@commercelayer/app-elements 0.0.10 → 0.0.12
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/dist/{Async-cd7e0925.js → Async-3afccca6.js} +2 -2
- package/dist/{InputDateComponent-60fbdc2b.js → InputDateComponent-eaf4aead.js} +1 -1
- package/dist/{Select-28bbc8e8.js → Select-f07f1570.js} +2 -2
- package/dist/hooks/useDelayShow.d.ts +1 -0
- package/dist/main-e490d6fa.js +8581 -0
- package/dist/main.d.ts +2 -1
- package/dist/main.js +42 -41
- package/dist/{overrides-33e36a2f.js → overrides-5b44a038.js} +1 -1
- package/dist/ui/atoms/EmptyState.d.ts +2 -2
- package/dist/ui/atoms/Legend.d.ts +1 -1
- package/dist/ui/atoms/SkeletonTemplate.d.ts +6 -2
- package/dist/ui/resources/OrderSummary.d.ts +1 -2
- package/dist/ui/resources/ResourceList/VisibilityTrigger.d.ts +8 -0
- package/dist/ui/resources/ResourceList/index.d.ts +20 -0
- package/dist/ui/resources/ResourceList/infiniteFetcher.d.ts +20 -0
- package/dist/ui/resources/ResourceList/reducer.d.ts +20 -0
- package/package.json +2 -2
- package/dist/main-415f7420.js +0 -7795
- package/dist/ui/atoms/DelayShow.d.ts +0 -10
package/dist/main.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export { Button } from './ui/atoms/Button';
|
|
|
10
10
|
export { Card } from './ui/atoms/Card';
|
|
11
11
|
export { Container } from './ui/atoms/Container';
|
|
12
12
|
export { CopyToClipboard } from './ui/atoms/CopyToClipboard';
|
|
13
|
-
export { DelayShow } from './ui/atoms/DelayShow';
|
|
14
13
|
export { DropdownMenu, DropdownMenuDivider, DropdownMenuItem } from './ui/atoms/dropdown';
|
|
15
14
|
export { EmptyState } from './ui/atoms/EmptyState';
|
|
16
15
|
export { FormFooter } from './ui/atoms/FormFooter';
|
|
@@ -54,5 +53,7 @@ export { ListItem } from './ui/lists/ListItem';
|
|
|
54
53
|
export { Table } from './ui/tables/Table';
|
|
55
54
|
export { TableData } from './ui/tables/TableData';
|
|
56
55
|
export { OrderSummary } from './ui/resources/OrderSummary';
|
|
56
|
+
export { ResourceList } from './ui/resources/ResourceList';
|
|
57
57
|
export { downloadJsonAsFile } from './helpers/downloadJsonAsFile';
|
|
58
58
|
export { formatDate } from './helpers/date';
|
|
59
|
+
export { useDelayShow } from './hooks/useDelayShow';
|
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as o, B as n, D as r, F as i, G as l, H as
|
|
1
|
+
import { A as o, B as n, D as r, F as i, G as l, H as u, J as d, a8 as p, K as S, C as g, L as T, M as I, N as m, O as D, E as k, P, Q as c, R as C, ad as L, ae as y, af as B, ag as b, ah as v, ai as w, aj as x, ak as R, an as F, ao as A, ap as M, aq as f, S as h, as as E, at as H, au as J, av as V, ay as z, a9 as O, U as j, aa as q, ab as G, V as K, W as N, ar as Q, ac as U, az as W, Y, Z, $ as _, a0 as $, a1 as X, a3 as aa, aw as sa, ax as ea, a2 as ta, a4 as oa, a7 as na, a6 as ra, T as ia, a5 as la, aA as ua, am as da, aB as pa, al as Sa, y as ga, aC as Ta, z as Ia, _ as ma } from "./main-e490d6fa.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "@commercelayer/sdk";
|
|
4
4
|
export {
|
|
@@ -7,46 +7,46 @@ export {
|
|
|
7
7
|
r as Badge,
|
|
8
8
|
i as BlockCode,
|
|
9
9
|
l as Button,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
u as Card,
|
|
11
|
+
d as Container,
|
|
12
12
|
p as ContextMenu,
|
|
13
13
|
S as CopyToClipboard,
|
|
14
14
|
g as CoreSdkProvider,
|
|
15
|
-
T as
|
|
16
|
-
I as
|
|
17
|
-
m as
|
|
18
|
-
D as
|
|
19
|
-
k as
|
|
20
|
-
P as
|
|
21
|
-
c as
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
b as
|
|
27
|
-
v as
|
|
28
|
-
w as
|
|
29
|
-
x as
|
|
30
|
-
F as InputReadonly,
|
|
15
|
+
T as DropdownMenu,
|
|
16
|
+
I as DropdownMenuDivider,
|
|
17
|
+
m as DropdownMenuItem,
|
|
18
|
+
D as EmptyState,
|
|
19
|
+
k as ErrorBoundary,
|
|
20
|
+
P as FormFooter,
|
|
21
|
+
c as Hint,
|
|
22
|
+
C as Icon,
|
|
23
|
+
L as Input,
|
|
24
|
+
y as InputDate,
|
|
25
|
+
B as InputDateRange,
|
|
26
|
+
b as InputFeedback,
|
|
27
|
+
v as InputFile,
|
|
28
|
+
w as InputJson,
|
|
29
|
+
x as InputReadonly,
|
|
31
30
|
R as InputSelect,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
31
|
+
F as InputTextArea,
|
|
32
|
+
A as InputToggleBox,
|
|
33
|
+
M as InputToggleListBox,
|
|
34
|
+
f as Label,
|
|
35
|
+
h as Legend,
|
|
36
|
+
E as List,
|
|
37
|
+
H as ListDetails,
|
|
38
|
+
J as ListDetailsItem,
|
|
39
|
+
V as ListItem,
|
|
40
|
+
z as OrderSummary,
|
|
41
|
+
O as PageError,
|
|
42
|
+
j as PageHeading,
|
|
43
|
+
q as PageLayout,
|
|
44
|
+
G as PageSkeleton,
|
|
45
|
+
K as Pagination,
|
|
46
|
+
N as RadialProgress,
|
|
47
|
+
Q as RadioButtons,
|
|
48
|
+
U as Report,
|
|
49
|
+
W as ResourceList,
|
|
50
50
|
Y as Skeleton,
|
|
51
51
|
Z as SkeletonTemplate,
|
|
52
52
|
_ as Spacer,
|
|
@@ -61,11 +61,12 @@ export {
|
|
|
61
61
|
ra as Th,
|
|
62
62
|
ia as TokenProvider,
|
|
63
63
|
la as Tr,
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
ua as downloadJsonAsFile,
|
|
65
|
+
da as flatSelectValues,
|
|
66
66
|
pa as formatDate,
|
|
67
67
|
Sa as isSingleValueSelected,
|
|
68
68
|
ga as useCoreSdkProvider,
|
|
69
|
-
Ta as
|
|
70
|
-
Ia as
|
|
69
|
+
Ta as useDelayShow,
|
|
70
|
+
Ia as useTokenProvider,
|
|
71
|
+
ma as withinSkeleton
|
|
71
72
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as V from "react";
|
|
2
2
|
import be, { useLayoutEffect as hn, forwardRef as fr, useContext as Ze, createContext as Ct, createElement as fe, Fragment as Ve, useRef as ue, useState as pe, useMemo as he, useCallback as Y, Component as pr, useEffect as Cn } from "react";
|
|
3
3
|
import { createPortal as mr } from "react-dom";
|
|
4
|
-
import { X as Ir } from "./main-
|
|
4
|
+
import { X as Ir } from "./main-e490d6fa.js";
|
|
5
5
|
var Je = {}, vr = {
|
|
6
6
|
get exports() {
|
|
7
7
|
return Je;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { IconProps } from './Icon';
|
|
3
|
-
interface
|
|
3
|
+
export interface EmptyStateProps {
|
|
4
4
|
title: string;
|
|
5
5
|
description?: ReactNode;
|
|
6
6
|
action?: ReactNode;
|
|
7
7
|
className?: string;
|
|
8
8
|
icon?: IconProps['name'];
|
|
9
9
|
}
|
|
10
|
-
declare function EmptyState({ title, description, action, icon, className, ...rest }:
|
|
10
|
+
declare function EmptyState({ title, description, action, icon, className, ...rest }: EmptyStateProps): JSX.Element;
|
|
11
11
|
declare namespace EmptyState {
|
|
12
12
|
var displayName: string;
|
|
13
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC, ReactNode, ReactPortal } from 'react';
|
|
1
|
+
import { FC, FunctionComponent, ReactNode, ReactPortal } from 'react';
|
|
2
2
|
import { Simplify } from 'type-fest';
|
|
3
3
|
declare type ReactNodeNoPortal = Exclude<ReactNode, ReactPortal>;
|
|
4
4
|
interface SkeletonTemplateProps {
|
|
@@ -10,10 +10,14 @@ interface SkeletonTemplateProps {
|
|
|
10
10
|
isLoading?: boolean;
|
|
11
11
|
children: ReactNodeNoPortal;
|
|
12
12
|
}
|
|
13
|
+
export interface SkeletonTemplateComponent<P = {}> extends FunctionComponent<P> {
|
|
14
|
+
skeletonTemplate: true;
|
|
15
|
+
}
|
|
13
16
|
export declare function withinSkeleton<P>(Element: FC<Simplify<P & {
|
|
14
17
|
isLoading?: boolean;
|
|
15
|
-
}>>):
|
|
18
|
+
}>>): SkeletonTemplateComponent<Simplify<P & {
|
|
16
19
|
isLoading?: boolean;
|
|
17
20
|
}>>;
|
|
21
|
+
export declare function isSkeletonTemplate(child: ReactNode): boolean;
|
|
18
22
|
declare const SkeletonTemplate: FC<SkeletonTemplateProps>;
|
|
19
23
|
export { SkeletonTemplate };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { Order } from '@commercelayer/sdk';
|
|
3
|
-
declare const OrderSummary:
|
|
2
|
+
declare const OrderSummary: import('../atoms/SkeletonTemplate').SkeletonTemplateComponent<{
|
|
4
3
|
order: Order;
|
|
5
4
|
isLoading?: boolean | undefined;
|
|
6
5
|
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface VisibilityTriggerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
rootMargin?: string;
|
|
4
|
+
callback: (entry: IntersectionObserverEntry) => void;
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function VisibilityTrigger({ rootMargin, enabled, callback, ...rest }: VisibilityTriggerProps): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EmptyStateProps } from '../../atoms/EmptyState';
|
|
2
|
+
import { LegendProps } from '../../atoms/Legend';
|
|
3
|
+
import { CommerceLayerClient, QueryParamsList } from '@commercelayer/sdk';
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
import { ListableResource, Resource } from './infiniteFetcher';
|
|
6
|
+
export interface ResourceListProps<TResource extends ListableResource> extends Pick<LegendProps, 'title' | 'actionButton'> {
|
|
7
|
+
type: TResource;
|
|
8
|
+
query?: Omit<QueryParamsList, 'pageNumber'>;
|
|
9
|
+
Item: FC<{
|
|
10
|
+
resource?: Resource<TResource>;
|
|
11
|
+
isLoading?: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
emptyState: EmptyStateProps;
|
|
14
|
+
sdkClient?: CommerceLayerClient;
|
|
15
|
+
}
|
|
16
|
+
declare function ResourceList<TResource extends ListableResource>({ type, query, title, Item, actionButton, sdkClient, emptyState }: ResourceListProps<TResource>): JSX.Element;
|
|
17
|
+
declare namespace ResourceList {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
20
|
+
export { ResourceList };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CommerceLayerClient, QueryParamsList } from '@commercelayer/sdk';
|
|
2
|
+
export declare type ListableResource = Exclude<keyof CommerceLayerClient, 'addRawResponseReader' | 'addRawResponseReader' | 'addRequestInterceptor' | 'addResponseInterceptor' | 'application' | 'config' | 'currentOrganization' | 'isApiError' | 'openApiSchemaVersion' | 'organization' | 'removeInterceptor' | 'removeRawResponseReader' | 'resources'>;
|
|
3
|
+
declare type ListResource<TResource extends ListableResource> = Awaited<ReturnType<CommerceLayerClient[TResource]['list']>>;
|
|
4
|
+
export declare type Resource<TResource extends ListableResource> = ListResource<TResource>[number];
|
|
5
|
+
export interface FetcherResponse<TResource> {
|
|
6
|
+
list: TResource[];
|
|
7
|
+
meta: {
|
|
8
|
+
pageCount: number;
|
|
9
|
+
recordCount: number;
|
|
10
|
+
currentPage: number;
|
|
11
|
+
recordsPerPage: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare function infiniteFetcher<TResource extends ListableResource>({ sdkClient, query, currentData, resourceType }: {
|
|
15
|
+
sdkClient: CommerceLayerClient;
|
|
16
|
+
query?: Omit<QueryParamsList, 'pageNumber'>;
|
|
17
|
+
currentData?: FetcherResponse<Resource<TResource>>;
|
|
18
|
+
resourceType: TResource;
|
|
19
|
+
}): Promise<FetcherResponse<Resource<TResource>>>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FetcherResponse, Resource, ListableResource } from './infiniteFetcher';
|
|
2
|
+
interface ResourceListInternalState<TResource extends ListableResource> {
|
|
3
|
+
isLoading: boolean;
|
|
4
|
+
error?: {
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
data?: FetcherResponse<Resource<TResource>> | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare const initialState: ResourceListInternalState<any>;
|
|
10
|
+
declare type Action<TResource extends ListableResource> = {
|
|
11
|
+
type: 'prepare';
|
|
12
|
+
} | {
|
|
13
|
+
type: 'loaded';
|
|
14
|
+
payload: FetcherResponse<Resource<TResource>>;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'error';
|
|
17
|
+
payload: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const reducer: <TResource extends ListableResource>(state: ResourceListInternalState<TResource>, action: Action<TResource>) => ResourceListInternalState<TResource>;
|
|
20
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercelayer/app-elements",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"pnpm": ">=7"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@commercelayer/sdk": "
|
|
23
|
+
"@commercelayer/sdk": "4.25.0",
|
|
24
24
|
"@types/lodash": "^4.14.191",
|
|
25
25
|
"@types/react": "^18.0.26",
|
|
26
26
|
"@types/react-datepicker": "^4.8.0",
|