@open-tender/store 1.1.168 → 1.1.170
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/cjs/components/CategoryNavItem.d.ts +2 -4
- package/dist/cjs/components/CategoryNavItem.js +2 -7
- package/dist/cjs/components/Keypad.js +13 -2
- package/dist/cjs/utils/keyboard.d.ts +1 -1
- package/dist/cjs/utils/keyboard.js +3 -3
- package/dist/esm/components/CategoryNavItem.d.ts +2 -4
- package/dist/esm/components/CategoryNavItem.js +2 -7
- package/dist/esm/components/Keypad.js +14 -3
- package/dist/esm/utils/keyboard.d.ts +1 -1
- package/dist/esm/utils/keyboard.js +3 -3
- package/package.json +4 -4
|
@@ -1,11 +1,9 @@
|
|
|
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: ({ category, children, navigate }: {
|
|
5
5
|
category: MenuCategory;
|
|
6
|
-
navigate
|
|
6
|
+
navigate: (route: string) => void;
|
|
7
7
|
children: (props: CategoryNavItemProps) => ReactNode;
|
|
8
|
-
scrollTo?: (index: number) => void;
|
|
9
|
-
index?: number;
|
|
10
8
|
}) => ReactNode;
|
|
11
9
|
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 category = _a.category, children = _a.children, navigate = _a.navigate;
|
|
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,12 +15,7 @@ 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
|
-
|
|
19
|
-
scrollTo(index);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
navigate && navigate('/menu/category');
|
|
23
|
-
}
|
|
18
|
+
navigate('/menu/category');
|
|
24
19
|
};
|
|
25
20
|
var handlers = { browse: browse };
|
|
26
21
|
if (!config)
|
|
@@ -9,10 +9,21 @@ var Keypad = function (_a) {
|
|
|
9
9
|
var _b = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig), keypad = _b.keypad, numpad = _b.numpad;
|
|
10
10
|
var isDollar = type === 'dollar';
|
|
11
11
|
var config = type === 'numeric' || isDollar ? numpad : keypad;
|
|
12
|
-
var
|
|
12
|
+
var _c = (0, react_1.useState)(false), isShiftOn = _c[0], setIsShiftOn = _c[1];
|
|
13
|
+
var handleOnKeyPress = (0, react_1.useCallback)(function (key) {
|
|
14
|
+
setIsShiftOn(function (prev) { return (key === '\u21E7' ? !prev : prev); });
|
|
15
|
+
handlers.change((0, utils_1.getKeyboardValue)(key, value, maxLength, isShiftOn));
|
|
16
|
+
}, [handlers, value, maxLength, isShiftOn]);
|
|
13
17
|
var viewHandlers = (0, react_1.useMemo)(function () { return ({ keyPress: handleOnKeyPress }); }, [handleOnKeyPress]);
|
|
14
18
|
if (!config)
|
|
15
19
|
return null;
|
|
16
|
-
return children({
|
|
20
|
+
return children({
|
|
21
|
+
config: config,
|
|
22
|
+
handlers: viewHandlers,
|
|
23
|
+
value: value,
|
|
24
|
+
type: type,
|
|
25
|
+
isEmail: isEmail,
|
|
26
|
+
isShiftOn: isShiftOn
|
|
27
|
+
});
|
|
17
28
|
};
|
|
18
29
|
exports.default = Keypad;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getKeyboardValue: (key: string, value: string, maxLength?: number) => string;
|
|
1
|
+
export declare const getKeyboardValue: (key: string, value: string, maxLength?: number, isShiftOn?: boolean) => string;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getKeyboardValue = void 0;
|
|
4
|
-
var getKeyboardValue = function (key, value, maxLength) {
|
|
4
|
+
var getKeyboardValue = function (key, value, maxLength, isShiftOn) {
|
|
5
5
|
if (key === 'Del')
|
|
6
6
|
return value.slice(0, -1);
|
|
7
7
|
else if (key === 'Clr')
|
|
8
8
|
return '';
|
|
9
|
-
else if (maxLength && value.length >= maxLength)
|
|
9
|
+
else if ((maxLength && value.length >= maxLength) || key === '\u21E7')
|
|
10
10
|
return value;
|
|
11
11
|
else if (key === 'Space')
|
|
12
12
|
return value + ' ';
|
|
13
13
|
else
|
|
14
|
-
return value + key;
|
|
14
|
+
return value + (isShiftOn ? key.toUpperCase() : key);
|
|
15
15
|
};
|
|
16
16
|
exports.getKeyboardValue = getKeyboardValue;
|
|
@@ -1,11 +1,9 @@
|
|
|
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: ({ category, children, navigate }: {
|
|
5
5
|
category: MenuCategory;
|
|
6
|
-
navigate
|
|
6
|
+
navigate: (route: string) => void;
|
|
7
7
|
children: (props: CategoryNavItemProps) => ReactNode;
|
|
8
|
-
scrollTo?: (index: number) => void;
|
|
9
|
-
index?: number;
|
|
10
8
|
}) => ReactNode;
|
|
11
9
|
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 category = _a.category, children = _a.children, navigate = _a.navigate;
|
|
6
6
|
var dispatch = useAppDispatch();
|
|
7
7
|
var apiUrl = useAppSelector(selectKioskApi);
|
|
8
8
|
var current = useAppSelector(selectCurrentCategory);
|
|
@@ -13,12 +13,7 @@ var CategoryNavItem = function (_a) {
|
|
|
13
13
|
var imageUrl = makeImageUrl(category);
|
|
14
14
|
var browse = function () {
|
|
15
15
|
dispatch(setCurrentCategory(category));
|
|
16
|
-
|
|
17
|
-
scrollTo(index);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
navigate && navigate('/menu/category');
|
|
21
|
-
}
|
|
16
|
+
navigate('/menu/category');
|
|
22
17
|
};
|
|
23
18
|
var handlers = { browse: browse };
|
|
24
19
|
if (!config)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useMemo } from 'react';
|
|
1
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import { useAppSelector } from '../app/hooks';
|
|
3
3
|
import { selectKioskConfig } from '../slices';
|
|
4
4
|
import { getKeyboardValue } from '../utils';
|
|
@@ -7,10 +7,21 @@ var Keypad = function (_a) {
|
|
|
7
7
|
var _b = useAppSelector(selectKioskConfig), keypad = _b.keypad, numpad = _b.numpad;
|
|
8
8
|
var isDollar = type === 'dollar';
|
|
9
9
|
var config = type === 'numeric' || isDollar ? numpad : keypad;
|
|
10
|
-
var
|
|
10
|
+
var _c = useState(false), isShiftOn = _c[0], setIsShiftOn = _c[1];
|
|
11
|
+
var handleOnKeyPress = useCallback(function (key) {
|
|
12
|
+
setIsShiftOn(function (prev) { return (key === '\u21E7' ? !prev : prev); });
|
|
13
|
+
handlers.change(getKeyboardValue(key, value, maxLength, isShiftOn));
|
|
14
|
+
}, [handlers, value, maxLength, isShiftOn]);
|
|
11
15
|
var viewHandlers = useMemo(function () { return ({ keyPress: handleOnKeyPress }); }, [handleOnKeyPress]);
|
|
12
16
|
if (!config)
|
|
13
17
|
return null;
|
|
14
|
-
return children({
|
|
18
|
+
return children({
|
|
19
|
+
config: config,
|
|
20
|
+
handlers: viewHandlers,
|
|
21
|
+
value: value,
|
|
22
|
+
type: type,
|
|
23
|
+
isEmail: isEmail,
|
|
24
|
+
isShiftOn: isShiftOn
|
|
25
|
+
});
|
|
15
26
|
};
|
|
16
27
|
export default Keypad;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getKeyboardValue: (key: string, value: string, maxLength?: number) => string;
|
|
1
|
+
export declare const getKeyboardValue: (key: string, value: string, maxLength?: number, isShiftOn?: boolean) => string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export var getKeyboardValue = function (key, value, maxLength) {
|
|
1
|
+
export var getKeyboardValue = function (key, value, maxLength, isShiftOn) {
|
|
2
2
|
if (key === 'Del')
|
|
3
3
|
return value.slice(0, -1);
|
|
4
4
|
else if (key === 'Clr')
|
|
5
5
|
return '';
|
|
6
|
-
else if (maxLength && value.length >= maxLength)
|
|
6
|
+
else if ((maxLength && value.length >= maxLength) || key === '\u21E7')
|
|
7
7
|
return value;
|
|
8
8
|
else if (key === 'Space')
|
|
9
9
|
return value + ' ';
|
|
10
10
|
else
|
|
11
|
-
return value + key;
|
|
11
|
+
return value + (isShiftOn ? key.toUpperCase() : key);
|
|
12
12
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.170",
|
|
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,9 +61,9 @@
|
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@emotion/react": "^11.11.1",
|
|
64
|
-
"@open-tender/types": "^0.4.
|
|
65
|
-
"@open-tender/ui": "^0.4.
|
|
66
|
-
"@open-tender/utils": "^0.4.
|
|
64
|
+
"@open-tender/types": "^0.4.77",
|
|
65
|
+
"@open-tender/ui": "^0.4.4",
|
|
66
|
+
"@open-tender/utils": "^0.4.52",
|
|
67
67
|
"@reduxjs/toolkit": "^2.0.1",
|
|
68
68
|
"date-fns": "2.30.0",
|
|
69
69
|
"date-fns-tz": "^2.0.0",
|