@tap-payments/os-micro-frontend-shared 0.0.121 → 0.0.123

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.
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { BoxProps } from '@mui/material/Box';
3
+ import { PopperPlacementType } from '@mui/material/Popper';
4
+ import { CalendarProps, DateObject } from 'react-multi-date-picker';
5
+ interface CalenderI extends CalendarProps {
6
+ isAr?: boolean;
7
+ value?: DateObject;
8
+ setValue?: (v: DateObject) => void;
9
+ enableTimePicker?: boolean;
10
+ placement?: PopperPlacementType;
11
+ }
12
+ declare function Calender({ isAr, value, setValue, enableTimePicker, placement, ...props }: CalenderI & BoxProps): import("react/jsx-runtime").JSX.Element;
13
+ declare const _default: import("react").MemoExoticComponent<typeof Calender>;
14
+ export default _default;
@@ -0,0 +1,56 @@
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 ClickAwayListener from '@mui/material/ClickAwayListener';
15
+ import Popper from '@mui/material/Popper';
16
+ import { useTranslation } from 'react-i18next';
17
+ import { Calendar, DateObject } from 'react-multi-date-picker';
18
+ import TimePicker, { getDefaultHour, getDefaultMinute } from '../Timepicker';
19
+ import { darkLeftArrowIcon, darkRightArrowIcon } from '../../constants/index.js';
20
+ import { ArrowButton, CalenderWrapper, SelectedDate, Wrapper, ButtonsWrapper, CancelButton, OkayButton, FooterButtonsWrapper } from './style';
21
+ const weekDays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
22
+ function Calender(_a) {
23
+ var { isAr = false, value, setValue, enableTimePicker, placement } = _a, props = __rest(_a, ["isAr", "value", "setValue", "enableTimePicker", "placement"]);
24
+ const [anchorEl, setAnchorEl] = useState(null);
25
+ const [date, setDate] = useState(value ? new DateObject(new Date(value.toLocaleString())) : new DateObject(new Date()));
26
+ const [tempDate, setTempDate] = useState(value ? new DateObject(new Date(value.toLocaleString())) : new DateObject(new Date()));
27
+ const [time, setTime] = useState({ hour: getDefaultHour(), minute: getDefaultMinute() });
28
+ const { t } = useTranslation();
29
+ const open = Boolean(anchorEl);
30
+ const getArrow = (direction) => {
31
+ if (direction === 'right') {
32
+ return isAr ? darkLeftArrowIcon : darkRightArrowIcon;
33
+ }
34
+ return isAr ? darkRightArrowIcon : darkLeftArrowIcon;
35
+ };
36
+ const onOpen = (e) => {
37
+ setAnchorEl(e.currentTarget);
38
+ };
39
+ const handleClose = () => {
40
+ setAnchorEl(null);
41
+ };
42
+ const handleSubmit = () => {
43
+ const dateValue = enableTimePicker ? tempDate.setHour(time.hour).setMinute(time.minute) : tempDate;
44
+ setDate(dateValue);
45
+ if (setValue)
46
+ setValue(dateValue);
47
+ handleClose();
48
+ };
49
+ const onChangeTimepicker = (newTime) => {
50
+ setTime(newTime);
51
+ };
52
+ return (_jsx(ClickAwayListener, Object.assign({ onClickAway: handleClose }, { children: _jsxs(Wrapper, Object.assign({ sx: Object.assign({}, props.sx) }, { children: [_jsx(SelectedDate, Object.assign({ onClick: onOpen, open: open, className: "date-button" }, { children: date.format('MMM D, YYYY') })), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: placement }, { children: _jsxs(CalenderWrapper, Object.assign({ className: "calender-content", open: open }, { children: [_jsx(Calendar, Object.assign({ numberOfMonths: 1, format: "MMM DD", monthYearSeparator: ' ', renderButton: (direction, handleClick) => (_jsx(ArrowButton, Object.assign({ onClick: handleClick }, { children: _jsx("img", { src: getArrow(direction), alt: "arrow" }) }))), onChange: (v) => {
53
+ setTempDate(v);
54
+ }, weekDays: !isAr ? weekDays : undefined, minDate: new Date(), value: date }, props)), _jsxs(ButtonsWrapper, Object.assign({ sx: Object.assign({}, (enableTimePicker && { justifyContent: 'space-between' })) }, { children: [enableTimePicker && _jsx(TimePicker, { onChange: onChangeTimepicker }), _jsxs(FooterButtonsWrapper, { children: [_jsx(CancelButton, Object.assign({ variant: "contained", onClick: handleClose }, { children: t('cancel') })), _jsx(OkayButton, Object.assign({ variant: "contained", onClick: handleSubmit }, { children: t('okay') }))] })] }))] })) }))] })) })));
55
+ }
56
+ export default memo(Calender);
@@ -0,0 +1,2 @@
1
+ import Calender from './Calender';
2
+ export default Calender;
@@ -0,0 +1,2 @@
1
+ import Calender from './Calender';
2
+ export default Calender;
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ export declare const ArrowButton: import("@emotion/styled").StyledComponent<import("@mui/material/Button").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
3
+ ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
4
+ }, "disabled" | "className" | "style" | "classes" | "color" | "children" | "sx" | "tabIndex" | "size" | "variant" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "href" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
5
+ 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"> & {
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>, {}, {}>;
8
+ export declare const CalenderWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").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/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
11
+ open: boolean;
12
+ }, {}, {}>;
13
+ export declare const SelectedDate: import("@emotion/styled").StyledComponent<import("@mui/material/Button").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
14
+ ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
15
+ }, "disabled" | "className" | "style" | "classes" | "color" | "children" | "sx" | "tabIndex" | "size" | "variant" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "href" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
16
+ open: boolean;
17
+ }, {}, {}>;
18
+ export declare const ButtonsWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
19
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
20
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
21
+ export declare const CancelButton: import("@emotion/styled").StyledComponent<import("@mui/material/Button").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
22
+ ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
23
+ }, "disabled" | "className" | "style" | "classes" | "color" | "children" | "sx" | "tabIndex" | "size" | "variant" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "href" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
24
+ export declare const OkayButton: import("@emotion/styled").StyledComponent<import("@mui/material/Button").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
25
+ ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
26
+ }, "disabled" | "className" | "style" | "classes" | "color" | "children" | "sx" | "tabIndex" | "size" | "variant" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "href" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
27
+ export declare const FooterButtonsWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
28
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
29
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -0,0 +1,171 @@
1
+ import Box from '@mui/material/Box';
2
+ import Button from '@mui/material/Button';
3
+ import { styled } from '@mui/material/styles';
4
+ export const ArrowButton = styled(Button)(() => ({
5
+ minWidth: 'auto',
6
+ padding: 0,
7
+ '& > img': {
8
+ cursor: 'pointer',
9
+ },
10
+ }));
11
+ export const Wrapper = styled(Box)(() => ({
12
+ position: 'relative',
13
+ }));
14
+ export const CalenderWrapper = styled(Box, { shouldForwardProp: (props) => props !== 'open' })(({ open, theme }) => ({
15
+ display: open ? 'flex' : 'none',
16
+ flexDirection: 'column',
17
+ background: theme.palette.common.white,
18
+ boxShadow: theme.shadows[9],
19
+ borderRadius: theme.spacing(1),
20
+ top: 37,
21
+ color: theme.palette.text.primary,
22
+ fontSize: '11px',
23
+ margin: '8px 0',
24
+ '.rmdp-calendar': {
25
+ padding: '8px 16px 16px',
26
+ },
27
+ '.rmdp-rtl *': {
28
+ fontFamily: 'Tajawal',
29
+ },
30
+ '.rmdp-rtl .sd': {
31
+ paddingTop: '4px',
32
+ },
33
+ '.rmdp-wrapper': {
34
+ position: 'relative',
35
+ borderRadius: '8px',
36
+ boxShadow: 'none',
37
+ },
38
+ '.rmdp-day span': {
39
+ fontSize: '11px',
40
+ fontWeight: 500,
41
+ },
42
+ '.rmdp-day, .rmdp-week-day': {
43
+ width: 40,
44
+ height: 40,
45
+ marginBottom: '2px',
46
+ padding: '4px',
47
+ fontSize: '11px',
48
+ color: theme.palette.grey[900],
49
+ },
50
+ '.rmdp-day-picker': {
51
+ padding: 0,
52
+ },
53
+ '.rmdp-day.rmdp-today span': {
54
+ backgroundColor: 'transparent',
55
+ color: theme.palette.info.dark,
56
+ },
57
+ '.rmdp-day.rmdp-today.end span, .rmdp-day.rmdp-today.end span': {
58
+ color: theme.palette.common.white,
59
+ },
60
+ '.rmdp-range, .rmdp-day:not(.rmdp-disabled):not(.rmdp-day-hidden) span:hover': {
61
+ background: theme.palette.info.light,
62
+ boxShadow: 'none',
63
+ color: theme.palette.grey[900],
64
+ },
65
+ '.rmdp-range-hover.start, .rmdp-range.start, .rmdp-range-hover.end, .rmdp-range.end, .rmdp-rtl .rmdp-range-hover.start, .rmdp-rtl .rmdp-range.start, .rmdp-rtl .rmdp-range-hover.end, .rmdp-rtl .rmdp-range.end': {
66
+ borderRadius: '50%',
67
+ background: theme.palette.background.gradient.darkShadedBlue,
68
+ color: theme.palette.common.white,
69
+ },
70
+ '.rmdp-range.start:after': {
71
+ content: '""',
72
+ position: 'absolute',
73
+ background: theme.palette.info.light,
74
+ height: '100%',
75
+ width: '50%',
76
+ right: 0,
77
+ top: 0,
78
+ zIndex: -1,
79
+ },
80
+ '.rmdp-rtl .rmdp-range.start:after': {
81
+ right: 'unset',
82
+ left: 0,
83
+ },
84
+ '.rmdp-range.end:after': {
85
+ content: '""',
86
+ position: 'absolute',
87
+ background: theme.palette.info.light,
88
+ height: '100%',
89
+ width: '50%',
90
+ left: 0,
91
+ top: 0,
92
+ zIndex: -1,
93
+ },
94
+ '.rmdp-rtl .rmdp-range.end:after': {
95
+ left: 'unset',
96
+ right: 0,
97
+ },
98
+ '.rmdp-week-day': {
99
+ color: theme.palette.grey[700],
100
+ marginBottom: '4px',
101
+ fontSize: '11px',
102
+ padding: '4px',
103
+ },
104
+ '.rmdp-header-values': {
105
+ color: theme.palette.grey[900],
106
+ fontSize: '12px',
107
+ fontWeight: 500,
108
+ lineHeight: '20px',
109
+ letterSpacing: '0.1px',
110
+ },
111
+ '.rmdp-header-values span:nth-of-type(2)': {
112
+ display: 'none',
113
+ },
114
+ '.rmdp-header': {
115
+ padding: '4px 0',
116
+ margin: 0,
117
+ fontSize: '12px',
118
+ },
119
+ '.rmdp-top-class': {
120
+ display: 'block !important',
121
+ },
122
+ '.rmdp-day.rmdp-selected span:not(.highlight)': {
123
+ background: theme.palette.info.dark,
124
+ },
125
+ '.rmdp-day.start.end': {
126
+ overflow: 'hidden',
127
+ },
128
+ }));
129
+ export const SelectedDate = styled(Button, { shouldForwardProp: (props) => props !== 'open' })(({ open, theme }) => (Object.assign({ color: theme.palette.text.primary, fontSize: '11px', fontWeight: 500, padding: theme.spacing(1), borderRadius: '4px', border: '1px solid', borderColor: theme.palette.divider, background: theme.palette.common.white, textTransform: 'none', height: 32 }, (open && { border: '1px solid', borderColor: theme.palette.info.dark, boxShadow: theme.shadows[7] }))));
130
+ export const ButtonsWrapper = styled(Box)(({ theme }) => ({
131
+ display: 'flex',
132
+ justifyContent: 'flex-end',
133
+ alignItems: 'center',
134
+ gap: 8,
135
+ padding: '16px',
136
+ borderTop: `1px solid ${theme.palette.divider}`,
137
+ }));
138
+ export const CancelButton = styled(Button)(({ theme }) => ({
139
+ textTransform: 'capitalize',
140
+ padding: '8px 24px',
141
+ width: 75,
142
+ height: 32,
143
+ fontSize: '11px',
144
+ background: 'transparent',
145
+ color: theme.palette.text.primary,
146
+ border: '1px solid',
147
+ borderColor: theme.palette.divider,
148
+ fontWeight: 500,
149
+ borderRadius: '4px',
150
+ '&:hover': {
151
+ background: 'transparent',
152
+ color: theme.palette.text.primary,
153
+ },
154
+ }));
155
+ export const OkayButton = styled(Button)(({ theme }) => ({
156
+ textTransform: 'capitalize',
157
+ padding: '8px 24px',
158
+ width: 75,
159
+ height: 32,
160
+ fontSize: '11px',
161
+ borderRadius: '4px',
162
+ fontWeight: 700,
163
+ background: theme.palette.info.dark,
164
+ '&:hover': {
165
+ background: theme.palette.info.dark,
166
+ },
167
+ }));
168
+ export const FooterButtonsWrapper = styled(Box)(() => ({
169
+ display: 'flex',
170
+ gap: '8px',
171
+ }));
@@ -12,9 +12,9 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { memo } from 'react';
14
14
  import Box from '@mui/material/Box';
15
- import { defaultCountryIcon, getCountriesIcon } from '../../constants/index.js';
15
+ import { defaultCountryIcon } from '../../constants/index.js';
16
16
  function CountryFlag(_a) {
17
17
  var { code } = _a, props = __rest(_a, ["code"]);
18
- return (_jsx(Box, Object.assign({}, props, { component: "img", src: code ? getCountriesIcon(code) : defaultCountryIcon, alt: code, sx: Object.assign(Object.assign({ width: 16 }, (code && { height: 12, borderRadius: '3px' })), props.sx), loading: "lazy" })));
18
+ return (_jsx(Box, Object.assign({}, props, { component: "img", src: code || defaultCountryIcon, alt: code, sx: Object.assign(Object.assign({ width: 16 }, (code && { height: 12, borderRadius: '3px' })), props.sx), loading: "lazy" })));
19
19
  }
20
20
  export default memo(CountryFlag);
@@ -5,10 +5,10 @@ import { Typography, Checkbox } from '@mui/material';
5
5
  import { ChevronIcon } from '../TableHeader_V2/components/StatusButtons/ChevronIcon';
6
6
  import StyledBadge, { BadgeVariants } from '../CountBadge';
7
7
  import CountryFlag from '../CountryFlag';
8
- import { formatNumber } from '../../utils/index.js';
8
+ import { formatNumber, getCurrencyCodeFlag } from '../../utils/index.js';
9
9
  import { closeXIcon } from '../../constants/index.js';
10
10
  import { ChevronContainer, Label, LabelWrapper, StyledDropdown, MenuItemContainer, CheckboxStyles, StyledStatusButton, ClearIcon, ChevronIconWrapper, } from './style';
11
- function MultiSelectStatusButton({ options, selectedValues, onSelectionChange, label, variant = 'inActive' }) {
11
+ function MultiSelectStatusButton({ options = [], selectedValues, onSelectionChange, label, variant = 'inActive' }) {
12
12
  const { t } = useTranslation();
13
13
  const [anchorEl, setAnchorEl] = useState(null);
14
14
  const buttonRef = useRef(null);
@@ -63,7 +63,7 @@ function MultiSelectStatusButton({ options, selectedValues, onSelectionChange, l
63
63
  const countBadge = (_jsx(StyledBadge, Object.assign({ pointer: true, variant: variant === 'active' ? BadgeVariants.ACTIVE : BadgeVariants.INACTIVE }, { children: formatNumber(selectedValues.length > 0 ? selectedValues.length : options.length) })));
64
64
  return (_jsxs(_Fragment, { children: [_jsx(StyledStatusButton, Object.assign({ buttonVariant: variant, ref: buttonRef, sx: {
65
65
  paddingInlineEnd: '27px',
66
- }, "data-testid": "MultiSelectStatusButton", onClick: handleDropdownClick, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false) }, { children: _jsxs(LabelWrapper, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [getDisplayLabel(), countBadge] })), _jsxs(ChevronContainer, Object.assign({ onClick: isHovered && internalSelectedValues.length > 0 ? handleClearAll : undefined, sx: {
66
+ }, "data-testid": "MultiSelectStatusButton", onClick: handleDropdownClick, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), disabled: !options.length }, { children: _jsxs(LabelWrapper, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [getDisplayLabel(), countBadge] })), _jsxs(ChevronContainer, Object.assign({ onClick: isHovered && internalSelectedValues.length > 0 ? handleClearAll : undefined, sx: {
67
67
  '&:hover': {
68
68
  backgroundColor: 'transparent',
69
69
  },
@@ -85,7 +85,7 @@ function MultiSelectStatusButton({ options, selectedValues, onSelectionChange, l
85
85
  var _a;
86
86
  e.stopPropagation();
87
87
  handleOptionToggle((_a = option.status) !== null && _a !== void 0 ? _a : '', e);
88
- } }), _jsx(CountryFlag, { code: option.flagCode || option.code, sx: { border: '1px solid white', borderRadius: '3px' } }), _jsx(Typography, Object.assign({ variant: "body2" }, { children: option.name }))] })),
88
+ } }), _jsx(CountryFlag, { code: getCurrencyCodeFlag(option.code), sx: { border: '1px solid white', borderRadius: '3px' } }), _jsx(Typography, Object.assign({ variant: "body2" }, { children: option.name }))] })),
89
89
  onClick: (e) => {
90
90
  var _a;
91
91
  e.preventDefault();
@@ -8,6 +8,9 @@ export const StyledStatusButton = styled(Button, {
8
8
  ? {
9
9
  background: theme.palette.background.gradient.shadedBlue,
10
10
  color: theme.palette.common.white,
11
+ '&:disabled': {
12
+ color: theme.palette.common.white,
13
+ },
11
14
  }
12
15
  : {
13
16
  backgroundColor: theme.palette.common.white,
@@ -16,6 +19,9 @@ export const StyledStatusButton = styled(Button, {
16
19
  '&:hover': {
17
20
  backgroundColor: 'white',
18
21
  },
22
+ '&:disabled': {
23
+ color: theme.palette.text.primary,
24
+ },
19
25
  }))));
20
26
  export const FlagContainer = styled(Box)(({ theme }) => ({
21
27
  display: 'flex',
@@ -0,0 +1,9 @@
1
+ export type Time = {
2
+ hour: number;
3
+ minute: number;
4
+ };
5
+ interface TimePickerProps {
6
+ onChange?: (time: Time) => void;
7
+ }
8
+ export declare function TimePicker({ onChange }: TimePickerProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,79 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useCallback } from 'react';
3
+ import ClickAwayListener from '@mui/material/ClickAwayListener';
4
+ import Box from '@mui/material/Box';
5
+ import Menu from '../Menu';
6
+ import Text from '../Text';
7
+ import { greyUpArrowIcon, greyDownArrowIcon } from '../../constants/index.js';
8
+ import { Arrow, Button, Period, PeriodWrapper, Wrapper, Time, TimeWrapper, Input } from './style';
9
+ import { getDefaultHour, getDefaultMinute } from './utils';
10
+ import { maxHour, maxMinute, periodList } from './constant';
11
+ export function TimePicker({ onChange }) {
12
+ const [anchorEl, setAnchorEl] = useState(null);
13
+ const [period, setPeriod] = useState(new Date().getHours() >= maxHour ? 'PM' : 'AM');
14
+ const [hours, setHours] = useState(getDefaultHour());
15
+ const [minutes, setMinutes] = useState(getDefaultMinute());
16
+ const open = Boolean(anchorEl);
17
+ const onOpen = (e) => {
18
+ setAnchorEl(e.currentTarget);
19
+ };
20
+ const onClose = () => {
21
+ setAnchorEl(null);
22
+ onChange === null || onChange === void 0 ? void 0 : onChange({ hour: period === 'PM' ? hours + 12 : hours, minute: minutes });
23
+ };
24
+ const onClickPeriod = (selectedPeriod) => {
25
+ setPeriod(selectedPeriod);
26
+ };
27
+ const onChangeHours = (e) => {
28
+ const value = Number(e.target.value);
29
+ if (value > maxHour) {
30
+ e.preventDefault();
31
+ return;
32
+ }
33
+ setHours(Number(e.target.value));
34
+ };
35
+ const onIncreaseHours = () => {
36
+ setHours((prev) => {
37
+ if (prev === maxHour)
38
+ return 1;
39
+ return prev + 1;
40
+ });
41
+ };
42
+ const onDecreaseHours = () => {
43
+ setHours((prev) => {
44
+ if (prev === 1)
45
+ return maxHour;
46
+ return prev - 1;
47
+ });
48
+ };
49
+ const onChangeMinutes = (e) => {
50
+ const value = Number(e.target.value);
51
+ if (value > maxMinute) {
52
+ e.preventDefault();
53
+ return;
54
+ }
55
+ setMinutes(value);
56
+ };
57
+ const onIncreaseMinutes = () => {
58
+ setMinutes((prev) => {
59
+ if (prev === maxMinute) {
60
+ onIncreaseHours();
61
+ return 0;
62
+ }
63
+ return prev + 1;
64
+ });
65
+ };
66
+ const onDecreaseMinutes = () => {
67
+ setMinutes((prev) => {
68
+ if (prev === 0) {
69
+ onDecreaseHours();
70
+ return maxMinute;
71
+ }
72
+ return prev - 1;
73
+ });
74
+ };
75
+ const formatTime = useCallback((time) => (time < 10 ? `0${time}` : time), []);
76
+ return (_jsx(ClickAwayListener, Object.assign({ onClickAway: onClose }, { children: _jsxs(Box, { children: [_jsx(Button, Object.assign({ open: open, onClick: onOpen }, { children: `${formatTime(hours)}:${formatTime(minutes)}${period.toLowerCase()}` })), _jsx(Menu, Object.assign({ open: open, anchorEl: anchorEl, placement: "top-start", sx: { marginTop: '8px', marginBottom: '8px' } }, { children: _jsxs(Wrapper, { children: [_jsxs(TimeWrapper, { children: [_jsxs(Time, { children: [_jsx(Arrow, Object.assign({ onClick: onIncreaseHours }, { children: _jsx("img", { src: greyUpArrowIcon, alt: "arrow" }) })), _jsx(Input, { value: formatTime(hours), onChange: onChangeHours }), _jsx(Arrow, Object.assign({ onClick: onDecreaseHours }, { children: _jsx("img", { src: greyDownArrowIcon, alt: "arrow" }) }))] }), _jsx(Text, { children: ":" }), _jsxs(Time, { children: [_jsx(Arrow, Object.assign({ onClick: onIncreaseMinutes }, { children: _jsx("img", { src: greyUpArrowIcon, alt: "arrow" }) })), _jsx(Input, { value: formatTime(minutes), onChange: onChangeMinutes }), _jsx(Arrow, Object.assign({ onClick: onDecreaseMinutes }, { children: _jsx("img", { src: greyDownArrowIcon, alt: "arrow" }) }))] })] }), _jsx(PeriodWrapper, { children: periodList.map((item) => (_jsx(Period, Object.assign({ onClick: () => {
77
+ onClickPeriod(item);
78
+ }, selected: period === item }, { children: item }), item))) })] }) }))] }) })));
79
+ }
@@ -0,0 +1,3 @@
1
+ export declare const periodList: string[];
2
+ export declare const maxHour = 12;
3
+ export declare const maxMinute = 59;
@@ -0,0 +1,3 @@
1
+ export const periodList = ['AM', 'PM'];
2
+ export const maxHour = 12;
3
+ export const maxMinute = 59;
@@ -0,0 +1,4 @@
1
+ import { TimePicker } from './Timepicker';
2
+ export * from './utils';
3
+ export * from './Timepicker';
4
+ export default TimePicker;
@@ -0,0 +1,4 @@
1
+ import { TimePicker } from './Timepicker';
2
+ export * from './utils';
3
+ export * from './Timepicker';
4
+ export default TimePicker;
@@ -0,0 +1,34 @@
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 Button: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
6
+ ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
7
+ }, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "textAlign" | "className" | "style" | "classes" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "boxShadow" | "maxWidth" | "minWidth" | "maxHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textTransform" | "children" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & {
8
+ component?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
9
+ } & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
10
+ open: boolean;
11
+ }, {}, {}>;
12
+ export declare const Arrow: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
13
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
14
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
15
+ export declare const Period: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
16
+ ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
17
+ }, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "textAlign" | "className" | "style" | "classes" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "boxShadow" | "maxWidth" | "minWidth" | "maxHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textTransform" | "children" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & {
18
+ component?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
19
+ } & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
20
+ selected: boolean;
21
+ }, {}, {}>;
22
+ export declare const PeriodWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
23
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
24
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
25
+ export declare const TimeWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
26
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
27
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
28
+ export declare const Time: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
29
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
30
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
31
+ export declare const Input: import("@emotion/styled").StyledComponent<Omit<Readonly<import("@mui/material").InputProps & {
32
+ isError?: boolean | undefined;
33
+ hideArrows?: boolean | undefined;
34
+ }>, "ref"> & import("react").RefAttributes<HTMLInputElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -0,0 +1,45 @@
1
+ import Box from '@mui/material/Box';
2
+ import { styled, alpha } from '@mui/material/styles';
3
+ import Text from '../Text';
4
+ import InputNumber from '../InputNumber';
5
+ export const Wrapper = styled(Box)(() => ({
6
+ width: 157,
7
+ padding: '16px',
8
+ display: 'flex',
9
+ alignItems: 'center',
10
+ justifyContent: 'center',
11
+ gap: '16px',
12
+ }));
13
+ export const Button = styled(Text, { shouldForwardProp: (props) => props !== 'open' })(({ theme, open }) => (Object.assign({ fontSize: '11px', fontWeight: 500, background: theme.palette.common.white, border: `1px solid ${theme.palette.divider}`, borderRadius: '19px', height: 32, width: 74, display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer' }, (open && { boxShadow: '0px 0px 4px 0px #1F88D080', borderColor: theme.palette.info.dark }))));
14
+ export const Arrow = styled(Box)(() => ({
15
+ textAlign: 'center',
16
+ cursor: 'pointer',
17
+ userSelect: 'none',
18
+ }));
19
+ export const Period = styled(Text, { shouldForwardProp: (props) => props !== 'selected' })(({ theme, selected }) => (Object.assign({ fontSize: '11px', fontWeight: 500, background: theme.palette.common.white, border: `1px solid ${theme.palette.divider}`, borderRadius: '4px', height: 24, width: 33, display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer' }, (selected && {
20
+ borderColor: 'transparent',
21
+ color: theme.palette.info.dark,
22
+ backgroundColor: alpha(theme.palette.info.dark, 0.1),
23
+ }))));
24
+ export const PeriodWrapper = styled(Box)(() => ({
25
+ display: 'flex',
26
+ flexDirection: 'column',
27
+ gap: '4px',
28
+ }));
29
+ export const TimeWrapper = styled(Box)(() => ({
30
+ display: 'flex',
31
+ alignItems: 'center',
32
+ justifyContent: 'center',
33
+ gap: '4px',
34
+ }));
35
+ export const Time = styled(Box)(() => ({
36
+ display: 'flex',
37
+ flexDirection: 'column',
38
+ justifyContent: 'center',
39
+ gap: '6px',
40
+ }));
41
+ export const Input = styled(InputNumber)(() => ({
42
+ '.MuiInput-input': { fontWeight: '500', fontSize: '11px' },
43
+ height: 32,
44
+ width: 32,
45
+ }));
@@ -0,0 +1,2 @@
1
+ export declare const getDefaultMinute: () => number;
2
+ export declare const getDefaultHour: () => number;
@@ -0,0 +1,2 @@
1
+ export const getDefaultMinute = () => new Date().getMinutes();
2
+ export const getDefaultHour = () => (new Date().getHours() > 12 ? new Date().getHours() - 12 : new Date().getHours());
@@ -4,6 +4,8 @@ export { default as ActivityAreaChart, type ActivityAreaChartProps, type ChartDa
4
4
  export { default as AppWindowWrapper, type AccountHeaderProps, AccountHeaderTitle, AppWindow, type AccountHeaderTitleProps, type AppWindowProps, type WindowProps, AppWindowContext, AppWindowContextProvider, LEFT_SIDEBAR, RIGHT_SIDEBAR, VIEWER_HEIGHT, VIEWER_WIDTH, animationDuration, StyledFooter, StyledHideButton, StyledMenuLink, StyledSubmitButton, SubmitButtonWrapper, } from './AppWindowWrapper';
5
5
  export { default as BackgroundAnimation, type BlobGradient, type Blob } from './BackgroundAnimation';
6
6
  export { default as Button, PlusButton } from './Button';
7
+ export { default as Calender } from './Calender';
8
+ export { default as Timepicker } from './Timepicker';
7
9
  export { default as CardEmptyState, type CardEmptyStateProps } from './CardEmptyState';
8
10
  export { default as CardHeadline } from './CardHeadline';
9
11
  export { default as Checkbox } from './Checkbox';
@@ -4,6 +4,8 @@ export { default as ActivityAreaChart, ChartTooltip, LoadingChart, } from './Act
4
4
  export { default as AppWindowWrapper, AccountHeaderTitle, AppWindow, AppWindowContext, AppWindowContextProvider, LEFT_SIDEBAR, RIGHT_SIDEBAR, VIEWER_HEIGHT, VIEWER_WIDTH, animationDuration, StyledFooter, StyledHideButton, StyledMenuLink, StyledSubmitButton, SubmitButtonWrapper, } from './AppWindowWrapper';
5
5
  export { default as BackgroundAnimation } from './BackgroundAnimation';
6
6
  export { default as Button, PlusButton } from './Button';
7
+ export { default as Calender } from './Calender';
8
+ export { default as Timepicker } from './Timepicker';
7
9
  export { default as CardEmptyState } from './CardEmptyState';
8
10
  export { default as CardHeadline } from './CardHeadline';
9
11
  export { default as Checkbox } from './Checkbox';
@@ -488,3 +488,5 @@ export declare const terminalDeviceFrame: string;
488
488
  export declare const blackBrushIcon: string;
489
489
  export declare const mutedOutlinedCheckIcon: string;
490
490
  export declare const outlinedPlatformIcon: string;
491
+ export declare const greyUpArrowIcon: string;
492
+ export declare const greyDownArrowIcon: string;
@@ -492,3 +492,5 @@ export const terminalDeviceFrame = `${lightUrl}/terminalDeviceFrame.svg`;
492
492
  export const blackBrushIcon = `${lightUrl}/blackBrushIcon.svg`;
493
493
  export const mutedOutlinedCheckIcon = `${lightUrl}/mutedOutlinedCheckIcon.svg`;
494
494
  export const outlinedPlatformIcon = `${lightUrl}/outlinedPlatformIcon.svg`;
495
+ export const greyUpArrowIcon = `${lightUrl}/greyUpArrow.svg`;
496
+ export const greyDownArrowIcon = `${lightUrl}/greyDownArrow.svg`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
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.0.121",
4
+ "version": "0.0.123",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
7
7
  "module": "build/index.js",