goobs-frontend 0.8.6 → 0.8.7
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 +18 -18
- package/src/components/Content/Structure/phoneNumber/usePhoneNumber.tsx +3 -4
- package/src/components/Content/Structure/textfield/useTextField.tsx +5 -29
- package/src/components/PhoneNumberField/index.tsx +91 -67
- package/src/components/TextField/index.tsx +21 -32
- package/src/index.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goobs-frontend",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A comprehensive React-based UI library built on Material-UI, offering a wide range of customizable components including grids, typography, buttons, cards, forms, navigation, pricing tables, steppers, tooltips, accordions, and more. Designed for building responsive and consistent user interfaces with advanced features like form validation, theming, and code syntax highlighting.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,35 +19,35 @@
|
|
|
19
19
|
"lint": "next lint"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@emotion/cache": "^11.13.
|
|
23
|
-
"@emotion/react": "^11.13.
|
|
24
|
-
"@emotion/styled": "^11.13.
|
|
25
|
-
"@mui/icons-material": "^6.1.
|
|
26
|
-
"@mui/material": "^6.1.
|
|
27
|
-
"@types/lodash": "^4.17.
|
|
22
|
+
"@emotion/cache": "^11.13.5",
|
|
23
|
+
"@emotion/react": "^11.13.5",
|
|
24
|
+
"@emotion/styled": "^11.13.5",
|
|
25
|
+
"@mui/icons-material": "^6.1.8",
|
|
26
|
+
"@mui/material": "^6.1.8",
|
|
27
|
+
"@types/lodash": "^4.17.13",
|
|
28
28
|
"highlight.js": "^11.10.0",
|
|
29
|
-
"jotai": "^2.10.
|
|
29
|
+
"jotai": "^2.10.3",
|
|
30
30
|
"lodash": "^4.17.21",
|
|
31
|
-
"next": "15.0.
|
|
31
|
+
"next": "15.0.3",
|
|
32
32
|
"otplib": "^12.0.1",
|
|
33
33
|
"react-datepicker": "^7.5.0",
|
|
34
34
|
"react-qr-code": "^2.0.15"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@next/eslint-plugin-next": "^15.0.
|
|
38
|
-
"@types/node": "^22.
|
|
39
|
-
"@types/react": "18.3.
|
|
37
|
+
"@next/eslint-plugin-next": "^15.0.3",
|
|
38
|
+
"@types/node": "^22.10.0",
|
|
39
|
+
"@types/react": "18.3.12",
|
|
40
40
|
"@types/react-dom": "^18.3.1",
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
42
|
-
"@typescript-eslint/parser": "^8.
|
|
43
|
-
"eslint": "^9.
|
|
44
|
-
"eslint-config-next": "^15.0.
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^8.16.0",
|
|
42
|
+
"@typescript-eslint/parser": "^8.16.0",
|
|
43
|
+
"eslint": "^9.15.0",
|
|
44
|
+
"eslint-config-next": "^15.0.3",
|
|
45
45
|
"eslint-config-prettier": "^9.1.0",
|
|
46
46
|
"eslint-plugin-prettier": "^5.2.1",
|
|
47
|
-
"prettier": "^3.
|
|
47
|
+
"prettier": "^3.4.1",
|
|
48
48
|
"react": "^18.3.1",
|
|
49
49
|
"react-dom": "^18.3.1",
|
|
50
|
-
"typescript": "^5.
|
|
50
|
+
"typescript": "^5.7.2"
|
|
51
51
|
},
|
|
52
52
|
"files": [
|
|
53
53
|
"src"
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import PhoneNumberField
|
|
4
|
-
PhoneNumberFieldProps,
|
|
5
|
-
} from './../../../PhoneNumberField'
|
|
3
|
+
import PhoneNumberField from '../../../PhoneNumberField'
|
|
6
4
|
import { columnconfig, cellconfig } from '../../../Grid'
|
|
5
|
+
import { TextFieldProps } from '@mui/material'
|
|
7
6
|
|
|
8
|
-
export
|
|
7
|
+
export type ExtendedPhoneNumberFieldProps = TextFieldProps & {
|
|
9
8
|
columnconfig?: Partial<columnconfig>
|
|
10
9
|
cellconfig?: cellconfig
|
|
11
10
|
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
+
'use client'
|
|
1
2
|
import React from 'react'
|
|
2
|
-
import TextField
|
|
3
|
-
CustomTextFieldProps,
|
|
4
|
-
} from '../../../../components/TextField'
|
|
3
|
+
import TextField from '../../../../components/TextField'
|
|
5
4
|
import { columnconfig, cellconfig } from '../../../Grid'
|
|
5
|
+
import { TextFieldProps } from '@mui/material'
|
|
6
6
|
|
|
7
7
|
type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
|
|
8
8
|
component?: columnconfig['component']
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export
|
|
12
|
-
extends Omit<CustomTextFieldProps, 'columnconfig'> {
|
|
11
|
+
export type ExtendedTextFieldProps = TextFieldProps & {
|
|
13
12
|
columnconfig?: ExtendedColumnConfig
|
|
14
13
|
cellconfig?: cellconfig
|
|
15
14
|
}
|
|
@@ -24,15 +23,6 @@ const useTextField = (grid: {
|
|
|
24
23
|
index: number
|
|
25
24
|
): columnconfig => {
|
|
26
25
|
const {
|
|
27
|
-
name,
|
|
28
|
-
label,
|
|
29
|
-
placeholder,
|
|
30
|
-
value,
|
|
31
|
-
onChange,
|
|
32
|
-
onFocus,
|
|
33
|
-
onBlur,
|
|
34
|
-
error,
|
|
35
|
-
InputProps,
|
|
36
26
|
columnconfig: itemColumnConfig,
|
|
37
27
|
cellconfig,
|
|
38
28
|
...restProps
|
|
@@ -54,21 +44,7 @@ const useTextField = (grid: {
|
|
|
54
44
|
cellconfig: {
|
|
55
45
|
...cellconfig,
|
|
56
46
|
},
|
|
57
|
-
component:
|
|
58
|
-
<TextField
|
|
59
|
-
key={`textfield-${index}`}
|
|
60
|
-
name={name}
|
|
61
|
-
label={label}
|
|
62
|
-
placeholder={placeholder}
|
|
63
|
-
value={value}
|
|
64
|
-
onChange={onChange}
|
|
65
|
-
onFocus={onFocus}
|
|
66
|
-
onBlur={onBlur}
|
|
67
|
-
error={error}
|
|
68
|
-
InputProps={InputProps}
|
|
69
|
-
{...restProps}
|
|
70
|
-
/>
|
|
71
|
-
),
|
|
47
|
+
component: <TextField key={`textfield-${index}`} {...restProps} />,
|
|
72
48
|
}
|
|
73
49
|
|
|
74
50
|
return mergedConfig
|
|
@@ -1,45 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import React, {
|
|
3
|
-
import { TextField, TextFieldProps } from '@mui/material'
|
|
4
|
-
import { styled } from '@mui/material/styles'
|
|
5
|
-
|
|
6
|
-
export interface PhoneNumberFieldProps
|
|
7
|
-
extends Omit<TextFieldProps, 'onChange'> {
|
|
8
|
-
initialValue?: string
|
|
9
|
-
onChange?: () => void
|
|
10
|
-
backgroundcolor?: string
|
|
11
|
-
outlinecolor?: string
|
|
12
|
-
fontcolor?: string
|
|
13
|
-
label?: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const StyledTextField = styled(TextField)<{
|
|
17
|
-
backgroundcolor?: string
|
|
18
|
-
outlinecolor?: string
|
|
19
|
-
fontcolor?: string
|
|
20
|
-
}>(({ theme, backgroundcolor, outlinecolor, fontcolor }) => ({
|
|
21
|
-
'& .MuiOutlinedInput-root': {
|
|
22
|
-
backgroundColor: backgroundcolor || theme.palette.background.paper,
|
|
23
|
-
'& fieldset': {
|
|
24
|
-
borderColor: outlinecolor || theme.palette.primary.main,
|
|
25
|
-
},
|
|
26
|
-
'&:hover fieldset': {
|
|
27
|
-
borderColor: outlinecolor || theme.palette.primary.main,
|
|
28
|
-
},
|
|
29
|
-
'&.Mui-focused fieldset': {
|
|
30
|
-
borderColor: outlinecolor || theme.palette.primary.main,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
'& .MuiInputLabel-root': {
|
|
34
|
-
color: fontcolor || theme.palette.text.primary,
|
|
35
|
-
'&.Mui-focused': {
|
|
36
|
-
color: fontcolor || theme.palette.primary.main,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
'& .MuiInputBase-input': {
|
|
40
|
-
color: fontcolor || theme.palette.text.primary,
|
|
41
|
-
},
|
|
42
|
-
}))
|
|
2
|
+
import React, { useCallback, useMemo, useState } from 'react'
|
|
3
|
+
import { Box, TextField as MuiTextField, TextFieldProps } from '@mui/material'
|
|
43
4
|
|
|
44
5
|
const formatPhoneNumber = (value: string): string => {
|
|
45
6
|
const digits = value.replace(/\D/g, '')
|
|
@@ -57,47 +18,110 @@ const formatPhoneNumber = (value: string): string => {
|
|
|
57
18
|
return formattedNumber.trim()
|
|
58
19
|
}
|
|
59
20
|
|
|
60
|
-
const PhoneNumberField: React.FC<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
21
|
+
const PhoneNumberField: React.FC<TextFieldProps> = React.memo(props => {
|
|
22
|
+
const {
|
|
23
|
+
name,
|
|
24
|
+
label = 'Phone Number',
|
|
25
|
+
placeholder,
|
|
26
|
+
onChange,
|
|
27
|
+
onFocus,
|
|
28
|
+
onBlur,
|
|
29
|
+
value = '',
|
|
30
|
+
error,
|
|
31
|
+
...restProps
|
|
32
|
+
} = props
|
|
33
|
+
|
|
69
34
|
const [phoneNumber, setPhoneNumber] = useState(
|
|
70
|
-
formatPhoneNumber(
|
|
35
|
+
formatPhoneNumber(value as string)
|
|
71
36
|
)
|
|
72
37
|
|
|
73
|
-
const
|
|
74
|
-
(e: React.ChangeEvent<HTMLInputElement
|
|
38
|
+
const handleChange = useCallback(
|
|
39
|
+
(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
75
40
|
const input = e.target.value
|
|
76
41
|
let strippedInput = input.replace(/^\+1\s?/, '').replace(/\D/g, '')
|
|
77
42
|
strippedInput = strippedInput.slice(0, 10)
|
|
78
43
|
const formattedValue =
|
|
79
44
|
strippedInput.length > 0 ? formatPhoneNumber(strippedInput) : '+1 '
|
|
80
45
|
setPhoneNumber(formattedValue)
|
|
81
|
-
onChange
|
|
46
|
+
if (onChange) {
|
|
47
|
+
onChange(e)
|
|
48
|
+
}
|
|
82
49
|
},
|
|
83
50
|
[onChange]
|
|
84
51
|
)
|
|
85
52
|
|
|
53
|
+
const handleFocus = useCallback(
|
|
54
|
+
(e: React.FocusEvent<HTMLInputElement>) => {
|
|
55
|
+
if (onFocus) {
|
|
56
|
+
onFocus(e)
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
[onFocus]
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
const handleBlur = useCallback(
|
|
63
|
+
(e: React.FocusEvent<HTMLInputElement>) => {
|
|
64
|
+
if (onBlur) {
|
|
65
|
+
onBlur(e)
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
[onBlur]
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
const handleClick = useCallback((e: React.MouseEvent<HTMLDivElement>) => {
|
|
72
|
+
e.preventDefault()
|
|
73
|
+
}, [])
|
|
74
|
+
|
|
75
|
+
const inputProps = useMemo(
|
|
76
|
+
() => ({
|
|
77
|
+
style: {
|
|
78
|
+
height: '40px',
|
|
79
|
+
padding: '8px 14px',
|
|
80
|
+
},
|
|
81
|
+
}),
|
|
82
|
+
[]
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
const InputProps = useMemo(
|
|
86
|
+
() => ({
|
|
87
|
+
style: {
|
|
88
|
+
height: '45px',
|
|
89
|
+
},
|
|
90
|
+
}),
|
|
91
|
+
[]
|
|
92
|
+
)
|
|
93
|
+
|
|
86
94
|
return (
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
inputProps={{
|
|
96
|
-
maxLength: 16,
|
|
95
|
+
<Box
|
|
96
|
+
sx={{
|
|
97
|
+
display: 'flex',
|
|
98
|
+
flexDirection: 'column',
|
|
99
|
+
justifyContent: 'center',
|
|
100
|
+
width: '100%',
|
|
101
|
+
marginTop: '5px',
|
|
102
|
+
height: '70px',
|
|
97
103
|
}}
|
|
98
|
-
{
|
|
99
|
-
|
|
104
|
+
onClick={handleClick}
|
|
105
|
+
>
|
|
106
|
+
<MuiTextField
|
|
107
|
+
name={name}
|
|
108
|
+
label={label}
|
|
109
|
+
placeholder={placeholder}
|
|
110
|
+
onChange={handleChange}
|
|
111
|
+
onFocus={handleFocus}
|
|
112
|
+
onBlur={handleBlur}
|
|
113
|
+
value={phoneNumber}
|
|
114
|
+
error={error}
|
|
115
|
+
fullWidth
|
|
116
|
+
variant="outlined"
|
|
117
|
+
inputProps={inputProps}
|
|
118
|
+
InputProps={InputProps}
|
|
119
|
+
{...restProps}
|
|
120
|
+
/>
|
|
121
|
+
</Box>
|
|
100
122
|
)
|
|
101
|
-
}
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
PhoneNumberField.displayName = 'PhoneNumberField'
|
|
102
126
|
|
|
103
127
|
export default PhoneNumberField
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
+
'use client'
|
|
1
2
|
import React, { useCallback, useMemo } from 'react'
|
|
2
3
|
import { Box, TextField as MuiTextField, TextFieldProps } from '@mui/material'
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
name: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const TextField: React.FC<CustomTextFieldProps> = React.memo(props => {
|
|
5
|
+
const TextField: React.FC<TextFieldProps> = React.memo(props => {
|
|
9
6
|
const {
|
|
10
7
|
name,
|
|
11
8
|
label,
|
|
@@ -16,7 +13,6 @@ const TextField: React.FC<CustomTextFieldProps> = React.memo(props => {
|
|
|
16
13
|
value,
|
|
17
14
|
error,
|
|
18
15
|
sx,
|
|
19
|
-
InputProps,
|
|
20
16
|
...restProps
|
|
21
17
|
} = props
|
|
22
18
|
|
|
@@ -64,31 +60,27 @@ const TextField: React.FC<CustomTextFieldProps> = React.memo(props => {
|
|
|
64
60
|
[]
|
|
65
61
|
)
|
|
66
62
|
|
|
67
|
-
const
|
|
63
|
+
const slotProps = useMemo(
|
|
68
64
|
() => ({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
...inputStyle,
|
|
72
|
-
...InputProps?.style,
|
|
65
|
+
input: {
|
|
66
|
+
style: inputStyle,
|
|
73
67
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
top: '9px',
|
|
88
|
-
left: '12px',
|
|
68
|
+
inputLabel: {
|
|
69
|
+
sx: {
|
|
70
|
+
'&.MuiInputLabel-shrink': {
|
|
71
|
+
top: '0px',
|
|
72
|
+
left: '0px',
|
|
73
|
+
},
|
|
74
|
+
'&:not(.MuiInputLabel-shrink)': {
|
|
75
|
+
transform: 'scale(1)',
|
|
76
|
+
transformOrigin: 'top left',
|
|
77
|
+
top: '9px',
|
|
78
|
+
left: '12px',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
89
81
|
},
|
|
90
82
|
}),
|
|
91
|
-
[]
|
|
83
|
+
[inputStyle]
|
|
92
84
|
)
|
|
93
85
|
|
|
94
86
|
return (
|
|
@@ -99,7 +91,7 @@ const TextField: React.FC<CustomTextFieldProps> = React.memo(props => {
|
|
|
99
91
|
justifyContent: 'center',
|
|
100
92
|
width: '100%',
|
|
101
93
|
marginTop: '5px',
|
|
102
|
-
height: '
|
|
94
|
+
height: '70px',
|
|
103
95
|
...sx,
|
|
104
96
|
}}
|
|
105
97
|
onClick={handleClick}
|
|
@@ -113,10 +105,7 @@ const TextField: React.FC<CustomTextFieldProps> = React.memo(props => {
|
|
|
113
105
|
onBlur={handleBlur}
|
|
114
106
|
value={value}
|
|
115
107
|
error={error}
|
|
116
|
-
|
|
117
|
-
InputLabelProps={{
|
|
118
|
-
sx: labelStyle,
|
|
119
|
-
}}
|
|
108
|
+
slotProps={slotProps}
|
|
120
109
|
fullWidth
|
|
121
110
|
variant="outlined"
|
|
122
111
|
{...restProps}
|
package/src/index.ts
CHANGED
|
@@ -71,7 +71,6 @@ import { ExtendedImageProps } from './components/Content/Structure/image/useImag
|
|
|
71
71
|
import { ExtendedConfirmationCodeInputsProps } from './components/Content/Structure/confirmationinput/useConfirmationInput'
|
|
72
72
|
import { ExtendedRadioGroupProps } from './components/Content/Structure/radiogroup/useRadioGroup'
|
|
73
73
|
import { ExtendedPhoneNumberFieldProps } from './components/Content/Structure/phoneNumber/usePhoneNumber'
|
|
74
|
-
import { CustomTextFieldProps } from './components/TextField'
|
|
75
74
|
// Colors
|
|
76
75
|
import {
|
|
77
76
|
moss,
|
|
@@ -268,7 +267,6 @@ export type { CustomToolbarComponentProps }
|
|
|
268
267
|
export type { TransferListComponentProps }
|
|
269
268
|
export type { StyledTooltipComponentProps }
|
|
270
269
|
export type { DropdownOption }
|
|
271
|
-
export type { CustomTextFieldProps }
|
|
272
270
|
|
|
273
271
|
// New type exports
|
|
274
272
|
export type { DateFieldProps }
|