@modlin/ui 0.0.244 → 0.0.246

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@modlin/ui",
4
4
  "description": "A lightweight UI library built on the Suffix design system for consistent, fast, and elegant interfaces.",
5
- "version": "0.0.244",
5
+ "version": "0.0.246",
6
6
  "main": "src/index.ts",
7
7
  "type": "module",
8
8
  "exports": {
package/src/button.tsx CHANGED
@@ -19,13 +19,13 @@ const size: Record<Size, string> = {
19
19
  }
20
20
  const variant: Record<Variant, string> = {
21
21
  primary: "bg-primary disabled:bg-primary/60 hover:bg-primary/85 active:bg-primary/85 text-background",
22
- secondary: "bg-secondary hover:bg-secondary/75",
22
+ secondary: "bg-secondary hover:bg-secondary/75 backdrop-blur-sm",
23
23
  destructive: "bg-red hover:bg-red/85 text-white",
24
24
  outline: cn(
25
- "bg-background inset-ring inset-ring-border",
25
+ "bg-background/25 backdrop-blur-sm inset-ring inset-ring-border",
26
26
  "hover:bg-secondary active:bg-secondary focus-visible:inset-ring-muted-foreground disabled:bg-background disabled:text-muted-foreground",
27
27
  ),
28
- ghost: "hover:bg-secondary",
28
+ ghost: "hover:bg-secondary backdrop-blur-sm",
29
29
  link: "text-primary hover:underline",
30
30
  none: cn(),
31
31
  // jnsa: "bg-(--purple) hover:bg-(--purple)/90 text-white",
package/src/checkbox.tsx CHANGED
@@ -34,7 +34,7 @@ export interface CheckboxProps {
34
34
  }
35
35
  export default function Checkbox(props: Readonly<CheckboxProps>): ReactElement<CheckboxProps> {
36
36
  const input = useRef<HTMLInputElement>(null)
37
- const button = useRef<HTMLInputElement>(null)
37
+ const button = useRef<HTMLButtonElement>(null)
38
38
  let checked = props.checked || props.defaultChecked || false
39
39
 
40
40
  return (
package/src/input.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { type ChangeEvent, type FocusEvent, type HTMLInputAutoCompleteAttribute, forwardRef } from "react"
1
+ import type { ChangeEvent, FocusEvent, HTMLInputAutoCompleteAttribute, InvalidEvent } from "react"
2
2
  import type { Variant } from "./globals"
3
3
  import { cn } from "./utils"
4
4
 
@@ -16,7 +16,7 @@ export const input_variant: Record<Variant, string> = {
16
16
  ),
17
17
  secondary: cn(),
18
18
  destructive: cn(
19
- "bg-background",
19
+ "bg-background/25 backdrop-blur-sm",
20
20
  "placeholder:text-muted-foreground disabled:text-disabled",
21
21
  "inset-ring inset-ring-red/50 disabled:inset-ring-red/25 focus:inset-ring-red/75",
22
22
  "focus:ring-4 focus:ring-red/10",
@@ -34,63 +34,62 @@ type InputMode = "search" | "text" | "email" | "tel" | "url" | "none" | "numeric
34
34
  type BlurEvent = FocusEvent<HTMLInputElement, Element>
35
35
 
36
36
  export interface InputProps {
37
- /** @android @ios @web */
37
+ /** @android @ios @web */
38
38
  placeholder?: string
39
- /** @android @ios @web */
39
+ /** @android @ios @web */
40
40
  defaultValue?: string
41
- /** @android @ios @web */
41
+ /** @android @ios @web */
42
42
  inputMode?: InputMode
43
- /** @android @ios @web */
43
+ /** @android @ios @web */
44
44
  value?: string
45
- /** @android @ios @web */
45
+ /** @android @ios @web */
46
46
  readOnly?: boolean
47
- /** @android @ios @web */
47
+ /** @android @ios @web */
48
48
  maxLength?: number
49
- /** @android @ios @web */
49
+ /** @android @ios @web */
50
50
  autoCapitalize?: "none" | "sentences" | "words" | "characters"
51
- /** @android @ios @web */
51
+ /** @android @ios @web */
52
52
  autoComplete?: HTMLInputAutoCompleteAttribute
53
- /** @android @ios @web */
53
+ /** @android @ios @web */
54
54
  autoCorrect?: boolean
55
- /** @android @ios @web */
55
+ /** @android @ios @web */
56
56
  variant?: Variant
57
- /** @web */
57
+ /** @web */
58
58
  id?: string
59
- /** @web */
59
+ /** @web */
60
60
  type?: InputType
61
- /** @web */
61
+ /** @web */
62
62
  name?: string
63
- /** @web */
63
+ /** @web */
64
64
  required?: boolean // validation
65
- /** @web */
65
+ /** @web */
66
66
  disabled?: boolean
67
- /** @web */
67
+ /** @web */
68
68
  pattern?: string // validation
69
- /** @web */
69
+ /** @web */
70
70
  min?: number | string // validation
71
- /** @web */
71
+ /** @web */
72
72
  max?: number | string // validation
73
- /** @web */
73
+ /** @web */
74
74
  minLength?: number // validation
75
- /** @web */
75
+ /** @web */
76
76
  invalid?: boolean
77
- /** @web */
77
+ /** @web */
78
78
  describedby?: string
79
- /** @web */
79
+ /** @web */
80
80
  className?: string
81
- /** @android @ios @web */
82
- onChange?(event: ChangeEvent): void
83
- /** @android @ios @web */
84
- onFocus?(event: FocusEvent): void
85
- /** @android @ios @web */
81
+ /** @android @ios @web */
82
+ onChange?(event: ChangeEvent<HTMLInputElement>): void
83
+ /** @android @ios @web */
84
+ onFocus?(event: FocusEvent<HTMLInputElement>): void
85
+ /** @android @ios @web */
86
86
  onBlur?(event: BlurEvent): void
87
+ /** @web */
88
+ onInvalid?(event: InvalidEvent<HTMLInputElement>): void
87
89
  }
88
- const Input = forwardRef<HTMLInputElement, Readonly<InputProps>>((props, ref) => {
89
- const { onChange } = props
90
-
90
+ const Input = (props: Readonly<InputProps>) => {
91
91
  return (
92
92
  <input
93
- ref={ref}
94
93
  type={props.type ?? "text"}
95
94
  inputMode={props.inputMode}
96
95
  placeholder={props.placeholder}
@@ -105,16 +104,16 @@ const Input = forwardRef<HTMLInputElement, Readonly<InputProps>>((props, ref) =>
105
104
  required={props.required}
106
105
  readOnly={props.readOnly}
107
106
  disabled={props.disabled}
108
- onChange={onChange}
109
- onFocus={props.onFocus}
110
- onBlur={props.onBlur}
111
- onInvalid={e => e.preventDefault()}
112
107
  id={props.id}
113
- autoCapitalize={props.autoCapitalize}
108
+ autoCapitalize={props.autoCapitalize}
114
109
  autoComplete={props.autoComplete}
115
- autoCorrect={props.autoCorrect ? "on" : "off"}
110
+ autoCorrect={props.autoCorrect ? "on" : "off"}
116
111
  aria-describedby={props.describedby}
117
112
  data-invalid={props.invalid}
113
+ onChange={props.onChange}
114
+ onFocus={props.onFocus}
115
+ onBlur={props.onBlur}
116
+ onInvalid={props.onInvalid}
118
117
  className={cn(
119
118
  "flex items-center w-full h-12 px-4",
120
119
  "transition transition-duration-150 transition-[box-shadow] ease-in",
@@ -124,5 +123,5 @@ const Input = forwardRef<HTMLInputElement, Readonly<InputProps>>((props, ref) =>
124
123
  )}
125
124
  />
126
125
  )
127
- })
126
+ }
128
127
  export default Input
@@ -1,15 +1,17 @@
1
- import type { ChangeEvent, ReactNode } from "react"
1
+ import { useRef, type ChangeEvent, type ReactNode } from "react"
2
2
  import { cn } from "./utils"
3
3
 
4
4
  export interface SelectProps {
5
- children?: ReactNode
5
+ defaultValue?: string
6
6
  name?: string
7
7
  id?: string
8
+ children?: ReactNode
8
9
  onChange?: (event: ChangeEvent<HTMLSelectElement>) => void
9
10
  }
10
11
  export function Select(props: SelectProps) {
11
12
  return (
12
13
  <select
14
+ defaultValue={props.defaultValue}
13
15
  name={props.name}
14
16
  id={props.id}
15
17
  onChange={props.onChange}
@@ -25,6 +27,9 @@ export function Select(props: SelectProps) {
25
27
  }
26
28
 
27
29
  export interface SelectItemProps {
30
+ disabled?: boolean
31
+ selected?: boolean
32
+ hidden?: boolean
28
33
  value: string
29
34
  children?: ReactNode
30
35
  className?: string
@@ -38,6 +43,9 @@ export function SelectItem(props: SelectItemProps) {
38
43
  props.className,
39
44
  )}
40
45
  value={props.value}
46
+ disabled={props.disabled}
47
+ selected={props.selected}
48
+ hidden={props.hidden}
41
49
  >
42
50
  {props.children}
43
51
  </option>
package/src/utils.ts CHANGED
@@ -1,5 +1,4 @@
1
- import clsx from "clsx"
2
- import type { ClassValue } from "clsx"
1
+ import clsx, { type ClassValue } from "clsx"
3
2
  import { twMerge } from "tailwind-merge"
4
3
 
5
4
  export function cn(...classList: ClassValue[]) {
package/src/example.tsx DELETED
@@ -1,30 +0,0 @@
1
- import { Heading4 } from "./heading"
2
- import Button from "./button"
3
- import Input from "./input"
4
- import Label from "./label"
5
- import { Muted } from "./typography"
6
-
7
- export function Example() {
8
- return (
9
- <div className="flex flex-1 flex-col gap-8 p-8 bg-background">
10
- <header>
11
- <Heading4 className="h-8">Login to your account</Heading4>
12
- <Muted>Enter your email address below to login to your account</Muted>
13
- </header>
14
- <div className="flex flex-col gap-4">
15
- <div className="flex flex-col gap-2">
16
- <Label htmlFor="email">Email address</Label>
17
- <Input placeholder="m@example.com" id="email" type="email" inputMode="email" autoComplete="email" autoCapitalize="none" />
18
- </div>
19
- <div className="flex flex-col gap-2">
20
- <Label htmlFor="password">Password</Label>
21
- <Input id="password" type="password" autoComplete="password" autoCapitalize="none" />
22
- </div>
23
- </div>
24
- <div className="flex flex-col gap-4">
25
- <Button title="Login" haptics />
26
- <Button variant="outline" title="Login with Google" haptics />
27
- </div>
28
- </div>
29
- )
30
- }