@radui/ui 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/components/AlertDialog.js +1 -1
- package/dist/components/Combobox.js +1 -1
- package/dist/components/{ComboboxPrimitive-Ddp_PqU6.js → ComboboxPrimitive-D5wWLl2_.js} +1 -1
- package/dist/components/ContextMenu.d.ts +12 -0
- package/dist/components/ContextMenu.js +1 -1
- package/dist/components/Dialog.js +1 -1
- package/dist/components/DropdownMenu.js +1 -1
- package/dist/components/HoverCard.js +1 -1
- package/dist/components/MenuPrimitive-BvxwQFGM.js +1 -0
- package/dist/components/Menubar.js +1 -1
- package/dist/components/Select.js +1 -1
- package/dist/components/Slider.d.ts +3 -0
- package/dist/components/Slider.js +1 -1
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/floating-ui.react-gB901AP2.js +5 -0
- package/dist/components/index-BQ2Hbb_x.js +1 -0
- package/dist/components/{index-B77TeBat.js → index-BoRAvltW.js} +1 -1
- package/dist/themes/default.css +1 -1
- package/package.json +149 -13
- package/dist/components/MenuPrimitive-BnQil448.js +0 -1
- package/dist/components/floating-ui.react-DMgxgTKq.js +0 -5
- package/dist/components/index-W6-aam_B.js +0 -1
package/README.md
CHANGED
|
@@ -65,6 +65,37 @@ npm install @radui/ui
|
|
|
65
65
|
|
|
66
66
|
Rad UI works with modern React setups and is friendly to tokens, CSS variables, and custom theming strategies.
|
|
67
67
|
|
|
68
|
+
## Local development
|
|
69
|
+
|
|
70
|
+
The repository has two primary workflows:
|
|
71
|
+
|
|
72
|
+
- Component library: use `npm` from the repository root
|
|
73
|
+
- Documentation site: use `pnpm` inside `docs/`
|
|
74
|
+
|
|
75
|
+
Install root dependencies and run Storybook:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm install
|
|
79
|
+
npm run sb
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Run the docs app locally:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
cd docs
|
|
86
|
+
pnpm install
|
|
87
|
+
pnpm dev
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
To test local library changes inside the docs app, build and link the package from the repo root, then link it into `docs`:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npm run build:rollup
|
|
94
|
+
npm link
|
|
95
|
+
cd docs
|
|
96
|
+
pnpm link @radui/ui
|
|
97
|
+
```
|
|
98
|
+
|
|
68
99
|
## Philosophy
|
|
69
100
|
|
|
70
101
|
Rad UI is opinionated where bugs live and flexible where taste lives.
|
|
@@ -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 a,useRef as o,useEffect as i}from"react";import{c as l}from"./index-6If6D2Zi.js";import{c as n}from"./clsx-BaVHROc5.js";import{u as c}from"./index-wRElCyvx.js";import{D as d}from"./index-
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import{createContext as s,forwardRef as r,useState as t,useContext as a,useRef as o,useEffect as i}from"react";import{c as l}from"./index-6If6D2Zi.js";import{c as n}from"./clsx-BaVHROc5.js";import{u as c}from"./index-wRElCyvx.js";import{D as d}from"./index-BoRAvltW.js";import{F as m}from"./index-BQ2Hbb_x.js";import{P as p}from"./index-98jQ1vTr.js";import"./index-BOy86lYu.js";import"./ThemeContext-Sm-iNANd.js";import"./floating-ui.react-gB901AP2.js";import"react-dom";const h=s({rootClass:"",isOpen:!1,setIsOpen:()=>{},titleId:void 0,descriptionId:void 0,setTitleId:()=>{},setDescriptionId:()=>{}}),C="AlertDialog",u=r((({children:s,className:r="",customRootClass:a="",defaultOpen:o=!1,open:i,onOpenChange:m,...p},u)=>{const N=l(a,C),[f,g]=c(i,o,m),[D,I]=t(void 0),[y,A]=t(void 0),v={rootClass:N,isOpen:f,setIsOpen:g,titleId:D,descriptionId:y,setTitleId:I,setDescriptionId:A};return e(d.Root,{open:f,onOpenChange:g,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:o=!1,...i},l)=>{const{rootClass:c,titleId:m,descriptionId:p}=a(h);return e(d.Content,{ref:l,className:n(`${c}-content`,r),asChild:t,forceMount:o,role:"alertdialog","aria-modal":!0,"aria-labelledby":m,"aria-describedby":p,...i,children:s})}));N.displayName="AlertDialogContent";const f=r((({children:s,asChild:r,className:t="",disabled:o=!1,...i},l)=>{const{rootClass:c,isOpen:m}=a(h),p=m?"open":"closed",C=o?"":void 0;return e(d.Trigger,{ref:l,className:n(`${c}-trigger`,t),asChild:r,disabled:o,"data-state":p,"data-disabled":C,...i,children:s})}));f.displayName="AlertDialogTrigger";const g=({children:s,...r})=>e(d.Portal,{...r,children:s});g.displayName="AlertDialogPortal";const D=r((({className:s="",asChild:r=!1,forceMount:t=!1,children:o,...i},l)=>{const{rootClass:c}=a(h);return e(d.Overlay,{ref:l,className:n(`${c}-overlay`,s),asChild:r,forceMount:t,...i,children:o})}));D.displayName="AlertDialogOverlay";const I=r((({children:s,asChild:r,className:t="",...o},i)=>{const{rootClass:l}=a(h);return e(d.Cancel,{ref:i,className:`${l}-cancel ${t}`,asChild:r,...o,children:s})}));I.displayName="AlertDialogCancel";const y=r((({children:s,asChild:r,className:t="",...o},i)=>{const{rootClass:l}=a(h);return e(d.Action,{ref:i,className:`${l}-action ${t}`,asChild:r,...o,children:s})}));y.displayName="AlertDialogAction";const A=r((({children:s,className:r="",...t},o)=>{const{rootClass:i}=a(h);return e(d.Footer,{ref:o,className:n(`${i}-footer`,r),...t,children:s})}));A.displayName="AlertDialogFooter";const v=r((({children:s,className:r="",asChild:t=!1,id:l,...n},c)=>{const{rootClass:d,setTitleId:C,titleId:u}=a(h),N=m.useId(),f=l??N,g=o(f),D=o(u);return i((()=>{D.current=u}),[u]),i((()=>(g.current=f,f&&C(f),()=>{D.current===g.current&&C(void 0)})),[f,C]),e(p.h2,{ref:c,id:f,className:`${d}-title ${r}`,asChild:t,...n,children:s})}));v.displayName="AlertDialogTitle";const $=r((({children:s,className:r="",asChild:t=!1,id:l,...n},c)=>{const{rootClass:d,setDescriptionId:C,descriptionId:u}=a(h),N=m.useId(),f=l??N,g=o(f),D=o(u);return i((()=>{D.current=u}),[u]),i((()=>(g.current=f,f&&C(f),()=>{D.current===g.current&&C(void 0)})),[f,C]),e(p.p,{ref:c,id:f,className:`${d}-description ${r}`,asChild:t,...n,children:s})}));$.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=f,O.Overlay=D,O.Portal=g,O.Content=N,O.Title=v,O.Description=$,O.Footer=A,O.Cancel=I,O.Action=y;export{O as default};
|
|
@@ -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-D5wWLl2_.js";import{c as t}from"./index-6If6D2Zi.js";import{C as s}from"./check-DujVUWP-.js";import"./index-BQ2Hbb_x.js";import"./floating-ui.react-gB901AP2.js";import"react-dom";import"./index-98jQ1vTr.js";import"./index-CXzybYmm.js";import"./index-wRElCyvx.js";const i=o.createContext({rootClass:""}),n=o.forwardRef((({customRootClass:o,children:t,position:s="popper",...n},l)=>{const{rootClass:d}=e(i);return r(a.Content,{className:`${d}-content`,position:s,"data-position":s,ref:l,...n,children:t})}));n.displayName="ComboboxContent";const l=o.forwardRef((({customRootClass:o,children:t,value:s,disabled:n,...l},d)=>{const{rootClass:c}=e(i);return r(a.Item,{className:`${c}-item`,value:s,disabled:n,"data-disabled":n?"":void 0,role:"option","aria-disabled":n?"true":void 0,ref:d,...l,children:r("span",{className:`${c}-text`,children:t})})}));l.displayName="ComboboxItem";const d=o.forwardRef((({customRootClass:o,children:t,disabled:s,placeholder:n,...l},d)=>{const{rootClass:c}=e(i);return r(a.Trigger,{className:`${c}-trigger`,"aria-disabled":s?"true":void 0,"data-placeholder":n?"":void 0,disabled:s,ref:d,...l,children:t})}));d.displayName="ComboboxTrigger";const c=o.forwardRef((({customRootClass:o,children:e,defaultValue:s,value:n,onValueChange:l,shift:d,...c},m)=>{const f=t(o,"Combobox");return r(i.Provider,{value:{rootClass:f},children:r(a.Root,{className:`${f}-root`,defaultValue:s,value:n,onValueChange:l,shift:d,ref:m,...c,children:e})})}));c.displayName="ComboboxRoot";const m=o.forwardRef(((o,a)=>{const{rootClass:t}=e(i);return r("div",{className:`${t}-item-indicator`,ref:a,...o,children:r(s,{width:16,height:16})})}));m.displayName="ComboboxIndicator";const f=o.forwardRef((({children:o,container:e,...t},s)=>r(a.Portal,{ref:s,container:e,...t,children:o})));f.displayName="ComboboxPortal";const p=o.forwardRef((({children:o,...t},s)=>{const{rootClass:n}=e(i);return r(a.Group,{className:`${n}-group`,ref:s,...t,children:o})}));p.displayName="ComboboxGroup";const b=o.forwardRef(((o,t)=>{const{rootClass:s}=e(i);return r(a.Search,{className:`${s}-search`,ref:t,...o})}));b.displayName="ComboboxSearch";const u=o.forwardRef(((o,e)=>(console.warn("Direct usage of Combobox is not supported. Please use Combobox.Root, Combobox.Content, etc. instead."),null)));u.displayName="Combobox";const C=u;C.Root=c,C.Content=n,C.Item=l,C.Trigger=d,C.Portal=f,C.Group=p,C.Indicator=m,C.Search=b;export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import r,{createContext as s,useContext as a,useState as o,useEffect as i,useLayoutEffect as l}from"react";import{F as c}from"./index-
|
|
1
|
+
'use client';import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import r,{createContext as s,useContext as a,useState as o,useEffect as i,useLayoutEffect as l}from"react";import{F as c}from"./index-BQ2Hbb_x.js";import{P as d}from"./index-98jQ1vTr.js";import{c as u}from"./index-CXzybYmm.js";import{u as f}from"./index-wRElCyvx.js";const m=s({}),b=r.forwardRef((({children:n,className:r,...s},o)=>{const{isOpen:i,elementsRef:l,labelsRef:d,floatingContext:u,refs:f,getFloatingProps:b,floatingStyles:p}=a(m),h=c.useMergeRefs([f.setFloating,o]);return e(t,{children:i&&e(c.FocusManager,{context:u,children:e(c.FloatingList,{elementsRef:l,labelsRef:d,children:e("div",{ref:h,style:p,className:r,"data-state":i?"open":"closed",...b(),...s,children:n})})})})}));b.displayName="ComboboxPrimitiveContent";const p=s(null),h=r.forwardRef((({children:t,value:n,disabled:s,className:o,...i},l)=>{const u=a(m);if(!u)return console.error("ComboboxPrimitiveItem must be used within a ComboboxPrimitive"),null;const{handleSelect:f,isTypingRef:b,getItemProps:h,activeIndex:v,selectedIndex:R,virtualItemRef:g,selectedItemRef:x,hasSearch:I,search:C,hiddenIndices:y,disabledIndices:S,setDisabledIndices:P,valuesRef:N,bumpLabelsVersion:w}=u,M=r.useRef(null),{ref:k,index:D}=c.useListItem({label:n}),E=y.includes(D),F=v===D,L=R===D,O=n||`select-item-${D}`,T=a(p);return r.useEffect((()=>{if(T?.registerItem)return T.registerItem(O,!E)}),[T,O,E]),r.useEffect((()=>(N.current[D]=O,()=>{delete N.current[D]})),[D,O,N]),r.useEffect((()=>(w(),()=>{w()})),[D,n,w]),r.useEffect((()=>{const e=D;return P((t=>{if(s&&t.includes(e))return t;if(!s&&!t.includes(e))return t;const n=new Set(t);return s?n.add(e):n.delete(e),Array.from(n).sort(((e,t)=>e-t))})),()=>{P((t=>{if(!t.includes(e))return t;const n=new Set(t);return n.delete(e),Array.from(n).sort(((e,t)=>e-t))}))}}),[D,s,P]),r.useEffect((()=>{L&&!I&&(x.current=M.current)}),[L,I,x]),e(d.div,{ref:c.useMergeRefs([k,M,l]),id:O,role:"option",className:o,style:{display:E?"none":void 0,...i.style},"data-value":n,"data-label":n,"data-active":I?g.current?.id==O:F,"aria-selected":L,"aria-disabled":!!s||void 0,"data-disabled":s?"":void 0,...h({tabIndex:s?-1:F?0:-1,onClick:()=>!s&&f(D),onKeyDown:e=>{s||("Enter"===e.key&&(e.preventDefault(),f(D))," "!==e.key||b.current||(e.preventDefault(),f(D)))}}),...i,tabIndex:s?-1:F?0:-1,children:t})}));h.displayName="ComboboxPrimitiveItem";const v=r.forwardRef((({children:t,className:n,disabled:r,asChild:s,onClick:o,...i},l)=>{const{isOpen:f,setIsOpen:b,selectedLabel:p,refs:h,getReferenceProps:v}=a(m),{onClick:R,...g}=v(),x=u(o,(()=>{r||b((e=>!e))}));return e(d.button,{type:s?void 0:"button",className:n,"aria-expanded":f,"data-state":f?"open":"closed","aria-disabled":!!r||void 0,disabled:!!r||void 0,ref:c.useMergeRefs([h.setReference,l]),role:"combobox",asChild:s,onClick:x,...g,...i,children:p||t})}));v.displayName="ComboboxPrimitiveTrigger";const R=r.forwardRef((({children:t,className:s,value:a,name:u,defaultValue:b="",onValueChange:p,onClickOutside:h=()=>{},placement:v="bottom-start",offsetValue:R,shift:g=!0,...x},I)=>{const[C,y]=r.useState(!1),[S,P]=r.useState(R),[N,w]=f(a,b,p),M=r.useRef(null),k=r.useRef([]),D=r.useRef([]),E=r.useRef([]),[F,L]=r.useState([]),O=r.useRef(!1),T=r.useRef(null),V=r.useRef(null),[j,A]=r.useState(null),[B,G]=r.useState(null),[H,K]=r.useState(!1),[q,z]=r.useState(""),[$,J]=r.useReducer((e=>e+1),0),Q=r.useMemo((()=>{if(!q)return[];const e=[];for(let t=0;t<D.current.length;t++){const n=D.current[t];n&&!n.toLowerCase().includes(q.toLowerCase())&&e.push(t)}return e}),[q,$]),U=r.useMemo((()=>{const e=new Set([...F,...Q]);return Array.from(e).sort(((e,t)=>e-t))}),[F,Q]),W=function(e){const[t,n]=o(!1);return i((()=>{if(!e)return void n(!1);let t=e;for(;t;){if("FORM"===t.tagName)return void n(!0);t=t.parentElement}n(!1)}),[e]),t}(T.current),{refs:X,floatingStyles:Y,context:Z}=c.useFloating({middleware:[c.offset(S)],open:C,onOpenChange:y,placement:v}),_=c.useClick(Z),ee=c.useDismiss(Z),te=c.useRole(Z,{role:"listbox"});const ne=r.useCallback((e=>{if(null!==e&&!U.includes(e)&&(G(e),y(!1),X.reference.current?.focus(),null!==e)){const t=D.current[e];t&&w(t)}}),[U,D,G,y,w,X]),re=c.useListNavigation(Z,{listRef:k,activeIndex:j,selectedIndex:B,onNavigate:A,virtual:H,virtualItemRef:V,disabledIndices:U}),se=c.useTypeahead(Z,{listRef:D,activeIndex:j,selectedIndex:B,enabled:!H,onMatch:function(e){null===e||U.includes(e)||(C?A(e):ne(e))},onTypingChange(e){O.current=e}}),{getReferenceProps:ae,getFloatingProps:oe,getItemProps:ie}=c.useInteractions([_,ee,te,re,se]);l((()=>{if(g&&M&&X.floating.current&&M.current){const e=X.floating.current.getBoundingClientRect(),t=M.current.getBoundingClientRect(),n=e.top-t.bottom;P(n)}}),[M.current,g]);const le=r.useMemo((()=>({isOpen:C,setIsOpen:y,handleSelect:ne,floatingContext:Z,refs:X,getFloatingProps:oe,getReferenceProps:ae,floatingStyles:Y,getItemProps:ie,activeIndex:j,selectedIndex:B,elementsRef:k,labelsRef:D,valuesRef:E,disabledIndices:F,setDisabledIndices:L,setActiveIndex:A,selectedLabel:N,isTypingRef:O,virtualItemRef:V,hasSearch:H,setHasSearch:K,search:q,setSearch:z,hiddenIndices:Q,selectedItemRef:M,labelsVersion:$,bumpLabelsVersion:J})),[C,ne,Z,X,oe,ae,Y,ie,j,B,F,N,H,q,Q,$]);return e(m.Provider,{value:le,children:n(d.div,{...x,className:s,ref:c.useMergeRefs([T,I]),"data-state":C?"open":"closed",children:[t,W&&e("select",{name:u,value:N,hidden:!0,"aria-hidden":"true",tabIndex:-1,onChange:()=>{},children:e("option",{value:N,children:N})})]})})}));R.displayName="ComboboxPrimitiveRoot";const g=r.forwardRef((({children:t,container:n,...r},s)=>{const{isOpen:l}=a(m),[d,u]=o(!1),f=n||document.querySelector("#rad-ui-theme-container")||document.body;return i((()=>{f&&u(!0)}),[f]),l&&d?e(c.Portal,{root:f,...r,children:t}):null}));g.displayName="ComboboxPrimitivePortal";const x=r.forwardRef((({children:t,className:n,...s},a)=>{const[o,i]=r.useState(new Set),{search:l}=r.useContext(m),c=r.useCallback(((e,t)=>(i((n=>{if(t&&n.has(e))return n;if(!t&&!n.has(e))return n;const r=new Set(n);return t?r.add(e):r.delete(e),r})),()=>{i((t=>{if(!t.has(e))return t;const n=new Set(t);return n.delete(e),n}))})),[]),d=o.size>0,u=""!==l&&!d,f=r.useMemo((()=>({registerItem:c})),[c]);return e(p.Provider,{value:f,children:e("div",{className:n,ref:a,...s,style:{display:u?"none":void 0,...s.style},children:t})})}));x.displayName="ComboboxPrimitiveGroup";const I=r.forwardRef((({className:t,...n},s)=>{const o=a(m),{refs:i,handleSelect:l,labelsRef:u,valuesRef:f,activeIndex:b,elementsRef:p,virtualItemRef:h,getReferenceProps:v,setHasSearch:R,search:g,setSearch:x,setActiveIndex:I}=o,C=r.useRef(null);r.useEffect((()=>(R(!0),I(0),()=>{R(!1),x("")})),[R,I,x]);const y=v();return e(d.input,{type:"search",className:t,placeholder:"Search...",ref:c.useMergeRefs([C,s]),value:g,"aria-activedescendant":h.current?.id||(null!==b&&f.current[b]?f.current[b]:void 0),onChange:e=>x(e.target.value),...y,onKeyDown:e=>{null!==b&&"Enter"===e.key&&(e.preventDefault(),l(b))},...n})}));I.displayName="ComboboxPrimitiveSearch";const C=r.forwardRef(((e,t)=>(console.warn("Direct usage of Combobox is not supported. Please use Combobox.Root, Combobox.Content, etc. instead."),null)));C.displayName="ComboboxPrimitive";const y=C;y.Root=R,y.Content=b,y.Portal=g,y.Item=h,y.Trigger=v,y.Group=x,y.Search=I;export{y as C};
|
|
@@ -7,11 +7,15 @@ type ContextMenuRootProps = {
|
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
customRootClass?: string;
|
|
9
9
|
className?: string;
|
|
10
|
+
variant?: 'default' | 'soft' | 'outline';
|
|
11
|
+
size?: 'small' | 'medium' | 'large';
|
|
10
12
|
} & ComponentPropsWithoutRef<typeof MenuPrimitive.Root>;
|
|
11
13
|
declare const ContextMenuRoot: React.ForwardRefExoticComponent<{
|
|
12
14
|
children: React.ReactNode;
|
|
13
15
|
customRootClass?: string;
|
|
14
16
|
className?: string;
|
|
17
|
+
variant?: "default" | "soft" | "outline";
|
|
18
|
+
size?: "small" | "medium" | "large";
|
|
15
19
|
} & Omit<{
|
|
16
20
|
children: React.ReactNode;
|
|
17
21
|
className?: string;
|
|
@@ -49,10 +53,18 @@ type MenuPrimitiveContentProps = {
|
|
|
49
53
|
type ContextMenuContentProps = {
|
|
50
54
|
children: React.ReactNode;
|
|
51
55
|
className?: string;
|
|
56
|
+
/** Visual style variant of the content panel */
|
|
57
|
+
variant?: 'default' | 'soft' | 'outline';
|
|
58
|
+
/** Size of the content panel */
|
|
59
|
+
size?: 'small' | 'medium' | 'large';
|
|
52
60
|
} & ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;
|
|
53
61
|
declare const ContextMenuContent: React.ForwardRefExoticComponent<{
|
|
54
62
|
children: React.ReactNode;
|
|
55
63
|
className?: string;
|
|
64
|
+
/** Visual style variant of the content panel */
|
|
65
|
+
variant?: "default" | "soft" | "outline";
|
|
66
|
+
/** Size of the content panel */
|
|
67
|
+
size?: "small" | "medium" | "large";
|
|
56
68
|
} & Omit<MenuPrimitiveContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
57
69
|
|
|
58
70
|
type ContextMenuPortalProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import e,{forwardRef as t}from"react";import{jsx as n}from"react/jsx-runtime";import{M as o}from"./MenuPrimitive-
|
|
1
|
+
'use client';import e,{forwardRef as t}from"react";import{jsx as n}from"react/jsx-runtime";import{M as o,a as s}from"./MenuPrimitive-BvxwQFGM.js";import{c as r}from"./index-6If6D2Zi.js";import{c as a}from"./clsx-BaVHROc5.js";import{u}from"./index-wRElCyvx.js";import{u as i}from"./floating-ui.react-gB901AP2.js";import{c as l}from"./index-3dZuI04X.js";import c from"./Separator.js";import"./index-BQ2Hbb_x.js";import"./index-98jQ1vTr.js";import"./index-BOy86lYu.js";import"react-dom";const m=e.createContext(null),d="ContextMenu",C=t((({children:e,customRootClass:t,className:s,open:i,defaultOpen:l=!1,onOpenChange:c,variant:C,size:x,...p},h)=>{const[f,g]=u(i,l,c),M=r(t,d);return n(m.Provider,{value:{rootClass:M,setIsOpen:g,variant:C,size:x},children:n(o.Root,{ref:h,className:a(`${M}-root`,s),open:f,onOpenChange:g,...p,children:e})})}));C.displayName=d;const x=t((({children:t,className:r,...u},l)=>{const c=e.useContext(m),d=e.useContext(s),C=e.useRef(null),x=i([C,l]);if(!c)return console.warn("ContextMenuTrigger should be used in the ContextMenuRoot"),null;const{rootClass:p,setIsOpen:h}=c,f=(e,t)=>{d?.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(`${p}-trigger`,r),asChild:!0,...u,children:n("span",{ref:x,onContextMenu:e=>{e.preventDefault(),f(e.clientX,e.clientY)},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){if(e.preventDefault(),!C.current)return;const t=C.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})})}));x.displayName="ContextMenuTrigger";const p=t((({children:t,className:s,variant:r,size:u,...i},c)=>{const d=e.useContext(m);if(!d)return console.warn("ContextMenuContent should be used in the ContextMenuRoot"),null;const{rootClass:C}=d,x=r??d.variant,p=u??d.size,h=l("context-menu-content",{variant:x,size:p});return n(o.Content,{ref:c,className:a(`${C}-content`,s),...h,...i,children:t})}));p.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}-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}-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}-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=C,b.Trigger=x,b.Content=p,b.Portal=h,b.Item=f,b.Sub=g,b.SubTrigger=M,b.Separator=N;export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{createContext as s,forwardRef as e,useContext as o}from"react";import{jsx as a}from"react/jsx-runtime";import{D as r}from"./index-
|
|
1
|
+
'use client';import{createContext as s,forwardRef as e,useContext as o}from"react";import{jsx as a}from"react/jsx-runtime";import{D as r}from"./index-BoRAvltW.js";import{c as l}from"./clsx-BaVHROc5.js";import{c as t}from"./index-6If6D2Zi.js";import{P as i}from"./index-98jQ1vTr.js";import"./index-BQ2Hbb_x.js";import"./floating-ui.react-gB901AP2.js";import"react-dom";import"./index-BOy86lYu.js";import"./ThemeContext-Sm-iNANd.js";const n=s({rootClass:""}),c="Dialog",m=e((({children:s,customRootClass:e="",className:o="",...i},m)=>{const d=t(e,c),p={rootClass:d};return a(r.Root,{ref:m,className:l(d,o),...i,children:a(n.Provider,{value:p,children:s})})}));m.displayName=c;const d=e((({children:s,asChild:e,className:t="",...i},c)=>{const{rootClass:m}=o(n);return a(r.Trigger,{ref:c,className:l(`${m}-trigger`,t),asChild:e,...i,children:s})}));d.displayName="DialogTrigger";const p=e((({children:s,...e},o)=>a(r.Portal,{...e,children:s})));p.displayName="DialogPortal";const N=e((({className:s="",...e},t)=>{const{rootClass:i}=o(n);return a(r.Overlay,{ref:t,className:l(`${i}-overlay`,s),...e})}));N.displayName="DialogOverlay";const g=e((({children:s,className:e="",...t},i)=>{const{rootClass:c}=o(n);return a(r.Content,{ref:i,className:l(`${c}-content`,e),...t,children:s})}));g.displayName="DialogContent";const h=e((({children:s,className:e="",...r},t)=>{const{rootClass:c}=o(n);return a(i.h2,{ref:t,className:l(`${c}-title`,e),...r,children:s})}));h.displayName="DialogTitle";const C=e((({children:s,className:e="",...r},t)=>{const{rootClass:c}=o(n);return a(i.p,{ref:t,className:l(`${c}-description`,e),...r,children:s})}));C.displayName="DialogDescription";const f=e((({children:s,asChild:e,className:t="",...i},c)=>{const{rootClass:m}=o(n);return a(r.Cancel,{ref:c,className:l(`${m}-close`,t),asChild:e,...i,children:s})}));f.displayName="DialogClose";const u=e((({children:s,className:e="",...t},i)=>{const{rootClass:c}=o(n);return a(r.Footer,{ref:i,className:l(`${c}-footer`,e),...t,children:s})}));u.displayName="DialogFooter";const D=e(((s,e)=>(console.warn("Direct usage of Dialog is not supported. Please use Dialog.Root, Dialog.Content, etc. instead."),null)));D.displayName="Dialog";const y=D;y.Root=m,y.Trigger=d,y.Portal=p,y.Overlay=N,y.Content=g,y.Title=h,y.Description=C,y.Footer=u,y.Close=f;export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import o,{forwardRef as e}from"react";import{jsx as n}from"react/jsx-runtime";import{M as r}from"./MenuPrimitive-
|
|
1
|
+
'use client';import o,{forwardRef as e}from"react";import{jsx as n}from"react/jsx-runtime";import{M as r}from"./MenuPrimitive-BvxwQFGM.js";import{c as t}from"./index-6If6D2Zi.js";import{c as s}from"./clsx-BaVHROc5.js";import a from"./Separator.js";import"./index-BQ2Hbb_x.js";import"./floating-ui.react-gB901AP2.js";import"react-dom";import"./index-wRElCyvx.js";import"./index-98jQ1vTr.js";import"./index-BOy86lYu.js";const l=o.createContext(null),u="DropdownMenu",i=e((({children:o,customRootClass:e,className:a,...i},c)=>{const d=t(e,u);return n(l.Provider,{value:{rootClass:d},children:n(r.Root,{ref:c,className:s(`${d}-root`,a),...i,children:o})})}));i.displayName=u;const c=e((({children:e,className:t,...a},u)=>{const i=o.useContext(l);if(!i)return console.warn("DropdownMenuTrigger should be used in the DropdownMenuRoot"),null;const{rootClass:c}=i;return n(r.Trigger,{ref:u,className:s(`${c}-trigger`,t),...a,children:e})}));c.displayName="DropdownMenuTrigger";const d=e((({children:e,className:t,...a},u)=>{const i=o.useContext(l);if(!i)return console.warn("DropdownMenuContent should be used in the DropdownMenuRoot"),null;const{rootClass:c}=i;return n(r.Content,{ref:u,className:s(`${c}-content`,t),...a,children:e})}));d.displayName="DropdownMenuContent";const p=e((({children:e,...t},s)=>{const a=o.useContext(l);if(!a)return console.warn("DropdownMenuPortal should be used in the DropdownMenuRoot"),null;const{rootClass:u}=a;return n(r.Portal,{ref:s,...t,children:e})}));p.displayName="DropdownMenuPortal";const m=e((({children:e,className:t,label:a,...u},i)=>{const c=o.useContext(l);if(!c)return console.warn("DropdownMenuItem should be used in the DropdownMenuRoot"),null;const{rootClass:d}=c;return n(r.Item,{ref:i,className:s(`${d}-item`,t),label:a,...u,children:e})}));m.displayName="DropdownMenuItem";const w=e((({children:e,className:t,...a},u)=>{const i=o.useContext(l);if(!i)return console.warn("DropdownMenuSub should be used in the DropdownMenuRoot"),null;const{rootClass:c}=i;return n(r.Sub,{ref:u,className:s(`${c}-sub`,t),...a,children:e})}));w.displayName="DropdownMenuSub";const h=e((({children:e,className:t,...a},u)=>{const i=o.useContext(l);if(!i)return console.warn("DropdownMenuSubTrigger should be used in the DropdownMenuRoot"),null;const{rootClass:c}=i;return n(r.Trigger,{ref:u,className:s(`${c}-sub-trigger`,t),...a,children:e})}));h.displayName="DropdownMenuSubTrigger";const M=e((({className:e,...r},t)=>{const s=o.useContext(l);if(!s)return console.warn("DropdownMenuSeparator should be used within DropdownMenuRoot"),null;const{rootClass:u}=s;return n(a,{ref:t,customRootClass:u,className:e,...r})}));M.displayName="DropdownMenuSeparator";const D=e(((o,e)=>(console.warn("Direct usage of DropdownMenu is not supported. Please use DropdownMenu.Root, DropdownMenu.Item instead."),null)));D.displayName="DropdownMenu",D.Root=i,D.Trigger=c,D.Content=d,D.Portal=p,D.Item=m,D.Sub=w,D.SubTrigger=h,D.Separator=M;export{D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{createContext as e,forwardRef as r,useRef as o,useState as t,useEffect as s,useContext as n}from"react";import{jsx as a}from"react/jsx-runtime";import{F as l}from"./index-
|
|
1
|
+
'use client';import{createContext as e,forwardRef as r,useRef as o,useState as t,useEffect as s,useContext as n}from"react";import{jsx as a}from"react/jsx-runtime";import{F as l}from"./index-BQ2Hbb_x.js";import{c as i}from"./index-6If6D2Zi.js";import{u as c}from"./index-wRElCyvx.js";import{c as u}from"./clsx-BaVHROc5.js";import{P as m}from"./index-98jQ1vTr.js";import{T as d}from"./ThemeContext-Sm-iNANd.js";import"./floating-ui.react-gB901AP2.js";import"react-dom";const f=e({}),g="HoverCard",p=r((({children:e,open:r,onOpenChange:n,customRootClass:m="",openDelay:d=100,closeDelay:p=200,...C},y)=>{const h=i(m,g),v=i(m,`${g}-trigger`),R=o(null),{refs:x,floatingStyles:T,context:w}=l.useFloating({placement:"bottom",strategy:"fixed",middleware:[l.arrow({element:R}),l.offset(10),l.flip({mainAxis:!0})]}),[N,P]=c(r,!1,n),[D,H]=t(!1),j=o(null),W=o(null),E=e=>{P(e)},F=l.useRole(w),M=l.useDismiss(w),A=l.useHover(w,{delay:100}),{getReferenceProps:L,getFloatingProps:O}=l.useInteractions([A,F,M]);s((()=>()=>{j.current&&clearTimeout(j.current),W.current&&clearTimeout(W.current)}),[]);const S={isOpen:N,handleOpenChange:E,floatingRefs:x,floatingStyles:T,floatingContext:w,arrowRef:R,getReferenceProps:L,getFloatingProps:O,rootClass:h,rootTriggerClass:v,closeWithDelay:()=>{H(!0),W.current&&clearTimeout(W.current),W.current=setTimeout((()=>{H((e=>(e&&E(!1),e)))}),p)},closeWithoutDelay:()=>{E(!1)},openWithDelay:()=>{H(!1),j.current&&clearTimeout(j.current),j.current=setTimeout((()=>{E(!0)}),d)}};return a(f.Provider,{value:S,children:a("div",{ref:y,className:u(h),...C,children:e})})}));p.displayName=g;const C=r((({children:e,className:r="",...o},t)=>{const{floatingRefs:s,closeWithDelay:i,openWithDelay:c,rootTriggerClass:d}=n(f),g=l.useMergeRefs([s.setReference,t]);return a(m.span,{className:u(d,r),onClick:()=>{},onMouseEnter:c,onMouseLeave:i,ref:g,...o,children:e})}));C.displayName="HoverCardTrigger";const y=r((({children:e,rootElement:r,...o},t)=>{const{rootTriggerClass:s}=n(f),i=n(d),c=r||i?.portalRootRef.current||document.querySelector("[data-rad-ui-portal-root]")||i?.containerRef.current||document.getElementsByClassName(s)[0];return a(l.Portal,{root:c,...o,children:e})}));y.displayName="HoverCardPortal";const h=r((({children:e,className:r,...o},t)=>{const{isOpen:i,floatingRefs:c,floatingStyles:m,getFloatingProps:d,rootClass:g,closeWithDelay:p,closeWithoutDelay:C,openWithDelay:y}=n(f);s((()=>{const e=()=>C();return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[C]);const h=l.useMergeRefs([c.setFloating,t]);return i?a("div",{onPointerEnter:y,onPointerLeave:p,className:u(g,r),ref:h,style:m,...o,...d(),children:e}):null}));h.displayName="HoverCardContent";const v=r(((e,r)=>{const{floatingContext:o,arrowRef:t,rootClass:s}=n(f),i=l.useMergeRefs([t,r]);return a(l.Arrow,{className:u(`${s}-arrow`),...e,context:o,ref:i})}));v.displayName="HoverCardArrow";const R=r(((e,r)=>(console.warn("Direct usage of HoverCard is not supported. Please use HoverCard.Root, HoverCard.Trigger, etc. instead."),null)));R.displayName="HoverCard",R.Root=p,R.Trigger=C,R.Portal=y,R.Content=h,R.Arrow=v;export{R as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use client';import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import s,{forwardRef as i,useState as l,useRef as o,useContext as a,useEffect as r}from"react";import{F as c}from"./index-BQ2Hbb_x.js";import{u as d}from"./index-wRElCyvx.js";import{P as u}from"./index-98jQ1vTr.js";import{B as f}from"./index-BOy86lYu.js";const m=s.createContext(null),p=i((({children:t,className:n,open:i,onOpenChange:a,defaultOpen:r=!1,crossAxisOffset:u,mainAxisOffset:f,loop:p=!0,placement:g="bottom-start",avoidCollision:h=!0,rtl:v=!1,...x},N)=>{const[P,y]=d(i,r,a),[I,C]=l(null),[O,b]=l(void 0),R=o([]),F=o([]),M=o([]),A=o(null),k=c.useFloatingNodeId(),S=c.useFloatingParentNodeId(),T=null!=S,j=u??0,w=void 0!==f?f:T?2:4,{refs:H,floatingStyles:L,context:E}=c.useFloating({open:P,nodeId:k,onOpenChange:y,strategy:"fixed",placement:T?"right-start":g,middleware:[c.offset({mainAxis:w,crossAxis:j}),c.flip({mainAxis:h,crossAxis:h}),c.shift({padding:4}),...T?[]:[c.size({padding:4,apply({availableHeight:e,elements:t}){b(e),t.floating.style.maxHeight=`${e}px`}})]],whileElementsMounted:c.autoUpdate}),D=c.useListNavigation(E,{listRef:F,activeIndex:I,nested:T,rtl:v,loop:p,onNavigate:C}),q=c.useClick(E,{}),z=c.useHover(E,{enabled:T,delay:{open:75},handleClose:c.safePolygon({blockPointerEvents:!0})}),B=c.useDismiss(E,{bubbles:!0}),U=c.useTypeahead(E,{listRef:M,onMatch:P?C:void 0,activeIndex:I}),{getReferenceProps:X,getFloatingProps:Y,getItemProps:$}=c.useInteractions([B,q,D,z,U]),G={isOpen:P,setIsOpen:y,refs:H,floatingStyles:L,maxHeight:O,getReferenceProps:X,getFloatingProps:Y,getItemProps:$,activeIndex:I,setActiveIndex:C,listRef:R,elementsRef:F,labelsRef:M,virtualItemRef:A,nodeId:k,isNested:T,floatingContext:E,rtl:v},J=c.useFloatingTree();return s.useEffect((()=>{if(J)return J.events.on("click",e),()=>{J.events.off("click",e)};function e(){y(!1)}}),[J,k,S]),e("div",{ref:N,className:n,"data-tree":"true",...x,children:e(m.Provider,{value:G,children:e(c.FloatingNode,{id:k,children:t})})})}));p.displayName="MenuComponentRoot";const g=i((({children:t,className:n,open:s,onOpenChange:i,defaultOpen:l=!1,crossAxisOffset:o,mainAxisOffset:a,...r},d)=>e(c.FloatingTree,{children:e(p,{ref:d,className:n,open:s,onOpenChange:i,defaultOpen:l,crossAxisOffset:o,mainAxisOffset:a,...r,children:t})})));g.displayName="MenuPrimitiveRoot";const h=i((({children:t,className:n,label:i,disabled:l,asChild:o=!1,onSelect:a,...r},d)=>{const f=s.useContext(m),p=l?null:i,{ref:g,index:h}=c.useListItem({label:p}),v=c.useFloatingTree(),x=s.useCallback((e=>{"function"==typeof g?g(e):g&&(g.current=e),"function"==typeof d?d(e):d&&(d.current=e)}),[g,d]);if(!f)return null;const{activeIndex:N,getItemProps:P}=f,y=N===h;return e(u.button,{ref:x,tabIndex:y?0:-1,className:n,...P({onClick(e){l||(a?a(e):v?.events.emit("click"))}}),disabled:l,asChild:o,...r,children:t})}));h.displayName="MenuPrimitiveItem";const v=i((({children:t,className:n,asChild:s,...i},l)=>{const o=a(m),{ref:r,index:d}=c.useListItem(),u=c.useMergeRefs([o?.refs.setReference,r,l]);if(!o)return null;const{activeIndex:p,getReferenceProps:g,isNested:h}=o;return e(f,{className:n,tabIndex:h?p===d?0:-1:void 0,ref:u,...g(),asChild:s,...i,children:t})}));v.displayName="MenuPrimitiveTrigger";const x=i((({children:s,className:i,...l},o)=>{const r=a(m),d=c.useMergeRefs([r?.refs.setFloating,o]);if(!r||!r.isOpen)return null;const{floatingStyles:u,getFloatingProps:f,elementsRef:p,labelsRef:g,isNested:h,floatingContext:v}=r;return t(n,{children:[e(c.Overlay,{lockScroll:!0}),e(c.FloatingList,{elementsRef:p,labelsRef:g,children:e(c.FocusManager,{context:v,modal:!1,initialFocus:h?-1:0,returnFocus:!h,children:e("div",{ref:d,style:u,...f(),className:i,...l,children:e("div",{style:{overflowY:"auto",overflowX:"hidden"},children:s})})})})]})}));x.displayName="MenuPrimitiveContent";const N=i((({children:t,className:n,open:s,onOpenChange:i,defaultOpen:l=!1,...o},r)=>{const c=a(m);return e(p,{ref:r,className:n,open:s,onOpenChange:i,defaultOpen:l,rtl:c&&c.rtl||!1,...o,children:t})}));N.displayName="MenuPrimitiveSub";const P=i((({children:t,...n},s)=>{const i=a(m),[o,d]=l(!1),u=document.querySelector("#rad-ui-theme-container")||document.body;if(r((()=>{u&&d(!0)}),[u]),!i)return null;const{isOpen:f}=i;return f&&o?e(c.Portal,{root:u,...n,children:e("div",{ref:s,children:t})}):null}));P.displayName="MenuPrimitivePortal";const y=()=>(console.warn("Direct usage of MenuPrimitive is not supported. Please use MenuPrimitive.Root, MenuPrimitive.Item instead."),null);y.Root=g,y.Item=h,y.Trigger=v,y.Content=x,y.Sub=N,y.Portal=P;export{y as M,m as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import t,{forwardRef as n}from"react";import{c as r}from"./index-6If6D2Zi.js";import{c as o}from"./clsx-BaVHROc5.js";import{F as s}from"./index-
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import t,{forwardRef as n}from"react";import{c as r}from"./index-6If6D2Zi.js";import{c as o}from"./clsx-BaVHROc5.js";import{F as s}from"./index-BQ2Hbb_x.js";import{M as a}from"./MenuPrimitive-BvxwQFGM.js";import u from"./Separator.js";import"./floating-ui.react-gB901AP2.js";import"react-dom";import"./index-wRElCyvx.js";import"./index-98jQ1vTr.js";import"./index-BOy86lYu.js";const l=t.createContext(null),i=n((({children:n,customRootClass:a,className:u,dir:i,loop:c,...d},m)=>{const b=r(a,"Menubar"),[p,h]=t.useState([]),[M,f]=t.useState(0),g=(e,t)=>{h((n=>n.map((n=>n.id===e?{...n,state:t}:n))))};return e(l.Provider,{value:{rootClass:b,registerItem:(e,t="closed")=>{h((n=>n.find((t=>t.id===e))?n.map((n=>n.id===e?{...n,state:t}:n)):[...n,{id:e,state:t}]))},items:p,updateItemState:g},children:e(s.Composite,{ref:m,className:o(`${b}-root`,u),dir:i,loop:c,...d,activeIndex:M,onNavigate:e=>{const t=p[M],n=p[e];if(t&&g(t.id,"closed"),n){const e="open"===t?.state;g(n.id,e?"open":"closed")}f(e)},children:n})})}));i.displayName="MenubarRoot";const c=t.createContext(null),d=n((({children:n,className:r,...u},i)=>{const d=t.useContext(l),m=t.useContext(c);if(!d)return console.warn("MenubarTrigger should be used in the MenubarRoot"),null;const{rootClass:b}=d;if(!m)return console.warn("MenubarTrigger should be used in the MenubarMenu"),null;const{isOpen:p}=m;return e(s.CompositeItem,{render:()=>e(a.Trigger,{ref:i,className:o(`${b}-trigger`,r),"data-active":p,...u,children:n})})}));d.displayName="MenubarTrigger";const m=n((({children:n,className:r,...s},u)=>{const i=t.useContext(l);if(!i)return console.warn("MenubarContent should be used in the MenubarRoot"),null;const{rootClass:c}=i;return e(a.Content,{ref:u,className:o(`${c}-content`,r),...s,children:n})}));m.displayName="MenubarContent";const b=n((({children:n,...r},o)=>t.useContext(l)?e(a.Portal,{ref:o,...r,children:n}):(console.warn("MenubarPortal should be used in the MenubarRoot"),null)));b.displayName="MenubarPortal";const p=n((({children:n,className:r,label:s,...u},i)=>{const c=t.useContext(l);if(!c)return console.warn("MenubarItem should be used in the MenubarRoot"),null;const{rootClass:d}=c;return e(a.Item,{ref:i,className:o(`${d}-item`,r),label:s,...u,children:n})}));p.displayName="MenubarItem";const h=n((({children:n,className:r,...s},u)=>{const i=t.useContext(l);if(!i)return console.warn("MenubarSub should be used in the MenubarRoot"),null;const{rootClass:c}=i;return e(a.Sub,{ref:u,className:o(`${c}-sub`,r),...s,children:n})}));h.displayName="MenubarSub";const M=n((({children:n,className:r,...s},u)=>{const i=t.useContext(l);if(!i)return console.warn("MenubarSubTrigger should be used in the MenubarRoot"),null;const{rootClass:c}=i;return e(a.Trigger,{ref:u,className:o(`${c}-sub-trigger`,r),...s,children:n})}));M.displayName="MenubarSubTrigger";const f=n((({children:n,className:r,...u},i)=>{const d=t.useContext(l),m=s.useId();if(!d)return console.warn("MenubarMenu should be used in the MenubarRoot"),null;const{rootClass:b,registerItem:p,items:h,updateItemState:M}=d;t.useEffect((()=>{m&&p(m)}),[m]);const f="open"===h.find((e=>e.id===m))?.state;return e(a.Root,{ref:i,className:o(`${b}-menu`,r),"data-id":m,"data-active":f,open:f,onOpenChange:e=>m&&M(m,e?"open":"closed"),...u,children:e(c.Provider,{value:{isOpen:f},children:n})})}));f.displayName="MenubarMenu";const g=n((({className:n,...r},o)=>{const s=t.useContext(l);if(!s)return console.warn("MenubarSeparator should be used within MenubarRoot"),null;const{rootClass:a}=s;return e(u,{ref:o,customRootClass:a,className:n,...r})}));g.displayName="MenubarSeparator";const C=()=>(console.warn("Direct usage of Menubar is not supported. Please use Menubar.Root, Menubar.Item instead."),null);C.Root=i,C.Menu=f,C.Trigger=d,C.Content=m,C.Portal=b,C.Item=p,C.Sub=h,C.SubTrigger=M,C.Separator=g;export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import e,{useContext as o}from"react";import{jsx as t}from"react/jsx-runtime";import{C as r}from"./ComboboxPrimitive-
|
|
1
|
+
'use client';import e,{useContext as o}from"react";import{jsx as t}from"react/jsx-runtime";import{C as r}from"./ComboboxPrimitive-D5wWLl2_.js";import{c as a}from"./index-6If6D2Zi.js";import{C as s}from"./check-DujVUWP-.js";import"./index-BQ2Hbb_x.js";import"./floating-ui.react-gB901AP2.js";import"react-dom";import"./index-98jQ1vTr.js";import"./index-CXzybYmm.js";import"./index-wRElCyvx.js";const i=e.createContext({rootClass:""}),l=e.forwardRef((({customRootClass:e,children:a,position:s="popper",...l},n)=>{const{rootClass:c}=o(i);return t(r.Content,{className:`${c}-content`,position:s,"data-position":s,ref:n,...l,children:a})}));l.displayName="SelectContent";const n=e.forwardRef((({customRootClass:e,children:a,value:s,disabled:l,...n},c)=>{const{rootClass:d}=o(i);return t(r.Item,{className:`${d}-item`,value:s,disabled:l,"data-disabled":l?"":void 0,role:"option","aria-disabled":l?"true":void 0,ref:c,...n,children:t("span",{className:`${d}-text`,children:a})})}));n.displayName="SelectItem";const c=e.forwardRef((({customRootClass:e,children:a,disabled:s,placeholder:l,...n},c)=>{const{rootClass:d}=o(i);return t(r.Trigger,{className:`${d}-trigger`,"aria-disabled":s?"true":void 0,"data-placeholder":l?"":void 0,disabled:s,ref:c,...n,children:a})}));c.displayName="SelectTrigger";const d=e.forwardRef((({customRootClass:e,children:o,defaultValue:s,value:l,onValueChange:n,shift:c,...d},m)=>{const f=a(e,"Select");return t(i.Provider,{value:{rootClass:f},children:t(r.Root,{className:`${f}-root`,defaultValue:s,value:l,onValueChange:n,shift:c,ref:m,...d,children:o})})}));d.displayName="SelectRoot";const m=e.forwardRef(((e,r)=>{const{rootClass:a}=o(i);return t("div",{className:`${a}-item-indicator`,ref:r,...e,children:t(s,{width:16,height:16})})}));m.displayName="SelectIndicator";const f=e.forwardRef((({children:e,container:o,...a},s)=>t(r.Portal,{ref:s,container:o,...a,children:e})));f.displayName="SelectPortal";const p=e.forwardRef((({children:e,...a},s)=>{const{rootClass:l}=o(i);return t(r.Group,{className:`${l}-group`,ref:s,...a,children:e})}));p.displayName="SelectGroup";const u=e.forwardRef(((e,o)=>(console.warn("Direct usage of Select is not supported. Please use Select.Root, Select.Content, etc. instead."),null)));u.displayName="Select";const h=u;h.Root=d,h.Content=l,h.Item=n,h.Trigger=c,h.Portal=f,h.Group=p,h.Indicator=m;export{h as default};
|
|
@@ -7,6 +7,7 @@ type SliderRootProps = {
|
|
|
7
7
|
defaultValue?: number | number[];
|
|
8
8
|
value?: number | number[];
|
|
9
9
|
onValueChange?: (value: number | number[]) => void;
|
|
10
|
+
onValueCommit?: (value: number | number[]) => void;
|
|
10
11
|
min?: number;
|
|
11
12
|
max?: number;
|
|
12
13
|
step?: number;
|
|
@@ -24,6 +25,7 @@ declare const SliderRoot: React.ForwardRefExoticComponent<{
|
|
|
24
25
|
defaultValue?: number | number[];
|
|
25
26
|
value?: number | number[];
|
|
26
27
|
onValueChange?: (value: number | number[]) => void;
|
|
28
|
+
onValueCommit?: (value: number | number[]) => void;
|
|
27
29
|
min?: number;
|
|
28
30
|
max?: number;
|
|
29
31
|
step?: number;
|
|
@@ -101,6 +103,7 @@ type SliderProps = {
|
|
|
101
103
|
defaultValue?: number | number[];
|
|
102
104
|
value?: number | number[];
|
|
103
105
|
onValueChange?: (value: number | number[]) => void;
|
|
106
|
+
onValueCommit?: (value: number | number[]) => void;
|
|
104
107
|
min?: number;
|
|
105
108
|
max?: number;
|
|
106
109
|
step?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{createContext as n,forwardRef as l,useRef as o,useCallback as i}from"react";import{c as s}from"./clsx-BaVHROc5.js";import{c as u}from"./index-6If6D2Zi.js";import{u as c}from"./index-wRElCyvx.js";import{P as m}from"./index-98jQ1vTr.js";import{m as d}from"./mergeRefs-B8eZ_q-T.js";const p=n({rootClass:"",value:0,setValue:()=>{},minValue:0,maxValue:100,step:1,name:void 0,isDragging:!1,setDragging:()=>{},disabled:!1,orientation:"horizontal",pageStepMultiplier:10,showStepMarks:!1,formatValue:void 0,rootRef:{current:null},thumbRefs:void 0,registerThumbRef:void 0}),h="Slider",f=l((({children:t,className:a="",customRootClass:n="",defaultValue:l,value:m,onValueChange:d,min:f=0,max:v=100,step:b=1,disabled:g=!1,name:w,orientation:x="horizontal",pageStepMultiplier:y=10,showStepMarks:M=!1,formatValue:$,...k},V)=>{const R=u(n,h),[A,S]=c(m,l??(Array.isArray(m)?m:0),d),[N,D]=r.useState(!1),C=r.useRef(null),P=r.useRef(null),T=o([]),E=r.useMemo((()=>e=>{P.current=e,"function"==typeof V?V(e):V&&(V.current=e)}),[V]),X=i(((e,t)=>{T.current[e]=t}),[]),L=e=>{const t=P.current;if(!t)return;const a=t.getBoundingClientRect();let r;r="vertical"===x?(a.bottom-e.clientY)/a.height:(e.clientX-a.left)/a.width;const n=f+r*(v-f),l=Math.round(n/b)*b,o=(i=l,Math.min(v,Math.max(f,i)));var i;if(Array.isArray(A)){let e=C.current;if(null===e){const t=A.map((e=>Math.abs(e-o)));e=t.indexOf(Math.min(...t)),C.current=e}const t=A.map(((e,t)=>({value:e,origIndex:t})));t[e].value=o,t.sort(((e,t)=>e.value-t.value)),C.current=t.findIndex((t=>t.origIndex===e)),S(t.map((e=>e.value)))}else S(o)},B={rootClass:R,value:A,setValue:S,minValue:f,maxValue:v,step:b,name:w,isDragging:N,setDragging:D,disabled:g,orientation:x,pageStepMultiplier:y,showStepMarks:M,formatValue:$,rootRef:P,thumbRefs:T.current,registerThumbRef:X};return e(p.Provider,{value:B,children:e("div",{ref:E,className:s(R,a),"data-slider-root":R,"data-disabled":g,"data-orientation":x,onPointerDown:e=>{if(g)return;e.stopPropagation();const t=e.target.closest(`.${R}-thumb`);if(t&&Array.isArray(A)){const e=parseInt(t.getAttribute("data-index")||"0",10);C.current=e,t.focus()}else if(C.current=null,Array.isArray(A))P.current?.focus();else{const e=T.current[0];e?.current?.focus()}D(!0),L(e);const a=e=>{e.preventDefault(),L(e)},r=()=>{D(!1),C.current=null,document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",r)};document.addEventListener("pointermove",a),document.addEventListener("pointerup",r)},onPointerMove:e=>{N&&(e.preventDefault(),L(e))},onPointerUp:()=>{D(!1),C.current=null},...k,children:t})})}));f.displayName=h;const v=l((({children:t,...a},n)=>{const{rootClass:l}=r.useContext(p);return e("div",{ref:n,className:`${l}-track`,style:{position:"relative"},...a,children:t})}));v.displayName="SliderTrack";const b=r.memo(l((({children:n,asChild:l=!1,index:o=0,"aria-label":i,"aria-labelledby":s,...u},c)=>{const{rootClass:h,value:f,minValue:v,maxValue:b,step:g,setValue:w,name:x,isDragging:y,setDragging:M,disabled:$,orientation:k,pageStepMultiplier:V,formatValue:R,registerThumbRef:A}=r.useContext(p),S=r.useRef(null);r.useEffect((()=>{A&&S.current&&A(o,S)}),[o,A]);const N=Array.isArray(f)&&o>=0&&o<f.length?f[o]:"number"==typeof f?f:v,D=Number.isFinite(N)?N:v,C=Math.min(b,Math.max(v,D)),P=b===v?0:(C-v)/(b-v)*100,[T,E]=r.useState(!1),X=y?"dragging":T?"active":"inactive",L=e(m.div,{ref:d(S,c),asChild:l,className:`${h}-thumb`,role:"slider",tabIndex:$?-1:0,"aria-valuemin":v,"aria-valuemax":b,"aria-valuenow":C,"aria-valuetext":R?R(C):void 0,"aria-orientation":k,"aria-label":i,"aria-labelledby":s,"data-state":X,"data-disabled":$,"data-index":o,onKeyDown:e=>{if($)return;let t=C;const a=Boolean(e.currentTarget.closest('[dir="rtl"]'));switch(e.key){case"ArrowRight":t=a?C-g:C+g;break;case"ArrowLeft":t=a?C+g:C-g;break;case"ArrowUp":t=C+g;break;case"ArrowDown":t=C-g;break;case"Home":t=v;break;case"End":t=b;break;case"PageUp":t=C+g*V;break;case"PageDown":t=C-g*V;break;default:return}e.preventDefault();const r=(n=t,Math.min(b,Math.max(v,n)));var n;if(Array.isArray(f)){const e=[...f];e[o]=r,w(e)}else w(r)},onPointerDown:e=>{$||(e.currentTarget.focus(),M(!0))},onPointerUp:()=>{M(!1)},onFocus:()=>E(!0),onBlur:()=>E(!1),style:"vertical"===k?{bottom:`calc(${P}% - 10px)`}:{left:`calc(${P}% - 10px)`},...u,children:n});return t(a,{children:[L,e("input",{type:"hidden",value:C,name:Array.isArray(f)?`${x}[${o}]`:x})]})})));b.displayName="SliderThumb";const g=l((({children:t,...a},n)=>{const{rootClass:l,value:o,minValue:i,maxValue:s,orientation:u}=r.useContext(p);let c=0,m=0;if(Array.isArray(o))if(0===o.length)c=0,m=0;else{const e=[...o].sort(((e,t)=>e-t)),t=e[0],a=e[e.length-1];c=s===i?0:(t-i)/(s-i)*100,m=s===i?0:(a-i)/(s-i)*100,1===o.length&&(c=0)}else c=0,m=s===i?0:(o-i)/(s-i)*100;const d=m-c;return e("div",{ref:n,className:`${l}-range`,style:"vertical"===u?{height:`${d}%`,marginTop:100-m+"%"}:{marginLeft:`${c}%`,width:`${d}%`},...a,children:t})}));g.displayName="SliderRange";const w=l((({children:a,customMarks:n,...l},o)=>{const{rootClass:i,minValue:s,maxValue:u,step:c,orientation:m,showStepMarks:d}=r.useContext(p);if(!d&&!n)return null;const h=[];if(n)n.forEach((({value:a,label:r})=>{const n=u===s?0:(a-s)/(u-s)*100;h.push(t("div",{className:`${i}-mark ${i}-mark-custom`,"data-testid":`mark-${a}`,style:"vertical"===m?{bottom:`${n}%`,left:"50%",transform:"translateX(-50%)"}:{left:`${n}%`,top:0,transform:"translateX(-50%)"},"data-value":a,children:[e("div",{className:`${i}-mark-line`,style:"vertical"===m?{width:"2px",height:"12px",position:"absolute",bottom:"-6px",left:"50%",transform:"translateX(-50%)"}:{width:"1px",height:"6px",position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)"}}),r&&e("span",{className:`${i}-mark-label`,style:"vertical"===m?{right:"16px",top:"50%",transform:"translateY(-50%)",whiteSpace:"nowrap"}:{top:"8px",left:"50%",transform:"translateX(-50%)",whiteSpace:"nowrap"},children:r})]},a))}));else for(let t=s;t<=u;t+=c){const a=u===s?0:(t-s)/(u-s)*100;h.push(e("div",{className:`${i}-mark`,"data-testid":`mark-${t}`,style:"vertical"===m?{bottom:`${a}%`,left:"50%",transform:"translateX(-50%)"}:{left:`${a}%`,top:0,transform:"translateX(-50%)"},"data-value":t,children:e("div",{className:`${i}-mark-line`,style:"vertical"===m?{width:"2px",height:"8px",position:"absolute",bottom:"-4px",left:"50%",transform:"translateX(-50%)"}:{width:"1px",height:"4px",position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)"}})},t))}return t("div",{ref:o,className:`${i}-marks`,style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:1},...l,children:[h,a]})}));w.displayName="SliderMarks";const x=l((({children:a,"aria-label":n,"aria-labelledby":l,defaultValue:o=[25,75],value:i,onValueChange:s,...u},c)=>{const{rootClass:d,minValue:h,maxValue:f,step:v,disabled:b,orientation:g,rootRef:w}=r.useContext(p),[x,y]=r.useState(i||o),[M,$]=r.useState(null),[k,V]=r.useState(null),R=r.useRef(0),A=e=>Math.min(f,Math.max(h,e)),S=e=>{y(e),s?.(e)},N=f===h?0:(x[0]-h)/(f-h)*100,D=f===h?0:(x[1]-h)/(f-h)*100,C=(e,t)=>{const a=e.currentTarget.getBoundingClientRect();let r;r="vertical"===g?(a.bottom-e.clientY)/a.height:(e.clientX-a.left)/a.width;const n=h+r*(f-h),l=Math.round(n/v)*v,o=A(l),i=[...x];i["lower"===t?0:1]=o,"lower"===t?i[0]=Math.min(i[0],x[1]):i[1]=Math.max(i[1],x[0]),S(i)},P=(e,t)=>{if(b)return;e.stopPropagation(),$(t),C(e,t);const a=e=>{e.preventDefault();const a=w.current;if(!a)return;const r=a.getBoundingClientRect();let n;n="vertical"===g?(r.bottom-e.clientY)/r.height:(e.clientX-r.left)/r.width;const l=h+n*(f-h),o=Math.round(l/v)*v,i=A(o),s=[...x];s["lower"===t?0:1]=i,"lower"===t?s[0]=Math.min(s[0],x[1]):s[1]=Math.max(s[1],x[0]);const u=performance.now();u-R.current>16&&(S(s),R.current=u)},r=()=>{$(null),document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",r)};document.addEventListener("pointermove",a),document.addEventListener("pointerup",r)},T=(e,t)=>{M&&M===t&&(e.preventDefault(),C(e,t))},E=()=>{$(null)},X=(e,t)=>{if(b)return;const a=[...x],r=Boolean(e.currentTarget.closest('[dir="rtl"]'));switch(e.key){case"ArrowRight":a["lower"===t?0:1]=r?x["lower"===t?0:1]-v:x["lower"===t?0:1]+v;break;case"ArrowLeft":a["lower"===t?0:1]=r?x["lower"===t?0:1]+v:x["lower"===t?0:1]-v;break;case"ArrowUp":a["lower"===t?0:1]=x["lower"===t?0:1]+v;break;case"ArrowDown":a["lower"===t?0:1]=x["lower"===t?0:1]-v;break;case"Home":a["lower"===t?0:1]=h;break;case"End":a["lower"===t?0:1]=f;break;default:return}e.preventDefault(),"lower"===t?a[0]=Math.min(a[0],x[1]):a[1]=Math.max(a[1],x[0]),a[0]=A(a[0]),a[1]=A(a[1]),S(a)};return t("div",{ref:c,className:`${d}-range-slider`,...u,children:[e(m.div,{className:`${d}-thumb ${d}-thumb-lower`,role:"slider",tabIndex:b?-1:0,"aria-valuemin":h,"aria-valuemax":f,"aria-valuenow":x[0],"aria-orientation":g,"aria-label":n?`${n} minimum`:"Minimum value","aria-labelledby":l,"data-state":"lower"===M?"dragging":"lower"===k?"active":"inactive","data-disabled":b,onKeyDown:e=>X(e,"lower"),onFocus:()=>V("lower"),onBlur:()=>V(null),onPointerDown:e=>P(e,"lower"),onPointerMove:e=>T(e,"lower"),onPointerUp:E,style:"vertical"===g?{bottom:`calc(${N}% - 8px)`}:{left:`calc(${N}% - 8px)`}}),e(m.div,{className:`${d}-thumb ${d}-thumb-upper`,role:"slider",tabIndex:b?-1:0,"aria-valuemin":h,"aria-valuemax":f,"aria-valuenow":x[1],"aria-orientation":g,"aria-label":n?`${n} maximum`:"Maximum value","aria-labelledby":l,"data-state":"upper"===M?"dragging":"upper"===k?"active":"inactive","data-disabled":b,onKeyDown:e=>X(e,"upper"),onFocus:()=>V("upper"),onBlur:()=>V(null),onPointerDown:e=>P(e,"upper"),onPointerMove:e=>T(e,"upper"),onPointerUp:E,style:"vertical"===g?{bottom:`calc(${D}% - 8px)`}:{left:`calc(${D}% - 8px)`}}),e("div",{className:`${d}-range-fill`,style:"vertical"===g?{bottom:`${Math.min(N,D)}%`,height:`${Math.abs(D-N)}%`,left:0,right:0}:{left:`${Math.min(N,D)}%`,width:`${Math.abs(D-N)}%`,top:0,bottom:0}}),a]})}));x.displayName="SliderRangeSlider";const y=l(((t,a)=>{const{defaultValue:r,min:n=0,max:l=100,step:o=1,orientation:i="horizontal",formatValue:s,"aria-label":u,"aria-labelledby":c,...m}=t;return e(y.Root,{ref:a,defaultValue:r,min:n,max:l,step:o,orientation:i,formatValue:s,...m,children:e(y.Track,{children:e(y.Range,{children:e(y.Thumb,{"aria-label":u,"aria-labelledby":c})})})})}));y.displayName="Slider",y.Root=f,y.Track=v,y.Range=g,y.Thumb=b,y.Marks=w,y.RangeSlider=x;export{y as default};
|
|
1
|
+
'use client';import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{createContext as n,forwardRef as o,useRef as l,useCallback as i}from"react";import{c as s}from"./clsx-BaVHROc5.js";import{c as u}from"./index-6If6D2Zi.js";import{u as c}from"./index-wRElCyvx.js";import{P as m}from"./index-98jQ1vTr.js";import{m as d}from"./mergeRefs-B8eZ_q-T.js";const p=n({rootClass:"",value:0,setValue:()=>{},minValue:0,maxValue:100,step:1,name:void 0,isDragging:!1,setDragging:()=>{},disabled:!1,orientation:"horizontal",pageStepMultiplier:10,showStepMarks:!1,formatValue:void 0,rootRef:{current:null},thumbRefs:void 0,registerThumbRef:void 0}),h="Slider",f=o((({children:t,className:a="",customRootClass:n="",defaultValue:o,value:m,onValueChange:d,onValueCommit:f,min:v=0,max:b=100,step:g=1,disabled:w=!1,name:x,orientation:y="horizontal",pageStepMultiplier:M=10,showStepMarks:$=!1,formatValue:k,...V},R)=>{const A=u(n,h),[S,N]=c(m,o??(Array.isArray(m)?m:0),d),[D,C]=r.useState(!1),P=r.useRef(null),E=r.useRef(S);r.useEffect((()=>{E.current=S}),[S]);const T=r.useRef(null),X=l([]),L=r.useMemo((()=>e=>{T.current=e,"function"==typeof R?R(e):R&&(R.current=e)}),[R]),B=i(((e,t)=>{X.current[e]=t}),[]),I=e=>{const t=T.current;if(!t)return;const a=t.getBoundingClientRect();let r;r="vertical"===y?(a.bottom-e.clientY)/a.height:(e.clientX-a.left)/a.width;const n=v+r*(b-v),o=Math.round(n/g)*g,l=(i=o,Math.min(b,Math.max(v,i)));var i;if(Array.isArray(S)){let e=P.current;if(null===e){const t=S.map((e=>Math.abs(e-l)));e=t.indexOf(Math.min(...t)),P.current=e}const t=S.map(((e,t)=>({value:e,origIndex:t})));t[e].value=l,t.sort(((e,t)=>e.value-t.value)),P.current=t.findIndex((t=>t.origIndex===e)),N(t.map((e=>e.value)))}else N(l)},U={rootClass:A,value:S,setValue:N,minValue:v,maxValue:b,step:g,name:x,isDragging:D,setDragging:C,disabled:w,orientation:y,pageStepMultiplier:M,showStepMarks:$,formatValue:k,rootRef:T,thumbRefs:X.current,registerThumbRef:B};return e(p.Provider,{value:U,children:e("div",{ref:L,className:s(A,a),"data-slider-root":A,"data-disabled":w,"data-orientation":y,onPointerDown:e=>{if(w)return;e.stopPropagation();const t=e.target.closest(`.${A}-thumb`);if(t&&Array.isArray(S)){const e=parseInt(t.getAttribute("data-index")||"0",10);P.current=e,t.focus()}else if(P.current=null,Array.isArray(S))T.current?.focus();else{const e=X.current[0];e?.current?.focus()}C(!0),I(e);const a=e=>{e.preventDefault(),I(e)},r=()=>{C(!1),P.current=null,document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",r),f?.(E.current)};document.addEventListener("pointermove",a),document.addEventListener("pointerup",r)},onPointerMove:e=>{D&&(e.preventDefault(),I(e))},onPointerUp:()=>{C(!1),P.current=null},...V,children:t})})}));f.displayName=h;const v=o((({children:t,...a},n)=>{const{rootClass:o,orientation:l}=r.useContext(p);return e("div",{ref:n,className:`${o}-track`,style:"vertical"===l?{rotate:"180deg",position:"relative"}:{position:"relative"},...a,children:t})}));v.displayName="SliderTrack";const b=r.memo(o((({children:n,asChild:o=!1,index:l=0,"aria-label":i,"aria-labelledby":s,...u},c)=>{const{rootClass:h,value:f,minValue:v,maxValue:b,step:g,setValue:w,name:x,isDragging:y,setDragging:M,disabled:$,orientation:k,pageStepMultiplier:V,formatValue:R,registerThumbRef:A}=r.useContext(p),S=r.useRef(null);r.useEffect((()=>{A&&S.current&&A(l,S)}),[l,A]);const N=Array.isArray(f)&&l>=0&&l<f.length?f[l]:"number"==typeof f?f:v,D=Number.isFinite(N)?N:v,C=Math.min(b,Math.max(v,D)),P=b===v?0:(C-v)/(b-v)*100,[E,T]=r.useState(!1),X=y?"dragging":E?"active":"inactive",L=e(m.div,{ref:d(S,c),asChild:o,className:`${h}-thumb`,role:"slider",tabIndex:$?-1:0,"aria-valuemin":v,"aria-valuemax":b,"aria-valuenow":C,"aria-valuetext":R?R(C):void 0,"aria-orientation":k,"aria-label":i,"aria-labelledby":s,"data-state":X,"data-disabled":$,"data-index":l,onKeyDown:e=>{if($)return;let t=C;const a=Boolean(e.currentTarget.closest('[dir="rtl"]'));switch(e.key){case"ArrowRight":t=a?C-g:C+g;break;case"ArrowLeft":t=a?C+g:C-g;break;case"ArrowUp":t=C+g;break;case"ArrowDown":t=C-g;break;case"Home":t=v;break;case"End":t=b;break;case"PageUp":t=C+g*V;break;case"PageDown":t=C-g*V;break;default:return}e.preventDefault();const r=(n=t,Math.min(b,Math.max(v,n)));var n;if(Array.isArray(f)){const e=[...f];e[l]=r,w(e)}else w(r)},onPointerDown:e=>{$||(e.currentTarget.focus(),M(!0))},onPointerUp:()=>{M(!1)},onFocus:()=>T(!0),onBlur:()=>T(!1),style:"vertical"===k?{top:`calc(${P}% - 10px)`}:{left:`calc(${P}% - 10px)`},...u,children:n});return t(a,{children:[L,e("input",{type:"hidden",value:C,name:Array.isArray(f)?`${x}[${l}]`:x})]})})));b.displayName="SliderThumb";const g=o((({children:t,...a},n)=>{const{rootClass:o,value:l,minValue:i,maxValue:s,orientation:u}=r.useContext(p);let c=0,m=0;if(Array.isArray(l))if(0===l.length)c=0,m=0;else{const e=[...l].sort(((e,t)=>e-t)),t=e[0],a=e[e.length-1];c=s===i?0:(t-i)/(s-i)*100,m=s===i?0:(a-i)/(s-i)*100,1===l.length&&(c=0)}else c=0,m=s===i?0:(l-i)/(s-i)*100;const d=m-c;return e("div",{ref:n,className:`${o}-range`,style:"vertical"===u?{height:`${d}%`,marginTop:100-m+"%"}:{marginLeft:`${c}%`,width:`${d}%`},...a,children:t})}));g.displayName="SliderRange";const w=o((({children:a,customMarks:n,...o},l)=>{const{rootClass:i,minValue:s,maxValue:u,step:c,orientation:m,showStepMarks:d}=r.useContext(p);if(!d&&!n)return null;const h=[];if(n)n.forEach((({value:a,label:r})=>{const n=u===s?0:(a-s)/(u-s)*100;h.push(t("div",{className:`${i}-mark ${i}-mark-custom`,"data-testid":`mark-${a}`,style:"vertical"===m?{bottom:`${n}%`,left:"50%",transform:"translateX(-50%)"}:{left:`${n}%`,top:0,transform:"translateX(-50%)"},"data-value":a,children:[e("div",{className:`${i}-mark-line`,style:"vertical"===m?{width:"2px",height:"12px",position:"absolute",bottom:"-6px",left:"50%",transform:"translateX(-50%)"}:{width:"1px",height:"6px",position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)"}}),r&&e("span",{className:`${i}-mark-label`,style:"vertical"===m?{right:"16px",top:"50%",transform:"translateY(-50%)",whiteSpace:"nowrap"}:{top:"8px",left:"50%",transform:"translateX(-50%)",whiteSpace:"nowrap"},children:r})]},a))}));else for(let t=s;t<=u;t+=c){const a=u===s?0:(t-s)/(u-s)*100;h.push(e("div",{className:`${i}-mark`,"data-testid":`mark-${t}`,style:"vertical"===m?{bottom:`${a}%`,left:"50%",transform:"translateX(-50%)"}:{left:`${a}%`,top:0,transform:"translateX(-50%)"},"data-value":t,children:e("div",{className:`${i}-mark-line`,style:"vertical"===m?{width:"2px",height:"8px",position:"absolute",bottom:"-4px",left:"50%",transform:"translateX(-50%)"}:{width:"1px",height:"4px",position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)"}})},t))}return t("div",{ref:l,className:`${i}-marks`,style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:1},...o,children:[h,a]})}));w.displayName="SliderMarks";const x=o((({children:a,"aria-label":n,"aria-labelledby":o,defaultValue:l=[25,75],value:i,onValueChange:s,...u},c)=>{const{rootClass:d,minValue:h,maxValue:f,step:v,disabled:b,orientation:g,rootRef:w}=r.useContext(p),[x,y]=r.useState(i||l),[M,$]=r.useState(null),[k,V]=r.useState(null),R=r.useRef(0),A=e=>Math.min(f,Math.max(h,e)),S=e=>{y(e),s?.(e)},N=f===h?0:(x[0]-h)/(f-h)*100,D=f===h?0:(x[1]-h)/(f-h)*100,C=(e,t)=>{const a=e.currentTarget.getBoundingClientRect();let r;r="vertical"===g?(a.bottom-e.clientY)/a.height:(e.clientX-a.left)/a.width;const n=h+r*(f-h),o=Math.round(n/v)*v,l=A(o),i=[...x];i["lower"===t?0:1]=l,"lower"===t?i[0]=Math.min(i[0],x[1]):i[1]=Math.max(i[1],x[0]),S(i)},P=(e,t)=>{if(b)return;e.stopPropagation(),$(t),C(e,t);const a=e=>{e.preventDefault();const a=w.current;if(!a)return;const r=a.getBoundingClientRect();let n;n="vertical"===g?(r.bottom-e.clientY)/r.height:(e.clientX-r.left)/r.width;const o=h+n*(f-h),l=Math.round(o/v)*v,i=A(l),s=[...x];s["lower"===t?0:1]=i,"lower"===t?s[0]=Math.min(s[0],x[1]):s[1]=Math.max(s[1],x[0]);const u=performance.now();u-R.current>16&&(S(s),R.current=u)},r=()=>{$(null),document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",r)};document.addEventListener("pointermove",a),document.addEventListener("pointerup",r)},E=(e,t)=>{M&&M===t&&(e.preventDefault(),C(e,t))},T=()=>{$(null)},X=(e,t)=>{if(b)return;const a=[...x],r=Boolean(e.currentTarget.closest('[dir="rtl"]'));switch(e.key){case"ArrowRight":a["lower"===t?0:1]=r?x["lower"===t?0:1]-v:x["lower"===t?0:1]+v;break;case"ArrowLeft":a["lower"===t?0:1]=r?x["lower"===t?0:1]+v:x["lower"===t?0:1]-v;break;case"ArrowUp":a["lower"===t?0:1]=x["lower"===t?0:1]+v;break;case"ArrowDown":a["lower"===t?0:1]=x["lower"===t?0:1]-v;break;case"Home":a["lower"===t?0:1]=h;break;case"End":a["lower"===t?0:1]=f;break;default:return}e.preventDefault(),"lower"===t?a[0]=Math.min(a[0],x[1]):a[1]=Math.max(a[1],x[0]),a[0]=A(a[0]),a[1]=A(a[1]),S(a)};return t("div",{ref:c,className:`${d}-range-slider`,...u,children:[e(m.div,{className:`${d}-thumb ${d}-thumb-lower`,role:"slider",tabIndex:b?-1:0,"aria-valuemin":h,"aria-valuemax":f,"aria-valuenow":x[0],"aria-orientation":g,"aria-label":n?`${n} minimum`:"Minimum value","aria-labelledby":o,"data-state":"lower"===M?"dragging":"lower"===k?"active":"inactive","data-disabled":b,onKeyDown:e=>X(e,"lower"),onFocus:()=>V("lower"),onBlur:()=>V(null),onPointerDown:e=>P(e,"lower"),onPointerMove:e=>E(e,"lower"),onPointerUp:T,style:"vertical"===g?{bottom:`calc(${N}% - 8px)`}:{left:`calc(${N}% - 8px)`}}),e(m.div,{className:`${d}-thumb ${d}-thumb-upper`,role:"slider",tabIndex:b?-1:0,"aria-valuemin":h,"aria-valuemax":f,"aria-valuenow":x[1],"aria-orientation":g,"aria-label":n?`${n} maximum`:"Maximum value","aria-labelledby":o,"data-state":"upper"===M?"dragging":"upper"===k?"active":"inactive","data-disabled":b,onKeyDown:e=>X(e,"upper"),onFocus:()=>V("upper"),onBlur:()=>V(null),onPointerDown:e=>P(e,"upper"),onPointerMove:e=>E(e,"upper"),onPointerUp:T,style:"vertical"===g?{bottom:`calc(${D}% - 8px)`}:{left:`calc(${D}% - 8px)`}}),e("div",{className:`${d}-range-fill`,style:"vertical"===g?{bottom:`${Math.min(N,D)}%`,height:`${Math.abs(D-N)}%`,left:0,right:0}:{left:`${Math.min(N,D)}%`,width:`${Math.abs(D-N)}%`,top:0,bottom:0}}),a]})}));x.displayName="SliderRangeSlider";const y=o(((t,a)=>{const{defaultValue:r,min:n=0,max:o=100,step:l=1,orientation:i="horizontal",formatValue:s,"aria-label":u,"aria-labelledby":c,...m}=t;return e(y.Root,{ref:a,defaultValue:r,min:n,max:o,step:l,orientation:i,formatValue:s,...m,children:e(y.Track,{children:e(y.Range,{children:e(y.Thumb,{"aria-label":u,"aria-labelledby":c})})})})}));y.displayName="Slider",y.Root=f,y.Track=v,y.Range=g,y.Thumb=b,y.Marks=w,y.RangeSlider=x;export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import e,{createContext as t,useRef as o,useState as r,useContext as n}from"react";import{jsx as a,jsxs as i}from"react/jsx-runtime";import{a as s,
|
|
1
|
+
'use client';import e,{createContext as t,useRef as o,useState as r,useContext as n}from"react";import{jsx as a,jsxs as i}from"react/jsx-runtime";import{a as s,m as l,o as c,f as d,e as p,g as f,k as m,i as u,l as g,j as h,u as w,G as T,v as R}from"./floating-ui.react-gB901AP2.js";import{B as x}from"./index-BOy86lYu.js";import{c as y}from"./clsx-BaVHROc5.js";import{P as v}from"./index-98jQ1vTr.js";import{T as j}from"./ThemeContext-Sm-iNANd.js";import"react-dom";const C=t(null),N=e.forwardRef((({children:e,placement:t="top",...n},i)=>{const w=o(null),[T,R]=r(!1),x=s({placement:t,strategy:"fixed",onOpenChange:R,middleware:[l({element:w,padding:4}),c(5),d({crossAxis:!0,fallbackAxisSideDirection:"start",padding:5}),p({padding:5})]}),y=x.context,v=f(y,{move:!1}),j=m(y,{}),N=u(y),O=g(y,{role:"tooltip"}),P=h([v,j,N,O]);return a(C.Provider,{value:{isOpen:T,setIsOpen:R,data:x,interactions:P,context:y,arrowRef:w},children:a("div",{ref:i,...n,children:e})})}));N.displayName="Tooltip";const O=e.forwardRef((({children:e,asChild:t,...o},r)=>{const i=n(C);if(!i)throw new Error("TooltipTrigger must be used within a TooltipRoot component");const{isOpen:s,interactions:l,context:c}=i,{getReferenceProps:d}=l,p=e.ref,f=w([c.refs.setReference,r,p]);return a(x,{asChild:t,ref:f,"data-state":s?"open":"closed",...d(o),children:e})}));O.displayName="TooltipTrigger";const P=e.forwardRef((({children:e,showArrow:t=!0,...o},r)=>{const s=n(C),l=n(j);if(!s)throw new Error("TooltipContent must be used within a TooltipRoot component");const{isOpen:c,data:d,interactions:p,context:f}=s,m=s.arrowRef,u=w([f.refs.setFloating,r]);if(!c)return null;const{getFloatingProps:g}=p,h=l?.portalRootRef.current||document.querySelector("[data-rad-ui-portal-root]")||l?.containerRef.current||document.querySelector("#rad-ui-theme-container")||void 0;return a(T,{root:h,children:a(v.div,{className:"rad-ui-tooltip-floating-element",ref:u,"data-state":c?"open":"closed",style:{...d.floatingStyles},...g(o),children:i("div",{className:"rad-ui-tooltip-content-inner",children:[t&&a(R,{className:y("rad-ui-arrow"),ref:m,context:f}),e]})})})}));P.displayName="TooltipContent";const b=e.forwardRef(((e,t)=>(console.warn("Direct usage of Tooltip is not supported. Please use Tooltip.Root, Tooltip.Trigger, etc. instead."),null)));b.displayName="Tooltip",b.Root=N,b.Trigger=O,b.Content=P;export{b as default};
|