@nattui/react-components 0.0.22 → 0.0.24

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.
@@ -1,15 +1,15 @@
1
1
  /* Base */
2
2
  .button_background {
3
+ position: absolute;
4
+ top: 0;
5
+ right: 0;
3
6
  bottom: 50%;
4
- filter: none !important;
5
7
  left: 0;
8
+ z-index: -1;
6
9
  opacity: 0.2;
7
- position: absolute;
8
- right: 0;
9
- top: 0;
10
+ filter: none !important;
10
11
  transition-duration: inherit;
11
12
  transition-property: opacity;
12
- z-index: -1;
13
13
  }
14
14
 
15
15
  /* Rounded */
@@ -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-gray-10, #86848d),
37
- var(--color-gray-11, #6f6e77)
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
  }
@@ -2,30 +2,31 @@
2
2
  /* Base */
3
3
  /* ===================================================== */
4
4
  .button {
5
- align-items: safe center;
6
- border-color: transparent;
7
- border-style: solid;
8
- border-width: 1px;
9
- column-gap: 8px;
10
- cursor: pointer;
5
+ position: relative;
11
6
  display: flex;
12
7
  flex-shrink: 0;
8
+ column-gap: 8px;
9
+ align-items: safe center;
10
+ justify-content: safe center;
11
+ height: var(--size);
12
+ padding: var(--padding);
13
+ overflow: hidden;
13
14
  font-family: var(--font-sans, sans-serif);
14
15
  font-size: 14px;
15
16
  font-weight: 500;
16
- justify-content: safe center;
17
17
  line-height: 1.5;
18
- outline-color: var(--color-primary, #e93d82);
19
- outline-offset: 2px;
20
- outline-style: solid;
18
+ cursor: pointer;
19
+ user-select: none;
21
20
  outline-width: 0;
22
- overflow: hidden;
23
- position: relative;
21
+ outline-style: solid;
22
+ outline-color: var(--color-primary-9, #e93d82);
23
+ outline-offset: 2px;
24
+ border-color: transparent;
25
+ border-style: solid;
26
+ border-width: 1px;
24
27
  transition-duration: 150ms;
25
28
  transition-property:
26
- background-color, border-color, box-shadow, color, filter, opacity,
27
- translate;
28
- user-select: none;
29
+ background-color, border-color, box-shadow, color, filter, opacity, translate;
29
30
  }
30
31
 
31
32
  .button:disabled {
@@ -67,8 +68,8 @@
67
68
  /* Icon only */
68
69
  /* ===================================================== */
69
70
  .button__icon_only {
70
- padding: 0 !important;
71
71
  width: var(--size) !important;
72
+ padding: 0 !important;
72
73
  }
73
74
 
74
75
  /* ===================================================== */
@@ -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
- height: var(--size);
91
- padding: 0 8px;
98
+ --padding: 0 10px;
92
99
  }
93
100
 
94
101
  .button__size_36 {
95
102
  --size: 36px;
96
- height: var(--size);
97
- padding: 0 12px;
103
+ --padding: 0 12px;
98
104
  }
99
105
 
100
106
  .button__size_40 {
101
107
  --size: 40px;
102
- height: var(--size);
103
- padding: 0 16px;
108
+ --padding: 0 14px;
104
109
  }
105
110
 
106
111
  .button__size_44 {
107
112
  --size: 44px;
108
- height: var(--size);
109
- padding: 0 20px;
113
+ --padding: 0 16px;
110
114
  }
111
115
 
112
116
  /* ===================================================== */
@@ -114,16 +118,16 @@
114
118
  /* ===================================================== */
115
119
  /* Accent */
116
120
  .button__variant_accent {
121
+ color: var(--color-white, #ffffff);
117
122
  background-image: linear-gradient(
118
123
  to bottom,
119
- var(--color-primary, #e93d82),
124
+ var(--color-primary-9, #e93d82),
120
125
  var(--color-primary-10, #e03177)
121
126
  );
122
- border-color: var(--color-primary, #e93d82);
127
+ border-color: var(--color-primary-9, #e93d82);
123
128
  box-shadow:
124
129
  inset 0 1px 0 0 rgba(255, 255, 255, 0.25),
125
130
  inset 0 -1px 0 0 rgba(0, 0, 0, 0.1);
126
- color: var(--color-gray-1, #fdfcfd);
127
131
  }
128
132
 
129
133
  .button__variant_accent:enabled[aria-pressed="true"],
@@ -135,27 +139,24 @@
135
139
 
136
140
  /* Ghost */
137
141
  .button__variant_ghost {
138
- background-color: transparent;
139
142
  color: var(--color-gray-11, #6f6e77);
143
+ background-color: transparent;
140
144
  }
141
145
 
142
146
  .button__variant_ghost:enabled[aria-pressed="true"],
143
147
  .button__variant_ghost:enabled:active {
144
- background-color: var(--color-gray-5, #e9e8ea) !important;
145
148
  color: var(--color-gray-12, #1a1523);
149
+ background-color: var(--color-gray-5, #e9e8ea) !important;
146
150
  }
147
151
 
148
152
  .button__variant_ghost:enabled:hover {
149
- background-color: color-mix(
150
- in oklab,
151
- var(--color-gray-5, #e9e8ea) 75%,
152
- transparent
153
- );
154
153
  color: var(--color-gray-12, #1a1523);
154
+ background-color: color-mix(in oklab, var(--color-gray-5, #e9e8ea) 75%, transparent);
155
155
  }
156
156
 
157
157
  /* Primary */
158
158
  .button__variant_primary {
159
+ color: var(--color-gray-1, #fdfcfd);
159
160
  background-image: linear-gradient(
160
161
  to bottom,
161
162
  color-mix(in oklab, var(--color-gray-12, #1a1523) 90%, transparent),
@@ -165,7 +166,6 @@
165
166
  box-shadow:
166
167
  inset 0 1px 0 0 rgba(255, 255, 255, 0.25),
167
168
  inset 0 -1px 0 0 rgba(0, 0, 0, 0.1);
168
- color: var(--color-gray-1, #fdfcfd);
169
169
  }
170
170
 
171
171
  .button__variant_primary:enabled[aria-pressed="true"],
@@ -177,6 +177,7 @@
177
177
 
178
178
  /* Secondary */
179
179
  .button__variant_secondary {
180
+ color: var(--color-gray-11, #6f6e77);
180
181
  background-image: linear-gradient(
181
182
  to bottom,
182
183
  var(--color-gray-1, #fdfcfd),
@@ -186,14 +187,13 @@
186
187
  box-shadow:
187
188
  inset 0 1px 0 0 rgba(255, 255, 255, 0.25),
188
189
  inset 0 -1px 0 0 rgba(0, 0, 0, 0.1);
189
- color: var(--color-gray-11, #6f6e77);
190
190
  }
191
191
 
192
192
  .button__variant_secondary:enabled[aria-pressed="true"],
193
193
  .button__variant_secondary:enabled:active,
194
194
  .button__variant_secondary:enabled:hover {
195
- border-color: var(--color-gray-8, #c8c7cb);
196
195
  color: var(--color-gray-12, #1a1523);
196
+ border-color: var(--color-gray-8, #c8c7cb);
197
197
  }
198
198
 
199
199
  .button__variant_secondary:enabled[aria-pressed="true"],
package/dist/index.d.ts CHANGED
@@ -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,5 +1,8 @@
1
+ // src/button.tsx
2
+ import styles3 from "./button.module-JEUFP4EH.module.css";
3
+
1
4
  // src/button-background.tsx
2
- import styles from "./button-background.module-T5B7XZ2Z.module.css";
5
+ import styles from "./button-background.module-EWE3JTY4.module.css";
3
6
  import { Fragment, jsx } from "react/jsx-runtime";
4
7
  function ButtonBackground(props) {
5
8
  const { isRounded = false, variant = "primary" } = props;
@@ -31,7 +34,7 @@ var BUTTON_BACKGROUND_CLASS_NAME = {
31
34
  };
32
35
 
33
36
  // src/button-spinner.tsx
34
- import styles2 from "./button-spinner.module-4TBETQ4T.module.css";
37
+ import styles2 from "./button-spinner.module-T3OGVJS4.module.css";
35
38
  import { jsx as jsx2 } from "react/jsx-runtime";
36
39
  function ButtonSpinner(props) {
37
40
  const { size = 16 } = props;
@@ -46,7 +49,6 @@ function ButtonSpinner(props) {
46
49
  }
47
50
 
48
51
  // src/button.tsx
49
- import styles3 from "./button.module-G7MNOYWZ.module.css";
50
52
  import { Fragment as Fragment2, jsx as jsx3, jsxs } from "react/jsx-runtime";
51
53
  function Button(props) {
52
54
  const {
@@ -83,7 +85,13 @@ function Button(props) {
83
85
  type,
84
86
  ...rest,
85
87
  children: [
86
- /* @__PURE__ */ jsx3(ButtonBackground, { isRounded, variant }),
88
+ /* @__PURE__ */ jsx3(
89
+ ButtonBackground,
90
+ {
91
+ isRounded,
92
+ variant
93
+ }
94
+ ),
87
95
  isLoading && /* @__PURE__ */ jsx3(ButtonSpinner, {}),
88
96
  !isLoading && iconStart,
89
97
  iconOnly ? isLoading ? /* @__PURE__ */ jsx3(Fragment2, {}) : children : /* @__PURE__ */ jsx3("span", { children }),
@@ -118,7 +126,7 @@ var BUTTON_CLASS_NAME = {
118
126
  };
119
127
 
120
128
  // src/input.tsx
121
- import styles4 from "./input.module-GJV5YJKN.module.css";
129
+ import styles4 from "./input.module-RQOR3OFH.module.css";
122
130
  import { jsx as jsx4 } from "react/jsx-runtime";
123
131
  function Input(props) {
124
132
  const {
@@ -127,12 +135,14 @@ function Input(props) {
127
135
  isDisabled = false,
128
136
  isReadOnly = false,
129
137
  isRequired = false,
138
+ size = 40,
130
139
  type = "text",
131
140
  ...rest
132
141
  } = props;
133
142
  const isPassword = type === "password";
134
143
  const combinedClassName = `
135
144
  ${INPUT_CLASS_NAME.BASE}
145
+ ${INPUT_CLASS_NAME.SIZE[size]}
136
146
  ${isPassword ? INPUT_CLASS_NAME.PASSWORD : ""}
137
147
  ${customClassName}
138
148
  `.replaceAll(/\s+/g, " ").trim();
@@ -151,11 +161,17 @@ function Input(props) {
151
161
  }
152
162
  var INPUT_CLASS_NAME = {
153
163
  BASE: styles4.input,
154
- 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
+ }
155
171
  };
156
172
 
157
173
  // src/label.tsx
158
- import styles5 from "./label.module-4CZ6ETIR.module.css";
174
+ import styles5 from "./label.module-3W6OLN6C.module.css";
159
175
  import { jsx as jsx5 } from "react/jsx-runtime";
160
176
  function Label(props) {
161
177
  const { className: customClassName = "", ...rest } = props;
@@ -163,7 +179,13 @@ function Label(props) {
163
179
  ${LABEL_CLASS_NAME.BASE}
164
180
  ${customClassName}
165
181
  `.replaceAll(/\s+/g, " ").trim();
166
- return /* @__PURE__ */ jsx5("label", { className: combinedClassName, ...rest });
182
+ return /* @__PURE__ */ jsx5(
183
+ "label",
184
+ {
185
+ className: combinedClassName,
186
+ ...rest
187
+ }
188
+ );
167
189
  }
168
190
  var LABEL_CLASS_NAME = {
169
191
  BASE: styles5.label
@@ -2,29 +2,40 @@
2
2
  /* Base */
3
3
  /* ===================================================== */
4
4
  .input {
5
+ width: 100%;
6
+ height: var(--size);
7
+ padding: 0 12px;
8
+ font-family: var(--font-sans, sans-serif);
9
+ font-size: 14px;
10
+ font-weight: 400;
11
+ line-height: 1.5;
12
+ color: var(--color-gray-12, #202020);
13
+ text-decoration: none;
5
14
  appearance: none;
15
+ cursor: text;
16
+ outline-width: 0;
17
+ outline-style: solid;
18
+ outline-color: var(--color-primary-9, #e93d82);
19
+ outline-offset: 2px;
6
20
  background-color: var(--color-gray-1, #fcfcfc);
7
21
  border-color: var(--color-gray-5, #e0e0e0);
8
- border-radius: 8px;
9
22
  border-style: solid;
10
23
  border-width: 1px;
24
+ border-radius: 8px;
11
25
  box-shadow: 0 1px rgba(0, 0, 0, 0.05);
12
- color: var(--color-gray-12, #202020);
13
- cursor: text;
14
- font-family: var(--font-sans, sans-serif);
15
- font-size: 14px;
16
- font-weight: 400;
17
- height: 40px;
18
- line-height: 1.5;
19
- outline-color: var(--color-primary, #e93d82);
20
- outline-offset: 2px;
21
- outline-style: solid;
22
- outline-width: 0;
23
- padding: 0 12px;
24
- text-decoration: none;
25
26
  transition-duration: 150ms;
26
27
  transition-property: background-color, border-color, box-shadow, opacity;
27
- width: 100%;
28
+ }
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
+ }
28
39
  }
29
40
 
30
41
  .input::placeholder {
@@ -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.22",
3
+ "version": "0.0.24",
4
4
  "description": "A collection of reusable React components built with TypeScript and CSS Modules",
5
5
  "keywords": [
6
6
  "components",
@@ -31,6 +31,7 @@
31
31
  ],
32
32
  "scripts": {
33
33
  "build": "tsup",
34
+ "check:type": "tsc",
34
35
  "dev": "tsup --watch",
35
36
  "prepublishOnly": "pnpm run build"
36
37
  },
@@ -1,9 +1,9 @@
1
1
  .button_spinner {
2
- animation: spinner 1000ms steps(12, end) infinite;
3
- height: var(--size);
4
2
  position: relative;
5
- scale: -1 1;
6
3
  width: var(--size);
4
+ height: var(--size);
5
+ scale: -1 1;
6
+ animation: spinner 1000ms steps(12, end) infinite;
7
7
  }
8
8
 
9
9
  @keyframes spinner {
@@ -13,25 +13,25 @@
13
13
  }
14
14
 
15
15
  .button_spinner > div {
16
- height: calc(var(--size) / 12);
17
- pointer-events: none;
18
16
  position: absolute;
19
- right: 0;
20
17
  top: 50%;
18
+ right: 0;
19
+ width: calc(var(--size) / 2);
20
+ height: calc(var(--size) / 12);
21
+ pointer-events: none;
21
22
  transform-origin: center left;
22
- transition: all 150ms;
23
23
  translate: 0 -50%;
24
- width: calc(var(--size) / 2);
24
+ transition: all 150ms;
25
25
  }
26
26
 
27
27
  .button_spinner > div::after {
28
- background-color: currentColor;
29
- border-radius: 9999px;
30
- content: "";
31
- height: 100%;
32
28
  position: absolute;
33
29
  right: 0;
34
30
  width: 50%;
31
+ height: 100%;
32
+ content: "";
33
+ background-color: currentColor;
34
+ border-radius: 9999px;
35
35
  }
36
36
 
37
37
  .button_spinner > div:nth-child(1) {
@@ -2,7 +2,7 @@
2
2
  /* Base */
3
3
  /* ===================================================== */
4
4
  .label {
5
- color: var(--color-gray-11, #646464);
6
- font-size: 13px;
7
5
  width: fit-content;
6
+ font-size: 13px;
7
+ color: var(--color-gray-11, #646464);
8
8
  }