4.2.3 • Published 1 month ago

@bynder/compact-view v4.2.3

Weekly downloads
133
License
UNLICENSED
Repository
-
Last release
1 month ago

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
hideLimitedUseIf 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;
};
4.2.3

1 month ago

4.2.2

1 month ago

4.2.1

2 months ago

4.2.0

3 months ago

4.1.0

3 months ago

4.0.1

3 months ago

3.4.0

9 months ago

3.4.1

8 months ago

4.0.0

7 months ago

3.3.4

1 year ago

3.3.3

1 year ago

3.3.2

1 year ago

3.3.1

1 year ago

3.3.0

1 year ago

3.2.4

2 years ago

3.2.3

2 years ago

3.2.2

2 years ago

3.1.3

2 years ago

3.2.1

2 years ago

3.1.2

2 years ago

3.2.0

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.0

2 years ago

2.5.0

2 years ago

2.6.1

2 years ago

2.6.0

2 years ago

0.0.1-beta

2 years ago

2.4.3

3 years ago

2.4.2

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.0-rc.5

4 years ago

2.0.0-rc.4

4 years ago

2.0.0-rc.3

4 years ago

2.0.0-rc.2

4 years ago

2.0.0-rc.1

4 years ago

2.0.0-beta.2

4 years ago

2.0.0-beta.1

4 years ago

2.0.0-beta.0

4 years ago

2.0.0-alpha.0

4 years ago

1.5.0-beta.5

5 years ago

1.5.0-beta.4

5 years ago

1.5.0-beta.3

5 years ago

1.5.0-beta.2

5 years ago

1.5.0-beta.1

5 years ago

1.5.0-beta.0

5 years ago