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

@equalizer/synchron-lib

v0.2.35

Published

Synchron React Component Packages

Downloads

154

Readme

Synchron React Component Packages

common definition

const ApiKey = 'Bearer __API_KEY_TOKEN_VS__'
const APP_URL = 'https://your_server.com';
const headers = {
    authorization: ApiKey,
}

Single Upload component

import React, { useState } from 'react';
import { RowUpload } from '@equalizer/synchron-lib';
import { IRowUpload } from '@equalizer/synchron-lib-types';

const RowUploadExampleForm = (props: IProps) => {
    const uploadUrl = `${APP_URL}/Upload/08d8def1-dc4b-42c4-8128-7b908a83e642`
    const downloadUrl = `${APP_URL}/Download`

    const [file, setFile] = useState('');

    return (
        <>
            <RowUpload
                connection={{ url: uploadUrl, headers }}
                files={[file]}
                rowItems={{
                    Column3: <>Deneme</>, // string or REactNode can be used in all Colunmns.
                    Column4: 'Free usage area',
                    // Column5: '4.', // Ebedded buttons area 
                    Column6: 'last column customization' 
                }}
                text={{
                    DeleteButton: "Delete",
                    DownloadButton: "Download",
                    UploadButton: "Upload",
                    EditButton: "Change",
                    ViewButton: "Preview",
                    AbortButton: "Cancel",
                }}
                tools={{
                    PieChartLoading: {
                        backgroundColor: '#030303',
                        // backgroundColor?: string;
                        // foregroundColor?: string;
                        // width?: string;
                        // height?: string;
                    }
                }}
                actions={{
                    View: (data) => console.log('View Pressed : ', data),
                    Delete: (data) => console.log('Delete Pressed : ', data),
                    Edit: (data) => console.log('Edit Pressed : ', data),
                    Download: (data) => console.log('Download Pressed : ', data),
                    Upload: (data) => console.log('Upload Pressed : ', data),

                    onSuccess: ((data) => {
                        console.log('Success : ', data)
                        setFile(`${downloadUrl}/${data.UploadId}`)
                    }),
                    onAbort: (() => { console.log('Aborted') }),
                    onDelete: ((data) => {
                        console.log('Deleted :', data)
                        setFile('')
                    }),
                    onError: (s, d) => console.log('error:', s, d),
                }}
            />
        </>
    )
};
export default RowUploadExampleForm

Dropzone Upload Component

import React, { useState } from 'react';
import { DropzoneUpload } from '@equalizer/synchron-lib';
import { IConnections } from '@equalizer/synchron-lib-types';


const DropzoneUploadExample = (props: IProps) => {
    const uploadUrl = `${APP_URL}/Upload/08d8def1-dc4b-42c4-8128-7b908a83e642`
    const downloadUrl = `${APP_URL}/Download`
    const uploadUrl = `${APP_URL}/Upload/08d8def1-dc4b-42c4-8128-7b908a83e642`
    const [fileURLList,
        // setFileURLList
    ] = useState<string[]>([]) // download url list

    return (
        <>
            DropzoneUploadExample without file
            <DropzoneUpload
                connection={{ url: uploadUrl, headers }}
                uploadParameters={['param1=value1', 'param2=value2']}
                uploadMethod='POST' // 'PUT'                
                files={fileURLList}
                classes={{
                    // width: '40px',
                    // height: '40px',
                    errorStyles: {
                        // color: 'blue',
                        fontSize: '10px'
                    }
                }}
                text={{
                    DragboxText: 'Dropzone 1 Drag Here'
                }}
               // thumbnailSize={100}
                refreshOnFilesChange={true}
                inititalFiles={fileURLList || []}
                actions={{
                    View: (data) => console.log('View Pressed : ', data),
                    Download: (data) => console.log('Download Pressed : ', data),
                    onSuccess: ((data) => { console.log('onSuccess : ', data) }),
                    onChange: ((data) => { console.log('onChange : ', data) }),
                    onAbort: (() => { console.log('Aborted') }),
                    onDelete: ((data) => { console.log('Deleted :', data) }),
                    onError: (s, d) => console.log('error:', s, d),
                    onDirty: ((data) => { console.log('onDirty:', data) }),
                }}
            />
        </>
    )
};
export default DropzoneUploadExample

Download Component

import { Button } from '@material-ui/core';
import React, { useState } from 'react';
import { DownloadFile } from '@equalizer/synchron-lib';
import { IConnections } from '@equalizer/synchron-lib-types';

interface IProps {
    connection: IConnections;
    sampleImageURL: string;

}

const DownloadFileExample = (props: IProps) => {
    const [downloadUrl, setDownloadURL] = useState<string | null>(null)
    return (
        <div>
            <Button
                variant='contained'
                onClick={() => setDownloadURL(props.sampleImageURL)}

            >Download File</Button>
            <DownloadFile
                connection={props.connection}
                file={{
                    name: 'TestFile',
                    url: downloadUrl
                }}
                onError={(status, data) => console.log(status, data)}
                onLoading={(value) => console.log('Loading:', value)}
                imageStatus={(value) => console.log('imageStatus:', value)}
            />
        </div>

    )
};
export default DownloadFileExample

Show Image or File Component

Recognozed non image file types : pdf, xls,xlsx,doc,docx,ppt and txt. System will show icon.

import React from 'react';
import { ShowImage } from '@equalizer/synchron-lib';
import { IConnections } from '@equalizer/synchron-lib-types';

interface IProps {
    connection: IConnections;
    sampleImageURL: string;

}

const ShowImageExample = (props: IProps) => {
    return (
        <div style={{ width: '200px', border: 'red 1px solid' }}>
            <ShowImage
                connection={props.connection}
                file={{
                    name: 'TestFile',
                    url: props.sampleImageURL
                }}
                onError={(status, data) => console.log(status, data)}
                onLoading={(value) => console.log('Loading:', value)}
                imageStatus={(value) => console.log('imageStatus:', value)}
                onClick={() => console.log('imageClicked:')}

                className="test"
                styles={{}}
            />
        </div>

    )
};
export default ShowImageExample