@womp/kookie-ui 0.32.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components.css +288 -35
- package/dist/cjs/components/_internal/pane-chrome.js +1 -1
- package/dist/cjs/components/_internal/pane-chrome.js.map +2 -2
- package/dist/cjs/components/_internal/shell-bottom.d.ts +7 -2
- package/dist/cjs/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
- package/dist/cjs/components/_internal/shell-inspector.d.ts +7 -2
- package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
- package/dist/cjs/components/_internal/shell-pane.js +1 -1
- package/dist/cjs/components/_internal/shell-pane.js.map +2 -2
- package/dist/cjs/components/_internal/shell-sidebar.d.ts +7 -2
- package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/cjs/components/_internal/shell-store.d.ts +6 -6
- package/dist/cjs/components/_internal/shell-store.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-store.js +1 -1
- package/dist/cjs/components/_internal/shell-store.js.map +3 -3
- package/dist/cjs/components/command.d.ts +133 -0
- package/dist/cjs/components/command.d.ts.map +1 -0
- package/dist/cjs/components/command.js +3 -0
- package/dist/cjs/components/command.js.map +7 -0
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.d.ts.map +1 -1
- package/dist/cjs/components/index.js +2 -2
- package/dist/cjs/components/index.js.map +4 -4
- package/dist/cjs/components/navigator.js +1 -1
- package/dist/cjs/components/navigator.js.map +2 -2
- package/dist/cjs/components/shell.context.js +1 -1
- package/dist/cjs/components/shell.context.js.map +2 -2
- package/dist/cjs/components/shell.d.ts +25 -7
- package/dist/cjs/components/shell.d.ts.map +1 -1
- package/dist/cjs/components/shell.hooks.js +1 -1
- package/dist/cjs/components/shell.hooks.js.map +2 -2
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +3 -3
- package/dist/cjs/components/toolbar.js +1 -1
- package/dist/cjs/components/toolbar.js.map +2 -2
- package/dist/cjs/index.js +5 -5
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/chunk-5BXCPANF.js +3 -0
- package/dist/esm/{chunk-GHWEXMF6.js.map → chunk-5BXCPANF.js.map} +3 -3
- package/dist/esm/{chunk-K35JUIUT.js → chunk-API4DAPY.js} +2 -2
- package/dist/esm/{chunk-ZG2XQUOH.js → chunk-B447PNRD.js} +2 -2
- package/dist/esm/{chunk-QDAM2I6O.js → chunk-BR6Z2CAE.js} +2 -2
- package/dist/esm/{chunk-W35ZKQMQ.js → chunk-CAM66IXC.js} +2 -2
- package/dist/esm/chunk-GZPB6MRQ.js +3 -0
- package/dist/esm/chunk-GZPB6MRQ.js.map +7 -0
- package/dist/esm/{chunk-4G3FJUER.js → chunk-INGT6DB6.js} +2 -2
- package/dist/esm/{chunk-4ZHBNYXM.js → chunk-J6B7UCZN.js} +2 -2
- package/dist/esm/chunk-KDJM4NQQ.js +3 -0
- package/dist/esm/chunk-KDJM4NQQ.js.map +7 -0
- package/dist/esm/{chunk-LTUW36HM.js → chunk-KGCGT4MJ.js} +2 -2
- package/dist/esm/chunk-NO2JCJWI.js +3 -0
- package/dist/esm/chunk-NO2JCJWI.js.map +7 -0
- package/dist/esm/{chunk-6WHKGVWY.js → chunk-NZJRXZYX.js} +2 -2
- package/dist/esm/{chunk-NFSW36RG.js → chunk-ODHCDJ3Y.js} +2 -2
- package/dist/esm/chunk-SHKPQ3RI.js +2 -0
- package/dist/esm/chunk-UMQOTGJC.js +3 -0
- package/dist/esm/chunk-UMQOTGJC.js.map +7 -0
- package/dist/esm/chunk-XD676L6S.js +3 -0
- package/dist/esm/chunk-XD676L6S.js.map +7 -0
- package/dist/esm/{chunk-6SGJWML7.js → chunk-XKYPJTRN.js} +2 -2
- package/dist/esm/components/_internal/pane-chrome.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.d.ts +7 -2
- package/dist/esm/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +1 -1
- package/dist/esm/components/_internal/shell-inspector.d.ts +7 -2
- package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-inspector.js +1 -1
- package/dist/esm/components/_internal/shell-pane.js +1 -1
- package/dist/esm/components/_internal/shell-sidebar.d.ts +7 -2
- package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/_internal/shell-store.d.ts +6 -6
- package/dist/esm/components/_internal/shell-store.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-store.js +1 -1
- package/dist/esm/components/alert-dialog.js +1 -1
- package/dist/esm/components/command.d.ts +133 -0
- package/dist/esm/components/command.d.ts.map +1 -0
- package/dist/esm/components/command.js +3 -0
- package/dist/esm/components/command.js.map +7 -0
- package/dist/esm/components/dialog.js +1 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/navigator.js +1 -1
- package/dist/esm/components/sheet.js +1 -1
- package/dist/esm/components/shell.context.js +1 -1
- package/dist/esm/components/shell.d.ts +25 -7
- package/dist/esm/components/shell.d.ts.map +1 -1
- package/dist/esm/components/shell.hooks.js +1 -1
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/sidebar.js +1 -1
- package/dist/esm/components/toolbar.js +1 -1
- package/dist/esm/hooks/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
- package/src/components/_internal/shell-bottom.tsx +11 -6
- package/src/components/_internal/shell-inspector.tsx +11 -6
- package/src/components/_internal/shell-sidebar.tsx +11 -6
- package/src/components/_internal/shell-store.tsx +13 -13
- package/src/components/command.css +197 -0
- package/src/components/command.tsx +432 -0
- package/src/components/index.css +1 -0
- package/src/components/index.tsx +24 -0
- package/src/components/shell.css +133 -47
- package/src/components/shell.tsx +50 -32
- package/src/styles/tokens/color.css +2 -0
- package/styles.css +289 -35
- package/tokens/base.css +1 -0
- package/tokens.css +1 -0
- package/dist/esm/chunk-4B3S2DM7.js +0 -3
- package/dist/esm/chunk-4B3S2DM7.js.map +0 -7
- package/dist/esm/chunk-AKMRPGNP.js +0 -3
- package/dist/esm/chunk-AKMRPGNP.js.map +0 -7
- package/dist/esm/chunk-GHWEXMF6.js +0 -3
- package/dist/esm/chunk-RSG4XWHU.js +0 -2
- package/dist/esm/chunk-ZBSGH74F.js +0 -3
- package/dist/esm/chunk-ZBSGH74F.js.map +0 -7
- package/dist/esm/chunk-ZHXEEOGI.js +0 -3
- package/dist/esm/chunk-ZHXEEOGI.js.map +0 -7
- /package/dist/esm/{chunk-K35JUIUT.js.map → chunk-API4DAPY.js.map} +0 -0
- /package/dist/esm/{chunk-ZG2XQUOH.js.map → chunk-B447PNRD.js.map} +0 -0
- /package/dist/esm/{chunk-QDAM2I6O.js.map → chunk-BR6Z2CAE.js.map} +0 -0
- /package/dist/esm/{chunk-W35ZKQMQ.js.map → chunk-CAM66IXC.js.map} +0 -0
- /package/dist/esm/{chunk-4G3FJUER.js.map → chunk-INGT6DB6.js.map} +0 -0
- /package/dist/esm/{chunk-4ZHBNYXM.js.map → chunk-J6B7UCZN.js.map} +0 -0
- /package/dist/esm/{chunk-LTUW36HM.js.map → chunk-KGCGT4MJ.js.map} +0 -0
- /package/dist/esm/{chunk-6WHKGVWY.js.map → chunk-NZJRXZYX.js.map} +0 -0
- /package/dist/esm/{chunk-NFSW36RG.js.map → chunk-ODHCDJ3Y.js.map} +0 -0
- /package/dist/esm/{chunk-RSG4XWHU.js.map → chunk-SHKPQ3RI.js.map} +0 -0
- /package/dist/esm/{chunk-6SGJWML7.js.map → chunk-XKYPJTRN.js.map} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{b as a}from"./chunk-MAA6LEE2.js";import*as o from"react";import{useLayoutEffect as p}from"radix-ui/internal";function s(e){return typeof e=="object"&&e!==null}function f(e,n){let t={},r=null;for(let i of a){if(e!==void 0&&!s(e)){t[i]=e;continue}let l=s(e)?e[i]:void 0;l!==void 0&&(r={value:l}),t[i]=r?r.value:n(i)}return t}function d(e){let n=e.initial;return a.every(t=>e[t]===n)?n:void 0}function P(e,n){let t=d(n);if(t!==void 0)return{[`data-${e}`]:t};let r={};for(let i of a)r[`data-${e}-${i}`]=n[i];return r}function T(e){return typeof e=="object"&&e!==null?JSON.stringify(e):String(e)}var g=f("fixed",()=>"fixed");function R(){return{entries:new Map,listeners:new Set,version:0,peek:null}}function S(e){e.version+=1;for(let n of e.listeners)n()}function c(e,n){return e.listeners.add(n),()=>{e.listeners.delete(n)}}function y(e,n){e.peek!==n&&(e.peek=n,S(e))}var b=o.createContext(null);function k(e){let n=o.useContext(b);if(!n)throw new Error(`${e} must be used within <Shell.Root>`);return n}function v(e,n){let t=o.useCallback(i=>c(e,i),[e]),r=o.useCallback(()=>e.entries.get(n),[e,n]);return o.useSyncExternalStore(t,r,()=>{})}function E(e,n){let t=o.useCallback(r=>c(e,r),[e]);return o.useSyncExternalStore(t,()=>e.peek===n,()=>!1)}var x=o.createContext(null);function w(e,n){let t=o.useContext(x);if(!t)throw new Error("Shell panes must be used within <Shell.Root>");let{registerOffFrame:r,unregisterOffFrame:i}=t;p(()=>{if(!n)return r(e),()=>i(e)},[e,n,r,i])}var u=new Set;function O(e){}export{f as a,d as b,P as c,T as d,g as e,R as f,S as g,c as h,y as i,b as j,k,v as l,E as m,x as n,w as o,O as p};
|
|
3
|
+
//# sourceMappingURL=chunk-5BXCPANF.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/_internal/shell-store.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\n/**\n * The Shell's state model (0.8.0), ported from kookie-ui-v2's Shell.\n *\n * - State lives on the pane. Each pane holds `auto | open | closed`.\n * `auto` means untouched: the stylesheet decides what\n * it shows at each breakpoint, so first paint is right with no script, the\n * server and the client render the same markup, and no open-state callback\n * can fire on mount or on a resize.\n * - The one thing that crosses the Shell is a registry keyed by pane name.\n * Each pane registers what it is and how to drive it; a Trigger looks its\n * pane up, and the Root reads the set of live overlays. Nothing scans\n * children and nothing checks `displayName`.\n * - The responsive props are resolved into a table with one value per\n * breakpoint, from the props alone, with no window. The table is written to\n * the DOM as data attributes for the stylesheet, and read again in JS by the\n * mirror that sets `aria-expanded`. One table, two readers, so they agree by\n * construction.\n */\nimport * as React from 'react';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { SHELL_BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneName, PresentationValue } from '../shell.types.js';\n\n/* \u2500\u2500 Breakpoint tables \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type Table<T> = Record<Breakpoint, T>;\n\n/** What a pane shows: open or closed. */\nexport type PaneValue = 'open' | 'closed';\n\ntype ResponsiveInput<T> = T | Partial<Record<Breakpoint, T>> | undefined;\n\nfunction isMap<T>(value: ResponsiveInput<T>): value is Partial<Record<Breakpoint, T>> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * A responsive value at every breakpoint. A breakpoint takes the largest key\n * at or below it, the same fallback `useResponsiveValue` used; a breakpoint\n * below every key takes `fallback`.\n */\nexport function tableOf<T>(value: ResponsiveInput<T>, fallback: (bp: Breakpoint) => T): Table<T> {\n const table = {} as Table<T>;\n let carried: { value: T } | null = null;\n for (const bp of SHELL_BREAKPOINTS) {\n if (value !== undefined && !isMap(value)) {\n table[bp] = value;\n continue;\n }\n const entry = isMap(value) ? value[bp] : undefined;\n if (entry !== undefined) carried = { value: entry };\n table[bp] = carried ? carried.value : fallback(bp);\n }\n return table;\n}\n\n/** The table's one value, when it has only one. */\nexport function constantOf<T>(table: Table<T>): T | undefined {\n const first = table.initial;\n return SHELL_BREAKPOINTS.every((bp) => table[bp] === first) ? first : undefined;\n}\n\n/**\n * The table as data attributes: `data-<name>` when it holds one value, one\n * `data-<name>-<bp>` per breakpoint when it holds several. The stylesheet has\n * a rule for each spelling.\n */\nexport function tableAttributes(name: string, table: Table<string>): Record<string, string> {\n const constant = constantOf(table);\n if (constant !== undefined) return { [`data-${name}`]: constant };\n const attributes: Record<string, string> = {};\n for (const bp of SHELL_BREAKPOINTS) attributes[`data-${name}-${bp}`] = table[bp];\n return attributes;\n}\n\n/**\n * A responsive prop object is usually an inline literal, a new identity every\n * render. Keying memoisation on its contents keeps the tables, and so the\n * registry entries, stable across renders that change nothing.\n */\nexport function useStableKey(value: unknown): string {\n return typeof value === 'object' && value !== null ? JSON.stringify(value) : String(value);\n}\n\nexport const FIXED_TABLE: Table<PresentationValue> = tableOf<PresentationValue>('fixed', () => 'fixed');\n\n/* \u2500\u2500 The registry \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type OpenChangeReason = 'toggle' | 'dismiss';\n\nexport type PaneEntry = {\n name: PaneName;\n id: string;\n el: HTMLElement | null;\n /** What the pane shows now; `undefined` while an untouched pane cannot know (before the breakpoint is known). */\n value: PaneValue | undefined;\n /** How the pane is presented now, when known. */\n presentation: PresentationValue | undefined;\n /** The pane's own presentation at every breakpoint. A Panel with none of its own follows the Rail's. */\n presentationTable: Table<PresentationValue>;\n /** Open and presented as an overlay: what the scrim and Escape close, and what containment exempts. */\n overlayLive: boolean;\n /** The pane's designed open width, for panes that sit beside it when floating. */\n size: number;\n setValue: (value: PaneValue, reason: OpenChangeReason) => void;\n toggle: (reason: OpenChangeReason) => void;\n};\n\nexport type ShellStore = {\n entries: Map<PaneName, PaneEntry>;\n listeners: Set<() => void>;\n /**\n * What a subscriber reads. useSyncExternalStore needs a value that is stable\n * between notifications, and a number is; the Map, or anything derived from\n * it, would be a new identity on every read.\n */\n version: number;\n /** The pane a hovered Trigger is previewing, if any. Layout only. */\n peek: PaneName | null;\n};\n\nexport function createShellStore(): ShellStore {\n return { entries: new Map(), listeners: new Set(), version: 0, peek: null };\n}\n\nexport function notifyShellStore(store: ShellStore) {\n store.version += 1;\n for (const listener of store.listeners) listener();\n}\n\nexport function subscribeShellStore(store: ShellStore, listener: () => void) {\n store.listeners.add(listener);\n return () => {\n store.listeners.delete(listener);\n };\n}\n\nexport function setShellPeek(store: ShellStore, peek: PaneName | null) {\n if (store.peek === peek) return;\n store.peek = peek;\n notifyShellStore(store);\n}\n\nexport const ShellStoreContext = React.createContext<ShellStore | null>(null);\n\nexport function useShellStore(part: string): ShellStore {\n const store = React.useContext(ShellStoreContext);\n if (!store) throw new Error(`${part} must be used within <Shell.Root>`);\n return store;\n}\n\n/** One pane's registry entry. Re-renders only when that entry is replaced. */\nexport function usePaneEntry(store: ShellStore, name: PaneName): PaneEntry | undefined {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n const getSnapshot = React.useCallback(() => store.entries.get(name), [store, name]);\n return React.useSyncExternalStore(subscribe, getSnapshot, () => undefined);\n}\n\n/**\n * Whether this pane is the one being previewed. A boolean per pane rather than\n * the peek target itself, so hovering one Trigger re-renders one pane, not all.\n */\nexport function usePeeking(store: ShellStore, name: PaneName): boolean {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n return React.useSyncExternalStore(\n subscribe,\n () => store.peek === name,\n () => false,\n );\n}\n\n/* \u2500\u2500
|
|
5
|
-
"mappings": ";wCAoBA,UAAYA,MAAW,QACvB,OAAS,mBAAAC,MAAuB,oBAahC,SAASC,EAASC,EAAoE,CACpF,OAAO,OAAOA,GAAU,UAAYA,IAAU,IAChD,CAOO,SAASC,EAAWD,EAA2BE,EAA2C,CAC/F,IAAMC,EAAQ,CAAC,EACXC,EAA+B,KACnC,QAAWC,KAAMC,EAAmB,CAClC,GAAIN,IAAU,QAAa,CAACD,EAAMC,CAAK,EAAG,CACxCG,EAAME,CAAE,EAAIL,EACZ,QACF,CACA,IAAMO,EAAQR,EAAMC,CAAK,EAAIA,EAAMK,CAAE,EAAI,OACrCE,IAAU,SAAWH,EAAU,CAAE,MAAOG,CAAM,GAClDJ,EAAME,CAAE,EAAID,EAAUA,EAAQ,MAAQF,EAASG,CAAE,CACnD,CACA,OAAOF,CACT,CAGO,SAASK,EAAcL,EAAgC,CAC5D,IAAMM,EAAQN,EAAM,QACpB,OAAOG,EAAkB,MAAOD,GAAOF,EAAME,CAAE,IAAMI,CAAK,EAAIA,EAAQ,MACxE,CAOO,SAASC,EAAgBC,EAAcR,EAA8C,CAC1F,IAAMS,EAAWJ,EAAWL,CAAK,EACjC,GAAIS,IAAa,OAAW,MAAO,CAAE,CAAC,QAAQD,CAAI,EAAE,EAAGC,CAAS,EAChE,IAAMC,EAAqC,CAAC,EAC5C,QAAWR,KAAMC,EAAmBO,EAAW,QAAQF,CAAI,IAAIN,CAAE,EAAE,EAAIF,EAAME,CAAE,EAC/E,O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F,CAMO,IAAMmB,EAA0B,gBAG7B,IAAI,EAGP,SAASC,EAAqBC,EAAiBC,
|
|
6
|
-
"names": ["React", "useLayoutEffect", "isMap", "value", "tableOf", "fallback", "table", "carried", "bp", "SHELL_BREAKPOINTS", "entry", "constantOf", "first", "tableAttributes", "name", "constant", "attributes", "useStableKey", "FIXED_TABLE", "createShellStore", "notifyShellStore", "store", "listener", "subscribeShellStore", "setShellPeek", "peek", "ShellStoreContext", "useShellStore", "part", "usePaneEntry", "subscribe", "getSnapshot", "usePeeking", "
|
|
4
|
+
"sourcesContent": ["'use client';\n\n/**\n * The Shell's state model (0.8.0), ported from kookie-ui-v2's Shell.\n *\n * - State lives on the pane. Each pane holds `auto | open | closed`.\n * `auto` means untouched: the stylesheet decides what\n * it shows at each breakpoint, so first paint is right with no script, the\n * server and the client render the same markup, and no open-state callback\n * can fire on mount or on a resize.\n * - The one thing that crosses the Shell is a registry keyed by pane name.\n * Each pane registers what it is and how to drive it; a Trigger looks its\n * pane up, and the Root reads the set of live overlays. Nothing scans\n * children and nothing checks `displayName`.\n * - The responsive props are resolved into a table with one value per\n * breakpoint, from the props alone, with no window. The table is written to\n * the DOM as data attributes for the stylesheet, and read again in JS by the\n * mirror that sets `aria-expanded`. One table, two readers, so they agree by\n * construction.\n */\nimport * as React from 'react';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { SHELL_BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneName, PresentationValue } from '../shell.types.js';\n\n/* \u2500\u2500 Breakpoint tables \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type Table<T> = Record<Breakpoint, T>;\n\n/** What a pane shows: open or closed. */\nexport type PaneValue = 'open' | 'closed';\n\ntype ResponsiveInput<T> = T | Partial<Record<Breakpoint, T>> | undefined;\n\nfunction isMap<T>(value: ResponsiveInput<T>): value is Partial<Record<Breakpoint, T>> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * A responsive value at every breakpoint. A breakpoint takes the largest key\n * at or below it, the same fallback `useResponsiveValue` used; a breakpoint\n * below every key takes `fallback`.\n */\nexport function tableOf<T>(value: ResponsiveInput<T>, fallback: (bp: Breakpoint) => T): Table<T> {\n const table = {} as Table<T>;\n let carried: { value: T } | null = null;\n for (const bp of SHELL_BREAKPOINTS) {\n if (value !== undefined && !isMap(value)) {\n table[bp] = value;\n continue;\n }\n const entry = isMap(value) ? value[bp] : undefined;\n if (entry !== undefined) carried = { value: entry };\n table[bp] = carried ? carried.value : fallback(bp);\n }\n return table;\n}\n\n/** The table's one value, when it has only one. */\nexport function constantOf<T>(table: Table<T>): T | undefined {\n const first = table.initial;\n return SHELL_BREAKPOINTS.every((bp) => table[bp] === first) ? first : undefined;\n}\n\n/**\n * The table as data attributes: `data-<name>` when it holds one value, one\n * `data-<name>-<bp>` per breakpoint when it holds several. The stylesheet has\n * a rule for each spelling.\n */\nexport function tableAttributes(name: string, table: Table<string>): Record<string, string> {\n const constant = constantOf(table);\n if (constant !== undefined) return { [`data-${name}`]: constant };\n const attributes: Record<string, string> = {};\n for (const bp of SHELL_BREAKPOINTS) attributes[`data-${name}-${bp}`] = table[bp];\n return attributes;\n}\n\n/**\n * A responsive prop object is usually an inline literal, a new identity every\n * render. Keying memoisation on its contents keeps the tables, and so the\n * registry entries, stable across renders that change nothing.\n */\nexport function useStableKey(value: unknown): string {\n return typeof value === 'object' && value !== null ? JSON.stringify(value) : String(value);\n}\n\nexport const FIXED_TABLE: Table<PresentationValue> = tableOf<PresentationValue>('fixed', () => 'fixed');\n\n/* \u2500\u2500 The registry \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type OpenChangeReason = 'toggle' | 'dismiss';\n\nexport type PaneEntry = {\n name: PaneName;\n id: string;\n el: HTMLElement | null;\n /** What the pane shows now; `undefined` while an untouched pane cannot know (before the breakpoint is known). */\n value: PaneValue | undefined;\n /** How the pane is presented now, when known. */\n presentation: PresentationValue | undefined;\n /** The pane's own presentation at every breakpoint. A Panel with none of its own follows the Rail's. */\n presentationTable: Table<PresentationValue>;\n /** Open and presented as an overlay: what the scrim and Escape close, and what containment exempts. */\n overlayLive: boolean;\n /** The pane's designed open width, for panes that sit beside it when floating. */\n size: number;\n setValue: (value: PaneValue, reason: OpenChangeReason) => void;\n toggle: (reason: OpenChangeReason) => void;\n};\n\nexport type ShellStore = {\n entries: Map<PaneName, PaneEntry>;\n listeners: Set<() => void>;\n /**\n * What a subscriber reads. useSyncExternalStore needs a value that is stable\n * between notifications, and a number is; the Map, or anything derived from\n * it, would be a new identity on every read.\n */\n version: number;\n /** The pane a hovered Trigger is previewing, if any. Layout only. */\n peek: PaneName | null;\n};\n\nexport function createShellStore(): ShellStore {\n return { entries: new Map(), listeners: new Set(), version: 0, peek: null };\n}\n\nexport function notifyShellStore(store: ShellStore) {\n store.version += 1;\n for (const listener of store.listeners) listener();\n}\n\nexport function subscribeShellStore(store: ShellStore, listener: () => void) {\n store.listeners.add(listener);\n return () => {\n store.listeners.delete(listener);\n };\n}\n\nexport function setShellPeek(store: ShellStore, peek: PaneName | null) {\n if (store.peek === peek) return;\n store.peek = peek;\n notifyShellStore(store);\n}\n\nexport const ShellStoreContext = React.createContext<ShellStore | null>(null);\n\nexport function useShellStore(part: string): ShellStore {\n const store = React.useContext(ShellStoreContext);\n if (!store) throw new Error(`${part} must be used within <Shell.Root>`);\n return store;\n}\n\n/** One pane's registry entry. Re-renders only when that entry is replaced. */\nexport function usePaneEntry(store: ShellStore, name: PaneName): PaneEntry | undefined {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n const getSnapshot = React.useCallback(() => store.entries.get(name), [store, name]);\n return React.useSyncExternalStore(subscribe, getSnapshot, () => undefined);\n}\n\n/**\n * Whether this pane is the one being previewed. A boolean per pane rather than\n * the peek target itself, so hovering one Trigger re-renders one pane, not all.\n */\nexport function usePeeking(store: ShellStore, name: PaneName): boolean {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n return React.useSyncExternalStore(\n subscribe,\n () => store.peek === name,\n () => false,\n );\n}\n\n/* \u2500\u2500 Off the frame \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type FramePaneId = 'rail' | 'panel' | 'sidebar' | 'content' | 'inspector' | 'bottom';\n\nexport const ShellFrameContext = React.createContext<{\n registerOffFrame: (id: FramePaneId) => void;\n unregisterOffFrame: (id: FramePaneId) => void;\n} | null>(null);\n\n/** Tells the Root a pane is off the frame (`flush={false}`); the Rail's card moves a floating Panel over. */\nexport function useFrameRegistration(id: FramePaneId, flush: boolean) {\n const ctx = React.useContext(ShellFrameContext);\n if (!ctx) throw new Error('Shell panes must be used within <Shell.Root>');\n const { registerOffFrame, unregisterOffFrame } = ctx;\n useLayoutEffect(() => {\n if (flush) return;\n registerOffFrame(id);\n return () => unregisterOffFrame(id);\n }, [id, flush, registerOffFrame, unregisterOffFrame]);\n}\n\n/* \u2500\u2500 Development warnings \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nconst warned = new Set<string>();\n\n/** A deprecation warning, once per message per page load. Development only. */\nexport function warnOnce(message: string) {\n if (process.env.NODE_ENV === 'production') return;\n if (warned.has(message)) return;\n warned.add(message);\n console.warn(`[kookie-ui] ${message}`);\n}\n"],
|
|
5
|
+
"mappings": ";wCAoBA,UAAYA,MAAW,QACvB,OAAS,mBAAAC,MAAuB,oBAahC,SAASC,EAASC,EAAoE,CACpF,OAAO,OAAOA,GAAU,UAAYA,IAAU,IAChD,CAOO,SAASC,EAAWD,EAA2BE,EAA2C,CAC/F,IAAMC,EAAQ,CAAC,EACXC,EAA+B,KACnC,QAAWC,KAAMC,EAAmB,CAClC,GAAIN,IAAU,QAAa,CAACD,EAAMC,CAAK,EAAG,CACxCG,EAAME,CAAE,EAAIL,EACZ,QACF,CACA,IAAMO,EAAQR,EAAMC,CAAK,EAAIA,EAAMK,CAAE,EAAI,OACrCE,IAAU,SAAWH,EAAU,CAAE,MAAOG,CAAM,GAClDJ,EAAME,CAAE,EAAID,EAAUA,EAAQ,MAAQF,EAASG,CAAE,CACnD,CACA,OAAOF,CACT,CAGO,SAASK,EAAcL,EAAgC,CAC5D,IAAMM,EAAQN,EAAM,QACpB,OAAOG,EAAkB,MAAOD,GAAOF,EAAME,CAAE,IAAMI,CAAK,EAAIA,EAAQ,MACxE,CAOO,SAASC,EAAgBC,EAAcR,EAA8C,CAC1F,IAAMS,EAAWJ,EAAWL,CAAK,EAC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EAAY,CAC3E,CAMO,SAASC,EAAWX,EAAmBP,EAAyB,CACrE,IAAMgB,EAAkB,cAAaR,GAAyBC,EAAoBF,EAAOC,CAAQ,EAAG,CAACD,CAAK,CAAC,EAC3G,OAAa,uBACXS,EACA,IAAMT,EAAM,OAASP,EACrB,IAAM,EACR,CACF,CAMO,IAAMmB,EAA0B,gBAG7B,IAAI,EAGP,SAASC,EAAqBC,EAAiBC,EAAgB,CACpE,IAAMC,EAAY,aAAWJ,CAAiB,EAC9C,GAAI,CAACI,EAAK,MAAM,IAAI,MAAM,8CAA8C,EACxE,GAAM,CAAE,iBAAAC,EAAkB,mBAAAC,CAAmB,EAAIF,EACjDG,EAAgB,IAAM,CACpB,GAAI,CAAAJ,EACJ,OAAAE,EAAiBH,CAAE,EACZ,IAAMI,EAAmBJ,CAAE,CACpC,EAAG,CAACA,EAAIC,EAAOE,EAAkBC,CAAkB,CAAC,CACtD,CAIA,IAAME,EAAS,IAAI,IAGZ,SAASC,EAASC,EAAiB,CAK1C",
|
|
6
|
+
"names": ["React", "useLayoutEffect", "isMap", "value", "tableOf", "fallback", "table", "carried", "bp", "SHELL_BREAKPOINTS", "entry", "constantOf", "first", "tableAttributes", "name", "constant", "attributes", "useStableKey", "FIXED_TABLE", "createShellStore", "notifyShellStore", "store", "listener", "subscribeShellStore", "setShellPeek", "peek", "ShellStoreContext", "useShellStore", "part", "usePaneEntry", "subscribe", "getSnapshot", "usePeeking", "ShellFrameContext", "useFrameRegistration", "id", "flush", "ctx", "registerOffFrame", "unregisterOffFrame", "useLayoutEffect", "warned", "warnOnce", "message"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as g}from"./chunk-FATCGZZE.js";import{a as
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as g}from"./chunk-FATCGZZE.js";import{a as f}from"./chunk-OBSZOD5M.js";import{a as C}from"./chunk-7VJF6EXN.js";import{a}from"./chunk-TGRHRMQI.js";import{a as d}from"./chunk-FICBVI4M.js";import{a as h}from"./chunk-HGF4CKRY.js";import{c}from"./chunk-5ON3XLRD.js";import{a as P}from"./chunk-4KBKS3ZE.js";import{c as m}from"./chunk-OKQAVYW4.js";import{a as W}from"./chunk-VQPANPMI.js";var j={};W(j,{Close:()=>E,Content:()=>y,Description:()=>T,Root:()=>S,Title:()=>D,Trigger:()=>R});import*as e from"react";import k from"classnames";import{Dialog as i}from"radix-ui";var S=t=>e.createElement(i.Root,{...t,modal:!0});S.displayName="Sheet.Root";var R=e.forwardRef(({children:t,...o},r)=>e.createElement(i.Trigger,{...o,ref:r,asChild:!0},a(t)));R.displayName="Sheet.Trigger";var{align:Y,...w}=g,u=w,B={Title:({children:t})=>e.createElement(i.Title,{asChild:!0},t),Close:({children:t})=>e.createElement(i.Close,{asChild:!0},t)},v=e.createContext(null),y=e.forwardRef((t,o)=>{let{side:r="start",forceMount:s,container:n,className:N,...x}=t,b=c(x,u.size),H={left:"start",right:"end",start:"start",end:"end",top:"top",bottom:"bottom"}[r],{className:O,...l}=m(b,u),z=e.useRef(0),M=e.useCallback(p=>{typeof o=="function"?o(p):o&&(o.current=p)},[o]);return C(),e.createElement(i.Portal,{container:n,forceMount:s},e.createElement(v.Provider,{value:z},e.createElement(h,{asChild:!0},e.createElement(i.Overlay,{className:"kui-BaseDialogOverlay kui-DialogOverlay kui-SheetOverlay"},e.createElement(i.Content,{...l,ref:M,className:k("kui-BaseDialogContent","kui-SheetContent",N,O),"data-side":H,"aria-modal":"true",children:e.createElement(P.Provider,{value:B},l.children)})))))});y.displayName="Sheet.Content";var D=e.forwardRef(({size:t="4",weight:o="medium",...r},s)=>{let n=e.useContext(v);return e.useLayoutEffect(()=>{if(n)return n.current+=1,()=>{n.current-=1}},[n]),e.createElement(i.Title,{asChild:!0},e.createElement(f,{ref:s,size:t,weight:o,...r}))});D.displayName="Sheet.Title";var T=e.forwardRef(({size:t="2",emphasis:o="medium",...r},s)=>e.createElement(i.Description,{asChild:!0},e.createElement(d,{ref:s,size:t,emphasis:o,...r})));T.displayName="Sheet.Description";var E=e.forwardRef(({children:t,...o},r)=>e.createElement(i.Close,{...o,ref:r,asChild:!0},a(t)));E.displayName="Sheet.Close";export{S as a,R as b,y as c,D as d,T as e,E as f,j as g};
|
|
3
|
+
//# sourceMappingURL=chunk-API4DAPY.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{b as t}from"./chunk-G66WDIIV.js";import{a as n}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{b as t}from"./chunk-G66WDIIV.js";import{a as n}from"./chunk-5BXCPANF.js";import*as s from"react";function p(e){s.useEffect(()=>{},[]);let{breakpoint:o}=t(typeof e!="string");return n(e,()=>"fixed")[o]}export{p as a};
|
|
3
|
+
//# sourceMappingURL=chunk-B447PNRD.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as to,b as ro,c as no,e as W,f as ao,i as so,l as io}from"./chunk-KBSH6CBD.js";import{a as B}from"./chunk-JQMWNI62.js";import{a as eo}from"./chunk-FICBVI4M.js";import{a as q}from"./chunk-7N2Q5WOM.js";import{b as L}from"./chunk-5ON3XLRD.js";import{d as J,f as Q,g as X}from"./chunk-VWRPVM5K.js";import{h as oo}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as to,b as ro,c as no,e as W,f as ao,i as so,l as io}from"./chunk-KBSH6CBD.js";import{a as B}from"./chunk-JQMWNI62.js";import{a as eo}from"./chunk-FICBVI4M.js";import{a as q}from"./chunk-7N2Q5WOM.js";import{b as L}from"./chunk-5ON3XLRD.js";import{d as J,f as Q,g as X}from"./chunk-VWRPVM5K.js";import{h as oo}from"./chunk-ODHCDJ3Y.js";import{c as U}from"./chunk-OKQAVYW4.js";import*as o from"react";import{useComposedRefs as vo,useLayoutEffect as D}from"radix-ui/internal";import g from"classnames";import{Toolbar as N}from"radix-ui";var Po=["1","2","3","4"],Ro=["horizontal","vertical"],x={size:{type:"enum",className:"kui-r-size",values:Po,default:"2"},orientation:{type:"enum",values:Ro,default:"horizontal"}};var M=o.createContext(null),F=o.createContext(null),E=o.createContext(!1);function Ho(){return o.useContext(E)}var H=o.forwardRef((e,t)=>{let r=oo(),a=L(e.size??r??void 0,x.size),s=e.orientation??x.orientation.default,{className:i,orientation:n,backdrop:l=!1,children:c,...d}=U({...e,size:a},x,q),u=o.useMemo(()=>({size:a,orientation:s,backdrop:l}),[a,s,l]);return o.createElement(N.Root,{...d,ref:t,orientation:s,"data-backdrop":l||void 0,className:g("kui-Toolbar",i)},o.createElement(M.Provider,{value:u},c))});H.displayName="Toolbar";var co=o.forwardRef(({className:e,disabled:t=!1,children:r,...a},s)=>{let i=o.useContext(M),n=o.useContext(E),l=o.useMemo(()=>({disabled:t}),[t]);return n?o.createElement(ao,{...a,ref:s,className:e},o.createElement(F.Provider,{value:l},r)):o.createElement("div",{role:"group","data-orientation":i?.orientation??"horizontal","data-disabled":t||void 0,...a,ref:s,className:g("kui-ToolbarGroup",e)},o.createElement(F.Provider,{value:l},r))});co.displayName="Toolbar.Group";var yo=new Set(["id","className","style","title"]);function lo(e){return e===!0||e==="true"}function wo(e){return o.isValidElement(e)&&e.type==="button"}var A=o.forwardRef((e,t)=>{let r=o.useContext(M),a=o.useContext(F),s=o.useContext(E),{iconOnly:i,size:n,variant:l,emphasis:c,color:d,disabled:u,asChild:f,onKeyDown:b,...y}=e,h=u||a?.disabled||void 0;if(s){let P={};for(let R of Object.keys(y))(/^on[A-Z]/.test(R)||R.startsWith("aria-")||R.startsWith("data-")||yo.has(R))&&(P[R]=y[R]);return b&&(P.onKeyDown=b),o.createElement(uo,{...P,ref:t,asChild:f,iconOnly:i,disabled:h,color:d,pressed:e["aria-pressed"]===void 0?void 0:lo(e["aria-pressed"])},y.children)}let O=r?.orientation==="vertical"&&b?P=>{P.key==="ArrowDown"||P.key==="ArrowUp"||b(P)}:b,I=lo(e["aria-pressed"]),p="data-state"in e||e["aria-pressed"]===void 0?{}:{"data-state":I?"on":"off"},m={size:n??r?.size,...c!==void 0?{emphasis:c}:{variant:l??(a?"ghost":r?.backdrop?"raised":"soft")},color:d??(l||c?void 0:"gray"),...p},T={...y,...i?{iconOnly:!0}:{},...f?{asChild:!0}:{},...O?{onKeyDown:O}:{},...m};return r?f&&!wo(y.children)?o.createElement(N.Link,{asChild:!0,ref:t},o.createElement(B,{...T,disabled:h})):o.createElement(N.Button,{asChild:!0,ref:t,disabled:h},o.createElement(B,{...T})):o.createElement(B,{...T,ref:t,disabled:h})});A.displayName="Toolbar.Button";var uo=o.forwardRef(({asChild:e,iconOnly:t,disabled:r,color:a,pressed:s,children:i,"aria-label":n,...l},c)=>{let d=t?n:void 0,u={...l,...t?{}:n?{"aria-label":n}:{},disabled:r,...a?{color:a}:{}};if(e&&o.isValidElement(i)){let f=d?o.cloneElement(i,void 0,i.props.children,o.createElement("span",null,d)):i;return o.createElement(W,{...u,ref:c,asChild:!0},f)}return s!==void 0?o.createElement(so,{...u,ref:c,checked:s},i,d):o.createElement(W,{...u,ref:c},i,d)});uo.displayName="Toolbar.OverflowItem";function ho(){return o.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentcolor","aria-hidden":!0,xmlns:"http://www.w3.org/2000/svg"},o.createElement("circle",{cx:"3.25",cy:"8",r:"1.25"}),o.createElement("circle",{cx:"8",cy:"8",r:"1.25"}),o.createElement("circle",{cx:"12.75",cy:"8",r:"1.25"}))}var po=o.forwardRef(({label:e="More",className:t,children:r,...a},s)=>{let i=o.Children.toArray(r),n=i.length,l=o.useRef(null),c=o.useRef([]),d=o.useRef(0),[u,f]=o.useState(n),[b,y]=o.useState(0),[h,O]=o.useState(n);h!==n&&(O(n),f(n)),D(()=>{c.current=[]},[n]),D(()=>{let p=l.current;if(!p)return;let m=Array.from(p.children),T=Math.min(u,n);for(let v=0;v<T;v++){let w=m[v];w&&(c.current[v]=w.offsetWidth)}let P=m[T];P&&(d.current=P.offsetWidth);let R=Number.parseFloat(getComputedStyle(p).columnGap)||0,K=p.clientWidth,V=0,_=0;for(let v=0;v<n;v++){let w=c.current[v];if(w===void 0)return;w!==0&&(V+=w+(_>0?R:0),_+=1)}let k=n;if(V>K){let v=K-(d.current||p.clientHeight)-R,w=0,Y=0;k=0;for(let G=0;G<n;G++){let Z=c.current[G];if(Z>0){let $=Z+(Y>0?R:0);if(w+$>v)break;w+=$,Y+=1}k+=1}}k!==u&&f(k)},[u,n,b]),o.useEffect(()=>{let p=l.current;if(!p||typeof ResizeObserver>"u")return;let m=new ResizeObserver(()=>y(T=>T+1));m.observe(p);for(let T of Array.from(p.children))m.observe(T);return()=>m.disconnect()},[u,n]);let I=o.useCallback(p=>{l.current=p,typeof s=="function"?s(p):s&&(s.current=p)},[s]);return o.createElement("div",{...a,ref:I,className:g("kui-ToolbarOverflow",t)},i.slice(0,u).map((p,m)=>o.createElement("div",{key:m,className:"kui-ToolbarOverflowSeat"},p)),u<n?o.createElement(to,null,o.createElement(ro,null,o.createElement(A,{iconOnly:!0,"aria-label":e},o.createElement(ho,null))),o.createElement(no,{align:"end"},o.createElement(E.Provider,{value:!0},i.slice(u)))):null)});po.displayName="Toolbar.Overflow";var j=[],S=new Map,z=new Set,C=new Map;function So(e){return z.add(e),()=>{z.delete(e)}}function go(e,t,r){let a=S.get(e)??j,i=a.findIndex(n=>n.id===t)===-1?[...a,{id:t,node:r}]:a.map(n=>n.id===t?{id:t,node:r}:n);S.set(e,i),z.forEach(n=>n())}function xo(e,t){let r=S.get(e);if(!r)return;let a=r.filter(s=>s.id!==t);a.length===0?S.delete(e):S.set(e,a),z.forEach(s=>s())}function fo({name:e="default"}){D(()=>{let r=(C.get(e)??0)+1;return C.set(e,r),r>1,()=>{let a=(C.get(e)??1)-1;a>0?C.set(e,a):C.delete(e)}},[e]);let t=o.useSyncExternalStore(So,()=>S.get(e)??j,()=>j);return o.createElement(o.Fragment,null,t.map(r=>o.createElement(o.Fragment,{key:r.id},r.node)))}fo.displayName="Toolbar.Slot";function bo({name:e="default",children:t}){let r=o.useId();return D(()=>{go(e,r,t)},[e,r,t]),D(()=>()=>xo(e,r),[e,r]),null}bo.displayName="Toolbar.Fill";var mo=o.forwardRef(({className:e,...t},r)=>{let a=o.useContext(M);return o.useContext(E)?o.createElement(io,{...t,ref:r,className:e}):a?o.createElement(N.Separator,{...t,ref:r,className:g("kui-ToolbarSeparator",e)}):o.createElement("div",{role:"separator","aria-orientation":"vertical","data-orientation":"vertical",...t,ref:r,className:g("kui-ToolbarSeparator",e)})});mo.displayName="Toolbar.Separator";var Co={1:"2",2:"3",3:"4",4:"5"},To=o.forwardRef(({className:e,children:t,style:r,id:a},s)=>{let i=o.useContext(M),n=L(void 0,x.size),l=i?.size??n,c=J(),d=Q(c),u=X(c),f=t==null||t===!1,b=f?d:t,y=vo(s,f?u:void 0);return b==null?null:o.createElement(eo,{ref:y,as:"span",size:Co[l],weight:"medium",truncate:!0,id:a,style:r,className:g("kui-ToolbarTitle",e),"data-mirror":f||void 0},b)});To.displayName="Toolbar.Title";var jo=Object.assign(H,{Root:H,Group:co,Button:A,Separator:mo,Title:To,Overflow:po,Slot:fo,Fill:bo});export{Ho as a,H as b,co as c,A as d,po as e,fo as f,bo as g,mo as h,To as i,jo as j};
|
|
3
|
+
//# sourceMappingURL=chunk-BR6Z2CAE.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as m}from"./chunk-FATCGZZE.js";import{a as
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as m}from"./chunk-FATCGZZE.js";import{a as D}from"./chunk-OBSZOD5M.js";import{a as c}from"./chunk-7VJF6EXN.js";import{a as l}from"./chunk-TGRHRMQI.js";import{a as P}from"./chunk-FICBVI4M.js";import{a as g}from"./chunk-HGF4CKRY.js";import{c as n}from"./chunk-5ON3XLRD.js";import{a as p}from"./chunk-4KBKS3ZE.js";import{c as r}from"./chunk-OKQAVYW4.js";import{a as w}from"./chunk-VQPANPMI.js";var z={};w(z,{Close:()=>T,Content:()=>v,Description:()=>y,Root:()=>f,Title:()=>R,Trigger:()=>d});import*as o from"react";import W from"classnames";import{Dialog as i}from"radix-ui";var f=e=>o.createElement(i.Root,{...e,modal:!0});f.displayName="Dialog.Root";var d=o.forwardRef(({children:e,...t},a)=>o.createElement(i.Trigger,{...t,ref:a,asChild:!0},l(e)));d.displayName="Dialog.Trigger";var{align:O,...C}=m,B={align:O},S={Title:({children:e})=>o.createElement(i.Title,{asChild:!0},e),Close:({children:e})=>o.createElement(i.Close,{asChild:!0},e)},v=o.forwardRef(({align:e,...t},a)=>{let u=n(t,C.size),{className:h}=r({align:e},B),{className:N,forceMount:E,container:x,onCloseAutoFocus:H,...s}=r(u,C);return c(),o.createElement(i.Portal,{container:x,forceMount:E},o.createElement(g,{asChild:!0},o.createElement(i.Overlay,{className:"kui-BaseDialogOverlay kui-DialogOverlay"},o.createElement("div",{className:"kui-BaseDialogScroll kui-DialogScroll"},o.createElement("div",{className:`kui-BaseDialogScrollPadding kui-DialogScrollPadding ${h}`},o.createElement(i.Content,{...s,ref:a,className:W("kui-BaseDialogContent","kui-DialogContent",N),children:o.createElement(p.Provider,{value:S},s.children),"aria-modal":"true",onCloseAutoFocus:k=>{H?.(k),document.body.style.pointerEvents=""}}))))))});v.displayName="Dialog.Content";var R=o.forwardRef((e,t)=>o.createElement(i.Title,{asChild:!0},o.createElement(D,{size:"5",trim:"start",...e,asChild:!1,ref:t})));R.displayName="Dialog.Title";var y=o.forwardRef((e,t)=>o.createElement(i.Description,{asChild:!0},o.createElement(P,{as:"p",size:"3",...e,asChild:!1,ref:t})));y.displayName="Dialog.Description";var T=o.forwardRef(({children:e,...t},a)=>o.createElement(i.Close,{...t,ref:a,asChild:!0},l(e)));T.displayName="Dialog.Close";export{f as a,d as b,v as c,R as d,y as e,T as f,z as g};
|
|
3
|
+
//# sourceMappingURL=chunk-CAM66IXC.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{a as b}from"./chunk-7VJF6EXN.js";import{a as T}from"./chunk-HGF4CKRY.js";import{b as N}from"./chunk-5ON3XLRD.js";import*as e from"react";import{createPortal as D}from"react-dom";import d from"classnames";import{Command as v}from"cmdk";import{Dialog as g}from"radix-ui";var z={1:"2",2:"3",3:"4",4:"4"},M={values:["1","2","3","4"],default:"2"},h=e.createContext("2"),I=e.createContext(()=>{}),w=e.createContext([]),L=e.createContext(null),E=e.createContext({query:"",filter:null,itemToString:String}),x=e.createContext(null);function G(t){if(typeof t=="string"||typeof t=="number")return String(t);if(t&&typeof t=="object"){let n=t;for(let o of["label","title","value","name"])if(typeof n[o]=="string")return n[o]}return""}var F=(t,n,o)=>o(t).toLowerCase().includes(n.trim().toLowerCase());function B(t){return!!(t&&typeof t=="object"&&Array.isArray(t.items))}function V(t,n,o,r){if(o===null||n.trim()==="")return[...t];let s=[];for(let a of t)if(B(a)){let i=a.items.filter(m=>o(m,n,r));i.length>0&&s.push({...a,items:i})}else o(a,n,r)&&s.push(a);return s}function j({size:t,items:n,open:o,defaultOpen:r,onOpenChange:s,children:a}){let i=N(t,M),[m,C]=e.useState(r??!1),l=o!==void 0,p=l?o:m,u=e.useCallback((c,R)=>{s?.(c,{reason:R}),l||C(c)},[s,l]),f=e.useCallback(()=>u(!1,"item-press"),[u]);return e.createElement(h.Provider,{value:i},e.createElement(w.Provider,{value:n},e.createElement(L.Provider,{value:f},e.createElement(g.Root,{open:p,onOpenChange:c=>u(c,"dismiss"),modal:!0},a))))}function Z({children:t,...n}){return e.createElement(g.Trigger,{asChild:!0,...n},t)}function J({"aria-label":t,filter:n=F,itemToString:o=G,onQueryChange:r,container:s,children:a,className:i,style:m}){let C=e.useContext(h),[l,p]=e.useState(""),[u,f]=e.useState(null),c=e.useRef(r);e.useEffect(()=>{c.current=r}),e.useEffect(()=>()=>c.current?.(""),[]),b();let R=e.useCallback(k=>{p(k),c.current?.(k)},[]),S=e.useMemo(()=>({query:l,filter:n,itemToString:o}),[l,n,o]),P=e.useMemo(()=>({seat:u,setSeat:f}),[u]);return e.createElement(g.Portal,{container:s},e.createElement(T,{asChild:!0},e.createElement(g.Overlay,{className:"kui-BaseDialogOverlay kui-CommandOverlay"},e.createElement(g.Content,{"aria-label":t,"aria-describedby":void 0,className:d("kui-CommandContent",`kui-r-size-${C}`,i),style:m,onCloseAutoFocus:()=>{document.body.style.pointerEvents=""}},e.createElement(g.Title,{className:"kui-sr-only"},t),e.createElement(v,{label:t,shouldFilter:!1,loop:!0,className:"kui-CommandRoot"},e.createElement(E.Provider,{value:S},e.createElement(I.Provider,{value:R},e.createElement(x.Provider,{value:P},a))))))))}function K({leading:t,className:n,...o}){let r=e.useContext(h),s=e.useContext(I),a=e.useRef(null);return e.createElement("div",{className:d("kui-CommandSearch",`kui-r-size-${r}`),onMouseDown:i=>{i.target!==a.current&&(i.preventDefault(),a.current?.focus())}},t?e.createElement("span",{className:"kui-CommandSearchSlot","aria-hidden":!0},t):null,e.createElement(v.Input,{ref:a,autoFocus:!0,...o,onValueChange:s,className:d("kui-reset","kui-CommandInput",n)}))}function U({children:t,className:n}){let o=e.useContext(h),r=e.useContext(w),{query:s,filter:a,itemToString:i}=e.useContext(E),m=e.useContext(x),C=e.useMemo(()=>V(r,s,a,i),[r,s,a,i]);return e.createElement("div",{className:d("kui-BaseMenuContent","kui-variant-soft",`kui-r-size-${z[o]}`,"kui-CommandPanel",n)},e.createElement(v.List,{className:d("kui-BaseMenuViewport","kui-CommandList")},C.map(l=>t(l)),e.createElement("div",{className:"kui-CommandSeat",ref:m?m.setSeat:void 0})))}var O=e.createContext([]);function X({items:t,children:n,className:o}){return e.createElement(O.Provider,{value:t},e.createElement(v.Group,{className:d("kui-BaseMenuGroup","kui-CommandGroup",o)},n))}function Y({children:t,className:n}){return e.createElement("div",{className:d("kui-BaseMenuLabel","kui-CommandGroupLabel",n),"aria-hidden":!0},t)}function ee({children:t}){let n=e.useContext(O);return e.createElement(e.Fragment,null,n.map(o=>t(o)))}function te({value:t,onSelect:n,leading:o,trailing:r,tone:s,asChild:a,children:i,className:m,...C}){let l=e.useContext(L),p=e.useId(),u=e.useRef(null),f=e.useRef(!1),c=typeof t=="string"?t:p,R=()=>{n?.(),l?.()},S=()=>{if(f.current){f.current=!1,R();return}let y=u.current??document.querySelector(`[data-kui-command-item="${CSS.escape(p)}"]`);if(a&&y instanceof HTMLAnchorElement){y.click();return}R()},P=a&&e.isValidElement(i)?i:null,k=y=>e.createElement(e.Fragment,null,o?e.createElement("span",{className:"kui-CommandItemSlot","data-slot":"leading","aria-hidden":!0},o):null,e.createElement("span",{className:"kui-CommandItemLabel"},y),r?e.createElement("span",{className:"kui-CommandItemSlot","data-slot":"trailing"},r):null);return e.createElement(v.Item,{...C,ref:u,"data-kui-command-item":p,value:c,asChild:!!P,onSelect:S,onClickCapture:()=>{f.current=!0},"data-tone":s,className:d("kui-reset","kui-BaseMenuItem","kui-CommandItem",m)},P?e.cloneElement(P,void 0,k(P.props.children)):k(i))}function ne({children:t,className:n}){let o=e.useContext(x);return o?.seat?D(e.createElement(v.Empty,{className:d("kui-CommandEmpty",n)},t),o.seat):null}export{z as a,j as b,Z as c,J as d,K as e,U as f,X as g,Y as h,ee as i,te as j,ne as k};
|
|
3
|
+
//# sourceMappingURL=chunk-GZPB6MRQ.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/command.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\n/**\n * Command, from v2 (2026-11-03): a command palette, one field over everything the app can do.\n *\n * It is a Dialog: it covers the app, traps focus, locks the page and leaves on Escape. Inside are\n * two panes in a column anchored to the top, the search bar and the results, so a result count\n * never moves the field. The keyboard model is the package's: a row is highlighted from the first\n * frame and after every keystroke, the arrows move it, Enter runs it, and running a row closes the\n * palette. What rows exist and what they do is the app's.\n *\n * Filtering keeps the order of `items`: a palette is used by muscle memory, so typing never\n * reorders it. Pass `filter={null}` to narrow and rank `items` yourself.\n *\n * Differs from v2 in its machine only: v1 builds on cmdk where v2 builds on Base UI's Autocomplete.\n * A row that should be a link takes `asChild` around the app's link, where v2 takes `render`.\n */\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport classNames from 'classnames';\nimport { Command as CommandPrimitive } from 'cmdk';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\n\nimport { PortalTheme } from './_internal/portal-theme.js';\nimport { useBodyPointerEventsCleanup } from '../hooks/use-body-pointer-events-cleanup.js';\nimport { useThemeSize } from '../hooks/theme-size.js';\n\ntype Size = '1' | '2' | '3' | '4';\n\n/** The rows stand one step above the palette: it is the one object on screen, read from a distance. */\nconst ROW_STEP: Record<Size, Size> = { '1': '2', '2': '3', '3': '4', '4': '4' };\n\ntype CommandOpenChangeReason = 'item-press' | 'dismiss';\ntype CommandOpenChangeDetails = { reason: CommandOpenChangeReason };\n\ntype Filter = (item: unknown, query: string, itemToString: (item: unknown) => string) => boolean;\n\nconst SIZE_DEF = { values: ['1', '2', '3', '4'], default: '2' } as const;\n\nconst CommandSizeContext = React.createContext<Size>('2');\nconst CommandQueryContext = React.createContext<(query: string) => void>(() => {});\nconst CommandItemsContext = React.createContext<readonly unknown[]>([]);\nconst CommandCloseContext = React.createContext<(() => void) | null>(null);\nconst CommandListContext = React.createContext<{ query: string; filter: Filter | null; itemToString: (item: unknown) => string }>({\n query: '',\n filter: null,\n itemToString: String,\n});\nconst CommandSeatContext = React.createContext<{ seat: HTMLElement | null; setSeat: (node: HTMLElement | null) => void } | null>(null);\n\n/** What an item says, for the default filter: a string as itself, an object by its label, title or value. */\nfunction defaultItemToString(item: unknown): string {\n if (typeof item === 'string' || typeof item === 'number') return String(item);\n if (item && typeof item === 'object') {\n const record = item as Record<string, unknown>;\n for (const key of ['label', 'title', 'value', 'name']) {\n if (typeof record[key] === 'string') return record[key] as string;\n }\n }\n return '';\n}\n\nconst defaultFilter: Filter = (item, query, itemToString) => itemToString(item).toLowerCase().includes(query.trim().toLowerCase());\n\n/** A group is an item that carries its own `items`; it stays while any of them matches. */\nfunction isGroup(item: unknown): item is { items: readonly unknown[] } {\n return Boolean(item && typeof item === 'object' && Array.isArray((item as { items?: unknown }).items));\n}\n\nfunction narrow(items: readonly unknown[], query: string, filter: Filter | null, itemToString: (item: unknown) => string): unknown[] {\n if (filter === null || query.trim() === '') return [...items];\n const out: unknown[] = [];\n for (const item of items) {\n if (isGroup(item)) {\n const kept = item.items.filter((member) => filter(member, query, itemToString));\n if (kept.length > 0) out.push({ ...item, items: kept });\n } else if (filter(item, query, itemToString)) {\n out.push(item);\n }\n }\n return out;\n}\n\ninterface CommandProps {\n /**\n * The size step of the palette, from `\"1\"` to `\"4\"`. The rows are one step larger than the\n * app's controls at the same step, and the search text larger again. The default comes from\n * the theme.\n */\n size?: Size;\n /**\n * Every item the palette can show, before filtering. `CommandList` takes a function that turns\n * an item into a row. An item with its own `items` array is a group. Keep the array stable.\n */\n items: readonly unknown[];\n /** Whether the palette is open, for a controlled palette. Most are, because a key handler opens them. */\n open?: boolean;\n /** Whether the palette is open at the start, for an uncontrolled palette. */\n defaultOpen?: boolean;\n /** Called each time the palette opens or closes. `reason` is `\"item-press\"` when a row ran. */\n onOpenChange?: (open: boolean, details: CommandOpenChangeDetails) => void;\n /** A `CommandTrigger`, if there is one, and a `CommandContent`. */\n children: React.ReactNode;\n}\n\n/** A command palette: a field over a list of rows, in a dialog. Running a row closes it. */\nfunction Command({ size: sizeProp, items, open, defaultOpen, onOpenChange, children }: CommandProps) {\n const size = useThemeSize<Size>(sizeProp, SIZE_DEF);\n const [internalOpen, setInternalOpen] = React.useState(defaultOpen ?? false);\n const controlled = open !== undefined;\n const isOpen = controlled ? open : internalOpen;\n\n const change = React.useCallback(\n (next: boolean, reason: CommandOpenChangeReason) => {\n onOpenChange?.(next, { reason });\n if (!controlled) setInternalOpen(next);\n },\n [onOpenChange, controlled],\n );\n const close = React.useCallback(() => change(false, 'item-press'), [change]);\n\n return (\n <CommandSizeContext.Provider value={size}>\n <CommandItemsContext.Provider value={items}>\n <CommandCloseContext.Provider value={close}>\n <DialogPrimitive.Root open={isOpen} onOpenChange={(next) => change(next, 'dismiss')} modal>\n {children}\n </DialogPrimitive.Root>\n </CommandCloseContext.Provider>\n </CommandItemsContext.Provider>\n </CommandSizeContext.Provider>\n );\n}\n\ninterface CommandTriggerProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger> {}\n\n/** Opens the palette. Most palettes open from a key handler instead, and render none. */\nfunction CommandTrigger({ children, ...props }: CommandTriggerProps) {\n return (\n <DialogPrimitive.Trigger asChild {...props}>\n {children}\n </DialogPrimitive.Trigger>\n );\n}\n\ninterface CommandContentProps {\n /** The palette's accessible name, such as \"Search the documentation\". */\n 'aria-label': string;\n /**\n * How an item matches the query. The default keeps an item whose text contains the query.\n * `null` turns filtering off, for an app that narrows and ranks `items` itself.\n */\n filter?: Filter | null;\n /** What an item says, for the filter. The default reads a string, or an object's label, title or value. */\n itemToString?: (item: unknown) => string;\n /** Called with the query on every keystroke, and with `\"\"` when the palette closes. */\n onQueryChange?: (query: string) => void;\n /** Keep the portal in a container of your own. */\n container?: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>['container'];\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n}\n\n/** The palette: a column of the search bar over the results, anchored to the top of the window. */\nfunction CommandContent({ 'aria-label': label, filter = defaultFilter, itemToString = defaultItemToString, onQueryChange, container, children, className, style }: CommandContentProps) {\n const size = React.useContext(CommandSizeContext);\n const [query, setQuery] = React.useState('');\n const [seat, setSeat] = React.useState<HTMLElement | null>(null);\n const report = React.useRef(onQueryChange);\n React.useEffect(() => {\n report.current = onQueryChange;\n });\n\n // Closing clears the query, so the palette opens fresh.\n React.useEffect(() => () => report.current?.(''), []);\n useBodyPointerEventsCleanup();\n\n const changeQuery = React.useCallback((next: string) => {\n setQuery(next);\n report.current?.(next);\n }, []);\n const listValue = React.useMemo(() => ({ query, filter, itemToString }), [query, filter, itemToString]);\n const seatValue = React.useMemo(() => ({ seat, setSeat }), [seat]);\n\n return (\n <DialogPrimitive.Portal container={container}>\n <PortalTheme asChild>\n <DialogPrimitive.Overlay className=\"kui-BaseDialogOverlay kui-CommandOverlay\">\n <DialogPrimitive.Content\n aria-label={label}\n aria-describedby={undefined}\n className={classNames('kui-CommandContent', `kui-r-size-${size}`, className)}\n style={style}\n onCloseAutoFocus={() => {\n document.body.style.pointerEvents = '';\n }}\n >\n <DialogPrimitive.Title className=\"kui-sr-only\">{label}</DialogPrimitive.Title>\n {/* cmdk owns the highlight and Enter; this file owns the filter, so order never changes. */}\n <CommandPrimitive label={label} shouldFilter={false} loop className=\"kui-CommandRoot\">\n <CommandListContext.Provider value={listValue}>\n <CommandQueryContext.Provider value={changeQuery}>\n <CommandSeatContext.Provider value={seatValue}>{children}</CommandSeatContext.Provider>\n </CommandQueryContext.Provider>\n </CommandListContext.Provider>\n </CommandPrimitive>\n </DialogPrimitive.Content>\n </DialogPrimitive.Overlay>\n </PortalTheme>\n </DialogPrimitive.Portal>\n );\n}\n\ninterface CommandInputProps extends Omit<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>, 'value' | 'onValueChange' | 'aria-label'> {\n /** The field's accessible name. */\n 'aria-label': string;\n /** An icon before the text, such as a search glyph. */\n leading?: React.ReactNode;\n}\n\n/** The search bar, a pane of its own. The palette opens with the caret in it. */\nfunction CommandInput({ leading, className, ...props }: CommandInputProps) {\n const size = React.useContext(CommandSizeContext);\n const setQuery = React.useContext(CommandQueryContext);\n const inputRef = React.useRef<HTMLInputElement>(null);\n return (\n // A press anywhere on the bar puts the caret in the field.\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n className={classNames('kui-CommandSearch', `kui-r-size-${size}`)}\n onMouseDown={(event) => {\n if (event.target === inputRef.current) return;\n event.preventDefault();\n inputRef.current?.focus();\n }}\n >\n {leading ? (\n <span className=\"kui-CommandSearchSlot\" aria-hidden>\n {leading}\n </span>\n ) : null}\n {/* `autoFocus` focuses inside the tap's own task, which is what raises the keyboard on iOS. */}\n <CommandPrimitive.Input\n ref={inputRef}\n // The palette is the field: it opens to type into, the one place autofocus is the design.\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n {...props}\n onValueChange={setQuery}\n className={classNames('kui-reset', 'kui-CommandInput', className)}\n />\n </div>\n );\n}\n\ninterface CommandListProps<T> {\n /** Turns an item into a row (a `CommandItem`) or a group (a `CommandGroup`). */\n children: (item: T) => React.ReactNode;\n className?: string;\n}\n\n/** The results, a pane of their own under the search bar. Its height follows the results. */\nfunction CommandList<T>({ children, className }: CommandListProps<T>) {\n const size = React.useContext(CommandSizeContext);\n const items = React.useContext(CommandItemsContext);\n const { query, filter, itemToString } = React.useContext(CommandListContext);\n const seat = React.useContext(CommandSeatContext);\n const shown = React.useMemo(() => narrow(items, query, filter, itemToString), [items, query, filter, itemToString]);\n return (\n <div className={classNames('kui-BaseMenuContent', 'kui-variant-soft', `kui-r-size-${ROW_STEP[size]}`, 'kui-CommandPanel', className)}>\n <CommandPrimitive.List className={classNames('kui-BaseMenuViewport', 'kui-CommandList')}>\n {shown.map((item) => children(item as T))}\n {/* The empty state's seat, inside this pane, so it is the same box as the results. */}\n <div className=\"kui-CommandSeat\" ref={seat ? seat.setSeat : undefined} />\n </CommandPrimitive.List>\n </div>\n );\n}\n\nconst CommandGroupItemsContext = React.createContext<readonly unknown[]>([]);\n\ninterface CommandGroupProps {\n /** The group's own items, after filtering. Render them with `CommandCollection`. */\n items: readonly unknown[];\n children: React.ReactNode;\n className?: string;\n}\n\n/** A labelled run of rows. A group with no matching rows is left out. */\nfunction CommandGroup({ items, children, className }: CommandGroupProps) {\n return (\n <CommandGroupItemsContext.Provider value={items}>\n <CommandPrimitive.Group className={classNames('kui-BaseMenuGroup', 'kui-CommandGroup', className)}>{children}</CommandPrimitive.Group>\n </CommandGroupItemsContext.Provider>\n );\n}\n\ninterface CommandGroupLabelProps {\n children: React.ReactNode;\n className?: string;\n}\n\n/** The group's name, above its rows. */\nfunction CommandGroupLabel({ children, className }: CommandGroupLabelProps) {\n return (\n <div className={classNames('kui-BaseMenuLabel', 'kui-CommandGroupLabel', className)} aria-hidden>\n {children}\n </div>\n );\n}\n\ninterface CommandCollectionProps<T> {\n /** Turns one of the group's items into a row. */\n children: (item: T) => React.ReactNode;\n}\n\n/** The group's rows. */\nfunction CommandCollection<T>({ children }: CommandCollectionProps<T>) {\n const items = React.useContext(CommandGroupItemsContext);\n return <>{items.map((item) => children(item as T))}</>;\n}\n\ninterface CommandItemProps extends Omit<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>, 'value' | 'onSelect'> {\n /** The item this row shows. A string is also the row's identity for the highlight. */\n value?: unknown;\n /** Runs when the row is pressed or Enter is pressed on it. The palette then closes. */\n onSelect?: () => void;\n /** An icon before the label. */\n leading?: React.ReactNode;\n /** Something after the label, such as a shortcut. */\n trailing?: React.ReactNode;\n /** Set when running the row destroys something. */\n tone?: 'destructive';\n /** Renders the child, such as your router's link, as the row. Enter follows the link. */\n asChild?: boolean;\n}\n\n/** One row. Running it, by press or by Enter, runs `onSelect` and closes the palette. */\nfunction CommandItem({ value, onSelect, leading, trailing, tone, asChild, children, className, ...props }: CommandItemProps) {\n const close = React.useContext(CommandCloseContext);\n const id = React.useId();\n const element = React.useRef<HTMLDivElement>(null);\n const clicked = React.useRef(false);\n const itemValue = typeof value === 'string' ? value : id;\n\n const run = () => {\n onSelect?.();\n close?.();\n };\n\n // cmdk runs a row from Enter without a click. A link has to be clicked to navigate, so Enter\n // clicks it, and the click comes back through here as the run.\n const handleSelect = () => {\n if (clicked.current) {\n clicked.current = false;\n run();\n return;\n }\n // Found by attribute, not by ref: an app's link component need not forward a ref.\n const node = element.current ?? document.querySelector(`[data-kui-command-item=\"${CSS.escape(id)}\"]`);\n if (asChild && node instanceof HTMLAnchorElement) {\n node.click();\n return;\n }\n run();\n };\n\n const child = asChild && React.isValidElement<{ children?: React.ReactNode }>(children) ? children : null;\n const inner = (label: React.ReactNode) => (\n <>\n {leading ? (\n <span className=\"kui-CommandItemSlot\" data-slot=\"leading\" aria-hidden>\n {leading}\n </span>\n ) : null}\n <span className=\"kui-CommandItemLabel\">{label}</span>\n {trailing ? (\n <span className=\"kui-CommandItemSlot\" data-slot=\"trailing\">\n {trailing}\n </span>\n ) : null}\n </>\n );\n\n return (\n <CommandPrimitive.Item\n {...props}\n ref={element}\n data-kui-command-item={id}\n value={itemValue}\n asChild={Boolean(child)}\n onSelect={handleSelect}\n onClickCapture={() => {\n clicked.current = true;\n }}\n data-tone={tone}\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-CommandItem', className)}\n >\n {child ? React.cloneElement(child, undefined, inner(child.props.children)) : inner(children)}\n </CommandPrimitive.Item>\n );\n}\n\ninterface CommandEmptyProps {\n children: React.ReactNode;\n className?: string;\n}\n\n/** What the results pane says when nothing matches. It renders inside that pane. */\nfunction CommandEmpty({ children, className }: CommandEmptyProps) {\n const seat = React.useContext(CommandSeatContext);\n if (!seat?.seat) return null;\n return createPortal(<CommandPrimitive.Empty className={classNames('kui-CommandEmpty', className)}>{children}</CommandPrimitive.Empty>, seat.seat);\n}\n\nexport { Command, CommandTrigger, CommandContent, CommandInput, CommandList, CommandGroup, CommandGroupLabel, CommandCollection, CommandItem, CommandEmpty, ROW_STEP as COMMAND_ROW_STEP };\nexport type {\n CommandProps,\n CommandTriggerProps,\n CommandContentProps,\n CommandInputProps,\n CommandListProps,\n CommandGroupProps,\n CommandGroupLabelProps,\n CommandCollectionProps,\n CommandItemProps,\n CommandEmptyProps,\n CommandOpenChangeDetails,\n CommandOpenChangeReason,\n};\n"],
|
|
5
|
+
"mappings": ";wHAkBA,UAAYA,MAAW,QACvB,OAAS,gBAAAC,MAAoB,YAC7B,OAAOC,MAAgB,aACvB,OAAS,WAAW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AAU,cAAW,IAClEA,CACH,EACE,KACJ,gBAAC,QAAK,UAAU,wBAAwBjB,CAAM,EAC7C6B,EACC,gBAAC,QAAK,UAAU,sBAAsB,YAAU,YAC7CA,CACH,EACE,IACN,EAGF,OACE,gBAACd,EAAiB,KAAjB,CACE,GAAGjB,EACJ,IAAKmC,EACL,wBAAuBD,EACvB,MAAOG,EACP,QAAS,EAAQI,EACjB,SAAUF,EACV,eAAgB,IAAM,CACpBH,EAAQ,QAAU,EACpB,EACA,YAAWJ,EACX,UAAWhB,EAAW,YAAa,mBAAoB,kBAAmBX,CAAS,GAElFoC,EAAc,eAAaA,EAAO,OAAWC,EAAMD,EAAM,MAAM,QAAQ,CAAC,EAAIC,EAAMvD,CAAQ,CAC7F,CAEJ,CAQA,SAASwD,GAAa,CAAE,SAAAxD,EAAU,UAAAkB,CAAU,EAAsB,CAChE,IAAMG,EAAa,aAAWzC,CAAkB,EAChD,OAAKyC,GAAM,KACJoC,EAAa,gBAAC3B,EAAiB,MAAjB,CAAuB,UAAWD,EAAW,mBAAoBX,CAAS,GAAIlB,CAAS,EAA2BqB,EAAK,IAAI,EADxH,IAE1B",
|
|
6
|
+
"names": ["React", "createPortal", "classNames", "CommandPrimitive", "DialogPrimitive", "ROW_STEP", "SIZE_DEF", "CommandSizeContext", "CommandQueryContext", "CommandItemsContext", "CommandCloseContext", "CommandListContext", "CommandSeatContext", "defaultItemToString", "item", "record", "key", "defaultFilter", "query", "itemToString", "isGroup", "narrow", "items", "filter", "out", "kept", "member", "Command", "sizeProp", "open", "defaultOpen", "onOpenChange", "children", "size", "useThemeSize", "internalOpen", "setInternalOpen", "controlled", "isOpen", "change", "next", "reason", "close", "DialogPrimitive", "CommandTrigger", "props", "CommandContent", "label", "onQueryChange", "container", "className", "style", "setQuery", "seat", "setSeat", "report", "useBodyPointerEventsCleanup", "changeQuery", "listValue", "seatValue", "PortalTheme", "classNames", "CommandPrimitive", "CommandInput", "leading", "inputRef", "event", "CommandList", "shown", "CommandGroupItemsContext", "CommandGroup", "CommandGroupLabel", "CommandCollection", "CommandItem", "value", "onSelect", "trailing", "tone", "asChild", "id", "element", "clicked", "itemValue", "run", "handleSelect", "node", "child", "inner", "CommandEmpty", "createPortal"]
|
|
7
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{b as P}from"./chunk-G66WDIIV.js";import{h as p,i as b,k as M}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{b as P}from"./chunk-G66WDIIV.js";import{h as p,i as b,k as M}from"./chunk-5BXCPANF.js";import*as o from"react";var S=e=>e===void 0?void 0:e==="closed"?"collapsed":"expanded",f=e=>e==="collapsed"?"closed":"open",s=e=>e===void 0||e==="closed"?"collapsed":"expanded",l=e=>e==="left"?"rail":e;function v(e){let d=o.useCallback(r=>p(e,r),[e]);return o.useSyncExternalStore(d,()=>e.version,()=>0)}function V(){let e=M("useSidebarMode"),d=o.useCallback(t=>p(e,t),[e]),r=o.useSyncExternalStore(d,()=>e.entries.get("sidebar")?.value,()=>{}),i=o.useCallback(t=>{e.entries.get("sidebar")?.setValue(f(t),"toggle")},[e]);return{sidebarMode:S(r)??"expanded",setSidebarMode:i}}var g=()=>{};function x(){let e=M("useShell");o.useEffect(()=>{},[]),v(e);let{breakpoint:d,ready:r}=P(),i=o.useMemo(()=>{let n=a=>m=>e.entries.get(a)?.setValue(m==="collapsed"?"closed":"open","toggle"),u=a=>b(e,a===null?null:l(a));return{setLeftMode:n("rail"),setPanelMode:n("panel"),setInspectorMode:n("inspector"),setBottomMode:n("bottom"),setSidebarMode:a=>e.entries.get("sidebar")?.setValue(f(a),"toggle"),setPeekTarget:u,peekPane:a=>u(a),clearPeek:()=>u(null),setHasLeft:g,setHasSidebar:g,togglePane:a=>e.entries.get(l(a))?.toggle("toggle"),expandPane:a=>e.entries.get(l(a))?.setValue("open","toggle"),collapsePane:a=>e.entries.get(l(a))?.setValue("closed","toggle")}},[e]),t=n=>e.entries.get(n)?.value,c=e.entries.get("rail");return{leftMode:s(t("rail")),leftControlledOpen:c?.value===void 0?void 0:c.value!=="closed",panelMode:s(t("panel")),sidebarMode:S(t("sidebar"))??"expanded",inspectorMode:s(t("inspector")),bottomMode:s(t("bottom")),peekTarget:e.peek,hasLeft:e.entries.has("rail"),hasSidebar:e.entries.has("sidebar"),currentBreakpoint:d,currentBreakpointReady:r,leftResolvedPresentation:c?.presentation,...i}}export{V as a,x as b};
|
|
3
|
+
//# sourceMappingURL=chunk-INGT6DB6.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as F}from"./chunk-COLJWVN7.js";import{a as z,b as V,c as j}from"./chunk-TUZ665BA.js";import{a as O,b as U,c as q,e as C,f as $}from"./chunk-KBSH6CBD.js";import{a as E}from"./chunk-JFJV4HL3.js";import{b as L}from"./chunk-5KMEUZWN.js";import{d as H}from"./chunk-GKDGNPBD.js";import{a as W}from"./chunk-QPRUTOLI.js";import{b as y,c as K}from"./chunk-NFSW36RG.js";import{a as ue}from"./chunk-VQPANPMI.js";var fe={};ue(fe,{Group:()=>oe,GroupContent:()=>ie,GroupLabel:()=>ae,Menu:()=>Y,MenuButton:()=>T,MenuItem:()=>D,MenuSub:()=>ee,MenuSubContent:()=>re,MenuSubTrigger:()=>te,Search:()=>se,Separator:()=>Q});import*as e from"react";import d from"classnames";import*as f from"@radix-ui/react-accordion";var Q=e.forwardRef(({className:t,...r},n)=>e.createElement(F,{...r,ref:n,className:d("kui-SidebarSeparator",t)}));Q.displayName="Sidebar.Separator";var Y=e.forwardRef(({className:t,...r},n)=>e.createElement("ul",{...r,ref:n,className:d("kui-SidebarMenu",t)}));Y.displayName="Sidebar.Menu";var D=e.forwardRef(({className:t,...r},n)=>e.createElement("li",{...r,ref:n,className:d("kui-SidebarMenuItem",t)}));D.displayName="Sidebar.MenuItem";function A(t){if(typeof t=="function"){let r=t;return r.displayName||r.name}if(t&&typeof t=="object"){let r=t;return r.displayName||A(r.render)||A(r.type)}}function ce(t){return t.type==="svg"||t.props?.icon?!0:A(t.type)?.includes("Icon")??!1}function Z(t){return typeof t=="string"||typeof t=="number"}function de(t){let r=e.Children.toArray(t),n=[],o=[];for(let a of r)e.isValidElement(a)&&ce(a)?n.push(a):o.push(Z(a)?e.createElement("span",{key:o.length,className:"kui-SidebarMenuLabel"},a):a);return n.length===0&&r.length>1&&e.isValidElement(r[0])&&(n.push(r[0]),o.shift()),{icons:n,labels:o}}function pe(t){return e.Children.map(t,r=>Z(r)?e.createElement("span",{className:"kui-SidebarMenuLabel"},r):r)}function _(t){if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;let r=t.currentTarget.closest(".kui-SidebarContent, .kui-SidebarSearchPopover"),n=r?Array.from(r.querySelectorAll(".kui-SidebarMenuButton")).filter(u=>u.offsetParent!==null):[],o=n.indexOf(t.currentTarget),a=n[o+(t.key==="ArrowDown"?1:-1)];o!==-1&&a&&(t.preventDefault(),a.focus())}var T=e.forwardRef(({asChild:t=!1,isActive:r=!1,shortcut:n,badge:o,className:a,children:u,onKeyDown:p,...s},l)=>{let c=y(),k=e.useContext(K),g=c?.size??k,M=c?.presentation==="thin",N=t?L:"button",P=i=>{p?.(i),i.defaultPrevented||_(i)},m=M?null:e.createElement(e.Fragment,null,o&&e.createElement("div",{className:"kui-SidebarMenuBadge"},typeof o=="string"?e.createElement(E,{size:g,variant:"soft"},o):e.createElement(E,{size:o.size||g,variant:o.variant||"soft",color:o.color,radius:o.radius},o.content)),n&&e.createElement("div",{className:"kui-BaseMenuShortcut kui-SidebarMenuShortcut"},e.createElement(W,{size:g},n))),h=i=>{if(M){let{icons:v,labels:w}=de(i);if(v.length>0)return e.createElement(e.Fragment,null,e.createElement("span",{className:"kui-SidebarMenuIconWrapper"},v),w)}return e.createElement(e.Fragment,null,pe(i),m)},S;return t&&e.isValidElement(u)&&e.Children.count(u)===1?S=e.cloneElement(u,void 0,h(u.props.children)):t?S=u:S=h(u),e.createElement(N,{type:t?void 0:"button",...s,ref:l,"aria-current":r?"page":void 0,className:d("kui-reset","kui-BaseMenuItem","kui-SidebarMenuButton",a),"data-active":r||void 0,onKeyDown:P},S)});T.displayName="Sidebar.MenuButton";var x=e.createContext("accordion"),ee=e.forwardRef(({defaultOpen:t=!1,children:r,...n},o)=>(y()?.presentation==="thin"?"dropdown":"accordion")==="dropdown"?e.createElement("div",{...n,ref:o},e.createElement(O,null,e.createElement(x.Provider,{value:"dropdown"},r))):e.createElement("div",{...n,ref:o},e.createElement(x.Provider,{value:"accordion"},e.createElement(f.Root,{type:"single",collapsible:!0,defaultValue:t?"item":void 0},e.createElement(f.Item,{value:"item"},r)))));ee.displayName="Sidebar.MenuSub";var te=e.forwardRef(({asChild:t=!1,className:r,children:n,onKeyDown:o,...a},u)=>e.useContext(x)==="dropdown"?e.createElement(U,null,e.createElement("button",{...a,onKeyDown:o,ref:u,type:"button","aria-haspopup":"menu",className:d("kui-reset","kui-BaseMenuItem","kui-SidebarMenuButton","kui-SidebarMenuSubTrigger",r)},n)):e.createElement(f.Header,{asChild:!0},e.createElement("div",null,e.createElement(f.Trigger,{...a,onKeyDown:s=>{_(s),o?.(s)},ref:u,asChild:t,className:d("kui-reset","kui-BaseMenuItem","kui-SidebarMenuButton","kui-SidebarMenuSubTrigger",r)},t?n:e.createElement(e.Fragment,null,n,e.createElement(H,{className:d("kui-BaseMenuSubTriggerIcon","kui-SidebarMenuSubTriggerIcon")}))))));te.displayName="Sidebar.MenuSubTrigger";function X(t,r){if(e.isValidElement(t)&&t.type===T){let{asChild:n,isActive:o,shortcut:a,badge:u,type:p,children:s,...l}=t.props,c={...l,"data-active":o||void 0,"aria-current":o?"page":void 0};return n&&e.isValidElement(s)&&e.Children.count(s)===1?e.createElement(C,{key:r,...c,asChild:!0},s):e.createElement(C,{key:r,...c},s)}return e.isValidElement(t)?e.createElement(C,{key:r,asChild:!0},t):e.createElement(C,{key:r},t)}function le(t){return e.Children.map(t,(r,n)=>e.isValidElement(r)&&r.type===T?e.createElement(D,{key:r.key??n},r):r)}var re=e.forwardRef(({className:t,children:r,...n},o)=>{let a=y();if(e.useContext(x)==="dropdown"){let p=e.Children.map(r,(s,l)=>{if(e.isValidElement(s)&&s.type===D){let c=e.Children.toArray(s.props.children);return X(c.length===1?c[0]:c,l)}return X(s,l)});return e.createElement(q,{...n,ref:o,size:a?.size,className:d(t)},e.createElement($,null,p))}return e.createElement(f.Content,{...n,ref:o,className:d("kui-SidebarMenuSubContent",t)},e.createElement("ul",{className:"kui-SidebarMenuSubList"},le(r)))});re.displayName="Sidebar.MenuSubContent";var ne=e.createContext(null),oe=e.forwardRef(({className:t,...r},n)=>{let o=e.useId(),[a,u]=e.useState(null),p=e.useMemo(()=>({labelId:o,setLabelId:u}),[o]);return e.createElement(ne.Provider,{value:p},e.createElement("div",{role:a?"group":void 0,"aria-labelledby":a??void 0,...r,ref:n,className:d("kui-BaseMenuGroup","kui-SidebarGroup",t)}))});oe.displayName="Sidebar.Group";var ae=e.forwardRef(({asChild:t=!1,className:r,id:n,...o},a)=>{let u=t?L:"div",p=e.useContext(ne),s=n??p?.labelId,l=p?.setLabelId;return e.useEffect(()=>{if(!(!l||!s))return l(s),()=>l(null)},[l,s]),e.createElement(u,{...o,id:s,ref:a,className:d("kui-BaseMenuLabel","kui-SidebarGroupLabel",r)})});ae.displayName="Sidebar.GroupLabel";var ie=e.forwardRef(({className:t,...r},n)=>e.createElement("div",{...r,ref:n,className:d("kui-SidebarGroupContent",t)}));ie.displayName="Sidebar.GroupContent";var B=({className:t})=>e.createElement("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e.createElement("circle",{cx:"11",cy:"11",r:"8"}),e.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),J=({className:t})=>e.createElement("svg",{className:t,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),se=e.forwardRef(({value:t,onValueChange:r,placeholder:n="Search...",children:o,className:a,...u},p)=>{let s=y(),l=s?.presentation==="thin",c=e.useRef(null),k=e.useRef(null),M=`${e.useId()}-results`,N=e.useRef(t);N.current=t;let P=e.useRef(r);P.current=r;let m=n.replace(/\.+$/,""),h=e.useCallback(i=>{i.key==="Escape"&&N.current&&(i.preventDefault(),i.stopPropagation(),P.current(""),c.current?.focus())},[]),S=e.useCallback(i=>{if(i.defaultPrevented)return;let v=k.current;if(!v)return;let w=v.querySelector('[role="group"]');if(!w)return;let b=Array.from(w.querySelectorAll("a, button"));if(b.length===0)return;let G=document.activeElement,I=G===c.current,R=b.indexOf(G);if(i.key.length===1&&!i.ctrlKey&&!i.metaKey&&!i.altKey&&!I&&R!==-1){c.current?.focus();return}switch(i.key){case"ArrowDown":{i.preventDefault(),I||R===-1?b[0]?.focus():R<b.length-1&&b[R+1]?.focus();break}case"ArrowUp":{i.preventDefault(),R<=0?c.current?.focus():b[R-1]?.focus();break}case"Home":{I||(i.preventDefault(),b[0]?.focus());break}case"End":{I||(i.preventDefault(),b[b.length-1]?.focus());break}}},[]);return l?e.createElement("div",{...u,ref:p,className:d("kui-SidebarSearch","kui-SidebarSearch--thin",a)},e.createElement(z,null,e.createElement(V,null,e.createElement("button",{type:"button",className:d("kui-reset","kui-BaseMenuItem","kui-SidebarMenuButton","kui-SidebarSearchTrigger"),"aria-label":m},e.createElement("span",{className:"kui-SidebarMenuIconWrapper"},e.createElement(B,null)),e.createElement("span",{className:"kui-SidebarMenuLabel"},"Search"))),e.createElement(j,{side:"right",align:"start",size:"2",width:"280px","aria-label":m},e.createElement("div",{ref:k,className:"kui-SidebarSearchPopover",role:"search",onKeyDown:S},e.createElement("div",{className:"kui-SidebarSearchInputWrapper"},e.createElement(B,{className:"kui-SidebarSearchIcon"}),e.createElement("input",{ref:c,type:"search",className:"kui-SidebarSearchInput",value:t,onChange:i=>r(i.target.value),onKeyDown:h,placeholder:n,"aria-label":m,"aria-controls":o?M:void 0,autoFocus:!0}),t&&e.createElement("button",{type:"button",className:"kui-reset kui-SidebarSearchClear",onClick:()=>{r(""),c.current?.focus()},"aria-label":"Clear search"},e.createElement(J,null))),o&&e.createElement("div",{id:M,role:"group","aria-label":"Search results"},o))))):e.createElement("div",{...u,ref:p,className:d("kui-SidebarSearch","kui-SidebarSearch--expanded","kui-ShellPaneChrome",`kui-r-size-${s?.size??"2"}`,a),role:"search"},e.createElement("div",{className:"kui-SidebarSearchInputWrapper"},e.createElement(B,{className:"kui-SidebarSearchIcon"}),e.createElement("input",{ref:c,type:"search",className:"kui-SidebarSearchInput",value:t,onChange:i=>r(i.target.value),onKeyDown:h,placeholder:n,"aria-label":m}),t&&e.createElement("button",{type:"button",className:"kui-reset kui-SidebarSearchClear",onClick:()=>{r(""),c.current?.focus()},"aria-label":"Clear search"},e.createElement(J,null))))});se.displayName="Sidebar.Search";export{Q as a,Y as b,D as c,T as d,ee as e,te as f,re as g,oe as h,ae as i,ie as j,se as k,fe as l};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as F}from"./chunk-COLJWVN7.js";import{a as z,b as V,c as j}from"./chunk-TUZ665BA.js";import{a as O,b as U,c as q,e as C,f as $}from"./chunk-KBSH6CBD.js";import{a as E}from"./chunk-JFJV4HL3.js";import{b as L}from"./chunk-5KMEUZWN.js";import{d as H}from"./chunk-GKDGNPBD.js";import{a as W}from"./chunk-QPRUTOLI.js";import{b as y,c as K}from"./chunk-ODHCDJ3Y.js";import{a as ue}from"./chunk-VQPANPMI.js";var fe={};ue(fe,{Group:()=>oe,GroupContent:()=>ie,GroupLabel:()=>ae,Menu:()=>Y,MenuButton:()=>T,MenuItem:()=>D,MenuSub:()=>ee,MenuSubContent:()=>re,MenuSubTrigger:()=>te,Search:()=>se,Separator:()=>Q});import*as e from"react";import d from"classnames";import*as f from"@radix-ui/react-accordion";var Q=e.forwardRef(({className:t,...r},n)=>e.createElement(F,{...r,ref:n,className:d("kui-SidebarSeparator",t)}));Q.displayName="Sidebar.Separator";var Y=e.forwardRef(({className:t,...r},n)=>e.createElement("ul",{...r,ref:n,className:d("kui-SidebarMenu",t)}));Y.displayName="Sidebar.Menu";var D=e.forwardRef(({className:t,...r},n)=>e.createElement("li",{...r,ref:n,className:d("kui-SidebarMenuItem",t)}));D.displayName="Sidebar.MenuItem";function A(t){if(typeof t=="function"){let r=t;return r.displayName||r.name}if(t&&typeof t=="object"){let r=t;return r.displayName||A(r.render)||A(r.type)}}function ce(t){return t.type==="svg"||t.props?.icon?!0:A(t.type)?.includes("Icon")??!1}function Z(t){return typeof t=="string"||typeof t=="number"}function de(t){let r=e.Children.toArray(t),n=[],o=[];for(let a of r)e.isValidElement(a)&&ce(a)?n.push(a):o.push(Z(a)?e.createElement("span",{key:o.length,className:"kui-SidebarMenuLabel"},a):a);return n.length===0&&r.length>1&&e.isValidElement(r[0])&&(n.push(r[0]),o.shift()),{icons:n,labels:o}}function pe(t){return e.Children.map(t,r=>Z(r)?e.createElement("span",{className:"kui-SidebarMenuLabel"},r):r)}function _(t){if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;let r=t.currentTarget.closest(".kui-SidebarContent, .kui-SidebarSearchPopover"),n=r?Array.from(r.querySelectorAll(".kui-SidebarMenuButton")).filter(u=>u.offsetParent!==null):[],o=n.indexOf(t.currentTarget),a=n[o+(t.key==="ArrowDown"?1:-1)];o!==-1&&a&&(t.preventDefault(),a.focus())}var T=e.forwardRef(({asChild:t=!1,isActive:r=!1,shortcut:n,badge:o,className:a,children:u,onKeyDown:p,...s},l)=>{let c=y(),k=e.useContext(K),g=c?.size??k,M=c?.presentation==="thin",N=t?L:"button",P=i=>{p?.(i),i.defaultPrevented||_(i)},m=M?null:e.createElement(e.Fragment,null,o&&e.createElement("div",{className:"kui-SidebarMenuBadge"},typeof o=="string"?e.createElement(E,{size:g,variant:"soft"},o):e.createElement(E,{size:o.size||g,variant:o.variant||"soft",color:o.color,radius:o.radius},o.content)),n&&e.createElement("div",{className:"kui-BaseMenuShortcut kui-SidebarMenuShortcut"},e.createElement(W,{size:g},n))),h=i=>{if(M){let{icons:v,labels:w}=de(i);if(v.length>0)return e.createElement(e.Fragment,null,e.createElement("span",{className:"kui-SidebarMenuIconWrapper"},v),w)}return e.createElement(e.Fragment,null,pe(i),m)},S;return t&&e.isValidElement(u)&&e.Children.count(u)===1?S=e.cloneElement(u,void 0,h(u.props.children)):t?S=u:S=h(u),e.createElement(N,{type:t?void 0:"button",...s,ref:l,"aria-current":r?"page":void 0,className:d("kui-reset","kui-BaseMenuItem","kui-SidebarMenuButton",a),"data-active":r||void 0,onKeyDown:P},S)});T.displayName="Sidebar.MenuButton";var x=e.createContext("accordion"),ee=e.forwardRef(({defaultOpen:t=!1,children:r,...n},o)=>(y()?.presentation==="thin"?"dropdown":"accordion")==="dropdown"?e.createElement("div",{...n,ref:o},e.createElement(O,null,e.createElement(x.Provider,{value:"dropdown"},r))):e.createElement("div",{...n,ref:o},e.createElement(x.Provider,{value:"accordion"},e.createElement(f.Root,{type:"single",collapsible:!0,defaultValue:t?"item":void 0},e.createElement(f.Item,{value:"item"},r)))));ee.displayName="Sidebar.MenuSub";var te=e.forwardRef(({asChild:t=!1,className:r,children:n,onKeyDown:o,...a},u)=>e.useContext(x)==="dropdown"?e.createElement(U,null,e.createElement("button",{...a,onKeyDown:o,ref:u,type:"button","aria-haspopup":"menu",className:d("kui-reset","kui-BaseMenuItem","kui-SidebarMenuButton","kui-SidebarMenuSubTrigger",r)},n)):e.createElement(f.Header,{asChild:!0},e.createElement("div",null,e.createElement(f.Trigger,{...a,onKeyDown:s=>{_(s),o?.(s)},ref:u,asChild:t,className:d("kui-reset","kui-BaseMenuItem","kui-SidebarMenuButton","kui-SidebarMenuSubTrigger",r)},t?n:e.createElement(e.Fragment,null,n,e.createElement(H,{className:d("kui-BaseMenuSubTriggerIcon","kui-SidebarMenuSubTriggerIcon")}))))));te.displayName="Sidebar.MenuSubTrigger";function X(t,r){if(e.isValidElement(t)&&t.type===T){let{asChild:n,isActive:o,shortcut:a,badge:u,type:p,children:s,...l}=t.props,c={...l,"data-active":o||void 0,"aria-current":o?"page":void 0};return n&&e.isValidElement(s)&&e.Children.count(s)===1?e.createElement(C,{key:r,...c,asChild:!0},s):e.createElement(C,{key:r,...c},s)}return e.isValidElement(t)?e.createElement(C,{key:r,asChild:!0},t):e.createElement(C,{key:r},t)}function le(t){return e.Children.map(t,(r,n)=>e.isValidElement(r)&&r.type===T?e.createElement(D,{key:r.key??n},r):r)}var re=e.forwardRef(({className:t,children:r,...n},o)=>{let a=y();if(e.useContext(x)==="dropdown"){let p=e.Children.map(r,(s,l)=>{if(e.isValidElement(s)&&s.type===D){let c=e.Children.toArray(s.props.children);return X(c.length===1?c[0]:c,l)}return X(s,l)});return e.createElement(q,{...n,ref:o,size:a?.size,className:d(t)},e.createElement($,null,p))}return e.createElement(f.Content,{...n,ref:o,className:d("kui-SidebarMenuSubContent",t)},e.createElement("ul",{className:"kui-SidebarMenuSubList"},le(r)))});re.displayName="Sidebar.MenuSubContent";var ne=e.createContext(null),oe=e.forwardRef(({className:t,...r},n)=>{let o=e.useId(),[a,u]=e.useState(null),p=e.useMemo(()=>({labelId:o,setLabelId:u}),[o]);return e.createElement(ne.Provider,{value:p},e.createElement("div",{role:a?"group":void 0,"aria-labelledby":a??void 0,...r,ref:n,className:d("kui-BaseMenuGroup","kui-SidebarGroup",t)}))});oe.displayName="Sidebar.Group";var ae=e.forwardRef(({asChild:t=!1,className:r,id:n,...o},a)=>{let u=t?L:"div",p=e.useContext(ne),s=n??p?.labelId,l=p?.setLabelId;return e.useEffect(()=>{if(!(!l||!s))return l(s),()=>l(null)},[l,s]),e.createElement(u,{...o,id:s,ref:a,className:d("kui-BaseMenuLabel","kui-SidebarGroupLabel",r)})});ae.displayName="Sidebar.GroupLabel";var ie=e.forwardRef(({className:t,...r},n)=>e.createElement("div",{...r,ref:n,className:d("kui-SidebarGroupContent",t)}));ie.displayName="Sidebar.GroupContent";var B=({className:t})=>e.createElement("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e.createElement("circle",{cx:"11",cy:"11",r:"8"}),e.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),J=({className:t})=>e.createElement("svg",{className:t,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),se=e.forwardRef(({value:t,onValueChange:r,placeholder:n="Search...",children:o,className:a,...u},p)=>{let s=y(),l=s?.presentation==="thin",c=e.useRef(null),k=e.useRef(null),M=`${e.useId()}-results`,N=e.useRef(t);N.current=t;let P=e.useRef(r);P.current=r;let m=n.replace(/\.+$/,""),h=e.useCallback(i=>{i.key==="Escape"&&N.current&&(i.preventDefault(),i.stopPropagation(),P.current(""),c.current?.focus())},[]),S=e.useCallback(i=>{if(i.defaultPrevented)return;let v=k.current;if(!v)return;let w=v.querySelector('[role="group"]');if(!w)return;let b=Array.from(w.querySelectorAll("a, button"));if(b.length===0)return;let G=document.activeElement,I=G===c.current,R=b.indexOf(G);if(i.key.length===1&&!i.ctrlKey&&!i.metaKey&&!i.altKey&&!I&&R!==-1){c.current?.focus();return}switch(i.key){case"ArrowDown":{i.preventDefault(),I||R===-1?b[0]?.focus():R<b.length-1&&b[R+1]?.focus();break}case"ArrowUp":{i.preventDefault(),R<=0?c.current?.focus():b[R-1]?.focus();break}case"Home":{I||(i.preventDefault(),b[0]?.focus());break}case"End":{I||(i.preventDefault(),b[b.length-1]?.focus());break}}},[]);return l?e.createElement("div",{...u,ref:p,className:d("kui-SidebarSearch","kui-SidebarSearch--thin",a)},e.createElement(z,null,e.createElement(V,null,e.createElement("button",{type:"button",className:d("kui-reset","kui-BaseMenuItem","kui-SidebarMenuButton","kui-SidebarSearchTrigger"),"aria-label":m},e.createElement("span",{className:"kui-SidebarMenuIconWrapper"},e.createElement(B,null)),e.createElement("span",{className:"kui-SidebarMenuLabel"},"Search"))),e.createElement(j,{side:"right",align:"start",size:"2",width:"280px","aria-label":m},e.createElement("div",{ref:k,className:"kui-SidebarSearchPopover",role:"search",onKeyDown:S},e.createElement("div",{className:"kui-SidebarSearchInputWrapper"},e.createElement(B,{className:"kui-SidebarSearchIcon"}),e.createElement("input",{ref:c,type:"search",className:"kui-SidebarSearchInput",value:t,onChange:i=>r(i.target.value),onKeyDown:h,placeholder:n,"aria-label":m,"aria-controls":o?M:void 0,autoFocus:!0}),t&&e.createElement("button",{type:"button",className:"kui-reset kui-SidebarSearchClear",onClick:()=>{r(""),c.current?.focus()},"aria-label":"Clear search"},e.createElement(J,null))),o&&e.createElement("div",{id:M,role:"group","aria-label":"Search results"},o))))):e.createElement("div",{...u,ref:p,className:d("kui-SidebarSearch","kui-SidebarSearch--expanded","kui-ShellPaneChrome",`kui-r-size-${s?.size??"2"}`,a),role:"search"},e.createElement("div",{className:"kui-SidebarSearchInputWrapper"},e.createElement(B,{className:"kui-SidebarSearchIcon"}),e.createElement("input",{ref:c,type:"search",className:"kui-SidebarSearchInput",value:t,onChange:i=>r(i.target.value),onKeyDown:h,placeholder:n,"aria-label":m}),t&&e.createElement("button",{type:"button",className:"kui-reset kui-SidebarSearchClear",onClick:()=>{r(""),c.current?.focus()},"aria-label":"Clear search"},e.createElement(J,null))))});se.displayName="Sidebar.Search";export{Q as a,Y as b,D as c,T as d,ee as e,te as f,re as g,oe as h,ae as i,ie as j,se as k,fe as l};
|
|
3
|
+
//# sourceMappingURL=chunk-J6B7UCZN.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{b as H,d as U,g as D}from"./chunk-XUCR7L4G.js";import{a as V,c as m}from"./chunk-3QWGSRYC.js";import{a as k,b as N,c as w}from"./chunk-KGCGT4MJ.js";import{a as B,b as I,c as A}from"./chunk-QKCNGEX4.js";import{a as T}from"./chunk-WEBNIUEX.js";import{a as y}from"./chunk-G66WDIIV.js";import{b as M}from"./chunk-VWRPVM5K.js";import{f as E}from"./chunk-ODHCDJ3Y.js";import{o as x}from"./chunk-5BXCPANF.js";import*as e from"react";import ue from"classnames";import{useComposedRefs as Se}from"radix-ui/internal";var L=t=>t==="collapsed"?"closed":"open",ce=t=>t==="closed"?"collapsed":"expanded";function O(t){if(t===void 0)return;if(typeof t=="string")return L(t);let n={};for(let[r,i]of Object.entries(t))i!==void 0&&(n[r]=L(i));return n}var me={controlled:"state",default:"defaultState"},be={initial:"overlay",sm:"fixed"},_=e.forwardRef((t,n)=>{let{className:r,presentation:i=be,expandedSize:o=288,minSize:s=200,maxSize:d=400,resizable:b=!1,collapsible:$=!0,onExpand:F,onCollapse:W,onResize:j,onResizeStart:q,onResizeEnd:G,snapPoints:l,snapTolerance:K,collapseThreshold:p,paneId:u,persistence:S,children:J,style:Q,state:X,defaultState:Y,onStateChange:Z,size:f,defaultSize:P,onSizeChange:ee,sizeUpdate:ae,sizeUpdateMs:te=50,flush:h=!0,id:ne,...c}=t,{table:g,attributes:ie}=w(i,"fixed"),a=k({name:"sidebar",label:"Sidebar",propNames:me,id:ne,controlled:O(X),defaultValue:O(Y),presentationTable:g,builtIn:H,onChange:(le,pe)=>Z?.(ce(le),{reason:pe}),onExpand:F,onCollapse:W,size:o});x("sidebar",h),e.useEffect(()=>{(l!==void 0||p!==void 0||u!==void 0||S!==void 0)&&void 0},[l,p,u,S]);let z=e.useRef(null),oe=Se(n,a.setElement,z),re=I({name:"sidebar",elementId:a.id,elementRef:z,cssVarName:"--sidebar-size",orientation:"vertical",edge:"end",growth:U,expandedSize:o,minSize:s,maxSize:d,resizable:b,collapsible:$,size:f,defaultSize:P,onSizeChange:ee,sizeUpdate:ae,sizeUpdateMs:te,onResize:j,onResizeStart:q,onResizeEnd:G,snapPoints:l,snapTolerance:K,collapseThreshold:p,paneId:u,persistence:S,overlaying:a.overlaying,overlayingNow:()=>g[y()]==="overlay",requestCollapse:()=>a.setValue("closed","toggle"),requestToggle:()=>a.toggle("toggle")}),{handles:v,content:se}=A(J,m),de=b&&a.value!=="closed"&&!a.overlaying?e.createElement(T.Provider,{value:re},v.length>0?v:e.createElement(V,null)):null,R=a.peeking?`var(--sidebar-size, ${o}px)`:void 0,C=B(f,P,s,d);return e.createElement("div",{...D(c),role:c.role??"navigation",id:a.id,ref:oe,className:ue("kui-ShellPane","kui-ShellSidebar",r),...N(a,ie),"data-flush":h||void 0,tabIndex:a.overlaying?-1:c.tabIndex,style:{...Q,"--sidebar-expanded-size":`${o}px`,...C?{"--sidebar-size":C}:{},"--sidebar-min-size":`${s}px`,"--sidebar-max-size":`${d}px`,...R?{"--peek-sidebar-width":R}:{}}},e.createElement("div",{className:"kui-ShellSidebarContent"},e.createElement(E,null,e.createElement(M,null,se))),de)});_.displayName="Shell.Sidebar";_.Handle=m;export{_ as a};
|
|
3
|
+
//# sourceMappingURL=chunk-KDJM4NQQ.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/_internal/shell-sidebar.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { useComposedRefs } from 'radix-ui/internal';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { PaneHandle, SidebarHandle } from './shell-handles.js';\nimport { usePane, paneAttributes, usePresentationTable } from './shell-pane.js';\nimport { splitHandles, useInitialPaneSize, useResizablePane, type SizeChangeMeta } from './shell-resizable.js';\nimport { useFrameRegistration, warnOnce, type PaneValue } from './shell-store.js';\nimport { navigationRest, startAnchoredGrowth, withoutRemovedPaneProps } from './shell-rest.js';\nimport { readBreakpoint } from '../../hooks/use-breakpoint.js';\nimport { PaneChromeScope } from './pane-chrome.js';\nimport { PageScope } from './page-scope.js';\nimport type { Breakpoint, CSSPropertiesWithVars, PaneBaseProps, Responsive, SidebarMode } from '../shell.types.js';\n\ntype SidebarStateChangeMeta = { reason: 'init' | 'toggle' | 'responsive' | 'dismiss' };\ntype SidebarControlledProps = { state: Responsive<SidebarMode>; onStateChange?: (state: SidebarMode, meta: SidebarStateChangeMeta) => void; defaultState?: never };\ntype SidebarUncontrolledProps = { defaultState?: SidebarMode | Partial<Record<Breakpoint, SidebarMode>>; onStateChange?: (state: SidebarMode, meta: SidebarStateChangeMeta) => void; state?: never };\ntype SidebarPublicProps = PaneBaseProps & {\n size?: number | string;\n defaultSize?: number | string;\n onSizeChange?: (size: number, meta: SizeChangeMeta) => void;\n sizeUpdate?: 'throttle' | 'debounce';\n sizeUpdateMs?: number;\n /**\n * Sets whether this pane joins the app frame. The default is `true`: the pane sits against its\n * neighbours with one hairline between them. Set `flush={false}` to pull it off the frame as a\n * card. It then floats over the content if the content is flush, and otherwise sits on the\n * Shell's background beside a card content.\n */\n flush?: boolean;\n} & (SidebarControlledProps | SidebarUncontrolledProps);\n\ntype SidebarComponent = React.ForwardRefExoticComponent<SidebarPublicProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof SidebarHandle };\n\nconst toValue = (mode: SidebarMode): PaneValue => (mode === 'collapsed' ? 'closed' : 'open');\nconst toMode = (value: PaneValue): SidebarMode => (value === 'closed' ? 'collapsed' : 'expanded');\n\nfunction modeToValue(state: Responsive<SidebarMode> | undefined): PaneValue | Partial<Record<Breakpoint, PaneValue>> | undefined {\n if (state === undefined) return undefined;\n if (typeof state === 'string') return toValue(state);\n const map: Partial<Record<Breakpoint, PaneValue>> = {};\n for (const [bp, mode] of Object.entries(state) as Array<[Breakpoint, SidebarMode | undefined]>) {\n if (mode !== undefined) map[bp] = toValue(mode);\n }\n return map;\n}\n\nconst SIDEBAR_PROP_NAMES = { controlled: 'state', default: 'defaultState' };\n\n/** Since 0.8.0 the Sidebar is in the frame from 768px up, the boundary kookie-ui-v2 uses everywhere. It was 1024px. */\nconst SIDEBAR_DEFAULT_PRESENTATION = { initial: 'overlay', sm: 'fixed' } as const;\n\n\nexport const Sidebar = React.forwardRef<HTMLDivElement, SidebarPublicProps>((props, ref) => {\n const {\n className,\n presentation = SIDEBAR_DEFAULT_PRESENTATION,\n expandedSize = 288,\n minSize = 200,\n maxSize = 400,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n state,\n defaultState,\n onStateChange,\n size,\n defaultSize,\n onSizeChange,\n sizeUpdate,\n sizeUpdateMs = 50,\n flush = true,\n id,\n ...domProps\n } = props;\n\n const { table, attributes } = usePresentationTable(presentation, 'fixed');\n const pane = usePane({\n name: 'sidebar',\n label: 'Sidebar',\n propNames: SIDEBAR_PROP_NAMES,\n id,\n controlled: modeToValue(state),\n defaultValue: modeToValue(defaultState),\n presentationTable: table,\n builtIn: navigationRest,\n onChange: (value, reason) => onStateChange?.(toMode(value), { reason }),\n onExpand,\n onCollapse,\n size: expandedSize,\n });\n useFrameRegistration('sidebar', flush);\n\n React.useEffect(() => {\n if (snapPoints !== undefined || collapseThreshold !== undefined || paneId !== undefined || persistence !== undefined) {\n warnOnce('Shell.Sidebar: `snapPoints`, `collapseThreshold`, `paneId` and `persistence` are deprecated and are removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`.');\n }\n }, [snapPoints, collapseThreshold, paneId, persistence]);\n\n const elementRef = React.useRef<HTMLElement | null>(null);\n const composedRef = useComposedRefs(ref, pane.setElement, elementRef);\n\n const resize = useResizablePane({\n name: 'sidebar',\n elementId: pane.id,\n elementRef,\n cssVarName: '--sidebar-size',\n orientation: 'vertical',\n edge: 'end',\n growth: startAnchoredGrowth,\n expandedSize,\n minSize,\n maxSize,\n resizable,\n collapsible,\n size,\n defaultSize,\n onSizeChange,\n sizeUpdate,\n sizeUpdateMs,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n overlaying: pane.overlaying,\n overlayingNow: () => table[readBreakpoint()] === 'overlay',\n requestCollapse: () => pane.setValue('closed', 'toggle'),\n requestToggle: () => pane.toggle('toggle'),\n });\n\n const { handles, content } = splitHandles(children, SidebarHandle);\n const handle =\n resizable && pane.value !== 'closed' && !pane.overlaying ? (\n <PaneResizeContext.Provider value={resize}>{handles.length > 0 ? handles : <PaneHandle />}</PaneResizeContext.Provider>\n ) : null;\n\n // A peek previews the width the next toggle opens to.\n const peekWidth = pane.peeking ? `var(--sidebar-size, ${expandedSize}px)` : undefined;\n\n const initialSize = useInitialPaneSize(size, defaultSize, minSize, maxSize);\n return (\n <div\n {...withoutRemovedPaneProps(domProps)}\n role={domProps.role ?? 'navigation'}\n id={pane.id}\n ref={composedRef}\n className={classNames('kui-ShellPane', 'kui-ShellSidebar', className)}\n {...paneAttributes(pane, attributes)}\n data-flush={flush || undefined}\n tabIndex={pane.overlaying ? -1 : domProps.tabIndex}\n style={\n {\n ...style,\n '--sidebar-expanded-size': `${expandedSize}px`,\n ...(initialSize ? { '--sidebar-size': initialSize } : {}),\n '--sidebar-min-size': `${minSize}px`,\n '--sidebar-max-size': `${maxSize}px`,\n ...(peekWidth ? { '--peek-sidebar-width': peekWidth } : {}),\n } as CSSPropertiesWithVars\n }\n >\n <div className=\"kui-ShellSidebarContent\">\n <PaneChromeScope>\n <PageScope>{content}</PageScope>\n </PaneChromeScope>\n </div>\n {handle}\n </div>\n );\n}) as SidebarComponent;\n\nSidebar.displayName = 'Shell.Sidebar';\nSidebar.Handle = SidebarHandle;\n\nexport type { SidebarPublicProps };\n"],
|
|
5
|
+
"mappings": ";yZAEA,UAAYA,MAAW,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kD,EAAwB1B,CAAQ,EACpC,KAAMA,EAAS,MAAQ,aACvB,GAAII,EAAK,GACT,IAAKM,GACL,UAAWiB,GAAW,gBAAiB,mBAAoBvD,CAAS,EACnE,GAAGwD,EAAexB,EAAMF,EAAU,EACnC,aAAYJ,GAAS,OACrB,SAAUM,EAAK,WAAa,GAAKJ,EAAS,SAC1C,MACE,CACE,GAAGV,EACH,0BAA2B,GAAGhB,CAAY,KAC1C,GAAIkD,EAAc,CAAE,iBAAkBA,CAAY,EAAI,CAAC,EACvD,qBAAsB,GAAGjD,CAAO,KAChC,qBAAsB,GAAGC,CAAO,KAChC,GAAI+C,EAAY,CAAE,uBAAwBA,CAAU,EAAI,CAAC,CAC3D,GAGF,gBAAC,OAAI,UAAU,2BACb,gBAACM,EAAA,KACC,gBAACC,EAAA,KAAWb,EAAQ,CACtB,CACF,EACCG,EACH,CAEJ,CAAC,EAEDnD,EAAQ,YAAc,gBACtBA,EAAQ,OAASkD",
|
|
6
|
+
"names": ["React", "classNames", "useComposedRefs", "toValue", "mode", "toMode", "value", "modeToValue", "state", "map", "bp", "SIDEBAR_PROP_NAMES", "SIDEBAR_DEFAULT_PRESENTATION", "Sidebar", "props", "ref", "className", "presentation", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "defaultState", "onStateChange", "size", "defaultSize", "onSizeChange", "sizeUpdate", "sizeUpdateMs", "flush", "id", "domProps", "table", "attributes", "usePresentationTable", "pane", "usePane", "navigationRest", "reason", "useFrameRegistration", "elementRef", "composedRef", "useComposedRefs", "resize", "useResizablePane", "startAnchoredGrowth", "readBreakpoint", "handles", "content", "splitHandles", "SidebarHandle", "handle", "PaneResizeContext", "PaneHandle", "peekWidth", "initialSize", "useInitialPaneSize", "withoutRemovedPaneProps", "classNames", "paneAttributes", "PaneChromeScope", "PageScope"]
|
|
7
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as O,b as _}from"./chunk-G66WDIIV.js";import{a as C,b,c as $,d as B,g as M,k as q,m as F}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as O,b as _}from"./chunk-G66WDIIV.js";import{a as C,b,c as $,d as B,g as M,k as q,m as F}from"./chunk-5BXCPANF.js";import*as t from"react";import{useLayoutEffect as v}from"radix-ui/internal";var I=e=>typeof e=="object"&&e!==null;function ne(e){for(let a of["initial","xs","sm","md","lg","xl"]){let l=e[a];if(l!==void 0)return l}return"closed"}function re(e){let{name:a,label:l,propNames:o,presentationTable:r,builtIn:m}=e,d=q(`Shell.${l}`),G=t.useId(),k=e.id??`shell-${a}${G}`,c=e.controlled!==void 0,x=I(e.controlled);x&&(`${l}${o.controlled}${o.default}`,void 0);let p=x?e.controlled:void 0,z=p??(I(e.defaultValue)?e.defaultValue:void 0),J=B(z),[Q,W]=t.useState(()=>typeof e.defaultValue=="string"?e.defaultValue:"auto"),P=t.useMemo(()=>p?C(p,()=>ne(p)):C(z,n=>m(r[n])),[J,x,r,m]),u=Q;c&&(u=p?"auto":e.controlled);let X=b(r)===void 0||u==="auto"&&b(P)===void 0,{breakpoint:H,ready:L}=_(X),j=n=>{let f=b(n);return f!==void 0?f:L?n[H]:void 0},i=u==="auto"?j(P):u,y=j(r),E=y==="overlay",s=i===void 0?void 0:i!=="closed",N=s===!0&&E,D=e.defaultValue,V=t.useRef({state:u,value:i,autoTable:P,defaultValue:D,controlled:c,onChange:e.onChange,toggleNext:e.toggleNext});v(()=>{V.current={state:u,value:i,autoTable:P,defaultValue:D,controlled:c,onChange:e.onChange,toggleNext:e.toggleNext}});let h=t.useCallback(()=>{let n=V.current;return n.value!==void 0?n.value:n.state==="auto"?n.autoTable[O()]:void 0},[]),T=t.useCallback(()=>{let n=V.current;return typeof n.defaultValue=="string"?n.defaultValue:I(n.defaultValue)?n.autoTable[O()]:void 0},[]),g=t.useCallback((n,f)=>{let R=V.current;h()!==n&&(R.onChange?.(n,f),R.controlled||W(n))},[h]),w=t.useCallback(n=>{let f=V.current,R=h()??"closed",ee=f.toggleNext?f.toggleNext(R,T()):R==="closed"?"open":"closed";g(ee,n)},[g,h,T]),A=t.useRef(null),Y=t.useCallback(n=>{A.current=n},[]);v(()=>{let n={name:a,id:k,el:A.current,value:i,presentation:y,presentationTable:r,overlayLive:N,size:e.size,setValue:g,toggle:w};return d.entries.set(a,n),M(d),()=>{d.entries.get(a)===n&&(d.entries.delete(a),M(d))}},[d,a,k,i,y,r,N,e.size,g,w]);let S=t.useRef({onExpand:e.onExpand,onCollapse:e.onCollapse});v(()=>{S.current={onExpand:e.onExpand,onCollapse:e.onCollapse}});let K=t.useRef({state:u,shown:s});t.useEffect(()=>{let n=K.current;n.state!==u&&n.shown!==void 0&&s!==void 0&&n.shown!==s&&(s?S.current.onExpand?.():S.current.onCollapse?.()),K.current={state:u,shown:s}},[u,s]),v(()=>{},[]);let U=t.useRef(c);t.useEffect(()=>{},[c,l,o.controlled]);let Z=F(d,a)&&s===!1&&!E;return{store:d,id:k,state:u,value:i,shown:s,presentation:y,overlaying:E,overlayLive:N,peeking:Z,ready:L,breakpoint:H,autoTable:P,setValue:g,toggle:w,defaultHereNow:T,setElement:Y}}function ue(e,a){let{state:l,value:o,presentation:r,shown:m}=e;return{...a,"data-state":l,...l==="auto"?$("auto",e.autoTable):{},"data-presentation":r,"data-mode":o===void 0?void 0:o==="closed"?"collapsed":"expanded","data-open":r==="stacked"&&m?"":void 0,"data-peek":e.peeking?"":void 0}}function se(e,a){let l=B(e),o=t.useMemo(()=>C(e,()=>a),[l,a]),r=t.useMemo(()=>b(o)===void 0?$("presentation",o):{},[o]);return{table:o,attributes:r}}export{re as a,ue as b,se as c};
|
|
3
|
+
//# sourceMappingURL=chunk-KGCGT4MJ.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{a as Ye,b as Xe}from"./chunk-INGT6DB6.js";import{a as Je}from"./chunk-B447PNRD.js";import{a as Ge}from"./chunk-KDJM4NQQ.js";import{a as Ke}from"./chunk-UMQOTGJC.js";import{a as je}from"./chunk-XD676L6S.js";import{a as J,b as _e,c as Ue,d as qe,g as $e}from"./chunk-XUCR7L4G.js";import{a as Ie,b as Pe}from"./chunk-3QWGSRYC.js";import{a as he,b as ve,c as Se}from"./chunk-KGCGT4MJ.js";import{a as Be,b as Ve,c as We}from"./chunk-QKCNGEX4.js";import{a as De}from"./chunk-WEBNIUEX.js";import{b as ye}from"./chunk-5ON3XLRD.js";import{a as Le}from"./chunk-G66WDIIV.js";import{b as ie}from"./chunk-VWRPVM5K.js";import{c as pe,d as fe,e as Fe,f as me,i as Ae,j as Ne,k as Oe}from"./chunk-ODHCDJ3Y.js";import{c as ke,d as we}from"./chunk-QEDKL23P.js";import{e as ce,f as Me,h as ze,i as ne,j as He,k as ue,l as de,n as xe,o as oe}from"./chunk-5BXCPANF.js";import{a as Te}from"./chunk-ANQLWGFN.js";import{a as it}from"./chunk-VQPANPMI.js";var ht={};it(ht,{Bottom:()=>Ke,Content:()=>rt,Header:()=>ot,Inspector:()=>je,Left:()=>lt,PaneFooter:()=>Ne,PaneHeader:()=>Ae,Panel:()=>Ee,Rail:()=>at,Root:()=>nt,Scroll:()=>Oe,Sidebar:()=>Ge,Trigger:()=>st,useResponsivePresentation:()=>Je,useShell:()=>Xe,useSidebarMode:()=>Ye});import*as e from"react";import $ from"classnames";import{Slot as ct}from"radix-ui";import{useComposedRefs as Ce,useLayoutEffect as ut}from"radix-ui/internal";var Re=0;function Qe(a){Re=Math.max(0,Re+a);let r=document.documentElement;Re>0?r.setAttribute("data-kui-shell-lock",""):r.removeAttribute("data-kui-shell-lock")}var ge="data-kui-shell-inert",dt=30;function Q(a,r){return r===null||r===a||r===a.body||r===a.documentElement}function Ze(a,r,s){for(let d of a.querySelectorAll("[data-shell-trigger][aria-controls]"))if(!(d.getAttribute("aria-controls")!==r||d.closest("[inert]"))&&!(s&&!s.some(S=>S.contains(d))))return d;return null}var pt={values:["1","2","3"]},tt=e.createContext(null),et=64;function be(a){return a.querySelector(":scope > .kui-ShellContent > .kui-ShellScroll > .kui-ScrollAreaViewport")??a.querySelector(":scope > .kui-ShellContent")}var nt=e.forwardRef(({className:a,children:r,height:s="full",contained:d,size:S,style:x,onKeyDown:g,onFocus:k,...w},L)=>{let P=ye(S,pt),[i]=e.useState(Me),C=e.useCallback(t=>ze(i,t),[i]);e.useSyncExternalStore(C,()=>i.version,()=>0);let R=e.useRef(null),I=Ce(L,R),[T,F]=e.useState(()=>new Set),A=e.useCallback(t=>{F(n=>n.has(t)?n:new Set(n).add(t))},[]),f=e.useCallback(t=>{F(n=>{if(!n.has(t))return n;let o=new Set(n);return o.delete(t),o})},[]),m=e.useMemo(()=>({registerOffFrame:A,unregisterOffFrame:f}),[A,f]),N=e.useCallback(()=>{for(let t of i.entries.values())t.overlayLive&&t.setValue("closed","dismiss")},[i]),M=e.useCallback(()=>[...i.entries.values()].filter(t=>t.overlayLive&&t.el).map(t=>({name:t.name,id:t.id,el:t.el})),[i]),E=[...i.entries.values()].filter(t=>t.overlayLive&&t.el).length,O=d===!0||s!=="full"&&s!=="auto",V=!O&&s==="full",[Z,le]=e.useState(void 0);e.useEffect(()=>{if(!V)return;let t=R.current,n=t?.ownerDocument.defaultView;if(!t||!n||typeof n.matchMedia!="function")return;let o=ke(),c=o?n.scrollY:be(t)?.scrollTop??0,h=0,v=0,y=()=>{v&&cancelAnimationFrame(v),v=requestAnimationFrame(()=>{v=0})},U=()=>{o&&!v&&(c=n.scrollY)},q=l=>{!o&&!v&&l.target instanceof HTMLElement&&l.target===be(t)&&(c=l.target.scrollTop)};n.addEventListener("resize",y),n.addEventListener("scroll",U,{passive:!0}),t.addEventListener("scroll",q,{passive:!0,capture:!0});let se=we(l=>{o=l;let u=c;h&&cancelAnimationFrame(h),h=requestAnimationFrame(()=>{if(h=0,l)n.scrollTo(0,u);else{let p=be(t);p&&(p.scrollTop=u)}})});return()=>{h&&cancelAnimationFrame(h),v&&cancelAnimationFrame(v),n.removeEventListener("resize",y),n.removeEventListener("scroll",U),t.removeEventListener("scroll",q,{capture:!0}),se()}},[V]);let K=e.useCallback(()=>{let t=R.current;if(!t)return;let n=M().map(o=>o.el);for(let o of t.children){if(!(o instanceof HTMLElement)||o.classList.contains("kui-ShellScrim"))continue;let c=n.some(h=>o===h||o.contains(h));n.length===0||c?o.hasAttribute(ge)&&(o.removeAttribute(ge),o.inert=!1):o.inert||(o.setAttribute(ge,""),o.inert=!0)}},[M]),j=e.useRef(null),G=e.useRef([]),ee=e.useRef(null),D=e.useRef(!1),z=e.useRef(0),W=e.useCallback(()=>{z.current&&cancelAnimationFrame(z.current),z.current=0},[]),_=e.useCallback((t,n)=>{W();let o=0,c=()=>{if(z.current=0,!!t.isConnected){if(n(t.ownerDocument.activeElement)){t.focus({preventScroll:!0});return}o+=1,o<dt&&(z.current=requestAnimationFrame(c))}};z.current=requestAnimationFrame(c)},[W]);e.useEffect(()=>()=>{W(),D.current&&(D.current=!1,Qe(-1))},[W]),e.useEffect(()=>{let t=R.current;if(!t)return;let n=t.ownerDocument,o=M(),c=o.map(l=>l.el),h=!O&&o.length>0;h!==D.current&&(D.current=h,Qe(h?1:-1));let v=G.current;G.current=o;let y=v.filter(l=>{if(c.includes(l.el))return!1;let u=i.entries.get(l.name);return!l.el.isConnected||!u||u.el!==l.el||u.value==="closed"}),U=l=>l!==null&&y.some(u=>u.el.contains(l));if(v.length===0&&o.length>0){let l=n.activeElement,u=l instanceof HTMLElement&&!Q(n,l)&&!c.some(p=>p.contains(l))?l:null;if(u&&!t.contains(u)){let p=ee.current;p&&p.isConnected&&!c.some(te=>te.contains(p))&&(u=p)}j.current=u}if(K(),o.length===0){let l=j.current;if(j.current=null,y.length===0)return;let p=(H=>H!==null&&H.isConnected&&!H.closest("[inert]")&&!U(H))(l)?l:null;for(let H of y)p??(p=Ze(n,H.id));if(!p)return;let te=H=>Q(n,H)||U(H);te(n.activeElement)?p.focus({preventScroll:!0}):_(p,te);return}if(y.length>0){let l=n.activeElement;if(Q(n,l)||U(l)){let u=null;for(let p of y)u??(u=Ze(n,p.id,c));(u??c[c.length-1]).focus({preventScroll:!0})}}let q=c.filter(l=>!v.some(u=>u.el===l)),se=n.activeElement;q.length>0&&!c.some(l=>l.contains(se))&&(q[0].focus({preventScroll:!0}),_(q[0],l=>Q(n,l)||l instanceof Element&&l.closest("[inert]")!==null))}),e.useEffect(()=>{let t=R.current;if(!t||E===0||typeof MutationObserver>"u")return;let n=new MutationObserver(K);return n.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["inert"]}),()=>n.disconnect()},[E,K]);let Y=t=>{g?.(t),!(t.key!=="Escape"||t.defaultPrevented||E===0)&&(N(),t.stopPropagation())};e.useEffect(()=>{let t=R.current;if(!t||E===0)return;let n=t.ownerDocument,o=c=>{c.key!=="Escape"||c.defaultPrevented||!Q(n,c.target)||N()};return n.addEventListener("keydown",o),()=>n.removeEventListener("keydown",o)},[E,N]);let ae=t=>{k?.(t),t.target instanceof HTMLElement&&R.current?.contains(t.target)&&(ee.current=t.target)},B=i.entries.get("rail"),X=B!==void 0&&B.value!==void 0&&B.value!=="closed"?T.has("rail")?`calc(${B.size}px + 2 * var(--shell-gap))`:`${B.size}px`:void 0,re=s==="full"?{}:s==="auto"?{height:"auto"}:typeof s=="number"?{height:`${s}px`}:{height:s};return e.createElement(He.Provider,{value:i},e.createElement(pe.Provider,{value:P},e.createElement(fe.Provider,{value:!1},e.createElement(Fe.Provider,{value:V},e.createElement(tt.Provider,{value:le},e.createElement(xe.Provider,{value:m},e.createElement(Te.Provider,{value:void 0},e.createElement("div",{...w,ref:I,className:$("kui-ShellRoot",a),"data-height":s==="auto"&&!O?"auto":void 0,"data-contained":O||void 0,"data-window":V||void 0,"data-overlay-live":E>0||void 0,onKeyDown:Y,onFocus:ae,style:{...re,...X?{"--shell-rail-offset":X}:{},...Z!==void 0?{"--kui-shell-header-h":`${Z}px`}:{},...x}},r,e.createElement("div",{className:"kui-ShellScrim","aria-hidden":!0,onClick:N})))))))))});nt.displayName="Shell.Root";var ot=e.forwardRef(({className:a,height:r=et,flush:s=!0,style:d,...S},x)=>{let g=e.useContext(tt);return ut(()=>{if(g)return g(r===et?void 0:r),()=>g(void 0)},[g,r]),e.createElement("header",{...S,ref:x,className:$("kui-ShellHeader",a),"data-flush":s||void 0,style:{...d,"--shell-header-height":`${r}px`}})});ot.displayName="Shell.Header";var lt=e.forwardRef(({children:a},r)=>(e.useEffect(()=>{},[]),e.createElement(e.Fragment,null,a)));lt.displayName="Shell.Left";var ft={controlled:"open",default:"defaultOpen"},at=e.forwardRef((a,r)=>{let{className:s,presentation:d,expandedSize:S=64,collapsible:x,onExpand:g,onCollapse:k,children:w,style:L,open:P,defaultOpen:i,onOpenChange:C,flush:R=!0,id:I,...T}=a,{table:F,attributes:A}=Se(d,"fixed"),f=he({name:"rail",label:"Rail",propNames:ft,id:I,controlled:J(P),defaultValue:J(i),presentationTable:F,builtIn:_e,onChange:(N,M)=>C?.(N!=="closed",{reason:M}),onExpand:g,onCollapse:k,size:S});oe("rail",R);let m=Ce(r,f.setElement);return e.createElement("div",{...T,role:T.role??"navigation",id:f.id,ref:m,className:$("kui-ShellPane","kui-ShellRail",s),...ve(f,A),"data-flush":R||void 0,tabIndex:f.overlaying?-1:T.tabIndex,style:{...L,"--rail-size":`${S}px`}},e.createElement(mt,null,w))});at.displayName="Shell.Rail";function mt({children:a}){let r=e.useContext(pe);return e.createElement("div",{className:$("kui-ShellRailContent",`kui-r-size-${r}`)},e.createElement(me,{presentation:"thin"},a))}var Pt={controlled:"open",default:"defaultOpen"},Ee=e.forwardRef((a,r)=>{let{className:s,presentation:d,defaultOpen:S,open:x,onOpenChange:g,size:k,defaultSize:w,expandedSize:L=288,minSize:P=100,maxSize:i=800,resizable:C=!1,collapsible:R=!0,onExpand:I,onCollapse:T,onResize:F,onResizeStart:A,onResizeEnd:f,snapPoints:m,snapTolerance:N,collapseThreshold:M,paneId:E,persistence:O,children:V,style:Z,onSizeChange:le,sizeUpdate:K,sizeUpdateMs:j=50,flush:G=!0,id:ee,...D}=a,z=ue("Shell.Panel"),W=de(z,"rail"),_=Se(d,"fixed"),Y=d===void 0,ae=Y?W?.presentationTable??ce:_.table,B=Y?{"data-presentation-follows":""}:_.attributes,b=he({name:"panel",label:"Panel",propNames:Pt,id:ee,controlled:J(x),defaultValue:J(S),presentationTable:ae,builtIn:Ue,onChange:(v,y)=>g?.(v!=="closed",{reason:y}),onExpand:I,onCollapse:T,size:L});oe("panel",G),e.useEffect(()=>{(m!==void 0||M!==void 0||E!==void 0||O!==void 0)&&void 0},[m,M,E,O]);let X=e.useRef(null),re=Ce(r,b.setElement,X),t=Ve({name:"panel",elementId:b.id,elementRef:X,cssVarName:"--panel-size",orientation:"vertical",edge:"end",growth:qe,expandedSize:L,minSize:P,maxSize:i,resizable:C,collapsible:R,size:k,defaultSize:w,onSizeChange:le,sizeUpdate:K,sizeUpdateMs:j,onResize:F,onResizeStart:A,onResizeEnd:f,snapPoints:m,snapTolerance:N,collapseThreshold:M,paneId:E,persistence:O,overlaying:b.overlaying,overlayingNow:()=>(Y?z.entries.get("rail")?.presentationTable??ce:_.table)[Le()]==="overlay",requestCollapse:()=>b.setValue("closed","toggle"),requestToggle:()=>b.toggle("toggle")}),n=Be(k,w,P,i),{handles:o,content:c}=We(V,Pe),h=C&&b.shown!==!1&&!b.overlaying?e.createElement(De.Provider,{value:t},o.length>0?o:e.createElement(Ie,null)):null;return e.createElement("div",{...$e(D),role:D.role??"navigation",id:b.id,ref:re,className:$("kui-ShellPane","kui-ShellPanel",s),...ve(b,B),"data-flush":G||void 0,tabIndex:b.overlaying?-1:D.tabIndex,style:{...Z,"--panel-expanded-size":`${L}px`,...n?{"--panel-size":n}:{}}},e.createElement("div",{className:"kui-ShellPanelContent"},e.createElement(me,null,e.createElement(ie,null,c))),h)});Ee.displayName="Shell.Panel";Ee.Handle=Pe;var rt=e.forwardRef(({className:a,flush:r=!0,children:s,...d},S)=>(oe("content",r),e.createElement("main",{...d,ref:S,className:$("kui-ShellContent",a),"data-flush":r||void 0},e.createElement(fe.Provider,{value:!0},e.createElement(ie,null,s)))));rt.displayName="Shell.Content";var st=e.forwardRef(({target:a,action:r="toggle",peekOnHover:s,asChild:d=!1,onClick:S,onMouseEnter:x,onMouseLeave:g,children:k,...w},L)=>{let P=ue("Shell.Trigger");e.useEffect(()=>{a==="left"&&void 0,s&&void 0},[a,s]);let i=a==="left"?"rail":a,C=de(P,i),R=C?.value===void 0?void 0:C.value!=="closed",I=f=>{if(S?.(f),f.defaultPrevented)return;let m=P.entries.get(i);m&&(P.peek===i&&ne(P,null),r==="toggle"?m.toggle("toggle"):r==="expand"?m.setValue("open","toggle"):m.setValue("closed","toggle"))},T=f=>{if(x?.(f),!s)return;let m=P.entries.get(i);m&&m.value==="closed"&&m.presentation!=="overlay"&&ne(P,i)},F=f=>{g?.(f),s&&P.peek===i&&ne(P,null)},A=d?ct.Root:"button";return e.createElement(A,{...!d&&{type:"button"},"aria-controls":C?.id,"aria-expanded":R,...w,ref:L,onClick:I,onMouseEnter:T,onMouseLeave:F,"data-shell-trigger":a,"data-shell-action":r},k)});st.displayName="Shell.Trigger";export{nt as a,ot as b,lt as c,at as d,Ee as e,rt as f,st as g,ht as h};
|
|
3
|
+
//# sourceMappingURL=chunk-NO2JCJWI.js.map
|