@molecule/app-image-gallery-editor-react 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +146 -0
  2. package/package.json +16 -10
package/README.md ADDED
@@ -0,0 +1,146 @@
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-08-04T01:51:06.106Z
7
+ -->
8
+
9
+ # @molecule/app-image-gallery-editor-react
10
+
11
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
+ > It is written to be read by coding agents as much as by people, and is generated from this
13
+ > package's source — edit `src/index.ts` JSDoc, not this file.
14
+
15
+ `@molecule/app-image-gallery-editor-react` — hero drop zone + side grid of
16
+ thumbnail slots. Click an empty slot or the drop zone to upload; click a
17
+ filled slot to remove (native `window.confirm`).
18
+
19
+ Stateless about persistence — the consumer owns the slot array and handles
20
+ uploads via `onPickFiles` (defaults to local object URLs for preview).
21
+
22
+ ## Quick Start
23
+
24
+ ```tsx
25
+ import { useState } from 'react'
26
+ import { ImageGalleryEditor } from '@molecule/app-image-gallery-editor-react'
27
+
28
+ function GalleryEditor() {
29
+ const [slots, setSlots] = useState<(string | null)[]>(Array(4).fill(null))
30
+ return (
31
+ <ImageGalleryEditor
32
+ slots={slots}
33
+ onChange={setSlots}
34
+ onPickFiles={async (files) => {
35
+ // upload each file, return persisted URLs (null keeps a slot empty)
36
+ return Array.from(files).map((f) => URL.createObjectURL(f))
37
+ }}
38
+ header={<h3>Image Gallery</h3>}
39
+ counter={`${slots.filter(Boolean).length} / 24 Photos`}
40
+ />
41
+ )
42
+ }
43
+ ```
44
+
45
+ ## Type
46
+
47
+ `feature`
48
+
49
+ ## Installation
50
+
51
+ ```bash
52
+ npm install @molecule/app-image-gallery-editor-react @molecule/app-icons @molecule/app-react @molecule/app-ui @molecule/app-ui-react react
53
+ npm install -D @types/react
54
+ ```
55
+
56
+ ## API
57
+
58
+ ### Interfaces
59
+
60
+ #### `ImageGalleryEditorProps`
61
+
62
+ Props for {@link ImageGalleryEditor}.
63
+
64
+ ```typescript
65
+ interface ImageGalleryEditorProps {
66
+ /** Ordered slots, `null` for empty. Length determines slot count. */
67
+ slots: (string | null)[]
68
+ onChange: (slots: (string | null)[]) => void
69
+ /** Called when the user picks files; defaults to a local object URL. */
70
+ onPickFiles?: (files: FileList) => Promise<(string | null)[]> | (string | null)[]
71
+ maxImages?: number
72
+ /** Header heading + subtitle slot (renders left of the photo counter). */
73
+ header?: ReactNode
74
+ /** Photo-counter label (e.g. "3 / 24 Photos"). */
75
+ counter?: ReactNode
76
+ dropZoneTitle?: ReactNode
77
+ dropZoneHint?: ReactNode
78
+ confirmRemoveMessage?: string
79
+ statusMessage?: ReactNode
80
+ /**
81
+ * Glyph rendered in empty slots — a typed `IconName` from the bonded
82
+ * `@molecule/app-icons` set (an unknown name is a type error, not a blank).
83
+ */
84
+ emptySlotIcon?: IconName
85
+ }
86
+ ```
87
+
88
+ ### Functions
89
+
90
+ #### `ImageGalleryEditor(props)`
91
+
92
+ Editable image gallery primitive.
93
+
94
+ ```typescript
95
+ function ImageGalleryEditor({
96
+ slots,
97
+ onChange,
98
+ onPickFiles,
99
+ maxImages = 24,
100
+ header,
101
+ counter,
102
+ dropZoneTitle = 'Drag and drop assets here',
103
+ dropZoneHint = 'or click to browse local files',
104
+ confirmRemoveMessage = 'Remove this image?',
105
+ statusMessage,
106
+ emptySlotIcon = 'image',
107
+ }: ImageGalleryEditorProps): JSX.Element
108
+ ```
109
+
110
+ ## Injection Notes
111
+
112
+ ### Requirements
113
+
114
+ Peer dependencies:
115
+
116
+ - `@molecule/app-icons` ^1.0.1
117
+ - `@molecule/app-react` ^1.0.1
118
+ - `@molecule/app-ui` ^1.0.1
119
+ - `@molecule/app-ui-react` ^1.0.1
120
+ - `react` ^18.0.0 || ^19.0.0
121
+
122
+ ### Runtime Dependencies
123
+
124
+ - `@molecule/app-icons`
125
+ - `@molecule/app-react`
126
+ - `@molecule/app-ui`
127
+ - `@molecule/app-ui-react`
128
+ - `react`
129
+
130
+ - Styling is 100% ClassMap (`getClassMap()` / `cm.*`) — the editor renders
131
+ correctly out of the box under any bonded styling library and needs NO
132
+ per-app Tailwind `@source` scan of this package. (It previously hardcoded
133
+ raw Tailwind + Material-3 utility classes that no scaffold `@source`-scans,
134
+ so even the `hidden` file input never generated a rule and rendered
135
+ visible; the file input is now hidden with an inline `display:none`.) The
136
+ few `style={...}` values (grid-column span, aspect ratio, corner radius,
137
+ the dashed drop-zone border, `object-fit`, dim opacity, `display:none`)
138
+ are the documented ClassMap-can't-express cases and use real theme tokens.
139
+ - Icons are real SVG glyphs from `@molecule/app-ui-react`'s `<Icon>`
140
+ (`upload`, `trash`, and the `emptySlotIcon` — a typed `IconName`) — NO
141
+ Material Symbols font to load. Requires a bonded `@molecule/app-icons` set.
142
+ - The filled-slot delete affordance is always visible (touch-friendly)
143
+ rather than hover-revealed.
144
+ - `dropZoneTitle` / `dropZoneHint` / `confirmRemoveMessage` default to
145
+ English strings — pass translated values (`t('...')`) in localized apps.
146
+ - `getClassMap()` requires a bonded ClassMap for the layout primitives.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-image-gallery-editor-react",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Editable image gallery: hero drop zone + grid of thumbnail slots with click-to-remove and progress label. Extracted from property-listing ListingEditorImageGallery.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,8 @@
17
17
  }
18
18
  },
19
19
  "files": [
20
- "dist"
20
+ "dist",
21
+ "README.md"
21
22
  ],
22
23
  "keywords": [
23
24
  "molecule",
@@ -27,18 +28,23 @@
27
28
  "react"
28
29
  ],
29
30
  "license": "Apache-2.0",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/molecule-dev/molecule.git",
34
+ "directory": "packages/app/features/image-gallery-editor-react"
35
+ },
30
36
  "peerDependencies": {
31
- "@molecule/app-icons": "^1.0.0",
32
- "@molecule/app-react": "^1.0.0",
33
- "@molecule/app-ui": "^1.0.0",
34
- "@molecule/app-ui-react": "^1.0.0",
37
+ "@molecule/app-icons": "^1.0.1",
38
+ "@molecule/app-react": "^1.0.1",
39
+ "@molecule/app-ui": "^1.0.1",
40
+ "@molecule/app-ui-react": "^1.0.1",
35
41
  "react": "^18.0.0 || ^19.0.0"
36
42
  },
37
43
  "devDependencies": {
38
- "@molecule/app-icons": "1.0.0",
39
- "@molecule/app-react": "1.0.0",
40
- "@molecule/app-ui": "1.0.0",
41
- "@molecule/app-ui-react": "1.0.0",
44
+ "@molecule/app-icons": "1.0.1",
45
+ "@molecule/app-react": "1.0.1",
46
+ "@molecule/app-ui": "1.0.1",
47
+ "@molecule/app-ui-react": "1.0.1",
42
48
  "@types/node": "26.1.2",
43
49
  "@types/react": "19.2.17",
44
50
  "@types/react-dom": "19.2.3",