@korsolutions/ui 0.0.86 → 0.0.87
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/module/components/index.js +1 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/sidebar/components/sidebar-content.js +19 -0
- package/dist/module/components/sidebar/components/sidebar-content.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-footer.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-footer.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-group-label.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-group-label.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-group.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-group.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-header.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-header.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-menu-item.js +36 -0
- package/dist/module/components/sidebar/components/sidebar-menu-item.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-menu-sub.js +22 -0
- package/dist/module/components/sidebar/components/sidebar-menu-sub.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-menu.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-menu.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-provider.js +47 -0
- package/dist/module/components/sidebar/components/sidebar-provider.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-root.js +27 -0
- package/dist/module/components/sidebar/components/sidebar-root.js.map +1 -0
- package/dist/module/components/sidebar/context.js +12 -0
- package/dist/module/components/sidebar/context.js.map +1 -0
- package/dist/module/components/sidebar/index.js +26 -0
- package/dist/module/components/sidebar/index.js.map +1 -0
- package/dist/module/components/sidebar/types.js +4 -0
- package/dist/module/components/sidebar/types.js.map +1 -0
- package/dist/module/components/sidebar/variants/default.js +101 -0
- package/dist/module/components/sidebar/variants/default.js.map +1 -0
- package/dist/module/components/sidebar/variants/index.js +7 -0
- package/dist/module/components/sidebar/variants/index.js.map +1 -0
- package/dist/typescript/src/components/index.d.ts +1 -0
- package/dist/typescript/src/components/index.d.ts.map +1 -1
- package/dist/typescript/src/components/sidebar/components/sidebar-content.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-content.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-footer.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-footer.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-group-label.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-group-label.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-group.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-group.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-header.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-header.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu-item.d.ts +12 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu-item.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu-sub.d.ts +10 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu-sub.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-provider.d.ts +17 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-provider.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-root.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-root.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/context.d.ts +12 -0
- package/dist/typescript/src/components/sidebar/context.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/index.d.ts +35 -0
- package/dist/typescript/src/components/sidebar/index.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/types.d.ts +29 -0
- package/dist/typescript/src/components/sidebar/types.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/variants/default.d.ts +3 -0
- package/dist/typescript/src/components/sidebar/variants/default.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/variants/index.d.ts +5 -0
- package/dist/typescript/src/components/sidebar/variants/index.d.ts.map +1 -0
- package/dist/typescript/src/themes/types.d.ts +4 -0
- package/dist/typescript/src/themes/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/sidebar/components/sidebar-content.tsx +19 -0
- package/src/components/sidebar/components/sidebar-footer.tsx +15 -0
- package/src/components/sidebar/components/sidebar-group-label.tsx +15 -0
- package/src/components/sidebar/components/sidebar-group.tsx +15 -0
- package/src/components/sidebar/components/sidebar-header.tsx +15 -0
- package/src/components/sidebar/components/sidebar-menu-item.tsx +61 -0
- package/src/components/sidebar/components/sidebar-menu-sub.tsx +23 -0
- package/src/components/sidebar/components/sidebar-menu.tsx +15 -0
- package/src/components/sidebar/components/sidebar-provider.tsx +73 -0
- package/src/components/sidebar/components/sidebar-root.tsx +19 -0
- package/src/components/sidebar/context.ts +21 -0
- package/src/components/sidebar/index.ts +37 -0
- package/src/components/sidebar/types.ts +31 -0
- package/src/components/sidebar/variants/default.tsx +96 -0
- package/src/components/sidebar/variants/index.ts +5 -0
- package/src/themes/types.ts +4 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
export interface SidebarMenuProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
style?: StyleProp<ViewStyle>;
|
|
6
|
+
}
|
|
7
|
+
export declare function SidebarMenu(props: SidebarMenuProps): React.JSX.Element;
|
|
8
|
+
//# sourceMappingURL=sidebar-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar-menu.d.ts","sourceRoot":"","sources":["../../../../../../src/components/sidebar/components/sidebar-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,qBAKlD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SidebarVariants } from "../variants";
|
|
3
|
+
export interface SidebarProviderProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
/** Variant key for sidebar theming */
|
|
6
|
+
variant?: keyof typeof SidebarVariants;
|
|
7
|
+
/** Width of the sidebar in pixels (default: 256) */
|
|
8
|
+
width?: number;
|
|
9
|
+
/** Default open state (uncontrolled) */
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
/** Open state (controlled) */
|
|
12
|
+
open?: boolean;
|
|
13
|
+
/** Callback when open state changes (controlled) */
|
|
14
|
+
onOpenChange?: (open: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function SidebarProvider(props: SidebarProviderProps): React.JSX.Element;
|
|
17
|
+
//# sourceMappingURL=sidebar-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar-provider.d.ts","sourceRoot":"","sources":["../../../../../../src/components/sidebar/components/sidebar-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAI9D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,OAAO,eAAe,CAAC;IAEvC,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,wCAAwC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf,oDAAoD;IACpD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBA+C1D"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
export interface SidebarRootProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
style?: StyleProp<ViewStyle>;
|
|
6
|
+
}
|
|
7
|
+
export declare function SidebarRoot(props: SidebarRootProps): React.JSX.Element;
|
|
8
|
+
//# sourceMappingURL=sidebar-root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar-root.d.ts","sourceRoot":"","sources":["../../../../../../src/components/sidebar/components/sidebar-root.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,qBASlD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SidebarState, SidebarStyles } from "./types";
|
|
2
|
+
export interface SidebarContextValue {
|
|
3
|
+
state: SidebarState;
|
|
4
|
+
open: boolean;
|
|
5
|
+
setOpen: (open: boolean) => void;
|
|
6
|
+
toggleSidebar: () => void;
|
|
7
|
+
width?: number;
|
|
8
|
+
styles?: SidebarStyles;
|
|
9
|
+
}
|
|
10
|
+
export declare const SidebarContext: import("react").Context<SidebarContextValue | undefined>;
|
|
11
|
+
export declare const useSidebar: () => SidebarContextValue;
|
|
12
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../src/components/sidebar/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE3D,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,eAAO,MAAM,cAAc,0DAA4D,CAAC;AAExF,eAAO,MAAM,UAAU,2BAMtB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SidebarContent } from "./components/sidebar-content";
|
|
2
|
+
import { SidebarFooter } from "./components/sidebar-footer";
|
|
3
|
+
import { SidebarGroup } from "./components/sidebar-group";
|
|
4
|
+
import { SidebarGroupLabel } from "./components/sidebar-group-label";
|
|
5
|
+
import { SidebarHeader } from "./components/sidebar-header";
|
|
6
|
+
import { SidebarMenuItem } from "./components/sidebar-menu-item";
|
|
7
|
+
import { SidebarMenuSub } from "./components/sidebar-menu-sub";
|
|
8
|
+
import { SidebarMenu } from "./components/sidebar-menu";
|
|
9
|
+
import { SidebarProvider } from "./components/sidebar-provider";
|
|
10
|
+
import { SidebarRoot } from "./components/sidebar-root";
|
|
11
|
+
export declare const Sidebar: {
|
|
12
|
+
Provider: typeof SidebarProvider;
|
|
13
|
+
Root: typeof SidebarRoot;
|
|
14
|
+
Header: typeof SidebarHeader;
|
|
15
|
+
Footer: typeof SidebarFooter;
|
|
16
|
+
Content: typeof SidebarContent;
|
|
17
|
+
Group: typeof SidebarGroup;
|
|
18
|
+
GroupLabel: typeof SidebarGroupLabel;
|
|
19
|
+
Menu: typeof SidebarMenu;
|
|
20
|
+
MenuItem: typeof SidebarMenuItem;
|
|
21
|
+
MenuSub: typeof SidebarMenuSub;
|
|
22
|
+
};
|
|
23
|
+
export { useSidebar } from "./context";
|
|
24
|
+
export type { SidebarProviderProps } from "./components/sidebar-provider";
|
|
25
|
+
export type { SidebarRootProps } from "./components/sidebar-root";
|
|
26
|
+
export type { SidebarHeaderProps } from "./components/sidebar-header";
|
|
27
|
+
export type { SidebarFooterProps } from "./components/sidebar-footer";
|
|
28
|
+
export type { SidebarContentProps } from "./components/sidebar-content";
|
|
29
|
+
export type { SidebarGroupProps } from "./components/sidebar-group";
|
|
30
|
+
export type { SidebarGroupLabelProps } from "./components/sidebar-group-label";
|
|
31
|
+
export type { SidebarMenuProps } from "./components/sidebar-menu";
|
|
32
|
+
export type { SidebarMenuItemProps } from "./components/sidebar-menu-item";
|
|
33
|
+
export type { SidebarMenuSubProps } from "./components/sidebar-menu-sub";
|
|
34
|
+
export type { SidebarStyles, SidebarState } from "./types";
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/sidebar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,eAAO,MAAM,OAAO;;;;;;;;;;;CAWnB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,YAAY,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,YAAY,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,YAAY,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,YAAY,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
2
|
+
import type { IconProps } from "../icon";
|
|
3
|
+
export type SidebarState = "expanded" | "collapsed";
|
|
4
|
+
export type SidebarMenuButtonState = "default" | "active" | "hovered";
|
|
5
|
+
export interface SidebarStyles {
|
|
6
|
+
/** The sidebar container */
|
|
7
|
+
root?: StyleProp<ViewStyle>;
|
|
8
|
+
/** Header (sticky top) */
|
|
9
|
+
header?: StyleProp<ViewStyle>;
|
|
10
|
+
/** Footer (sticky bottom) */
|
|
11
|
+
footer?: StyleProp<ViewStyle>;
|
|
12
|
+
/** Scrollable content area */
|
|
13
|
+
content?: StyleProp<ViewStyle>;
|
|
14
|
+
/** Group container */
|
|
15
|
+
group?: StyleProp<ViewStyle>;
|
|
16
|
+
/** Group label text */
|
|
17
|
+
groupLabel?: StyleProp<TextStyle>;
|
|
18
|
+
/** Menu list container */
|
|
19
|
+
menu?: StyleProp<ViewStyle>;
|
|
20
|
+
/** Menu item */
|
|
21
|
+
menuItem?: Partial<Record<SidebarMenuButtonState, StyleProp<ViewStyle>>>;
|
|
22
|
+
/** Menu item text */
|
|
23
|
+
menuItemText?: Partial<Record<SidebarMenuButtonState, StyleProp<TextStyle>>>;
|
|
24
|
+
/** Menu item icon */
|
|
25
|
+
menuItemIcon?: Partial<Record<SidebarMenuButtonState, IconProps>>;
|
|
26
|
+
/** Submenu container */
|
|
27
|
+
menuSub?: StyleProp<ViewStyle>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/sidebar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,WAAW,CAAC;AAEpD,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEtE,MAAM,WAAW,aAAa;IAC5B,4BAA4B;IAC5B,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,0BAA0B;IAC1B,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC9B,6BAA6B;IAC7B,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC9B,8BAA8B;IAC9B,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC/B,sBAAsB;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,uBAAuB;IACvB,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,0BAA0B;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,gBAAgB;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,sBAAsB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACzE,qBAAqB;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,sBAAsB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7E,qBAAqB;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,sBAAsB,EAAE,SAAS,CAAC,CAAC,CAAC;IAClE,wBAAwB;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/sidebar/variants/default.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,wBAAwB,IAAI,aAAa,CA4FxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/sidebar/variants/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,eAAO,MAAM,eAAe;;CAE3B,CAAC"}
|
|
@@ -54,6 +54,7 @@ import type { ProgressStyles } from "../components/progress/types";
|
|
|
54
54
|
import type { RadioGroupStyles } from "../components/radio-group/types";
|
|
55
55
|
import type { SelectStyles } from "../components/select/types";
|
|
56
56
|
import type { SeparatorStyles } from "../components/separator/types";
|
|
57
|
+
import type { SidebarStyles } from "../components/sidebar/types";
|
|
57
58
|
import type { SpinnerStyles } from "../components/spinner/types";
|
|
58
59
|
import type { TableStyles } from "../components/table/types";
|
|
59
60
|
import type { TabsStyles } from "../components/tabs/types";
|
|
@@ -129,6 +130,9 @@ export interface ComponentsConfig {
|
|
|
129
130
|
separator?: {
|
|
130
131
|
styles?: SeparatorStyles;
|
|
131
132
|
};
|
|
133
|
+
sidebar?: {
|
|
134
|
+
styles?: SidebarStyles;
|
|
135
|
+
};
|
|
132
136
|
spinner?: {
|
|
133
137
|
styles?: SpinnerStyles;
|
|
134
138
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/themes/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C,KAAK,KAAK,GAAG,OAAO,MAAM,KAAK,MAAM,MAAM,MAAM,IAAI,CAAC;AAEtD,MAAM,WAAW,MAAM;IACrB,UAAU,EAAE,KAAK,CAAC;IAClB,UAAU,EAAE,KAAK,CAAC;IAClB,OAAO,EAAE,KAAK,CAAC;IACf,iBAAiB,EAAE,KAAK,CAAC;IACzB,SAAS,EAAE,KAAK,CAAC;IACjB,mBAAmB,EAAE,KAAK,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,eAAe,EAAE,KAAK,CAAC;IACvB,MAAM,EAAE,KAAK,CAAC;IACd,OAAO,EAAE,KAAK,CAAC;IACf,OAAO,EAAE,KAAK,CAAC;IACf,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,KAAK,CAAC;CACb;AAED,MAAM,MAAM,MAAM,GAAG,MAAM,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,CAAC,EAAE,cAAc,CAAC;KACzB,CAAC;IACF,KAAK,CAAC,EAAE;QACN,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,OAAO,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACnF,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,CAAC;IACF,SAAS,CAAC,EAAE;QACV,MAAM,CAAC,EAAE,eAAe,CAAC;KAC1B,CAAC;IACF,YAAY,CAAC,EAAE;QACb,MAAM,CAAC,EAAE,kBAAkB,CAAC;KAC7B,CAAC;CACH"}
|
package/package.json
CHANGED
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ScrollView, type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarContentProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SidebarContent(props: SidebarContentProps) {
|
|
11
|
+
const { children, style } = props;
|
|
12
|
+
const sidebar = useSidebar();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<ScrollView style={[sidebar.styles?.content, style]} showsVerticalScrollIndicator={false}>
|
|
16
|
+
{children}
|
|
17
|
+
</ScrollView>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, View, type ViewStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarFooterProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SidebarFooter(props: SidebarFooterProps) {
|
|
11
|
+
const { children, style } = props;
|
|
12
|
+
const sidebar = useSidebar();
|
|
13
|
+
|
|
14
|
+
return <View style={[sidebar.styles?.footer, style]}>{children}</View>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, Text, type TextStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarGroupLabelProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: StyleProp<TextStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SidebarGroupLabel(props: SidebarGroupLabelProps) {
|
|
11
|
+
const { children, style } = props;
|
|
12
|
+
const sidebar = useSidebar();
|
|
13
|
+
|
|
14
|
+
return <Text style={[sidebar.styles?.groupLabel, style]}>{children}</Text>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, View, type ViewStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarGroupProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SidebarGroup(props: SidebarGroupProps) {
|
|
11
|
+
const { children, style } = props;
|
|
12
|
+
const sidebar = useSidebar();
|
|
13
|
+
|
|
14
|
+
return <View style={[sidebar.styles?.group, style]}>{children}</View>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, View, type ViewStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarHeaderProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SidebarHeader(props: SidebarHeaderProps) {
|
|
11
|
+
const { children, style } = props;
|
|
12
|
+
const sidebar = useSidebar();
|
|
13
|
+
|
|
14
|
+
return <View style={[sidebar.styles?.header, style]}>{children}</View>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Pressable,
|
|
4
|
+
type PressableProps,
|
|
5
|
+
type StyleProp,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
type ViewStyle,
|
|
8
|
+
} from "react-native";
|
|
9
|
+
import { useOrganizedChildren } from "../../../hooks/use-organized-children";
|
|
10
|
+
import { useSidebar } from "../context";
|
|
11
|
+
import type { SidebarMenuButtonState } from "../types";
|
|
12
|
+
|
|
13
|
+
export interface SidebarMenuItemProps extends Omit<PressableProps, "style"> {
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
|
|
16
|
+
/** Mark as active item */
|
|
17
|
+
isActive?: boolean;
|
|
18
|
+
|
|
19
|
+
/** Size variant */
|
|
20
|
+
size?: "default" | "lg";
|
|
21
|
+
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function SidebarMenuItem(props: SidebarMenuItemProps) {
|
|
26
|
+
const { children, isActive, size = "default", style, onPress, ...rest } = props;
|
|
27
|
+
const sidebar = useSidebar();
|
|
28
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
29
|
+
const styles = sidebar.styles;
|
|
30
|
+
|
|
31
|
+
const state: SidebarMenuButtonState = isActive ? "active" : isHovered ? "hovered" : "default";
|
|
32
|
+
|
|
33
|
+
const textStyle = StyleSheet.flatten([
|
|
34
|
+
styles?.menuItemText?.default,
|
|
35
|
+
styles?.menuItemText?.[state],
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
const iconProps = StyleSheet.flatten([
|
|
39
|
+
styles?.menuItemIcon?.default,
|
|
40
|
+
styles?.menuItemIcon?.[state],
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
const organizedChildren = useOrganizedChildren(children, textStyle, iconProps);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<Pressable
|
|
47
|
+
{...rest}
|
|
48
|
+
onPress={onPress}
|
|
49
|
+
onHoverIn={() => setIsHovered(true)}
|
|
50
|
+
onHoverOut={() => setIsHovered(false)}
|
|
51
|
+
style={[
|
|
52
|
+
styles?.menuItem?.default,
|
|
53
|
+
state !== "default" && styles?.menuItem?.[state],
|
|
54
|
+
size === "lg" && { minHeight: 48, paddingVertical: 8 },
|
|
55
|
+
style,
|
|
56
|
+
]}
|
|
57
|
+
>
|
|
58
|
+
{organizedChildren}
|
|
59
|
+
</Pressable>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, View, type ViewStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarMenuSubProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
|
|
8
|
+
/** Whether the submenu is open (controlled) */
|
|
9
|
+
open?: boolean;
|
|
10
|
+
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function SidebarMenuSub(props: SidebarMenuSubProps) {
|
|
15
|
+
const { children, open = true, style } = props;
|
|
16
|
+
const sidebar = useSidebar();
|
|
17
|
+
|
|
18
|
+
if (!open) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return <View style={[sidebar.styles?.menuSub, style]}>{children}</View>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, View, type ViewStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarMenuProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SidebarMenu(props: SidebarMenuProps) {
|
|
11
|
+
const { children, style } = props;
|
|
12
|
+
const sidebar = useSidebar();
|
|
13
|
+
|
|
14
|
+
return <View style={[sidebar.styles?.menu, style]}>{children}</View>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
2
|
+
import { useComponentConfig } from "../../../themes/provider";
|
|
3
|
+
import { mergeStyles } from "../../../utils/calculate-styles";
|
|
4
|
+
import { SidebarContext, type SidebarContextValue } from "../context";
|
|
5
|
+
import { SidebarVariants } from "../variants";
|
|
6
|
+
|
|
7
|
+
export interface SidebarProviderProps {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
|
|
10
|
+
/** Variant key for sidebar theming */
|
|
11
|
+
variant?: keyof typeof SidebarVariants;
|
|
12
|
+
|
|
13
|
+
/** Width of the sidebar in pixels (default: 256) */
|
|
14
|
+
width?: number;
|
|
15
|
+
|
|
16
|
+
/** Default open state (uncontrolled) */
|
|
17
|
+
defaultOpen?: boolean;
|
|
18
|
+
|
|
19
|
+
/** Open state (controlled) */
|
|
20
|
+
open?: boolean;
|
|
21
|
+
|
|
22
|
+
/** Callback when open state changes (controlled) */
|
|
23
|
+
onOpenChange?: (open: boolean) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function SidebarProvider(props: SidebarProviderProps) {
|
|
27
|
+
const {
|
|
28
|
+
children,
|
|
29
|
+
variant = "default",
|
|
30
|
+
width,
|
|
31
|
+
defaultOpen = true,
|
|
32
|
+
open: controlledOpen,
|
|
33
|
+
onOpenChange,
|
|
34
|
+
} = props;
|
|
35
|
+
|
|
36
|
+
const [_open, _setOpen] = useState(defaultOpen);
|
|
37
|
+
|
|
38
|
+
const open = controlledOpen ?? _open;
|
|
39
|
+
const setOpen = useCallback(
|
|
40
|
+
(value: boolean) => {
|
|
41
|
+
if (onOpenChange) {
|
|
42
|
+
onOpenChange(value);
|
|
43
|
+
} else {
|
|
44
|
+
_setOpen(value);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
[onOpenChange],
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const toggleSidebar = useCallback(() => {
|
|
51
|
+
setOpen(!open);
|
|
52
|
+
}, [open, setOpen]);
|
|
53
|
+
|
|
54
|
+
const variantStyles = SidebarVariants[variant]();
|
|
55
|
+
const componentConfig = useComponentConfig("sidebar");
|
|
56
|
+
const mergedStyles = mergeStyles(variantStyles, componentConfig?.styles);
|
|
57
|
+
|
|
58
|
+
const state = open ? "expanded" : "collapsed";
|
|
59
|
+
|
|
60
|
+
const contextValue = useMemo<SidebarContextValue>(
|
|
61
|
+
() => ({
|
|
62
|
+
state,
|
|
63
|
+
open,
|
|
64
|
+
setOpen,
|
|
65
|
+
toggleSidebar,
|
|
66
|
+
width,
|
|
67
|
+
styles: mergedStyles,
|
|
68
|
+
}),
|
|
69
|
+
[state, open, setOpen, toggleSidebar, width, mergedStyles],
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
return <SidebarContext.Provider value={contextValue}>{children}</SidebarContext.Provider>;
|
|
73
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, View, type ViewStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarRootProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SidebarRoot(props: SidebarRootProps) {
|
|
11
|
+
const { children, style } = props;
|
|
12
|
+
const { open, width = 256, styles } = useSidebar();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<View style={[styles?.root, { width }, !open && { width: 0, overflow: "hidden" }, style]}>
|
|
16
|
+
{children}
|
|
17
|
+
</View>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import type { SidebarState, SidebarStyles } from "./types";
|
|
3
|
+
|
|
4
|
+
export interface SidebarContextValue {
|
|
5
|
+
state: SidebarState;
|
|
6
|
+
open: boolean;
|
|
7
|
+
setOpen: (open: boolean) => void;
|
|
8
|
+
toggleSidebar: () => void;
|
|
9
|
+
width?: number;
|
|
10
|
+
styles?: SidebarStyles;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const SidebarContext = createContext<SidebarContextValue | undefined>(undefined);
|
|
14
|
+
|
|
15
|
+
export const useSidebar = () => {
|
|
16
|
+
const context = useContext(SidebarContext);
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error("useSidebar must be used within a SidebarProvider");
|
|
19
|
+
}
|
|
20
|
+
return context;
|
|
21
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SidebarContent } from "./components/sidebar-content";
|
|
2
|
+
import { SidebarFooter } from "./components/sidebar-footer";
|
|
3
|
+
import { SidebarGroup } from "./components/sidebar-group";
|
|
4
|
+
import { SidebarGroupLabel } from "./components/sidebar-group-label";
|
|
5
|
+
import { SidebarHeader } from "./components/sidebar-header";
|
|
6
|
+
import { SidebarMenuItem } from "./components/sidebar-menu-item";
|
|
7
|
+
import { SidebarMenuSub } from "./components/sidebar-menu-sub";
|
|
8
|
+
import { SidebarMenu } from "./components/sidebar-menu";
|
|
9
|
+
import { SidebarProvider } from "./components/sidebar-provider";
|
|
10
|
+
import { SidebarRoot } from "./components/sidebar-root";
|
|
11
|
+
|
|
12
|
+
export const Sidebar = {
|
|
13
|
+
Provider: SidebarProvider,
|
|
14
|
+
Root: SidebarRoot,
|
|
15
|
+
Header: SidebarHeader,
|
|
16
|
+
Footer: SidebarFooter,
|
|
17
|
+
Content: SidebarContent,
|
|
18
|
+
Group: SidebarGroup,
|
|
19
|
+
GroupLabel: SidebarGroupLabel,
|
|
20
|
+
Menu: SidebarMenu,
|
|
21
|
+
MenuItem: SidebarMenuItem,
|
|
22
|
+
MenuSub: SidebarMenuSub,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { useSidebar } from "./context";
|
|
26
|
+
|
|
27
|
+
export type { SidebarProviderProps } from "./components/sidebar-provider";
|
|
28
|
+
export type { SidebarRootProps } from "./components/sidebar-root";
|
|
29
|
+
export type { SidebarHeaderProps } from "./components/sidebar-header";
|
|
30
|
+
export type { SidebarFooterProps } from "./components/sidebar-footer";
|
|
31
|
+
export type { SidebarContentProps } from "./components/sidebar-content";
|
|
32
|
+
export type { SidebarGroupProps } from "./components/sidebar-group";
|
|
33
|
+
export type { SidebarGroupLabelProps } from "./components/sidebar-group-label";
|
|
34
|
+
export type { SidebarMenuProps } from "./components/sidebar-menu";
|
|
35
|
+
export type { SidebarMenuItemProps } from "./components/sidebar-menu-item";
|
|
36
|
+
export type { SidebarMenuSubProps } from "./components/sidebar-menu-sub";
|
|
37
|
+
export type { SidebarStyles, SidebarState } from "./types";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
2
|
+
import type { IconProps } from "../icon";
|
|
3
|
+
|
|
4
|
+
export type SidebarState = "expanded" | "collapsed";
|
|
5
|
+
|
|
6
|
+
export type SidebarMenuButtonState = "default" | "active" | "hovered";
|
|
7
|
+
|
|
8
|
+
export interface SidebarStyles {
|
|
9
|
+
/** The sidebar container */
|
|
10
|
+
root?: StyleProp<ViewStyle>;
|
|
11
|
+
/** Header (sticky top) */
|
|
12
|
+
header?: StyleProp<ViewStyle>;
|
|
13
|
+
/** Footer (sticky bottom) */
|
|
14
|
+
footer?: StyleProp<ViewStyle>;
|
|
15
|
+
/** Scrollable content area */
|
|
16
|
+
content?: StyleProp<ViewStyle>;
|
|
17
|
+
/** Group container */
|
|
18
|
+
group?: StyleProp<ViewStyle>;
|
|
19
|
+
/** Group label text */
|
|
20
|
+
groupLabel?: StyleProp<TextStyle>;
|
|
21
|
+
/** Menu list container */
|
|
22
|
+
menu?: StyleProp<ViewStyle>;
|
|
23
|
+
/** Menu item */
|
|
24
|
+
menuItem?: Partial<Record<SidebarMenuButtonState, StyleProp<ViewStyle>>>;
|
|
25
|
+
/** Menu item text */
|
|
26
|
+
menuItemText?: Partial<Record<SidebarMenuButtonState, StyleProp<TextStyle>>>;
|
|
27
|
+
/** Menu item icon */
|
|
28
|
+
menuItemIcon?: Partial<Record<SidebarMenuButtonState, IconProps>>;
|
|
29
|
+
/** Submenu container */
|
|
30
|
+
menuSub?: StyleProp<ViewStyle>;
|
|
31
|
+
}
|