meta-mosaic 1.0.10 → 1.0.12

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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +146 -7
  3. package/package.json +34 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 MetaMosaic Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,12 +1,151 @@
1
- # React + Vite
1
+ # 🧩 MetaMosaic
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ > A simple and responsive React component to create a mosaic grid of images — with background image, custom styles, and click dialog support.
4
+ > ![ScreenRecording2025-11-29at4 09 29PM-ezgif com-optimize (2)](https://github.com/user-attachments/assets/172c6b36-616c-42fe-ba49-c05b0fe9a223)
4
5
 
5
- Currently, two official plugins are available:
6
+ ![npm version](https://img.shields.io/npm/v/meta-mosaic)
7
+ ![License](https://img.shields.io/npm/l/meta-mosaic)
8
+ ![Downloads](https://img.shields.io/npm/dw/meta-mosaic)
9
+ [![React](https://img.shields.io/badge/React-17+-blue)](https://reactjs.org/)
6
10
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
11
+ ---
9
12
 
10
- ## Expanding the ESLint configuration
13
+ ## 🚀 Installation
11
14
 
12
- If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
15
+ ```bash
16
+ npm install meta-mosaic
17
+ # or
18
+ yarn add meta-mosaic
19
+ ```
20
+
21
+ Then import it in your project:
22
+
23
+ ```jsx
24
+ import { MetaMosaic } from "meta-mosaic";
25
+ import "meta-mosaic/dist/meta-mosaic.css";
26
+ ```
27
+
28
+ ---
29
+
30
+ ## ⚡ Quick Example
31
+
32
+ ```jsx
33
+ import React from "react";
34
+ import { MetaMosaic } from "meta-mosaic";
35
+ import "meta-mosaic/dist/meta-mosaic.css";
36
+
37
+ const images = Array.from({ length: 400 }, (_, i) => ({
38
+ id: i + 1,
39
+ link: `https://picsum.photos/id/${101 + i}/400/300`,
40
+ title: `Image ${i + 1}`,
41
+ }));
42
+
43
+ const bgImage =
44
+ "https://i.etsystatic.com/32237469/r/il/72bad1/4009560313/il_570xN.4009560313_q4ps.jpg";
45
+
46
+ function App() {
47
+ return (
48
+ <MetaMosaic
49
+ images={images}
50
+ size={20}
51
+ bgImageUrl={bgImage}
52
+ gridWrapperClassName="custom-mosaic-wrapper"
53
+ gridWrapperStyle={{ boxShadow: "0 0 1em rgba(255,255,255,0.5)" }}
54
+ bgPosition="center 8px"
55
+ width={{ xs: 350, md: 500, lg: 650 }}
56
+ height={{ xs: 350, md: 500, lg: 650 }}
57
+ setDialog={(img) => (
58
+ <div>
59
+ <h2>{img.id}</h2>
60
+ <h6 style={{ color: "red" }}>{img.title}</h6>
61
+ <img src={img.link} alt={img.title} />
62
+ </div>
63
+ )}
64
+ />
65
+ );
66
+ }
67
+
68
+ export default App;
69
+ ```
70
+
71
+ ---
72
+
73
+ ## 🧩 Props Guide
74
+
75
+ | Prop | Type | Description |
76
+ | ------------------------ | ---------- | ---------------------------------------------------------------------------------- |
77
+ | **images** | `Array` | List of images to display in mosaic. Each image should have `{ id, link, title }`. |
78
+ | **size** | `number` | Defines number of rows and columns. Example: `size={4}` → 4x4 grid. |
79
+ | **bgImageUrl** | `string` | Background image for the mosaic layout. |
80
+ | **gridWrapperClassName** | `string` | Add your custom class to the grid wrapper. |
81
+ | **gridWrapperStyle** | `object` | Inline CSS styles for grid wrapper. |
82
+ | **bgPosition** | `string` | Adjust the background image position (e.g. `"center 8px"`). |
83
+ | **width** | `object` | Responsive width based on breakpoints: `{ xs, md, lg }`. |
84
+ | **height** | `object` | Responsive height based on breakpoints: `{ xs, md, lg }`. |
85
+ | **setDialog** | `function` | Custom component that opens when clicking a mosaic cell. |
86
+
87
+ ---
88
+
89
+ ## 💡 Example: setDialog
90
+
91
+ ```jsx
92
+ setDialog={(img) => (
93
+ <div>
94
+ <h2>{img.id}</h2>
95
+ <h6 style={{ color: 'red' }}>{img.title}</h6>
96
+ <img src={img.link} alt={img.title} />
97
+ </div>
98
+ )}
99
+ ```
100
+
101
+ This function runs when a user clicks on a cell. You can render any custom component here.
102
+
103
+ ---
104
+
105
+ ## 🪄 Responsive Behavior
106
+
107
+ You can set different `width` and `height` values for small, medium, and large screens:
108
+
109
+ ```jsx
110
+ width={{ xs: 350, md: 500, lg: 650 }}
111
+ height={{ xs: 350, md: 500, lg: 650 }}
112
+ ```
113
+
114
+ The component adjusts automatically based on screen size.
115
+
116
+ ---
117
+
118
+ ## 📦 Changelog
119
+
120
+ ### v1.0.11 — (2025-11-09)
121
+
122
+ #### ✨ New Features
123
+
124
+ - Added all props: `images`, `size`, `bgImageUrl`, `gridWrapperClassName`, `gridWrapperStyle`, `bgPosition`, `width`, `height`, and `setDialog`.
125
+ - Fully responsive and customizable grid.
126
+ - Clickable mosaic cells with custom dialog support.
127
+
128
+ ---
129
+
130
+ ## 🧠 Tips
131
+
132
+ - Use high-quality images for better visual effect.
133
+ - The `bgImageUrl` should have similar aspect ratio as your grid.
134
+ - Combine `gridWrapperStyle` with `className` for fine-tuned control.
135
+
136
+ ---
137
+
138
+ ## Alternatives & Comparisons
139
+
140
+ - `react-mosaic-component` - More complex, for window management
141
+ - `@tilework/mosaic` - E-commerce focused
142
+ - `react-photo-gallery` - Simpler, no dialog support
143
+ - `react-grid-gallery` - Heavy bundle, more features
144
+
145
+ **meta-mosaic** is lightweight and perfect for simple, responsive image grids with metadata.
146
+
147
+ ---
148
+
149
+ ## 📜 License
150
+
151
+ MIT © [MetaMosaic](https://www.npmjs.com/package/meta-mosaic)
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "meta-mosaic",
3
- "version": "1.0.10",
4
- "description": "A React component library to create interactive image mosaics with metadata popups.",
3
+ "version": "1.0.12",
4
+ "description": "A simple and responsive React component to create interactive image mosaics with metadata popups, background images, and click-to-enlarge dialogs.",
5
+ "homepage": "https://meta-mosaic-showcase.onrender.com",
5
6
  "main": "dist/index.umd.js",
6
7
  "module": "dist/index.es.js",
7
8
  "files": [
@@ -21,12 +22,41 @@
21
22
  "popup",
22
23
  "gallery",
23
24
  "photo viewer",
24
- "react library"
25
+ "react library",
26
+ "react",
27
+ "mosaic",
28
+ "gallery",
29
+ "image-gallery",
30
+ "image-grid",
31
+ "responsive-grid",
32
+ "photo-gallery",
33
+ "image-mosaic",
34
+ "popup",
35
+ "dialog",
36
+ "metadata",
37
+ "react-component",
38
+ "grid-layout",
39
+ "image-layout",
40
+ "portfolio",
41
+ "showcase",
42
+ "tiling-window",
43
+ "window-manager",
44
+ "lightbox",
45
+ "photo-viewer",
46
+ "mosaic npm",
47
+ "react image mosaic",
48
+ "react canvas mosaic"
25
49
  ],
26
50
  "author": "Arbaj Ansari",
27
51
  "license": "MIT",
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "https://github.com/A-Coder02/meta-mosaic"
55
+ },
28
56
  "scripts": {
29
- "build": "vite build"
57
+ "dev": "vite",
58
+ "build": "vite build",
59
+ "preview": "vite preview"
30
60
  },
31
61
  "peerDependencies": {
32
62
  "react": "^19.0.0",