@molecule/app-file-dropzone-angular 0.0.0-stage → 0.0.1-stage

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/index.js ADDED
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Angular file dropzone — drag-drop + click-to-browse file picker with
3
+ * accept / max-size filtering. Pure UI: it emits the chosen `File[]`
4
+ * and the host app performs the actual upload.
5
+ *
6
+ * Exports `<FileDropzone>` and its `FileDropzoneProps`. It is the Angular
7
+ * counterpart of `@molecule/app-file-dropzone-react`: same props and the same
8
+ * DOM for the same input.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { Component } from '@angular/core'
13
+ * import { FileDropzone } from '@molecule/app-file-dropzone-angular'
14
+ *
15
+ * @Component({
16
+ * selector: 'app-avatar-upload',
17
+ * standalone: true,
18
+ * imports: [FileDropzone],
19
+ * template: `
20
+ * <div
21
+ * mol-file-dropzone
22
+ * accept="image/*"
23
+ * [maxSize]="5 * 1024 * 1024"
24
+ * [onFiles]="uploadAvatar"
25
+ * [onRejected]="showError"
26
+ * ></div>
27
+ * `,
28
+ * })
29
+ * export class AvatarUpload {
30
+ * avatar: File | null = null
31
+ * error = ''
32
+ * uploadAvatar = (files: File[]): void => {
33
+ * this.avatar = files[0] ?? null
34
+ * }
35
+ * showError = (files: File[]): void => {
36
+ * this.error = `${files.length} file(s) are not images under 5 MB`
37
+ * }
38
+ * }
39
+ * ```
40
+ *
41
+ * @remarks
42
+ * With `multiple` false (the default) only the FIRST accepted file is
43
+ * delivered to `onFiles`, even when the user drops several at once.
44
+ *
45
+ * The `accept` filter is a best-effort client-side check (file
46
+ * extension or MIME prefix match) — treat it as UX sugar and always
47
+ * re-validate on the server. Files failing `accept` or `maxSize` go to
48
+ * `onRejected` (both rejection causes arrive in the same callback).
49
+ *
50
+ * `children` is projected content (Angular cannot carry a node in an input):
51
+ * put it between the element's tags to replace the default "Drop files here or
52
+ * click to browse" copy, which translates via
53
+ * `@molecule/app-locales-file-dropzone`.
54
+ *
55
+ * The zone is a keyboard-activatable `role="button"` (`tabindex="0"`):
56
+ * pressing Enter or Space opens the native file dialog, matching a click.
57
+ *
58
+ * @module
59
+ */
60
+ export * from './file-dropzone.component.js';
61
+ export * from './types.js';
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,cAAc,8BAA8B,CAAA;AAC5C,cAAc,YAAY,CAAA"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Types of `@molecule/app-file-dropzone-angular` — the Angular counterpart of
3
+ * `@molecule/app-file-dropzone-react`, same props and DOM.
4
+ *
5
+ * @module
6
+ */
7
+ /**
8
+ * Props accepted by {@link FileDropzone} — the same props
9
+ * `@molecule/app-file-dropzone-react` accepts. The node prop (`children`) is
10
+ * projected content in Angular (an input cannot carry a node), so it is typed
11
+ * `unknown`: pass it in the host template, not as a value.
12
+ */
13
+ export interface FileDropzoneProps {
14
+ /** Called with the File[] the user selected or dropped. */
15
+ onFiles: (files: File[]) => void;
16
+ /** Accept attribute (e.g. `'image/*'` or `'.pdf,.docx'`). */
17
+ accept?: string;
18
+ /** Allow multi-file selection. Defaults to false. */
19
+ multiple?: boolean;
20
+ /** Max file size in bytes. Files exceeding are rejected. */
21
+ maxSize?: number;
22
+ /** Called with rejected files (wrong type or size). */
23
+ onRejected?: (files: File[]) => void;
24
+ /** Content rendered inside the dropzone, projected as the element's default content. */
25
+ children?: unknown;
26
+ /** Disabled state. */
27
+ disabled?: boolean;
28
+ /** Extra classes on the dropzone wrapper. */
29
+ className?: string;
30
+ }
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAA;IAChC,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,IAAI,EAAE,KAAK,IAAI,CAAA;IACpC,wFAAwF;IACxF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types of `@molecule/app-file-dropzone-angular` — the Angular counterpart of
3
+ * `@molecule/app-file-dropzone-react`, same props and DOM.
4
+ *
5
+ * @module
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json CHANGED
@@ -1,6 +1,71 @@
1
1
  {
2
2
  "name": "@molecule/app-file-dropzone-angular",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1-stage",
4
+ "description": "Drag-drop file upload area with click-to-browse, accept/size filtering, and a content slot",
5
+ "homepage": "https://www.molecule.dev/packages/app-file-dropzone-angular",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "ngc",
21
+ "dev": "ngc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "molecule",
27
+ "file-dropzone",
28
+ "angular"
29
+ ],
30
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
31
+ "license": "Apache-2.0",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/molecule-dev/molecule.git",
35
+ "directory": "packages/app/features/file-dropzone-angular"
36
+ },
37
+ "engines": {
38
+ "node": ">=20"
39
+ },
40
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "peerDependencies": {
45
+ "@angular/common": "^22.0.0",
46
+ "@angular/core": "^22.0.0",
47
+ "@angular/platform-browser": "^22.0.0",
48
+ "@molecule/app-angular": "^3.5.0",
49
+ "@molecule/app-ui": "^1.0.1",
50
+ "@molecule/app-ui-angular": "^1.1.0"
51
+ },
52
+ "devDependencies": {
53
+ "@angular/common": "22.2.3",
54
+ "@angular/compiler": "22.2.3",
55
+ "@angular/compiler-cli": "22.2.3",
56
+ "@angular/core": "22.2.3",
57
+ "@angular/platform-browser": "22.2.3",
58
+ "@molecule/app-angular": "3.7.1",
59
+ "@molecule/app-framework-conformance": "0.0.0",
60
+ "@molecule/app-i18n": "1.2.2",
61
+ "@molecule/app-icons": "1.0.4",
62
+ "@molecule/app-ui": "1.4.0",
63
+ "@molecule/app-ui-angular": "1.2.0",
64
+ "@types/node": "26.6.5",
65
+ "jsdom": "30.1.3",
66
+ "rxjs": "7.8.2",
67
+ "typescript": "6.0.3",
68
+ "vitest": "4.1.12",
69
+ "zone.js": "0.16.3"
70
+ }
71
+ }