@facter/ds-core 1.4.0 → 1.5.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/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +38 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3394,6 +3394,38 @@ function FormSwitch({
|
|
|
3394
3394
|
) });
|
|
3395
3395
|
}
|
|
3396
3396
|
FormSwitch.displayName = "Form.Switch";
|
|
3397
|
+
var colorStyles = {
|
|
3398
|
+
default: {
|
|
3399
|
+
border: "border-primary",
|
|
3400
|
+
bg: "bg-primary/5",
|
|
3401
|
+
text: "text-primary",
|
|
3402
|
+
radio: "border-primary text-primary"
|
|
3403
|
+
},
|
|
3404
|
+
destructive: {
|
|
3405
|
+
border: "border-red-500",
|
|
3406
|
+
bg: "bg-red-500/10",
|
|
3407
|
+
text: "text-red-600",
|
|
3408
|
+
radio: "border-red-500 text-red-500"
|
|
3409
|
+
},
|
|
3410
|
+
warning: {
|
|
3411
|
+
border: "border-amber-500",
|
|
3412
|
+
bg: "bg-amber-500/10",
|
|
3413
|
+
text: "text-amber-600",
|
|
3414
|
+
radio: "border-amber-500 text-amber-500"
|
|
3415
|
+
},
|
|
3416
|
+
success: {
|
|
3417
|
+
border: "border-green-500",
|
|
3418
|
+
bg: "bg-green-500/10",
|
|
3419
|
+
text: "text-green-600",
|
|
3420
|
+
radio: "border-green-500 text-green-500"
|
|
3421
|
+
},
|
|
3422
|
+
info: {
|
|
3423
|
+
border: "border-blue-500",
|
|
3424
|
+
bg: "bg-blue-500/10",
|
|
3425
|
+
text: "text-blue-600",
|
|
3426
|
+
radio: "border-blue-500 text-blue-500"
|
|
3427
|
+
}
|
|
3428
|
+
};
|
|
3397
3429
|
function FormRadioGroup({
|
|
3398
3430
|
name,
|
|
3399
3431
|
label,
|
|
@@ -3433,12 +3465,14 @@ function FormRadioGroup({
|
|
|
3433
3465
|
children: options.map((option) => {
|
|
3434
3466
|
const optionId = `${name}-${option.value}`;
|
|
3435
3467
|
const isSelected = field.value === option.value;
|
|
3468
|
+
const color = option.color || "default";
|
|
3469
|
+
const styles = colorStyles[color];
|
|
3436
3470
|
return /* @__PURE__ */ jsxs(
|
|
3437
3471
|
"div",
|
|
3438
3472
|
{
|
|
3439
3473
|
className: cn(
|
|
3440
3474
|
"flex items-center gap-3 border-2 py-2 px-4 rounded-lg transition-colors cursor-pointer",
|
|
3441
|
-
isSelected ?
|
|
3475
|
+
isSelected ? cn(styles.border, styles.bg) : "border-border hover:border-muted-foreground/50",
|
|
3442
3476
|
option.disabled && "opacity-50 cursor-not-allowed"
|
|
3443
3477
|
),
|
|
3444
3478
|
onClick: () => {
|
|
@@ -3454,7 +3488,8 @@ function FormRadioGroup({
|
|
|
3454
3488
|
value: option.value,
|
|
3455
3489
|
disabled: option.disabled,
|
|
3456
3490
|
className: cn(
|
|
3457
|
-
"aspect-square h-4 w-4 rounded-full border
|
|
3491
|
+
"aspect-square h-4 w-4 rounded-full border",
|
|
3492
|
+
isSelected ? styles.radio : "border-border text-muted-foreground",
|
|
3458
3493
|
"ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
3459
3494
|
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
3460
3495
|
),
|
|
@@ -3468,7 +3503,7 @@ function FormRadioGroup({
|
|
|
3468
3503
|
htmlFor: optionId,
|
|
3469
3504
|
className: cn(
|
|
3470
3505
|
"text-sm font-medium leading-none cursor-pointer",
|
|
3471
|
-
isSelected &&
|
|
3506
|
+
isSelected && styles.text,
|
|
3472
3507
|
option.disabled && "cursor-not-allowed"
|
|
3473
3508
|
),
|
|
3474
3509
|
children: option.label
|