@kushagradhawan/kookie-ui 0.1.126 → 0.1.127
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/components.css +31 -0
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.d.ts +4 -1
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.d.ts.map +1 -1
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.js +1 -1
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.js.map +3 -3
- package/dist/cjs/components/dropdown-menu.d.ts.map +1 -1
- package/dist/cjs/components/dropdown-menu.js +1 -1
- package/dist/cjs/components/dropdown-menu.js.map +2 -2
- package/dist/esm/components/_internal/dropdown-menu-drill-down.d.ts +4 -1
- package/dist/esm/components/_internal/dropdown-menu-drill-down.d.ts.map +1 -1
- package/dist/esm/components/_internal/dropdown-menu-drill-down.js +1 -1
- package/dist/esm/components/_internal/dropdown-menu-drill-down.js.map +3 -3
- package/dist/esm/components/dropdown-menu.d.ts.map +1 -1
- package/dist/esm/components/dropdown-menu.js +1 -1
- package/dist/esm/components/dropdown-menu.js.map +2 -2
- package/package.json +2 -2
- package/schemas/base-button.json +1 -1
- package/schemas/button.json +1 -1
- package/schemas/icon-button.json +1 -1
- package/schemas/index.json +6 -6
- package/schemas/toggle-button.json +1 -1
- package/schemas/toggle-icon-button.json +1 -1
- package/src/components/_internal/dropdown-menu-drill-down.tsx +12 -2
- package/src/components/animations.css +11 -0
- package/src/components/dropdown-menu.css +22 -0
- package/src/components/dropdown-menu.tsx +2 -0
- package/styles.css +31 -0
package/components.css
CHANGED
|
@@ -351,6 +351,26 @@
|
|
|
351
351
|
animation: rt-tab-indicator-appear var(--motion-duration-small) var(--motion-spring-snappy);
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
+
@keyframes rt-drill-down-enter-from-right {
|
|
355
|
+
from {
|
|
356
|
+
opacity: 0;
|
|
357
|
+
transform: translateX(30%);
|
|
358
|
+
}
|
|
359
|
+
to {
|
|
360
|
+
opacity: 1;
|
|
361
|
+
transform: translateX(0);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
@keyframes rt-drill-down-enter-from-left {
|
|
365
|
+
from {
|
|
366
|
+
opacity: 0;
|
|
367
|
+
transform: translateX(-30%);
|
|
368
|
+
}
|
|
369
|
+
to {
|
|
370
|
+
opacity: 1;
|
|
371
|
+
transform: translateX(0);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
354
374
|
@keyframes rt-dialog-overlay-no-op {
|
|
355
375
|
from {
|
|
356
376
|
opacity: 1;
|
|
@@ -8741,6 +8761,17 @@
|
|
|
8741
8761
|
outline-offset: 2px;
|
|
8742
8762
|
}
|
|
8743
8763
|
}
|
|
8764
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
8765
|
+
.rt-DropdownMenuDrillDownPanel:where([data-drill-down-active][data-animation-direction='forward']) > :where(*:not(.rt-DropdownMenuDrillDownPanel)) {
|
|
8766
|
+
animation: rt-drill-down-enter-from-right var(--motion-duration-small) var(--motion-ease-smooth);
|
|
8767
|
+
}
|
|
8768
|
+
.rt-DropdownMenuDrillDownPanel:where([data-drill-down-active][data-animation-direction='backward']) > :where(*:not(.rt-DropdownMenuDrillDownPanel)) {
|
|
8769
|
+
animation: rt-drill-down-enter-from-left var(--motion-duration-small) var(--motion-ease-smooth);
|
|
8770
|
+
}
|
|
8771
|
+
.rt-DropdownMenuDrillDownRoot:where(:not([data-drill-down-active])[data-animation-direction='backward']) > :where(*:not(.rt-DropdownMenuDrillDownPanel)) {
|
|
8772
|
+
animation: rt-drill-down-enter-from-left var(--motion-duration-small) var(--motion-ease-smooth);
|
|
8773
|
+
}
|
|
8774
|
+
}
|
|
8744
8775
|
:where([data-panel-background='translucent'], [data-material='translucent']) .rt-TextFieldRoot {
|
|
8745
8776
|
-webkit-backdrop-filter: var(--backdrop-filter-components);
|
|
8746
8777
|
backdrop-filter: var(--backdrop-filter-components);
|
|
@@ -16,6 +16,7 @@ declare function useBreakpoint(): {
|
|
|
16
16
|
* Falls back through smaller breakpoints if the current one isn't defined.
|
|
17
17
|
*/
|
|
18
18
|
declare function resolveResponsiveValue<T>(value: T | Partial<Record<Breakpoint, T>> | undefined, currentBreakpoint: Breakpoint, defaultValue: T): T;
|
|
19
|
+
type AnimationDirection = 'forward' | 'backward' | null;
|
|
19
20
|
interface DrillDownContextValue {
|
|
20
21
|
/** Current submenu behavior mode */
|
|
21
22
|
behavior: SubmenuBehavior;
|
|
@@ -35,6 +36,8 @@ interface DrillDownContextValue {
|
|
|
35
36
|
isRoot: boolean;
|
|
36
37
|
/** The currently active submenu ID (or null if at root) */
|
|
37
38
|
currentId: string | null;
|
|
39
|
+
/** Current animation direction for transitions */
|
|
40
|
+
animationDirection: AnimationDirection;
|
|
38
41
|
}
|
|
39
42
|
declare const DrillDownContext: React.Context<DrillDownContextValue | null>;
|
|
40
43
|
interface DrillDownProviderProps {
|
|
@@ -56,5 +59,5 @@ interface SubContextValue {
|
|
|
56
59
|
declare const SubContext: React.Context<SubContextValue | null>;
|
|
57
60
|
declare function useSubContext(): SubContextValue | null;
|
|
58
61
|
export { DrillDownProvider, DrillDownContext, SubContext, useDrillDown, useDrillDownOptional, useSubContext, useBreakpoint, resolveResponsiveValue, };
|
|
59
|
-
export type { SubmenuBehavior, DrillDownContextValue, SubContextValue };
|
|
62
|
+
export type { SubmenuBehavior, DrillDownContextValue, SubContextValue, AnimationDirection };
|
|
60
63
|
//# sourceMappingURL=dropdown-menu-drill-down.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu-drill-down.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/dropdown-menu-drill-down.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,KAAK,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;GAIG;AACH,iBAAS,aAAa,IAAI;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAsDnE;AAED;;;GAGG;AACH,iBAAS,sBAAsB,CAAC,CAAC,EAC/B,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,EACrD,iBAAiB,EAAE,UAAU,EAC7B,YAAY,EAAE,CAAC,GACd,CAAC,CA6BH;AAMD,UAAU,qBAAqB;IAC7B,oCAAoC;IACpC,QAAQ,EAAE,eAAe,CAAC;IAC1B,kEAAkE;IAClE,KAAK,EAAE,OAAO,CAAC;IACf,mEAAmE;IACnE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,8BAA8B;IAC9B,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,mCAAmC;IACnC,GAAG,EAAE,MAAM,IAAI,CAAC;IAChB,yBAAyB;IACzB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,8DAA8D;IAC9D,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,sDAAsD;IACtD,MAAM,EAAE,OAAO,CAAC;IAChB,2DAA2D;IAC3D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"dropdown-menu-drill-down.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/dropdown-menu-drill-down.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,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AC,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,sBAAsB,qBA6D/E;AAED,iBAAS,YAAY,0BAMpB;AAED;;GAEG;AACH,iBAAS,oBAAoB,iCAE5B;AAMD,UAAU,eAAe;IACvB,iCAAiC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,QAAA,MAAM,UAAU,uCAAoD,CAAC;AAErE,iBAAS,aAAa,2BAErB;AAED,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,sBAAsB,GACvB,CAAC;AAEF,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var L=Object.create;var m=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var r in t)m(e,r,{get:t[r],enumerable:!0})},y=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of A(t))!V.call(e,n)&&n!==r&&m(e,n,{get:()=>t[n],enumerable:!(a=P(t,n))||a.enumerable});return e};var O=(e,t,r)=>(r=e!=null?L(T(e)):{},y(t||!e||!e.__esModule?m(r,"default",{value:e,enumerable:!0}):r,e)),N=e=>y(m({},"__esModule",{value:!0}),e);var I={};M(I,{DrillDownContext:()=>f,DrillDownProvider:()=>C,SubContext:()=>D,resolveResponsiveValue:()=>b,useBreakpoint:()=>v,useDrillDown:()=>k,useDrillDownOptional:()=>B,useSubContext:()=>R});module.exports=N(I);var o=O(require("react")),g=require("../shell.types.js");function v(){const[e,t]=o.useState("initial"),[r,a]=o.useState(!1);return o.useEffect(()=>{if(typeof window>"u")return;const c=Object.entries(g._BREAKPOINTS).map(([i,s])=>[i,window.matchMedia(s)]),u=()=>{const i=c.filter(([,d])=>d.matches).map(([d])=>d),s=i[i.length-1]??"initial";t(s),a(!0)};u();const l=[];return c.forEach(([,i])=>{const s=i;typeof s.addEventListener=="function"?(s.addEventListener("change",u),l.push(()=>s.removeEventListener?.("change",u))):typeof s.addListener=="function"&&(s.addListener(u),l.push(()=>s.removeListener?.(u)))}),()=>{l.forEach(i=>{try{i()}catch{}})}},[]),{breakpoint:e,ready:r}}function b(e,t,r){if(e==null)return r;if(typeof e!="object")return e;const a=e;if(a[t]!==void 0)return a[t];const n=["xl","lg","md","sm","xs","initial"],c=n.indexOf(t);for(let u=c+1;u<n.length;u++){const l=n[u];if(a[l]!==void 0)return a[l]}return r}const f=o.createContext(null);function C({children:e,submenuBehavior:t}){const{breakpoint:r,ready:a}=v(),[n,c]=o.useState([]),[u,l]=o.useState(null),i=o.useMemo(()=>b(t,r,"cascade"),[t,r]),s=o.useRef(i);o.useEffect(()=>{s.current==="drill-down"&&i==="cascade"&&(c([]),l(null)),s.current=i},[i]);const d=o.useCallback(p=>{l("forward"),c(E=>[...E,p])},[]),h=o.useCallback(()=>{l("backward"),c(p=>p.slice(0,-1))},[]),w=o.useCallback(()=>{c([]),l(null)},[]),x=o.useCallback(p=>n.length===0?!1:n[n.length-1]===p,[n]),S=o.useMemo(()=>({behavior:i,ready:a,stack:n,push:d,pop:h,reset:w,isActive:x,isRoot:n.length===0,currentId:n.length>0?n[n.length-1]:null,animationDirection:u}),[i,a,n,d,h,w,x,u]);return o.createElement(f.Provider,{value:S},e)}function k(){const e=o.useContext(f);if(!e)throw new Error("useDrillDown must be used within a DropdownMenu.Content");return e}function B(){return o.useContext(f)}const D=o.createContext(null);function R(){return o.useContext(D)}
|
|
2
2
|
//# sourceMappingURL=dropdown-menu-drill-down.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/_internal/dropdown-menu-drill-down.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport type { Breakpoint, Responsive } from '../../props/prop-def.js';\nimport type { submenuBehaviors } from './base-menu.props.js';\nimport { _BREAKPOINTS } from '../shell.types.js';\n\ntype SubmenuBehavior = (typeof submenuBehaviors)[number];\n\n/**\n * Hook to get the current breakpoint based on window width.\n * Returns 'initial' on the server and during initial hydration.\n * Uses shared breakpoint values from shell.types.js.\n */\nfunction useBreakpoint(): { breakpoint: Breakpoint; ready: boolean } {\n const [currentBp, setCurrentBp] = React.useState<Breakpoint>('initial');\n const [ready, setReady] = React.useState(false);\n\n React.useEffect(() => {\n if (typeof window === 'undefined') return;\n\n // Use shared breakpoint media queries from shell.types\n const queries = Object.entries(_BREAKPOINTS) as [keyof typeof _BREAKPOINTS, string][];\n const mqls = queries.map(([k, q]) => [k, window.matchMedia(q)] as const);\n\n const compute = () => {\n // Highest matched breakpoint wins\n const matched = mqls.filter(([, m]) => m.matches).map(([k]) => k);\n const next = (matched[matched.length - 1] as Breakpoint | undefined) ?? 'initial';\n setCurrentBp(next);\n setReady(true);\n };\n\n compute();\n\n const cleanups: Array<() => void> = [];\n mqls.forEach(([, m]) => {\n const mm = m as MediaQueryList & {\n addEventListener?: (type: 'change', listener: () => void) => void;\n removeEventListener?: (type: 'change', listener: () => void) => void;\n addListener?: (listener: () => void) => void;\n removeListener?: (listener: () => void) => void;\n };\n if (typeof mm.addEventListener === 'function') {\n mm.addEventListener('change', compute);\n cleanups.push(() => mm.removeEventListener?.('change', compute));\n } else if (typeof mm.addListener === 'function') {\n mm.addListener(compute);\n cleanups.push(() => mm.removeListener?.(compute));\n }\n });\n\n return () => {\n cleanups.forEach((fn) => {\n try {\n fn();\n } catch (e) {\n // MediaQueryList cleanup can fail in edge cases (e.g., already removed)\n // Log in development to aid debugging\n if (process.env.NODE_ENV !== 'production') {\n console.warn('[DropdownMenu] MediaQueryList cleanup warning:', e);\n }\n }\n });\n };\n }, []);\n\n return { breakpoint: currentBp, ready };\n}\n\n/**\n * Resolves a responsive value to its current value based on the breakpoint.\n * Falls back through smaller breakpoints if the current one isn't defined.\n */\nfunction resolveResponsiveValue<T>(\n value: T | Partial<Record<Breakpoint, T>> | undefined,\n currentBreakpoint: Breakpoint,\n defaultValue: T\n): T {\n if (value === undefined || value === null) {\n return defaultValue;\n }\n\n // Non-object values are returned directly\n if (typeof value !== 'object') {\n return value;\n }\n\n const map = value as Partial<Record<Breakpoint, T>>;\n\n // Check if current breakpoint has a value\n if (map[currentBreakpoint] !== undefined) {\n return map[currentBreakpoint] as T;\n }\n\n // Fall back through smaller breakpoints\n const bpOrder: Breakpoint[] = ['xl', 'lg', 'md', 'sm', 'xs', 'initial'];\n const startIdx = bpOrder.indexOf(currentBreakpoint);\n\n for (let i = startIdx + 1; i < bpOrder.length; i++) {\n const bp = bpOrder[i];\n if (map[bp] !== undefined) {\n return map[bp] as T;\n }\n }\n\n return defaultValue;\n}\n\n// ============================================================================\n// DrillDown Context\n// ============================================================================\n\ninterface DrillDownContextValue {\n /** Current submenu behavior mode */\n behavior: SubmenuBehavior;\n /** Whether the breakpoint has been resolved (client-side only) */\n ready: boolean;\n /** Stack of active submenu IDs. Empty means root menu is shown. */\n stack: string[];\n /** Navigate into a submenu */\n push: (id: string) => void;\n /** Navigate back to parent menu */\n pop: () => void;\n /** Reset to root menu */\n reset: () => void;\n /** Check if a specific submenu is the currently active one */\n isActive: (id: string) => boolean;\n /** Check if we're at root level (no submenus open) */\n isRoot: boolean;\n /** The currently active submenu ID (or null if at root) */\n currentId: string | null;\n}\n\nconst DrillDownContext = React.createContext<DrillDownContextValue | null>(null);\n\ninterface DrillDownProviderProps {\n children: React.ReactNode;\n submenuBehavior: Responsive<SubmenuBehavior> | undefined;\n}\n\nfunction DrillDownProvider({ children, submenuBehavior }: DrillDownProviderProps) {\n const { breakpoint, ready } = useBreakpoint();\n const [stack, setStack] = React.useState<string[]>([]);\n\n // Resolve the current behavior based on breakpoint\n const behavior = React.useMemo(\n () => resolveResponsiveValue(submenuBehavior, breakpoint, 'cascade'),\n [submenuBehavior, breakpoint]\n );\n\n // Reset stack when behavior changes from drill-down to cascade\n const prevBehaviorRef = React.useRef(behavior);\n React.useEffect(() => {\n if (prevBehaviorRef.current === 'drill-down' && behavior === 'cascade') {\n setStack([]);\n }\n prevBehaviorRef.current = behavior;\n }, [behavior]);\n\n const push = React.useCallback((id: string) => {\n setStack((prev) => [...prev, id]);\n }, []);\n\n const pop = React.useCallback(() => {\n setStack((prev) => prev.slice(0, -1));\n }, []);\n\n const reset = React.useCallback(() => {\n setStack([]);\n }, []);\n\n const isActive = React.useCallback(\n (id: string) => {\n if (stack.length === 0) return false;\n return stack[stack.length - 1] === id;\n },\n [stack]\n );\n\n const value = React.useMemo(\n (): DrillDownContextValue => ({\n behavior,\n ready,\n stack,\n push,\n pop,\n reset,\n isActive,\n isRoot: stack.length === 0,\n currentId: stack.length > 0 ? stack[stack.length - 1] : null,\n }),\n [behavior, ready, stack, push, pop, reset, isActive]\n );\n\n return <DrillDownContext.Provider value={value}>{children}</DrillDownContext.Provider>;\n}\n\nfunction useDrillDown() {\n const ctx = React.useContext(DrillDownContext);\n if (!ctx) {\n throw new Error('useDrillDown must be used within a DropdownMenu.Content');\n }\n return ctx;\n}\n\n/**\n * Hook to check if drill-down context is available (i.e., we're inside Content)\n */\nfunction useDrillDownOptional() {\n return React.useContext(DrillDownContext);\n}\n\n// ============================================================================\n// Sub Context (for individual submenu instances)\n// ============================================================================\n\ninterface SubContextValue {\n /** Unique ID for this submenu */\n id: string;\n /** Label for the back button */\n label: React.ReactNode;\n}\n\nconst SubContext = React.createContext<SubContextValue | null>(null);\n\nfunction useSubContext() {\n return React.useContext(SubContext);\n}\n\nexport {\n DrillDownProvider,\n DrillDownContext,\n SubContext,\n useDrillDown,\n useDrillDownOptional,\n useSubContext,\n useBreakpoint,\n resolveResponsiveValue,\n};\n\nexport type { SubmenuBehavior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CACL,MAAY,CAMZ,CACF,CAAC,CACH,CACF,EAAG,CAAC,CAAC,EAEE,CAAE,WAAYb,EAAW,MAAAE,CAAM,CACxC,CAMA,SAASV,EACPsB,EACAC,EACAC,EACG,CACH,GAA2BF,GAAU,KACnC,OAAOE,EAIT,GAAI,OAAOF,GAAU,SACnB,OAAOA,EAGT,MAAMG,EAAMH,EAGZ,GAAIG,EAAIF,CAAiB,IAAM,OAC7B,OAAOE,EAAIF,CAAiB,EAI9B,MAAMG,EAAwB,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,SAAS,EAChEC,EAAWD,EAAQ,QAAQH,CAAiB,EAElD,
|
|
6
|
-
"names": ["dropdown_menu_drill_down_exports", "__export", "DrillDownContext", "DrillDownProvider", "SubContext", "resolveResponsiveValue", "useBreakpoint", "useDrillDown", "useDrillDownOptional", "useSubContext", "__toCommonJS", "React", "import_shell_types", "currentBp", "setCurrentBp", "ready", "setReady", "mqls", "k", "q", "compute", "matched", "m", "next", "cleanups", "mm", "fn", "value", "currentBreakpoint", "defaultValue", "map", "bpOrder", "startIdx", "bp", "children", "submenuBehavior", "breakpoint", "stack", "setStack", "behavior", "prevBehaviorRef", "push", "id", "prev", "pop", "reset", "isActive", "ctx"]
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport type { Breakpoint, Responsive } from '../../props/prop-def.js';\nimport type { submenuBehaviors } from './base-menu.props.js';\nimport { _BREAKPOINTS } from '../shell.types.js';\n\ntype SubmenuBehavior = (typeof submenuBehaviors)[number];\n\n/**\n * Hook to get the current breakpoint based on window width.\n * Returns 'initial' on the server and during initial hydration.\n * Uses shared breakpoint values from shell.types.js.\n */\nfunction useBreakpoint(): { breakpoint: Breakpoint; ready: boolean } {\n const [currentBp, setCurrentBp] = React.useState<Breakpoint>('initial');\n const [ready, setReady] = React.useState(false);\n\n React.useEffect(() => {\n if (typeof window === 'undefined') return;\n\n // Use shared breakpoint media queries from shell.types\n const queries = Object.entries(_BREAKPOINTS) as [keyof typeof _BREAKPOINTS, string][];\n const mqls = queries.map(([k, q]) => [k, window.matchMedia(q)] as const);\n\n const compute = () => {\n // Highest matched breakpoint wins\n const matched = mqls.filter(([, m]) => m.matches).map(([k]) => k);\n const next = (matched[matched.length - 1] as Breakpoint | undefined) ?? 'initial';\n setCurrentBp(next);\n setReady(true);\n };\n\n compute();\n\n const cleanups: Array<() => void> = [];\n mqls.forEach(([, m]) => {\n const mm = m as MediaQueryList & {\n addEventListener?: (type: 'change', listener: () => void) => void;\n removeEventListener?: (type: 'change', listener: () => void) => void;\n addListener?: (listener: () => void) => void;\n removeListener?: (listener: () => void) => void;\n };\n if (typeof mm.addEventListener === 'function') {\n mm.addEventListener('change', compute);\n cleanups.push(() => mm.removeEventListener?.('change', compute));\n } else if (typeof mm.addListener === 'function') {\n mm.addListener(compute);\n cleanups.push(() => mm.removeListener?.(compute));\n }\n });\n\n return () => {\n cleanups.forEach((fn) => {\n try {\n fn();\n } catch (e) {\n // MediaQueryList cleanup can fail in edge cases (e.g., already removed)\n // Log in development to aid debugging\n if (process.env.NODE_ENV !== 'production') {\n console.warn('[DropdownMenu] MediaQueryList cleanup warning:', e);\n }\n }\n });\n };\n }, []);\n\n return { breakpoint: currentBp, ready };\n}\n\n/**\n * Resolves a responsive value to its current value based on the breakpoint.\n * Falls back through smaller breakpoints if the current one isn't defined.\n */\nfunction resolveResponsiveValue<T>(\n value: T | Partial<Record<Breakpoint, T>> | undefined,\n currentBreakpoint: Breakpoint,\n defaultValue: T\n): T {\n if (value === undefined || value === null) {\n return defaultValue;\n }\n\n // Non-object values are returned directly\n if (typeof value !== 'object') {\n return value;\n }\n\n const map = value as Partial<Record<Breakpoint, T>>;\n\n // Check if current breakpoint has a value\n if (map[currentBreakpoint] !== undefined) {\n return map[currentBreakpoint] as T;\n }\n\n // Fall back through smaller breakpoints\n const bpOrder: Breakpoint[] = ['xl', 'lg', 'md', 'sm', 'xs', 'initial'];\n const startIdx = bpOrder.indexOf(currentBreakpoint);\n\n for (let i = startIdx + 1; i < bpOrder.length; i++) {\n const bp = bpOrder[i];\n if (map[bp] !== undefined) {\n return map[bp] as T;\n }\n }\n\n return defaultValue;\n}\n\n// ============================================================================\n// DrillDown Context\n// ============================================================================\n\ntype AnimationDirection = 'forward' | 'backward' | null;\n\ninterface DrillDownContextValue {\n /** Current submenu behavior mode */\n behavior: SubmenuBehavior;\n /** Whether the breakpoint has been resolved (client-side only) */\n ready: boolean;\n /** Stack of active submenu IDs. Empty means root menu is shown. */\n stack: string[];\n /** Navigate into a submenu */\n push: (id: string) => void;\n /** Navigate back to parent menu */\n pop: () => void;\n /** Reset to root menu */\n reset: () => void;\n /** Check if a specific submenu is the currently active one */\n isActive: (id: string) => boolean;\n /** Check if we're at root level (no submenus open) */\n isRoot: boolean;\n /** The currently active submenu ID (or null if at root) */\n currentId: string | null;\n /** Current animation direction for transitions */\n animationDirection: AnimationDirection;\n}\n\nconst DrillDownContext = React.createContext<DrillDownContextValue | null>(null);\n\ninterface DrillDownProviderProps {\n children: React.ReactNode;\n submenuBehavior: Responsive<SubmenuBehavior> | undefined;\n}\n\nfunction DrillDownProvider({ children, submenuBehavior }: DrillDownProviderProps) {\n const { breakpoint, ready } = useBreakpoint();\n const [stack, setStack] = React.useState<string[]>([]);\n const [animationDirection, setAnimationDirection] = React.useState<AnimationDirection>(null);\n\n // Resolve the current behavior based on breakpoint\n const behavior = React.useMemo(\n () => resolveResponsiveValue(submenuBehavior, breakpoint, 'cascade'),\n [submenuBehavior, breakpoint]\n );\n\n // Reset stack when behavior changes from drill-down to cascade\n const prevBehaviorRef = React.useRef(behavior);\n React.useEffect(() => {\n if (prevBehaviorRef.current === 'drill-down' && behavior === 'cascade') {\n setStack([]);\n setAnimationDirection(null);\n }\n prevBehaviorRef.current = behavior;\n }, [behavior]);\n\n const push = React.useCallback((id: string) => {\n setAnimationDirection('forward');\n setStack((prev) => [...prev, id]);\n }, []);\n\n const pop = React.useCallback(() => {\n setAnimationDirection('backward');\n setStack((prev) => prev.slice(0, -1));\n }, []);\n\n const reset = React.useCallback(() => {\n setStack([]);\n setAnimationDirection(null);\n }, []);\n\n const isActive = React.useCallback(\n (id: string) => {\n if (stack.length === 0) return false;\n return stack[stack.length - 1] === id;\n },\n [stack]\n );\n\n const value = React.useMemo(\n (): DrillDownContextValue => ({\n behavior,\n ready,\n stack,\n push,\n pop,\n reset,\n isActive,\n isRoot: stack.length === 0,\n currentId: stack.length > 0 ? stack[stack.length - 1] : null,\n animationDirection,\n }),\n [behavior, ready, stack, push, pop, reset, isActive, animationDirection]\n );\n\n return <DrillDownContext.Provider value={value}>{children}</DrillDownContext.Provider>;\n}\n\nfunction useDrillDown() {\n const ctx = React.useContext(DrillDownContext);\n if (!ctx) {\n throw new Error('useDrillDown must be used within a DropdownMenu.Content');\n }\n return ctx;\n}\n\n/**\n * Hook to check if drill-down context is available (i.e., we're inside Content)\n */\nfunction useDrillDownOptional() {\n return React.useContext(DrillDownContext);\n}\n\n// ============================================================================\n// Sub Context (for individual submenu instances)\n// ============================================================================\n\ninterface SubContextValue {\n /** Unique ID for this submenu */\n id: string;\n /** Label for the back button */\n label: React.ReactNode;\n}\n\nconst SubContext = React.createContext<SubContextValue | null>(null);\n\nfunction useSubContext() {\n return React.useContext(SubContext);\n}\n\nexport {\n DrillDownProvider,\n DrillDownContext,\n SubContext,\n useDrillDown,\n useDrillDownOptional,\n useSubContext,\n useBreakpoint,\n resolveResponsiveValue,\n};\n\nexport type { SubmenuBehavior, DrillDownContextValue, SubContextValue, AnimationDirection };\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,sBAAAC,EAAA,eAAAC,EAAA,2BAAAC,EAAA,kBAAAC,EAAA,iBAAAC,EAAA,yBAAAC,EAAA,kBAAAC,IAAA,eAAAC,EAAAV,GAEA,IAAAW,EAAuB,oBAGvBC,EAA6B,6BAS7B,SAASN,GAA4D,CACnE,KAAM,CAACO,EAAW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AECQ,EAAWtC,EAAM,YACpBkC,GACKP,EAAM,SAAW,EAAU,GACxBA,EAAMA,EAAM,OAAS,CAAC,IAAMO,EAErC,CAACP,CAAK,CACR,EAEMX,EAAQhB,EAAM,QAClB,KAA8B,CAC5B,SAAA+B,EACA,MAAA3B,EACA,MAAAuB,EACA,KAAAM,EACA,IAAAG,EACA,MAAAC,EACA,SAAAC,EACA,OAAQX,EAAM,SAAW,EACzB,UAAWA,EAAM,OAAS,EAAIA,EAAMA,EAAM,OAAS,CAAC,EAAI,KACxD,mBAAAE,CACF,GACA,CAACE,EAAU3B,EAAOuB,EAAOM,EAAMG,EAAKC,EAAOC,EAAUT,CAAkB,CACzE,EAEA,OAAO7B,EAAA,cAACT,EAAiB,SAAjB,CAA0B,MAAOyB,GAAQQ,CAAS,CAC5D,CAEA,SAAS5B,GAAe,CACtB,MAAM2C,EAAMvC,EAAM,WAAWT,CAAgB,EAC7C,GAAI,CAACgD,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT,CAKA,SAAS1C,GAAuB,CAC9B,OAAOG,EAAM,WAAWT,CAAgB,CAC1C,CAaA,MAAME,EAAaO,EAAM,cAAsC,IAAI,EAEnE,SAASF,GAAgB,CACvB,OAAOE,EAAM,WAAWP,CAAU,CACpC",
|
|
6
|
+
"names": ["dropdown_menu_drill_down_exports", "__export", "DrillDownContext", "DrillDownProvider", "SubContext", "resolveResponsiveValue", "useBreakpoint", "useDrillDown", "useDrillDownOptional", "useSubContext", "__toCommonJS", "React", "import_shell_types", "currentBp", "setCurrentBp", "ready", "setReady", "mqls", "k", "q", "compute", "matched", "m", "next", "cleanups", "mm", "fn", "value", "currentBreakpoint", "defaultValue", "map", "bpOrder", "startIdx", "i", "bp", "children", "submenuBehavior", "breakpoint", "stack", "setStack", "animationDirection", "setAnimationDirection", "behavior", "prevBehaviorRef", "push", "id", "prev", "pop", "reset", "isActive", "ctx"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAQ,MAAM,UAAU,CAAC;AAGvE,OAAO,EACL,2BAA2B,EAE3B,wBAAwB,EACxB,gCAAgC,EAChC,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAWlC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAI/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAExE,UAAU,qBACR,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,qBAAqB,CAAC,IAAI,CAAC;CAAG;AAC9E,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAErD,CAAC;AAIF,UAAU,wBACR,SAAQ,qBAAqB,CAAC,OAAO,qBAAqB,CAAC,OAAO,EAAE,YAAY,CAAC;CAAG;AACtF,QAAA,MAAM,mBAAmB,oGAMxB,CAAC;
|
|
1
|
+
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAQ,MAAM,UAAU,CAAC;AAGvE,OAAO,EACL,2BAA2B,EAE3B,wBAAwB,EACxB,gCAAgC,EAChC,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAWlC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAI/E,OAAO,KAAK,EAAE,SAA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 -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var Q=Object.create;var v=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var ee=(o,n)=>{for(var r in n)v(o,r,{get:n[r],enumerable:!0})},K=(o,n,r,p)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of Y(n))!$.call(o,t)&&t!==r&&v(o,t,{get:()=>n[t],enumerable:!(p=X(n,t))||p.enumerable});return o};var j=(o,n,r)=>(r=o!=null?Q(Z(o)):{},K(n||!o||!o.__esModule?v(r,"default",{value:o,enumerable:!0}):r,o)),oe=o=>K(v({},"__esModule",{value:!0}),o);var pe={};ee(pe,{CheckboxItem:()=>L,Content:()=>x,Group:()=>k,Item:()=>B,Label:()=>N,RadioGroup:()=>E,RadioItem:()=>G,Root:()=>R,Separator:()=>b,Sub:()=>W,SubContent:()=>V,SubTrigger:()=>O,Trigger:()=>T,TriggerIcon:()=>_});module.exports=oe(pe);var e=j(require("react")),a=j(require("classnames")),i=require("radix-ui"),h=require("./scroll-area.js"),m=require("./dropdown-menu.props.js"),M=require("./theme.js"),
|
|
1
|
+
"use strict";"use client";var Q=Object.create;var v=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var ee=(o,n)=>{for(var r in n)v(o,r,{get:n[r],enumerable:!0})},K=(o,n,r,p)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of Y(n))!$.call(o,t)&&t!==r&&v(o,t,{get:()=>n[t],enumerable:!(p=X(n,t))||p.enumerable});return o};var j=(o,n,r)=>(r=o!=null?Q(Z(o)):{},K(n||!o||!o.__esModule?v(r,"default",{value:o,enumerable:!0}):r,o)),oe=o=>K(v({},"__esModule",{value:!0}),o);var pe={};ee(pe,{CheckboxItem:()=>L,Content:()=>x,Group:()=>k,Item:()=>B,Label:()=>N,RadioGroup:()=>E,RadioItem:()=>G,Root:()=>R,Separator:()=>b,Sub:()=>W,SubContent:()=>V,SubTrigger:()=>O,Trigger:()=>T,TriggerIcon:()=>_});module.exports=oe(pe);var e=j(require("react")),a=j(require("classnames")),i=require("radix-ui"),h=require("./scroll-area.js"),m=require("./dropdown-menu.props.js"),M=require("./theme.js"),c=require("./icons.js"),S=require("../helpers/extract-props.js"),u=require("./_internal/dropdown-menu-drill-down.js"),q=require("../helpers/require-react-element.js"),y=require("./kbd.js");const R=o=>e.createElement(i.DropdownMenu.Root,{...o});R.displayName="DropdownMenu.Root";const T=e.forwardRef(({children:o,...n},r)=>e.createElement(i.DropdownMenu.Trigger,{...n,ref:r,asChild:!0},(0,q.requireReactElement)(o)));T.displayName="DropdownMenu.Trigger";function ne({children:o}){const n=(0,u.useDrillDownOptional)();return!n||n.behavior==="cascade"?e.createElement(e.Fragment,null,o):e.createElement("div",{className:"rt-DropdownMenuDrillDownRoot","data-drill-down-active":n.isRoot?void 0:!0,"data-animation-direction":n.animationDirection??void 0},o)}const F=e.createContext({}),x=e.forwardRef((o,n)=>{const r=(0,M.useThemeContext)();e.useEffect(()=>{o.panelBackground!==void 0&&console.warn("Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.")},[o.panelBackground]);const p=o.material??o.panelBackground??r.panelBackground,t=e.useMemo(()=>({material:p,accentColor:r.accentColor}),[p,r.accentColor]),{size:d=m.dropdownMenuContentPropDefs.size.default,variant:l=m.dropdownMenuContentPropDefs.variant.default,highContrast:w=m.dropdownMenuContentPropDefs.highContrast.default,material:D=t.material,submenuBehavior:s}=o,{className:f,children:P,color:C,container:I,forceMount:H,material:U,panelBackground:z,submenuBehavior:A,...J}=(0,S.extractProps)(o,m.dropdownMenuContentPropDefs),g=e.useMemo(()=>C||t.accentColor,[C,t.accentColor]);return e.createElement(i.DropdownMenu.Portal,{container:I,forceMount:H},e.createElement(M.Theme,{asChild:!0},e.createElement(i.DropdownMenu.Content,{"data-accent-color":g,"data-material":D,"data-panel-background":D,align:"start",sideOffset:4,collisionPadding:10,...J,asChild:!1,ref:n,className:(0,a.default)("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",f)},e.createElement(h.ScrollArea,{type:"auto"},e.createElement("div",{className:(0,a.default)("rt-BaseMenuViewport","rt-DropdownMenuViewport")},e.createElement(F.Provider,{value:e.useMemo(()=>({size:d,variant:l,color:g,highContrast:w,material:D}),[d,l,g,w,D])},e.createElement(u.DrillDownProvider,{submenuBehavior:s},e.createElement(ne,null,P))))))))});x.displayName="DropdownMenu.Content";const N=e.forwardRef(({className:o,...n},r)=>e.createElement(i.DropdownMenu.Label,{...n,asChild:!1,ref:r,className:(0,a.default)("rt-BaseMenuLabel","rt-DropdownMenuLabel",o)}));N.displayName="DropdownMenu.Label";const B=e.forwardRef((o,n)=>{const{className:r,children:p,color:t=m.dropdownMenuItemPropDefs.color.default,shortcut:d,...l}=o;return e.createElement(i.DropdownMenu.Item,{"data-accent-color":t,...l,ref:n,className:(0,a.default)("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},e.createElement(i.Slot.Slottable,null,p),d&&e.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},e.createElement(y.Kbd,{size:"1"},d)))});B.displayName="DropdownMenu.Item";const k=e.forwardRef(({className:o,...n},r)=>e.createElement(i.DropdownMenu.Group,{...n,asChild:!1,ref:r,className:(0,a.default)("rt-BaseMenuGroup","rt-DropdownMenuGroup",o)}));k.displayName="DropdownMenu.Group";const E=e.forwardRef(({className:o,...n},r)=>e.createElement(i.DropdownMenu.RadioGroup,{...n,asChild:!1,ref:r,className:(0,a.default)("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",o)}));E.displayName="DropdownMenu.RadioGroup";const G=e.forwardRef((o,n)=>{const{children:r,className:p,color:t=m.dropdownMenuRadioItemPropDefs.color.default,...d}=o;return e.createElement(i.DropdownMenu.RadioItem,{...d,asChild:!1,ref:n,"data-accent-color":t,className:(0,a.default)("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",p)},r,e.createElement(i.DropdownMenu.ItemIndicator,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},e.createElement(c.ThickDotIcon,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});G.displayName="DropdownMenu.RadioItem";const L=e.forwardRef((o,n)=>{const{children:r,className:p,shortcut:t,color:d=m.dropdownMenuCheckboxItemPropDefs.color.default,...l}=o;return e.createElement(i.DropdownMenu.CheckboxItem,{...l,asChild:!1,ref:n,"data-accent-color":d,className:(0,a.default)("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",p)},r,e.createElement(i.DropdownMenu.ItemIndicator,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},e.createElement(c.ThickCheckIcon,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),t&&e.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},e.createElement(y.Kbd,{size:"1"},t)))});L.displayName="DropdownMenu.CheckboxItem";function re(){return e.useId()}const W=({label:o="Back",...n})=>{const r=(0,u.useDrillDownOptional)(),p=re(),t=e.useMemo(()=>({id:p,label:o}),[p,o]);return r?.behavior==="drill-down"?e.createElement(u.SubContext.Provider,{value:t},n.children):e.createElement(u.SubContext.Provider,{value:t},e.createElement(i.DropdownMenu.Sub,{...n}))};W.displayName="DropdownMenu.Sub";const O=e.forwardRef((o,n)=>{const{className:r,children:p,onClick:t,...d}=o,l=(0,u.useDrillDownOptional)(),w=(0,u.useSubContext)();return l?.behavior==="drill-down"&&w?e.createElement("div",{role:"menuitem",tabIndex:0,ref:n,onClick:s=>{s.preventDefault(),l.push(w.id),t?.(s)},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),l.push(w.id))},className:(0,a.default)("rt-reset","rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger","rt-DropdownMenuDrillDownSubTrigger",r)},p,e.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},e.createElement(c.ThickChevronRightIcon,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"}))):e.createElement(i.DropdownMenu.SubTrigger,{...d,onClick:t,asChild:!1,ref:n,className:(0,a.default)("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},p,e.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},e.createElement(c.ThickChevronRightIcon,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});O.displayName="DropdownMenu.SubTrigger";const b=e.forwardRef(({className:o,...n},r)=>e.createElement(i.DropdownMenu.Separator,{...n,asChild:!1,ref:r,className:(0,a.default)("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",o)}));b.displayName="DropdownMenu.Separator";function te({label:o}){const n=(0,u.useDrillDown)();return e.createElement("div",{role:"menuitem",tabIndex:0,onClick:r=>{r.preventDefault(),n.pop()},onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),n.pop())},className:(0,a.default)("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem","rt-DropdownMenuDrillDownBackItem")},e.createElement(c.ThickChevronLeftIcon,{className:"rt-DropdownMenuDrillDownBackIcon"}),e.createElement("span",{className:"rt-DropdownMenuDrillDownBackLabel"},o))}const V=e.forwardRef((o,n)=>{const r=e.useContext(F),{size:p,variant:t,color:d,highContrast:l,material:w}=e.useMemo(()=>r,[r]),D=(0,u.useDrillDownOptional)(),s=(0,u.useSubContext)(),{className:f,children:P,container:C,forceMount:I,material:H,panelBackground:U,...z}=(0,S.extractProps)({size:p,variant:t,color:d,highContrast:l,material:w,...o},m.dropdownMenuSubContentPropDefs);if(D?.behavior==="drill-down"&&s){const A=D.isActive(s.id);return e.createElement("div",{ref:n,role:"menu","aria-label":typeof s.label=="string"?s.label:void 0,"data-drill-down-active":A?!0:void 0,"data-animation-direction":D.animationDirection??void 0,className:(0,a.default)("rt-DropdownMenuDrillDownPanel",f)},e.createElement(te,{label:s.label}),e.createElement(b,null),P)}return e.createElement(i.DropdownMenu.Portal,{container:C,forceMount:I},e.createElement(M.Theme,{asChild:!0},e.createElement(i.DropdownMenu.SubContent,{"data-accent-color":d,"data-material":w,"data-panel-background":w,alignOffset:-Number(p)*4,sideOffset:1,collisionPadding:10,...z,asChild:!1,ref:n,className:(0,a.default)("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",f)},e.createElement(h.ScrollArea,{type:"auto"},e.createElement("div",{className:(0,a.default)("rt-BaseMenuViewport","rt-DropdownMenuViewport")},P)))))});V.displayName="DropdownMenu.SubContent";const _=e.forwardRef((o,n)=>e.createElement(c.ChevronDownIcon,{...o,ref:n,className:"rt-DropdownMenuTriggerIcon"}));_.displayName="DropdownMenu.TriggerIcon";
|
|
2
2
|
//# sourceMappingURL=dropdown-menu.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dropdown-menu.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { DropdownMenu as DropdownMenuPrimitive, Slot } from 'radix-ui';\n\nimport { ScrollArea } from './scroll-area.js';\nimport {\n dropdownMenuContentPropDefs,\n dropdownMenuSubContentPropDefs,\n dropdownMenuItemPropDefs,\n dropdownMenuCheckboxItemPropDefs,\n dropdownMenuRadioItemPropDefs,\n} from './dropdown-menu.props.js';\nimport { Theme, useThemeContext } from './theme.js';\nimport { ChevronDownIcon, ThickCheckIcon, ThickChevronLeftIcon, ThickChevronRightIcon, ThickDotIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport {\n DrillDownProvider,\n SubContext,\n useDrillDown,\n useDrillDownOptional,\n useSubContext,\n} from './_internal/dropdown-menu-drill-down.js';\nimport type { SubmenuBehavior } from './_internal/dropdown-menu-drill-down.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { Kbd } from './kbd.js';\n\nimport type { IconProps } from './icons.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes, Responsive } from '../props/prop-def.js';\n\ninterface DropdownMenuRootProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root> {}\nconst DropdownMenuRoot: React.FC<DropdownMenuRootProps> = (props) => (\n <DropdownMenuPrimitive.Root {...props} />\n);\nDropdownMenuRoot.displayName = 'DropdownMenu.Root';\n\ntype DropdownMenuTriggerElement = React.ElementRef<typeof DropdownMenuPrimitive.Trigger>;\ninterface DropdownMenuTriggerProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Trigger, RemovedProps> {}\nconst DropdownMenuTrigger = React.forwardRef<DropdownMenuTriggerElement, DropdownMenuTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DropdownMenuPrimitive.Trigger>\n ),\n);\nDropdownMenuTrigger.displayName = 'DropdownMenu.Trigger';\n\n/**\n * Internal component that wraps root menu items and handles visibility in drill-down mode.\n * In drill-down mode, this hides when a submenu is active.\n */\nfunction DrillDownRoot({ children }: { children: React.ReactNode }) {\n const drillDown = useDrillDownOptional();\n\n // In cascade mode or when no drill-down context, always show\n if (!drillDown || drillDown.behavior === 'cascade') {\n return <>{children}</>;\n }\n\n // In drill-down mode, hide root when a submenu is active\n return (\n <div\n className=\"rt-DropdownMenuDrillDownRoot\"\n data-drill-down-active={drillDown.isRoot ? undefined : true}\n >\n {children}\n </div>\n );\n}\n\ntype DropdownMenuContentOwnProps = GetPropDefTypes<typeof dropdownMenuContentPropDefs> & {\n /**\n * Controls how submenus behave.\n * - `cascade`: Default cascading behavior where submenus open to the side (portal-based)\n * - `drill-down`: Mobile-friendly behavior where submenus replace the content inline\n * Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`\n */\n submenuBehavior?: Responsive<SubmenuBehavior>;\n};\ntype DropdownMenuContentContextValue = Omit<DropdownMenuContentOwnProps, 'submenuBehavior'>;\nconst DropdownMenuContentContext = React.createContext<DropdownMenuContentContextValue>({});\ntype DropdownMenuContentElement = React.ElementRef<typeof DropdownMenuPrimitive.Content>;\ninterface DropdownMenuContentProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Content, RemovedProps>,\n DropdownMenuContentContextValue {\n container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];\n /**\n * Controls how submenus behave.\n * - `cascade`: Default cascading behavior where submenus open to the side (portal-based)\n * - `drill-down`: Mobile-friendly behavior where submenus replace the content inline\n * Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`\n */\n submenuBehavior?: Responsive<SubmenuBehavior>;\n}\nconst DropdownMenuContent = React.forwardRef<DropdownMenuContentElement, DropdownMenuContentProps>(\n (props, forwardedRef) => {\n const themeContext = useThemeContext();\n\n // Show deprecation warning for panelBackground when used\n React.useEffect(() => {\n if (props.panelBackground !== undefined) {\n console.warn(\n 'Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.',\n );\n }\n }, [props.panelBackground]);\n\n // Material takes precedence over panelBackground\n const effectiveMaterial =\n props.material ?? props.panelBackground ?? themeContext.panelBackground;\n\n // Memoize theme context values to prevent unnecessary re-renders\n const memoizedThemeContext = React.useMemo(\n () => ({\n material: effectiveMaterial,\n accentColor: themeContext.accentColor,\n }),\n [effectiveMaterial, themeContext.accentColor],\n );\n\n const {\n size = dropdownMenuContentPropDefs.size.default,\n variant = dropdownMenuContentPropDefs.variant.default,\n highContrast = dropdownMenuContentPropDefs.highContrast.default,\n material = memoizedThemeContext.material,\n submenuBehavior,\n } = props;\n const {\n className,\n children,\n color,\n container,\n forceMount,\n material: _,\n panelBackground: __,\n submenuBehavior: ___,\n ...contentProps\n } = extractProps(props, dropdownMenuContentPropDefs);\n\n // Memoize color resolution to prevent unnecessary re-renders\n const resolvedColor = React.useMemo(\n () => color || memoizedThemeContext.accentColor,\n [color, memoizedThemeContext.accentColor],\n );\n return (\n <DropdownMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DropdownMenuPrimitive.Content\n data-accent-color={resolvedColor}\n data-material={material}\n data-panel-background={material}\n align=\"start\"\n sideOffset={4}\n collisionPadding={10}\n {...contentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'rt-PopperContent',\n 'rt-BaseMenuContent',\n 'rt-DropdownMenuContent',\n className,\n )}\n >\n <ScrollArea type=\"auto\">\n <div className={classNames('rt-BaseMenuViewport', 'rt-DropdownMenuViewport')}>\n <DropdownMenuContentContext.Provider\n value={React.useMemo(\n () => ({ size, variant, color: resolvedColor, highContrast, material }),\n [size, variant, resolvedColor, highContrast, material],\n )}\n >\n <DrillDownProvider submenuBehavior={submenuBehavior}>\n <DrillDownRoot>{children}</DrillDownRoot>\n </DrillDownProvider>\n </DropdownMenuContentContext.Provider>\n </div>\n </ScrollArea>\n </DropdownMenuPrimitive.Content>\n </Theme>\n </DropdownMenuPrimitive.Portal>\n );\n },\n);\nDropdownMenuContent.displayName = 'DropdownMenu.Content';\n\ntype DropdownMenuLabelElement = React.ElementRef<typeof DropdownMenuPrimitive.Label>;\ninterface DropdownMenuLabelProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Label, RemovedProps> {}\nconst DropdownMenuLabel = React.forwardRef<DropdownMenuLabelElement, DropdownMenuLabelProps>(\n ({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Label\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuLabel', 'rt-DropdownMenuLabel', className)}\n />\n ),\n);\nDropdownMenuLabel.displayName = 'DropdownMenu.Label';\n\ntype DropdownMenuItemElement = React.ElementRef<typeof DropdownMenuPrimitive.Item>;\ntype DropdownMenuItemOwnProps = GetPropDefTypes<typeof dropdownMenuItemPropDefs>;\ninterface DropdownMenuItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Item, RemovedProps>,\n DropdownMenuItemOwnProps {}\nconst DropdownMenuItem = React.forwardRef<DropdownMenuItemElement, DropdownMenuItemProps>(\n (props, forwardedRef) => {\n const {\n className,\n children,\n color = dropdownMenuItemPropDefs.color.default,\n shortcut,\n ...itemProps\n } = props;\n return (\n <DropdownMenuPrimitive.Item\n data-accent-color={color}\n {...itemProps}\n ref={forwardedRef}\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-DropdownMenuItem', className)}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n {shortcut && (\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <Kbd size=\"1\">{shortcut}</Kbd>\n </div>\n )}\n </DropdownMenuPrimitive.Item>\n );\n },\n);\nDropdownMenuItem.displayName = 'DropdownMenu.Item';\n\ntype DropdownMenuGroupElement = React.ElementRef<typeof DropdownMenuPrimitive.Group>;\ninterface DropdownMenuGroupProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Group, RemovedProps> {}\nconst DropdownMenuGroup = React.forwardRef<DropdownMenuGroupElement, DropdownMenuGroupProps>(\n ({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Group\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuGroup', 'rt-DropdownMenuGroup', className)}\n />\n ),\n);\nDropdownMenuGroup.displayName = 'DropdownMenu.Group';\n\ntype DropdownMenuRadioGroupElement = React.ElementRef<typeof DropdownMenuPrimitive.RadioGroup>;\ninterface DropdownMenuRadioGroupProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.RadioGroup, RemovedProps> {}\nconst DropdownMenuRadioGroup = React.forwardRef<\n DropdownMenuRadioGroupElement,\n DropdownMenuRadioGroupProps\n>(({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.RadioGroup\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuRadioGroup', 'rt-DropdownMenuRadioGroup', className)}\n />\n));\nDropdownMenuRadioGroup.displayName = 'DropdownMenu.RadioGroup';\n\ntype DropdownMenuRadioItemElement = React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>;\ntype DropdownMenuRadioItemOwnProps = GetPropDefTypes<typeof dropdownMenuRadioItemPropDefs>;\ninterface DropdownMenuRadioItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.RadioItem, RemovedProps>,\n DropdownMenuRadioItemOwnProps {}\nconst DropdownMenuRadioItem = React.forwardRef<\n DropdownMenuRadioItemElement,\n DropdownMenuRadioItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n color = dropdownMenuRadioItemPropDefs.color.default,\n ...itemProps\n } = props;\n return (\n <DropdownMenuPrimitive.RadioItem\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'rt-BaseMenuItem',\n 'rt-BaseMenuRadioItem',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuRadioItem',\n className,\n )}\n >\n {children}\n <DropdownMenuPrimitive.ItemIndicator className=\"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator\">\n <ThickDotIcon className=\"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </DropdownMenuPrimitive.RadioItem>\n );\n});\nDropdownMenuRadioItem.displayName = 'DropdownMenu.RadioItem';\n\ntype DropdownMenuCheckboxItemElement = React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>;\ntype DropdownMenuCheckboxItemOwnProps = GetPropDefTypes<typeof dropdownMenuCheckboxItemPropDefs>;\ninterface DropdownMenuCheckboxItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.CheckboxItem, RemovedProps>,\n DropdownMenuCheckboxItemOwnProps {}\nconst DropdownMenuCheckboxItem = React.forwardRef<\n DropdownMenuCheckboxItemElement,\n DropdownMenuCheckboxItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n shortcut,\n color = dropdownMenuCheckboxItemPropDefs.color.default,\n ...itemProps\n } = props;\n return (\n <DropdownMenuPrimitive.CheckboxItem\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'rt-BaseMenuItem',\n 'rt-BaseMenuCheckboxItem',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuCheckboxItem',\n className,\n )}\n >\n {children}\n <DropdownMenuPrimitive.ItemIndicator className=\"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator\">\n <ThickCheckIcon className=\"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon\" />\n </DropdownMenuPrimitive.ItemIndicator>\n {shortcut && (\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <Kbd size=\"1\">{shortcut}</Kbd>\n </div>\n )}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\nDropdownMenuCheckboxItem.displayName = 'DropdownMenu.CheckboxItem';\n\n// Generate unique submenu IDs using React 18's useId for SSR safety\nfunction useSubId() {\n return React.useId();\n}\n\ninterface DropdownMenuSubProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Sub> {\n /**\n * Label displayed in the back button when using drill-down mode.\n * If not provided, defaults to \"Back\".\n */\n label?: React.ReactNode;\n}\nconst DropdownMenuSub: React.FC<DropdownMenuSubProps> = ({ label = 'Back', ...props }) => {\n const drillDown = useDrillDownOptional();\n const subId = useSubId();\n\n // Create context value for SubContent and SubTrigger\n const subContextValue = React.useMemo(\n () => ({ id: subId, label }),\n [subId, label]\n );\n\n // In drill-down mode, we don't use Radix's Sub component\n // We just provide the SubContext and render children\n if (drillDown?.behavior === 'drill-down') {\n return (\n <SubContext.Provider value={subContextValue}>\n {props.children}\n </SubContext.Provider>\n );\n }\n\n // In cascade mode, use Radix's Sub component normally\n return (\n <SubContext.Provider value={subContextValue}>\n <DropdownMenuPrimitive.Sub {...props} />\n </SubContext.Provider>\n );\n};\nDropdownMenuSub.displayName = 'DropdownMenu.Sub';\n\ntype DropdownMenuSubTriggerElement = React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>;\ninterface DropdownMenuSubTriggerProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubTrigger, RemovedProps> {}\nconst DropdownMenuSubTrigger = React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>((props, forwardedRef) => {\n const { className, children, onClick, ...subTriggerProps } = props;\n const drillDown = useDrillDownOptional();\n const subContext = useSubContext();\n\n // In drill-down mode, render a button that navigates to the submenu\n if (drillDown?.behavior === 'drill-down' && subContext) {\n const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {\n e.preventDefault();\n drillDown.push(subContext.id);\n (onClick as React.MouseEventHandler<HTMLDivElement> | undefined)?.(e);\n };\n\n return (\n <div\n role=\"menuitem\"\n tabIndex={0}\n ref={forwardedRef as React.Ref<HTMLDivElement>}\n onClick={handleClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n drillDown.push(subContext.id);\n }\n }}\n className={classNames(\n 'rt-reset',\n 'rt-BaseMenuItem',\n 'rt-BaseMenuSubTrigger',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuSubTrigger',\n 'rt-DropdownMenuDrillDownSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <ThickChevronRightIcon className=\"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon\" />\n </div>\n </div>\n );\n }\n\n // In cascade mode, use Radix's SubTrigger\n return (\n <DropdownMenuPrimitive.SubTrigger\n {...subTriggerProps}\n onClick={onClick as React.MouseEventHandler<HTMLDivElement> | undefined}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'rt-BaseMenuItem',\n 'rt-BaseMenuSubTrigger',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <ThickChevronRightIcon className=\"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon\" />\n </div>\n </DropdownMenuPrimitive.SubTrigger>\n );\n});\nDropdownMenuSubTrigger.displayName = 'DropdownMenu.SubTrigger';\n\n// Separator is defined here (before SubContent) because it's used in drill-down mode\ntype DropdownMenuSeparatorElement = React.ElementRef<typeof DropdownMenuPrimitive.Separator>;\ninterface DropdownMenuSeparatorProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Separator, RemovedProps> {}\nconst DropdownMenuSeparator = React.forwardRef<\n DropdownMenuSeparatorElement,\n DropdownMenuSeparatorProps\n>(({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Separator\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuSeparator', 'rt-DropdownMenuSeparator', className)}\n />\n));\nDropdownMenuSeparator.displayName = 'DropdownMenu.Separator';\n\n/**\n * Internal component for the drill-down back button.\n */\nfunction DrillDownBackItem({ label }: { label: React.ReactNode }) {\n const drillDown = useDrillDown();\n\n return (\n <div\n role=\"menuitem\"\n tabIndex={0}\n onClick={(e) => {\n e.preventDefault();\n drillDown.pop();\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n drillDown.pop();\n }\n }}\n className={classNames(\n 'rt-reset',\n 'rt-BaseMenuItem',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuDrillDownBackItem',\n )}\n >\n <ThickChevronLeftIcon className=\"rt-DropdownMenuDrillDownBackIcon\" />\n <span className=\"rt-DropdownMenuDrillDownBackLabel\">{label}</span>\n </div>\n );\n}\n\ntype DropdownMenuSubContentElement = React.ElementRef<typeof DropdownMenuPrimitive.SubContent>;\ninterface DropdownMenuSubContentProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubContent, RemovedProps>,\n DropdownMenuContentContextValue {\n container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];\n}\nconst DropdownMenuSubContent = React.forwardRef<\n DropdownMenuSubContentElement,\n DropdownMenuSubContentProps\n>((props, forwardedRef) => {\n // Memoize context consumption to prevent unnecessary re-renders\n const contextValue = React.useContext(DropdownMenuContentContext);\n const { size, variant, color, highContrast, material } = React.useMemo(\n () => contextValue,\n [contextValue],\n );\n const drillDown = useDrillDownOptional();\n const subContext = useSubContext();\n\n const {\n className,\n children,\n container,\n forceMount,\n material: _,\n panelBackground: __,\n ...subContentProps\n } = extractProps(\n { size, variant, color, highContrast, material, ...props },\n dropdownMenuSubContentPropDefs,\n );\n\n // In drill-down mode, render inline instead of in a portal\n if (drillDown?.behavior === 'drill-down' && subContext) {\n const isActive = drillDown.isActive(subContext.id);\n\n return (\n <div\n ref={forwardedRef as React.Ref<HTMLDivElement>}\n role=\"menu\"\n aria-label={typeof subContext.label === 'string' ? subContext.label : undefined}\n data-drill-down-active={isActive ? true : undefined}\n className={classNames(\n 'rt-DropdownMenuDrillDownPanel',\n className,\n )}\n >\n <DrillDownBackItem label={subContext.label} />\n <DropdownMenuSeparator />\n {children}\n </div>\n );\n }\n\n // In cascade mode, use Portal and Radix's SubContent\n return (\n <DropdownMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DropdownMenuPrimitive.SubContent\n data-accent-color={color}\n data-material={material}\n data-panel-background={material}\n alignOffset={-Number(size) * 4}\n // Side offset accounts for the outer solid box-shadow\n sideOffset={1}\n collisionPadding={10}\n {...subContentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'rt-PopperContent',\n 'rt-BaseMenuContent',\n 'rt-BaseMenuSubContent',\n 'rt-DropdownMenuContent',\n 'rt-DropdownMenuSubContent',\n className,\n )}\n >\n <ScrollArea type=\"auto\">\n <div className={classNames('rt-BaseMenuViewport', 'rt-DropdownMenuViewport')}>\n {children}\n </div>\n </ScrollArea>\n </DropdownMenuPrimitive.SubContent>\n </Theme>\n </DropdownMenuPrimitive.Portal>\n );\n});\nDropdownMenuSubContent.displayName = 'DropdownMenu.SubContent';\n\ntype DropdownMenuTriggerIconElement = React.ElementRef<'svg'>;\ninterface DropdownMenuTriggerIconProps extends IconProps {}\nconst DropdownMenuTriggerIcon = React.forwardRef<\n DropdownMenuTriggerIconElement,\n DropdownMenuTriggerIconProps\n>((props, forwardedRef) => (\n <ChevronDownIcon {...props} ref={forwardedRef} className=\"rt-DropdownMenuTriggerIcon\" />\n));\nDropdownMenuTriggerIcon.displayName = 'DropdownMenu.TriggerIcon';\n\nexport {\n DropdownMenuRoot as Root,\n DropdownMenuTrigger as Trigger,\n DropdownMenuTriggerIcon as TriggerIcon,\n DropdownMenuContent as Content,\n DropdownMenuLabel as Label,\n DropdownMenuItem as Item,\n DropdownMenuGroup as Group,\n DropdownMenuRadioGroup as RadioGroup,\n DropdownMenuRadioItem as RadioItem,\n DropdownMenuCheckboxItem as CheckboxItem,\n DropdownMenuSub as Sub,\n DropdownMenuSubTrigger as SubTrigger,\n DropdownMenuSubContent as SubContent,\n DropdownMenuSeparator as Separator,\n};\n\nexport type {\n DropdownMenuRootProps as RootProps,\n DropdownMenuTriggerProps as TriggerProps,\n DropdownMenuTriggerIconProps as TriggerIconProps,\n DropdownMenuContentProps as ContentProps,\n DropdownMenuLabelProps as LabelProps,\n DropdownMenuItemProps as ItemProps,\n DropdownMenuGroupProps as GroupProps,\n DropdownMenuRadioGroupProps as RadioGroupProps,\n DropdownMenuRadioItemProps as RadioItemProps,\n DropdownMenuCheckboxItemProps as CheckboxItemProps,\n DropdownMenuSubProps as SubProps,\n DropdownMenuSubTriggerProps as SubTriggerProps,\n DropdownMenuSubContentProps as SubContentProps,\n DropdownMenuSeparatorProps as SeparatorProps,\n SubmenuBehavior,\n};\n"],
|
|
5
|
-
"mappings": "ykBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,kBAAAE,EAAA,YAAAC,EAAA,UAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,eAAAC,EAAA,cAAAC,EAAA,SAAAC,EAAA,cAAAC,EAAA,QAAAC,EAAA,eAAAC,EAAA,eAAAC,EAAA,YAAAC,EAAA,gBAAAC,IAAA,eAAAC,GAAAhB,IAEA,IAAAiB,EAAuB,oBACvBC,EAAuB,yBACvBC,EAA4D,oBAE5DC,EAA2B,4BAC3BC,EAMO,oCACPC,EAAuC,sBACvCC,EAA2G,sBAC3GC,EAA6B,uCAC7BC,EAMO,mDAEPC,EAAoC,+CACpCC,EAAoB,oBAQpB,MAAMlB,EAAqDmB,GACzDX,EAAA,cAAC,EAAAY,aAAsB,KAAtB,CAA4B,GAAGD,EAAO,EAEzCnB,EAAiB,YAAc,oBAK/B,MAAMK,EAAsBG,EAAM,WAChC,CAAC,CAAE,SAAAa,EAAU,GAAGF,CAAM,EAAGG,IACvBd,EAAA,cAAC,EAAAY,aAAsB,QAAtB,CAA+B,GAAGD,EAAO,IAAKG,EAAc,QAAO,OACjE,uBAAoBD,CAAQ,CAC/B,CAEJ,EACAhB,EAAoB,YAAc,uBAMlC,SAASkB,GAAc,CAAE,SAAAF,CAAS,EAAkC,CAClE,MAAMG,KAAY,wBAAqB,EAGvC,MAAI,CAACA,GAAaA,EAAU,WAAa,UAChChB,EAAA,cAAAA,EAAA,cAAGa,CAAS,EAKnBb,EAAA,cAAC,OACC,UAAU,+BACV,yBAAwBgB,EAAU,OAAS,OAAY,
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { DropdownMenu as DropdownMenuPrimitive, Slot } from 'radix-ui';\n\nimport { ScrollArea } from './scroll-area.js';\nimport {\n dropdownMenuContentPropDefs,\n dropdownMenuSubContentPropDefs,\n dropdownMenuItemPropDefs,\n dropdownMenuCheckboxItemPropDefs,\n dropdownMenuRadioItemPropDefs,\n} from './dropdown-menu.props.js';\nimport { Theme, useThemeContext } from './theme.js';\nimport { ChevronDownIcon, ThickCheckIcon, ThickChevronLeftIcon, ThickChevronRightIcon, ThickDotIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport {\n DrillDownProvider,\n SubContext,\n useDrillDown,\n useDrillDownOptional,\n useSubContext,\n} from './_internal/dropdown-menu-drill-down.js';\nimport type { SubmenuBehavior } from './_internal/dropdown-menu-drill-down.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { Kbd } from './kbd.js';\n\nimport type { IconProps } from './icons.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes, Responsive } from '../props/prop-def.js';\n\ninterface DropdownMenuRootProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root> {}\nconst DropdownMenuRoot: React.FC<DropdownMenuRootProps> = (props) => (\n <DropdownMenuPrimitive.Root {...props} />\n);\nDropdownMenuRoot.displayName = 'DropdownMenu.Root';\n\ntype DropdownMenuTriggerElement = React.ElementRef<typeof DropdownMenuPrimitive.Trigger>;\ninterface DropdownMenuTriggerProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Trigger, RemovedProps> {}\nconst DropdownMenuTrigger = React.forwardRef<DropdownMenuTriggerElement, DropdownMenuTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DropdownMenuPrimitive.Trigger>\n ),\n);\nDropdownMenuTrigger.displayName = 'DropdownMenu.Trigger';\n\n/**\n * Internal component that wraps root menu items and handles visibility in drill-down mode.\n * In drill-down mode, this hides when a submenu is active.\n */\nfunction DrillDownRoot({ children }: { children: React.ReactNode }) {\n const drillDown = useDrillDownOptional();\n\n // In cascade mode or when no drill-down context, always show\n if (!drillDown || drillDown.behavior === 'cascade') {\n return <>{children}</>;\n }\n\n // In drill-down mode, hide root when a submenu is active\n return (\n <div\n className=\"rt-DropdownMenuDrillDownRoot\"\n data-drill-down-active={drillDown.isRoot ? undefined : true}\n data-animation-direction={drillDown.animationDirection ?? undefined}\n >\n {children}\n </div>\n );\n}\n\ntype DropdownMenuContentOwnProps = GetPropDefTypes<typeof dropdownMenuContentPropDefs> & {\n /**\n * Controls how submenus behave.\n * - `cascade`: Default cascading behavior where submenus open to the side (portal-based)\n * - `drill-down`: Mobile-friendly behavior where submenus replace the content inline\n * Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`\n */\n submenuBehavior?: Responsive<SubmenuBehavior>;\n};\ntype DropdownMenuContentContextValue = Omit<DropdownMenuContentOwnProps, 'submenuBehavior'>;\nconst DropdownMenuContentContext = React.createContext<DropdownMenuContentContextValue>({});\ntype DropdownMenuContentElement = React.ElementRef<typeof DropdownMenuPrimitive.Content>;\ninterface DropdownMenuContentProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Content, RemovedProps>,\n DropdownMenuContentContextValue {\n container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];\n /**\n * Controls how submenus behave.\n * - `cascade`: Default cascading behavior where submenus open to the side (portal-based)\n * - `drill-down`: Mobile-friendly behavior where submenus replace the content inline\n * Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`\n */\n submenuBehavior?: Responsive<SubmenuBehavior>;\n}\nconst DropdownMenuContent = React.forwardRef<DropdownMenuContentElement, DropdownMenuContentProps>(\n (props, forwardedRef) => {\n const themeContext = useThemeContext();\n\n // Show deprecation warning for panelBackground when used\n React.useEffect(() => {\n if (props.panelBackground !== undefined) {\n console.warn(\n 'Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.',\n );\n }\n }, [props.panelBackground]);\n\n // Material takes precedence over panelBackground\n const effectiveMaterial =\n props.material ?? props.panelBackground ?? themeContext.panelBackground;\n\n // Memoize theme context values to prevent unnecessary re-renders\n const memoizedThemeContext = React.useMemo(\n () => ({\n material: effectiveMaterial,\n accentColor: themeContext.accentColor,\n }),\n [effectiveMaterial, themeContext.accentColor],\n );\n\n const {\n size = dropdownMenuContentPropDefs.size.default,\n variant = dropdownMenuContentPropDefs.variant.default,\n highContrast = dropdownMenuContentPropDefs.highContrast.default,\n material = memoizedThemeContext.material,\n submenuBehavior,\n } = props;\n const {\n className,\n children,\n color,\n container,\n forceMount,\n material: _,\n panelBackground: __,\n submenuBehavior: ___,\n ...contentProps\n } = extractProps(props, dropdownMenuContentPropDefs);\n\n // Memoize color resolution to prevent unnecessary re-renders\n const resolvedColor = React.useMemo(\n () => color || memoizedThemeContext.accentColor,\n [color, memoizedThemeContext.accentColor],\n );\n return (\n <DropdownMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DropdownMenuPrimitive.Content\n data-accent-color={resolvedColor}\n data-material={material}\n data-panel-background={material}\n align=\"start\"\n sideOffset={4}\n collisionPadding={10}\n {...contentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'rt-PopperContent',\n 'rt-BaseMenuContent',\n 'rt-DropdownMenuContent',\n className,\n )}\n >\n <ScrollArea type=\"auto\">\n <div className={classNames('rt-BaseMenuViewport', 'rt-DropdownMenuViewport')}>\n <DropdownMenuContentContext.Provider\n value={React.useMemo(\n () => ({ size, variant, color: resolvedColor, highContrast, material }),\n [size, variant, resolvedColor, highContrast, material],\n )}\n >\n <DrillDownProvider submenuBehavior={submenuBehavior}>\n <DrillDownRoot>{children}</DrillDownRoot>\n </DrillDownProvider>\n </DropdownMenuContentContext.Provider>\n </div>\n </ScrollArea>\n </DropdownMenuPrimitive.Content>\n </Theme>\n </DropdownMenuPrimitive.Portal>\n );\n },\n);\nDropdownMenuContent.displayName = 'DropdownMenu.Content';\n\ntype DropdownMenuLabelElement = React.ElementRef<typeof DropdownMenuPrimitive.Label>;\ninterface DropdownMenuLabelProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Label, RemovedProps> {}\nconst DropdownMenuLabel = React.forwardRef<DropdownMenuLabelElement, DropdownMenuLabelProps>(\n ({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Label\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuLabel', 'rt-DropdownMenuLabel', className)}\n />\n ),\n);\nDropdownMenuLabel.displayName = 'DropdownMenu.Label';\n\ntype DropdownMenuItemElement = React.ElementRef<typeof DropdownMenuPrimitive.Item>;\ntype DropdownMenuItemOwnProps = GetPropDefTypes<typeof dropdownMenuItemPropDefs>;\ninterface DropdownMenuItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Item, RemovedProps>,\n DropdownMenuItemOwnProps {}\nconst DropdownMenuItem = React.forwardRef<DropdownMenuItemElement, DropdownMenuItemProps>(\n (props, forwardedRef) => {\n const {\n className,\n children,\n color = dropdownMenuItemPropDefs.color.default,\n shortcut,\n ...itemProps\n } = props;\n return (\n <DropdownMenuPrimitive.Item\n data-accent-color={color}\n {...itemProps}\n ref={forwardedRef}\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-DropdownMenuItem', className)}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n {shortcut && (\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <Kbd size=\"1\">{shortcut}</Kbd>\n </div>\n )}\n </DropdownMenuPrimitive.Item>\n );\n },\n);\nDropdownMenuItem.displayName = 'DropdownMenu.Item';\n\ntype DropdownMenuGroupElement = React.ElementRef<typeof DropdownMenuPrimitive.Group>;\ninterface DropdownMenuGroupProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Group, RemovedProps> {}\nconst DropdownMenuGroup = React.forwardRef<DropdownMenuGroupElement, DropdownMenuGroupProps>(\n ({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Group\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuGroup', 'rt-DropdownMenuGroup', className)}\n />\n ),\n);\nDropdownMenuGroup.displayName = 'DropdownMenu.Group';\n\ntype DropdownMenuRadioGroupElement = React.ElementRef<typeof DropdownMenuPrimitive.RadioGroup>;\ninterface DropdownMenuRadioGroupProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.RadioGroup, RemovedProps> {}\nconst DropdownMenuRadioGroup = React.forwardRef<\n DropdownMenuRadioGroupElement,\n DropdownMenuRadioGroupProps\n>(({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.RadioGroup\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuRadioGroup', 'rt-DropdownMenuRadioGroup', className)}\n />\n));\nDropdownMenuRadioGroup.displayName = 'DropdownMenu.RadioGroup';\n\ntype DropdownMenuRadioItemElement = React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>;\ntype DropdownMenuRadioItemOwnProps = GetPropDefTypes<typeof dropdownMenuRadioItemPropDefs>;\ninterface DropdownMenuRadioItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.RadioItem, RemovedProps>,\n DropdownMenuRadioItemOwnProps {}\nconst DropdownMenuRadioItem = React.forwardRef<\n DropdownMenuRadioItemElement,\n DropdownMenuRadioItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n color = dropdownMenuRadioItemPropDefs.color.default,\n ...itemProps\n } = props;\n return (\n <DropdownMenuPrimitive.RadioItem\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'rt-BaseMenuItem',\n 'rt-BaseMenuRadioItem',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuRadioItem',\n className,\n )}\n >\n {children}\n <DropdownMenuPrimitive.ItemIndicator className=\"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator\">\n <ThickDotIcon className=\"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </DropdownMenuPrimitive.RadioItem>\n );\n});\nDropdownMenuRadioItem.displayName = 'DropdownMenu.RadioItem';\n\ntype DropdownMenuCheckboxItemElement = React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>;\ntype DropdownMenuCheckboxItemOwnProps = GetPropDefTypes<typeof dropdownMenuCheckboxItemPropDefs>;\ninterface DropdownMenuCheckboxItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.CheckboxItem, RemovedProps>,\n DropdownMenuCheckboxItemOwnProps {}\nconst DropdownMenuCheckboxItem = React.forwardRef<\n DropdownMenuCheckboxItemElement,\n DropdownMenuCheckboxItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n shortcut,\n color = dropdownMenuCheckboxItemPropDefs.color.default,\n ...itemProps\n } = props;\n return (\n <DropdownMenuPrimitive.CheckboxItem\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'rt-BaseMenuItem',\n 'rt-BaseMenuCheckboxItem',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuCheckboxItem',\n className,\n )}\n >\n {children}\n <DropdownMenuPrimitive.ItemIndicator className=\"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator\">\n <ThickCheckIcon className=\"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon\" />\n </DropdownMenuPrimitive.ItemIndicator>\n {shortcut && (\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <Kbd size=\"1\">{shortcut}</Kbd>\n </div>\n )}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\nDropdownMenuCheckboxItem.displayName = 'DropdownMenu.CheckboxItem';\n\n// Generate unique submenu IDs using React 18's useId for SSR safety\nfunction useSubId() {\n return React.useId();\n}\n\ninterface DropdownMenuSubProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Sub> {\n /**\n * Label displayed in the back button when using drill-down mode.\n * If not provided, defaults to \"Back\".\n */\n label?: React.ReactNode;\n}\nconst DropdownMenuSub: React.FC<DropdownMenuSubProps> = ({ label = 'Back', ...props }) => {\n const drillDown = useDrillDownOptional();\n const subId = useSubId();\n\n // Create context value for SubContent and SubTrigger\n const subContextValue = React.useMemo(\n () => ({ id: subId, label }),\n [subId, label]\n );\n\n // In drill-down mode, we don't use Radix's Sub component\n // We just provide the SubContext and render children\n if (drillDown?.behavior === 'drill-down') {\n return (\n <SubContext.Provider value={subContextValue}>\n {props.children}\n </SubContext.Provider>\n );\n }\n\n // In cascade mode, use Radix's Sub component normally\n return (\n <SubContext.Provider value={subContextValue}>\n <DropdownMenuPrimitive.Sub {...props} />\n </SubContext.Provider>\n );\n};\nDropdownMenuSub.displayName = 'DropdownMenu.Sub';\n\ntype DropdownMenuSubTriggerElement = React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>;\ninterface DropdownMenuSubTriggerProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubTrigger, RemovedProps> {}\nconst DropdownMenuSubTrigger = React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>((props, forwardedRef) => {\n const { className, children, onClick, ...subTriggerProps } = props;\n const drillDown = useDrillDownOptional();\n const subContext = useSubContext();\n\n // In drill-down mode, render a button that navigates to the submenu\n if (drillDown?.behavior === 'drill-down' && subContext) {\n const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {\n e.preventDefault();\n drillDown.push(subContext.id);\n (onClick as React.MouseEventHandler<HTMLDivElement> | undefined)?.(e);\n };\n\n return (\n <div\n role=\"menuitem\"\n tabIndex={0}\n ref={forwardedRef as React.Ref<HTMLDivElement>}\n onClick={handleClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n drillDown.push(subContext.id);\n }\n }}\n className={classNames(\n 'rt-reset',\n 'rt-BaseMenuItem',\n 'rt-BaseMenuSubTrigger',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuSubTrigger',\n 'rt-DropdownMenuDrillDownSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <ThickChevronRightIcon className=\"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon\" />\n </div>\n </div>\n );\n }\n\n // In cascade mode, use Radix's SubTrigger\n return (\n <DropdownMenuPrimitive.SubTrigger\n {...subTriggerProps}\n onClick={onClick as React.MouseEventHandler<HTMLDivElement> | undefined}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'rt-BaseMenuItem',\n 'rt-BaseMenuSubTrigger',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <ThickChevronRightIcon className=\"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon\" />\n </div>\n </DropdownMenuPrimitive.SubTrigger>\n );\n});\nDropdownMenuSubTrigger.displayName = 'DropdownMenu.SubTrigger';\n\n// Separator is defined here (before SubContent) because it's used in drill-down mode\ntype DropdownMenuSeparatorElement = React.ElementRef<typeof DropdownMenuPrimitive.Separator>;\ninterface DropdownMenuSeparatorProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Separator, RemovedProps> {}\nconst DropdownMenuSeparator = React.forwardRef<\n DropdownMenuSeparatorElement,\n DropdownMenuSeparatorProps\n>(({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Separator\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuSeparator', 'rt-DropdownMenuSeparator', className)}\n />\n));\nDropdownMenuSeparator.displayName = 'DropdownMenu.Separator';\n\n/**\n * Internal component for the drill-down back button.\n */\nfunction DrillDownBackItem({ label }: { label: React.ReactNode }) {\n const drillDown = useDrillDown();\n\n return (\n <div\n role=\"menuitem\"\n tabIndex={0}\n onClick={(e) => {\n e.preventDefault();\n drillDown.pop();\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n drillDown.pop();\n }\n }}\n className={classNames(\n 'rt-reset',\n 'rt-BaseMenuItem',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuDrillDownBackItem',\n )}\n >\n <ThickChevronLeftIcon className=\"rt-DropdownMenuDrillDownBackIcon\" />\n <span className=\"rt-DropdownMenuDrillDownBackLabel\">{label}</span>\n </div>\n );\n}\n\ntype DropdownMenuSubContentElement = React.ElementRef<typeof DropdownMenuPrimitive.SubContent>;\ninterface DropdownMenuSubContentProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubContent, RemovedProps>,\n DropdownMenuContentContextValue {\n container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];\n}\nconst DropdownMenuSubContent = React.forwardRef<\n DropdownMenuSubContentElement,\n DropdownMenuSubContentProps\n>((props, forwardedRef) => {\n // Memoize context consumption to prevent unnecessary re-renders\n const contextValue = React.useContext(DropdownMenuContentContext);\n const { size, variant, color, highContrast, material } = React.useMemo(\n () => contextValue,\n [contextValue],\n );\n const drillDown = useDrillDownOptional();\n const subContext = useSubContext();\n\n const {\n className,\n children,\n container,\n forceMount,\n material: _,\n panelBackground: __,\n ...subContentProps\n } = extractProps(\n { size, variant, color, highContrast, material, ...props },\n dropdownMenuSubContentPropDefs,\n );\n\n // In drill-down mode, render inline instead of in a portal\n if (drillDown?.behavior === 'drill-down' && subContext) {\n const isActive = drillDown.isActive(subContext.id);\n\n return (\n <div\n ref={forwardedRef as React.Ref<HTMLDivElement>}\n role=\"menu\"\n aria-label={typeof subContext.label === 'string' ? subContext.label : undefined}\n data-drill-down-active={isActive ? true : undefined}\n data-animation-direction={drillDown.animationDirection ?? undefined}\n className={classNames(\n 'rt-DropdownMenuDrillDownPanel',\n className,\n )}\n >\n <DrillDownBackItem label={subContext.label} />\n <DropdownMenuSeparator />\n {children}\n </div>\n );\n }\n\n // In cascade mode, use Portal and Radix's SubContent\n return (\n <DropdownMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DropdownMenuPrimitive.SubContent\n data-accent-color={color}\n data-material={material}\n data-panel-background={material}\n alignOffset={-Number(size) * 4}\n // Side offset accounts for the outer solid box-shadow\n sideOffset={1}\n collisionPadding={10}\n {...subContentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'rt-PopperContent',\n 'rt-BaseMenuContent',\n 'rt-BaseMenuSubContent',\n 'rt-DropdownMenuContent',\n 'rt-DropdownMenuSubContent',\n className,\n )}\n >\n <ScrollArea type=\"auto\">\n <div className={classNames('rt-BaseMenuViewport', 'rt-DropdownMenuViewport')}>\n {children}\n </div>\n </ScrollArea>\n </DropdownMenuPrimitive.SubContent>\n </Theme>\n </DropdownMenuPrimitive.Portal>\n );\n});\nDropdownMenuSubContent.displayName = 'DropdownMenu.SubContent';\n\ntype DropdownMenuTriggerIconElement = React.ElementRef<'svg'>;\ninterface DropdownMenuTriggerIconProps extends IconProps {}\nconst DropdownMenuTriggerIcon = React.forwardRef<\n DropdownMenuTriggerIconElement,\n DropdownMenuTriggerIconProps\n>((props, forwardedRef) => (\n <ChevronDownIcon {...props} ref={forwardedRef} className=\"rt-DropdownMenuTriggerIcon\" />\n));\nDropdownMenuTriggerIcon.displayName = 'DropdownMenu.TriggerIcon';\n\nexport {\n DropdownMenuRoot as Root,\n DropdownMenuTrigger as Trigger,\n DropdownMenuTriggerIcon as TriggerIcon,\n DropdownMenuContent as Content,\n DropdownMenuLabel as Label,\n DropdownMenuItem as Item,\n DropdownMenuGroup as Group,\n DropdownMenuRadioGroup as RadioGroup,\n DropdownMenuRadioItem as RadioItem,\n DropdownMenuCheckboxItem as CheckboxItem,\n DropdownMenuSub as Sub,\n DropdownMenuSubTrigger as SubTrigger,\n DropdownMenuSubContent as SubContent,\n DropdownMenuSeparator as Separator,\n};\n\nexport type {\n DropdownMenuRootProps as RootProps,\n DropdownMenuTriggerProps as TriggerProps,\n DropdownMenuTriggerIconProps as TriggerIconProps,\n DropdownMenuContentProps as ContentProps,\n DropdownMenuLabelProps as LabelProps,\n DropdownMenuItemProps as ItemProps,\n DropdownMenuGroupProps as GroupProps,\n DropdownMenuRadioGroupProps as RadioGroupProps,\n DropdownMenuRadioItemProps as RadioItemProps,\n DropdownMenuCheckboxItemProps as CheckboxItemProps,\n DropdownMenuSubProps as SubProps,\n DropdownMenuSubTriggerProps as SubTriggerProps,\n DropdownMenuSubContentProps as SubContentProps,\n DropdownMenuSeparatorProps as SeparatorProps,\n SubmenuBehavior,\n};\n"],
|
|
5
|
+
"mappings": "ykBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,kBAAAE,EAAA,YAAAC,EAAA,UAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,eAAAC,EAAA,cAAAC,EAAA,SAAAC,EAAA,cAAAC,EAAA,QAAAC,EAAA,eAAAC,EAAA,eAAAC,EAAA,YAAAC,EAAA,gBAAAC,IAAA,eAAAC,GAAAhB,IAEA,IAAAiB,EAAuB,oBACvBC,EAAuB,yBACvBC,EAA4D,oBAE5DC,EAA2B,4BAC3BC,EAMO,oCACPC,EAAuC,sBACvCC,EAA2G,sBAC3GC,EAA6B,uCAC7BC,EAMO,mDAEPC,EAAoC,+CACpCC,EAAoB,oBAQpB,MAAMlB,EAAqDmB,GACzDX,EAAA,cAAC,EAAAY,aAAsB,KAAtB,CAA4B,GAAGD,EAAO,EAEzCnB,EAAiB,YAAc,oBAK/B,MAAMK,EAAsBG,EAAM,WAChC,CAAC,CAAE,SAAAa,EAAU,GAAGF,CAAM,EAAGG,IACvBd,EAAA,cAAC,EAAAY,aAAsB,QAAtB,CAA+B,GAAGD,EAAO,IAAKG,EAAc,QAAO,OACjE,uBAAoBD,CAAQ,CAC/B,CAEJ,EACAhB,EAAoB,YAAc,uBAMlC,SAASkB,GAAc,CAAE,SAAAF,CAAS,EAAkC,CAClE,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BACA,yBACA,4BACAT,CACF,GAEA1B,EAAA,cAAC,cAAW,KAAK,QACfA,EAAA,cAAC,OAAI,aAAW,EAAAmC,SAAW,sBAAuB,yBAAyB,GACxEtB,CACH,CACF,CACF,CACF,CACF,CAEJ,CAAC,EACDlB,EAAuB,YAAc,0BAIrC,MAAMG,EAA0BE,EAAM,WAGpC,CAACW,EAAOG,IACRd,EAAA,cAAC,mBAAiB,GAAGW,EAAO,IAAKG,EAAc,UAAU,6BAA6B,CACvF,EACDhB,EAAwB,YAAc",
|
|
6
6
|
"names": ["dropdown_menu_exports", "__export", "DropdownMenuCheckboxItem", "DropdownMenuContent", "DropdownMenuGroup", "DropdownMenuItem", "DropdownMenuLabel", "DropdownMenuRadioGroup", "DropdownMenuRadioItem", "DropdownMenuRoot", "DropdownMenuSeparator", "DropdownMenuSub", "DropdownMenuSubContent", "DropdownMenuSubTrigger", "DropdownMenuTrigger", "DropdownMenuTriggerIcon", "__toCommonJS", "React", "import_classnames", "import_radix_ui", "import_scroll_area", "import_dropdown_menu_props", "import_theme", "import_icons", "import_extract_props", "import_dropdown_menu_drill_down", "import_require_react_element", "import_kbd", "props", "DropdownMenuPrimitive", "children", "forwardedRef", "DrillDownRoot", "drillDown", "DropdownMenuContentContext", "themeContext", "effectiveMaterial", "memoizedThemeContext", "size", "variant", "highContrast", "material", "submenuBehavior", "className", "color", "container", "forceMount", "_", "__", "___", "contentProps", "resolvedColor", "classNames", "shortcut", "itemProps", "useSubId", "label", "subId", "subContextValue", "onClick", "subTriggerProps", "subContext", "e", "DrillDownBackItem", "contextValue", "subContentProps", "isActive"]
|
|
7
7
|
}
|
|
@@ -16,6 +16,7 @@ declare function useBreakpoint(): {
|
|
|
16
16
|
* Falls back through smaller breakpoints if the current one isn't defined.
|
|
17
17
|
*/
|
|
18
18
|
declare function resolveResponsiveValue<T>(value: T | Partial<Record<Breakpoint, T>> | undefined, currentBreakpoint: Breakpoint, defaultValue: T): T;
|
|
19
|
+
type AnimationDirection = 'forward' | 'backward' | null;
|
|
19
20
|
interface DrillDownContextValue {
|
|
20
21
|
/** Current submenu behavior mode */
|
|
21
22
|
behavior: SubmenuBehavior;
|
|
@@ -35,6 +36,8 @@ interface DrillDownContextValue {
|
|
|
35
36
|
isRoot: boolean;
|
|
36
37
|
/** The currently active submenu ID (or null if at root) */
|
|
37
38
|
currentId: string | null;
|
|
39
|
+
/** Current animation direction for transitions */
|
|
40
|
+
animationDirection: AnimationDirection;
|
|
38
41
|
}
|
|
39
42
|
declare const DrillDownContext: React.Context<DrillDownContextValue | null>;
|
|
40
43
|
interface DrillDownProviderProps {
|
|
@@ -56,5 +59,5 @@ interface SubContextValue {
|
|
|
56
59
|
declare const SubContext: React.Context<SubContextValue | null>;
|
|
57
60
|
declare function useSubContext(): SubContextValue | null;
|
|
58
61
|
export { DrillDownProvider, DrillDownContext, SubContext, useDrillDown, useDrillDownOptional, useSubContext, useBreakpoint, resolveResponsiveValue, };
|
|
59
|
-
export type { SubmenuBehavior, DrillDownContextValue, SubContextValue };
|
|
62
|
+
export type { SubmenuBehavior, DrillDownContextValue, SubContextValue, AnimationDirection };
|
|
60
63
|
//# sourceMappingURL=dropdown-menu-drill-down.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu-drill-down.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/dropdown-menu-drill-down.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,KAAK,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;GAIG;AACH,iBAAS,aAAa,IAAI;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAsDnE;AAED;;;GAGG;AACH,iBAAS,sBAAsB,CAAC,CAAC,EAC/B,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,EACrD,iBAAiB,EAAE,UAAU,EAC7B,YAAY,EAAE,CAAC,GACd,CAAC,CA6BH;AAMD,UAAU,qBAAqB;IAC7B,oCAAoC;IACpC,QAAQ,EAAE,eAAe,CAAC;IAC1B,kEAAkE;IAClE,KAAK,EAAE,OAAO,CAAC;IACf,mEAAmE;IACnE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,8BAA8B;IAC9B,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,mCAAmC;IACnC,GAAG,EAAE,MAAM,IAAI,CAAC;IAChB,yBAAyB;IACzB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,8DAA8D;IAC9D,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,sDAAsD;IACtD,MAAM,EAAE,OAAO,CAAC;IAChB,2DAA2D;IAC3D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"dropdown-menu-drill-down.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/dropdown-menu-drill-down.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,KAAK,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;GAIG;AACH,iBAAS,aAAa,IAAI;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAsDnE;AAED;;;GAGG;AACH,i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AChC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,QAAA,MAAM,UAAU,uCAAoD,CAAC;AAErE,iBAAS,aAAa,2BAErB;AAED,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,sBAAsB,GACvB,CAAC;AAEF,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{_BREAKPOINTS as
|
|
1
|
+
"use client";import*as e from"react";import{_BREAKPOINTS as g}from"../shell.types.js";function D(){const[r,l]=e.useState("initial"),[c,a]=e.useState(!1);return e.useEffect(()=>{if(typeof window>"u")return;const u=Object.entries(g).map(([t,o])=>[t,window.matchMedia(o)]),i=()=>{const t=u.filter(([,d])=>d.matches).map(([d])=>d),o=t[t.length-1]??"initial";l(o),a(!0)};i();const s=[];return u.forEach(([,t])=>{const o=t;typeof o.addEventListener=="function"?(o.addEventListener("change",i),s.push(()=>o.removeEventListener?.("change",i))):typeof o.addListener=="function"&&(o.addListener(i),s.push(()=>o.removeListener?.(i)))}),()=>{s.forEach(t=>{try{t()}catch{}})}},[]),{breakpoint:r,ready:c}}function h(r,l,c){if(r==null)return c;if(typeof r!="object")return r;const a=r;if(a[l]!==void 0)return a[l];const n=["xl","lg","md","sm","xs","initial"],u=n.indexOf(l);for(let i=u+1;i<n.length;i++){const s=n[i];if(a[s]!==void 0)return a[s]}return c}const f=e.createContext(null);function C({children:r,submenuBehavior:l}){const{breakpoint:c,ready:a}=D(),[n,u]=e.useState([]),[i,s]=e.useState(null),t=e.useMemo(()=>h(l,c,"cascade"),[l,c]),o=e.useRef(t);e.useEffect(()=>{o.current==="drill-down"&&t==="cascade"&&(u([]),s(null)),o.current=t},[t]);const d=e.useCallback(p=>{s("forward"),u(y=>[...y,p])},[]),m=e.useCallback(()=>{s("backward"),u(p=>p.slice(0,-1))},[]),v=e.useCallback(()=>{u([]),s(null)},[]),b=e.useCallback(p=>n.length===0?!1:n[n.length-1]===p,[n]),x=e.useMemo(()=>({behavior:t,ready:a,stack:n,push:d,pop:m,reset:v,isActive:b,isRoot:n.length===0,currentId:n.length>0?n[n.length-1]:null,animationDirection:i}),[t,a,n,d,m,v,b,i]);return e.createElement(f.Provider,{value:x},r)}function k(){const r=e.useContext(f);if(!r)throw new Error("useDrillDown must be used within a DropdownMenu.Content");return r}function B(){return e.useContext(f)}const w=e.createContext(null);function R(){return e.useContext(w)}export{f as DrillDownContext,C as DrillDownProvider,w as SubContext,h as resolveResponsiveValue,D as useBreakpoint,k as useDrillDown,B as useDrillDownOptional,R as useSubContext};
|
|
2
2
|
//# sourceMappingURL=dropdown-menu-drill-down.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/_internal/dropdown-menu-drill-down.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport type { Breakpoint, Responsive } from '../../props/prop-def.js';\nimport type { submenuBehaviors } from './base-menu.props.js';\nimport { _BREAKPOINTS } from '../shell.types.js';\n\ntype SubmenuBehavior = (typeof submenuBehaviors)[number];\n\n/**\n * Hook to get the current breakpoint based on window width.\n * Returns 'initial' on the server and during initial hydration.\n * Uses shared breakpoint values from shell.types.js.\n */\nfunction useBreakpoint(): { breakpoint: Breakpoint; ready: boolean } {\n const [currentBp, setCurrentBp] = React.useState<Breakpoint>('initial');\n const [ready, setReady] = React.useState(false);\n\n React.useEffect(() => {\n if (typeof window === 'undefined') return;\n\n // Use shared breakpoint media queries from shell.types\n const queries = Object.entries(_BREAKPOINTS) as [keyof typeof _BREAKPOINTS, string][];\n const mqls = queries.map(([k, q]) => [k, window.matchMedia(q)] as const);\n\n const compute = () => {\n // Highest matched breakpoint wins\n const matched = mqls.filter(([, m]) => m.matches).map(([k]) => k);\n const next = (matched[matched.length - 1] as Breakpoint | undefined) ?? 'initial';\n setCurrentBp(next);\n setReady(true);\n };\n\n compute();\n\n const cleanups: Array<() => void> = [];\n mqls.forEach(([, m]) => {\n const mm = m as MediaQueryList & {\n addEventListener?: (type: 'change', listener: () => void) => void;\n removeEventListener?: (type: 'change', listener: () => void) => void;\n addListener?: (listener: () => void) => void;\n removeListener?: (listener: () => void) => void;\n };\n if (typeof mm.addEventListener === 'function') {\n mm.addEventListener('change', compute);\n cleanups.push(() => mm.removeEventListener?.('change', compute));\n } else if (typeof mm.addListener === 'function') {\n mm.addListener(compute);\n cleanups.push(() => mm.removeListener?.(compute));\n }\n });\n\n return () => {\n cleanups.forEach((fn) => {\n try {\n fn();\n } catch (e) {\n // MediaQueryList cleanup can fail in edge cases (e.g., already removed)\n // Log in development to aid debugging\n if (process.env.NODE_ENV !== 'production') {\n console.warn('[DropdownMenu] MediaQueryList cleanup warning:', e);\n }\n }\n });\n };\n }, []);\n\n return { breakpoint: currentBp, ready };\n}\n\n/**\n * Resolves a responsive value to its current value based on the breakpoint.\n * Falls back through smaller breakpoints if the current one isn't defined.\n */\nfunction resolveResponsiveValue<T>(\n value: T | Partial<Record<Breakpoint, T>> | undefined,\n currentBreakpoint: Breakpoint,\n defaultValue: T\n): T {\n if (value === undefined || value === null) {\n return defaultValue;\n }\n\n // Non-object values are returned directly\n if (typeof value !== 'object') {\n return value;\n }\n\n const map = value as Partial<Record<Breakpoint, T>>;\n\n // Check if current breakpoint has a value\n if (map[currentBreakpoint] !== undefined) {\n return map[currentBreakpoint] as T;\n }\n\n // Fall back through smaller breakpoints\n const bpOrder: Breakpoint[] = ['xl', 'lg', 'md', 'sm', 'xs', 'initial'];\n const startIdx = bpOrder.indexOf(currentBreakpoint);\n\n for (let i = startIdx + 1; i < bpOrder.length; i++) {\n const bp = bpOrder[i];\n if (map[bp] !== undefined) {\n return map[bp] as T;\n }\n }\n\n return defaultValue;\n}\n\n// ============================================================================\n// DrillDown Context\n// ============================================================================\n\ninterface DrillDownContextValue {\n /** Current submenu behavior mode */\n behavior: SubmenuBehavior;\n /** Whether the breakpoint has been resolved (client-side only) */\n ready: boolean;\n /** Stack of active submenu IDs. Empty means root menu is shown. */\n stack: string[];\n /** Navigate into a submenu */\n push: (id: string) => void;\n /** Navigate back to parent menu */\n pop: () => void;\n /** Reset to root menu */\n reset: () => void;\n /** Check if a specific submenu is the currently active one */\n isActive: (id: string) => boolean;\n /** Check if we're at root level (no submenus open) */\n isRoot: boolean;\n /** The currently active submenu ID (or null if at root) */\n currentId: string | null;\n}\n\nconst DrillDownContext = React.createContext<DrillDownContextValue | null>(null);\n\ninterface DrillDownProviderProps {\n children: React.ReactNode;\n submenuBehavior: Responsive<SubmenuBehavior> | undefined;\n}\n\nfunction DrillDownProvider({ children, submenuBehavior }: DrillDownProviderProps) {\n const { breakpoint, ready } = useBreakpoint();\n const [stack, setStack] = React.useState<string[]>([]);\n\n // Resolve the current behavior based on breakpoint\n const behavior = React.useMemo(\n () => resolveResponsiveValue(submenuBehavior, breakpoint, 'cascade'),\n [submenuBehavior, breakpoint]\n );\n\n // Reset stack when behavior changes from drill-down to cascade\n const prevBehaviorRef = React.useRef(behavior);\n React.useEffect(() => {\n if (prevBehaviorRef.current === 'drill-down' && behavior === 'cascade') {\n setStack([]);\n }\n prevBehaviorRef.current = behavior;\n }, [behavior]);\n\n const push = React.useCallback((id: string) => {\n setStack((prev) => [...prev, id]);\n }, []);\n\n const pop = React.useCallback(() => {\n setStack((prev) => prev.slice(0, -1));\n }, []);\n\n const reset = React.useCallback(() => {\n setStack([]);\n }, []);\n\n const isActive = React.useCallback(\n (id: string) => {\n if (stack.length === 0) return false;\n return stack[stack.length - 1] === id;\n },\n [stack]\n );\n\n const value = React.useMemo(\n (): DrillDownContextValue => ({\n behavior,\n ready,\n stack,\n push,\n pop,\n reset,\n isActive,\n isRoot: stack.length === 0,\n currentId: stack.length > 0 ? stack[stack.length - 1] : null,\n }),\n [behavior, ready, stack, push, pop, reset, isActive]\n );\n\n return <DrillDownContext.Provider value={value}>{children}</DrillDownContext.Provider>;\n}\n\nfunction useDrillDown() {\n const ctx = React.useContext(DrillDownContext);\n if (!ctx) {\n throw new Error('useDrillDown must be used within a DropdownMenu.Content');\n }\n return ctx;\n}\n\n/**\n * Hook to check if drill-down context is available (i.e., we're inside Content)\n */\nfunction useDrillDownOptional() {\n return React.useContext(DrillDownContext);\n}\n\n// ============================================================================\n// Sub Context (for individual submenu instances)\n// ============================================================================\n\ninterface SubContextValue {\n /** Unique ID for this submenu */\n id: string;\n /** Label for the back button */\n label: React.ReactNode;\n}\n\nconst SubContext = React.createContext<SubContextValue | null>(null);\n\nfunction useSubContext() {\n return React.useContext(SubContext);\n}\n\nexport {\n DrillDownProvider,\n DrillDownContext,\n SubContext,\n useDrillDown,\n useDrillDownOptional,\n useSubContext,\n useBreakpoint,\n resolveResponsiveValue,\n};\n\nexport type { SubmenuBehavior, DrillDownContextValue, SubContextValue };\n"],
|
|
5
|
-
"mappings": "aAEA,UAAYA,MAAW,QAGvB,OAAS,gBAAAC,MAAoB,oBAS7B,SAASC,GAA4D,CACnE,KAAM,CAACC,EAAWC,CAAY,EAAIJ,EAAM,SAAqB,SAAS,EAChE,CAACK,EAAOC,CAAQ,EAAIN,EAAM,SAAS,EAAK,EAE9C,OAAAA,EAAM,UAAU,IAAM,CACpB,GAAI,OAAO,OAAW,IAAa,OAInC,MAAMO,EADU,OAAO,QAAQN,CAAY,EACtB,IAAI,CAAC,CAACO,EAAGC,CAAC,IAAM,CAACD,EAAG,OAAO,WAAWC,CAAC,CAAC,CAAU,EAEjEC,EAAU,IAAM,CAEpB,MAAMC,EAAUJ,EAAK,OAAO,CAAC,CAAC,CAAEK,CAAC,IAAMA,EAAE,OAAO,EAAE,IAAI,CAAC,CAACJ,CAAC,IAAMA,CAAC,EAC1DK,EAAQF,EAAQA,EAAQ,OAAS,CAAC,GAAgC,UACxEP,EAAaS,CAAI,EACjBP,EAAS,EAAI,CACf,EAEAI,EAAQ,EAER,MAAMI,EAA8B,CAAC,EACrC,OAAAP,EAAK,QAAQ,CAAC,CAAC,CAAEK,CAAC,IAAM,CACtB,MAAMG,EAAKH,EAMP,OAAOG,EAAG,kBAAqB,YACjCA,EAAG,iBAAiB,SAAUL,CAAO,EACrCI,EAAS,KAAK,IAAMC,EAAG,sBAAsB,SAAUL,CAAO,CAAC,GACtD,OAAOK,EAAG,aAAgB,aACnCA,EAAG,YAAYL,CAAO,EACtBI,EAAS,KAAK,IAAMC,EAAG,iBAAiBL,CAAO,CAAC,EAEpD,CAAC,EAEM,IAAM,CACXI,EAAS,QAASE,GAAO,CACvB,GAAI,CACFA,EAAG,CACL,MAAY,CAMZ,CACF,CAAC,CACH,CACF,EAAG,CAAC,CAAC,EAEE,CAAE,WAAYb,EAAW,MAAAE,CAAM,CACxC,CAMA,SAASY,EACPC,EACAC,EACAC,EACG,CACH,GAA2BF,GAAU,KACnC,OAAOE,EAIT,GAAI,OAAOF,GAAU,SACnB,OAAOA,EAGT,MAAMG,EAAMH,EAGZ,GAAIG,EAAIF,CAAiB,IAAM,OAC7B,OAAOE,EAAIF,CAAiB,EAI9B,MAAMG,EAAwB,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,SAAS,EAChEC,EAAWD,EAAQ,QAAQH,CAAiB,EAElD,
|
|
6
|
-
"names": ["React", "_BREAKPOINTS", "useBreakpoint", "currentBp", "setCurrentBp", "ready", "setReady", "mqls", "k", "q", "compute", "matched", "m", "next", "cleanups", "mm", "fn", "resolveResponsiveValue", "value", "currentBreakpoint", "defaultValue", "map", "bpOrder", "startIdx", "
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport type { Breakpoint, Responsive } from '../../props/prop-def.js';\nimport type { submenuBehaviors } from './base-menu.props.js';\nimport { _BREAKPOINTS } from '../shell.types.js';\n\ntype SubmenuBehavior = (typeof submenuBehaviors)[number];\n\n/**\n * Hook to get the current breakpoint based on window width.\n * Returns 'initial' on the server and during initial hydration.\n * Uses shared breakpoint values from shell.types.js.\n */\nfunction useBreakpoint(): { breakpoint: Breakpoint; ready: boolean } {\n const [currentBp, setCurrentBp] = React.useState<Breakpoint>('initial');\n const [ready, setReady] = React.useState(false);\n\n React.useEffect(() => {\n if (typeof window === 'undefined') return;\n\n // Use shared breakpoint media queries from shell.types\n const queries = Object.entries(_BREAKPOINTS) as [keyof typeof _BREAKPOINTS, string][];\n const mqls = queries.map(([k, q]) => [k, window.matchMedia(q)] as const);\n\n const compute = () => {\n // Highest matched breakpoint wins\n const matched = mqls.filter(([, m]) => m.matches).map(([k]) => k);\n const next = (matched[matched.length - 1] as Breakpoint | undefined) ?? 'initial';\n setCurrentBp(next);\n setReady(true);\n };\n\n compute();\n\n const cleanups: Array<() => void> = [];\n mqls.forEach(([, m]) => {\n const mm = m as MediaQueryList & {\n addEventListener?: (type: 'change', listener: () => void) => void;\n removeEventListener?: (type: 'change', listener: () => void) => void;\n addListener?: (listener: () => void) => void;\n removeListener?: (listener: () => void) => void;\n };\n if (typeof mm.addEventListener === 'function') {\n mm.addEventListener('change', compute);\n cleanups.push(() => mm.removeEventListener?.('change', compute));\n } else if (typeof mm.addListener === 'function') {\n mm.addListener(compute);\n cleanups.push(() => mm.removeListener?.(compute));\n }\n });\n\n return () => {\n cleanups.forEach((fn) => {\n try {\n fn();\n } catch (e) {\n // MediaQueryList cleanup can fail in edge cases (e.g., already removed)\n // Log in development to aid debugging\n if (process.env.NODE_ENV !== 'production') {\n console.warn('[DropdownMenu] MediaQueryList cleanup warning:', e);\n }\n }\n });\n };\n }, []);\n\n return { breakpoint: currentBp, ready };\n}\n\n/**\n * Resolves a responsive value to its current value based on the breakpoint.\n * Falls back through smaller breakpoints if the current one isn't defined.\n */\nfunction resolveResponsiveValue<T>(\n value: T | Partial<Record<Breakpoint, T>> | undefined,\n currentBreakpoint: Breakpoint,\n defaultValue: T\n): T {\n if (value === undefined || value === null) {\n return defaultValue;\n }\n\n // Non-object values are returned directly\n if (typeof value !== 'object') {\n return value;\n }\n\n const map = value as Partial<Record<Breakpoint, T>>;\n\n // Check if current breakpoint has a value\n if (map[currentBreakpoint] !== undefined) {\n return map[currentBreakpoint] as T;\n }\n\n // Fall back through smaller breakpoints\n const bpOrder: Breakpoint[] = ['xl', 'lg', 'md', 'sm', 'xs', 'initial'];\n const startIdx = bpOrder.indexOf(currentBreakpoint);\n\n for (let i = startIdx + 1; i < bpOrder.length; i++) {\n const bp = bpOrder[i];\n if (map[bp] !== undefined) {\n return map[bp] as T;\n }\n }\n\n return defaultValue;\n}\n\n// ============================================================================\n// DrillDown Context\n// ============================================================================\n\ntype AnimationDirection = 'forward' | 'backward' | null;\n\ninterface DrillDownContextValue {\n /** Current submenu behavior mode */\n behavior: SubmenuBehavior;\n /** Whether the breakpoint has been resolved (client-side only) */\n ready: boolean;\n /** Stack of active submenu IDs. Empty means root menu is shown. */\n stack: string[];\n /** Navigate into a submenu */\n push: (id: string) => void;\n /** Navigate back to parent menu */\n pop: () => void;\n /** Reset to root menu */\n reset: () => void;\n /** Check if a specific submenu is the currently active one */\n isActive: (id: string) => boolean;\n /** Check if we're at root level (no submenus open) */\n isRoot: boolean;\n /** The currently active submenu ID (or null if at root) */\n currentId: string | null;\n /** Current animation direction for transitions */\n animationDirection: AnimationDirection;\n}\n\nconst DrillDownContext = React.createContext<DrillDownContextValue | null>(null);\n\ninterface DrillDownProviderProps {\n children: React.ReactNode;\n submenuBehavior: Responsive<SubmenuBehavior> | undefined;\n}\n\nfunction DrillDownProvider({ children, submenuBehavior }: DrillDownProviderProps) {\n const { breakpoint, ready } = useBreakpoint();\n const [stack, setStack] = React.useState<string[]>([]);\n const [animationDirection, setAnimationDirection] = React.useState<AnimationDirection>(null);\n\n // Resolve the current behavior based on breakpoint\n const behavior = React.useMemo(\n () => resolveResponsiveValue(submenuBehavior, breakpoint, 'cascade'),\n [submenuBehavior, breakpoint]\n );\n\n // Reset stack when behavior changes from drill-down to cascade\n const prevBehaviorRef = React.useRef(behavior);\n React.useEffect(() => {\n if (prevBehaviorRef.current === 'drill-down' && behavior === 'cascade') {\n setStack([]);\n setAnimationDirection(null);\n }\n prevBehaviorRef.current = behavior;\n }, [behavior]);\n\n const push = React.useCallback((id: string) => {\n setAnimationDirection('forward');\n setStack((prev) => [...prev, id]);\n }, []);\n\n const pop = React.useCallback(() => {\n setAnimationDirection('backward');\n setStack((prev) => prev.slice(0, -1));\n }, []);\n\n const reset = React.useCallback(() => {\n setStack([]);\n setAnimationDirection(null);\n }, []);\n\n const isActive = React.useCallback(\n (id: string) => {\n if (stack.length === 0) return false;\n return stack[stack.length - 1] === id;\n },\n [stack]\n );\n\n const value = React.useMemo(\n (): DrillDownContextValue => ({\n behavior,\n ready,\n stack,\n push,\n pop,\n reset,\n isActive,\n isRoot: stack.length === 0,\n currentId: stack.length > 0 ? stack[stack.length - 1] : null,\n animationDirection,\n }),\n [behavior, ready, stack, push, pop, reset, isActive, animationDirection]\n );\n\n return <DrillDownContext.Provider value={value}>{children}</DrillDownContext.Provider>;\n}\n\nfunction useDrillDown() {\n const ctx = React.useContext(DrillDownContext);\n if (!ctx) {\n throw new Error('useDrillDown must be used within a DropdownMenu.Content');\n }\n return ctx;\n}\n\n/**\n * Hook to check if drill-down context is available (i.e., we're inside Content)\n */\nfunction useDrillDownOptional() {\n return React.useContext(DrillDownContext);\n}\n\n// ============================================================================\n// Sub Context (for individual submenu instances)\n// ============================================================================\n\ninterface SubContextValue {\n /** Unique ID for this submenu */\n id: string;\n /** Label for the back button */\n label: React.ReactNode;\n}\n\nconst SubContext = React.createContext<SubContextValue | null>(null);\n\nfunction useSubContext() {\n return React.useContext(SubContext);\n}\n\nexport {\n DrillDownProvider,\n DrillDownContext,\n SubContext,\n useDrillDown,\n useDrillDownOptional,\n useSubContext,\n useBreakpoint,\n resolveResponsiveValue,\n};\n\nexport type { SubmenuBehavior, DrillDownContextValue, SubContextValue, AnimationDirection };\n"],
|
|
5
|
+
"mappings":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xC,EAAM,YAAY,IAAM,CACpC+B,EAAS,CAAC,CAAC,EACXE,EAAsB,IAAI,CAC5B,EAAG,CAAC,CAAC,EAECQ,EAAWzC,EAAM,YACpBqC,GACKP,EAAM,SAAW,EAAU,GACxBA,EAAMA,EAAM,OAAS,CAAC,IAAMO,EAErC,CAACP,CAAK,CACR,EAEMZ,EAAQlB,EAAM,QAClB,KAA8B,CAC5B,SAAAkC,EACA,MAAA7B,EACA,MAAAyB,EACA,KAAAM,EACA,IAAAG,EACA,MAAAC,EACA,SAAAC,EACA,OAAQX,EAAM,SAAW,EACzB,UAAWA,EAAM,OAAS,EAAIA,EAAMA,EAAM,OAAS,CAAC,EAAI,KACxD,mBAAAE,CACF,GACA,CAACE,EAAU7B,EAAOyB,EAAOM,EAAMG,EAAKC,EAAOC,EAAUT,CAAkB,CACzE,EAEA,OAAOhC,EAAA,cAACyB,EAAiB,SAAjB,CAA0B,MAAOP,GAAQS,CAAS,CAC5D,CAEA,SAASe,GAAe,CACtB,MAAMC,EAAM3C,EAAM,WAAWyB,CAAgB,EAC7C,GAAI,CAACkB,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT,CAKA,SAASC,GAAuB,CAC9B,OAAO5C,EAAM,WAAWyB,CAAgB,CAC1C,CAaA,MAAMoB,EAAa7C,EAAM,cAAsC,IAAI,EAEnE,SAAS8C,GAAgB,CACvB,OAAO9C,EAAM,WAAW6C,CAAU,CACpC",
|
|
6
|
+
"names": ["React", "_BREAKPOINTS", "useBreakpoint", "currentBp", "setCurrentBp", "ready", "setReady", "mqls", "k", "q", "compute", "matched", "m", "next", "cleanups", "mm", "fn", "resolveResponsiveValue", "value", "currentBreakpoint", "defaultValue", "map", "bpOrder", "startIdx", "bp", "DrillDownContext", "DrillDownProvider", "children", "submenuBehavior", "breakpoint", "stack", "setStack", "animationDirection", "setAnimationDirection", "behavior", "prevBehaviorRef", "push", "id", "prev", "pop", "reset", "isActive", "useDrillDown", "ctx", "useDrillDownOptional", "SubContext", "useSubContext"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAQ,MAAM,UAAU,CAAC;AAGvE,OAAO,EACL,2BAA2B,EAE3B,wBAAwB,EACxB,gCAAgC,EAChC,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAWlC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAI/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAExE,UAAU,qBACR,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,qBAAqB,CAAC,IAAI,CAAC;CAAG;AAC9E,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAErD,CAAC;AAIF,UAAU,wBACR,SAAQ,qBAAqB,CAAC,OAAO,qBAAqB,CAAC,OAAO,EAAE,YAAY,CAAC;CAAG;AACtF,QAAA,MAAM,mBAAmB,oGAMxB,CAAC;
|
|
1
|
+
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAQ,MAAM,UAAU,CAAC;AAGvE,OAAO,EACL,2BAA2B,EAE3B,wBAAwB,EACxB,gCAAgC,EAChC,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAWlC,OAAO,KAAK,EA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e,EAC9C,0BAA0B,IAAI,cAAc,EAC5C,eAAe,GAChB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import*as e from"react";import a from"classnames";import{DropdownMenu as i,Slot as U}from"radix-ui";import{ScrollArea as h}from"./scroll-area.js";import{dropdownMenuContentPropDefs as M,dropdownMenuSubContentPropDefs as J,dropdownMenuItemPropDefs as Q,dropdownMenuCheckboxItemPropDefs as X,dropdownMenuRadioItemPropDefs as Y}from"./dropdown-menu.props.js";import{Theme as S,useThemeContext as Z}from"./theme.js";import{ChevronDownIcon as $,ThickCheckIcon as ee,ThickChevronLeftIcon as oe,ThickChevronRightIcon as y,ThickDotIcon as ne}from"./icons.js";import{extractProps as R}from"../helpers/extract-props.js";import{DrillDownProvider as re,SubContext as T,useDrillDown as te,useDrillDownOptional as f,useSubContext as x}from"./_internal/dropdown-menu-drill-down.js";import{requireReactElement as pe}from"../helpers/require-react-element.js";import{Kbd as N}from"./kbd.js";const B=o=>e.createElement(i.Root,{...o});B.displayName="DropdownMenu.Root";const k=e.forwardRef(({children:o,...n},r)=>e.createElement(i.Trigger,{...n,ref:r,asChild:!0},pe(o)));k.displayName="DropdownMenu.Trigger";function ie({children:o}){const n=f();return!n||n.behavior==="cascade"?e.createElement(e.Fragment,null,o):e.createElement("div",{className:"rt-DropdownMenuDrillDownRoot","data-drill-down-active":n.isRoot?void 0:!0},o)}const E=e.createContext({}),G=e.forwardRef((o,n)=>{const r=Z();e.useEffect(()=>{o.panelBackground!==void 0&&console.warn("Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.")},[o.panelBackground]);const p=o.material??o.panelBackground??r.panelBackground,t=e.useMemo(()=>({material:p,accentColor:r.accentColor}),[p,r.accentColor]),{size:u=M.size.default,variant:s=M.variant.default,highContrast:m=M.highContrast.default,material:l=t.material,submenuBehavior:d}=o,{className:
|
|
1
|
+
"use client";import*as e from"react";import a from"classnames";import{DropdownMenu as i,Slot as U}from"radix-ui";import{ScrollArea as h}from"./scroll-area.js";import{dropdownMenuContentPropDefs as M,dropdownMenuSubContentPropDefs as J,dropdownMenuItemPropDefs as Q,dropdownMenuCheckboxItemPropDefs as X,dropdownMenuRadioItemPropDefs as Y}from"./dropdown-menu.props.js";import{Theme as S,useThemeContext as Z}from"./theme.js";import{ChevronDownIcon as $,ThickCheckIcon as ee,ThickChevronLeftIcon as oe,ThickChevronRightIcon as y,ThickDotIcon as ne}from"./icons.js";import{extractProps as R}from"../helpers/extract-props.js";import{DrillDownProvider as re,SubContext as T,useDrillDown as te,useDrillDownOptional as f,useSubContext as x}from"./_internal/dropdown-menu-drill-down.js";import{requireReactElement as pe}from"../helpers/require-react-element.js";import{Kbd as N}from"./kbd.js";const B=o=>e.createElement(i.Root,{...o});B.displayName="DropdownMenu.Root";const k=e.forwardRef(({children:o,...n},r)=>e.createElement(i.Trigger,{...n,ref:r,asChild:!0},pe(o)));k.displayName="DropdownMenu.Trigger";function ie({children:o}){const n=f();return!n||n.behavior==="cascade"?e.createElement(e.Fragment,null,o):e.createElement("div",{className:"rt-DropdownMenuDrillDownRoot","data-drill-down-active":n.isRoot?void 0:!0,"data-animation-direction":n.animationDirection??void 0},o)}const E=e.createContext({}),G=e.forwardRef((o,n)=>{const r=Z();e.useEffect(()=>{o.panelBackground!==void 0&&console.warn("Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.")},[o.panelBackground]);const p=o.material??o.panelBackground??r.panelBackground,t=e.useMemo(()=>({material:p,accentColor:r.accentColor}),[p,r.accentColor]),{size:u=M.size.default,variant:s=M.variant.default,highContrast:m=M.highContrast.default,material:l=t.material,submenuBehavior:d}=o,{className:c,children:w,color:D,container:P,forceMount:b,material:F,panelBackground:I,submenuBehavior:g,...q}=R(o,M),C=e.useMemo(()=>D||t.accentColor,[D,t.accentColor]);return e.createElement(i.Portal,{container:P,forceMount:b},e.createElement(S,{asChild:!0},e.createElement(i.Content,{"data-accent-color":C,"data-material":l,"data-panel-background":l,align:"start",sideOffset:4,collisionPadding:10,...q,asChild:!1,ref:n,className:a("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",c)},e.createElement(h,{type:"auto"},e.createElement("div",{className:a("rt-BaseMenuViewport","rt-DropdownMenuViewport")},e.createElement(E.Provider,{value:e.useMemo(()=>({size:u,variant:s,color:C,highContrast:m,material:l}),[u,s,C,m,l])},e.createElement(re,{submenuBehavior:d},e.createElement(ie,null,w))))))))});G.displayName="DropdownMenu.Content";const L=e.forwardRef(({className:o,...n},r)=>e.createElement(i.Label,{...n,asChild:!1,ref:r,className:a("rt-BaseMenuLabel","rt-DropdownMenuLabel",o)}));L.displayName="DropdownMenu.Label";const W=e.forwardRef((o,n)=>{const{className:r,children:p,color:t=Q.color.default,shortcut:u,...s}=o;return e.createElement(i.Item,{"data-accent-color":t,...s,ref:n,className:a("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},e.createElement(U.Slottable,null,p),u&&e.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},e.createElement(N,{size:"1"},u)))});W.displayName="DropdownMenu.Item";const O=e.forwardRef(({className:o,...n},r)=>e.createElement(i.Group,{...n,asChild:!1,ref:r,className:a("rt-BaseMenuGroup","rt-DropdownMenuGroup",o)}));O.displayName="DropdownMenu.Group";const V=e.forwardRef(({className:o,...n},r)=>e.createElement(i.RadioGroup,{...n,asChild:!1,ref:r,className:a("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",o)}));V.displayName="DropdownMenu.RadioGroup";const _=e.forwardRef((o,n)=>{const{children:r,className:p,color:t=Y.color.default,...u}=o;return e.createElement(i.RadioItem,{...u,asChild:!1,ref:n,"data-accent-color":t,className:a("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",p)},r,e.createElement(i.ItemIndicator,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},e.createElement(ne,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});_.displayName="DropdownMenu.RadioItem";const H=e.forwardRef((o,n)=>{const{children:r,className:p,shortcut:t,color:u=X.color.default,...s}=o;return e.createElement(i.CheckboxItem,{...s,asChild:!1,ref:n,"data-accent-color":u,className:a("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",p)},r,e.createElement(i.ItemIndicator,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},e.createElement(ee,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),t&&e.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},e.createElement(N,{size:"1"},t)))});H.displayName="DropdownMenu.CheckboxItem";function ae(){return e.useId()}const z=({label:o="Back",...n})=>{const r=f(),p=ae(),t=e.useMemo(()=>({id:p,label:o}),[p,o]);return r?.behavior==="drill-down"?e.createElement(T.Provider,{value:t},n.children):e.createElement(T.Provider,{value:t},e.createElement(i.Sub,{...n}))};z.displayName="DropdownMenu.Sub";const A=e.forwardRef((o,n)=>{const{className:r,children:p,onClick:t,...u}=o,s=f(),m=x();return s?.behavior==="drill-down"&&m?e.createElement("div",{role:"menuitem",tabIndex:0,ref:n,onClick:d=>{d.preventDefault(),s.push(m.id),t?.(d)},onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),s.push(m.id))},className:a("rt-reset","rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger","rt-DropdownMenuDrillDownSubTrigger",r)},p,e.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},e.createElement(y,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"}))):e.createElement(i.SubTrigger,{...u,onClick:t,asChild:!1,ref:n,className:a("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},p,e.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},e.createElement(y,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});A.displayName="DropdownMenu.SubTrigger";const v=e.forwardRef(({className:o,...n},r)=>e.createElement(i.Separator,{...n,asChild:!1,ref:r,className:a("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",o)}));v.displayName="DropdownMenu.Separator";function ue({label:o}){const n=te();return e.createElement("div",{role:"menuitem",tabIndex:0,onClick:r=>{r.preventDefault(),n.pop()},onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),n.pop())},className:a("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem","rt-DropdownMenuDrillDownBackItem")},e.createElement(oe,{className:"rt-DropdownMenuDrillDownBackIcon"}),e.createElement("span",{className:"rt-DropdownMenuDrillDownBackLabel"},o))}const K=e.forwardRef((o,n)=>{const r=e.useContext(E),{size:p,variant:t,color:u,highContrast:s,material:m}=e.useMemo(()=>r,[r]),l=f(),d=x(),{className:c,children:w,container:D,forceMount:P,material:b,panelBackground:F,...I}=R({size:p,variant:t,color:u,highContrast:s,material:m,...o},J);if(l?.behavior==="drill-down"&&d){const g=l.isActive(d.id);return e.createElement("div",{ref:n,role:"menu","aria-label":typeof d.label=="string"?d.label:void 0,"data-drill-down-active":g?!0:void 0,"data-animation-direction":l.animationDirection??void 0,className:a("rt-DropdownMenuDrillDownPanel",c)},e.createElement(ue,{label:d.label}),e.createElement(v,null),w)}return e.createElement(i.Portal,{container:D,forceMount:P},e.createElement(S,{asChild:!0},e.createElement(i.SubContent,{"data-accent-color":u,"data-material":m,"data-panel-background":m,alignOffset:-Number(p)*4,sideOffset:1,collisionPadding:10,...I,asChild:!1,ref:n,className:a("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",c)},e.createElement(h,{type:"auto"},e.createElement("div",{className:a("rt-BaseMenuViewport","rt-DropdownMenuViewport")},w)))))});K.displayName="DropdownMenu.SubContent";const j=e.forwardRef((o,n)=>e.createElement($,{...o,ref:n,className:"rt-DropdownMenuTriggerIcon"}));j.displayName="DropdownMenu.TriggerIcon";export{H as CheckboxItem,G as Content,O as Group,W as Item,L as Label,V as RadioGroup,_ as RadioItem,B as Root,v as Separator,z as Sub,K as SubContent,A as SubTrigger,k as Trigger,j as TriggerIcon};
|
|
2
2
|
//# sourceMappingURL=dropdown-menu.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dropdown-menu.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { DropdownMenu as DropdownMenuPrimitive, Slot } from 'radix-ui';\n\nimport { ScrollArea } from './scroll-area.js';\nimport {\n dropdownMenuContentPropDefs,\n dropdownMenuSubContentPropDefs,\n dropdownMenuItemPropDefs,\n dropdownMenuCheckboxItemPropDefs,\n dropdownMenuRadioItemPropDefs,\n} from './dropdown-menu.props.js';\nimport { Theme, useThemeContext } from './theme.js';\nimport { ChevronDownIcon, ThickCheckIcon, ThickChevronLeftIcon, ThickChevronRightIcon, ThickDotIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport {\n DrillDownProvider,\n SubContext,\n useDrillDown,\n useDrillDownOptional,\n useSubContext,\n} from './_internal/dropdown-menu-drill-down.js';\nimport type { SubmenuBehavior } from './_internal/dropdown-menu-drill-down.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { Kbd } from './kbd.js';\n\nimport type { IconProps } from './icons.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes, Responsive } from '../props/prop-def.js';\n\ninterface DropdownMenuRootProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root> {}\nconst DropdownMenuRoot: React.FC<DropdownMenuRootProps> = (props) => (\n <DropdownMenuPrimitive.Root {...props} />\n);\nDropdownMenuRoot.displayName = 'DropdownMenu.Root';\n\ntype DropdownMenuTriggerElement = React.ElementRef<typeof DropdownMenuPrimitive.Trigger>;\ninterface DropdownMenuTriggerProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Trigger, RemovedProps> {}\nconst DropdownMenuTrigger = React.forwardRef<DropdownMenuTriggerElement, DropdownMenuTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DropdownMenuPrimitive.Trigger>\n ),\n);\nDropdownMenuTrigger.displayName = 'DropdownMenu.Trigger';\n\n/**\n * Internal component that wraps root menu items and handles visibility in drill-down mode.\n * In drill-down mode, this hides when a submenu is active.\n */\nfunction DrillDownRoot({ children }: { children: React.ReactNode }) {\n const drillDown = useDrillDownOptional();\n\n // In cascade mode or when no drill-down context, always show\n if (!drillDown || drillDown.behavior === 'cascade') {\n return <>{children}</>;\n }\n\n // In drill-down mode, hide root when a submenu is active\n return (\n <div\n className=\"rt-DropdownMenuDrillDownRoot\"\n data-drill-down-active={drillDown.isRoot ? undefined : true}\n >\n {children}\n </div>\n );\n}\n\ntype DropdownMenuContentOwnProps = GetPropDefTypes<typeof dropdownMenuContentPropDefs> & {\n /**\n * Controls how submenus behave.\n * - `cascade`: Default cascading behavior where submenus open to the side (portal-based)\n * - `drill-down`: Mobile-friendly behavior where submenus replace the content inline\n * Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`\n */\n submenuBehavior?: Responsive<SubmenuBehavior>;\n};\ntype DropdownMenuContentContextValue = Omit<DropdownMenuContentOwnProps, 'submenuBehavior'>;\nconst DropdownMenuContentContext = React.createContext<DropdownMenuContentContextValue>({});\ntype DropdownMenuContentElement = React.ElementRef<typeof DropdownMenuPrimitive.Content>;\ninterface DropdownMenuContentProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Content, RemovedProps>,\n DropdownMenuContentContextValue {\n container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];\n /**\n * Controls how submenus behave.\n * - `cascade`: Default cascading behavior where submenus open to the side (portal-based)\n * - `drill-down`: Mobile-friendly behavior where submenus replace the content inline\n * Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`\n */\n submenuBehavior?: Responsive<SubmenuBehavior>;\n}\nconst DropdownMenuContent = React.forwardRef<DropdownMenuContentElement, DropdownMenuContentProps>(\n (props, forwardedRef) => {\n const themeContext = useThemeContext();\n\n // Show deprecation warning for panelBackground when used\n React.useEffect(() => {\n if (props.panelBackground !== undefined) {\n console.warn(\n 'Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.',\n );\n }\n }, [props.panelBackground]);\n\n // Material takes precedence over panelBackground\n const effectiveMaterial =\n props.material ?? props.panelBackground ?? themeContext.panelBackground;\n\n // Memoize theme context values to prevent unnecessary re-renders\n const memoizedThemeContext = React.useMemo(\n () => ({\n material: effectiveMaterial,\n accentColor: themeContext.accentColor,\n }),\n [effectiveMaterial, themeContext.accentColor],\n );\n\n const {\n size = dropdownMenuContentPropDefs.size.default,\n variant = dropdownMenuContentPropDefs.variant.default,\n highContrast = dropdownMenuContentPropDefs.highContrast.default,\n material = memoizedThemeContext.material,\n submenuBehavior,\n } = props;\n const {\n className,\n children,\n color,\n container,\n forceMount,\n material: _,\n panelBackground: __,\n submenuBehavior: ___,\n ...contentProps\n } = extractProps(props, dropdownMenuContentPropDefs);\n\n // Memoize color resolution to prevent unnecessary re-renders\n const resolvedColor = React.useMemo(\n () => color || memoizedThemeContext.accentColor,\n [color, memoizedThemeContext.accentColor],\n );\n return (\n <DropdownMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DropdownMenuPrimitive.Content\n data-accent-color={resolvedColor}\n data-material={material}\n data-panel-background={material}\n align=\"start\"\n sideOffset={4}\n collisionPadding={10}\n {...contentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'rt-PopperContent',\n 'rt-BaseMenuContent',\n 'rt-DropdownMenuContent',\n className,\n )}\n >\n <ScrollArea type=\"auto\">\n <div className={classNames('rt-BaseMenuViewport', 'rt-DropdownMenuViewport')}>\n <DropdownMenuContentContext.Provider\n value={React.useMemo(\n () => ({ size, variant, color: resolvedColor, highContrast, material }),\n [size, variant, resolvedColor, highContrast, material],\n )}\n >\n <DrillDownProvider submenuBehavior={submenuBehavior}>\n <DrillDownRoot>{children}</DrillDownRoot>\n </DrillDownProvider>\n </DropdownMenuContentContext.Provider>\n </div>\n </ScrollArea>\n </DropdownMenuPrimitive.Content>\n </Theme>\n </DropdownMenuPrimitive.Portal>\n );\n },\n);\nDropdownMenuContent.displayName = 'DropdownMenu.Content';\n\ntype DropdownMenuLabelElement = React.ElementRef<typeof DropdownMenuPrimitive.Label>;\ninterface DropdownMenuLabelProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Label, RemovedProps> {}\nconst DropdownMenuLabel = React.forwardRef<DropdownMenuLabelElement, DropdownMenuLabelProps>(\n ({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Label\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuLabel', 'rt-DropdownMenuLabel', className)}\n />\n ),\n);\nDropdownMenuLabel.displayName = 'DropdownMenu.Label';\n\ntype DropdownMenuItemElement = React.ElementRef<typeof DropdownMenuPrimitive.Item>;\ntype DropdownMenuItemOwnProps = GetPropDefTypes<typeof dropdownMenuItemPropDefs>;\ninterface DropdownMenuItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Item, RemovedProps>,\n DropdownMenuItemOwnProps {}\nconst DropdownMenuItem = React.forwardRef<DropdownMenuItemElement, DropdownMenuItemProps>(\n (props, forwardedRef) => {\n const {\n className,\n children,\n color = dropdownMenuItemPropDefs.color.default,\n shortcut,\n ...itemProps\n } = props;\n return (\n <DropdownMenuPrimitive.Item\n data-accent-color={color}\n {...itemProps}\n ref={forwardedRef}\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-DropdownMenuItem', className)}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n {shortcut && (\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <Kbd size=\"1\">{shortcut}</Kbd>\n </div>\n )}\n </DropdownMenuPrimitive.Item>\n );\n },\n);\nDropdownMenuItem.displayName = 'DropdownMenu.Item';\n\ntype DropdownMenuGroupElement = React.ElementRef<typeof DropdownMenuPrimitive.Group>;\ninterface DropdownMenuGroupProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Group, RemovedProps> {}\nconst DropdownMenuGroup = React.forwardRef<DropdownMenuGroupElement, DropdownMenuGroupProps>(\n ({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Group\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuGroup', 'rt-DropdownMenuGroup', className)}\n />\n ),\n);\nDropdownMenuGroup.displayName = 'DropdownMenu.Group';\n\ntype DropdownMenuRadioGroupElement = React.ElementRef<typeof DropdownMenuPrimitive.RadioGroup>;\ninterface DropdownMenuRadioGroupProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.RadioGroup, RemovedProps> {}\nconst DropdownMenuRadioGroup = React.forwardRef<\n DropdownMenuRadioGroupElement,\n DropdownMenuRadioGroupProps\n>(({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.RadioGroup\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuRadioGroup', 'rt-DropdownMenuRadioGroup', className)}\n />\n));\nDropdownMenuRadioGroup.displayName = 'DropdownMenu.RadioGroup';\n\ntype DropdownMenuRadioItemElement = React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>;\ntype DropdownMenuRadioItemOwnProps = GetPropDefTypes<typeof dropdownMenuRadioItemPropDefs>;\ninterface DropdownMenuRadioItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.RadioItem, RemovedProps>,\n DropdownMenuRadioItemOwnProps {}\nconst DropdownMenuRadioItem = React.forwardRef<\n DropdownMenuRadioItemElement,\n DropdownMenuRadioItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n color = dropdownMenuRadioItemPropDefs.color.default,\n ...itemProps\n } = props;\n return (\n <DropdownMenuPrimitive.RadioItem\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'rt-BaseMenuItem',\n 'rt-BaseMenuRadioItem',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuRadioItem',\n className,\n )}\n >\n {children}\n <DropdownMenuPrimitive.ItemIndicator className=\"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator\">\n <ThickDotIcon className=\"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </DropdownMenuPrimitive.RadioItem>\n );\n});\nDropdownMenuRadioItem.displayName = 'DropdownMenu.RadioItem';\n\ntype DropdownMenuCheckboxItemElement = React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>;\ntype DropdownMenuCheckboxItemOwnProps = GetPropDefTypes<typeof dropdownMenuCheckboxItemPropDefs>;\ninterface DropdownMenuCheckboxItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.CheckboxItem, RemovedProps>,\n DropdownMenuCheckboxItemOwnProps {}\nconst DropdownMenuCheckboxItem = React.forwardRef<\n DropdownMenuCheckboxItemElement,\n DropdownMenuCheckboxItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n shortcut,\n color = dropdownMenuCheckboxItemPropDefs.color.default,\n ...itemProps\n } = props;\n return (\n <DropdownMenuPrimitive.CheckboxItem\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'rt-BaseMenuItem',\n 'rt-BaseMenuCheckboxItem',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuCheckboxItem',\n className,\n )}\n >\n {children}\n <DropdownMenuPrimitive.ItemIndicator className=\"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator\">\n <ThickCheckIcon className=\"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon\" />\n </DropdownMenuPrimitive.ItemIndicator>\n {shortcut && (\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <Kbd size=\"1\">{shortcut}</Kbd>\n </div>\n )}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\nDropdownMenuCheckboxItem.displayName = 'DropdownMenu.CheckboxItem';\n\n// Generate unique submenu IDs using React 18's useId for SSR safety\nfunction useSubId() {\n return React.useId();\n}\n\ninterface DropdownMenuSubProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Sub> {\n /**\n * Label displayed in the back button when using drill-down mode.\n * If not provided, defaults to \"Back\".\n */\n label?: React.ReactNode;\n}\nconst DropdownMenuSub: React.FC<DropdownMenuSubProps> = ({ label = 'Back', ...props }) => {\n const drillDown = useDrillDownOptional();\n const subId = useSubId();\n\n // Create context value for SubContent and SubTrigger\n const subContextValue = React.useMemo(\n () => ({ id: subId, label }),\n [subId, label]\n );\n\n // In drill-down mode, we don't use Radix's Sub component\n // We just provide the SubContext and render children\n if (drillDown?.behavior === 'drill-down') {\n return (\n <SubContext.Provider value={subContextValue}>\n {props.children}\n </SubContext.Provider>\n );\n }\n\n // In cascade mode, use Radix's Sub component normally\n return (\n <SubContext.Provider value={subContextValue}>\n <DropdownMenuPrimitive.Sub {...props} />\n </SubContext.Provider>\n );\n};\nDropdownMenuSub.displayName = 'DropdownMenu.Sub';\n\ntype DropdownMenuSubTriggerElement = React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>;\ninterface DropdownMenuSubTriggerProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubTrigger, RemovedProps> {}\nconst DropdownMenuSubTrigger = React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>((props, forwardedRef) => {\n const { className, children, onClick, ...subTriggerProps } = props;\n const drillDown = useDrillDownOptional();\n const subContext = useSubContext();\n\n // In drill-down mode, render a button that navigates to the submenu\n if (drillDown?.behavior === 'drill-down' && subContext) {\n const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {\n e.preventDefault();\n drillDown.push(subContext.id);\n (onClick as React.MouseEventHandler<HTMLDivElement> | undefined)?.(e);\n };\n\n return (\n <div\n role=\"menuitem\"\n tabIndex={0}\n ref={forwardedRef as React.Ref<HTMLDivElement>}\n onClick={handleClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n drillDown.push(subContext.id);\n }\n }}\n className={classNames(\n 'rt-reset',\n 'rt-BaseMenuItem',\n 'rt-BaseMenuSubTrigger',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuSubTrigger',\n 'rt-DropdownMenuDrillDownSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <ThickChevronRightIcon className=\"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon\" />\n </div>\n </div>\n );\n }\n\n // In cascade mode, use Radix's SubTrigger\n return (\n <DropdownMenuPrimitive.SubTrigger\n {...subTriggerProps}\n onClick={onClick as React.MouseEventHandler<HTMLDivElement> | undefined}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'rt-BaseMenuItem',\n 'rt-BaseMenuSubTrigger',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <ThickChevronRightIcon className=\"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon\" />\n </div>\n </DropdownMenuPrimitive.SubTrigger>\n );\n});\nDropdownMenuSubTrigger.displayName = 'DropdownMenu.SubTrigger';\n\n// Separator is defined here (before SubContent) because it's used in drill-down mode\ntype DropdownMenuSeparatorElement = React.ElementRef<typeof DropdownMenuPrimitive.Separator>;\ninterface DropdownMenuSeparatorProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Separator, RemovedProps> {}\nconst DropdownMenuSeparator = React.forwardRef<\n DropdownMenuSeparatorElement,\n DropdownMenuSeparatorProps\n>(({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Separator\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuSeparator', 'rt-DropdownMenuSeparator', className)}\n />\n));\nDropdownMenuSeparator.displayName = 'DropdownMenu.Separator';\n\n/**\n * Internal component for the drill-down back button.\n */\nfunction DrillDownBackItem({ label }: { label: React.ReactNode }) {\n const drillDown = useDrillDown();\n\n return (\n <div\n role=\"menuitem\"\n tabIndex={0}\n onClick={(e) => {\n e.preventDefault();\n drillDown.pop();\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n drillDown.pop();\n }\n }}\n className={classNames(\n 'rt-reset',\n 'rt-BaseMenuItem',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuDrillDownBackItem',\n )}\n >\n <ThickChevronLeftIcon className=\"rt-DropdownMenuDrillDownBackIcon\" />\n <span className=\"rt-DropdownMenuDrillDownBackLabel\">{label}</span>\n </div>\n );\n}\n\ntype DropdownMenuSubContentElement = React.ElementRef<typeof DropdownMenuPrimitive.SubContent>;\ninterface DropdownMenuSubContentProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubContent, RemovedProps>,\n DropdownMenuContentContextValue {\n container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];\n}\nconst DropdownMenuSubContent = React.forwardRef<\n DropdownMenuSubContentElement,\n DropdownMenuSubContentProps\n>((props, forwardedRef) => {\n // Memoize context consumption to prevent unnecessary re-renders\n const contextValue = React.useContext(DropdownMenuContentContext);\n const { size, variant, color, highContrast, material } = React.useMemo(\n () => contextValue,\n [contextValue],\n );\n const drillDown = useDrillDownOptional();\n const subContext = useSubContext();\n\n const {\n className,\n children,\n container,\n forceMount,\n material: _,\n panelBackground: __,\n ...subContentProps\n } = extractProps(\n { size, variant, color, highContrast, material, ...props },\n dropdownMenuSubContentPropDefs,\n );\n\n // In drill-down mode, render inline instead of in a portal\n if (drillDown?.behavior === 'drill-down' && subContext) {\n const isActive = drillDown.isActive(subContext.id);\n\n return (\n <div\n ref={forwardedRef as React.Ref<HTMLDivElement>}\n role=\"menu\"\n aria-label={typeof subContext.label === 'string' ? subContext.label : undefined}\n data-drill-down-active={isActive ? true : undefined}\n className={classNames(\n 'rt-DropdownMenuDrillDownPanel',\n className,\n )}\n >\n <DrillDownBackItem label={subContext.label} />\n <DropdownMenuSeparator />\n {children}\n </div>\n );\n }\n\n // In cascade mode, use Portal and Radix's SubContent\n return (\n <DropdownMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DropdownMenuPrimitive.SubContent\n data-accent-color={color}\n data-material={material}\n data-panel-background={material}\n alignOffset={-Number(size) * 4}\n // Side offset accounts for the outer solid box-shadow\n sideOffset={1}\n collisionPadding={10}\n {...subContentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'rt-PopperContent',\n 'rt-BaseMenuContent',\n 'rt-BaseMenuSubContent',\n 'rt-DropdownMenuContent',\n 'rt-DropdownMenuSubContent',\n className,\n )}\n >\n <ScrollArea type=\"auto\">\n <div className={classNames('rt-BaseMenuViewport', 'rt-DropdownMenuViewport')}>\n {children}\n </div>\n </ScrollArea>\n </DropdownMenuPrimitive.SubContent>\n </Theme>\n </DropdownMenuPrimitive.Portal>\n );\n});\nDropdownMenuSubContent.displayName = 'DropdownMenu.SubContent';\n\ntype DropdownMenuTriggerIconElement = React.ElementRef<'svg'>;\ninterface DropdownMenuTriggerIconProps extends IconProps {}\nconst DropdownMenuTriggerIcon = React.forwardRef<\n DropdownMenuTriggerIconElement,\n DropdownMenuTriggerIconProps\n>((props, forwardedRef) => (\n <ChevronDownIcon {...props} ref={forwardedRef} className=\"rt-DropdownMenuTriggerIcon\" />\n));\nDropdownMenuTriggerIcon.displayName = 'DropdownMenu.TriggerIcon';\n\nexport {\n DropdownMenuRoot as Root,\n DropdownMenuTrigger as Trigger,\n DropdownMenuTriggerIcon as TriggerIcon,\n DropdownMenuContent as Content,\n DropdownMenuLabel as Label,\n DropdownMenuItem as Item,\n DropdownMenuGroup as Group,\n DropdownMenuRadioGroup as RadioGroup,\n DropdownMenuRadioItem as RadioItem,\n DropdownMenuCheckboxItem as CheckboxItem,\n DropdownMenuSub as Sub,\n DropdownMenuSubTrigger as SubTrigger,\n DropdownMenuSubContent as SubContent,\n DropdownMenuSeparator as Separator,\n};\n\nexport type {\n DropdownMenuRootProps as RootProps,\n DropdownMenuTriggerProps as TriggerProps,\n DropdownMenuTriggerIconProps as TriggerIconProps,\n DropdownMenuContentProps as ContentProps,\n DropdownMenuLabelProps as LabelProps,\n DropdownMenuItemProps as ItemProps,\n DropdownMenuGroupProps as GroupProps,\n DropdownMenuRadioGroupProps as RadioGroupProps,\n DropdownMenuRadioItemProps as RadioItemProps,\n DropdownMenuCheckboxItemProps as CheckboxItemProps,\n DropdownMenuSubProps as SubProps,\n DropdownMenuSubTriggerProps as SubTriggerProps,\n DropdownMenuSubContentProps as SubContentProps,\n DropdownMenuSeparatorProps as SeparatorProps,\n SubmenuBehavior,\n};\n"],
|
|
5
|
-
"mappings": "aAEA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,gBAAgBC,EAAuB,QAAAC,MAAY,WAE5D,OAAS,cAAAC,MAAkB,mBAC3B,OACE,+BAAAC,EACA,kCAAAC,EACA,4BAAAC,EACA,oCAAAC,EACA,iCAAAC,MACK,2BACP,OAAS,SAAAC,EAAO,mBAAAC,MAAuB,aACvC,OAAS,mBAAAC,EAAiB,kBAAAC,GAAgB,wBAAAC,GAAsB,yBAAAC,EAAuB,gBAAAC,OAAoB,aAC3G,OAAS,gBAAAC,MAAoB,8BAC7B,OACE,qBAAAC,GACA,cAAAC,EACA,gBAAAC,GACA,wBAAAC,EACA,iBAAAC,MACK,0CAEP,OAAS,uBAAAC,OAA2B,sCACpC,OAAS,OAAAC,MAAW,WAQpB,MAAMC,EAAqDC,GACzD1B,EAAA,cAACE,EAAsB,KAAtB,CAA4B,GAAGwB,EAAO,EAEzCD,EAAiB,YAAc,oBAK/B,MAAME,EAAsB3B,EAAM,WAChC,CAAC,CAAE,SAAA4B,EAAU,GAAGF,CAAM,EAAGG,IACvB7B,EAAA,cAACE,EAAsB,QAAtB,CAA+B,GAAGwB,EAAO,IAAKG,EAAc,QAAO,IACjEN,GAAoBK,CAAQ,CAC/B,CAEJ,EACAD,EAAoB,YAAc,uBAMlC,SAASG,GAAc,CAAE,SAAAF,CAAS,EAAkC,CAClE,MAAMG,EAAYV,EAAqB,EAGvC,MAAI,CAACU,GAAaA,EAAU,WAAa,UAChC/B,EAAA,cAAAA,EAAA,cAAG4B,CAAS,EAKnB5B,EAAA,cAAC,OACC,UAAU,+BACV,yBAAwB+B,EAAU,OAAS,OAAY,
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { DropdownMenu as DropdownMenuPrimitive, Slot } from 'radix-ui';\n\nimport { ScrollArea } from './scroll-area.js';\nimport {\n dropdownMenuContentPropDefs,\n dropdownMenuSubContentPropDefs,\n dropdownMenuItemPropDefs,\n dropdownMenuCheckboxItemPropDefs,\n dropdownMenuRadioItemPropDefs,\n} from './dropdown-menu.props.js';\nimport { Theme, useThemeContext } from './theme.js';\nimport { ChevronDownIcon, ThickCheckIcon, ThickChevronLeftIcon, ThickChevronRightIcon, ThickDotIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport {\n DrillDownProvider,\n SubContext,\n useDrillDown,\n useDrillDownOptional,\n useSubContext,\n} from './_internal/dropdown-menu-drill-down.js';\nimport type { SubmenuBehavior } from './_internal/dropdown-menu-drill-down.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { Kbd } from './kbd.js';\n\nimport type { IconProps } from './icons.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes, Responsive } from '../props/prop-def.js';\n\ninterface DropdownMenuRootProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root> {}\nconst DropdownMenuRoot: React.FC<DropdownMenuRootProps> = (props) => (\n <DropdownMenuPrimitive.Root {...props} />\n);\nDropdownMenuRoot.displayName = 'DropdownMenu.Root';\n\ntype DropdownMenuTriggerElement = React.ElementRef<typeof DropdownMenuPrimitive.Trigger>;\ninterface DropdownMenuTriggerProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Trigger, RemovedProps> {}\nconst DropdownMenuTrigger = React.forwardRef<DropdownMenuTriggerElement, DropdownMenuTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DropdownMenuPrimitive.Trigger>\n ),\n);\nDropdownMenuTrigger.displayName = 'DropdownMenu.Trigger';\n\n/**\n * Internal component that wraps root menu items and handles visibility in drill-down mode.\n * In drill-down mode, this hides when a submenu is active.\n */\nfunction DrillDownRoot({ children }: { children: React.ReactNode }) {\n const drillDown = useDrillDownOptional();\n\n // In cascade mode or when no drill-down context, always show\n if (!drillDown || drillDown.behavior === 'cascade') {\n return <>{children}</>;\n }\n\n // In drill-down mode, hide root when a submenu is active\n return (\n <div\n className=\"rt-DropdownMenuDrillDownRoot\"\n data-drill-down-active={drillDown.isRoot ? undefined : true}\n data-animation-direction={drillDown.animationDirection ?? undefined}\n >\n {children}\n </div>\n );\n}\n\ntype DropdownMenuContentOwnProps = GetPropDefTypes<typeof dropdownMenuContentPropDefs> & {\n /**\n * Controls how submenus behave.\n * - `cascade`: Default cascading behavior where submenus open to the side (portal-based)\n * - `drill-down`: Mobile-friendly behavior where submenus replace the content inline\n * Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`\n */\n submenuBehavior?: Responsive<SubmenuBehavior>;\n};\ntype DropdownMenuContentContextValue = Omit<DropdownMenuContentOwnProps, 'submenuBehavior'>;\nconst DropdownMenuContentContext = React.createContext<DropdownMenuContentContextValue>({});\ntype DropdownMenuContentElement = React.ElementRef<typeof DropdownMenuPrimitive.Content>;\ninterface DropdownMenuContentProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Content, RemovedProps>,\n DropdownMenuContentContextValue {\n container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];\n /**\n * Controls how submenus behave.\n * - `cascade`: Default cascading behavior where submenus open to the side (portal-based)\n * - `drill-down`: Mobile-friendly behavior where submenus replace the content inline\n * Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`\n */\n submenuBehavior?: Responsive<SubmenuBehavior>;\n}\nconst DropdownMenuContent = React.forwardRef<DropdownMenuContentElement, DropdownMenuContentProps>(\n (props, forwardedRef) => {\n const themeContext = useThemeContext();\n\n // Show deprecation warning for panelBackground when used\n React.useEffect(() => {\n if (props.panelBackground !== undefined) {\n console.warn(\n 'Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.',\n );\n }\n }, [props.panelBackground]);\n\n // Material takes precedence over panelBackground\n const effectiveMaterial =\n props.material ?? props.panelBackground ?? themeContext.panelBackground;\n\n // Memoize theme context values to prevent unnecessary re-renders\n const memoizedThemeContext = React.useMemo(\n () => ({\n material: effectiveMaterial,\n accentColor: themeContext.accentColor,\n }),\n [effectiveMaterial, themeContext.accentColor],\n );\n\n const {\n size = dropdownMenuContentPropDefs.size.default,\n variant = dropdownMenuContentPropDefs.variant.default,\n highContrast = dropdownMenuContentPropDefs.highContrast.default,\n material = memoizedThemeContext.material,\n submenuBehavior,\n } = props;\n const {\n className,\n children,\n color,\n container,\n forceMount,\n material: _,\n panelBackground: __,\n submenuBehavior: ___,\n ...contentProps\n } = extractProps(props, dropdownMenuContentPropDefs);\n\n // Memoize color resolution to prevent unnecessary re-renders\n const resolvedColor = React.useMemo(\n () => color || memoizedThemeContext.accentColor,\n [color, memoizedThemeContext.accentColor],\n );\n return (\n <DropdownMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DropdownMenuPrimitive.Content\n data-accent-color={resolvedColor}\n data-material={material}\n data-panel-background={material}\n align=\"start\"\n sideOffset={4}\n collisionPadding={10}\n {...contentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'rt-PopperContent',\n 'rt-BaseMenuContent',\n 'rt-DropdownMenuContent',\n className,\n )}\n >\n <ScrollArea type=\"auto\">\n <div className={classNames('rt-BaseMenuViewport', 'rt-DropdownMenuViewport')}>\n <DropdownMenuContentContext.Provider\n value={React.useMemo(\n () => ({ size, variant, color: resolvedColor, highContrast, material }),\n [size, variant, resolvedColor, highContrast, material],\n )}\n >\n <DrillDownProvider submenuBehavior={submenuBehavior}>\n <DrillDownRoot>{children}</DrillDownRoot>\n </DrillDownProvider>\n </DropdownMenuContentContext.Provider>\n </div>\n </ScrollArea>\n </DropdownMenuPrimitive.Content>\n </Theme>\n </DropdownMenuPrimitive.Portal>\n );\n },\n);\nDropdownMenuContent.displayName = 'DropdownMenu.Content';\n\ntype DropdownMenuLabelElement = React.ElementRef<typeof DropdownMenuPrimitive.Label>;\ninterface DropdownMenuLabelProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Label, RemovedProps> {}\nconst DropdownMenuLabel = React.forwardRef<DropdownMenuLabelElement, DropdownMenuLabelProps>(\n ({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Label\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuLabel', 'rt-DropdownMenuLabel', className)}\n />\n ),\n);\nDropdownMenuLabel.displayName = 'DropdownMenu.Label';\n\ntype DropdownMenuItemElement = React.ElementRef<typeof DropdownMenuPrimitive.Item>;\ntype DropdownMenuItemOwnProps = GetPropDefTypes<typeof dropdownMenuItemPropDefs>;\ninterface DropdownMenuItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Item, RemovedProps>,\n DropdownMenuItemOwnProps {}\nconst DropdownMenuItem = React.forwardRef<DropdownMenuItemElement, DropdownMenuItemProps>(\n (props, forwardedRef) => {\n const {\n className,\n children,\n color = dropdownMenuItemPropDefs.color.default,\n shortcut,\n ...itemProps\n } = props;\n return (\n <DropdownMenuPrimitive.Item\n data-accent-color={color}\n {...itemProps}\n ref={forwardedRef}\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-DropdownMenuItem', className)}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n {shortcut && (\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <Kbd size=\"1\">{shortcut}</Kbd>\n </div>\n )}\n </DropdownMenuPrimitive.Item>\n );\n },\n);\nDropdownMenuItem.displayName = 'DropdownMenu.Item';\n\ntype DropdownMenuGroupElement = React.ElementRef<typeof DropdownMenuPrimitive.Group>;\ninterface DropdownMenuGroupProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Group, RemovedProps> {}\nconst DropdownMenuGroup = React.forwardRef<DropdownMenuGroupElement, DropdownMenuGroupProps>(\n ({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Group\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuGroup', 'rt-DropdownMenuGroup', className)}\n />\n ),\n);\nDropdownMenuGroup.displayName = 'DropdownMenu.Group';\n\ntype DropdownMenuRadioGroupElement = React.ElementRef<typeof DropdownMenuPrimitive.RadioGroup>;\ninterface DropdownMenuRadioGroupProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.RadioGroup, RemovedProps> {}\nconst DropdownMenuRadioGroup = React.forwardRef<\n DropdownMenuRadioGroupElement,\n DropdownMenuRadioGroupProps\n>(({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.RadioGroup\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuRadioGroup', 'rt-DropdownMenuRadioGroup', className)}\n />\n));\nDropdownMenuRadioGroup.displayName = 'DropdownMenu.RadioGroup';\n\ntype DropdownMenuRadioItemElement = React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>;\ntype DropdownMenuRadioItemOwnProps = GetPropDefTypes<typeof dropdownMenuRadioItemPropDefs>;\ninterface DropdownMenuRadioItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.RadioItem, RemovedProps>,\n DropdownMenuRadioItemOwnProps {}\nconst DropdownMenuRadioItem = React.forwardRef<\n DropdownMenuRadioItemElement,\n DropdownMenuRadioItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n color = dropdownMenuRadioItemPropDefs.color.default,\n ...itemProps\n } = props;\n return (\n <DropdownMenuPrimitive.RadioItem\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'rt-BaseMenuItem',\n 'rt-BaseMenuRadioItem',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuRadioItem',\n className,\n )}\n >\n {children}\n <DropdownMenuPrimitive.ItemIndicator className=\"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator\">\n <ThickDotIcon className=\"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </DropdownMenuPrimitive.RadioItem>\n );\n});\nDropdownMenuRadioItem.displayName = 'DropdownMenu.RadioItem';\n\ntype DropdownMenuCheckboxItemElement = React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>;\ntype DropdownMenuCheckboxItemOwnProps = GetPropDefTypes<typeof dropdownMenuCheckboxItemPropDefs>;\ninterface DropdownMenuCheckboxItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.CheckboxItem, RemovedProps>,\n DropdownMenuCheckboxItemOwnProps {}\nconst DropdownMenuCheckboxItem = React.forwardRef<\n DropdownMenuCheckboxItemElement,\n DropdownMenuCheckboxItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n shortcut,\n color = dropdownMenuCheckboxItemPropDefs.color.default,\n ...itemProps\n } = props;\n return (\n <DropdownMenuPrimitive.CheckboxItem\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'rt-BaseMenuItem',\n 'rt-BaseMenuCheckboxItem',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuCheckboxItem',\n className,\n )}\n >\n {children}\n <DropdownMenuPrimitive.ItemIndicator className=\"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator\">\n <ThickCheckIcon className=\"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon\" />\n </DropdownMenuPrimitive.ItemIndicator>\n {shortcut && (\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <Kbd size=\"1\">{shortcut}</Kbd>\n </div>\n )}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\nDropdownMenuCheckboxItem.displayName = 'DropdownMenu.CheckboxItem';\n\n// Generate unique submenu IDs using React 18's useId for SSR safety\nfunction useSubId() {\n return React.useId();\n}\n\ninterface DropdownMenuSubProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Sub> {\n /**\n * Label displayed in the back button when using drill-down mode.\n * If not provided, defaults to \"Back\".\n */\n label?: React.ReactNode;\n}\nconst DropdownMenuSub: React.FC<DropdownMenuSubProps> = ({ label = 'Back', ...props }) => {\n const drillDown = useDrillDownOptional();\n const subId = useSubId();\n\n // Create context value for SubContent and SubTrigger\n const subContextValue = React.useMemo(\n () => ({ id: subId, label }),\n [subId, label]\n );\n\n // In drill-down mode, we don't use Radix's Sub component\n // We just provide the SubContext and render children\n if (drillDown?.behavior === 'drill-down') {\n return (\n <SubContext.Provider value={subContextValue}>\n {props.children}\n </SubContext.Provider>\n );\n }\n\n // In cascade mode, use Radix's Sub component normally\n return (\n <SubContext.Provider value={subContextValue}>\n <DropdownMenuPrimitive.Sub {...props} />\n </SubContext.Provider>\n );\n};\nDropdownMenuSub.displayName = 'DropdownMenu.Sub';\n\ntype DropdownMenuSubTriggerElement = React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>;\ninterface DropdownMenuSubTriggerProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubTrigger, RemovedProps> {}\nconst DropdownMenuSubTrigger = React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>((props, forwardedRef) => {\n const { className, children, onClick, ...subTriggerProps } = props;\n const drillDown = useDrillDownOptional();\n const subContext = useSubContext();\n\n // In drill-down mode, render a button that navigates to the submenu\n if (drillDown?.behavior === 'drill-down' && subContext) {\n const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {\n e.preventDefault();\n drillDown.push(subContext.id);\n (onClick as React.MouseEventHandler<HTMLDivElement> | undefined)?.(e);\n };\n\n return (\n <div\n role=\"menuitem\"\n tabIndex={0}\n ref={forwardedRef as React.Ref<HTMLDivElement>}\n onClick={handleClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n drillDown.push(subContext.id);\n }\n }}\n className={classNames(\n 'rt-reset',\n 'rt-BaseMenuItem',\n 'rt-BaseMenuSubTrigger',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuSubTrigger',\n 'rt-DropdownMenuDrillDownSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <ThickChevronRightIcon className=\"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon\" />\n </div>\n </div>\n );\n }\n\n // In cascade mode, use Radix's SubTrigger\n return (\n <DropdownMenuPrimitive.SubTrigger\n {...subTriggerProps}\n onClick={onClick as React.MouseEventHandler<HTMLDivElement> | undefined}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'rt-BaseMenuItem',\n 'rt-BaseMenuSubTrigger',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"rt-BaseMenuShortcut rt-DropdownMenuShortcut\">\n <ThickChevronRightIcon className=\"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon\" />\n </div>\n </DropdownMenuPrimitive.SubTrigger>\n );\n});\nDropdownMenuSubTrigger.displayName = 'DropdownMenu.SubTrigger';\n\n// Separator is defined here (before SubContent) because it's used in drill-down mode\ntype DropdownMenuSeparatorElement = React.ElementRef<typeof DropdownMenuPrimitive.Separator>;\ninterface DropdownMenuSeparatorProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Separator, RemovedProps> {}\nconst DropdownMenuSeparator = React.forwardRef<\n DropdownMenuSeparatorElement,\n DropdownMenuSeparatorProps\n>(({ className, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Separator\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuSeparator', 'rt-DropdownMenuSeparator', className)}\n />\n));\nDropdownMenuSeparator.displayName = 'DropdownMenu.Separator';\n\n/**\n * Internal component for the drill-down back button.\n */\nfunction DrillDownBackItem({ label }: { label: React.ReactNode }) {\n const drillDown = useDrillDown();\n\n return (\n <div\n role=\"menuitem\"\n tabIndex={0}\n onClick={(e) => {\n e.preventDefault();\n drillDown.pop();\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n drillDown.pop();\n }\n }}\n className={classNames(\n 'rt-reset',\n 'rt-BaseMenuItem',\n 'rt-DropdownMenuItem',\n 'rt-DropdownMenuDrillDownBackItem',\n )}\n >\n <ThickChevronLeftIcon className=\"rt-DropdownMenuDrillDownBackIcon\" />\n <span className=\"rt-DropdownMenuDrillDownBackLabel\">{label}</span>\n </div>\n );\n}\n\ntype DropdownMenuSubContentElement = React.ElementRef<typeof DropdownMenuPrimitive.SubContent>;\ninterface DropdownMenuSubContentProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubContent, RemovedProps>,\n DropdownMenuContentContextValue {\n container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];\n}\nconst DropdownMenuSubContent = React.forwardRef<\n DropdownMenuSubContentElement,\n DropdownMenuSubContentProps\n>((props, forwardedRef) => {\n // Memoize context consumption to prevent unnecessary re-renders\n const contextValue = React.useContext(DropdownMenuContentContext);\n const { size, variant, color, highContrast, material } = React.useMemo(\n () => contextValue,\n [contextValue],\n );\n const drillDown = useDrillDownOptional();\n const subContext = useSubContext();\n\n const {\n className,\n children,\n container,\n forceMount,\n material: _,\n panelBackground: __,\n ...subContentProps\n } = extractProps(\n { size, variant, color, highContrast, material, ...props },\n dropdownMenuSubContentPropDefs,\n );\n\n // In drill-down mode, render inline instead of in a portal\n if (drillDown?.behavior === 'drill-down' && subContext) {\n const isActive = drillDown.isActive(subContext.id);\n\n return (\n <div\n ref={forwardedRef as React.Ref<HTMLDivElement>}\n role=\"menu\"\n aria-label={typeof subContext.label === 'string' ? subContext.label : undefined}\n data-drill-down-active={isActive ? true : undefined}\n data-animation-direction={drillDown.animationDirection ?? undefined}\n className={classNames(\n 'rt-DropdownMenuDrillDownPanel',\n className,\n )}\n >\n <DrillDownBackItem label={subContext.label} />\n <DropdownMenuSeparator />\n {children}\n </div>\n );\n }\n\n // In cascade mode, use Portal and Radix's SubContent\n return (\n <DropdownMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DropdownMenuPrimitive.SubContent\n data-accent-color={color}\n data-material={material}\n data-panel-background={material}\n alignOffset={-Number(size) * 4}\n // Side offset accounts for the outer solid box-shadow\n sideOffset={1}\n collisionPadding={10}\n {...subContentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'rt-PopperContent',\n 'rt-BaseMenuContent',\n 'rt-BaseMenuSubContent',\n 'rt-DropdownMenuContent',\n 'rt-DropdownMenuSubContent',\n className,\n )}\n >\n <ScrollArea type=\"auto\">\n <div className={classNames('rt-BaseMenuViewport', 'rt-DropdownMenuViewport')}>\n {children}\n </div>\n </ScrollArea>\n </DropdownMenuPrimitive.SubContent>\n </Theme>\n </DropdownMenuPrimitive.Portal>\n );\n});\nDropdownMenuSubContent.displayName = 'DropdownMenu.SubContent';\n\ntype DropdownMenuTriggerIconElement = React.ElementRef<'svg'>;\ninterface DropdownMenuTriggerIconProps extends IconProps {}\nconst DropdownMenuTriggerIcon = React.forwardRef<\n DropdownMenuTriggerIconElement,\n DropdownMenuTriggerIconProps\n>((props, forwardedRef) => (\n <ChevronDownIcon {...props} ref={forwardedRef} className=\"rt-DropdownMenuTriggerIcon\" />\n));\nDropdownMenuTriggerIcon.displayName = 'DropdownMenu.TriggerIcon';\n\nexport {\n DropdownMenuRoot as Root,\n DropdownMenuTrigger as Trigger,\n DropdownMenuTriggerIcon as TriggerIcon,\n DropdownMenuContent as Content,\n DropdownMenuLabel as Label,\n DropdownMenuItem as Item,\n DropdownMenuGroup as Group,\n DropdownMenuRadioGroup as RadioGroup,\n DropdownMenuRadioItem as RadioItem,\n DropdownMenuCheckboxItem as CheckboxItem,\n DropdownMenuSub as Sub,\n DropdownMenuSubTrigger as SubTrigger,\n DropdownMenuSubContent as SubContent,\n DropdownMenuSeparator as Separator,\n};\n\nexport type {\n DropdownMenuRootProps as RootProps,\n DropdownMenuTriggerProps as TriggerProps,\n DropdownMenuTriggerIconProps as TriggerIconProps,\n DropdownMenuContentProps as ContentProps,\n DropdownMenuLabelProps as LabelProps,\n DropdownMenuItemProps as ItemProps,\n DropdownMenuGroupProps as GroupProps,\n DropdownMenuRadioGroupProps as RadioGroupProps,\n DropdownMenuRadioItemProps as RadioItemProps,\n DropdownMenuCheckboxItemProps as CheckboxItemProps,\n DropdownMenuSubProps as SubProps,\n DropdownMenuSubTriggerProps as SubTriggerProps,\n DropdownMenuSubContentProps as SubContentProps,\n DropdownMenuSeparatorProps as SeparatorProps,\n SubmenuBehavior,\n};\n"],
|
|
5
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", "dropdownMenuSubContentPropDefs", "dropdownMenuItemPropDefs", "dropdownMenuCheckboxItemPropDefs", "dropdownMenuRadioItemPropDefs", "Theme", "useThemeContext", "ChevronDownIcon", "ThickCheckIcon", "ThickChevronLeftIcon", "ThickChevronRightIcon", "ThickDotIcon", "extractProps", "DrillDownProvider", "SubContext", "useDrillDown", "useDrillDownOptional", "useSubContext", "requireReactElement", "Kbd", "DropdownMenuRoot", "props", "DropdownMenuTrigger", "children", "forwardedRef", "DrillDownRoot", "drillDown", "DropdownMenuContentContext", "DropdownMenuContent", "themeContext", "effectiveMaterial", "memoizedThemeContext", "size", "variant", "highContrast", "material", "submenuBehavior", "className", "color", "container", "forceMount", "_", "__", "___", "contentProps", "resolvedColor", "DropdownMenuLabel", "DropdownMenuItem", "shortcut", "itemProps", "DropdownMenuGroup", "DropdownMenuRadioGroup", "DropdownMenuRadioItem", "DropdownMenuCheckboxItem", "useSubId", "DropdownMenuSub", "label", "subId", "subContextValue", "DropdownMenuSubTrigger", "onClick", "subTriggerProps", "subContext", "e", "DropdownMenuSeparator", "DrillDownBackItem", "DropdownMenuSubContent", "contextValue", "subContentProps", "isActive", "DropdownMenuTriggerIcon"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kushagradhawan/kookie-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.127",
|
|
4
4
|
"description": "A modern React component library with beautiful design tokens, flexible theming, and comprehensive documentation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
"react-dom": "^19.0.0",
|
|
190
190
|
"stylelint": "16.6.1",
|
|
191
191
|
"tsd": "^0.33.0",
|
|
192
|
-
"typescript": "
|
|
192
|
+
"typescript": "~5.8.0",
|
|
193
193
|
"typescript-eslint": "^8.18.1",
|
|
194
194
|
"vitest": "^4.0.16"
|
|
195
195
|
},
|
package/schemas/base-button.json
CHANGED
|
@@ -279,6 +279,6 @@
|
|
|
279
279
|
"title": "Base-button Component Props",
|
|
280
280
|
"description": "Props schema for the base-button component in Kookie UI",
|
|
281
281
|
"version": "1.0.0",
|
|
282
|
-
"generatedAt": "2026-01-
|
|
282
|
+
"generatedAt": "2026-01-12T19:07:54.808Z",
|
|
283
283
|
"source": "Zod schema"
|
|
284
284
|
}
|
package/schemas/button.json
CHANGED
|
@@ -530,6 +530,6 @@
|
|
|
530
530
|
"title": "Button Component Props",
|
|
531
531
|
"description": "Props schema for the button component in Kookie UI",
|
|
532
532
|
"version": "1.0.0",
|
|
533
|
-
"generatedAt": "2026-01-
|
|
533
|
+
"generatedAt": "2026-01-12T19:07:54.814Z",
|
|
534
534
|
"source": "Zod schema"
|
|
535
535
|
}
|
package/schemas/icon-button.json
CHANGED
|
@@ -313,6 +313,6 @@
|
|
|
313
313
|
"title": "Icon-button Component Props",
|
|
314
314
|
"description": "Props schema for the icon-button component in Kookie UI",
|
|
315
315
|
"version": "1.0.0",
|
|
316
|
-
"generatedAt": "2026-01-
|
|
316
|
+
"generatedAt": "2026-01-12T19:07:54.815Z",
|
|
317
317
|
"source": "Zod schema"
|
|
318
318
|
}
|
package/schemas/index.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"title": "Kookie UI Button Components",
|
|
4
4
|
"description": "Complete JSON Schema collection for all button components in Kookie UI",
|
|
5
5
|
"version": "1.0.0",
|
|
6
|
-
"generatedAt": "2026-01-
|
|
6
|
+
"generatedAt": "2026-01-12T19:07:54.818Z",
|
|
7
7
|
"source": "Zod schemas",
|
|
8
8
|
"components": {
|
|
9
9
|
"base-button": {
|
|
@@ -287,7 +287,7 @@
|
|
|
287
287
|
"title": "Base-button Component Props",
|
|
288
288
|
"description": "Props schema for the base-button component in Kookie UI",
|
|
289
289
|
"version": "1.0.0",
|
|
290
|
-
"generatedAt": "2026-01-
|
|
290
|
+
"generatedAt": "2026-01-12T19:07:54.808Z",
|
|
291
291
|
"source": "Zod schema"
|
|
292
292
|
},
|
|
293
293
|
"button": {
|
|
@@ -822,7 +822,7 @@
|
|
|
822
822
|
"title": "Button Component Props",
|
|
823
823
|
"description": "Props schema for the button component in Kookie UI",
|
|
824
824
|
"version": "1.0.0",
|
|
825
|
-
"generatedAt": "2026-01-
|
|
825
|
+
"generatedAt": "2026-01-12T19:07:54.814Z",
|
|
826
826
|
"source": "Zod schema"
|
|
827
827
|
},
|
|
828
828
|
"icon-button": {
|
|
@@ -1140,7 +1140,7 @@
|
|
|
1140
1140
|
"title": "Icon-button Component Props",
|
|
1141
1141
|
"description": "Props schema for the icon-button component in Kookie UI",
|
|
1142
1142
|
"version": "1.0.0",
|
|
1143
|
-
"generatedAt": "2026-01-
|
|
1143
|
+
"generatedAt": "2026-01-12T19:07:54.815Z",
|
|
1144
1144
|
"source": "Zod schema"
|
|
1145
1145
|
},
|
|
1146
1146
|
"toggle-button": {
|
|
@@ -1683,7 +1683,7 @@
|
|
|
1683
1683
|
"title": "Toggle-button Component Props",
|
|
1684
1684
|
"description": "Props schema for the toggle-button component in Kookie UI",
|
|
1685
1685
|
"version": "1.0.0",
|
|
1686
|
-
"generatedAt": "2026-01-
|
|
1686
|
+
"generatedAt": "2026-01-12T19:07:54.817Z",
|
|
1687
1687
|
"source": "Zod schema"
|
|
1688
1688
|
},
|
|
1689
1689
|
"toggle-icon-button": {
|
|
@@ -2009,7 +2009,7 @@
|
|
|
2009
2009
|
"title": "Toggle-icon-button Component Props",
|
|
2010
2010
|
"description": "Props schema for the toggle-icon-button component in Kookie UI",
|
|
2011
2011
|
"version": "1.0.0",
|
|
2012
|
-
"generatedAt": "2026-01-
|
|
2012
|
+
"generatedAt": "2026-01-12T19:07:54.818Z",
|
|
2013
2013
|
"source": "Zod schema"
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
@@ -538,6 +538,6 @@
|
|
|
538
538
|
"title": "Toggle-button Component Props",
|
|
539
539
|
"description": "Props schema for the toggle-button component in Kookie UI",
|
|
540
540
|
"version": "1.0.0",
|
|
541
|
-
"generatedAt": "2026-01-
|
|
541
|
+
"generatedAt": "2026-01-12T19:07:54.817Z",
|
|
542
542
|
"source": "Zod schema"
|
|
543
543
|
}
|
|
@@ -321,6 +321,6 @@
|
|
|
321
321
|
"title": "Toggle-icon-button Component Props",
|
|
322
322
|
"description": "Props schema for the toggle-icon-button component in Kookie UI",
|
|
323
323
|
"version": "1.0.0",
|
|
324
|
-
"generatedAt": "2026-01-
|
|
324
|
+
"generatedAt": "2026-01-12T19:07:54.818Z",
|
|
325
325
|
"source": "Zod schema"
|
|
326
326
|
}
|
|
@@ -111,6 +111,8 @@ function resolveResponsiveValue<T>(
|
|
|
111
111
|
// DrillDown Context
|
|
112
112
|
// ============================================================================
|
|
113
113
|
|
|
114
|
+
type AnimationDirection = 'forward' | 'backward' | null;
|
|
115
|
+
|
|
114
116
|
interface DrillDownContextValue {
|
|
115
117
|
/** Current submenu behavior mode */
|
|
116
118
|
behavior: SubmenuBehavior;
|
|
@@ -130,6 +132,8 @@ interface DrillDownContextValue {
|
|
|
130
132
|
isRoot: boolean;
|
|
131
133
|
/** The currently active submenu ID (or null if at root) */
|
|
132
134
|
currentId: string | null;
|
|
135
|
+
/** Current animation direction for transitions */
|
|
136
|
+
animationDirection: AnimationDirection;
|
|
133
137
|
}
|
|
134
138
|
|
|
135
139
|
const DrillDownContext = React.createContext<DrillDownContextValue | null>(null);
|
|
@@ -142,6 +146,7 @@ interface DrillDownProviderProps {
|
|
|
142
146
|
function DrillDownProvider({ children, submenuBehavior }: DrillDownProviderProps) {
|
|
143
147
|
const { breakpoint, ready } = useBreakpoint();
|
|
144
148
|
const [stack, setStack] = React.useState<string[]>([]);
|
|
149
|
+
const [animationDirection, setAnimationDirection] = React.useState<AnimationDirection>(null);
|
|
145
150
|
|
|
146
151
|
// Resolve the current behavior based on breakpoint
|
|
147
152
|
const behavior = React.useMemo(
|
|
@@ -154,20 +159,24 @@ function DrillDownProvider({ children, submenuBehavior }: DrillDownProviderProps
|
|
|
154
159
|
React.useEffect(() => {
|
|
155
160
|
if (prevBehaviorRef.current === 'drill-down' && behavior === 'cascade') {
|
|
156
161
|
setStack([]);
|
|
162
|
+
setAnimationDirection(null);
|
|
157
163
|
}
|
|
158
164
|
prevBehaviorRef.current = behavior;
|
|
159
165
|
}, [behavior]);
|
|
160
166
|
|
|
161
167
|
const push = React.useCallback((id: string) => {
|
|
168
|
+
setAnimationDirection('forward');
|
|
162
169
|
setStack((prev) => [...prev, id]);
|
|
163
170
|
}, []);
|
|
164
171
|
|
|
165
172
|
const pop = React.useCallback(() => {
|
|
173
|
+
setAnimationDirection('backward');
|
|
166
174
|
setStack((prev) => prev.slice(0, -1));
|
|
167
175
|
}, []);
|
|
168
176
|
|
|
169
177
|
const reset = React.useCallback(() => {
|
|
170
178
|
setStack([]);
|
|
179
|
+
setAnimationDirection(null);
|
|
171
180
|
}, []);
|
|
172
181
|
|
|
173
182
|
const isActive = React.useCallback(
|
|
@@ -189,8 +198,9 @@ function DrillDownProvider({ children, submenuBehavior }: DrillDownProviderProps
|
|
|
189
198
|
isActive,
|
|
190
199
|
isRoot: stack.length === 0,
|
|
191
200
|
currentId: stack.length > 0 ? stack[stack.length - 1] : null,
|
|
201
|
+
animationDirection,
|
|
192
202
|
}),
|
|
193
|
-
[behavior, ready, stack, push, pop, reset, isActive]
|
|
203
|
+
[behavior, ready, stack, push, pop, reset, isActive, animationDirection]
|
|
194
204
|
);
|
|
195
205
|
|
|
196
206
|
return <DrillDownContext.Provider value={value}>{children}</DrillDownContext.Provider>;
|
|
@@ -239,4 +249,4 @@ export {
|
|
|
239
249
|
resolveResponsiveValue,
|
|
240
250
|
};
|
|
241
251
|
|
|
242
|
-
export type { SubmenuBehavior, DrillDownContextValue, SubContextValue };
|
|
252
|
+
export type { SubmenuBehavior, DrillDownContextValue, SubContextValue, AnimationDirection };
|
|
@@ -95,6 +95,17 @@
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/* Drill-down menu keyframes */
|
|
99
|
+
@keyframes rt-drill-down-enter-from-right {
|
|
100
|
+
from { opacity: 0; transform: translateX(30%); }
|
|
101
|
+
to { opacity: 1; transform: translateX(0); }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@keyframes rt-drill-down-enter-from-left {
|
|
105
|
+
from { opacity: 0; transform: translateX(-30%); }
|
|
106
|
+
to { opacity: 1; transform: translateX(0); }
|
|
107
|
+
}
|
|
108
|
+
|
|
98
109
|
/* Dialog keyframes (centralized) */
|
|
99
110
|
@keyframes rt-dialog-overlay-no-op {
|
|
100
111
|
from { opacity: 1; }
|
|
@@ -163,3 +163,25 @@
|
|
|
163
163
|
outline-offset: 2px;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
+
|
|
167
|
+
/***************************************************************************************************
|
|
168
|
+
* *
|
|
169
|
+
* DRILL-DOWN ANIMATIONS *
|
|
170
|
+
* *
|
|
171
|
+
***************************************************************************************************/
|
|
172
|
+
|
|
173
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
174
|
+
/* Active panel items animate in based on direction */
|
|
175
|
+
.rt-DropdownMenuDrillDownPanel:where([data-drill-down-active][data-animation-direction='forward']) > :where(*:not(.rt-DropdownMenuDrillDownPanel)) {
|
|
176
|
+
animation: rt-drill-down-enter-from-right var(--motion-duration-small) var(--motion-ease-smooth);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.rt-DropdownMenuDrillDownPanel:where([data-drill-down-active][data-animation-direction='backward']) > :where(*:not(.rt-DropdownMenuDrillDownPanel)) {
|
|
180
|
+
animation: rt-drill-down-enter-from-left var(--motion-duration-small) var(--motion-ease-smooth);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* Root items animate when returning from a submenu */
|
|
184
|
+
.rt-DropdownMenuDrillDownRoot:where(:not([data-drill-down-active])[data-animation-direction='backward']) > :where(*:not(.rt-DropdownMenuDrillDownPanel)) {
|
|
185
|
+
animation: rt-drill-down-enter-from-left var(--motion-duration-small) var(--motion-ease-smooth);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -66,6 +66,7 @@ function DrillDownRoot({ children }: { children: React.ReactNode }) {
|
|
|
66
66
|
<div
|
|
67
67
|
className="rt-DropdownMenuDrillDownRoot"
|
|
68
68
|
data-drill-down-active={drillDown.isRoot ? undefined : true}
|
|
69
|
+
data-animation-direction={drillDown.animationDirection ?? undefined}
|
|
69
70
|
>
|
|
70
71
|
{children}
|
|
71
72
|
</div>
|
|
@@ -556,6 +557,7 @@ const DropdownMenuSubContent = React.forwardRef<
|
|
|
556
557
|
role="menu"
|
|
557
558
|
aria-label={typeof subContext.label === 'string' ? subContext.label : undefined}
|
|
558
559
|
data-drill-down-active={isActive ? true : undefined}
|
|
560
|
+
data-animation-direction={drillDown.animationDirection ?? undefined}
|
|
559
561
|
className={classNames(
|
|
560
562
|
'rt-DropdownMenuDrillDownPanel',
|
|
561
563
|
className,
|
package/styles.css
CHANGED
|
@@ -5422,6 +5422,26 @@
|
|
|
5422
5422
|
animation: rt-tab-indicator-appear var(--motion-duration-small) var(--motion-spring-snappy);
|
|
5423
5423
|
}
|
|
5424
5424
|
}
|
|
5425
|
+
@keyframes rt-drill-down-enter-from-right {
|
|
5426
|
+
from{
|
|
5427
|
+
opacity: 0;
|
|
5428
|
+
transform: translateX(30%);
|
|
5429
|
+
}
|
|
5430
|
+
to{
|
|
5431
|
+
opacity: 1;
|
|
5432
|
+
transform: translateX(0);
|
|
5433
|
+
}
|
|
5434
|
+
}
|
|
5435
|
+
@keyframes rt-drill-down-enter-from-left {
|
|
5436
|
+
from{
|
|
5437
|
+
opacity: 0;
|
|
5438
|
+
transform: translateX(-30%);
|
|
5439
|
+
}
|
|
5440
|
+
to{
|
|
5441
|
+
opacity: 1;
|
|
5442
|
+
transform: translateX(0);
|
|
5443
|
+
}
|
|
5444
|
+
}
|
|
5425
5445
|
@keyframes rt-dialog-overlay-no-op {
|
|
5426
5446
|
from{
|
|
5427
5447
|
opacity: 1;
|
|
@@ -13773,6 +13793,17 @@
|
|
|
13773
13793
|
outline-offset: 2px;
|
|
13774
13794
|
}
|
|
13775
13795
|
}
|
|
13796
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
13797
|
+
.rt-DropdownMenuDrillDownPanel:where([data-drill-down-active][data-animation-direction='forward']) > :where(*:not(.rt-DropdownMenuDrillDownPanel)){
|
|
13798
|
+
animation: rt-drill-down-enter-from-right var(--motion-duration-small) var(--motion-ease-smooth);
|
|
13799
|
+
}
|
|
13800
|
+
.rt-DropdownMenuDrillDownPanel:where([data-drill-down-active][data-animation-direction='backward']) > :where(*:not(.rt-DropdownMenuDrillDownPanel)){
|
|
13801
|
+
animation: rt-drill-down-enter-from-left var(--motion-duration-small) var(--motion-ease-smooth);
|
|
13802
|
+
}
|
|
13803
|
+
.rt-DropdownMenuDrillDownRoot:where(:not([data-drill-down-active])[data-animation-direction='backward']) > :where(*:not(.rt-DropdownMenuDrillDownPanel)){
|
|
13804
|
+
animation: rt-drill-down-enter-from-left var(--motion-duration-small) var(--motion-ease-smooth);
|
|
13805
|
+
}
|
|
13806
|
+
}
|
|
13776
13807
|
:where([data-panel-background='translucent'], [data-material='translucent']) .rt-TextFieldRoot{
|
|
13777
13808
|
-webkit-backdrop-filter: var(--backdrop-filter-components);
|
|
13778
13809
|
backdrop-filter: var(--backdrop-filter-components);
|