@choice-ui/radio 0.0.4
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/README.md +434 -0
- package/dist/index.cjs +341 -0
- package/dist/index.d.cts +69 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.js +335 -0
- package/package.json +47 -0
- package/src/context.ts +38 -0
- package/src/index.ts +8 -0
- package/src/radio-group.tsx +137 -0
- package/src/radio-label.tsx +33 -0
- package/src/radio.tsx +109 -0
- package/src/tv.ts +128 -0
package/src/tv.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { tcv } from "@choice-ui/shared"
|
|
2
|
+
|
|
3
|
+
export const radioTv = tcv({
|
|
4
|
+
slots: {
|
|
5
|
+
root: "flex items-center select-none",
|
|
6
|
+
box: ["relative flex size-4 items-center justify-center", "border border-solid"],
|
|
7
|
+
input: "peer pointer-events-auto absolute inset-0 appearance-none opacity-0",
|
|
8
|
+
label: "pl-2",
|
|
9
|
+
},
|
|
10
|
+
variants: {
|
|
11
|
+
type: {
|
|
12
|
+
checkbox: {
|
|
13
|
+
box: "rounded-md",
|
|
14
|
+
},
|
|
15
|
+
radio: {
|
|
16
|
+
box: "rounded-full",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
variant: {
|
|
20
|
+
default: {},
|
|
21
|
+
accent: {},
|
|
22
|
+
outline: {},
|
|
23
|
+
},
|
|
24
|
+
checked: {
|
|
25
|
+
true: {},
|
|
26
|
+
false: {},
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
true: {},
|
|
30
|
+
false: {},
|
|
31
|
+
},
|
|
32
|
+
focused: {
|
|
33
|
+
true: {},
|
|
34
|
+
false: {},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
compoundVariants: [
|
|
38
|
+
// 未选中状态
|
|
39
|
+
{
|
|
40
|
+
variant: ["default", "accent"],
|
|
41
|
+
checked: false,
|
|
42
|
+
disabled: false,
|
|
43
|
+
focused: false,
|
|
44
|
+
class: {
|
|
45
|
+
box: "bg-secondary-background border-default-boundary",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
variant: "outline",
|
|
50
|
+
checked: false,
|
|
51
|
+
disabled: false,
|
|
52
|
+
focused: false,
|
|
53
|
+
class: {
|
|
54
|
+
box: ["border-default-foreground", "peer-focus-visible:border-selected-boundary"],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
// 选中状态 - default
|
|
58
|
+
{
|
|
59
|
+
variant: "default",
|
|
60
|
+
checked: true,
|
|
61
|
+
disabled: false,
|
|
62
|
+
focused: false,
|
|
63
|
+
class: {
|
|
64
|
+
box: [
|
|
65
|
+
"bg-secondary-background border-default-boundary",
|
|
66
|
+
"peer-focus-visible:border-selected-strong-boundary",
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
// 选中状态 - accent & outline
|
|
71
|
+
{
|
|
72
|
+
variant: ["accent", "outline"],
|
|
73
|
+
checked: true,
|
|
74
|
+
disabled: false,
|
|
75
|
+
focused: false,
|
|
76
|
+
class: {
|
|
77
|
+
box: [
|
|
78
|
+
"bg-accent-background border-selected-strong-boundary text-on-accent-foreground",
|
|
79
|
+
"peer-focus-visible:border-selected-strong-boundary",
|
|
80
|
+
"peer-focus-visible:text-on-accent-foreground",
|
|
81
|
+
"peer-focus-visible:shadow-checked-focused",
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
variant: ["default", "accent", "outline"],
|
|
87
|
+
checked: false,
|
|
88
|
+
disabled: false,
|
|
89
|
+
focused: true,
|
|
90
|
+
class: {
|
|
91
|
+
box: "border-selected-boundary",
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
variant: "default",
|
|
96
|
+
checked: true,
|
|
97
|
+
disabled: false,
|
|
98
|
+
focused: true,
|
|
99
|
+
class: {
|
|
100
|
+
box: "border-selected-strong-boundary",
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
variant: ["accent", "outline"],
|
|
105
|
+
checked: true,
|
|
106
|
+
disabled: false,
|
|
107
|
+
focused: true,
|
|
108
|
+
class: {
|
|
109
|
+
box: "text-on-accent-foreground border-selected-strong-boundary shadow-checked-focused",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
variant: ["accent", "outline", "default"],
|
|
114
|
+
disabled: true,
|
|
115
|
+
class: {
|
|
116
|
+
root: "text-default-background",
|
|
117
|
+
box: "border-disabled-background bg-disabled-background",
|
|
118
|
+
label: "text-disabled-foreground",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
defaultVariants: {
|
|
123
|
+
variant: "default",
|
|
124
|
+
checked: false,
|
|
125
|
+
disabled: false,
|
|
126
|
+
focused: false,
|
|
127
|
+
},
|
|
128
|
+
})
|