@nattui/react-components 0.0.21 → 0.0.23
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-background.module-Y3DFESUY.module.css → button-background.module-EWE3JTY4.module.css} +3 -10
- package/dist/{button.module-VAXL2INY.module.css → button.module-44LVL7ES.module.css} +16 -16
- package/dist/index.d.ts +17 -10
- package/dist/index.js +26 -6
- package/dist/{input.module-GMZ6XJ62.module.css → input.module-RQOR3OFH.module.css} +32 -2
- package/package.json +3 -6
|
@@ -22,18 +22,11 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/* Variant */
|
|
25
|
-
.button_background__variant_accent
|
|
26
|
-
background: linear-gradient(
|
|
27
|
-
to bottom,
|
|
28
|
-
var(--color-primary-7, #edadc8),
|
|
29
|
-
var(--color-primary-8, #e58fb1)
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
25
|
+
.button_background__variant_accent,
|
|
33
26
|
.button_background__variant_primary {
|
|
34
27
|
background: linear-gradient(
|
|
35
28
|
to bottom,
|
|
36
|
-
var(--color-
|
|
37
|
-
var(--color-
|
|
29
|
+
var(--color-white-a6, rgba(0, 0, 0, 0.4)),
|
|
30
|
+
var(--color-white-a5, rgba(0, 0, 0, 0.3))
|
|
38
31
|
);
|
|
39
32
|
}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
column-gap: 8px;
|
|
9
9
|
align-items: safe center;
|
|
10
10
|
justify-content: safe center;
|
|
11
|
+
height: var(--size);
|
|
12
|
+
padding: var(--padding);
|
|
11
13
|
overflow: hidden;
|
|
12
14
|
font-family: var(--font-sans, sans-serif);
|
|
13
15
|
font-size: 14px;
|
|
@@ -24,8 +26,7 @@
|
|
|
24
26
|
border-width: 1px;
|
|
25
27
|
transition-duration: 150ms;
|
|
26
28
|
transition-property:
|
|
27
|
-
background-color, border-color, box-shadow, color, filter, opacity,
|
|
28
|
-
translate;
|
|
29
|
+
background-color, border-color, box-shadow, color, filter, opacity, translate;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
.button:disabled {
|
|
@@ -78,6 +79,13 @@
|
|
|
78
79
|
border-radius: 8px;
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
@supports (corner-shape: squircle) {
|
|
83
|
+
.button__rounded_base {
|
|
84
|
+
border-radius: 9999px;
|
|
85
|
+
corner-shape: squircle;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
81
89
|
.button__rounded_full {
|
|
82
90
|
border-radius: 9999px;
|
|
83
91
|
}
|
|
@@ -87,26 +95,22 @@
|
|
|
87
95
|
/* ===================================================== */
|
|
88
96
|
.button__size_32 {
|
|
89
97
|
--size: 32px;
|
|
90
|
-
|
|
91
|
-
padding: 0 8px;
|
|
98
|
+
--padding: 0 10px;
|
|
92
99
|
}
|
|
93
100
|
|
|
94
101
|
.button__size_36 {
|
|
95
102
|
--size: 36px;
|
|
96
|
-
|
|
97
|
-
padding: 0 12px;
|
|
103
|
+
--padding: 0 14px;
|
|
98
104
|
}
|
|
99
105
|
|
|
100
106
|
.button__size_40 {
|
|
101
107
|
--size: 40px;
|
|
102
|
-
|
|
103
|
-
padding: 0 16px;
|
|
108
|
+
--padding: 0 18px;
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
.button__size_44 {
|
|
107
112
|
--size: 44px;
|
|
108
|
-
|
|
109
|
-
padding: 0 20px;
|
|
113
|
+
--padding: 0 22px;
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
/* ===================================================== */
|
|
@@ -114,7 +118,7 @@
|
|
|
114
118
|
/* ===================================================== */
|
|
115
119
|
/* Accent */
|
|
116
120
|
.button__variant_accent {
|
|
117
|
-
color: var(--color-
|
|
121
|
+
color: var(--color-white, #ffffff);
|
|
118
122
|
background-image: linear-gradient(
|
|
119
123
|
to bottom,
|
|
120
124
|
var(--color-primary-9, #e93d82),
|
|
@@ -147,11 +151,7 @@
|
|
|
147
151
|
|
|
148
152
|
.button__variant_ghost:enabled:hover {
|
|
149
153
|
color: var(--color-gray-12, #1a1523);
|
|
150
|
-
background-color: color-mix(
|
|
151
|
-
in oklab,
|
|
152
|
-
var(--color-gray-5, #e9e8ea) 75%,
|
|
153
|
-
transparent
|
|
154
|
-
);
|
|
154
|
+
background-color: color-mix(in oklab, var(--color-gray-5, #e9e8ea) 75%, transparent);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/* Primary */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode, JSX } from 'react';
|
|
2
2
|
|
|
3
|
+
interface ButtonIconProps extends ButtonPropsInternal {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
iconEnd?: never;
|
|
6
|
+
iconOnly: true;
|
|
7
|
+
iconStart?: never;
|
|
8
|
+
}
|
|
9
|
+
interface ButtonProps extends ButtonPropsInternal {
|
|
10
|
+
children?: string | string[];
|
|
11
|
+
iconOnly?: false;
|
|
12
|
+
}
|
|
3
13
|
interface ButtonPropsInternal extends Omit<ComponentProps<"button">, "aria-pressed" | "disabled"> {
|
|
4
14
|
iconEnd?: ReactNode;
|
|
5
15
|
iconOnly?: boolean;
|
|
@@ -12,16 +22,6 @@ interface ButtonPropsInternal extends Omit<ComponentProps<"button">, "aria-press
|
|
|
12
22
|
size?: 32 | 36 | 40 | 44;
|
|
13
23
|
variant?: "accent" | "ghost" | "primary" | "secondary";
|
|
14
24
|
}
|
|
15
|
-
interface ButtonIconProps extends ButtonPropsInternal {
|
|
16
|
-
children?: ReactNode;
|
|
17
|
-
iconEnd?: never;
|
|
18
|
-
iconOnly: true;
|
|
19
|
-
iconStart?: never;
|
|
20
|
-
}
|
|
21
|
-
interface ButtonProps extends ButtonPropsInternal {
|
|
22
|
-
children?: string | string[];
|
|
23
|
-
iconOnly?: false;
|
|
24
|
-
}
|
|
25
25
|
type ButtonUnionProps = ButtonIconProps | ButtonProps;
|
|
26
26
|
declare function Button(props: ButtonUnionProps): JSX.Element;
|
|
27
27
|
declare const BUTTON_CLASS_NAME: {
|
|
@@ -54,11 +54,18 @@ interface InputProps extends Omit<ComponentProps<"input">, "aria-pressed" | "dis
|
|
|
54
54
|
isDisabled?: boolean;
|
|
55
55
|
isReadOnly?: boolean;
|
|
56
56
|
isRequired?: boolean;
|
|
57
|
+
size?: 32 | 36 | 40 | 44;
|
|
57
58
|
}
|
|
58
59
|
declare function Input(props: InputProps): JSX.Element;
|
|
59
60
|
declare const INPUT_CLASS_NAME: {
|
|
60
61
|
readonly BASE: string;
|
|
61
62
|
readonly PASSWORD: string;
|
|
63
|
+
readonly SIZE: {
|
|
64
|
+
readonly 32: string;
|
|
65
|
+
readonly 36: string;
|
|
66
|
+
readonly 40: string;
|
|
67
|
+
readonly 44: string;
|
|
68
|
+
};
|
|
62
69
|
};
|
|
63
70
|
|
|
64
71
|
interface LabelProps extends ComponentProps<"label"> {
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/button.tsx
|
|
2
|
-
import styles3 from "./button.module-
|
|
2
|
+
import styles3 from "./button.module-44LVL7ES.module.css";
|
|
3
3
|
|
|
4
4
|
// src/button-background.tsx
|
|
5
|
-
import styles from "./button-background.module-
|
|
5
|
+
import styles from "./button-background.module-EWE3JTY4.module.css";
|
|
6
6
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
7
7
|
function ButtonBackground(props) {
|
|
8
8
|
const { isRounded = false, variant = "primary" } = props;
|
|
@@ -85,7 +85,13 @@ function Button(props) {
|
|
|
85
85
|
type,
|
|
86
86
|
...rest,
|
|
87
87
|
children: [
|
|
88
|
-
/* @__PURE__ */ jsx3(
|
|
88
|
+
/* @__PURE__ */ jsx3(
|
|
89
|
+
ButtonBackground,
|
|
90
|
+
{
|
|
91
|
+
isRounded,
|
|
92
|
+
variant
|
|
93
|
+
}
|
|
94
|
+
),
|
|
89
95
|
isLoading && /* @__PURE__ */ jsx3(ButtonSpinner, {}),
|
|
90
96
|
!isLoading && iconStart,
|
|
91
97
|
iconOnly ? isLoading ? /* @__PURE__ */ jsx3(Fragment2, {}) : children : /* @__PURE__ */ jsx3("span", { children }),
|
|
@@ -120,7 +126,7 @@ var BUTTON_CLASS_NAME = {
|
|
|
120
126
|
};
|
|
121
127
|
|
|
122
128
|
// src/input.tsx
|
|
123
|
-
import styles4 from "./input.module-
|
|
129
|
+
import styles4 from "./input.module-RQOR3OFH.module.css";
|
|
124
130
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
125
131
|
function Input(props) {
|
|
126
132
|
const {
|
|
@@ -129,12 +135,14 @@ function Input(props) {
|
|
|
129
135
|
isDisabled = false,
|
|
130
136
|
isReadOnly = false,
|
|
131
137
|
isRequired = false,
|
|
138
|
+
size = 40,
|
|
132
139
|
type = "text",
|
|
133
140
|
...rest
|
|
134
141
|
} = props;
|
|
135
142
|
const isPassword = type === "password";
|
|
136
143
|
const combinedClassName = `
|
|
137
144
|
${INPUT_CLASS_NAME.BASE}
|
|
145
|
+
${INPUT_CLASS_NAME.SIZE[size]}
|
|
138
146
|
${isPassword ? INPUT_CLASS_NAME.PASSWORD : ""}
|
|
139
147
|
${customClassName}
|
|
140
148
|
`.replaceAll(/\s+/g, " ").trim();
|
|
@@ -153,7 +161,13 @@ function Input(props) {
|
|
|
153
161
|
}
|
|
154
162
|
var INPUT_CLASS_NAME = {
|
|
155
163
|
BASE: styles4.input,
|
|
156
|
-
PASSWORD: styles4.input__password
|
|
164
|
+
PASSWORD: styles4.input__password,
|
|
165
|
+
SIZE: {
|
|
166
|
+
32: styles4.input__size_32,
|
|
167
|
+
36: styles4.input__size_36,
|
|
168
|
+
40: styles4.input__size_40,
|
|
169
|
+
44: styles4.input__size_44
|
|
170
|
+
}
|
|
157
171
|
};
|
|
158
172
|
|
|
159
173
|
// src/label.tsx
|
|
@@ -165,7 +179,13 @@ function Label(props) {
|
|
|
165
179
|
${LABEL_CLASS_NAME.BASE}
|
|
166
180
|
${customClassName}
|
|
167
181
|
`.replaceAll(/\s+/g, " ").trim();
|
|
168
|
-
return /* @__PURE__ */ jsx5(
|
|
182
|
+
return /* @__PURE__ */ jsx5(
|
|
183
|
+
"label",
|
|
184
|
+
{
|
|
185
|
+
className: combinedClassName,
|
|
186
|
+
...rest
|
|
187
|
+
}
|
|
188
|
+
);
|
|
169
189
|
}
|
|
170
190
|
var LABEL_CLASS_NAME = {
|
|
171
191
|
BASE: styles5.label
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* ===================================================== */
|
|
4
4
|
.input {
|
|
5
5
|
width: 100%;
|
|
6
|
-
height:
|
|
6
|
+
height: var(--size);
|
|
7
7
|
padding: 0 12px;
|
|
8
8
|
font-family: var(--font-sans, sans-serif);
|
|
9
9
|
font-size: 14px;
|
|
@@ -27,8 +27,19 @@
|
|
|
27
27
|
transition-property: background-color, border-color, box-shadow, opacity;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
:global(.dark) .input {
|
|
31
|
+
background-color: var(--color-gray-2, #101010);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@supports (corner-shape: squircle) {
|
|
35
|
+
.input {
|
|
36
|
+
border-radius: 9999px;
|
|
37
|
+
corner-shape: squircle;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
30
41
|
.input::placeholder {
|
|
31
|
-
color: var(--color-gray
|
|
42
|
+
color: var(--color-gray, #8d8d8d);
|
|
32
43
|
user-select: none;
|
|
33
44
|
}
|
|
34
45
|
|
|
@@ -55,3 +66,22 @@
|
|
|
55
66
|
.input__password {
|
|
56
67
|
font-family: var(--font-mono, monospace);
|
|
57
68
|
}
|
|
69
|
+
|
|
70
|
+
/* ===================================================== */
|
|
71
|
+
/* Size */
|
|
72
|
+
/* ===================================================== */
|
|
73
|
+
.input__size_32 {
|
|
74
|
+
--size: 32px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.input__size_36 {
|
|
78
|
+
--size: 36px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.input__size_40 {
|
|
82
|
+
--size: 40px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.input__size_44 {
|
|
86
|
+
--size: 44px;
|
|
87
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nattui/react-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "A collection of reusable React components built with TypeScript and CSS Modules",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -31,14 +31,11 @@
|
|
|
31
31
|
],
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsup",
|
|
34
|
-
"check": "
|
|
35
|
-
"check:fix": "biome check --write",
|
|
34
|
+
"check:type": "tsc",
|
|
36
35
|
"dev": "tsup --watch",
|
|
37
|
-
"prepublishOnly": "pnpm run build"
|
|
38
|
-
"update": "pnpx npm-check-updates --upgrade"
|
|
36
|
+
"prepublishOnly": "pnpm run build"
|
|
39
37
|
},
|
|
40
38
|
"devDependencies": {
|
|
41
|
-
"@biomejs/biome": "catalog:",
|
|
42
39
|
"@types/react": "catalog:",
|
|
43
40
|
"tsup": "^8.5.0",
|
|
44
41
|
"typescript": "catalog:"
|