@tap-payments/auth-jsconnect 2.0.28 → 2.0.29

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,13 @@
1
+ import React from 'react';
2
+ import { CalendarProps } from 'react-multi-date-picker';
3
+ import './style.css';
4
+ export interface DatePickerProps extends CalendarProps {
5
+ disabled?: boolean;
6
+ readOnly?: boolean;
7
+ dir?: string;
8
+ onDateChange?: (date: string) => void;
9
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void;
10
+ onDatePicked?: () => void;
11
+ }
12
+ declare const _default: React.MemoExoticComponent<({ disabled, dir, readOnly, onDateChange, onClick, onDatePicked, value, ...rest }: DatePickerProps) => JSX.Element>;
13
+ export default _default;
@@ -0,0 +1,94 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import React, { memo } from 'react';
25
+ import { Calendar, toDateObject } from 'react-multi-date-picker';
26
+ import arabic from 'react-date-object/calendars/arabic';
27
+ import arabic_ar from 'react-date-object/locales/arabic_ar';
28
+ import Box from '@mui/material/Box';
29
+ import { styled } from '@mui/material/styles';
30
+ import Divider from '@mui/material/Divider';
31
+ import Collapse from '../Collapse';
32
+ import ExpandIcon from '../ExpandIcon';
33
+ import CalendarTodayOutlined from '@mui/icons-material/CalendarTodayOutlined';
34
+ import Input from '../Input';
35
+ import Text from '../Text';
36
+ import './style.css';
37
+ var ContainerIcon = styled(CalendarTodayOutlined)(function (_a) {
38
+ var theme = _a.theme;
39
+ return (__assign(__assign({ marginInlineStart: theme.spacing(2.5) }, theme.typography.h6), { cursor: 'pointer', width: theme.spacing(2.5), height: theme.spacing(2.5) }));
40
+ });
41
+ var Container = styled(Box, { shouldForwardProp: function (prop) { return prop !== 'disabled'; } })(function (_a) {
42
+ var theme = _a.theme, disabled = _a.disabled;
43
+ return ({
44
+ cursor: disabled ? 'auto' : 'pointer',
45
+ fontFamily: theme.typography.fontFamily
46
+ });
47
+ });
48
+ var InputFieldStyled = styled(Input)(function (_a) {
49
+ var theme = _a.theme, disabled = _a.disabled;
50
+ return ({
51
+ cursor: disabled ? 'auto' : 'pointer',
52
+ '&::placeholder': __assign(__assign({ opacity: 1, color: theme.palette.text.primary, lineHeight: theme.spacing(2.125) }, theme.typography.body2), { fontWeight: theme.typography.fontWeightLight }),
53
+ '& .MuiInputBase-input': {
54
+ WebkitTextFillColor: 'inherit'
55
+ }
56
+ });
57
+ });
58
+ var ArrowIcon = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'disabled'; } })(function (_a) {
59
+ var theme = _a.theme, disabled = _a.disabled;
60
+ return ({
61
+ cursor: disabled ? 'auto' : 'pointer',
62
+ marginInlineEnd: theme.spacing(2.5)
63
+ });
64
+ });
65
+ var DatePicker = function (_a) {
66
+ var disabled = _a.disabled, dir = _a.dir, readOnly = _a.readOnly, onDateChange = _a.onDateChange, onClick = _a.onClick, onDatePicked = _a.onDatePicked, value = _a.value, rest = __rest(_a, ["disabled", "dir", "readOnly", "onDateChange", "onClick", "onDatePicked", "value"]);
67
+ var _b = React.useState(null), anchor = _b[0], setAnchor = _b[1];
68
+ var calenderIcon = _jsx(ContainerIcon, {});
69
+ var defaultMax = new Date();
70
+ var defaultMin = new Date('1900-01-01');
71
+ var DATE_FORMAT = 'YYYY-MM-DD';
72
+ var toggleCalender = function (event) {
73
+ if (disabled)
74
+ return;
75
+ if (anchor) {
76
+ onDatePicked && onDatePicked();
77
+ setAnchor(null);
78
+ return;
79
+ }
80
+ setAnchor(event.currentTarget);
81
+ onClick && onClick(event);
82
+ };
83
+ var handleOnDateChange = function (date) {
84
+ onDateChange && onDateChange(date.toDate().toLocaleDateString('en-CA'));
85
+ setAnchor(null);
86
+ onDatePicked === null || onDatePicked === void 0 ? void 0 : onDatePicked();
87
+ };
88
+ var formateDate = function (date) {
89
+ var dateObject = toDateObject(date);
90
+ return dateObject.convert(arabic).format(DATE_FORMAT);
91
+ };
92
+ return (_jsxs(Container, __assign({ disabled: disabled, id: 'container-calendar' }, { children: [_jsx(InputFieldStyled, { endAdornment: _jsx(ArrowIcon, __assign({ disabled: disabled }, { children: disabled ? '' : _jsx(ExpandIcon, { anchorEl: !!anchor }) })), value: value ? formateDate(value) : '', placeholder: DATE_FORMAT, onClick: toggleCalender, startAdornment: calenderIcon, disabled: !disabled, readOnly: readOnly, dir: dir }), _jsxs(Collapse, __assign({ in: !!anchor }, { children: [_jsx(Calendar, __assign({ calendar: arabic, locale: arabic_ar, maxDate: defaultMax, minDate: defaultMin, format: DATE_FORMAT, onChange: handleOnDateChange, value: value, className: 'custom-container' }, rest)), _jsx(Divider, {})] }))] })));
93
+ };
94
+ export default memo(DatePicker);
@@ -0,0 +1,2 @@
1
+ import ArabicDatePicker from './ArabicDatePicker';
2
+ export default ArabicDatePicker;
@@ -0,0 +1,2 @@
1
+ import ArabicDatePicker from './ArabicDatePicker';
2
+ export default ArabicDatePicker;
@@ -0,0 +1,24 @@
1
+ .rmdp-wrapper {
2
+ box-shadow: none !important;
3
+ width: 100% !important;
4
+ z-index: 0 !important;
5
+ }
6
+
7
+ .rmdp-day-picker > div {
8
+ width: 100%;
9
+ }
10
+
11
+ .rmdp-calendar {
12
+ width: 100%;
13
+ }
14
+ /* .rmdp-day:not(.rmdp-disabled):not(.rmdp-day-hidden) span:hover {
15
+ background: radial-gradient(circle closest-side, #fafafa 0%, #fafafa 98%, rgba(0, 0, 0, 0) 100%);
16
+ color: black !important;
17
+ background-color: unset !important;
18
+ } */
19
+
20
+ .rmdp-day.rmdp-selected span:not(.highlight) {
21
+ /* background: radial-gradient(circle closest-side, #3a4154 0%, #3a4154 98%, rgba(0, 0, 0, 0) 100%) !important; */
22
+ color: #ffffff !important;
23
+ background-color: black !important;
24
+ }
@@ -95,6 +95,7 @@ var BackButton = styled('button')(function (_a) {
95
95
  height: 44,
96
96
  appearance: 'none',
97
97
  background: 'none',
98
+ pointerEvents: 'auto',
98
99
  border: 'none',
99
100
  color: theme.palette.primary.main,
100
101
  fontSize: theme.typography.body1.fontSize,
@@ -98,6 +98,7 @@ var BackButton = styled('button')(function (_a) {
98
98
  appearance: 'none',
99
99
  background: 'none',
100
100
  border: 'none',
101
+ pointerEvents: 'auto',
101
102
  color: theme.palette.primary.main,
102
103
  fontSize: theme.typography.body1.fontSize,
103
104
  fontWeight: theme.typography.fontWeightMedium,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.0.28",
3
+ "version": "2.0.29",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -90,7 +90,6 @@
90
90
  "jsencrypt": "^2.3.1",
91
91
  "lodash-es": "^4.17.21",
92
92
  "lottie-web": "^5.9.6",
93
- "moment-hijri": "~2.1.2",
94
93
  "react": "^18.2.0",
95
94
  "react-calendar": "~3.7.0",
96
95
  "react-device-detect": "^2.2.2",
@@ -98,6 +97,7 @@
98
97
  "react-dropzone": "^14.2.2",
99
98
  "react-hook-form": "^7.33.1",
100
99
  "react-i18next": "^11.18.1",
100
+ "react-multi-date-picker": "^3.3.4",
101
101
  "react-otp-input": "^2.4.0",
102
102
  "react-redux": "^8.0.2",
103
103
  "react-spring-bottom-sheet": "^3.4.1",