UNPKG

@combine-labs/combine-polaris

Version:

Combine Lab's product component library. Forked from Shopify's Polaris.

30 lines (29 loc) 1.1 kB
import Messenger from '../Messenger'; import Modal from './Modal'; export interface SelectionResult { products?: object[]; collections?: object[]; } export interface OpenOptions { /** The title of the picker */ title?: string; /** Whether to allow the merchant to select products */ products?: boolean; /** Whether to allow the merchant to select collections */ collections?: boolean; /** Whether multiple selections are allowed */ allowMultiple?: boolean; /** Whether to display resources that are not published (hidden) in the context of a channel. Defaults to true. */ showHidden?: boolean; /** Callback when the picker is closed without selection */ onCancel?(): void; /** Callback after a selection was made */ onSelection?(resources: SelectionResult): void; } export default class ResourcePicker { private messenger; private modal; constructor(messenger: Messenger, modal: Modal); close(): void; open({ title, products, collections, allowMultiple, showHidden, onCancel, onSelection, }: OpenOptions): void; }