@gamecp/ui 0.1.21 → 0.1.22
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 +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +39 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2657,7 +2657,8 @@ function Switch({
|
|
|
2657
2657
|
label,
|
|
2658
2658
|
description,
|
|
2659
2659
|
className = "",
|
|
2660
|
-
size = "md"
|
|
2660
|
+
size = "md",
|
|
2661
|
+
variant = "default"
|
|
2661
2662
|
}) {
|
|
2662
2663
|
const toggle = () => {
|
|
2663
2664
|
if (!disabled) {
|
|
@@ -2669,7 +2670,40 @@ function Switch({
|
|
|
2669
2670
|
md: { track: "w-11 h-6", thumb: "w-5 h-5", translate: "translate-x-5" },
|
|
2670
2671
|
lg: { track: "w-14 h-8", thumb: "w-7 h-7", translate: "translate-x-6" }
|
|
2671
2672
|
};
|
|
2673
|
+
const variants = {
|
|
2674
|
+
default: {
|
|
2675
|
+
checked: "bg-primary",
|
|
2676
|
+
unchecked: "bg-muted",
|
|
2677
|
+
ring: "focus:ring-primary"
|
|
2678
|
+
},
|
|
2679
|
+
success: {
|
|
2680
|
+
checked: "bg-success",
|
|
2681
|
+
unchecked: "bg-muted",
|
|
2682
|
+
ring: "focus:ring-success"
|
|
2683
|
+
},
|
|
2684
|
+
danger: {
|
|
2685
|
+
checked: "bg-destructive",
|
|
2686
|
+
unchecked: "bg-muted",
|
|
2687
|
+
ring: "focus:ring-destructive"
|
|
2688
|
+
},
|
|
2689
|
+
warning: {
|
|
2690
|
+
checked: "bg-warning",
|
|
2691
|
+
unchecked: "bg-muted",
|
|
2692
|
+
ring: "focus:ring-warning"
|
|
2693
|
+
},
|
|
2694
|
+
info: {
|
|
2695
|
+
checked: "bg-info",
|
|
2696
|
+
unchecked: "bg-muted",
|
|
2697
|
+
ring: "focus:ring-info"
|
|
2698
|
+
},
|
|
2699
|
+
embedded: {
|
|
2700
|
+
checked: "bg-success",
|
|
2701
|
+
unchecked: "bg-gray-300 dark:bg-gray-600",
|
|
2702
|
+
ring: "focus:ring-success"
|
|
2703
|
+
}
|
|
2704
|
+
};
|
|
2672
2705
|
const currentSize = sizes[size];
|
|
2706
|
+
const currentVariant = variants[variant];
|
|
2673
2707
|
return /* @__PURE__ */ jsxs("div", { className: `flex items-start ${className}`, children: [
|
|
2674
2708
|
/* @__PURE__ */ jsx(
|
|
2675
2709
|
"button",
|
|
@@ -2681,8 +2715,8 @@ function Switch({
|
|
|
2681
2715
|
onClick: toggle,
|
|
2682
2716
|
className: `
|
|
2683
2717
|
relative inline-flex flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent
|
|
2684
|
-
transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2
|
|
2685
|
-
${checked ?
|
|
2718
|
+
transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 ${currentVariant.ring} focus:ring-offset-2
|
|
2719
|
+
${checked ? currentVariant.checked : currentVariant.unchecked}
|
|
2686
2720
|
${disabled ? "opacity-50 cursor-not-allowed" : ""}
|
|
2687
2721
|
${currentSize.track}
|
|
2688
2722
|
`,
|
|
@@ -2942,8 +2976,8 @@ function SharedTooltip({
|
|
|
2942
2976
|
offset,
|
|
2943
2977
|
delayShow,
|
|
2944
2978
|
delayHide,
|
|
2945
|
-
className: `!bg-popover !text-popover-foreground !border !border-border !shadow-md !text-xs !px-2 !py-1 !rounded-md
|
|
2946
|
-
style,
|
|
2979
|
+
className: `!bg-popover !text-popover-foreground !border !border-border !shadow-md !text-xs !px-2 !py-1 !rounded-md ${className}`,
|
|
2980
|
+
style: { zIndex: 9999, ...style },
|
|
2947
2981
|
positionStrategy: "fixed",
|
|
2948
2982
|
render: children ? () => /* @__PURE__ */ jsx(Fragment, { children }) : void 0
|
|
2949
2983
|
}
|