@fluid-app/portal-core 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-CKQMccvm.cjs +28 -0
- package/dist/data-sources/DataAwareWidget.cjs +50 -0
- package/dist/data-sources/DataAwareWidget.cjs.map +1 -0
- package/dist/data-sources/DataAwareWidget.d.cts +24 -0
- package/dist/data-sources/DataAwareWidget.d.cts.map +1 -0
- package/dist/data-sources/DataAwareWidget.d.mts +24 -0
- package/dist/data-sources/DataAwareWidget.d.mts.map +1 -0
- package/dist/data-sources/DataAwareWidget.mjs +48 -0
- package/dist/data-sources/DataAwareWidget.mjs.map +1 -0
- package/dist/data-sources/ErrorState.cjs +20 -0
- package/dist/data-sources/ErrorState.cjs.map +1 -0
- package/dist/data-sources/ErrorState.d.cts +7 -0
- package/dist/data-sources/ErrorState.d.cts.map +1 -0
- package/dist/data-sources/ErrorState.d.mts +7 -0
- package/dist/data-sources/ErrorState.d.mts.map +1 -0
- package/dist/data-sources/ErrorState.mjs +18 -0
- package/dist/data-sources/ErrorState.mjs.map +1 -0
- package/dist/data-sources/context.cjs +24 -0
- package/dist/data-sources/context.cjs.map +1 -0
- package/dist/data-sources/context.d.cts +21 -0
- package/dist/data-sources/context.d.cts.map +1 -0
- package/dist/data-sources/context.d.mts +21 -0
- package/dist/data-sources/context.d.mts.map +1 -0
- package/dist/data-sources/context.mjs +21 -0
- package/dist/data-sources/context.mjs.map +1 -0
- package/dist/data-sources/fetchers/api.cjs +65 -0
- package/dist/data-sources/fetchers/api.cjs.map +1 -0
- package/dist/data-sources/fetchers/api.d.cts +10 -0
- package/dist/data-sources/fetchers/api.d.cts.map +1 -0
- package/dist/data-sources/fetchers/api.d.mts +10 -0
- package/dist/data-sources/fetchers/api.d.mts.map +1 -0
- package/dist/data-sources/fetchers/api.mjs +64 -0
- package/dist/data-sources/fetchers/api.mjs.map +1 -0
- package/dist/data-sources/fetchers/custom.cjs +108 -0
- package/dist/data-sources/fetchers/custom.cjs.map +1 -0
- package/dist/data-sources/fetchers/custom.d.cts +17 -0
- package/dist/data-sources/fetchers/custom.d.cts.map +1 -0
- package/dist/data-sources/fetchers/custom.d.mts +17 -0
- package/dist/data-sources/fetchers/custom.d.mts.map +1 -0
- package/dist/data-sources/fetchers/custom.mjs +107 -0
- package/dist/data-sources/fetchers/custom.mjs.map +1 -0
- package/dist/data-sources/fetchers/static.cjs +161 -0
- package/dist/data-sources/fetchers/static.cjs.map +1 -0
- package/dist/data-sources/fetchers/static.d.cts +40 -0
- package/dist/data-sources/fetchers/static.d.cts.map +1 -0
- package/dist/data-sources/fetchers/static.d.mts +40 -0
- package/dist/data-sources/fetchers/static.d.mts.map +1 -0
- package/dist/data-sources/fetchers/static.mjs +158 -0
- package/dist/data-sources/fetchers/static.mjs.map +1 -0
- package/dist/data-sources/preview-context.cjs +21 -0
- package/dist/data-sources/preview-context.cjs.map +1 -0
- package/dist/data-sources/preview-context.d.cts +13 -0
- package/dist/data-sources/preview-context.d.cts.map +1 -0
- package/dist/data-sources/preview-context.d.mts +13 -0
- package/dist/data-sources/preview-context.d.mts.map +1 -0
- package/dist/data-sources/preview-context.mjs +18 -0
- package/dist/data-sources/preview-context.mjs.map +1 -0
- package/dist/data-sources/registry-context.cjs +53 -0
- package/dist/data-sources/registry-context.cjs.map +1 -0
- package/dist/data-sources/registry-context.d.cts +48 -0
- package/dist/data-sources/registry-context.d.cts.map +1 -0
- package/dist/data-sources/registry-context.d.mts +48 -0
- package/dist/data-sources/registry-context.d.mts.map +1 -0
- package/dist/data-sources/registry-context.mjs +49 -0
- package/dist/data-sources/registry-context.mjs.map +1 -0
- package/dist/data-sources/registry.cjs +31 -0
- package/dist/data-sources/registry.cjs.map +1 -0
- package/dist/data-sources/registry.d.cts +19 -0
- package/dist/data-sources/registry.d.cts.map +1 -0
- package/dist/data-sources/registry.d.mts +19 -0
- package/dist/data-sources/registry.d.mts.map +1 -0
- package/dist/data-sources/registry.mjs +29 -0
- package/dist/data-sources/registry.mjs.map +1 -0
- package/dist/data-sources/transformers.cjs +154 -0
- package/dist/data-sources/transformers.cjs.map +1 -0
- package/dist/data-sources/transformers.d.cts +10 -0
- package/dist/data-sources/transformers.d.cts.map +1 -0
- package/dist/data-sources/transformers.d.mts +10 -0
- package/dist/data-sources/transformers.d.mts.map +1 -0
- package/dist/data-sources/transformers.mjs +153 -0
- package/dist/data-sources/transformers.mjs.map +1 -0
- package/dist/data-sources/types.cjs +0 -0
- package/dist/data-sources/types.d.cts +2 -0
- package/dist/data-sources/types.d.mts +2 -0
- package/dist/data-sources/types.mjs +1 -0
- package/dist/data-sources/use-widget-data.cjs +111 -0
- package/dist/data-sources/use-widget-data.cjs.map +1 -0
- package/dist/data-sources/use-widget-data.d.cts +17 -0
- package/dist/data-sources/use-widget-data.d.cts.map +1 -0
- package/dist/data-sources/use-widget-data.d.mts +17 -0
- package/dist/data-sources/use-widget-data.d.mts.map +1 -0
- package/dist/data-sources/use-widget-data.mjs +109 -0
- package/dist/data-sources/use-widget-data.mjs.map +1 -0
- package/dist/index-B5cTNde-.d.cts +246 -0
- package/dist/index-B5cTNde-.d.cts.map +1 -0
- package/dist/index-Cqt2JzkQ.d.mts +246 -0
- package/dist/index-Cqt2JzkQ.d.mts.map +1 -0
- package/dist/registries/index.cjs +243 -0
- package/dist/registries/index.cjs.map +1 -0
- package/dist/registries/index.d.cts +338 -0
- package/dist/registries/index.d.cts.map +1 -0
- package/dist/registries/index.d.mts +338 -0
- package/dist/registries/index.d.mts.map +1 -0
- package/dist/registries/index.mjs +229 -0
- package/dist/registries/index.mjs.map +1 -0
- package/dist/shell/AppShellLayout.cjs +49 -0
- package/dist/shell/AppShellLayout.cjs.map +1 -0
- package/dist/shell/AppShellLayout.d.cts +39 -0
- package/dist/shell/AppShellLayout.d.cts.map +1 -0
- package/dist/shell/AppShellLayout.d.mts +39 -0
- package/dist/shell/AppShellLayout.d.mts.map +1 -0
- package/dist/shell/AppShellLayout.mjs +46 -0
- package/dist/shell/AppShellLayout.mjs.map +1 -0
- package/dist/shell/ScreenHeader.cjs +44 -0
- package/dist/shell/ScreenHeader.cjs.map +1 -0
- package/dist/shell/ScreenHeader.d.cts +12 -0
- package/dist/shell/ScreenHeader.d.cts.map +1 -0
- package/dist/shell/ScreenHeader.d.mts +12 -0
- package/dist/shell/ScreenHeader.d.mts.map +1 -0
- package/dist/shell/ScreenHeader.mjs +42 -0
- package/dist/shell/ScreenHeader.mjs.map +1 -0
- package/dist/shell/ScreenHeaderContext.cjs +91 -0
- package/dist/shell/ScreenHeaderContext.cjs.map +1 -0
- package/dist/shell/ScreenHeaderContext.d.cts +35 -0
- package/dist/shell/ScreenHeaderContext.d.cts.map +1 -0
- package/dist/shell/ScreenHeaderContext.d.mts +35 -0
- package/dist/shell/ScreenHeaderContext.d.mts.map +1 -0
- package/dist/shell/ScreenHeaderContext.mjs +86 -0
- package/dist/shell/ScreenHeaderContext.mjs.map +1 -0
- package/dist/shell/ThemeModeContext.cjs +70 -0
- package/dist/shell/ThemeModeContext.cjs.map +1 -0
- package/dist/shell/ThemeModeContext.d.cts +33 -0
- package/dist/shell/ThemeModeContext.d.cts.map +1 -0
- package/dist/shell/ThemeModeContext.d.mts +33 -0
- package/dist/shell/ThemeModeContext.d.mts.map +1 -0
- package/dist/shell/ThemeModeContext.mjs +66 -0
- package/dist/shell/ThemeModeContext.mjs.map +1 -0
- package/dist/shell/index.cjs +43 -0
- package/dist/shell/index.d.cts +7 -0
- package/dist/shell/index.d.mts +7 -0
- package/dist/shell/index.mjs +7 -0
- package/dist/shell/sidebar.cjs +390 -0
- package/dist/shell/sidebar.cjs.map +1 -0
- package/dist/shell/sidebar.d.cts +85 -0
- package/dist/shell/sidebar.d.cts.map +1 -0
- package/dist/shell/sidebar.d.mts +85 -0
- package/dist/shell/sidebar.d.mts.map +1 -0
- package/dist/shell/sidebar.mjs +364 -0
- package/dist/shell/sidebar.mjs.map +1 -0
- package/dist/shell/use-mobile.cjs +51 -0
- package/dist/shell/use-mobile.cjs.map +1 -0
- package/dist/shell/use-mobile.d.cts +7 -0
- package/dist/shell/use-mobile.d.cts.map +1 -0
- package/dist/shell/use-mobile.d.mts +7 -0
- package/dist/shell/use-mobile.d.mts.map +1 -0
- package/dist/shell/use-mobile.mjs +47 -0
- package/dist/shell/use-mobile.mjs.map +1 -0
- package/dist/theme/index.cjs +758 -0
- package/dist/theme/index.cjs.map +1 -0
- package/dist/theme/index.d.cts +131 -0
- package/dist/theme/index.d.cts.map +1 -0
- package/dist/theme/index.d.mts +131 -0
- package/dist/theme/index.d.mts.map +1 -0
- package/dist/theme/index.mjs +728 -0
- package/dist/theme/index.mjs.map +1 -0
- package/dist/types/index.cjs +18 -0
- package/dist/types/index.d.cts +4 -0
- package/dist/types/index.d.mts +4 -0
- package/dist/types/index.mjs +2 -0
- package/dist/types-27AHMek-.d.cts +85 -0
- package/dist/types-27AHMek-.d.cts.map +1 -0
- package/dist/types-BXFX9bXp.cjs +303 -0
- package/dist/types-BXFX9bXp.cjs.map +1 -0
- package/dist/types-Bjmd7Fdx.mjs +208 -0
- package/dist/types-Bjmd7Fdx.mjs.map +1 -0
- package/dist/types-C5Zs5V3E.d.mts +155 -0
- package/dist/types-C5Zs5V3E.d.mts.map +1 -0
- package/dist/types-CeCPKvOv.d.mts +85 -0
- package/dist/types-CeCPKvOv.d.mts.map +1 -0
- package/dist/types-DrzvahW8.d.cts +155 -0
- package/dist/types-DrzvahW8.d.cts.map +1 -0
- package/dist/widget-schema-BKZgsNG7.d.mts +119 -0
- package/dist/widget-schema-BKZgsNG7.d.mts.map +1 -0
- package/dist/widget-schema-BSX2fVhW.d.cts +119 -0
- package/dist/widget-schema-BSX2fVhW.d.cts.map +1 -0
- package/dist/widget-utils/index.cjs +130 -0
- package/dist/widget-utils/index.cjs.map +1 -0
- package/dist/widget-utils/index.d.cts +47 -0
- package/dist/widget-utils/index.d.cts.map +1 -0
- package/dist/widget-utils/index.d.mts +47 -0
- package/dist/widget-utils/index.d.mts.map +1 -0
- package/dist/widget-utils/index.mjs +119 -0
- package/dist/widget-utils/index.mjs.map +1 -0
- package/package.json +200 -0
- package/src/styles/globals.css +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeModeContext.cjs","names":[],"sources":["../../src/shell/ThemeModeContext.tsx"],"sourcesContent":["\"use client\";\n\nimport type React from \"react\";\nimport {\n createContext,\n useContext,\n useCallback,\n useMemo,\n useSyncExternalStore,\n type ReactNode,\n} from \"react\";\n\nexport type ThemeMode = \"auto\" | \"light\" | \"dark\";\n\nexport type DisplayMode = \"light\" | \"dark\";\n\nexport interface ThemeModeContextValue {\n mode: ThemeMode;\n displayMode: DisplayMode;\n setMode: (mode: ThemeMode) => void;\n autoModeEnabled: boolean;\n cycleMode: () => void;\n dataAttribute: string | undefined;\n}\n\nconst ThemeModeContext = createContext<ThemeModeContextValue | null>(null);\n\nconst darkMediaQuery =\n typeof window !== \"undefined\"\n ? window.matchMedia(\"(prefers-color-scheme: dark)\")\n : null;\n\nfunction subscribeToPrefersColorScheme(callback: () => void) {\n darkMediaQuery?.addEventListener(\"change\", callback);\n return () => darkMediaQuery?.removeEventListener(\"change\", callback);\n}\n\nfunction getSystemPrefersDark(): boolean {\n return darkMediaQuery?.matches ?? false;\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\ninterface ThemeModeProviderProps {\n children: ReactNode;\n mode: ThemeMode;\n onModeChange: (mode: ThemeMode) => void;\n /** When false, auto mode is skipped in the cycle (light↔dark only). Default true. */\n autoModeEnabled?: boolean;\n}\n\nexport function ThemeModeProvider({\n children,\n mode,\n onModeChange,\n autoModeEnabled = true,\n}: ThemeModeProviderProps): React.JSX.Element {\n const systemPrefersDark = useSyncExternalStore(\n subscribeToPrefersColorScheme,\n getSystemPrefersDark,\n getServerSnapshot,\n );\n\n const systemMode: DisplayMode = systemPrefersDark ? \"dark\" : \"light\";\n\n const displayMode: DisplayMode = mode === \"auto\" ? systemMode : mode;\n\n const cycleMode = useCallback(() => {\n if (autoModeEnabled) {\n // Toggle displayed mode. If target matches system preference, use \"auto\".\n const target: DisplayMode = displayMode === \"light\" ? \"dark\" : \"light\";\n onModeChange(target === systemMode ? \"auto\" : target);\n } else {\n // light ↔ dark\n onModeChange(mode === \"light\" ? \"dark\" : \"light\");\n }\n }, [mode, displayMode, systemMode, onModeChange, autoModeEnabled]);\n\n const dataAttribute = getThemeModeAttribute(mode);\n\n const value = useMemo(\n () => ({\n mode,\n displayMode,\n setMode: onModeChange,\n autoModeEnabled,\n cycleMode,\n dataAttribute,\n }),\n [\n mode,\n displayMode,\n onModeChange,\n autoModeEnabled,\n cycleMode,\n dataAttribute,\n ],\n );\n\n return (\n <ThemeModeContext.Provider value={value}>\n {children}\n </ThemeModeContext.Provider>\n );\n}\n\n/** Access the current theme mode, setter, and cycle helper. Must be used within a `ThemeModeProvider`. */\nexport function useThemeMode(): ThemeModeContextValue {\n const ctx = useContext(ThemeModeContext);\n if (!ctx) {\n throw new Error(\"useThemeMode must be used within a ThemeModeProvider\");\n }\n return ctx;\n}\n\n/** Maps a ThemeMode to the value for `data-theme-mode`. Returns undefined for \"auto\". */\nexport function getThemeModeAttribute(mode: ThemeMode): string | undefined {\n return mode === \"auto\" ? undefined : mode;\n}\n"],"mappings":";;;;;;AAyBA,MAAM,oBAAA,GAAA,MAAA,eAA+D,KAAK;AAE1E,MAAM,iBACJ,OAAO,WAAW,cACd,OAAO,WAAW,+BAA+B,GACjD;AAEN,SAAS,8BAA8B,UAAsB;AAC3D,iBAAgB,iBAAiB,UAAU,SAAS;AACpD,cAAa,gBAAgB,oBAAoB,UAAU,SAAS;;AAGtE,SAAS,uBAAgC;AACvC,QAAO,gBAAgB,WAAW;;AAGpC,SAAS,oBAA6B;AACpC,QAAO;;AAWT,SAAgB,kBAAkB,EAChC,UACA,MACA,cACA,kBAAkB,QAC0B;CAO5C,MAAM,cAAA,GAAA,MAAA,sBALJ,+BACA,sBACA,kBACD,GAEmD,SAAS;CAE7D,MAAM,cAA2B,SAAS,SAAS,aAAa;CAEhE,MAAM,aAAA,GAAA,MAAA,mBAA8B;AAClC,MAAI,iBAAiB;GAEnB,MAAM,SAAsB,gBAAgB,UAAU,SAAS;AAC/D,gBAAa,WAAW,aAAa,SAAS,OAAO;QAGrD,cAAa,SAAS,UAAU,SAAS,QAAQ;IAElD;EAAC;EAAM;EAAa;EAAY;EAAc;EAAgB,CAAC;CAElE,MAAM,gBAAgB,sBAAsB,KAAK;CAEjD,MAAM,SAAA,GAAA,MAAA,gBACG;EACL;EACA;EACA,SAAS;EACT;EACA;EACA;EACD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AAED,QACE,iBAAA,GAAA,kBAAA,KAAC,iBAAiB,UAAlB;EAAkC;EAC/B;EACyB,CAAA;;;AAKhC,SAAgB,eAAsC;CACpD,MAAM,OAAA,GAAA,MAAA,YAAiB,iBAAiB;AACxC,KAAI,CAAC,IACH,OAAM,IAAI,MAAM,uDAAuD;AAEzE,QAAO;;;AAIT,SAAgB,sBAAsB,MAAqC;AACzE,QAAO,SAAS,SAAS,KAAA,IAAY"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/shell/ThemeModeContext.d.ts
|
|
4
|
+
type ThemeMode = "auto" | "light" | "dark";
|
|
5
|
+
type DisplayMode = "light" | "dark";
|
|
6
|
+
interface ThemeModeContextValue {
|
|
7
|
+
mode: ThemeMode;
|
|
8
|
+
displayMode: DisplayMode;
|
|
9
|
+
setMode: (mode: ThemeMode) => void;
|
|
10
|
+
autoModeEnabled: boolean;
|
|
11
|
+
cycleMode: () => void;
|
|
12
|
+
dataAttribute: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
interface ThemeModeProviderProps {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
mode: ThemeMode;
|
|
17
|
+
onModeChange: (mode: ThemeMode) => void;
|
|
18
|
+
/** When false, auto mode is skipped in the cycle (light↔dark only). Default true. */
|
|
19
|
+
autoModeEnabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare function ThemeModeProvider({
|
|
22
|
+
children,
|
|
23
|
+
mode,
|
|
24
|
+
onModeChange,
|
|
25
|
+
autoModeEnabled
|
|
26
|
+
}: ThemeModeProviderProps): React.JSX.Element;
|
|
27
|
+
/** Access the current theme mode, setter, and cycle helper. Must be used within a `ThemeModeProvider`. */
|
|
28
|
+
declare function useThemeMode(): ThemeModeContextValue;
|
|
29
|
+
/** Maps a ThemeMode to the value for `data-theme-mode`. Returns undefined for "auto". */
|
|
30
|
+
declare function getThemeModeAttribute(mode: ThemeMode): string | undefined;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { DisplayMode, ThemeMode, ThemeModeContextValue, ThemeModeProvider, getThemeModeAttribute, useThemeMode };
|
|
33
|
+
//# sourceMappingURL=ThemeModeContext.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeModeContext.d.cts","names":[],"sources":["../../src/shell/ThemeModeContext.tsx"],"mappings":";;;KAYY,SAAA;AAAA,KAEA,WAAA;AAAA,UAEK,qBAAA;EACf,IAAA,EAAM,SAAA;EACN,WAAA,EAAa,WAAA;EACb,OAAA,GAAU,IAAA,EAAM,SAAA;EAChB,eAAA;EACA,SAAA;EACA,aAAA;AAAA;AAAA,UAuBQ,sBAAA;EACR,QAAA,EAAU,SAAA;EACV,IAAA,EAAM,SAAA;EACN,YAAA,GAAe,IAAA,EAAM,SAAA;;EAErB,eAAA;AAAA;AAAA,iBAGc,iBAAA,CAAA;EACd,QAAA;EACA,IAAA;EACA,YAAA;EACA;AAAA,GACC,sBAAA,GAAyB,KAAA,CAAM,GAAA,CAAI,OAAA;;iBAmDtB,YAAA,CAAA,GAAgB,qBAAA;;iBAShB,qBAAA,CAAsB,IAAA,EAAM,SAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/shell/ThemeModeContext.d.ts
|
|
4
|
+
type ThemeMode = "auto" | "light" | "dark";
|
|
5
|
+
type DisplayMode = "light" | "dark";
|
|
6
|
+
interface ThemeModeContextValue {
|
|
7
|
+
mode: ThemeMode;
|
|
8
|
+
displayMode: DisplayMode;
|
|
9
|
+
setMode: (mode: ThemeMode) => void;
|
|
10
|
+
autoModeEnabled: boolean;
|
|
11
|
+
cycleMode: () => void;
|
|
12
|
+
dataAttribute: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
interface ThemeModeProviderProps {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
mode: ThemeMode;
|
|
17
|
+
onModeChange: (mode: ThemeMode) => void;
|
|
18
|
+
/** When false, auto mode is skipped in the cycle (light↔dark only). Default true. */
|
|
19
|
+
autoModeEnabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare function ThemeModeProvider({
|
|
22
|
+
children,
|
|
23
|
+
mode,
|
|
24
|
+
onModeChange,
|
|
25
|
+
autoModeEnabled
|
|
26
|
+
}: ThemeModeProviderProps): React.JSX.Element;
|
|
27
|
+
/** Access the current theme mode, setter, and cycle helper. Must be used within a `ThemeModeProvider`. */
|
|
28
|
+
declare function useThemeMode(): ThemeModeContextValue;
|
|
29
|
+
/** Maps a ThemeMode to the value for `data-theme-mode`. Returns undefined for "auto". */
|
|
30
|
+
declare function getThemeModeAttribute(mode: ThemeMode): string | undefined;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { DisplayMode, ThemeMode, ThemeModeContextValue, ThemeModeProvider, getThemeModeAttribute, useThemeMode };
|
|
33
|
+
//# sourceMappingURL=ThemeModeContext.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeModeContext.d.mts","names":[],"sources":["../../src/shell/ThemeModeContext.tsx"],"mappings":";;;KAYY,SAAA;AAAA,KAEA,WAAA;AAAA,UAEK,qBAAA;EACf,IAAA,EAAM,SAAA;EACN,WAAA,EAAa,WAAA;EACb,OAAA,GAAU,IAAA,EAAM,SAAA;EAChB,eAAA;EACA,SAAA;EACA,aAAA;AAAA;AAAA,UAuBQ,sBAAA;EACR,QAAA,EAAU,SAAA;EACV,IAAA,EAAM,SAAA;EACN,YAAA,GAAe,IAAA,EAAM,SAAA;;EAErB,eAAA;AAAA;AAAA,iBAGc,iBAAA,CAAA;EACd,QAAA;EACA,IAAA;EACA,YAAA;EACA;AAAA,GACC,sBAAA,GAAyB,KAAA,CAAM,GAAA,CAAI,OAAA;;iBAmDtB,YAAA,CAAA,GAAgB,qBAAA;;iBAShB,qBAAA,CAAsB,IAAA,EAAM,SAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo, useSyncExternalStore } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/shell/ThemeModeContext.tsx
|
|
5
|
+
const ThemeModeContext = createContext(null);
|
|
6
|
+
const darkMediaQuery = typeof window !== "undefined" ? window.matchMedia("(prefers-color-scheme: dark)") : null;
|
|
7
|
+
function subscribeToPrefersColorScheme(callback) {
|
|
8
|
+
darkMediaQuery?.addEventListener("change", callback);
|
|
9
|
+
return () => darkMediaQuery?.removeEventListener("change", callback);
|
|
10
|
+
}
|
|
11
|
+
function getSystemPrefersDark() {
|
|
12
|
+
return darkMediaQuery?.matches ?? false;
|
|
13
|
+
}
|
|
14
|
+
function getServerSnapshot() {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
function ThemeModeProvider({ children, mode, onModeChange, autoModeEnabled = true }) {
|
|
18
|
+
const systemMode = useSyncExternalStore(subscribeToPrefersColorScheme, getSystemPrefersDark, getServerSnapshot) ? "dark" : "light";
|
|
19
|
+
const displayMode = mode === "auto" ? systemMode : mode;
|
|
20
|
+
const cycleMode = useCallback(() => {
|
|
21
|
+
if (autoModeEnabled) {
|
|
22
|
+
const target = displayMode === "light" ? "dark" : "light";
|
|
23
|
+
onModeChange(target === systemMode ? "auto" : target);
|
|
24
|
+
} else onModeChange(mode === "light" ? "dark" : "light");
|
|
25
|
+
}, [
|
|
26
|
+
mode,
|
|
27
|
+
displayMode,
|
|
28
|
+
systemMode,
|
|
29
|
+
onModeChange,
|
|
30
|
+
autoModeEnabled
|
|
31
|
+
]);
|
|
32
|
+
const dataAttribute = getThemeModeAttribute(mode);
|
|
33
|
+
const value = useMemo(() => ({
|
|
34
|
+
mode,
|
|
35
|
+
displayMode,
|
|
36
|
+
setMode: onModeChange,
|
|
37
|
+
autoModeEnabled,
|
|
38
|
+
cycleMode,
|
|
39
|
+
dataAttribute
|
|
40
|
+
}), [
|
|
41
|
+
mode,
|
|
42
|
+
displayMode,
|
|
43
|
+
onModeChange,
|
|
44
|
+
autoModeEnabled,
|
|
45
|
+
cycleMode,
|
|
46
|
+
dataAttribute
|
|
47
|
+
]);
|
|
48
|
+
return /* @__PURE__ */ jsx(ThemeModeContext.Provider, {
|
|
49
|
+
value,
|
|
50
|
+
children
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/** Access the current theme mode, setter, and cycle helper. Must be used within a `ThemeModeProvider`. */
|
|
54
|
+
function useThemeMode() {
|
|
55
|
+
const ctx = useContext(ThemeModeContext);
|
|
56
|
+
if (!ctx) throw new Error("useThemeMode must be used within a ThemeModeProvider");
|
|
57
|
+
return ctx;
|
|
58
|
+
}
|
|
59
|
+
/** Maps a ThemeMode to the value for `data-theme-mode`. Returns undefined for "auto". */
|
|
60
|
+
function getThemeModeAttribute(mode) {
|
|
61
|
+
return mode === "auto" ? void 0 : mode;
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { ThemeModeProvider, getThemeModeAttribute, useThemeMode };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=ThemeModeContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeModeContext.mjs","names":[],"sources":["../../src/shell/ThemeModeContext.tsx"],"sourcesContent":["\"use client\";\n\nimport type React from \"react\";\nimport {\n createContext,\n useContext,\n useCallback,\n useMemo,\n useSyncExternalStore,\n type ReactNode,\n} from \"react\";\n\nexport type ThemeMode = \"auto\" | \"light\" | \"dark\";\n\nexport type DisplayMode = \"light\" | \"dark\";\n\nexport interface ThemeModeContextValue {\n mode: ThemeMode;\n displayMode: DisplayMode;\n setMode: (mode: ThemeMode) => void;\n autoModeEnabled: boolean;\n cycleMode: () => void;\n dataAttribute: string | undefined;\n}\n\nconst ThemeModeContext = createContext<ThemeModeContextValue | null>(null);\n\nconst darkMediaQuery =\n typeof window !== \"undefined\"\n ? window.matchMedia(\"(prefers-color-scheme: dark)\")\n : null;\n\nfunction subscribeToPrefersColorScheme(callback: () => void) {\n darkMediaQuery?.addEventListener(\"change\", callback);\n return () => darkMediaQuery?.removeEventListener(\"change\", callback);\n}\n\nfunction getSystemPrefersDark(): boolean {\n return darkMediaQuery?.matches ?? false;\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\ninterface ThemeModeProviderProps {\n children: ReactNode;\n mode: ThemeMode;\n onModeChange: (mode: ThemeMode) => void;\n /** When false, auto mode is skipped in the cycle (light↔dark only). Default true. */\n autoModeEnabled?: boolean;\n}\n\nexport function ThemeModeProvider({\n children,\n mode,\n onModeChange,\n autoModeEnabled = true,\n}: ThemeModeProviderProps): React.JSX.Element {\n const systemPrefersDark = useSyncExternalStore(\n subscribeToPrefersColorScheme,\n getSystemPrefersDark,\n getServerSnapshot,\n );\n\n const systemMode: DisplayMode = systemPrefersDark ? \"dark\" : \"light\";\n\n const displayMode: DisplayMode = mode === \"auto\" ? systemMode : mode;\n\n const cycleMode = useCallback(() => {\n if (autoModeEnabled) {\n // Toggle displayed mode. If target matches system preference, use \"auto\".\n const target: DisplayMode = displayMode === \"light\" ? \"dark\" : \"light\";\n onModeChange(target === systemMode ? \"auto\" : target);\n } else {\n // light ↔ dark\n onModeChange(mode === \"light\" ? \"dark\" : \"light\");\n }\n }, [mode, displayMode, systemMode, onModeChange, autoModeEnabled]);\n\n const dataAttribute = getThemeModeAttribute(mode);\n\n const value = useMemo(\n () => ({\n mode,\n displayMode,\n setMode: onModeChange,\n autoModeEnabled,\n cycleMode,\n dataAttribute,\n }),\n [\n mode,\n displayMode,\n onModeChange,\n autoModeEnabled,\n cycleMode,\n dataAttribute,\n ],\n );\n\n return (\n <ThemeModeContext.Provider value={value}>\n {children}\n </ThemeModeContext.Provider>\n );\n}\n\n/** Access the current theme mode, setter, and cycle helper. Must be used within a `ThemeModeProvider`. */\nexport function useThemeMode(): ThemeModeContextValue {\n const ctx = useContext(ThemeModeContext);\n if (!ctx) {\n throw new Error(\"useThemeMode must be used within a ThemeModeProvider\");\n }\n return ctx;\n}\n\n/** Maps a ThemeMode to the value for `data-theme-mode`. Returns undefined for \"auto\". */\nexport function getThemeModeAttribute(mode: ThemeMode): string | undefined {\n return mode === \"auto\" ? undefined : mode;\n}\n"],"mappings":";;;;AAyBA,MAAM,mBAAmB,cAA4C,KAAK;AAE1E,MAAM,iBACJ,OAAO,WAAW,cACd,OAAO,WAAW,+BAA+B,GACjD;AAEN,SAAS,8BAA8B,UAAsB;AAC3D,iBAAgB,iBAAiB,UAAU,SAAS;AACpD,cAAa,gBAAgB,oBAAoB,UAAU,SAAS;;AAGtE,SAAS,uBAAgC;AACvC,QAAO,gBAAgB,WAAW;;AAGpC,SAAS,oBAA6B;AACpC,QAAO;;AAWT,SAAgB,kBAAkB,EAChC,UACA,MACA,cACA,kBAAkB,QAC0B;CAO5C,MAAM,aANoB,qBACxB,+BACA,sBACA,kBACD,GAEmD,SAAS;CAE7D,MAAM,cAA2B,SAAS,SAAS,aAAa;CAEhE,MAAM,YAAY,kBAAkB;AAClC,MAAI,iBAAiB;GAEnB,MAAM,SAAsB,gBAAgB,UAAU,SAAS;AAC/D,gBAAa,WAAW,aAAa,SAAS,OAAO;QAGrD,cAAa,SAAS,UAAU,SAAS,QAAQ;IAElD;EAAC;EAAM;EAAa;EAAY;EAAc;EAAgB,CAAC;CAElE,MAAM,gBAAgB,sBAAsB,KAAK;CAEjD,MAAM,QAAQ,eACL;EACL;EACA;EACA,SAAS;EACT;EACA;EACA;EACD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AAED,QACE,oBAAC,iBAAiB,UAAlB;EAAkC;EAC/B;EACyB,CAAA;;;AAKhC,SAAgB,eAAsC;CACpD,MAAM,MAAM,WAAW,iBAAiB;AACxC,KAAI,CAAC,IACH,OAAM,IAAI,MAAM,uDAAuD;AAEzE,QAAO;;;AAIT,SAAgB,sBAAsB,MAAqC;AACzE,QAAO,SAAS,SAAS,KAAA,IAAY"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_shell_use_mobile = require("./use-mobile.cjs");
|
|
3
|
+
const require_shell_sidebar = require("./sidebar.cjs");
|
|
4
|
+
const require_shell_AppShellLayout = require("./AppShellLayout.cjs");
|
|
5
|
+
const require_shell_ScreenHeaderContext = require("./ScreenHeaderContext.cjs");
|
|
6
|
+
const require_shell_ScreenHeader = require("./ScreenHeader.cjs");
|
|
7
|
+
const require_shell_ThemeModeContext = require("./ThemeModeContext.cjs");
|
|
8
|
+
exports.AppShellLayout = require_shell_AppShellLayout.AppShellLayout;
|
|
9
|
+
exports.ScreenHeader = require_shell_ScreenHeader.ScreenHeader;
|
|
10
|
+
exports.ScreenHeaderProvider = require_shell_ScreenHeaderContext.ScreenHeaderProvider;
|
|
11
|
+
exports.Sidebar = require_shell_sidebar.Sidebar;
|
|
12
|
+
exports.SidebarContent = require_shell_sidebar.SidebarContent;
|
|
13
|
+
exports.SidebarContext = require_shell_sidebar.SidebarContext;
|
|
14
|
+
exports.SidebarFooter = require_shell_sidebar.SidebarFooter;
|
|
15
|
+
exports.SidebarGroup = require_shell_sidebar.SidebarGroup;
|
|
16
|
+
exports.SidebarGroupAction = require_shell_sidebar.SidebarGroupAction;
|
|
17
|
+
exports.SidebarGroupContent = require_shell_sidebar.SidebarGroupContent;
|
|
18
|
+
exports.SidebarGroupLabel = require_shell_sidebar.SidebarGroupLabel;
|
|
19
|
+
exports.SidebarHeader = require_shell_sidebar.SidebarHeader;
|
|
20
|
+
exports.SidebarInput = require_shell_sidebar.SidebarInput;
|
|
21
|
+
exports.SidebarInset = require_shell_sidebar.SidebarInset;
|
|
22
|
+
exports.SidebarMenu = require_shell_sidebar.SidebarMenu;
|
|
23
|
+
exports.SidebarMenuAction = require_shell_sidebar.SidebarMenuAction;
|
|
24
|
+
exports.SidebarMenuBadge = require_shell_sidebar.SidebarMenuBadge;
|
|
25
|
+
exports.SidebarMenuButton = require_shell_sidebar.SidebarMenuButton;
|
|
26
|
+
exports.SidebarMenuItem = require_shell_sidebar.SidebarMenuItem;
|
|
27
|
+
exports.SidebarMenuSkeleton = require_shell_sidebar.SidebarMenuSkeleton;
|
|
28
|
+
exports.SidebarMenuSub = require_shell_sidebar.SidebarMenuSub;
|
|
29
|
+
exports.SidebarMenuSubButton = require_shell_sidebar.SidebarMenuSubButton;
|
|
30
|
+
exports.SidebarMenuSubItem = require_shell_sidebar.SidebarMenuSubItem;
|
|
31
|
+
exports.SidebarProvider = require_shell_sidebar.SidebarProvider;
|
|
32
|
+
exports.SidebarRail = require_shell_sidebar.SidebarRail;
|
|
33
|
+
exports.SidebarSeparator = require_shell_sidebar.SidebarSeparator;
|
|
34
|
+
exports.ThemeModeProvider = require_shell_ThemeModeContext.ThemeModeProvider;
|
|
35
|
+
exports.getThemeModeAttribute = require_shell_ThemeModeContext.getThemeModeAttribute;
|
|
36
|
+
exports.useIsMobile = require_shell_use_mobile.useIsMobile;
|
|
37
|
+
exports.useIsMobileOrTablet = require_shell_use_mobile.useIsMobileOrTablet;
|
|
38
|
+
exports.useIsTablet = require_shell_use_mobile.useIsTablet;
|
|
39
|
+
exports.useScreenHeaderActions = require_shell_ScreenHeaderContext.useScreenHeaderActions;
|
|
40
|
+
exports.useScreenHeaderBreadcrumbs = require_shell_ScreenHeaderContext.useScreenHeaderBreadcrumbs;
|
|
41
|
+
exports.useScreenHeaderContext = require_shell_ScreenHeaderContext.useScreenHeaderContext;
|
|
42
|
+
exports.useSidebar = require_shell_sidebar.useSidebar;
|
|
43
|
+
exports.useThemeMode = require_shell_ThemeModeContext.useThemeMode;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppShellLayout, AppShellLayoutProps } from "./AppShellLayout.cjs";
|
|
2
|
+
import { ScreenHeader, ScreenHeaderProps } from "./ScreenHeader.cjs";
|
|
3
|
+
import { ScreenHeaderProvider, useScreenHeaderActions, useScreenHeaderBreadcrumbs, useScreenHeaderContext } from "./ScreenHeaderContext.cjs";
|
|
4
|
+
import { DisplayMode, ThemeMode, ThemeModeContextValue, ThemeModeProvider, getThemeModeAttribute, useThemeMode } from "./ThemeModeContext.cjs";
|
|
5
|
+
import { Sidebar, SidebarContent, SidebarContext, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, useSidebar } from "./sidebar.cjs";
|
|
6
|
+
import { useIsMobile, useIsMobileOrTablet, useIsTablet } from "./use-mobile.cjs";
|
|
7
|
+
export { AppShellLayout, type AppShellLayoutProps, type DisplayMode, ScreenHeader, type ScreenHeaderProps, ScreenHeaderProvider, Sidebar, SidebarContent, SidebarContext, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, type ThemeMode, type ThemeModeContextValue, ThemeModeProvider, getThemeModeAttribute, useIsMobile, useIsMobileOrTablet, useIsTablet, useScreenHeaderActions, useScreenHeaderBreadcrumbs, useScreenHeaderContext, useSidebar, useThemeMode };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppShellLayout, AppShellLayoutProps } from "./AppShellLayout.mjs";
|
|
2
|
+
import { ScreenHeader, ScreenHeaderProps } from "./ScreenHeader.mjs";
|
|
3
|
+
import { ScreenHeaderProvider, useScreenHeaderActions, useScreenHeaderBreadcrumbs, useScreenHeaderContext } from "./ScreenHeaderContext.mjs";
|
|
4
|
+
import { DisplayMode, ThemeMode, ThemeModeContextValue, ThemeModeProvider, getThemeModeAttribute, useThemeMode } from "./ThemeModeContext.mjs";
|
|
5
|
+
import { Sidebar, SidebarContent, SidebarContext, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, useSidebar } from "./sidebar.mjs";
|
|
6
|
+
import { useIsMobile, useIsMobileOrTablet, useIsTablet } from "./use-mobile.mjs";
|
|
7
|
+
export { AppShellLayout, type AppShellLayoutProps, type DisplayMode, ScreenHeader, type ScreenHeaderProps, ScreenHeaderProvider, Sidebar, SidebarContent, SidebarContext, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, type ThemeMode, type ThemeModeContextValue, ThemeModeProvider, getThemeModeAttribute, useIsMobile, useIsMobileOrTablet, useIsTablet, useScreenHeaderActions, useScreenHeaderBreadcrumbs, useScreenHeaderContext, useSidebar, useThemeMode };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useIsMobile, useIsMobileOrTablet, useIsTablet } from "./use-mobile.mjs";
|
|
2
|
+
import { Sidebar, SidebarContent, SidebarContext, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, useSidebar } from "./sidebar.mjs";
|
|
3
|
+
import { AppShellLayout } from "./AppShellLayout.mjs";
|
|
4
|
+
import { ScreenHeaderProvider, useScreenHeaderActions, useScreenHeaderBreadcrumbs, useScreenHeaderContext } from "./ScreenHeaderContext.mjs";
|
|
5
|
+
import { ScreenHeader } from "./ScreenHeader.mjs";
|
|
6
|
+
import { ThemeModeProvider, getThemeModeAttribute, useThemeMode } from "./ThemeModeContext.mjs";
|
|
7
|
+
export { AppShellLayout, ScreenHeader, ScreenHeaderProvider, Sidebar, SidebarContent, SidebarContext, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, ThemeModeProvider, getThemeModeAttribute, useIsMobile, useIsMobileOrTablet, useIsTablet, useScreenHeaderActions, useScreenHeaderBreadcrumbs, useScreenHeaderContext, useSidebar, useThemeMode };
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_chunk = require("../chunk-CKQMccvm.cjs");
|
|
4
|
+
const require_shell_use_mobile = require("./use-mobile.cjs");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
react = require_chunk.__toESM(react);
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let _radix_ui_react_slot = require("@radix-ui/react-slot");
|
|
9
|
+
let class_variance_authority = require("class-variance-authority");
|
|
10
|
+
let clsx = require("clsx");
|
|
11
|
+
let tailwind_merge = require("tailwind-merge");
|
|
12
|
+
//#region src/shell/sidebar.tsx
|
|
13
|
+
function cn(...inputs) {
|
|
14
|
+
return (0, tailwind_merge.twMerge)((0, clsx.clsx)(inputs));
|
|
15
|
+
}
|
|
16
|
+
function Separator({ className, orientation = "horizontal", ...props }) {
|
|
17
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
18
|
+
role: "separator",
|
|
19
|
+
"aria-orientation": orientation,
|
|
20
|
+
className: cn("bg-border shrink-0", orientation === "horizontal" ? "h-px w-full" : "h-full w-px", className),
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function Skeleton({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
26
|
+
className: cn("bg-muted animate-pulse rounded-md", className),
|
|
27
|
+
...props
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const SIDEBAR_WIDTH = "13rem";
|
|
31
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
32
|
+
const SIDEBAR_WIDTH_ICON = "3rem";
|
|
33
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
34
|
+
const SidebarContext = react.createContext(null);
|
|
35
|
+
function useSidebar() {
|
|
36
|
+
const context = react.useContext(SidebarContext);
|
|
37
|
+
if (!context) throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
38
|
+
return context;
|
|
39
|
+
}
|
|
40
|
+
const SidebarProvider = react.forwardRef(({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, viewportWidth, previewMode, useBottomNav: useBottomNavProp = false, className, style, children, ...props }, ref) => {
|
|
41
|
+
const windowIsMobile = require_shell_use_mobile.useIsMobile();
|
|
42
|
+
const isMobile = viewportWidth !== void 0 ? viewportWidth < 768 : windowIsMobile;
|
|
43
|
+
const isPreviewMode = viewportWidth !== void 0 || !!previewMode;
|
|
44
|
+
const [openMobile, setOpenMobile] = react.useState(false);
|
|
45
|
+
const [_open, _setOpen] = react.useState(defaultOpen);
|
|
46
|
+
const open = openProp ?? _open;
|
|
47
|
+
const setOpen = react.useCallback((value) => {
|
|
48
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
49
|
+
if (setOpenProp) setOpenProp(openState);
|
|
50
|
+
else _setOpen(openState);
|
|
51
|
+
}, [setOpenProp, open]);
|
|
52
|
+
const toggleSidebar = react.useCallback(() => {
|
|
53
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
54
|
+
}, [
|
|
55
|
+
isMobile,
|
|
56
|
+
setOpen,
|
|
57
|
+
setOpenMobile
|
|
58
|
+
]);
|
|
59
|
+
react.useEffect(() => {
|
|
60
|
+
const handleKeyDown = (event) => {
|
|
61
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
62
|
+
const activeElement = document.activeElement;
|
|
63
|
+
if (activeElement?.closest(".group\\/composer") || activeElement?.closest("[data-toolbar]") || activeElement?.classList.contains("ProseMirror")) return;
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
toggleSidebar();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
69
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
70
|
+
}, [toggleSidebar]);
|
|
71
|
+
const state = open ? "expanded" : "collapsed";
|
|
72
|
+
const contextValue = react.useMemo(() => ({
|
|
73
|
+
state,
|
|
74
|
+
open,
|
|
75
|
+
setOpen,
|
|
76
|
+
isMobile,
|
|
77
|
+
openMobile,
|
|
78
|
+
setOpenMobile,
|
|
79
|
+
toggleSidebar,
|
|
80
|
+
isPreviewMode,
|
|
81
|
+
useBottomNav: useBottomNavProp
|
|
82
|
+
}), [
|
|
83
|
+
state,
|
|
84
|
+
open,
|
|
85
|
+
setOpen,
|
|
86
|
+
isMobile,
|
|
87
|
+
openMobile,
|
|
88
|
+
setOpenMobile,
|
|
89
|
+
toggleSidebar,
|
|
90
|
+
isPreviewMode,
|
|
91
|
+
useBottomNavProp
|
|
92
|
+
]);
|
|
93
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarContext.Provider, {
|
|
94
|
+
value: contextValue,
|
|
95
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
96
|
+
style: {
|
|
97
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
98
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
99
|
+
...style
|
|
100
|
+
},
|
|
101
|
+
className: cn("group/sidebar-wrapper flex min-h-0 w-full flex-1", className),
|
|
102
|
+
ref,
|
|
103
|
+
...props,
|
|
104
|
+
children
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
SidebarProvider.displayName = "SidebarProvider";
|
|
109
|
+
const Sidebar = react.forwardRef(({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, ...props }, ref) => {
|
|
110
|
+
const { isMobile, state, openMobile, setOpenMobile, isPreviewMode, useBottomNav } = useSidebar();
|
|
111
|
+
const sidebarWidth = state === "expanded" ? SIDEBAR_WIDTH : SIDEBAR_WIDTH_ICON;
|
|
112
|
+
if (useBottomNav && isMobile) return null;
|
|
113
|
+
if (collapsible === "none") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
114
|
+
className: cn("bg-sidebar text-sidebar-foreground flex w-(--sidebar-width) flex-col rounded-tl-lg", isPreviewMode ? "h-full" : "h-[97vh]", className),
|
|
115
|
+
ref,
|
|
116
|
+
...props,
|
|
117
|
+
children
|
|
118
|
+
});
|
|
119
|
+
if (isMobile) {
|
|
120
|
+
const positionClass = isPreviewMode ? "absolute" : "fixed";
|
|
121
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [openMobile && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
122
|
+
className: cn(positionClass, "inset-0 z-40 bg-black/50"),
|
|
123
|
+
onClick: () => setOpenMobile(false),
|
|
124
|
+
"aria-hidden": "true"
|
|
125
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
126
|
+
"data-sidebar": "sidebar",
|
|
127
|
+
"data-mobile": "true",
|
|
128
|
+
className: cn(positionClass, "bg-sidebar text-sidebar-foreground top-0 left-0 z-50 h-full w-[--sidebar-width] p-0 transition-transform duration-300 ease-in-out", openMobile ? "translate-x-0" : "-translate-x-full", className),
|
|
129
|
+
style: { "--sidebar-width": SIDEBAR_WIDTH_MOBILE },
|
|
130
|
+
ref,
|
|
131
|
+
...props,
|
|
132
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
133
|
+
className: "flex h-full w-full flex-col",
|
|
134
|
+
children
|
|
135
|
+
})
|
|
136
|
+
})] });
|
|
137
|
+
}
|
|
138
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
139
|
+
ref,
|
|
140
|
+
className: "group peer bg-sidebar text-sidebar-foreground hidden md:block",
|
|
141
|
+
"data-state": state,
|
|
142
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
143
|
+
"data-variant": variant,
|
|
144
|
+
"data-side": side,
|
|
145
|
+
style: { "--sidebar-width": sidebarWidth },
|
|
146
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: cn("relative bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
147
|
+
className: cn("relative inset-y-0 z-[20] hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex", isPreviewMode ? "h-full" : "h-svh", side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]", variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=right]:border-l", className),
|
|
148
|
+
...props,
|
|
149
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
150
|
+
"data-sidebar": "sidebar",
|
|
151
|
+
className: "group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",
|
|
152
|
+
children
|
|
153
|
+
})
|
|
154
|
+
})]
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
Sidebar.displayName = "Sidebar";
|
|
158
|
+
const SidebarRail = react.forwardRef(({ className, ...props }, ref) => {
|
|
159
|
+
const { toggleSidebar } = useSidebar();
|
|
160
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
161
|
+
ref,
|
|
162
|
+
"data-sidebar": "rail",
|
|
163
|
+
"aria-label": "Toggle Sidebar",
|
|
164
|
+
tabIndex: -1,
|
|
165
|
+
onClick: toggleSidebar,
|
|
166
|
+
title: "Toggle Sidebar",
|
|
167
|
+
className: cn("hover:after:bg-sidebar-border absolute inset-y-0 z-[10] hidden w-4 -translate-x-full transition-all ease-linear group-data-[side=left]:-right-[1.375rem] group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className),
|
|
168
|
+
...props
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
SidebarRail.displayName = "SidebarRail";
|
|
172
|
+
const SidebarInset = react.forwardRef(({ className, ...props }, ref) => {
|
|
173
|
+
const { isPreviewMode } = useSidebar();
|
|
174
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("main", {
|
|
175
|
+
ref,
|
|
176
|
+
className: cn("relative flex flex-1 flex-col", isPreviewMode ? "max-h-[calc(100svh-(--spacing(13)))]" : "min-h-svh peer-data-[variant=inset]:min-h-[calc(100svh-(--spacing(4)))]", "md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", className),
|
|
177
|
+
...props
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
SidebarInset.displayName = "SidebarInset";
|
|
181
|
+
const SidebarInput = react.forwardRef(({ className, ...props }, ref) => {
|
|
182
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
183
|
+
ref,
|
|
184
|
+
"data-sidebar": "input",
|
|
185
|
+
className: cn("bg-background focus-visible:ring-sidebar-ring h-8 w-full rounded-md border px-3 text-sm shadow-none focus-visible:ring-2 focus-visible:outline-none", className),
|
|
186
|
+
...props
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
SidebarInput.displayName = "SidebarInput";
|
|
190
|
+
const SidebarHeader = react.forwardRef(({ className, ...props }, ref) => {
|
|
191
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
192
|
+
ref,
|
|
193
|
+
"data-sidebar": "header",
|
|
194
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
195
|
+
...props
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
SidebarHeader.displayName = "SidebarHeader";
|
|
199
|
+
const SidebarFooter = react.forwardRef(({ className, ...props }, ref) => {
|
|
200
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
201
|
+
ref,
|
|
202
|
+
"data-sidebar": "footer",
|
|
203
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
204
|
+
...props
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
SidebarFooter.displayName = "SidebarFooter";
|
|
208
|
+
const SidebarSeparator = react.forwardRef(({ className, ...props }, ref) => {
|
|
209
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Separator, {
|
|
210
|
+
ref,
|
|
211
|
+
"data-sidebar": "separator",
|
|
212
|
+
className: cn("bg-sidebar-border mx-2 w-auto", className),
|
|
213
|
+
...props
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
SidebarSeparator.displayName = "SidebarSeparator";
|
|
217
|
+
const SidebarContent = react.forwardRef(({ className, ...props }, ref) => {
|
|
218
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
219
|
+
ref,
|
|
220
|
+
"data-sidebar": "content",
|
|
221
|
+
className: cn("scrollbar-none flex min-h-0 flex-1 flex-col gap-2 overflow-auto rounded group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:overflow-hidden group-data-[collapsible=icon]:pt-3", className),
|
|
222
|
+
...props
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
SidebarContent.displayName = "SidebarContent";
|
|
226
|
+
const SidebarGroup = react.forwardRef(({ className, ...props }, ref) => {
|
|
227
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
228
|
+
ref,
|
|
229
|
+
"data-sidebar": "group",
|
|
230
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2 group-data-[collapsible=icon]:py-0 group-data-[collapsible=icon]:pt-4", className),
|
|
231
|
+
...props
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
SidebarGroup.displayName = "SidebarGroup";
|
|
235
|
+
const SidebarGroupLabel = react.forwardRef(({ className, asChild = false, ...props }, ref) => {
|
|
236
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? _radix_ui_react_slot.Slot : "div", {
|
|
237
|
+
ref,
|
|
238
|
+
"data-sidebar": "group-label",
|
|
239
|
+
className: cn("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:hidden", className),
|
|
240
|
+
...props
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
SidebarGroupLabel.displayName = "SidebarGroupLabel";
|
|
244
|
+
const SidebarGroupAction = react.forwardRef(({ className, asChild = false, ...props }, ref) => {
|
|
245
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? _radix_ui_react_slot.Slot : "button", {
|
|
246
|
+
ref,
|
|
247
|
+
"data-sidebar": "group-action",
|
|
248
|
+
className: cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 md:after:hidden", "group-data-[collapsible=icon]:hidden", className),
|
|
249
|
+
...props
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
SidebarGroupAction.displayName = "SidebarGroupAction";
|
|
253
|
+
const SidebarGroupContent = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
254
|
+
ref,
|
|
255
|
+
"data-sidebar": "group-content",
|
|
256
|
+
className: cn("w-full text-sm", className),
|
|
257
|
+
...props
|
|
258
|
+
}));
|
|
259
|
+
SidebarGroupContent.displayName = "SidebarGroupContent";
|
|
260
|
+
const SidebarMenu = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
261
|
+
ref,
|
|
262
|
+
"data-sidebar": "menu",
|
|
263
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
264
|
+
...props
|
|
265
|
+
}));
|
|
266
|
+
SidebarMenu.displayName = "SidebarMenu";
|
|
267
|
+
const SidebarMenuItem = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
268
|
+
ref,
|
|
269
|
+
"data-sidebar": "menu-item",
|
|
270
|
+
className: cn("group/menu-item relative", className),
|
|
271
|
+
...props
|
|
272
|
+
}));
|
|
273
|
+
SidebarMenuItem.displayName = "SidebarMenuItem";
|
|
274
|
+
const sidebarMenuButtonVariants = (0, class_variance_authority.cva)("peer/menu-button ring-sidebar-ring hover:bg-sidebar-primary hover:text-sidebar-primary-foreground active:bg-sidebar-primary active:text-sidebar-primary-foreground data-[active=true]:bg-sidebar-primary data-[active=true]:text-sidebar-primary-foreground data-[state=open]:hover:bg-sidebar-primary data-[state=open]:hover:text-sidebar-primary-foreground flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:font-medium [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", {
|
|
275
|
+
variants: {
|
|
276
|
+
variant: {
|
|
277
|
+
default: "hover:bg-sidebar-primary hover:text-sidebar-primary-foreground",
|
|
278
|
+
outline: "hover:bg-sidebar-primary hover:text-sidebar-primary-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-primary))]"
|
|
279
|
+
},
|
|
280
|
+
size: {
|
|
281
|
+
default: "h-8 text-sm",
|
|
282
|
+
sm: "h-7 text-xs",
|
|
283
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
defaultVariants: {
|
|
287
|
+
variant: "default",
|
|
288
|
+
size: "default"
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
const SidebarMenuButton = react.forwardRef(({ asChild = false, isActive = false, variant = "default", size = "default", className, ...props }, ref) => {
|
|
292
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? _radix_ui_react_slot.Slot : "button", {
|
|
293
|
+
ref,
|
|
294
|
+
"data-sidebar": "menu-button",
|
|
295
|
+
"data-size": size,
|
|
296
|
+
"data-active": isActive,
|
|
297
|
+
className: cn(sidebarMenuButtonVariants({
|
|
298
|
+
variant,
|
|
299
|
+
size
|
|
300
|
+
}), className),
|
|
301
|
+
...props
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
SidebarMenuButton.displayName = "SidebarMenuButton";
|
|
305
|
+
const SidebarMenuAction = react.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
|
|
306
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? _radix_ui_react_slot.Slot : "button", {
|
|
307
|
+
ref,
|
|
308
|
+
"data-sidebar": "menu-action",
|
|
309
|
+
className: cn("text-sidebar-foreground ring-sidebar-ring peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 md:after:hidden", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", showOnHover && "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0", className),
|
|
310
|
+
...props
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
SidebarMenuAction.displayName = "SidebarMenuAction";
|
|
314
|
+
const SidebarMenuBadge = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
315
|
+
ref,
|
|
316
|
+
"data-sidebar": "menu-badge",
|
|
317
|
+
className: cn("text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", className),
|
|
318
|
+
...props
|
|
319
|
+
}));
|
|
320
|
+
SidebarMenuBadge.displayName = "SidebarMenuBadge";
|
|
321
|
+
const SidebarMenuSkeleton = react.forwardRef(({ className, showIcon = false, ...props }, ref) => {
|
|
322
|
+
const width = react.useMemo(() => {
|
|
323
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
324
|
+
}, []);
|
|
325
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
326
|
+
ref,
|
|
327
|
+
"data-sidebar": "menu-skeleton",
|
|
328
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
329
|
+
...props,
|
|
330
|
+
children: [showIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, {
|
|
331
|
+
className: "size-4 rounded-md",
|
|
332
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
333
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, {
|
|
334
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
335
|
+
"data-sidebar": "menu-skeleton-text",
|
|
336
|
+
style: { "--skeleton-width": width }
|
|
337
|
+
})]
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
|
|
341
|
+
const SidebarMenuSub = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
342
|
+
ref,
|
|
343
|
+
"data-sidebar": "menu-sub",
|
|
344
|
+
className: cn("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5", "group-data-[collapsible=icon]:hidden", className),
|
|
345
|
+
...props
|
|
346
|
+
}));
|
|
347
|
+
SidebarMenuSub.displayName = "SidebarMenuSub";
|
|
348
|
+
const SidebarMenuSubItem = react.forwardRef(({ ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
349
|
+
ref,
|
|
350
|
+
...props
|
|
351
|
+
}));
|
|
352
|
+
SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
|
|
353
|
+
const SidebarMenuSubButton = react.forwardRef(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
|
|
354
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? _radix_ui_react_slot.Slot : "a", {
|
|
355
|
+
ref,
|
|
356
|
+
"data-sidebar": "menu-sub-button",
|
|
357
|
+
"data-size": size,
|
|
358
|
+
"data-active": isActive,
|
|
359
|
+
className: cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", size === "sm" && "text-xs", size === "md" && "text-sm", "group-data-[collapsible=icon]:hidden", className),
|
|
360
|
+
...props
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
|
|
364
|
+
//#endregion
|
|
365
|
+
exports.Sidebar = Sidebar;
|
|
366
|
+
exports.SidebarContent = SidebarContent;
|
|
367
|
+
exports.SidebarContext = SidebarContext;
|
|
368
|
+
exports.SidebarFooter = SidebarFooter;
|
|
369
|
+
exports.SidebarGroup = SidebarGroup;
|
|
370
|
+
exports.SidebarGroupAction = SidebarGroupAction;
|
|
371
|
+
exports.SidebarGroupContent = SidebarGroupContent;
|
|
372
|
+
exports.SidebarGroupLabel = SidebarGroupLabel;
|
|
373
|
+
exports.SidebarHeader = SidebarHeader;
|
|
374
|
+
exports.SidebarInput = SidebarInput;
|
|
375
|
+
exports.SidebarInset = SidebarInset;
|
|
376
|
+
exports.SidebarMenu = SidebarMenu;
|
|
377
|
+
exports.SidebarMenuAction = SidebarMenuAction;
|
|
378
|
+
exports.SidebarMenuBadge = SidebarMenuBadge;
|
|
379
|
+
exports.SidebarMenuButton = SidebarMenuButton;
|
|
380
|
+
exports.SidebarMenuItem = SidebarMenuItem;
|
|
381
|
+
exports.SidebarMenuSkeleton = SidebarMenuSkeleton;
|
|
382
|
+
exports.SidebarMenuSub = SidebarMenuSub;
|
|
383
|
+
exports.SidebarMenuSubButton = SidebarMenuSubButton;
|
|
384
|
+
exports.SidebarMenuSubItem = SidebarMenuSubItem;
|
|
385
|
+
exports.SidebarProvider = SidebarProvider;
|
|
386
|
+
exports.SidebarRail = SidebarRail;
|
|
387
|
+
exports.SidebarSeparator = SidebarSeparator;
|
|
388
|
+
exports.useSidebar = useSidebar;
|
|
389
|
+
|
|
390
|
+
//# sourceMappingURL=sidebar.cjs.map
|