@bynder/compact-view 5.1.1 → 5.1.3

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.
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Field } from './OrderingContext';
2
+ import { Field } from '@src/store/useOrderingStore';
3
3
  interface FieldProps {
4
4
  options: Field[];
5
5
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bynder/compact-view",
3
3
  "description": "Bynder Compact View",
4
- "version": "5.1.1",
4
+ "version": "5.1.3",
5
5
  "author": "Bynder",
6
6
  "license": "UNLICENSED",
7
7
  "main": "index.js",
@@ -1,18 +1,15 @@
1
1
  import React from 'react';
2
2
  import { useSimilaritySearchInterface } from '@src/api/getSimilarityAssets';
3
- import { Asset } from '../views/asset/asset.type';
4
3
  interface State {
5
4
  isEnabled: boolean;
6
5
  isSelected: boolean;
7
- assets: Asset[];
8
6
  isNLSSelected: boolean;
9
7
  NLSSearchText?: string;
10
8
  }
11
9
  interface Actions {
12
10
  setIsEnabled: (isEnabled: boolean) => void;
13
11
  setIsSelected: (isSelected: boolean) => void;
14
- setIsNLSelected: React.Dispatch<React.SetStateAction<boolean>>;
15
- setAssets: (assets: Asset[]) => void;
12
+ setIsNLSSelected: React.Dispatch<React.SetStateAction<boolean>>;
16
13
  setNLSSearchText: (text: string | undefined) => void;
17
14
  }
18
15
  export declare const SimilaritySearchContext: React.Context<(State & Actions & useSimilaritySearchInterface) | null>;
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import { Asset } from '../views/asset/asset.type';
3
3
  import { File } from './file.type';
4
4
  interface Props {
5
- asset: Asset;
6
- onChange: (file: File | undefined) => void;
5
+ readonly asset: Asset;
6
+ readonly onChange: (file: File | undefined) => void;
7
7
  }
8
8
  export declare function FileSelector({ asset, onChange }: Props): React.JSX.Element;
9
9
  export {};
@@ -0,0 +1,13 @@
1
+ import { StreamingLinks } from '../api/getAsset';
2
+ import { File } from './file.type';
3
+ export type State = {
4
+ status: 'Failure';
5
+ } | {
6
+ status: 'Loading';
7
+ } | {
8
+ status: 'Data';
9
+ files: Record<string, File>;
10
+ key: string;
11
+ streamingLinks?: StreamingLinks;
12
+ selectedAdaptiveKey?: string;
13
+ };
package/select/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { File } from './file.type';
2
- export declare function getDefaultKey(files: Record<string, File>): 'transformBaseUrl' | 'original' | 'webImage';
2
+ export declare function getDefaultKey(files: Record<string, File>): 'transformBaseUrl' | 'original' | 'webImage' | 'adaptiveVideo';
3
3
  export declare function splitByCamelCase(str: string): string;
4
4
  export declare function getUrlExtension(url: string): string | undefined;
5
5
  export declare function getHumanReadableFileSize(bytes: number): string;
@@ -0,0 +1,61 @@
1
+ import { PageType } from './useRouterStore';
2
+ export type Field = 'CREATED_AT' | 'NAME' | 'PUBLISHED_AT' | 'UPDATED_AT' | 'NL_SEARCH';
3
+ export type Direction = 'ASC' | 'DESC';
4
+ export type Ordering = {
5
+ field: Field;
6
+ direction: Direction;
7
+ };
8
+ type OrderingState = {
9
+ assets: Ordering;
10
+ collections: Ordering;
11
+ collection: Ordering;
12
+ setOrdering: (page: PageType, ordering: Ordering) => void;
13
+ reset: () => void;
14
+ };
15
+ export declare const useOrderingStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<OrderingState>, "setState" | "devtools"> & {
16
+ setState(partial: OrderingState | Partial<OrderingState> | ((state: OrderingState) => OrderingState | Partial<OrderingState>), replace?: false | undefined, action?: (string | {
17
+ [x: string]: unknown;
18
+ [x: number]: unknown;
19
+ [x: symbol]: unknown;
20
+ type: string;
21
+ }) | undefined): void;
22
+ setState(state: OrderingState | ((state: OrderingState) => OrderingState), replace: true, action?: (string | {
23
+ [x: string]: unknown;
24
+ [x: number]: unknown;
25
+ [x: symbol]: unknown;
26
+ type: string;
27
+ }) | undefined): void;
28
+ devtools: {
29
+ cleanup: () => void;
30
+ };
31
+ }>;
32
+ export declare const useOrderingSelectors: {
33
+ (): OrderingState;
34
+ <U>(selector: (state: OrderingState) => U): U;
35
+ } & Omit<import("zustand").StoreApi<OrderingState>, "setState" | "devtools"> & {
36
+ setState(partial: OrderingState | Partial<OrderingState> | ((state: OrderingState) => OrderingState | Partial<OrderingState>), replace?: false | undefined, action?: (string | {
37
+ [x: string]: unknown;
38
+ [x: number]: unknown;
39
+ [x: symbol]: unknown;
40
+ type: string;
41
+ }) | undefined): void;
42
+ setState(state: OrderingState | ((state: OrderingState) => OrderingState), replace: true, action?: (string | {
43
+ [x: string]: unknown;
44
+ [x: number]: unknown;
45
+ [x: symbol]: unknown;
46
+ type: string;
47
+ }) | undefined): void;
48
+ devtools: {
49
+ cleanup: () => void;
50
+ };
51
+ } & {
52
+ use: {
53
+ assets: () => Ordering;
54
+ collections: () => Ordering;
55
+ collection: () => Ordering;
56
+ setOrdering: () => (page: PageType, ordering: Ordering) => void;
57
+ reset: () => () => void;
58
+ };
59
+ };
60
+ export declare const useOrderingByPage: (page: PageType) => [Ordering, (ordering: Ordering) => void];
61
+ export {};
@@ -0,0 +1,61 @@
1
+ import { Collection } from '@src/views/collection/collection.types';
2
+ type AssetsPage = 'assets';
3
+ type CollectionsPage = 'collections';
4
+ type CollectionPage = 'collection';
5
+ export type PageType = AssetsPage | CollectionsPage | CollectionPage;
6
+ type Page = {
7
+ page: AssetsPage;
8
+ } | {
9
+ page: CollectionsPage;
10
+ } | {
11
+ page: CollectionPage;
12
+ collection: Collection;
13
+ };
14
+ type RouterState = {
15
+ page: Page;
16
+ setPage: (page: Page) => void;
17
+ };
18
+ export declare const useRouterStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<RouterState>, "setState" | "devtools"> & {
19
+ setState(partial: RouterState | Partial<RouterState> | ((state: RouterState) => RouterState | Partial<RouterState>), replace?: false | undefined, action?: (string | {
20
+ [x: string]: unknown;
21
+ [x: number]: unknown;
22
+ [x: symbol]: unknown;
23
+ type: string;
24
+ }) | undefined): void;
25
+ setState(state: RouterState | ((state: RouterState) => RouterState), replace: true, action?: (string | {
26
+ [x: string]: unknown;
27
+ [x: number]: unknown;
28
+ [x: symbol]: unknown;
29
+ type: string;
30
+ }) | undefined): void;
31
+ devtools: {
32
+ cleanup: () => void;
33
+ };
34
+ }>;
35
+ export declare const useRouterSelectors: {
36
+ (): RouterState;
37
+ <U>(selector: (state: RouterState) => U): U;
38
+ } & Omit<import("zustand").StoreApi<RouterState>, "setState" | "devtools"> & {
39
+ setState(partial: RouterState | Partial<RouterState> | ((state: RouterState) => RouterState | Partial<RouterState>), replace?: false | undefined, action?: (string | {
40
+ [x: string]: unknown;
41
+ [x: number]: unknown;
42
+ [x: symbol]: unknown;
43
+ type: string;
44
+ }) | undefined): void;
45
+ setState(state: RouterState | ((state: RouterState) => RouterState), replace: true, action?: (string | {
46
+ [x: string]: unknown;
47
+ [x: number]: unknown;
48
+ [x: symbol]: unknown;
49
+ type: string;
50
+ }) | undefined): void;
51
+ devtools: {
52
+ cleanup: () => void;
53
+ };
54
+ } & {
55
+ use: {
56
+ page: () => Page;
57
+ setPage: () => (page: Page) => void;
58
+ };
59
+ };
60
+ export declare const useRouter: () => [Page, (page: Page) => void];
61
+ export {};
@@ -0,0 +1,10 @@
1
+ import { StoreApi, UseBoundStore } from 'zustand';
2
+ type WithSelectors<S> = S extends {
3
+ getState: () => infer T;
4
+ } ? S & {
5
+ use: {
6
+ [K in keyof T]: () => T[K];
7
+ };
8
+ } : never;
9
+ export declare const createSelectors: <S extends UseBoundStore<StoreApi<object>>>(_store: S) => WithSelectors<S>;
10
+ export {};
@@ -40,5 +40,9 @@ export interface Asset {
40
40
  };
41
41
  textMetaproperties?: TextMetapropertiesType[];
42
42
  files: Record<string, File>;
43
+ streamingLinks?: {
44
+ hls: string;
45
+ dash: string;
46
+ };
43
47
  }
44
48
  export {};
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { PageType } from '../router/RouterContext';
3
- export type Field = 'CREATED_AT' | 'NAME' | 'PUBLISHED_AT' | 'UPDATED_AT' | 'NL_SEARCH';
4
- export type Direction = 'ASC' | 'DESC';
5
- export type Ordering = {
6
- field: Field;
7
- direction: Direction;
8
- };
9
- export declare function OrderingProvider(props: {
10
- children: React.ReactNode;
11
- }): React.JSX.Element;
12
- export declare function useOrdering(): {
13
- assets: Ordering;
14
- collections: Ordering;
15
- collection: Ordering;
16
- setOrdering: (page: PageType, ordering: Ordering) => void;
17
- reset: () => void;
18
- };
19
- export declare function useOrderingByPage(page: PageType): [Ordering, (ordering: Ordering) => void];