@nattui/react-components 0.0.8 → 0.0.10

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.
@@ -10,6 +10,8 @@
10
10
  cursor: pointer;
11
11
  display: flex;
12
12
  flex-shrink: 0;
13
+ font-family: var(--font-sans, sans-serif);
14
+ font-size: 14px;
13
15
  font-weight: 500;
14
16
  justify-content: safe center;
15
17
  line-height: 1.5;
@@ -21,7 +23,8 @@
21
23
  position: relative;
22
24
  transition-duration: 150ms;
23
25
  transition-property:
24
- background-color, border-color, box-shadow, color, opacity, scale, translate;
26
+ background-color, border-color, box-shadow, color, filter, opacity, scale,
27
+ translate;
25
28
  user-select: none;
26
29
  }
27
30
 
@@ -85,28 +88,24 @@
85
88
  /* ===================================================== */
86
89
  .button__size_32 {
87
90
  --size: 32px;
88
- font-size: 14px;
89
91
  height: var(--size);
90
92
  padding: 0 8px;
91
93
  }
92
94
 
93
95
  .button__size_36 {
94
96
  --size: 36px;
95
- font-size: 14px;
96
97
  height: var(--size);
97
98
  padding: 0 12px;
98
99
  }
99
100
 
100
101
  .button__size_40 {
101
102
  --size: 40px;
102
- font-size: 14px;
103
103
  height: var(--size);
104
104
  padding: 0 16px;
105
105
  }
106
106
 
107
- .button__size_48 {
108
- --size: 48px;
109
- font-size: 16px;
107
+ .button__size_44 {
108
+ --size: 44px;
110
109
  height: var(--size);
111
110
  padding: 0 20px;
112
111
  }
@@ -220,11 +219,17 @@
220
219
  filter: drop-shadow(0 1px 0 rgb(255 255 255 / 0.1));
221
220
  }
222
221
 
222
+ .button__variant_accent:enabled:active,
223
223
  .button__variant_accent:enabled:hover,
224
+ .button__variant_accent:enabled[aria-pressed="true"],
225
+ .button__variant_primary:enabled:active,
224
226
  .button__variant_primary:enabled:hover,
225
- .button__variant_secondary:enabled:hover {
227
+ .button__variant_primary:enabled[aria-pressed="true"],
228
+ .button__variant_secondary:enabled:active,
229
+ .button__variant_secondary:enabled:hover,
230
+ .button__variant_secondary:enabled[aria-pressed="true"] {
226
231
  box-shadow: inset 0 0 0 0 transparent;
227
- filter: none;
232
+ filter: drop-shadow(0 1px 0 transparent);
228
233
  }
229
234
 
230
235
  .button__variant_ghost:enabled:hover,
package/src/button.tsx CHANGED
@@ -5,15 +5,15 @@ import styles from "@/button.module.css"
5
5
 
6
6
  export interface ButtonProps
7
7
  extends Omit<ComponentProps<"button">, "aria-pressed" | "disabled"> {
8
- fullWidth?: boolean
9
8
  iconEnd?: ReactNode
10
9
  iconOnly?: boolean
11
10
  iconStart?: ReactNode
12
11
  isActive?: boolean
13
12
  isDisabled?: boolean
13
+ isFullWidth?: boolean
14
14
  isLoading?: boolean
15
15
  isRounded?: boolean
16
- size?: 32 | 36 | 40 | 48
16
+ size?: 32 | 36 | 40 | 44
17
17
  variant?: "accent" | "ghost" | "primary" | "secondary"
18
18
  }
19
19
 
@@ -21,7 +21,9 @@ type ButtonPropsInternal = ButtonPropsWithIcon | ButtonPropsWithText
21
21
 
22
22
  interface ButtonPropsWithIcon extends ButtonProps {
23
23
  children?: ReactNode
24
+ iconEnd?: never
24
25
  iconOnly: true
26
+ iconStart?: never
25
27
  }
26
28
 
27
29
  interface ButtonPropsWithText extends ButtonProps {
@@ -33,12 +35,12 @@ export function Button(props: ButtonPropsInternal): JSX.Element {
33
35
  const {
34
36
  children = "",
35
37
  className: customClassName = "",
36
- fullWidth = false,
37
38
  iconEnd = "",
38
39
  iconOnly = false,
39
40
  iconStart = "",
40
41
  isActive = false,
41
42
  isDisabled = false,
43
+ isFullWidth = false,
42
44
  isLoading = false,
43
45
  isRounded = false,
44
46
  size = 36,
@@ -51,7 +53,7 @@ export function Button(props: ButtonPropsInternal): JSX.Element {
51
53
  ${BUTTON_CLASS_NAME.BASE}
52
54
  ${BUTTON_CLASS_NAME.SIZE[size]}
53
55
  ${BUTTON_CLASS_NAME.VARIANT[variant.toUpperCase() as keyof typeof BUTTON_CLASS_NAME.VARIANT]}
54
- ${fullWidth ? BUTTON_CLASS_NAME.WIDTH.FULL : BUTTON_CLASS_NAME.WIDTH.BASE}
56
+ ${isFullWidth ? BUTTON_CLASS_NAME.WIDTH.FULL : BUTTON_CLASS_NAME.WIDTH.BASE}
55
57
  ${iconOnly ? BUTTON_CLASS_NAME.ICON_ONLY : ""}
56
58
  ${isRounded ? BUTTON_CLASS_NAME.ROUNDED.FULL : BUTTON_CLASS_NAME.ROUNDED.BASE}
57
59
  ${customClassName}
@@ -87,7 +89,7 @@ export const BUTTON_CLASS_NAME = {
87
89
  32: styles.button__size_32,
88
90
  36: styles.button__size_36,
89
91
  40: styles.button__size_40,
90
- 48: styles.button__size_48,
92
+ 44: styles.button__size_44,
91
93
  },
92
94
  VARIANT: {
93
95
  ACCENT: styles.button__variant_accent,
package/src/index.ts CHANGED
@@ -1 +1,3 @@
1
1
  export * from "@/button"
2
+ export * from "@/input"
3
+ export * from "@/label"
@@ -0,0 +1,57 @@
1
+ /* ===================================================== */
2
+ /* Base */
3
+ /* ===================================================== */
4
+ .input {
5
+ appearance: none;
6
+ background-color: var(--color-gray-1, #fcfcfc);
7
+ border-color: var(--color-gray-5, #e0e0e0);
8
+ border-radius: 8px;
9
+ border-style: solid;
10
+ border-width: 1px;
11
+ 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-9, #e93d82);
20
+ outline-offset: 2px;
21
+ outline-style: solid;
22
+ outline-width: 0;
23
+ padding: 0 12px;
24
+ text-decoration: none;
25
+ transition-duration: 150ms;
26
+ transition-property: background-color, border-color, box-shadow, opacity;
27
+ width: 100%;
28
+ }
29
+
30
+ .input::placeholder {
31
+ color: var(--color-gray-9, #8d8d8d);
32
+ user-select: none;
33
+ }
34
+
35
+ .input:disabled {
36
+ cursor: not-allowed;
37
+ opacity: 0.5;
38
+ }
39
+
40
+ .input:enabled:active,
41
+ .input:enabled:focus,
42
+ .input:enabled:hover,
43
+ .input:enabled[aria-pressed="true"] {
44
+ border-color: var(--color-gray-8, #bbbbbb);
45
+ box-shadow: 0 1px transparent;
46
+ }
47
+
48
+ .input:focus-visible {
49
+ outline-width: 2px;
50
+ }
51
+
52
+ /* ===================================================== */
53
+ /* Password */
54
+ /* ===================================================== */
55
+ .input__password {
56
+ font-family: var(--font-mono, monospace);
57
+ }
package/src/input.tsx ADDED
@@ -0,0 +1,49 @@
1
+ import type { ComponentProps, JSX } from "react"
2
+ import styles from "@/input.module.css"
3
+
4
+ export interface InputProps
5
+ extends Omit<
6
+ ComponentProps<"input">,
7
+ "aria-pressed" | "disabled" | "readOnly"
8
+ > {
9
+ isActive?: boolean
10
+ isDisabled?: boolean
11
+ isReadOnly?: boolean
12
+ }
13
+
14
+ export function Input(props: InputProps): JSX.Element {
15
+ const {
16
+ className: customClassName = "",
17
+ isActive = false,
18
+ isDisabled = false,
19
+ isReadOnly = false,
20
+ type = "text",
21
+ ...rest
22
+ } = props
23
+
24
+ const isPassword = type === "password"
25
+
26
+ const combinedClassName = `
27
+ ${INPUT_CLASS_NAME.BASE}
28
+ ${isPassword ? INPUT_CLASS_NAME.PASSWORD : ""}
29
+ ${customClassName}
30
+ `
31
+ .replaceAll(/\s+/g, " ")
32
+ .trim()
33
+
34
+ return (
35
+ <input
36
+ aria-pressed={isActive}
37
+ className={combinedClassName}
38
+ disabled={isDisabled}
39
+ readOnly={isReadOnly}
40
+ type={type}
41
+ {...rest}
42
+ />
43
+ )
44
+ }
45
+
46
+ export const INPUT_CLASS_NAME = {
47
+ BASE: styles.input,
48
+ PASSWORD: styles.input__password,
49
+ } as const
@@ -0,0 +1,8 @@
1
+ /* ===================================================== */
2
+ /* Base */
3
+ /* ===================================================== */
4
+ .label {
5
+ color: var(--color-gray-11, #646464);
6
+ font-size: 13px;
7
+ width: fit-content;
8
+ }
package/src/label.tsx ADDED
@@ -0,0 +1,21 @@
1
+ import type { ComponentProps, JSX } from "react"
2
+ import styles from "@/label.module.css"
3
+
4
+ export interface LabelProps extends ComponentProps<"label"> {}
5
+
6
+ export function Label(props: LabelProps): JSX.Element {
7
+ const { className: customClassName = "", ...rest } = props
8
+
9
+ const combinedClassName = `
10
+ ${LABEL_CLASS_NAME.BASE}
11
+ ${customClassName}
12
+ `
13
+ .replaceAll(/\s+/g, " ")
14
+ .trim()
15
+
16
+ return <label className={combinedClassName} {...rest} />
17
+ }
18
+
19
+ export const LABEL_CLASS_NAME = {
20
+ BASE: styles.label,
21
+ } as const
package/tsup.config.ts CHANGED
@@ -5,7 +5,7 @@ export default defineConfig({
5
5
  dts: true,
6
6
  entry: ["src/index.ts"],
7
7
  external: ["react", "react-dom"],
8
- format: ["esm", "cjs"],
8
+ format: ["cjs", "esm"],
9
9
  loader: { ".css": "copy" },
10
10
  sourcemap: true,
11
11
  splitting: true,
package/.prettierrc DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "cssDeclarationSorterOrder": "alphabetical",
3
- "jsonRecursiveSort": true,
4
- "plugins": [
5
- "prettier-plugin-css-order",
6
- "prettier-plugin-packagejson",
7
- "prettier-plugin-sort-json"
8
- ],
9
- "semi": false
10
- }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Natt Nguyen
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.