@commercelayer/app-elements 0.0.19 → 0.0.20
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-01069344.js → Async-86d7b52d.js} +18 -17
- package/dist/{InputDateComponent-7cc64865.js → InputDateComponent-8fe235f4.js} +2542 -2381
- package/dist/{Select-207fa38b.js → Select-c5f20a31.js} +2 -2
- package/dist/helpers/date.d.ts +2 -2
- package/dist/hooks/useClickAway.d.ts +1 -1
- package/dist/{main-29e2c4ad.js → main-b7422b94.js} +843 -706
- package/dist/main.d.ts +1 -1
- package/dist/main.js +22 -21
- package/dist/{overrides-ded5eb26.js → overrides-c4c3ace4.js} +1630 -1529
- package/dist/providers/CoreSdkProvider/index.d.ts +2 -2
- package/dist/providers/CoreSdkProvider/makeSdkClient.d.ts +1 -1
- package/dist/providers/ErrorBoundary.d.ts +1 -1
- package/dist/providers/TokenProvider/getInfoFromJwt.d.ts +1 -1
- package/dist/providers/TokenProvider/index.d.ts +3 -4
- package/dist/providers/TokenProvider/reducer.d.ts +2 -2
- package/dist/providers/TokenProvider/storage.d.ts +2 -2
- package/dist/providers/TokenProvider/types.d.ts +6 -6
- package/dist/providers/TokenProvider/url.d.ts +1 -1
- package/dist/providers/TokenProvider/validateToken.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/ui/atoms/A.d.ts +0 -1
- package/dist/ui/atoms/Avatar.d.ts +0 -1
- package/dist/ui/atoms/Badge.d.ts +1 -1
- package/dist/ui/atoms/Button.d.ts +3 -4
- package/dist/ui/atoms/Card.d.ts +0 -1
- package/dist/ui/atoms/Container.d.ts +0 -1
- package/dist/ui/atoms/EmptyState.d.ts +2 -2
- package/dist/ui/atoms/FlexRow.d.ts +2 -3
- package/dist/ui/atoms/Hint.d.ts +2 -2
- package/dist/ui/atoms/Icon.d.ts +18 -19
- package/dist/ui/atoms/Legend.d.ts +1 -1
- package/dist/ui/atoms/PageHeading.d.ts +2 -3
- package/dist/ui/atoms/RadialProgress.d.ts +1 -1
- package/dist/ui/atoms/Skeleton.d.ts +1 -1
- package/dist/ui/atoms/SkeletonTemplate.d.ts +5 -5
- package/dist/ui/atoms/Spacer.d.ts +2 -3
- package/dist/ui/atoms/Stack.d.ts +1 -1
- package/dist/ui/atoms/StatusDot.d.ts +1 -1
- package/dist/ui/atoms/Tabs.d.ts +1 -1
- package/dist/ui/atoms/Text.d.ts +6 -7
- package/dist/ui/atoms/dropdown/DropdownMenu.d.ts +0 -1
- package/dist/ui/atoms/dropdown/DropdownMenuDivider.d.ts +0 -1
- package/dist/ui/atoms/dropdown/DropdownMenuItem.d.ts +0 -1
- package/dist/ui/atoms/tables/Td.d.ts +0 -1
- package/dist/ui/atoms/tables/Th.d.ts +0 -1
- package/dist/ui/atoms/tables/Tr.d.ts +0 -1
- package/dist/ui/composite/ContextMenu.d.ts +0 -1
- package/dist/ui/composite/PageLayout.d.ts +2 -2
- package/dist/ui/composite/Report.d.ts +1 -1
- package/dist/ui/forms/Input.d.ts +2 -3
- package/dist/ui/forms/InputCheckbox.d.ts +3 -4
- package/dist/ui/forms/InputDate/InputDateComponent.d.ts +3 -4
- package/dist/ui/forms/InputDate/index.d.ts +3 -4
- package/dist/ui/forms/InputDateRange.d.ts +3 -4
- package/dist/ui/forms/InputFeedback.d.ts +1 -1
- package/dist/ui/forms/InputFile.d.ts +2 -3
- package/dist/ui/forms/InputJson.d.ts +1 -1
- package/dist/ui/forms/InputReadonly.d.ts +1 -1
- package/dist/ui/forms/InputSelect/Async.d.ts +3 -3
- package/dist/ui/forms/InputSelect/Select.d.ts +2 -2
- package/dist/ui/forms/InputSelect/index.d.ts +23 -6
- package/dist/ui/forms/InputSelect/overrides.d.ts +2 -2
- package/dist/ui/forms/InputSelect/styles.d.ts +3 -3
- package/dist/ui/forms/InputTextArea.d.ts +2 -3
- package/dist/ui/forms/InputToggleBox.d.ts +1 -2
- package/dist/ui/forms/InputToggleListBox.d.ts +1 -2
- package/dist/ui/forms/InputWrapper.d.ts +2 -2
- package/dist/ui/forms/Label.d.ts +0 -1
- package/dist/ui/forms/RadioButtons.d.ts +4 -5
- package/dist/ui/forms/ToggleButtons.d.ts +5 -6
- package/dist/ui/lists/List.d.ts +3 -3
- package/dist/ui/lists/ListDetails.d.ts +1 -1
- package/dist/ui/lists/ListDetailsItem.d.ts +1 -1
- package/dist/ui/lists/ListItem.d.ts +4 -5
- package/dist/ui/resources/ResourceList/index.d.ts +5 -5
- package/dist/ui/resources/ResourceList/infiniteFetcher.d.ts +3 -3
- package/dist/ui/resources/ResourceList/reducer.d.ts +2 -2
- package/dist/ui/tables/TableData.d.ts +1 -1
- package/dist/utils/children.d.ts +1 -1
- package/package.json +22 -22
package/dist/ui/atoms/Text.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export declare type TextWrap = 'normal' | 'nowrap' | 'inherit';
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type TextVariant = 'danger' | 'success' | 'primary' | 'warning' | 'info' | 'plain';
|
|
3
|
+
export type TextSize = 'small' | 'regular' | 'large' | 'inherit';
|
|
4
|
+
export type TextWeight = 'regular' | 'medium' | 'semibold' | 'bold' | 'inherit';
|
|
5
|
+
export type TextAlignment = 'center' | 'left' | 'right' | 'inherit';
|
|
6
|
+
export type TextWrap = 'normal' | 'nowrap' | 'inherit';
|
|
8
7
|
export interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
9
8
|
children?: ReactNode;
|
|
10
9
|
variant?: TextVariant;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { PageHeadingProps } from '../atoms/PageHeading';
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type PageHeadingProps } from '../atoms/PageHeading';
|
|
3
3
|
export interface PageLayoutProps extends Pick<PageHeadingProps, 'title' | 'description' | 'onGoBack' | 'actionButton' | 'gap'> {
|
|
4
4
|
/**
|
|
5
5
|
* Page content
|
package/dist/ui/forms/Input.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { InputWrapperBaseProps } from '../forms/InputWrapper';
|
|
1
|
+
import { type InputWrapperBaseProps } from '../forms/InputWrapper';
|
|
3
2
|
export interface InputProps extends InputWrapperBaseProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
4
3
|
/**
|
|
5
4
|
* controlled type
|
|
@@ -10,5 +9,5 @@ export interface InputProps extends InputWrapperBaseProps, Omit<React.InputHTMLA
|
|
|
10
9
|
*/
|
|
11
10
|
className?: string;
|
|
12
11
|
}
|
|
13
|
-
declare const Input:
|
|
12
|
+
declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
14
13
|
export { Input };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { type InputWrapperBaseProps } from '../forms/InputWrapper';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
4
3
|
export interface InputCheckboxProps extends Omit<InputWrapperBaseProps, 'label'>, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value'> {
|
|
5
4
|
/**
|
|
6
5
|
* Icon component
|
|
@@ -9,5 +8,5 @@ export interface InputCheckboxProps extends Omit<InputWrapperBaseProps, 'label'>
|
|
|
9
8
|
icon?: JSX.Element;
|
|
10
9
|
children: ReactNode;
|
|
11
10
|
}
|
|
12
|
-
declare const InputCheckbox:
|
|
11
|
+
declare const InputCheckbox: import("react").ForwardRefExoticComponent<InputCheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
13
12
|
export { InputCheckbox };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import DatePicker from 'react-datepicker';
|
|
3
|
-
import { InputWrapperBaseProps } from '../../forms/InputWrapper';
|
|
4
|
-
export
|
|
2
|
+
import { type InputWrapperBaseProps } from '../../forms/InputWrapper';
|
|
3
|
+
export type MaybeDate = Date | null;
|
|
5
4
|
export interface InputDateProps extends InputWrapperBaseProps {
|
|
6
5
|
/**
|
|
7
6
|
* controlled value
|
|
@@ -41,5 +40,5 @@ export interface InputDateProps extends InputWrapperBaseProps {
|
|
|
41
40
|
*/
|
|
42
41
|
isClearable?: boolean;
|
|
43
42
|
}
|
|
44
|
-
declare const InputDateComponent:
|
|
43
|
+
declare const InputDateComponent: import("react").ForwardRefExoticComponent<InputDateProps & import("react").RefAttributes<DatePicker<never, undefined>>>;
|
|
45
44
|
export { InputDateComponent };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import DatePicker
|
|
4
|
-
declare const InputDate: React.ForwardRefExoticComponent<InputDateProps & React.RefAttributes<DatePicker<never, undefined>>>;
|
|
1
|
+
import { type InputDateProps } from './InputDateComponent';
|
|
2
|
+
import type DatePicker from 'react-datepicker';
|
|
3
|
+
declare const InputDate: import("react").ForwardRefExoticComponent<InputDateProps & import("react").RefAttributes<DatePicker<never, undefined>>>;
|
|
5
4
|
export { InputDate };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { InputWrapperBaseProps } from '../forms/InputWrapper';
|
|
1
|
+
import { type InputDateProps, type MaybeDate } from './InputDate/InputDateComponent';
|
|
2
|
+
import { type InputWrapperBaseProps } from '../forms/InputWrapper';
|
|
4
3
|
export interface InputDateRangeProps extends Pick<InputDateProps, 'isClearable' | 'format' | 'autoPlaceholder'>, InputWrapperBaseProps {
|
|
5
4
|
/**
|
|
6
5
|
* a tuple that represents the [from, to] dates
|
|
@@ -19,5 +18,5 @@ export interface InputDateRangeProps extends Pick<InputDateProps, 'isClearable'
|
|
|
19
18
|
*/
|
|
20
19
|
toPlaceholder?: string;
|
|
21
20
|
}
|
|
22
|
-
declare const InputDateRange:
|
|
21
|
+
declare const InputDateRange: import("react").ForwardRefExoticComponent<InputDateRangeProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
23
22
|
export { InputDateRange };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { InputWrapperBaseProps } from '../forms/InputWrapper';
|
|
1
|
+
import { type InputWrapperBaseProps } from '../forms/InputWrapper';
|
|
3
2
|
interface InputFileProps extends InputWrapperBaseProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
4
3
|
/**
|
|
5
4
|
* If defined, it shows a progress bar at the bottom. It must be between 0 and 100.
|
|
6
5
|
*/
|
|
7
6
|
progress?: number;
|
|
8
7
|
}
|
|
9
|
-
declare const InputFile:
|
|
8
|
+
declare const InputFile: import("react").ForwardRefExoticComponent<InputFileProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
10
9
|
export { InputFile };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { InputSelectProps, SelectValue } from './';
|
|
2
|
-
import { StylesConfig } from 'react-select';
|
|
3
|
-
import { SetRequired } from 'type-fest';
|
|
1
|
+
import { type InputSelectProps, type SelectValue } from './';
|
|
2
|
+
import { type StylesConfig } from 'react-select';
|
|
3
|
+
import { type SetRequired } from 'type-fest';
|
|
4
4
|
interface AsyncSelectComponentProps extends Omit<SetRequired<InputSelectProps, 'loadAsyncValues'>, 'label' | 'hint'> {
|
|
5
5
|
styles: StylesConfig<SelectValue>;
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InputSelectProps, SelectValue } from './';
|
|
2
|
-
import { StylesConfig } from 'react-select';
|
|
1
|
+
import { type InputSelectProps, type SelectValue } from './';
|
|
2
|
+
import { type StylesConfig } from 'react-select';
|
|
3
3
|
interface SelectComponentProps extends Omit<InputSelectProps, 'loadAsyncValues' | 'label' | 'hint'> {
|
|
4
4
|
styles: StylesConfig<SelectValue>;
|
|
5
5
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FocusEventHandler } from 'react';
|
|
2
|
-
import { MultiValue, SingleValue } from 'react-select';
|
|
3
|
-
import { InputWrapperBaseProps } from '../../forms/InputWrapper';
|
|
4
|
-
export
|
|
1
|
+
import { type FocusEventHandler } from 'react';
|
|
2
|
+
import { type MultiValue, type SingleValue } from 'react-select';
|
|
3
|
+
import { type InputWrapperBaseProps } from '../../forms/InputWrapper';
|
|
4
|
+
export type GroupedSelectValues = Array<{
|
|
5
5
|
label: string;
|
|
6
6
|
options: SelectValue[];
|
|
7
7
|
}>;
|
|
@@ -10,7 +10,7 @@ export interface SelectValue {
|
|
|
10
10
|
label: string;
|
|
11
11
|
meta?: Record<string, any>;
|
|
12
12
|
}
|
|
13
|
-
export
|
|
13
|
+
export type PossibleSelectValue = MultiValue<SelectValue> | SingleValue<SelectValue>;
|
|
14
14
|
export interface InputSelectProps extends InputWrapperBaseProps {
|
|
15
15
|
initialValues: GroupedSelectValues | SelectValue[];
|
|
16
16
|
defaultValue?: SelectValue | SelectValue[];
|
|
@@ -39,10 +39,14 @@ declare namespace InputSelect {
|
|
|
39
39
|
* @returns true if selected value is single, from this point TypeScript will treat this as `SelectValue` type
|
|
40
40
|
*/
|
|
41
41
|
export declare function isSingleValueSelected(selectedValue: PossibleSelectValue): selectedValue is SelectValue;
|
|
42
|
+
/**
|
|
43
|
+
* Type-guard to check if prop `initialValues` is a GroupedSelectValues or SelectValue
|
|
44
|
+
*/
|
|
45
|
+
export declare function isGroupedSelectValues(initialValues?: GroupedSelectValues | SelectValue[]): initialValues is GroupedSelectValues;
|
|
42
46
|
/**
|
|
43
47
|
* Helper function to extract only a specific property from the `SelectValue`
|
|
44
48
|
* @param selectedValue possible value returned from select component
|
|
45
|
-
* @param
|
|
49
|
+
* @param pathToValue optional path.to.property. Default is `value`
|
|
46
50
|
* @returns a string or an array of strings.
|
|
47
51
|
* Examples:
|
|
48
52
|
* ```
|
|
@@ -57,4 +61,17 @@ export declare function isSingleValueSelected(selectedValue: PossibleSelectValue
|
|
|
57
61
|
* ```
|
|
58
62
|
*/
|
|
59
63
|
export declare function flatSelectValues(selectedValue: PossibleSelectValue, pathToValue?: string): null | string | Array<string | number>;
|
|
64
|
+
/**
|
|
65
|
+
* To be used when storing the flatten value and there is the need
|
|
66
|
+
* to retrieve the `defaultValue` to pass as <InputSelect> prop
|
|
67
|
+
* @param currentValue the current value that is being stored in app state
|
|
68
|
+
* @param initialValues the array of SelectValue objects that should contain the `currentValue`
|
|
69
|
+
* @param pathToValue optional path.to.property. Default is `value`
|
|
70
|
+
* @returns the matched value or values, otherwise undefined.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getDefaultValueFromFlatten({ currentValue, initialValues, pathToValue }: {
|
|
73
|
+
currentValue?: string | Array<string | number> | null;
|
|
74
|
+
initialValues?: GroupedSelectValues | SelectValue[];
|
|
75
|
+
pathToValue?: string;
|
|
76
|
+
}): SelectValue | SelectValue[] | undefined;
|
|
60
77
|
export { InputSelect };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DropdownIndicatorProps, ClearIndicatorProps } from 'react-select';
|
|
2
|
-
import { SelectValue } from '.';
|
|
1
|
+
import { type DropdownIndicatorProps, type ClearIndicatorProps } from 'react-select';
|
|
2
|
+
import { type SelectValue } from '.';
|
|
3
3
|
declare function DropdownIndicator(props: DropdownIndicatorProps<SelectValue>): JSX.Element;
|
|
4
4
|
declare function ClearIndicator(props: ClearIndicatorProps<SelectValue>): JSX.Element;
|
|
5
5
|
declare const selectComponentOverrides: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StylesConfig } from 'react-select';
|
|
2
|
-
import { SelectValue } from '.';
|
|
3
|
-
import { InputFeedbackProps } from '../../forms/InputFeedback';
|
|
1
|
+
import { type StylesConfig } from 'react-select';
|
|
2
|
+
import { type SelectValue } from '.';
|
|
3
|
+
import { type InputFeedbackProps } from '../../forms/InputFeedback';
|
|
4
4
|
export declare const getSelectStyles: (feedbackVariant?: InputFeedbackProps['variant']) => StylesConfig<SelectValue>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { InputWrapperBaseProps } from '../forms/InputWrapper';
|
|
1
|
+
import { type InputWrapperBaseProps } from '../forms/InputWrapper';
|
|
3
2
|
interface InputTextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement>, InputWrapperBaseProps {
|
|
4
3
|
}
|
|
5
|
-
declare const InputTextArea:
|
|
4
|
+
declare const InputTextArea: import("react").ForwardRefExoticComponent<InputTextAreaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
6
5
|
export { InputTextArea };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
export interface InputToggleBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value'> {
|
|
3
2
|
id: string;
|
|
4
3
|
label: string;
|
|
5
4
|
description?: React.ReactNode;
|
|
6
5
|
className?: string;
|
|
7
6
|
}
|
|
8
|
-
declare const InputToggleBox:
|
|
7
|
+
declare const InputToggleBox: import("react").ForwardRefExoticComponent<InputToggleBoxProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
9
8
|
export { InputToggleBox };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
export interface InputToggleListBoxOption {
|
|
3
2
|
value: string;
|
|
4
3
|
label: string;
|
|
@@ -11,5 +10,5 @@ export interface InputToggleListBoxProps extends Omit<React.SelectHTMLAttributes
|
|
|
11
10
|
options: InputToggleListBoxOption[];
|
|
12
11
|
className?: string;
|
|
13
12
|
}
|
|
14
|
-
declare const InputToggleListBox:
|
|
13
|
+
declare const InputToggleListBox: import("react").ForwardRefExoticComponent<InputToggleListBoxProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
15
14
|
export { InputToggleListBox };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HintProps } from '../atoms/Hint';
|
|
2
|
-
import { InputFeedbackProps } from '../forms/InputFeedback';
|
|
1
|
+
import { type HintProps } from '../atoms/Hint';
|
|
2
|
+
import { type InputFeedbackProps } from '../forms/InputFeedback';
|
|
3
3
|
export interface InputWrapperBaseProps {
|
|
4
4
|
/**
|
|
5
5
|
* optional input label
|
package/dist/ui/forms/Label.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare type RadioOptionValue = string | number | boolean;
|
|
1
|
+
import { type InputHTMLAttributes } from 'react';
|
|
2
|
+
import { type InputWrapperBaseProps } from '../forms/InputWrapper';
|
|
3
|
+
export type RadioOptionValue = string | number | boolean;
|
|
5
4
|
export interface RadioOption {
|
|
6
5
|
value: RadioOptionValue;
|
|
7
6
|
label: string;
|
|
@@ -14,5 +13,5 @@ export interface RadioButtonsProps extends InputWrapperBaseProps {
|
|
|
14
13
|
className?: string;
|
|
15
14
|
onBlur?: InputHTMLAttributes<HTMLInputElement>['onBlur'];
|
|
16
15
|
}
|
|
17
|
-
declare const RadioButtons:
|
|
16
|
+
declare const RadioButtons: import("react").ForwardRefExoticComponent<RadioButtonsProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
18
17
|
export { RadioButtons };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare type ToggleButtonValue = string | boolean | number;
|
|
1
|
+
import { type InputWrapperBaseProps } from '../forms/InputWrapper';
|
|
2
|
+
import { type Simplify } from 'type-fest';
|
|
3
|
+
export type ToggleButtonValue = string | boolean | number;
|
|
5
4
|
export interface ToggleButtonOption {
|
|
6
5
|
label: string;
|
|
7
6
|
value: ToggleButtonValue;
|
|
@@ -13,14 +12,14 @@ interface BaseProps extends InputWrapperBaseProps, Omit<React.HTMLAttributes<HTM
|
|
|
13
12
|
interface SingleValueProps {
|
|
14
13
|
mode: 'single';
|
|
15
14
|
value?: ToggleButtonValue;
|
|
16
|
-
onChange: (value
|
|
15
|
+
onChange: (value?: ToggleButtonValue) => void;
|
|
17
16
|
}
|
|
18
17
|
interface MultiValuesProps {
|
|
19
18
|
mode: 'multi';
|
|
20
19
|
value?: ToggleButtonValue[];
|
|
21
20
|
onChange: (values: ToggleButtonValue[]) => void;
|
|
22
21
|
}
|
|
23
|
-
export
|
|
22
|
+
export type ToggleButtonsProps = Simplify<BaseProps & (SingleValueProps | MultiValuesProps)>;
|
|
24
23
|
declare function ToggleButtons({ options, value, mode, onChange, label, hint, feedback, ...rest }: ToggleButtonsProps): JSX.Element;
|
|
25
24
|
declare namespace ToggleButtons {
|
|
26
25
|
var displayName: string;
|
package/dist/ui/lists/List.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PaginationProps } from '../atoms/Pagination';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
export
|
|
1
|
+
import { type PaginationProps } from '../atoms/Pagination';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
export type ListPagination = {
|
|
4
4
|
recordsPerPage: number;
|
|
5
5
|
recordCount: number;
|
|
6
6
|
} & Omit<PaginationProps, 'className' | 'isDisabled'>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
declare type Props = Pick<FlexRowProps, 'alignItems' | 'children'> & {
|
|
1
|
+
import { type FlexRowProps } from '../atoms/FlexRow';
|
|
2
|
+
import { type FC } from 'react';
|
|
3
|
+
type Props = Pick<FlexRowProps, 'alignItems' | 'children'> & {
|
|
5
4
|
/**
|
|
6
5
|
* Icon component
|
|
7
6
|
* Example: `<Icon>` or `<RadialProgress>` or `<Avatar>`
|
|
@@ -16,7 +15,7 @@ declare type Props = Pick<FlexRowProps, 'alignItems' | 'children'> & {
|
|
|
16
15
|
*/
|
|
17
16
|
borderStyle?: 'dashed' | 'solid';
|
|
18
17
|
};
|
|
19
|
-
export
|
|
18
|
+
export type ListItemProps = Props & (({
|
|
20
19
|
/**
|
|
21
20
|
* HTML tag to render
|
|
22
21
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
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';
|
|
1
|
+
import { type EmptyStateProps } from '../../atoms/EmptyState';
|
|
2
|
+
import { type LegendProps } from '../../atoms/Legend';
|
|
3
|
+
import { type CommerceLayerClient, type QueryParamsList } from '@commercelayer/sdk';
|
|
4
|
+
import { type FC } from 'react';
|
|
5
|
+
import { type ListableResource, type Resource } from './infiniteFetcher';
|
|
6
6
|
export interface ResourceListProps<TResource extends ListableResource> extends Pick<LegendProps, 'title' | 'actionButton'> {
|
|
7
7
|
type: TResource;
|
|
8
8
|
query?: Omit<QueryParamsList, 'pageNumber'>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CommerceLayerClient, QueryParamsList } from '@commercelayer/sdk';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export
|
|
2
|
+
export type ListableResource = Exclude<keyof CommerceLayerClient, 'addRawResponseReader' | 'addRawResponseReader' | 'addRequestInterceptor' | 'addResponseInterceptor' | 'application' | 'config' | 'currentOrganization' | 'isApiError' | 'openApiSchemaVersion' | 'organization' | 'removeInterceptor' | 'removeRawResponseReader' | 'resources'>;
|
|
3
|
+
type ListResource<TResource extends ListableResource> = Awaited<ReturnType<CommerceLayerClient[TResource]['list']>>;
|
|
4
|
+
export type Resource<TResource extends ListableResource> = ListResource<TResource>[number];
|
|
5
5
|
export interface FetcherResponse<TResource> {
|
|
6
6
|
list: TResource[];
|
|
7
7
|
meta: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FetcherResponse, Resource, ListableResource } from './infiniteFetcher';
|
|
1
|
+
import { type FetcherResponse, type Resource, type ListableResource } from './infiniteFetcher';
|
|
2
2
|
interface ResourceListInternalState<TResource extends ListableResource> {
|
|
3
3
|
isLoading: boolean;
|
|
4
4
|
error?: {
|
|
@@ -7,7 +7,7 @@ interface ResourceListInternalState<TResource extends ListableResource> {
|
|
|
7
7
|
data?: FetcherResponse<Resource<TResource>> | undefined;
|
|
8
8
|
}
|
|
9
9
|
export declare const initialState: ResourceListInternalState<any>;
|
|
10
|
-
|
|
10
|
+
type Action<TResource extends ListableResource> = {
|
|
11
11
|
type: 'prepare';
|
|
12
12
|
} | {
|
|
13
13
|
type: 'loaded';
|
package/dist/utils/children.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercelayer/app-elements",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -20,44 +20,44 @@
|
|
|
20
20
|
"pnpm": ">=7"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@commercelayer/sdk": "
|
|
24
|
-
"@types/lodash": "^4.14.
|
|
25
|
-
"@types/react": "^18.0.
|
|
26
|
-
"@types/react-datepicker": "^4.
|
|
27
|
-
"@types/react-dom": "^18.0.
|
|
23
|
+
"@commercelayer/sdk": "5.0.0",
|
|
24
|
+
"@types/lodash": "^4.14.192",
|
|
25
|
+
"@types/react": "^18.0.33",
|
|
26
|
+
"@types/react-datepicker": "^4.10.0",
|
|
27
|
+
"@types/react-dom": "^18.0.11",
|
|
28
28
|
"classnames": "^2.3.2",
|
|
29
29
|
"jwt-decode": "^3.1.2",
|
|
30
30
|
"lodash": "^4.17.21",
|
|
31
31
|
"react": "^18.2.0",
|
|
32
|
-
"react-datepicker": "^4.
|
|
32
|
+
"react-datepicker": "^4.11.0",
|
|
33
33
|
"react-dom": "^18.2.0",
|
|
34
|
-
"react-select": "^5.7.
|
|
34
|
+
"react-select": "^5.7.2",
|
|
35
35
|
"ts-invariant": "^0.10.3",
|
|
36
|
-
"type-fest": "^3.
|
|
36
|
+
"type-fest": "^3.7.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@commercelayer/eslint-config-ts-react": "^0.
|
|
39
|
+
"@commercelayer/eslint-config-ts-react": "^1.0.0",
|
|
40
40
|
"@tailwindcss/forms": "^0.5.3",
|
|
41
41
|
"@testing-library/jest-dom": "^5.16.5",
|
|
42
42
|
"@testing-library/react": "^13.4.0",
|
|
43
|
-
"@types/node": "^18.11
|
|
43
|
+
"@types/node": "^18.15.11",
|
|
44
44
|
"@types/testing-library__jest-dom": "^5.14.5",
|
|
45
|
-
"@vitejs/plugin-react": "^3.
|
|
46
|
-
"autoprefixer": "^10.4.
|
|
45
|
+
"@vitejs/plugin-react": "^3.1.0",
|
|
46
|
+
"autoprefixer": "^10.4.14",
|
|
47
47
|
"cross-fetch": "^3.1.5",
|
|
48
48
|
"date-fns": "^2.29.3",
|
|
49
49
|
"date-fns-tz": "^2.0.0",
|
|
50
|
-
"eslint": "^8.
|
|
51
|
-
"jsdom": "^
|
|
52
|
-
"msw": "^1.
|
|
50
|
+
"eslint": "^8.37.0",
|
|
51
|
+
"jsdom": "^21.1.1",
|
|
52
|
+
"msw": "^1.2.1",
|
|
53
53
|
"phosphor-react": "^1.4.1",
|
|
54
54
|
"polished": "^4.2.2",
|
|
55
|
-
"postcss": "^8.4.
|
|
56
|
-
"tailwindcss": "^3.
|
|
57
|
-
"typescript": "^
|
|
58
|
-
"vite": "^4.
|
|
59
|
-
"vite-plugin-dts": "^
|
|
60
|
-
"vitest": "^0.
|
|
55
|
+
"postcss": "^8.4.21",
|
|
56
|
+
"tailwindcss": "^3.3.1",
|
|
57
|
+
"typescript": "^5.0.3",
|
|
58
|
+
"vite": "^4.2.1",
|
|
59
|
+
"vite-plugin-dts": "^2.2.0",
|
|
60
|
+
"vitest": "^0.29.8"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@commercelayer/sdk": "^4.x"
|