chore: format webapp files

This commit is contained in:
Ahmed Bouhuolia
2026-05-31 23:35:10 +02:00
parent ef9c93cbf9
commit ed48a2cbdb
1288 changed files with 10396 additions and 5738 deletions

View File

@@ -6,5 +6,5 @@
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2,
"useTabs": false,
"useTabs": false
}

View File

@@ -133,6 +133,7 @@
"@vitejs/plugin-legacy": "^5.4.2",
"@vitejs/plugin-react": "^4.3.4",
"eslint-config-react-app": "^7.0.1",
"prettier": "^3.3.3",
"vite": "^5.1.6"
},
"scripts": {

View File

@@ -19,7 +19,7 @@ interface Account {
account_normal?: string;
}
export interface AccountSelect extends Partial<Account>, SelectOptionProps { }
export interface AccountSelect extends Partial<Account>, SelectOptionProps {}
type MultiSelectProps = React.ComponentProps<typeof FMultiSelect>;

View File

@@ -1,6 +1,6 @@
// @ts-nocheck
import { AccountSelect } from "./AccountsMultiSelect";
import { AccountSelect } from './AccountsMultiSelect';
// Filters accounts items.
export const accountPredicate = (

View File

@@ -14,11 +14,7 @@ export function AdvancedFilterPopover({
return (
<Popover
minimal={true}
content={
<AdvancedFilterDropdown
{...advancedFilterProps}
/>
}
content={<AdvancedFilterDropdown {...advancedFilterProps} />}
interactionKind={PopoverInteractionKind.CLICK}
position={Position.BOTTOM_LEFT}
canOutsideClickClose={true}

View File

@@ -106,7 +106,6 @@ export interface IAdvancedFilterPopover {
children: JSX.Element | JSX.Element[];
}
export interface IDynamicFilterCompatatorFieldProps {
dataType: string;
}

View File

@@ -54,25 +54,21 @@ export const getNumberCampatators = () => [
{ value: 'smaller_or_equal', label: intl.get('smaller_or_equals') },
];
export const getConditionTypeCompatators = (
dataType,
) => {
export const getConditionTypeCompatators = (dataType) => {
return [
...(dataType === 'enumeration'
? [...getOptionsCompatators()]
: dataType === 'date'
? [...getDateCompatators()]
: dataType === 'boolean'
? [...getBooleanCompatators()]
: dataType === 'number'
? [...getNumberCampatators()]
: [...getTextCompatators()]),
? [...getDateCompatators()]
: dataType === 'boolean'
? [...getBooleanCompatators()]
: dataType === 'number'
? [...getNumberCampatators()]
: [...getTextCompatators()]),
];
};
export const getConditionDefaultCompatator = (
dataType,
) => {
export const getConditionDefaultCompatator = (dataType) => {
const compatators = getConditionTypeCompatators(dataType);
return compatators[0];
};
@@ -89,14 +85,11 @@ export const transformFieldsToOptions = (fields) =>
* @param {IFilterRole[]} conditions
* @returns
*/
export const filterConditionRoles = (
conditions,
) => {
export const filterConditionRoles = (conditions) => {
const requiredProps = ['fieldKey', 'condition', 'comparator', 'value'];
const filteredConditions = conditions.filter(
(condition) =>
!checkRequiredProperties(condition, requiredProps),
(condition) => !checkRequiredProperties(condition, requiredProps),
);
return uniqueMultiProps(filteredConditions, requiredProps);
};
@@ -110,4 +103,4 @@ export const shouldFilterValueFieldUpdate = (newProps, oldProps) => {
newProps.fieldKey !== oldProps.fieldKey ||
defaultFastFieldShouldUpdate(newProps, oldProps)
);
};
};

View File

@@ -20,11 +20,31 @@ import { EnsureUserEmailNotVerified } from './Guards/EnsureUserEmailNotVerified'
const DashboardPrivatePages = lazy(
() => import('@/components/Dashboard/PrivatePages'),
);
const AuthenticationPage = lazy(() => import('@/containers/Authentication/AuthenticationPage').then(m => ({ default: m.AuthenticationPage })));
const EmailConfirmation = lazy(() => import('@/containers/Authentication/EmailConfirmation').then(m => ({ default: m.EmailConfirmation })));
const RegisterVerify = lazy(() => import('@/containers/Authentication/RegisterVerify').then(m => ({ default: m.RegisterVerify })));
const OneClickDemoPage = lazy(() => import('@/containers/OneClickDemo/OneClickDemoPage').then(m => ({ default: m.OneClickDemoPage })));
const PaymentPortalPage = lazy(() => import('@/containers/PaymentPortal/PaymentPortalPage').then(m => ({ default: m.PaymentPortalPage })));
const AuthenticationPage = lazy(() =>
import('@/containers/Authentication/AuthenticationPage').then((m) => ({
default: m.AuthenticationPage,
})),
);
const EmailConfirmation = lazy(() =>
import('@/containers/Authentication/EmailConfirmation').then((m) => ({
default: m.EmailConfirmation,
})),
);
const RegisterVerify = lazy(() =>
import('@/containers/Authentication/RegisterVerify').then((m) => ({
default: m.RegisterVerify,
})),
);
const OneClickDemoPage = lazy(() =>
import('@/containers/OneClickDemo/OneClickDemoPage').then((m) => ({
default: m.OneClickDemoPage,
})),
);
const PaymentPortalPage = lazy(() =>
import('@/containers/PaymentPortal/PaymentPortalPage').then((m) => ({
default: m.PaymentPortalPage,
})),
);
/**
* App inner.

View File

@@ -117,7 +117,7 @@ function useAppYupLoadLocales(currentLocale) {
setLocale(results);
setIsLoading(false);
})
.then(() => { });
.then(() => {});
}, [currentLocale, stopLoading]);
// Watches the valiue to start/stop splash screen.

View File

@@ -20,7 +20,7 @@ export function Aside({
children,
hideCloseButton,
classNames,
className
className,
}: AsideProps) {
const isDarkMode = useIsDarkMode();
const handleClose = () => {
@@ -34,7 +34,9 @@ export function Aside({
<Button
aria-label="Close"
className={Classes.DIALOG_CLOSE_BUTTON}
icon={<Icon icon={'smallCross'} color={isDarkMode ? '#fff' : '#000'} />}
icon={
<Icon icon={'smallCross'} color={isDarkMode ? '#fff' : '#000'} />
}
minimal={true}
onClick={handleClose}
/>
@@ -46,13 +48,13 @@ export function Aside({
);
}
interface AsideContentProps extends BoxProps { }
interface AsideContentProps extends BoxProps {}
function AsideContent({ ...props }: AsideContentProps) {
return <Box {...props} className={clsx(styles.content, props?.className)} />;
}
interface AsideFooterProps extends BoxProps { }
interface AsideFooterProps extends BoxProps {}
function AsideFooter({ ...props }: AsideFooterProps) {
return <Box {...props} />;

View File

@@ -1 +1 @@
export * from './ButtonLink';
export * from './ButtonLink';

View File

@@ -5,7 +5,7 @@ import { DataTable } from '../Datatable';
export const CommercialDocBox = styled(Card)`
--x-background-color: var(--x-white);
--x-background-color: var(--color-dark-gray2);
background-color: var(--x-background-color);
padding: 22px 20px;
`;

View File

@@ -5,9 +5,13 @@ import { FormattedMessage as T, Icon } from '@/components';
export default function DashboardErrorBoundary({}) {
return (
<div class="dashboard__error-boundary">
<h1><T id={'sorry_about_that_something_went_wrong'} /></h1>
<p><T id={'if_the_problem_stuck_please_contact_us_as_soon_as_possible'} /></p>
<h1>
<T id={'sorry_about_that_something_went_wrong'} />
</h1>
<p>
<T id={'if_the_problem_stuck_please_contact_us_as_soon_as_possible'} />
</p>
<Icon icon="bigcapital" height={30} width={160} />
</div>
)
}
);
}

View File

@@ -1,7 +1,7 @@
// @ts-nocheck
import React from 'react';
import classNames from 'classnames';
import intl from "react-intl-universal";
import intl from 'react-intl-universal';
import { Classes, Button } from '@blueprintjs/core';
import { T, Icon } from '@/components';

View File

@@ -17,7 +17,7 @@ export function DashboardInsider({
name,
mount = false,
className,
style
style,
}: DashboardInsiderProps) {
return (
<div
@@ -26,7 +26,6 @@ export function DashboardInsider({
dashboard__insider: true,
'dashboard__insider--loading': loading,
[`dashboard__insider--${name}`]: !!name,
},
className,
)}

View File

@@ -14,12 +14,10 @@ export default function DashboardLoadingIndicator({
return (
<Choose>
<Choose.When condition={isLoading}>
<BigcapitalLoading />
<BigcapitalLoading />
</Choose.When>
<Choose.Otherwise>
{ children }
</Choose.Otherwise>
<Choose.Otherwise>{children}</Choose.Otherwise>
</Choose>
);
}

View File

@@ -13,7 +13,9 @@ export default function DashboardProvider({ children }) {
// Show toast when user has switched workspaces
useEffect(() => {
const switchedWorkspaceName = sessionStorage.getItem('switchedWorkspaceName');
const switchedWorkspaceName = sessionStorage.getItem(
'switchedWorkspaceName',
);
if (switchedWorkspaceName) {
AppToaster.show({
message: intl.get('workspace.switched_successfully', {

View File

@@ -12,12 +12,18 @@ export function DashboardSockets() {
useEffect(() => {
socket.current = io('/', { path: '/socket' });
socket.current.on('NEW_TRANSACTIONS_DATA', () => {
client.invalidateQueries({ queryKey: [AccountsQueryKeys.ACCOUNTS] });
client.invalidateQueries({ queryKey: [AccountsQueryKeys.ACCOUNT_TRANSACTION] });
client.invalidateQueries({ queryKey: [CashflowAccountsQueryKeys.CASH_FLOW_ACCOUNTS] });
client.invalidateQueries({ queryKey: [CashflowAccountsQueryKeys.CASH_FLOW_TRANSACTIONS] });
client.invalidateQueries({
queryKey: [AccountsQueryKeys.ACCOUNT_TRANSACTION],
});
client.invalidateQueries({
queryKey: [CashflowAccountsQueryKeys.CASH_FLOW_ACCOUNTS],
});
client.invalidateQueries({
queryKey: [CashflowAccountsQueryKeys.CASH_FLOW_TRANSACTIONS],
});
AppToaster.show({
message: 'The Plaid connected accounts have been updated.',

View File

@@ -6,10 +6,7 @@ import { debounce } from 'lodash';
import { withDashboard } from '@/containers/Dashboard/withDashboard';
import { compose } from '@/utils';
function DashboardSplitPane({
sidebarExpended,
children
}) {
function DashboardSplitPane({ sidebarExpended, children }) {
const initialSize = 220;
const [defaultSize, setDefaultSize] = useState(
@@ -23,7 +20,7 @@ function DashboardSplitPane({
const handleChange = (size) => {
debounceSaveSize.current(size);
setDefaultSize(size);
}
};
return (
<SplitPane
allowResize={sidebarExpended}
@@ -41,5 +38,5 @@ function DashboardSplitPane({
}
export default compose(
withDashboard(({ sidebarExpended }) => ({ sidebarExpended }))
)(DashboardSplitPane);
withDashboard(({ sidebarExpended }) => ({ sidebarExpended })),
)(DashboardSplitPane);

View File

@@ -58,4 +58,4 @@ export function DashboardQuickSearchButton({ ...rest }) {
{...rest}
/>
);
}
}

View File

@@ -1,3 +1,3 @@
import DashboardTopbar from './DashboardTopbar';
export default DashboardTopbar;
export default DashboardTopbar;

View File

@@ -11,7 +11,11 @@ import { EnsureUserEmailVerified } from '../Guards/EnsureUserEmailVerified';
import '@/style/pages/Dashboard/Dashboard.scss';
const SetupWizardPage = lazy(() => import('@/containers/Setup/WizardSetupPage').then(m => ({ default: m.WizardSetupPage })));
const SetupWizardPage = lazy(() =>
import('@/containers/Setup/WizardSetupPage').then((m) => ({
default: m.WizardSetupPage,
})),
);
/**
* Dashboard inner private pages.
*/

View File

@@ -3,12 +3,12 @@ export * from './SplashScreen';
export * from './DashboardBoot';
export * from './DashboardThemeProvider';
export * from './DashboardAbilityProvider';
export * from './DashboardCard'
export * from './DashboardActionsBar'
export * from './DashboardFilterButton'
export * from './DashboardRowsHeightButton'
export * from './DashboardViewsTabs'
export * from './DashboardActionViewsList'
export * from './DashboardContentTable'
export * from './DashboardPageContent'
export * from './DashboardInsider'
export * from './DashboardCard';
export * from './DashboardActionsBar';
export * from './DashboardFilterButton';
export * from './DashboardRowsHeightButton';
export * from './DashboardViewsTabs';
export * from './DashboardActionViewsList';
export * from './DashboardContentTable';
export * from './DashboardPageContent';
export * from './DashboardInsider';

View File

@@ -15,9 +15,12 @@ const MoneyFieldCellRenderer = ({
}) => {
const [value, setValue] = useState(initialValue);
const handleFieldChange = useCallback((value) => {
setValue(value);
}, [setValue]);
const handleFieldChange = useCallback(
(value) => {
setValue(value);
},
[setValue],
);
function isNumeric(data) {
return (
@@ -37,9 +40,7 @@ const MoneyFieldCellRenderer = ({
const error = errors?.[index]?.[id];
return (
<FormGroup
intent={error ? Intent.DANGER : null}
className={CLASSES.FILL}>
<FormGroup intent={error ? Intent.DANGER : null} className={CLASSES.FILL}>
<MoneyInputGroup
value={value}
// prefix={'$'}

View File

@@ -14,14 +14,17 @@ const PercentFieldCell = ({
const [value, setValue] = useState(initialValue);
const handleBlurChange = (newValue) => {
const parsedValue = newValue === '' || newValue === undefined
? '' : parseInt(newValue, 10);
const parsedValue =
newValue === '' || newValue === undefined ? '' : parseInt(newValue, 10);
updateData(index, id, parsedValue);
};
const handleChange = useCallback((value) => {
setValue(value);
}, [setValue]);
const handleChange = useCallback(
(value) => {
setValue(value);
},
[setValue],
);
useEffect(() => {
setValue(initialValue);

View File

@@ -2,5 +2,5 @@
import React from 'react';
export function CellTextSpan({ cell: { value } }) {
return (<span class="cell-text">{ value }</span>)
return <span class="cell-text">{value}</span>;
}

View File

@@ -121,7 +121,10 @@ export function DataTable(props) {
hiddenColumns: initialHiddenColumns,
},
manualPagination,
pageCount: rowsCount && initialPageSize > 0 ? Math.ceil(rowsCount / initialPageSize) : 0,
pageCount:
rowsCount && initialPageSize > 0
? Math.ceil(rowsCount / initialPageSize)
: 0,
getSubRows: (row) => row.children,
manualSortBy,
expandSubRows,

View File

@@ -19,10 +19,10 @@ const StyledButtonGroup = styled(ButtonGroup)`
const StyledPaginationButton = styled(Button)`
--x-button-text-color: #666666;
--x-button-hover-background: #E6EFFB;
--x-button-hover-background: #e6effb;
--x-button-active-text-color: #000;
--x-button-active-background: #E6EFFB;
--x-button-active-disabled-background: #E6EFFB;
--x-button-active-background: #e6effb;
--x-button-active-disabled-background: #e6effb;
.bp4-dark & {
--x-button-text-color: rgba(255, 255, 255, 0.8);
@@ -35,9 +35,9 @@ const StyledPaginationButton = styled(Button)`
min-height: 24px;
border-radius: 5px;
&:not([class*="bp4-intent-"]).bp4-minimal {
&:not([class*='bp4-intent-']).bp4-minimal {
color: var(--x-button-text-color);
&:hover {
background-color: var(--x-button-hover-background);
}
@@ -63,7 +63,7 @@ const StyledPreviousButton = styled(StyledPaginationButton)`
padding-right: 10px;
.bp4-icon {
[dir="rtl"] & {
[dir='rtl'] & {
transform: scale(-1);
}
}
@@ -88,9 +88,9 @@ const StyledHTMLSelect = styled(HTMLSelect)`
--x-html-select-text-color: rgba(255, 255, 255, 0.8);
--x-html-select-border-color: rgba(255, 255, 255, 0.15);
}
&.bp4-html-select.bp4-minimal {
&.bp4-html-select.bp4-minimal {
margin-left: 6px;
select {
height: 24px;
width: auto;
@@ -299,7 +299,12 @@ export function Pagination({
</x.div>
</x.div>
<x.div color={isDark ? 'rgba(255, 255, 255, 0.6)' : '#666'} ml="12px" display="flex" alignItems="center">
<x.div
color={isDark ? 'rgba(255, 255, 255, 0.6)' : '#666'}
ml="12px"
display="flex"
alignItems="center"
>
{intl.get('showing_current_page_to_total', {
currentPage: state.currentPage,
totalPages: state.totalPages,

View File

@@ -1,6 +1,5 @@
// @ts-nocheck
export default function TableBody({}) {
return (
<ScrollSyncPane>

View File

@@ -1,4 +1,4 @@
// @ts-nocheck
import { createContext } from 'react';
export default createContext();
export default createContext();

View File

@@ -11,11 +11,11 @@ export default memo(TableFastCell, (prevProps, nextProps) => {
prevProps.row.canExpand === nextProps.row.canExpand &&
prevProps.row.isExpanded === nextProps.row.isExpanded &&
prevProps.cell.value === nextProps.cell.value &&
prevProps.cell.maxWidth === nextProps.cell.maxWidth &&
prevProps.cell.width === nextProps.cell.width
prevProps.cell.maxWidth === nextProps.cell.maxWidth &&
prevProps.cell.width === nextProps.cell.width
) {
return true;
} else {
return false;
}
});
});

View File

@@ -13,8 +13,10 @@ export default function TableFooter() {
} = useContext(TableContext);
// Can't contiunue if the footer is disabled.
if (!footer) { return null; }
if (!footer) {
return null;
}
return (
<div class="tfooter">
{footerGroups.map((group) => (
@@ -25,9 +27,7 @@ export default function TableFooter() {
className: classNames(column.className || '', 'td'),
})}
>
<div className={'cell-inner'}>
{column.render('Footer')}
</div>
<div className={'cell-inner'}>{column.render('Footer')}</div>
</div>
))}
</div>

View File

@@ -7,7 +7,7 @@ export default function TableIndeterminateCheckboxHeader({
}) {
return (
<div>
<Checkbox {...getToggleAllRowsSelectedProps()} />
<Checkbox {...getToggleAllRowsSelectedProps()} />
</div>
);
}

View File

@@ -5,12 +5,10 @@ import { Spinner } from '@blueprintjs/core';
/**
* Table loading component.
*/
export default function TableLoading({
spinnerProps
}) {
export default function TableLoading({ spinnerProps }) {
return (
<div class="loading">
<Spinner {...spinnerProps} />
</div>
);
}
}

View File

@@ -23,5 +23,5 @@ export default function TablePage() {
if (page.length === 0) {
return <TableNoResultsRowRenderer />;
}
return (<TableRowsRenderer />);
return <TableRowsRenderer />;
}

View File

@@ -15,7 +15,13 @@ export default function TablePagination() {
pageCount,
state: { pageIndex, pageSize },
},
props: { pagination, loading, onPaginationChange, hidePaginationNoPages, rowsCount },
props: {
pagination,
loading,
onPaginationChange,
hidePaginationNoPages,
rowsCount,
},
} = useContext(TableContext);
const triggerOnPaginationChange = useCallback(

View File

@@ -1,6 +1,6 @@
// @ts-nocheck
import React, { useContext } from "react";
import TableContext from "./TableContext";
import React, { useContext } from 'react';
import TableContext from './TableContext';
/**
* Table rows.
@@ -13,6 +13,12 @@ export default function TableRows() {
return page.map((row, index) => {
prepareRow(row);
return <TableRowRenderer key={index} row={row} TableCellRenderer={TableCellRenderer} />;
return (
<TableRowRenderer
key={index}
row={row}
TableCellRenderer={TableCellRenderer}
/>
);
});
}
}

View File

@@ -3,19 +3,15 @@ import React, { useContext } from 'react';
import { ScrollSyncPane } from 'react-scroll-sync';
import TableContext from './TableContext';
export default function TableTBody({
children
}) {
export default function TableTBody({ children }) {
const {
table: { getTableBodyProps }
table: { getTableBodyProps },
} = useContext(TableContext);
return (
<ScrollSyncPane>
<div {...getTableBodyProps()} className="tbody">
<div class="tbody-inner">
{ children }
</div>
<div class="tbody-inner">{children}</div>
</div>
</ScrollSyncPane>
);

View File

@@ -2,8 +2,8 @@
export * from './CellForceWidth';
export * from './DataTable';
export * from './DatatableEditable';
export * from './TableHeaderSkeleton'
export * from './TableSkeletonRows'
export * from './TableVirtualizedRows'
export * from './TableHeaderSkeleton';
export * from './TableSkeletonRows';
export * from './TableVirtualizedRows';
export * from './TableFastCell';
export * from './Pagination'
export * from './Pagination';

View File

@@ -11,10 +11,11 @@ interface DialogProviderProps {
children: ReactNode;
}
export const DialogProvider: React.FC<DialogProviderProps> = ({ value, children }) => {
export const DialogProvider: React.FC<DialogProviderProps> = ({
value,
children,
}) => {
return (
<DialogContext.Provider value={value}>
{children}
</DialogContext.Provider>
<DialogContext.Provider value={value}>{children}</DialogContext.Provider>
);
};

View File

@@ -3,17 +3,17 @@ import React, { Suspense } from 'react';
import { Classes, Spinner } from '@blueprintjs/core';
function LoadingContent() {
return (<div className={Classes.DIALOG_BODY}><Spinner size={30} /></div>);
return (
<div className={Classes.DIALOG_BODY}>
<Spinner size={30} />
</div>
);
}
export function DialogSuspense({
children
}) {
export function DialogSuspense({ children }) {
return (
<Suspense fallback={<LoadingContent /> }>
<div className={'dialog__suspense-wrapper'}>
{ children }
</div>
<Suspense fallback={<LoadingContent />}>
<div className={'dialog__suspense-wrapper'}>{children}</div>
</Suspense>
);
};
}

View File

@@ -1,8 +1,7 @@
// @ts-nocheck
export * from './Dialog';
export * from './DialogFooterActions';
export * from './DialogSuspense';
export * from './DialogContent';
// export * from './DialogFooter';
// export * from './DialogFooter';

View File

@@ -184,9 +184,7 @@ export default function DialogsContainer() {
<SelectPaymentMethodsDialog
dialogName={DialogsName.SelectPaymentMethod}
/>
<ApiKeysGenerateDialog
dialogName={DialogsName.ApiKeysGenerate}
/>
<ApiKeysGenerateDialog dialogName={DialogsName.ApiKeysGenerate} />
<WorkspaceDeleteDialog dialogName={DialogsName.WorkspaceDelete} />
<WorkspaceInactivateDialog dialogName={DialogsName.WorkspaceInactivate} />
</div>

View File

@@ -87,7 +87,9 @@ export default function DrawersContainer() {
<InvoiceSendMailDrawer name={DRAWERS.INVOICE_SEND_MAIL} />
<EstimateSendMailDrawer name={DRAWERS.ESTIMATE_SEND_MAIL} />
<ReceiptSendMailDrawer name={DRAWERS.RECEIPT_SEND_MAIL} />
<PaymentReceivedSendMailDrawer name={DRAWERS.PAYMENT_RECEIVED_SEND_MAIL} />
<PaymentReceivedSendMailDrawer
name={DRAWERS.PAYMENT_RECEIVED_SEND_MAIL}
/>
<CreateWorkspaceDrawer name={DRAWERS.CREATE_WORKSPACE} />
<OrganizationsListDrawer name={DRAWERS.ORGANIZATIONS_LIST} />
</div>

View File

@@ -20,11 +20,11 @@ export type DropzoneStylesNames = 'root' | 'inner';
export type DropzoneVariant = 'filled' | 'light';
export type DropzoneCssVariables = {
root:
| '--dropzone-radius'
| '--dropzone-accept-color'
| '--dropzone-accept-bg'
| '--dropzone-reject-color'
| '--dropzone-reject-bg';
| '--dropzone-radius'
| '--dropzone-accept-color'
| '--dropzone-accept-bg'
| '--dropzone-reject-color'
| '--dropzone-reject-bg';
};
export interface DropzoneProps {
@@ -239,9 +239,9 @@ export const Dropzone = (_props: DropzoneProps) => {
styles.root,
{
[styles.dropzoneAccept]: isDragAccept,
[styles.dropzoneReject]: isDragReject
[styles.dropzoneReject]: isDragReject,
},
classNames?.root
classNames?.root,
),
})}
// {...getStyles('root', { focusable: true })}
@@ -274,7 +274,6 @@ Dropzone.Accept = DropzoneAccept;
Dropzone.Idle = DropzoneIdle;
Dropzone.Reject = DropzoneReject;
type PossibleRef<T> = Ref<T> | undefined;
export function assignRef<T>(ref: PossibleRef<T>, value: T) {
@@ -293,4 +292,4 @@ export function mergeRefs<T>(...refs: PossibleRef<T>[]) {
export function useMergedRef<T>(...refs: PossibleRef<T>[]) {
return useCallback(mergeRefs(...refs), refs);
}
}

View File

@@ -1 +1 @@
export * from './Dropzone';
export * from './Dropzone';

View File

@@ -2,12 +2,7 @@
import React from 'react';
import PropTypes from 'prop-types';
function ErrorBoundary({
error,
errorInfo,
children
}) {
function ErrorBoundary({ error, errorInfo, children }) {
if (errorInfo) {
return (
<div>
@@ -32,4 +27,4 @@ ErrorBoundary.propTypes = {
children: PropTypes.node,
};
export default ErrorBoundary;
export default ErrorBoundary;

View File

@@ -1,4 +1,4 @@
// @ts-nocheck
export * from './ExchangeRateInput';
export * from './ExchangeRateMutedField'
export * from './DetailExchangeRate'
export * from './ExchangeRateMutedField';
export * from './DetailExchangeRate';

View File

@@ -1,2 +1,2 @@
// @ts-nocheck
export * from './FeatureCan';
export * from './FeatureCan';

View File

@@ -6,7 +6,7 @@ const FinancialStatementRoot = styled.div``;
const FinancialStatementBodyRoot = styled.div``;
/**
*
*
* @returns {React.JSX}
*/
export function FinancialReport({ children, className }) {

View File

@@ -54,7 +54,9 @@ export function FinancialSheet({
>
{hasHead && (
<div>
{companyName && <FinancialSheetTitle>{companyName}</FinancialSheetTitle>}
{companyName && (
<FinancialSheetTitle>{companyName}</FinancialSheetTitle>
)}
{sheetType && <FinancialSheetType>{sheetType}</FinancialSheetType>}
{dateText && <FinancialSheetDate>{dateText}</FinancialSheetDate>}
</div>

View File

@@ -1,4 +1,4 @@
// @ts-nocheck
export * from './FinancialSheet';
export * from './FinancialSheetSkeleton';
export * from './ReportDataTable';
export * from './ReportDataTable';

View File

@@ -9,11 +9,17 @@ interface FinancialStatementProps {
className?: string;
}
export function FinancialStatement({ children, className }: FinancialStatementProps) {
export function FinancialStatement({
children,
className,
}: FinancialStatementProps) {
return <FinancialStatementRoot children={children} className={className} />;
}
export function FinancialStatementBody({ children, className }: FinancialStatementProps) {
export function FinancialStatementBody({
children,
className,
}: FinancialStatementProps) {
return (
<FinancialStatementBodyRoot children={children} className={className} />
);

View File

@@ -1,2 +1,2 @@
// @ts-nocheck
export * from './FlexItem.style';
export * from './FlexItem.style';

View File

@@ -2,4 +2,4 @@
export * from './Flex.style';
export * from './Flex';
export * from './FlexItem.style';
export * from './interfaces';
export * from './interfaces';

View File

@@ -20,4 +20,4 @@ export interface FlexProps extends HTMLAttributes<HTMLDivElement> {
className?: string;
style?: StyleHTMLAttributes<HTMLDivElement>;
as?: string | Component;
}
}

View File

@@ -1,8 +1,6 @@
// @ts-nocheck
import React, { useState } from 'react';
import {
Checkbox as BPCheckbox,
} from '@blueprintjs/core';
import { Checkbox as BPCheckbox } from '@blueprintjs/core';
export default function CheckboxComponent(props: any) {
const { field, form, ...rest } = props;
@@ -23,6 +21,6 @@ export default function CheckboxComponent(props: any) {
onChange: handleChange,
onBlur: handleBlur,
checked: value,
}
};
return <BPCheckbox {...checkboxProps} />;
}
}

View File

@@ -1,6 +1,6 @@
// @ts-nocheck
import { useEffect } from 'react'
import { useEffect } from 'react';
export function FormObserver({ onChange, values }) {
useEffect(() => {

View File

@@ -2,9 +2,5 @@
import React from 'react';
export default function InputPrepend({ children }) {
return (
<div class="input-prepend">
{ children }
</div>
);
}
return <div class="input-prepend">{children}</div>;
}

View File

@@ -118,4 +118,4 @@ export type CurrencyInputProps = Overwrite<
*/
turnOffAbbreviations?: boolean;
}
>;
>;

View File

@@ -210,4 +210,4 @@ export const CurrencyInput: FC<CurrencyInputProps> = ({
);
};
export { CurrencyInput as MoneyInputGroup };
export { CurrencyInput as MoneyInputGroup };

View File

@@ -6,7 +6,7 @@ describe('cleanValue', () => {
expect(
cleanValue({
value: '1,000,000',
})
}),
).toEqual('1000000');
});
@@ -16,7 +16,7 @@ describe('cleanValue', () => {
value: '1.000.000,12',
decimalSeparator: ',',
groupSeparator: '.',
})
}),
).toEqual('1000000,12');
});
@@ -25,14 +25,14 @@ describe('cleanValue', () => {
cleanValue({
value: '£1000000',
prefix: '£',
})
}),
).toEqual('1000000');
expect(
cleanValue({
value: '$5.5',
prefix: '$',
})
}),
).toEqual('5.5');
});
@@ -40,7 +40,7 @@ describe('cleanValue', () => {
expect(
cleanValue({
value: '100.0000',
})
}),
).toEqual('100.00');
});
@@ -50,7 +50,7 @@ describe('cleanValue', () => {
value: '100.0000',
allowDecimals: false,
decimalsLimit: 0,
})
}),
).toEqual('100');
});
@@ -60,7 +60,7 @@ describe('cleanValue', () => {
value: '100.123',
allowDecimals: true,
decimalsLimit: 0,
})
}),
).toEqual('100.123');
});
@@ -69,7 +69,7 @@ describe('cleanValue', () => {
cleanValue({
value: '£1,234,567.89',
prefix: '£',
})
}),
).toEqual('1234567.89');
});
@@ -83,7 +83,7 @@ describe('cleanValue', () => {
allowDecimals: true,
decimalsLimit: 2,
prefix: '£',
})
}),
).toEqual('-1000');
});
@@ -96,7 +96,7 @@ describe('cleanValue', () => {
allowDecimals: true,
decimalsLimit: 2,
prefix: '£',
})
}),
).toEqual('-99999.99');
});
@@ -110,7 +110,7 @@ describe('cleanValue', () => {
decimalsLimit: 2,
allowNegativeValue: false,
prefix: '£',
})
}),
).toEqual('1000');
});
});
@@ -120,21 +120,21 @@ describe('cleanValue', () => {
cleanValue({
value: '2£1',
prefix: '£',
})
}),
).toEqual('12');
expect(
cleanValue({
value: '-2£1',
prefix: '£',
})
}),
).toEqual('-12');
expect(
cleanValue({
value: '2-£1',
prefix: '£',
})
}),
).toEqual('-12');
expect(
@@ -142,7 +142,7 @@ describe('cleanValue', () => {
value: '2-£1.99',
prefix: '£',
decimalsLimit: 5,
})
}),
).toEqual('-1.992');
});
@@ -152,21 +152,21 @@ describe('cleanValue', () => {
cleanValue({
value: 'k',
turnOffAbbreviations: true,
})
}),
).toEqual('');
expect(
cleanValue({
value: 'm',
turnOffAbbreviations: true,
})
}),
).toEqual('');
expect(
cleanValue({
value: 'b',
turnOffAbbreviations: true,
})
}),
).toEqual('');
});
@@ -176,7 +176,7 @@ describe('cleanValue', () => {
value: '$k',
prefix: '$',
turnOffAbbreviations: true,
})
}),
).toEqual('');
expect(
@@ -184,7 +184,7 @@ describe('cleanValue', () => {
value: '£m',
prefix: '£',
turnOffAbbreviations: true,
})
}),
).toEqual('');
});
@@ -193,28 +193,28 @@ describe('cleanValue', () => {
cleanValue({
value: '1k',
turnOffAbbreviations: true,
})
}),
).toEqual('1');
expect(
cleanValue({
value: '-2k',
turnOffAbbreviations: true,
})
}),
).toEqual('-2');
expect(
cleanValue({
value: '25.6m',
turnOffAbbreviations: true,
})
}),
).toEqual('25.6');
expect(
cleanValue({
value: '9b',
turnOffAbbreviations: true,
})
}),
).toEqual('9');
});
});

View File

@@ -6,7 +6,7 @@ describe('formatValue', () => {
expect(
formatValue({
value: '',
})
}),
).toEqual('');
});
@@ -14,7 +14,7 @@ describe('formatValue', () => {
expect(
formatValue({
value: '1234567',
})
}),
).toEqual('1,234,567');
});
@@ -24,7 +24,7 @@ describe('formatValue', () => {
value: '1234567',
decimalSeparator: '.',
groupSeparator: '.',
})
}),
).toEqual('1.234.567');
});
@@ -34,7 +34,7 @@ describe('formatValue', () => {
value: '1234567,89',
decimalSeparator: '.',
groupSeparator: '.',
})
}),
).toEqual('1.234.567,89');
});
@@ -44,7 +44,7 @@ describe('formatValue', () => {
value: '1234567-89',
decimalSeparator: '-',
groupSeparator: '.',
})
}),
).toEqual('1.234.567-89');
});
@@ -54,7 +54,7 @@ describe('formatValue', () => {
value: '1234567-89',
decimalSeparator: '',
groupSeparator: '.',
})
}),
).toEqual('1.234.567-89');
});
@@ -63,7 +63,7 @@ describe('formatValue', () => {
formatValue({
value: '1234567',
turnOffSeparators: true,
})
}),
).toEqual('1234567');
});
@@ -74,7 +74,7 @@ describe('formatValue', () => {
decimalSeparator: '.',
groupSeparator: ',',
turnOffSeparators: true,
})
}),
).toEqual('1234567');
});
@@ -83,7 +83,7 @@ describe('formatValue', () => {
formatValue({
value: '123',
prefix: '£',
})
}),
).toEqual('£123');
});
@@ -91,7 +91,7 @@ describe('formatValue', () => {
expect(
formatValue({
value: '1234567.',
})
}),
).toEqual('1,234,567.');
});
@@ -99,7 +99,7 @@ describe('formatValue', () => {
expect(
formatValue({
value: '1234.567',
})
}),
).toEqual('1,234.567');
});
@@ -108,7 +108,7 @@ describe('formatValue', () => {
formatValue({
value: '1234567.89',
prefix: '£',
})
}),
).toEqual('£1,234,567.89');
});
@@ -117,7 +117,7 @@ describe('formatValue', () => {
formatValue({
value: '0',
prefix: '£',
})
}),
).toEqual('£0');
});
@@ -127,7 +127,7 @@ describe('formatValue', () => {
formatValue({
value: '-1234',
prefix: '£',
})
}),
).toEqual('-£1,234');
});
@@ -136,7 +136,7 @@ describe('formatValue', () => {
formatValue({
value: '-',
prefix: '£',
})
}),
).toEqual('-');
});
});
@@ -147,7 +147,7 @@ describe('formatValue', () => {
value: '-1234',
groupSeparator: '-',
prefix: '£',
})
}),
).toEqual('-£1-234');
});
@@ -157,7 +157,7 @@ describe('formatValue', () => {
value: '-12-34',
decimalSeparator: '-',
prefix: '£',
})
}),
).toEqual('-£12-34');
});
@@ -167,7 +167,7 @@ describe('formatValue', () => {
value: '-123456',
groupSeparator: '-',
prefix: '£',
})
}),
).toEqual('-£123-456');
});
});

View File

@@ -3,7 +3,9 @@ import { removeInvalidChars } from '../removeInvalidChars';
describe('removeInvalidChars', () => {
it('should remove letters in string', () => {
expect(removeInvalidChars('1,000ab,0cd00.99', [',', '.'])).toEqual('1,000,000.99');
expect(removeInvalidChars('1,000ab,0cd00.99', [',', '.'])).toEqual(
'1,000,000.99',
);
});
it('should remove special characters in string', () => {

View File

@@ -31,8 +31,11 @@ export const cleanValue = ({
const abbreviations = turnOffAbbreviations ? [] : ['k', 'm', 'b'];
const isNegative = value.includes('-');
const [prefixWithValue, preValue] = RegExp(`(\\d+)-?${escapeRegExp(prefix)}`).exec(value) || [];
const withoutPrefix = prefix ? value.replace(prefixWithValue, '').concat(preValue) : value;
const [prefixWithValue, preValue] =
RegExp(`(\\d+)-?${escapeRegExp(prefix)}`).exec(value) || [];
const withoutPrefix = prefix
? value.replace(prefixWithValue, '').concat(preValue)
: value;
const withoutSeparators = removeSeparators(withoutPrefix, groupSeparator);
const withoutInvalidChars = removeInvalidChars(withoutSeparators, [
groupSeparator,
@@ -44,7 +47,11 @@ export const cleanValue = ({
if (!turnOffAbbreviations) {
// disallow letter without number
if (abbreviations.some((letter) => letter === withoutInvalidChars.toLowerCase())) {
if (
abbreviations.some(
(letter) => letter === withoutInvalidChars.toLowerCase(),
)
) {
return '';
}
const parsed = parseAbbrValue(withoutInvalidChars, decimalSeparator);
@@ -57,8 +64,12 @@ export const cleanValue = ({
if (String(valueOnly).includes(decimalSeparator)) {
const [int, decimals] = withoutInvalidChars.split(decimalSeparator);
const trimmedDecimals = decimalsLimit ? decimals.slice(0, decimalsLimit) : decimals;
const includeDecimals = allowDecimals ? `${decimalSeparator}${trimmedDecimals}` : '';
const trimmedDecimals = decimalsLimit
? decimals.slice(0, decimalsLimit)
: decimals;
const includeDecimals = allowDecimals
? `${decimalSeparator}${trimmedDecimals}`
: '';
return `${includeNegative}${int}${includeDecimals}`;
}

View File

@@ -2,7 +2,7 @@
export const fixedDecimalValue = (
value: string,
decimalSeparator: string,
fixedDecimalLength?: number
fixedDecimalLength?: number,
): string => {
if (fixedDecimalLength && value.length > 1) {
if (value.includes(decimalSeparator)) {

View File

@@ -59,12 +59,17 @@ export const formatValue = (props: Props): string => {
}
const isNegative = RegExp('^-\\d+').test(value);
const hasDecimalSeparator = decimalSeparator && value.includes(decimalSeparator);
const hasDecimalSeparator =
decimalSeparator && value.includes(decimalSeparator);
const valueOnly = isNegative ? value.replace('-', '') : value;
const [int, decimals] = hasDecimalSeparator ? valueOnly.split(decimalSeparator) : [valueOnly];
const [int, decimals] = hasDecimalSeparator
? valueOnly.split(decimalSeparator)
: [valueOnly];
const formattedInt = turnOffSeparators ? int : addSeparators(int, groupSeparator);
const formattedInt = turnOffSeparators
? int
: addSeparators(int, groupSeparator);
const includePrefix = prefix ? prefix : '';
const includeNegative = isNegative ? '-' : '';
@@ -72,8 +77,8 @@ export const formatValue = (props: Props): string => {
hasDecimalSeparator && decimals
? `${decimalSeparator}${decimals}`
: hasDecimalSeparator
? `${decimalSeparator}`
: '';
? `${decimalSeparator}`
: '';
return `${includeNegative}${includePrefix}${formattedInt}${includeDecimals}`;
};

View File

@@ -1,2 +1,3 @@
// @ts-nocheck
export const isNumber = (input: string): boolean => RegExp(/\d/, 'gi').test(input);
export const isNumber = (input: string): boolean =>
RegExp(/\d/, 'gi').test(input);

View File

@@ -1,5 +1,9 @@
// @ts-nocheck
export const padTrimValue = (value: string, decimalSeparator = '.', precision?: number): string => {
export const padTrimValue = (
value: string,
decimalSeparator = '.',
precision?: number,
): string => {
if (!precision || value === '' || value === undefined) {
return value;
}

View File

@@ -6,14 +6,20 @@ import { escapeRegExp } from './escapeRegExp';
*
* Source: https://stackoverflow.com/a/9345181
*/
export const abbrValue = (value: number, decimalSeparator = '.', _decimalPlaces = 10): string => {
export const abbrValue = (
value: number,
decimalSeparator = '.',
_decimalPlaces = 10,
): string => {
if (value > 999) {
let valueLength = ('' + value).length;
const p = Math.pow;
const d = p(10, _decimalPlaces);
valueLength -= valueLength % 3;
const abbrValue = Math.round((value * d) / p(10, valueLength)) / d + ' kMGTPE'[valueLength / 3];
const abbrValue =
Math.round((value * d) / p(10, valueLength)) / d +
' kMGTPE'[valueLength / 3];
return abbrValue.replace('.', decimalSeparator);
}
@@ -27,8 +33,14 @@ const abbrMap: AbbrMap = { k: 1000, m: 1000000, b: 1000000000 };
/**
* Parse a value with abbreviation e.g 1k = 1000
*/
export const parseAbbrValue = (value: string, decimalSeparator = '.'): number | undefined => {
const reg = new RegExp(`(\\d+(${escapeRegExp(decimalSeparator)}\\d+)?)([kmb])$`, 'i');
export const parseAbbrValue = (
value: string,
decimalSeparator = '.',
): number | undefined => {
const reg = new RegExp(
`(\\d+(${escapeRegExp(decimalSeparator)}\\d+)?)([kmb])$`,
'i',
);
const match = value.match(reg);
if (match) {

View File

@@ -4,7 +4,10 @@ import { escapeRegExp } from './escapeRegExp';
/**
* Remove invalid characters
*/
export const removeInvalidChars = (value: string, validChars: ReadonlyArray<string>): string => {
export const removeInvalidChars = (
value: string,
validChars: ReadonlyArray<string>,
): string => {
const chars = escapeRegExp(validChars.join(''));
const reg = new RegExp(`[^\\d${chars}]`, 'gi');
return value.replace(reg, '');

View File

@@ -6,4 +6,4 @@ export * from './InputPrependText';
export * from './InputPrependButton';
export * from './MoneyInputGroup';
export * from './FRichEditor';
export * from './Select';
export * from './Select';

View File

@@ -1,2 +1,2 @@
export * from './Col'
export * from './Row'
export * from './Col';
export * from './Row';

View File

@@ -2,14 +2,23 @@ import React from 'react';
import { connect } from 'react-redux';
import { Redirect } from 'react-router-dom';
import { compose } from '@/utils';
import { withAuthentication, WithAuthenticationProps } from '@/containers/Authentication/withAuthentication';
import { withOrganization, WithOrganizationProps } from '@/containers/Organization/withOrganization';
import {
withAuthentication,
WithAuthenticationProps,
} from '@/containers/Authentication/withAuthentication';
import {
withOrganization,
WithOrganizationProps,
} from '@/containers/Organization/withOrganization';
interface EnsureOrganizationIsNotReadyProps extends
Pick<WithAuthenticationProps, 'currentOrganizationId'>,
Pick<WithOrganizationProps, 'isOrganizationReady' | 'isOrganizationSetupCompleted'> {
interface EnsureOrganizationIsNotReadyProps
extends Pick<WithAuthenticationProps, 'currentOrganizationId'>,
Pick<
WithOrganizationProps,
'isOrganizationReady' | 'isOrganizationSetupCompleted'
> {
children: React.ReactNode;
}
}
/**
* Ensures organization is not ready.
@@ -19,11 +28,13 @@ function EnsureOrganizationIsNotReady({
// #withOrganization
isOrganizationReady,
isOrganizationSetupCompleted
isOrganizationSetupCompleted,
}: EnsureOrganizationIsNotReadyProps) {
return (isOrganizationReady && !isOrganizationSetupCompleted) ? (
return isOrganizationReady && !isOrganizationSetupCompleted ? (
<Redirect to={{ pathname: '/' }} />
) : children;
) : (
children
);
}
export default compose(
@@ -35,11 +46,8 @@ export default compose(
organizationId: props.currentOrganizationId,
}),
),
withOrganization(({
withOrganization(({ isOrganizationReady, isOrganizationSetupCompleted }) => ({
isOrganizationReady,
isOrganizationSetupCompleted
}) => ({
isOrganizationReady,
isOrganizationSetupCompleted
isOrganizationSetupCompleted,
})),
)(EnsureOrganizationIsNotReady);
)(EnsureOrganizationIsNotReady);

View File

@@ -1,23 +1,80 @@
interface BigcapitalAltProps extends React.SVGProps<SVGSVGElement> {
}
interface BigcapitalAltProps extends React.SVGProps<SVGSVGElement> {}
export function BigcapitalAlt(props: BigcapitalAltProps) {
return (
<svg data-icon="bigcapital-alt" width="214" height="37" viewBox="0 0 309.09 42.89" {...props}>
<svg
data-icon="bigcapital-alt"
width="214"
height="37"
viewBox="0 0 309.09 42.89"
{...props}
>
<desc>bigcapital</desc>
<path fill="currentColor" d="M56,3.16,61.33,8.5,31.94,37.9l-5.35-5.35Z" fill-rule="evenodd"></path>
<path fill="currentColor" d="M29.53,6.94l5.35,5.34L5.49,41.67.14,36.33l15.8-15.8Z" fill-rule="evenodd"></path>
<path fill="currentColor" d="M94.36,38.87H79.62v-31H94c6.33,0,10.22,3.15,10.22,8V16a7.22,7.22,0,0,1-4.07,6.69c3.58,1.37,5.8,3.45,5.8,7.61v.09C106,36,101.35,38.87,94.36,38.87Zm3.1-21.81c0-2-1.59-3.19-4.47-3.19H86.26v6.55h6.29c3,0,4.91-1,4.91-3.28Zm1.72,12.39c0-2.08-1.54-3.37-5-3.37H86.26V32.9h8.1c3,0,4.82-1.06,4.82-3.36Z" fill-rule="evenodd"></path>
<path fill="currentColor" d="M110.56,12.54v-6h7.08v6Zm.18,26.33V15.15h6.72V38.87Z" fill-rule="evenodd"></path>
<path fill="currentColor" d="M134,46a22.55,22.55,0,0,1-10.49-2.47l2.3-5a15.52,15.52,0,0,0,8,2.17c4.61,0,6.78-2.21,6.78-6.46V33.08c-2,2.39-4.16,3.85-7.75,3.85-5.53,0-10.53-4-10.53-11.07v-.09c0-7.08,5.09-11.06,10.53-11.06a9.63,9.63,0,0,1,7.66,3.54v-3.1h6.72V33.52C147.2,42.46,142.78,46,134,46Zm6.6-20.27a5.79,5.79,0,0,0-11.56,0v.09a5.42,5.42,0,0,0,5.76,5.49,5.49,5.49,0,0,0,5.8-5.49Z" fill-rule="evenodd"></path>
<path fill="currentColor" d="M164,39.41a12.11,12.11,0,0,1-12.35-12.26v-.09a12.18,12.18,0,0,1,12.44-12.35c4.47,0,7.25,1.5,9.47,4l-4.12,4.43a6.93,6.93,0,0,0-5.4-2.61c-3.36,0-5.75,3-5.75,6.46v.09c0,3.63,2.34,6.55,6,6.55,2.26,0,3.8-1,5.44-2.53l3.94,4A12,12,0,0,1,164,39.41Z" fill-rule="evenodd"></path>
<path fill="currentColor" d="M191.51,38.87V36.31a9.15,9.15,0,0,1-7.17,3c-4.47,0-8.15-2.57-8.15-7.26V32c0-5.18,3.94-7.57,9.56-7.57a16.74,16.74,0,0,1,5.8,1V25c0-2.79-1.72-4.34-5.09-4.34a17.57,17.57,0,0,0-6.55,1.28l-1.68-5.13a21,21,0,0,1,9.21-1.9c7.34,0,10.57,3.8,10.57,10.22V38.87Zm.13-9.55a10.3,10.3,0,0,0-4.29-.89c-2.88,0-4.65,1.15-4.65,3.27v.09c0,1.82,1.5,2.88,3.67,2.88,3.15,0,5.27-1.73,5.27-4.16Z" fill-rule="evenodd"></path>
<path fill="currentColor" d="M217.49,39.32a9.1,9.1,0,0,1-7.39-3.54V46h-6.73V15.15h6.73v3.41a8.7,8.7,0,0,1,7.39-3.85c5.53,0,10.8,4.34,10.8,12.26v.09C228.29,35,223.11,39.32,217.49,39.32ZM221.56,27c0-3.94-2.66-6.55-5.8-6.55S210,23,210,27v.09c0,3.94,2.61,6.55,5.75,6.55s5.8-2.57,5.8-6.55Z" fill-rule="evenodd"></path>
<path fill="currentColor" d="M232.93,12.54v-6H240v6Zm.18,26.33V15.15h6.73V38.87Z" fill-rule="evenodd"></path>
<path fill="currentColor" d="M253.73,39.27c-4.11,0-6.9-1.63-6.9-7.12V20.91H244V15.15h2.83V9.09h6.73v6.06h5.57v5.76h-5.57V31c0,1.55.66,2.3,2.16,2.3A6.84,6.84,0,0,0,259,32.5v5.4A9.9,9.9,0,0,1,253.73,39.27Z" fill-rule="evenodd"></path>
<path fill="currentColor" d="M277.55,38.87V36.31a9.15,9.15,0,0,1-7.18,3c-4.46,0-8.14-2.57-8.14-7.26V32c0-5.18,3.94-7.57,9.56-7.57a16.74,16.74,0,0,1,5.8,1V25c0-2.79-1.73-4.34-5.09-4.34A17.57,17.57,0,0,0,266,21.92l-1.68-5.13a20.94,20.94,0,0,1,9.2-1.9c7.35,0,10.58,3.8,10.58,10.22V38.87Zm.13-9.55a10.31,10.31,0,0,0-4.3-.89c-2.87,0-4.64,1.15-4.64,3.27v.09c0,1.82,1.5,2.88,3.67,2.88,3.14,0,5.27-1.73,5.27-4.16Z" fill-rule="evenodd"></path>
<path fill="currentColor" d="M289.72,38.87V6.57h6.72v32.3Z" fill-rule="evenodd"></path>
<path fill="currentColor" d="M302.06,38.87V31.79h7.17v7.08Z" fill-rule="evenodd"></path></svg>
<path
fill="currentColor"
d="M56,3.16,61.33,8.5,31.94,37.9l-5.35-5.35Z"
fill-rule="evenodd"
></path>
<path
fill="currentColor"
d="M29.53,6.94l5.35,5.34L5.49,41.67.14,36.33l15.8-15.8Z"
fill-rule="evenodd"
></path>
<path
fill="currentColor"
d="M94.36,38.87H79.62v-31H94c6.33,0,10.22,3.15,10.22,8V16a7.22,7.22,0,0,1-4.07,6.69c3.58,1.37,5.8,3.45,5.8,7.61v.09C106,36,101.35,38.87,94.36,38.87Zm3.1-21.81c0-2-1.59-3.19-4.47-3.19H86.26v6.55h6.29c3,0,4.91-1,4.91-3.28Zm1.72,12.39c0-2.08-1.54-3.37-5-3.37H86.26V32.9h8.1c3,0,4.82-1.06,4.82-3.36Z"
fill-rule="evenodd"
></path>
<path
fill="currentColor"
d="M110.56,12.54v-6h7.08v6Zm.18,26.33V15.15h6.72V38.87Z"
fill-rule="evenodd"
></path>
<path
fill="currentColor"
d="M134,46a22.55,22.55,0,0,1-10.49-2.47l2.3-5a15.52,15.52,0,0,0,8,2.17c4.61,0,6.78-2.21,6.78-6.46V33.08c-2,2.39-4.16,3.85-7.75,3.85-5.53,0-10.53-4-10.53-11.07v-.09c0-7.08,5.09-11.06,10.53-11.06a9.63,9.63,0,0,1,7.66,3.54v-3.1h6.72V33.52C147.2,42.46,142.78,46,134,46Zm6.6-20.27a5.79,5.79,0,0,0-11.56,0v.09a5.42,5.42,0,0,0,5.76,5.49,5.49,5.49,0,0,0,5.8-5.49Z"
fill-rule="evenodd"
></path>
<path
fill="currentColor"
d="M164,39.41a12.11,12.11,0,0,1-12.35-12.26v-.09a12.18,12.18,0,0,1,12.44-12.35c4.47,0,7.25,1.5,9.47,4l-4.12,4.43a6.93,6.93,0,0,0-5.4-2.61c-3.36,0-5.75,3-5.75,6.46v.09c0,3.63,2.34,6.55,6,6.55,2.26,0,3.8-1,5.44-2.53l3.94,4A12,12,0,0,1,164,39.41Z"
fill-rule="evenodd"
></path>
<path
fill="currentColor"
d="M191.51,38.87V36.31a9.15,9.15,0,0,1-7.17,3c-4.47,0-8.15-2.57-8.15-7.26V32c0-5.18,3.94-7.57,9.56-7.57a16.74,16.74,0,0,1,5.8,1V25c0-2.79-1.72-4.34-5.09-4.34a17.57,17.57,0,0,0-6.55,1.28l-1.68-5.13a21,21,0,0,1,9.21-1.9c7.34,0,10.57,3.8,10.57,10.22V38.87Zm.13-9.55a10.3,10.3,0,0,0-4.29-.89c-2.88,0-4.65,1.15-4.65,3.27v.09c0,1.82,1.5,2.88,3.67,2.88,3.15,0,5.27-1.73,5.27-4.16Z"
fill-rule="evenodd"
></path>
<path
fill="currentColor"
d="M217.49,39.32a9.1,9.1,0,0,1-7.39-3.54V46h-6.73V15.15h6.73v3.41a8.7,8.7,0,0,1,7.39-3.85c5.53,0,10.8,4.34,10.8,12.26v.09C228.29,35,223.11,39.32,217.49,39.32ZM221.56,27c0-3.94-2.66-6.55-5.8-6.55S210,23,210,27v.09c0,3.94,2.61,6.55,5.75,6.55s5.8-2.57,5.8-6.55Z"
fill-rule="evenodd"
></path>
<path
fill="currentColor"
d="M232.93,12.54v-6H240v6Zm.18,26.33V15.15h6.73V38.87Z"
fill-rule="evenodd"
></path>
<path
fill="currentColor"
d="M253.73,39.27c-4.11,0-6.9-1.63-6.9-7.12V20.91H244V15.15h2.83V9.09h6.73v6.06h5.57v5.76h-5.57V31c0,1.55.66,2.3,2.16,2.3A6.84,6.84,0,0,0,259,32.5v5.4A9.9,9.9,0,0,1,253.73,39.27Z"
fill-rule="evenodd"
></path>
<path
fill="currentColor"
d="M277.55,38.87V36.31a9.15,9.15,0,0,1-7.18,3c-4.46,0-8.14-2.57-8.14-7.26V32c0-5.18,3.94-7.57,9.56-7.57a16.74,16.74,0,0,1,5.8,1V25c0-2.79-1.73-4.34-5.09-4.34A17.57,17.57,0,0,0,266,21.92l-1.68-5.13a20.94,20.94,0,0,1,9.2-1.9c7.35,0,10.58,3.8,10.58,10.22V38.87Zm.13-9.55a10.31,10.31,0,0,0-4.3-.89c-2.87,0-4.64,1.15-4.64,3.27v.09c0,1.82,1.5,2.88,3.67,2.88,3.14,0,5.27-1.73,5.27-4.16Z"
fill-rule="evenodd"
></path>
<path
fill="currentColor"
d="M289.72,38.87V6.57h6.72v32.3Z"
fill-rule="evenodd"
></path>
<path
fill="currentColor"
d="M302.06,38.87V31.79h7.17v7.08Z"
fill-rule="evenodd"
></path>
</svg>
);
}
}

View File

@@ -152,5 +152,6 @@ function ItemsSuggestFieldRoot({
);
}
export const ItemsSuggestField =
R.compose(withDrawerActions)(ItemsSuggestFieldRoot);
export const ItemsSuggestField = R.compose(withDrawerActions)(
ItemsSuggestFieldRoot,
);

View File

@@ -1 +1 @@
export * from './Box';
export * from './Box';

View File

@@ -1 +1 @@
export * from './Group';
export * from './Group';

View File

@@ -1 +1 @@
export * from './Stack';
export * from './Stack';

View File

@@ -1,3 +1,3 @@
export * from './Box';
export * from './Group';
export * from './Stack';
export * from './Stack';

View File

@@ -15,12 +15,12 @@
* limitations under the License.
*/
import classNames from "classnames";
import React from "react";
import classNames from 'classnames';
import React from 'react';
// import {
// ,
// } from "@bluprintjs/core/src/components/common";
// ,
// } from "@bluprintjs/core/src/components/common";
// import { DISPLAYNAME_PREFIX } from "../../common/props";
import {
Icon,
@@ -28,11 +28,12 @@ import {
PopoverInteractionKind,
Text,
Menu,
Classes, Position,
Classes,
Position,
AbstractPureComponent2,
DISPLAYNAME_PREFIX,
Collapse
} from "@blueprintjs/core";
Collapse,
} from '@blueprintjs/core';
// export interface IMenuItemProps extends IActionProps, ILinkProps {
// // override from IActionProps to make it required
@@ -106,170 +107,186 @@ import {
// }
export class MenuItem extends AbstractPureComponent2 {
static get defaultProps() {
return {
disabled: false,
multiline: false,
popoverProps: {},
shouldDismissPopover: true,
text: "",
dropdownType: 'popover',
};
static get defaultProps() {
return {
disabled: false,
multiline: false,
popoverProps: {},
shouldDismissPopover: true,
text: '',
dropdownType: 'popover',
};
static get displayName() {
return `${DISPLAYNAME_PREFIX}.MenuItem`;
}
constructor(props) {
super(props);
this.state = {
isCollapseActive: this.props.callapseActive || false,
};
}
static get displayName() {
return `${DISPLAYNAME_PREFIX}.MenuItem`;
}
constructor(props) {
super(props);
this.state = {
isCollapseActive: this.props.callapseActive || false,
};
}
render() {
const {
active,
className,
children,
disabled,
icon,
intent,
labelClassName,
labelElement,
itemClassName,
multiline,
popoverProps,
shouldDismissPopover,
text,
textClassName,
tagName = 'a',
dropdownType,
caretIconSize = 16,
hasSubmenu,
...htmlProps
} = this.props;
const intentClass = Classes.intentClass(intent);
const anchorClasses = classNames(
Classes.MENU_ITEM,
intentClass,
{
[Classes.ACTIVE]: active,
[Classes.INTENT_PRIMARY]: active && intentClass == null,
[Classes.DISABLED]: disabled,
// prevent popover from closing when clicking on submenu trigger or disabled item
[Classes.POPOVER_DISMISS]:
shouldDismissPopover && !disabled && !hasSubmenu,
},
className,
);
const handleAnchorClick = (event) => {
htmlProps.onClick && htmlProps.onClick(event);
if (dropdownType === 'collapse') {
this.setState({ isCollapseActive: !this.state.isCollapseActive });
}
};
const target = React.createElement(
tagName,
{
...htmlProps,
...(disabled ? DISABLED_PROPS : {}),
className: anchorClasses,
onClick: handleAnchorClick,
},
<Icon icon={icon} />,
<Text
className={classNames(Classes.FILL, textClassName)}
ellipsize={!multiline}
>
{text}
</Text>,
this.maybeRenderLabel(labelElement),
hasSubmenu ? (
<Icon icon="caret-right" iconSize={caretIconSize} />
) : undefined,
);
render() {
const {
active,
className,
children,
disabled,
icon,
intent,
labelClassName,
labelElement,
itemClassName,
multiline,
popoverProps,
shouldDismissPopover,
text,
textClassName,
tagName = "a",
dropdownType,
caretIconSize = 16,
hasSubmenu,
...htmlProps
} = this.props;
const liClasses = classNames(
{ [Classes.MENU_SUBMENU]: hasSubmenu },
itemClassName,
);
return (
<li className={liClasses}>
{dropdownType === 'collapse'
? this.maybeRenderCollapse(target, children)
: this.maybeRenderPopover(target, children)}
</li>
);
}
const intentClass = Classes.intentClass(intent);
const anchorClasses = classNames(
Classes.MENU_ITEM,
intentClass,
{
[Classes.ACTIVE]: active,
[Classes.INTENT_PRIMARY]: active && intentClass == null,
[Classes.DISABLED]: disabled,
// prevent popover from closing when clicking on submenu trigger or disabled item
[Classes.POPOVER_DISMISS]: shouldDismissPopover && !disabled && !hasSubmenu,
},
className,
);
const handleAnchorClick = (event) => {
htmlProps.onClick && htmlProps.onClick(event);
if (dropdownType === 'collapse') {
this.setState({ isCollapseActive: !this.state.isCollapseActive });
}
};
const target = React.createElement(
tagName,
{
...htmlProps,
...(disabled ? DISABLED_PROPS : {}),
className: anchorClasses,
onClick: handleAnchorClick,
},
<Icon icon={icon} />,
<Text className={classNames(Classes.FILL, textClassName)} ellipsize={!multiline}>
{text}
</Text>,
this.maybeRenderLabel(labelElement),
hasSubmenu ? <Icon icon="caret-right" iconSize={caretIconSize} /> : undefined,
);
const liClasses = classNames({ [Classes.MENU_SUBMENU]: hasSubmenu }, itemClassName);
return <li className={liClasses}>{
(dropdownType === 'collapse') ?
this.maybeRenderCollapse(target, children) :
this.maybeRenderPopover(target, children)
}</li>;
componentWillReceiveProps(nextProps) {
if (nextProps.callapseActive !== this.props.callapseActive) {
//Perform some operation
this.setState({ isCollapseActive: nextProps.callapseActive });
}
}
componentWillReceiveProps(nextProps){
if(nextProps.callapseActive!==this.props.callapseActive){
//Perform some operation
this.setState({ isCollapseActive: nextProps.callapseActive });
}
maybeRenderLabel(labelElement) {
const { label, labelClassName } = this.props;
if (label == null && labelElement == null) {
return null;
}
return (
<span className={classNames(Classes.MENU_ITEM_LABEL, labelClassName)}>
{label}
{labelElement}
</span>
);
}
maybeRenderLabel(labelElement) {
const { label, labelClassName } = this.props;
if (label == null && labelElement == null) {
return null;
}
return (
<span className={classNames(Classes.MENU_ITEM_LABEL, labelClassName)}>
{label}
{labelElement}
</span>
);
maybeRenderCollapse(target, children) {
if (children == null) {
return target;
}
return (
<>
{target}
<Collapse
isOpen={this.state.isCollapseActive}
keepChildrenMounted={true}
>
{children}
</Collapse>
</>
);
}
maybeRenderCollapse(target, children) {
if (children == null) {
return target;
}
return (
<>
{target}
<Collapse isOpen={this.state.isCollapseActive} keepChildrenMounted={true}>
{ children }
</Collapse>
</>
);
}
maybeRenderPopover(target, children) {
if (children == null) {
return target;
}
const { disabled, popoverProps } = this.props;
return (
<Popover
autoFocus={false}
captureDismiss={false}
disabled={disabled}
enforceFocus={false}
hoverCloseDelay={0}
interactionKind={PopoverInteractionKind.HOVER}
modifiers={SUBMENU_POPOVER_MODIFIERS}
position={Position.RIGHT_TOP}
usePortal={false}
{...popoverProps}
content={<Menu>{children}</Menu>}
minimal={true}
popoverClassName={classNames(Classes.MENU_SUBMENU, popoverProps.popoverClassName)}
target={target}
/>
);
maybeRenderPopover(target, children) {
if (children == null) {
return target;
}
const { disabled, popoverProps } = this.props;
return (
<Popover
autoFocus={false}
captureDismiss={false}
disabled={disabled}
enforceFocus={false}
hoverCloseDelay={0}
interactionKind={PopoverInteractionKind.HOVER}
modifiers={SUBMENU_POPOVER_MODIFIERS}
position={Position.RIGHT_TOP}
usePortal={false}
{...popoverProps}
content={<Menu>{children}</Menu>}
minimal={true}
popoverClassName={classNames(
Classes.MENU_SUBMENU,
popoverProps.popoverClassName,
)}
target={target}
/>
);
}
}
const SUBMENU_POPOVER_MODIFIERS = {
// 20px padding - scrollbar width + a bit
flip: { boundariesElement: "viewport", padding: 20 },
// shift popover up 5px so MenuItems align
offset: { offset: -5 },
preventOverflow: { boundariesElement: "viewport", padding: 20 },
const SUBMENU_POPOVER_MODIFIERS = {
// 20px padding - scrollbar width + a bit
flip: { boundariesElement: 'viewport', padding: 20 },
// shift popover up 5px so MenuItems align
offset: { offset: -5 },
preventOverflow: { boundariesElement: 'viewport', padding: 20 },
};
// props to ignore when disabled
const DISABLED_PROPS = {
href: undefined,
onClick: undefined,
onMouseDown: undefined,
onMouseEnter: undefined,
onMouseLeave: undefined,
tabIndex: -1,
href: undefined,
onClick: undefined,
onMouseDown: undefined,
onMouseEnter: undefined,
onMouseLeave: undefined,
tabIndex: -1,
};

View File

@@ -3,7 +3,5 @@ import React from 'react';
import { formattedAmount } from '@/utils';
export function Money({ amount, currency }) {
return (
<span>{ formattedAmount(amount, currency) }</span>
);
}
return <span>{formattedAmount(amount, currency)}</span>;
}

View File

@@ -6,9 +6,7 @@ import { useIsFetching } from '@tanstack/react-query';
function AppProgress() {
const isFetching = useIsFetching();
return (
<Progress isAnimating={isFetching} />
);
};
export default AppProgress;
return <Progress isAnimating={isFetching} />;
}
export default AppProgress;

View File

@@ -1,6 +1,6 @@
// @ts-nocheck
import PropTypes from 'prop-types'
import * as React from 'react'
import PropTypes from 'prop-types';
import * as React from 'react';
const Bar = ({ progress, animationDuration }) => (
<div
@@ -29,11 +29,11 @@ const Bar = ({ progress, animationDuration }) => (
}}
/>
</div>
)
);
Bar.propTypes = {
animationDuration: PropTypes.number.isRequired,
progress: PropTypes.number.isRequired,
}
};
export default Bar;

View File

@@ -1,6 +1,6 @@
// @ts-nocheck
import PropTypes from 'prop-types'
import * as React from 'react'
import PropTypes from 'prop-types';
import * as React from 'react';
const Container = ({ children, isFinished, animationDuration }) => (
<div
@@ -12,12 +12,12 @@ const Container = ({ children, isFinished, animationDuration }) => (
>
{children}
</div>
)
);
Container.propTypes = {
animationDuration: PropTypes.number.isRequired,
children: PropTypes.node.isRequired,
isFinished: PropTypes.bool.isRequired,
}
};
export default Container;

View File

@@ -1,26 +1,23 @@
// @ts-nocheck
import React from 'react'
import { useNProgress } from '@tanem/react-nprogress'
import PropTypes from 'prop-types'
import React from 'react';
import { useNProgress } from '@tanem/react-nprogress';
import PropTypes from 'prop-types';
import Bar from './Bar'
import Container from './Container'
import Bar from './Bar';
import Container from './Container';
const Progress = ({
isAnimating,
minimum = 0.2
}) => {
const Progress = ({ isAnimating, minimum = 0.2 }) => {
const { animationDuration, isFinished, progress } = useNProgress({
isAnimating, minimum,
isAnimating,
minimum,
});
return (
<Container isFinished={isFinished} animationDuration={animationDuration}>
<Bar progress={progress} animationDuration={animationDuration} />
</Container>
)
}
);
};
Progress.propTypes = {
isAnimating: PropTypes.bool.isRequired,

View File

@@ -1,5 +1,5 @@
// @ts-nocheck
import * as React from 'react'
import * as React from 'react';
const Spinner = () => (
<div
@@ -25,6 +25,6 @@ const Spinner = () => (
}}
/>
</div>
)
);
export default Spinner;

View File

@@ -11,7 +11,7 @@ import { FormattedMessage as T } from '@/components';
export default function NumberFormatFooter({
// #ownProps
onCancelClick,
submitDisabled
submitDisabled,
}) {
return (
<div className={classNames('number-format-dropdown__footer')}>

View File

@@ -3,7 +3,6 @@ import * as Yup from 'yup';
import { DATATYPES_LENGTH } from '@/constants/dataTypes';
import { defaultTo } from 'lodash';
const Schema = Yup.object().shape({
format_money: Yup.string(),
show_zero: Yup.boolean(),

View File

@@ -22,7 +22,7 @@ export default function NumberFormatDropdown({
divideOn1000: false,
negativeFormat: 'mines',
precision: 2,
...numberFormat
...numberFormat,
};
// Handle cancel button click.
const handleCancelClick = useCallback(() => {}, []);

View File

@@ -2,4 +2,4 @@
export * from './FormTopbar';
export * from './FormTopbarSelectInputs';
export * from './PageFormBigNumber';
export * from './PageForm';
export * from './PageForm';

View File

@@ -9,10 +9,7 @@ interface PaperProps extends SystemProps {
export const Paper = ({ children, ...props }: PaperProps) => {
return (
<x.div
{...props}
className={clsx(styles.root)}
>
<x.div {...props} className={clsx(styles.root)}>
{children}
</x.div>
);

View File

@@ -1,2 +1,2 @@
// @ts-nocheck
export * from './Paper';
export * from './Paper';

View File

@@ -1,23 +1,26 @@
// @ts-nocheck
import React from 'react';
import preferencesTabs from '@/routes/preferencesTabs';
import {Switch, Route, useRouteMatch} from 'react-router-dom';
import { Switch, Route, useRouteMatch } from 'react-router-dom';
export default function PreferencesSubContent({ preferenceTab }) {
const routes = preferencesTabs[preferenceTab];
const { path } = useRouteMatch();
if (routes.length <= 0) { return null; }
if (routes.length <= 0) {
return null;
}
return (
<Switch>
{ routes.map((route, index) => (
{routes.map((route, index) => (
<Route
key={index}
path={`${path}/${route.path}`}
exact={route.exact}
component={route.component}
/>
/>
))}
</Switch>);
}
</Switch>
);
}

View File

@@ -1 +1 @@
export * from './RichEditor';
export * from './RichEditor';

View File

@@ -231,9 +231,7 @@ export const Section: React.FC<SectionProps> = React.forwardRef(
)}
{collapsible ? (
// @ts-ignore
<Collapse isOpen={!isCollapsed}>
{children}
</Collapse>
<Collapse isOpen={!isCollapsed}>{children}</Collapse>
) : (
children
)}

View File

@@ -1,2 +1,2 @@
export * from './Section';
export * from './SectionCard';
export * from './SectionCard';

View File

@@ -1,4 +1,4 @@
// @ts-nocheck
export * from './ListSelect';
export * from './SalutationList';
export * from './DisplayNameList'
export * from './DisplayNameList';

View File

@@ -1 +1 @@
export * from './Stepper';
export * from './Stepper';

View File

@@ -1,7 +1,5 @@
export enum StepperStepState {
Progress = 'stepProgress',
Completed = 'stepCompleted',
Inactive = 'stepInactive',
}
}

Some files were not shown because too many files have changed in this diff Show More