goobs-frontend 0.7.55 → 0.7.57
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 +1 -1
- package/src/components/Content/Structure/button/useButton.tsx +13 -2
- package/src/components/Content/Structure/card/useCard.tsx +17 -2
- package/src/components/Content/Structure/codecopy/useCodeCopy.tsx +18 -2
- package/src/components/Content/Structure/confirmationinput/useConfirmationInput.tsx +17 -2
- package/src/components/Content/Structure/image/useImage.tsx +21 -4
- package/src/components/Content/Structure/link/useLink.tsx +21 -5
- package/src/components/Content/Structure/pricing/usePricing.tsx +18 -2
- package/src/components/Content/Structure/radiogroup/{useGridRadioGroup.tsx → useRadioGroup.tsx} +18 -3
- package/src/components/Content/Structure/stepper/useStepper.tsx +35 -10
- package/src/components/Content/Structure/styledcomponent/useStyledComponent.tsx +22 -6
- package/src/components/Content/Structure/transferlist/useTransferList.tsx +28 -9
- package/src/components/Content/Structure/typography/useGridTypography.tsx +19 -3
- package/src/components/Content/index.tsx +1 -1
- package/src/components/PricingTable/defaultconfig.tsx +78 -30
- package/src/components/PricingTable/index.tsx +25 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goobs-frontend",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.57",
|
|
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",
|
|
@@ -5,7 +5,7 @@ import { columnconfig, cellconfig } from '../../../Grid'
|
|
|
5
5
|
import { TypographyPropsVariantOverrides } from '@mui/material'
|
|
6
6
|
|
|
7
7
|
export interface ExtendedButtonProps extends CustomButtonProps {
|
|
8
|
-
columnconfig?: columnconfig
|
|
8
|
+
columnconfig?: Partial<columnconfig>
|
|
9
9
|
cellconfig?: cellconfig
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -39,8 +39,19 @@ const useButton = (grid: {
|
|
|
39
39
|
...restProps
|
|
40
40
|
} = buttonItem
|
|
41
41
|
|
|
42
|
+
if (
|
|
43
|
+
!itemColumnConfig ||
|
|
44
|
+
typeof itemColumnConfig !== 'object' ||
|
|
45
|
+
typeof itemColumnConfig.row !== 'number' ||
|
|
46
|
+
typeof itemColumnConfig.column !== 'number'
|
|
47
|
+
) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
'columnconfig must be an object with row and column as numbers'
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
42
53
|
const mergedConfig: columnconfig = {
|
|
43
|
-
...itemColumnConfig,
|
|
54
|
+
...(itemColumnConfig as columnconfig),
|
|
44
55
|
cellconfig: {
|
|
45
56
|
...cellconfig,
|
|
46
57
|
},
|
|
@@ -3,8 +3,12 @@ import React from 'react'
|
|
|
3
3
|
import { columnconfig, cellconfig } from '../../../Grid'
|
|
4
4
|
import Card, { CardProps } from './../../../../components/Card'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
|
|
7
|
+
component?: columnconfig['component']
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ExtendedCardProps extends Omit<CardProps, 'columnconfig'> {
|
|
11
|
+
columnconfig?: ExtendedColumnConfig
|
|
8
12
|
cellconfig?: cellconfig
|
|
9
13
|
}
|
|
10
14
|
|
|
@@ -23,6 +27,17 @@ const useCard = (grid: {
|
|
|
23
27
|
...restProps
|
|
24
28
|
} = cardProps
|
|
25
29
|
|
|
30
|
+
if (
|
|
31
|
+
!itemColumnConfig ||
|
|
32
|
+
typeof itemColumnConfig !== 'object' ||
|
|
33
|
+
typeof itemColumnConfig.row !== 'number' ||
|
|
34
|
+
typeof itemColumnConfig.column !== 'number'
|
|
35
|
+
) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
'columnconfig must be an object with row and column as numbers'
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
26
41
|
// Merge the existing columnconfig with the new props
|
|
27
42
|
const mergedConfig: columnconfig = {
|
|
28
43
|
...itemColumnConfig,
|
|
@@ -3,8 +3,13 @@ import React from 'react'
|
|
|
3
3
|
import CodeCopy, { CodeCopyProps } from './../../../../components/CodeCopy'
|
|
4
4
|
import { columnconfig, cellconfig } from '../../../Grid'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
|
|
7
|
+
component?: columnconfig['component']
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ExtendedCodeCopyProps
|
|
11
|
+
extends Omit<CodeCopyProps, 'columnconfig'> {
|
|
12
|
+
columnconfig?: ExtendedColumnConfig
|
|
8
13
|
cellconfig?: cellconfig
|
|
9
14
|
}
|
|
10
15
|
|
|
@@ -25,6 +30,17 @@ const useCodeCopy = (grid: {
|
|
|
25
30
|
...restProps
|
|
26
31
|
} = codeCopyProps
|
|
27
32
|
|
|
33
|
+
if (
|
|
34
|
+
!itemColumnConfig ||
|
|
35
|
+
typeof itemColumnConfig !== 'object' ||
|
|
36
|
+
typeof itemColumnConfig.row !== 'number' ||
|
|
37
|
+
typeof itemColumnConfig.column !== 'number'
|
|
38
|
+
) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
'columnconfig must be an object with row and column as numbers'
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
28
44
|
// Merge the existing columnconfig with the new props
|
|
29
45
|
const mergedConfig: columnconfig = {
|
|
30
46
|
...itemColumnConfig,
|
|
@@ -5,9 +5,13 @@ import ConfirmationCodeInputs, {
|
|
|
5
5
|
} from '../../../ConfirmationCodeInput'
|
|
6
6
|
import { columnconfig, cellconfig } from '../../../Grid'
|
|
7
7
|
|
|
8
|
+
type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
|
|
9
|
+
component?: columnconfig['component']
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
export interface ExtendedConfirmationCodeInputsProps
|
|
9
|
-
extends ConfirmationCodeInputsProps {
|
|
10
|
-
columnconfig?:
|
|
13
|
+
extends Omit<ConfirmationCodeInputsProps, 'columnconfig'> {
|
|
14
|
+
columnconfig?: ExtendedColumnConfig
|
|
11
15
|
cellconfig?: cellconfig
|
|
12
16
|
}
|
|
13
17
|
|
|
@@ -30,6 +34,17 @@ const useConfirmationInput = (grid: {
|
|
|
30
34
|
...restProps
|
|
31
35
|
} = confirmationCodeInputProps
|
|
32
36
|
|
|
37
|
+
if (
|
|
38
|
+
!itemColumnConfig ||
|
|
39
|
+
typeof itemColumnConfig !== 'object' ||
|
|
40
|
+
typeof itemColumnConfig.row !== 'number' ||
|
|
41
|
+
typeof itemColumnConfig.column !== 'number'
|
|
42
|
+
) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
'columnconfig must be an object with row and column as numbers'
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
33
48
|
return {
|
|
34
49
|
...itemColumnConfig,
|
|
35
50
|
cellconfig: {
|
|
@@ -3,6 +3,10 @@ import React from 'react'
|
|
|
3
3
|
import Image from 'next/image'
|
|
4
4
|
import { columnconfig, cellconfig } from '../../../Grid'
|
|
5
5
|
|
|
6
|
+
type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
|
|
7
|
+
component?: columnconfig['component']
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
type ImageProps = {
|
|
7
11
|
url: string
|
|
8
12
|
alt?: string
|
|
@@ -11,13 +15,13 @@ type ImageProps = {
|
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
export interface ExtendedImageProps extends Omit<ImageProps, 'columnconfig'> {
|
|
14
|
-
columnconfig?:
|
|
18
|
+
columnconfig?: ExtendedColumnConfig
|
|
15
19
|
cellconfig?: cellconfig
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
const useImage = (grid: {
|
|
19
23
|
image?: ExtendedImageProps | ExtendedImageProps[]
|
|
20
|
-
}) => {
|
|
24
|
+
}): columnconfig | columnconfig[] | null => {
|
|
21
25
|
if (!grid.image) return null
|
|
22
26
|
|
|
23
27
|
const renderImage = (
|
|
@@ -32,7 +36,20 @@ const useImage = (grid: {
|
|
|
32
36
|
...restProps
|
|
33
37
|
} = imageItem
|
|
34
38
|
|
|
35
|
-
if (!url)
|
|
39
|
+
if (!url) {
|
|
40
|
+
throw new Error('URL is required for image')
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (
|
|
44
|
+
!itemColumnConfig ||
|
|
45
|
+
typeof itemColumnConfig !== 'object' ||
|
|
46
|
+
typeof itemColumnConfig.row !== 'number' ||
|
|
47
|
+
typeof itemColumnConfig.column !== 'number'
|
|
48
|
+
) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
'columnconfig must be an object with row and column as numbers'
|
|
51
|
+
)
|
|
52
|
+
}
|
|
36
53
|
|
|
37
54
|
return {
|
|
38
55
|
...itemColumnConfig,
|
|
@@ -55,7 +72,7 @@ const useImage = (grid: {
|
|
|
55
72
|
if (Array.isArray(grid.image)) {
|
|
56
73
|
return grid.image.map(renderImage)
|
|
57
74
|
} else {
|
|
58
|
-
return
|
|
75
|
+
return renderImage(grid.image, 0)
|
|
59
76
|
}
|
|
60
77
|
}
|
|
61
78
|
|
|
@@ -4,15 +4,20 @@ import Link from 'next/link'
|
|
|
4
4
|
import { Typography, TypographyProps } from '../../../Typography'
|
|
5
5
|
import { columnconfig, cellconfig } from '../../../Grid'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
|
|
8
|
+
component?: columnconfig['component']
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ExtendedTypographyProps
|
|
12
|
+
extends Omit<TypographyProps, 'columnconfig'> {
|
|
13
|
+
columnconfig?: ExtendedColumnConfig
|
|
9
14
|
cellconfig?: cellconfig
|
|
10
|
-
link
|
|
15
|
+
link: string
|
|
11
16
|
}
|
|
12
17
|
|
|
13
18
|
const useLink = (grid: {
|
|
14
19
|
link?: ExtendedTypographyProps | ExtendedTypographyProps[]
|
|
15
|
-
}) => {
|
|
20
|
+
}): columnconfig | columnconfig[] | null => {
|
|
16
21
|
if (!grid.link) return null
|
|
17
22
|
|
|
18
23
|
const renderLink = (
|
|
@@ -33,6 +38,17 @@ const useLink = (grid: {
|
|
|
33
38
|
throw new Error('Link property is required in ExtendedTypographyProps')
|
|
34
39
|
}
|
|
35
40
|
|
|
41
|
+
if (
|
|
42
|
+
!itemColumnConfig ||
|
|
43
|
+
typeof itemColumnConfig !== 'object' ||
|
|
44
|
+
typeof itemColumnConfig.row !== 'number' ||
|
|
45
|
+
typeof itemColumnConfig.column !== 'number'
|
|
46
|
+
) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
'columnconfig must be an object with row and column as numbers'
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
36
52
|
return {
|
|
37
53
|
...itemColumnConfig,
|
|
38
54
|
cellconfig: {
|
|
@@ -53,7 +69,7 @@ const useLink = (grid: {
|
|
|
53
69
|
if (Array.isArray(grid.link)) {
|
|
54
70
|
return grid.link.map(renderLink)
|
|
55
71
|
} else {
|
|
56
|
-
return
|
|
72
|
+
return renderLink(grid.link, 0)
|
|
57
73
|
}
|
|
58
74
|
}
|
|
59
75
|
|
|
@@ -4,8 +4,13 @@ import PricingTable from './../../../../components/PricingTable'
|
|
|
4
4
|
import { columnconfig, cellconfig } from '../../../Grid'
|
|
5
5
|
import { PricingProps } from './../../../../components/PricingTable'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
|
|
8
|
+
component?: columnconfig['component']
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ExtendedPricingProps
|
|
12
|
+
extends Omit<PricingProps, 'columnconfig'> {
|
|
13
|
+
columnconfig?: ExtendedColumnConfig
|
|
9
14
|
cellconfig?: cellconfig
|
|
10
15
|
}
|
|
11
16
|
|
|
@@ -22,6 +27,17 @@ const usePricing = (pricing?: ExtendedPricingProps): columnconfig | null => {
|
|
|
22
27
|
...restProps
|
|
23
28
|
} = pricingItem
|
|
24
29
|
|
|
30
|
+
if (
|
|
31
|
+
!itemColumnConfig ||
|
|
32
|
+
typeof itemColumnConfig !== 'object' ||
|
|
33
|
+
typeof itemColumnConfig.row !== 'number' ||
|
|
34
|
+
typeof itemColumnConfig.column !== 'number'
|
|
35
|
+
) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
'columnconfig must be an object with row and column as numbers'
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
25
41
|
// Merge the existing columnconfig with the new props
|
|
26
42
|
const mergedConfig: columnconfig = {
|
|
27
43
|
...itemColumnConfig,
|
package/src/components/Content/Structure/radiogroup/{useGridRadioGroup.tsx → useRadioGroup.tsx}
RENAMED
|
@@ -3,15 +3,19 @@ import RadioGroup from '../../../RadioGroup'
|
|
|
3
3
|
import { columnconfig, cellconfig } from '../../../Grid'
|
|
4
4
|
import { RadioGroupProps as BaseRadioGroupProps } from '../../../../components/RadioGroup'
|
|
5
5
|
|
|
6
|
+
type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
|
|
7
|
+
component?: columnconfig['component']
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
export interface ExtendedRadioGroupProps
|
|
7
11
|
extends Omit<BaseRadioGroupProps, 'columnconfig'> {
|
|
8
|
-
columnconfig?:
|
|
12
|
+
columnconfig?: ExtendedColumnConfig
|
|
9
13
|
cellconfig?: cellconfig
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
const useGridRadioGroup = (grid: {
|
|
13
17
|
radiogroup?: ExtendedRadioGroupProps | ExtendedRadioGroupProps[]
|
|
14
|
-
}) => {
|
|
18
|
+
}): columnconfig | columnconfig[] | null => {
|
|
15
19
|
if (!grid.radiogroup) return null
|
|
16
20
|
|
|
17
21
|
const renderRadioGroup = (
|
|
@@ -31,6 +35,17 @@ const useGridRadioGroup = (grid: {
|
|
|
31
35
|
...restProps
|
|
32
36
|
} = radiogroup
|
|
33
37
|
|
|
38
|
+
if (
|
|
39
|
+
!itemColumnConfig ||
|
|
40
|
+
typeof itemColumnConfig !== 'object' ||
|
|
41
|
+
typeof itemColumnConfig.row !== 'number' ||
|
|
42
|
+
typeof itemColumnConfig.column !== 'number'
|
|
43
|
+
) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
'columnconfig must be an object with row and column as numbers'
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
34
49
|
return {
|
|
35
50
|
...itemColumnConfig,
|
|
36
51
|
cellconfig: {
|
|
@@ -55,7 +70,7 @@ const useGridRadioGroup = (grid: {
|
|
|
55
70
|
if (Array.isArray(grid.radiogroup)) {
|
|
56
71
|
return grid.radiogroup.map(renderRadioGroup)
|
|
57
72
|
} else {
|
|
58
|
-
return
|
|
73
|
+
return renderRadioGroup(grid.radiogroup, 0)
|
|
59
74
|
}
|
|
60
75
|
}
|
|
61
76
|
|
|
@@ -7,25 +7,50 @@ import {
|
|
|
7
7
|
import { columnconfig, cellconfig } from '../../../Grid'
|
|
8
8
|
import { CustomStepperProps as BaseCustomStepperProps } from './../../../../components/Stepper'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
|
|
11
|
+
component?: columnconfig['component']
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ExtendedStepperProps
|
|
15
|
+
extends Omit<BaseCustomStepperProps, 'columnconfig'> {
|
|
11
16
|
cellconfig?: cellconfig
|
|
12
|
-
columnconfig?:
|
|
17
|
+
columnconfig?: ExtendedColumnConfig
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
const useStepper = (grid: {
|
|
16
21
|
stepper?: ExtendedStepperProps | ExtendedStepperProps[]
|
|
17
|
-
}) => {
|
|
22
|
+
}): columnconfig | columnconfig[] | null => {
|
|
18
23
|
if (!grid.stepper) return null
|
|
19
24
|
|
|
20
|
-
const renderStepper = (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
const renderStepper = (
|
|
26
|
+
stepperProps: ExtendedStepperProps,
|
|
27
|
+
index: number
|
|
28
|
+
): columnconfig => {
|
|
29
|
+
const {
|
|
30
|
+
steps,
|
|
31
|
+
columnconfig: itemColumnConfig,
|
|
32
|
+
cellconfig,
|
|
33
|
+
...restProps
|
|
34
|
+
} = stepperProps
|
|
35
|
+
|
|
36
|
+
if (
|
|
37
|
+
!itemColumnConfig ||
|
|
38
|
+
typeof itemColumnConfig !== 'object' ||
|
|
39
|
+
typeof itemColumnConfig.row !== 'number' ||
|
|
40
|
+
typeof itemColumnConfig.column !== 'number'
|
|
41
|
+
) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
'columnconfig must be an object with row and column as numbers'
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const mergedConfig: columnconfig = {
|
|
48
|
+
...itemColumnConfig,
|
|
24
49
|
cellconfig: {
|
|
25
50
|
...cellconfig,
|
|
26
51
|
},
|
|
27
52
|
component: (
|
|
28
|
-
<CustomStepper steps={steps} {...restProps}>
|
|
53
|
+
<CustomStepper key={`stepper-${index}`} steps={steps} {...restProps}>
|
|
29
54
|
{steps.map(step => (
|
|
30
55
|
<Step key={step.label}>
|
|
31
56
|
<StepLabel>{step.label}</StepLabel>
|
|
@@ -38,9 +63,9 @@ const useStepper = (grid: {
|
|
|
38
63
|
}
|
|
39
64
|
|
|
40
65
|
if (Array.isArray(grid.stepper)) {
|
|
41
|
-
return grid.stepper.map(renderStepper)
|
|
66
|
+
return grid.stepper.map((stepper, index) => renderStepper(stepper, index))
|
|
42
67
|
} else {
|
|
43
|
-
return renderStepper(grid.stepper)
|
|
68
|
+
return renderStepper(grid.stepper, 0)
|
|
44
69
|
}
|
|
45
70
|
}
|
|
46
71
|
|
|
@@ -4,8 +4,13 @@ import StyledComponent, {
|
|
|
4
4
|
} from '../../../../components/StyledComponent'
|
|
5
5
|
import { columnconfig, cellconfig } from '../../../Grid'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
|
|
8
|
+
component?: columnconfig['component']
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ExtendedStyledComponentProps
|
|
12
|
+
extends Omit<StyledComponentProps, 'columnconfig'> {
|
|
13
|
+
columnconfig?: ExtendedColumnConfig
|
|
9
14
|
cellconfig?: cellconfig
|
|
10
15
|
}
|
|
11
16
|
|
|
@@ -13,7 +18,7 @@ const useStyledComponent = (grid: {
|
|
|
13
18
|
styledcomponent?:
|
|
14
19
|
| ExtendedStyledComponentProps
|
|
15
20
|
| ExtendedStyledComponentProps[]
|
|
16
|
-
}) => {
|
|
21
|
+
}): columnconfig | columnconfig[] | null => {
|
|
17
22
|
if (!grid.styledcomponent) return null
|
|
18
23
|
|
|
19
24
|
const renderStyledComponent = (
|
|
@@ -40,16 +45,27 @@ const useStyledComponent = (grid: {
|
|
|
40
45
|
onChange,
|
|
41
46
|
defaultValue,
|
|
42
47
|
inputRef,
|
|
43
|
-
columnconfig,
|
|
48
|
+
columnconfig: itemColumnConfig,
|
|
44
49
|
valuestatus,
|
|
45
50
|
cellconfig,
|
|
46
51
|
required,
|
|
47
52
|
...restProps
|
|
48
53
|
} = component
|
|
49
54
|
|
|
55
|
+
if (
|
|
56
|
+
!itemColumnConfig ||
|
|
57
|
+
typeof itemColumnConfig !== 'object' ||
|
|
58
|
+
typeof itemColumnConfig.row !== 'number' ||
|
|
59
|
+
typeof itemColumnConfig.column !== 'number'
|
|
60
|
+
) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
'columnconfig must be an object with row and column as numbers'
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
50
66
|
// Merge the cellconfig with the columnconfig
|
|
51
67
|
const mergedConfig: columnconfig = {
|
|
52
|
-
...
|
|
68
|
+
...itemColumnConfig,
|
|
53
69
|
cellconfig: {
|
|
54
70
|
...cellconfig,
|
|
55
71
|
},
|
|
@@ -87,7 +103,7 @@ const useStyledComponent = (grid: {
|
|
|
87
103
|
if (Array.isArray(grid.styledcomponent)) {
|
|
88
104
|
return grid.styledcomponent.map(renderStyledComponent)
|
|
89
105
|
} else {
|
|
90
|
-
return
|
|
106
|
+
return renderStyledComponent(grid.styledcomponent, 0)
|
|
91
107
|
}
|
|
92
108
|
}
|
|
93
109
|
|
|
@@ -2,35 +2,53 @@ import React from 'react'
|
|
|
2
2
|
import TransferList, { TransferListProps } from '../../../TransferList'
|
|
3
3
|
import { columnconfig, cellconfig } from '../../../Grid'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
|
|
6
|
+
component?: columnconfig['component']
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ExtendedTransferListProps
|
|
10
|
+
extends Omit<TransferListProps, 'columnconfig'> {
|
|
11
|
+
columnconfig?: ExtendedColumnConfig
|
|
7
12
|
cellconfig?: cellconfig
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
const useTransferList = (grid: {
|
|
11
16
|
transferlist?: ExtendedTransferListProps | ExtendedTransferListProps[]
|
|
12
|
-
}) => {
|
|
17
|
+
}): columnconfig | columnconfig[] | null => {
|
|
13
18
|
if (!grid.transferlist) return null
|
|
14
19
|
|
|
15
20
|
const renderTransferList = (
|
|
16
|
-
transferListItem: ExtendedTransferListProps
|
|
21
|
+
transferListItem: ExtendedTransferListProps,
|
|
22
|
+
index: number
|
|
17
23
|
): columnconfig => {
|
|
18
24
|
const {
|
|
19
25
|
leftItems,
|
|
20
26
|
rightItems,
|
|
21
27
|
onChange,
|
|
22
|
-
columnconfig,
|
|
28
|
+
columnconfig: itemColumnConfig,
|
|
23
29
|
cellconfig,
|
|
24
30
|
...restProps
|
|
25
31
|
} = transferListItem
|
|
26
32
|
|
|
33
|
+
if (
|
|
34
|
+
!itemColumnConfig ||
|
|
35
|
+
typeof itemColumnConfig !== 'object' ||
|
|
36
|
+
typeof itemColumnConfig.row !== 'number' ||
|
|
37
|
+
typeof itemColumnConfig.column !== 'number'
|
|
38
|
+
) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
'columnconfig must be an object with row and column as numbers'
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
27
44
|
const mergedConfig: columnconfig = {
|
|
28
|
-
...
|
|
45
|
+
...itemColumnConfig,
|
|
29
46
|
cellconfig: {
|
|
30
47
|
...cellconfig,
|
|
31
48
|
},
|
|
32
49
|
component: (
|
|
33
50
|
<TransferList
|
|
51
|
+
key={`transferlist-${index}`}
|
|
34
52
|
leftItems={leftItems}
|
|
35
53
|
rightItems={rightItems}
|
|
36
54
|
onChange={onChange}
|
|
@@ -38,14 +56,15 @@ const useTransferList = (grid: {
|
|
|
38
56
|
/>
|
|
39
57
|
),
|
|
40
58
|
}
|
|
41
|
-
|
|
42
59
|
return mergedConfig
|
|
43
60
|
}
|
|
44
61
|
|
|
45
62
|
if (Array.isArray(grid.transferlist)) {
|
|
46
|
-
return grid.transferlist.map(
|
|
63
|
+
return grid.transferlist.map((item, index) =>
|
|
64
|
+
renderTransferList(item, index)
|
|
65
|
+
)
|
|
47
66
|
} else {
|
|
48
|
-
return renderTransferList(grid.transferlist)
|
|
67
|
+
return renderTransferList(grid.transferlist, 0)
|
|
49
68
|
}
|
|
50
69
|
}
|
|
51
70
|
|
|
@@ -2,14 +2,19 @@ import React from 'react'
|
|
|
2
2
|
import { Typography, TypographyProps } from '../../../Typography'
|
|
3
3
|
import { columnconfig, cellconfig } from '../../../Grid'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
|
|
6
|
+
component?: columnconfig['component']
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ExtendedTypographyProps
|
|
10
|
+
extends Omit<TypographyProps, 'columnconfig'> {
|
|
11
|
+
columnconfig?: ExtendedColumnConfig
|
|
7
12
|
cellconfig?: cellconfig
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
const useGridTypography = (grid: {
|
|
11
16
|
typography?: ExtendedTypographyProps | ExtendedTypographyProps[]
|
|
12
|
-
}) => {
|
|
17
|
+
}): columnconfig | columnconfig[] | null => {
|
|
13
18
|
if (!grid.typography) return null
|
|
14
19
|
|
|
15
20
|
const renderTypography = (
|
|
@@ -25,6 +30,17 @@ const useGridTypography = (grid: {
|
|
|
25
30
|
...restProps
|
|
26
31
|
} = typographyItem
|
|
27
32
|
|
|
33
|
+
if (
|
|
34
|
+
!itemColumnConfig ||
|
|
35
|
+
typeof itemColumnConfig !== 'object' ||
|
|
36
|
+
typeof itemColumnConfig.row !== 'number' ||
|
|
37
|
+
typeof itemColumnConfig.column !== 'number'
|
|
38
|
+
) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
'columnconfig must be an object with row and column as numbers'
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
28
44
|
return {
|
|
29
45
|
...itemColumnConfig,
|
|
30
46
|
cellconfig: {
|
|
@@ -10,7 +10,7 @@ import useStyledComponent, {
|
|
|
10
10
|
} from '../../components/Content/Structure/styledcomponent/useStyledComponent'
|
|
11
11
|
import useGridRadioGroup, {
|
|
12
12
|
ExtendedRadioGroupProps,
|
|
13
|
-
} from '
|
|
13
|
+
} from './Structure/radiogroup/useRadioGroup'
|
|
14
14
|
import useConfirmationInput, {
|
|
15
15
|
ExtendedConfirmationCodeInputsProps,
|
|
16
16
|
} from '../../components/Content/Structure/confirmationinput/useConfirmationInput'
|
|
@@ -116,12 +116,20 @@ const defaultConfig: PricingProps = {
|
|
|
116
116
|
},
|
|
117
117
|
},
|
|
118
118
|
tiedtopackage: {
|
|
119
|
-
row: 1,
|
|
120
|
-
column: 2,
|
|
121
119
|
tiedtopackages: 'true',
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
columnconfig: {
|
|
121
|
+
row: 1,
|
|
122
|
+
column: 2,
|
|
123
|
+
mobilewidth: '20%',
|
|
124
|
+
tabletwidth: '50%',
|
|
125
|
+
computerwidth: '50%',
|
|
126
|
+
gridname: 'pricingtablefeatures',
|
|
127
|
+
alignment: 'center' as Alignment,
|
|
128
|
+
cellconfig: {
|
|
129
|
+
border: 'solid',
|
|
130
|
+
minHeight: '40px',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
125
133
|
},
|
|
126
134
|
subfeatures: [
|
|
127
135
|
{
|
|
@@ -143,12 +151,20 @@ const defaultConfig: PricingProps = {
|
|
|
143
151
|
},
|
|
144
152
|
},
|
|
145
153
|
tiedtopackage: {
|
|
146
|
-
row: 2,
|
|
147
|
-
column: 2,
|
|
148
154
|
tiedtopackages: 'true',
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
columnconfig: {
|
|
156
|
+
row: 2,
|
|
157
|
+
column: 2,
|
|
158
|
+
mobilewidth: '20%',
|
|
159
|
+
tabletwidth: '50%',
|
|
160
|
+
computerwidth: '50%',
|
|
161
|
+
gridname: 'pricingtablefeatures',
|
|
162
|
+
alignment: 'center' as Alignment,
|
|
163
|
+
cellconfig: {
|
|
164
|
+
border: 'solid',
|
|
165
|
+
minHeight: '40px',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
152
168
|
},
|
|
153
169
|
},
|
|
154
170
|
{
|
|
@@ -170,12 +186,20 @@ const defaultConfig: PricingProps = {
|
|
|
170
186
|
},
|
|
171
187
|
},
|
|
172
188
|
tiedtopackage: {
|
|
173
|
-
row: 3,
|
|
174
|
-
column: 2,
|
|
175
189
|
tiedtopackages: 'true',
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
190
|
+
columnconfig: {
|
|
191
|
+
row: 3,
|
|
192
|
+
column: 2,
|
|
193
|
+
mobilewidth: '20%',
|
|
194
|
+
tabletwidth: '50%',
|
|
195
|
+
computerwidth: '50%',
|
|
196
|
+
gridname: 'pricingtablefeatures',
|
|
197
|
+
alignment: 'center' as Alignment,
|
|
198
|
+
cellconfig: {
|
|
199
|
+
border: 'solid',
|
|
200
|
+
minHeight: '40px',
|
|
201
|
+
},
|
|
202
|
+
},
|
|
179
203
|
},
|
|
180
204
|
},
|
|
181
205
|
],
|
|
@@ -198,12 +222,20 @@ const defaultConfig: PricingProps = {
|
|
|
198
222
|
},
|
|
199
223
|
},
|
|
200
224
|
tiedtopackage: {
|
|
201
|
-
row: 4,
|
|
202
|
-
column: 2,
|
|
203
225
|
tiedtopackages: 'true',
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
226
|
+
columnconfig: {
|
|
227
|
+
row: 4,
|
|
228
|
+
column: 2,
|
|
229
|
+
mobilewidth: '20%',
|
|
230
|
+
tabletwidth: '50%',
|
|
231
|
+
computerwidth: '50%',
|
|
232
|
+
gridname: 'pricingtablefeatures',
|
|
233
|
+
alignment: 'center' as Alignment,
|
|
234
|
+
cellconfig: {
|
|
235
|
+
border: 'solid',
|
|
236
|
+
minHeight: '40px',
|
|
237
|
+
},
|
|
238
|
+
},
|
|
207
239
|
},
|
|
208
240
|
subfeatures: [
|
|
209
241
|
{
|
|
@@ -225,12 +257,20 @@ const defaultConfig: PricingProps = {
|
|
|
225
257
|
},
|
|
226
258
|
},
|
|
227
259
|
tiedtopackage: {
|
|
228
|
-
row: 5,
|
|
229
|
-
column: 2,
|
|
230
260
|
tiedtopackages: 'true',
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
261
|
+
columnconfig: {
|
|
262
|
+
row: 5,
|
|
263
|
+
column: 2,
|
|
264
|
+
mobilewidth: '20%',
|
|
265
|
+
tabletwidth: '50%',
|
|
266
|
+
computerwidth: '50%',
|
|
267
|
+
gridname: 'pricingtablefeatures',
|
|
268
|
+
alignment: 'center' as Alignment,
|
|
269
|
+
cellconfig: {
|
|
270
|
+
border: 'solid',
|
|
271
|
+
minHeight: '40px',
|
|
272
|
+
},
|
|
273
|
+
},
|
|
234
274
|
},
|
|
235
275
|
},
|
|
236
276
|
{
|
|
@@ -252,12 +292,20 @@ const defaultConfig: PricingProps = {
|
|
|
252
292
|
},
|
|
253
293
|
},
|
|
254
294
|
tiedtopackage: {
|
|
255
|
-
row: 6,
|
|
256
|
-
column: 2,
|
|
257
295
|
tiedtopackages: 'true',
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
296
|
+
columnconfig: {
|
|
297
|
+
row: 6,
|
|
298
|
+
column: 2,
|
|
299
|
+
mobilewidth: '20%',
|
|
300
|
+
tabletwidth: '50%',
|
|
301
|
+
computerwidth: '50%',
|
|
302
|
+
gridname: 'pricingtablefeatures',
|
|
303
|
+
alignment: 'center' as Alignment,
|
|
304
|
+
cellconfig: {
|
|
305
|
+
border: 'solid',
|
|
306
|
+
minHeight: '40px',
|
|
307
|
+
},
|
|
308
|
+
},
|
|
261
309
|
},
|
|
262
310
|
},
|
|
263
311
|
],
|
|
@@ -7,8 +7,8 @@ import { Typography } from '../Typography'
|
|
|
7
7
|
import StyledTooltip from '../Tooltip'
|
|
8
8
|
import CustomButton from '../Button'
|
|
9
9
|
import StyledComponent from '../StyledComponent'
|
|
10
|
-
import CustomGrid from '
|
|
11
|
-
import { columnconfig, gridconfig } from '
|
|
10
|
+
import CustomGrid from './../../components/Grid'
|
|
11
|
+
import { columnconfig, gridconfig } from './../../components/Grid/'
|
|
12
12
|
import defaultConfig from './defaultconfig'
|
|
13
13
|
import { useRouter } from 'next/navigation'
|
|
14
14
|
import {
|
|
@@ -19,6 +19,11 @@ import {
|
|
|
19
19
|
aqua,
|
|
20
20
|
} from '../../styles/palette'
|
|
21
21
|
|
|
22
|
+
type TiedToPackage = {
|
|
23
|
+
tiedtopackages?: string
|
|
24
|
+
columnconfig?: Omit<columnconfig, 'component'>
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
/**
|
|
23
28
|
* Interface for sub-features in the pricing table
|
|
24
29
|
*/
|
|
@@ -26,15 +31,8 @@ interface SubFeature {
|
|
|
26
31
|
title: string
|
|
27
32
|
titlelink?: string
|
|
28
33
|
infopopuptext?: string
|
|
29
|
-
columnconfig?: columnconfig
|
|
30
|
-
tiedtopackage?:
|
|
31
|
-
row?: number
|
|
32
|
-
column?: number
|
|
33
|
-
tiedtopackages?: string
|
|
34
|
-
mobilewidth?: string
|
|
35
|
-
tabletwidth?: string
|
|
36
|
-
computerwidth?: string
|
|
37
|
-
}
|
|
34
|
+
columnconfig?: Omit<columnconfig, 'component'>
|
|
35
|
+
tiedtopackage?: TiedToPackage
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
/**
|
|
@@ -45,15 +43,8 @@ interface Feature {
|
|
|
45
43
|
infopopuptext?: string
|
|
46
44
|
titlelink?: string
|
|
47
45
|
subfeatures: SubFeature[]
|
|
48
|
-
columnconfig?: columnconfig
|
|
49
|
-
tiedtopackage?:
|
|
50
|
-
row?: number
|
|
51
|
-
column?: number
|
|
52
|
-
tiedtopackages?: string
|
|
53
|
-
mobilewidth?: string
|
|
54
|
-
tabletwidth?: string
|
|
55
|
-
computerwidth?: string
|
|
56
|
-
}
|
|
46
|
+
columnconfig?: Omit<columnconfig, 'component'>
|
|
47
|
+
tiedtopackage?: TiedToPackage
|
|
57
48
|
}
|
|
58
49
|
|
|
59
50
|
/**
|
|
@@ -184,11 +175,7 @@ const PricingTable: React.FC<PricingProps> = props => {
|
|
|
184
175
|
featureColumnConfigs.push({
|
|
185
176
|
...feature.columnconfig,
|
|
186
177
|
component: (
|
|
187
|
-
<Box
|
|
188
|
-
// @ts-ignore
|
|
189
|
-
display="flex"
|
|
190
|
-
alignItems="center"
|
|
191
|
-
>
|
|
178
|
+
<Box display="flex" alignItems="center">
|
|
192
179
|
<Typography
|
|
193
180
|
text={feature.title}
|
|
194
181
|
fontcolor={black.main}
|
|
@@ -211,13 +198,13 @@ const PricingTable: React.FC<PricingProps> = props => {
|
|
|
211
198
|
)}
|
|
212
199
|
</Box>
|
|
213
200
|
),
|
|
214
|
-
})
|
|
201
|
+
} as columnconfig)
|
|
215
202
|
}
|
|
216
203
|
|
|
217
204
|
// Render feature checkbox
|
|
218
|
-
if (feature.tiedtopackage) {
|
|
219
|
-
|
|
220
|
-
...feature.tiedtopackage,
|
|
205
|
+
if (feature.tiedtopackage && feature.tiedtopackage.columnconfig) {
|
|
206
|
+
const tiedConfig: columnconfig = {
|
|
207
|
+
...feature.tiedtopackage.columnconfig,
|
|
221
208
|
cellconfig: {
|
|
222
209
|
border: 'solid',
|
|
223
210
|
minHeight: '40px',
|
|
@@ -225,12 +212,10 @@ const PricingTable: React.FC<PricingProps> = props => {
|
|
|
225
212
|
component: feature.tiedtopackage.tiedtopackages ? (
|
|
226
213
|
<CheckCircleIcon />
|
|
227
214
|
) : (
|
|
228
|
-
<Box
|
|
229
|
-
// @ts-ignore
|
|
230
|
-
sx={{ width: '24px', height: '24px' }}
|
|
231
|
-
/>
|
|
215
|
+
<Box sx={{ width: '24px', height: '24px' }} />
|
|
232
216
|
),
|
|
233
|
-
}
|
|
217
|
+
}
|
|
218
|
+
featureColumnConfigs.push(tiedConfig)
|
|
234
219
|
}
|
|
235
220
|
|
|
236
221
|
// Render subfeatures
|
|
@@ -262,13 +247,13 @@ const PricingTable: React.FC<PricingProps> = props => {
|
|
|
262
247
|
)}
|
|
263
248
|
</Box>
|
|
264
249
|
),
|
|
265
|
-
})
|
|
250
|
+
} as columnconfig)
|
|
266
251
|
}
|
|
267
252
|
|
|
268
253
|
// Render subfeature checkbox
|
|
269
|
-
if (subFeature.tiedtopackage) {
|
|
270
|
-
|
|
271
|
-
...subFeature.tiedtopackage,
|
|
254
|
+
if (subFeature.tiedtopackage && subFeature.tiedtopackage.columnconfig) {
|
|
255
|
+
const tiedConfig: columnconfig = {
|
|
256
|
+
...subFeature.tiedtopackage.columnconfig,
|
|
272
257
|
cellconfig: {
|
|
273
258
|
border: 'solid',
|
|
274
259
|
minHeight: '40px',
|
|
@@ -278,7 +263,8 @@ const PricingTable: React.FC<PricingProps> = props => {
|
|
|
278
263
|
) : (
|
|
279
264
|
<Box sx={{ width: '24px', height: '24px' }} />
|
|
280
265
|
),
|
|
281
|
-
}
|
|
266
|
+
}
|
|
267
|
+
featureColumnConfigs.push(tiedConfig)
|
|
282
268
|
}
|
|
283
269
|
})
|
|
284
270
|
}
|