@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,130 @@
|
|
|
1
|
+
import { type InputCurrencyRangeProps } from '../../forms/InputCurrencyRange';
|
|
2
|
+
import { type RelationshipSelectorProps } from '../../resources/RelationshipSelector';
|
|
3
|
+
export declare const filtrableTimeRangePreset: readonly ["today", "last7days", "last30days", "custom"];
|
|
4
|
+
export type UiFilterName = string;
|
|
5
|
+
export type UiFilterValue = string | string[] | boolean | Date | undefined;
|
|
6
|
+
export type TimeRangePreset = (typeof filtrableTimeRangePreset)[number];
|
|
7
|
+
export interface TimeRangeFormValues {
|
|
8
|
+
timePreset?: TimeRangePreset | null;
|
|
9
|
+
timeFrom?: Date | null;
|
|
10
|
+
timeTo?: Date | null;
|
|
11
|
+
}
|
|
12
|
+
type CurrencyRangeSdkPredicate = string;
|
|
13
|
+
export interface CurrencyRangeFieldValue {
|
|
14
|
+
from?: number | null;
|
|
15
|
+
to?: number | null;
|
|
16
|
+
currencyCode?: string | null;
|
|
17
|
+
}
|
|
18
|
+
export type CurrencyRangeFormValues = Record<CurrencyRangeSdkPredicate, CurrencyRangeFieldValue>;
|
|
19
|
+
export interface PageInfoFormValues {
|
|
20
|
+
viewTitle?: string;
|
|
21
|
+
}
|
|
22
|
+
export type FormFullValues = Record<UiFilterName, UiFilterValue | CurrencyRangeFieldValue> & TimeRangeFormValues & PageInfoFormValues;
|
|
23
|
+
export interface BaseFilterItem {
|
|
24
|
+
/**
|
|
25
|
+
* Label of the filter field in form component
|
|
26
|
+
*/
|
|
27
|
+
label: string;
|
|
28
|
+
/**
|
|
29
|
+
* Flag to hide the filter field in form component
|
|
30
|
+
*/
|
|
31
|
+
hidden?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Instruction to use this item to build the sdk query
|
|
34
|
+
*/
|
|
35
|
+
sdk: {
|
|
36
|
+
/**
|
|
37
|
+
* SDK predicate to use in the query (example: `status_in` or `name_cont`)
|
|
38
|
+
*/
|
|
39
|
+
predicate: string;
|
|
40
|
+
/**
|
|
41
|
+
* Set the default options to use in the query when this filter is not selected.
|
|
42
|
+
* Example, you have no `status_in` selected in UI, but if this option is `['placed', 'approved']`, the query will always contain
|
|
43
|
+
* a `status_in` predicate with `placed` and `approved` statuses. This helps to avoid getting status we never want to see (eg: 'draft')
|
|
44
|
+
*/
|
|
45
|
+
defaultOptions?: string[];
|
|
46
|
+
/**
|
|
47
|
+
* Custom function to transform the form value to the SDK value
|
|
48
|
+
*/
|
|
49
|
+
parseFormValue?: (value: unknown) => string | number | boolean | undefined;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export type FilterItemOptions = BaseFilterItem & {
|
|
53
|
+
type: 'options';
|
|
54
|
+
render: {
|
|
55
|
+
/**
|
|
56
|
+
* UI component to render
|
|
57
|
+
*/
|
|
58
|
+
component: 'toggleButtons';
|
|
59
|
+
/**
|
|
60
|
+
* props required for the UI component
|
|
61
|
+
*/
|
|
62
|
+
props: {
|
|
63
|
+
mode: 'multi' | 'single';
|
|
64
|
+
/**
|
|
65
|
+
* an option can be hidden from the UI but still be used in the query
|
|
66
|
+
* Example: we wont show the button to filter `pending` status in the UI, but we still want to accept it for a predefined list)
|
|
67
|
+
*/
|
|
68
|
+
options: Array<{
|
|
69
|
+
label: string;
|
|
70
|
+
value: string;
|
|
71
|
+
isHidden?: boolean;
|
|
72
|
+
}>;
|
|
73
|
+
};
|
|
74
|
+
} | {
|
|
75
|
+
/**
|
|
76
|
+
* UI component to render
|
|
77
|
+
*/
|
|
78
|
+
component: 'relationshipSelector';
|
|
79
|
+
/**
|
|
80
|
+
* props required for the UI component
|
|
81
|
+
*/
|
|
82
|
+
props: Omit<RelationshipSelectorProps, 'onChange' | 'defaultValues' | 'title'>;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export interface FilterItemTextSearch extends Omit<BaseFilterItem, 'sdk'> {
|
|
86
|
+
type: 'textSearch';
|
|
87
|
+
render: {
|
|
88
|
+
/**
|
|
89
|
+
* UI component to render
|
|
90
|
+
*/
|
|
91
|
+
component: 'searchBar';
|
|
92
|
+
};
|
|
93
|
+
sdk: Pick<BaseFilterItem['sdk'], 'predicate'>;
|
|
94
|
+
}
|
|
95
|
+
export interface FilterItemTime extends Omit<BaseFilterItem, 'sdk'> {
|
|
96
|
+
type: 'timeRange';
|
|
97
|
+
sdk: {
|
|
98
|
+
/**
|
|
99
|
+
* SDK predicate to use in the query (example: `updated_at` or `updated_at`).
|
|
100
|
+
* Don't use `_gteq` or `_lteq` suffixes, they will be generated by the filter method based on the following key
|
|
101
|
+
* Example given the key `updated_at`, the generated predicate will be `updated_at_gteq` or `updated_at_lteq` depending on the preset
|
|
102
|
+
*/
|
|
103
|
+
predicate: string;
|
|
104
|
+
};
|
|
105
|
+
render: {
|
|
106
|
+
component: 'dateRangePicker';
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export interface FilterItemCurrencyRange extends Omit<BaseFilterItem, 'sdk'> {
|
|
110
|
+
type: 'currencyRange';
|
|
111
|
+
sdk: {
|
|
112
|
+
/**
|
|
113
|
+
* SDK predicate to use in the query (example: `total_amount_cents` or `subtotal_amount_cents`).
|
|
114
|
+
* Don't use `_gteq` or `_lteq` suffixes, they will be generated by the filter method based on the following key
|
|
115
|
+
* Example given the key `total_amount_cents`, the generated predicate will be `total_amount_cents_gteq` or `total_amount_cents_lteq`
|
|
116
|
+
* It will also add the `currency_code_eq` predicate
|
|
117
|
+
*/
|
|
118
|
+
predicate: string;
|
|
119
|
+
};
|
|
120
|
+
render: {
|
|
121
|
+
component: 'inputCurrencyRange';
|
|
122
|
+
props: Omit<InputCurrencyRangeProps, 'onChange' | 'fromCents' | 'toCents' | 'defaultCurrency' | 'currencyList'>;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export type FiltersInstructionItem = FilterItemOptions | FilterItemTextSearch | FilterItemTime | FilterItemCurrencyRange;
|
|
126
|
+
export type FiltersInstructions = FiltersInstructionItem[];
|
|
127
|
+
export declare function isItemOptions(item: FiltersInstructionItem): item is FilterItemOptions;
|
|
128
|
+
export declare function isTextSearch(item: FiltersInstructionItem): item is FilterItemTextSearch;
|
|
129
|
+
export declare function isCurrencyRange(item: FiltersInstructionItem): item is FilterItemCurrencyRange;
|
|
130
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ResourceListProps } from '../../resources/ResourceList';
|
|
3
|
+
import { type ListableResourceType } from '@commercelayer/sdk/lib/cjs/api';
|
|
4
|
+
import { type QueryFilter } from '@commercelayer/sdk/lib/cjs/query';
|
|
5
|
+
import { type FiltersFormProps } from './FiltersForm';
|
|
6
|
+
import { type FiltersNavProps } from './FiltersNav';
|
|
7
|
+
import { makeFilterAdapters } from './adapters';
|
|
8
|
+
import { type FiltersInstructions } from './types';
|
|
9
|
+
interface UseFiltersProps {
|
|
10
|
+
/**
|
|
11
|
+
* Array of instruction items to build the filters behaviors
|
|
12
|
+
*/
|
|
13
|
+
instructions: FiltersInstructions;
|
|
14
|
+
}
|
|
15
|
+
interface UseFiltersHook {
|
|
16
|
+
/**
|
|
17
|
+
* Helper methods to transform filters from/to url query string, sdk and form values
|
|
18
|
+
*/
|
|
19
|
+
adapters: ReturnType<typeof makeFilterAdapters>;
|
|
20
|
+
/**
|
|
21
|
+
* Search bar component with filters navigation buttons
|
|
22
|
+
*/
|
|
23
|
+
SearchWithNav: (props: Pick<FiltersNavProps, 'onFilterClick' | 'queryString'> & {
|
|
24
|
+
/**
|
|
25
|
+
* Callback triggered when user interact with search bar or remove a filter from the buttons
|
|
26
|
+
*/
|
|
27
|
+
onUpdate: (newQueryString: string) => void;
|
|
28
|
+
hideSearchBar?: boolean;
|
|
29
|
+
hideFiltersNav?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Placeholder text for the search bar
|
|
32
|
+
* @default 'Search...'
|
|
33
|
+
*/
|
|
34
|
+
searchBarPlaceholder?: string;
|
|
35
|
+
}) => JSX.Element;
|
|
36
|
+
/**
|
|
37
|
+
* Form component with filters fields based on provided instructions
|
|
38
|
+
*/
|
|
39
|
+
FiltersForm: (props: Pick<FiltersFormProps, 'onSubmit'>) => JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* Filtered ResourceList component based on current active filters
|
|
42
|
+
*/
|
|
43
|
+
FilteredList: <TResource extends ListableResourceType>(props: Pick<ResourceListProps<TResource>, 'Item' | 'type' | 'query' | 'emptyState' | 'actionButton'>) => JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* SDK filters object to be used in the sdk query
|
|
46
|
+
*/
|
|
47
|
+
sdkFilters: QueryFilter | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Returns `true` if there is at least one filter activated by the user.
|
|
50
|
+
* This does not include the text filter or presets, but only ones manually set by the user.
|
|
51
|
+
*/
|
|
52
|
+
hasActiveFilter: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* view title to be used in the page
|
|
55
|
+
*/
|
|
56
|
+
viewTitle?: string;
|
|
57
|
+
}
|
|
58
|
+
export declare function useFilters({ instructions }: UseFiltersProps): UseFiltersHook;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type FilterItemOptions, type FiltersInstructions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Show the filter label with the counter for selected options
|
|
4
|
+
* or just the total of available options when nothing is selected
|
|
5
|
+
* @param options
|
|
6
|
+
* @returns string
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* "Markets · 2 of 4"
|
|
10
|
+
* "Markets · 4"
|
|
11
|
+
*/
|
|
12
|
+
export declare function computeFilterLabel({ label, totalCount, selectedCount }: {
|
|
13
|
+
label: string;
|
|
14
|
+
totalCount: number;
|
|
15
|
+
selectedCount: number;
|
|
16
|
+
}): string;
|
|
17
|
+
/**
|
|
18
|
+
* Get total count of active filter groups from URL query string.
|
|
19
|
+
* @param includeTextSearch if `true` will count `text` filter as active filter group
|
|
20
|
+
* @returns number of active filters
|
|
21
|
+
* Example: if we have 3 markets selected, will still count as `1` active filter group
|
|
22
|
+
* If we have 3 markets and 1 status selected, will count as `2`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getActiveFilterCountFromUrl({ includeTextSearch, instructions, queryString }: {
|
|
25
|
+
includeTextSearch?: boolean;
|
|
26
|
+
instructions: FiltersInstructions;
|
|
27
|
+
queryString: string;
|
|
28
|
+
}): number;
|
|
29
|
+
export declare function getAllowedValuesFromItemOptions(instructionItem: FilterItemOptions): string[] | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/utils/htmltags.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare function enforceAllowedTags<AllowedTags extends ReadonlyArray<keyof JSX.IntrinsicElements>, Tag extends AllowedTags[number], DefaultTag extends AllowedTags[number]>({ tag, allowedTags, defaultTag }: {
|
|
2
3
|
tag?: Tag;
|
|
3
4
|
allowedTags: AllowedTags;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercelayer/app-elements",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.80",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -28,10 +28,12 @@
|
|
|
28
28
|
"classnames": "^2.3.2",
|
|
29
29
|
"jwt-decode": "^3.1.2",
|
|
30
30
|
"lodash": "^4.17.21",
|
|
31
|
+
"query-string": "^8.1.0",
|
|
31
32
|
"react": "^18.2.0",
|
|
32
33
|
"react-currency-input-field": "^3.6.11",
|
|
33
34
|
"react-datepicker": "^4.16.0",
|
|
34
35
|
"react-dom": "^18.2.0",
|
|
36
|
+
"react-hook-form": "^7.45.2",
|
|
35
37
|
"react-select": "^5.7.4",
|
|
36
38
|
"swr": "^2.2.0",
|
|
37
39
|
"ts-invariant": "^0.10.3",
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
42
44
|
"@commercelayer/eslint-config-ts-react": "^1.0.1",
|
|
45
|
+
"@hookform/resolvers": "^3.1.1",
|
|
43
46
|
"@phosphor-icons/react": "v2.0.10",
|
|
44
47
|
"@tailwindcss/forms": "^0.5.4",
|
|
45
48
|
"@testing-library/jest-dom": "^5.17.0",
|
|
@@ -65,6 +68,10 @@
|
|
|
65
68
|
},
|
|
66
69
|
"peerDependencies": {
|
|
67
70
|
"@commercelayer/sdk": "^5.x",
|
|
71
|
+
"query-string": "^8.1.x",
|
|
72
|
+
"react": "^18.2.x",
|
|
73
|
+
"react-dom": "^18.2.x",
|
|
74
|
+
"react-hook-form": "^7.43.x",
|
|
68
75
|
"wouter": "^2.x"
|
|
69
76
|
},
|
|
70
77
|
"scripts": {
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type OverlayProps } from '../ui/atoms/Overlay';
|
|
2
|
-
interface OverlayNavigationOptions {
|
|
3
|
-
/**
|
|
4
|
-
* The query param to be used to control the overlay visibility.
|
|
5
|
-
**/
|
|
6
|
-
queryParam: string;
|
|
7
|
-
}
|
|
8
|
-
interface OverlayNavigation {
|
|
9
|
-
/**
|
|
10
|
-
* The overlay component.
|
|
11
|
-
**/
|
|
12
|
-
Overlay: React.FC<OverlayProps>;
|
|
13
|
-
/**
|
|
14
|
-
* Function to be used to open the overlay.
|
|
15
|
-
* It will add the query param to the URL.
|
|
16
|
-
* @param replaceHistory If true, the query param will be added without creating a new history entry.
|
|
17
|
-
**/
|
|
18
|
-
open: (replaceHistory?: boolean) => void;
|
|
19
|
-
/**
|
|
20
|
-
* Function to be used to close the overlay.
|
|
21
|
-
* It's a simple history.back() call.
|
|
22
|
-
**/
|
|
23
|
-
close: () => void;
|
|
24
|
-
}
|
|
25
|
-
export declare function useOverlayNavigation({ queryParam }: OverlayNavigationOptions): OverlayNavigation;
|
|
26
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface OverlayProps {
|
|
3
|
-
/**
|
|
4
|
-
* The content of the overlay.
|
|
5
|
-
**/
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
/**
|
|
8
|
-
* The action button to be rendered at the bottom of the overlay.
|
|
9
|
-
* If set to 'none', no button will be rendered.
|
|
10
|
-
* If set to an object, the button will be rendered with the label and the onClick handler.
|
|
11
|
-
* @default 'none'
|
|
12
|
-
**/
|
|
13
|
-
button?: 'none' | {
|
|
14
|
-
onClick: () => void;
|
|
15
|
-
label: string;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
declare const Overlay: React.FC<OverlayProps>;
|
|
20
|
-
export { Overlay };
|
|
File without changes
|