@startupjs-ui/file-input 0.2.1 → 0.3.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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
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.0](https://github.com/startupjs/startupjs-ui/compare/v0.2.3...v0.3.0) (2026-05-27)
7
+
8
+
9
+ ### Features
10
+
11
+ * [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))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.2.2](https://github.com/startupjs/startupjs-ui/compare/v0.2.1...v0.2.2) (2026-05-11)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **file-input:** fix typings of the files plugin ([2bf0191](https://github.com/startupjs/startupjs-ui/commit/2bf0191c7b389982f0956925f27b28e38de6427d))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [0.2.1](https://github.com/startupjs/startupjs-ui/compare/v0.2.0...v0.2.1) (2026-05-11)
7
29
 
8
30
 
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/files.plugin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CollectionSpec, Signal, SignalModelConstructor } from 'startupjs'
1
+ import { Signal, type CollectionSpec } from 'startupjs'
2
2
 
3
3
  export interface FileDoc {
4
4
  storageType: string
@@ -49,7 +49,7 @@ export interface FilesPluginServerOptions {
49
49
  transformUpload?: (context: FileUploadContext) => FileUploadTransformResult | void | Promise<FileUploadTransformResult | void>
50
50
  }
51
51
 
52
- interface FilesModel extends Signal<FileDoc[]> {
52
+ export declare class FilesModel extends Signal<FileDoc[]> {
53
53
  addNew (file: Omit<FileDoc, 'createdAt' | 'updatedAt'>): Promise<string>
54
54
  getUrl (fileId: string, extension?: string): string
55
55
  getDownloadUrl (fileId: string, extension?: string): string
@@ -57,7 +57,7 @@ interface FilesModel extends Signal<FileDoc[]> {
57
57
  getDeleteUrl (fileId: string): string
58
58
  }
59
59
 
60
- interface FileModel extends Signal<FileDoc> {
60
+ export declare class FileModel extends Signal<FileDoc> {
61
61
  getUrl (): string
62
62
  getDownloadUrl (): string
63
63
  getUploadUrl (): string
@@ -65,13 +65,10 @@ interface FileModel extends Signal<FileDoc> {
65
65
  getBlob (): Promise<Blob>
66
66
  }
67
67
 
68
- type FilesModelConstructor = SignalModelConstructor<FileDoc[], FilesModel>
69
- type FileModelConstructor = SignalModelConstructor<FileDoc, FileModel>
70
-
71
68
  declare module 'teamplay' {
72
69
  interface TeamplayPluginCollections {
73
70
  '@startupjs-ui/file-input/files': {
74
- files: CollectionSpec<FileDoc, FilesModelConstructor, FileModelConstructor>
71
+ files: CollectionSpec<FileDoc, typeof FilesModel, typeof FileModel>
75
72
  }
76
73
  }
77
74
  }
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?: () => ReactNode;
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.2.1",
3
+ "version": "0.3.0",
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.2.0",
25
- "@startupjs-ui/core": "^0.2.0",
26
- "@startupjs-ui/dialogs": "^0.2.0",
27
- "@startupjs-ui/div": "^0.2.0",
24
+ "@startupjs-ui/button": "^0.3.0",
25
+ "@startupjs-ui/core": "^0.3.0",
26
+ "@startupjs-ui/dialogs": "^0.3.0",
27
+ "@startupjs-ui/div": "^0.3.0",
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": "38511829e3e4f084aecc79ae563e83286e319249"
52
+ "gitHead": "8d212b47680af1dfe582f9759b38724b46488e25"
53
53
  }