@bynder/compact-view 2.4.3 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -37
- package/components.d.ts +218 -237
- package/components.js +22 -3
- package/index.d.ts +64 -104
- package/index.js +22 -3
- package/package.json +20 -20
package/README.md
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
## Usage example
|
|
4
4
|
|
|
5
5
|
```jsx
|
|
6
|
-
import * as React from
|
|
7
|
-
import * as ReactDOM from
|
|
8
|
-
import { CompactView, Modal, Login } from
|
|
9
|
-
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import * as ReactDOM from 'react-dom';
|
|
8
|
+
import { CompactView, Modal, Login } from '@bynder/compact-view';
|
|
10
9
|
const assetFieldSelection = `
|
|
11
10
|
name
|
|
12
11
|
url
|
|
@@ -19,39 +18,30 @@ const assetFieldSelection = `
|
|
|
19
18
|
previewUrls
|
|
20
19
|
}
|
|
21
20
|
`;
|
|
22
|
-
|
|
23
21
|
class App extends React.Component {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
assetFieldSelection={assetFieldSelection}
|
|
48
|
-
/>
|
|
49
|
-
</Login>
|
|
50
|
-
</Modal>
|
|
51
|
-
</>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
22
|
+
constructor(props) {
|
|
23
|
+
super(props);
|
|
24
|
+
this.state = { isOpen: false };
|
|
25
|
+
}
|
|
26
|
+
onSuccess(assets) {
|
|
27
|
+
console.log(assets);
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<button onClick={() => this.setState({ isOpen: true })}>Open Compact View</button>
|
|
33
|
+
<Modal isOpen={this.state.isOpen} onClose={() => this.setState({ isOpen: false })}>
|
|
34
|
+
<Login>
|
|
35
|
+
<CompactView
|
|
36
|
+
language="en_US"
|
|
37
|
+
onSuccess={this.onSuccess}
|
|
38
|
+
assetFieldSelection={assetFieldSelection}
|
|
39
|
+
/>
|
|
40
|
+
</Login>
|
|
41
|
+
</Modal>
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
54
45
|
}
|
|
55
|
-
|
|
56
|
-
ReactDOM.render(<App />, document.getElementById("app"));
|
|
46
|
+
ReactDOM.render(<App />, document.getElementById('app'));
|
|
57
47
|
```
|
package/components.d.ts
CHANGED
|
@@ -1,241 +1,222 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
readonly asset: t;
|
|
37
|
-
readonly children?: React.ReactNode;
|
|
38
|
-
readonly className?: string;
|
|
39
|
-
readonly fadeIn?: boolean;
|
|
40
|
-
readonly isSelected: boolean;
|
|
41
|
-
readonly onClick?: (_1: t) => void;
|
|
42
|
-
readonly theme?: Theming_theme;
|
|
43
|
-
}>;
|
|
44
|
-
type Asset_asset = asset;
|
|
45
|
-
/* TypeScript file generated from ConfigProvider.re by genType. */
|
|
46
|
-
/* eslint-disable import/first */
|
|
47
|
-
// tslint:disable-next-line:interface-over-type-literal
|
|
48
|
-
type selectionMode = "SingleSelect" | "SingleSelectFile" | "MultiSelect";
|
|
49
|
-
type ConfigProvider_selectionMode = selectionMode;
|
|
50
|
-
type Asset_t = t;
|
|
51
|
-
type data<data> = {
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface Derivatives {
|
|
4
|
+
thumbnail?: string;
|
|
5
|
+
}
|
|
6
|
+
interface Asset {
|
|
7
|
+
id: string;
|
|
8
|
+
derivatives: Derivatives;
|
|
9
|
+
extensions: string[];
|
|
10
|
+
name: string;
|
|
11
|
+
url: string;
|
|
12
|
+
isArchived: boolean;
|
|
13
|
+
isWatermarked: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface Props {
|
|
16
|
+
className?: string;
|
|
17
|
+
fadeIn?: boolean;
|
|
18
|
+
asset: Asset;
|
|
19
|
+
isSelected: boolean;
|
|
20
|
+
onClick?: (asset: Asset, event: React.MouseEvent) => void;
|
|
21
|
+
isOutlined: boolean;
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
declare function AssetCard({ className, fadeIn, asset, isSelected, isOutlined, onClick, children }: Props): JSX.Element;
|
|
25
|
+
type Kind = "Flat" | "Primary" | "Secondary" | "FlatSm" | "PrimarySm" | "SecondarySm";
|
|
26
|
+
interface Theme {
|
|
27
|
+
colorPrimary?: string;
|
|
28
|
+
colorButtonPrimary?: string;
|
|
29
|
+
colorButtonPrimaryLabel?: string;
|
|
30
|
+
colorButtonPrimaryActive?: string;
|
|
31
|
+
colorButtonPrimaryHover?: string;
|
|
32
|
+
colorButtonPrimaryHoverLabel?: string;
|
|
33
|
+
}
|
|
34
|
+
type SelectionMode = "SingleSelect" | "SingleSelectFile" | "MultiSelect";
|
|
35
|
+
type AssetData = {
|
|
52
36
|
tag: "Loading";
|
|
53
|
-
value:
|
|
37
|
+
value: undefined | Asset[];
|
|
54
38
|
} | {
|
|
55
39
|
tag: "Loaded";
|
|
56
|
-
value:
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
declare
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
readonly className?: string;
|
|
240
|
-
}>;
|
|
241
|
-
export { Asset, asset as displayAsset, AssetList, data, Button, Card, Images_make as CardImages, Image_make as CardImage, Checkbox, Chip, Dropdown, ListItem_make as DropdownListItem, MetapropertyOption_make as MetapropertyOption, MetapropertyOption_t as metapropertyOption, Metaproperty_make as Metaproperty, Metaproperty_t as metaproperty, Smartfilter_make as Smartfilter, Smartfilter_t as smartfilter, HorizontalScroll, InfiniteScroll, Modal, NoResults, Oops, OverlayButton, ShadowRoot, Skeleton, Spinner };
|
|
40
|
+
value: Asset[];
|
|
41
|
+
};
|
|
42
|
+
interface Props$0 {
|
|
43
|
+
assets: AssetData;
|
|
44
|
+
count?: number;
|
|
45
|
+
hasNextPage?: boolean;
|
|
46
|
+
isLoading?: boolean;
|
|
47
|
+
loadMore?: () => void;
|
|
48
|
+
onSelect?: (assets: Asset[]) => void;
|
|
49
|
+
onToggle?: (assets: Asset[]) => void;
|
|
50
|
+
emptyStateElement?: React.ReactElement | null;
|
|
51
|
+
selectedAssetIds?: string[];
|
|
52
|
+
selectionMode?: SelectionMode;
|
|
53
|
+
theme?: Theme;
|
|
54
|
+
children?: React.ReactNode;
|
|
55
|
+
}
|
|
56
|
+
declare function AssetList({ assets, count, hasNextPage, isLoading, loadMore, onSelect, onToggle, emptyStateElement, selectedAssetIds, selectionMode, theme, children }: Props$0): JSX.Element;
|
|
57
|
+
interface Props$1 {
|
|
58
|
+
className?: string;
|
|
59
|
+
title?: string;
|
|
60
|
+
isDisabled?: boolean;
|
|
61
|
+
onClick?: React.MouseEventHandler;
|
|
62
|
+
kind?: Kind;
|
|
63
|
+
testId?: string;
|
|
64
|
+
children: React.ReactNode;
|
|
65
|
+
}
|
|
66
|
+
declare const Button: React.ForwardRefExoticComponent<Props$1 & React.RefAttributes<HTMLButtonElement>>;
|
|
67
|
+
interface CardProps {
|
|
68
|
+
alt?: string;
|
|
69
|
+
className?: string;
|
|
70
|
+
fadeIn?: boolean;
|
|
71
|
+
id?: string;
|
|
72
|
+
style?: React.CSSProperties;
|
|
73
|
+
stacked?: boolean;
|
|
74
|
+
title: React.ReactNode;
|
|
75
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
76
|
+
children?: React.ReactNode;
|
|
77
|
+
["aria-selected"]?: boolean;
|
|
78
|
+
}
|
|
79
|
+
declare function Card({ alt, className, fadeIn, id, style, stacked, title, onClick, children, ...props }: CardProps): JSX.Element;
|
|
80
|
+
interface CardImagesProps {
|
|
81
|
+
urls: string[];
|
|
82
|
+
totalCount: number;
|
|
83
|
+
alt: string;
|
|
84
|
+
}
|
|
85
|
+
declare function CardImages({ urls, totalCount, alt }: CardImagesProps): JSX.Element;
|
|
86
|
+
interface ImageProps {
|
|
87
|
+
url?: string;
|
|
88
|
+
cover?: boolean;
|
|
89
|
+
alt?: string;
|
|
90
|
+
}
|
|
91
|
+
declare function CardImage({ url, cover, alt }: ImageProps): JSX.Element;
|
|
92
|
+
interface Props$2 {
|
|
93
|
+
className?: string;
|
|
94
|
+
onClick?: () => void;
|
|
95
|
+
isChecked?: boolean;
|
|
96
|
+
title?: string;
|
|
97
|
+
}
|
|
98
|
+
declare function Checkbox({ className, onClick, isChecked, title }: Props$2): JSX.Element;
|
|
99
|
+
interface Props$3 {
|
|
100
|
+
className?: string;
|
|
101
|
+
onClick?: () => void;
|
|
102
|
+
children: React.ReactNode;
|
|
103
|
+
["data-testid"]?: string;
|
|
104
|
+
}
|
|
105
|
+
declare function Chip(props: Props$3): JSX.Element;
|
|
106
|
+
interface Props$4 {
|
|
107
|
+
className?: string;
|
|
108
|
+
buttonClassName?: string;
|
|
109
|
+
buttonKind?: Kind;
|
|
110
|
+
direction?: "Down" | "Up";
|
|
111
|
+
title: React.ReactNode;
|
|
112
|
+
alt?: string;
|
|
113
|
+
disabled?: boolean;
|
|
114
|
+
children: (toggle: () => void) => React.ReactNode;
|
|
115
|
+
}
|
|
116
|
+
declare function Dropdown({ buttonKind, direction, ...props }: Props$4): JSX.Element;
|
|
117
|
+
interface ListItemProps {
|
|
118
|
+
className?: string;
|
|
119
|
+
onClick?: () => void;
|
|
120
|
+
selected?: boolean;
|
|
121
|
+
children: React.ReactNode;
|
|
122
|
+
}
|
|
123
|
+
declare function DropdownListItem({ selected, ...props }: ListItemProps): JSX.Element;
|
|
124
|
+
interface MetapropertyOptionType {
|
|
125
|
+
id: string;
|
|
126
|
+
label: string;
|
|
127
|
+
assetCount: number;
|
|
128
|
+
}
|
|
129
|
+
interface MetapropertyOptionProps {
|
|
130
|
+
metapropertyOption: MetapropertyOptionType;
|
|
131
|
+
selectedOptionIds?: string[];
|
|
132
|
+
isLoading?: boolean;
|
|
133
|
+
onAddOption: () => void;
|
|
134
|
+
onRemoveOption: () => void;
|
|
135
|
+
}
|
|
136
|
+
declare function MetapropertyOptionComponent(props: MetapropertyOptionProps): JSX.Element;
|
|
137
|
+
interface MetapropertyType {
|
|
138
|
+
__typename: "Metaproperty";
|
|
139
|
+
id: string;
|
|
140
|
+
label: string;
|
|
141
|
+
options: MetapropertyOptionType[];
|
|
142
|
+
}
|
|
143
|
+
interface MetapropertyProps {
|
|
144
|
+
metaproperty: MetapropertyType;
|
|
145
|
+
selectedOptionIds: string[];
|
|
146
|
+
isLoading: boolean;
|
|
147
|
+
onAddOption: (metapropertyOption: MetapropertyOptionType) => void;
|
|
148
|
+
onRemoveOption: (metapropertyOption: MetapropertyOptionType) => void;
|
|
149
|
+
}
|
|
150
|
+
declare function MetapropertyComponent(props: MetapropertyProps): JSX.Element;
|
|
151
|
+
interface SmartfilterType {
|
|
152
|
+
__typename: "Smartfilter";
|
|
153
|
+
id: string;
|
|
154
|
+
label: string;
|
|
155
|
+
metaproperties: MetapropertyType[];
|
|
156
|
+
icon?: string;
|
|
157
|
+
zIndex: number;
|
|
158
|
+
}
|
|
159
|
+
interface SmartfilterProps {
|
|
160
|
+
smartfilter: SmartfilterType;
|
|
161
|
+
selectedOptionIds: string[];
|
|
162
|
+
isLoading: boolean;
|
|
163
|
+
onAddOption: (metapropertyOption: MetapropertyOptionType) => void;
|
|
164
|
+
onRemoveOption: (metapropertyOption: MetapropertyOptionType) => void;
|
|
165
|
+
}
|
|
166
|
+
declare function SmartfilterComponent(props: SmartfilterProps): JSX.Element;
|
|
167
|
+
interface Props$5 {
|
|
168
|
+
static?: React.ReactNode;
|
|
169
|
+
className: string;
|
|
170
|
+
children: React.ReactNode;
|
|
171
|
+
}
|
|
172
|
+
declare function HorizontalScroll(props: Props$5): JSX.Element;
|
|
173
|
+
interface Props$6 {
|
|
174
|
+
isLoading: boolean;
|
|
175
|
+
hasNextPage: boolean;
|
|
176
|
+
loadMore: () => void;
|
|
177
|
+
children: React.ReactNode;
|
|
178
|
+
}
|
|
179
|
+
declare function InfiniteScroll(props: Props$6): JSX.Element;
|
|
180
|
+
interface Props$7 {
|
|
181
|
+
children: React.ReactNode;
|
|
182
|
+
isOpen?: boolean;
|
|
183
|
+
style?: React.CSSProperties;
|
|
184
|
+
onClose?: () => void;
|
|
185
|
+
}
|
|
186
|
+
declare function Modal({ children, isOpen, style, onClose }: Props$7): JSX.Element | null;
|
|
187
|
+
interface Props$8 {
|
|
188
|
+
onReset: () => void;
|
|
189
|
+
}
|
|
190
|
+
declare function NoResults(props: Props$8): JSX.Element;
|
|
191
|
+
interface Props$9 {
|
|
192
|
+
error: Error;
|
|
193
|
+
onRetry: () => void;
|
|
194
|
+
}
|
|
195
|
+
declare function Oops({ error, onRetry }: Props$9): JSX.Element;
|
|
196
|
+
interface Props$10 {
|
|
197
|
+
className?: string;
|
|
198
|
+
active?: boolean;
|
|
199
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
200
|
+
title?: string;
|
|
201
|
+
children: React.ReactNode;
|
|
202
|
+
}
|
|
203
|
+
declare function OverlayButton(props: Props$10): JSX.Element;
|
|
204
|
+
/**
|
|
205
|
+
* This component will create a shadow root if it is the first ShadowRoot in the tree.
|
|
206
|
+
* Otherwise it will just render it's childred. This is useful as we don't always know
|
|
207
|
+
* which component will be first in the tree, especially when the components are used
|
|
208
|
+
* externally from the npm package.
|
|
209
|
+
*/
|
|
210
|
+
declare function ShadowRoot(props: {
|
|
211
|
+
children: React.ReactNode;
|
|
212
|
+
}): JSX.Element;
|
|
213
|
+
interface Props$11 {
|
|
214
|
+
width?: number;
|
|
215
|
+
className?: string;
|
|
216
|
+
}
|
|
217
|
+
declare function Skeleton({ width, className }: Props$11): JSX.Element;
|
|
218
|
+
interface Props$12 {
|
|
219
|
+
className?: string;
|
|
220
|
+
}
|
|
221
|
+
declare function Spinner(props: Props$12): JSX.Element;
|
|
222
|
+
export { AssetCard as Asset, Asset as displayAsset, AssetList, Button, Card, CardImages, CardImage, Checkbox, Chip, Dropdown, DropdownListItem, MetapropertyComponent as Metaproperty, MetapropertyType as metaproperty, MetapropertyOptionComponent as MetapropertyOption, MetapropertyOptionType as metapropertyOption, SmartfilterComponent as Smartfilter, SmartfilterType as smartfilter, HorizontalScroll, InfiniteScroll, Modal, NoResults, Oops, OverlayButton, ShadowRoot, Skeleton, Spinner };
|