@open-tender/store 1.1.182 → 1.1.183
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.
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { MenuCategory } from '@open-tender/types';
|
|
2
2
|
import { CategoryNavItemProps } from '@open-tender/ui';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
|
-
declare const CategoryNavItem: ({ category, children, navigate }: {
|
|
4
|
+
declare const CategoryNavItem: ({ index, category, children, navigate, scrollToIndex }: {
|
|
5
|
+
index?: number;
|
|
5
6
|
category: MenuCategory;
|
|
6
7
|
navigate: (route: string) => void;
|
|
7
8
|
children: (props: CategoryNavItemProps) => ReactNode;
|
|
9
|
+
scrollToIndex?: (index: number) => void;
|
|
8
10
|
}) => ReactNode;
|
|
9
11
|
export default CategoryNavItem;
|
|
@@ -4,7 +4,7 @@ var ui_1 = require("@open-tender/ui");
|
|
|
4
4
|
var hooks_1 = require("../app/hooks");
|
|
5
5
|
var slices_1 = require("../slices");
|
|
6
6
|
var CategoryNavItem = function (_a) {
|
|
7
|
-
var category = _a.category, children = _a.children, navigate = _a.navigate;
|
|
7
|
+
var index = _a.index, category = _a.category, children = _a.children, navigate = _a.navigate, scrollToIndex = _a.scrollToIndex;
|
|
8
8
|
var dispatch = (0, hooks_1.useAppDispatch)();
|
|
9
9
|
var apiUrl = (0, hooks_1.useAppSelector)(slices_1.selectKioskApi);
|
|
10
10
|
var current = (0, hooks_1.useAppSelector)(slices_1.selectCurrentCategory);
|
|
@@ -15,7 +15,12 @@ var CategoryNavItem = function (_a) {
|
|
|
15
15
|
var imageUrl = (0, ui_1.makeImageUrl)(category);
|
|
16
16
|
var browse = function () {
|
|
17
17
|
dispatch((0, slices_1.setCurrentCategory)(category));
|
|
18
|
-
|
|
18
|
+
if (scrollToIndex && index) {
|
|
19
|
+
scrollToIndex(index);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
navigate('/menu/category');
|
|
23
|
+
}
|
|
19
24
|
};
|
|
20
25
|
var handlers = { browse: browse };
|
|
21
26
|
if (!config)
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { MenuCategory } from '@open-tender/types';
|
|
2
2
|
import { CategoryNavItemProps } from '@open-tender/ui';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
|
-
declare const CategoryNavItem: ({ category, children, navigate }: {
|
|
4
|
+
declare const CategoryNavItem: ({ index, category, children, navigate, scrollToIndex }: {
|
|
5
|
+
index?: number;
|
|
5
6
|
category: MenuCategory;
|
|
6
7
|
navigate: (route: string) => void;
|
|
7
8
|
children: (props: CategoryNavItemProps) => ReactNode;
|
|
9
|
+
scrollToIndex?: (index: number) => void;
|
|
8
10
|
}) => ReactNode;
|
|
9
11
|
export default CategoryNavItem;
|
|
@@ -2,7 +2,7 @@ import { makeImageUrl } from '@open-tender/ui';
|
|
|
2
2
|
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
3
3
|
import { selectCurrentCategory, selectKioskApi, selectKioskConfig, setCurrentCategory } from '../slices';
|
|
4
4
|
var CategoryNavItem = function (_a) {
|
|
5
|
-
var category = _a.category, children = _a.children, navigate = _a.navigate;
|
|
5
|
+
var index = _a.index, category = _a.category, children = _a.children, navigate = _a.navigate, scrollToIndex = _a.scrollToIndex;
|
|
6
6
|
var dispatch = useAppDispatch();
|
|
7
7
|
var apiUrl = useAppSelector(selectKioskApi);
|
|
8
8
|
var current = useAppSelector(selectCurrentCategory);
|
|
@@ -13,7 +13,12 @@ var CategoryNavItem = function (_a) {
|
|
|
13
13
|
var imageUrl = makeImageUrl(category);
|
|
14
14
|
var browse = function () {
|
|
15
15
|
dispatch(setCurrentCategory(category));
|
|
16
|
-
|
|
16
|
+
if (scrollToIndex && index) {
|
|
17
|
+
scrollToIndex(index);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
navigate('/menu/category');
|
|
21
|
+
}
|
|
17
22
|
};
|
|
18
23
|
var handlers = { browse: browse };
|
|
19
24
|
if (!config)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.183",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@emotion/react": "^11.11.1",
|
|
64
|
-
"@open-tender/types": "^0.4.
|
|
64
|
+
"@open-tender/types": "^0.4.78",
|
|
65
65
|
"@open-tender/ui": "^0.4.11",
|
|
66
66
|
"@open-tender/utils": "^0.4.61",
|
|
67
67
|
"@reduxjs/toolkit": "^2.0.1",
|