@commercelayer/app-elements 0.2.0 → 0.3.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/LICENSE +1 -1
- package/README.md +15 -14
- package/dist/{InputDateComponent-926e5e6d.js → InputDateComponent-dee358c1.js} +1 -1
- package/dist/hooks/useOnBlurFromContainer.d.ts +9 -0
- package/dist/main-49356a73.js +41117 -0
- package/dist/main.d.ts +5 -6
- package/dist/main.js +140 -142
- package/dist/mocks/data/customers.d.ts +2 -0
- package/dist/providers/CoreSdkProvider/useCoreApi.d.ts +23 -0
- package/dist/providers/TokenProvider/TokenProvider.d.ts +12 -13
- package/dist/style.css +1 -1
- package/dist/ui/atoms/A.d.ts +1 -1
- package/dist/ui/atoms/Avatar.d.ts +3 -0
- package/dist/ui/atoms/AvatarLetter/AvatarLetter.d.ts +23 -0
- package/dist/ui/atoms/AvatarLetter/colors.d.ts +2 -0
- package/dist/ui/atoms/AvatarLetter/index.d.ts +1 -0
- package/dist/ui/atoms/Badge.d.ts +5 -6
- package/dist/ui/atoms/Button.d.ts +4 -3
- package/dist/ui/atoms/Card.d.ts +1 -0
- package/dist/ui/atoms/Container.d.ts +6 -8
- package/dist/ui/atoms/CopyToClipboard.d.ts +2 -4
- package/dist/ui/atoms/Hr.d.ts +5 -4
- package/dist/ui/atoms/Icon/Icon.d.ts +18 -0
- package/dist/ui/atoms/{Icon.d.ts → Icon/icons.d.ts} +1 -26
- package/dist/ui/atoms/Icon/index.d.ts +1 -0
- package/dist/ui/atoms/Progress.d.ts +9 -6
- package/dist/ui/atoms/RadialProgress.d.ts +7 -0
- package/dist/ui/atoms/Tag.d.ts +2 -2
- package/dist/ui/composite/{ActionButtons.d.ts → ActionButtons/ActionButtons.d.ts} +2 -2
- package/dist/ui/composite/ActionButtons/index.d.ts +1 -0
- package/dist/ui/composite/Dropdown/Dropdown.d.ts +16 -0
- package/dist/ui/{atoms/dropdown/DropdownMenuDivider.d.ts → composite/Dropdown/DropdownDivider.d.ts} +3 -3
- package/dist/ui/{atoms/dropdown/DropdownMenuItem.d.ts → composite/Dropdown/DropdownItem.d.ts} +3 -3
- package/dist/ui/{atoms/dropdown → composite/Dropdown}/DropdownMenu.d.ts +3 -3
- package/dist/ui/composite/Dropdown/index.d.ts +3 -0
- package/dist/ui/composite/ListDetails.d.ts +2 -2
- package/dist/ui/composite/SearchBar.d.ts +2 -2
- package/dist/ui/forms/Input/Input.d.ts +2 -2
- package/dist/ui/forms/InputCurrency/InputCurrency.d.ts +3 -3
- package/dist/ui/forms/InputDate/InputDateComponent.d.ts +10 -10
- package/dist/ui/forms/InputReadonly.d.ts +4 -4
- package/dist/ui/forms/InputResourceGroup/InputResourceGroup.d.ts +1 -1
- package/dist/ui/forms/InputSelect/InputSelect.d.ts +1 -1
- package/dist/ui/internals/InputWrapper.d.ts +5 -5
- package/dist/ui/resources/ResourceAddress/ResourceAddress.d.ts +15 -0
- package/dist/ui/resources/ResourceAddress/ResourceAddress.mocks.d.ts +38 -0
- package/dist/ui/resources/ResourceAddress/ResourceAddressForm.d.ts +48 -0
- package/dist/ui/resources/ResourceAddress/index.d.ts +1 -0
- package/dist/ui/resources/ResourceLineItems/ResourceLineItems.d.ts +15 -0
- package/dist/ui/resources/{ResourceLineItems.mocks.d.ts → ResourceLineItems/ResourceLineItems.mocks.d.ts} +18 -0
- package/dist/ui/resources/ResourceLineItems/index.d.ts +1 -0
- package/dist/ui/resources/ResourceMetadata/ResourceMetadata.d.ts +22 -0
- package/dist/ui/resources/ResourceMetadata/ResourceMetadata.test.d.ts +1 -0
- package/dist/ui/resources/ResourceMetadata/ResourceMetadataForm.d.ts +14 -0
- package/dist/ui/resources/ResourceMetadata/index.d.ts +1 -0
- package/dist/ui/resources/ResourceTags.d.ts +12 -0
- package/dist/ui/resources/useResourceFilters/types.d.ts +2 -2
- package/dist/utils/array.d.ts +10 -0
- package/dist/utils/text.d.ts +5 -2
- package/package.json +2 -1
- package/dist/main-d208b3aa.js +0 -29029
- package/dist/ui/atoms/AvatarLetter.d.ts +0 -16
- package/dist/ui/atoms/BlockCode.d.ts +0 -12
- package/dist/ui/atoms/dropdown/index.d.ts +0 -3
- package/dist/ui/composite/ContextMenu.d.ts +0 -10
- package/dist/ui/forms/InputMetadata/HookedInputMetadata.d.ts +0 -19
- package/dist/ui/forms/InputMetadata/index.d.ts +0 -1
- package/dist/ui/resources/ResourceLineItems.d.ts +0 -12
- package/dist/ui/resources/ResourceListItemsMetadata.d.ts +0 -6
- /package/dist/ui/atoms/{AvatarLetter.test.d.ts → AvatarLetter/AvatarLetter.test.d.ts} +0 -0
- /package/dist/ui/atoms/{BlockCode.test.d.ts → AvatarLetter/colors.test.d.ts} +0 -0
- /package/dist/ui/atoms/{Icon.test.d.ts → Icon/Icon.test.d.ts} +0 -0
- /package/dist/ui/composite/{ActionButtons.test.d.ts → ActionButtons/ActionButtons.test.d.ts} +0 -0
- /package/dist/ui/resources/{ResourceLineItems.test.d.ts → ResourceAddress/ResourceAddress.test.d.ts} +0 -0
- /package/dist/ui/resources/{ResourceListItemsMetadata.test.d.ts → ResourceLineItems/ResourceLineItems.test.d.ts} +0 -0
|
@@ -3,8 +3,8 @@ interface Props extends React.HTMLAttributes<HTMLElement> {
|
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
arrow?: 'none';
|
|
5
5
|
}
|
|
6
|
-
declare function DropdownMenu({ children, arrow, ...rest }: Props): JSX.Element;
|
|
7
|
-
declare namespace DropdownMenu {
|
|
6
|
+
export declare function DropdownMenu({ children, arrow, ...rest }: Props): JSX.Element;
|
|
7
|
+
export declare namespace DropdownMenu {
|
|
8
8
|
var displayName: string;
|
|
9
9
|
}
|
|
10
|
-
export {
|
|
10
|
+
export {};
|
|
@@ -33,8 +33,8 @@ interface SearchBarProps {
|
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* This component renders a search bar with a clear button with debounced `onSearch` callback.
|
|
36
|
-
* <
|
|
37
|
-
* for the specified value of `debounceMs` (default 500ms).</
|
|
36
|
+
* <span type='info'>In this way the `onSearch` callback will be triggered only when the user stops typing
|
|
37
|
+
* for the specified value of `debounceMs` (default 500ms).</span>
|
|
38
38
|
*/
|
|
39
39
|
export declare const SearchBar: import("react").ForwardRefExoticComponent<SearchBarProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
40
40
|
export {};
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { type InputWrapperBaseProps } from '../../internals/InputWrapper';
|
|
3
3
|
export interface InputProps extends InputWrapperBaseProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Controlled type
|
|
6
6
|
*/
|
|
7
7
|
type?: 'text' | 'number' | 'password' | 'tel' | 'url' | 'email';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Optional CSS class names used for the input element
|
|
10
10
|
*/
|
|
11
11
|
className?: string;
|
|
12
12
|
}
|
|
@@ -16,7 +16,7 @@ export interface InputCurrencyProps extends InputWrapperBaseProps, Pick<ReactCur
|
|
|
16
16
|
*/
|
|
17
17
|
placeholder?: string;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Optional CSS class names used for the input element
|
|
20
20
|
*/
|
|
21
21
|
className?: string;
|
|
22
22
|
/**
|
|
@@ -32,7 +32,7 @@ export interface InputCurrencyProps extends InputWrapperBaseProps, Pick<ReactCur
|
|
|
32
32
|
*/
|
|
33
33
|
onChange: (cents: number | null, formatted: string) => void;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Hide currency symbol but keep the currency formatting
|
|
36
36
|
*/
|
|
37
37
|
hideCurrencySymbol?: boolean;
|
|
38
38
|
/**
|
|
@@ -41,7 +41,7 @@ export interface InputCurrencyProps extends InputWrapperBaseProps, Pick<ReactCur
|
|
|
41
41
|
*/
|
|
42
42
|
allowNegativeValue?: boolean;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Show (X) button to clear the input
|
|
45
45
|
*/
|
|
46
46
|
isClearable?: boolean;
|
|
47
47
|
}
|
|
@@ -4,44 +4,44 @@ import { type InputWrapperBaseProps } from '../../internals/InputWrapper';
|
|
|
4
4
|
export type MaybeDate = Date | null;
|
|
5
5
|
export interface InputDateProps extends InputWrapperBaseProps {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Controlled value
|
|
8
8
|
*/
|
|
9
9
|
value?: MaybeDate;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Callback fired when value is changed
|
|
12
12
|
*/
|
|
13
13
|
onChange: (date: MaybeDate) => void;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Optional CSS class names used for the outer wrapper/container element
|
|
16
16
|
*/
|
|
17
17
|
wrapperClassName?: string;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Optional CSS class names used for the input element
|
|
20
20
|
*/
|
|
21
21
|
inputClassName?: string;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Optional placeholder text
|
|
24
24
|
*/
|
|
25
25
|
placeholder?: string;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* String to be parsed as formatter (eg. MM/dd/yyyy, dd-MM-yy, ect...).
|
|
28
28
|
* When undefined, will autodetect format from user's browser
|
|
29
29
|
*/
|
|
30
30
|
format?: string;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Disable selection of previous dates
|
|
33
33
|
*/
|
|
34
34
|
minDate?: Date;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Set placeholder as detected date format
|
|
37
37
|
*/
|
|
38
38
|
autoPlaceholder?: boolean;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Enables a button to clear the selected date
|
|
41
41
|
*/
|
|
42
42
|
isClearable?: boolean;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Prevent the date picker calendar from opening on focus,
|
|
45
45
|
* this is useful when showing validation error message and
|
|
46
46
|
* to avoid the calendar to open on top of the error message
|
|
47
47
|
*/
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
import { type InputWrapperBaseProps } from '../internals/InputWrapper';
|
|
3
3
|
interface InputReadonlyProps extends InputWrapperBaseProps {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Controlled value
|
|
6
6
|
*/
|
|
7
7
|
value?: string;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Optional CSS class names used for the outer wrapper/container element
|
|
10
10
|
*/
|
|
11
11
|
wrapperClassName?: string;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Optional CSS class names used for the input element
|
|
14
14
|
*/
|
|
15
15
|
inputClassName?: string;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Optional prop to define whether to show or not the Copy to clipboard button
|
|
18
18
|
*/
|
|
19
19
|
showCopyAction?: boolean;
|
|
20
20
|
}
|
|
@@ -23,6 +23,6 @@ export interface InputResourceGroupProps extends Omit<FullListProps, 'totalCount
|
|
|
23
23
|
/**
|
|
24
24
|
* Input component that allows to select multiple resources. The list of options is automatically fetched from the API using the configuration provided as props.
|
|
25
25
|
* When number of fetched options is greater than `previewLimit` provided, a button will be shown to open an overlay with the full list of resources (infinite scrolling) and a search box on top.
|
|
26
|
-
* <
|
|
26
|
+
* <span type='info'>It's possible to mount the component with some `defaultValues` that will be always shown checked on top of the preview list, to ensure that user will always see the already checked options.</span>
|
|
27
27
|
*/
|
|
28
28
|
export declare const InputResourceGroup: React.FC<InputResourceGroupProps>;
|
|
@@ -3,29 +3,29 @@ import { type HintProps } from '../atoms/Hint';
|
|
|
3
3
|
import { type InputFeedbackProps } from '../forms/InputFeedback';
|
|
4
4
|
export interface InputWrapperBaseProps {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Optional input label
|
|
7
7
|
*/
|
|
8
8
|
label?: string;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Optional hint to be rendered below
|
|
11
11
|
*/
|
|
12
12
|
hint?: {
|
|
13
13
|
icon?: HintProps['icon'];
|
|
14
14
|
text: HintProps['children'];
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Optional hint to be rendered below
|
|
18
18
|
*/
|
|
19
19
|
feedback?: Omit<InputFeedbackProps, 'className'>;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Show label and input on the same line
|
|
22
22
|
* @default false
|
|
23
23
|
*/
|
|
24
24
|
inline?: boolean;
|
|
25
25
|
}
|
|
26
26
|
export interface InputWrapperProps extends InputWrapperBaseProps {
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Optional CSS class names used for the input element
|
|
29
29
|
*/
|
|
30
30
|
className?: string;
|
|
31
31
|
name?: string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Address } from '@commercelayer/sdk';
|
|
2
|
+
type ResourceAddressEditPosition = 'side' | 'bottom';
|
|
3
|
+
/**
|
|
4
|
+
* Renders an all-in-one visualization and editing solution to deal with a given resource of type `Address`
|
|
5
|
+
*/
|
|
6
|
+
export declare const ResourceAddress: import('../../atoms/SkeletonTemplate').SkeletonTemplateComponent<{
|
|
7
|
+
resource: Address;
|
|
8
|
+
title?: string | undefined;
|
|
9
|
+
editable?: boolean | undefined;
|
|
10
|
+
editPosition?: ResourceAddressEditPosition | undefined;
|
|
11
|
+
showBillingInfo?: boolean | undefined;
|
|
12
|
+
delayMs?: number | undefined;
|
|
13
|
+
isLoading?: boolean | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const presetAddresses: {
|
|
2
|
+
withName: {
|
|
3
|
+
type: "addresses";
|
|
4
|
+
id: string;
|
|
5
|
+
company: string;
|
|
6
|
+
first_name: string;
|
|
7
|
+
last_name: string;
|
|
8
|
+
full_name: string;
|
|
9
|
+
line_1: string;
|
|
10
|
+
line_2: string;
|
|
11
|
+
city: string;
|
|
12
|
+
country_code: string;
|
|
13
|
+
state_code: string;
|
|
14
|
+
zip_code: string;
|
|
15
|
+
phone: string;
|
|
16
|
+
billing_info: string;
|
|
17
|
+
created_at: string;
|
|
18
|
+
updated_at: string;
|
|
19
|
+
};
|
|
20
|
+
withCompany: {
|
|
21
|
+
type: "addresses";
|
|
22
|
+
id: string;
|
|
23
|
+
company: string;
|
|
24
|
+
first_name: string;
|
|
25
|
+
last_name: string;
|
|
26
|
+
full_name: string;
|
|
27
|
+
line_1: string;
|
|
28
|
+
line_2: string;
|
|
29
|
+
city: string;
|
|
30
|
+
country_code: string;
|
|
31
|
+
state_code: string;
|
|
32
|
+
zip_code: string;
|
|
33
|
+
phone: string;
|
|
34
|
+
billing_info: string;
|
|
35
|
+
created_at: string;
|
|
36
|
+
updated_at: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type Address } from '@commercelayer/sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const addressFormSchema: z.ZodObject<{
|
|
4
|
+
first_name: z.ZodString;
|
|
5
|
+
last_name: z.ZodString;
|
|
6
|
+
company: z.ZodOptional<z.ZodString>;
|
|
7
|
+
line_1: z.ZodString;
|
|
8
|
+
line_2: z.ZodOptional<z.ZodString>;
|
|
9
|
+
city: z.ZodString;
|
|
10
|
+
zip_code: z.ZodOptional<z.ZodString>;
|
|
11
|
+
state_code: z.ZodString;
|
|
12
|
+
country_code: z.ZodString;
|
|
13
|
+
phone: z.ZodString;
|
|
14
|
+
billing_info: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
city: string;
|
|
17
|
+
first_name: string;
|
|
18
|
+
last_name: string;
|
|
19
|
+
country_code: string;
|
|
20
|
+
line_1: string;
|
|
21
|
+
state_code: string;
|
|
22
|
+
phone: string;
|
|
23
|
+
company?: string | undefined;
|
|
24
|
+
line_2?: string | undefined;
|
|
25
|
+
zip_code?: string | undefined;
|
|
26
|
+
billing_info?: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
city: string;
|
|
29
|
+
first_name: string;
|
|
30
|
+
last_name: string;
|
|
31
|
+
country_code: string;
|
|
32
|
+
line_1: string;
|
|
33
|
+
state_code: string;
|
|
34
|
+
phone: string;
|
|
35
|
+
company?: string | undefined;
|
|
36
|
+
line_2?: string | undefined;
|
|
37
|
+
zip_code?: string | undefined;
|
|
38
|
+
billing_info?: string | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
export type ResourceAddressFormValues = z.infer<typeof addressFormSchema>;
|
|
41
|
+
export declare const ResourceAddressForm: import('../../atoms/SkeletonTemplate').SkeletonTemplateComponent<{
|
|
42
|
+
address: Address;
|
|
43
|
+
showBillingInfo?: boolean | undefined;
|
|
44
|
+
onChange: (updatedAddress: Address) => void;
|
|
45
|
+
delayMs?: number | undefined;
|
|
46
|
+
isLoading?: boolean | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ResourceAddress } from './ResourceAddress';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LineItem, ParcelLineItem, ReturnLineItem, StockLineItem } from '@commercelayer/sdk';
|
|
2
|
+
type Item = LineItem | ParcelLineItem | StockLineItem | ReturnLineItem;
|
|
3
|
+
/**
|
|
4
|
+
* This component renders a list of line items taking care of showing the right informations and structure depending of provided line item type.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ResourceLineItems: import('../../atoms/SkeletonTemplate').SkeletonTemplateComponent<{
|
|
7
|
+
items: Item[];
|
|
8
|
+
size?: "small" | "normal" | undefined;
|
|
9
|
+
footer?: React.ReactNode;
|
|
10
|
+
editable?: boolean | undefined;
|
|
11
|
+
onChange?: (() => void) | undefined;
|
|
12
|
+
delayMs?: number | undefined;
|
|
13
|
+
isLoading?: boolean | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export {};
|
|
@@ -215,6 +215,24 @@ export declare const presetLineItems: {
|
|
|
215
215
|
reference_origin: null;
|
|
216
216
|
metadata: {};
|
|
217
217
|
};
|
|
218
|
+
returnLineItem: {
|
|
219
|
+
id: string;
|
|
220
|
+
type: "return_line_items";
|
|
221
|
+
sku_code: string;
|
|
222
|
+
bundle_code: null;
|
|
223
|
+
quantity: number;
|
|
224
|
+
name: string;
|
|
225
|
+
image_url: string;
|
|
226
|
+
return_reason: {
|
|
227
|
+
0: string;
|
|
228
|
+
};
|
|
229
|
+
restocked_at: string;
|
|
230
|
+
created_at: string;
|
|
231
|
+
updated_at: string;
|
|
232
|
+
reference: null;
|
|
233
|
+
reference_origin: null;
|
|
234
|
+
metadata: {};
|
|
235
|
+
};
|
|
218
236
|
giftCardUsed: {
|
|
219
237
|
type: "line_items";
|
|
220
238
|
id: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ResourceLineItems } from './ResourceLineItems';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ListableResourceType } from '@commercelayer/sdk/lib/cjs/api';
|
|
2
|
+
interface ResourceMetadataOverlay {
|
|
3
|
+
/**
|
|
4
|
+
* Title shown as first line in edit overlay heading
|
|
5
|
+
*/
|
|
6
|
+
title: string;
|
|
7
|
+
/**
|
|
8
|
+
* Optional description shown as second line in edit overlay heading
|
|
9
|
+
*/
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* This component generates an all-in-one visualization and editing interface for managing metadata object values of requested resource.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ResourceMetadata: import('../../atoms/SkeletonTemplate').SkeletonTemplateComponent<{
|
|
16
|
+
resourceType: ListableResourceType;
|
|
17
|
+
resourceId: string;
|
|
18
|
+
overlay: ResourceMetadataOverlay;
|
|
19
|
+
delayMs?: number | undefined;
|
|
20
|
+
isLoading?: boolean | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type UseFormSetError } from 'react-hook-form';
|
|
2
|
+
import { type Metadata } from '@commercelayer/sdk/lib/cjs/resource';
|
|
3
|
+
interface ResourceMetadataFormValues {
|
|
4
|
+
metadata: Metadata;
|
|
5
|
+
}
|
|
6
|
+
export declare const ResourceMetadataForm: import('../../atoms/SkeletonTemplate').SkeletonTemplateComponent<{
|
|
7
|
+
defaultValues: ResourceMetadataFormValues;
|
|
8
|
+
onSubmit: (formValues: ResourceMetadataFormValues, setError: UseFormSetError<ResourceMetadataFormValues>) => void;
|
|
9
|
+
isSubmitting: boolean;
|
|
10
|
+
apiError?: any;
|
|
11
|
+
delayMs?: number | undefined;
|
|
12
|
+
isLoading?: boolean | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ResourceMetadata } from './ResourceMetadata';
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { type ListableResourceType } from '@commercelayer/sdk/lib/cjs/api';
|
|
2
2
|
type TaggableResource = Extract<ListableResourceType, 'addresses' | 'bundles' | 'customers' | 'coupons' | 'gift_cards' | 'line_items' | 'orders' | 'returns' | 'sku_options' | 'skus'>;
|
|
3
3
|
interface TagsOverlay {
|
|
4
|
+
/**
|
|
5
|
+
* Title shown as first line in edit overlay heading
|
|
6
|
+
*/
|
|
4
7
|
title: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional description shown as second line in edit overlay heading
|
|
10
|
+
*/
|
|
5
11
|
description?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Optional setting to define if tags app management link is to be shown in edit overlay heading
|
|
14
|
+
*/
|
|
6
15
|
showManageAction?: boolean;
|
|
7
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* This component generates an all-in-one visualization and editing interface for managing tags relationship of requested resource.
|
|
19
|
+
*/
|
|
8
20
|
export declare const ResourceTags: import('../atoms/SkeletonTemplate').SkeletonTemplateComponent<{
|
|
9
21
|
resourceType: TaggableResource;
|
|
10
22
|
resourceId: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type InputCurrencyRangeProps } from '../../forms/InputCurrencyRange';
|
|
2
2
|
import { type InputResourceGroupProps } from '../../forms/InputResourceGroup';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const filterableTimeRangePreset: readonly ["today", "last7days", "last30days", "custom"];
|
|
4
4
|
export type UiFilterName = string;
|
|
5
5
|
export type UiFilterValue = string | string[] | boolean | Date | undefined;
|
|
6
|
-
export type TimeRangePreset = (typeof
|
|
6
|
+
export type TimeRangePreset = (typeof filterableTimeRangePreset)[number];
|
|
7
7
|
export interface TimeRangeFormValues {
|
|
8
8
|
timePreset?: TimeRangePreset | null;
|
|
9
9
|
timeFrom?: Date | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Invalid<T> = Error & {
|
|
2
|
+
__errorMessage: T;
|
|
3
|
+
};
|
|
4
|
+
type AsUniqueArray<A extends readonly any[], B extends readonly any[]> = {
|
|
5
|
+
[I in keyof A]: unknown extends {
|
|
6
|
+
[J in keyof B]: J extends I ? never : B[J] extends A[I] ? unknown : never;
|
|
7
|
+
}[number] ? Invalid<[A[I], 'is repeated']> : A[I];
|
|
8
|
+
};
|
|
9
|
+
export declare const asUniqueArray: <N extends string, A extends [] | (readonly N[] & AsUniqueArray<A, A>)>(a: A) => A;
|
|
10
|
+
export {};
|
package/dist/utils/text.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { JsonPrimitive } from 'type-fest';
|
|
2
2
|
/**
|
|
3
3
|
* Given a `text` and a list of `values` it returns always the same value given the same `text`.
|
|
4
|
-
* For example this is used when you need to map a
|
|
4
|
+
* For example this is used when you need to map a full name with a color.
|
|
5
|
+
* ```
|
|
6
|
+
* getDeterministicValue('Doe', ['#FFFFFF', '#000000']) // => '#FFFFFF'
|
|
7
|
+
* ```
|
|
5
8
|
*/
|
|
6
|
-
export declare function getDeterministicValue(text: string, values: readonly
|
|
9
|
+
export declare function getDeterministicValue(text: string, values: readonly string[]): string | undefined;
|
|
7
10
|
/**
|
|
8
11
|
* Get initials given a text.
|
|
9
12
|
* @example getInitials('Ringo Starr') -> 'RS'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercelayer/app-elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"pnpm": ">=7"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"@ac-dev/countries-service": "^1.2.0",
|
|
24
25
|
"@commercelayer/sdk": "5.13.2",
|
|
25
26
|
"@types/lodash": "^4.14.198",
|
|
26
27
|
"@types/react": "^18.2.21",
|