@devtron-labs/devtron-fe-common-lib 0.0.7-beta-2 → 0.0.7-beta-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/64232fbb58cec80f.png +0 -0
- package/dist/Common/BreadCrumb/BreadCrumb.d.ts +1 -29
- package/dist/Common/BreadCrumb/Types.d.ts +28 -0
- package/dist/Common/Checkbox.d.ts +1 -14
- package/dist/Common/Dialogs/ConfirmationDialog.d.ts +5 -16
- package/dist/Common/Dialogs/Types.d.ts +16 -0
- package/dist/Common/EmptyState/GenericEmptyState.d.ts +5 -0
- package/dist/Common/Error.d.ts +0 -1
- package/dist/Common/InfoColorBar/InfoColourbar.d.ts +2 -15
- package/dist/Common/Modals/Modal.d.ts +2 -9
- package/dist/Common/MultiSelectCustomization.d.ts +1 -2
- package/dist/Common/PopupMenu.d.ts +4 -21
- package/dist/Common/Progressing.d.ts +2 -11
- package/dist/Common/RadioGroup.d.ts +1 -10
- package/dist/Common/Reload.d.ts +2 -4
- package/dist/Common/TippyCustomized.d.ts +2 -30
- package/dist/Common/Types.d.ts +127 -0
- package/dist/Common/index.d.ts +1 -0
- package/dist/index.js +43 -28
- package/package.json +1 -1
- package/src/Assets/Img/app-not-deployed.png +0 -0
- package/src/Common/BreadCrumb/BreadCrumb.tsx +1 -30
- package/src/Common/BreadCrumb/Types.ts +30 -0
- package/src/Common/Checkbox.tsx +1 -15
- package/src/Common/Dialogs/ConfirmationDialog.tsx +6 -4
- package/src/Common/Dialogs/DialogForm.tsx +1 -1
- package/src/Common/Dialogs/Types.ts +16 -0
- package/src/Common/EmptyState/GenericEmptyState.tsx +40 -0
- package/src/Common/EmptyState/emptyState.scss +4 -15
- package/src/Common/Error.tsx +11 -15
- package/src/Common/ErrorScreenNotFound.tsx +22 -29
- package/src/Common/InfoColorBar/InfoColourbar.tsx +2 -16
- package/src/Common/Modals/Modal.tsx +3 -1
- package/src/Common/Modals/OpaqueModal.tsx +1 -1
- package/src/Common/MultiSelectCustomization.tsx +1 -1
- package/src/Common/PopupMenu.tsx +19 -6
- package/src/Common/Progressing.tsx +1 -10
- package/src/Common/RadioGroup.tsx +1 -12
- package/src/Common/Reload.tsx +15 -10
- package/src/Common/TippyCustomized.tsx +2 -30
- package/src/Common/Types.ts +139 -0
- package/src/Common/index.ts +2 -0
- package/src/Assets/Icon/ic-close.svg +0 -9
package/package.json
CHANGED
|
Binary file
|
|
@@ -2,32 +2,9 @@ import React, { useMemo, useEffect } from 'react'
|
|
|
2
2
|
import { Link, useRouteMatch, useParams } from 'react-router-dom'
|
|
3
3
|
import { useBreadcrumbContext } from './BreadcrumbStore'
|
|
4
4
|
import { ConditionalWrap } from '../Helper'
|
|
5
|
+
import { Breadcrumb, Breadcrumbs, UseBreadcrumbOptionalProps, UseBreadcrumbState } from './Types'
|
|
5
6
|
export const BreadcrumbContext = React.createContext(null)
|
|
6
7
|
|
|
7
|
-
interface Breadcrumb {
|
|
8
|
-
to: string
|
|
9
|
-
name: string
|
|
10
|
-
className?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface UseBreadcrumbState {
|
|
14
|
-
breadcrumbs: Breadcrumb[]
|
|
15
|
-
setCrumb: (props: { [key: string]: any }) => void
|
|
16
|
-
resetCrumb: (props: string[]) => void
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface AdvancedAlias {
|
|
20
|
-
component: any
|
|
21
|
-
linked: boolean
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface UseBreadcrumbProps {
|
|
25
|
-
sep?: string
|
|
26
|
-
alias?: { [key: string]: AdvancedAlias | any }
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type UseBreadcrumbOptionalProps = UseBreadcrumbProps | null
|
|
30
|
-
|
|
31
8
|
export function useBreadcrumb(props?: UseBreadcrumbOptionalProps, deps?: any[]): UseBreadcrumbState {
|
|
32
9
|
let sep = props?.sep || '/'
|
|
33
10
|
deps = deps || []
|
|
@@ -91,12 +68,6 @@ export function useBreadcrumb(props?: UseBreadcrumbOptionalProps, deps?: any[]):
|
|
|
91
68
|
return { breadcrumbs, setCrumb, resetCrumb }
|
|
92
69
|
}
|
|
93
70
|
|
|
94
|
-
interface Breadcrumbs {
|
|
95
|
-
breadcrumbs: Breadcrumb[]
|
|
96
|
-
sep?: string
|
|
97
|
-
className?: string
|
|
98
|
-
}
|
|
99
|
-
|
|
100
71
|
export const BreadCrumb: React.FC<Breadcrumbs> = ({
|
|
101
72
|
breadcrumbs,
|
|
102
73
|
sep = '/',
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
export interface Breadcrumb {
|
|
3
|
+
to: string
|
|
4
|
+
name: string
|
|
5
|
+
className?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface UseBreadcrumbState {
|
|
9
|
+
breadcrumbs: Breadcrumb[]
|
|
10
|
+
setCrumb: (props: { [key: string]: any }) => void
|
|
11
|
+
resetCrumb: (props: string[]) => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface AdvancedAlias {
|
|
15
|
+
component: any
|
|
16
|
+
linked: boolean
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface UseBreadcrumbProps {
|
|
20
|
+
sep?: string
|
|
21
|
+
alias?: { [key: string]: AdvancedAlias | any }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface Breadcrumbs {
|
|
25
|
+
breadcrumbs: Breadcrumb[]
|
|
26
|
+
sep?: string
|
|
27
|
+
className?: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type UseBreadcrumbOptionalProps = UseBreadcrumbProps | null
|
package/src/Common/Checkbox.tsx
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import React, { Component } from 'react'
|
|
2
|
-
|
|
3
|
-
export enum CHECKBOX_VALUE {
|
|
4
|
-
CHECKED = 'CHECKED',
|
|
5
|
-
INTERMEDIATE = 'INTERMEDIATE',
|
|
6
|
-
}
|
|
7
|
-
export interface CheckboxProps {
|
|
8
|
-
onChange: (event) => void
|
|
9
|
-
isChecked: boolean
|
|
10
|
-
value: 'CHECKED' | 'INTERMEDIATE'
|
|
11
|
-
disabled?: boolean
|
|
12
|
-
tabIndex?: number
|
|
13
|
-
rootClassName?: string
|
|
14
|
-
onClick?: (event) => void
|
|
15
|
-
id?: string
|
|
16
|
-
}
|
|
2
|
+
import { CheckboxProps } from './Types'
|
|
17
3
|
|
|
18
4
|
/*
|
|
19
5
|
Valid States of Checkbox:
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { VisibleModal2 } from '../Modals/VisibleModal2'
|
|
3
|
-
|
|
3
|
+
import { ConfirmationDialogBodyType, ConfirmationDialogButtonGroupType, ConfirmationDialogIconType, ConfirmationDialogType } from './Types'
|
|
4
|
+
|
|
5
|
+
function ConfirmationDialog({ className = '', children }: ConfirmationDialogType) {
|
|
4
6
|
return (
|
|
5
7
|
<VisibleModal2 className="confirmation-dialog">
|
|
6
8
|
<div className={`confirmation-dialog__body ${className}`}>{children}</div>
|
|
@@ -8,11 +10,11 @@ function ConfirmationDialog({ className = '', children }) {
|
|
|
8
10
|
)
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
function Icon({ src, className = '' }) {
|
|
13
|
+
function Icon({ src, className = '' }: ConfirmationDialogIconType) {
|
|
12
14
|
return <img src={src} className={`confirmation-dialog__icon ${className}`} alt="" />
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
function Body({ title, subtitle = null, children = null }) {
|
|
17
|
+
function Body({ title, subtitle = null, children = null }: ConfirmationDialogBodyType) {
|
|
16
18
|
return (
|
|
17
19
|
<div className="flex left column ">
|
|
18
20
|
<h3 className="confirmation-dialog__title lh-1-25 dc__break-word w-100">{title}</h3>
|
|
@@ -22,7 +24,7 @@ function Body({ title, subtitle = null, children = null }) {
|
|
|
22
24
|
)
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
function ButtonGroup({ children }) {
|
|
27
|
+
function ButtonGroup({ children }: ConfirmationDialogButtonGroupType) {
|
|
26
28
|
return <div className="flex right confirmation-dialog__button-group">{children}</div>
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component, createContext } from 'react';
|
|
2
2
|
import { VisibleModal } from '../Modals/VisibleModal';
|
|
3
|
-
import close from '../../Assets/Icon/ic-
|
|
3
|
+
import close from '../../Assets/Icon/ic-cross.svg';
|
|
4
4
|
import { Progressing } from '../Progressing'
|
|
5
5
|
//TODO: may not need context
|
|
6
6
|
const DialogFormContext = createContext({ title: '', isLoading: false, close: (event) => {}, onSave: (event) => {} });
|
|
@@ -14,3 +14,19 @@ export interface ForceDeleteDialogType {
|
|
|
14
14
|
forceDeleteDialogTitle: string
|
|
15
15
|
forceDeleteDialogMessage: string
|
|
16
16
|
}
|
|
17
|
+
export interface ConfirmationDialogType {
|
|
18
|
+
className?: string
|
|
19
|
+
children: any
|
|
20
|
+
}
|
|
21
|
+
export interface ConfirmationDialogIconType {
|
|
22
|
+
src: string
|
|
23
|
+
className?: string
|
|
24
|
+
}
|
|
25
|
+
export interface ConfirmationDialogBodyType {
|
|
26
|
+
title: string
|
|
27
|
+
subtitle?: string
|
|
28
|
+
children?: any
|
|
29
|
+
}
|
|
30
|
+
export interface ConfirmationDialogButtonGroupType {
|
|
31
|
+
children: any
|
|
32
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import AppNotDeployed from '../../Assets/Img/app-not-deployed.png'
|
|
3
|
+
import { GenericEmptyStateType, ImageType } from '../Types'
|
|
4
|
+
import './emptyState.scss'
|
|
5
|
+
|
|
6
|
+
function GenericEmptyState({
|
|
7
|
+
title,
|
|
8
|
+
image,
|
|
9
|
+
subTitle,
|
|
10
|
+
isButtonAvailable,
|
|
11
|
+
classname,
|
|
12
|
+
styles,
|
|
13
|
+
heightToDeduct,
|
|
14
|
+
imageType,
|
|
15
|
+
renderButton,
|
|
16
|
+
imageClassName,
|
|
17
|
+
children,
|
|
18
|
+
noImage
|
|
19
|
+
}: GenericEmptyStateType): JSX.Element {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
className={`flex column empty-state ${classname ? classname : ''}`}
|
|
23
|
+
style={styles}
|
|
24
|
+
{...(heightToDeduct >= 0 && { style: { ...styles, height: `calc(100vh - ${heightToDeduct}px)` } })}
|
|
25
|
+
>
|
|
26
|
+
{!noImage && <img className={imageClassName ? imageClassName : ''}
|
|
27
|
+
src={image || AppNotDeployed}
|
|
28
|
+
width={imageType === ImageType.Medium ? '200' : '250'}
|
|
29
|
+
height={imageType === ImageType.Medium ? '160' : '200'}
|
|
30
|
+
alt="empty-state"
|
|
31
|
+
/>}
|
|
32
|
+
<h4 className="title fw-6 cn-9 mb-8">{title}</h4>
|
|
33
|
+
{subTitle && <p className="subtitle">{subTitle}</p>}
|
|
34
|
+
{isButtonAvailable && renderButton()}
|
|
35
|
+
{children}
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default GenericEmptyState
|
|
@@ -19,12 +19,9 @@
|
|
|
19
19
|
h6 {
|
|
20
20
|
color: var(--N900);
|
|
21
21
|
}
|
|
22
|
-
.title {
|
|
23
|
-
font-weight: 600;
|
|
24
|
-
}
|
|
25
22
|
.subtitle {
|
|
26
23
|
font-size: 13px;
|
|
27
|
-
width:
|
|
24
|
+
width: 300px;
|
|
28
25
|
font-weight: 400;
|
|
29
26
|
text-align: center;
|
|
30
27
|
line-height: 1.5;
|
|
@@ -34,7 +31,7 @@
|
|
|
34
31
|
height: 36px;
|
|
35
32
|
}
|
|
36
33
|
p {
|
|
37
|
-
width:
|
|
34
|
+
width: 300px;
|
|
38
35
|
text-align: center;
|
|
39
36
|
font-size: 13px;
|
|
40
37
|
color: var(--N700);
|
|
@@ -68,16 +65,8 @@
|
|
|
68
65
|
color: var(--N900);
|
|
69
66
|
}
|
|
70
67
|
.button__icon {
|
|
71
|
-
width:16px;
|
|
72
|
-
height:16px;
|
|
68
|
+
width: 16px;
|
|
69
|
+
height: 16px;
|
|
73
70
|
margin-left: 8px;
|
|
74
71
|
}
|
|
75
|
-
//TODO: use name
|
|
76
|
-
// .subtitle a {
|
|
77
|
-
// color: inherit;
|
|
78
|
-
// }
|
|
79
|
-
// .subtitle a:focus,
|
|
80
|
-
// .subtitle a:hover {
|
|
81
|
-
// color: inherit;
|
|
82
|
-
// }
|
|
83
72
|
}
|
package/src/Common/Error.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { Component } from 'react'
|
|
2
2
|
import EmptyState from './EmptyState/EmptyState'
|
|
3
3
|
import notAuthorized from '../Assets/Img/ic-not-authorized.svg'
|
|
4
|
-
import Reload from './Reload'
|
|
5
4
|
import ErrorScreenNotFound from './ErrorScreenNotFound'
|
|
6
5
|
import { ERROR_EMPTY_SCREEN } from './Constants'
|
|
6
|
+
import GenericEmptyState from './EmptyState/GenericEmptyState'
|
|
7
|
+
import Reload from './Reload'
|
|
7
8
|
|
|
8
9
|
export class ErrorScreenManager extends Component<{
|
|
9
10
|
code?: number
|
|
@@ -19,7 +20,9 @@ export class ErrorScreenManager extends Component<{
|
|
|
19
20
|
case 401:
|
|
20
21
|
return 'Unauthorized'
|
|
21
22
|
case 403:
|
|
22
|
-
return
|
|
23
|
+
return (
|
|
24
|
+
<ErrorScreenNotAuthorized subtitle={this.props.subtitle} />
|
|
25
|
+
)
|
|
23
26
|
case 404:
|
|
24
27
|
return <ErrorScreenNotFound />
|
|
25
28
|
case 500:
|
|
@@ -45,21 +48,14 @@ export class ErrorScreenManager extends Component<{
|
|
|
45
48
|
export class ErrorScreenNotAuthorized extends Component<{
|
|
46
49
|
subtitle?: React.ReactChild
|
|
47
50
|
title?: string
|
|
48
|
-
subtitleClass?: string
|
|
49
51
|
}> {
|
|
50
52
|
render() {
|
|
51
53
|
return (
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<h3 className="title">{this.props.title ?? ERROR_EMPTY_SCREEN.NOT_AUTHORIZED}</h3>
|
|
58
|
-
</EmptyState.Title>
|
|
59
|
-
<EmptyState.Subtitle className={this.props.subtitleClass}>
|
|
60
|
-
{this.props.subtitle ?? ERROR_EMPTY_SCREEN.ONLY_FOR_SUPERADMIN}
|
|
61
|
-
</EmptyState.Subtitle>
|
|
62
|
-
</EmptyState>
|
|
54
|
+
<GenericEmptyState
|
|
55
|
+
image={notAuthorized}
|
|
56
|
+
title={this.props.title ?? ERROR_EMPTY_SCREEN.NOT_AUTHORIZED}
|
|
57
|
+
subTitle={this.props.subtitle ?? ERROR_EMPTY_SCREEN.ONLY_FOR_SUPERADMIN}
|
|
58
|
+
/>
|
|
63
59
|
)
|
|
64
60
|
}
|
|
65
|
-
}
|
|
61
|
+
}
|
|
@@ -1,38 +1,31 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import notFound from '../Assets/Img/ic-empty-error@2x.png'
|
|
3
3
|
import { useHistory } from 'react-router'
|
|
4
|
-
import EmptyState from './EmptyState/EmptyState'
|
|
5
4
|
import { ERROR_EMPTY_SCREEN } from './Constants'
|
|
5
|
+
import GenericEmptyState from './EmptyState/GenericEmptyState'
|
|
6
6
|
|
|
7
7
|
function ErrorScreenNotFound() {
|
|
8
|
-
|
|
8
|
+
const history = useHistory()
|
|
9
|
+
const redirectToHome = () => {
|
|
10
|
+
history.push('/app/list')
|
|
11
|
+
}
|
|
12
|
+
const renderGenerateButton = () => {
|
|
13
|
+
return (
|
|
14
|
+
<button className="flex cta h-32" onClick={redirectToHome}>
|
|
15
|
+
{ERROR_EMPTY_SCREEN.TAKE_BACK_HOME}
|
|
16
|
+
</button>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
9
19
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</EmptyState.Image>
|
|
20
|
-
<EmptyState.Title>
|
|
21
|
-
<h3 className="title">{ERROR_EMPTY_SCREEN.PAGE_NOT_FOUND}</h3>
|
|
22
|
-
</EmptyState.Title>
|
|
23
|
-
<EmptyState.Subtitle >
|
|
24
|
-
<p>{ERROR_EMPTY_SCREEN.PAGE_NOT_EXIST}</p>
|
|
25
|
-
</EmptyState.Subtitle>
|
|
26
|
-
<EmptyState.Button>
|
|
27
|
-
<button className="flex cta h-32"
|
|
28
|
-
onClick={redirectToHome}
|
|
29
|
-
>
|
|
30
|
-
{ERROR_EMPTY_SCREEN.TAKE_BACK_HOME}
|
|
31
|
-
</button>
|
|
32
|
-
</EmptyState.Button>
|
|
33
|
-
</EmptyState>
|
|
34
|
-
</div>
|
|
35
|
-
)
|
|
20
|
+
return (
|
|
21
|
+
<GenericEmptyState
|
|
22
|
+
image={notFound}
|
|
23
|
+
title={ERROR_EMPTY_SCREEN.PAGE_NOT_FOUND}
|
|
24
|
+
subTitle={ERROR_EMPTY_SCREEN.PAGE_NOT_EXIST}
|
|
25
|
+
isButtonAvailable={true}
|
|
26
|
+
renderButton={renderGenerateButton}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
36
29
|
}
|
|
37
30
|
|
|
38
|
-
export default ErrorScreenNotFound
|
|
31
|
+
export default ErrorScreenNotFound
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react'
|
|
2
2
|
import { Link } from 'react-router-dom'
|
|
3
|
+
import { InfoColourBarType } from '../Types'
|
|
3
4
|
import './infoColourBar.scss'
|
|
4
5
|
|
|
5
|
-
interface InfoColourBarType {
|
|
6
|
-
message: React.ReactNode
|
|
7
|
-
classname: string
|
|
8
|
-
Icon
|
|
9
|
-
iconClass?: string
|
|
10
|
-
iconSize?: number // E.g. 16, 20, etc.. Currently, there are around 12 sizes supported. Check `icons.css` or `base.scss` for supported sizes or add new size (class names starts with `icon-dim-`).
|
|
11
|
-
renderActionButton?: () => JSX.Element
|
|
12
|
-
linkText?: React.ReactNode
|
|
13
|
-
redirectLink?: string
|
|
14
|
-
linkOnClick?: () => void
|
|
15
|
-
linkClass?: string
|
|
16
|
-
internalLink?: boolean
|
|
17
|
-
styles?: CSSProperties
|
|
18
|
-
}
|
|
19
|
-
|
|
20
6
|
function InfoColourBar({
|
|
21
7
|
message,
|
|
22
8
|
classname,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { useEffect } from 'react'
|
|
2
2
|
import ReactDOM from 'react-dom'
|
|
3
|
+
import { ModalType } from '../Types'
|
|
4
|
+
|
|
3
5
|
export const Modal = ({
|
|
4
6
|
style = {},
|
|
5
7
|
children,
|
|
@@ -8,7 +10,7 @@ export const Modal = ({
|
|
|
8
10
|
onClick = null,
|
|
9
11
|
callbackRef = null,
|
|
10
12
|
preventWheelDisable = false,
|
|
11
|
-
}) => {
|
|
13
|
+
}: ModalType) => {
|
|
12
14
|
const innerRef = React.useRef(null)
|
|
13
15
|
function handleClick(e) {
|
|
14
16
|
if (typeof onClick !== 'function') return
|
package/src/Common/PopupMenu.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import React, { useEffect } from 'react'
|
|
2
|
-
import {Modal} from './Modals/Modal'
|
|
3
|
-
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { Modal } from './Modals/Modal'
|
|
3
|
+
import { PopupMenuBodyType, PopupMenuButtonType, PopupMenuType } from './Types'
|
|
4
|
+
|
|
5
|
+
const PopupContext = React.createContext(null)
|
|
4
6
|
|
|
5
7
|
function usePopupContext() {
|
|
6
8
|
const context = React.useContext(PopupContext)
|
|
@@ -10,7 +12,12 @@ function usePopupContext() {
|
|
|
10
12
|
return context
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
function PopupMenu({
|
|
15
|
+
function PopupMenu({
|
|
16
|
+
children = null,
|
|
17
|
+
onToggleCallback = null,
|
|
18
|
+
autoClose = false,
|
|
19
|
+
autoPosition = false,
|
|
20
|
+
}: PopupMenuType) {
|
|
14
21
|
const [popupPosition, setPopupPosition] = React.useState(null)
|
|
15
22
|
const [opacity, setOpacity] = React.useState(0)
|
|
16
23
|
const observer = React.useRef<IntersectionObserver | null>(null)
|
|
@@ -135,7 +142,7 @@ function Button({
|
|
|
135
142
|
tabIndex = 0,
|
|
136
143
|
onHover = false,
|
|
137
144
|
isKebab = false,
|
|
138
|
-
}) {
|
|
145
|
+
}: PopupMenuButtonType) {
|
|
139
146
|
const { handleOpen, popupPosition, buttonRef, initialiseButtonWidth } = usePopupContext()
|
|
140
147
|
return (
|
|
141
148
|
<button
|
|
@@ -154,7 +161,13 @@ function Button({
|
|
|
154
161
|
)
|
|
155
162
|
}
|
|
156
163
|
|
|
157
|
-
function Body({
|
|
164
|
+
function Body({
|
|
165
|
+
children = null,
|
|
166
|
+
rootClassName = '',
|
|
167
|
+
style = {},
|
|
168
|
+
autoWidth = false,
|
|
169
|
+
preventWheelDisable = false,
|
|
170
|
+
}: PopupMenuBodyType) {
|
|
158
171
|
const { handleClose, popupPosition, opacity, callbackRef, buttonWidth } = usePopupContext()
|
|
159
172
|
return popupPosition ? (
|
|
160
173
|
<Modal
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
|
|
3
|
-
interface ProgressingProps {
|
|
4
|
-
pageLoader?: boolean
|
|
5
|
-
loadingText?: string
|
|
6
|
-
size?: number
|
|
7
|
-
fullHeight?: boolean
|
|
8
|
-
theme?: 'white' | 'default'
|
|
9
|
-
styles?: React.CSSProperties
|
|
10
|
-
children?: React.ReactNode
|
|
11
|
-
}
|
|
2
|
+
import { ProgressingProps } from './Types'
|
|
12
3
|
|
|
13
4
|
export function Progressing({ pageLoader, size, theme, styles }: ProgressingProps): JSX.Element {
|
|
14
5
|
const loaderSize = size ? `${size}px` : pageLoader ? '48px' : '20px'
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React, { Component, createContext } from 'react'
|
|
2
|
+
import { RadioGroupItemProps, RadioGroupProps } from './Types'
|
|
2
3
|
const RadioGroupContext = createContext({ name: '', value: '', disabled: false, onChange: (event) => {} })
|
|
3
4
|
|
|
4
|
-
export interface RadioGroupItemProps {
|
|
5
|
-
value: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
5
|
export class RadioGroupItem extends Component<RadioGroupItemProps> {
|
|
9
6
|
render() {
|
|
10
7
|
return (
|
|
@@ -35,14 +32,6 @@ export class RadioGroupItem extends Component<RadioGroupItemProps> {
|
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
34
|
|
|
38
|
-
export interface RadioGroupProps {
|
|
39
|
-
value: string
|
|
40
|
-
name: string
|
|
41
|
-
disabled?: boolean
|
|
42
|
-
onChange: (event) => void
|
|
43
|
-
className?: string
|
|
44
|
-
}
|
|
45
|
-
|
|
46
35
|
export class RadioGroup extends Component<RadioGroupProps> {
|
|
47
36
|
render() {
|
|
48
37
|
return (
|
package/src/Common/Reload.tsx
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import loadingFailure from '../Assets/Img/ic-loading-failure.png'
|
|
2
|
+
import loadingFailure from '../Assets/Img/ic-loading-failure.png'
|
|
3
|
+
import { ReloadType } from './Types'
|
|
3
4
|
|
|
4
|
-
export default function Reload({ reload
|
|
5
|
-
function refresh(e){
|
|
6
|
-
window.location.reload()
|
|
5
|
+
export default function Reload({ reload, className = '' }: ReloadType) {
|
|
6
|
+
function refresh(e) {
|
|
7
|
+
window.location.reload()
|
|
7
8
|
}
|
|
8
9
|
return (
|
|
9
|
-
<article className={`flex ${className}`}
|
|
10
|
-
<div className="flex column
|
|
11
|
-
<img src={loadingFailure} style={{
|
|
10
|
+
<article className={`flex w-100 h-100 ${className}`}>
|
|
11
|
+
<div className="flex column w-250 dc__align-center">
|
|
12
|
+
<img src={loadingFailure} style={{ height: 'auto' }} className="w-100 mb-12" alt="load-error" />
|
|
12
13
|
<h3 className="title dc__bold">Failed to load</h3>
|
|
13
|
-
<div className="dc__empty__subtitle"
|
|
14
|
-
|
|
14
|
+
<div className="dc__empty__subtitle mb-20">
|
|
15
|
+
We could not load this page. Please give us another try.
|
|
16
|
+
</div>
|
|
17
|
+
<button type="button" className="cta ghosted" onClick={typeof reload === 'function' ? reload : refresh}>
|
|
18
|
+
Retry
|
|
19
|
+
</button>
|
|
15
20
|
</div>
|
|
16
21
|
</article>
|
|
17
22
|
)
|
|
18
|
-
}
|
|
23
|
+
}
|
|
@@ -1,36 +1,8 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useRef } from 'react'
|
|
2
2
|
import Tippy from '@tippyjs/react'
|
|
3
|
-
import { Placement } from 'tippy.js'
|
|
4
3
|
import { ReactComponent as CloseIcon } from '../Assets/Icon/ic-cross.svg'
|
|
5
4
|
import 'tippy.js/animations/shift-toward-subtle.css'
|
|
6
|
-
import { TippyTheme } from './Types'
|
|
7
|
-
|
|
8
|
-
interface TippyCustomizedProps {
|
|
9
|
-
theme: TippyTheme
|
|
10
|
-
visible?: boolean
|
|
11
|
-
heading?: string
|
|
12
|
-
infoTextHeading?: string
|
|
13
|
-
placement: Placement
|
|
14
|
-
className?: string
|
|
15
|
-
Icon?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>
|
|
16
|
-
iconPath?: string
|
|
17
|
-
iconClass?: string
|
|
18
|
-
iconSize?: number // E.g. 16, 20, etc.. Currently, there are around 12 sizes supported. Check `icons.css` or `base.scss` for supported sizes or add new size (class names starts with `icon-dim-`).
|
|
19
|
-
onImageLoadError?: (e) => void
|
|
20
|
-
onClose?: () => void
|
|
21
|
-
infoText?: string
|
|
22
|
-
showCloseButton?: boolean
|
|
23
|
-
arrow?: boolean
|
|
24
|
-
interactive?: boolean
|
|
25
|
-
showOnCreate?: boolean
|
|
26
|
-
trigger?: string
|
|
27
|
-
animation?: string
|
|
28
|
-
duration?: number
|
|
29
|
-
additionalContent?: ReactNode
|
|
30
|
-
documentationLink?: string
|
|
31
|
-
documentationLinkText?: string
|
|
32
|
-
children: React.ReactElement<any>
|
|
33
|
-
}
|
|
5
|
+
import { TippyCustomizedProps, TippyTheme } from './Types'
|
|
34
6
|
|
|
35
7
|
// This component will handle some of the new tippy designs and interactions
|
|
36
8
|
// So this can be updated to support further for new features or interactions
|