@radui/ui 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/components/Accordion.d.ts +19 -33
- package/dist/components/Accordion.js +1 -1
- package/dist/components/AlertDialog.d.ts +2 -0
- package/dist/components/AlertDialog.js +1 -1
- package/dist/components/AspectRatio.d.ts +2 -2
- package/dist/components/AspectRatio.js +1 -1
- package/dist/components/Avatar.js +1 -1
- package/dist/components/AvatarGroup.js +1 -1
- package/dist/components/{AvatarPrimitiveFallback-BOYawMc9.js → AvatarPrimitiveFallback-B1u295x6.js} +1 -1
- package/dist/components/Breadcrumb.d.ts +70 -0
- package/dist/components/Breadcrumb.js +1 -0
- package/dist/components/Button.js +1 -1
- package/dist/components/Callout.js +1 -1
- package/dist/components/Checkbox.js +1 -1
- package/dist/components/CheckboxCards.js +1 -1
- package/dist/components/CheckboxGroup.js +1 -1
- package/dist/components/{CheckboxGroupPrimitive-Cd8ra39e.js → CheckboxGroupPrimitive-BWGRST9p.js} +1 -1
- package/dist/components/Code.js +1 -1
- package/dist/components/Collapsible.js +1 -1
- package/dist/components/Combobox.js +1 -1
- package/dist/components/ComboboxPrimitive-C2sksm48.js +1 -0
- package/dist/components/Command.d.ts +1 -0
- package/dist/components/Command.js +1 -1
- package/dist/components/ContextMenu.d.ts +6 -6
- package/dist/components/ContextMenu.js +1 -1
- package/dist/components/Dialog.d.ts +1 -0
- package/dist/components/Dialog.js +1 -1
- package/dist/components/Disclosure.d.ts +2 -0
- package/dist/components/Disclosure.js +1 -1
- package/dist/components/Drawer.d.ts +94 -16
- package/dist/components/Drawer.js +1 -1
- package/dist/components/DropdownMenu.d.ts +6 -6
- package/dist/components/DropdownMenu.js +1 -1
- package/dist/components/Fieldset.d.ts +43 -0
- package/dist/components/Fieldset.js +1 -0
- package/dist/components/HoverCard.js +1 -1
- package/dist/components/Link.js +1 -1
- package/dist/components/LiveRegion.d.ts +73 -0
- package/dist/components/LiveRegion.js +1 -0
- package/dist/components/MenuPrimitive-COEgTo6S.js +1 -0
- package/dist/components/Menubar.d.ts +6 -6
- package/dist/components/Menubar.js +1 -1
- package/dist/components/Minimap.js +1 -1
- package/dist/components/NavigationMenu.d.ts +3 -0
- package/dist/components/NavigationMenu.js +1 -1
- package/dist/components/NumberField.js +1 -1
- package/dist/components/Popover.d.ts +68 -0
- package/dist/components/Popover.js +1 -0
- 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.js +1 -1
- package/dist/components/RadioGroup.js +1 -1
- package/dist/components/{RadioGroupPrimitive-CcvI-_wm.js → RadioGroupPrimitive-BWUU-0Qh.js} +1 -1
- package/dist/components/ScrollArea.d.ts +15 -3
- package/dist/components/ScrollArea.js +1 -1
- package/dist/components/Select.js +1 -1
- package/dist/components/Separator.js +1 -1
- package/dist/components/Slider.d.ts +1 -1
- package/dist/components/Slider.js +1 -1
- package/dist/components/Spinner.js +1 -1
- package/dist/components/Splitter.js +1 -1
- package/dist/components/Steps.js +1 -1
- package/dist/components/Switch.js +1 -1
- package/dist/components/TabNav.js +1 -1
- package/dist/components/Table.d.ts +65 -19
- package/dist/components/Table.js +1 -1
- package/dist/components/Tabs.d.ts +2 -0
- package/dist/components/Tabs.js +1 -1
- package/dist/components/TextArea.js +1 -1
- package/dist/components/TextField.js +1 -1
- package/dist/components/Toast.d.ts +322 -0
- package/dist/components/Toast.js +1 -0
- package/dist/components/Toggle.js +1 -1
- package/dist/components/ToggleGroup.js +1 -1
- package/dist/components/Toolbar.js +1 -1
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/Tree.d.ts +1 -0
- package/dist/components/Tree.js +1 -1
- package/dist/components/VisuallyHidden.js +1 -1
- package/dist/components/documentOverlayOpen-coyGmcyL.js +1 -0
- package/dist/components/index-C09ZQH_q.js +1 -0
- package/dist/components/index-CD_nZA9X.js +1 -0
- package/dist/components/{index-gM8bbyw1.js → index-CfC8-kd8.js} +1 -1
- package/dist/components/index-UODM4mVT.js +1 -0
- package/dist/components/index-XF8itt-H.js +1 -0
- package/dist/components/index-YhJvxumL.js +1 -0
- package/dist/components/index-m8Mhi26u.js +1 -0
- package/dist/components/keyboard-BKF7hXqL.js +1 -0
- package/dist/components/mergeProps-0RucjqeH.js +1 -0
- package/dist/themes/baremetal.css +1 -0
- package/dist/themes/default.css +1 -0
- package/dist/themes/tailwind-presets/default.css +396 -0
- package/package.json +65 -23
- package/dist/components/ComboboxPrimitive-BhHSrtiY.js +0 -1
- package/dist/components/MenuPrimitive-wJbEC-gM.js +0 -1
- package/dist/components/index-BbEsAodL.js +0 -1
- package/dist/components/index-DOVR6Rd5.js +0 -1
- package/dist/components/index-DU_6Msfu.js +0 -1
- package/dist/components/index-Ir5FYyWW.js +0 -1
- package/dist/components/index-m6qHOeQ9.js +0 -1
- package/dist/components/mergeProps-B9ocQsG4.js +0 -1
- package/dist/themes/tailwind-presets/default.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import t,{forwardRef as
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import t,{forwardRef as n}from"react";import{u as r}from"./useComponentClass-QwNivz0h.js";import{c as o}from"./clsx-BaVHROc5.js";import{F as s}from"./index-Db-tduwt.js";import{M as a}from"./MenuPrimitive-COEgTo6S.js";import u from"./Separator.js";import"./ThemeContext-Sm-iNANd.js";import"./floating-ui.react-Byzse64h.js";import"react-dom";import"./index-wRElCyvx.js";import"./index-UODM4mVT.js";import"./documentOverlayOpen-coyGmcyL.js";import"./index-XF8itt-H.js";import"./mergeProps-0RucjqeH.js";import"./index-CfC8-kd8.js";const l=t.createContext(null),i=n((({children:n,customRootClass:a,className:u,dir:i,loop:c,...d},m)=>{const p=r(a,"Menubar"),[b,f]=t.useState([]),[h,g]=t.useState(0),[M,C]=t.useState(),v=t.useRef({}),N=t.useCallback(((e,t="closed")=>{f((n=>{const r=n.find((t=>t.id===e));return r?r.state===t?n:n.map((n=>n.id===e?{...n,state:t}:n)):[...n,{id:e,state:t}]}))}),[]),x=t.useCallback(((e,t)=>{"open"===t&&C((e=>-1===e?e:void 0)),f((n=>n.map((n=>n.id===e?{...n,state:t}:n))))}),[]),y=t.useCallback(((e,t)=>{t?v.current[e]=t:delete v.current[e]}),[]),w=t.useCallback((e=>{const t=b[h],n=b[e];if(t&&x(t.id,"closed"),n){const e="open"===t?.state;x(n.id,e?"open":"closed")}g(e)}),[h,b,x]),I=t.useCallback((e=>{if(0===b.length)return;const t=h>=0?h:b.findIndex((e=>"open"===e.state));if(-1===t)return;const n=(t+e+b.length)%b.length,r=b[n];r&&(C(-1),f((e=>e.map(((e,t)=>({...e,state:t===n?"open":"closed"}))))),g(n),v.current[r.id]?.focus())}),[h,b]),R=t.useMemo((()=>({rootClass:p,registerItem:N,items:b,updateItemState:x,updateItemTrigger:y,navigateMenu:I,contentInitialFocus:M})),[p,N,b,x,y,I,M]);return e(l.Provider,{value:R,children:e(s.Composite,{ref:m,className:o(p&&`${p}-root`,u),dir:i,loop:c,...d,activeIndex:h,onNavigate:w,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:p,updateItemTrigger:b}=d;if(!m)return console.warn("MenubarTrigger should be used in the MenubarMenu"),null;const{id:f,isOpen:h}=m,g=t.useCallback((e=>{b(f,e),"function"==typeof i?i(e):i&&(i.current=e)}),[f,i,b]);return e(s.CompositeItem,{render:()=>e(a.Trigger,{ref:g,className:o(p&&`${p}-trigger`,r),"data-active":h,...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,navigateMenu:d,contentInitialFocus:m}=i,{onKeyDown:p,...b}=s,f=t.useCallback((e=>{"function"==typeof u?u(e):u&&(u.current=e)}),[u]);t.useEffect((()=>{const e=e=>{if(!e.defaultPrevented)return"ArrowLeft"===e.key?(e.preventDefault(),void d(-1)):void("ArrowRight"===e.key&&(e.preventDefault(),d(1)))};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}),[d]);return e(a.Content,{ref:f,className:o(c&&`${c}-content`,r),focusManagerDisabled:-1===m,initialFocus:m,onKeyDown:e=>{if(p?.(e),!e.defaultPrevented)return"ArrowLeft"===e.key?(e.preventDefault(),void d(-1)):void("ArrowRight"===e.key&&(e.preventDefault(),d(1)))},...b,children:n})}));m.displayName="MenubarContent";const p=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)));p.displayName="MenubarPortal";const b=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&&`${d}-item`,r),label:s,...u,children:n})}));b.displayName="MenubarItem";const f=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&&`${c}-sub`,r),...s,children:n})}));f.displayName="MenubarSub";const h=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&&`${c}-sub-trigger`,r),...s,children:n})}));h.displayName="MenubarSubTrigger";const g=n((({children:n,className:r,...u},i)=>{const d=t.useContext(l),m=s.useId(),p=t.useId(),b=m??p;if(!d)return console.warn("MenubarMenu should be used in the MenubarRoot"),null;const{rootClass:f,registerItem:h,items:g,updateItemState:M}=d;t.useEffect((()=>{b&&h(b)}),[b]);const C="open"===g.find((e=>e.id===b))?.state;return e(a.Root,{ref:i,className:o(f&&`${f}-menu`,r),"data-id":b,"data-active":C,open:C,onOpenChange:e=>b&&M(b,e?"open":"closed"),...u,children:e(c.Provider,{value:{id:b,isOpen:C},children:n})})}));g.displayName="MenubarMenu";const M=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})}));M.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=g,C.Trigger=d,C.Content=m,C.Portal=p,C.Item=b,C.Sub=f,C.SubTrigger=h,C.Separator=M;export{C as default};
|
|
@@ -1 +1 @@
|
|
|
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 s}from"./clsx-BaVHROc5.js";import{u as l}from"./useComponentClass-QwNivz0h.js";import{P as i}from"./index-
|
|
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 s}from"./clsx-BaVHROc5.js";import{u as l}from"./useComponentClass-QwNivz0h.js";import{P as i}from"./index-XF8itt-H.js";import{R as a}from"./index-m8Mhi26u.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-0RucjqeH.js";import"./index-CfC8-kd8.js";import"./keyboard-BKF7hXqL.js";import"./mergeRefs-B8eZ_q-T.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:s="0px",root:l}){const i=n(null);return o((()=>{if("undefined"==typeof window||!("IntersectionObserver"in window))return;if(!i.current)return;const n=l??m(i.current),o=new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting?e?.():t?.()}))}),{threshold:r,rootMargin:s,root:n});return o.observe(i.current),()=>{i.current&&o.unobserve(i.current),o.disconnect()}}),[e,t,r,s,l]),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=l(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:s(d,n),...u,children:r})})})})},Item:({children:r,className:n="",value:o,...l})=>{const{rootClass:m}=t.useContext(c)||{rootClass:""},{visibleItems:h,scrollToItem:f}=t.useContext(d),v=h.includes(o),p=t.useMemo((()=>({value:o,isVisible:v})),[o,v]),C=t.useCallback((()=>{f(o)}),[o,f]);return e(u.Provider,{value:p,children:e(a.Item,{value:o,children:e(i.button,{onClick:C,className:s(m&&`${m}-item`,n),"data-in-view":v?"true":"false",...l,children:r})})})},Track:({children:r,className:n="",...o})=>{const{rootClass:l}=t.useContext(c);return e("div",{className:s(l&&`${l}-track`,n),...o,children:r})},Line:({children:r,className:n="",...o})=>{const{rootClass:l}=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:s(l&&`${l}-line`,n),"data-in-view":v?"true":"false",...o,children:r})},Content:({children:r,className:n="",...o})=>{const{rootClass:l}=t.useContext(c);return e("div",{className:s(l&&`${l}-content`,n),...o,children:r})},Bubble:({children:r,className:n="",...o})=>{const{rootClass:l}=t.useContext(c)||{rootClass:""},{isVisible:i}=t.useContext(u)||{isVisible:!1};return e("div",{className:s(l&&`${l}-bubble`,n),"data-in-view":i?"true":"false",...o,children:r})},Provider:({children:r,className:n="",scrollable:o,...s})=>{const[l,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,s=r.scrollHeight-r.clientHeight,l=Math.max(0,Math.min(o,s));Math.abs(l-r.scrollTop)>1&&r.scrollTo({top:l,behavior:"smooth"})}}),[]),v=t.useMemo((()=>({visibleItems:l,handleInView:m,handleOutView:h,scrollToItem:f,registerRef:u})),[l,m,h,f,u]);return e(d.Provider,{value:v,children:e("div",{ref:c,className:`${n}`,...s,children:r})})},Waypoint:({children:r,className:n="",value:o="",...l})=>{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:s(n),...l,children:r})}});export{f as default};
|
|
@@ -7,6 +7,8 @@ interface NavigationMenuRootProps extends React__default.ComponentPropsWithoutRe
|
|
|
7
7
|
defaultValue?: string;
|
|
8
8
|
onValueChange?: (value: string) => void;
|
|
9
9
|
customRootClass?: string;
|
|
10
|
+
loop?: boolean;
|
|
11
|
+
contentLoop?: boolean;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
interface NavigationMenuItemProps extends React__default.ComponentPropsWithoutRef<'div'> {
|
|
@@ -18,6 +20,7 @@ interface NavigationMenuTriggerProps extends React__default.ComponentPropsWithou
|
|
|
18
20
|
|
|
19
21
|
interface NavigationMenuContentProps extends React__default.ComponentPropsWithoutRef<'div'> {
|
|
20
22
|
children: React__default.ReactNode;
|
|
23
|
+
loop?: boolean;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
interface NavigationMenuLinkProps extends React__default.ComponentPropsWithoutRef<'a'> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import o from"react";import{R as n}from"./index-m8Mhi26u.js";import{u as t}from"./index-wRElCyvx.js";import{u as r}from"./useComponentClass-QwNivz0h.js";import{c as s}from"./clsx-BaVHROc5.js";import{c as a}from"./index-CXzybYmm.js";import{K as i}from"./keyboard-BKF7hXqL.js";import"./index-XF8itt-H.js";import"./mergeProps-0RucjqeH.js";import"./index-CfC8-kd8.js";import"./mergeRefs-B8eZ_q-T.js";import"./ThemeContext-Sm-iNANd.js";const l=o.createContext({isOpen:"",setIsOpen:()=>{},rootClass:"",contentLoop:!0}),c="NavigationMenu",m=o.forwardRef((({children:o,value:a,defaultValue:i="",onValueChange:m,customRootClass:d,loop:p=!0,contentLoop:u=!0,className:f,...h},C)=>{const g=r(d,c),[N,x]=t(a,i,m);return e("div",{ref:C,...h,children:e(l.Provider,{value:{isOpen:N,setIsOpen:x,rootClass:g,contentLoop:u},children:e(n.Root,{loop:p,children:e(n.Group,{className:s(g&&`${g}-root`,f),children:o})})})})}));m.displayName=c;const d=o.createContext({itemOpen:!1,handleTrigger:()=>{}}),p=o.forwardRef((({value:n,children:t,className:r,onMouseEnter:c,onMouseLeave:m,onKeyDown:p,...u},f)=>{const{isOpen:h,setIsOpen:C,rootClass:g}=o.useContext(l),N=h===n,x=()=>{C(N?"":n)};return e(d.Provider,{value:{itemOpen:N,handleTrigger:x},children:e("div",{ref:f,onMouseEnter:a(c,x),onMouseLeave:a(m,x),className:s(g&&`${g}-item`,r),onKeyDown:a(p,(e=>{e.key===i.ESCAPE&&C("")})),...u,children:t})})}));p.displayName="NavigationMenuItem";const u=o.forwardRef((({children:t,className:r,onClick:i,...c},m)=>{const{handleTrigger:p,itemOpen:u}=o.useContext(d),{rootClass:f}=o.useContext(l);return e(n.Item,{children:e("button",{ref:m,onClick:a(i,p),className:s(f&&`${f}-trigger`,r),"aria-expanded":u,"data-state":u?"open":"closed",...c,children:t})})}));u.displayName="NavigationMenuTrigger";const f=o.forwardRef((({children:t,className:r,loop:a,...i},c)=>{const{itemOpen:m}=o.useContext(d),{rootClass:p,contentLoop:u}=o.useContext(l),f=o.useRef(null),h=a??u;return o.useImperativeHandle(c,(()=>f.current)),m?e("div",{ref:f,className:s(p&&`${p}-content`,r),"data-state":m?"open":"closed",...i,children:e(n.Root,{loop:h,children:e(n.Group,{children:t})})}):null}));f.displayName="NavigationMenuContent";const h=o.forwardRef((({children:t,href:r,className:a,...i},c)=>{const{rootClass:m}=o.useContext(l);return e(n.Item,{children:e("a",{ref:c,href:r,className:s(m&&`${m}-link`,a),...i,children:t})})}));h.displayName="NavigationMenuLink";const C={Root:m,Item:p,Trigger:u,Content:f,Link:h};export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import t,{forwardRef as n,useContext as r}from"react";import{u as l}from"./index-wRElCyvx.js";import{u as a}from"./useComponentClass-QwNivz0h.js";import{c as s}from"./clsx-BaVHROc5.js";import{K as i}from"./keyboard-BKF7hXqL.js";import"./ThemeContext-Sm-iNANd.js";const o=t.createContext(null),d="NumberField",u=n((({children:t,customRootClass:n="",name:r,defaultValue:i="",value:u,onValueChange:m,largeStep:c,step:p,min:b,max:f,disabled:y,readOnly:N,required:h,id:v,className:D="",...C},O)=>{const F=a(n,d),[R,g]=l(u,i,m),w={inputValue:R,handleOnChange:e=>{g(""!==e?void 0!==f&&e>f?f:void 0!==b&&e<b?b:e:"")},handleStep:({type:e,direction:t})=>{let n=0;switch(e){case"small":if(!p)return;n=p;break;case"large":if(!c)return;n=c}"decrement"===t&&(n*=-1),(e=>{g((t=>{let n=t;""===n&&(n=void 0!==b?b:-1);const r=n+e;return void 0!==f&&r>f?f:void 0!==b&&r<b?b:r}))})(n)},id:v,name:r,disabled:y,readOnly:N,required:h,rootClass:F};return e("div",{ref:O,className:s(F&&`${F}-root`,D),...C,children:e(o.Provider,{value:w,children:t})})}));u.displayName=d;const m=n((({className:t,...n},l)=>{const a=r(o);if(!a)return console.error("NumberFieldInput must be used within a NumberField"),null;const{inputValue:d,handleOnChange:u,handleStep:m,id:c,name:p,disabled:b,readOnly:f,required:y,rootClass:N}=a;return e("input",{ref:l,type:"number",onKeyDown:e=>{e.key!==i.ARROW_UP||e.shiftKey||(e.preventDefault(),m({direction:"increment",type:"small"})),e.key!==i.ARROW_DOWN||e.shiftKey||(e.preventDefault(),m({direction:"decrement",type:"small"})),e.key===i.ARROW_UP&&e.shiftKey&&(e.preventDefault(),m({direction:"increment",type:"large"})),e.key===i.ARROW_DOWN&&e.shiftKey&&(e.preventDefault(),m({direction:"decrement",type:"large"}))},value:""===d?"":d,onChange:e=>{const t=e.target.value;u(""===t?"":Number(t))},id:c,name:p,disabled:b,readOnly:f,required:y,className:s(N&&`${N}-input`,t),...n})}));m.displayName="NumberFieldInput";const c=n((({children:t,className:n,onMouseDown:l,...a},i)=>{const d=r(o);if(!d)return console.error("NumberFieldIncrement must be used within a NumberField"),null;const{handleStep:u,rootClass:m,disabled:c,readOnly:p}=d;return e("button",{ref:i,onClick:()=>u({direction:"increment",type:"small"}),className:s(m&&`${m}-increment`,n),disabled:c||p,type:"button",...a,tabIndex:-1,onMouseDown:e=>{l?.(e),e.defaultPrevented||e.preventDefault()},children:t})}));c.displayName="NumberFieldIncrement";const p=n((({children:t,className:n,onMouseDown:l,...a},i)=>{const d=r(o);if(!d)return console.error("NumberFieldDecrement must be used within a NumberField"),null;const{handleStep:u,rootClass:m,disabled:c,readOnly:p}=d;return e("button",{ref:i,onClick:()=>u({direction:"decrement",type:"small"}),className:s(m&&`${m}-decrement`,n),disabled:c||p,type:"button",...a,tabIndex:-1,onMouseDown:e=>{l?.(e),e.defaultPrevented||e.preventDefault()},children:t})}));p.displayName="NumberFieldDecrement";const b=()=>(console.warn("Direct usage of NumberField is not supported. Please use NumberField.Root, NumberField.Item instead."),null);b.Root=u,b.Input=m,b.Increment=c,b.Decrement=p;export{b as default};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { ElementRef, ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import PopoverPrimitive from '~/core/primitives/Popover';
|
|
3
|
+
import * as _floating_ui_react from '@floating-ui/react';
|
|
4
|
+
|
|
5
|
+
type PopoverRootProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> & {
|
|
6
|
+
customRootClass?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const PopoverRoot: React.ForwardRefExoticComponent<PopoverRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
|
|
11
|
+
type PopoverTriggerProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger>;
|
|
12
|
+
declare const PopoverTrigger: React.ForwardRefExoticComponent<Omit<Omit<{
|
|
13
|
+
label?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
asChild?: boolean;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
onChange?: any;
|
|
18
|
+
} & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
19
|
+
asChild?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
} & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
|
|
23
|
+
type PopoverAnchorProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Anchor>;
|
|
24
|
+
declare const PopoverAnchor: React.ForwardRefExoticComponent<PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
|
|
26
|
+
type PopoverPrimitivePortalProps = {
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
container?: Element | null;
|
|
29
|
+
forceMount?: boolean;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type PopoverPortalProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Portal>;
|
|
33
|
+
declare const PopoverPortal: React.ForwardRefExoticComponent<PopoverPrimitivePortalProps & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
|
|
35
|
+
type PopoverContentProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>;
|
|
36
|
+
declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
37
|
+
|
|
38
|
+
type PopoverCloseProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Close>;
|
|
39
|
+
declare const PopoverClose: React.ForwardRefExoticComponent<Omit<Omit<{
|
|
40
|
+
label?: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
asChild?: boolean;
|
|
43
|
+
required?: boolean;
|
|
44
|
+
onChange?: any;
|
|
45
|
+
} & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
46
|
+
asChild?: boolean;
|
|
47
|
+
} & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
48
|
+
|
|
49
|
+
type PopoverArrowProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Arrow>;
|
|
50
|
+
declare const PopoverArrow: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<_floating_ui_react.FloatingArrowProps, "ref"> & React.RefAttributes<SVGSVGElement>, "ref">, "context"> & {
|
|
51
|
+
asChild?: boolean;
|
|
52
|
+
} & React.RefAttributes<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
53
|
+
|
|
54
|
+
type PopoverElement = ElementRef<'div'>;
|
|
55
|
+
type PopoverProps = ComponentPropsWithoutRef<'div'>;
|
|
56
|
+
type PopoverComponent = React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<PopoverElement>> & {
|
|
57
|
+
Root: typeof PopoverRoot;
|
|
58
|
+
Trigger: typeof PopoverTrigger;
|
|
59
|
+
Anchor: typeof PopoverAnchor;
|
|
60
|
+
Portal: typeof PopoverPortal;
|
|
61
|
+
Content: typeof PopoverContent;
|
|
62
|
+
Close: typeof PopoverClose;
|
|
63
|
+
Arrow: typeof PopoverArrow;
|
|
64
|
+
};
|
|
65
|
+
declare const Popover: PopoverComponent;
|
|
66
|
+
|
|
67
|
+
export { Popover as default };
|
|
68
|
+
export type { PopoverAnchorProps, PopoverArrowProps, PopoverCloseProps, PopoverContentProps, PopoverElement, PopoverPortalProps, PopoverProps, PopoverRootProps, PopoverTriggerProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use client';import e,{createContext as o,forwardRef as t,useContext as n}from"react";import{jsx as r}from"react/jsx-runtime";import{c as s}from"./clsx-BaVHROc5.js";import{F as i}from"./index-Db-tduwt.js";import{P as a}from"./index-XF8itt-H.js";import{u as l}from"./index-wRElCyvx.js";import{u as d}from"./index-UODM4mVT.js";import{B as c}from"./index-CfC8-kd8.js";import{T as u}from"./ThemeContext-Sm-iNANd.js";import{g as f,c as p,m as g}from"./mergeProps-0RucjqeH.js";import{u as m}from"./useComponentClass-QwNivz0h.js";import"./floating-ui.react-Byzse64h.js";import"react-dom";import"./documentOverlayOpen-coyGmcyL.js";const h={side:"bottom",align:"center",sideOffset:0,alignOffset:0,avoidCollisions:!0,collisionBoundary:void 0,collisionPadding:0,arrowPadding:0,sticky:"partial",hideWhenDetached:!1},v=o({isOpen:!1,modal:!1,contentId:"",triggerNode:null,anchorNode:null,handleOpenChange:()=>{},setTriggerNode:()=>{},setAnchorNode:()=>{},setArrowNode:()=>{},positioning:h,setPositioning:()=>{},getReferenceProps:(e={})=>e,getFloatingProps:(e={})=>e,setContentEventHandlers:()=>{},refs:{setFloating:()=>{},floating:{current:null}},isPositioned:!1,floatingStyles:{position:"absolute",top:0,left:0},floatingContext:null}),P="PopoverPrimitive",C=e=>{let o=!1;return{originalEvent:e,get defaultPrevented(){return o},preventDefault(){o=!0}}},y=t((({children:o,open:t,defaultOpen:n=!1,onOpenChange:s,modal:c=!1,...u},f)=>{const[p,g]=l(t,n,s);d(p);const[m,P]=e.useState(null),[y,N]=e.useState(null),[O,w]=e.useState(null),[A,x]=e.useState(h),F=e.useRef({}),E=i.useFloatingNodeId(),R=e.useMemo((()=>{return e=A.side,"center"===(o=A.align)?e:`${e}-${o}`;var e,o}),[A.align,A.side]),D=e.useMemo((()=>(Array.isArray(A.collisionBoundary)?A.collisionBoundary:[A.collisionBoundary]).filter((e=>null!=e))),[A.collisionBoundary]),M=e.useMemo((()=>({padding:A.collisionPadding,boundary:D,altBoundary:D.length>0})),[D,A.collisionPadding]),b=y??m,{context:k,refs:I,floatingStyles:T,isPositioned:j}=i.useFloating({open:p,nodeId:E,onOpenChange:(e,o,t)=>{if(!(!e&&"escape-key"===t&&o instanceof KeyboardEvent&&(F.current.onEscapeKeyDown?.(o),o.defaultPrevented))){if(!e&&"focus-out"===t&&o instanceof FocusEvent){const e=C(o);if(F.current.onFocusOutside?.(e),F.current.onInteractOutside?.(e),e.defaultPrevented)return}g(e)}},placement:R,strategy:"fixed",elements:{reference:b},middleware:[i.offset({mainAxis:A.sideOffset+(O?5:0),crossAxis:A.alignOffset}),A.avoidCollisions?i.flip({crossAxis:R.includes("-"),fallbackAxisSideDirection:"start",...M}):null,A.avoidCollisions?i.shift({...M,limiter:"partial"===A.sticky?i.limitShift():void 0}):null,O?i.arrow({element:O,padding:A.arrowPadding}):null,A.hideWhenDetached?i.hide({strategy:"referenceHidden"}):null].filter(Boolean),whileElementsMounted:i.autoUpdate}),S=i.useClick(k,{event:"click",toggle:!0}),B=i.useDismiss(k,{outsidePressEvent:"pointerdown",outsidePress:e=>{const o=C(e);return F.current.onPointerDownOutside?.(o),F.current.onInteractOutside?.(o),!o.defaultPrevented}}),$=i.useRole(k,{role:"dialog"}),{getReferenceProps:H,getFloatingProps:K}=i.useInteractions([S,B,$]),W=i.useId()??"",q=e.useCallback((e=>{x((o=>({...o,...e})))}),[]),L=e.useCallback((e=>{g(e)}),[g]),U=e.useCallback((e=>{F.current=e}),[]),V=e.useMemo((()=>({isOpen:p,modal:c,contentId:W,triggerNode:m,anchorNode:y,handleOpenChange:L,setTriggerNode:P,setAnchorNode:N,setArrowNode:w,positioning:A,setPositioning:q,getReferenceProps:H,getFloatingProps:K,setContentEventHandlers:U,refs:I,isPositioned:j,floatingStyles:T,floatingContext:k})),[y,W,k,T,K,H,L,p,j,c,A,I,U,q,m]);return r(v.Provider,{value:V,children:r(i.FloatingNode,{id:E,children:r(a.div,{ref:f,"data-state":p?"open":"closed",...u,children:o})})})}));y.displayName=`${P}Inner`;const N=t(((e,o)=>i.useFloatingTree()?r(y,{ref:o,...e}):r(i.FloatingTree,{children:r(y,{ref:o,...e})})));N.displayName=P;const O=t((({children:e,asChild:o=!1,disabled:t=!1,onClick:s,...a},l)=>{const{isOpen:d,contentId:u,getReferenceProps:f,setTriggerNode:p}=n(v),g=i.useMergeRefs([l,e=>{p(e)}]);return r(c,{ref:g,asChild:o,disabled:t,"aria-haspopup":"dialog","aria-expanded":d,"aria-controls":u||void 0,"data-state":d?"open":"closed","data-disabled":t?"":void 0,...f({...a,disabled:t,onClick:e=>{s?.(e)}}),children:e})}));O.displayName="PopoverPrimitiveTrigger";const w=t((({children:e,asChild:o=!1,...t},s)=>{const{setAnchorNode:l}=n(v),d=i.useMergeRefs([s,e=>{l(e)}]);return r(a.div,{ref:d,asChild:o,...t,children:e})}));w.displayName="PopoverPrimitiveAnchor";const A=e.createContext({forceMount:!1}),x=t((({children:o,asChild:t=!1,forceMount:s=!1,side:l="bottom",sideOffset:d=0,align:c="center",alignOffset:u=0,avoidCollisions:f=!0,collisionBoundary:p,collisionPadding:g=0,arrowPadding:m=0,sticky:h="partial",hideWhenDetached:P=!1,onOpenAutoFocus:C,onCloseAutoFocus:y,onEscapeKeyDown:N,onPointerDownOutside:O,onFocusOutside:w,onInteractOutside:x,role:F="dialog",style:E,...R},D)=>{const{forceMount:M}=e.useContext(A),{isOpen:b,modal:k,contentId:I,triggerNode:T,getFloatingProps:j,refs:S,isPositioned:B,floatingStyles:$,floatingContext:H,setContentEventHandlers:K,setPositioning:W}=n(v),q=e.useRef(null),L=i.useMergeRefs([S.setFloating,D]),U=b||s||M;if(e.useEffect((()=>{W({side:l,align:c,sideOffset:d,alignOffset:u,avoidCollisions:f,collisionBoundary:p,collisionPadding:g,arrowPadding:m,sticky:h,hideWhenDetached:P})}),[c,u,m,f,p,g,P,W,l,d,h]),e.useEffect((()=>(K({onEscapeKeyDown:N,onPointerDownOutside:O,onFocusOutside:w,onInteractOutside:x}),()=>{K({})})),[N,w,x,O,K]),e.useEffect((()=>{if(!b||!S.floating.current)return;if(q.current=document.activeElement instanceof HTMLElement?document.activeElement:null,!C)return;C({defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}})}),[b,C,S.floating]),e.useEffect((()=>{if(b||!y)return;const e={defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(y(e),!e.defaultPrevented){const e=T??q.current;e&&requestAnimationFrame((()=>{e.focus()}))}}),[b,y,T]),!U)return null;const V=j({...R,id:I,role:F,"data-state":b?"open":"closed","data-side":l,"data-align":c,"aria-hidden":b?void 0:"true",style:{...$,outline:"none",visibility:b&&!B?"hidden":void 0,pointerEvents:b&&!B?"none":void 0,...E}}),z=r(a.div,{ref:L,asChild:t,...V,children:o});return b?r(i.FocusManager,{context:H,modal:k,initialFocus:k?0:-1,returnFocus:!y,restoreFocus:!0,outsideElementsInert:k,closeOnFocusOut:!k,children:z}):z}));x.displayName="PopoverPrimitiveContent";const F=t((({children:e,asChild:o=!1,onClick:t,...s},i)=>{const{handleOpenChange:a}=n(v);return r(c,{ref:i,asChild:o,onClick:e=>{t?.(e),e.defaultPrevented||a(!1)},...s,children:e})}));F.displayName="PopoverPrimitiveClose";const E=t((({children:o,asChild:t=!1,width:s=10,height:a=5,...l},d)=>{const{floatingContext:c,setArrowNode:u}=n(v),m=i.useMergeRefs([d,e=>{u(e)}]);if(t){const t=e.Children.toArray(o);if(1!==t.length||!e.isValidElement(t[0]))return console.warn("PopoverPrimitiveArrow: asChild requires exactly one valid React element child."),null;const n=t[0],d=r(i.Arrow,{ref:m,context:c,width:s,height:a,...l}),u=f(n),h=p(m,u),v=g(d.props,n.props);return e.cloneElement(n,{...v,...h?{ref:h}:{}})}return r(i.Arrow,{ref:m,context:c,width:s,height:a,...l})}));E.displayName="PopoverPrimitiveArrow";const R={Root:N,Trigger:O,Anchor:w,Portal:({children:o,container:t,forceMount:n=!1})=>{const s=e.useContext(u),a=e.useRef(null),[l,d]=e.useState(!1);return e.useEffect((()=>{a.current=t??s?.portalRootRef.current??s?.containerRef.current??document.body,d(!0)}),[t,s]),l?r(A.Provider,{value:{forceMount:n},children:r(i.Portal,{root:a.current,children:o})}):null},Content:x,Close:F,Arrow:E},D=o({rootClass:""}),M="Popover",b=t((({children:e,customRootClass:o="",className:t="",...n},i)=>{const a=m(o,M);return r(D.Provider,{value:{rootClass:a},children:r(R.Root,{ref:i,className:s(a,t),"data-slot":"popover-root",...n,children:e})})}));b.displayName=M;const k=t((({className:e="",...o},t)=>{const{rootClass:i}=n(D);return r(R.Trigger,{ref:t,className:s(i&&`${i}-trigger`,e),"data-slot":"popover-trigger",...o})}));k.displayName="PopoverTrigger";const I=t((({className:e="",...o},t)=>{const{rootClass:i}=n(D);return r(R.Anchor,{ref:t,className:s(i&&`${i}-anchor`,e),"data-slot":"popover-anchor",...o})}));I.displayName="PopoverAnchor";const T=t((({children:e,...o},t)=>r(R.Portal,{...o,children:e})));T.displayName="PopoverPortal";const j=t((({className:e="",...o},t)=>{const{rootClass:i}=n(D);return r(R.Content,{ref:t,className:s(i&&`${i}-content`,e),"data-slot":"popover-content",...o})}));j.displayName="PopoverContent";const S=t((({className:e="",...o},t)=>{const{rootClass:i}=n(D);return r(R.Close,{ref:t,className:s(i&&`${i}-close`,e),"data-slot":"popover-close",...o})}));S.displayName="PopoverClose";const B=t((({className:e="",...o},t)=>{const{rootClass:i}=n(D);return r(R.Arrow,{ref:t,className:s(i&&`${i}-arrow`,e),"data-slot":"popover-arrow",...o})}));B.displayName="PopoverArrow";const $=t(((e,o)=>(console.warn("Direct usage of Popover is not supported. Please use Popover.Root, Popover.Trigger, etc. instead."),null)));$.displayName="Popover",$.Root=b,$.Trigger=k,$.Anchor=I,$.Portal=T,$.Content=j,$.Close=S,$.Arrow=B;export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as a}from"react/jsx-runtime";import{createContext as e,forwardRef as s,
|
|
1
|
+
'use client';import{jsx as a}from"react/jsx-runtime";import{createContext as e,forwardRef as s,useContext as t}from"react";import{c as r}from"./clsx-BaVHROc5.js";import{u as l}from"./useComponentClass-QwNivz0h.js";import{P as o}from"./index-XF8itt-H.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-0RucjqeH.js";const i=e({value:0,minValue:0,maxValue:100,rootClass:"",ariaLabel:"",state:"loading"}),m="Progress",n="loading",d="complete",u="indeterminate",c=s((({value:e=0,minValue:s=0,maxValue:t=100,children:c,customRootClass:p,getValueLabel:v,className:x,...g},f)=>{const C=l(p,m),h=v?.(e??0,s,t)??"",P=((a,e)=>null===a?u:a===e?d:n)(e,t),V=null===e,N={value:e,minValue:s,maxValue:t,rootClass:C,getValueLabel:v,ariaLabel:h,state:P},{asChild:b,...j}=g;return a(i.Provider,{value:N,children:a(o.div,{role:"progressbar","aria-label":h,"aria-valuetext":h,"aria-valuenow":V?void 0:e,"aria-valuemin":s,"aria-valuemax":t,"data-state":P,"data-value":V?void 0:e,"data-max":t,"data-min":s,className:r(C,x),asChild:b,ref:f,...j,children:c})})}));c.displayName=m;const p=s((({className:e,style:s,...l},m)=>{const{value:n,minValue:d,maxValue:u,rootClass:c,state:p}=t(i),v=null===n,x=Math.min(Math.max(n??0,d),u),g=(x-d)/(u-d)*100,{asChild:f,...C}=l;return a(o.div,{className:r(c&&`${c}-indicator`,e),style:{transform:`translateX(-${100-g}%)`,...s},"data-state":p,"data-value":v?void 0:x,"data-max":u,"data-min":d,asChild:f,ref:m,...C})}));p.displayName="ProgressIndicator";const v="Progress",x=s(((e,s)=>(console.warn("Direct usage of Progress is not supported. Please use Progress.Root, Progress.Indicator, etc. instead."),a(c,{ref:s,...e}))));x.displayName=v,x.Root=c,x.Indicator=p;export{v as COMPONENT_NAME,x as default};
|
package/dist/components/Quote.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as t}from"react/jsx-runtime";import o from"react";import{u as r}from"./useComponentClass-QwNivz0h.js";import{c as e}from"./index-eAZUMNef.js";import{c as s}from"./clsx-BaVHROc5.js";import"./ThemeContext-Sm-iNANd.js";const a="Quote",m=o.forwardRef((({children:o,customRootClass:m,className:c,truncate:i=!1,...n},
|
|
1
|
+
'use client';import{jsx as t}from"react/jsx-runtime";import o from"react";import{u as r}from"./useComponentClass-QwNivz0h.js";import{c as e}from"./index-eAZUMNef.js";import{c as s}from"./clsx-BaVHROc5.js";import"./ThemeContext-Sm-iNANd.js";const a="Quote",m=o.forwardRef((({children:o,customRootClass:m,className:c,truncate:i=!1,...n},u)=>{const f=r(m,a),l=e("quote",{truncate:i||void 0});return t("q",{ref:u,className:s(f,c),...l,...n,children:o})}));m.displayName=a;export{m as default};
|
package/dist/components/Radio.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import a from"react";import{P as
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import a from"react";import{P as i}from"./index-XF8itt-H.js";import{c as s}from"./clsx-BaVHROc5.js";import{u as d}from"./useComponentClass-QwNivz0h.js";import{c as r,a as o,b as t}from"./index-eAZUMNef.js";import{u as m}from"./index-wRElCyvx.js";import"./mergeProps-0RucjqeH.js";import"./ThemeContext-Sm-iNANd.js";const n=a.forwardRef((({name:a,value:s,id:d,checked:r,required:o,onChange:t,disabled:m,asChild:n,className:c,...l},u)=>e(i.input,{ref:u,type:"radio",checked:r,name:a,tabIndex:-1,value:s,onChange:t,id:d,"aria-disabled":m,disabled:m,required:o,"aria-required":o,asChild:n,className:c,...l})));n.displayName="RadioPrimitive";const c="Radio",l=a.forwardRef((function({name:a,value:i,id:l,checked:u,required:h,onChange:p,disabled:f,asChild:C,className:b,customRootClass:j,variant:v="",size:x="",color:k="",...N},g){const q=d(j,c),[R,y]=m(u,!1,(()=>{p?.()})),P=r("button",{variant:v,size:x}),w=t(k),z=o(P,w,{"data-slot":"radio-root","data-state":R?"checked":"unchecked","data-disabled":f?"":void 0});return e(n,{ref:g,name:a,id:l,value:i,checked:R,required:h,onChange:()=>{y(!R)},disabled:f,asChild:C,className:s(q,b),...N,"data-checked":R,...z})}));l.displayName=c;export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{createContext as o,forwardRef as s,useContext as a}from"react";import{jsx as r}from"react/jsx-runtime";import{R as e}from"./RadioGroupPrimitive-
|
|
1
|
+
'use client';import{createContext as o,forwardRef as s,useContext as a}from"react";import{jsx as r}from"react/jsx-runtime";import{R as e}from"./RadioGroupPrimitive-BWUU-0Qh.js";import{c as t}from"./clsx-BaVHROc5.js";import{u as i}from"./useComponentClass-QwNivz0h.js";import{c as m,a as d,b as n}from"./index-eAZUMNef.js";import"./index-XF8itt-H.js";import"./mergeProps-0RucjqeH.js";import"./index-m8Mhi26u.js";import"./index-CfC8-kd8.js";import"./keyboard-BKF7hXqL.js";import"./mergeRefs-B8eZ_q-T.js";import"./index-wRElCyvx.js";import"./ThemeContext-Sm-iNANd.js";const l=o({rootClass:""}),c=s((({children:o,className:s="",customRootClass:a="",variant:c="",size:p="",color:u="",orientation:R="both",...C},j)=>{const f=i(a,"RadioCards"),x=m("radio-cards",{variant:c,size:p}),h=n(u),v=d(x,h);return r(l.Provider,{value:{rootClass:f},children:r(e.Root,{ref:j,className:t(f,s),...C,...v,orientation:R,children:o})})}));c.displayName="RadioCardsRoot";const p=s((({children:o,className:s="",value:i,...m},d)=>{const{rootClass:n}=a(l);return r(e.Item,{ref:d,className:t(n&&`${n}-item`,s),...m,value:i,children:o})}));p.displayName="RadioCardsItem";const u=s(((o,s)=>(console.warn("Direct usage of RadioCards is not supported. Please use RadioCards.Root and RadioCards.Item instead."),null)));u.displayName="RadioCards",u.Root=c,u.Item=p;export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import o,{createContext as r,useContext as a}from"react";import{jsx as
|
|
1
|
+
'use client';import o,{createContext as r,useContext as a}from"react";import{jsx as s,jsxs as e}from"react/jsx-runtime";import{R as t}from"./RadioGroupPrimitive-BWUU-0Qh.js";import{c as i}from"./clsx-BaVHROc5.js";import{u as d}from"./useComponentClass-QwNivz0h.js";import{c as l,a as m,b as n}from"./index-eAZUMNef.js";import{P as c}from"./index-XF8itt-H.js";import"./index-m8Mhi26u.js";import"./index-CfC8-kd8.js";import"./keyboard-BKF7hXqL.js";import"./mergeRefs-B8eZ_q-T.js";import"./index-wRElCyvx.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-0RucjqeH.js";const p=r({rootClass:""}),u=o.forwardRef((({children:o,className:r="",customRootClass:a="",variant:c="",size:u="",color:f="",...R},j)=>{const C=d(a,"RadioGroup"),N=l("radio-group",{variant:c,size:u}),h=n(f),x=m(N,h,{"data-slot":"radio-group-root"});return s(p.Provider,{value:{rootClass:C},children:e(t.Root,{ref:j,className:i(C&&`${C}-root`,r),...x,...R,children:[" ",o," "]})})}));u.displayName="RadioGroupRoot";const f=o.forwardRef((({children:o,className:r="",value:e,...d},l)=>{const{rootClass:m}=a(p);return s(t.Item,{ref:l,className:i(m&&`${m}-item`,r),value:e,"data-slot":"radio-group-item",...d,children:o})}));f.displayName="RadioGroupItem";const R=o.forwardRef((({className:r="",children:a,...e},d)=>{const{rootClass:l}=o.useContext(p);return s(t.Indicator,{ref:d,className:i(l&&`${l}-indicator`,r),"data-slot":"radio-group-indicator",...e,children:a})}));R.displayName="RadioGroupIndicator";const j=o.forwardRef((({className:r="",asChild:a=!1,children:e,...t},d)=>{const{rootClass:l}=o.useContext(p);return s(c.label,{ref:d,"data-slot":"radio-group-label",...t,className:i(l&&`${l}-label`,r),asChild:a,children:e})}));j.displayName="RadioGroupLabel";const C=o.forwardRef(((o,r)=>(console.warn("Direct usage of RadioGroup is not supported. Please use RadioGroup.Root and RadioGroup.Item instead."),null)));C.displayName="RadioGroup",C.Root=u,C.Item=f,C.Indicator=R,C.Label=j;export{C as default};
|
|
@@ -1 +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-
|
|
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-XF8itt-H.js";import{R as t}from"./index-m8Mhi26u.js";import{u as l}from"./index-wRElCyvx.js";import{B as n}from"./index-CfC8-kd8.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=!0,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,12 +1,24 @@
|
|
|
1
1
|
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
2
|
|
|
3
|
+
type ScrollAreaScrollbarType = 'auto' | 'always' | 'scroll' | 'hover';
|
|
4
|
+
|
|
3
5
|
type ScrollAreaRootProps = ComponentPropsWithoutRef<'div'> & {
|
|
4
6
|
customRootClass?: string;
|
|
5
|
-
|
|
7
|
+
/** Controls scrollbar and thumb visibility: always, on scroll (1s fade), on hover + scroll, or when overflowing (auto). */
|
|
8
|
+
type?: ScrollAreaScrollbarType;
|
|
9
|
+
/** When set to manual, resets the viewport scroll position on mount and whenever restoreKey changes. */
|
|
10
|
+
scrollRestoration?: 'auto' | 'manual';
|
|
11
|
+
/** Key used to reset manual scroll restoration, such as a route pathname. */
|
|
12
|
+
restoreKey?: React.Key;
|
|
6
13
|
};
|
|
7
14
|
declare const ScrollAreaRoot: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
8
15
|
customRootClass?: string;
|
|
9
|
-
|
|
16
|
+
/** Controls scrollbar and thumb visibility: always, on scroll (1s fade), on hover + scroll, or when overflowing (auto). */
|
|
17
|
+
type?: ScrollAreaScrollbarType;
|
|
18
|
+
/** When set to manual, resets the viewport scroll position on mount and whenever restoreKey changes. */
|
|
19
|
+
scrollRestoration?: "auto" | "manual";
|
|
20
|
+
/** Key used to reset manual scroll restoration, such as a route pathname. */
|
|
21
|
+
restoreKey?: React.Key;
|
|
10
22
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
11
23
|
|
|
12
24
|
type ScrollAreaViewportProps = ComponentPropsWithoutRef<'div'>;
|
|
@@ -39,4 +51,4 @@ declare const ScrollArea: React.ForwardRefExoticComponent<ScrollAreaProps> & {
|
|
|
39
51
|
};
|
|
40
52
|
|
|
41
53
|
export { ScrollArea as default };
|
|
42
|
-
export type { ScrollAreaCornerProps, ScrollAreaRootProps, ScrollAreaScrollbarProps, ScrollAreaThumbProps, ScrollAreaViewportProps };
|
|
54
|
+
export type { ScrollAreaCornerProps, ScrollAreaRootProps, ScrollAreaScrollbarProps, ScrollAreaScrollbarType, ScrollAreaThumbProps, ScrollAreaViewportProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import e,{createContext as t,
|
|
1
|
+
'use client';import e,{createContext as t,useState as r,useRef as n,useCallback as l,useEffect as o,forwardRef as c,useLayoutEffect as s,useContext as i}from"react";import{jsx as u}from"react/jsx-runtime";import{c as a}from"./clsx-BaVHROc5.js";import{u as d}from"./useComponentClass-QwNivz0h.js";import{i as m,s as f,D as h}from"./documentOverlayOpen-coyGmcyL.js";import"./ThemeContext-Sm-iNANd.js";const v=t({rootClass:"",type:"hover",scrollbarVisible:!1,overflow:{x:!1,y:!1},overlaySuppressesScrollbar:!1});const p="ScrollArea",y=c((({children:t,className:c="",customRootClass:i="",type:y="hover",scrollRestoration:b="auto",restoreKey:g,...w},L)=>{const S=d(i,p),x=n(null),T=n(null),E=n(null),C=n(null),[R,N]=e.useState({x:!1,y:!1}),A=function(e,t,c){const[s,i]=r("always"===e),u=n(!1),a=n(null),d=l((()=>{a.current&&(clearTimeout(a.current),a.current=null)}),[]),m=l((()=>{d(),a.current=setTimeout((()=>{u.current||i(!1)}),1e3)}),[d]),f=l((()=>{"scroll"!==e&&"hover"!==e||(i(!0),"scroll"!==e&&u.current?d():m())}),[e,m,d]);return o((()=>{i("always"===e),d(),u.current=!1}),[e,d]),o((()=>{if("always"===e||"auto"===e)return;const r=t?.current;if(!r)return;const n=()=>f();return r.addEventListener("scroll",n,{passive:!0}),()=>{r.removeEventListener("scroll",n),d()}}),[e,t,f,d]),o((()=>{if("hover"!==e)return;const t=c?.current;if(!t)return;const r=()=>{u.current=!0,d(),i(!0)},n=()=>{u.current=!1,m()};return t.addEventListener("mouseenter",r),t.addEventListener("mouseleave",n),()=>{t.removeEventListener("mouseenter",r),t.removeEventListener("mouseleave",n),d()}}),[e,c,m,d]),o((()=>()=>d()),[d]),s}(y,C,x),H=function(){const[t,r]=e.useState((()=>m()));return e.useEffect((()=>{const e=()=>{r(m())},t=f(e),n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[h]}),n.observe(document.body,{attributes:!0,attributeFilter:["style"]}),()=>{t(),n.disconnect()}}),[]),t}();o((()=>{W()}),[T,E,C]),o((()=>{const e=C.current;if(!e)return;const t=()=>{W()},r=new ResizeObserver((()=>t())),n=()=>{r.disconnect(),r.observe(e),Array.from(e.children).forEach((e=>{e instanceof Element&&r.observe(e)}))};n();const l=new MutationObserver((r=>{const l=r.some((t=>"childList"===t.type&&t.target===e&&(t.addedNodes.length>0||t.removedNodes.length>0)));l&&(e.scrollTop=0,e.scrollLeft=0,n()),t(),l&&M()}));return l.observe(e,{childList:!0,subtree:!1}),window.addEventListener("resize",t),()=>{r.disconnect(),l.disconnect(),window.removeEventListener("resize",t)}}),[]);const W=()=>{if(!C.current)return;const e=C.current,t=e.clientHeight,r=e.scrollHeight,n=r>t;if(T.current)if(t<=0)T.current.style.height="0px";else if(n){let e=t/(r/t);e=Math.max(e,24),T.current.style.height=`${e}px`}else T.current.style.height=`${t}px`;const l=e.clientWidth,o=e.scrollWidth,c=o>l;if(E.current)if(l<=0)E.current.style.width="0px";else if(c){let e=l/(o/l);e=Math.max(e,24),E.current.style.width=`${e}px`}else E.current.style.width=`${l}px`;N({x:c,y:n})},M=()=>{if(!C.current)return;const e=C.current;if(T.current){const t=e.clientHeight,r=e.scrollHeight,n=e.scrollTop,l=T.current.clientHeight;if(t<=0||r<=t)T.current.style.top="0px";else{const e=n/(r-t)*(t-l);T.current.style.top=`${e}px`}}if(E.current){const t=e.clientWidth,r=e.scrollWidth,n=e.scrollLeft,l=E.current.clientWidth;if(t<=0||r<=t)E.current.style.left="0px";else{const e=n/(r-t)*(t-l);E.current.style.left=`${e}px`}}};s((()=>{"manual"===b&&(()=>{const e=C.current;e&&(e.scrollTop=0,e.scrollLeft=0,M())})()}),[b,g]);const X=e=>{if(!C.current)return;const t=C.current,r=t.scrollTop,n=t.scrollLeft,l=void 0!==e.top?e.top-r:0,o=void 0!==e.left?e.left-n:0,c=performance.now(),s=i=>{const u=i-c,a=Math.min(u/150,1),d=1-Math.pow(1-a,3);void 0!==e.top&&(t.scrollTop=r+l*d),void 0!==e.left&&(t.scrollLeft=n+o*d),a<1&&requestAnimationFrame(s)};requestAnimationFrame(s)};return u(v.Provider,{value:{rootClass:S,scrollYThumbRef:T,scrollXThumbRef:E,scrollAreaViewportRef:C,handleScroll:M,handleScrollbarClick:e=>{if(!C.current)return;const t=C.current;if("vertical"===e.orientation&&void 0!==e.clientY){const r=T.current;if(!r)return;if(t.clientHeight<=0||t.scrollHeight<=t.clientHeight)return;const n=r.getBoundingClientRect(),l=t.scrollHeight/t.clientHeight;e.clientY<n.top?X({top:t.scrollTop-r.clientHeight*l}):e.clientY>n.bottom&&X({top:t.scrollTop+r.clientHeight*l})}else if("horizontal"===e.orientation&&void 0!==e.clientX){const r=E.current;if(!r)return;if(t.clientWidth<=0||t.scrollWidth<=t.clientWidth)return;const n=r.getBoundingClientRect(),l=t.scrollWidth/t.clientWidth;e.clientX<n.left?X({left:t.scrollLeft-r.clientWidth*l}):e.clientX>n.right&&X({left:t.scrollLeft+r.clientWidth*l})}},type:y,scrollbarVisible:A,overflow:R,overlaySuppressesScrollbar:H,rootRef:x},children:u("div",{ref:e=>{x.current=e,"function"==typeof L?L(e):L&&(L.current=e)},className:a(S,c),"data-scrollbar-type":y,"data-scrollbar-x":String(R.x||"always"===y),"data-scrollbar-y":String(R.y||"always"===y),...w,children:t})})}));y.displayName=p;const b=c((({children:e,className:t="",...r},n)=>{const{rootClass:l,scrollAreaViewportRef:o,handleScroll:c}=i(v);return u("div",{ref:e=>{o&&(o.current=e),"function"==typeof n?n(e):n&&(n.current=e)},className:a(l&&`${l}-viewport`,t),onScroll:c,...r,children:e})}));b.displayName="ScrollAreaViewport";const g=c((({children:t,className:r="",orientation:l="vertical",...o},c)=>{const{rootClass:s,handleScrollbarClick:d,scrollXThumbRef:m,scrollYThumbRef:f,type:h,scrollbarVisible:p,overflow:y,overlaySuppressesScrollbar:b}=i(v),g=n(null),w=n(!1),L=n(null),[S,x]=e.useState(!1),T=n(0),E="vertical"===l?y.y:y.x,C=e.useCallback((e=>{const t="vertical"===l?f?.current:m?.current;if(!t)return!1;const r=t.getBoundingClientRect();return"vertical"===l?e<r.top||e>r.bottom:e<r.left||e>r.right}),[l,m,f]),R=e.useCallback((e=>{d&&(e.preventDefault(),T.current="vertical"===l?e.clientY:e.clientX,d({clientY:e.clientY,clientX:e.clientX,orientation:l}),setTimeout((()=>{w.current&&(g.current=setInterval((()=>{w.current&&C(T.current)?d({clientY:"vertical"===l?T.current:void 0,clientX:"horizontal"===l?T.current:void 0,orientation:l}):N()}),50))}),300),w.current=!0,x(!0))}),[d,l,C]),N=e.useCallback((()=>{w.current=!1,L.current?.(),L.current=null,g.current&&(clearInterval(g.current),g.current=null),x(!1)}),[]);e.useEffect((()=>{if(!w.current)return()=>{L.current?.(),N()};const e=()=>N(),t=()=>N();return document.addEventListener("mouseup",e),document.addEventListener("mouseleave",t),L.current=()=>{document.removeEventListener("mouseup",e),document.removeEventListener("mouseleave",t)},()=>{L.current?.(),L.current=null,N()}}),[S,N]);const A=!b&&("always"===h||"auto"===h&&E||E&&("scroll"===h||"hover"===h)&&p),H=E||"always"===h;return u("div",{ref:c,className:a(s&&`${s}-scrollbar`,r),"data-orientation":l,"data-state":A?"visible":"hidden",style:{display:H?void 0:"none",...o.style},onMouseDown:R,onMouseUp:N,onMouseLeave:N,...o,children:t})}));g.displayName="ScrollAreaScrollbar";const w=c((({children:t,className:r="",orientation:o="vertical",...c},s)=>{const{rootClass:d,scrollXThumbRef:m,scrollYThumbRef:f,scrollAreaViewportRef:h,type:p,scrollbarVisible:y,overflow:b,overlaySuppressesScrollbar:g}=i(v),w="vertical"===o?b.y:b.x,L=!g&&("always"===p||"auto"===p&&w||w&&("scroll"===p||"hover"===p)&&y),S=n(!1),x=n({x:0,y:0,scrollTop:0,scrollLeft:0}),T=l((e=>{h?.current&&(e.preventDefault(),e.stopPropagation(),S.current=!0,x.current={x:e.clientX,y:e.clientY,scrollTop:h.current.scrollTop,scrollLeft:h.current.scrollLeft},document.body.style.userSelect="none",document.body.style.cursor="grabbing")}),[h]),E=l((e=>{if(!S.current||!h?.current)return;const t=h.current,r="vertical"===o?f?.current:m?.current,n=r?.parentElement?.getBoundingClientRect();if(r&&n)if("vertical"===o){const l=(e.clientY-x.current.y)/(n.height-r.clientHeight),o=t.scrollHeight-t.clientHeight,c=x.current.scrollTop+l*o;t.scrollTop=Math.max(0,Math.min(c,o))}else{const l=(e.clientX-x.current.x)/(n.width-r.clientWidth),o=t.scrollWidth-t.clientWidth,c=x.current.scrollLeft+l*o;t.scrollLeft=Math.max(0,Math.min(c,o))}}),[o,h,m,f]),C=l((()=>{S.current=!1,document.body.style.cursor="",document.body.style.userSelect=""}),[]);e.useEffect((()=>{const e=e=>E(e),t=()=>C();return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t),C()}}),[E,C]);return u("div",{ref:e=>{const t="vertical"===o?f:m;t&&(t.current=e),"function"==typeof s?s(e):s&&(s.current=e)},className:a(d&&`${d}-thumb`,r),"data-state":L?"visible":"hidden",onMouseDown:T,...c,children:t})}));w.displayName="ScrollAreaThumb";const L=c((({children:e,className:t,...r},n)=>{const{rootClass:l}=i(v);return u("div",{ref:n,className:a(l&&`${l}-corner`,t),...r,children:e})}));L.displayName="ScrollAreaCorner";const S=e.forwardRef(((e,t)=>(console.warn("Direct usage of ScrollArea is not supported. Please use ScrollArea.Root and ScrollArea.Viewport instead."),null)));S.Root=y,S.Viewport=b,S.Scrollbar=g,S.Thumb=w,S.Corner=L,S.displayName="ScrollArea";export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import e,{useContext as
|
|
1
|
+
'use client';import e,{useContext as t}from"react";import{jsx as o}from"react/jsx-runtime";import{C as r}from"./ComboboxPrimitive-C2sksm48.js";import{u as a}from"./useComponentClass-QwNivz0h.js";import{C as s}from"./check-DujVUWP-.js";import{T as i}from"./ThemeContext-Sm-iNANd.js";import{c as l}from"./clsx-BaVHROc5.js";import"./index-Db-tduwt.js";import"./floating-ui.react-Byzse64h.js";import"react-dom";import"./index-XF8itt-H.js";import"./mergeProps-0RucjqeH.js";import"./keyboard-BKF7hXqL.js";import"./index-CXzybYmm.js";import"./index-wRElCyvx.js";import"./index-UODM4mVT.js";import"./documentOverlayOpen-coyGmcyL.js";const n=e.createContext({rootClass:""}),d=e.forwardRef((({customRootClass:e,children:a,position:s="popper",...i},l)=>{const{rootClass:d}=t(n);return o(r.Content,{className:d?`${d}-content`:void 0,position:s,"data-position":s,"data-slot":"select-content",ref:l,...i,children:a})}));function c(t){return"string"==typeof t||"number"==typeof t?String(t):Array.isArray(t)?t.map(c).join(""):e.isValidElement(t)?c(t.props.children):""}d.displayName="SelectContent";const m=e.forwardRef((({customRootClass:e,children:a,value:s,label:i,disabled:l,...d},m)=>{const{rootClass:p}=t(n),f=i||c(a).trim()||s;return o(r.Item,{className:p?`${p}-item`:void 0,value:s,label:f,disabled:l,"data-disabled":l?"":void 0,"data-slot":"select-item",role:"option","aria-disabled":l?"true":void 0,ref:m,...d,children:o("span",{className:p?`${p}-text`:void 0,"data-slot":"select-item-text",children:a})})}));m.displayName="SelectItem";const p=e.forwardRef((({customRootClass:e,children:a,disabled:s,placeholder:i,...l},d)=>{const{rootClass:c}=t(n);return o(r.Trigger,{className:c?`${c}-trigger`:void 0,"aria-disabled":s?"true":void 0,"data-placeholder":i?"":void 0,"data-slot":"select-trigger",disabled:s,ref:d,...l,children:a})}));p.displayName="SelectTrigger";const f=e.forwardRef((({customRootClass:e,children:t,defaultValue:s,value:i,onValueChange:l,sideOffset:d=4,...c},m)=>{const p=a(e,"Select");return o(n.Provider,{value:{rootClass:p},children:o(r.Root,{className:p?`${p}-root`:void 0,"data-slot":"select-root",defaultValue:s,value:i,onValueChange:l,sideOffset:d,ref:m,...c,children:t})})}));f.displayName="SelectRoot";const u=e.forwardRef(((e,r)=>{const{rootClass:a}=t(n);return o("div",{className:a?`${a}-item-indicator`:void 0,"data-slot":"select-item-indicator",ref:r,...e,children:o(s,{width:16,height:16})})}));u.displayName="SelectIndicator";const h=e.forwardRef((({children:e,container:a,...s},l)=>{const n=t(i),d=a??n?.portalRootRef.current??n?.containerRef.current??void 0;return o(r.Portal,{ref:l,container:d,...s,children:e})}));h.displayName="SelectPortal";const C=e.forwardRef((({children:e,className:a,...s},i)=>{const{rootClass:d}=t(n),c=l(d?`${d}-group`:void 0,a)||void 0;return o(r.Group,{className:c,"data-slot":"select-group",ref:i,...s,children:e})}));C.displayName="SelectGroup";const v=e.forwardRef(((e,t)=>(console.warn("Direct usage of Select is not supported. Please use Select.Root, Select.Content, etc. instead."),null)));v.displayName="Select";const g=v;g.Root=f,g.Content=d,g.Item=m,g.Trigger=p,g.Portal=h,g.Group=C,g.Indicator=u;export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as o}from"react/jsx-runtime";import r from"react";import{u as a}from"./useComponentClass-QwNivz0h.js";import{c as t}from"./clsx-BaVHROc5.js";import{P as e}from"./index-
|
|
1
|
+
'use client';import{jsx as o}from"react/jsx-runtime";import r from"react";import{u as a}from"./useComponentClass-QwNivz0h.js";import{c as t}from"./clsx-BaVHROc5.js";import{P as e}from"./index-XF8itt-H.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-0RucjqeH.js";const s="Separator",i=r.forwardRef((({orientation:r="horizontal",className:i,customRootClass:m,color:n="",decorative:p=!1,...c},d)=>{const l=a(m,s),f=l?`${l}-${r}`:void 0,u={};return u["data-orientation"]=r,n&&(u["data-color"]=n),p&&(u.role="separator",u["aria-hidden"]="true"),o(e.div,{ref:d,className:t(l,f,i),...u,...c})}));i.displayName=s;export{i as default};
|
|
@@ -35,7 +35,7 @@ declare const SliderRoot: React.ForwardRefExoticComponent<{
|
|
|
35
35
|
pageStepMultiplier?: number;
|
|
36
36
|
showStepMarks?: boolean;
|
|
37
37
|
formatValue?: (value: number) => string;
|
|
38
|
-
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "
|
|
38
|
+
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "value" | "onValueChange"> & React.RefAttributes<HTMLDivElement>>;
|
|
39
39
|
|
|
40
40
|
type SliderTrackProps = {
|
|
41
41
|
children: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{createContext as o,forwardRef as n,useRef as l,useCallback as i}from"react";import{c as s}from"./clsx-BaVHROc5.js";import{u}from"./useComponentClass-QwNivz0h.js";import{u as c}from"./index-wRElCyvx.js";import{P as m}from"./index-m6qHOeQ9.js";import{m as d}from"./mergeRefs-B8eZ_q-T.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-B9ocQsG4.js";const p=o({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",v=n((({children:t,className:a="",customRootClass:o="",defaultValue:n,value:m,onValueChange:d,onValueCommit:v,min:f=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(o,h),[N,C]=c(m,n??(Array.isArray(m)?m:0),d),[S,D]=r.useState(!1),P=r.useRef(null),T=r.useRef(N);r.useEffect((()=>{T.current=N}),[N]);const E=r.useRef(null),X=l([]),L=r.useMemo((()=>e=>{E.current=e,"function"==typeof R?R(e):R&&(R.current=e)}),[R]),j=i(((e,t)=>{X.current[e]=t}),[]),B=e=>{const t=E.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 o=f+r*(b-f),n=Math.round(o/g)*g,l=(i=n,Math.min(b,Math.max(f,i)));var i;if(Array.isArray(N)){let e=P.current;if(null===e){const t=N.map((e=>Math.abs(e-l)));e=t.indexOf(Math.min(...t)),P.current=e}const t=N.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)),C(t.map((e=>e.value)))}else C(l)},I={rootClass:A,value:N,setValue:C,minValue:f,maxValue:b,step:g,name:x,isDragging:S,setDragging:D,disabled:w,orientation:y,pageStepMultiplier:M,showStepMarks:$,formatValue:k,rootRef:E,thumbRefs:X.current,registerThumbRef:j};return e(p.Provider,{value:I,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,a=A?t.closest(`.${A}-thumb`):t.closest('[role="slider"]');if(a&&Array.isArray(N)){const e=parseInt(a.getAttribute("data-index")||"0",10);P.current=e,a.focus()}else if(P.current=null,Array.isArray(N))E.current?.focus();else{const e=X.current[0];e?.current?.focus()}D(!0),B(e);const r=e=>{e.preventDefault(),B(e)},o=()=>{D(!1),P.current=null,document.removeEventListener("pointermove",r),document.removeEventListener("pointerup",o),v?.(T.current)};document.addEventListener("pointermove",r),document.addEventListener("pointerup",o)},onPointerMove:e=>{S&&(e.preventDefault(),B(e))},onPointerUp:()=>{D(!1),P.current=null},...V,children:t})})}));v.displayName=h;const f=n((({children:t,className:a,style:o,...n},l)=>{const{rootClass:i,orientation:u}=r.useContext(p),c="vertical"===u?{rotate:"180deg",position:"relative"}:{position:"relative"},m=s(i?`${i}-track`:void 0,a)||void 0;return e("div",{ref:l,className:m,style:{...o,...c},...n,children:t})}));f.displayName="SliderTrack";const b=r.memo(n((({children:o,asChild:n=!1,index:l=0,"aria-label":i,"aria-labelledby":s,...u},c)=>{const{rootClass:h,value:v,minValue:f,maxValue:b,step:g,setValue:w,name:x,isDragging:y,setDragging:M,disabled:$,orientation:k,pageStepMultiplier:V,formatValue:R,registerThumbRef:A}=r.useContext(p),N=r.useRef(null);r.useEffect((()=>{A&&N.current&&A(l,N)}),[l,A]);const C=Array.isArray(v)&&l>=0&&l<v.length?v[l]:"number"==typeof v?v:f,S=Number.isFinite(C)?C:f,D=Math.min(b,Math.max(f,S)),P=b===f?0:(D-f)/(b-f)*100,[T,E]=r.useState(!1),X=y?"dragging":T?"active":"inactive",L=e(m.div,{ref:d(N,c),asChild:n,className:h?`${h}-thumb`:void 0,role:"slider",tabIndex:$?-1:0,"aria-valuemin":f,"aria-valuemax":b,"aria-valuenow":D,"aria-valuetext":R?R(D):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=D;const a=Boolean(e.currentTarget.closest('[dir="rtl"]'));switch(e.key){case"ArrowRight":t=a?D-g:D+g;break;case"ArrowLeft":t=a?D+g:D-g;break;case"ArrowUp":t=D+g;break;case"ArrowDown":t=D-g;break;case"Home":t=f;break;case"End":t=b;break;case"PageUp":t=D+g*V;break;case"PageDown":t=D-g*V;break;default:return}e.preventDefault();const r=(o=t,Math.min(b,Math.max(f,o)));var o;if(Array.isArray(v)){const e=[...v];e[l]=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?{top:`calc(${P}% - 10px)`}:{left:`calc(${P}% - 10px)`},...u,children:o});return t(a,{children:[L,e("input",{type:"hidden",value:D,name:Array.isArray(v)?`${x}[${l}]`:x})]})})));b.displayName="SliderThumb";const g=n((({children:t,className:a,style:o,...n},l)=>{const{rootClass:i,value:u,minValue:c,maxValue:m,orientation:d}=r.useContext(p);let h=0,v=0;if(Array.isArray(u))if(0===u.length)h=0,v=0;else{const e=[...u].sort(((e,t)=>e-t)),t=e[0],a=e[e.length-1];h=m===c?0:(t-c)/(m-c)*100,v=m===c?0:(a-c)/(m-c)*100,1===u.length&&(h=0)}else h=0,v=m===c?0:(u-c)/(m-c)*100;const f=v-h,b=s(i?`${i}-range`:void 0,a)||void 0;return e("div",{ref:l,className:b,style:{...o,..."vertical"===d?{height:`${f}%`,marginTop:100-v+"%"}:{marginLeft:`${h}%`,width:`${f}%`}},...n,children:t})}));g.displayName="SliderRange";const w=n((({children:a,customMarks:o,...n},l)=>{const{rootClass:i,minValue:s,maxValue:u,step:c,orientation:m,showStepMarks:d}=r.useContext(p);if(!d&&!o)return null;const h=[];if(o)o.forEach((({value:a,label:r})=>{const o=u===s?0:(a-s)/(u-s)*100;h.push(t("div",{className:i?`${i}-mark ${i}-mark-custom`:void 0,"data-testid":`mark-${a}`,style:"vertical"===m?{bottom:`${o}%`,left:"50%",transform:"translateX(-50%)"}:{left:`${o}%`,top:0,transform:"translateX(-50%)"},"data-value":a,children:[e("div",{className:i?`${i}-mark-line`:void 0,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?`${i}-mark-label`:void 0,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?`${i}-mark`:void 0,"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?`${i}-mark-line`:void 0,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?`${i}-marks`:void 0,style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:1},...n,children:[h,a]})}));w.displayName="SliderMarks";const x=n((({children:a,"aria-label":o,"aria-labelledby":n,defaultValue:l=[25,75],value:i,onValueChange:s,...u},c)=>{const{rootClass:d,minValue:h,maxValue:v,step:f,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(v,Math.max(h,e)),N=e=>{y(e),s?.(e)},C=v===h?0:(x[0]-h)/(v-h)*100,S=v===h?0:(x[1]-h)/(v-h)*100,D=(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 o=h+r*(v-h),n=Math.round(o/f)*f,l=A(n),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]),N(i)},P=(e,t)=>{if(b)return;e.stopPropagation(),$(t),D(e,t);const a=e=>{e.preventDefault();const a=w.current;if(!a)return;const r=a.getBoundingClientRect();let o;o="vertical"===g?(r.bottom-e.clientY)/r.height:(e.clientX-r.left)/r.width;const n=h+o*(v-h),l=Math.round(n/f)*f,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&&(N(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(),D(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]-f:x["lower"===t?0:1]+f;break;case"ArrowLeft":a["lower"===t?0:1]=r?x["lower"===t?0:1]+f:x["lower"===t?0:1]-f;break;case"ArrowUp":a["lower"===t?0:1]=x["lower"===t?0:1]+f;break;case"ArrowDown":a["lower"===t?0:1]=x["lower"===t?0:1]-f;break;case"Home":a["lower"===t?0:1]=h;break;case"End":a["lower"===t?0:1]=v;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]),N(a)};return t("div",{ref:c,className:d?`${d}-range-slider`:void 0,...u,children:[e(m.div,{className:d?`${d}-thumb ${d}-thumb-lower`:void 0,role:"slider",tabIndex:b?-1:0,"aria-valuemin":h,"aria-valuemax":v,"aria-valuenow":x[0],"aria-orientation":g,"aria-label":o?`${o} minimum`:"Minimum value","aria-labelledby":n,"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(${C}% - 8px)`}:{left:`calc(${C}% - 8px)`}}),e(m.div,{className:d?`${d}-thumb ${d}-thumb-upper`:void 0,role:"slider",tabIndex:b?-1:0,"aria-valuemin":h,"aria-valuemax":v,"aria-valuenow":x[1],"aria-orientation":g,"aria-label":o?`${o} maximum`:"Maximum value","aria-labelledby":n,"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(${S}% - 8px)`}:{left:`calc(${S}% - 8px)`}}),e("div",{className:d?`${d}-range-fill`:void 0,style:"vertical"===g?{bottom:`${Math.min(C,S)}%`,height:`${Math.abs(S-C)}%`,left:0,right:0}:{left:`${Math.min(C,S)}%`,width:`${Math.abs(S-C)}%`,top:0,bottom:0}}),a]})}));x.displayName="SliderRangeSlider";const y=n(((t,a)=>{const{defaultValue:r,min:o=0,max:n=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:o,max:n,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=v,y.Track=f,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{u}from"./useComponentClass-QwNivz0h.js";import{u as c}from"./index-wRElCyvx.js";import{P as m}from"./index-XF8itt-H.js";import{K as d}from"./keyboard-BKF7hXqL.js";import{m as p}from"./mergeRefs-B8eZ_q-T.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-0RucjqeH.js";const v=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:p,min:f=0,max:b=100,step:g=1,disabled:x=!1,name:w,orientation:y="horizontal",pageStepMultiplier:R=10,showStepMarks:M=!1,formatValue:$,...k},N)=>{const V=u(n,h),[A,C]=c(m,o??(Array.isArray(m)?m:0),d),[D,S]=r.useState(!1),P=r.useRef(null),E=r.useRef(A);r.useEffect((()=>{E.current=A}),[A]);const T=r.useRef(null),O=l([]),X=r.useMemo((()=>e=>{T.current=e,"function"==typeof N?N(e):N&&(N.current=e)}),[N]),L=i(((e,t)=>{O.current[e]=t}),[]),W=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=f+r*(b-f),o=Math.round(n/g)*g,l=(i=o,Math.min(b,Math.max(f,i)));var i;if(Array.isArray(A)){let e=P.current;if(null===e){const t=A.map((e=>Math.abs(e-l)));e=t.indexOf(Math.min(...t)),P.current=e}const t=A.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)),C(t.map((e=>e.value)))}else C(l)},I={rootClass:V,value:A,setValue:C,minValue:f,maxValue:b,step:g,name:w,isDragging:D,setDragging:S,disabled:x,orientation:y,pageStepMultiplier:R,showStepMarks:M,formatValue:$,rootRef:T,thumbRefs:O.current,registerThumbRef:L};return e(v.Provider,{value:I,children:e("div",{ref:X,className:s(V,a),"data-slider-root":V,"data-disabled":x,"data-orientation":y,onPointerDown:e=>{if(x)return;e.stopPropagation();const t=e.target,a=V?t.closest(`.${V}-thumb`):t.closest('[role="slider"]');if(a&&Array.isArray(A)){const e=parseInt(a.getAttribute("data-index")||"0",10);P.current=e,a.focus()}else if(P.current=null,Array.isArray(A))T.current?.focus();else{const e=O.current[0];e?.current?.focus()}S(!0),W(e);const r=e=>{e.preventDefault(),W(e)},n=()=>{S(!1),P.current=null,document.removeEventListener("pointermove",r),document.removeEventListener("pointerup",n),p?.(E.current)};document.addEventListener("pointermove",r),document.addEventListener("pointerup",n)},onPointerMove:e=>{D&&(e.preventDefault(),W(e))},onPointerUp:()=>{S(!1),P.current=null},...k,children:t})})}));f.displayName=h;const b=o((({children:t,className:a,style:n,...o},l)=>{const{rootClass:i,orientation:u}=r.useContext(v),c="vertical"===u?{rotate:"180deg",position:"relative"}:{position:"relative"},m=s(i?`${i}-track`:void 0,a)||void 0;return e("div",{ref:l,className:m,style:{...n,...c},...o,children:t})}));b.displayName="SliderTrack";const g=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:b,maxValue:g,step:x,setValue:w,name:y,isDragging:R,setDragging:M,disabled:$,orientation:k,pageStepMultiplier:N,formatValue:V,registerThumbRef:A}=r.useContext(v),C=r.useRef(null);r.useEffect((()=>{A&&C.current&&A(l,C)}),[l,A]);const D=Array.isArray(f)&&l>=0&&l<f.length?f[l]:"number"==typeof f?f:b,S=Number.isFinite(D)?D:b,P=Math.min(g,Math.max(b,S)),E=g===b?0:(P-b)/(g-b)*100,[T,O]=r.useState(!1),X=R?"dragging":T?"active":"inactive",L=e(m.div,{ref:p(C,c),asChild:o,className:h?`${h}-thumb`:void 0,role:"slider",tabIndex:$?-1:0,"aria-valuemin":b,"aria-valuemax":g,"aria-valuenow":P,"aria-valuetext":V?V(P):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=P;const a=Boolean(e.currentTarget.closest('[dir="rtl"]'));switch(e.key){case d.ARROW_RIGHT:t=a?P-x:P+x;break;case d.ARROW_LEFT:t=a?P+x:P-x;break;case d.ARROW_UP:t=P+x;break;case d.ARROW_DOWN:t=P-x;break;case d.HOME:t=b;break;case d.END:t=g;break;case d.PAGE_UP:t=P+x*N;break;case d.PAGE_DOWN:t=P-x*N;break;default:return}e.preventDefault();const r=(n=t,Math.min(g,Math.max(b,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:()=>O(!0),onBlur:()=>O(!1),style:"vertical"===k?{top:`calc(${E}% - 10px)`}:{left:`calc(${E}% - 10px)`},...u,children:n});return t(a,{children:[L,e("input",{type:"hidden",value:P,name:Array.isArray(f)?`${y}[${l}]`:y})]})})));g.displayName="SliderThumb";const x=o((({children:t,className:a,style:n,...o},l)=>{const{rootClass:i,value:u,minValue:c,maxValue:m,orientation:d}=r.useContext(v);let p=0,h=0;if(Array.isArray(u))if(0===u.length)p=0,h=0;else{const e=[...u].sort(((e,t)=>e-t)),t=e[0],a=e[e.length-1];p=m===c?0:(t-c)/(m-c)*100,h=m===c?0:(a-c)/(m-c)*100,1===u.length&&(p=0)}else p=0,h=m===c?0:(u-c)/(m-c)*100;const f=h-p,b=s(i?`${i}-range`:void 0,a)||void 0;return e("div",{ref:l,className:b,style:{...n,..."vertical"===d?{height:`${f}%`,marginTop:100-h+"%"}:{marginLeft:`${p}%`,width:`${f}%`}},...o,children:t})}));x.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(v);if(!d&&!n)return null;const p=[];if(n)n.forEach((({value:a,label:r})=>{const n=u===s?0:(a-s)/(u-s)*100;p.push(t("div",{className:i?`${i}-mark ${i}-mark-custom`:void 0,"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?`${i}-mark-line`:void 0,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?`${i}-mark-label`:void 0,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;p.push(e("div",{className:i?`${i}-mark`:void 0,"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?`${i}-mark-line`:void 0,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?`${i}-marks`:void 0,style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:1},...o,children:[p,a]})}));w.displayName="SliderMarks";const y=o((({children:a,"aria-label":n,"aria-labelledby":o,defaultValue:l=[25,75],value:i,onValueChange:s,...u},c)=>{const{rootClass:p,minValue:h,maxValue:f,step:b,disabled:g,orientation:x,rootRef:w}=r.useContext(v),[y,R]=r.useState(i||l),[M,$]=r.useState(null),[k,N]=r.useState(null),V=r.useRef(0),A=e=>Math.min(f,Math.max(h,e)),C=e=>{R(e),s?.(e)},D=f===h?0:(y[0]-h)/(f-h)*100,S=f===h?0:(y[1]-h)/(f-h)*100,P=(e,t)=>{const a=e.currentTarget.getBoundingClientRect();let r;r="vertical"===x?(a.bottom-e.clientY)/a.height:(e.clientX-a.left)/a.width;const n=h+r*(f-h),o=Math.round(n/b)*b,l=A(o),i=[...y];i["lower"===t?0:1]=l,"lower"===t?i[0]=Math.min(i[0],y[1]):i[1]=Math.max(i[1],y[0]),C(i)},E=(e,t)=>{if(g)return;e.stopPropagation(),$(t),P(e,t);const a=e=>{e.preventDefault();const a=w.current;if(!a)return;const r=a.getBoundingClientRect();let n;n="vertical"===x?(r.bottom-e.clientY)/r.height:(e.clientX-r.left)/r.width;const o=h+n*(f-h),l=Math.round(o/b)*b,i=A(l),s=[...y];s["lower"===t?0:1]=i,"lower"===t?s[0]=Math.min(s[0],y[1]):s[1]=Math.max(s[1],y[0]);const u=performance.now();u-V.current>16&&(C(s),V.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(),P(e,t))},O=()=>{$(null)},X=(e,t)=>{if(g)return;const a=[...y],r=Boolean(e.currentTarget.closest('[dir="rtl"]'));switch(e.key){case d.ARROW_RIGHT:a["lower"===t?0:1]=r?y["lower"===t?0:1]-b:y["lower"===t?0:1]+b;break;case d.ARROW_LEFT:a["lower"===t?0:1]=r?y["lower"===t?0:1]+b:y["lower"===t?0:1]-b;break;case d.ARROW_UP:a["lower"===t?0:1]=y["lower"===t?0:1]+b;break;case d.ARROW_DOWN:a["lower"===t?0:1]=y["lower"===t?0:1]-b;break;case d.HOME:a["lower"===t?0:1]=h;break;case d.END:a["lower"===t?0:1]=f;break;default:return}e.preventDefault(),"lower"===t?a[0]=Math.min(a[0],y[1]):a[1]=Math.max(a[1],y[0]),a[0]=A(a[0]),a[1]=A(a[1]),C(a)};return t("div",{ref:c,className:p?`${p}-range-slider`:void 0,...u,children:[e(m.div,{className:p?`${p}-thumb ${p}-thumb-lower`:void 0,role:"slider",tabIndex:g?-1:0,"aria-valuemin":h,"aria-valuemax":f,"aria-valuenow":y[0],"aria-orientation":x,"aria-label":n?`${n} minimum`:"Minimum value","aria-labelledby":o,"data-state":"lower"===M?"dragging":"lower"===k?"active":"inactive","data-disabled":g,onKeyDown:e=>X(e,"lower"),onFocus:()=>N("lower"),onBlur:()=>N(null),onPointerDown:e=>E(e,"lower"),onPointerMove:e=>T(e,"lower"),onPointerUp:O,style:"vertical"===x?{bottom:`calc(${D}% - 8px)`}:{left:`calc(${D}% - 8px)`}}),e(m.div,{className:p?`${p}-thumb ${p}-thumb-upper`:void 0,role:"slider",tabIndex:g?-1:0,"aria-valuemin":h,"aria-valuemax":f,"aria-valuenow":y[1],"aria-orientation":x,"aria-label":n?`${n} maximum`:"Maximum value","aria-labelledby":o,"data-state":"upper"===M?"dragging":"upper"===k?"active":"inactive","data-disabled":g,onKeyDown:e=>X(e,"upper"),onFocus:()=>N("upper"),onBlur:()=>N(null),onPointerDown:e=>E(e,"upper"),onPointerMove:e=>T(e,"upper"),onPointerUp:O,style:"vertical"===x?{bottom:`calc(${S}% - 8px)`}:{left:`calc(${S}% - 8px)`}}),e("div",{className:p?`${p}-range-fill`:void 0,style:"vertical"===x?{bottom:`${Math.min(D,S)}%`,height:`${Math.abs(S-D)}%`,left:0,right:0}:{left:`${Math.min(D,S)}%`,width:`${Math.abs(S-D)}%`,top:0,bottom:0}}),a]})}));y.displayName="SliderRangeSlider";const R=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(R.Root,{ref:a,defaultValue:r,min:n,max:o,step:l,orientation:i,formatValue:s,...m,children:e(R.Track,{children:e(R.Range,{children:e(R.Thumb,{"aria-label":u,"aria-labelledby":c})})})})}));R.displayName="Slider",R.Root=f,R.Track=b,R.Range=x,R.Thumb=g,R.Marks=w,R.RangeSlider=y;export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as s}from"react/jsx-runtime";import e from"react";import{u as o}from"./useComponentClass-QwNivz0h.js";import{c as r}from"./index-eAZUMNef.js";import{c as a}from"./clsx-BaVHROc5.js";import"./ThemeContext-Sm-iNANd.js";const t="Spinner",
|
|
1
|
+
'use client';import{jsx as s}from"react/jsx-runtime";import e from"react";import{u as o}from"./useComponentClass-QwNivz0h.js";import{c as r}from"./index-eAZUMNef.js";import{c as a}from"./clsx-BaVHROc5.js";import"./ThemeContext-Sm-iNANd.js";const t="Spinner",i=e.forwardRef((({className:e,customRootClass:i="",size:m="",...n},c)=>{const p=o(i,t),f=r("spinner",{size:m}),l=a(p,e)||void 0;return s("div",{className:p?`${p}-container`:void 0,children:s("span",{ref:c,className:l,...n,...f})})}));i.displayName=t;export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import t,{createContext as n,useRef as r,useState as i,useCallback as o,useMemo as a,useEffect as s}from"react";import{u as l}from"./useComponentClass-QwNivz0h.js";import{c}from"./clsx-BaVHROc5.js";import"./ThemeContext-Sm-iNANd.js";const m=n(null),
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import t,{createContext as n,useRef as r,useState as i,useCallback as o,useMemo as a,useEffect as s}from"react";import{u as l}from"./useComponentClass-QwNivz0h.js";import{K as c}from"./keyboard-BKF7hXqL.js";import{c as u}from"./clsx-BaVHROc5.js";import"./ThemeContext-Sm-iNANd.js";const m=n(null),d=()=>{const e=t.useContext(m);if(!e)throw new Error("Splitter components must be used within a Splitter.Root");return e},f=t.forwardRef((({orientation:t="horizontal",children:n,className:d,customRootClass:f="",defaultSizes:h=[50,50],minSizes:p=[0,0],maxSizes:v=[100,100],onSizesChange:x,style:y,...S},w)=>{const z=l(f,"Splitter"),R=r(null),[g,D]=i(h),[E,N]=i(!1),[A,H]=i(null),[P,b]=i(null),k=o((e=>{R.current=e,"function"==typeof w?w(e):w&&(w.current=e)}),[w]),C=a((()=>({minSizes:p||[],maxSizes:v||[]})),[p,v]),I=r(null);s((()=>()=>{I.current&&(clearTimeout(I.current),I.current=null)}),[]);const L=r(g),M=r(C);L.current=g,M.current=C;const j="horizontal"===t,O=o(((e,t=L.current)=>{const n=e,r=e+1,{minSizes:i,maxSizes:o}=M.current,a=(t[n]||0)+(t[r]||0),s=i[n]??0,l=o[n]??100,c=i[r]??0,u=o[r]??100;return{leftPanelIndex:n,rightPanelIndex:r,min:Math.max(s,a-u),max:Math.min(l,a-c),totalAdjacentSize:a}}),[]),T=o(((e,t,n=L.current)=>{const r=[...n],{leftPanelIndex:i,rightPanelIndex:o,min:a,max:s,totalAdjacentSize:l}=O(e,r),c=((e,t,n)=>Math.max(t,Math.min(n,e)))(t,a,s);return r[i]=c,r[o]=l-c,r}),[O]),W=o((e=>{const t=L.current,{leftPanelIndex:n,min:r,max:i}=O(e,t);return{"aria-valuemin":r,"aria-valuemax":i,"aria-valuenow":t[n]||0}}),[O]),X=o(((e,t=!1)=>{D(e),I.current&&clearTimeout(I.current),x&&(t?x(e):I.current=setTimeout((()=>{x(e)}),16))}),[x]),Y=o(((e,t)=>{t.preventDefault();const n=j?"clientX"in t?t.clientX:t.touches[0].clientX:"clientY"in t?t.clientY:t.touches[0].clientY,r=[...L.current];b({position:n,sizes:r}),N(!0),H(e);let i=null,o=0;const a=t=>{if(!R.current)return;const a=Date.now();a-o<16||(i&&cancelAnimationFrame(i),i=requestAnimationFrame((()=>{const i=((j?"clientX"in t?t.clientX:t.touches[0].clientX:"clientY"in t?t.clientY:t.touches[0].clientY)-n)/(j?R.current.offsetWidth:R.current.offsetHeight)*100;if(Math.abs(i)>.1){const t=T(e,(r[e]||0)+i,r);D(t)}o=a})))},s=()=>{i&&cancelAnimationFrame(i),N(!1),H(null),b(null);const e=L.current;x&&x(e),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",s),document.removeEventListener("touchmove",a),document.removeEventListener("touchend",s)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",s),document.addEventListener("touchmove",a),document.addEventListener("touchend",s)}),[j,x,T]),K=o(((e,t)=>{const n=t.shiftKey?10:1,r=L.current;let i=0;if(j?(t.key===c.ARROW_LEFT&&(i=-n),t.key===c.ARROW_RIGHT&&(i=n)):(t.key===c.ARROW_UP&&(i=-n),t.key===c.ARROW_DOWN&&(i=n)),0===i){if(t.key===c.HOME||t.key===c.END){t.preventDefault();const{min:n,max:i}=O(e,r);X(T(e,t.key===c.HOME?n:i),!0)}}else{t.preventDefault();const n=r[e]||0;X(T(e,n+i),!0)}}),[O,j,T,X]),F={orientation:t,sizes:g,setSizes:X,getHandleValueAttributes:W,startDrag:Y,handleKeyDown:K,isDragging:E,activeHandleIndex:A,rootClass:z};return e(m.Provider,{value:F,children:e("div",{...S,ref:k,className:u(z,d),style:{display:"flex",flexDirection:j?"row":"column",width:"100%",height:"100%",...y},children:n})})}));f.displayName="SplitterRoot";const h=t.forwardRef((({index:t,children:n,className:r,style:i,...o},a)=>{const{sizes:s,orientation:l,rootClass:c}=d(),m={flexBasis:`${s[t]}%`,flexGrow:0,flexShrink:0,overflow:"auto",minWidth:"horizontal"===l?0:void 0,minHeight:"vertical"===l?0:void 0,...i};return e("div",{...o,ref:a,className:u(c&&`${c}-panel`,r),style:m,children:n})}));h.displayName="SplitterPanel";const p=t.forwardRef((({index:t,className:n,"aria-label":r,style:i,...o},a)=>{const{startDrag:s,orientation:l,isDragging:c,activeHandleIndex:m,handleKeyDown:f,getHandleValueAttributes:h,rootClass:p}=d(),v=c&&m===t,x=h(t);return e("div",{...o,ref:a,className:u(p&&`${p}-handle`,{active:v},n),role:"separator","aria-orientation":l,"aria-label":r||`${l} resize handle`,...x,tabIndex:0,onMouseDown:e=>s(t,e),onTouchStart:e=>s(t,e),onKeyDown:e=>f(t,e),style:i})}));p.displayName="SplitterHandle";const v=t.forwardRef(((t,n)=>(console.warn("Direct usage of Splitter is not supported. Please use Splitter.Root, Splitter.Panel, etc. instead."),e("div",{ref:n,...t}))));v.displayName="Splitter",v.Root=f,v.Panel=h,v.Handle=p;export{v as default};
|
package/dist/components/Steps.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import{c as t}from"./clsx-BaVHROc5.js";import{u as s}from"./useComponentClass-QwNivz0h.js";import{P as r}from"./index-
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import{c as t}from"./clsx-BaVHROc5.js";import{u as s}from"./useComponentClass-QwNivz0h.js";import{P as r}from"./index-XF8itt-H.js";import{createContext as a,useContext as o}from"react";import{u as n}from"./index-wRElCyvx.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-0RucjqeH.js";const l=a(null),i=()=>{const e=o(l);if(!e)throw new Error("useStepsContext must be used within a StepsContext.Provider");return e},c=Object.assign((()=>(console.warn("Direct usage of Steps is not supported. Please use Steps.Root, Steps.Item, etc. instead."),null)),{Root:({children:a,className:o,customRootClass:i,orientation:c="horizontal",value:m,defaultValue:d,onValueChange:u,...p})=>{const[h,C]=n(m,d??0,u),v=s(i,"Steps");return e(l.Provider,{value:{currentStep:h,setCurrentStep:C,rootClass:v,orientation:c},children:e(r.div,{className:t(v,o,v&&`${v}-${c}`),"data-orientation":c,...p,children:a})})},Item:({children:s,value:r=0,className:a="",...o})=>{const{rootClass:n,currentStep:l}=i(),c="number"==typeof r&&l>r?"completed":"number"==typeof r&&l===r?"active":"inactive";return e("div",{className:t(n&&`${n}-item`,a),"data-state":c,"data-value":r,...o,children:s})},Track:({children:s,className:r="",...a})=>{const{rootClass:o}=i();return e("div",{className:t(o&&`${o}-track`,r),...a,children:s})},Bubble:({children:s,className:r="",...a})=>{const{rootClass:o}=i();return e("div",{className:t(o&&`${o}-bubble`,r),...a,children:s})},Line:({children:s,className:r="",...a})=>{const{rootClass:o}=i();return e("div",{className:t(o&&`${o}-line`,r),...a,children:s})},Content:({children:s,className:r="",...a})=>{const{rootClass:o}=i();return e("div",{className:t(o&&`${o}-content`,r),...a,children:s})},Title:({children:s,className:r="",...a})=>{const{rootClass:o}=i();return e("div",{className:t(o&&`${o}-title`,r),...a,children:s})},Description:({children:s,className:r="",...a})=>{const{rootClass:o}=i();return e("div",{className:t(o&&`${o}-description`,r),...a,children:s})}});export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import{createContext as s,forwardRef as a,useContext as t}from"react";import{B as i}from"./index-
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import{createContext as s,forwardRef as a,useContext as t}from"react";import{B as i}from"./index-CfC8-kd8.js";import{u as o}from"./useComponentClass-QwNivz0h.js";import{c as d,a as c,b as r}from"./index-eAZUMNef.js";import{u as l}from"./index-wRElCyvx.js";import{c as h}from"./clsx-BaVHROc5.js";import{P as n}from"./index-XF8itt-H.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-0RucjqeH.js";const m=s({checked:!1,setChecked:()=>{},rootClass:"",disabled:!1}),u="Switch",p=a((({children:s,customRootClass:a,color:t="",variant:h,size:n,defaultChecked:p=!1,checked:C,onCheckedChange:k,disabled:f=!1,required:b=!1,name:w,value:j,asChild:x=!1,...v},N)=>{const[S,P]=l(C,p,k),T=o(a,u),g=d("switch",{variant:h,size:n}),R=r(t),q=c(g,R),y={checked:S,setChecked:P,rootClass:T,disabled:f},z={...q,"data-slot":"switch-root","data-state":S?"checked":"unchecked","data-disabled":f?"":void 0,role:"switch","aria-checked":S,"aria-required":b,disabled:f,...v};return w&&(z.name=w),j&&(z.value=j),e(m.Provider,{value:y,children:e(i,{ref:N,onClick:()=>{f||P(!S)},className:T,asChild:x,...z,children:s})})}));p.displayName=u;const C=a((({asChild:s=!1,className:a,children:i,...o},d)=>{const{checked:c,rootClass:r,disabled:l}=t(m),u={"data-slot":"switch-thumb"};return u["data-state"]=c?"checked":"unchecked",l&&(u["data-disabled"]=""),e(n.span,{ref:d,className:h(r&&`${r}-indicator`,a),asChild:s,...u,...o,children:i})}));C.displayName="SwitchThumb";const k=()=>(console.warn("Direct usage of Switch is not supported. Please use Switch.Root, Switch.Thumb, etc. instead."),null);k.Root=p,k.Thumb=C;export{k as default};
|