@radui/ui 0.1.9 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion.d.ts +67 -34
- package/dist/components/Accordion.js +1 -1
- package/dist/components/AlertDialog.d.ts +13 -14
- package/dist/components/AlertDialog.js +1 -1
- package/dist/components/AspectRatio.js +1 -1
- package/dist/components/Avatar.d.ts +4 -3
- package/dist/components/Avatar.js +1 -1
- package/dist/components/AvatarGroup.d.ts +1 -0
- package/dist/components/AvatarGroup.js +1 -1
- package/dist/components/AvatarPrimitiveFallback-KiY3slgV.js +1 -0
- package/dist/components/Badge.d.ts +6 -4
- package/dist/components/Badge.js +1 -1
- package/dist/components/BlockQuote.js +1 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/Callout.d.ts +19 -12
- package/dist/components/Callout.js +1 -1
- package/dist/components/Card.d.ts +30 -1
- package/dist/components/Card.js +1 -1
- package/dist/components/Checkbox.d.ts +22 -6
- package/dist/components/Checkbox.js +1 -1
- package/dist/components/CheckboxCards.d.ts +25 -7
- package/dist/components/CheckboxCards.js +1 -1
- package/dist/components/CheckboxGroup.d.ts +22 -7
- package/dist/components/CheckboxGroup.js +1 -1
- package/dist/components/CheckboxGroupPrimitive-DIOswrR1.js +1 -0
- package/dist/components/Code.js +1 -1
- package/dist/components/Collapsible.d.ts +12 -9
- package/dist/components/Collapsible.js +1 -1
- package/dist/components/Combobox.d.ts +98 -0
- package/dist/components/Combobox.js +1 -0
- package/dist/components/ComboboxPrimitive-Bn1C5dkn.js +1 -0
- package/dist/components/ContextMenu.d.ts +31 -1
- package/dist/components/ContextMenu.js +1 -1
- package/dist/components/DataList.d.ts +12 -5
- package/dist/components/DataList.js +1 -1
- package/dist/components/Dialog.d.ts +37 -18
- package/dist/components/Dialog.js +1 -1
- package/dist/components/Disclosure.d.ts +6 -1
- package/dist/components/Disclosure.js +1 -1
- package/dist/components/DropdownMenu.d.ts +31 -1
- package/dist/components/DropdownMenu.js +1 -1
- package/dist/components/Em.js +1 -1
- package/dist/components/Heading.js +1 -1
- package/dist/components/HoverCard.d.ts +12 -1
- package/dist/components/HoverCard.js +1 -1
- package/dist/components/Kbd.d.ts +1 -1
- package/dist/components/Kbd.js +1 -1
- package/dist/components/Link.d.ts +3 -1
- package/dist/components/Link.js +1 -1
- package/dist/components/MenuPrimitive-6Qr46BSn.js +1 -0
- package/dist/components/Menubar.d.ts +81 -37
- package/dist/components/Menubar.js +1 -1
- package/dist/components/Minimap.d.ts +11 -8
- package/dist/components/Minimap.js +1 -1
- package/dist/components/NavigationMenu.d.ts +13 -12
- package/dist/components/NavigationMenu.js +1 -1
- package/dist/components/NumberField.d.ts +28 -6
- package/dist/components/NumberField.js +1 -1
- package/dist/components/Progress.d.ts +1 -1
- 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 +7 -2
- 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-QSMno27i.js +1 -0
- package/dist/components/ScrollArea.d.ts +18 -2
- package/dist/components/ScrollArea.js +1 -1
- package/dist/components/Select.d.ts +20 -15
- package/dist/components/Select.js +1 -1
- package/dist/components/Separator.js +1 -1
- package/dist/components/Skeleton.js +1 -1
- package/dist/components/Slider.d.ts +57 -11
- package/dist/components/Slider.js +1 -1
- package/dist/components/Spinner.d.ts +13 -0
- package/dist/components/Spinner.js +1 -0
- package/dist/components/Splitter.d.ts +1 -1
- package/dist/components/Splitter.js +1 -1
- package/dist/components/Steps.d.ts +21 -9
- package/dist/components/Steps.js +1 -1
- package/dist/components/Strong.js +1 -1
- package/dist/components/Switch.d.ts +8 -7
- package/dist/components/Switch.js +1 -1
- package/dist/components/TabNav.d.ts +23 -5
- package/dist/components/TabNav.js +1 -1
- package/dist/components/Table.d.ts +9 -1
- package/dist/components/Table.js +1 -1
- package/dist/components/Tabs.d.ts +25 -1
- package/dist/components/Tabs.js +1 -1
- package/dist/components/Text.js +1 -1
- package/dist/components/TextArea.d.ts +15 -2
- package/dist/components/TextArea.js +1 -1
- package/dist/components/Theme.js +1 -1
- package/dist/components/ThemeContext-Sm-iNANd.js +1 -0
- package/dist/components/Toggle.js +1 -1
- package/dist/components/ToggleGroup.d.ts +33 -0
- package/dist/components/ToggleGroup.js +1 -1
- package/dist/components/Toolbar.d.ts +83 -0
- package/dist/components/Toolbar.js +1 -0
- package/dist/components/Tooltip.d.ts +6 -0
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/Tree.d.ts +10 -1
- package/dist/components/Tree.js +1 -1
- package/dist/components/VisuallyHidden.d.ts +1 -1
- package/dist/components/VisuallyHidden.js +1 -1
- package/dist/components/check-DujVUWP-.js +44 -0
- package/dist/components/floating-ui.react-DMgxgTKq.js +5 -0
- package/dist/components/index-3dZuI04X.js +1 -0
- package/dist/components/index-6If6D2Zi.js +1 -0
- package/dist/components/index-98jQ1vTr.js +1 -0
- package/dist/components/index-BOy86lYu.js +1 -0
- package/dist/components/index-BZVbVgqN.js +1 -0
- package/dist/components/index-CTJl2pTM.js +1 -0
- package/dist/components/index-CXzybYmm.js +1 -0
- package/dist/components/index-DTYJVF-V.js +1 -0
- package/dist/components/index-hAp0hL9w.js +1 -0
- package/dist/components/index-wRElCyvx.js +1 -0
- package/dist/components/index-yqRHPukT.js +1 -0
- package/dist/themes/default.css +1 -1
- package/package.json +51 -32
- package/dist/components/AvatarPrimitiveFallback-SECStDbi.js +0 -1
- package/dist/components/CheckboxGroupPrimitive-CEeFUCQV.js +0 -1
- package/dist/components/MenuPrimitive-CBMvjJyH.js +0 -1
- package/dist/components/RadioGroupPrimitive-CbRZK8wB.js +0 -1
- package/dist/components/floating-ui.react-CLbXmKZY.js +0 -5
- package/dist/components/index-BVxS3Ixi.js +0 -1
- package/dist/components/index-BgvB1-RV.js +0 -1
- package/dist/components/index-Br4Ygpsh.js +0 -1
- package/dist/components/index-BuGKU1-S.js +0 -1
- package/dist/components/index-BxNZdFaZ.js +0 -1
- package/dist/components/index-CD1lNchI.js +0 -1
- package/dist/components/index-DBZNt4Em.js +0 -1
- package/dist/components/index-DR_GC01Z.js +0 -1
- package/dist/components/index-Di6TooPD.js +0 -1
- package/dist/components/index-DzAecJCk.js +0 -1
- package/dist/components/index-fkj4Fdgt.js +0 -1
- package/dist/components/tslib.es6-B3RR16LH.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{
|
|
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-yqRHPukT.js";import{M as a}from"./MenuPrimitive-6Qr46BSn.js";import u from"./Separator.js";import"./floating-ui.react-DMgxgTKq.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,36 +1,38 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
type MinimapRootProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
4
5
|
customRootClass?: string;
|
|
5
6
|
};
|
|
6
|
-
declare const MinimapRoot: ({ children, className, customRootClass, ...props }: MinimapRootProps) =>
|
|
7
|
+
declare const MinimapRoot: ({ children, className, customRootClass, ...props }: MinimapRootProps) => react_jsx_runtime.JSX.Element;
|
|
7
8
|
|
|
8
9
|
type MinimapItemProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
9
10
|
value: string;
|
|
10
11
|
};
|
|
11
|
-
declare const MinimapItem: ({ children, className, value, ...props }: MinimapItemProps) =>
|
|
12
|
+
declare const MinimapItem: ({ children, className, value, ...props }: MinimapItemProps) => react_jsx_runtime.JSX.Element;
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
type MinimapTrackProps = React.HTMLAttributes<HTMLDivElement>;
|
|
15
|
+
declare const MinimapTrack: ({ children, className, ...props }: MinimapTrackProps) => react_jsx_runtime.JSX.Element;
|
|
14
16
|
|
|
15
17
|
type MinimapLineProps = React.HTMLAttributes<HTMLDivElement>;
|
|
16
|
-
declare const MinimapLine: ({ children, className, ...props }: MinimapLineProps) =>
|
|
18
|
+
declare const MinimapLine: ({ children, className, ...props }: MinimapLineProps) => react_jsx_runtime.JSX.Element;
|
|
17
19
|
|
|
18
20
|
type MinimapContentProps = React.HTMLAttributes<HTMLDivElement>;
|
|
19
|
-
declare const MinimapContent: ({ children, className, ...props }: MinimapContentProps) =>
|
|
21
|
+
declare const MinimapContent: ({ children, className, ...props }: MinimapContentProps) => react_jsx_runtime.JSX.Element;
|
|
20
22
|
|
|
21
23
|
type MinimapBubbleProps = React.HTMLAttributes<HTMLDivElement>;
|
|
22
|
-
declare const MinimapBubble: ({ children, className, ...props }: MinimapBubbleProps) =>
|
|
24
|
+
declare const MinimapBubble: ({ children, className, ...props }: MinimapBubbleProps) => react_jsx_runtime.JSX.Element;
|
|
23
25
|
|
|
24
26
|
type MinimapProviderProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
25
27
|
children: React.ReactNode;
|
|
26
28
|
scrollable?: boolean;
|
|
27
29
|
};
|
|
28
|
-
declare const MinimapProvider: ({ children, className, scrollable, ...props }: MinimapProviderProps) =>
|
|
30
|
+
declare const MinimapProvider: ({ children, className, scrollable, ...props }: MinimapProviderProps) => react_jsx_runtime.JSX.Element;
|
|
29
31
|
|
|
30
32
|
type MinimapWaypointProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
31
33
|
value?: string | null;
|
|
32
34
|
};
|
|
33
|
-
declare const MinimapWaypoint: ({ children, className, value, ...props }: MinimapWaypointProps) =>
|
|
35
|
+
declare const MinimapWaypoint: ({ children, className, value, ...props }: MinimapWaypointProps) => react_jsx_runtime.JSX.Element;
|
|
34
36
|
|
|
35
37
|
declare const MinimapComponent: () => null;
|
|
36
38
|
type MinimapComponentType = typeof MinimapComponent & {
|
|
@@ -46,3 +48,4 @@ type MinimapComponentType = typeof MinimapComponent & {
|
|
|
46
48
|
declare const Minimap: MinimapComponentType;
|
|
47
49
|
|
|
48
50
|
export { Minimap as default };
|
|
51
|
+
export type { MinimapBubbleProps, MinimapContentProps, MinimapItemProps, MinimapLineProps, MinimapProviderProps, MinimapRootProps, MinimapTrackProps, MinimapWaypointProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import t,{createContext as r,useRef as n,useEffect as o}from"react";import{c as l}from"./clsx-BaVHROc5.js";import{c as s}from"./index-6If6D2Zi.js";import{P as i}from"./index-98jQ1vTr.js";import{R as a}from"./index-hAp0hL9w.js";import"./index-BOy86lYu.js";const c=r({rootClass:"",rootRef:null}),u=r({value:"",isVisible:!1}),d=r({visibleItems:[],handleInView:()=>{},handleOutView:()=>{},scrollToItem:()=>{},registerRef:()=>{}});function m(e){if(!e)return null;const t=window.getComputedStyle(e).overflowY;return"auto"===t||"scroll"===t?e:m(e.parentElement)}function h({onEnter:e,onLeave:t,threshold:r=0,rootMargin:l="0px",root:s}){const i=n(null);return o((()=>{if("undefined"==typeof window||!("IntersectionObserver"in window))return;if(!i.current)return;const n=s??m(i.current),o=new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting?e?.():t?.()}))}),{threshold:r,rootMargin:l,root:n});return o.observe(i.current),()=>{i.current&&o.unobserve(i.current),o.disconnect()}}),[e,t,r,l,s]),i}const f=Object.assign((()=>(console.warn("Direct usage of Minimap is not supported. Please use Minimap.Root, Minimap.Item instead."),null)),{Root:({children:r,className:n,customRootClass:o="",...u})=>{const d=s(o,"Minimap"),m=t.useRef(null);return e(c.Provider,{value:{rootClass:d,rootRef:m},children:e(a.Root,{loop:!0,orientation:"both",children:e(a.Group,{children:e(i.div,{ref:m,className:l(d,n),...u,children:r})})})})},Item:({children:r,className:n="",value:o,...s})=>{const{rootClass:m}=t.useContext(c)||{rootClass:""},{visibleItems:h,scrollToItem:f}=t.useContext(d),v=h.includes(o),C=t.useMemo((()=>({value:o,isVisible:v})),[o,v]),p=t.useCallback((()=>{f(o)}),[o,f]);return e(u.Provider,{value:C,children:e(a.Item,{value:o,children:e(i.button,{onClick:p,className:l(`${m}-item`,n),"data-in-view":v?"true":"false",...s,children:r})})})},Track:({children:r,className:n="",...o})=>{const{rootClass:s}=t.useContext(c);return e("div",{className:l(`${s}-track`,n),...o,children:r})},Line:({children:r,className:n="",...o})=>{const{rootClass:s}=t.useContext(c)||{rootClass:""},{value:i}=t.useContext(u)||{value:""},{visibleItems:a}=t.useContext(d),m=a.indexOf(i),h=-1!==m,f=-1!==m&&m<a.length-1,v=h&&f;return e("div",{className:l(`${s}-line`,n),"data-in-view":v?"true":"false",...o,children:r})},Content:({children:r,className:n="",...o})=>{const{rootClass:s}=t.useContext(c);return e("div",{className:l(`${s}-content`,n),...o,children:r})},Bubble:({children:r,className:n="",...o})=>{const{rootClass:s}=t.useContext(c)||{rootClass:""},{isVisible:i}=t.useContext(u)||{isVisible:!1};return e("div",{className:l(`${s}-bubble`,n),"data-in-view":i?"true":"false",...o,children:r})},Provider:({children:r,className:n="",scrollable:o,...l})=>{const[s,i]=t.useState([]),a=t.useRef(new Map),c=t.useRef(null),u=t.useCallback(((e,t)=>{t?a.current.set(e,t):a.current.delete(e)}),[]),m=t.useCallback((e=>{i((t=>{if(null===e||t.includes(e))return t;return[...t,e].sort(((e,t)=>{const r=a.current.get(e),n=a.current.get(t);if(!r||!n)return 0;return r.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}))}))}),[]),h=t.useCallback((e=>{i((t=>null!==e&&t.includes(e)?t.filter((t=>t!==e)):t))}),[]),f=t.useCallback((e=>{const t=a.current.get(e);if(!t)return;let r=null;if(o&&c.current)r=c.current;else{const e=t=>{if(!t||t===document.body)return null;const r=window.getComputedStyle(t);return("auto"===r.overflow||"scroll"===r.overflow||"auto"===r.overflowY||"scroll"===r.overflowY)&&t.scrollHeight>t.clientHeight?t:e(t.parentElement)};r=e(t.parentElement)}if(r){const e=t.getBoundingClientRect(),n=r.getBoundingClientRect(),o=e.top-n.top+r.scrollTop,l=r.scrollHeight-r.clientHeight,s=Math.max(0,Math.min(o,l));Math.abs(s-r.scrollTop)>1&&r.scrollTo({top:s,behavior:"smooth"})}}),[]),v=t.useMemo((()=>({visibleItems:s,handleInView:m,handleOutView:h,scrollToItem:f,registerRef:u})),[s,m,h,f,u]);return e(d.Provider,{value:v,children:e("div",{ref:c,className:`${n}`,...l,children:r})})},Waypoint:({children:r,className:n="",value:o="",...s})=>{const{handleInView:i,handleOutView:a,registerRef:c}=t.useContext(d),u=h({onEnter:t.useCallback((()=>{console.log("waypoint",o,"in view"),i(o)}),[o,i]),onLeave:t.useCallback((()=>{console.log("waypoint",o,"out of view"),a(o)}),[o,a]),threshold:.1}),m=t.useCallback((e=>{u&&"current"in u&&(u.current=e),o&&c(o,e)}),[u,o,c]);return e("div",{ref:m,className:l(n),...s,children:r})}});export{f as default};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
|
|
4
|
-
interface
|
|
5
|
-
|
|
4
|
+
interface NavigationMenuRootProps extends React__default.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
children: React__default.ReactNode;
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
onValueChange?: (value: string) => void;
|
|
9
|
+
customRootClass?: string;
|
|
6
10
|
}
|
|
7
11
|
|
|
8
|
-
interface
|
|
9
|
-
|
|
12
|
+
interface NavigationMenuItemProps extends React__default.ComponentPropsWithoutRef<'div'> {
|
|
13
|
+
value: string;
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
interface NavigationMenuTriggerProps extends React__default.ComponentPropsWithoutRef<'button'> {
|
|
13
17
|
}
|
|
14
18
|
|
|
15
|
-
interface
|
|
16
|
-
|
|
19
|
+
interface NavigationMenuContentProps extends React__default.ComponentPropsWithoutRef<'div'> {
|
|
20
|
+
children: React__default.ReactNode;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
interface
|
|
20
|
-
|
|
21
|
-
value?: string;
|
|
22
|
-
defaultValue?: string;
|
|
23
|
-
onValueChange?: (value: string) => void;
|
|
24
|
-
customRootClass?: string;
|
|
23
|
+
interface NavigationMenuLinkProps extends React__default.ComponentPropsWithoutRef<'a'> {
|
|
24
|
+
href: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
declare const NavigationMenu: {
|
|
@@ -33,3 +33,4 @@ declare const NavigationMenu: {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
export { NavigationMenu as default };
|
|
36
|
+
export type { NavigationMenuContentProps, NavigationMenuItemProps, NavigationMenuLinkProps, NavigationMenuRootProps, NavigationMenuTriggerProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import n,{useEffect as r}from"react";import{R as o}from"./index-hAp0hL9w.js";import{u as t}from"./index-wRElCyvx.js";import{c as s}from"./index-6If6D2Zi.js";import{c as a}from"./clsx-BaVHROc5.js";import{c as i}from"./index-CXzybYmm.js";import"./index-98jQ1vTr.js";import"./index-BOy86lYu.js";const l=n.createContext({isOpen:"",setIsOpen:()=>{},rootClass:""}),c="NavigationMenuRoot",d=n.forwardRef((({children:n,value:r,defaultValue:i="",onValueChange:d,customRootClass:m,className:u,...p},f)=>{const h=s(m,c),[C,N]=t(r,i,d);return e("div",{ref:f,...p,children:e(l.Provider,{value:{isOpen:C,setIsOpen:N,rootClass:h},children:e(o.Root,{children:e(o.Group,{className:a(`${h}-root`,u),children:n})})})})}));d.displayName=c;const m=n.createContext({itemOpen:!1,handleTrigger:()=>{}}),u=n.forwardRef((({value:r,children:o,className:t,onMouseEnter:s,onMouseLeave:c,onKeyDown:d,...u},p)=>{const{isOpen:f,setIsOpen:h,rootClass:C}=n.useContext(l),N=f===r,g=()=>{h(N?"":r)};return e(m.Provider,{value:{itemOpen:N,handleTrigger:g},children:e("div",{ref:p,onMouseEnter:i(s,g),onMouseLeave:i(c,g),className:a(`${C}-item`,t),onKeyDown:i(d,(e=>{"Escape"===e.key&&h("")})),...u,children:o})})}));u.displayName="NavigationMenuItem";const p=n.forwardRef((({children:r,className:t,onClick:s,...c},d)=>{const{handleTrigger:u}=n.useContext(m),{rootClass:p}=n.useContext(l);return e(o.Item,{children:e("button",{ref:d,onClick:i(s,u),className:a(`${p}-trigger`,t),...c,children:r})})}));p.displayName="NavigationMenuTrigger";const f=n.forwardRef((({children:t,className:s,...i},c)=>{const{itemOpen:d}=n.useContext(m),{rootClass:u}=n.useContext(l),p=n.useRef(null);return n.useImperativeHandle(c,(()=>p.current)),r((()=>{const e=p.current?.querySelector("*");e?.focus()}),[d]),d?e("div",{ref:p,className:a(`${u}-content`,s),"data-state":d?"open":"closed",...i,children:e(o.Root,{children:e(o.Group,{children:t})})}):null}));f.displayName="NavigationMenuContent";const h=n.forwardRef((({children:r,href:t,className:s,...i},c)=>{const{rootClass:d}=n.useContext(l);return e(o.Item,{children:e("a",{ref:c,href:t,className:a(`${d}-link`,s),...i,children:r})})}));h.displayName="NavigationMenuLink";const C={Root:d,Item:u,Trigger:p,Content:f,Link:h};export{C as default};
|
|
@@ -1,8 +1,29 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
type NumberFieldRootProps = {
|
|
5
|
+
name?: string;
|
|
6
|
+
defaultValue?: number | '';
|
|
7
|
+
value?: number | '';
|
|
8
|
+
onValueChange?: (value: number | '') => void;
|
|
9
|
+
step?: number;
|
|
10
|
+
largeStep?: number;
|
|
11
|
+
min?: number;
|
|
12
|
+
max?: number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
readOnly?: boolean;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
} & ComponentPropsWithoutRef<'div'>;
|
|
17
|
+
|
|
18
|
+
type NumberFieldInputProps = ComponentPropsWithoutRef<'input'>;
|
|
19
|
+
|
|
20
|
+
type NumberFieldIncrementProps = ComponentPropsWithoutRef<'button'>;
|
|
21
|
+
|
|
22
|
+
type NumberFieldDecrementProps = ComponentPropsWithoutRef<'button'>;
|
|
2
23
|
|
|
3
24
|
declare const NumberField: {
|
|
4
25
|
(): null;
|
|
5
|
-
Root:
|
|
26
|
+
Root: React.ForwardRefExoticComponent<{
|
|
6
27
|
name?: string;
|
|
7
28
|
defaultValue?: number | "";
|
|
8
29
|
value?: number | "";
|
|
@@ -14,10 +35,11 @@ declare const NumberField: {
|
|
|
14
35
|
disabled?: boolean;
|
|
15
36
|
readOnly?: boolean;
|
|
16
37
|
required?: boolean;
|
|
17
|
-
} & Omit<
|
|
18
|
-
Input:
|
|
19
|
-
Increment:
|
|
20
|
-
Decrement:
|
|
38
|
+
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
39
|
+
Input: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
40
|
+
Increment: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
41
|
+
Decrement: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
21
42
|
};
|
|
22
43
|
|
|
23
44
|
export { NumberField as default };
|
|
45
|
+
export type { NumberFieldDecrementProps, NumberFieldIncrementProps, NumberFieldInputProps, NumberFieldRootProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import r,{forwardRef as n,useContext as t}from"react";import{u as l}from"./index-wRElCyvx.js";import{c as i}from"./index-6If6D2Zi.js";import{c as a}from"./clsx-BaVHROc5.js";const d=r.createContext(null),s="NumberField",o=n((({children:r,name:n,defaultValue:t="",value:o,onValueChange:u,largeStep:m,step:c,min:p,max:b,disabled:y,readOnly:N,required:f,id:h,className:v,...F},w)=>{const C=i(v,s),[D,g]=l(o,t,u),O={inputValue:D,handleOnChange:e=>{g(""!==e?void 0!==b&&e>b?b:void 0!==p&&e<p?p:e:"")},handleStep:({type:e,direction:r})=>{let n=0;switch(e){case"small":if(!c)return;n=c;break;case"large":if(!m)return;n=m}"decrement"===r&&(n*=-1),(e=>{g((r=>{let n=r;""===n&&(n=void 0!==p?p:-1);const t=n+e;return void 0!==b&&t>b?b:void 0!==p&&t<p?p:t}))})(n)},id:h,name:n,disabled:y,readOnly:N,required:f,rootClass:C};return e("div",{ref:w,className:a(`${C}-root`,v),...F,children:e(d.Provider,{value:O,children:r})})}));o.displayName=s;const u=n((({className:r,...n},l)=>{const i=t(d);if(!i)return console.error("NumberFieldInput must be used within a NumberField"),null;const{inputValue:s,handleOnChange:o,handleStep:u,id:m,name:c,disabled:p,readOnly:b,required:y,rootClass:N}=i;return e("input",{ref:l,type:"number",onKeyDown:e=>{"ArrowUp"!==e.key||e.shiftKey||(e.preventDefault(),u({direction:"increment",type:"small"})),"ArrowDown"!==e.key||e.shiftKey||(e.preventDefault(),u({direction:"decrement",type:"small"})),"ArrowUp"===e.key&&e.shiftKey&&(e.preventDefault(),u({direction:"increment",type:"large"})),"ArrowDown"===e.key&&e.shiftKey&&(e.preventDefault(),u({direction:"decrement",type:"large"}))},value:""===s?"":s,onChange:e=>{const r=e.target.value;o(""===r?"":Number(r))},id:m,name:c,disabled:p,readOnly:b,required:y,className:a(`${N}-input`,r),...n})}));u.displayName="NumberFieldInput";const m=n((({children:r,className:n,...l},i)=>{const s=t(d);if(!s)return console.error("NumberFieldIncrement must be used within a NumberField"),null;const{handleStep:o,rootClass:u,disabled:m,readOnly:c}=s;return e("button",{ref:i,onClick:()=>o({direction:"increment",type:"small"}),className:a(`${u}-increment`,n),disabled:m||c,type:"button",...l,children:r})}));m.displayName="NumberFieldIncrement";const c=n((({children:r,className:n,...l},i)=>{const s=t(d);if(!s)return console.error("NumberFieldDecrement must be used within a NumberField"),null;const{handleStep:o,rootClass:u,disabled:m,readOnly:c}=s;return e("button",{ref:i,onClick:()=>o({direction:"decrement",type:"small"}),className:a(`${u}-decrement`,n),disabled:m||c,type:"button",...l,children:r})}));c.displayName="NumberFieldDecrement";const p=()=>(console.warn("Direct usage of NumberField is not supported. Please use NumberField.Root, NumberField.Item instead."),null);p.Root=o,p.Input=u,p.Increment=m,p.Decrement=c;export{p as default};
|
|
@@ -24,4 +24,4 @@ type ProgressComponent = React.ForwardRefExoticComponent<ProgressProps & React.R
|
|
|
24
24
|
declare const Progress: ProgressComponent;
|
|
25
25
|
|
|
26
26
|
export { COMPONENT_NAME, Progress as default };
|
|
27
|
-
export type { ProgressProps };
|
|
27
|
+
export type { ProgressIndicatorProps, ProgressProps, ProgressRootProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{
|
|
1
|
+
'use client';import{jsx as a}from"react/jsx-runtime";import{createContext as e,forwardRef as s,useState as r,useEffect as t,useContext as l}from"react";import{c as o}from"./clsx-BaVHROc5.js";import{c as i}from"./index-6If6D2Zi.js";import{P as m}from"./index-98jQ1vTr.js";const n=e({value:0,minValue:0,maxValue:100,rootClass:"",ariaLabel:"",state:"loading"}),d="Progress",u="loading",c="complete",v="indeterminate",x=s((({value:e=0,minValue:s=0,maxValue:l=100,children:x,customRootClass:p,getValueLabel:g,className:f,...V},h)=>{const[P,C]=r(u),b=i(p,d),N=g?.(e??0,s,l)??"";t((()=>{C(null===e?v:e===l?c:u)}),[e,l]);const y={value:e,minValue:s,maxValue:l,rootClass:b,getValueLabel:g,ariaLabel:N,state:P},{asChild:j,...L}=V;return a(n.Provider,{value:y,children:a(m.div,{role:"progressbar","aria-label":N,"aria-valuetext":N,"aria-valuenow":e??0,"aria-valuemin":s,"aria-valuemax":l,"data-state":P,"data-value":e??0,"data-max":l,"data-min":s,className:o(b,f),asChild:j,ref:h,...L,children:x})})}));x.displayName=d;const p=s((({className:e,style:s,...r},t)=>{const{value:i,minValue:d,maxValue:u,rootClass:c,state:v}=l(n),x=Math.min(Math.max(i??0,d),u),p=(x-d)/(u-d)*100,{asChild:g,...f}=r;return a(m.div,{role:"progressbar",className:o(`${c}-indicator`,e),style:{transform:`translateX(-${100-p}%)`,...s},"aria-valuenow":x,"aria-valuemax":u,"aria-valuemin":d,"data-state":v,"data-value":x,"data-max":u,"data-min":d,asChild:g,ref:t,...f})}));p.displayName="ProgressIndicator";const g="Progress",f=s(((e,s)=>(console.warn("Direct usage of Progress is not supported. Please use Progress.Root, Progress.Indicator, etc. instead."),a(x,{ref:s,...e}))));f.displayName=g,f.Root=x,f.Indicator=p;export{g as COMPONENT_NAME,f as default};
|
package/dist/components/Quote.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{
|
|
1
|
+
'use client';import{jsx as r}from"react/jsx-runtime";import s from"react";import{c as o}from"./index-6If6D2Zi.js";import{c as e}from"./clsx-BaVHROc5.js";const t="Quote",a=s.forwardRef((({children:s,customRootClass:a,className:m,...c},i)=>{const f=o(a,t);return r("q",{ref:i,className:e(f,m),...c,children:s})}));a.displayName=t;export{a as default};
|
package/dist/components/Radio.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import a from"react";import{P as i}from"./index-98jQ1vTr.js";import{c as d}from"./clsx-BaVHROc5.js";import{c as r}from"./index-6If6D2Zi.js";import{c as s,a as o,b as t}from"./index-3dZuI04X.js";const n=a.forwardRef((({name:a,value:d,id:r,checked:s,required:o,onChange:t,disabled:n,asChild:c,className:m,...l},u)=>e(i.input,{ref:u,type:"radio",checked:s,name:a,tabIndex:-1,value:d,onChange:t,id:r,"aria-disabled":n,disabled:n,required:o,"aria-required":o,asChild:c,className:m,...l})));n.displayName="RadioPrimitive";const c="Radio",m=a.forwardRef((function({name:i,value:m,id:l,checked:u=!1,required:f,onChange:h,disabled:p,asChild:C,className:b,customRootClass:v,variant:x="",size:N="",color:j="",...k},q){const R=r(v,c),[g,y]=a.useState(u),w=s("button",{variant:x,size:N}),z=t(j),P=o(w,z);return e(n,{ref:q,name:i,id:l,value:m,checked:g,required:f,onChange:()=>{h&&h(),y(!g)},disabled:p,asChild:C,className:d(R,b),"data-checked":g,...P,...k})}));m.displayName=c;export{m as default};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { ElementRef, ComponentPropsWithoutRef, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
2
|
import { RadioGroupPrimitiveRootProps } from '~/core/primitives/RadioGroup/fragments/RadioGroupPrimitiveRoot';
|
|
3
|
+
import { RadioGroupPrimitiveItemProps } from '~/core/primitives/RadioGroup/fragments/RadioGroupPrimitiveItem';
|
|
3
4
|
|
|
4
5
|
type RadioCardsRootProps = RadioGroupPrimitiveRootProps & {
|
|
5
6
|
children: React.ReactNode;
|
|
@@ -13,6 +14,10 @@ type RadioCardsRootProps = RadioGroupPrimitiveRootProps & {
|
|
|
13
14
|
};
|
|
14
15
|
declare const RadioCardsRoot: React.ForwardRefExoticComponent<RadioCardsRootProps & React.RefAttributes<HTMLElement>>;
|
|
15
16
|
|
|
17
|
+
type RadioCardsItemProps = RadioGroupPrimitiveItemProps & {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
className?: string;
|
|
20
|
+
};
|
|
16
21
|
declare const RadioCardsItem: React.ForwardRefExoticComponent<Omit<{
|
|
17
22
|
label?: string;
|
|
18
23
|
description?: string;
|
|
@@ -35,4 +40,4 @@ interface RadioCardsComponent extends ForwardRefExoticComponent<RadioCardsProps
|
|
|
35
40
|
declare const RadioCards: RadioCardsComponent;
|
|
36
41
|
|
|
37
42
|
export { RadioCards as default };
|
|
38
|
-
export type { RadioCardsElement, RadioCardsProps };
|
|
43
|
+
export type { RadioCardsElement, RadioCardsItemProps, RadioCardsProps, RadioCardsRootProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import
|
|
1
|
+
'use client';import{createContext as o,forwardRef as a,useContext as s}from"react";import{jsx as r}from"react/jsx-runtime";import{R as i}from"./RadioGroupPrimitive-QSMno27i.js";import{c as e}from"./clsx-BaVHROc5.js";import{c as t}from"./index-6If6D2Zi.js";import{c as d,a as m,b as n}from"./index-3dZuI04X.js";import"./index-98jQ1vTr.js";import"./index-hAp0hL9w.js";import"./index-BOy86lYu.js";import"./index-wRElCyvx.js";const l=o({rootClass:""}),c=a((({children:o,className:a="",customRootClass:s="",variant:c="",size:p="",color:R="",orientation:u="both",...C},f)=>{const j=t(s,"RadioCards"),x=d("radio-cards",{variant:c,size:p}),v=n(R),N=m(x,v);return r(l.Provider,{value:{rootClass:j},children:r(i.Root,{ref:f,className:e(j,a),...C,...N,orientation:u,children:o})})}));c.displayName="RadioCardsRoot";const p=a((({children:o,className:a="",value:t,...d},m)=>{const{rootClass:n}=s(l);return r(i.Item,{ref:m,className:e(`${n}-item`,a),...d,value:t,children:o})}));p.displayName="RadioCardsItem";const R=a(((o,a)=>(console.warn("Direct usage of RadioCards is not supported. Please use RadioCards.Root and RadioCards.Item instead."),null)));R.displayName="RadioCards",R.Root=c,R.Item=p;export{R as default};
|
|
@@ -48,4 +48,4 @@ type RadioGroupComponent = React.ForwardRefExoticComponent<RadioGroupProps & Rea
|
|
|
48
48
|
declare const RadioGroup: RadioGroupComponent;
|
|
49
49
|
|
|
50
50
|
export { RadioGroup as default };
|
|
51
|
-
export type { RadioGroupElement, RadioGroupProps };
|
|
51
|
+
export type { RadioGroupElement, RadioGroupProps, RadioGroupRootProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import
|
|
1
|
+
'use client';import o,{createContext as r,useContext as a}from"react";import{jsx as e,jsxs as s}from"react/jsx-runtime";import{R as i}from"./RadioGroupPrimitive-QSMno27i.js";import{c as t}from"./clsx-BaVHROc5.js";import{c as d}from"./index-6If6D2Zi.js";import{c as l,a as n,b as c}from"./index-3dZuI04X.js";import{P as m}from"./index-98jQ1vTr.js";import"./index-hAp0hL9w.js";import"./index-BOy86lYu.js";import"./index-wRElCyvx.js";const p=r({rootClass:""}),u=o.forwardRef((({children:o,className:r="",customRootClass:a="",variant:m="",size:u="",color:f="",...R},N)=>{const h=d(a,"RadioGroup"),x=l("radio-group",{variant:m,size:u}),j=c(f),C=n(x,j);return e(p.Provider,{value:{rootClass:h},children:s(i.Root,{ref:N,className:t(`${h}-root`,r),...C,...R,children:[" ",o," "]})})}));u.displayName="RadioGroupRoot";const f=o.forwardRef((({children:o,className:r="",value:s,...d},l)=>{const{rootClass:n}=a(p);return e(i.Item,{ref:l,className:t(`${n}-item`,r),value:s,...d,children:o})}));f.displayName="RadioGroupItem";const R=o.forwardRef((({className:r="",children:a,...s},d)=>{const{rootClass:l}=o.useContext(p);return e(i.Indicator,{ref:d,className:t(`${l}-indicator`,r),...s,children:a})}));R.displayName="RadioGroupIndicator";const N=o.forwardRef((({className:r="",asChild:a=!1,children:e,...i},d)=>{const{rootClass:l}=o.useContext(p);return s(m.label,{ref:d,...i,className:t(`${l}-label`,r),asChild:a,children:[" ",e," "]})}));N.displayName="RadioGroupLabel";const h=o.forwardRef(((o,r)=>(console.warn("Direct usage of RadioGroup is not supported. Please use RadioGroup.Root and RadioGroup.Item instead."),null)));h.displayName="RadioGroup",h.Root=u,h.Item=f,h.Indicator=R,h.Label=N;export{h as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use client';import e,{useContext as i}from"react";import{jsxs as a,jsx as r,Fragment as d}from"react/jsx-runtime";import{P as o}from"./index-98jQ1vTr.js";import{R as t}from"./index-hAp0hL9w.js";import{u as l}from"./index-wRElCyvx.js";import{B as n}from"./index-BOy86lYu.js";const s=e.createContext(null),c=e.forwardRef((({value:e,defaultValue:i="",onValueChange:n,children:c,disabled:u=!1,required:m=!1,name:p="",orientation:h="horizontal",loop:f=!1,dir:R="ltr",...v},b)=>{const[C,x]=l(e,i,n),G={selectedValue:C,setSelectedValue:x,groupDisabled:u};return a(o.div,{ref:b,...v,"aria-required":m,role:"radiogroup","aria-disabled":u,"data-disabled":u?"":void 0,children:[r(t.Root,{dir:R,orientation:h,loop:f,asChild:!0,children:r(s.Provider,{value:G,children:r(t.Group,{children:c})})}),p&&a(d,{children:[r("input",{type:"hidden",name:p,value:C,disabled:u}),m&&""!==C&&r("input",{type:"radio",name:p,value:C,checked:!0,onChange:()=>{},disabled:u,required:!0,"aria-hidden":"true",tabIndex:-1,style:{position:"absolute",width:0,height:0,opacity:0,pointerEvents:"none",margin:0}})]})]})}));c.displayName="RadioGroupPrimitiveRoot";const u=e.createContext({itemSelected:!1}),m=e.forwardRef((({value:e,children:a,disabled:d,required:o=!1,className:l="",asChild:c=!1,...m},p)=>{const h=i(s);if(!h)throw new Error("RadioGroup.Item must be used within a RadioGroup.Root");const{groupDisabled:f,selectedValue:R,setSelectedValue:v}=h,b=e===R;return r(u.Provider,{value:{itemSelected:b},children:r(t.Item,{children:r(n,{ref:p,role:"radio",type:"button",disabled:f||d,onClick:()=>v(e),onFocus:()=>v(e),"aria-disabled":f||d,"aria-checked":b,"aria-selected":void 0,"data-state":b?"checked":"unchecked","data-disabled":f||d?"":void 0,"aria-required":o,asChild:c,className:l,...m,children:a})})})}));m.displayName="RadioGroupPrimitiveItem";const p=e.forwardRef((({children:i,className:a,asChild:d=!1,...t},l)=>{const{itemSelected:n}=e.useContext(u);return n?r(o.span,{ref:l,className:a,asChild:d,...t,children:i}):null}));p.displayName="RadioGroupPrimitiveIndicator";const h=e.forwardRef(((e,i)=>(console.warn("Direct usage of RadioGroup is not supported. Please use RadioGroup.Root, RadioGroup.Item, etc. instead."),null)));h.displayName="RadioGroupPrimitive",h.Root=c,h.Item=m,h.Indicator=p;export{h as R};
|
|
@@ -1,17 +1,32 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
2
|
|
|
3
|
+
type ScrollAreaRootProps = ComponentPropsWithoutRef<'div'> & {
|
|
4
|
+
customRootClass?: string;
|
|
5
|
+
type?: 'auto' | 'always' | 'scroll' | 'hover';
|
|
6
|
+
};
|
|
3
7
|
declare const ScrollAreaRoot: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
4
8
|
customRootClass?: string;
|
|
9
|
+
type?: "auto" | "always" | "scroll" | "hover";
|
|
5
10
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
6
11
|
|
|
12
|
+
type ScrollAreaViewportProps = ComponentPropsWithoutRef<'div'>;
|
|
7
13
|
declare const ScrollAreaViewport: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
14
|
|
|
15
|
+
type ScrollAreaScrollbarProps = ComponentPropsWithoutRef<'div'> & {
|
|
16
|
+
orientation?: 'horizontal' | 'vertical';
|
|
17
|
+
};
|
|
9
18
|
declare const ScrollAreaScrollbar: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
10
19
|
orientation?: "horizontal" | "vertical";
|
|
11
20
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
type ScrollAreaThumbProps = ComponentPropsWithoutRef<'div'> & {
|
|
23
|
+
orientation?: 'horizontal' | 'vertical';
|
|
24
|
+
};
|
|
25
|
+
declare const ScrollAreaThumb: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
26
|
+
orientation?: "horizontal" | "vertical";
|
|
27
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
14
28
|
|
|
29
|
+
type ScrollAreaCornerProps = ComponentPropsWithoutRef<'div'>;
|
|
15
30
|
declare const ScrollAreaCorner: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
31
|
|
|
17
32
|
type ScrollAreaProps = React.ComponentPropsWithoutRef<'div'>;
|
|
@@ -24,3 +39,4 @@ declare const ScrollArea: React.ForwardRefExoticComponent<ScrollAreaProps> & {
|
|
|
24
39
|
};
|
|
25
40
|
|
|
26
41
|
export { ScrollArea as default };
|
|
42
|
+
export type { ScrollAreaCornerProps, ScrollAreaRootProps, ScrollAreaScrollbarProps, ScrollAreaThumbProps, ScrollAreaViewportProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import e,{createContext as
|
|
1
|
+
'use client';import e,{createContext as t,forwardRef as r,useRef as n,useEffect as c,useContext as l,useCallback as o}from"react";import{jsx as i}from"react/jsx-runtime";import{c as s}from"./clsx-BaVHROc5.js";import{c as u}from"./index-6If6D2Zi.js";const a=t({rootClass:"",type:"hover"}),d="ScrollArea",f=r((({children:t,className:r="",customRootClass:l="",type:o="hover",...f},m)=>{const h=u(l,d),v=n(null),p=n(null),y=n(null),b=n(null),[g,w]=e.useState({x:!1,y:!1});c((()=>{L()}),[p,y,b]),c((()=>{const e=b.current;if(!e)return;const t=()=>{L()},r=new ResizeObserver((()=>t()));r.observe(e),Array.from(e.children).forEach((e=>r.observe(e)));const n=new MutationObserver((()=>{t()}));return n.observe(e,{childList:!0,subtree:!0}),window.addEventListener("resize",t),()=>{r.disconnect(),n.disconnect(),window.removeEventListener("resize",t)}}),[]);const L=()=>{if(!b.current)return;const e=b.current,t=e.clientHeight,r=e.scrollHeight,n=r>t;if(p.current)if(t<=0)p.current.style.height="0px";else if(n){let e=t/(r/t);e=Math.max(e,24),p.current.style.height=`${e}px`}else p.current.style.height=`${t}px`;const c=e.clientWidth,l=e.scrollWidth,o=l>c;if(y.current)if(c<=0)y.current.style.width="0px";else if(o){let e=c/(l/c);e=Math.max(e,24),y.current.style.width=`${e}px`}else y.current.style.width=`${c}px`;w({x:o,y:n})},x=e=>{if(!b.current)return;const t=b.current,r=t.scrollTop,n=t.scrollLeft,c=void 0!==e.top?e.top-r:0,l=void 0!==e.left?e.left-n:0,o=performance.now(),i=s=>{const u=s-o,a=Math.min(u/150,1),d=1-Math.pow(1-a,3);void 0!==e.top&&(t.scrollTop=r+c*d),void 0!==e.left&&(t.scrollLeft=n+l*d),a<1&&requestAnimationFrame(i)};requestAnimationFrame(i)};return i(a.Provider,{value:{rootClass:h,scrollYThumbRef:p,scrollXThumbRef:y,scrollAreaViewportRef:b,handleScroll:()=>{if(!b.current)return;const e=b.current;if(p.current){const t=e.clientHeight,r=e.scrollHeight,n=e.scrollTop,c=p.current.clientHeight;if(t<=0||r<=t)p.current.style.top="0px";else{const e=n/(r-t)*(t-c);p.current.style.top=`${e}px`}}if(y.current){const t=e.clientWidth,r=e.scrollWidth,n=e.scrollLeft,c=y.current.clientWidth;if(t<=0||r<=t)y.current.style.left="0px";else{const e=n/(r-t)*(t-c);y.current.style.left=`${e}px`}}},handleScrollbarClick:e=>{if(!b.current)return;const t=b.current;if("vertical"===e.orientation&&void 0!==e.clientY){const r=p.current;if(!r)return;if(t.clientHeight<=0||t.scrollHeight<=t.clientHeight)return;const n=r.getBoundingClientRect(),c=t.scrollHeight/t.clientHeight;e.clientY<n.top?x({top:t.scrollTop-r.clientHeight*c}):e.clientY>n.bottom&&x({top:t.scrollTop+r.clientHeight*c})}else if("horizontal"===e.orientation&&void 0!==e.clientX){const r=y.current;if(!r)return;if(t.clientWidth<=0||t.scrollWidth<=t.clientWidth)return;const n=r.getBoundingClientRect(),c=t.scrollWidth/t.clientWidth;e.clientX<n.left?x({left:t.scrollLeft-r.clientWidth*c}):e.clientX>n.right&&x({left:t.scrollLeft+r.clientWidth*c})}},type:o,rootRef:v},children:i("div",{ref:e=>{v.current=e,"function"==typeof m?m(e):m&&(m.current=e)},className:s(h,r),"data-scrollbar-x":String(g.x||"always"===o),"data-scrollbar-y":String(g.y||"always"===o),...f,children:t})})}));f.displayName=d;const m=r((({children:e,className:t="",...r},n)=>{const{rootClass:c,scrollAreaViewportRef:o,handleScroll:u}=l(a);return i("div",{ref:e=>{o&&(o.current=e),"function"==typeof n?n(e):n&&(n.current=e)},className:s(c+"-viewport",t),onScroll:u,...r,children:e})}));m.displayName="ScrollAreaViewport";const h=r((({children:t,className:r="",orientation:c="vertical",...o},u)=>{const{rootClass:d,handleScrollbarClick:f,scrollXThumbRef:m,scrollYThumbRef:h,type:v,scrollAreaViewportRef:p,rootRef:y}=l(a),b=n(null),g=n(!1),w=n(null),[L,x]=e.useState(!1),T=n(0),[E,S]=e.useState("always"===v),[R,C]=e.useState(!1),A=n(null),H=e.useCallback((()=>{"scroll"!==v&&"hover"!==v||(S(!0),A.current&&clearTimeout(A.current),A.current=setTimeout((()=>{S(!1)}),1e3))}),[v]);e.useEffect((()=>{if("always"===v||"auto"===v)return;const e=p?.current;if(!e)return;const t=()=>H();return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t),A.current&&clearTimeout(A.current)}}),[v,p,H]),e.useEffect((()=>{if("hover"!==v)return;const e=y?.current;if(!e)return;const t=()=>{A.current&&clearTimeout(A.current),S(!0)},r=()=>{A.current&&clearTimeout(A.current),A.current=setTimeout((()=>{S(!1)}),500)};return e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",r),()=>{e.removeEventListener("mouseenter",t),e.removeEventListener("mouseleave",r)}}),[v,y]),e.useEffect((()=>{const e=p?.current;if(!e)return;const t=()=>{const t="vertical"===c?e.scrollHeight>e.clientHeight:e.scrollWidth>e.clientWidth;C(t)};t();const r=new ResizeObserver(t);return r.observe(e),Array.from(e.children).forEach((e=>r.observe(e))),()=>r.disconnect()}),[p,c]);const W=e.useCallback((e=>{const t="vertical"===c?h?.current:m?.current;if(!t)return!1;const r=t.getBoundingClientRect();return"vertical"===c?e<r.top||e>r.bottom:e<r.left||e>r.right}),[c,m,h]),N=e.useCallback((e=>{f&&(e.preventDefault(),T.current="vertical"===c?e.clientY:e.clientX,f({clientY:e.clientY,clientX:e.clientX,orientation:c}),setTimeout((()=>{g.current&&(b.current=setInterval((()=>{g.current&&W(T.current)?f({clientY:"vertical"===c?T.current:void 0,clientX:"horizontal"===c?T.current:void 0,orientation:c}):M()}),50))}),300),g.current=!0,x(!0))}),[f,c,W]),M=e.useCallback((()=>{g.current=!1,w.current?.(),w.current=null,b.current&&(clearInterval(b.current),b.current=null),x(!1)}),[]);e.useEffect((()=>{if(!g.current)return()=>{w.current?.(),M()};const e=()=>M(),t=()=>M();return document.addEventListener("mouseup",e),document.addEventListener("mouseleave",t),w.current=()=>{document.removeEventListener("mouseup",e),document.removeEventListener("mouseleave",t)},()=>{w.current?.(),w.current=null,M()}}),[L,M]);const X="always"===v||"auto"===v&&R||R&&E,Y=R||"always"===v;return i("div",{ref:u,className:s(d+"-scrollbar",r),"data-orientation":c,"data-state":X?"visible":"hidden",style:{display:Y?void 0:"none",...o.style},onMouseDown:N,onMouseUp:M,onMouseLeave:M,...o,children:t})}));h.displayName="ScrollAreaScrollbar";const v=r((({children:t,className:r="",orientation:c="vertical",...u},d)=>{const{rootClass:f,scrollXThumbRef:m,scrollYThumbRef:h,scrollAreaViewportRef:v}=l(a),p=n(!1),y=n({x:0,y:0,scrollTop:0,scrollLeft:0}),b=o((e=>{v?.current&&(e.preventDefault(),e.stopPropagation(),p.current=!0,y.current={x:e.clientX,y:e.clientY,scrollTop:v.current.scrollTop,scrollLeft:v.current.scrollLeft},document.body.style.userSelect="none",document.body.style.cursor="grabbing")}),[v]),g=o((e=>{if(!p.current||!v?.current)return;const t=v.current,r="vertical"===c?h?.current:m?.current,n=r?.parentElement?.getBoundingClientRect();if(r&&n)if("vertical"===c){const c=(e.clientY-y.current.y)/(n.height-r.clientHeight),l=t.scrollHeight-t.clientHeight,o=y.current.scrollTop+c*l;t.scrollTop=Math.max(0,Math.min(o,l))}else{const c=(e.clientX-y.current.x)/(n.width-r.clientWidth),l=t.scrollWidth-t.clientWidth,o=y.current.scrollLeft+c*l;t.scrollLeft=Math.max(0,Math.min(o,l))}}),[c,v,m,h]),w=o((()=>{p.current=!1,document.body.style.cursor="",document.body.style.userSelect=""}),[]);e.useEffect((()=>{const e=e=>g(e),t=()=>w();return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t),w()}}),[g,w]);return i("div",{ref:e=>{const t="vertical"===c?h:m;t&&(t.current=e),"function"==typeof d?d(e):d&&(d.current=e)},className:s(f+"-thumb",r),onMouseDown:b,...u,children:t})}));v.displayName="ScrollAreaThumb";const p=r((({children:e,className:t,...r},n)=>{const{rootClass:c}=l(a);return i("div",{ref:n,className:s(c+"-corner",t),...r,children:e})}));p.displayName="ScrollAreaCorner";const y=e.forwardRef(((e,t)=>(console.warn("Direct usage of ScrollArea is not supported. Please use ScrollArea.Root and ScrollArea.Viewport instead."),null)));y.Root=f,y.Viewport=m,y.Scrollbar=h,y.Thumb=v,y.Corner=p,y.displayName="ScrollArea";export{y as default};
|