goobs-frontend 0.7.54 → 0.7.55
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goobs-frontend",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.55",
|
|
4
4
|
"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.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"@mui/icons-material": "^5.15.20",
|
|
29
29
|
"@mui/material": "^5.15.20",
|
|
30
30
|
"@types/lodash": "^4.17.5",
|
|
31
|
-
"async-lock": "^1.4.1",
|
|
32
31
|
"goobs-cache": "^1.2.1",
|
|
33
32
|
"highlight.js": "^11.9.0",
|
|
34
33
|
"lodash": "^4.17.21",
|
|
@@ -36,7 +35,6 @@
|
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
37
|
"@next/eslint-plugin-next": "^14.2.4",
|
|
39
|
-
"@types/async-lock": "^1.4.2",
|
|
40
38
|
"@types/node": "^20.14.9",
|
|
41
39
|
"@types/react": "18.3.0",
|
|
42
40
|
"@types/react-dom": "^18.3.0",
|
|
@@ -44,44 +44,35 @@ import useCodeCopy, {
|
|
|
44
44
|
* Includes configuration for various content elements.
|
|
45
45
|
*/
|
|
46
46
|
export interface ContentSectionProps {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
pricing?: ExtendedPricingProps
|
|
69
|
-
/** Stepper configuration */
|
|
70
|
-
stepper?: ExtendedStepperProps | ExtendedStepperProps[]
|
|
71
|
-
/** Transfer list configuration */
|
|
72
|
-
transferlist?: ExtendedTransferListProps | ExtendedTransferListProps[]
|
|
73
|
-
/** Card configuration */
|
|
74
|
-
card?: ExtendedCardProps | ExtendedCardProps[]
|
|
75
|
-
/** Code copy configuration */
|
|
76
|
-
codecopy?: ExtendedCodeCopyProps | ExtendedCodeCopyProps[]
|
|
47
|
+
grids: Array<{
|
|
48
|
+
grid: {
|
|
49
|
+
gridconfig?: gridconfig
|
|
50
|
+
}
|
|
51
|
+
confirmationcodeinput?:
|
|
52
|
+
| ExtendedConfirmationCodeInputsProps
|
|
53
|
+
| ExtendedConfirmationCodeInputsProps[]
|
|
54
|
+
typography?: TypographyProps | TypographyProps[]
|
|
55
|
+
styledcomponent?:
|
|
56
|
+
| ExtendedStyledComponentProps
|
|
57
|
+
| ExtendedStyledComponentProps[]
|
|
58
|
+
radiogroup?: ExtendedRadioGroupProps | ExtendedRadioGroupProps[]
|
|
59
|
+
link?: LinkProps | LinkProps[]
|
|
60
|
+
button?: ExtendedButtonProps | ExtendedButtonProps[]
|
|
61
|
+
image?: ExtendedImageProps | ExtendedImageProps[]
|
|
62
|
+
pricing?: ExtendedPricingProps
|
|
63
|
+
stepper?: ExtendedStepperProps | ExtendedStepperProps[]
|
|
64
|
+
transferlist?: ExtendedTransferListProps | ExtendedTransferListProps[]
|
|
65
|
+
card?: ExtendedCardProps | ExtendedCardProps[]
|
|
66
|
+
codecopy?: ExtendedCodeCopyProps | ExtendedCodeCopyProps[]
|
|
67
|
+
}>
|
|
77
68
|
}
|
|
78
69
|
|
|
79
70
|
/**
|
|
80
71
|
* RenderContent component handles the rendering of various content elements
|
|
81
72
|
* based on the provided configuration.
|
|
82
73
|
*/
|
|
83
|
-
const RenderContent: React.FC<ContentSectionProps> = ({
|
|
84
|
-
|
|
74
|
+
const RenderContent: React.FC<ContentSectionProps['grids'][0]> = ({
|
|
75
|
+
grid,
|
|
85
76
|
...props
|
|
86
77
|
}) => {
|
|
87
78
|
let columnConfigs: columnconfig[] = []
|
|
@@ -113,22 +104,20 @@ const RenderContent: React.FC<ContentSectionProps> = ({
|
|
|
113
104
|
addToColumnConfigs(useCard(props))
|
|
114
105
|
addToColumnConfigs(useCodeCopy(props))
|
|
115
106
|
|
|
116
|
-
return
|
|
107
|
+
return (
|
|
108
|
+
<CustomGrid gridconfig={grid.gridconfig} columnconfig={columnConfigs} />
|
|
109
|
+
)
|
|
117
110
|
}
|
|
118
111
|
|
|
119
112
|
/**
|
|
120
113
|
* ContentSection component renders multiple grids based on the provided configuration.
|
|
121
114
|
* @param grids An array of ContentSectionProps, each representing a grid to be rendered.
|
|
122
115
|
*/
|
|
123
|
-
export default function ContentSection({
|
|
124
|
-
grids,
|
|
125
|
-
}: {
|
|
126
|
-
grids: ContentSectionProps[]
|
|
127
|
-
}) {
|
|
116
|
+
export default function ContentSection({ grids }: ContentSectionProps) {
|
|
128
117
|
return (
|
|
129
118
|
<>
|
|
130
|
-
{grids.map((
|
|
131
|
-
<RenderContent key={index} {...
|
|
119
|
+
{grids.map((gridProps, index) => (
|
|
120
|
+
<RenderContent key={index} {...gridProps} />
|
|
132
121
|
))}
|
|
133
122
|
</>
|
|
134
123
|
)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
2
|
+
import React, { forwardRef, useImperativeHandle, useRef } from 'react'
|
|
4
3
|
import { Close } from '@mui/icons-material'
|
|
5
4
|
import { Dialog, IconButton, Box } from '@mui/material'
|
|
6
5
|
import ContentSection, { ContentSectionProps } from '../../Content'
|
|
7
6
|
import { formContainerStyle } from './../../../styles/Form'
|
|
8
7
|
import { ExtendedTypographyProps } from '../../Content/Structure/typography/useGridTypography'
|
|
8
|
+
import Typography from '../../Typography'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Props for the PopupForm component.
|
|
@@ -19,103 +19,137 @@ export interface PopupFormProps {
|
|
|
19
19
|
open: boolean
|
|
20
20
|
/** Function to call when closing the dialog */
|
|
21
21
|
onClose: () => void
|
|
22
|
-
/**
|
|
23
|
-
grids: ContentSectionProps[]
|
|
22
|
+
/** ContentSectionProps to render the form content */
|
|
23
|
+
grids: ContentSectionProps['grids']
|
|
24
|
+
/** Optional function to handle form submission */
|
|
25
|
+
onSubmit?: () => void
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* PopupForm component renders a popup form with a title, description, and content sections.
|
|
28
30
|
* It uses the ContentSection component to render the form content within a Material-UI Dialog.
|
|
31
|
+
* Handles form submission and displays submitted data internally.
|
|
29
32
|
*
|
|
30
33
|
* @param props The props for the PopupForm component.
|
|
34
|
+
* @param ref Ref forwarded to the form element.
|
|
31
35
|
* @returns The rendered popup form.
|
|
32
36
|
*/
|
|
33
|
-
|
|
34
|
-
title,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
marginleft: 0,
|
|
50
|
-
marginright: 0,
|
|
51
|
-
gridwidth: '100%',
|
|
52
|
-
},
|
|
53
|
-
typography: [
|
|
54
|
-
{
|
|
55
|
-
text: title,
|
|
56
|
-
fontvariant: 'merrih5',
|
|
57
|
-
fontcolor: 'black',
|
|
58
|
-
columnconfig: {
|
|
59
|
-
row: 1,
|
|
60
|
-
column: 1,
|
|
37
|
+
const PopupForm = forwardRef<HTMLFormElement, PopupFormProps>(
|
|
38
|
+
({ title, description, open, onClose, grids, onSubmit }, ref) => {
|
|
39
|
+
const [submittedData, setSubmittedData] = React.useState<
|
|
40
|
+
Record<string, string>
|
|
41
|
+
>({})
|
|
42
|
+
const internalFormRef = useRef<HTMLFormElement>(null)
|
|
43
|
+
|
|
44
|
+
useImperativeHandle(ref, () => internalFormRef.current as HTMLFormElement)
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* headerGrid contains the grid configuration for the form header.
|
|
48
|
+
* It includes the title and description as typography items.
|
|
49
|
+
*/
|
|
50
|
+
const headerGrid: ContentSectionProps['grids'][0] = {
|
|
51
|
+
grid: {
|
|
52
|
+
gridconfig: {
|
|
61
53
|
gridname: 'formHeader',
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
marginbottom: 0.5,
|
|
65
|
-
},
|
|
66
|
-
cellconfig: {
|
|
67
|
-
border: 'none',
|
|
54
|
+
marginbottom: 1,
|
|
55
|
+
gridwidth: '100%',
|
|
68
56
|
},
|
|
69
57
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
58
|
+
typography: [
|
|
59
|
+
{
|
|
60
|
+
text: title,
|
|
61
|
+
fontvariant: 'merrih5',
|
|
62
|
+
fontcolor: 'black',
|
|
63
|
+
columnconfig: {
|
|
64
|
+
column: 1,
|
|
65
|
+
gridname: 'formHeader',
|
|
66
|
+
columnwidth: '100%',
|
|
67
|
+
alignment: 'left',
|
|
68
|
+
marginbottom: 0.5,
|
|
69
|
+
},
|
|
80
70
|
},
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
{
|
|
72
|
+
text: description,
|
|
73
|
+
fontvariant: 'merriparagraph',
|
|
74
|
+
fontcolor: 'black',
|
|
75
|
+
columnconfig: {
|
|
76
|
+
column: 1,
|
|
77
|
+
gridname: 'formHeader',
|
|
78
|
+
columnwidth: '100%',
|
|
79
|
+
},
|
|
83
80
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
81
|
+
] as ExtendedTypographyProps[],
|
|
82
|
+
}
|
|
87
83
|
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
/** Combine the header grid with the provided content grids */
|
|
85
|
+
const contentSectionGrids: ContentSectionProps['grids'] = [
|
|
86
|
+
headerGrid,
|
|
87
|
+
...grids,
|
|
88
|
+
]
|
|
90
89
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
right: 8,
|
|
100
|
-
top: 8,
|
|
101
|
-
color: theme => theme.palette.grey[500],
|
|
102
|
-
}}
|
|
103
|
-
>
|
|
104
|
-
<Close />
|
|
105
|
-
</IconButton>
|
|
90
|
+
/**
|
|
91
|
+
* Handles form submission and processes form data internally.
|
|
92
|
+
* @param event - The form submission event
|
|
93
|
+
*/
|
|
94
|
+
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
|
95
|
+
event.preventDefault()
|
|
96
|
+
const formData = new FormData(event.currentTarget)
|
|
97
|
+
const data: Record<string, string> = {}
|
|
106
98
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
99
|
+
formData.forEach((value, key) => {
|
|
100
|
+
data[key] = value.toString()
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
setSubmittedData(data)
|
|
104
|
+
|
|
105
|
+
if (onSubmit) {
|
|
106
|
+
onSubmit()
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<Dialog open={open} onClose={onClose} fullWidth maxWidth="sm">
|
|
112
|
+
{/* Close button */}
|
|
113
|
+
<IconButton
|
|
114
|
+
size="small"
|
|
115
|
+
onClick={onClose}
|
|
116
|
+
sx={{
|
|
117
|
+
position: 'absolute',
|
|
118
|
+
right: 8,
|
|
119
|
+
top: 8,
|
|
120
|
+
color: theme => theme.palette.grey[500],
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
<Close />
|
|
124
|
+
</IconButton>
|
|
125
|
+
{/* Form container */}
|
|
126
|
+
<Box
|
|
127
|
+
// @ts-ignore
|
|
128
|
+
sx={formContainerStyle}
|
|
129
|
+
>
|
|
130
|
+
<form onSubmit={handleSubmit} ref={internalFormRef}>
|
|
131
|
+
{/* Render the form content using ContentSection */}
|
|
132
|
+
<ContentSection grids={contentSectionGrids} />
|
|
133
|
+
</form>
|
|
134
|
+
{/* Display submitted data */}
|
|
135
|
+
{Object.keys(submittedData).length > 0 && (
|
|
136
|
+
<Box mt={2}>
|
|
137
|
+
<Typography fontvariant="merrih6" text="Submitted Data:" />
|
|
138
|
+
{Object.entries(submittedData).map(([key, value]) => (
|
|
139
|
+
<Typography
|
|
140
|
+
key={key}
|
|
141
|
+
fontvariant="merriparagraph"
|
|
142
|
+
text={`${key}: ${value}`}
|
|
143
|
+
/>
|
|
144
|
+
))}
|
|
145
|
+
</Box>
|
|
146
|
+
)}
|
|
147
|
+
</Box>
|
|
148
|
+
</Dialog>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
PopupForm.displayName = 'PopupForm'
|
|
120
154
|
|
|
121
155
|
export default PopupForm
|
|
@@ -13,8 +13,8 @@ export type BorderProp = 'none' | 'solid'
|
|
|
13
13
|
* Configuration for individual columns within the grid
|
|
14
14
|
*/
|
|
15
15
|
export interface columnconfig {
|
|
16
|
-
row
|
|
17
|
-
column
|
|
16
|
+
row: number
|
|
17
|
+
column: number
|
|
18
18
|
gridname?: string
|
|
19
19
|
alignment?: Alignment
|
|
20
20
|
margintop?: number
|
package/src/index.ts
CHANGED
|
@@ -38,6 +38,7 @@ import PricingTable, { PricingProps } from './components/PricingTable'
|
|
|
38
38
|
import { CustomStepper, CustomStepperProps } from './components/Stepper'
|
|
39
39
|
import CustomToolbar, { ToolbarProps } from './components/Toolbar'
|
|
40
40
|
import TransferList, { TransferListProps } from './components/TransferList'
|
|
41
|
+
import StyledTooltip, { CustomTooltipProps } from './components/Tooltip'
|
|
41
42
|
import React from 'react'
|
|
42
43
|
|
|
43
44
|
// Animations
|
|
@@ -139,6 +140,9 @@ declare type CustomToolbarComponentProps = React.ComponentProps<
|
|
|
139
140
|
declare type TransferListComponentProps = React.ComponentProps<
|
|
140
141
|
typeof TransferList
|
|
141
142
|
>
|
|
143
|
+
declare type StyledTooltipComponentProps = React.ComponentProps<
|
|
144
|
+
typeof StyledTooltip
|
|
145
|
+
>
|
|
142
146
|
|
|
143
147
|
// Named exports
|
|
144
148
|
export { CustomButton }
|
|
@@ -157,6 +161,7 @@ export { PricingTable }
|
|
|
157
161
|
export { CustomStepper }
|
|
158
162
|
export { CustomToolbar }
|
|
159
163
|
export { TransferList }
|
|
164
|
+
export { StyledTooltip }
|
|
160
165
|
export { formContainerStyle }
|
|
161
166
|
|
|
162
167
|
// Exporting ExtendedButtonProps
|
|
@@ -185,6 +190,7 @@ export type { PricingProps }
|
|
|
185
190
|
export type { CustomStepperProps }
|
|
186
191
|
export type { ToolbarProps }
|
|
187
192
|
export type { TransferListProps }
|
|
193
|
+
export type { CustomTooltipProps }
|
|
188
194
|
|
|
189
195
|
// Additional type exports for the newly declared types
|
|
190
196
|
export type { TypographyComponentProps }
|
|
@@ -200,6 +206,7 @@ export type { PricingTableComponentProps }
|
|
|
200
206
|
export type { CustomStepperComponentProps }
|
|
201
207
|
export type { CustomToolbarComponentProps }
|
|
202
208
|
export type { TransferListComponentProps }
|
|
209
|
+
export type { StyledTooltipComponentProps }
|
|
203
210
|
|
|
204
211
|
// Animation type export
|
|
205
212
|
export type { Animation }
|