@molecule/app-file-dropzone-react 5.0.0 → 5.1.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/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-26T08:58:20.561Z
6
+ Generated: 2026-11-27T12:43:50.682Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-file-dropzone-react
@@ -87,16 +87,7 @@ Rejects files exceeding `maxSize` or not matching `accept` (best-effort
87
87
  extension/MIME check) via `onRejected`.
88
88
 
89
89
  ```typescript
90
- function FileDropzone({
91
- onFiles,
92
- accept,
93
- multiple = false,
94
- maxSize,
95
- onRejected,
96
- children: childrenProp,
97
- disabled,
98
- className,
99
- }: FileDropzoneProps): JSX.Element
90
+ function FileDropzone(props: FileDropzoneProps): JSX.Element
100
91
  ```
101
92
 
102
93
  - `props` — Component props (see {@link FileDropzoneProps}).
@@ -110,7 +101,7 @@ Peer dependencies:
110
101
  - `@molecule/app-filesystem` ^1.1.0
111
102
  - `@molecule/app-react` ^4.13.0
112
103
  - `@molecule/app-ui` ^1.0.1
113
- - `@molecule/app-ui-react` ^4.12.0
104
+ - `@molecule/app-ui-react` ^4.13.0
114
105
  - `react` ^18.0.0 || ^19.0.0
115
106
 
116
107
  ### Runtime Dependencies
@@ -131,9 +122,8 @@ re-validate on the server. Files failing `accept` or `maxSize` go to
131
122
  Read selected bytes with `arrayBuffer()` or append a file to a multipart
132
123
  body with `file.appendTo(formData, fieldName)`.
133
124
 
134
- Pass `children` to replace the default "Drop files here or click to
135
- browse" copy; the default copy translates via
136
- `@molecule/app-locales-file-dropzone`.
125
+ Pass `children` to replace the default instructions. Browsers describe
126
+ dropping or browsing. The device entry shows the file picker action.
137
127
 
138
128
  The zone is a keyboard-activatable `role="button"` (`tabIndex={0}`):
139
129
  pressing Enter or Space opens the native file dialog, matching a click.
@@ -27,5 +27,13 @@ export interface FileDropzoneProps {
27
27
  * extension/MIME check) via `onRejected`.
28
28
  * @param props - Component props (see {@link FileDropzoneProps}).
29
29
  */
30
- export declare function FileDropzone({ onFiles, accept, multiple, maxSize, onRejected, children: childrenProp, disabled, className, }: FileDropzoneProps): JSX.Element;
30
+ export declare function FileDropzone(props: FileDropzoneProps): JSX.Element;
31
+ /**
32
+ * Shared file selection surface.
33
+ *
34
+ * @internal
35
+ */
36
+ export declare function FileDropzoneSurface({ onFiles, accept, multiple, maxSize, onRejected, children: childrenProp, disabled, className, devicePicker, }: FileDropzoneProps & {
37
+ devicePicker?: boolean;
38
+ }): JSX.Element;
31
39
  //# sourceMappingURL=FileDropzone.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileDropzone.d.ts","sourceRoot":"","sources":["../src/FileDropzone.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAG3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAM1D,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,8EAA8E;IAC9E,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,KAAK,IAAI,CAAA;IAC/C,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uDAAuD;IACvD,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,KAAK,IAAI,CAAA;IACnD,wFAAwF;IACxF,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,sBAAsB;IACtB,QAAQ,C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EAAE,YAAY,EACtB,QAAQ,EACR,SAAS,EACT,YAAoB,GACrB,EAAE,iBAAiB,GAAG;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,GAAG,CAAC,OAAO,CA8D9D"}
@@ -12,7 +12,15 @@ import { FileField, Text } from '@molecule/app-ui-react/elements';
12
12
  * extension/MIME check) via `onRejected`.
13
13
  * @param props - Component props (see {@link FileDropzoneProps}).
14
14
  */
15
- export function FileDropzone({ onFiles, accept, multiple = false, maxSize, onRejected, children: childrenProp, disabled, className, }) {
15
+ export function FileDropzone(props) {
16
+ return _jsx(FileDropzoneSurface, { ...props });
17
+ }
18
+ /**
19
+ * Shared file selection surface.
20
+ *
21
+ * @internal
22
+ */
23
+ export function FileDropzoneSurface({ onFiles, accept, multiple = false, maxSize, onRejected, children: childrenProp, disabled, className, devicePicker = false, }) {
16
24
  const children = slot(childrenProp);
17
25
  const cm = getClassMap();
18
26
  const { t } = useTranslation();
@@ -32,5 +40,7 @@ export function FileDropzone({ onFiles, accept, multiple = false, maxSize, onRej
32
40
  background: dragging
33
41
  ? 'color-mix(in srgb, var(--mol-color-primary, #3366ff) 6%, transparent)'
34
42
  : undefined,
35
- }, children: children ?? (_jsxs(_Fragment, { children: [_jsx(Text, { as: "p", className: cm.cn(cm.textSize('sm'), cm.fontWeight('semibold')), children: t('fileDropzone.dropHere', {}, { defaultValue: 'Drop files here or click to browse' }) }), accept && (_jsx(Text, { as: "p", className: cm.cn(cm.textSize('xs'), cm.sp('mt', 1)), children: t('fileDropzone.accepts', { accept }, { defaultValue: 'Accepts: {{accept}}' }) }))] })) }));
43
+ }, children: children ?? (_jsxs(_Fragment, { children: [_jsx(Text, { as: "p", className: cm.cn(cm.textSize('sm'), cm.fontWeight('semibold')), children: devicePicker
44
+ ? t('ui.fileField.browse', {}, { defaultValue: 'Browse files' })
45
+ : t('fileDropzone.dropHere', {}, { defaultValue: 'Drop files here or click to browse' }) }), accept && (_jsx(Text, { as: "p", className: cm.cn(cm.textSize('xs'), cm.sp('mt', 1)), children: t('fileDropzone.accepts', { accept }, { defaultValue: 'Accepts: {{accept}}' }) }))] })) }));
36
46
  }
package/dist/index.d.ts CHANGED
@@ -33,14 +33,13 @@
33
33
  * Read selected bytes with `arrayBuffer()` or append a file to a multipart
34
34
  * body with `file.appendTo(formData, fieldName)`.
35
35
  *
36
- * Pass `children` to replace the default "Drop files here or click to
37
- * browse" copy; the default copy translates via
38
- * `@molecule/app-locales-file-dropzone`.
36
+ * Pass `children` to replace the default instructions. Browsers describe
37
+ * dropping or browsing. The device entry shows the file picker action.
39
38
  *
40
39
  * The zone is a keyboard-activatable `role="button"` (`tabIndex={0}`):
41
40
  * pressing Enter or Space opens the native file dialog, matching a click.
42
41
  *
43
42
  * @module
44
43
  */
45
- export * from './FileDropzone.js';
44
+ export { FileDropzone, type FileDropzoneProps } from './FileDropzone.js';
46
45
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,cAAc,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAA"}
package/dist/index.js CHANGED
@@ -33,13 +33,12 @@
33
33
  * Read selected bytes with `arrayBuffer()` or append a file to a multipart
34
34
  * body with `file.appendTo(formData, fieldName)`.
35
35
  *
36
- * Pass `children` to replace the default "Drop files here or click to
37
- * browse" copy; the default copy translates via
38
- * `@molecule/app-locales-file-dropzone`.
36
+ * Pass `children` to replace the default instructions. Browsers describe
37
+ * dropping or browsing. The device entry shows the file picker action.
39
38
  *
40
39
  * The zone is a keyboard-activatable `role="button"` (`tabIndex={0}`):
41
40
  * pressing Enter or Space opens the native file dialog, matching a click.
42
41
  *
43
42
  * @module
44
43
  */
45
- export * from './FileDropzone.js';
44
+ export { FileDropzone } from './FileDropzone.js';
@@ -0,0 +1,6 @@
1
+ import type { JSX } from 'react';
2
+ import { type FileDropzoneProps } from './FileDropzone.js';
3
+ export type { FileDropzoneProps } from './FileDropzone.js';
4
+ /** File upload area using the device picker. */
5
+ export declare function FileDropzone(props: FileDropzoneProps): JSX.Element;
6
+ //# sourceMappingURL=native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,KAAK,iBAAiB,EAAuB,MAAM,mBAAmB,CAAA;AAE/E,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,gDAAgD;AAChD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAElE"}
package/dist/native.js ADDED
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FileDropzoneSurface } from './FileDropzone.js';
3
+ /** File upload area using the device picker. */
4
+ export function FileDropzone(props) {
5
+ return _jsx(FileDropzoneSurface, { ...props, devicePicker: true });
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-file-dropzone-react",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "Drag-drop file upload area with click-to-browse, accept/size filtering, and a content slot",
5
5
  "homepage": "https://www.molecule.dev/packages/app-file-dropzone-react",
6
6
  "type": "module",
@@ -13,6 +13,14 @@
13
13
  },
14
14
  "exports": {
15
15
  ".": {
16
+ "browser": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "react-native": {
21
+ "types": "./dist/native.d.ts",
22
+ "default": "./dist/native.js"
23
+ },
16
24
  "types": "./dist/index.d.ts",
17
25
  "import": "./dist/index.js"
18
26
  }
@@ -36,14 +44,14 @@
36
44
  "@molecule/app-filesystem": "^1.1.0",
37
45
  "@molecule/app-react": "^4.13.0",
38
46
  "@molecule/app-ui": "^1.0.1",
39
- "@molecule/app-ui-react": "^4.12.0",
47
+ "@molecule/app-ui-react": "^4.13.0",
40
48
  "react": "^18.0.0 || ^19.0.0"
41
49
  },
42
50
  "devDependencies": {
43
51
  "@molecule/app-filesystem": "1.1.0",
44
52
  "@molecule/app-react": "4.17.0",
45
- "@molecule/app-ui": "1.14.0",
46
- "@molecule/app-ui-react": "4.12.1",
53
+ "@molecule/app-ui": "1.15.0",
54
+ "@molecule/app-ui-react": "4.13.0",
47
55
  "@testing-library/react": "16.3.3",
48
56
  "@types/node": "26.6.5",
49
57
  "@types/react": "19.3.0",