goobs-frontend 0.7.61 → 0.7.64
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/package.json +2 -2
- package/src/components/Button/hook/useHelperFooter.tsx +251 -0
- package/src/components/Button/index.tsx +114 -127
- package/src/components/ConfirmationCodeInput/index.tsx +2 -2
- package/src/components/Content/Structure/button/useButton.tsx +0 -2
- package/src/components/Content/index.tsx +13 -7
- package/src/components/Form/Popup/index.tsx +29 -10
- package/src/components/Icons/ShowHideEye.tsx +8 -2
- package/src/components/Nav/HorizontalVariant/index.tsx +11 -4
- package/src/components/Nav/index.tsx +2 -14
- package/src/components/StyledComponent/adornment/index.tsx +6 -8
- package/src/components/StyledComponent/helperfooter/useHelperFooter.tsx +418 -317
- package/src/components/StyledComponent/hooks/useDropdown.tsx +48 -5
- package/src/components/StyledComponent/hooks/usePhoneNumber.tsx +70 -28
- package/src/components/StyledComponent/index.tsx +102 -18
- package/src/components/StyledComponent/hooks/usePassword.tsx +0 -23
|
@@ -8,7 +8,7 @@ import React, {
|
|
|
8
8
|
useCallback,
|
|
9
9
|
} from 'react'
|
|
10
10
|
import { Close } from '@mui/icons-material'
|
|
11
|
-
import { Dialog, IconButton, Box } from '@mui/material'
|
|
11
|
+
import { Dialog, IconButton, Box, DialogProps } from '@mui/material'
|
|
12
12
|
import ContentSection, { ContentSectionProps } from '../../Content'
|
|
13
13
|
import { formContainerStyle } from './../../../styles/Form'
|
|
14
14
|
import { ExtendedTypographyProps } from '../../Content/Structure/typography/useGridTypography'
|
|
@@ -34,6 +34,8 @@ export interface PopupFormProps {
|
|
|
34
34
|
open?: boolean
|
|
35
35
|
/** Callback function to handle closing the popup (only applicable for 'dialog' type) */
|
|
36
36
|
onClose?: () => void
|
|
37
|
+
/** The width of the popup form in pixels */
|
|
38
|
+
width?: number
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
/**
|
|
@@ -52,11 +54,22 @@ export interface PopupFormProps {
|
|
|
52
54
|
* onClose={handleClose}
|
|
53
55
|
* onSubmit={handleSubmit}
|
|
54
56
|
* content={<LoginForm />}
|
|
57
|
+
* width={400}
|
|
55
58
|
* />
|
|
56
59
|
*/
|
|
57
60
|
const PopupForm = forwardRef<HTMLFormElement, PopupFormProps>(
|
|
58
61
|
(
|
|
59
|
-
{
|
|
62
|
+
{
|
|
63
|
+
title,
|
|
64
|
+
description,
|
|
65
|
+
grids,
|
|
66
|
+
onSubmit,
|
|
67
|
+
content,
|
|
68
|
+
popupType,
|
|
69
|
+
open,
|
|
70
|
+
onClose,
|
|
71
|
+
width = 450,
|
|
72
|
+
},
|
|
60
73
|
ref
|
|
61
74
|
) => {
|
|
62
75
|
const internalFormRef = useRef<HTMLFormElement>(null)
|
|
@@ -151,22 +164,28 @@ const PopupForm = forwardRef<HTMLFormElement, PopupFormProps>(
|
|
|
151
164
|
[renderHeader, handleSubmit, content, grids]
|
|
152
165
|
)
|
|
153
166
|
|
|
167
|
+
const dialogProps: DialogProps = {
|
|
168
|
+
open: popupType === 'modal' ? true : open || false,
|
|
169
|
+
onClose: popupType === 'modal' ? undefined : onClose,
|
|
170
|
+
fullWidth: true,
|
|
171
|
+
maxWidth: false,
|
|
172
|
+
PaperProps: {
|
|
173
|
+
style: {
|
|
174
|
+
width: `${width}px`,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
}
|
|
178
|
+
|
|
154
179
|
if (popupType === 'modal') {
|
|
155
180
|
return (
|
|
156
|
-
<Dialog
|
|
157
|
-
open={true}
|
|
158
|
-
fullWidth
|
|
159
|
-
maxWidth="sm"
|
|
160
|
-
disableEscapeKeyDown
|
|
161
|
-
hideBackdrop
|
|
162
|
-
>
|
|
181
|
+
<Dialog {...dialogProps} disableEscapeKeyDown hideBackdrop>
|
|
163
182
|
{renderContent}
|
|
164
183
|
</Dialog>
|
|
165
184
|
)
|
|
166
185
|
}
|
|
167
186
|
|
|
168
187
|
return (
|
|
169
|
-
<Dialog
|
|
188
|
+
<Dialog {...dialogProps}>
|
|
170
189
|
{onClose && (
|
|
171
190
|
<IconButton
|
|
172
191
|
size="small"
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
2
|
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import VisibilityIcon from '@mui/icons-material/Visibility'
|
|
5
5
|
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
interface ShowHideEyeIconProps {
|
|
8
|
+
visible?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const ShowHideEyeIcon: React.FC<ShowHideEyeIconProps> = ({
|
|
12
|
+
visible = false,
|
|
13
|
+
}) => {
|
|
8
14
|
const iconStyle = { color: 'black' }
|
|
9
15
|
return visible ? (
|
|
10
16
|
<VisibilityIcon style={iconStyle} />
|
|
@@ -59,10 +59,17 @@ function HorizontalVariant({
|
|
|
59
59
|
* Asynchronously fetches the active tab values from the cache.
|
|
60
60
|
*/
|
|
61
61
|
const fetchActiveTabValues = async () => {
|
|
62
|
-
const result = await get('activeTabValues', 'client')
|
|
63
|
-
if (
|
|
62
|
+
const result = await get('activeTabValues', 'tabStore', 'client')
|
|
63
|
+
if (
|
|
64
|
+
result &&
|
|
65
|
+
typeof result === 'object' &&
|
|
66
|
+
'type' in result &&
|
|
67
|
+
result.type === 'json' &&
|
|
68
|
+
'value' in result &&
|
|
69
|
+
typeof result.value === 'object'
|
|
70
|
+
) {
|
|
64
71
|
setActiveTabValues(
|
|
65
|
-
|
|
72
|
+
result.value as Record<string, ActiveTabValue | null>
|
|
66
73
|
)
|
|
67
74
|
}
|
|
68
75
|
}
|
|
@@ -88,8 +95,8 @@ function HorizontalVariant({
|
|
|
88
95
|
setActiveTabValues(updatedActiveTabValues)
|
|
89
96
|
await set(
|
|
90
97
|
'activeTabValues',
|
|
98
|
+
'tabStore',
|
|
91
99
|
{ type: 'json', value: updatedActiveTabValues } as JSONValue,
|
|
92
|
-
new Date(Date.now() + 30 * 60 * 1000),
|
|
93
100
|
'client'
|
|
94
101
|
)
|
|
95
102
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import React, { useState,
|
|
2
|
+
import React, { useState, useMemo } from 'react'
|
|
3
3
|
import type { JSX } from 'react'
|
|
4
4
|
import HorizontalVariant from './HorizontalVariant'
|
|
5
5
|
import VerticalVariant from './VerticalVariant'
|
|
6
|
-
import { get, JSONValue } from 'goobs-cache'
|
|
7
6
|
|
|
8
7
|
// Type definition for alignment options
|
|
9
8
|
type Alignment = 'left' | 'center' | 'right' | 'inherit' | 'justify'
|
|
@@ -78,7 +77,7 @@ function Nav({
|
|
|
78
77
|
// State for expanded navigation items
|
|
79
78
|
const [expandedNavs, setExpandedNavs] = useState<string[]>([])
|
|
80
79
|
const [expandedSubnavs, setExpandedSubnavs] = useState<string[]>([])
|
|
81
|
-
const [verticalNavWidth
|
|
80
|
+
const [verticalNavWidth] = useState<number>(250) // Default width, no longer using goobs-cache
|
|
82
81
|
|
|
83
82
|
// Memoized navigation items
|
|
84
83
|
const navs = useMemo(() => {
|
|
@@ -97,17 +96,6 @@ function Nav({
|
|
|
97
96
|
return navs
|
|
98
97
|
}, [items])
|
|
99
98
|
|
|
100
|
-
// Effect to fetch vertical nav width from cache
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
const fetchVerticalNavWidth = async () => {
|
|
103
|
-
const result = await get('verticalNavWidth', 'client')
|
|
104
|
-
if (result && typeof result === 'object' && 'value' in result) {
|
|
105
|
-
setVerticalNavWidth((result as JSONValue).value as number)
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
fetchVerticalNavWidth()
|
|
109
|
-
}, [])
|
|
110
|
-
|
|
111
99
|
// Render vertical or horizontal variant based on orientation
|
|
112
100
|
if (orientation === 'vertical') {
|
|
113
101
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react'
|
|
2
2
|
import { InputAdornment, Button, Box } from '@mui/material'
|
|
3
3
|
import SearchIcon from '../../Icons/Search'
|
|
4
4
|
import ShowHideEyeIcon from '../../Icons/ShowHideEye'
|
|
@@ -11,6 +11,7 @@ export interface AdornmentProps {
|
|
|
11
11
|
componentvariant: string
|
|
12
12
|
iconcolor?: string
|
|
13
13
|
passwordVisible?: boolean
|
|
14
|
+
togglePasswordVisibility?: () => void
|
|
14
15
|
marginRight?: number | string
|
|
15
16
|
handleIncrement?: () => void
|
|
16
17
|
handleDecrement?: () => void
|
|
@@ -43,18 +44,15 @@ export const EndAdornment: React.FC<AdornmentProps> = props => {
|
|
|
43
44
|
const {
|
|
44
45
|
componentvariant,
|
|
45
46
|
passwordVisible,
|
|
47
|
+
togglePasswordVisibility,
|
|
46
48
|
handleIncrement,
|
|
47
49
|
handleDecrement,
|
|
48
50
|
} = props
|
|
49
|
-
|
|
50
|
-
passwordVisible || false
|
|
51
|
-
)
|
|
51
|
+
|
|
52
52
|
const adornmentStyle = {
|
|
53
53
|
cursor: 'pointer',
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
setIsPasswordVisible(!isPasswordVisible)
|
|
57
|
-
}
|
|
55
|
+
|
|
58
56
|
// Render the show/hide eye icon for the password variant
|
|
59
57
|
if (componentvariant === 'password') {
|
|
60
58
|
return (
|
|
@@ -63,7 +61,7 @@ export const EndAdornment: React.FC<AdornmentProps> = props => {
|
|
|
63
61
|
onClick={togglePasswordVisibility}
|
|
64
62
|
style={adornmentStyle}
|
|
65
63
|
>
|
|
66
|
-
<ShowHideEyeIcon visible={
|
|
64
|
+
<ShowHideEyeIcon visible={passwordVisible} />
|
|
67
65
|
</InputAdornment>
|
|
68
66
|
)
|
|
69
67
|
}
|