@duro-app/ui 0.27.0 → 0.29.0
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/dist/components/Input/Input.d.ts +2 -1
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts +2 -1
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +1116 -1114
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Input/Input.tsx +8 -4
- package/src/components/Textarea/Textarea.tsx +6 -0
- package/src/global-reset.css +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duro-app/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@duro-app/tokens": "^0.
|
|
56
|
+
"@duro-app/tokens": "^0.29.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@babel/preset-typescript": "^7.28.0",
|
|
@@ -29,6 +29,7 @@ interface InputProps {
|
|
|
29
29
|
value?: string
|
|
30
30
|
defaultValue?: string
|
|
31
31
|
disabled?: boolean
|
|
32
|
+
autoFocus?: boolean
|
|
32
33
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void
|
|
33
34
|
onBlur?: () => void
|
|
34
35
|
ref?: React.Ref<HTMLInputElement>
|
|
@@ -46,6 +47,7 @@ export function Input({
|
|
|
46
47
|
value,
|
|
47
48
|
defaultValue,
|
|
48
49
|
disabled,
|
|
50
|
+
autoFocus,
|
|
49
51
|
onChange,
|
|
50
52
|
onBlur,
|
|
51
53
|
ref,
|
|
@@ -62,9 +64,11 @@ export function Input({
|
|
|
62
64
|
const effectiveDisabled = disabled ?? ctx?.disabled
|
|
63
65
|
const effectiveVariant = ctx?.invalid ? 'error' : variant
|
|
64
66
|
|
|
65
|
-
// react-strict-dom omits web-only
|
|
66
|
-
// underlying DOM element supports
|
|
67
|
-
const extraProps
|
|
67
|
+
// react-strict-dom omits some web-only props from its types, but the
|
|
68
|
+
// underlying DOM element supports them. Type-assert to pass them through.
|
|
69
|
+
const extraProps: Record<string, unknown> = {}
|
|
70
|
+
if (pattern !== undefined) extraProps.pattern = pattern
|
|
71
|
+
if (autoFocus) extraProps.autoFocus = true
|
|
68
72
|
|
|
69
73
|
return (
|
|
70
74
|
<html.input
|
|
@@ -86,7 +90,7 @@ export function Input({
|
|
|
86
90
|
onBlur={effectiveOnBlur as StrictInputProps['onBlur']}
|
|
87
91
|
ref={effectiveRef as React.Ref<HTMLInputElement>}
|
|
88
92
|
style={[styles.base, styles[effectiveVariant], groupCtx?.inGroup && styles.inGroup]}
|
|
89
|
-
{...
|
|
93
|
+
{...extraProps}
|
|
90
94
|
/>
|
|
91
95
|
)
|
|
92
96
|
}
|
|
@@ -15,6 +15,7 @@ interface TextareaProps {
|
|
|
15
15
|
value?: string
|
|
16
16
|
defaultValue?: string
|
|
17
17
|
disabled?: boolean
|
|
18
|
+
autoFocus?: boolean
|
|
18
19
|
onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void
|
|
19
20
|
onBlur?: () => void
|
|
20
21
|
ref?: React.Ref<HTMLTextAreaElement>
|
|
@@ -29,6 +30,7 @@ export function Textarea({
|
|
|
29
30
|
value,
|
|
30
31
|
defaultValue,
|
|
31
32
|
disabled,
|
|
33
|
+
autoFocus,
|
|
32
34
|
onChange,
|
|
33
35
|
onBlur,
|
|
34
36
|
ref,
|
|
@@ -44,6 +46,9 @@ export function Textarea({
|
|
|
44
46
|
const effectiveDisabled = disabled ?? ctx?.disabled
|
|
45
47
|
const effectiveVariant = ctx?.invalid ? 'error' : variant
|
|
46
48
|
|
|
49
|
+
const extraProps: Record<string, unknown> = {}
|
|
50
|
+
if (autoFocus) extraProps.autoFocus = true
|
|
51
|
+
|
|
47
52
|
return (
|
|
48
53
|
<html.textarea
|
|
49
54
|
id={ctx?.controlId}
|
|
@@ -62,6 +67,7 @@ export function Textarea({
|
|
|
62
67
|
onBlur={effectiveOnBlur as StrictTextareaProps['onBlur']}
|
|
63
68
|
ref={effectiveRef as React.Ref<HTMLTextAreaElement>}
|
|
64
69
|
style={[styles.base, styles[effectiveVariant]]}
|
|
70
|
+
{...extraProps}
|
|
65
71
|
/>
|
|
66
72
|
)
|
|
67
73
|
}
|
package/src/global-reset.css
CHANGED
|
@@ -11,10 +11,25 @@
|
|
|
11
11
|
font-size: 16px;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
html,
|
|
15
|
+
body {
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
body {
|
|
15
20
|
font-family:
|
|
16
21
|
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
17
22
|
line-height: 1.5;
|
|
18
23
|
min-height: 100vh;
|
|
24
|
+
background-color: #0f0f0f;
|
|
25
|
+
color: #e5e5e5;
|
|
26
|
+
-webkit-font-smoothing: antialiased;
|
|
27
|
+
-moz-osx-font-smoothing: grayscale;
|
|
28
|
+
color-scheme: dark;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
a {
|
|
32
|
+
color: inherit;
|
|
33
|
+
text-decoration: none;
|
|
19
34
|
}
|
|
20
35
|
}
|