@gamecp/ui 0.1.37 → 0.1.39

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/index.d.mts CHANGED
@@ -251,6 +251,15 @@ interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
251
251
  }
252
252
  declare const Link: React__default.ForwardRefExoticComponent<LinkProps & React__default.RefAttributes<HTMLAnchorElement>>;
253
253
 
254
+ /**
255
+ * Get the sidebar nav item classes based on active state.
256
+ * Useful for extensions that need custom Link components.
257
+ */
258
+ declare function getSidebarNavItemClasses(isActive: boolean, className?: string): string;
259
+ /**
260
+ * Get the sidebar nav icon classes.
261
+ */
262
+ declare function getSidebarNavIconClasses(isActive?: boolean): string;
254
263
  interface SidebarNavItemProps {
255
264
  href: string;
256
265
  icon?: IconType;
@@ -261,8 +270,17 @@ interface SidebarNavItemProps {
261
270
  exact?: boolean;
262
271
  onClick?: () => void;
263
272
  isButton?: boolean;
273
+ /** Custom Link component for extensions that inject their own routing */
274
+ LinkComponent?: React__default.ComponentType<{
275
+ href: string;
276
+ className?: string;
277
+ onClick?: () => void;
278
+ children: React__default.ReactNode;
279
+ }>;
280
+ /** Custom pathname for extensions that inject their own routing context */
281
+ pathname?: string;
264
282
  }
265
- declare function SidebarNavItem({ href, icon: Icon, children, active, className, title, exact, onClick, isButton, }: SidebarNavItemProps): react_jsx_runtime.JSX.Element;
283
+ declare function SidebarNavItem({ href, icon: Icon, children, active, className, title, exact, onClick, isButton, LinkComponent, pathname: externalPathname, }: SidebarNavItemProps): react_jsx_runtime.JSX.Element;
266
284
 
267
285
  interface LoadingSpinnerProps {
268
286
  message?: string;
@@ -1007,4 +1025,4 @@ declare function VariableInput({ name, label, value, onChange, placeholder, erro
1007
1025
 
1008
1026
  declare const VERSION = "0.1.35";
1009
1027
 
1010
- export { ActionButton, Badge, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, ConfirmDialog, type ConfirmDialogOptions, Container, DangerNotice, DataTable, DataTableActions, DataTableBody, DataTableCell, DataTableEmptyState, DataTableHeader, DataTableHeaderCell, DataTableLoadingState, DataTableRow, DropDownArrow, Dropdown, DropdownItem, EmptyState, ErrorAlert, ErrorMessage, FilterSelect, FilterToggleButton, FormInput, FormSection, Grid, IconButtonWithCount, InfoAlert, InfoBox, InfoNotice, Link, type LinkProps, LoadingSpinner, MobileSearchLayout, Modal, Notice, PageHeader, RefreshButton, SearchCard, SearchCardContent, SearchCardHeader, SearchInput, Select, SharedTooltip, SidebarNavItem, type SidebarNavItemProps, Skeleton, SkeletonCard, SkeletonEnvironmentsList, SkeletonForm, SkeletonGameCard, SkeletonGameServerCard, SkeletonGameServerCards, SkeletonGameServerTable, SkeletonGamesTable, SkeletonItem, SkeletonList, SkeletonNodeCard, SkeletonNodeCards, SkeletonNodeTable, SkeletonRecentActivity, SkeletonSearchCard, SkeletonStats, SkeletonTable, SkeletonTenantCard, SkeletonUserCard, SmartDropdown, SmartSelect, Spinner, StatusBadge, StickyActionsColumn, SuccessAlert, SuccessNotice, Switch, type SwitchVariant, Typography, UnsavedAlert, UnsavedChangesNotification, VERSION, VariableInput, VariableSelector, ViewToggle, WarningAlert, WarningNotice, useConfirmDialog };
1028
+ export { ActionButton, Badge, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, ConfirmDialog, type ConfirmDialogOptions, Container, DangerNotice, DataTable, DataTableActions, DataTableBody, DataTableCell, DataTableEmptyState, DataTableHeader, DataTableHeaderCell, DataTableLoadingState, DataTableRow, DropDownArrow, Dropdown, DropdownItem, EmptyState, ErrorAlert, ErrorMessage, FilterSelect, FilterToggleButton, FormInput, FormSection, Grid, IconButtonWithCount, InfoAlert, InfoBox, InfoNotice, Link, type LinkProps, LoadingSpinner, MobileSearchLayout, Modal, Notice, PageHeader, RefreshButton, SearchCard, SearchCardContent, SearchCardHeader, SearchInput, Select, SharedTooltip, SidebarNavItem, type SidebarNavItemProps, Skeleton, SkeletonCard, SkeletonEnvironmentsList, SkeletonForm, SkeletonGameCard, SkeletonGameServerCard, SkeletonGameServerCards, SkeletonGameServerTable, SkeletonGamesTable, SkeletonItem, SkeletonList, SkeletonNodeCard, SkeletonNodeCards, SkeletonNodeTable, SkeletonRecentActivity, SkeletonSearchCard, SkeletonStats, SkeletonTable, SkeletonTenantCard, SkeletonUserCard, SmartDropdown, SmartSelect, Spinner, StatusBadge, StickyActionsColumn, SuccessAlert, SuccessNotice, Switch, type SwitchVariant, Typography, UnsavedAlert, UnsavedChangesNotification, VERSION, VariableInput, VariableSelector, ViewToggle, WarningAlert, WarningNotice, getSidebarNavIconClasses, getSidebarNavItemClasses, useConfirmDialog };
package/dist/index.d.ts CHANGED
@@ -251,6 +251,15 @@ interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
251
251
  }
252
252
  declare const Link: React__default.ForwardRefExoticComponent<LinkProps & React__default.RefAttributes<HTMLAnchorElement>>;
253
253
 
254
+ /**
255
+ * Get the sidebar nav item classes based on active state.
256
+ * Useful for extensions that need custom Link components.
257
+ */
258
+ declare function getSidebarNavItemClasses(isActive: boolean, className?: string): string;
259
+ /**
260
+ * Get the sidebar nav icon classes.
261
+ */
262
+ declare function getSidebarNavIconClasses(isActive?: boolean): string;
254
263
  interface SidebarNavItemProps {
255
264
  href: string;
256
265
  icon?: IconType;
@@ -261,8 +270,17 @@ interface SidebarNavItemProps {
261
270
  exact?: boolean;
262
271
  onClick?: () => void;
263
272
  isButton?: boolean;
273
+ /** Custom Link component for extensions that inject their own routing */
274
+ LinkComponent?: React__default.ComponentType<{
275
+ href: string;
276
+ className?: string;
277
+ onClick?: () => void;
278
+ children: React__default.ReactNode;
279
+ }>;
280
+ /** Custom pathname for extensions that inject their own routing context */
281
+ pathname?: string;
264
282
  }
265
- declare function SidebarNavItem({ href, icon: Icon, children, active, className, title, exact, onClick, isButton, }: SidebarNavItemProps): react_jsx_runtime.JSX.Element;
283
+ declare function SidebarNavItem({ href, icon: Icon, children, active, className, title, exact, onClick, isButton, LinkComponent, pathname: externalPathname, }: SidebarNavItemProps): react_jsx_runtime.JSX.Element;
266
284
 
267
285
  interface LoadingSpinnerProps {
268
286
  message?: string;
@@ -1007,4 +1025,4 @@ declare function VariableInput({ name, label, value, onChange, placeholder, erro
1007
1025
 
1008
1026
  declare const VERSION = "0.1.35";
1009
1027
 
1010
- export { ActionButton, Badge, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, ConfirmDialog, type ConfirmDialogOptions, Container, DangerNotice, DataTable, DataTableActions, DataTableBody, DataTableCell, DataTableEmptyState, DataTableHeader, DataTableHeaderCell, DataTableLoadingState, DataTableRow, DropDownArrow, Dropdown, DropdownItem, EmptyState, ErrorAlert, ErrorMessage, FilterSelect, FilterToggleButton, FormInput, FormSection, Grid, IconButtonWithCount, InfoAlert, InfoBox, InfoNotice, Link, type LinkProps, LoadingSpinner, MobileSearchLayout, Modal, Notice, PageHeader, RefreshButton, SearchCard, SearchCardContent, SearchCardHeader, SearchInput, Select, SharedTooltip, SidebarNavItem, type SidebarNavItemProps, Skeleton, SkeletonCard, SkeletonEnvironmentsList, SkeletonForm, SkeletonGameCard, SkeletonGameServerCard, SkeletonGameServerCards, SkeletonGameServerTable, SkeletonGamesTable, SkeletonItem, SkeletonList, SkeletonNodeCard, SkeletonNodeCards, SkeletonNodeTable, SkeletonRecentActivity, SkeletonSearchCard, SkeletonStats, SkeletonTable, SkeletonTenantCard, SkeletonUserCard, SmartDropdown, SmartSelect, Spinner, StatusBadge, StickyActionsColumn, SuccessAlert, SuccessNotice, Switch, type SwitchVariant, Typography, UnsavedAlert, UnsavedChangesNotification, VERSION, VariableInput, VariableSelector, ViewToggle, WarningAlert, WarningNotice, useConfirmDialog };
1028
+ export { ActionButton, Badge, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, ConfirmDialog, type ConfirmDialogOptions, Container, DangerNotice, DataTable, DataTableActions, DataTableBody, DataTableCell, DataTableEmptyState, DataTableHeader, DataTableHeaderCell, DataTableLoadingState, DataTableRow, DropDownArrow, Dropdown, DropdownItem, EmptyState, ErrorAlert, ErrorMessage, FilterSelect, FilterToggleButton, FormInput, FormSection, Grid, IconButtonWithCount, InfoAlert, InfoBox, InfoNotice, Link, type LinkProps, LoadingSpinner, MobileSearchLayout, Modal, Notice, PageHeader, RefreshButton, SearchCard, SearchCardContent, SearchCardHeader, SearchInput, Select, SharedTooltip, SidebarNavItem, type SidebarNavItemProps, Skeleton, SkeletonCard, SkeletonEnvironmentsList, SkeletonForm, SkeletonGameCard, SkeletonGameServerCard, SkeletonGameServerCards, SkeletonGameServerTable, SkeletonGamesTable, SkeletonItem, SkeletonList, SkeletonNodeCard, SkeletonNodeCards, SkeletonNodeTable, SkeletonRecentActivity, SkeletonSearchCard, SkeletonStats, SkeletonTable, SkeletonTenantCard, SkeletonUserCard, SmartDropdown, SmartSelect, Spinner, StatusBadge, StickyActionsColumn, SuccessAlert, SuccessNotice, Switch, type SwitchVariant, Typography, UnsavedAlert, UnsavedChangesNotification, VERSION, VariableInput, VariableSelector, ViewToggle, WarningAlert, WarningNotice, getSidebarNavIconClasses, getSidebarNavItemClasses, useConfirmDialog };
package/dist/index.js CHANGED
@@ -4114,6 +4114,12 @@ var Link2 = React6.forwardRef(
4114
4114
  );
4115
4115
  Link2.displayName = "Link";
4116
4116
  var Link_default = Link2;
4117
+ function getSidebarNavItemClasses(isActive, className = "") {
4118
+ return `group flex items-center gap-0 overflow-hidden rounded-md px-3 py-2 text-sm font-medium outline-hidden ring-sidebar-ring transition-[width,height,padding,background-color,color] duration-300 focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 ${isActive ? "bg-primary text-primary-foreground" : "text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"} ${className}`;
4119
+ }
4120
+ function getSidebarNavIconClasses(isActive = false) {
4121
+ return `mr-3 h-5 w-5 shrink-0 transition-all duration-300 ease-in-out${isActive ? " text-primary-foreground" : ""}`;
4122
+ }
4117
4123
  function SidebarNavItem({
4118
4124
  href,
4119
4125
  icon: Icon,
@@ -4123,11 +4129,15 @@ function SidebarNavItem({
4123
4129
  title,
4124
4130
  exact = false,
4125
4131
  onClick,
4126
- isButton = false
4132
+ isButton = false,
4133
+ LinkComponent,
4134
+ pathname: externalPathname
4127
4135
  }) {
4128
- const pathname = navigation.usePathname();
4136
+ const nextPathname = navigation.usePathname();
4137
+ const pathname = externalPathname ?? nextPathname;
4129
4138
  const isActive = active !== void 0 ? active : exact ? pathname === href : pathname === href || pathname?.startsWith(`${href}/`);
4130
- const commonClasses = `group flex items-center px-3 py-2 text-sm font-medium rounded-md transition-all duration-150 ease-in-out ${isActive ? "" : "hover:bg-muted"} ${className}`;
4139
+ const commonClasses = getSidebarNavItemClasses(isActive, className);
4140
+ const iconClasses = getSidebarNavIconClasses(isActive);
4131
4141
  if (isButton) {
4132
4142
  return /* @__PURE__ */ jsxRuntime.jsxs(
4133
4143
  "button",
@@ -4141,7 +4151,7 @@ function SidebarNavItem({
4141
4151
  Icon && /* @__PURE__ */ jsxRuntime.jsx(
4142
4152
  Icon,
4143
4153
  {
4144
- className: `mr-3 h-5 w-5 shrink-0 transition-all duration-150 ease-in-out`,
4154
+ className: iconClasses,
4145
4155
  "aria-hidden": "true"
4146
4156
  }
4147
4157
  ),
@@ -4150,19 +4160,18 @@ function SidebarNavItem({
4150
4160
  }
4151
4161
  );
4152
4162
  }
4163
+ const LinkEl = LinkComponent || Link__default.default;
4153
4164
  return /* @__PURE__ */ jsxRuntime.jsxs(
4154
- Link__default.default,
4165
+ LinkEl,
4155
4166
  {
4156
4167
  href,
4157
4168
  onClick,
4158
- title,
4159
- "aria-current": isActive ? "page" : void 0,
4160
4169
  className: commonClasses,
4161
4170
  children: [
4162
4171
  Icon && /* @__PURE__ */ jsxRuntime.jsx(
4163
4172
  Icon,
4164
4173
  {
4165
- className: `mr-3 h-5 w-5 shrink-0 transition-all duration-150 ease-in-out`,
4174
+ className: iconClasses,
4166
4175
  "aria-hidden": "true"
4167
4176
  }
4168
4177
  ),
@@ -5552,6 +5561,8 @@ exports.VariableSelector = VariableSelector;
5552
5561
  exports.ViewToggle = ViewToggle;
5553
5562
  exports.WarningAlert = WarningAlert;
5554
5563
  exports.WarningNotice = WarningNotice;
5564
+ exports.getSidebarNavIconClasses = getSidebarNavIconClasses;
5565
+ exports.getSidebarNavItemClasses = getSidebarNavItemClasses;
5555
5566
  exports.useConfirmDialog = useConfirmDialog;
5556
5567
  //# sourceMappingURL=index.js.map
5557
5568
  //# sourceMappingURL=index.js.map