@gamecp/ui 0.1.25 → 0.1.27

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
@@ -200,7 +200,7 @@ declare function Grid({ children, cols, gap, className, }: GridProps): react_jsx
200
200
  interface InfoBoxProps {
201
201
  title: string;
202
202
  children: React__default.ReactNode;
203
- variant?: 'default' | 'warning' | 'info' | 'success';
203
+ variant?: 'default' | 'warning' | 'info' | 'success' | 'danger';
204
204
  className?: string;
205
205
  }
206
206
  declare function InfoBox({ title, children, variant, className }: InfoBoxProps): react_jsx_runtime.JSX.Element;
@@ -265,8 +265,9 @@ interface SwitchProps {
265
265
  className?: string;
266
266
  size?: 'sm' | 'md' | 'lg';
267
267
  variant?: SwitchVariant;
268
+ labelPosition?: 'left' | 'right';
268
269
  }
269
- declare function Switch({ checked, onChange, disabled, label, description, className, size, variant, }: SwitchProps): react_jsx_runtime.JSX.Element;
270
+ declare function Switch({ checked, onChange, disabled, label, description, className, size, variant, labelPosition, }: SwitchProps): react_jsx_runtime.JSX.Element;
270
271
 
271
272
  interface SmartDropdownProps {
272
273
  isOpen: boolean;
package/dist/index.d.ts CHANGED
@@ -200,7 +200,7 @@ declare function Grid({ children, cols, gap, className, }: GridProps): react_jsx
200
200
  interface InfoBoxProps {
201
201
  title: string;
202
202
  children: React__default.ReactNode;
203
- variant?: 'default' | 'warning' | 'info' | 'success';
203
+ variant?: 'default' | 'warning' | 'info' | 'success' | 'danger';
204
204
  className?: string;
205
205
  }
206
206
  declare function InfoBox({ title, children, variant, className }: InfoBoxProps): react_jsx_runtime.JSX.Element;
@@ -265,8 +265,9 @@ interface SwitchProps {
265
265
  className?: string;
266
266
  size?: 'sm' | 'md' | 'lg';
267
267
  variant?: SwitchVariant;
268
+ labelPosition?: 'left' | 'right';
268
269
  }
269
- declare function Switch({ checked, onChange, disabled, label, description, className, size, variant, }: SwitchProps): react_jsx_runtime.JSX.Element;
270
+ declare function Switch({ checked, onChange, disabled, label, description, className, size, variant, labelPosition, }: SwitchProps): react_jsx_runtime.JSX.Element;
270
271
 
271
272
  interface SmartDropdownProps {
272
273
  isOpen: boolean;
package/dist/index.js CHANGED
@@ -474,7 +474,7 @@ function Modal({
474
474
  }
475
475
  document.removeEventListener("keydown", handleTab);
476
476
  document.removeEventListener("keydown", handleEsc);
477
- document.body.style.overflow = "unset";
477
+ document.body.style.overflow = "";
478
478
  if (!isOpen && previousActiveElementRef.current) {
479
479
  previousActiveElementRef.current.focus();
480
480
  }
@@ -1307,7 +1307,7 @@ function SmartSelect({
1307
1307
  e.stopPropagation();
1308
1308
  handleSelect(option.value);
1309
1309
  },
1310
- className: `w-full px-3 py-2 text-left text-sm hover:bg-accent flex items-center justify-between min-h-[40px] transition-colors ${selectedValues.includes(option.value) ? "bg-accent border-l-2 border-l-ring" : index === focusedIndex ? "bg-muted ring-2 ring-ring" : ""}`,
1310
+ className: `w-full px-3 py-2 text-left text-sm hover:bg-accent flex items-center justify-between min-h-[40px] transition-colors ${selectedValues.includes(option.value) ? "bg-accent border-l-2 border-l-ring" : index === focusedIndex ? "bg-muted text-muted-foreground ring-2 ring-ring" : ""}`,
1311
1311
  children: [
1312
1312
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 min-w-0 flex-1", children: [
1313
1313
  option.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0", children: option.icon }),
@@ -1930,9 +1930,9 @@ function SkeletonGamesTable({
1930
1930
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider", children: "Mode" }),
1931
1931
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider", children: "Status" }),
1932
1932
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider", children: "Created" }),
1933
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-2 py-1 rounded-md bg-muted backdrop-blur-sm text-center text-xs font-medium text-muted-foreground uppercase tracking-wider sticky right-0", children: "Actions" })
1933
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-2 py-1 rounded-md backdrop-blur-sm text-center text-xs font-medium text-muted-foreground uppercase tracking-wider sticky right-0", children: "Actions" })
1934
1934
  ] }) }),
1935
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "table-body-card", children: Array.from({ length: items }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "hover:bg-muted", children: [
1935
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "table-body-card", children: Array.from({ length: items }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "hover:bg-muted/50", children: [
1936
1936
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
1937
1937
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 h-10 w-10", children: /* @__PURE__ */ jsxRuntime.jsx(SkeletonItem, { width: "w-10", height: "h-10", rounded: true }) }),
1938
1938
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-4 min-w-0 flex-1", children: [
@@ -2538,17 +2538,12 @@ function Grid({
2538
2538
  };
2539
2539
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `grid ${colClasses[cols]} ${gapClasses[gap]} ${className}`, children });
2540
2540
  }
2541
- var variantStyles = {
2542
- default: "bg-accent border-border text-muted-foreground",
2543
- warning: "bg-amber/10 border-amber text-amber",
2544
- info: "bg-info/10 border-info text-info",
2545
- success: "bg-success/10 border-success text-success"
2546
- };
2547
- var titleStyles = {
2548
- default: "text-foreground",
2549
- warning: "text-amber",
2550
- info: "text-info",
2551
- success: "text-success"
2541
+ var variantConfig = {
2542
+ default: { borderAccent: "gray", titleColor: "text-foreground" },
2543
+ warning: { borderAccent: "amber", titleColor: "text-amber" },
2544
+ info: { borderAccent: "info", titleColor: "text-info" },
2545
+ success: { borderAccent: "success", titleColor: "text-success" },
2546
+ danger: { borderAccent: "danger", titleColor: "text-danger" }
2552
2547
  };
2553
2548
  function InfoBox({
2554
2549
  title,
@@ -2556,10 +2551,19 @@ function InfoBox({
2556
2551
  variant = "default",
2557
2552
  className = ""
2558
2553
  }) {
2559
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `border rounded-md p-4 ${variantStyles[variant]} ${className}`, children: [
2560
- /* @__PURE__ */ jsxRuntime.jsx("h4", { className: `font-medium mb-2 ${titleStyles[variant]}`, children: title }),
2561
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm space-y-1 [&>ul]:list-disc [&>ul]:list-outside [&>ul]:pl-3 [&>ol]:list-decimal [&>ol]:list-outside [&>ol]:pl-4", children })
2562
- ] });
2554
+ const config = variantConfig[variant] || variantConfig.default;
2555
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2556
+ Card,
2557
+ {
2558
+ borderAccent: config.borderAccent,
2559
+ padding: "md",
2560
+ className,
2561
+ children: [
2562
+ /* @__PURE__ */ jsxRuntime.jsx("h4", { className: `font-medium mb-2 ${config.titleColor}`, children: title }),
2563
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground space-y-1 [&>ul]:list-disc [&>ul]:list-outside [&>ul]:pl-3 [&>ol]:list-decimal [&>ol]:list-outside [&>ol]:pl-4", children })
2564
+ ]
2565
+ }
2566
+ );
2563
2567
  }
2564
2568
  var variantClasses3 = {
2565
2569
  default: "text-foreground hover:text-primary",
@@ -2667,7 +2671,8 @@ function Switch({
2667
2671
  description,
2668
2672
  className = "",
2669
2673
  size = "md",
2670
- variant = "default"
2674
+ variant = "default",
2675
+ labelPosition = "right"
2671
2676
  }) {
2672
2677
  const toggle = () => {
2673
2678
  if (!disabled) {
@@ -2682,38 +2687,43 @@ function Switch({
2682
2687
  const variants = {
2683
2688
  default: {
2684
2689
  checked: "bg-primary",
2685
- unchecked: "bg-muted",
2690
+ unchecked: "bg-input",
2686
2691
  ring: "focus:ring-primary"
2687
2692
  },
2688
2693
  success: {
2689
2694
  checked: "bg-success",
2690
- unchecked: "bg-muted",
2695
+ unchecked: "bg-input",
2691
2696
  ring: "focus:ring-success"
2692
2697
  },
2693
2698
  danger: {
2694
2699
  checked: "bg-destructive",
2695
- unchecked: "bg-muted",
2700
+ unchecked: "bg-input",
2696
2701
  ring: "focus:ring-destructive"
2697
2702
  },
2698
2703
  warning: {
2699
2704
  checked: "bg-warning",
2700
- unchecked: "bg-muted",
2705
+ unchecked: "bg-input",
2701
2706
  ring: "focus:ring-warning"
2702
2707
  },
2703
2708
  info: {
2704
2709
  checked: "bg-info",
2705
- unchecked: "bg-muted",
2710
+ unchecked: "bg-input",
2706
2711
  ring: "focus:ring-info"
2707
2712
  },
2708
2713
  embedded: {
2709
2714
  checked: "bg-success",
2710
- unchecked: "bg-gray-300 dark:bg-gray-600",
2715
+ unchecked: "bg-input",
2711
2716
  ring: "focus:ring-success"
2712
2717
  }
2713
2718
  };
2714
2719
  const currentSize = sizes[size];
2715
2720
  const currentVariant = variants[variant];
2716
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex items-start ${className}`, children: [
2721
+ const LabelContent = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${labelPosition === "left" ? "mr-3 flex-1 text-left" : "ml-3 w-fit"} flex flex-col justify-center gap-1`, children: [
2722
+ label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium text-foreground cursor-pointer", onClick: toggle, children: label }),
2723
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground leading-snug", children: description })
2724
+ ] });
2725
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex items-center ${labelPosition === "left" ? "justify-between" : ""} ${className}`, children: [
2726
+ labelPosition === "left" && (label || description) && LabelContent,
2717
2727
  /* @__PURE__ */ jsxRuntime.jsx(
2718
2728
  "button",
2719
2729
  {
@@ -2743,10 +2753,7 @@ function Switch({
2743
2753
  )
2744
2754
  }
2745
2755
  ),
2746
- (label || description) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-3 text-sm leading-6", children: [
2747
- label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "font-medium text-foreground cursor-pointer", onClick: toggle, children: label }),
2748
- description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground", children: description })
2749
- ] })
2756
+ labelPosition === "right" && (label || description) && LabelContent
2750
2757
  ] });
2751
2758
  }
2752
2759
  var variantClasses4 = {
@@ -2831,7 +2838,7 @@ function DataTableRow({
2831
2838
  onClick,
2832
2839
  hover = true
2833
2840
  }) {
2834
- const baseClasses = "hover:bg-muted transition-colors duration-150";
2841
+ const baseClasses = "hover:bg-muted/50 transition-colors duration-150";
2835
2842
  const clickableClasses = onClick ? "cursor-pointer" : "";
2836
2843
  const hoverClasses = hover ? baseClasses : "";
2837
2844
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -2952,7 +2959,7 @@ function DataTableActions({
2952
2959
  enhanced = false
2953
2960
  }) {
2954
2961
  const baseClasses = "flex items-center justify-end space-x-2 dt-actions";
2955
- const enhancedClasses = enhanced ? "px-2 py-1 rounded-md bg-card backdrop-blur-sm" : "";
2962
+ const enhancedClasses = enhanced ? "px-2 py-1" : "";
2956
2963
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${baseClasses} ${enhancedClasses} ${className}`, children });
2957
2964
  }
2958
2965
  function StickyActionsColumn({
@@ -3169,25 +3176,25 @@ function ActionButton({
3169
3176
  return {
3170
3177
  icon: fill ? ri.RiStopCircleFill : ri.RiStopCircleLine,
3171
3178
  label: "Deactivate",
3172
- className: "bg-slate-50 text-slate-600 hover:bg-slate-100 hover:text-slate-700 border border-slate-200 transition-all duration-300 ease-in-out"
3179
+ className: "bg-slate-50 text-slate-600 hover:bg-slate-100 hover:text-slate-700 border border-slate-200 transition-all duration-300 ease-in-out"
3173
3180
  };
3174
3181
  case "activate":
3175
3182
  return {
3176
3183
  icon: fill ? ri.RiPlayCircleFill : ri.RiPlayCircleLine,
3177
3184
  label: "Activate",
3178
- className: "bg-emerald/10 text-emerald hover:bg-emerald/20 hover:text-emerald-700 border border-emerald-200 transition-all duration-300 ease-in-out"
3185
+ className: "bg-emerald/10 text-emerald hover:bg-emerald/20 hover:text-emerald-700 border border-emerald-200 transition-all duration-300 ease-in-out"
3179
3186
  };
3180
3187
  case "view":
3181
3188
  return {
3182
3189
  icon: fill ? ri.RiEyeFill : ri.RiEyeLine,
3183
3190
  label: "View",
3184
- className: "bg-muted text-muted-foreground hover:bg-muted hover:text-foreground border border-border transition-all duration-300 ease-in-out"
3191
+ className: "bg-muted text-muted-foreground hover:bg-muted hover:text-foreground border border-border transition-all duration-300 ease-in-out"
3185
3192
  };
3186
3193
  case "metrics":
3187
3194
  return {
3188
3195
  icon: fill ? ri.RiBarChartFill : ri.RiBarChartLine,
3189
3196
  label: "Metrics",
3190
- className: "bg-purple/10 text-purple-600 hover:bg-purple-100 hover:text-purple-700 border border-purple-200 transition-all duration-300 ease-in-out"
3197
+ className: "bg-purple/10 text-purple hover:bg-purple-100 hover:text-purple-700 border border-purple-200 transition-all duration-300 ease-in-out"
3191
3198
  };
3192
3199
  case "start":
3193
3200
  return {
@@ -3205,7 +3212,7 @@ function ActionButton({
3205
3212
  return {
3206
3213
  icon: fill ? ri.RiRestartFill : ri.RiRestartLine,
3207
3214
  label: "Restart",
3208
- className: "bg-orange/10 text-orange hover:bg-orange/20 hover:text-orange-700 border border-orange/30 transition-all duration-300 ease-in-out"
3215
+ className: "bg-orange/10 text-orange hover:bg-orange/20 hover:text-orange-700 border border-orange/30 transition-all duration-300 ease-in-out"
3209
3216
  };
3210
3217
  case "pause":
3211
3218
  return {
@@ -3217,23 +3224,23 @@ function ActionButton({
3217
3224
  return {
3218
3225
  icon: fill ? ri.RiFileCopyFill : ri.RiFileCopyLine,
3219
3226
  label: "Clone",
3220
- className: "bg-indigo/10 text-indigo hover:bg-indigo/20 hover:text-indigo-700 border border-indigo-200 transition-all duration-300 ease-in-out"
3227
+ className: "bg-indigo/10 text-indigo hover:bg-indigo/20 hover:text-indigo-700 border border-indigo-200 transition-all duration-300 ease-in-out"
3221
3228
  };
3222
3229
  default:
3223
3230
  return null;
3224
3231
  }
3225
3232
  };
3226
- const variantConfig = getVariantConfig();
3233
+ const variantConfig2 = getVariantConfig();
3227
3234
  const variantClasses5 = {
3228
3235
  primary: "btn-primary",
3229
3236
  secondary: "btn-secondary",
3230
3237
  danger: "btn-danger",
3231
3238
  success: "bg-success/10 text-success hover:bg-success/20 hover:text-success border border-success transition-all duration-300 ease-in-out",
3232
3239
  warning: "bg-amber/10 text-amber hover:bg-amber/20 hover:text-amber border border-amber transition-all duration-300 ease-in-out",
3233
- info: "bg-muted text-muted-foreground hover:bg-primary hover:text-primary-foreground border border-ring transition-all duration-300 ease-in-out",
3234
- metrics: "bg-purple/10 text-purple-600 hover:bg-purple-100 hover:text-purple-700 border border-purple-200 transition-all duration-300 ease-in-out"
3240
+ info: "bg-muted text-muted-foreground hover:bg-primary hover:text-primary-foreground border border-ring transition-all duration-300 ease-in-out",
3241
+ metrics: "bg-purple/10 text-purple hover:bg-purple/20 hover:text-purple-700 border border-purple-200 transition-all duration-300 ease-in-out"
3235
3242
  };
3236
- let variantClass = variantConfig ? variantConfig.className : variant ? variantClasses5[variant] : "";
3243
+ let variantClass = variantConfig2 ? variantConfig2.className : variant ? variantClasses5[variant] : "";
3237
3244
  if (terminalMode && variantClass) {
3238
3245
  const hoverMatch = variantClass.match(/hover:text-(\w+)-(\d+)/);
3239
3246
  const hoverColor = hoverMatch ? `hover:text-${hoverMatch[1]}-${hoverMatch[2]}` : "hover:text-muted-foreground";
@@ -3260,13 +3267,13 @@ function ActionButton({
3260
3267
  }
3261
3268
  )
3262
3269
  }
3263
- ) : (variantConfig?.icon || IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(
3270
+ ) : (variantConfig2?.icon || IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(
3264
3271
  "div",
3265
3272
  {
3266
3273
  className: `${iconSizes[size]} flex items-center justify-center flex-shrink-0`,
3267
3274
  "aria-hidden": "true",
3268
- children: variantConfig?.icon ? /* @__PURE__ */ jsxRuntime.jsx(
3269
- variantConfig.icon,
3275
+ children: variantConfig2?.icon ? /* @__PURE__ */ jsxRuntime.jsx(
3276
+ variantConfig2.icon,
3270
3277
  {
3271
3278
  className: "w-full h-full",
3272
3279
  "aria-hidden": "true"
@@ -3274,11 +3281,11 @@ function ActionButton({
3274
3281
  ) : IconComponent ? /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "w-full h-full", "aria-hidden": "true" }) : null
3275
3282
  }
3276
3283
  ),
3277
- !iconOnly && (restProps.children ? restProps.children : (variantConfig?.label || label) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center", children: variantConfig?.label || label }))
3284
+ !iconOnly && (restProps.children ? restProps.children : (variantConfig2?.label || label) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center", children: variantConfig2?.label || label }))
3278
3285
  ] });
3279
- const accessibleLabel = title || (iconOnly ? variantConfig?.label || label : void 0);
3280
- const buttonAriaLabel = iconOnly && !accessibleLabel ? variantConfig?.label || label || "Action button" : accessibleLabel;
3281
- const tooltipContent = title || (iconOnly ? variantConfig?.label || label : void 0);
3286
+ const accessibleLabel = title || (iconOnly ? variantConfig2?.label || label : void 0);
3287
+ const buttonAriaLabel = iconOnly && !accessibleLabel ? variantConfig2?.label || label || "Action button" : accessibleLabel;
3288
+ const tooltipContent = title || (iconOnly ? variantConfig2?.label || label : void 0);
3282
3289
  const buttonClassName = `
3283
3290
 
3284
3291
  ${terminalMode ? "btn-terminal" : `btn ${variantClass} ${paddingClasses3} ${heightClasses[size]} ${className} ${isDisabled ? "opacity-50 cursor-not-allowed" : ""}`}`;