@bigbinary/neeto-image-uploader-frontend

中文文档
4.2.2发布于 2026/11/05UNLICENSEDTypeScriptESM + CJS近 30 天下载 4.3万

The neeto-image-uploader-nano manages assets across neeto products. The nano exports the @bigbinary/neeto-image-uploader-frontend NPM package and neeto-image-uploader-engine Rails engine for development.

原始使用文档
文档目录7 节
  1. Engine
  2. Installation
  3. Frontend package
  4. Installation
  5. Components
  6. Hooks
  7. Upload Config

neeto-image-uploader-nano

The neeto-image-uploader-nano manages assets across neeto products. The nano exports the @bigbinary/neeto-image-uploader-frontend NPM package and neeto-image-uploader-engine Rails engine for development.

Contents

Development with Host Application

Engine

The engine is used to manage assets across neeto products.

Installation

  1. Add this line to your application's Gemfile:

    source "NEETO_GEM_SERVER_URL" do
       # ..existing gems
    
       gem 'neeto-image-uploader-engine'
    end
    
  2. And then execute:

    bundle install
    
  3. Add this line to your application's config/routes.rb file:

    mount NeetoImageUploaderEngine::Engine, at: "/neeto_image_uploader"
    
  4. Add the following keys to environment variables (all 6 keys are required):

    IMAGE_KIT_PUBLIC_KEY
    IMAGE_KIT_PRIVATE_KEY
    IMAGE_KIT_URL_ENDPOINT
    
    UNSPLASH_ACCESS_KEY #(for fetching images from unsplash)
    

Frontend package

Installation

  1. Install the latest neeto-image-uploader-frontend package using the below command:
    yarn add @bigbinary/neeto-image-uploader-frontend
    

Components

1. AssetLibrary (source code)

Asset library

Props

  • isOpen: A boolean to specify whether the modal is open or not.
  • onClose: A callback function triggered when the modal is closed.
  • onUploadComplete: A callback function triggered when the image upload is complete.
  • uploadConfig: Configuration object for image uploads.

Usage

import React, { useState } from "react";
import { AssetLibrary } from "@bigbinary/neeto-image-uploader-frontend";

const App = () => {
  const [isAssetLibraryOpen, setIsAssetLibraryOpen] = useState(false);
  const [image, setImage] = useState({ url: TEST_IMAGE_SRC, signedId: "" });

  const handleUploadComplete = image => setImage(image);

  return (
    <AssetLibrary
      isOpen={isAssetLibraryOpen}
      onClose={() => setIsAssetLibraryOpen(false)}
      onUploadComplete={handleUploadComplete}
    />
  );
};

export default App;

2. ImageUploader (source code)

Image Uploader

Props

  • onUploadComplete: A callback function triggered when the image upload is complete.
  • className: Additional classes to be applied to the component.
  • src: The source URL of the image to be displayed initially.
  • uploadConfig: Configuration object for image uploads.
  • fixedAspectRatio: An option to maintain a specific aspect ratio for the image. Expected input format is {height: number, width: number}.
  • defaultImageSize: An option to set the initial crop size of the image. Expected input format is { height: number, width: number }.
  • isOptionsDisabled: An option to disable dropdown to remove the already present image, or upload a new image.
  • ref: A ref that exposes an upload(file) method to programmatically trigger an upload. Useful when the file is selected outside the component (e.g., via drag-and-drop on a canvas).

Usage

import React, { useState } from "react";
import { ImageUploader } from "@bigbinary/neeto-image-uploader-frontend";

const App = () => {
  const [isAssetLibraryOpen, setIsAssetLibraryOpen] = useState(false);
  const [image, setImage] = useState({ url: TEST_IMAGE_SRC, signedId: "" });

  const handleUploadComplete = image => setImage(image);

  return (
    <ImageUploader
      className="mb-8 h-52 w-80"
      key={image.url}
      src={image.url}
      onUploadComplete={handleUploadComplete}
    />
  );
};

export default App;

3. BasicImageUploader (source code)

Props

  • src: The source URL of the image to be displayed initially.
  • className: Additional classes to be applied to the component.
  • imageFallbackProps: Props to be passed to the ImageWithFallback component.
  • onDrop: Callback function triggered when an image is dropped or selected for upload.
  • isDisabled: A boolean to specify whether the uploader is disabled.
  • onRemove: Callback function triggered when the "Remove" button is clicked.

Usage

import React, { useState } from "react";
import { noop } from "neetocist";
import { BasicImageUploader } from "@bigbinary/neeto-image-uploader-frontend";

const App = () => {
  const [image, setImage] = useState({ url: TEST_IMAGE_SRC, signedId: "" });

  return (
    <BasicImageUploader
      className="h-52 w-80"
      src={image.url}
      uploadProgress={0}
      onDrop={noop}
      onRemove={() => setImage({ url: "", signedId: "" })}
    />
  );
};

export default App;

4. ImageForm (source code)

Props

  • onChange: Callback function triggered when any form field changes.
  • imageUploaderProps: Additional props to be passed to the ImageUpload component.
  • className: Additional classes to be applied to the component.
  • names: Object specifying field names for form integration:
    • image: Name of the image field in the form (e.g., "properties.imageUrl")
    • height: Name of the height field in the form (e.g., "height")
    • alignment: Name of the alignment field in the form (e.g., "alignment")
  • logoHeight: Object specifying height constraints for the logo slider:
    • default: Default height value for the slider (default: 64)
    • min: Minimum height value for the slider (default: 64)
    • max: Maximum height value for the slider (default: 100)
  • logoSizeVariableName: CSS variable name for controlling logo size (required)
  • showAlignmentBlock: Boolean to control whether the alignment block is displayed (default: true)
  • showAltTextBlock: Boolean to control whether the alt text input block is displayed (default: true)
  • isLabelEnabled: Boolean to control whether the label is displayed in the image upload block (default: true)
  • entityName: String to customize the entity name used in labels, placeholders, and tooltips (default: "Logo"). This allows host applications to override the hardcoded "Logo" text with custom entity names.

Usage

import { Formik } from "formik";
import { ImageForm } from "@bigbinary/neeto-image-uploader-frontend";

const App = () => {
  const handleUpdate = (fieldName, value) => {
    console.log(`Field ${fieldName} changed to:`, value);
  };

  return (
    <Formik
      initialValues={{
        properties: {
          imageUrl: "",
          height: 64,
          alignment: "left",
        },
        altText: "",
      }}
    >
      <ImageForm
        className="logo-form"
        imageUploaderProps={{ maxSize: 1048576 }}
        names={{
          image: "properties.imageUrl",
          height: "height",
          alignment: "alignment",
        }}
        logoSizeVariableName="--my-app-logo-size"
        entityName="Image"
        onChange={handleUpdate}
      />
    </Formik>
  );
};

export default App;

Hooks

1. useImageUpload (source code)

  • The useImageUpload hook is a React custom hook that simplifies the process of uploading images in your application. It handles both development and production scenarios, tracks upload progress, and provides a clean interface for image uploading.
  • Usage in neetoAuth.

Returns

  • uploadImage: Function to initiate image upload. It takes two parameters:
    • file: The image file to be uploaded.
    • onUploadComplete: Callback function called when the upload is complete.
  • uploadProgress: Number representing the upload progress (0-100).
  • isUploading: Boolean indicating whether an upload is in progress.

Usage

Import the hook
import { useImageUpload } from "@bigbinary/neeto-image-uploader-frontend";
Invoke the hook
const { uploadImage, uploadProgress, isUploading } = useImageUpload();
Call uploadImage to Upload an Image
const handleImageUpload = async file => {
  uploadImage(file, uploadedImageData => {
    // Handle the uploaded image data
  });
};

Upload Config

The "Upload Config" section describes the default upload configuration. This configuration can be overridden by passing the uploadConfig prop.

{
  "maxImageSize": globalProps.endUserUploadedFileSizeLimitInMb,
  "allowedImageTypes": {
    "image/png": [".png"],
    "image/jpg": [".jpg", ".jpeg"],
    "image/gif": [".gif"],
    "image/svg+xml": [".svg"]
  }
}

Example: Overriding upload config in neetoForm.

Keys

  • maxImageSize: The maximum size allowed for uploaded images.
  • allowedImageTypes: An object specifying the allowed image types and their corresponding file extensions.

Instructions for Publishing

Consult the building and releasing packages guide for details on how to publish.

版本与发布记录

@bigbinary/neeto-image-uploader-frontend 共发布 189 个版本,首次发布于 2023/04/05;过去 12 个月发布了 74 个版本。

版本发布日期距今
4.2.2latest2026/11/053 天前
4.2.12026/11/053 天前
4.2.02026/11/035 天前
4.1.162026/11/026 天前
4.1.152026/11/026 天前
4.1.15-beta1beta2026/11/026 天前

关于 @bigbinary/neeto-image-uploader-frontend 的常见问题

@bigbinary/neeto-image-uploader-frontend 是什么?

The neeto-image-uploader-nano manages assets across neeto products. The nano exports the @bigbinary/neeto-image-uploader-frontend NPM package and neeto-image-uploader-engine Rails engine for development.

如何安装 @bigbinary/neeto-image-uploader-frontend?

在项目目录运行 npm install @bigbinary/neeto-image-uploader-frontend,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:qs(6.16.2)、url(0.11.4)、yup(0.32.11)、antd(5.22.1)、util(^0.12.5)、axios(1.20.0)、ramda(0.29.0)、react(18.3.1)、buffer(^6.0.3)、formik(2.4.6)、i18next(22.5.1)、zustand(4.4.2)、dompurify(3.4.17)、js-logger(1.6.1)、react-dom(18.3.1)、classnames(2.5.1)、react-query(3.39.3)、stream-http(3.2.0)、tailwindcss(4.1.16)、lucide-react(1.57.0)、react-helmet(^6.1.0)、os-browserify(0.3.0)、react-i18next(12.3.1)、vm-browserify(1.1.2)、@babel/runtime(7.29.7)、react-dropzone(14.3.8)、react-toastify(8.0.2)、tty-browserify(0.0.1)、path-browserify(^1.0.1)、https-browserify(1.0.0)、mixpanel-browser(2.46.0)、react-router-dom(5.3.3)、crypto-browserify(3.12.1)、source-map-loader(4.0.1)、stream-browserify(^3.0.0)、@bigbinary/neetoui(8.8.3)、@honeybadger-io/js(6.10.1)、@rails/activestorage(7.0.8-3)、@bigbinary/neeto-cist(1.0.17)、@honeybadger-io/react(6.1.25)、@tanstack/react-query(5.59.20)、@bigbinary/neeto-atoms(1.1.6)、@bigbinary/neeto-icons(1.20.89)、@bigbinary/neeto-molecules(5.12.0)、@tailwindcss/container-queries(0.1.1)、@bigbinary/neeto-editor-frontend(2.5.0)、@bigbinary/neeto-commons-frontend(4.15.0)、@bigbinary/neeto-filters-frontend(4.7.1)、@bigbinary/neeto-team-members-frontend(5.3.4)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@bigbinary/neeto-image-uploader-frontend 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@bigbinary/neeto-image-uploader-frontend 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@bigbinary/neeto-image-uploader-frontend 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.13。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@bigbinary/neeto-image-uploader-frontend 可以商用吗?

@bigbinary/neeto-image-uploader-frontend 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@bigbinary/neeto-image-uploader-frontend 的下载量有多少?

根据 npm 官方下载统计,@bigbinary/neeto-image-uploader-frontend 在 2026/10/08 – 2026/11/06 这 30 天内被下载 42,657 次,日均约 1,422 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bigbinary/neeto-image-uploader-frontend 还在维护吗?

最新版本 4.2.2 发布于 2026/11/05(3 天前);至今共发布 189 个版本,其中过去 12 个月发布了 74 个;首次发布于 2023/04/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。