npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rem.tools/signt-react-sdk

v1.2.10

Published

Signt SDK for React, sign and preview your documents from React Components.

Downloads

4

Readme

logo

signt-react-sdk

React components library built for Signt platform from rem.tools

API

Table of Contents

Components

You must use SigntContextProvider as the parent for DocumentPreview and DocumentSignaturePad

SigntContextProvider

packages/signt-react/src/context/SigntContextProvider.tsx:45-55

Use this Provider as the parent of {DocumentSignaturePad} and [DocumentPreview]

Example
<SigntContextProvider
 publicUrl='https://xxxx.com'
 signerToken='XXXXX'
>
 You must write all library components here...
<SigntContextProvider />
Parameters
DocumentPreview

packages/signt-react/src/components/DocumentPreview.tsx:55-182

Component to render a document from a signer's token, you must wrap this component in order to control size, or use maxWidth and/or maxHeight props, it will resize relatively from parent node size.

Note: You MUST generate the token from a Signer.

Example
<SigntContextProvider
 publicUrl='https://xxxx.com'
 signerToken='XXXXX'
>
 <div style={{ width: '100%', height: '100%' }}>
     <DocumentPreview maxHeight={600} />
 </div>
</SigntContextProvider>
Parameters
DocumentSignaturePad

packages/signt-react/src/components/DocumentSignaturePad.tsx:98-167

This components wraps functionality to handle signature pad

Example 1
<SigntContextProvider
 publicUrl='https://xxxx.com'
 signerToken='XXXXX'
>
 <DocumentSignaturePad
     onInitialize={() => console.log('DONE!')}
     onComplete={() => console.log('COMPLETE!')}
     onError={err => console.error(err)}
 >
     {({ canvasRef, clear, sendSignature, isEmpty }) => (
         <>
             <Canvas style={{ border: '1px solid black' }} width={400} height={150} canvasRef={canvasRef} />
             <button onClick={clear}>Clear</button>
             <button disabled={isEmpty} onClick={sendSignature()}>Send</button>
         </>
     )}
 </DocumentSignaturePad>
</SigntContextProvider>
Example 2 (With password's signer override)
<SigntContextProvider
 publicUrl='https://xxxx.com'
 signerToken='XXXXX'
>
 <DocumentSignaturePad
     onInitialize={() => console.log('DONE!')}
     onComplete={() => console.log('COMPLETE!')}
     onError={err => console.error(err)}
 >
     {({ canvasRef, clear, sendSignature }) => (
         <>
             <Canvas style={{ border: '1px solid black' }} width={400} height={150} canvasRef={canvasRef} />
             <button onClick={clear}>Clear</button>
             <button onClick={sendSignature('THIS IS A NEW PASSWORD')}>Send</button>
         </>
     )}
 </DocumentSignaturePad>
</SigntContextProvider>
Parameters

Returns RenderChildrenProps

Canvas

packages/signt-react/src/components/Canvas.tsx:22-30

Wraps a canvas element properly to render and adjust over any screen size and DPI, it requires the canvasRef provided by DocumentSignaturePad.

Parameters

Props Types

Types definitions for components

SigntContextProps

packages/signt-react/src/context/SigntContextProvider.tsx:11-15

Type: {signerToken: string, children: React.ReactNode, publicUrl: string}

Parameters
Properties
DocumentPreviewProps

packages/signt-react/src/components/DocumentPreview.tsx:26-33

Type: {onError: Function?, onLoad: Function?, errorComponent: ReactNode?, loadingComponent: ReactNode?, maxWidth: any?, maxHeight: any?}

Parameters
  • onError Function? Callback in case of error (optional) (optional, default null)
  • onLoad Function? Callback on initialized (optional) (optional, default null)
  • errorComponent ReactNode? Component to render on PDF viewer error (optional) (optional, default null)
  • loadingComponent ReactNode? Component to render on PDF viewer loading (optional) (optional, default null)
  • maxWidth any Max width size from viewer (for responsive purposes) (optional, default null)
  • maxHeight any Max height size from viewer (for responsive purposes) (optional, default null)
Properties
  • onError Function?
  • onLoad Function?
  • errorComponent ReactNode?
  • loadingComponent ReactNode?
  • maxWidth any?
  • maxHeight any?
DocumentSignaturePadProps

packages/signt-react/src/components/DocumentSignaturePad.tsx:31-39

Type: {backgroundColor: String?, penColor: String?, children: function (props: RenderChildrenProps): ReactNode, onError: Function?, onInitialize: function (engine: SignaturePad): void?, onComplete: Function?, destroyTokenOnSign: boolean?}

Parameters
  • backgroundColor String? Pad's Background color. Note: Be careful with this, this can change the background color generated, don't use if possible. (optional, default rgba(0,0,0,0))
  • penColor String? Pad's trace color. (optional, default black)
  • children Function Component body, this must be use as function like the DocumentSignaturePad example.
  • onError Function? Callback if there's any error (optional, default null)
  • onInitialize Function? Callback on component initialize, the argument contains a SignaturePad instance. (optional, default null)
  • destroyTokenOnSign boolean? This destroy the signer token provided on SigntContextProvider (optional, default false)
Properties
RenderChildrenProps

packages/signt-react/src/components/DocumentSignaturePad.tsx:15-20

This properties are passed to the DocumentSignaturePad body function.

Type: {canvasRef: Ref<(HTMLCanvasElement | null)>, clear: function (): void, isEmpty: boolean, sendSignature: function (password: (String | null)): function (): void}

Parameters
  • canvasRef (Ref<HTMLCanvasElement> | null) Must use this ref within an <canvas> element, otherwise will throw an Error.
  • clear Function Clears the signature pad.
  • isEmpty boolean Checks if signature pad is empty, component will be re-rendered on changes.
  • sendSignature Function This method sends signature to Signt platform.
Properties
CanvasProps

packages/signt-react/src/components/Canvas.tsx:10-15

Type: {canvasRef: Ref<HTMLCanvasElement>, width: any, height: any, style: CSSProperties?}

Parameters
  • canvasRef (RefObject<HTMLCanvasElement> | null) Ref passed by DocumentSignaturePad
  • width any Any acceptable width value for React
  • height any Any acceptable height value for React
  • style CSSProperties? Style property passed like any other React Component
Properties