@nattui/react-components 0.0.33 → 0.0.35
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/{button.module-BMN5S7JE.module.css → button.module-NXMK7IBS.module.css} +5 -12
- package/dist/index.d.ts +43 -1
- package/dist/index.js +105 -27
- package/dist/{input.module-FRZMYZZD.module.css → input.module-45RAFIJZ.module.css} +28 -24
- package/dist/switch.module-SEKLTDNC.module.css +62 -0
- package/dist/textarea.module-6GUVSFC7.module.css +9 -0
- package/package.json +32 -29
|
@@ -52,14 +52,7 @@
|
|
|
52
52
|
/* Rounded */
|
|
53
53
|
/* ===================================================== */
|
|
54
54
|
.button__rounded_base {
|
|
55
|
-
border-radius:
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
@supports (corner-shape: squircle) {
|
|
59
|
-
.button__rounded_base {
|
|
60
|
-
border-radius: 9999px;
|
|
61
|
-
corner-shape: squircle;
|
|
62
|
-
}
|
|
55
|
+
border-radius: 12px;
|
|
63
56
|
}
|
|
64
57
|
|
|
65
58
|
.button__rounded_full {
|
|
@@ -217,8 +210,8 @@
|
|
|
217
210
|
color-mix(in oklab, transparent 100%, #000000 2.5%) 50%
|
|
218
211
|
);
|
|
219
212
|
box-shadow:
|
|
220
|
-
0 -1px 0 0px rgba(0, 0, 0, 7.5%) inset,
|
|
221
|
-
0 0 0 1px var(--color-gray-4) inset; /* Border */
|
|
213
|
+
0 -1px 0 0px rgba(0, 0, 0, 7.5%) inset,
|
|
214
|
+
/* Bottom */ 0 0 0 1px var(--color-gray-4) inset; /* Border */
|
|
222
215
|
}
|
|
223
216
|
|
|
224
217
|
.button__variant_secondary:active:enabled,
|
|
@@ -241,8 +234,8 @@
|
|
|
241
234
|
color-mix(in oklab, transparent 100%, #ffffff 0%) 50%
|
|
242
235
|
);
|
|
243
236
|
box-shadow:
|
|
244
|
-
0 1px 0 0px rgba(255, 255, 255, 7.5%) inset,
|
|
245
|
-
0 0 0 1px var(--color-gray-4) inset; /* Border */
|
|
237
|
+
0 1px 0 0px rgba(255, 255, 255, 7.5%) inset,
|
|
238
|
+
/* Top */ 0 0 0 1px var(--color-gray-4) inset; /* Border */
|
|
246
239
|
}
|
|
247
240
|
|
|
248
241
|
/* ===================================================== */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode, JSX } from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { Switch as Switch$1 } from '@base-ui/react';
|
|
3
4
|
|
|
4
5
|
interface ButtonIconProps extends ButtonPropsInternal {
|
|
5
6
|
children?: ReactNode;
|
|
@@ -57,6 +58,7 @@ interface InputProps extends Omit<ComponentProps<"input">, "aria-pressed" | "dis
|
|
|
57
58
|
isInvalid?: boolean;
|
|
58
59
|
isReadOnly?: boolean;
|
|
59
60
|
isRequired?: boolean;
|
|
61
|
+
isRounded?: boolean;
|
|
60
62
|
isValid?: boolean;
|
|
61
63
|
size?: 32 | 36 | 40 | 44 | 48;
|
|
62
64
|
}
|
|
@@ -64,6 +66,10 @@ declare function Input(props: InputProps): JSX.Element;
|
|
|
64
66
|
declare const INPUT_CLASS_NAME: {
|
|
65
67
|
readonly BASE: string;
|
|
66
68
|
readonly PASSWORD: string;
|
|
69
|
+
readonly ROUNDED: {
|
|
70
|
+
readonly BASE: string;
|
|
71
|
+
readonly FULL: string;
|
|
72
|
+
};
|
|
67
73
|
readonly SIZE: {
|
|
68
74
|
readonly 32: string;
|
|
69
75
|
readonly 36: string;
|
|
@@ -87,4 +93,40 @@ declare const SPACER_CLASS_NAME: {
|
|
|
87
93
|
readonly BASE: string;
|
|
88
94
|
};
|
|
89
95
|
|
|
90
|
-
|
|
96
|
+
interface SwitchProps extends Omit<ComponentProps<typeof Switch$1.Root>, "checked" | "defaultChecked" | "disabled" | "nativeButton" | "readOnly" | "required"> {
|
|
97
|
+
isChecked?: boolean;
|
|
98
|
+
isDefaultChecked?: boolean;
|
|
99
|
+
isDisabled?: boolean;
|
|
100
|
+
isReadOnly?: boolean;
|
|
101
|
+
isRequired?: boolean;
|
|
102
|
+
size?: 14 | 24;
|
|
103
|
+
}
|
|
104
|
+
declare function Switch(props: SwitchProps): JSX.Element;
|
|
105
|
+
declare const SWITCH_CLASS_NAME: {
|
|
106
|
+
readonly BASE: string;
|
|
107
|
+
readonly SIZE: {
|
|
108
|
+
readonly 14: string;
|
|
109
|
+
readonly 24: string;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
interface TextareaProps extends Omit<ComponentProps<"textarea">, "aria-pressed" | "disabled" | "readOnly" | "required"> {
|
|
114
|
+
isActive?: boolean;
|
|
115
|
+
isDisabled?: boolean;
|
|
116
|
+
isInvalid?: boolean;
|
|
117
|
+
isReadOnly?: boolean;
|
|
118
|
+
isRequired?: boolean;
|
|
119
|
+
isRounded?: boolean;
|
|
120
|
+
isValid?: boolean;
|
|
121
|
+
}
|
|
122
|
+
declare function Textarea(props: TextareaProps): JSX.Element;
|
|
123
|
+
declare const TEXTAREA_CLASS_NAME: {
|
|
124
|
+
readonly BASE: string;
|
|
125
|
+
readonly INPUT: string;
|
|
126
|
+
readonly ROUNDED: {
|
|
127
|
+
readonly BASE: string;
|
|
128
|
+
readonly FULL: string;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export { BUTTON_CLASS_NAME, Button, type ButtonIconProps, type ButtonProps, INPUT_CLASS_NAME, Input, type InputProps, LABEL_CLASS_NAME, Label, type LabelProps, SPACER_CLASS_NAME, SWITCH_CLASS_NAME, Spacer, type SpacerProps, Switch, type SwitchProps, TEXTAREA_CLASS_NAME, Textarea, type TextareaProps };
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
// src/button.tsx
|
|
2
|
-
import styles2 from "./button.module-BMN5S7JE.module.css";
|
|
3
|
-
|
|
4
1
|
// src/button-spinner.tsx
|
|
5
2
|
import styles from "./button-spinner.module-T3OGVJS4.module.css";
|
|
6
3
|
import { jsx } from "react/jsx-runtime";
|
|
7
4
|
function ButtonSpinner(props) {
|
|
8
5
|
const { size = 16 } = props;
|
|
9
|
-
return /* @__PURE__ */ jsx(
|
|
10
|
-
"div",
|
|
11
|
-
{
|
|
12
|
-
className: styles.button_spinner,
|
|
13
|
-
style: { "--size": `${size}px` },
|
|
14
|
-
children: Array.from({ length: 12 }).map((_, index) => /* @__PURE__ */ jsx("div", {}, index))
|
|
15
|
-
}
|
|
16
|
-
);
|
|
6
|
+
return /* @__PURE__ */ jsx("div", { className: styles.button_spinner, style: { "--size": `${size}px` }, children: Array.from({ length: 12 }).map((_, index) => /* @__PURE__ */ jsx("div", {}, index)) });
|
|
17
7
|
}
|
|
18
8
|
|
|
19
9
|
// src/button.tsx
|
|
10
|
+
import styles2 from "./button.module-NXMK7IBS.module.css";
|
|
20
11
|
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
21
12
|
function Button(props) {
|
|
22
13
|
const {
|
|
@@ -88,7 +79,7 @@ var BUTTON_CLASS_NAME = {
|
|
|
88
79
|
};
|
|
89
80
|
|
|
90
81
|
// src/input.tsx
|
|
91
|
-
import styles3 from "./input.module-
|
|
82
|
+
import styles3 from "./input.module-45RAFIJZ.module.css";
|
|
92
83
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
93
84
|
function Input(props) {
|
|
94
85
|
const {
|
|
@@ -98,6 +89,7 @@ function Input(props) {
|
|
|
98
89
|
isInvalid = void 0,
|
|
99
90
|
isReadOnly = false,
|
|
100
91
|
isRequired = false,
|
|
92
|
+
isRounded = false,
|
|
101
93
|
isValid = void 0,
|
|
102
94
|
size = 40,
|
|
103
95
|
type = "text",
|
|
@@ -108,13 +100,14 @@ function Input(props) {
|
|
|
108
100
|
${INPUT_CLASS_NAME.BASE}
|
|
109
101
|
${INPUT_CLASS_NAME.SIZE[size]}
|
|
110
102
|
${isPassword ? INPUT_CLASS_NAME.PASSWORD : ""}
|
|
103
|
+
${isRounded ? INPUT_CLASS_NAME.ROUNDED.FULL : INPUT_CLASS_NAME.ROUNDED.BASE}
|
|
111
104
|
${customClassName}
|
|
112
105
|
`.replaceAll(/\s+/g, " ").trim();
|
|
113
106
|
return /* @__PURE__ */ jsx3(
|
|
114
107
|
"input",
|
|
115
108
|
{
|
|
116
|
-
"aria-pressed": isActive,
|
|
117
109
|
className: combinedClassName,
|
|
110
|
+
"data-is-active": isActive,
|
|
118
111
|
"data-is-invalid": isInvalid,
|
|
119
112
|
"data-is-valid": isValid,
|
|
120
113
|
disabled: isDisabled,
|
|
@@ -128,6 +121,10 @@ function Input(props) {
|
|
|
128
121
|
var INPUT_CLASS_NAME = {
|
|
129
122
|
BASE: styles3.input,
|
|
130
123
|
PASSWORD: styles3.input__password,
|
|
124
|
+
ROUNDED: {
|
|
125
|
+
BASE: styles3.input__rounded_base,
|
|
126
|
+
FULL: styles3.input__rounded_full
|
|
127
|
+
},
|
|
131
128
|
SIZE: {
|
|
132
129
|
32: styles3.input__size_32,
|
|
133
130
|
36: styles3.input__size_36,
|
|
@@ -141,18 +138,12 @@ var INPUT_CLASS_NAME = {
|
|
|
141
138
|
import styles4 from "./label.module-HUBUIUFV.module.css";
|
|
142
139
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
143
140
|
function Label(props) {
|
|
144
|
-
const { className: customClassName = "", ...rest } = props;
|
|
141
|
+
const { className: customClassName = "", htmlFor = void 0, children = "", ...rest } = props;
|
|
145
142
|
const combinedClassName = `
|
|
146
143
|
${LABEL_CLASS_NAME.BASE}
|
|
147
144
|
${customClassName}
|
|
148
145
|
`.replaceAll(/\s+/g, " ").trim();
|
|
149
|
-
return /* @__PURE__ */ jsx4(
|
|
150
|
-
"label",
|
|
151
|
-
{
|
|
152
|
-
className: combinedClassName,
|
|
153
|
-
...rest
|
|
154
|
-
}
|
|
155
|
-
);
|
|
146
|
+
return /* @__PURE__ */ jsx4("label", { className: combinedClassName, htmlFor, ...rest, children });
|
|
156
147
|
}
|
|
157
148
|
var LABEL_CLASS_NAME = {
|
|
158
149
|
BASE: styles4.label
|
|
@@ -167,16 +158,99 @@ function Spacer(props) {
|
|
|
167
158
|
${SPACER_CLASS_NAME.BASE}
|
|
168
159
|
${customClassName}
|
|
169
160
|
`.replaceAll(/\s+/g, " ").trim();
|
|
170
|
-
return /* @__PURE__ */ jsx5(
|
|
171
|
-
|
|
161
|
+
return /* @__PURE__ */ jsx5("div", { className: `${styles5.spacer} ${combinedClassName}`.trim(), ...rest });
|
|
162
|
+
}
|
|
163
|
+
var SPACER_CLASS_NAME = {
|
|
164
|
+
BASE: styles5.spacer
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// src/switch.tsx
|
|
168
|
+
import { Switch as BaseSwitch } from "@base-ui/react";
|
|
169
|
+
import styles6 from "./switch.module-SEKLTDNC.module.css";
|
|
170
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
171
|
+
function Switch(props) {
|
|
172
|
+
const {
|
|
173
|
+
className: customClassName = "",
|
|
174
|
+
isChecked = void 0,
|
|
175
|
+
isDefaultChecked = false,
|
|
176
|
+
isDisabled = false,
|
|
177
|
+
isReadOnly = false,
|
|
178
|
+
isRequired = false,
|
|
179
|
+
size = 24,
|
|
180
|
+
...rest
|
|
181
|
+
} = props;
|
|
182
|
+
const combinedClassName = `
|
|
183
|
+
${SWITCH_CLASS_NAME.BASE}
|
|
184
|
+
${SWITCH_CLASS_NAME.SIZE[size]}
|
|
185
|
+
${customClassName}
|
|
186
|
+
`.replaceAll(/\s+/g, " ").trim();
|
|
187
|
+
return /* @__PURE__ */ jsx6(
|
|
188
|
+
BaseSwitch.Root,
|
|
172
189
|
{
|
|
173
|
-
|
|
190
|
+
checked: isChecked,
|
|
191
|
+
className: combinedClassName,
|
|
192
|
+
defaultChecked: isDefaultChecked,
|
|
193
|
+
disabled: isDisabled,
|
|
194
|
+
readOnly: isReadOnly,
|
|
195
|
+
required: isRequired,
|
|
196
|
+
...rest,
|
|
197
|
+
children: /* @__PURE__ */ jsx6(BaseSwitch.Thumb, { className: styles6.switch__thumb })
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
var SWITCH_CLASS_NAME = {
|
|
202
|
+
BASE: styles6.switch,
|
|
203
|
+
SIZE: {
|
|
204
|
+
14: styles6.switch__size_14,
|
|
205
|
+
24: styles6.switch__size_24
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
// src/textarea.tsx
|
|
210
|
+
import inputStyles from "./input.module-45RAFIJZ.module.css";
|
|
211
|
+
import styles7 from "./textarea.module-6GUVSFC7.module.css";
|
|
212
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
213
|
+
function Textarea(props) {
|
|
214
|
+
const {
|
|
215
|
+
className: customClassName = "",
|
|
216
|
+
isActive = false,
|
|
217
|
+
isDisabled = false,
|
|
218
|
+
isInvalid = void 0,
|
|
219
|
+
isReadOnly = false,
|
|
220
|
+
isRequired = false,
|
|
221
|
+
isRounded = false,
|
|
222
|
+
isValid = void 0,
|
|
223
|
+
rows = 2,
|
|
224
|
+
...rest
|
|
225
|
+
} = props;
|
|
226
|
+
const combinedClassName = `
|
|
227
|
+
${TEXTAREA_CLASS_NAME.INPUT}
|
|
228
|
+
${TEXTAREA_CLASS_NAME.BASE}
|
|
229
|
+
${isRounded ? TEXTAREA_CLASS_NAME.ROUNDED.FULL : TEXTAREA_CLASS_NAME.ROUNDED.BASE}
|
|
230
|
+
${customClassName}
|
|
231
|
+
`.replaceAll(/\s+/g, " ").trim();
|
|
232
|
+
return /* @__PURE__ */ jsx7(
|
|
233
|
+
"textarea",
|
|
234
|
+
{
|
|
235
|
+
className: combinedClassName,
|
|
236
|
+
"data-is-active": isActive,
|
|
237
|
+
"data-is-invalid": isInvalid,
|
|
238
|
+
"data-is-valid": isValid,
|
|
239
|
+
disabled: isDisabled,
|
|
240
|
+
readOnly: isReadOnly,
|
|
241
|
+
required: isRequired,
|
|
242
|
+
rows,
|
|
174
243
|
...rest
|
|
175
244
|
}
|
|
176
245
|
);
|
|
177
246
|
}
|
|
178
|
-
var
|
|
179
|
-
BASE:
|
|
247
|
+
var TEXTAREA_CLASS_NAME = {
|
|
248
|
+
BASE: styles7.textarea,
|
|
249
|
+
INPUT: inputStyles.input,
|
|
250
|
+
ROUNDED: {
|
|
251
|
+
BASE: inputStyles.input__rounded_base,
|
|
252
|
+
FULL: inputStyles.input__rounded_full
|
|
253
|
+
}
|
|
180
254
|
};
|
|
181
255
|
export {
|
|
182
256
|
BUTTON_CLASS_NAME,
|
|
@@ -186,5 +260,9 @@ export {
|
|
|
186
260
|
LABEL_CLASS_NAME,
|
|
187
261
|
Label,
|
|
188
262
|
SPACER_CLASS_NAME,
|
|
189
|
-
|
|
263
|
+
SWITCH_CLASS_NAME,
|
|
264
|
+
Spacer,
|
|
265
|
+
Switch,
|
|
266
|
+
TEXTAREA_CLASS_NAME,
|
|
267
|
+
Textarea
|
|
190
268
|
};
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
/* ===================================================== */
|
|
4
4
|
.input {
|
|
5
5
|
width: 100%;
|
|
6
|
-
min-height: var(--
|
|
7
|
-
max-height: var(--
|
|
6
|
+
min-height: var(--height);
|
|
7
|
+
max-height: var(--height);
|
|
8
8
|
padding: 0 12px;
|
|
9
9
|
font-family: var(--font-sans, sans-serif);
|
|
10
10
|
font-size: 14px;
|
|
@@ -21,19 +21,12 @@
|
|
|
21
21
|
background-color: var(--color-gray-1, #fcfcfc);
|
|
22
22
|
border-style: none;
|
|
23
23
|
box-shadow:
|
|
24
|
-
0 -1px 0 0px rgba(0, 0, 0, 7.5%) inset,
|
|
25
|
-
0 0 0 1px var(--color-gray-4) inset; /* Border */
|
|
24
|
+
0 -1px 0 0px rgba(0, 0, 0, 7.5%) inset,
|
|
25
|
+
/* Bottom */ 0 0 0 1px var(--color-gray-4) inset; /* Border */
|
|
26
26
|
transition-duration: 150ms;
|
|
27
27
|
transition-property: box-shadow, opacity;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
@supports (corner-shape: squircle) {
|
|
31
|
-
.input {
|
|
32
|
-
border-radius: 9999px;
|
|
33
|
-
corner-shape: squircle;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
30
|
.input::placeholder {
|
|
38
31
|
color: var(--color-gray-9, #8d8d8d);
|
|
39
32
|
user-select: none;
|
|
@@ -47,10 +40,10 @@
|
|
|
47
40
|
.input:enabled:active,
|
|
48
41
|
.input:enabled:focus,
|
|
49
42
|
.input:enabled:hover,
|
|
50
|
-
.input:enabled[
|
|
43
|
+
.input:enabled[data-is-active="true"] {
|
|
51
44
|
box-shadow:
|
|
52
|
-
0 -1px 0 0px rgba(0, 0, 0, 7.5%) inset,
|
|
53
|
-
0 0 0 1px var(--color-gray-6) inset; /* Border */
|
|
45
|
+
0 -1px 0 0px rgba(0, 0, 0, 7.5%) inset,
|
|
46
|
+
/* Bottom */ 0 0 0 1px var(--color-gray-6) inset; /* Border */
|
|
54
47
|
}
|
|
55
48
|
|
|
56
49
|
.input[data-is-valid="true"] {
|
|
@@ -69,17 +62,17 @@
|
|
|
69
62
|
:global(.dark) .input {
|
|
70
63
|
background-color: var(--color-gray-2, #101010);
|
|
71
64
|
box-shadow:
|
|
72
|
-
0 1px 0 0px rgba(255, 255, 255, 7.5%) inset,
|
|
73
|
-
0 0 0 1px var(--color-gray-4) inset; /* Border */
|
|
65
|
+
0 1px 0 0px rgba(255, 255, 255, 7.5%) inset,
|
|
66
|
+
/* Top */ 0 0 0 1px var(--color-gray-4) inset; /* Border */
|
|
74
67
|
}
|
|
75
68
|
|
|
76
69
|
:global(.dark) .input:enabled:active,
|
|
77
70
|
:global(.dark) .input:enabled:focus,
|
|
78
71
|
:global(.dark) .input:enabled:hover,
|
|
79
|
-
:global(.dark) .input:enabled[
|
|
72
|
+
:global(.dark) .input:enabled[data-is-active="true"] {
|
|
80
73
|
box-shadow:
|
|
81
|
-
0 1px 0 0px rgba(255, 255, 255, 7.5%) inset,
|
|
82
|
-
0 0 0 1px var(--color-gray-6) inset; /* Border */
|
|
74
|
+
0 1px 0 0px rgba(255, 255, 255, 7.5%) inset,
|
|
75
|
+
/* Top */ 0 0 0 1px var(--color-gray-6) inset; /* Border */
|
|
83
76
|
}
|
|
84
77
|
|
|
85
78
|
/* ===================================================== */
|
|
@@ -89,25 +82,36 @@
|
|
|
89
82
|
font-family: var(--font-mono, monospace);
|
|
90
83
|
}
|
|
91
84
|
|
|
85
|
+
/* ===================================================== */
|
|
86
|
+
/* Rounded */
|
|
87
|
+
/* ===================================================== */
|
|
88
|
+
.input__rounded_base {
|
|
89
|
+
border-radius: 12px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.input__rounded_full {
|
|
93
|
+
border-radius: 9999px;
|
|
94
|
+
}
|
|
95
|
+
|
|
92
96
|
/* ===================================================== */
|
|
93
97
|
/* Size */
|
|
94
98
|
/* ===================================================== */
|
|
95
99
|
.input__size_32 {
|
|
96
|
-
--
|
|
100
|
+
--height: 32px;
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
.input__size_36 {
|
|
100
|
-
--
|
|
104
|
+
--height: 36px;
|
|
101
105
|
}
|
|
102
106
|
|
|
103
107
|
.input__size_40 {
|
|
104
|
-
--
|
|
108
|
+
--height: 40px;
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
.input__size_44 {
|
|
108
|
-
--
|
|
112
|
+
--height: 44px;
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
.input__size_48 {
|
|
112
|
-
--
|
|
116
|
+
--height: 48px;
|
|
113
117
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/* ===================================================== */
|
|
2
|
+
/* Base */
|
|
3
|
+
/* ===================================================== */
|
|
4
|
+
.switch {
|
|
5
|
+
display: flex;
|
|
6
|
+
padding: 2px;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
outline-width: 2px;
|
|
10
|
+
outline-style: none;
|
|
11
|
+
outline-color: var(--color-primary-9);
|
|
12
|
+
outline-offset: 2px;
|
|
13
|
+
background-color: var(--color-gray-6);
|
|
14
|
+
border-radius: 9999px;
|
|
15
|
+
transition-duration: 150ms;
|
|
16
|
+
transition-property: background-color;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.switch:focus-visible {
|
|
20
|
+
outline-style: solid;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.switch[data-checked] {
|
|
24
|
+
background-color: var(--color-primary-9);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.switch[data-disabled] {
|
|
28
|
+
cursor: not-allowed;
|
|
29
|
+
opacity: 0.5;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* ===================================================== */
|
|
33
|
+
/* Thumb */
|
|
34
|
+
/* ===================================================== */
|
|
35
|
+
|
|
36
|
+
.switch__thumb {
|
|
37
|
+
height: 100%;
|
|
38
|
+
aspect-ratio: 1 / 1;
|
|
39
|
+
background-color: var(--color-white);
|
|
40
|
+
border-radius: 9999px;
|
|
41
|
+
transition-duration: 150ms;
|
|
42
|
+
transition-property: transform;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.switch__thumb[data-checked] {
|
|
46
|
+
transform: translateX(var(--translateX));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* ===================================================== */
|
|
50
|
+
/* Size */
|
|
51
|
+
/* ===================================================== */
|
|
52
|
+
.switch__size_14 {
|
|
53
|
+
--translateX: 12px;
|
|
54
|
+
width: 30px;
|
|
55
|
+
height: 18px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.switch__size_24 {
|
|
59
|
+
--translateX: 16px;
|
|
60
|
+
width: 40px;
|
|
61
|
+
height: 24px;
|
|
62
|
+
}
|
package/package.json
CHANGED
|
@@ -1,50 +1,53 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"name": "@nattui/react-components",
|
|
3
|
+
"version": "0.0.35",
|
|
4
|
+
"description": "A collection of reusable React components built with TypeScript and CSS Modules",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"components",
|
|
7
|
+
"react",
|
|
8
|
+
"ui"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/nattui/react-components#readme",
|
|
3
11
|
"bugs": {
|
|
4
12
|
"url": "https://github.com/nattui/react-components/issues"
|
|
5
13
|
},
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"typescript": "catalog:"
|
|
11
|
-
},
|
|
12
|
-
"exports": {
|
|
13
|
-
".": {
|
|
14
|
-
"import": "./dist/index.js",
|
|
15
|
-
"types": "./dist/index.d.ts"
|
|
16
|
-
}
|
|
14
|
+
"author": "Natt Nguyen <hello@natt.sh> (https://natt.sh)",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/nattui/react-components.git"
|
|
17
18
|
},
|
|
18
19
|
"files": [
|
|
19
20
|
"dist"
|
|
20
21
|
],
|
|
21
|
-
"
|
|
22
|
-
"keywords": [
|
|
23
|
-
"components",
|
|
24
|
-
"react",
|
|
25
|
-
"ui"
|
|
26
|
-
],
|
|
22
|
+
"type": "module",
|
|
27
23
|
"main": "./dist/index.js",
|
|
28
24
|
"module": "./dist/index.js",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
}
|
|
33
31
|
},
|
|
34
32
|
"publishConfig": {
|
|
35
33
|
"access": "public"
|
|
36
34
|
},
|
|
37
|
-
"repository": {
|
|
38
|
-
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/nattui/react-components.git"
|
|
40
|
-
},
|
|
41
35
|
"scripts": {
|
|
42
36
|
"build": "tsup",
|
|
43
37
|
"check:type": "tsc",
|
|
44
38
|
"dev": "tsup --watch",
|
|
45
39
|
"prepublishOnly": "pnpm run build"
|
|
46
40
|
},
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@base-ui/react": "1.1.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/react": "catalog:",
|
|
46
|
+
"tsup": "8.5.1",
|
|
47
|
+
"typescript": "catalog:"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
51
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
52
|
+
}
|
|
50
53
|
}
|