@startupjs-ui/file-input 0.2.2 → 0.3.1
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/CHANGELOG.md +19 -0
- package/README.mdx +1 -0
- package/index.d.ts +5 -1
- package/index.tsx +3 -1
- package/input.expo.tsx +7 -4
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.3.1](https://github.com/startupjs/startupjs-ui/compare/v0.3.0...v0.3.1) (2026-06-08)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @startupjs-ui/file-input
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [0.3.0](https://github.com/startupjs/startupjs-ui/compare/v0.2.3...v0.3.0) (2026-05-27)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* [BREAKING] [0.3] improve accessibility props for E2E tests. Support testID everywhere ([#31](https://github.com/startupjs/startupjs-ui/issues/31)) ([882588c](https://github.com/startupjs/startupjs-ui/commit/882588ca37d5e1fd14b5717b5697cf9ed47042e4))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.2.2](https://github.com/startupjs/startupjs-ui/compare/v0.2.1...v0.2.2) (2026-05-11)
|
|
7
26
|
|
|
8
27
|
|
package/README.mdx
CHANGED
|
@@ -63,6 +63,7 @@ return (
|
|
|
63
63
|
- **afterUpload** -- a hook called after the upload finishes (can be async)
|
|
64
64
|
- **render** -- a custom render function to replace the default Upload/Change/Delete buttons
|
|
65
65
|
- **style** -- custom styles for the component
|
|
66
|
+
- **testID** -- forwarded to the default Upload/Change action button. The Delete button receives `${testID}-delete`. When using `render`, place the passed `testID` on your custom control.
|
|
66
67
|
- **ref** -- a ref object to access imperative methods (see below)
|
|
67
68
|
|
|
68
69
|
## Imperative methods
|
package/index.d.ts
CHANGED
|
@@ -22,9 +22,13 @@ export interface FileInputProps {
|
|
|
22
22
|
/** Called with new fileId after successful upload */
|
|
23
23
|
onChange?: (fileId?: string) => void;
|
|
24
24
|
/** Custom renderer instead of the default Upload/Change/Delete buttons */
|
|
25
|
-
render?: (
|
|
25
|
+
render?: (props?: {
|
|
26
|
+
testID?: string;
|
|
27
|
+
}) => ReactNode;
|
|
26
28
|
/** Custom styles (reserved for future use) */
|
|
27
29
|
style?: any;
|
|
30
|
+
/** Test identifier for the default primary action button */
|
|
31
|
+
testID?: string;
|
|
28
32
|
}
|
|
29
33
|
export interface FileInputRef {
|
|
30
34
|
/** Opens the native picker and (optionally) uploads the selected file */
|
package/index.tsx
CHANGED
|
@@ -22,9 +22,11 @@ export interface FileInputProps {
|
|
|
22
22
|
/** Called with new fileId after successful upload */
|
|
23
23
|
onChange?: (fileId?: string) => void
|
|
24
24
|
/** Custom renderer instead of the default Upload/Change/Delete buttons */
|
|
25
|
-
render?: () => ReactNode
|
|
25
|
+
render?: (props?: { testID?: string }) => ReactNode
|
|
26
26
|
/** Custom styles (reserved for future use) */
|
|
27
27
|
style?: any
|
|
28
|
+
/** Test identifier for the default primary action button */
|
|
29
|
+
testID?: string
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export interface FileInputRef {
|
package/input.expo.tsx
CHANGED
|
@@ -22,6 +22,7 @@ function FileInput ({
|
|
|
22
22
|
afterUpload,
|
|
23
23
|
onChange = () => undefined,
|
|
24
24
|
render,
|
|
25
|
+
testID,
|
|
25
26
|
ref
|
|
26
27
|
}: FileInputProps): ReactNode {
|
|
27
28
|
let fileId = initialFileId
|
|
@@ -82,19 +83,21 @@ function FileInput ({
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
function renderDefault (): ReactNode {
|
|
86
|
+
const deleteTestID = testID ? `${testID}-delete` : undefined
|
|
87
|
+
|
|
85
88
|
return pug`
|
|
86
89
|
if fileId
|
|
87
90
|
Div(row)
|
|
88
|
-
Button(onPress=pickFile) Change
|
|
89
|
-
Button(pushed onPress=handleDeleteFile variant='text' icon=faTrashAlt)
|
|
91
|
+
Button(testID=testID onPress=pickFile) Change
|
|
92
|
+
Button(testID=deleteTestID pushed onPress=handleDeleteFile variant='text' icon=faTrashAlt)
|
|
90
93
|
else
|
|
91
|
-
Button(onPress=pickFile) Upload file
|
|
94
|
+
Button(testID=testID onPress=pickFile) Upload file
|
|
92
95
|
`
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
return pug`
|
|
96
99
|
if render
|
|
97
|
-
= render()
|
|
100
|
+
= render({ testID })
|
|
98
101
|
else
|
|
99
102
|
= renderDefault()
|
|
100
103
|
`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/file-input",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@fortawesome/free-solid-svg-icons": "^7.1.0",
|
|
24
|
-
"@startupjs-ui/button": "^0.
|
|
25
|
-
"@startupjs-ui/core": "^0.
|
|
26
|
-
"@startupjs-ui/dialogs": "^0.
|
|
27
|
-
"@startupjs-ui/div": "^0.
|
|
24
|
+
"@startupjs-ui/button": "^0.3.1",
|
|
25
|
+
"@startupjs-ui/core": "^0.3.0",
|
|
26
|
+
"@startupjs-ui/dialogs": "^0.3.1",
|
|
27
|
+
"@startupjs-ui/div": "^0.3.1",
|
|
28
28
|
"busboy": "^1.6.0",
|
|
29
29
|
"expo-document-picker": ">=14.0.0",
|
|
30
30
|
"expo-image-picker": ">=17.0.0",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"optional": true
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "60311773bdc83f354c797a272774304502d28c58"
|
|
53
53
|
}
|