@tap-payments/os-micro-frontend-shared 0.1.246-test.2 → 0.1.246-test.4
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/build/components/BrandLogo/BrandLogo.d.ts +12 -0
- package/build/components/BrandLogo/BrandLogo.js +35 -0
- package/build/components/BrandLogo/Loading.d.ts +6 -0
- package/build/components/BrandLogo/Loading.js +3 -0
- package/build/components/BrandLogo/index.d.ts +1 -0
- package/build/components/BrandLogo/index.js +1 -0
- package/build/components/index.d.ts +1 -1
- package/build/components/index.js +1 -1
- package/build/constants/index.d.ts +0 -1
- package/build/constants/index.js +0 -1
- package/package.json +2 -2
- package/build/components/VAT/TotalVAT/TotalVAT.d.ts +0 -12
- package/build/components/VAT/TotalVAT/TotalVAT.js +0 -31
- package/build/components/VAT/TotalVAT/index.d.ts +0 -1
- package/build/components/VAT/TotalVAT/index.js +0 -1
- package/build/components/VAT/TotalVAT/style.d.ts +0 -12
- package/build/components/VAT/TotalVAT/style.js +0 -5
- package/build/components/VAT/VATDropdown/VATDropdown.d.ts +0 -11
- package/build/components/VAT/VATDropdown/VATDropdown.js +0 -34
- package/build/components/VAT/VATDropdown/index.d.ts +0 -1
- package/build/components/VAT/VATDropdown/index.js +0 -1
- package/build/components/VAT/VATDropdown/style.d.ts +0 -7
- package/build/components/VAT/VATDropdown/style.js +0 -32
- package/build/components/VAT/VATRateDropdown/VATRateDropdown.d.ts +0 -10
- package/build/components/VAT/VATRateDropdown/VATRateDropdown.js +0 -38
- package/build/components/VAT/VATRateDropdown/index.d.ts +0 -1
- package/build/components/VAT/VATRateDropdown/index.js +0 -1
- package/build/components/VAT/VATRateDropdown/style.d.ts +0 -7
- package/build/components/VAT/VATRateDropdown/style.js +0 -30
- package/build/components/VAT/index.d.ts +0 -4
- package/build/components/VAT/index.js +0 -4
- package/build/components/VAT/utils.d.ts +0 -7
- package/build/components/VAT/utils.js +0 -8
- package/build/constants/rate.d.ts +0 -6
- package/build/constants/rate.js +0 -6
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BoxProps } from '@mui/material/Box';
|
|
3
|
+
export interface BrandLogoProps extends BoxProps {
|
|
4
|
+
data?: Blob;
|
|
5
|
+
width?: number | string;
|
|
6
|
+
height?: number | string;
|
|
7
|
+
isError?: boolean;
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function BrandLogo({ data, isError, isLoading, width, height, ...props }: Readonly<BrandLogoProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const _default: import("react").MemoExoticComponent<typeof BrandLogo>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { memo, useMemo } from 'react';
|
|
14
|
+
import { useTheme } from '@mui/material/styles';
|
|
15
|
+
import { grayBrandIcon, pdfIcon } from '../../constants/index.js';
|
|
16
|
+
import { Icon } from '../index.js';
|
|
17
|
+
import { Loading } from './Loading';
|
|
18
|
+
function BrandLogo(_a) {
|
|
19
|
+
var { data, isError, isLoading, width = 24, height = 24 } = _a, props = __rest(_a, ["data", "isError", "isLoading", "width", "height"]);
|
|
20
|
+
const theme = useTheme();
|
|
21
|
+
const isPdf = useMemo(() => { var _a; return (_a = data === null || data === void 0 ? void 0 : data.type) === null || _a === void 0 ? void 0 : _a.includes('application/pdf'); }, [data]);
|
|
22
|
+
const logoUrl = useMemo(() => (data ? (window.URL ? URL : webkitURL).createObjectURL(data) : ''), [data]);
|
|
23
|
+
const imageSrc = useMemo(() => {
|
|
24
|
+
if (isError)
|
|
25
|
+
return grayBrandIcon;
|
|
26
|
+
if (isPdf)
|
|
27
|
+
return pdfIcon;
|
|
28
|
+
return logoUrl;
|
|
29
|
+
}, [isError, isPdf, logoUrl]);
|
|
30
|
+
if (isLoading)
|
|
31
|
+
return _jsx(Loading, { width: width, height: height });
|
|
32
|
+
return (_jsx(Icon, { alt: "brand", src: imageSrc, sx: Object.assign({ borderRadius: '50%', backgroundColor: theme.palette.common.white, width,
|
|
33
|
+
height, objectFit: isPdf ? 'none' : 'contain' }, props.sx) }));
|
|
34
|
+
}
|
|
35
|
+
export default memo(BrandLogo);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BrandLogo, BrandLogoProps } from './BrandLogo';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BrandLogo } from './BrandLogo';
|
package/build/constants/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.1.246-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.246-test.4",
|
|
5
|
+
"testVersion": 4,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Currency, Vat } from '../../../types/index.js';
|
|
3
|
-
interface TotalVATProps {
|
|
4
|
-
totalGrossAmount: number;
|
|
5
|
-
totalVat: Vat;
|
|
6
|
-
selectedCurrency: Currency;
|
|
7
|
-
isDisabled: boolean;
|
|
8
|
-
onChangeTotalVat: (vat: Vat) => void;
|
|
9
|
-
}
|
|
10
|
-
declare function TotalVAT({ totalGrossAmount, totalVat, selectedCurrency, onChangeTotalVat, isDisabled }: Readonly<TotalVATProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
declare const _default: import("react").MemoExoticComponent<typeof TotalVAT>;
|
|
12
|
-
export default _default;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useRef, useState } from 'react';
|
|
3
|
-
import Popper from '@mui/material/Popper';
|
|
4
|
-
import Box from '@mui/material/Box';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { CustomBackdrop, DisplayAmount } from '../../index.js';
|
|
7
|
-
import { actionsIcon, activeActionIcon, taxIcon } from '../../../constants/index.js';
|
|
8
|
-
import { Label, LabelWrapper } from './style';
|
|
9
|
-
import { getVatValue } from '../utils';
|
|
10
|
-
import VATDropdown from '../VATDropdown';
|
|
11
|
-
function TotalVAT({ totalGrossAmount, totalVat, selectedCurrency, onChangeTotalVat, isDisabled }) {
|
|
12
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
13
|
-
const vatButtonRef = useRef();
|
|
14
|
-
const { t } = useTranslation();
|
|
15
|
-
const toggleDropdown = () => {
|
|
16
|
-
if (!isDisabled)
|
|
17
|
-
setIsOpen(!isOpen);
|
|
18
|
-
};
|
|
19
|
-
const modifyTotalVAT = (newVat) => {
|
|
20
|
-
onChangeTotalVat(Object.assign(Object.assign({}, newVat), { value: getVatValue(totalGrossAmount, newVat) }));
|
|
21
|
-
};
|
|
22
|
-
const getLabel = () => {
|
|
23
|
-
if (totalVat.percentage === 0)
|
|
24
|
-
return t('noVat');
|
|
25
|
-
if (!totalVat.isInclusive)
|
|
26
|
-
return _jsx(DisplayAmount, { selectedCurrency: selectedCurrency, amount: totalVat.value });
|
|
27
|
-
return (_jsxs(Box, Object.assign({ sx: { display: 'flex', gap: '4px' } }, { children: [_jsxs("span", { children: [t('inclusive'), " "] }), _jsx(DisplayAmount, { amount: totalVat.value, selectedCurrency: selectedCurrency })] })));
|
|
28
|
-
};
|
|
29
|
-
return (_jsxs(LabelWrapper, Object.assign({ isDisabled: isDisabled, isOpen: isOpen, onClick: toggleDropdown, ref: vatButtonRef, sx: Object.assign({}, (isDisabled && { pointerEvents: 'none', opacity: 0.7 })) }, { children: [_jsx("img", { src: taxIcon, alt: "p" }), _jsx(Label, Object.assign({ isDisabled: isDisabled }, { children: getLabel() })), _jsx(Box, { component: "img", src: isOpen ? activeActionIcon : actionsIcon, alt: "a" }), isOpen && _jsx(CustomBackdrop, { onClick: toggleDropdown }), _jsx(Popper, Object.assign({ open: Boolean(isOpen), anchorEl: vatButtonRef.current, placement: "bottom-start" }, { children: _jsx(VATDropdown, { setIsOpen: setIsOpen, vat: totalVat, setVat: modifyTotalVAT, sx: { position: 'absolute', top: 8, left: 0, display: isOpen ? 'block' : 'none' } }) }))] })));
|
|
30
|
-
}
|
|
31
|
-
export default memo(TotalVAT);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './TotalVAT';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './TotalVAT';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const LabelWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
5
|
-
isDisabled?: boolean | undefined;
|
|
6
|
-
isOpen?: boolean | undefined;
|
|
7
|
-
}, {}, {}>;
|
|
8
|
-
export declare const Label: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
9
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
10
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
11
|
-
isDisabled: boolean;
|
|
12
|
-
}, {}, {}>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Box, styled } from '@mui/material';
|
|
2
|
-
export const LabelWrapper = styled(Box, {
|
|
3
|
-
shouldForwardProp: (props) => props !== 'isDisabled' && props !== 'isOpen',
|
|
4
|
-
})(({ theme, isOpen, isDisabled }) => (Object.assign(Object.assign({ display: 'flex', gap: theme.spacing(1), alignItems: 'center', justifyContent: 'space-between', fontSize: '11px', border: `1px solid ${theme.palette.divider}`, height: 32, padding: theme.spacing(1), borderRadius: '4px' }, (isOpen && { borderColor: theme.palette.info.dark, position: 'relative' })), (isDisabled ? { color: theme.palette.grey[700], cursor: 'not-allowed' } : { cursor: 'pointer' }))));
|
|
5
|
-
export const Label = styled(Box, { shouldForwardProp: (props) => props !== 'isDisabled' })(({ theme, isDisabled }) => (Object.assign({ fontSize: '11px', fontWeight: 600, color: theme.palette.text.primary }, (isDisabled && { color: theme.palette.grey[700] }))));
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { BoxProps } from '@mui/material/Box';
|
|
3
|
-
import { Vat } from '../../../types/index.js';
|
|
4
|
-
interface VATDropdownProps extends BoxProps {
|
|
5
|
-
vat: Vat;
|
|
6
|
-
setVat: (vat: Vat) => void;
|
|
7
|
-
setIsOpen: (value: boolean) => void;
|
|
8
|
-
}
|
|
9
|
-
declare function VATDropdown({ setVat, vat, setIsOpen: setIsDropdownOpen, ...props }: Readonly<VATDropdownProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
declare const _default: import("react").MemoExoticComponent<typeof VATDropdown>;
|
|
11
|
-
export default _default;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { memo, useState } from 'react';
|
|
14
|
-
import { useTranslation } from 'react-i18next';
|
|
15
|
-
import { rightArrow } from '../../../constants/index.js';
|
|
16
|
-
import { Menu } from '../../index.js';
|
|
17
|
-
import { Wrapper, Option } from './style';
|
|
18
|
-
import VATRateDropdown from '../VATRateDropdown';
|
|
19
|
-
function VATDropdown(_a) {
|
|
20
|
-
var { setVat, vat, setIsOpen: setIsDropdownOpen } = _a, props = __rest(_a, ["setVat", "vat", "setIsOpen"]);
|
|
21
|
-
const [anchorEl, setAnchorEl] = useState(null);
|
|
22
|
-
const open = Boolean(anchorEl);
|
|
23
|
-
const { t } = useTranslation();
|
|
24
|
-
const toggleDropdown = (e) => {
|
|
25
|
-
e.stopPropagation();
|
|
26
|
-
if (open) {
|
|
27
|
-
setAnchorEl(null);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
setAnchorEl(e.currentTarget);
|
|
31
|
-
};
|
|
32
|
-
return (_jsx(Wrapper, Object.assign({ sx: props.sx }, { children: _jsxs(Option, Object.assign({ sx: (theme) => (Object.assign({}, (open && { boxShadow: theme.shadows[3] }))), className: "option", onClick: toggleDropdown }, { children: [_jsx("span", { children: t('rate') }), _jsx("img", { src: rightArrow, alt: "a" }), _jsx(Menu, Object.assign({ anchorEl: anchorEl, open: open, placement: "right-start" }, { children: _jsx(VATRateDropdown, { onChange: setVat, vat: vat, setIsDropdownOpen: setIsDropdownOpen }) }))] })) })));
|
|
33
|
-
}
|
|
34
|
-
export default memo(VATDropdown);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './VATDropdown';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './VATDropdown';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const Wrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
5
|
-
export declare const Option: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Box, styled } from '@mui/material';
|
|
2
|
-
export const Wrapper = styled(Box)(({ theme }) => ({
|
|
3
|
-
width: 112,
|
|
4
|
-
boxShadow: theme.shadows[16],
|
|
5
|
-
borderRadius: 4,
|
|
6
|
-
backgroundColor: theme.palette.common.white,
|
|
7
|
-
'.option + .option': {
|
|
8
|
-
borderTop: `1px solid ${theme.palette.divider}`,
|
|
9
|
-
},
|
|
10
|
-
zIndex: 3,
|
|
11
|
-
}));
|
|
12
|
-
export const Option = styled(Box)(({ theme }) => ({
|
|
13
|
-
fontSize: '11px',
|
|
14
|
-
paddingInlineStart: theme.spacing(2),
|
|
15
|
-
paddingInlineEnd: theme.spacing(1),
|
|
16
|
-
paddingTop: theme.spacing(1.5),
|
|
17
|
-
paddingBottom: theme.spacing(1.5),
|
|
18
|
-
display: 'flex',
|
|
19
|
-
justifyContent: 'space-between',
|
|
20
|
-
alignItems: 'center',
|
|
21
|
-
gap: theme.spacing(1),
|
|
22
|
-
cursor: 'pointer',
|
|
23
|
-
height: 40,
|
|
24
|
-
input: {
|
|
25
|
-
height: 24,
|
|
26
|
-
width: 47,
|
|
27
|
-
textAlign: 'right',
|
|
28
|
-
},
|
|
29
|
-
'&:hover': {
|
|
30
|
-
boxShadow: theme.shadows[3],
|
|
31
|
-
},
|
|
32
|
-
}));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Vat } from '../../../types/index.js';
|
|
3
|
-
interface VATRateDropdownProps {
|
|
4
|
-
vat: Vat;
|
|
5
|
-
onChange: (value: Vat) => void;
|
|
6
|
-
setIsDropdownOpen: (value: boolean) => void;
|
|
7
|
-
}
|
|
8
|
-
declare function VATRateDropdown({ vat, onChange, setIsDropdownOpen }: Readonly<VATRateDropdownProps>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
declare const _default: import("react").MemoExoticComponent<typeof VATRateDropdown>;
|
|
10
|
-
export default _default;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { Input } from '../../index.js';
|
|
5
|
-
import { checkIcon, RATES } from '../../../constants/index.js';
|
|
6
|
-
import { removeAllCharsFromNumber } from '../../../utils/index.js';
|
|
7
|
-
import { Wrapper, Option } from './style';
|
|
8
|
-
function VATRateDropdown({ vat, onChange, setIsDropdownOpen }) {
|
|
9
|
-
const { t } = useTranslation();
|
|
10
|
-
const { percentage, isInclusive, value } = vat;
|
|
11
|
-
const isNoVAT = percentage === RATES.ZERO;
|
|
12
|
-
const isFivePercent = percentage === RATES.FIVE;
|
|
13
|
-
const isTenPercent = percentage === RATES.TEN;
|
|
14
|
-
const isFifteenPercent = percentage === RATES.FIFTEEN;
|
|
15
|
-
const isCustomPercent = percentage !== RATES.FIVE && percentage !== RATES.TEN && percentage !== RATES.FIFTEEN && percentage !== RATES.ZERO;
|
|
16
|
-
const vatRates = [
|
|
17
|
-
{ label: t('noVat'), value: RATES.ZERO, selected: isNoVAT },
|
|
18
|
-
{ label: '5%', value: RATES.FIVE, selected: isFivePercent },
|
|
19
|
-
{ label: '10%', value: RATES.TEN, selected: isTenPercent },
|
|
20
|
-
{ label: '15%', value: RATES.FIFTEEN, selected: isFifteenPercent },
|
|
21
|
-
];
|
|
22
|
-
const selectRate = (percentageValue) => {
|
|
23
|
-
onChange({ value, percentage: percentageValue, isInclusive });
|
|
24
|
-
};
|
|
25
|
-
const handleCustomRate = (e) => {
|
|
26
|
-
if (Number(e.target.value) > 100)
|
|
27
|
-
return;
|
|
28
|
-
selectRate(Number(removeAllCharsFromNumber(e.target.value)));
|
|
29
|
-
};
|
|
30
|
-
const renderSelectedIcon = (selected) => {
|
|
31
|
-
return selected ? _jsx("img", { src: checkIcon, alt: "check" }) : _jsx("span", {});
|
|
32
|
-
};
|
|
33
|
-
return (_jsxs(Wrapper, { children: [vatRates.map((rate, index) => (_jsxs(Option, Object.assign({ className: "option", onClick: () => {
|
|
34
|
-
selectRate(rate.value);
|
|
35
|
-
setIsDropdownOpen(false);
|
|
36
|
-
} }, { children: [renderSelectedIcon(rate.selected), _jsx("span", { children: rate.label })] }), `${rate.value}-${index}`))), _jsxs(Option, Object.assign({ className: "option" }, { children: [renderSelectedIcon(isCustomPercent), _jsx(Input, { placeholder: "%", value: isCustomPercent ? String(percentage) : '', onChange: handleCustomRate, sx: { justifyContent: 'flex-end' } })] }))] }));
|
|
37
|
-
}
|
|
38
|
-
export default memo(VATRateDropdown);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './VATRateDropdown';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './VATRateDropdown';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const Wrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
5
|
-
export declare const Option: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import Box from '@mui/material/Box';
|
|
2
|
-
import { styled } from '@mui/material/styles';
|
|
3
|
-
export const Wrapper = styled(Box)(({ theme }) => ({
|
|
4
|
-
width: 112,
|
|
5
|
-
'.option + .option': {
|
|
6
|
-
borderTop: `1px solid ${theme.palette.divider}`,
|
|
7
|
-
},
|
|
8
|
-
zIndex: 3,
|
|
9
|
-
}));
|
|
10
|
-
export const Option = styled(Box)(({ theme }) => ({
|
|
11
|
-
fontSize: '11px',
|
|
12
|
-
paddingInlineStart: theme.spacing(2),
|
|
13
|
-
paddingInlineEnd: theme.spacing(1),
|
|
14
|
-
paddingTop: theme.spacing(1.5),
|
|
15
|
-
paddingBottom: theme.spacing(1.5),
|
|
16
|
-
display: 'flex',
|
|
17
|
-
justifyContent: 'space-between',
|
|
18
|
-
alignItems: 'center',
|
|
19
|
-
gap: theme.spacing(1),
|
|
20
|
-
cursor: 'pointer',
|
|
21
|
-
height: 40,
|
|
22
|
-
input: {
|
|
23
|
-
height: 24,
|
|
24
|
-
width: 47,
|
|
25
|
-
textAlign: 'right',
|
|
26
|
-
},
|
|
27
|
-
'&:hover': {
|
|
28
|
-
boxShadow: theme.shadows[3],
|
|
29
|
-
},
|
|
30
|
-
}));
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Vat } from '../../types/index.js';
|
|
2
|
-
export declare const getVatValue: (amount: number, vat: Vat) => number;
|
|
3
|
-
export declare const getItemVat: (vat: Vat, itemPrice: number, quantity: number) => {
|
|
4
|
-
value: number;
|
|
5
|
-
percentage: number;
|
|
6
|
-
isInclusive: boolean;
|
|
7
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const getVatValue = (amount, vat) => {
|
|
2
|
-
let newVatValue = 0;
|
|
3
|
-
if (vat.percentage > 0) {
|
|
4
|
-
newVatValue = amount * (vat.percentage / 100);
|
|
5
|
-
}
|
|
6
|
-
return newVatValue;
|
|
7
|
-
};
|
|
8
|
-
export const getItemVat = (vat, itemPrice, quantity) => (Object.assign(Object.assign({}, vat), { value: getVatValue(Number(itemPrice), vat) * quantity }));
|