@sk-web-gui/core 0.1.2
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/LICENSE +21 -0
- package/README.md +5 -0
- package/package.json +35 -0
- package/src/colors.js +77 -0
- package/src/components/accordion.js +42 -0
- package/src/components/alert.js +98 -0
- package/src/components/avatar.js +85 -0
- package/src/components/badge.js +61 -0
- package/src/components/breadcrumb.js +13 -0
- package/src/components/button-group.js +46 -0
- package/src/components/button.js +295 -0
- package/src/components/card.js +55 -0
- package/src/components/checkbox.js +128 -0
- package/src/components/code.js +9 -0
- package/src/components/cookie-consent.js +26 -0
- package/src/components/divider.js +12 -0
- package/src/components/dot.js +84 -0
- package/src/components/forms.js +246 -0
- package/src/components/icon-button.js +5 -0
- package/src/components/icon.js +9 -0
- package/src/components/kbd.js +9 -0
- package/src/components/link.js +13 -0
- package/src/components/message.js +29 -0
- package/src/components/modal.js +29 -0
- package/src/components/notification.js +56 -0
- package/src/components/radio.js +103 -0
- package/src/components/switch.js +112 -0
- package/src/components/table.js +13 -0
- package/src/components/tag.js +109 -0
- package/src/index.js +235 -0
- package/src/with-opacity.js +6 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
function fieldOutline(colors) {
|
|
2
|
+
return {
|
|
3
|
+
"&-outline": {
|
|
4
|
+
"@apply border shadow-sm border-gray-stroke": {},
|
|
5
|
+
"@apply text-gray bg-white": {},
|
|
6
|
+
//"@apply hover:border-neutral-300": {},
|
|
7
|
+
|
|
8
|
+
"&[aria-invalid=true]": {
|
|
9
|
+
"--tw-border-opacity": "1",
|
|
10
|
+
borderColor: "rgba(220, 38, 38, var(--tw-border-opacity))",
|
|
11
|
+
"--tw-ring-offset-shadow":
|
|
12
|
+
"var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)",
|
|
13
|
+
"--tw-ring-shadow":
|
|
14
|
+
"var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)",
|
|
15
|
+
boxShadow:
|
|
16
|
+
"var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)",
|
|
17
|
+
"--tw-ring-opacity": "1",
|
|
18
|
+
"--tw-ring-color": "rgba(220, 38, 38, var(--tw-ring-opacity))",
|
|
19
|
+
},
|
|
20
|
+
"focus-visible:ring-4": {},
|
|
21
|
+
/* dark mode */
|
|
22
|
+
"@apply dark:border-neutral-700": {},
|
|
23
|
+
"@apply dark:text-neutral-100 dark:bg-base": {},
|
|
24
|
+
"@apply dark:hover:border-neutral-600": {},
|
|
25
|
+
|
|
26
|
+
".dark &[aria-invalid=true]": {
|
|
27
|
+
"--tw-border-opacity": "1",
|
|
28
|
+
borderColor: "rgba(248, 113, 113, var(--tw-border-opacity))",
|
|
29
|
+
"--tw-ring-opacity": "1",
|
|
30
|
+
"--tw-ring-color": "rgba(248, 113, 113, var(--tw-ring-opacity))",
|
|
31
|
+
},
|
|
32
|
+
"@media (prefers-color-scheme: dark)": {
|
|
33
|
+
"&[aria-invalid=true]": {
|
|
34
|
+
"--tw-border-opacity": "1",
|
|
35
|
+
borderColor: "rgba(248, 113, 113, var(--tw-border-opacity))",
|
|
36
|
+
"--tw-ring-opacity": "1",
|
|
37
|
+
"--tw-ring-color": "rgba(248, 113, 113, var(--tw-ring-opacity))",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
...colors.reduce(
|
|
42
|
+
(styles, color) => ({
|
|
43
|
+
...styles,
|
|
44
|
+
[`&[data-color="${color}"]`]: {
|
|
45
|
+
[`@apply focus-visible:border-${color} focus-visible:ring-${color}`]: {},
|
|
46
|
+
[`@apply dark:focus-visible:border-${color} dark:focus-visible:ring-${color}`]: {},
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
{}
|
|
50
|
+
),
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function fieldSolid(colors) {
|
|
56
|
+
return {
|
|
57
|
+
"&-solid": {
|
|
58
|
+
"@apply border border-transparent": {},
|
|
59
|
+
"@apply text-black bg-gray-light": {},
|
|
60
|
+
//"@apply hover:bg-gray-200": {},
|
|
61
|
+
|
|
62
|
+
"&[aria-invalid=true]": {
|
|
63
|
+
"--tw-border-opacity": "1",
|
|
64
|
+
borderColor: "rgba(220, 38, 38, var(--tw-border-opacity))",
|
|
65
|
+
"--tw-ring-offset-shadow":
|
|
66
|
+
"var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)",
|
|
67
|
+
"--tw-ring-shadow":
|
|
68
|
+
"var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)",
|
|
69
|
+
boxShadow:
|
|
70
|
+
"var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)",
|
|
71
|
+
"--tw-ring-opacity": "1",
|
|
72
|
+
"--tw-ring-color": "rgba(220, 38, 38, var(--tw-ring-opacity))",
|
|
73
|
+
},
|
|
74
|
+
"focus-visible:ring-4": {},
|
|
75
|
+
/* dark mode */
|
|
76
|
+
"@apply dark:text-neutral-100 dark:bg-whiteAlpha-50": {},
|
|
77
|
+
"@apply dark:hover:bg-whiteAlpha-100": {},
|
|
78
|
+
".dark &[aria-invalid=true]": {
|
|
79
|
+
"--tw-border-opacity": "1",
|
|
80
|
+
borderColor: "rgba(248, 113, 113, var(--tw-border-opacity))",
|
|
81
|
+
"--tw-ring-opacity": "1",
|
|
82
|
+
"--tw-ring-color": "rgba(248, 113, 113, var(--tw-ring-opacity))",
|
|
83
|
+
},
|
|
84
|
+
"@media (prefers-color-scheme: dark)": {
|
|
85
|
+
"&[aria-invalid=true]": {
|
|
86
|
+
"--tw-border-opacity": "1",
|
|
87
|
+
borderColor: "rgba(248, 113, 113, var(--tw-border-opacity))",
|
|
88
|
+
"--tw-ring-opacity": "1",
|
|
89
|
+
"--tw-ring-color": "rgba(248, 113, 113, var(--tw-ring-opacity))",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
...colors.reduce(
|
|
94
|
+
(styles, color) => ({
|
|
95
|
+
...styles,
|
|
96
|
+
[`&[data-color="${color}"]`]: {
|
|
97
|
+
[`@apply focus-visible:border-${color} focus-visible:ring-${color}`]: {},
|
|
98
|
+
[`@apply dark:focus-visible:border-${color} dark:focus-visible:ring-${color}`]: {},
|
|
99
|
+
},
|
|
100
|
+
}),
|
|
101
|
+
{}
|
|
102
|
+
),
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function formControl() {
|
|
108
|
+
return {
|
|
109
|
+
".form-control": {
|
|
110
|
+
"@apply w-full relative": {},
|
|
111
|
+
},
|
|
112
|
+
".form-helper-text": {
|
|
113
|
+
"@apply mt-1.5 leading-none text-gray dark:text-whiteAlpha-600": {},
|
|
114
|
+
},
|
|
115
|
+
".form-error-message": {
|
|
116
|
+
"@apply mt-1.5 leading-none flex items-center text-sm": {},
|
|
117
|
+
"--tw-text-opacity": "1",
|
|
118
|
+
color: "rgba(239, 68, 68, var(--tw-text-opacity))",
|
|
119
|
+
".dark &": {
|
|
120
|
+
"--tw-text-opacity": "1",
|
|
121
|
+
color: "rgba(252, 165, 165, var(--tw-text-opacity))",
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
".form-label": {
|
|
125
|
+
"@apply text-sm font-medium text-left align-middle block mb-1.5": {},
|
|
126
|
+
|
|
127
|
+
"&-disabled": {
|
|
128
|
+
//"@apply opacity-60": {},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
".form-required-indicator": {
|
|
132
|
+
"@apply ml-1 text-sm": {},
|
|
133
|
+
"--tw-text-opacity": "1",
|
|
134
|
+
color: "rgba(239, 68, 68, var(--tw-text-opacity))",
|
|
135
|
+
".dark &": {
|
|
136
|
+
"--tw-text-opacity": "1",
|
|
137
|
+
color: "rgba(252, 165, 165, var(--tw-text-opacity))",
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function formInputGroup() {
|
|
144
|
+
return {
|
|
145
|
+
".form-input-group": {
|
|
146
|
+
"@apply flex relative": {},
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
".form-input-element": {
|
|
150
|
+
"@apply flex items-center justify-center absolute z-base top-0": {},
|
|
151
|
+
|
|
152
|
+
"&-sm": {
|
|
153
|
+
"@apply text-xs h-7 w-7": {},
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
"&-md": {
|
|
157
|
+
"@apply text-sm h-8 w-8": {},
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
"&-lg": {
|
|
161
|
+
"@apply text-base h-10 w-10": {},
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
".form-input-addon": {
|
|
167
|
+
"@apply flex items-center w-auto rounded-base shadow-sm whitespace-nowrap": {},
|
|
168
|
+
"@apply border border-neutral-300": {},
|
|
169
|
+
"@apply text-neutral-600 bg-neutral-50": {},
|
|
170
|
+
// dark colors
|
|
171
|
+
"@apply dark:border-neutral-700": {},
|
|
172
|
+
"@apply dark:text-neutral-100 dark:bg-whiteAlpha-300": {},
|
|
173
|
+
|
|
174
|
+
"&-sm": {
|
|
175
|
+
"@apply px-3 text-xs": {},
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
"&-md": {
|
|
179
|
+
"@apply px-4 text-sm": {},
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
"&-lg": {
|
|
183
|
+
"@apply px-4 text-base": {},
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
"&-left": {
|
|
187
|
+
"@apply -mr-1 rounded-r-none": {},
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
"&-right": {
|
|
191
|
+
"@apply -ml-1 rounded-l-none": {},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
module.exports = Forms = (colors) => ({
|
|
198
|
+
".form-field": {
|
|
199
|
+
"@apply placeholder-gray-stroke": {},
|
|
200
|
+
"@apply relative w-full min-w-0 inline-flex items-center appearance-none focus-visible:outline-none": {},
|
|
201
|
+
"@apply transition-colors duration-75 ease-out": {},
|
|
202
|
+
|
|
203
|
+
"&-sm": {
|
|
204
|
+
"@apply text-sm leading-sm": {},
|
|
205
|
+
borderRadius: "0.2rem",
|
|
206
|
+
padding: "1.08rem 1.44rem",
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
"&-md": {
|
|
210
|
+
"@apply text-base leading-base": {},
|
|
211
|
+
borderRadius: "0.2rem",
|
|
212
|
+
padding: "1.2rem 1.6rem",
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
"&-lg": {
|
|
216
|
+
"@apply text-lg leading-lg": {},
|
|
217
|
+
borderRadius: "0.2rem",
|
|
218
|
+
padding: "1.32rem 1.76rem",
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
"&-disabled": {
|
|
223
|
+
"@apply disabled:cursor-not-allowed": {},
|
|
224
|
+
"@apply disabled:bg-gray-lighter": {},
|
|
225
|
+
//"@apply disabled:shadow-none disabled:cursor-not-allowed disabled:opacity-60": {},
|
|
226
|
+
//"@apply disabled:border-neutral-200 disabled:bg-neutral-200": {},
|
|
227
|
+
//"@apply dark:disabled:border-transparent dark:disabled:bg-whiteAlpha-200": {},
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
// variants
|
|
231
|
+
...fieldOutline(colors),
|
|
232
|
+
...fieldSolid(colors),
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
".form-textarea": {
|
|
236
|
+
//"@apply leading-tight": {},
|
|
237
|
+
minHeight: "5rem",
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
".form-select": {
|
|
241
|
+
//"@apply pr-10": {},
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
...formInputGroup(),
|
|
245
|
+
...formControl(),
|
|
246
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
module.exports = Kbd = () => ({
|
|
2
|
+
".kbd": {
|
|
3
|
+
"@apply inline-flex justify-center items-center capitalize text-xs p-1 rounded h-5 whitespace-nowrap font-sans": {},
|
|
4
|
+
"minWidth": "1.25rem",
|
|
5
|
+
"@apply bg-blackAlpha-100 text-neutral-900": {},
|
|
6
|
+
// dark
|
|
7
|
+
"@apply dark:bg-whiteAlpha-300 dark:text-neutral-300": {},
|
|
8
|
+
},
|
|
9
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = Link = () => ({
|
|
2
|
+
".link": {
|
|
3
|
+
"@apply cursor-base no-underline outline-none hover:underline": {},
|
|
4
|
+
"@apply text-primary dark:text-primary": {},
|
|
5
|
+
"@apply focus-visible:ring-4 focus-visible:ring-primary": {},
|
|
6
|
+
|
|
7
|
+
"@apply hover:text-primary-active": {},
|
|
8
|
+
|
|
9
|
+
"&-disabled": {
|
|
10
|
+
"@apply disabled:opacity-60 disabled:cursor-not-allowed disabled:no-underline": {},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module.exports = Message = () => ({
|
|
2
|
+
".message": {
|
|
3
|
+
"@apply flex items-center px-3 py-1.5 m-2 text-sm rounded-base shadow-sm w-max break-words": {},
|
|
4
|
+
"@apply text-neutral-900 bg-white border border-neutral-200": {},
|
|
5
|
+
// dark
|
|
6
|
+
"@apply dark:text-neutral-100 dark:bg-neutral-700 dark:border-neutral-600": {},
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
".message-icon": {
|
|
10
|
+
"@apply mr-2": {},
|
|
11
|
+
|
|
12
|
+
"&-info": {
|
|
13
|
+
"--tw-text-opacity": "1",
|
|
14
|
+
color: "rgba(59, 130, 246, var(--tw-text-opacity))",
|
|
15
|
+
},
|
|
16
|
+
"&-success": {
|
|
17
|
+
"--tw-text-opacity": "1",
|
|
18
|
+
color: "rgba(34, 197, 94, var(--tw-text-opacity))",
|
|
19
|
+
},
|
|
20
|
+
"&-error": {
|
|
21
|
+
"--tw-text-opacity": "1",
|
|
22
|
+
color: "rgba(239, 68, 68, var(--tw-text-opacity))",
|
|
23
|
+
},
|
|
24
|
+
"&-warning": {
|
|
25
|
+
"--tw-text-opacity": "1",
|
|
26
|
+
color: "rgba(234, 179, 8, var(--tw-text-opacity))",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module.exports = Modal = () => ({
|
|
2
|
+
".modal": {
|
|
3
|
+
"@apply fixed inset-0 z-10 flex items-center justify-center overflow-y-auto": {},
|
|
4
|
+
|
|
5
|
+
"&-backdrop": {
|
|
6
|
+
"@apply bg-black bg-opacity-30": {},
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
"&-wrapper": {
|
|
10
|
+
"@apply flex flex-col container py-8 px-4 text-center bg-white max-w-screen-sm relative": {},
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
"&-close-btn": {
|
|
14
|
+
"@apply cursor-pointer hover:text-primary-active absolute right-8 top-6 border border-transparent focus-visible:border-black flex self-center": {},
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
"&-title": {
|
|
18
|
+
"@apply text-3xl p-4": {},
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
"&-description": {
|
|
22
|
+
"@apply text-base p-4": {},
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
"&-content-wrapper": {
|
|
26
|
+
"@apply p-4 space-y-10": {},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module.exports = Notification = () => ({
|
|
2
|
+
".notification": {
|
|
3
|
+
"@apply relative flex p-4 text-sm w-96 m-2 max-w-full rounded-base shadow-sm sm:max-w-md": {},
|
|
4
|
+
"@apply text-neutral-900 bg-white border border-neutral-200": {},
|
|
5
|
+
// dark
|
|
6
|
+
"@apply dark:text-neutral-100 dark:bg-neutral-700 dark:border-neutral-600": {},
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
".notification-icon": {
|
|
10
|
+
"@apply flex-shrink-0 w-5 h-5 mr-3": {},
|
|
11
|
+
|
|
12
|
+
"&-info": {
|
|
13
|
+
"--tw-text-opacity": "1",
|
|
14
|
+
color: "rgba(59, 130, 246, var(--tw-text-opacity))",
|
|
15
|
+
},
|
|
16
|
+
"&-success": {
|
|
17
|
+
"--tw-text-opacity": "1",
|
|
18
|
+
color: "rgba(34, 197, 94, var(--tw-text-opacity))",
|
|
19
|
+
},
|
|
20
|
+
"&-error": {
|
|
21
|
+
"--tw-text-opacity": "1",
|
|
22
|
+
color: "rgba(239, 68, 68, var(--tw-text-opacity))",
|
|
23
|
+
},
|
|
24
|
+
"&-warning": {
|
|
25
|
+
"--tw-text-opacity": "1",
|
|
26
|
+
color: "rgba(234, 179, 8, var(--tw-text-opacity))",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
".notification-content": {
|
|
31
|
+
"@apply flex flex-col items-start flex-1 mr-2 -mt-px text-left": {},
|
|
32
|
+
|
|
33
|
+
"&-title": {
|
|
34
|
+
"@apply font-semibold": {},
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
"&-description": {
|
|
38
|
+
"@apply text-neutral-500 dark:text-neutral-400": {},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
".notification-action": {
|
|
43
|
+
"@apply absolute space-x-2": {},
|
|
44
|
+
right: 16,
|
|
45
|
+
top: 16,
|
|
46
|
+
|
|
47
|
+
"&-undo": {
|
|
48
|
+
"@apply h-auto p-0 text-sm": {},
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
"&-close-button": {
|
|
52
|
+
"@apply cursor-base text-neutral-700 hover:text-neutral-900": {},
|
|
53
|
+
"@apply dark:text-neutral-400 dark:hover:text-neutral-100": {},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
module.exports = Radio = (colors) => ({
|
|
2
|
+
".form-radio": {
|
|
3
|
+
"@apply shadow-sm": {},
|
|
4
|
+
backgroundColor: "inherit",
|
|
5
|
+
"@apply border-neutral-300": {},
|
|
6
|
+
"&[aria-invalid=true]": {
|
|
7
|
+
"--tw-border-opacity": "1",
|
|
8
|
+
"borderColor": "rgba(220, 38, 38, var(--tw-border-opacity))",
|
|
9
|
+
},
|
|
10
|
+
"&[aria-invalid=true]:hover": {
|
|
11
|
+
"--tw-border-opacity": "1",
|
|
12
|
+
"border-color": "rgba(220, 38, 38, var(--tw-border-opacity))",
|
|
13
|
+
},
|
|
14
|
+
// dark colors
|
|
15
|
+
"@apply dark:border-neutral-400": {},
|
|
16
|
+
".dark &[aria-invalid=true]": {
|
|
17
|
+
"--tw-border-opacity": "1",
|
|
18
|
+
"borderColor": "rgba(248, 113, 113, var(--tw-border-opacity))",
|
|
19
|
+
},
|
|
20
|
+
".dark &[aria-invalid=true]:hover": {
|
|
21
|
+
"--tw-border-opacity": "1",
|
|
22
|
+
"borderColor": "rgba(248, 113, 113, var(--tw-border-opacity))",
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
"@media (prefers-color-scheme: dark)": {
|
|
26
|
+
"&[aria-invalid=true]": {
|
|
27
|
+
"--tw-border-opacity": "1",
|
|
28
|
+
"borderColor": "rgba(220, 38, 38, var(--tw-border-opacity))",
|
|
29
|
+
},
|
|
30
|
+
"&[aria-invalid=true]:hover": {
|
|
31
|
+
"--tw-border-opacity": "1",
|
|
32
|
+
"border-color": "rgba(220, 38, 38, var(--tw-border-opacity))",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
"&:checked": {
|
|
37
|
+
borderColor: "transparent",
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
// colors
|
|
41
|
+
...colors.reduce(
|
|
42
|
+
(styles, color) => ({
|
|
43
|
+
...styles,
|
|
44
|
+
[`&[data-color="${color}"]`]: {
|
|
45
|
+
[`@apply text-${color}-600`]: {},
|
|
46
|
+
[`@apply focus-visible:border-${color}-600 focus-visible:ring-${color}-600`]: {},
|
|
47
|
+
[`@apply dark:text-${color}-500`]: {},
|
|
48
|
+
[`@apply dark:focus-visible:border-${color}-400 dark:focus-visible:ring-${color}-400`]: {},
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
{}
|
|
52
|
+
),
|
|
53
|
+
|
|
54
|
+
"@apply dark:focus-visible:ring-offset-neutral-900": {},
|
|
55
|
+
|
|
56
|
+
// sizing
|
|
57
|
+
"&-sm": {
|
|
58
|
+
"@apply w-3 h-3": {},
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
"&-md": {
|
|
62
|
+
"@apply w-4 h-4": {},
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
"&-lg": {
|
|
66
|
+
"@apply w-5 h-5": {},
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
"&-xl": {
|
|
70
|
+
"@apply w-6 h-6": {},
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
// disabled
|
|
74
|
+
"&-disabled": {
|
|
75
|
+
"@apply disabled:shadow-none disabled:border-neutral-300 disabled:bg-neutral-300 disabled:hover:text-neutral-300": {},
|
|
76
|
+
"@apply dark:disabled:border-transparent dark:disabled:bg-whiteAlpha-200 dark:disabled:hover:text-whiteAlpha-200": {},
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
// label
|
|
80
|
+
"&-label": {
|
|
81
|
+
"@apply ml-2 select-none text-sm": {},
|
|
82
|
+
"@apply text-neutral-900": {},
|
|
83
|
+
// dark colors
|
|
84
|
+
"@apply dark:text-neutral-100": {},
|
|
85
|
+
|
|
86
|
+
"&-sm": {
|
|
87
|
+
"@apply text-xs": {},
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
"&-md": {
|
|
91
|
+
"@apply text-sm": {},
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
"&-lg": {
|
|
95
|
+
"@apply text-base": {},
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
"&-xl": {
|
|
99
|
+
"@apply text-lg": {},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
module.exports = Switch = (colors) => ({
|
|
2
|
+
".form-switch-label": {
|
|
3
|
+
"@apply inline-block align-middle": {},
|
|
4
|
+
},
|
|
5
|
+
".form-switch": {
|
|
6
|
+
"@apply rounded-full p-0.5 cursor-base focus:outline-none": {},
|
|
7
|
+
"@apply bg-gray-stroke dark:bg-neutral-700": {},
|
|
8
|
+
// Hover
|
|
9
|
+
//"@apply hover:bg-neutral-300 dark:hover:bg-neutral-600": {},
|
|
10
|
+
|
|
11
|
+
border: "0.1rem solid transparent",
|
|
12
|
+
|
|
13
|
+
"input[type=checkbox]:checked + &, input[type=checkbox][aria-checked=mixed] + &": {
|
|
14
|
+
backgroundColor: "currentColor",
|
|
15
|
+
".form-switch-box-sm": {
|
|
16
|
+
transform: "translateX(1.42rem)",
|
|
17
|
+
},
|
|
18
|
+
".form-switch-box-md": {
|
|
19
|
+
transform: "translateX(1.6rem)",
|
|
20
|
+
},
|
|
21
|
+
".form-switch-box-lg": {
|
|
22
|
+
transform: "translateX(1.78rem)",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
"input[type=checkbox]:focus-visible + &": {
|
|
29
|
+
"@apply z-base !important": {},
|
|
30
|
+
"@apply border-primary !important": {},
|
|
31
|
+
"@apply ring-4 ring-black !important": {},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
"input[type=checkbox]:checked:focus-visible + &, input[type=checkbox][aria-checked=mixed]:focus-visible + &": {
|
|
35
|
+
"@apply ring-black !important": {},
|
|
36
|
+
},
|
|
37
|
+
".dark input[type=checkbox]:checked:focus-visible + &,.dark input[type=checkbox][aria-checked=mixed]:focus-visible + &": {
|
|
38
|
+
"@apply ring-black !important": {},
|
|
39
|
+
},
|
|
40
|
+
"input[type=checkbox]:checked:hover:not(:disabled) + &, input[type=checkbox][aria-checked=mixed]:hover:not(:disabled) + &": {
|
|
41
|
+
"@apply cursor-base": {},
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// colors
|
|
45
|
+
...colors.reduce(
|
|
46
|
+
(styles, color) => ({
|
|
47
|
+
...styles,
|
|
48
|
+
[`&[data-color="${color}"]`]: {
|
|
49
|
+
[`@apply text-${color}`]: {},
|
|
50
|
+
|
|
51
|
+
"input[type=checkbox]:focus + &": {
|
|
52
|
+
borderColor: `theme('colors.${color}.DEFAULT')`,
|
|
53
|
+
boxShadow: `0 0 5px theme('colors.${color}.DEFAULT')`,
|
|
54
|
+
borderWidth: "0.1rem",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
{}
|
|
59
|
+
),
|
|
60
|
+
|
|
61
|
+
// disabled
|
|
62
|
+
"&-disabled": {
|
|
63
|
+
"@apply cursor-not-allowed": {},
|
|
64
|
+
|
|
65
|
+
"&": {
|
|
66
|
+
backgroundColor: "#ECECEC",
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
"input[type=checkbox]:not(:checked) + &-disabled .form-switch-box": {
|
|
71
|
+
"@apply bg-gray-stroke": {},
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
// sizing
|
|
76
|
+
"&-sm": {
|
|
77
|
+
height: "2.16rem",
|
|
78
|
+
width: "3.6rem",
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
"&-md": {
|
|
82
|
+
height: "2.4rem",
|
|
83
|
+
width: "4rem",
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
"&-lg": {
|
|
87
|
+
height: "2.64rem",
|
|
88
|
+
width: "4.4rem",
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
// Knob
|
|
93
|
+
".form-switch-box": {
|
|
94
|
+
"@apply transition-transform ease-in-out duration-150 transform bg-white rounded-full shadow translate-x-0": {},
|
|
95
|
+
|
|
96
|
+
// sizing
|
|
97
|
+
"&-sm": {
|
|
98
|
+
height: "1.6rem",
|
|
99
|
+
width: "1.7rem",
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
"&-md": {
|
|
103
|
+
height: "2rem",
|
|
104
|
+
width: "2rem",
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
"&-lg": {
|
|
108
|
+
height: "2.2rem",
|
|
109
|
+
width: "2.2rem",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = Table = () => ({
|
|
2
|
+
".table": {
|
|
3
|
+
"@apply min-w-full border-collapse border-gray-stroke divide-gray-lighter table-auto": {},
|
|
4
|
+
|
|
5
|
+
"&-item": {
|
|
6
|
+
"@apply px-6 py-4 border border-gray-stroke whitespace-nowrap": {},
|
|
7
|
+
|
|
8
|
+
"&:nth-child(odd)": {
|
|
9
|
+
"@apply bg-gray-lighter": {},
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
});
|