@octane-xplat/files 0.0.1 → 0.10.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/src/props.ts ADDED
@@ -0,0 +1,52 @@
1
+ import type { Octane } from 'octane/jsx-runtime'
2
+
3
+ import type { FieldControlProps, FieldStatus, FieldStatusType } from '@octane-xplat/ui'
4
+ import type { FileRef } from './types'
5
+
6
+ /** A portable selected file. The browser File is only present on web. */
7
+ export interface FileInputFile extends FileRef {
8
+ size?: number
9
+ mimeType?: string
10
+ file?: any
11
+ }
12
+
13
+ export type FileInputStatus = FieldStatus
14
+ export type FileInputStatusType = FieldStatusType
15
+
16
+ export type FileInputPick = (options: {
17
+ accept?: string
18
+ multiple?: boolean
19
+ }) => Promise<FileInputFile[] | FileInputFile | null>
20
+
21
+ export interface FileInputHandle {
22
+ open(): void
23
+ native: any
24
+ }
25
+
26
+ export interface FileInputProps extends FieldControlProps {
27
+ className?: any
28
+ style?: any
29
+ id?: string
30
+ accessibilityLabel?: string
31
+ accessibilityHint?: string
32
+ /** `input` is a compact field row; `dropzone` a larger target that
33
+ * accepts drag/drop on pointer platforms. @default 'input' */
34
+ mode?: 'input' | 'dropzone'
35
+ value: FileInputFile | FileInputFile[] | null
36
+ onChange: (value: FileInputFile | FileInputFile[] | null) => void
37
+ changeAction?: (value: FileInputFile | FileInputFile[] | null) => void | Promise<void>
38
+ /** `accept`-style filter: `.ext`, `type/subtype`, wildcard subtype, any. */
39
+ accept?: string
40
+ /** When true, `value` and `onChange` use file arrays. */
41
+ isMultiple?: boolean
42
+ /** Max bytes per file; skipped for refs without a `size`. */
43
+ maxSize?: number
44
+ maxFiles?: number
45
+ placeholder?: string
46
+ /** Optional per-instance picker override for cloud or app-specific sources. */
47
+ pick?: FileInputPick
48
+ ref?: Octane.Ref<FileInputHandle>
49
+ ios?: any
50
+ android?: any
51
+ web?: any
52
+ }
package/src/types.ts ADDED
@@ -0,0 +1,9 @@
1
+ export interface FileRef {
2
+ name: string
3
+ /**
4
+ * Opaque reference: blob/object URL on web, filesystem path on native.
5
+ * `files.writeText()` downloads on web and writes where implemented.
6
+ * Picked mobile files may use `content://` URIs.
7
+ */
8
+ uri: string
9
+ }
@@ -0,0 +1,15 @@
1
+ import type { UniversalComponent } from 'octane/universal'
2
+ import type { FileInputProps } from '../src/props.js'
3
+
4
+ export declare const FileInput: UniversalComponent<FileInputProps>
5
+ export type {
6
+ FileInputFile,
7
+ FileInputHandle,
8
+ FileInputPick,
9
+ FileInputProps,
10
+ FileInputStatus,
11
+ FileInputStatusType,
12
+ } from '../src/props.js'
13
+
14
+ export { files } from '../src/files.js'
15
+ export type { FileRef } from '../src/types.js'
@@ -0,0 +1,14 @@
1
+ import type { FileInputProps } from '../src/props.js'
2
+
3
+ export declare function FileInput(props: FileInputProps): unknown
4
+ export type {
5
+ FileInputFile,
6
+ FileInputHandle,
7
+ FileInputPick,
8
+ FileInputProps,
9
+ FileInputStatus,
10
+ FileInputStatusType,
11
+ } from '../src/props.js'
12
+
13
+ export { files } from '../src/files.macos.js'
14
+ export type { FileRef } from '../src/types.js'
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export {}
package/index.js DELETED
@@ -1,2 +0,0 @@
1
- // Reservation stub; implementation will arrive in a later release.
2
- module.exports = {}