@hari_digitus/sms-ui-library 6.0.1 → 6.0.3

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.
@@ -0,0 +1 @@
1
+ :root{--sidebar-width-expanded: 260px;--sidebar-width-collapsed: 64px;--sidebar-transition: .22s cubic-bezier(.4, 0, .2, 1);--sidebar-bg: #11151F;--sidebar-border: #1e293b;--sidebar-text-primary: #ffffff;--sidebar-text-secondary: #cbd5e1;--sidebar-text-muted: #94a3b8;--sidebar-section-label: #64748b;--sidebar-accent: #059669;--sidebar-accent-hover: #047857;--sidebar-accent-dim: rgba(5, 150, 105, .12);--sidebar-accent-bright: #10b981;--sidebar-item-hover: rgba(255, 255, 255, .05);--sidebar-danger: #ef4444;--sidebar-avatar-bg: #059669;--sidebar-avatar-text: #ffffff;--sidebar-popup-bg: #ffffff;--sidebar-popup-border: #e5e7eb;--sidebar-popup-shadow: 0 4px 16px rgba(0, 0, 0, .15);--sidebar-popup-text: #222222;--sidebar-popup-text-secondary: #666666;--sidebar-popup-text-muted: #888888;--sidebar-popup-close-color: #374151}.rdr-sidebar{position:fixed;left:0;top:0;bottom:0;z-index:100;display:flex;flex-direction:column;width:var(--sidebar-width-expanded);height:100vh;background-color:var(--sidebar-bg);color:#e2e8f0;border-right:1px solid var(--sidebar-border);box-sizing:border-box;overflow:hidden;transition:width var(--sidebar-transition);font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased}.rdr-sidebar.expanded{width:var(--sidebar-width-expanded)}.rdr-sidebar.collapsed{width:var(--sidebar-width-collapsed)}.sidebar-header{display:flex;align-items:center;padding:24px 20px;gap:12px;flex-shrink:0}.logo-section{display:flex;align-items:center;gap:12px;cursor:pointer;min-width:0;flex:1;-webkit-user-select:none;user-select:none}.brand-logo{background:linear-gradient(135deg,#60a5fa,#3b82f6);width:32px;height:32px;border-radius:6px;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:18px;color:#fff;flex-shrink:0}.logo-icon{flex-shrink:0;width:32px;height:32px;display:flex;align-items:center;justify-content:center}.brand-text{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden}.brand-text h2{margin:0;font-size:16px;font-weight:600;color:var(--sidebar-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.brand-text span{font-size:9px;color:var(--sidebar-text-muted);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.menu-toggle{background:none!important;border:none!important;box-shadow:none!important;color:#cbd5e1;cursor:pointer;padding:0!important;display:flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:6px;width:32px;height:32px;transition:background .15s,color .15s}.menu-toggle:hover{background:var(--sidebar-item-hover)!important;color:var(--sidebar-text-primary)}.sidebar-actions{padding:0 20px 24px;flex-shrink:0}.sidebar-create-btn{width:100%;background-color:var(--sidebar-accent);color:#fff;border:none;border-radius:8px;padding:10px;font-size:14px;font-weight:600;display:flex;align-items:center;justify-content:center;gap:8px;cursor:pointer;transition:background-color .2s;height:44px;outline:none;box-shadow:none}.sidebar-create-btn:hover{background-color:var(--sidebar-accent-hover)}.sidebar-nav{flex:1;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.08) transparent}.sidebar-nav::-webkit-scrollbar{width:4px}.sidebar-nav::-webkit-scrollbar-track{background:transparent}.sidebar-nav::-webkit-scrollbar-thumb{background:#ffffff14;border-radius:2px}.nav-section{margin-bottom:24px;list-style-type:none!important;padding:0}.section-title{font-size:11px;font-weight:600;color:var(--sidebar-section-label);padding:0 20px;margin:0 0 12px;letter-spacing:.5px;text-transform:uppercase;-webkit-user-select:none;user-select:none;white-space:nowrap;overflow:hidden}.nav-items{list-style:none;padding:0;margin:0}.nav-items li{margin:0}.nav-item{display:flex;align-items:center;padding:12px 20px;gap:16px;cursor:pointer;color:#cbd5e1;transition:all .2s;position:relative;text-decoration:none;font-size:14px;font-weight:500;white-space:nowrap;overflow:hidden}.nav-item:hover{background-color:var(--sidebar-item-hover);color:var(--sidebar-text-primary);text-decoration:none}.nav-item.active{background-color:var(--sidebar-accent);color:var(--sidebar-text-primary)}.nav-item.active:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background-color:var(--sidebar-accent)}.nav-icon{display:flex;align-items:center;justify-content:center;color:#94a3b8;flex-shrink:0;width:20px;height:20px;transition:color .15s}.nav-icon svg{width:18px;height:18px}.nav-item.active .nav-icon{color:var(--sidebar-accent-bright)}.nav-text{font-size:14px;font-weight:500;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.submenu-arrow{flex-shrink:0;font-size:16px;font-weight:400;color:#94a3b8;line-height:1}.submenu{list-style:none;margin:0;padding:0 0 0 56px;background-color:#00000026}.submenu li{margin:0}.submenu-item{display:flex;align-items:center;gap:8px;padding:10px 20px 10px 0;cursor:pointer;text-decoration:none;color:#94a3b8;font-size:13px;font-weight:400;transition:color .15s,background .15s;white-space:nowrap;overflow:hidden}.submenu-item:hover{color:var(--sidebar-text-primary);text-decoration:none}.submenu-item.active-sub{color:var(--sidebar-accent-bright);font-weight:600}.submenu-icon{flex-shrink:0;width:16px;height:16px;display:flex;align-items:center;justify-content:center}.submenu-icon svg{width:14px;height:14px}.sidebar-footer{padding:20px;border-top:1px solid rgba(255,255,255,.05);flex-shrink:0;display:flex;flex-direction:column;gap:0}.footer-link{display:flex;align-items:center;gap:16px;color:#cbd5e1;cursor:pointer;margin-bottom:24px;transition:color .15s;-webkit-user-select:none;user-select:none;white-space:nowrap;overflow:hidden}.footer-link:hover{color:var(--sidebar-text-primary)}.footer-link span:first-child{flex-shrink:0;width:20px;height:20px;display:flex;align-items:center;justify-content:center}.footer-link span:first-child svg{width:18px;height:18px}.user-profile-wrapper{position:relative}.user-profile{display:flex;align-items:center;gap:12px;cursor:pointer;transition:background .15s;border-radius:8px;padding:4px;margin:-4px}.user-profile:hover{background:var(--sidebar-item-hover)}.avatar{width:36px;height:36px;border-radius:8px;background-color:var(--sidebar-avatar-bg);color:var(--sidebar-avatar-text);display:flex;align-items:center;justify-content:center;font-weight:600;font-size:14px;flex-shrink:0;text-transform:uppercase}.user-info{display:flex;flex-direction:column;flex:1;min-width:0;overflow:hidden}.user-name{font-size:14px;font-weight:600;color:var(--sidebar-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-role{font-size:11px;color:var(--sidebar-text-muted);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.profile-popup{position:absolute;bottom:60px;left:0;width:320px;min-height:95px;background:var(--sidebar-popup-bg);border-radius:10px;padding:12px 14px;box-shadow:var(--sidebar-popup-shadow);z-index:9999;animation:popupIn .15s cubic-bezier(.4,0,.2,1)}@keyframes popupIn{0%{opacity:0;transform:translateY(6px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1)}}.popup-close{position:absolute;top:10px;right:12px;border:none!important;background:transparent!important;cursor:pointer;color:var(--sidebar-popup-close-color);font-size:18px;font-weight:500;display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:6px;padding:0!important;transition:background .12s;box-shadow:none!important}.popup-close:hover{background:#0000000f!important}.popup-header{display:flex;align-items:center;gap:12px;padding-right:28px}.popup-avatar{width:42px;height:42px;border-radius:8px;background:var(--sidebar-accent);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:600;font-size:16px;flex-shrink:0;text-transform:uppercase}.popup-user-details{flex:1;min-width:0}.popup-name{font-size:14px;font-weight:600;color:var(--sidebar-popup-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.popup-role{font-size:12px;color:var(--sidebar-popup-text-secondary)}.popup-email{font-size:12px;color:var(--sidebar-popup-text-muted);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.popup-divider{height:1px;background:var(--sidebar-popup-border);margin:10px 0}.signout-btn{width:100%;border:none!important;background:transparent!important;color:var(--sidebar-danger);cursor:pointer;padding:4px 0;font-size:14px;font-weight:500;display:flex;justify-content:flex-end;align-items:center;gap:6px;outline:none;border-radius:6px;transition:background .15s}.signout-btn:hover{background:#ef444414!important}.signout-btn svg{width:15px;height:15px;color:var(--sidebar-danger);flex-shrink:0}.rdr-sidebar.collapsed .sidebar-header{padding:24px 0;justify-content:center}.rdr-sidebar.collapsed .sidebar-actions{padding:0 8px 16px}.rdr-sidebar.collapsed .nav-item{justify-content:center;padding:12px 0;gap:0}.rdr-sidebar.collapsed .nav-item.active:before{width:3px}.rdr-sidebar.collapsed .section-title{padding:0;text-align:center;font-size:0;margin:0 0 8px}.rdr-sidebar.collapsed .sidebar-footer{padding:16px 0;align-items:center}.rdr-sidebar.collapsed .footer-link{justify-content:center;gap:0;padding:0;margin-bottom:16px}.rdr-sidebar.collapsed .user-profile{justify-content:center;padding:4px 0}.rdr-sidebar.collapsed .nav-item[data-label]:hover:after,.rdr-sidebar.collapsed .footer-link[data-label]:hover:after{content:attr(data-label);position:absolute;left:calc(100% + 10px);top:50%;transform:translateY(-50%);background:#1e293b;color:#e2e8f0;font-size:12px;font-weight:500;padding:5px 10px;border-radius:6px;white-space:nowrap;box-shadow:0 4px 12px #0006;border:1px solid rgba(255,255,255,.08);pointer-events:none;z-index:300}.rdr-sidebar.collapsed .nav-item,.rdr-sidebar.collapsed .footer-link{position:relative}
@@ -1,50 +1,8 @@
1
- import type { ReactNode } from "react";
2
- export interface SidebarNavItem {
3
- label: string;
4
- icon: ReactNode;
5
- to: string;
6
- }
7
- export interface SidebarNavSection {
8
- section: string;
9
- /**
10
- * Pass a full Tailwind color token e.g. "green-500", "blue-400"
11
- * OR a raw CSS color e.g. "#14b8a6" for the border/active accent.
12
- * Raw CSS colors are recommended so the left-border inline style works correctly.
13
- */
14
- color?: string;
15
- /** Raw CSS color used for the left border accent on active/hover (e.g. "#4ade80") */
16
- rawColor?: string;
17
- items: SidebarNavItem[];
18
- }
19
- export interface SidebarLogoProps {
20
- icon: ReactNode;
21
- name: string;
22
- subLabel?: string;
23
- }
24
- export interface SidebarUserProps {
25
- initials: string;
26
- avatarColor?: string;
27
- name: string;
28
- role?: string;
29
- }
30
- export interface SidebarFooterLink {
31
- label: string;
32
- icon: ReactNode;
33
- onClick?: () => void;
34
- }
1
+ import React from "react";
2
+ import "./SideNavBar.css";
3
+ import { SidebarConfig } from "./SideNavBarTypes";
35
4
  export interface SidebarProps {
36
- open: boolean;
37
- onToggle: () => void;
38
- navConfig: SidebarNavSection[];
39
- logo?: SidebarLogoProps;
40
- cta?: {
41
- label: string;
42
- icon: ReactNode;
43
- to: string;
44
- color?: string;
45
- };
46
- user?: SidebarUserProps;
47
- footerLinks?: SidebarFooterLink[];
48
- bgColor?: string;
5
+ config: SidebarConfig;
49
6
  }
50
- export default function Sidebar({ open, onToggle, navConfig, logo, cta, user, footerLinks, bgColor, }: SidebarProps): import("react/jsx-runtime").JSX.Element;
7
+ declare const Sidebar: ({ config }: SidebarProps) => React.JSX.Element;
8
+ export default Sidebar;
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from "react";
2
+ interface SidebarContextValue {
3
+ isExpanded: boolean;
4
+ toggleSidebar: () => void;
5
+ openSubmenu: string | null;
6
+ toggleSubmenu: (name: string) => void;
7
+ }
8
+ export declare const SidebarProvider: ({ children }: {
9
+ children: ReactNode;
10
+ }) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const useSidebar: () => SidebarContextValue;
12
+ export {};
@@ -0,0 +1,49 @@
1
+ /// <reference types="react" />
2
+ export interface SubNavItem {
3
+ name: string;
4
+ path?: string;
5
+ icon?: React.ReactNode;
6
+ }
7
+ export interface NavItem {
8
+ name: string;
9
+ path?: string;
10
+ section: string;
11
+ roles?: number[];
12
+ icon?: React.ReactNode;
13
+ subItems?: SubNavItem[];
14
+ }
15
+ export interface SidebarUser {
16
+ role: number;
17
+ email?: string;
18
+ roleName?: string;
19
+ }
20
+ export interface SidebarConfig {
21
+ /** Navigation items to render */
22
+ navItems: NavItem[];
23
+ /** Current authenticated user */
24
+ user: SidebarUser;
25
+ /** Role value(s) that can see the Create button */
26
+ createButtonRoles?: number[];
27
+ /** Label for the create button (default: "Create") */
28
+ createButtonLabel?: string;
29
+ /** Path the create button navigates to */
30
+ createButtonPath?: string;
31
+ /** Path of the currently active route (defaults to window.location.pathname) */
32
+ currentPath?: string;
33
+ /** Brand name shown in expanded header (default: "Amphenol") */
34
+ brandName?: string;
35
+ /** Brand subtitle shown in expanded header */
36
+ brandSubtitle?: string;
37
+ /** Logo element to render in the header */
38
+ logo?: React.ReactNode;
39
+ /** Help Center label (default: "Help Center") */
40
+ helpLabel?: string;
41
+ /** Help center icon element */
42
+ helpIcon?: React.ReactNode;
43
+ /** Called when the user clicks Sign Out */
44
+ onSignOut?: () => void;
45
+ /** Called when a nav item is clicked; return false to prevent navigation */
46
+ onNavigate?: (path: string) => void;
47
+ /** Additional className for the <aside> */
48
+ className?: string;
49
+ }
@@ -1,2 +1,3 @@
1
- export { default as Sidebar } from "./components/SideNavBar";
2
- export type { SidebarProps, SidebarNavSection, SidebarNavItem, SidebarLogoProps, SidebarUserProps, SidebarFooterLink, } from "./components/SideNavBar";
1
+ export { default as SideNavbar } from "./components/SideNavBar";
2
+ export { SidebarProvider, useSidebar } from "./components/SideNavBarContext";
3
+ export type { SidebarConfig, NavItem, SubNavItem, SidebarUser } from "./components/SideNavBarTypes";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hari_digitus/sms-ui-library",
3
- "version": "6.0.1",
3
+ "version": "6.0.3",
4
4
  "main": "dist/SideNavBar.cjs.js",
5
5
  "module": "dist/SideNavBar.es.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -26,6 +26,7 @@
26
26
  "react-dom": "^18.3.1"
27
27
  },
28
28
  "devDependencies": {
29
+ "@tailwindcss/postcss": "^4.3.1",
29
30
  "@types/react": "18.3.1",
30
31
  "@types/react-dom": "18.3.1",
31
32
  "@vitejs/plugin-react": "^4.0.0",