@commercelayer/app-elements 0.0.78 → 0.0.80
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-163e6f77.js → Async-a8cbdb5b.js} +5 -3
- package/dist/{InputDateComponent-6853e317.js → InputDateComponent-a8c34dc1.js} +4 -2
- package/dist/{Select-a7b98c9a.js → Select-e581ae99.js} +5 -3
- package/dist/helpers/appsNavigation.d.ts +1 -0
- package/dist/hooks/useOverlay.d.ts +36 -0
- package/dist/{main-740e7f02.js → main-dd440dc6.js} +11748 -10189
- package/dist/main.d.ts +19 -2
- package/dist/main.js +150 -127
- package/dist/{overrides-f9354b78.js → overrides-0673bab0.js} +618 -621
- package/dist/providers/TokenProvider/MockTokenProvider.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/ui/atoms/A.d.ts +1 -0
- package/dist/ui/atoms/Avatar.d.ts +1 -0
- package/dist/ui/atoms/AvatarLetter.d.ts +1 -0
- package/dist/ui/atoms/BlockCode.d.ts +1 -0
- package/dist/ui/atoms/ButtonFilter.d.ts +1 -0
- package/dist/ui/atoms/Card.d.ts +2 -0
- package/dist/ui/atoms/Container.d.ts +1 -0
- package/dist/ui/atoms/CopyToClipboard.d.ts +1 -0
- package/dist/ui/atoms/Hr.d.ts +1 -0
- package/dist/ui/atoms/Icon.d.ts +1 -0
- package/dist/ui/atoms/Pagination.d.ts +1 -0
- package/dist/ui/atoms/Progress.d.ts +1 -0
- package/dist/ui/atoms/StatusDot.d.ts +1 -0
- package/dist/ui/atoms/Steps.d.ts +1 -0
- package/dist/ui/atoms/dropdown/DropdownMenu.d.ts +1 -0
- package/dist/ui/atoms/dropdown/DropdownMenuDivider.d.ts +1 -0
- package/dist/ui/atoms/dropdown/DropdownMenuItem.d.ts +1 -0
- package/dist/ui/atoms/tables/Td.d.ts +1 -0
- package/dist/ui/atoms/tables/Th.d.ts +1 -0
- package/dist/ui/atoms/tables/Tr.d.ts +1 -0
- package/dist/ui/composite/ContextMenu.d.ts +1 -0
- package/dist/ui/composite/PageError.d.ts +1 -0
- package/dist/ui/composite/PageSkeleton.d.ts +1 -0
- package/dist/ui/composite/SearchBar.d.ts +1 -0
- package/dist/ui/forms/Input.d.ts +1 -0
- package/dist/ui/forms/InputCheckbox.d.ts +1 -0
- package/dist/ui/forms/InputCurrency/index.d.ts +1 -0
- package/dist/ui/forms/InputCurrencyRange.d.ts +1 -0
- package/dist/ui/forms/InputDate/InputDateComponent.d.ts +1 -0
- package/dist/ui/forms/InputDate/index.d.ts +1 -0
- package/dist/ui/forms/InputDateRange.d.ts +1 -0
- package/dist/ui/forms/InputFeedback.d.ts +1 -0
- package/dist/ui/forms/InputFile.d.ts +1 -0
- package/dist/ui/forms/InputJson.d.ts +1 -0
- package/dist/ui/forms/InputReadonly.d.ts +1 -0
- package/dist/ui/forms/InputSelect/Async.d.ts +1 -0
- package/dist/ui/forms/InputSelect/Select.d.ts +1 -0
- package/dist/ui/forms/InputSelect/overrides.d.ts +1 -0
- package/dist/ui/forms/InputSpinner.d.ts +1 -0
- package/dist/ui/forms/InputTextArea.d.ts +1 -0
- package/dist/ui/forms/InputToggleBox.d.ts +1 -0
- package/dist/ui/forms/InputToggleListBox.d.ts +1 -0
- package/dist/ui/forms/Label.d.ts +1 -0
- package/dist/ui/forms/ToggleButtons.d.ts +1 -0
- package/dist/ui/hook-form/HookedForm.d.ts +34 -0
- package/dist/ui/hook-form/HookedInput.d.ts +17 -0
- package/dist/ui/hook-form/HookedInputCheckbox.d.ts +17 -0
- package/dist/ui/hook-form/HookedInputCurrency.d.ts +18 -0
- package/dist/ui/hook-form/HookedInputDate.d.ts +18 -0
- package/dist/ui/hook-form/HookedInputDateRange.d.ts +19 -0
- package/dist/ui/hook-form/HookedInputMetadata.d.ts +19 -0
- package/dist/ui/hook-form/HookedInputSelect.d.ts +34 -0
- package/dist/ui/hook-form/HookedInputSpinner.d.ts +17 -0
- package/dist/ui/hook-form/HookedInputToggleBox.d.ts +21 -0
- package/dist/ui/hook-form/HookedInputToggleListBox.d.ts +21 -0
- package/dist/ui/hook-form/HookedRelationshipSelector.d.ts +18 -0
- package/dist/ui/hook-form/HookedToggleButtons.d.ts +18 -0
- package/dist/ui/hook-form/HookedValidationApiError.d.ts +22 -0
- package/dist/ui/hook-form/HookedValidationError.d.ts +12 -0
- package/dist/ui/hook-form/setApiFormErrors.d.ts +19 -0
- package/dist/ui/hook-form/setApiFormErrors.test.d.ts +1 -0
- package/dist/ui/hook-form/useValidationFeedback.d.ts +4 -0
- package/dist/ui/internals/InputWrapper.d.ts +1 -0
- package/dist/ui/resources/Filters/FieldCurrencyRange.d.ts +7 -0
- package/dist/ui/resources/Filters/FieldItem.d.ts +7 -0
- package/dist/ui/resources/Filters/FieldTimeRange.d.ts +7 -0
- package/dist/ui/resources/Filters/FiltersForm.d.ts +17 -0
- package/dist/ui/resources/Filters/FiltersNav.d.ts +25 -0
- package/dist/ui/resources/Filters/FiltersSearchBar.d.ts +28 -0
- package/dist/ui/resources/Filters/adaptFormValuesToSdk.d.ts +19 -0
- package/dist/ui/resources/Filters/adaptFormValuesToSdk.test.d.ts +1 -0
- package/dist/ui/resources/Filters/adaptFormValuesToUrlQuery.d.ts +11 -0
- package/dist/ui/resources/Filters/adaptFormValuesToUrlQuery.test.d.ts +1 -0
- package/dist/ui/resources/Filters/adaptUrlQueryToFormValues.d.ts +11 -0
- package/dist/ui/resources/Filters/adaptUrlQueryToFormValues.test.d.ts +1 -0
- package/dist/ui/resources/Filters/adaptUrlQueryToSdk.d.ts +14 -0
- package/dist/ui/resources/Filters/adaptUrlQueryToSdk.test.d.ts +1 -0
- package/dist/ui/resources/Filters/adaptUrlQueryToUrlQuery.d.ts +11 -0
- package/dist/ui/resources/Filters/adaptUrlQueryToUrlQuery.test.d.ts +1 -0
- package/dist/ui/resources/Filters/adapters.d.ts +2 -0
- package/dist/ui/resources/Filters/adapters.types.d.ts +20 -0
- package/dist/ui/resources/Filters/index.d.ts +5 -0
- package/dist/ui/resources/Filters/mockedInstructions.d.ts +2 -0
- package/dist/ui/resources/Filters/timeUtils.d.ts +36 -0
- package/dist/ui/resources/Filters/timeUtils.test.d.ts +1 -0
- package/dist/ui/resources/Filters/types.d.ts +130 -0
- package/dist/ui/resources/Filters/useFilters.d.ts +59 -0
- package/dist/ui/resources/Filters/utils.d.ts +29 -0
- package/dist/ui/resources/Filters/utils.test.d.ts +1 -0
- package/dist/ui/resources/OrderSummary.d.ts +1 -0
- package/dist/ui/resources/RelationshipSelector/Checkbox.d.ts +1 -0
- package/dist/ui/resources/RelationshipSelector/FullList.d.ts +1 -0
- package/dist/ui/resources/RelationshipSelector/index.d.ts +1 -0
- package/dist/ui/resources/ResourceList/utils.d.ts +1 -0
- package/dist/ui/tables/TableData.d.ts +1 -0
- package/dist/{unsupportedIterableToArray-1a2db0a9.js → unsupportedIterableToArray-0f93b40f.js} +1 -1
- package/dist/utils/htmltags.d.ts +1 -0
- package/package.json +8 -1
- package/dist/hooks/useOverlayNavigation.d.ts +0 -26
- package/dist/ui/atoms/Overlay.d.ts +0 -20
- /package/dist/{ui/atoms/Overlay.test.d.ts → hooks/useOverlay.test.d.ts} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type InputProps } from '../forms/Input';
|
|
3
|
+
interface Props extends InputProps {
|
|
4
|
+
/**
|
|
5
|
+
* field name to match hook-form state
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* `Input` component ready to be used with the `react-hook-form` context.
|
|
11
|
+
* @see InputSelect
|
|
12
|
+
*/
|
|
13
|
+
declare function HookedInput({ name, ...props }: Props): JSX.Element;
|
|
14
|
+
declare namespace HookedInput {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
17
|
+
export { HookedInput };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type InputCheckboxProps } from '../forms/InputCheckbox';
|
|
3
|
+
interface Props extends InputCheckboxProps {
|
|
4
|
+
/**
|
|
5
|
+
* field name to match hook-form state
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* `InputCheckbox` component ready to be used with the `react-hook-form` context.
|
|
11
|
+
* @see InputCheckbox
|
|
12
|
+
*/
|
|
13
|
+
declare function HookedInputCheckbox({ name, ...props }: Props): JSX.Element;
|
|
14
|
+
declare namespace HookedInputCheckbox {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
17
|
+
export { HookedInputCheckbox };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type InputCurrencyProps } from '../forms/InputCurrency';
|
|
3
|
+
interface Props extends Omit<InputCurrencyProps, 'onChange' | 'onBlur' | 'cents'> {
|
|
4
|
+
/**
|
|
5
|
+
* field name to match hook-form state
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* `InputCurrency` component ready to be used with the `react-hook-form` context.
|
|
11
|
+
* Value is stored in form state as cents.
|
|
12
|
+
* @see InputCurrency
|
|
13
|
+
*/
|
|
14
|
+
declare function HookedInputCurrency({ name, ...props }: Props): JSX.Element;
|
|
15
|
+
declare namespace HookedInputCurrency {
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
18
|
+
export { HookedInputCurrency };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type InputDateProps } from '../forms/InputDate/InputDateComponent';
|
|
3
|
+
interface Props extends Omit<InputDateProps, 'onChange'> {
|
|
4
|
+
/**
|
|
5
|
+
* field name to match hook-form state
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* `InputDate` component ready to be used with the `react-hook-form` context.
|
|
11
|
+
* Value is stored in form state as iso date string (example: `"2023-08-01T22:00:00.000Z"` ).
|
|
12
|
+
* @see InputDate
|
|
13
|
+
*/
|
|
14
|
+
declare function HookedInputDate({ name, ...props }: Props): JSX.Element;
|
|
15
|
+
declare namespace HookedInputDate {
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
18
|
+
export { HookedInputDate };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type InputDateRangeProps } from '../forms/InputDateRange';
|
|
3
|
+
interface Props extends Omit<InputDateRangeProps, 'onChange' | 'value'> {
|
|
4
|
+
/**
|
|
5
|
+
* field name to match hook-form state
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* `InputDateRange` component ready to be used with the `react-hook-form` context.
|
|
11
|
+
* Value is stored in form state as tuple of two iso date strings
|
|
12
|
+
* (example: `["2023-08-01T22:00:00.000Z", "2023-08-14T22:00:00.000Z"]` ).
|
|
13
|
+
* @see InputDateRange
|
|
14
|
+
*/
|
|
15
|
+
declare function HookedInputDateRange({ name, ...props }: Props): JSX.Element;
|
|
16
|
+
declare namespace HookedInputDateRange {
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
19
|
+
export { HookedInputDateRange };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface Props {
|
|
3
|
+
/**
|
|
4
|
+
* field name to match hook-form state
|
|
5
|
+
*/
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `InputMetadata` component ready to be used with the `react-hook-form` context.
|
|
10
|
+
* Metadata is stored in form state as object of strings (example: `{foo: 'bar'}` )
|
|
11
|
+
* and should match the core api metadata structure. Non-string values are ignored and will not appear
|
|
12
|
+
* in the form state.
|
|
13
|
+
* @see InputMetadata
|
|
14
|
+
*/
|
|
15
|
+
declare function HookedInputMetadata({ name }: Props): JSX.Element;
|
|
16
|
+
declare namespace HookedInputMetadata {
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
19
|
+
export { HookedInputMetadata };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type InputSelectProps } from '../forms/InputSelect';
|
|
3
|
+
interface Props extends Omit<InputSelectProps, 'onSelect' | 'defaultValue'> {
|
|
4
|
+
/**
|
|
5
|
+
* field name to match hook-form state
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* Specify the path (in the `SelectValue` object) to reach the value to store in field.
|
|
10
|
+
* @default
|
|
11
|
+
* "value"
|
|
12
|
+
*
|
|
13
|
+
* Example:
|
|
14
|
+
* ```
|
|
15
|
+
* // single mode
|
|
16
|
+
* {value: 'ff0000', label: 'Red'} // set field value as 'ff0000'
|
|
17
|
+
*
|
|
18
|
+
* // multi mode
|
|
19
|
+
* [{value: 'ff0000', label: 'Red'}, {value: 'ffff00', label: 'Yellow'}]
|
|
20
|
+
* // set field value as ['ff0000', 'ffff00']
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
pathToValue?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* `InputSelect` component ready to be used with the `react-hook-form` context.
|
|
27
|
+
* Value to be stored in the field can be controlled from the `pathToValue` prop.
|
|
28
|
+
* @see InputSelect
|
|
29
|
+
*/
|
|
30
|
+
declare function HookedInputSelect({ name, pathToValue, ...props }: Props): JSX.Element;
|
|
31
|
+
declare namespace HookedInputSelect {
|
|
32
|
+
var displayName: string;
|
|
33
|
+
}
|
|
34
|
+
export { HookedInputSelect };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type InputSpinnerProps } from '../forms/InputSpinner';
|
|
3
|
+
interface Props extends Omit<InputSpinnerProps, 'onChange' | 'defaultValues'> {
|
|
4
|
+
/**
|
|
5
|
+
* field name to match hook-form state
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* `InputSpinner` component ready to be used with the `react-hook-form` context.
|
|
11
|
+
* @see InputSpinner
|
|
12
|
+
*/
|
|
13
|
+
declare function HookedInputSpinner({ name, ...props }: Props): JSX.Element;
|
|
14
|
+
declare namespace HookedInputSpinner {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
17
|
+
export { HookedInputSpinner };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type InputToggleBoxProps } from '../forms/InputToggleBox';
|
|
3
|
+
interface Props extends InputToggleBoxProps {
|
|
4
|
+
/**
|
|
5
|
+
* field name to match hook-form state
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* show validation error message underneath
|
|
10
|
+
*/
|
|
11
|
+
showValidation?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `InputToggleBox` component ready to be used with the `react-hook-form` context.
|
|
15
|
+
* @see InputToggleBox
|
|
16
|
+
*/
|
|
17
|
+
declare function HookedInputToggleBox({ name, showValidation, ...props }: Props): JSX.Element;
|
|
18
|
+
declare namespace HookedInputToggleBox {
|
|
19
|
+
var displayName: string;
|
|
20
|
+
}
|
|
21
|
+
export { HookedInputToggleBox };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type InputToggleListBoxProps } from '../forms/InputToggleListBox';
|
|
3
|
+
interface Props extends InputToggleListBoxProps {
|
|
4
|
+
/**
|
|
5
|
+
* field name to match hook-form state
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* show validation error message underneath
|
|
10
|
+
*/
|
|
11
|
+
showValidation?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `InputToggleListBox` component ready to be used with the `react-hook-form` context.
|
|
15
|
+
* @see InputToggleListBox
|
|
16
|
+
*/
|
|
17
|
+
declare function HookedInputToggleListBox({ name, showValidation, ...props }: Props): JSX.Element;
|
|
18
|
+
declare namespace HookedInputToggleListBox {
|
|
19
|
+
var displayName: string;
|
|
20
|
+
}
|
|
21
|
+
export { HookedInputToggleListBox };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type RelationshipSelectorProps } from '../resources/RelationshipSelector';
|
|
3
|
+
interface Props extends Omit<RelationshipSelectorProps, 'onChange' | 'defaultValues'> {
|
|
4
|
+
/**
|
|
5
|
+
* field name to match hook-form state
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* `RelationshipSelector` component ready to be used with the `react-hook-form` context.
|
|
11
|
+
* Since it will perform api requests to fetch list of options, it also needs to access `CoreSdkProvider` context.
|
|
12
|
+
* @see RelationshipSelector
|
|
13
|
+
*/
|
|
14
|
+
declare function HookedRelationshipSelector({ name, ...props }: Props): JSX.Element;
|
|
15
|
+
declare namespace HookedRelationshipSelector {
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
18
|
+
export { HookedRelationshipSelector };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ToggleButtonsProps } from '../forms/ToggleButtons';
|
|
3
|
+
type Props = Omit<ToggleButtonsProps, 'value' | 'onChange'> & {
|
|
4
|
+
/**
|
|
5
|
+
* field name to match hook-form state
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* `ToggleButtons` component ready to be used with the `react-hook-form` context.
|
|
11
|
+
* Stored value will be a string when used as `mode="single"` or an array of strings when `mode="multiple"`.
|
|
12
|
+
* @see ToggleButtons
|
|
13
|
+
*/
|
|
14
|
+
declare function HookedToggleButtons({ name, ...props }: Props): JSX.Element;
|
|
15
|
+
declare namespace HookedToggleButtons {
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
18
|
+
export { HookedToggleButtons };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface ValidationApiErrorProps {
|
|
3
|
+
/**
|
|
4
|
+
* An error object returned from a failed API request.
|
|
5
|
+
* We expect an object that contain an `errors` property with the Core Api error items shape.
|
|
6
|
+
*/
|
|
7
|
+
apiError: any;
|
|
8
|
+
/**
|
|
9
|
+
* Optional map of app field names to API error field names.
|
|
10
|
+
* This is useful when the API returns field names that are different from the app field names.
|
|
11
|
+
* For example, if the API returns `first_name` instead of `firstName`, you can pass `{ first_name: 'firstName' }`.
|
|
12
|
+
*
|
|
13
|
+
* Format is:
|
|
14
|
+
* ```{ apiFieldName: appFieldName }```
|
|
15
|
+
*/
|
|
16
|
+
fieldMap?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
declare function HookedValidationApiError({ apiError, fieldMap }: ValidationApiErrorProps): JSX.Element;
|
|
19
|
+
declare namespace HookedValidationApiError {
|
|
20
|
+
var displayName: string;
|
|
21
|
+
}
|
|
22
|
+
export { HookedValidationApiError };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface Props {
|
|
3
|
+
/**
|
|
4
|
+
* field name to match hook-form state
|
|
5
|
+
*/
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
declare function HookedValidationError({ name }: Props): JSX.Element | null;
|
|
9
|
+
declare namespace HookedValidationError {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
export { HookedValidationError };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type UseFormSetError } from 'react-hook-form';
|
|
2
|
+
export declare function setApiFormErrors({ apiError, setError, fieldMap, formFields }: {
|
|
3
|
+
/**
|
|
4
|
+
* Error response from API
|
|
5
|
+
*/
|
|
6
|
+
apiError: any;
|
|
7
|
+
/**
|
|
8
|
+
* setError function from react-hook-form, it comes from same useForm() context
|
|
9
|
+
*/
|
|
10
|
+
setError: UseFormSetError<any>;
|
|
11
|
+
/**
|
|
12
|
+
* list of from fields
|
|
13
|
+
*/
|
|
14
|
+
formFields: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Map of field names from API to field names in the form
|
|
17
|
+
*/
|
|
18
|
+
fieldMap?: Record<string, string>;
|
|
19
|
+
}): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type FilterItemCurrencyRange } from './types';
|
|
3
|
+
interface FieldCurrencyRangeProps {
|
|
4
|
+
item: FilterItemCurrencyRange;
|
|
5
|
+
}
|
|
6
|
+
export declare function FieldCurrencyRange({ item }: FieldCurrencyRangeProps): JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type FilterItemOptions, type FilterItemTextSearch } from './types';
|
|
3
|
+
interface FieldProps {
|
|
4
|
+
item: FilterItemOptions | FilterItemTextSearch;
|
|
5
|
+
}
|
|
6
|
+
export declare function FieldItem({ item }: FieldProps): JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FiltersInstructions } from './types';
|
|
3
|
+
export interface FiltersFormProps {
|
|
4
|
+
/**
|
|
5
|
+
* Array of instruction items to build the filters behaviors
|
|
6
|
+
*/
|
|
7
|
+
instructions: FiltersInstructions;
|
|
8
|
+
/**
|
|
9
|
+
* New queryString generated on submit to be used to navigate to the listing page
|
|
10
|
+
*/
|
|
11
|
+
onSubmit: (queryString: string) => void;
|
|
12
|
+
}
|
|
13
|
+
declare function FiltersForm({ instructions, onSubmit }: FiltersFormProps): JSX.Element;
|
|
14
|
+
declare namespace FiltersForm {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
17
|
+
export { FiltersForm };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type FiltersInstructions } from './types';
|
|
3
|
+
export interface FiltersNavProps {
|
|
4
|
+
/**
|
|
5
|
+
* Array of instruction items to build the filters behaviors
|
|
6
|
+
*/
|
|
7
|
+
instructions: FiltersInstructions;
|
|
8
|
+
/**
|
|
9
|
+
* Url query string to be parsed.
|
|
10
|
+
* It must be "reactive", so most of the time it should come for router.
|
|
11
|
+
*/
|
|
12
|
+
queryString: string;
|
|
13
|
+
/**
|
|
14
|
+
* Callback function triggered when user interacts with the filters buttons.
|
|
15
|
+
* Implemented function should update the url query string / search params,
|
|
16
|
+
* based on the new queryString received as argument.
|
|
17
|
+
*/
|
|
18
|
+
onUpdate: (newQueryString: string) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Callback function triggered when user clicks on the "Edit filters" button.
|
|
21
|
+
* Implemented function should open the filters form.
|
|
22
|
+
*/
|
|
23
|
+
onFilterClick: (queryString: string, filterPredicate?: string) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare function FiltersNav({ instructions, onFilterClick: onBtnLabelClick, onUpdate, queryString }: FiltersNavProps): JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type FiltersInstructions } from './types';
|
|
3
|
+
export interface FilterSearchBarProps {
|
|
4
|
+
/**
|
|
5
|
+
* Array of instruction items to build the filters behaviors
|
|
6
|
+
*/
|
|
7
|
+
instructions: FiltersInstructions;
|
|
8
|
+
/**
|
|
9
|
+
* Callback function triggered when user interacts with the search input.
|
|
10
|
+
* Implemented function should update the url query string / search params,
|
|
11
|
+
* based on the new queryString received as argument.
|
|
12
|
+
*/
|
|
13
|
+
onUpdate: (queryString: string) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Url query string to be parsed.
|
|
16
|
+
* It must be "reactive", so most of the time it should come for router.
|
|
17
|
+
*/
|
|
18
|
+
queryString: string;
|
|
19
|
+
/**
|
|
20
|
+
* Input placeholder
|
|
21
|
+
*/
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
}
|
|
24
|
+
declare function FiltersSearchBar({ instructions, placeholder, onUpdate, queryString }: FilterSearchBarProps): JSX.Element;
|
|
25
|
+
declare namespace FiltersSearchBar {
|
|
26
|
+
var displayName: string;
|
|
27
|
+
}
|
|
28
|
+
export { FiltersSearchBar };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type QueryFilter } from '@commercelayer/sdk/lib/cjs/query';
|
|
2
|
+
import { type CurrencyRangeFieldValue, type FiltersInstructions, type UiFilterName, type UiFilterValue } from './types';
|
|
3
|
+
export interface AdaptFormValuesToSdkParams<FilterFormValues> {
|
|
4
|
+
formValues: FilterFormValues;
|
|
5
|
+
timezone?: string;
|
|
6
|
+
instructions: FiltersInstructions;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Covert FilterFormValues in SDK filter object
|
|
10
|
+
* @param formValues a valid FilterFormValues object
|
|
11
|
+
* @returns an object of type QueryFilter to be used in the SDK stripping out empty or undefined values
|
|
12
|
+
*/
|
|
13
|
+
export declare function adaptFormValuesToSdk<FilterFormValues extends Record<UiFilterName, UiFilterValue | CurrencyRangeFieldValue>>({ formValues, instructions, timezone }: AdaptFormValuesToSdkParams<FilterFormValues>): QueryFilter;
|
|
14
|
+
export declare function extractEnforcedValues(instructions: FiltersInstructions): QueryFilter;
|
|
15
|
+
/**
|
|
16
|
+
* Be sure to have all the default values
|
|
17
|
+
* to prevent listing draft or pending orders
|
|
18
|
+
*/
|
|
19
|
+
export declare function enforceDefaultFiltersWhenEmpty(filters: QueryFilter, enforcedValues: QueryFilter): QueryFilter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FiltersInstructions, type FormFullValues } from './types';
|
|
2
|
+
export interface AdaptFormValuesToUrlQueryParams<FilterFormValues extends FormFullValues> {
|
|
3
|
+
formValues: FilterFormValues;
|
|
4
|
+
instructions: FiltersInstructions;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Covert FilterFormValues in url query string
|
|
8
|
+
* @param formValues a valid FilterFormValues object
|
|
9
|
+
* @returns a string ready to be used in URL
|
|
10
|
+
*/
|
|
11
|
+
export declare function adaptFormValuesToUrlQuery<FilterFormValues extends FormFullValues>({ formValues, instructions }: AdaptFormValuesToUrlQueryParams<FilterFormValues>): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FiltersInstructions, type FormFullValues, type UiFilterName, type UiFilterValue } from './types';
|
|
2
|
+
export interface AdaptUrlQueryToFormValuesParams {
|
|
3
|
+
queryString: string;
|
|
4
|
+
instructions: FiltersInstructions;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Covert query string in filters form values
|
|
8
|
+
* @param qs url query string
|
|
9
|
+
* @returns an object containing FilterFormValues
|
|
10
|
+
*/
|
|
11
|
+
export declare function adaptUrlQueryToFormValues<FilterFormValues extends Record<UiFilterName, UiFilterValue>>({ queryString, instructions }: AdaptUrlQueryToFormValuesParams): FilterFormValues & FormFullValues;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type QueryFilter } from '@commercelayer/sdk/lib/cjs/query';
|
|
2
|
+
import { type FiltersInstructions } from './types';
|
|
3
|
+
export interface AdaptUrlQueryToSdkParams {
|
|
4
|
+
queryString: string;
|
|
5
|
+
instructions: FiltersInstructions;
|
|
6
|
+
timezone?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Covert URL query string in SDK filter object
|
|
10
|
+
* @param qs url query string
|
|
11
|
+
* @returns an object of type QueryFilter to be used in the SDK
|
|
12
|
+
* stripping out empty or undefined values and enforcing default status_in when empty
|
|
13
|
+
*/
|
|
14
|
+
export declare function adaptUrlQueryToSdk({ queryString, instructions, timezone }: AdaptUrlQueryToSdkParams): QueryFilter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FiltersInstructions } from './types';
|
|
2
|
+
export interface AdaptUrlQueryToUrlQueryParams {
|
|
3
|
+
queryString: string;
|
|
4
|
+
instructions: FiltersInstructions;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Parse current URL query string to return a new query string that contains only valid form values
|
|
8
|
+
* @param qs url query string
|
|
9
|
+
* @returns an object of type QueryFilter to be used in the SDK stripping out empty or undefined values
|
|
10
|
+
*/
|
|
11
|
+
export declare function adaptUrlQueryToUrlQuery({ queryString, instructions }: AdaptUrlQueryToUrlQueryParams): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type QueryFilter } from '@commercelayer/sdk/lib/cjs/query';
|
|
2
|
+
import { type AdaptFormValuesToSdkParams } from './adaptFormValuesToSdk';
|
|
3
|
+
import { type AdaptFormValuesToUrlQueryParams } from './adaptFormValuesToUrlQuery';
|
|
4
|
+
import { type AdaptUrlQueryToFormValuesParams } from './adaptUrlQueryToFormValues';
|
|
5
|
+
import { type AdaptUrlQueryToSdkParams } from './adaptUrlQueryToSdk';
|
|
6
|
+
import { type AdaptUrlQueryToUrlQueryParams } from './adaptUrlQueryToUrlQuery';
|
|
7
|
+
import { type FiltersInstructions, type FormFullValues, type PageInfoFormValues, type TimeRangeFormValues, type UiFilterName, type UiFilterValue } from './types';
|
|
8
|
+
interface MakeFilterAdaptersParams {
|
|
9
|
+
instructions: FiltersInstructions;
|
|
10
|
+
}
|
|
11
|
+
interface MakeFilterAdaptersReturn<FilterFormValues extends FormFullValues> {
|
|
12
|
+
adaptFormValuesToUrlQuery: (params: Pick<AdaptFormValuesToUrlQueryParams<FormFullValues>, 'formValues'>) => string;
|
|
13
|
+
adaptFormValuesToSdk: (params: Pick<AdaptFormValuesToSdkParams<FilterFormValues>, 'formValues' | 'timezone'>) => QueryFilter;
|
|
14
|
+
adaptUrlQueryToFormValues: (params: Pick<AdaptUrlQueryToFormValuesParams, 'queryString'>) => FilterFormValues & TimeRangeFormValues & PageInfoFormValues;
|
|
15
|
+
adaptUrlQueryToSdk: (params: Pick<AdaptUrlQueryToSdkParams, 'queryString' | 'timezone'>) => QueryFilter;
|
|
16
|
+
adaptUrlQueryToUrlQuery: (params: Pick<AdaptUrlQueryToUrlQueryParams, 'queryString'>) => string;
|
|
17
|
+
validInstructions: FiltersInstructions;
|
|
18
|
+
}
|
|
19
|
+
export type MakeFiltersAdapters = <FilterFormValues extends Record<UiFilterName, UiFilterValue>>({ instructions }: MakeFilterAdaptersParams) => MakeFilterAdaptersReturn<FilterFormValues>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { TimeRangeFormValues, TimeRangePreset } from './types';
|
|
3
|
+
interface MakerSdkFilterTimeParams {
|
|
4
|
+
timePreset?: TimeRangePreset;
|
|
5
|
+
timeFrom?: Date | null;
|
|
6
|
+
timeTo?: Date | null;
|
|
7
|
+
timezone?: string;
|
|
8
|
+
sdkFilterName?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const makeSdkFilterTime: ({ timePreset, timeFrom, timeTo, timezone, sdkFilterName }: MakerSdkFilterTimeParams) => Record<string, string | undefined>;
|
|
11
|
+
export declare function getTimeRangeCustomLabel(timeFrom: Date, timeTo: Date, timezone?: string | undefined): string;
|
|
12
|
+
export declare function getTimeRangePresetName(timeRangePreset: TimeRangePreset): string;
|
|
13
|
+
export declare const timeRangeValidationSchema: z.ZodEffects<z.ZodObject<{
|
|
14
|
+
timeFrom: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
15
|
+
timeTo: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
16
|
+
timePreset: z.ZodNullable<z.ZodOptional<z.ZodEnum<["today", "last7days", "last30days", "custom"]>>>;
|
|
17
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
18
|
+
timeFrom: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
19
|
+
timeTo: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
20
|
+
timePreset: z.ZodNullable<z.ZodOptional<z.ZodEnum<["today", "last7days", "last30days", "custom"]>>>;
|
|
21
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
22
|
+
timeFrom: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
23
|
+
timeTo: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
24
|
+
timePreset: z.ZodNullable<z.ZodOptional<z.ZodEnum<["today", "last7days", "last30days", "custom"]>>>;
|
|
25
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
26
|
+
timeFrom: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
27
|
+
timeTo: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
28
|
+
timePreset: z.ZodNullable<z.ZodOptional<z.ZodEnum<["today", "last7days", "last30days", "custom"]>>>;
|
|
29
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
30
|
+
timeFrom: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
31
|
+
timeTo: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
32
|
+
timePreset: z.ZodNullable<z.ZodOptional<z.ZodEnum<["today", "last7days", "last30days", "custom"]>>>;
|
|
33
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
34
|
+
export declare const timeRangeFilterUiNames: Array<keyof TimeRangeFormValues>;
|
|
35
|
+
export declare function isTimeRangeFilterUiName(filterUiName: string): filterUiName is keyof TimeRangeFormValues;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|