@commercelayer/app-elements 2.7.4 → 2.8.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/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { aE as s, bi as t, aF as o, aG as r, aH as c, aI as n, aJ as u, aK as i, aL as l, aM as d, bj as p, aN as b, aO as g, aP as S, at as m, bk as I, bl as k, bm as D, bn as T, aQ as R, ax as y, ay as h, bx as C, aR as A, aS as H, bo as F, bF as P, bG as v, bI as f, bK as B, bM as O, bQ as N, bS as G, bX as L, bZ as E, c0 as w, c7 as x, c9 as V, cb as M, cd as W, cf as J, cj as U, ck as Y, cl as j, aT as q, aU as z, bH as K, bJ as X, bL as Z, bN as _, bP as $, bR as Q, bT as aa, bU as ea, bV as sa, bW as ta, bY as oa, b_ as ra, c1 as ca, c8 as na, ca as ua, cc as ia, ce as la, cg as da, ch as pa, ci as ba, bp as ga, bq as Sa, br as ma, bs as Ia, aA as ka, bt as Da, aV as Ta, bu as Ra, bv as ya, aW as ha, aX as Ca, aY as Aa, aZ as Ha, bw as Fa, co as Pa, cp as va, cs as fa, ct as Ba, cu as Oa, cv as Na, cw as Ga, cx as La, cy as Ea, cz as wa, by as xa, a_ as Va, bB as Ma, a$ as Wa, b0 as Ja, b1 as Ua, b2 as Ya, b4 as ja, b5 as qa, b6 as za, b7 as Ka, b8 as Xa, bd as Za, b9 as _a, bC as $a, be as Qa, bf as ae, ba as ee, bg as se, bb as te, bD as oe, aB as re, bE as ce, bh as ne, bc as ue, aa as ie, aw as le, bz as de, bA as pe, Z as be, _ as ge, a9 as Se, aC as me, c2 as Ie, bO as ke, $ as De, a0 as Te, a1 as Re, ab as ye, ac as he, ad as Ce, cB as Ae, cC as He, c3 as Fe, a2 as Pe, a3 as ve, a4 as fe, cD as Be, cE as Oe, cF as Ne, cG as Ge, cH as Le, ae as Ee, af as we, cI as xe, cJ as Ve, cK as Me, cL as We, ag as Je, ah as Ue, cM as Ye, cN as je, cO as qe, ak as ze, al as Ke, V as Xe, ai as Ze, aj as _e, X as $e, c4 as Qe, c5 as as, c6 as es, a5 as ss, W as ts, Y as os, a6 as rs, cq as cs, cm as ns, a7 as us, a8 as is, am as ls, au as ds, av as ps, an as bs, ao as gs, ap as Ss, b$ as ms, aq as Is, ar as ks, as as Ds, cr as Ts, cA as Rs, az as ys, aD as hs, cn as Cs, b3 as As } from "./main-CfwDxu1J.js";
2
+ import { aE as s, bi as t, aF as o, aG as r, aH as c, aI as n, aJ as u, aK as i, aL as l, aM as d, bj as p, aN as b, aO as g, aP as S, at as m, bk as I, bl as k, bm as D, bn as T, aQ as R, ax as y, ay as h, bx as C, aR as A, aS as H, bo as F, bF as P, bG as v, bI as f, bK as B, bM as O, bQ as N, bS as G, bX as L, bZ as E, c0 as w, c7 as x, c9 as V, cb as M, cd as W, cf as J, cj as U, ck as Y, cl as j, aT as q, aU as z, bH as K, bJ as X, bL as Z, bN as _, bP as $, bR as Q, bT as aa, bU as ea, bV as sa, bW as ta, bY as oa, b_ as ra, c1 as ca, c8 as na, ca as ua, cc as ia, ce as la, cg as da, ch as pa, ci as ba, bp as ga, bq as Sa, br as ma, bs as Ia, aA as ka, bt as Da, aV as Ta, bu as Ra, bv as ya, aW as ha, aX as Ca, aY as Aa, aZ as Ha, bw as Fa, co as Pa, cp as va, cs as fa, ct as Ba, cu as Oa, cv as Na, cw as Ga, cx as La, cy as Ea, cz as wa, by as xa, a_ as Va, bB as Ma, a$ as Wa, b0 as Ja, b1 as Ua, b2 as Ya, b4 as ja, b5 as qa, b6 as za, b7 as Ka, b8 as Xa, bd as Za, b9 as _a, bC as $a, be as Qa, bf as ae, ba as ee, bg as se, bb as te, bD as oe, aB as re, bE as ce, bh as ne, bc as ue, aa as ie, aw as le, bz as de, bA as pe, Z as be, _ as ge, a9 as Se, aC as me, c2 as Ie, bO as ke, $ as De, a0 as Te, a1 as Re, ab as ye, ac as he, ad as Ce, cB as Ae, cC as He, c3 as Fe, a2 as Pe, a3 as ve, a4 as fe, cD as Be, cE as Oe, cF as Ne, cG as Ge, cH as Le, ae as Ee, af as we, cI as xe, cJ as Ve, cK as Me, cL as We, ag as Je, ah as Ue, cM as Ye, cN as je, cO as qe, ak as ze, al as Ke, V as Xe, ai as Ze, aj as _e, X as $e, c4 as Qe, c5 as as, c6 as es, a5 as ss, W as ts, Y as os, a6 as rs, cq as cs, cm as ns, a7 as us, a8 as is, am as ls, au as ds, av as ps, an as bs, ao as gs, ap as Ss, b$ as ms, aq as Is, ar as ks, as as Ds, cr as Ts, cA as Rs, az as ys, aD as hs, cn as Cs, b3 as As } from "./main-C51zpxs_.js";
3
3
  export {
4
4
  s as A,
5
5
  t as ActionButtons,
@@ -11,6 +11,7 @@ export declare const iconMapping: {
11
11
  readonly arrowDown: phosphor.Icon;
12
12
  readonly arrowLeft: phosphor.Icon;
13
13
  readonly arrowRight: phosphor.Icon;
14
+ readonly arrowsDownUp: phosphor.Icon;
14
15
  readonly arrowsLeftRight: phosphor.Icon;
15
16
  readonly arrowSquareOut: phosphor.Icon;
16
17
  readonly arrowUpRight: phosphor.Icon;
@@ -2,9 +2,10 @@ import { default as React } from 'react';
2
2
 
3
3
  export interface TableProps {
4
4
  thead?: React.ReactNode;
5
- tbody?: React.ReactNode;
6
5
  className?: string;
7
6
  variant?: 'boxed';
7
+ tbody?: React.ReactNode;
8
+ tfoot?: React.ReactNode;
8
9
  }
9
10
  /**
10
11
  * `<Table>` component is used to organize and display data efficiently.
@@ -1,4 +1,6 @@
1
- export interface TdProps extends React.TdHTMLAttributes<HTMLElement> {
1
+ import { SkeletonTemplateProps } from '../SkeletonTemplate';
2
+
3
+ export interface TdProps extends React.TdHTMLAttributes<HTMLElement>, SkeletonTemplateProps {
2
4
  children?: React.ReactNode;
3
5
  textEllipsis?: number;
4
6
  }
@@ -1,5 +1,6 @@
1
1
  import { SectionProps } from '../../atoms/Section';
2
2
  import { SkeletonTemplateProps } from '../../atoms/SkeletonTemplate';
3
+ import { ThProps } from '../../atoms/Table/Th';
3
4
  import { FetcherResponse, Resource } from './infiniteFetcher';
4
5
  import { ListableResourceType, QueryParamsList, ResourceFields } from '@commercelayer/sdk';
5
6
  import { default as React, FC } from 'react';
@@ -16,6 +17,9 @@ export interface ResourceListItemTemplateProps<TResource extends ListableResourc
16
17
  remove?: () => void;
17
18
  }> {
18
19
  }
20
+ type TableVariantHeading = Omit<ThProps, 'children'> & {
21
+ label: React.ReactNode;
22
+ };
19
23
  export interface ResourceListItemTemplate<TResource extends ListableResourceType> {
20
24
  /**
21
25
  * A react component to be used to render each item in the list.
@@ -47,17 +51,26 @@ export type ResourceListProps<TResource extends ListableResourceType> = Pick<Sec
47
51
  };
48
52
  /**
49
53
  * An element to be rendered when the list is empty.
54
+ * When not provided, a default message will be shown.
55
+ * When a string is provided, it will be rendered as inline text below title and actionButton.
56
+ * When a JSX element is provided, it will be rendered as a custom element and no title or actionButton will be shown.
50
57
  */
51
- emptyState: JSX.Element;
58
+ emptyState?: JSX.Element;
52
59
  /**
53
60
  * Title.
54
61
  */
55
62
  title?: ((recordCount: number | undefined) => React.ReactNode) | React.ReactNode;
56
63
  /**
57
- *
64
+ * Force the size of the title, when not defined, title size will be `small` by default or `normal` when variant is `table` or `boxed`.
58
65
  */
66
+ titleSize?: SectionProps['titleSize'];
67
+ } & ({
68
+ /** Boxed variant wraps the list in a Card */
59
69
  variant?: 'boxed';
60
- } & (ResourceListItemTemplate<TResource> | {
70
+ } | {
71
+ variant: 'table';
72
+ headings: TableVariantHeading[];
73
+ }) & (ResourceListItemTemplate<TResource> | {
61
74
  /**
62
75
  * Children as a function to render a custom element.
63
76
  * @example
@@ -79,7 +92,8 @@ export type ResourceListProps<TResource extends ListableResourceType> = Pick<Sec
79
92
  * It's possible to specify a query to filter the list and either
80
93
  * a React component (`ItemTemplate`) to be used as item template for the list or a function as `children` to render a custom element.
81
94
  */
82
- export declare function ResourceList<TResource extends ListableResourceType>({ type, query, title, variant, actionButton, emptyState, metricsQuery, ...props }: ResourceListProps<TResource>): JSX.Element;
95
+ export declare function ResourceList<TResource extends ListableResourceType>({ type, query, title, titleSize, variant, actionButton, metricsQuery, emptyState: emptyStateProp, ...props }: ResourceListProps<TResource>): JSX.Element;
83
96
  export declare namespace ResourceList {
84
97
  var displayName: string;
85
98
  }
99
+ export {};
@@ -1,17 +1,10 @@
1
- import { Metadata } from '@commercelayer/sdk';
2
1
  import { ResourceMetadataProps } from './ResourceMetadata';
3
2
 
4
- interface ResourceMetadataFormValues {
5
- metadata: Metadata;
6
- }
7
3
  export declare const ResourceMetadataForm: import('../../atoms/SkeletonTemplate').SkeletonTemplateComponent<{
8
- resourceId: string;
9
- defaultValues: ResourceMetadataFormValues;
4
+ resourceId: ResourceMetadataProps["resourceId"];
5
+ resourceType: ResourceMetadataProps["resourceType"];
10
6
  mode: ResourceMetadataProps["mode"];
11
- onSubmit: (formValues: ResourceMetadataFormValues) => void;
12
- isSubmitting: boolean;
13
- apiError?: any;
7
+ onSubmitted: () => void;
14
8
  delayMs?: number | undefined;
15
9
  isLoading?: boolean | undefined;
16
10
  }>;
17
- export {};
@@ -1,7 +1,7 @@
1
1
  import { EditTagsOverlayProps } from '../../hooks/useEditTagsOverlay';
2
2
  import { ListableResourceType } from '@commercelayer/sdk';
3
3
 
4
- type TaggableResource = Extract<ListableResourceType, 'addresses' | 'bundles' | 'customers' | 'coupons' | 'gift_cards' | 'line_items' | 'orders' | 'returns' | 'sku_options' | 'skus' | 'shipments'>;
4
+ type TaggableResource = Extract<ListableResourceType, 'addresses' | 'bundles' | 'coupons' | 'customers' | 'gift_cards' | 'line_items' | 'line_item_options' | 'order_subscriptions' | 'orders' | 'buy_x_pay_y_promotions' | 'external_promotions' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'flex_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'percentage_discount_promotions' | 'returns' | 'shipments' | 'sku_options' | 'skus'>;
5
5
  interface TagsOverlay extends Omit<EditTagsOverlayProps, 'resourceId' | 'resourceType'> {
6
6
  }
7
7
  export interface ResourceTagsProps {
@@ -58,7 +58,7 @@ interface UseResourceFiltersHook {
58
58
  /**
59
59
  * Filtered ResourceList component based on current active filters
60
60
  */
61
- FilteredList: <TResource extends ListableResourceType>(props: Pick<ResourceListProps<TResource>, 'type' | 'emptyState' | 'actionButton'> & ResourceListItemTemplate<TResource> & {
61
+ FilteredList: <TResource extends ListableResourceType>(props: Omit<ResourceListProps<TResource>, 'query' | 'metricsQuery'> & ResourceListItemTemplate<TResource> & {
62
62
  query?: Omit<NonNullable<ResourceListProps<TResource>['query']>, 'filters'>;
63
63
  metricsQuery?: Omit<NonNullable<ResourceListProps<TResource>['metricsQuery']>, 'filter'> & {
64
64
  /** Filters need to be configured within the `useResourceFilters` options. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercelayer/app-elements",
3
- "version": "2.7.4",
3
+ "version": "2.8.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [