@nattui/react-components 0.0.33 → 0.0.34

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.
@@ -52,14 +52,7 @@
52
52
  /* Rounded */
53
53
  /* ===================================================== */
54
54
  .button__rounded_base {
55
- border-radius: 8px;
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 {
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,32 @@ declare const SPACER_CLASS_NAME: {
87
93
  readonly BASE: string;
88
94
  };
89
95
 
90
- 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 };
96
+ interface SwitchProps extends Omit<ComponentProps<typeof Switch$1.Root>, "checked" | "defaultChecked" | "disabled" | "required" | "readOnly" | "nativeButton"> {
97
+ isChecked?: boolean;
98
+ isDefaultChecked?: boolean;
99
+ isDisabled?: boolean;
100
+ isReadOnly?: boolean;
101
+ isRequired?: boolean;
102
+ }
103
+ declare function Switch(props: SwitchProps): JSX.Element;
104
+
105
+ interface TextareaProps extends Omit<ComponentProps<"textarea">, "aria-pressed" | "disabled" | "readOnly" | "required"> {
106
+ isActive?: boolean;
107
+ isDisabled?: boolean;
108
+ isInvalid?: boolean;
109
+ isReadOnly?: boolean;
110
+ isRequired?: boolean;
111
+ isRounded?: boolean;
112
+ isValid?: boolean;
113
+ }
114
+ declare function Textarea(props: TextareaProps): JSX.Element;
115
+ declare const TEXTAREA_CLASS_NAME: {
116
+ readonly BASE: string;
117
+ readonly INPUT: string;
118
+ readonly ROUNDED: {
119
+ readonly BASE: string;
120
+ readonly FULL: string;
121
+ };
122
+ };
123
+
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 };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/button.tsx
2
- import styles2 from "./button.module-BMN5S7JE.module.css";
2
+ import styles2 from "./button.module-VWVBUUZO.module.css";
3
3
 
4
4
  // src/button-spinner.tsx
5
5
  import styles from "./button-spinner.module-T3OGVJS4.module.css";
@@ -88,7 +88,7 @@ var BUTTON_CLASS_NAME = {
88
88
  };
89
89
 
90
90
  // src/input.tsx
91
- import styles3 from "./input.module-FRZMYZZD.module.css";
91
+ import styles3 from "./input.module-7OP5B7X3.module.css";
92
92
  import { jsx as jsx3 } from "react/jsx-runtime";
93
93
  function Input(props) {
94
94
  const {
@@ -98,6 +98,7 @@ function Input(props) {
98
98
  isInvalid = void 0,
99
99
  isReadOnly = false,
100
100
  isRequired = false,
101
+ isRounded = false,
101
102
  isValid = void 0,
102
103
  size = 40,
103
104
  type = "text",
@@ -108,6 +109,7 @@ function Input(props) {
108
109
  ${INPUT_CLASS_NAME.BASE}
109
110
  ${INPUT_CLASS_NAME.SIZE[size]}
110
111
  ${isPassword ? INPUT_CLASS_NAME.PASSWORD : ""}
112
+ ${isRounded ? INPUT_CLASS_NAME.ROUNDED.FULL : INPUT_CLASS_NAME.ROUNDED.BASE}
111
113
  ${customClassName}
112
114
  `.replaceAll(/\s+/g, " ").trim();
113
115
  return /* @__PURE__ */ jsx3(
@@ -128,6 +130,10 @@ function Input(props) {
128
130
  var INPUT_CLASS_NAME = {
129
131
  BASE: styles3.input,
130
132
  PASSWORD: styles3.input__password,
133
+ ROUNDED: {
134
+ BASE: styles3.input__rounded_base,
135
+ FULL: styles3.input__rounded_full
136
+ },
131
137
  SIZE: {
132
138
  32: styles3.input__size_32,
133
139
  36: styles3.input__size_36,
@@ -178,6 +184,86 @@ function Spacer(props) {
178
184
  var SPACER_CLASS_NAME = {
179
185
  BASE: styles5.spacer
180
186
  };
187
+
188
+ // src/switch.tsx
189
+ import { Switch as BaseSwitch } from "@base-ui/react";
190
+ import styles6 from "./switch.module-QVZRQ4BT.module.css";
191
+ import { jsx as jsx6 } from "react/jsx-runtime";
192
+ function Switch(props) {
193
+ const {
194
+ className: customClassName = "",
195
+ isChecked = void 0,
196
+ isDefaultChecked = false,
197
+ isDisabled = false,
198
+ isReadOnly = false,
199
+ isRequired = false,
200
+ ...rest
201
+ } = props;
202
+ const combinedClassName = `
203
+ ${styles6.switch}
204
+ ${customClassName}
205
+ `.replaceAll(/\s+/g, " ").trim();
206
+ return /* @__PURE__ */ jsx6(
207
+ BaseSwitch.Root,
208
+ {
209
+ checked: isChecked,
210
+ className: combinedClassName,
211
+ defaultChecked: isDefaultChecked,
212
+ disabled: isDisabled,
213
+ readOnly: isReadOnly,
214
+ required: isRequired,
215
+ ...rest,
216
+ children: /* @__PURE__ */ jsx6(BaseSwitch.Thumb, { className: styles6.switch__thumb })
217
+ }
218
+ );
219
+ }
220
+
221
+ // src/textarea.tsx
222
+ import inputStyles from "./input.module-7OP5B7X3.module.css";
223
+ import styles7 from "./textarea.module-6GUVSFC7.module.css";
224
+ import { jsx as jsx7 } from "react/jsx-runtime";
225
+ function Textarea(props) {
226
+ const {
227
+ className: customClassName = "",
228
+ isActive = false,
229
+ isDisabled = false,
230
+ isInvalid = void 0,
231
+ isReadOnly = false,
232
+ isRequired = false,
233
+ isRounded = false,
234
+ isValid = void 0,
235
+ rows = 2,
236
+ ...rest
237
+ } = props;
238
+ const combinedClassName = `
239
+ ${TEXTAREA_CLASS_NAME.INPUT}
240
+ ${TEXTAREA_CLASS_NAME.BASE}
241
+ ${isRounded ? TEXTAREA_CLASS_NAME.ROUNDED.FULL : TEXTAREA_CLASS_NAME.ROUNDED.BASE}
242
+ ${customClassName}
243
+ `.replaceAll(/\s+/g, " ").trim();
244
+ return /* @__PURE__ */ jsx7(
245
+ "textarea",
246
+ {
247
+ "aria-pressed": isActive,
248
+ className: combinedClassName,
249
+ "data-is-invalid": isInvalid,
250
+ "data-is-valid": isValid,
251
+ disabled: isDisabled,
252
+ readOnly: isReadOnly,
253
+ required: isRequired,
254
+ rows,
255
+ ...rest
256
+ }
257
+ );
258
+ }
259
+ var TEXTAREA_CLASS_NAME = {
260
+ BASE: styles7.textarea,
261
+ INPUT: inputStyles.input,
262
+ ROUNDED: {
263
+ BASE: inputStyles.input__rounded_base,
264
+ FULL: inputStyles.input__rounded_full
265
+ }
266
+ };
181
267
  export {
182
268
  BUTTON_CLASS_NAME,
183
269
  Button,
@@ -186,5 +272,8 @@ export {
186
272
  LABEL_CLASS_NAME,
187
273
  Label,
188
274
  SPACER_CLASS_NAME,
189
- Spacer
275
+ Spacer,
276
+ Switch,
277
+ TEXTAREA_CLASS_NAME,
278
+ Textarea
190
279
  };
@@ -3,8 +3,8 @@
3
3
  /* ===================================================== */
4
4
  .input {
5
5
  width: 100%;
6
- min-height: var(--size);
7
- max-height: var(--size);
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;
@@ -27,13 +27,6 @@
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;
@@ -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
- --size: 32px;
100
+ --height: 32px;
97
101
  }
98
102
 
99
103
  .input__size_36 {
100
- --size: 36px;
104
+ --height: 36px;
101
105
  }
102
106
 
103
107
  .input__size_40 {
104
- --size: 40px;
108
+ --height: 40px;
105
109
  }
106
110
 
107
111
  .input__size_44 {
108
- --size: 44px;
112
+ --height: 44px;
109
113
  }
110
114
 
111
115
  .input__size_48 {
112
- --size: 48px;
116
+ --height: 48px;
113
117
  }
@@ -0,0 +1,48 @@
1
+ /* ===================================================== */
2
+ /* Base */
3
+ /* ===================================================== */
4
+ .switch {
5
+ display: flex;
6
+ width: 40px;
7
+ height: 24px;
8
+ padding: 2px;
9
+ cursor: pointer;
10
+ outline-width: 2px;
11
+ outline-style: none;
12
+ outline-color: var(--color-primary-9);
13
+ outline-offset: 2px;
14
+ background-color: var(--color-gray-6);
15
+ border-radius: 9999px;
16
+ transition-duration: 150ms;
17
+ transition-property: background-color;
18
+ }
19
+
20
+ .switch:focus-visible {
21
+ outline-style: solid;
22
+ }
23
+
24
+ .switch[data-checked] {
25
+ background-color: var(--color-primary-9);
26
+ }
27
+
28
+ .switch[data-disabled] {
29
+ cursor: not-allowed;
30
+ opacity: 0.5;
31
+ }
32
+
33
+ /* ===================================================== */
34
+ /* Thumb */
35
+ /* ===================================================== */
36
+
37
+ .switch__thumb {
38
+ height: 100%;
39
+ aspect-ratio: 1 / 1;
40
+ background-color: var(--color-white);
41
+ border-radius: 9999px;
42
+ transition-duration: 150ms;
43
+ transition-property: transform;
44
+ }
45
+
46
+ .switch__thumb[data-checked] {
47
+ transform: translateX(16px);
48
+ }
@@ -0,0 +1,9 @@
1
+ /* ===================================================== */
2
+ /* Base */
3
+ /* ===================================================== */
4
+ .textarea {
5
+ min-height: 66px;
6
+ max-height: none;
7
+ padding: 12px !important;
8
+ resize: vertical;
9
+ }
package/package.json CHANGED
@@ -3,6 +3,9 @@
3
3
  "bugs": {
4
4
  "url": "https://github.com/nattui/react-components/issues"
5
5
  },
6
+ "dependencies": {
7
+ "@base-ui/react": "1.1.0"
8
+ },
6
9
  "description": "A collection of reusable React components built with TypeScript and CSS Modules",
7
10
  "devDependencies": {
8
11
  "@types/react": "catalog:",
@@ -46,5 +49,5 @@
46
49
  },
47
50
  "type": "module",
48
51
  "types": "./dist/index.d.ts",
49
- "version": "0.0.33"
52
+ "version": "0.0.34"
50
53
  }