@nattui/react-components 0.0.34 → 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-VWVBUUZO.module.css → button.module-NXMK7IBS.module.css} +4 -4
- package/dist/index.d.ts +10 -2
- package/dist/index.js +21 -32
- package/dist/{input.module-7OP5B7X3.module.css → input.module-45RAFIJZ.module.css} +10 -10
- package/dist/{switch.module-QVZRQ4BT.module.css → switch.module-SEKLTDNC.module.css} +17 -3
- package/package.json +32 -32
|
@@ -210,8 +210,8 @@
|
|
|
210
210
|
color-mix(in oklab, transparent 100%, #000000 2.5%) 50%
|
|
211
211
|
);
|
|
212
212
|
box-shadow:
|
|
213
|
-
0 -1px 0 0px rgba(0, 0, 0, 7.5%) inset,
|
|
214
|
-
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 */
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
.button__variant_secondary:active:enabled,
|
|
@@ -234,8 +234,8 @@
|
|
|
234
234
|
color-mix(in oklab, transparent 100%, #ffffff 0%) 50%
|
|
235
235
|
);
|
|
236
236
|
box-shadow:
|
|
237
|
-
0 1px 0 0px rgba(255, 255, 255, 7.5%) inset,
|
|
238
|
-
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 */
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
/* ===================================================== */
|
package/dist/index.d.ts
CHANGED
|
@@ -93,14 +93,22 @@ declare const SPACER_CLASS_NAME: {
|
|
|
93
93
|
readonly BASE: string;
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
interface SwitchProps extends Omit<ComponentProps<typeof Switch$1.Root>, "checked" | "defaultChecked" | "disabled" | "
|
|
96
|
+
interface SwitchProps extends Omit<ComponentProps<typeof Switch$1.Root>, "checked" | "defaultChecked" | "disabled" | "nativeButton" | "readOnly" | "required"> {
|
|
97
97
|
isChecked?: boolean;
|
|
98
98
|
isDefaultChecked?: boolean;
|
|
99
99
|
isDisabled?: boolean;
|
|
100
100
|
isReadOnly?: boolean;
|
|
101
101
|
isRequired?: boolean;
|
|
102
|
+
size?: 14 | 24;
|
|
102
103
|
}
|
|
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
|
+
};
|
|
104
112
|
|
|
105
113
|
interface TextareaProps extends Omit<ComponentProps<"textarea">, "aria-pressed" | "disabled" | "readOnly" | "required"> {
|
|
106
114
|
isActive?: boolean;
|
|
@@ -121,4 +129,4 @@ declare const TEXTAREA_CLASS_NAME: {
|
|
|
121
129
|
};
|
|
122
130
|
};
|
|
123
131
|
|
|
124
|
-
export { BUTTON_CLASS_NAME, Button, type ButtonIconProps, type ButtonProps, INPUT_CLASS_NAME, Input, type InputProps, LABEL_CLASS_NAME, Label, type LabelProps, SPACER_CLASS_NAME, Spacer, type SpacerProps, Switch, type SwitchProps, TEXTAREA_CLASS_NAME, Textarea, type TextareaProps };
|
|
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-VWVBUUZO.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 {
|
|
@@ -115,8 +106,8 @@ function Input(props) {
|
|
|
115
106
|
return /* @__PURE__ */ jsx3(
|
|
116
107
|
"input",
|
|
117
108
|
{
|
|
118
|
-
"aria-pressed": isActive,
|
|
119
109
|
className: combinedClassName,
|
|
110
|
+
"data-is-active": isActive,
|
|
120
111
|
"data-is-invalid": isInvalid,
|
|
121
112
|
"data-is-valid": isValid,
|
|
122
113
|
disabled: isDisabled,
|
|
@@ -147,18 +138,12 @@ var INPUT_CLASS_NAME = {
|
|
|
147
138
|
import styles4 from "./label.module-HUBUIUFV.module.css";
|
|
148
139
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
149
140
|
function Label(props) {
|
|
150
|
-
const { className: customClassName = "", ...rest } = props;
|
|
141
|
+
const { className: customClassName = "", htmlFor = void 0, children = "", ...rest } = props;
|
|
151
142
|
const combinedClassName = `
|
|
152
143
|
${LABEL_CLASS_NAME.BASE}
|
|
153
144
|
${customClassName}
|
|
154
145
|
`.replaceAll(/\s+/g, " ").trim();
|
|
155
|
-
return /* @__PURE__ */ jsx4(
|
|
156
|
-
"label",
|
|
157
|
-
{
|
|
158
|
-
className: combinedClassName,
|
|
159
|
-
...rest
|
|
160
|
-
}
|
|
161
|
-
);
|
|
146
|
+
return /* @__PURE__ */ jsx4("label", { className: combinedClassName, htmlFor, ...rest, children });
|
|
162
147
|
}
|
|
163
148
|
var LABEL_CLASS_NAME = {
|
|
164
149
|
BASE: styles4.label
|
|
@@ -173,13 +158,7 @@ function Spacer(props) {
|
|
|
173
158
|
${SPACER_CLASS_NAME.BASE}
|
|
174
159
|
${customClassName}
|
|
175
160
|
`.replaceAll(/\s+/g, " ").trim();
|
|
176
|
-
return /* @__PURE__ */ jsx5(
|
|
177
|
-
"div",
|
|
178
|
-
{
|
|
179
|
-
className: `${styles5.spacer} ${combinedClassName}`.trim(),
|
|
180
|
-
...rest
|
|
181
|
-
}
|
|
182
|
-
);
|
|
161
|
+
return /* @__PURE__ */ jsx5("div", { className: `${styles5.spacer} ${combinedClassName}`.trim(), ...rest });
|
|
183
162
|
}
|
|
184
163
|
var SPACER_CLASS_NAME = {
|
|
185
164
|
BASE: styles5.spacer
|
|
@@ -187,7 +166,7 @@ var SPACER_CLASS_NAME = {
|
|
|
187
166
|
|
|
188
167
|
// src/switch.tsx
|
|
189
168
|
import { Switch as BaseSwitch } from "@base-ui/react";
|
|
190
|
-
import styles6 from "./switch.module-
|
|
169
|
+
import styles6 from "./switch.module-SEKLTDNC.module.css";
|
|
191
170
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
192
171
|
function Switch(props) {
|
|
193
172
|
const {
|
|
@@ -197,10 +176,12 @@ function Switch(props) {
|
|
|
197
176
|
isDisabled = false,
|
|
198
177
|
isReadOnly = false,
|
|
199
178
|
isRequired = false,
|
|
179
|
+
size = 24,
|
|
200
180
|
...rest
|
|
201
181
|
} = props;
|
|
202
182
|
const combinedClassName = `
|
|
203
|
-
${
|
|
183
|
+
${SWITCH_CLASS_NAME.BASE}
|
|
184
|
+
${SWITCH_CLASS_NAME.SIZE[size]}
|
|
204
185
|
${customClassName}
|
|
205
186
|
`.replaceAll(/\s+/g, " ").trim();
|
|
206
187
|
return /* @__PURE__ */ jsx6(
|
|
@@ -217,9 +198,16 @@ function Switch(props) {
|
|
|
217
198
|
}
|
|
218
199
|
);
|
|
219
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
|
+
};
|
|
220
208
|
|
|
221
209
|
// src/textarea.tsx
|
|
222
|
-
import inputStyles from "./input.module-
|
|
210
|
+
import inputStyles from "./input.module-45RAFIJZ.module.css";
|
|
223
211
|
import styles7 from "./textarea.module-6GUVSFC7.module.css";
|
|
224
212
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
225
213
|
function Textarea(props) {
|
|
@@ -244,8 +232,8 @@ function Textarea(props) {
|
|
|
244
232
|
return /* @__PURE__ */ jsx7(
|
|
245
233
|
"textarea",
|
|
246
234
|
{
|
|
247
|
-
"aria-pressed": isActive,
|
|
248
235
|
className: combinedClassName,
|
|
236
|
+
"data-is-active": isActive,
|
|
249
237
|
"data-is-invalid": isInvalid,
|
|
250
238
|
"data-is-valid": isValid,
|
|
251
239
|
disabled: isDisabled,
|
|
@@ -272,6 +260,7 @@ export {
|
|
|
272
260
|
LABEL_CLASS_NAME,
|
|
273
261
|
Label,
|
|
274
262
|
SPACER_CLASS_NAME,
|
|
263
|
+
SWITCH_CLASS_NAME,
|
|
275
264
|
Spacer,
|
|
276
265
|
Switch,
|
|
277
266
|
TEXTAREA_CLASS_NAME,
|
|
@@ -21,8 +21,8 @@
|
|
|
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
|
}
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
.input:enabled:active,
|
|
41
41
|
.input:enabled:focus,
|
|
42
42
|
.input:enabled:hover,
|
|
43
|
-
.input:enabled[
|
|
43
|
+
.input:enabled[data-is-active="true"] {
|
|
44
44
|
box-shadow:
|
|
45
|
-
0 -1px 0 0px rgba(0, 0, 0, 7.5%) inset,
|
|
46
|
-
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 */
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.input[data-is-valid="true"] {
|
|
@@ -62,17 +62,17 @@
|
|
|
62
62
|
:global(.dark) .input {
|
|
63
63
|
background-color: var(--color-gray-2, #101010);
|
|
64
64
|
box-shadow:
|
|
65
|
-
0 1px 0 0px rgba(255, 255, 255, 7.5%) inset,
|
|
66
|
-
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 */
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
:global(.dark) .input:enabled:active,
|
|
70
70
|
:global(.dark) .input:enabled:focus,
|
|
71
71
|
:global(.dark) .input:enabled:hover,
|
|
72
|
-
:global(.dark) .input:enabled[
|
|
72
|
+
:global(.dark) .input:enabled[data-is-active="true"] {
|
|
73
73
|
box-shadow:
|
|
74
|
-
0 1px 0 0px rgba(255, 255, 255, 7.5%) inset,
|
|
75
|
-
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 */
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/* ===================================================== */
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
/* ===================================================== */
|
|
4
4
|
.switch {
|
|
5
5
|
display: flex;
|
|
6
|
-
width: 40px;
|
|
7
|
-
height: 24px;
|
|
8
6
|
padding: 2px;
|
|
7
|
+
overflow: hidden;
|
|
9
8
|
cursor: pointer;
|
|
10
9
|
outline-width: 2px;
|
|
11
10
|
outline-style: none;
|
|
@@ -44,5 +43,20 @@
|
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
.switch__thumb[data-checked] {
|
|
47
|
-
transform: translateX(
|
|
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;
|
|
48
62
|
}
|
package/package.json
CHANGED
|
@@ -1,53 +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
|
-
"devDependencies": {
|
|
11
|
-
"@types/react": "catalog:",
|
|
12
|
-
"tsup": "8.5.1",
|
|
13
|
-
"typescript": "catalog:"
|
|
14
|
-
},
|
|
15
|
-
"exports": {
|
|
16
|
-
".": {
|
|
17
|
-
"import": "./dist/index.js",
|
|
18
|
-
"types": "./dist/index.d.ts"
|
|
19
|
-
}
|
|
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"
|
|
20
18
|
},
|
|
21
19
|
"files": [
|
|
22
20
|
"dist"
|
|
23
21
|
],
|
|
24
|
-
"
|
|
25
|
-
"keywords": [
|
|
26
|
-
"components",
|
|
27
|
-
"react",
|
|
28
|
-
"ui"
|
|
29
|
-
],
|
|
22
|
+
"type": "module",
|
|
30
23
|
"main": "./dist/index.js",
|
|
31
24
|
"module": "./dist/index.js",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
}
|
|
36
31
|
},
|
|
37
32
|
"publishConfig": {
|
|
38
33
|
"access": "public"
|
|
39
34
|
},
|
|
40
|
-
"repository": {
|
|
41
|
-
"type": "git",
|
|
42
|
-
"url": "git+https://github.com/nattui/react-components.git"
|
|
43
|
-
},
|
|
44
35
|
"scripts": {
|
|
45
36
|
"build": "tsup",
|
|
46
37
|
"check:type": "tsc",
|
|
47
38
|
"dev": "tsup --watch",
|
|
48
39
|
"prepublishOnly": "pnpm run build"
|
|
49
40
|
},
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
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
|
+
}
|
|
53
53
|
}
|