Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bynder/compact-view

Package Overview
Dependencies
Maintainers
6
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bynder/compact-view

Bynder Compact View

  • 3.4.1
  • npm
  • Socket score

Version published
Maintainers
6
Created
Source

Bynder Compact View React Component

Usage example

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { CompactView, Modal, Login } from '@bynder/compact-view';
const assetFieldSelection = `
  name
  url
  originalUrl
  derivatives {
    thumbnail
    webImage
  }
  ... on Video {
    previewUrls
  }
`;
class App extends React.Component {
	constructor(props) {
		super(props);
		this.state = { isOpen: false };
	}
	onSuccess(assets) {
		console.log(assets);
	}
	render() {
		return (
			<>
				<button onClick={() => this.setState({ isOpen: true })}>Open Compact View</button>
				<Modal isOpen={this.state.isOpen} onClose={() => this.setState({ isOpen: false })}>
					<Login>
						<CompactView
							language="en_US"
							onSuccess={this.onSuccess}
							assetFieldSelection={assetFieldSelection}
						/>
					</Login>
				</Modal>
			</>
		);
	}
}
ReactDOM.render(<App />, document.getElementById('app'));

See more info on Bynder Docs

Configuration

The optional options object accepts the following attributes (which are also all optional):

AttributeDescriptionPossible ValuesDefault Value
onSuccessComma separated list of asset types to displayfunction (assets: asset[], { selectedFile?: File })): voidconsole.log
containerA DOM element to act as the container for Compact View (disables modal)A Dom.HTMLElement instanceNone
portalPortal config objectNone
portal.urlSet a default portal URL for the Compact View login screenA string containing Bynder portal URLNone
portal.readOnlyIf true, limits Compact View to a single portaltrue, falsefalse
defaultSearchTermSet the initial value for search term"Keyword"None
languageSet language for the Compact View"en_US", "nl_NL", "de_DE", "fr_FR", "es_ES","en_US"
modeSet the Compact View to allow multiple or single asset selection"SingleSelect", "SingleSelectFile", "MultiSelect""MultiSelect"
themeA theme object for customizing Compact View look and feelObject (see below for recognized keys)None
assetTypesAn array of strings for limiting allowed asset typesAssetType[]["image", "audio", "video", "document"]
hideExternalAccessIf true, removes access to external DAM from assets and collectionstrue, falsefalse
hideLimitedUse If true, limited assets are hiddentrue, falsefalse
selectedAssetsAn array of asset ids. When mode is different than MultiSelect, the last id in the array will be selected["id1", "id2", "id3"][]
modalStylesAn object with css properties for modal wrapper using strings as keys and values { [key: string]: string }{"width": "100%"}None
assetFieldSelectionA multiline string containing desired asset fieldsstringNone
assetFilterSet predefined filters for the Compact ViewAssetFilterJsonNone
type File = {
	url: string;
	width?: number;
	height?: number;
	fileSize?: number;
};

type AssetFilterJson = {
	assetType_in?: AssetType[]; //predefined asset types
	collectionId?: string; //predefined collection id
	metapropertyOptionId_in?: string[]; //predefined metaproperty IDs
	searchTerm?: string; //predefined search term
	tagNames_in?: string[]; //predefined tags
	isLimitedUse?: boolean; //whether or not this asset is marked as Limited Use
	showToolbar?: boolean; //show toolbar for predefined filters (false by default)
};

type AssetType = 'AUDIO' | 'DOCUMENT' | 'IMAGE' | 'VIDEO' | 'ARCHIVE';

type theme = {
	colorPrimary?: CSSColor;
	colorButtonPrimary?: CSSColor;
	colorButtonPrimaryLabel?: CSSColor;
	colorButtonPrimaryActive?: CSSColor;
	colorButtonPrimaryHover?: CSSColor;
	colorButtonPrimaryHoverLabel?: CSSColor;
};

FAQs

Package last updated on 28 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc