@tap-payments/os-micro-frontend-shared 0.1.221-test.1-test.2-test.3 → 0.1.221-test.10
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/LICENSE +21 -21
- package/README.md +12 -12
- package/build/components/RangeCalender/RangeCalender.d.ts +2 -26
- package/build/components/RangeCalender/RangeCalender.js +2 -2
- package/build/components/RangeCalender/components/Timezone/Timezone.d.ts +3 -2
- package/build/components/RangeCalender/components/Timezone/Timezone.js +4 -4
- package/build/components/RangeCalender/components/Timezone/components/EntitiesTimezone.d.ts +3 -6
- package/build/components/RangeCalender/components/Timezone/components/EntitiesTimezone.js +7 -6
- package/build/components/RangeCalender/type.d.ts +26 -0
- package/build/components/TableCells/CustomCells/BalanceCell/BalanceCell.js +1 -1
- package/build/components/TableCells/CustomCells/BalanceCell/BalanceCellSheet.d.ts +1 -1
- package/build/components/TableCells/CustomCells/BalanceCell/BalanceCellSheet.js +4 -2
- package/build/components/TableCells/CustomCells/BalanceCell/BalanceCellText.d.ts +3 -0
- package/build/components/TableCells/CustomCells/BalanceCell/BalanceCellText.js +44 -0
- package/build/components/TableCells/CustomCells/BalanceCell/index.d.ts +1 -0
- package/build/components/TableCells/CustomCells/BalanceCell/index.js +1 -0
- package/build/components/TableCells/CustomCells/BalanceCell/type.d.ts +1 -1
- package/build/constants/table/cell/authorizationTableCellWidth.d.ts +1 -1
- package/build/constants/table/cell/authorizationTableCellWidth.js +1 -1
- package/build/constants/table/cell/refundTableCellWidth.d.ts +1 -1
- package/build/constants/table/cell/refundTableCellWidth.js +1 -1
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/build/utils/timezone.d.ts +2 -0
- package/build/utils/timezone.js +3 -0
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Tap Payments
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tap Payments
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# os-micro-frontend-shared
|
|
2
|
-
|
|
3
|
-
## Publishing Workflow
|
|
4
|
-
|
|
5
|
-
1. Update version in package.json
|
|
6
|
-
2. Commit changes
|
|
7
|
-
3. Create and push a tag:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm version patch # or minor, major
|
|
11
|
-
git push origin main --tags
|
|
12
|
-
```
|
|
1
|
+
# os-micro-frontend-shared
|
|
2
|
+
|
|
3
|
+
## Publishing Workflow
|
|
4
|
+
|
|
5
|
+
1. Update version in package.json
|
|
6
|
+
2. Commit changes
|
|
7
|
+
3. Create and push a tag:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm version patch # or minor, major
|
|
11
|
+
git push origin main --tags
|
|
12
|
+
```
|
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { SxProps } from '@mui/system';
|
|
4
|
-
import type { CalenderMode, Timezone } from '../../types/index.js';
|
|
5
|
-
import { RangeDatepickerProps } from './components/RangeDatepicker';
|
|
6
|
-
interface RangeCalendarProps {
|
|
7
|
-
defaultDate: [Date, Date];
|
|
8
|
-
onDateChange: (date: [Date, Date]) => void;
|
|
9
|
-
mode?: CalenderMode;
|
|
10
|
-
onCalendarModeSwitch?: (mode: CalenderMode) => void;
|
|
11
|
-
numberOfMonths?: number;
|
|
12
|
-
noTimezone?: boolean;
|
|
13
|
-
noQuickFilter?: boolean;
|
|
14
|
-
maxDateRange?: number;
|
|
15
|
-
onCalendarGroupChange?: (value: string) => void;
|
|
16
|
-
groupBy?: string;
|
|
17
|
-
timezone: Timezone | null;
|
|
18
|
-
onChangeTimezone?: (timezone: Timezone) => void;
|
|
19
|
-
defaultTimezone: Timezone;
|
|
20
|
-
browserTimezone: string;
|
|
21
|
-
renderCalendarButton?: (open: boolean, onOpenCalender: (event: MouseEvent<HTMLElement>) => void) => React.ReactNode;
|
|
22
|
-
mainSx?: SxProps;
|
|
23
|
-
popperProps?: Partial<PopperProps>;
|
|
24
|
-
rangeDatePickerProps?: Partial<RangeDatepickerProps>;
|
|
25
|
-
}
|
|
26
|
-
declare function RangeCalender({ defaultDate, onDateChange, mode, onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezone, defaultTimezone, browserTimezone, renderCalendarButton, mainSx, popperProps, rangeDatePickerProps, }: RangeCalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { RangeCalendarProps } from './type';
|
|
2
|
+
declare function RangeCalender({ defaultDate, onDateChange, mode, onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezone, browserTimezone, renderCalendarButton, mainSx, popperProps, rangeDatePickerProps, defaultCountryTimezone, countriesCodes, }: RangeCalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
27
3
|
export default RangeCalender;
|
|
@@ -15,7 +15,7 @@ import CustomTimezone from './components/Timezone';
|
|
|
15
15
|
import { ButtonsWrapper, CalenderWrapper, CancelButton, FiltersArea, Footer, Main, OkayButton, SelectedDate, TimeZone, Settings } from './style';
|
|
16
16
|
import CustomTimePicker from './components/CustomTimepicker';
|
|
17
17
|
import { getDateRange, getEndOfDate, getStartOfDate } from './utils';
|
|
18
|
-
function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezone,
|
|
18
|
+
function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezone, browserTimezone, renderCalendarButton, mainSx, popperProps, rangeDatePickerProps, defaultCountryTimezone, countriesCodes, }) {
|
|
19
19
|
const [dates, setDates] = useState(getDateRange(defaultDate));
|
|
20
20
|
const [values, setValues] = useState(dates);
|
|
21
21
|
const [selectedTimezone, setSelectedTimezone] = useState(timezone);
|
|
@@ -90,6 +90,6 @@ function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalend
|
|
|
90
90
|
onCloseCalender();
|
|
91
91
|
} })), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "bottom-end" }, popperProps, { children: _jsxs(CalenderWrapper, { children: [!noQuickFilter && (_jsxs(FiltersArea, { children: [_jsx(QuickFilters, { onChange: onChangeQuickFilter, isHijri: isHijri }), _jsxs(Settings, { children: [groupBy && (_jsx(GroupBy, { groupBy: selectedGroupBy, isCalenderOpen: open, onUpdate: (group) => {
|
|
92
92
|
setSelectedGroupBy(group);
|
|
93
|
-
} })), _jsx(Hijri, { isHijri: isHijri, onCalendarModeSwitch: onCalendarModeSwitch })] })] })), _jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', justifyContent: 'space-between' } }, { children: [_jsx(RangeDatePicker, Object.assign({ values: values, onChange: onChange, isHijri: isHijri, ref: calendarRef, numberOfMonths: numberOfMonths }, rangeDatePickerProps)), _jsx(Collapse, Object.assign({ in: isError && Boolean(maxDateRange) }, { children: _jsx(Error, { error: t('dateRangeError', { number: maxDateRange }), sx: { marginInline: '16px', marginBottom: '16px' } }) })), _jsxs(Footer, Object.assign({ sx: { borderBottomLeftRadius: '8px' } }, { children: [!noTimezone ? (_jsx(TimeZone, { children: _jsx(CustomTimezone, { onChange: setSelectedTimezone, selectedTimezone: selectedTimezone,
|
|
93
|
+
} })), _jsx(Hijri, { isHijri: isHijri, onCalendarModeSwitch: onCalendarModeSwitch })] })] })), _jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', justifyContent: 'space-between' } }, { children: [_jsx(RangeDatePicker, Object.assign({ values: values, onChange: onChange, isHijri: isHijri, ref: calendarRef, numberOfMonths: numberOfMonths }, rangeDatePickerProps)), _jsx(Collapse, Object.assign({ in: isError && Boolean(maxDateRange) }, { children: _jsx(Error, { error: t('dateRangeError', { number: maxDateRange }), sx: { marginInline: '16px', marginBottom: '16px' } }) })), _jsxs(Footer, Object.assign({ sx: { borderBottomLeftRadius: '8px' } }, { children: [!noTimezone ? (_jsx(TimeZone, { children: _jsx(CustomTimezone, { onChange: setSelectedTimezone, selectedTimezone: selectedTimezone, browserTimezone: browserTimezone, defaultCountryTimezone: defaultCountryTimezone, countriesCodes: countriesCodes }, String(open)) })) : (_jsx("div", {})), new DateObject(values[0]).dayOfYear === new DateObject(values[1]).dayOfYear && (_jsx(CustomTimePicker, { values: values, setValues: setValues })), _jsxs(ButtonsWrapper, { children: [_jsx(CancelButton, Object.assign({ variant: "contained", onClick: onCloseCalender }, { children: t('cancel') })), _jsx(OkayButton, Object.assign({ variant: "contained", onClick: submitDate }, { children: t('okay') }))] })] }))] }))] }) }))] })));
|
|
94
94
|
}
|
|
95
95
|
export default RangeCalender;
|
|
@@ -3,9 +3,10 @@ import type { Timezone } from '../../../../types/index.js';
|
|
|
3
3
|
interface CustomTimezoneProps {
|
|
4
4
|
onChange: (timezone: Timezone) => void;
|
|
5
5
|
selectedTimezone: Timezone | null;
|
|
6
|
-
|
|
6
|
+
defaultCountryTimezone: Timezone;
|
|
7
7
|
browserTimezone: string;
|
|
8
|
+
countriesCodes: string[];
|
|
8
9
|
}
|
|
9
|
-
declare function CustomTimezone({ onChange, selectedTimezone,
|
|
10
|
+
declare function CustomTimezone({ onChange, selectedTimezone, browserTimezone, defaultCountryTimezone, countriesCodes }: CustomTimezoneProps): import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
declare const _default: import("react").MemoExoticComponent<typeof CustomTimezone>;
|
|
11
12
|
export default _default;
|
|
@@ -7,7 +7,7 @@ import { CountryFlag } from '../../../index.js';
|
|
|
7
7
|
import { TimezoneWrapper, TimezoneDropdown, SelectedTimezone } from './style';
|
|
8
8
|
import EntitiesTimezone from './components/EntitiesTimezone';
|
|
9
9
|
import UserTimezone from './components/UserTimezone';
|
|
10
|
-
function CustomTimezone({ onChange, selectedTimezone,
|
|
10
|
+
function CustomTimezone({ onChange, selectedTimezone, browserTimezone, defaultCountryTimezone, countriesCodes }) {
|
|
11
11
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
12
12
|
const open = Boolean(anchorEl);
|
|
13
13
|
const onClose = () => {
|
|
@@ -23,10 +23,10 @@ function CustomTimezone({ onChange, selectedTimezone, defaultTimezone, browserTi
|
|
|
23
23
|
const selectedTimezoneIcon = useMemo(() => {
|
|
24
24
|
if (browserTimezone === (selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone))
|
|
25
25
|
return userTimezoneIcon;
|
|
26
|
-
if ((selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone) ===
|
|
26
|
+
if ((selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone) === defaultCountryTimezone.timezone)
|
|
27
27
|
return entityTimezoneIcon;
|
|
28
28
|
return savedTimezoneIcon;
|
|
29
|
-
}, [browserTimezone,
|
|
30
|
-
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: onClose }, { children: _jsxs(TimezoneWrapper, Object.assign({ "data-testid": "CustomTimezone" }, { children: [_jsxs(SelectedTimezone, Object.assign({ open: open, onClick: onOpen }, { children: [_jsx("img", { src: selectedTimezoneIcon, alt: "timezone-icon" }), _jsx(CountryFlag, { code: selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.countryCode }), _jsx("span", { children: selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.label })] })), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "top-start", sx: { zIndex: 1400 } }, { children: _jsxs(TimezoneDropdown, Object.assign({ "data-testid": "CustomTimezone_dropdown" }, { children: [_jsx(EntitiesTimezone, { onChange: updateTimezone, selectedTimezone: selectedTimezone,
|
|
29
|
+
}, [browserTimezone, defaultCountryTimezone.timezone, selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone]);
|
|
30
|
+
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: onClose }, { children: _jsxs(TimezoneWrapper, Object.assign({ "data-testid": "CustomTimezone" }, { children: [_jsxs(SelectedTimezone, Object.assign({ open: open, onClick: onOpen }, { children: [_jsx("img", { src: selectedTimezoneIcon, alt: "timezone-icon" }), _jsx(CountryFlag, { code: selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.countryCode }), _jsx("span", { children: selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.label })] })), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "top-start", sx: { zIndex: 1400 } }, { children: _jsxs(TimezoneDropdown, Object.assign({ "data-testid": "CustomTimezone_dropdown" }, { children: [_jsx(EntitiesTimezone, { onChange: updateTimezone, selectedTimezone: selectedTimezone, defaultCountryTimezone: defaultCountryTimezone, countriesCodes: countriesCodes }), _jsx(UserTimezone, { onChange: updateTimezone, selectedTimezone: selectedTimezone, browserTimezone: browserTimezone })] })) }))] })) })));
|
|
31
31
|
}
|
|
32
32
|
export default memo(CustomTimezone);
|
|
@@ -2,11 +2,8 @@ import type { Timezone } from '../../../../../types/index.js';
|
|
|
2
2
|
interface EntitiesTimezoneProps {
|
|
3
3
|
selectedTimezone: Timezone | null;
|
|
4
4
|
onChange: (selected: Timezone) => void;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
segmentCountries?: {
|
|
8
|
-
code: string;
|
|
9
|
-
}[];
|
|
5
|
+
countriesCodes?: string[];
|
|
6
|
+
defaultCountryTimezone: Timezone;
|
|
10
7
|
}
|
|
11
|
-
export default function EntitiesTimezone({ selectedTimezone, onChange,
|
|
8
|
+
export default function EntitiesTimezone({ selectedTimezone, onChange, countriesCodes, defaultCountryTimezone }: EntitiesTimezoneProps): import("react/jsx-runtime").JSX.Element;
|
|
12
9
|
export {};
|
|
@@ -3,8 +3,9 @@ import { useMemo, useState } from 'react';
|
|
|
3
3
|
import Popper from '@mui/material/Popper';
|
|
4
4
|
import { entityTimezoneIcon, smallBlueCheckIcon } from '../../../../../constants/index.js';
|
|
5
5
|
import { CountryFlag } from '../../../../index.js';
|
|
6
|
+
import { getTimezoneByCountryCode } from '../../../../../utils/index.js';
|
|
6
7
|
import { Label, Space, TimezoneDropdown, TimezoneElement } from '../style';
|
|
7
|
-
export default function EntitiesTimezone({ selectedTimezone, onChange,
|
|
8
|
+
export default function EntitiesTimezone({ selectedTimezone, onChange, countriesCodes, defaultCountryTimezone }) {
|
|
8
9
|
const [entitiesEl, setEntitiesEl] = useState(null);
|
|
9
10
|
const onMouseEnter = (e) => {
|
|
10
11
|
if (!entitiesEl)
|
|
@@ -18,17 +19,17 @@ export default function EntitiesTimezone({ selectedTimezone, onChange, defaultTi
|
|
|
18
19
|
e.stopPropagation();
|
|
19
20
|
onChange(tz);
|
|
20
21
|
};
|
|
21
|
-
const availableTimezones = useMemo(() =>
|
|
22
|
+
const availableTimezones = useMemo(() => countriesCodes === null || countriesCodes === void 0 ? void 0 : countriesCodes.map((code) => getTimezoneByCountryCode(code)), [countriesCodes]);
|
|
22
23
|
const isSelectedTimezoneOneOFTheAvailable = useMemo(() => availableTimezones === null || availableTimezones === void 0 ? void 0 : availableTimezones.some((item) => (selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone) === (item === null || item === void 0 ? void 0 : item.timezone)), [availableTimezones, selectedTimezone]);
|
|
23
24
|
const entityTimezone = useMemo(() => {
|
|
24
25
|
if (!selectedTimezone)
|
|
25
|
-
return
|
|
26
|
-
return isSelectedTimezoneOneOFTheAvailable ? selectedTimezone :
|
|
27
|
-
}, [selectedTimezone,
|
|
26
|
+
return defaultCountryTimezone;
|
|
27
|
+
return isSelectedTimezoneOneOFTheAvailable ? selectedTimezone : defaultCountryTimezone;
|
|
28
|
+
}, [selectedTimezone, defaultCountryTimezone, isSelectedTimezoneOneOFTheAvailable]);
|
|
28
29
|
return (_jsxs(TimezoneElement, Object.assign({ onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: () => {
|
|
29
30
|
if (selectedTimezone)
|
|
30
31
|
onChange(entityTimezone);
|
|
31
|
-
} }, { children: [isSelectedTimezoneOneOFTheAvailable ? _jsx("img", { src: smallBlueCheckIcon, alt: "icon" }) : _jsx(Space, {}), _jsx("img", { src: entityTimezoneIcon, alt: "entity-timezone" }), _jsx(CountryFlag, { code: entityTimezone === null || entityTimezone === void 0 ? void 0 : entityTimezone.countryCode }), _jsx(Label, Object.assign({ className: isSelectedTimezoneOneOFTheAvailable ? 'selected' : '' }, { children: isSelectedTimezoneOneOFTheAvailable ? selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.label :
|
|
32
|
+
} }, { children: [isSelectedTimezoneOneOFTheAvailable ? _jsx("img", { src: smallBlueCheckIcon, alt: "icon" }) : _jsx(Space, {}), _jsx("img", { src: entityTimezoneIcon, alt: "entity-timezone" }), _jsx(CountryFlag, { code: entityTimezone === null || entityTimezone === void 0 ? void 0 : entityTimezone.countryCode }), _jsx(Label, Object.assign({ className: isSelectedTimezoneOneOFTheAvailable ? 'selected' : '' }, { children: isSelectedTimezoneOneOFTheAvailable ? selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.label : defaultCountryTimezone === null || defaultCountryTimezone === void 0 ? void 0 : defaultCountryTimezone.label })), _jsx(Popper, Object.assign({ open: Boolean(entitiesEl), anchorEl: entitiesEl, placement: "right-start", sx: { zIndex: 3 }, disablePortal: true }, { children: _jsx(TimezoneDropdown, Object.assign({ sx: { maxHeight: 300 } }, { children: availableTimezones === null || availableTimezones === void 0 ? void 0 : availableTimezones.map((timeZone, idx) => {
|
|
32
33
|
const isActive = (timeZone === null || timeZone === void 0 ? void 0 : timeZone.timezone) === (selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone);
|
|
33
34
|
return (_jsxs(TimezoneElement, Object.assign({ onClick: (e) => {
|
|
34
35
|
onSelectTimezone(e, timeZone);
|
|
@@ -1,2 +1,28 @@
|
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
import { PopperProps } from '@mui/material/Popper';
|
|
3
|
+
import { SxProps } from '@mui/system';
|
|
1
4
|
import type { DateObject } from 'react-multi-date-picker';
|
|
5
|
+
import type { CalenderMode, Timezone } from '../../types/index.js';
|
|
6
|
+
import { RangeDatepickerProps } from './components/RangeDatepicker';
|
|
2
7
|
export type Dates = [DateObject, DateObject];
|
|
8
|
+
export interface RangeCalendarProps {
|
|
9
|
+
defaultDate: [Date, Date];
|
|
10
|
+
onDateChange: (date: [Date, Date]) => void;
|
|
11
|
+
mode?: CalenderMode;
|
|
12
|
+
onCalendarModeSwitch?: (mode: CalenderMode) => void;
|
|
13
|
+
numberOfMonths?: number;
|
|
14
|
+
noTimezone?: boolean;
|
|
15
|
+
noQuickFilter?: boolean;
|
|
16
|
+
maxDateRange?: number;
|
|
17
|
+
onCalendarGroupChange?: (value: string) => void;
|
|
18
|
+
groupBy?: string;
|
|
19
|
+
timezone: Timezone | null;
|
|
20
|
+
onChangeTimezone?: (timezone: Timezone) => void;
|
|
21
|
+
defaultCountryTimezone: Timezone;
|
|
22
|
+
browserTimezone: string;
|
|
23
|
+
renderCalendarButton?: (open: boolean, onOpenCalender: (event: MouseEvent<HTMLElement>) => void) => React.ReactNode;
|
|
24
|
+
mainSx?: SxProps;
|
|
25
|
+
popperProps?: Partial<PopperProps>;
|
|
26
|
+
rangeDatePickerProps?: Partial<RangeDatepickerProps>;
|
|
27
|
+
countriesCodes: string[];
|
|
28
|
+
}
|
|
@@ -21,7 +21,7 @@ import { BalanceCellContainer, PercentageContainer } from './style';
|
|
|
21
21
|
import { formatPercentage } from './utils';
|
|
22
22
|
import { PiePercentage } from '../style';
|
|
23
23
|
function BalanceCell(_a) {
|
|
24
|
-
var { percentage
|
|
24
|
+
var { percentage, days, remainingAmount, currency } = _a, props = __rest(_a, ["percentage", "days", "remainingAmount", "currency"]);
|
|
25
25
|
const theme = useTheme();
|
|
26
26
|
const currencyIcon = _jsx(CurrencyIcon, { currency: currency });
|
|
27
27
|
const { integerAmount, decimalAmount } = formatAmountWithCurrency(remainingAmount, currency);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BalanceCellSheetProps } from './type';
|
|
2
|
-
declare function BalanceCellSheet({ remainingAmount, currency, selectionProps }: BalanceCellSheetProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare function BalanceCellSheet({ percentage, remainingAmount, currency, selectionProps }: BalanceCellSheetProps): import("react/jsx-runtime").JSX.Element | null;
|
|
3
3
|
export default BalanceCellSheet;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CurrencyIcon, StatusChipWithCopy } from '../../../index.js';
|
|
3
3
|
import { formatAmountWithCurrency } from '../../../../utils/index.js';
|
|
4
|
-
function BalanceCellSheet({ remainingAmount, currency, selectionProps }) {
|
|
4
|
+
function BalanceCellSheet({ percentage, remainingAmount, currency, selectionProps }) {
|
|
5
5
|
const currencyIcon = _jsx(CurrencyIcon, { currency: currency });
|
|
6
6
|
const { integerAmount, decimalAmount } = formatAmountWithCurrency(remainingAmount, currency);
|
|
7
7
|
const amount = `${integerAmount}.${decimalAmount}`;
|
|
8
|
-
|
|
8
|
+
if (percentage === 0)
|
|
9
|
+
return null;
|
|
10
|
+
return (_jsxs(StatusChipWithCopy, Object.assign({ chipIndex: 0, copyText: `${integerAmount}.${decimalAmount}`, selectionProps: selectionProps }, { children: [percentage, "% | Remaining balance - ", currencyIcon, " ", amount] })));
|
|
9
11
|
}
|
|
10
12
|
export default BalanceCellSheet;
|
|
@@ -0,0 +1,44 @@
|
|
|
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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useMemo } from 'react';
|
|
14
|
+
import { useTheme } from '@mui/material/styles';
|
|
15
|
+
import Tooltip from '../../../Tooltip';
|
|
16
|
+
import { TableCell } from '../../../TableCells';
|
|
17
|
+
import { CurrencyIcon } from '../../../index.js';
|
|
18
|
+
import { formatAmountWithCurrency } from '../../../../utils/index.js';
|
|
19
|
+
import { BalanceCellContainer } from './style';
|
|
20
|
+
import { TextLabel } from '../style';
|
|
21
|
+
function BalanceCellText(_a) {
|
|
22
|
+
var { percentage, days, remainingAmount, currency } = _a, props = __rest(_a, ["percentage", "days", "remainingAmount", "currency"]);
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
const currencyIcon = _jsx(CurrencyIcon, { currency: currency });
|
|
25
|
+
const { integerAmount, decimalAmount } = formatAmountWithCurrency(remainingAmount, currency);
|
|
26
|
+
const amount = `${integerAmount}.${decimalAmount}`;
|
|
27
|
+
const generatedTooltip = useMemo(() => {
|
|
28
|
+
return (_jsxs(_Fragment, { children: ["Remaining Authorized Balance - ", currencyIcon, " ", amount] }));
|
|
29
|
+
}, [remainingAmount, currency]);
|
|
30
|
+
if (percentage === 0)
|
|
31
|
+
return null;
|
|
32
|
+
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx("div", Object.assign({ style: {
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'flex-start',
|
|
36
|
+
gap: '8px',
|
|
37
|
+
} }, { children: _jsx(Tooltip, Object.assign({ title: generatedTooltip }, { children: _jsx(BalanceCellContainer, Object.assign({ whileHover: ['animate', 'fadeIn'], animate: "start", sx: {
|
|
38
|
+
zIndex: 22,
|
|
39
|
+
height: 'auto',
|
|
40
|
+
padding: '0',
|
|
41
|
+
backgroundColor: `${theme.palette.grey.A700}1a`,
|
|
42
|
+
} }, { children: _jsxs(TextLabel, { children: [percentage, "%"] }) })) })) })) })));
|
|
43
|
+
}
|
|
44
|
+
export default BalanceCellText;
|
package/build/utils/index.d.ts
CHANGED
package/build/utils/index.js
CHANGED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { COUNTRIES_TIMEZONES } from '../constants/index.js';
|
|
2
|
+
export const getTimezoneByCountryCode = (code) => COUNTRIES_TIMEZONES.find((country) => country.countryCode === code);
|
|
3
|
+
export const getTimezoneByTimezone = (timezone) => COUNTRIES_TIMEZONES.find((country) => country.timezone === timezone);
|
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.221-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.221-test.10",
|
|
5
|
+
"testVersion": 10,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|