goobs-frontend 0.8.8 → 0.8.9
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 +15 -15
- package/src/components/Button/index.tsx +91 -109
- package/src/components/{DataGrid/Checkbox → Checkbox}/index.tsx +1 -1
- package/src/components/Content/Structure/checkbox/useCheckbox.tsx +65 -0
- package/src/components/Content/Structure/typography/useGridTypography.tsx +2 -0
- package/src/components/Content/index.tsx +5 -0
- package/src/components/DataGrid/ManageColumn/index.tsx +1 -1
- package/src/components/DataGrid/ManageRow/index.tsx +269 -103
- package/src/components/DataGrid/Table/index.tsx +101 -53
- package/src/components/DataGrid/index.tsx +77 -48
- package/src/components/Dropdown/index.tsx +63 -14
- package/src/components/Form/DataGrid/index.tsx +9 -0
- package/src/components/Form/Popup/index.tsx +30 -63
- package/src/components/Grid/index.tsx +83 -101
- package/src/components/Nav/VerticalVariant/index.tsx +14 -10
- package/src/components/Toolbar/index.tsx +28 -8
- package/src/components/Typography/index.tsx +8 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goobs-frontend",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9",
|
|
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",
|
|
@@ -22,31 +22,31 @@
|
|
|
22
22
|
"@emotion/cache": "^11.13.5",
|
|
23
23
|
"@emotion/react": "^11.13.5",
|
|
24
24
|
"@emotion/styled": "^11.13.5",
|
|
25
|
-
"@mui/icons-material": "^6.1.
|
|
26
|
-
"@mui/material": "^6.1.
|
|
25
|
+
"@mui/icons-material": "^6.1.10",
|
|
26
|
+
"@mui/material": "^6.1.10",
|
|
27
27
|
"@types/lodash": "^4.17.13",
|
|
28
28
|
"highlight.js": "^11.10.0",
|
|
29
29
|
"jotai": "^2.10.3",
|
|
30
30
|
"lodash": "^4.17.21",
|
|
31
|
-
"next": "15.0.
|
|
31
|
+
"next": "15.0.4",
|
|
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.10.
|
|
39
|
-
"@types/react": "
|
|
40
|
-
"@types/react-dom": "^
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
42
|
-
"@typescript-eslint/parser": "^8.
|
|
43
|
-
"eslint": "^9.
|
|
44
|
-
"eslint-config-next": "^15.0.
|
|
37
|
+
"@next/eslint-plugin-next": "^15.0.4",
|
|
38
|
+
"@types/node": "^22.10.1",
|
|
39
|
+
"@types/react": "19.0.1",
|
|
40
|
+
"@types/react-dom": "^19.0.1",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^8.17.0",
|
|
42
|
+
"@typescript-eslint/parser": "^8.17.0",
|
|
43
|
+
"eslint": "^9.16.0",
|
|
44
|
+
"eslint-config-next": "^15.0.4",
|
|
45
45
|
"eslint-config-prettier": "^9.1.0",
|
|
46
46
|
"eslint-plugin-prettier": "^5.2.1",
|
|
47
|
-
"prettier": "^3.4.
|
|
48
|
-
"react": "^
|
|
49
|
-
"react-dom": "^
|
|
47
|
+
"prettier": "^3.4.2",
|
|
48
|
+
"react": "^19.0.0",
|
|
49
|
+
"react-dom": "^19.0.0",
|
|
50
50
|
"typescript": "^5.7.2"
|
|
51
51
|
},
|
|
52
52
|
"files": [
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { Button, Box, ButtonProps } from '@mui/material'
|
|
3
|
+
import { Button, Box, ButtonProps, SxProps, Theme } from '@mui/material'
|
|
4
4
|
import Typography from '../Typography'
|
|
5
|
+
import { SvgIconProps } from '@mui/material/SvgIcon'
|
|
5
6
|
|
|
6
7
|
export interface CustomButtonProps extends ButtonProps {
|
|
7
8
|
text?: string
|
|
@@ -9,131 +10,112 @@ export interface CustomButtonProps extends ButtonProps {
|
|
|
9
10
|
fontcolor?: string
|
|
10
11
|
fontvariant?: 'merriparagraph' | 'merrihelperfooter'
|
|
11
12
|
width?: string
|
|
13
|
+
height?: string
|
|
12
14
|
disableButton?: 'true' | 'false'
|
|
13
|
-
icon?: React.
|
|
15
|
+
icon?: React.ReactElement<SvgIconProps>
|
|
14
16
|
iconcolor?: string
|
|
15
17
|
iconsize?: string
|
|
16
18
|
iconlocation?: 'left' | 'right' | 'above'
|
|
17
19
|
fontlocation?: 'left' | 'center' | 'right'
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
const CustomButton: React.FC<CustomButtonProps> =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const buttonStyle = {
|
|
47
|
-
backgroundColor: backgroundcolor,
|
|
48
|
-
width: width,
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const isDisabled = disableButton === 'true'
|
|
22
|
+
const CustomButton: React.FC<CustomButtonProps> = ({
|
|
23
|
+
text,
|
|
24
|
+
variant,
|
|
25
|
+
fontvariant = 'merriparagraph',
|
|
26
|
+
onClick,
|
|
27
|
+
fontcolor,
|
|
28
|
+
backgroundcolor,
|
|
29
|
+
width,
|
|
30
|
+
height,
|
|
31
|
+
disableButton,
|
|
32
|
+
icon,
|
|
33
|
+
iconcolor,
|
|
34
|
+
iconsize,
|
|
35
|
+
iconlocation = 'left',
|
|
36
|
+
fontlocation = 'center',
|
|
37
|
+
sx,
|
|
38
|
+
...restProps
|
|
39
|
+
}) => {
|
|
40
|
+
const handleButtonClick = (
|
|
41
|
+
event: React.MouseEvent<HTMLButtonElement>
|
|
42
|
+
): void => {
|
|
43
|
+
event.preventDefault()
|
|
44
|
+
onClick?.(event)
|
|
45
|
+
}
|
|
52
46
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
47
|
+
const buttonSx: SxProps<Theme> = {
|
|
48
|
+
...(backgroundcolor && { backgroundColor: backgroundcolor }),
|
|
49
|
+
...(width && { width }),
|
|
50
|
+
...(height && { height }),
|
|
51
|
+
flexDirection: iconlocation === 'above' ? 'column' : 'row',
|
|
52
|
+
justifyContent:
|
|
53
|
+
fontlocation === 'left'
|
|
54
|
+
? 'flex-start'
|
|
55
|
+
: fontlocation === 'right'
|
|
56
|
+
? 'flex-end'
|
|
57
|
+
: 'center',
|
|
58
|
+
...(sx as object),
|
|
59
|
+
}
|
|
57
60
|
|
|
58
|
-
|
|
59
|
-
? React.cloneElement(icon as React.ReactElement, {
|
|
60
|
-
style: { ...iconStyle, ...(icon as React.ReactElement).props.style },
|
|
61
|
-
})
|
|
62
|
-
: null
|
|
61
|
+
const isDisabled = disableButton === 'true'
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
? 'flex-start'
|
|
73
|
-
: fontlocation === 'right'
|
|
74
|
-
? 'flex-end'
|
|
75
|
-
: 'center'
|
|
76
|
-
}
|
|
77
|
-
width="100%"
|
|
78
|
-
>
|
|
79
|
-
{iconlocation === 'left' && IconComponent}
|
|
80
|
-
<Typography
|
|
81
|
-
fontvariant={fontvariant}
|
|
82
|
-
fontcolor={isDisabled ? 'grey' : fontcolor}
|
|
83
|
-
text={text || ''}
|
|
84
|
-
/>
|
|
85
|
-
{iconlocation === 'right' && IconComponent}
|
|
86
|
-
</Box>
|
|
87
|
-
</>
|
|
88
|
-
)
|
|
63
|
+
const IconComponent = icon
|
|
64
|
+
? React.cloneElement(icon, {
|
|
65
|
+
sx: {
|
|
66
|
+
color: iconcolor,
|
|
67
|
+
fontSize: iconsize,
|
|
68
|
+
},
|
|
69
|
+
} as Partial<SvgIconProps>)
|
|
70
|
+
: null
|
|
89
71
|
|
|
90
|
-
|
|
72
|
+
const buttonContent = (
|
|
73
|
+
<>
|
|
74
|
+
{iconlocation === 'above' && IconComponent}
|
|
91
75
|
<Box
|
|
92
76
|
display="flex"
|
|
93
|
-
flexDirection="column"
|
|
94
77
|
alignItems="center"
|
|
95
|
-
|
|
78
|
+
justifyContent={
|
|
79
|
+
fontlocation === 'left'
|
|
80
|
+
? 'flex-start'
|
|
81
|
+
: fontlocation === 'right'
|
|
82
|
+
? 'flex-end'
|
|
83
|
+
: 'center'
|
|
84
|
+
}
|
|
85
|
+
width="100%"
|
|
86
|
+
height="100%"
|
|
96
87
|
>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
justifyContent:
|
|
105
|
-
fontlocation === 'left'
|
|
106
|
-
? 'flex-start'
|
|
107
|
-
: fontlocation === 'right'
|
|
108
|
-
? 'flex-end'
|
|
109
|
-
: 'center',
|
|
110
|
-
}}
|
|
111
|
-
disabled={isDisabled}
|
|
112
|
-
>
|
|
113
|
-
{buttonContent}
|
|
114
|
-
</Button>
|
|
88
|
+
{iconlocation === 'left' && IconComponent}
|
|
89
|
+
<Typography
|
|
90
|
+
fontvariant={fontvariant}
|
|
91
|
+
fontcolor={isDisabled ? 'grey' : fontcolor}
|
|
92
|
+
text={text || ''}
|
|
93
|
+
/>
|
|
94
|
+
{iconlocation === 'right' && IconComponent}
|
|
115
95
|
</Box>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
(prevProps, nextProps) => {
|
|
119
|
-
const propsAreEqual =
|
|
120
|
-
prevProps.text === nextProps.text &&
|
|
121
|
-
prevProps.variant === nextProps.variant &&
|
|
122
|
-
prevProps.fontvariant === nextProps.fontvariant &&
|
|
123
|
-
prevProps.onClick === nextProps.onClick &&
|
|
124
|
-
prevProps.fontcolor === nextProps.fontcolor &&
|
|
125
|
-
prevProps.backgroundcolor === nextProps.backgroundcolor &&
|
|
126
|
-
prevProps.width === nextProps.width &&
|
|
127
|
-
prevProps.disableButton === nextProps.disableButton &&
|
|
128
|
-
prevProps.icon === nextProps.icon &&
|
|
129
|
-
prevProps.iconcolor === nextProps.iconcolor &&
|
|
130
|
-
prevProps.iconsize === nextProps.iconsize &&
|
|
131
|
-
prevProps.iconlocation === nextProps.iconlocation &&
|
|
132
|
-
prevProps.fontlocation === nextProps.fontlocation
|
|
96
|
+
</>
|
|
97
|
+
)
|
|
133
98
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
99
|
+
return (
|
|
100
|
+
<Box
|
|
101
|
+
display="flex"
|
|
102
|
+
flexDirection="column"
|
|
103
|
+
alignItems="center"
|
|
104
|
+
width={width}
|
|
105
|
+
height={height}
|
|
106
|
+
>
|
|
107
|
+
<Button
|
|
108
|
+
{...restProps}
|
|
109
|
+
variant={variant}
|
|
110
|
+
onClick={handleButtonClick}
|
|
111
|
+
sx={buttonSx}
|
|
112
|
+
disabled={isDisabled}
|
|
113
|
+
>
|
|
114
|
+
{buttonContent}
|
|
115
|
+
</Button>
|
|
116
|
+
</Box>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
137
119
|
|
|
138
120
|
CustomButton.displayName = 'CustomButton'
|
|
139
121
|
export default CustomButton
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { columnconfig, cellconfig } from '../../../Grid'
|
|
4
|
+
import DataGridCheckbox from './../../../../components/Checkbox'
|
|
5
|
+
|
|
6
|
+
type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
|
|
7
|
+
component?: columnconfig['component']
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ExtendedCheckboxProps {
|
|
11
|
+
columnconfig?: ExtendedColumnConfig
|
|
12
|
+
cellconfig?: cellconfig
|
|
13
|
+
onClick?: (event: React.MouseEvent) => void
|
|
14
|
+
checked?: boolean
|
|
15
|
+
indeterminate?: boolean
|
|
16
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
|
|
17
|
+
disabled?: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const useCheckbox = (grid: {
|
|
21
|
+
checkbox?: ExtendedCheckboxProps | ExtendedCheckboxProps[]
|
|
22
|
+
}): columnconfig | columnconfig[] | null => {
|
|
23
|
+
if (!grid.checkbox) return null
|
|
24
|
+
|
|
25
|
+
const renderCheckbox = (
|
|
26
|
+
checkboxProps: ExtendedCheckboxProps,
|
|
27
|
+
index: number
|
|
28
|
+
): columnconfig => {
|
|
29
|
+
const {
|
|
30
|
+
columnconfig: itemColumnConfig,
|
|
31
|
+
cellconfig,
|
|
32
|
+
...restProps
|
|
33
|
+
} = checkboxProps
|
|
34
|
+
|
|
35
|
+
if (
|
|
36
|
+
!itemColumnConfig ||
|
|
37
|
+
typeof itemColumnConfig !== 'object' ||
|
|
38
|
+
typeof itemColumnConfig.row !== 'number' ||
|
|
39
|
+
typeof itemColumnConfig.column !== 'number'
|
|
40
|
+
) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
'columnconfig must be an object with row and column as numbers'
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Merge the existing columnconfig with the new props
|
|
47
|
+
const mergedConfig: columnconfig = {
|
|
48
|
+
...itemColumnConfig,
|
|
49
|
+
cellconfig: {
|
|
50
|
+
...cellconfig,
|
|
51
|
+
},
|
|
52
|
+
component: <DataGridCheckbox key={`checkbox-${index}`} {...restProps} />,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return mergedConfig
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (Array.isArray(grid.checkbox)) {
|
|
59
|
+
return grid.checkbox.map(renderCheckbox)
|
|
60
|
+
} else {
|
|
61
|
+
return renderCheckbox(grid.checkbox, 0)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default useCheckbox
|
|
@@ -27,6 +27,7 @@ const useGridTypography = (grid: {
|
|
|
27
27
|
fontvariant,
|
|
28
28
|
columnconfig: itemColumnConfig,
|
|
29
29
|
cellconfig,
|
|
30
|
+
component,
|
|
30
31
|
...restProps
|
|
31
32
|
} = typographyItem
|
|
32
33
|
|
|
@@ -53,6 +54,7 @@ const useGridTypography = (grid: {
|
|
|
53
54
|
text={text}
|
|
54
55
|
fontvariant={fontvariant}
|
|
55
56
|
fontcolor={fontcolor}
|
|
57
|
+
component={component || 'span'}
|
|
56
58
|
{...restProps}
|
|
57
59
|
/>
|
|
58
60
|
),
|
|
@@ -60,6 +60,9 @@ import useQRCode, { ExtendedQRCodeProps } from './Structure/qrcode/useQRCode'
|
|
|
60
60
|
import usePhoneNumber, {
|
|
61
61
|
ExtendedPhoneNumberFieldProps,
|
|
62
62
|
} from './Structure/phoneNumber/usePhoneNumber'
|
|
63
|
+
import useCheckbox, {
|
|
64
|
+
ExtendedCheckboxProps,
|
|
65
|
+
} from './Structure/checkbox/useCheckbox'
|
|
63
66
|
/**
|
|
64
67
|
* Props for the ContentSection component.
|
|
65
68
|
* Includes configuration for various content elements.
|
|
@@ -95,6 +98,7 @@ export interface ContentSectionProps {
|
|
|
95
98
|
phoneNumberField?:
|
|
96
99
|
| ExtendedPhoneNumberFieldProps
|
|
97
100
|
| ExtendedPhoneNumberFieldProps[]
|
|
101
|
+
checkbox?: ExtendedCheckboxProps | ExtendedCheckboxProps[]
|
|
98
102
|
}>
|
|
99
103
|
width?: number
|
|
100
104
|
}
|
|
@@ -135,6 +139,7 @@ const RenderContent: React.FC<
|
|
|
135
139
|
addToColumnConfigs(useCodeCopy(props))
|
|
136
140
|
addToColumnConfigs(useTextField(props))
|
|
137
141
|
addToColumnConfigs(useDateField(props))
|
|
142
|
+
addToColumnConfigs(useCheckbox(props))
|
|
138
143
|
addToColumnConfigs(usePhoneNumber(props))
|
|
139
144
|
addToColumnConfigs(useDropdown(props))
|
|
140
145
|
addToColumnConfigs(
|
|
@@ -5,7 +5,7 @@ import { Box, Popover, IconButton } from '@mui/material'
|
|
|
5
5
|
import { useManageColumn } from '../utils/useManageColumn'
|
|
6
6
|
import CustomButton from '../../Button'
|
|
7
7
|
import Searchbar from '../../Searchbar'
|
|
8
|
-
import Checkbox from '
|
|
8
|
+
import Checkbox from '../../Checkbox'
|
|
9
9
|
import ShowHideEyeIcon from '../../Icons/ShowHideEye'
|
|
10
10
|
import { ColumnDef } from '../Table'
|
|
11
11
|
import Typography from '../../Typography'
|