@timmbr/ui 1.0.0-beta → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -16
- package/dist/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/Alert/Alert.types.d.ts +2 -4
- package/dist/components/Alert/Alert.types.d.ts.map +1 -1
- package/dist/components/AlertDialog/AlertDialog.d.ts +16 -0
- package/dist/components/AlertDialog/AlertDialog.d.ts.map +1 -0
- package/dist/components/AlertDialog/AlertDialog.js +94 -0
- package/dist/components/AlertDialog/AlertDialog.styles.d.ts +8 -0
- package/dist/components/AlertDialog/AlertDialog.styles.d.ts.map +1 -0
- package/dist/components/AlertDialog/AlertDialog.styles.js +25 -0
- package/dist/components/AlertDialog/AlertDialog.types.d.ts +16 -0
- package/dist/components/AlertDialog/AlertDialog.types.d.ts.map +1 -0
- package/dist/components/AlertDialog/index.d.ts +4 -0
- package/dist/components/AlertDialog/index.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.styles.d.ts +2 -2
- package/dist/components/Badge/Badge.styles.d.ts +1 -1
- package/dist/components/Button/Button.styles.d.ts +2 -2
- package/dist/components/Chip/Chip.styles.d.ts +1 -1
- package/dist/components/CrossZoneLink/CrossZoneLink.d.ts +10 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.d.ts.map +1 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.js +111 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.styles.d.ts +8 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.styles.d.ts.map +1 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.styles.js +33 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.types.d.ts +31 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.types.d.ts.map +1 -0
- package/dist/components/CrossZoneLink/index.d.ts +4 -0
- package/dist/components/CrossZoneLink/index.d.ts.map +1 -0
- package/dist/components/Dialog/Dialog.d.ts +2 -1
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.js +8 -6
- package/dist/components/Dialog/Dialog.styles.d.ts +1 -0
- package/dist/components/Dialog/Dialog.styles.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.styles.js +7 -4
- package/dist/components/Dialog/Dialog.types.d.ts +4 -6
- package/dist/components/Dialog/Dialog.types.d.ts.map +1 -1
- package/dist/components/Divider/Divider.styles.d.ts +1 -1
- package/dist/components/Drawer/Drawer.types.d.ts +3 -6
- package/dist/components/Drawer/Drawer.types.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.types.d.ts +1 -2
- package/dist/components/Dropdown/Dropdown.types.d.ts.map +1 -1
- package/dist/components/FormField/FormField.js +2 -2
- package/dist/components/Heading/Heading.styles.d.ts +2 -2
- package/dist/components/Icon/Icon.styles.d.ts +1 -1
- package/dist/components/ImageUpload/ImageUpload.d.ts +4 -0
- package/dist/components/ImageUpload/ImageUpload.d.ts.map +1 -0
- package/dist/components/ImageUpload/ImageUpload.helpers.d.ts +30 -0
- package/dist/components/ImageUpload/ImageUpload.helpers.d.ts.map +1 -0
- package/dist/components/ImageUpload/ImageUpload.helpers.js +95 -0
- package/dist/components/ImageUpload/ImageUpload.js +365 -0
- package/dist/components/ImageUpload/ImageUpload.styles.d.ts +17 -0
- package/dist/components/ImageUpload/ImageUpload.styles.d.ts.map +1 -0
- package/dist/components/ImageUpload/ImageUpload.styles.js +72 -0
- package/dist/components/ImageUpload/ImageUpload.types.d.ts +112 -0
- package/dist/components/ImageUpload/ImageUpload.types.d.ts.map +1 -0
- package/dist/components/ImageUpload/index.d.ts +6 -0
- package/dist/components/ImageUpload/index.d.ts.map +1 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadDropzone.d.ts +25 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadDropzone.d.ts.map +1 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadDropzone.js +106 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadIcons.d.ts +6 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadIcons.d.ts.map +1 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadIcons.js +61 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadModal.d.ts +12 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadModal.d.ts.map +1 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadModal.js +137 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadSinglePreview.d.ts +14 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadSinglePreview.d.ts.map +1 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadSinglePreview.js +142 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadThumbnailCard.d.ts +23 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadThumbnailCard.d.ts.map +1 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadThumbnailCard.js +139 -0
- package/dist/components/ImageUpload/subcomponents/index.d.ts +6 -0
- package/dist/components/ImageUpload/subcomponents/index.d.ts.map +1 -0
- package/dist/components/Inline/Inline.styles.d.ts +2 -2
- package/dist/components/Input/Input.js +2 -2
- package/dist/components/Input/Input.styles.d.ts +1 -1
- package/dist/components/Input/Input.styles.js +1 -1
- package/dist/components/Input/Input.types.d.ts +1 -1
- package/dist/components/Input/Input.types.d.ts.map +1 -1
- package/dist/components/LinkButton/LinkButton.d.ts +13 -0
- package/dist/components/LinkButton/LinkButton.d.ts.map +1 -0
- package/dist/components/LinkButton/LinkButton.js +179 -0
- package/dist/components/LinkButton/LinkButton.styles.d.ts +8 -0
- package/dist/components/LinkButton/LinkButton.styles.d.ts.map +1 -0
- package/dist/components/LinkButton/LinkButton.styles.js +61 -0
- package/dist/components/LinkButton/LinkButton.types.d.ts +60 -0
- package/dist/components/LinkButton/LinkButton.types.d.ts.map +1 -0
- package/dist/components/LinkButton/index.d.ts +4 -0
- package/dist/components/LinkButton/index.d.ts.map +1 -0
- package/dist/components/List/List.types.d.ts +2 -4
- package/dist/components/List/List.types.d.ts.map +1 -1
- package/dist/components/Popover/Popover.types.d.ts +1 -2
- package/dist/components/Popover/Popover.types.d.ts.map +1 -1
- package/dist/components/Progress/Progress.styles.d.ts +1 -1
- package/dist/components/Radio/Radio.js +2 -2
- package/dist/components/Select/Select.js +2 -2
- package/dist/components/Select/Select.styles.d.ts +1 -1
- package/dist/components/SideBarNavigation/SideBarNavigation.context.d.ts +15 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.context.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.context.js +10 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.d.ts +4 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.helpers.d.ts +19 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.helpers.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.helpers.js +48 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.js +132 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.styles.d.ts +18 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.styles.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.styles.js +85 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.types.d.ts +69 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.types.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/index.d.ts +13 -0
- package/dist/components/SideBarNavigation/index.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarBranding.d.ts +13 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarBranding.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarBranding.js +58 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarFooter.d.ts +10 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarFooter.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarFooter.js +27 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarNavItem.d.ts +14 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarNavItem.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarNavItem.js +147 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarPopoverMenu.d.ts +13 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarPopoverMenu.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarPopoverMenu.js +106 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarProfile.d.ts +13 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarProfile.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarProfile.js +118 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarSubItem.d.ts +13 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarSubItem.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarSubItem.js +34 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarToggle.d.ts +8 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarToggle.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarToggle.js +40 -0
- package/dist/components/Stack/Stack.styles.d.ts +2 -2
- package/dist/components/Stat/Stat.types.d.ts +3 -6
- package/dist/components/Stat/Stat.types.d.ts.map +1 -1
- package/dist/components/Table/Table.types.d.ts +7 -14
- package/dist/components/Table/Table.types.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.styles.d.ts +2 -2
- package/dist/components/Text/Text.styles.d.ts +2 -2
- package/dist/components/Textarea/Textarea.js +2 -2
- package/dist/components/Textarea/Textarea.styles.d.ts +1 -1
- package/dist/components/Toast/Toast.d.ts.map +1 -1
- package/dist/components/Toast/Toast.js +13 -4
- package/dist/components/Toast/Toast.types.d.ts +35 -2
- package/dist/components/Toast/Toast.types.d.ts.map +1 -1
- package/dist/components/Toast/ToastContainer.d.ts +7 -0
- package/dist/components/Toast/ToastContainer.d.ts.map +1 -0
- package/dist/components/Toast/ToastContainer.js +104 -0
- package/dist/components/Toast/index.d.ts +2 -0
- package/dist/components/Toast/index.d.ts.map +1 -1
- package/dist/components/Toast/toastStore.d.ts +31 -0
- package/dist/components/Toast/toastStore.d.ts.map +1 -0
- package/dist/components/Toast/toastStore.js +104 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -3
- package/dist/providers/TimmbrConfigProvider.d.ts +20 -2
- package/dist/providers/TimmbrConfigProvider.d.ts.map +1 -1
- package/dist/providers/TimmbrConfigProvider.js +38 -3
- package/package.json +15 -6
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { LinkButtonVariants } from './LinkButton.styles';
|
|
3
|
+
import type { MotionProp } from '../../types/motion';
|
|
4
|
+
export interface LinkButtonProps extends React.AnchorHTMLAttributes<HTMLAnchorElement>, Omit<LinkButtonVariants, 'disabled'> {
|
|
5
|
+
/**
|
|
6
|
+
* Destination URL or path.
|
|
7
|
+
*/
|
|
8
|
+
href?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Target zone key corresponding to TimmbrConfigProvider zones (e.g. 'docs', 'app').
|
|
11
|
+
* If provided and resolves to a different zone from config.currentZone, automatically treats navigation as cross-zone.
|
|
12
|
+
*/
|
|
13
|
+
zone?: string;
|
|
14
|
+
/**
|
|
15
|
+
* If true, forces hard navigation across zone boundaries using CrossZoneLink, bypassing next/link.
|
|
16
|
+
* ARCHITECTURAL RULE: NEVER use `next/link` for navigation across zone boundaries. Always use `CrossZoneLink` from `@timmbr/ui`.
|
|
17
|
+
*/
|
|
18
|
+
crossZone?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Next.js prefetching toggle. Defaults to true when using next/link.
|
|
21
|
+
*/
|
|
22
|
+
prefetch?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Next.js route replacement toggle.
|
|
25
|
+
*/
|
|
26
|
+
replace?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Scroll to the top of the page after navigation. Defaults to true in Next.js.
|
|
29
|
+
*/
|
|
30
|
+
scroll?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* If true, LinkButton renders as Radix UI Slot to merge props onto a custom element.
|
|
33
|
+
*/
|
|
34
|
+
asChild?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Local toggle to enable/disable button motion transitions, or configure motion primitives.
|
|
37
|
+
*/
|
|
38
|
+
motion?: MotionProp;
|
|
39
|
+
/**
|
|
40
|
+
* Leading icon element rendered before button children.
|
|
41
|
+
*/
|
|
42
|
+
leftIcon?: React.ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Trailing icon element rendered after button children.
|
|
45
|
+
*/
|
|
46
|
+
rightIcon?: React.ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* Displays an animated loading spinner and disables interactive states.
|
|
49
|
+
*/
|
|
50
|
+
loading?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Optional loading text displayed alongside spinner.
|
|
53
|
+
*/
|
|
54
|
+
loadingText?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Disables the anchor element visually and functionally (aria-disabled, tabIndex=-1, pointer-events-none).
|
|
57
|
+
*/
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=LinkButton.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkButton.types.d.ts","sourceRoot":"","sources":["../../../src/components/LinkButton/LinkButton.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,WAAW,eACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC;IACtC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/LinkButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
@@ -5,12 +5,10 @@ export interface ListProps extends React.HTMLAttributes<HTMLUListElement>, ListV
|
|
|
5
5
|
export interface ListItemProps extends React.LiHTMLAttributes<HTMLLIElement>, ListItemVariants {
|
|
6
6
|
clickable?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
9
|
-
}
|
|
8
|
+
export type ListItemIconProps = React.HTMLAttributes<HTMLDivElement>;
|
|
10
9
|
export interface ListItemTextProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
10
|
primary?: React.ReactNode;
|
|
12
11
|
secondary?: React.ReactNode;
|
|
13
12
|
}
|
|
14
|
-
export
|
|
15
|
-
}
|
|
13
|
+
export type ListItemActionProps = React.HTMLAttributes<HTMLDivElement>;
|
|
16
14
|
//# sourceMappingURL=List.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.types.d.ts","sourceRoot":"","sources":["../../../src/components/List/List.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,WAAW,SACf,SAAQ,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAC5C,YAAY;CAAG;AAEnB,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAC3C,gBAAgB;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,
|
|
1
|
+
{"version":3,"file":"List.types.d.ts","sourceRoot":"","sources":["../../../src/components/List/List.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,WAAW,SACf,SAAQ,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAC5C,YAAY;CAAG;AAEnB,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAC3C,gBAAgB;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAErE,MAAM,WAAW,iBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
2
|
import type * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
3
3
|
import type { MotionProp } from '../../types/motion';
|
|
4
|
-
export
|
|
5
|
-
}
|
|
4
|
+
export type PopoverProps = PopoverPrimitive.PopoverProps;
|
|
6
5
|
export interface PopoverContentProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> {
|
|
7
6
|
/**
|
|
8
7
|
* Motion transition control.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.types.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,
|
|
1
|
+
{"version":3,"file":"Popover.types.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,YAAY,CAAC;AAEzD,MAAM,WAAW,mBACf,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC;IACvE;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB"}
|
|
@@ -3,7 +3,7 @@ export declare const progressRootVariants: (props?: ({
|
|
|
3
3
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
4
4
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
5
|
export declare const progressIndicatorVariants: (props?: ({
|
|
6
|
-
variant?: "default" | "
|
|
6
|
+
variant?: "default" | "destructive" | "success" | "warning" | "primary" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
export type ProgressVariants = VariantProps<typeof progressIndicatorVariants> & VariantProps<typeof progressRootVariants>;
|
|
9
9
|
//# sourceMappingURL=Progress.styles.d.ts.map
|
|
@@ -110,12 +110,12 @@ const RadioGroup = React.forwardRef(
|
|
|
110
110
|
"p",
|
|
111
111
|
{
|
|
112
112
|
className: cn(
|
|
113
|
-
"text-xs mt-
|
|
113
|
+
"text-xs mt-1 flex items-center gap-1.5",
|
|
114
114
|
isError ? "text-destructive font-medium" : "text-muted"
|
|
115
115
|
),
|
|
116
116
|
children: [
|
|
117
117
|
isError ? /* @__PURE__ */ jsx(AlertCircle, { className: "w-3.5 h-3.5 shrink-0", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(Info, { className: "w-3.5 h-3.5 shrink-0", "aria-hidden": "true" }),
|
|
118
|
-
/* @__PURE__ */ jsx("span", { children: errorMessage || helperText })
|
|
118
|
+
/* @__PURE__ */ jsx("span", { className: "leading-normal", children: errorMessage || helperText })
|
|
119
119
|
]
|
|
120
120
|
}
|
|
121
121
|
)
|
|
@@ -101,12 +101,12 @@ const Select = React.forwardRef(
|
|
|
101
101
|
"p",
|
|
102
102
|
{
|
|
103
103
|
className: cn(
|
|
104
|
-
"text-xs mt-
|
|
104
|
+
"text-xs mt-1 flex items-center gap-1.5",
|
|
105
105
|
isError ? "text-destructive font-medium" : "text-muted"
|
|
106
106
|
),
|
|
107
107
|
children: [
|
|
108
108
|
isError ? /* @__PURE__ */ jsx(AlertCircle, { className: "w-3.5 h-3.5 shrink-0", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(Info, { className: "w-3.5 h-3.5 shrink-0", "aria-hidden": "true" }),
|
|
109
|
-
/* @__PURE__ */ jsx("span", { children: errorMessage || helperText })
|
|
109
|
+
/* @__PURE__ */ jsx("span", { className: "leading-normal", children: errorMessage || helperText })
|
|
110
110
|
]
|
|
111
111
|
}
|
|
112
112
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
export declare const selectTriggerVariants: (props?: ({
|
|
3
|
-
variant?: "
|
|
3
|
+
variant?: "filled" | "outline" | null | undefined;
|
|
4
4
|
size?: "default" | "sm" | "lg" | "md" | null | undefined;
|
|
5
5
|
isError?: boolean | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface SidebarContextValue {
|
|
3
|
+
collapsed: boolean;
|
|
4
|
+
shouldAnimate: boolean;
|
|
5
|
+
motionClass?: string;
|
|
6
|
+
activePath?: string;
|
|
7
|
+
linkComponent?: React.ComponentType<{
|
|
8
|
+
href: string;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
export declare const SidebarContext: React.Context<SidebarContextValue>;
|
|
14
|
+
export declare const useSidebarContext: () => SidebarContextValue;
|
|
15
|
+
//# sourceMappingURL=SideBarNavigation.context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideBarNavigation.context.d.ts","sourceRoot":"","sources":["../../../src/components/SideBarNavigation/SideBarNavigation.context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAClC,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;CACJ;AAED,eAAO,MAAM,cAAc,oCAGzB,CAAC;AAEH,eAAO,MAAM,iBAAiB,2BAAyC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
const SidebarContext = React.createContext({
|
|
5
|
+
collapsed: false,
|
|
6
|
+
shouldAnimate: true
|
|
7
|
+
});
|
|
8
|
+
const useSidebarContext = () => React.useContext(SidebarContext);
|
|
9
|
+
|
|
10
|
+
export { SidebarContext, useSidebarContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideBarNavigation.d.ts","sourceRoot":"","sources":["../../../src/components/SideBarNavigation/SideBarNavigation.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAUxE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAsH9D,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NavItem } from './SideBarNavigation.types';
|
|
2
|
+
export declare const DEFAULT_STORAGE_KEY = "timmbr_sidebar_collapsed";
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a specific route matches the current activePath.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isRouteActive(href?: string, activePath?: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if a NavItem or any of its nested children are active.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isNavItemActive(item: NavItem, activePath?: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Reads the stored collapsed state from localStorage (guarded against SSR).
|
|
13
|
+
*/
|
|
14
|
+
export declare function readStoredCollapsed(storageKey: string | false, fallback: boolean): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Persists the collapsed state to both localStorage and a lightweight document cookie.
|
|
17
|
+
*/
|
|
18
|
+
export declare function writeStoredCollapsed(storageKey: string | false, isCollapsed: boolean): void;
|
|
19
|
+
//# sourceMappingURL=SideBarNavigation.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideBarNavigation.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/SideBarNavigation/SideBarNavigation.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,2BAA2B,CAAC;AAErE,eAAO,MAAM,mBAAmB,6BAA6B,CAAC;AAE9D;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAiBzE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAU3E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAe1F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,EAAE,WAAW,EAAE,OAAO,GAAG,IAAI,CAY3F"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const DEFAULT_STORAGE_KEY = "timmbr_sidebar_collapsed";
|
|
2
|
+
function isRouteActive(href, activePath) {
|
|
3
|
+
let path = activePath;
|
|
4
|
+
if (!path && typeof window !== "undefined") {
|
|
5
|
+
path = window.location.pathname;
|
|
6
|
+
}
|
|
7
|
+
if (!href || !path) return false;
|
|
8
|
+
const cleanHref = href.length > 1 && href.endsWith("/") ? href.slice(0, -1) : href;
|
|
9
|
+
const cleanActive = path.length > 1 && path.endsWith("/") ? path.slice(0, -1) : path;
|
|
10
|
+
if (cleanHref === "/" || cleanHref === "") {
|
|
11
|
+
return cleanActive === "/" || cleanActive === "";
|
|
12
|
+
}
|
|
13
|
+
return cleanActive === cleanHref || cleanActive.startsWith(`${cleanHref}/`);
|
|
14
|
+
}
|
|
15
|
+
function isNavItemActive(item, activePath) {
|
|
16
|
+
if (item.href && isRouteActive(item.href, activePath)) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
if (item.items && item.items.length > 0) {
|
|
20
|
+
return item.items.some((sub) => isRouteActive(sub.href, activePath));
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
function readStoredCollapsed(storageKey, fallback) {
|
|
25
|
+
if (typeof window === "undefined" || storageKey === false) {
|
|
26
|
+
return fallback;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const item = window.localStorage.getItem(storageKey);
|
|
30
|
+
if (item !== null) {
|
|
31
|
+
return item === "true";
|
|
32
|
+
}
|
|
33
|
+
} catch {
|
|
34
|
+
}
|
|
35
|
+
return fallback;
|
|
36
|
+
}
|
|
37
|
+
function writeStoredCollapsed(storageKey, isCollapsed) {
|
|
38
|
+
if (typeof window === "undefined" || storageKey === false) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
window.localStorage.setItem(storageKey, String(isCollapsed));
|
|
43
|
+
document.cookie = `${storageKey}=${isCollapsed}; path=/; max-age=31536000; SameSite=Lax`;
|
|
44
|
+
} catch {
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { DEFAULT_STORAGE_KEY, isNavItemActive, isRouteActive, readStoredCollapsed, writeStoredCollapsed };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { cn } from '@timmbr/utils';
|
|
5
|
+
import { motion, sidebarContainerMotionVariants } from '@timmbr/motion';
|
|
6
|
+
import { resolveMotion } from '../../types/motion.js';
|
|
7
|
+
import { DEFAULT_STORAGE_KEY, readStoredCollapsed, writeStoredCollapsed } from './SideBarNavigation.helpers.js';
|
|
8
|
+
import { sidebarContainerVariants } from './SideBarNavigation.styles.js';
|
|
9
|
+
import { SidebarContext } from './SideBarNavigation.context.js';
|
|
10
|
+
import { SidebarBranding } from './subcomponents/SidebarBranding.js';
|
|
11
|
+
import { SidebarToggle } from './subcomponents/SidebarToggle.js';
|
|
12
|
+
import { SidebarNavItem } from './subcomponents/SidebarNavItem.js';
|
|
13
|
+
import { SidebarFooter } from './subcomponents/SidebarFooter.js';
|
|
14
|
+
import { SidebarProfile } from './subcomponents/SidebarProfile.js';
|
|
15
|
+
import { useGlobalAnimation } from '../../providers/AnimationProvider.js';
|
|
16
|
+
|
|
17
|
+
const SideBarNavigation = ({
|
|
18
|
+
items,
|
|
19
|
+
activePath,
|
|
20
|
+
branding,
|
|
21
|
+
footer,
|
|
22
|
+
profile,
|
|
23
|
+
showProfile = true,
|
|
24
|
+
collapsed: controlledCollapsed,
|
|
25
|
+
defaultCollapsed = false,
|
|
26
|
+
onCollapsedChange,
|
|
27
|
+
storageKey = DEFAULT_STORAGE_KEY,
|
|
28
|
+
linkComponent,
|
|
29
|
+
motion: motionProp,
|
|
30
|
+
className,
|
|
31
|
+
style
|
|
32
|
+
}) => {
|
|
33
|
+
const globalMotion = useGlobalAnimation();
|
|
34
|
+
const { shouldAnimate, motionClass, dataAttributes } = resolveMotion(motionProp, globalMotion);
|
|
35
|
+
const isControlled = controlledCollapsed !== void 0;
|
|
36
|
+
const [internalCollapsed, setInternalCollapsed] = React.useState(defaultCollapsed);
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
if (!isControlled && storageKey !== false) {
|
|
39
|
+
const stored = readStoredCollapsed(storageKey, defaultCollapsed);
|
|
40
|
+
if (stored !== internalCollapsed) {
|
|
41
|
+
setInternalCollapsed(stored);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}, [isControlled, storageKey, defaultCollapsed]);
|
|
45
|
+
const isCollapsed = isControlled ? controlledCollapsed : internalCollapsed;
|
|
46
|
+
const handleToggle = React.useCallback(() => {
|
|
47
|
+
const nextState = !isCollapsed;
|
|
48
|
+
if (!isControlled) {
|
|
49
|
+
setInternalCollapsed(nextState);
|
|
50
|
+
if (storageKey !== false) {
|
|
51
|
+
writeStoredCollapsed(storageKey, nextState);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
onCollapsedChange?.(nextState);
|
|
55
|
+
}, [isCollapsed, isControlled, storageKey, onCollapsedChange]);
|
|
56
|
+
return /* @__PURE__ */ jsx(
|
|
57
|
+
SidebarContext.Provider,
|
|
58
|
+
{
|
|
59
|
+
value: {
|
|
60
|
+
collapsed: isCollapsed,
|
|
61
|
+
shouldAnimate,
|
|
62
|
+
motionClass,
|
|
63
|
+
activePath,
|
|
64
|
+
linkComponent
|
|
65
|
+
},
|
|
66
|
+
children: /* @__PURE__ */ jsxs(
|
|
67
|
+
motion.aside,
|
|
68
|
+
{
|
|
69
|
+
"data-slot": "sidebar-navigation",
|
|
70
|
+
"data-collapsed": isCollapsed,
|
|
71
|
+
...dataAttributes,
|
|
72
|
+
initial: false,
|
|
73
|
+
animate: shouldAnimate ? isCollapsed ? "collapsed" : "expanded" : void 0,
|
|
74
|
+
variants: shouldAnimate ? sidebarContainerMotionVariants : void 0,
|
|
75
|
+
className: cn(
|
|
76
|
+
sidebarContainerVariants({
|
|
77
|
+
collapsed: isCollapsed,
|
|
78
|
+
shouldAnimate,
|
|
79
|
+
cssFallback: !shouldAnimate,
|
|
80
|
+
className
|
|
81
|
+
}),
|
|
82
|
+
motionClass
|
|
83
|
+
),
|
|
84
|
+
style,
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ jsx(SidebarToggle, { collapsed: isCollapsed, onToggle: handleToggle }),
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
SidebarBranding,
|
|
89
|
+
{
|
|
90
|
+
branding,
|
|
91
|
+
collapsed: isCollapsed,
|
|
92
|
+
linkComponent
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
"nav",
|
|
97
|
+
{
|
|
98
|
+
"aria-label": "Sidebar Navigation",
|
|
99
|
+
className: cn(
|
|
100
|
+
"flex-1 overflow-y-auto overflow-x-hidden pt-1 pb-2 space-y-1",
|
|
101
|
+
isCollapsed ? "px-2" : "px-3"
|
|
102
|
+
),
|
|
103
|
+
children: items.map((item) => /* @__PURE__ */ jsx(
|
|
104
|
+
SidebarNavItem,
|
|
105
|
+
{
|
|
106
|
+
item,
|
|
107
|
+
collapsed: isCollapsed,
|
|
108
|
+
activePath,
|
|
109
|
+
linkComponent
|
|
110
|
+
},
|
|
111
|
+
item.id || item.href || item.label
|
|
112
|
+
))
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ jsx(SidebarFooter, { footer, collapsed: isCollapsed }),
|
|
116
|
+
showProfile && profile && /* @__PURE__ */ jsx(
|
|
117
|
+
SidebarProfile,
|
|
118
|
+
{
|
|
119
|
+
profile,
|
|
120
|
+
collapsed: isCollapsed,
|
|
121
|
+
linkComponent
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
SideBarNavigation.displayName = "SideBarNavigation";
|
|
131
|
+
|
|
132
|
+
export { SideBarNavigation };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const sidebarContainerVariants: (props?: ({
|
|
2
|
+
collapsed?: boolean | null | undefined;
|
|
3
|
+
shouldAnimate?: boolean | null | undefined;
|
|
4
|
+
cssFallback?: boolean | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export declare const sidebarToggleVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
7
|
+
export declare const navItemVariants: (props?: ({
|
|
8
|
+
active?: boolean | null | undefined;
|
|
9
|
+
collapsed?: boolean | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
+
export declare const navBadgeVariants: (props?: ({
|
|
12
|
+
variant?: "destructive" | "outline" | "primary" | "secondary" | null | undefined;
|
|
13
|
+
collapsed?: boolean | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
|
+
export declare const subItemVariants: (props?: ({
|
|
16
|
+
active?: boolean | null | undefined;
|
|
17
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
18
|
+
//# sourceMappingURL=SideBarNavigation.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideBarNavigation.styles.d.ts","sourceRoot":"","sources":["../../../src/components/SideBarNavigation/SideBarNavigation.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB;;;;8EAuBpC,CAAC;AAEF,eAAO,MAAM,qBAAqB,oFAEjC,CAAC;AAEF,eAAO,MAAM,eAAe;;;8EAkB3B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;8EAoB5B,CAAC;AAEF,eAAO,MAAM,eAAe;;8EAa3B,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
|
|
3
|
+
const sidebarContainerVariants = cva(
|
|
4
|
+
"relative flex flex-col h-screen max-h-screen bg-white border-r border-grey-200 select-none",
|
|
5
|
+
{
|
|
6
|
+
variants: {
|
|
7
|
+
collapsed: {
|
|
8
|
+
true: "w-[72px]",
|
|
9
|
+
false: "w-64"
|
|
10
|
+
},
|
|
11
|
+
shouldAnimate: {
|
|
12
|
+
true: "",
|
|
13
|
+
false: "transition-none"
|
|
14
|
+
},
|
|
15
|
+
cssFallback: {
|
|
16
|
+
true: "transition-all duration-300 ease-in-out",
|
|
17
|
+
false: ""
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
collapsed: false,
|
|
22
|
+
shouldAnimate: true,
|
|
23
|
+
cssFallback: false
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
const sidebarToggleVariants = cva(
|
|
28
|
+
"absolute -right-3.5 top-6 z-30 flex size-7 items-center justify-center rounded-full bg-white border border-grey-200 text-grey-600 shadow-xs hover:bg-grey-50 hover:text-grey-900 hover:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary cursor-pointer transition-all duration-150"
|
|
29
|
+
);
|
|
30
|
+
const navItemVariants = cva(
|
|
31
|
+
"group relative flex items-center gap-3 rounded-lg text-sm transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary cursor-pointer select-none",
|
|
32
|
+
{
|
|
33
|
+
variants: {
|
|
34
|
+
active: {
|
|
35
|
+
true: "bg-primary text-white shadow-xs font-medium",
|
|
36
|
+
false: "text-grey-700 hover:bg-grey-100 hover:text-grey-900"
|
|
37
|
+
},
|
|
38
|
+
collapsed: {
|
|
39
|
+
true: "justify-center size-10 mx-auto p-0",
|
|
40
|
+
false: "w-full px-3.5 py-2.5"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
defaultVariants: {
|
|
44
|
+
active: false,
|
|
45
|
+
collapsed: false
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
const navBadgeVariants = cva(
|
|
50
|
+
"inline-flex items-center justify-center rounded-full text-xs font-semibold shrink-0 transition-colors",
|
|
51
|
+
{
|
|
52
|
+
variants: {
|
|
53
|
+
variant: {
|
|
54
|
+
destructive: "bg-red-500 text-white px-2 py-0.5",
|
|
55
|
+
primary: "bg-primary-100 text-primary-800 px-2 py-0.5",
|
|
56
|
+
secondary: "bg-grey-100 text-grey-700 px-2 py-0.5",
|
|
57
|
+
outline: "border border-grey-200 text-grey-700 px-1.5 py-0.5"
|
|
58
|
+
},
|
|
59
|
+
collapsed: {
|
|
60
|
+
true: "absolute -top-1 -right-1 size-4 p-0 text-[10px] leading-none",
|
|
61
|
+
false: "ml-auto"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
defaultVariants: {
|
|
65
|
+
variant: "destructive",
|
|
66
|
+
collapsed: false
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
const subItemVariants = cva(
|
|
71
|
+
"flex items-center gap-2.5 w-full rounded-md px-3 py-2 text-xs transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary cursor-pointer",
|
|
72
|
+
{
|
|
73
|
+
variants: {
|
|
74
|
+
active: {
|
|
75
|
+
true: "bg-primary/10 text-primary-700 font-semibold",
|
|
76
|
+
false: "text-grey-600 hover:bg-grey-100 hover:text-grey-900"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
defaultVariants: {
|
|
80
|
+
active: false
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
export { navBadgeVariants, navItemVariants, sidebarContainerVariants, sidebarToggleVariants, subItemVariants };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { MotionProps } from '../../types/motion';
|
|
3
|
+
export type NavBadgeVariant = 'primary' | 'secondary' | 'outline' | 'destructive';
|
|
4
|
+
export interface NavSubItem {
|
|
5
|
+
id?: string;
|
|
6
|
+
label: string;
|
|
7
|
+
href: string;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
badge?: React.ReactNode | number | string;
|
|
10
|
+
badgeVariant?: NavBadgeVariant;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface NavItem {
|
|
14
|
+
id?: string;
|
|
15
|
+
label: string;
|
|
16
|
+
href?: string;
|
|
17
|
+
icon: React.ReactNode;
|
|
18
|
+
badge?: React.ReactNode | number | string;
|
|
19
|
+
badgeVariant?: NavBadgeVariant;
|
|
20
|
+
items?: NavSubItem[];
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface SidebarBrandingConfig {
|
|
24
|
+
logo?: React.ReactNode;
|
|
25
|
+
collapsedLogo?: React.ReactNode;
|
|
26
|
+
title?: React.ReactNode;
|
|
27
|
+
subtitle?: React.ReactNode;
|
|
28
|
+
href?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface SidebarProfileItem {
|
|
31
|
+
id?: string;
|
|
32
|
+
label: string;
|
|
33
|
+
href?: string;
|
|
34
|
+
icon?: React.ReactNode;
|
|
35
|
+
onClick?: () => void;
|
|
36
|
+
destructive?: boolean;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface SidebarProfileConfig {
|
|
40
|
+
name: string;
|
|
41
|
+
role?: string;
|
|
42
|
+
email?: string;
|
|
43
|
+
avatar?: React.ReactNode;
|
|
44
|
+
fallback?: string;
|
|
45
|
+
items?: SidebarProfileItem[];
|
|
46
|
+
onClick?: () => void;
|
|
47
|
+
}
|
|
48
|
+
export interface SideBarNavigationProps extends MotionProps {
|
|
49
|
+
items: NavItem[];
|
|
50
|
+
activePath?: string;
|
|
51
|
+
branding?: SidebarBrandingConfig;
|
|
52
|
+
footer?: React.ReactNode | ((props: {
|
|
53
|
+
collapsed: boolean;
|
|
54
|
+
}) => React.ReactNode);
|
|
55
|
+
profile?: SidebarProfileConfig;
|
|
56
|
+
showProfile?: boolean;
|
|
57
|
+
collapsed?: boolean;
|
|
58
|
+
defaultCollapsed?: boolean;
|
|
59
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
60
|
+
storageKey?: string | false;
|
|
61
|
+
linkComponent?: React.ComponentType<{
|
|
62
|
+
href: string;
|
|
63
|
+
children: React.ReactNode;
|
|
64
|
+
className?: string;
|
|
65
|
+
}>;
|
|
66
|
+
className?: string;
|
|
67
|
+
style?: React.CSSProperties;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=SideBarNavigation.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideBarNavigation.types.d.ts","sourceRoot":"","sources":["../../../src/components/SideBarNavigation/SideBarNavigation.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './SideBarNavigation';
|
|
2
|
+
export * from './SideBarNavigation.types';
|
|
3
|
+
export * from './SideBarNavigation.styles';
|
|
4
|
+
export * from './SideBarNavigation.helpers';
|
|
5
|
+
export * from './SideBarNavigation.context';
|
|
6
|
+
export * from './subcomponents/SidebarBranding';
|
|
7
|
+
export * from './subcomponents/SidebarToggle';
|
|
8
|
+
export * from './subcomponents/SidebarNavItem';
|
|
9
|
+
export * from './subcomponents/SidebarSubItem';
|
|
10
|
+
export * from './subcomponents/SidebarPopoverMenu';
|
|
11
|
+
export * from './subcomponents/SidebarFooter';
|
|
12
|
+
export * from './subcomponents/SidebarProfile';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SideBarNavigation/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SidebarBrandingConfig } from '../SideBarNavigation.types';
|
|
3
|
+
export interface SidebarBrandingProps {
|
|
4
|
+
branding?: SidebarBrandingConfig;
|
|
5
|
+
collapsed: boolean;
|
|
6
|
+
linkComponent?: React.ComponentType<{
|
|
7
|
+
href: string;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export declare const SidebarBranding: React.FC<SidebarBrandingProps>;
|
|
13
|
+
//# sourceMappingURL=SidebarBranding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarBranding.d.ts","sourceRoot":"","sources":["../../../../src/components/SideBarNavigation/subcomponents/SidebarBranding.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGxE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAClC,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;CACJ;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAuE1D,CAAC"}
|