@nattui/react-components 0.0.34 → 0.0.36

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.
@@ -96,21 +96,9 @@
96
96
  background-color: var(--color-primary-9);
97
97
  background-image: linear-gradient(
98
98
  to bottom,
99
- color-mix(in oklab, transparent 100%, #ffffff 2.5%) 50%,
99
+ color-mix(in oklab, transparent 100%, #ffffff 5%) 50%,
100
100
  color-mix(in oklab, transparent 100%, #ffffff 0%) 50%
101
101
  );
102
- box-shadow:
103
- 0 0 0 1px var(--color-primary-9) inset,
104
- 0 1px 0 1px rgba(255, 255, 255, 0.25) inset,
105
- 0 -1px 0 1px rgba(0, 0, 0, 0.1) inset;
106
- }
107
-
108
- .button__variant_accent:active:enabled,
109
- .button__variant_accent[aria-pressed="true"]:enabled {
110
- box-shadow:
111
- 0 0 0 1px var(--color-primary-9) inset,
112
- 0 -1px 0 1px rgba(255, 255, 255, 0.25) inset,
113
- 0 1px 0 1px rgba(0, 0, 0, 0.1) inset;
114
102
  }
115
103
 
116
104
  .button__variant_accent:active:enabled,
@@ -123,7 +111,7 @@
123
111
  background-image: linear-gradient(
124
112
  to bottom,
125
113
  color-mix(in oklab, transparent 100%, #000000 0%) 50%,
126
- color-mix(in oklab, transparent 100%, #000000 2.5%) 50%
114
+ color-mix(in oklab, transparent 100%, #000000 5%) 50%
127
115
  );
128
116
  }
129
117
 
@@ -136,7 +124,7 @@
136
124
  .button__variant_ghost:active:enabled,
137
125
  .button__variant_ghost:hover:enabled,
138
126
  .button__variant_ghost[aria-pressed="true"]:enabled {
139
- background-color: var(--color-gray-4);
127
+ background-color: var(--color-gray-3);
140
128
  }
141
129
 
142
130
  :global(.dark) .button__variant_ghost {
@@ -146,24 +134,12 @@
146
134
  /* Primary */
147
135
  .button__variant_primary {
148
136
  color: var(--color-white);
149
- background-color: var(--color-gray-dark-2);
137
+ background-color: var(--color-gray-dark-1);
150
138
  background-image: linear-gradient(
151
139
  to bottom,
152
- color-mix(in oklab, transparent 100%, #ffffff 2.5%) 50%,
140
+ color-mix(in oklab, transparent 100%, #ffffff 5%) 50%,
153
141
  color-mix(in oklab, transparent 100%, #ffffff 0%) 50%
154
142
  );
155
- box-shadow:
156
- 0 0 0 1px var(--color-gray-dark-2) inset,
157
- 0 1px 0 1px rgba(255, 255, 255, 0.25) inset,
158
- 0 -1px 0 1px rgba(0, 0, 0, 0.1) inset;
159
- }
160
-
161
- .button__variant_primary:active:enabled,
162
- .button__variant_primary[aria-pressed="true"]:enabled {
163
- box-shadow:
164
- 0 0 0 1px var(--color-gray-dark-2) inset,
165
- 0 -1px 0 1px rgba(255, 255, 255, 0.25) inset,
166
- 0 1px 0 1px rgba(0, 0, 0, 0.1) inset;
167
143
  }
168
144
 
169
145
  .button__variant_primary:active:enabled,
@@ -178,20 +154,8 @@
178
154
  background-image: linear-gradient(
179
155
  to bottom,
180
156
  color-mix(in oklab, transparent 100%, #000000 0%) 50%,
181
- color-mix(in oklab, transparent 100%, #000000 2.5%) 50%
157
+ color-mix(in oklab, transparent 100%, #000000 5%) 50%
182
158
  );
183
- box-shadow:
184
- 0 0 0 1px var(--color-gray-light-1) inset,
185
- 0 1px 0 1px rgba(255, 255, 255, 0.25) inset,
186
- 0 -1px 0 1px rgba(0, 0, 0, 0.1) inset;
187
- }
188
-
189
- :global(.dark) .button__variant_primary:active:enabled,
190
- :global(.dark) .button__variant_primary[aria-pressed="true"]:enabled {
191
- box-shadow:
192
- 0 0 0 1px var(--color-gray-light-2) inset,
193
- 0 -1px 0 1px rgba(255, 255, 255, 0.25) inset,
194
- 0 1px 0 1px rgba(0, 0, 0, 0.1) inset;
195
159
  }
196
160
 
197
161
  :global(.dark) .button__variant_primary:active:enabled,
@@ -209,33 +173,23 @@
209
173
  color-mix(in oklab, transparent 100%, #000000 0%) 50%,
210
174
  color-mix(in oklab, transparent 100%, #000000 2.5%) 50%
211
175
  );
212
- box-shadow:
213
- 0 -1px 0 0px rgba(0, 0, 0, 7.5%) inset, /* Bottom */
214
- 0 0 0 1px var(--color-gray-4) inset; /* Border */
215
- }
216
-
217
- .button__variant_secondary:active:enabled,
218
- .button__variant_secondary[aria-pressed="true"]:enabled {
219
- box-shadow: 0 0 0 1px var(--color-gray-6) inset;
176
+ box-shadow: 0 0 0 1px var(--color-gray-4) inset;
220
177
  }
221
178
 
222
179
  .button__variant_secondary:active:enabled,
223
180
  .button__variant_secondary:hover:enabled,
224
181
  .button__variant_secondary[aria-pressed="true"]:enabled {
225
- background-color: var(--color-gray-3);
182
+ background-color: var(--color-gray-2);
183
+ box-shadow: 0 0 0 1px var(--color-gray-6) inset;
226
184
  }
227
185
 
228
186
  :global(.dark) .button__variant_secondary {
229
187
  color: var(--color-white);
230
- background-color: var(--color-gray-2);
231
188
  background-image: linear-gradient(
232
189
  to bottom,
233
190
  color-mix(in oklab, transparent 100%, #ffffff 2.5%) 50%,
234
191
  color-mix(in oklab, transparent 100%, #ffffff 0%) 50%
235
192
  );
236
- box-shadow:
237
- 0 1px 0 0px rgba(255, 255, 255, 7.5%) inset, /* Top */
238
- 0 0 0 1px var(--color-gray-4) inset; /* Border */
239
193
  }
240
194
 
241
195
  /* ===================================================== */
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" | "required" | "readOnly" | "nativeButton"> {
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-4LEXZ25X.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-7OP5B7X3.module.css";
82
+ import styles3 from "./input.module-JBNVVC6S.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-QVZRQ4BT.module.css";
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
- ${styles6.switch}
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-7OP5B7X3.module.css";
210
+ import inputStyles from "./input.module-JBNVVC6S.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,
@@ -20,9 +20,7 @@
20
20
  outline-offset: -2px;
21
21
  background-color: var(--color-gray-1, #fcfcfc);
22
22
  border-style: none;
23
- box-shadow:
24
- 0 -1px 0 0px rgba(0, 0, 0, 7.5%) inset, /* Bottom */
25
- 0 0 0 1px var(--color-gray-4) inset; /* Border */
23
+ box-shadow: 0 0 0 1px var(--color-gray-4) inset;
26
24
  transition-duration: 150ms;
27
25
  transition-property: box-shadow, opacity;
28
26
  }
@@ -40,10 +38,8 @@
40
38
  .input:enabled:active,
41
39
  .input:enabled:focus,
42
40
  .input:enabled:hover,
43
- .input:enabled[aria-pressed="true"] {
44
- box-shadow:
45
- 0 -1px 0 0px rgba(0, 0, 0, 7.5%) inset, /* Bottom */
46
- 0 0 0 1px var(--color-gray-6) inset; /* Border */
41
+ .input:enabled[data-is-active="true"] {
42
+ box-shadow: 0 0 0 1px var(--color-gray-6) inset;
47
43
  }
48
44
 
49
45
  .input[data-is-valid="true"] {
@@ -59,22 +55,6 @@
59
55
  outline-color: var(--color-primary-9, #e93d82);
60
56
  }
61
57
 
62
- :global(.dark) .input {
63
- background-color: var(--color-gray-2, #101010);
64
- box-shadow:
65
- 0 1px 0 0px rgba(255, 255, 255, 7.5%) inset, /* Top */
66
- 0 0 0 1px var(--color-gray-4) inset; /* Border */
67
- }
68
-
69
- :global(.dark) .input:enabled:active,
70
- :global(.dark) .input:enabled:focus,
71
- :global(.dark) .input:enabled:hover,
72
- :global(.dark) .input:enabled[aria-pressed="true"] {
73
- box-shadow:
74
- 0 1px 0 0px rgba(255, 255, 255, 7.5%) inset, /* Top */
75
- 0 0 0 1px var(--color-gray-6) inset; /* Border */
76
- }
77
-
78
58
  /* ===================================================== */
79
59
  /* Password */
80
60
  /* ===================================================== */
@@ -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(16px);
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
- "author": "Natt Nguyen <hello@natt.sh> (https://natt.sh)",
2
+ "name": "@nattui/react-components",
3
+ "version": "0.0.36",
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
- "dependencies": {
7
- "@base-ui/react": "1.1.0"
8
- },
9
- "description": "A collection of reusable React components built with TypeScript and CSS Modules",
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
- "homepage": "https://github.com/nattui/react-components#readme",
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
- "name": "@nattui/react-components",
33
- "peerDependencies": {
34
- "react": "^18.0.0 || ^19.0.0",
35
- "react-dom": "^18.0.0 || ^19.0.0"
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
- "type": "module",
51
- "types": "./dist/index.d.ts",
52
- "version": "0.0.34"
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
  }