goobs-frontend 0.8.11 → 0.8.13

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.
@@ -0,0 +1,79 @@
1
+ 'use client'
2
+ import React from 'react'
3
+ import {
4
+ Accordion,
5
+ AccordionSummary,
6
+ AccordionDetails,
7
+ CustomAccordionProps,
8
+ CustomAccordionSummaryProps,
9
+ CustomAccordionDetailsProps,
10
+ } from '../../../Accordion'
11
+ import { columnconfig, cellconfig } from '../../../Grid'
12
+
13
+ export interface ExtendedAccordionProps extends CustomAccordionProps {
14
+ columnconfig?: Partial<columnconfig>
15
+ cellconfig?: cellconfig
16
+ summaryProps?: CustomAccordionSummaryProps
17
+ detailsProps?: CustomAccordionDetailsProps
18
+ summaryContent?: React.ReactNode
19
+ detailsContent?: React.ReactNode
20
+ }
21
+
22
+ const useAccordion = (grid: {
23
+ accordion?: ExtendedAccordionProps | ExtendedAccordionProps[]
24
+ }) => {
25
+ if (!grid.accordion) return null
26
+
27
+ const renderAccordion = (
28
+ accordionItem: ExtendedAccordionProps,
29
+ index: number
30
+ ): columnconfig => {
31
+ const {
32
+ columnconfig: itemColumnConfig,
33
+ cellconfig,
34
+ summaryProps,
35
+ detailsProps,
36
+ summaryContent,
37
+ detailsContent,
38
+ ...restProps
39
+ } = accordionItem
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
+
52
+ const mergedConfig: columnconfig = {
53
+ ...(itemColumnConfig as columnconfig),
54
+ cellconfig: {
55
+ ...cellconfig,
56
+ },
57
+ component: (
58
+ <Accordion key={`accordion-${index}`} {...restProps}>
59
+ <AccordionSummary {...summaryProps}>
60
+ {summaryContent}
61
+ </AccordionSummary>
62
+ <AccordionDetails {...detailsProps}>
63
+ {detailsContent}
64
+ </AccordionDetails>
65
+ </Accordion>
66
+ ),
67
+ }
68
+
69
+ return mergedConfig
70
+ }
71
+
72
+ if (Array.isArray(grid.accordion)) {
73
+ return grid.accordion.map(renderAccordion)
74
+ } else {
75
+ return [renderAccordion(grid.accordion, 0)]
76
+ }
77
+ }
78
+
79
+ export default useAccordion
@@ -2,7 +2,7 @@
2
2
  import React from 'react'
3
3
  import PhoneNumberField from '../../../PhoneNumberField'
4
4
  import { columnconfig, cellconfig } from '../../../Grid'
5
- import { TextFieldProps } from '@mui/material'
5
+ import type { TextFieldProps } from '../../../TextField'
6
6
 
7
7
  export type ExtendedPhoneNumberFieldProps = TextFieldProps & {
8
8
  columnconfig?: Partial<columnconfig>
@@ -69,6 +69,9 @@ import useComplexEditor, {
69
69
  import useSearchableDropdown, {
70
70
  ExtendedSearchableDropdownProps,
71
71
  } from './Structure/searchableDropdown/useSearchableDropdown'
72
+ import useAccordion, {
73
+ ExtendedAccordionProps,
74
+ } from './Structure/accordion/useAccordion'
72
75
 
73
76
  /**
74
77
  * Props for the ContentSection component.
@@ -87,6 +90,7 @@ export interface ContentSectionProps {
87
90
  | ExtendedSearchableDropdownProps[]
88
91
  complexeditor?: ExtendedComplexEditorProps | ExtendedComplexEditorProps[]
89
92
  typography?: TypographyProps | TypographyProps[]
93
+ accordion?: ExtendedAccordionProps | ExtendedAccordionProps[]
90
94
  radiogroup?: ExtendedRadioGroupProps | ExtendedRadioGroupProps[]
91
95
  link?: LinkProps | LinkProps[]
92
96
  button?: ExtendedButtonProps | ExtendedButtonProps[]
@@ -152,6 +156,7 @@ const RenderContent: React.FC<
152
156
  addToColumnConfigs(useSearchableDropdown(props))
153
157
  addToColumnConfigs(useTextField(props))
154
158
  addToColumnConfigs(useDateField(props))
159
+ addToColumnConfigs(useAccordion(props))
155
160
  addToColumnConfigs(useCheckbox(props))
156
161
  addToColumnConfigs(usePhoneNumber(props))
157
162
  addToColumnConfigs(useDropdown(props))
@@ -1,6 +1,5 @@
1
1
  'use client'
2
2
  import React, { useState, forwardRef } from 'react'
3
- import { styled } from '@mui/material/styles'
4
3
  import DatePicker from 'react-datepicker'
5
4
  import 'react-datepicker/dist/react-datepicker.css'
6
5
  import CalendarTodayIcon from '@mui/icons-material/CalendarToday'
@@ -9,36 +8,9 @@ import TextField, { TextFieldProps } from '../TextField'
9
8
  export interface DateFieldProps
10
9
  extends Omit<TextFieldProps, 'onChange' | 'value' | 'endAdornment'> {
11
10
  onChange?: (date: Date | null) => void
12
- backgroundcolor?: string
13
- outlinecolor?: string
14
- fontcolor?: string
15
- label?: string
16
11
  value?: Date | null
17
12
  }
18
13
 
19
- const StyledTextField = styled(TextField)<{
20
- backgroundcolor?: string
21
- outlinecolor?: string
22
- fontcolor?: string
23
- }>(({ backgroundcolor, outlinecolor }) => ({
24
- '& .MuiOutlinedInput-root': {
25
- backgroundColor: backgroundcolor,
26
- height: '40px',
27
- '& fieldset': {
28
- borderColor: outlinecolor,
29
- },
30
- '&:hover fieldset': {
31
- borderColor: outlinecolor,
32
- },
33
- '&.Mui-focused fieldset': {
34
- borderColor: outlinecolor,
35
- },
36
- },
37
- '& .MuiInputBase-input': {
38
- padding: '8px 14px',
39
- },
40
- }))
41
-
42
14
  interface CustomInputProps {
43
15
  value?: string
44
16
  onClick?: () => void
@@ -61,9 +33,6 @@ CustomInput.displayName = 'CustomInput'
61
33
 
62
34
  const DateField: React.FC<DateFieldProps> = ({
63
35
  onChange,
64
- backgroundcolor,
65
- outlinecolor,
66
- fontcolor,
67
36
  label = 'Select Date',
68
37
  value,
69
38
  ...rest
@@ -100,10 +69,8 @@ const DateField: React.FC<DateFieldProps> = ({
100
69
  const newValue = e.target.value
101
70
  const selectionStart = input.selectionStart || 0
102
71
 
103
- // Keep the original value
104
72
  setInputValue(newValue)
105
73
 
106
- // Try to parse the date parts
107
74
  const parts = newValue.split('/')
108
75
  if (parts.length === 3) {
109
76
  const month = parseInt(parts[0], 10)
@@ -125,7 +92,6 @@ const DateField: React.FC<DateFieldProps> = ({
125
92
  }
126
93
  }
127
94
 
128
- // Maintain cursor position
129
95
  setTimeout(() => {
130
96
  if (selectionStart <= 2) {
131
97
  input.setSelectionRange(selectionStart, selectionStart)
@@ -173,7 +139,6 @@ const DateField: React.FC<DateFieldProps> = ({
173
139
  onChange(newDate)
174
140
  }
175
141
 
176
- // Maintain cursor position
177
142
  setTimeout(() => {
178
143
  switch (selectedPart) {
179
144
  case 'month':
@@ -224,14 +189,11 @@ const DateField: React.FC<DateFieldProps> = ({
224
189
 
225
190
  return (
226
191
  <>
227
- <StyledTextField
192
+ <TextField
228
193
  label={label}
229
194
  value={inputValue}
230
195
  onChange={handleInputChange}
231
196
  endAdornment={calendarIcon}
232
- backgroundcolor={backgroundcolor}
233
- outlinecolor={outlinecolor}
234
- fontcolor={fontcolor}
235
197
  slotProps={{
236
198
  input: {
237
199
  readOnly: false,
@@ -9,7 +9,6 @@ import {
9
9
  SelectProps,
10
10
  FormHelperText,
11
11
  Box,
12
- CircularProgress,
13
12
  } from '@mui/material'
14
13
  import { styled } from '@mui/material/styles'
15
14
  import { black, white } from '../../styles/palette'
@@ -128,13 +127,6 @@ const StyledMenuItem = styled(MenuItem)(() => ({
128
127
  backgroundColor: white.main,
129
128
  }))
130
129
 
131
- const LoadingContainer = styled(Box)(() => ({
132
- display: 'flex',
133
- justifyContent: 'center',
134
- alignItems: 'center',
135
- height: '50px',
136
- }))
137
-
138
130
  const capitalizeFirstLetter = (string: string) => {
139
131
  return string.charAt(0).toUpperCase() + string.slice(1)
140
132
  }
@@ -199,23 +191,37 @@ const Dropdown: React.FC<DropdownProps> = ({
199
191
  onFocus,
200
192
  ...rest
201
193
  }) => {
202
- const [selectedValue, setSelectedValue] = useState<string>('')
203
- const [isLoading, setIsLoading] = useState(true)
204
- const [hasSelection, setHasSelection] = useState(false)
194
+ // Determine initial selectedValue and hasSelection immediately
195
+ const externalValue = rest.value as string | undefined
196
+ let initialSelected = ''
197
+ let initialHasSelection = false
205
198
 
206
- useEffect(() => {
199
+ if (externalValue !== undefined && externalValue !== '') {
200
+ initialSelected = externalValue
201
+ initialHasSelection = true
202
+ } else if (defaultValue) {
207
203
  const defaultOption = options.find(option => option.value === defaultValue)
208
204
  if (defaultOption) {
209
- setSelectedValue(defaultOption.value)
210
- setHasSelection(true)
205
+ initialSelected = defaultOption.value
206
+ initialHasSelection = true
211
207
  }
212
- setIsLoading(false)
213
- }, [defaultValue, options])
208
+ }
209
+
210
+ const [selectedValue, setSelectedValue] = useState<string>(initialSelected)
211
+ const [hasSelection, setHasSelection] = useState(initialHasSelection)
212
+
213
+ // Add useEffect to handle external value changes
214
+ useEffect(() => {
215
+ if (externalValue !== undefined) {
216
+ setSelectedValue(externalValue)
217
+ setHasSelection(externalValue !== '')
218
+ }
219
+ }, [externalValue])
214
220
 
215
221
  const handleChange: SelectProps['onChange'] = (event, child) => {
216
222
  const newValue = event.target.value as string
217
223
  setSelectedValue(newValue)
218
- setHasSelection(true)
224
+ setHasSelection(newValue !== '')
219
225
  if (onChange) {
220
226
  onChange(event, child)
221
227
  }
@@ -234,17 +240,17 @@ const Dropdown: React.FC<DropdownProps> = ({
234
240
  }
235
241
 
236
242
  const renderMenuItem = (option: DropdownOption) => {
237
- const label = capitalizeFirstLetter(option.value.replace(/_/g, ' '))
243
+ const itemLabel = capitalizeFirstLetter(option.value.replace(/_/g, ' '))
238
244
  if (!('attribute1' in option)) {
239
245
  return (
240
246
  <MenuItem key={option.value} value={option.value}>
241
- <Typography fontvariant="merriparagraph" text={label} />
247
+ <Typography fontvariant="merriparagraph" text={itemLabel} />
242
248
  </MenuItem>
243
249
  )
244
250
  } else {
245
251
  return (
246
252
  <StyledMenuItem key={option.value} value={option.value}>
247
- <Typography fontvariant="merriparagraph" text={label} />
253
+ <Typography fontvariant="merriparagraph" text={itemLabel} />
248
254
  <Typography
249
255
  fontvariant="merriparagraph"
250
256
  text={`${option.attribute1}${option.attribute2 ? ` | ${option.attribute2}` : ''}`}
@@ -255,14 +261,6 @@ const Dropdown: React.FC<DropdownProps> = ({
255
261
  }
256
262
  }
257
263
 
258
- if (isLoading) {
259
- return (
260
- <LoadingContainer>
261
- <CircularProgress size={24} />
262
- </LoadingContainer>
263
- )
264
- }
265
-
266
264
  return (
267
265
  <StyledBox>
268
266
  <StyledFormControl
@@ -278,6 +276,7 @@ const Dropdown: React.FC<DropdownProps> = ({
278
276
  unshrunkfontcolor={unshrunkfontcolor}
279
277
  shrunklabelposition={shrunklabelposition}
280
278
  hasvalue={hasSelection ? 'true' : 'false'}
279
+ shrink={hasSelection || Boolean(selectedValue)}
281
280
  >
282
281
  {label}
283
282
  </StyledInputLabel>
@@ -1,23 +1,54 @@
1
1
  'use client'
2
2
 
3
- import React, { JSX } from 'react'
3
+ import React from 'react'
4
4
  import Grid2, { Grid2Props } from '@mui/material/Grid2'
5
- import { useMediaQuery, useTheme } from '@mui/material'
5
+ import { useMediaQuery } from '@mui/material'
6
6
 
7
7
  type Alignment = 'left' | 'center' | 'right' | 'inherit' | 'justify'
8
8
  type BorderProp = 'none' | 'solid'
9
9
  type WrapProp = 'nowrap' | 'wrap'
10
+ type Breakpoint = 'xs' | 'sm' | 'md' | 'ms' | 'ml' | 'lg' | 'xl'
11
+
12
+ interface ResponsiveObject<T> {
13
+ xs?: T
14
+ sm?: T
15
+ md?: T
16
+ ms?: T
17
+ ml?: T
18
+ lg?: T
19
+ xl?: T
20
+ }
21
+
22
+ type ResponsiveValue<T> = T | ResponsiveObject<T>
23
+
24
+ type cellconfig = {
25
+ border?: BorderProp
26
+ minHeight?: string
27
+ maxHeight?: string
28
+ width?: string
29
+ mobilewidth?: string
30
+ tabletwidth?: string
31
+ computerwidth?: string
32
+ borderColor?: string
33
+ backgroundColor?: string
34
+ onClick?: () => void
35
+ wrap?: WrapProp
36
+ }
10
37
 
11
38
  type columnconfig = {
12
39
  row: number
13
40
  column: number
14
41
  gridname?: string
15
42
  alignment?: Alignment
16
- margintop?: number
43
+ margintop?: ResponsiveValue<number>
44
+ marginbottom?: ResponsiveValue<number>
45
+ marginright?: ResponsiveValue<number>
46
+ marginleft?: ResponsiveValue<number>
47
+ paddingtop?: ResponsiveValue<number>
48
+ paddingbottom?: ResponsiveValue<number>
49
+ paddingright?: ResponsiveValue<number>
50
+ paddingleft?: ResponsiveValue<number>
17
51
  columnwidth?: string
18
- marginbottom?: number
19
- marginright?: number
20
- marginleft?: number
21
52
  component?: React.ReactNode
22
53
  bordercolor?: string
23
54
  cellconfig?: cellconfig
@@ -29,40 +60,74 @@ type columnconfig = {
29
60
  type gridconfig = {
30
61
  gridname?: string
31
62
  alignment?: Alignment
32
- margintop?: number
33
- marginbottom?: number
34
- marginright?: number
35
- marginleft?: number
63
+ margintop?: ResponsiveValue<number>
64
+ marginbottom?: ResponsiveValue<number>
65
+ marginright?: ResponsiveValue<number>
66
+ marginleft?: ResponsiveValue<number>
67
+ paddingtop?: ResponsiveValue<number>
68
+ paddingbottom?: ResponsiveValue<number>
69
+ paddingright?: ResponsiveValue<number>
70
+ paddingleft?: ResponsiveValue<number>
36
71
  gridwidth?: string
37
72
  bordercolor?: string
38
73
  }
39
74
 
40
- type cellconfig = {
41
- border?: BorderProp
42
- minHeight?: string
43
- maxHeight?: string
44
- width?: string
45
- mobilewidth?: string
46
- tabletwidth?: string
47
- computerwidth?: string
48
- borderColor?: string
49
- backgroundColor?: string
50
- onClick?: () => void
51
- wrap?: WrapProp
52
- }
53
-
54
75
  type CustomGridProps = Omit<Grid2Props, 'children'> & {
55
76
  gridconfig?: gridconfig
56
77
  columnconfig?: columnconfig[]
57
78
  cellconfig?: cellconfig
58
79
  }
59
80
 
81
+ function isResponsiveObject<T>(
82
+ value: ResponsiveValue<T> | undefined
83
+ ): value is ResponsiveObject<T> {
84
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
85
+ }
86
+
87
+ function getResponsiveValue<T>(
88
+ value: ResponsiveValue<T> | undefined,
89
+ breakpoint: Breakpoint
90
+ ): T | undefined {
91
+ if (value === undefined) return undefined
92
+ if (isResponsiveObject(value)) {
93
+ return value[breakpoint]
94
+ }
95
+ return value
96
+ }
97
+
60
98
  function CustomGrid({
61
99
  gridconfig,
62
100
  columnconfig,
63
101
  cellconfig,
64
102
  ...rest
65
- }: CustomGridProps): JSX.Element {
103
+ }: CustomGridProps) {
104
+ // Manually define media queries for breakpoints
105
+ const isMobile = useMediaQuery('(max-width:600px)') // xs
106
+ const isSmallTablet = useMediaQuery('(min-width:601px) and (max-width:900px)') // sm
107
+ const isMediumSmall = useMediaQuery('(min-width:901px) and (max-width:960px)') // md
108
+ const isMediumLarge = useMediaQuery(
109
+ '(min-width:961px) and (max-width:1024px)'
110
+ ) // ms
111
+ const isLarge = useMediaQuery('(min-width:1025px) and (max-width:1170px)') // ml
112
+ const isExtraLarge = useMediaQuery('(min-width:1537px)') // xl
113
+
114
+ const currentBreakpoint = React.useMemo((): Breakpoint => {
115
+ if (isMobile) return 'xs'
116
+ if (isSmallTablet) return 'sm'
117
+ if (isMediumSmall) return 'md'
118
+ if (isMediumLarge) return 'ms'
119
+ if (isLarge) return 'ml'
120
+ if (isExtraLarge) return 'xl'
121
+ return 'lg'
122
+ }, [
123
+ isMobile,
124
+ isSmallTablet,
125
+ isMediumSmall,
126
+ isMediumLarge,
127
+ isLarge,
128
+ isExtraLarge,
129
+ ])
130
+
66
131
  const gridConfigValues = Array.isArray(gridconfig)
67
132
  ? gridconfig[0]
68
133
  : gridconfig
@@ -74,10 +139,40 @@ function CustomGrid({
74
139
  ? 'flex-end'
75
140
  : 'center'
76
141
 
77
- const theme = useTheme()
78
- const isMobile = useMediaQuery(theme.breakpoints.between(0, 767))
79
- const isTablet = useMediaQuery(theme.breakpoints.between(768, 1023))
80
- const isComputer = useMediaQuery(theme.breakpoints.up(1024))
142
+ // Get responsive margin and padding values for the overall grid
143
+ const gridMarginTop = getResponsiveValue(
144
+ gridConfigValues?.margintop,
145
+ currentBreakpoint
146
+ )
147
+ const gridMarginBottom = getResponsiveValue(
148
+ gridConfigValues?.marginbottom,
149
+ currentBreakpoint
150
+ )
151
+ const gridMarginLeft = getResponsiveValue(
152
+ gridConfigValues?.marginleft,
153
+ currentBreakpoint
154
+ )
155
+ const gridMarginRight = getResponsiveValue(
156
+ gridConfigValues?.marginright,
157
+ currentBreakpoint
158
+ )
159
+
160
+ const gridPaddingTop = getResponsiveValue(
161
+ gridConfigValues?.paddingtop,
162
+ currentBreakpoint
163
+ )
164
+ const gridPaddingBottom = getResponsiveValue(
165
+ gridConfigValues?.paddingbottom,
166
+ currentBreakpoint
167
+ )
168
+ const gridPaddingLeft = getResponsiveValue(
169
+ gridConfigValues?.paddingleft,
170
+ currentBreakpoint
171
+ )
172
+ const gridPaddingRight = getResponsiveValue(
173
+ gridConfigValues?.paddingright,
174
+ currentBreakpoint
175
+ )
81
176
 
82
177
  const rows = Math.max(...(columnconfig || []).map(c => c.row || 1))
83
178
 
@@ -93,7 +188,17 @@ function CustomGrid({
93
188
  padding: 0,
94
189
  margin: 0,
95
190
  gap: 0,
96
- '& > *': {
191
+ // Apply grid-level margins and paddings
192
+ marginTop: gridMarginTop ? `${gridMarginTop * 8}px` : 0,
193
+ marginBottom: gridMarginBottom ? `${gridMarginBottom * 8}px` : 0,
194
+ marginLeft: gridMarginLeft ? `${gridMarginLeft * 8}px` : 0,
195
+ marginRight: gridMarginRight ? `${gridMarginRight * 8}px` : 0,
196
+ paddingTop: gridPaddingTop ? `${gridPaddingTop * 8}px` : 0,
197
+ paddingBottom: gridPaddingBottom ? `${gridPaddingBottom * 8}px` : 0,
198
+ paddingLeft: gridPaddingLeft ? `${gridPaddingLeft * 8}px` : 0,
199
+ paddingRight: gridPaddingRight ? `${gridPaddingRight * 8}px` : 0,
200
+ // Remove or adjust the child selector that sets margin:0
201
+ '& > *:not(.grid-column)': {
97
202
  border: 'none !important',
98
203
  padding: 0,
99
204
  margin: 0,
@@ -147,15 +252,13 @@ function CustomGrid({
147
252
  ? currentColumnConfig?.mobilewidth ||
148
253
  currentColumnConfig?.columnwidth ||
149
254
  `${100 / columns}%`
150
- : isTablet
255
+ : isSmallTablet
151
256
  ? currentColumnConfig?.tabletwidth ||
152
257
  currentColumnConfig?.columnwidth ||
153
258
  `${100 / columns}%`
154
- : isComputer
155
- ? currentColumnConfig?.computerwidth ||
156
- currentColumnConfig?.columnwidth ||
157
- `${100 / columns}%`
158
- : currentColumnConfig?.columnwidth || `${100 / columns}%`
259
+ : currentColumnConfig?.computerwidth ||
260
+ currentColumnConfig?.columnwidth ||
261
+ `${100 / columns}%`
159
262
 
160
263
  const justifyContent =
161
264
  currentColumnConfig?.alignment === 'left'
@@ -164,9 +267,45 @@ function CustomGrid({
164
267
  ? 'flex-end'
165
268
  : 'center'
166
269
 
270
+ // Get responsive margin and padding values for the column
271
+ const marginTop = getResponsiveValue(
272
+ currentColumnConfig?.margintop,
273
+ currentBreakpoint
274
+ )
275
+ const marginBottom = getResponsiveValue(
276
+ currentColumnConfig?.marginbottom,
277
+ currentBreakpoint
278
+ )
279
+ const marginLeft = getResponsiveValue(
280
+ currentColumnConfig?.marginleft,
281
+ currentBreakpoint
282
+ )
283
+ const marginRight = getResponsiveValue(
284
+ currentColumnConfig?.marginright,
285
+ currentBreakpoint
286
+ )
287
+
288
+ const paddingTop = getResponsiveValue(
289
+ currentColumnConfig?.paddingtop,
290
+ currentBreakpoint
291
+ )
292
+ const paddingBottom = getResponsiveValue(
293
+ currentColumnConfig?.paddingbottom,
294
+ currentBreakpoint
295
+ )
296
+ const paddingLeft = getResponsiveValue(
297
+ currentColumnConfig?.paddingleft,
298
+ currentBreakpoint
299
+ )
300
+ const paddingRight = getResponsiveValue(
301
+ currentColumnConfig?.paddingright,
302
+ currentBreakpoint
303
+ )
304
+
167
305
  return (
168
306
  <Grid2
169
307
  key={`column-${columnIndex}`}
308
+ className="grid-column"
170
309
  sx={{
171
310
  display: 'flex',
172
311
  justifyContent,
@@ -177,19 +316,35 @@ function CustomGrid({
177
316
  flexShrink: hasFixedWidth ? 0 : 1,
178
317
  flexBasis: hasFixedWidth ? columnWidth : 'auto',
179
318
  height: 'fit-content',
180
- padding: 0,
181
- marginLeft: currentColumnConfig?.marginleft
182
- ? `${currentColumnConfig.marginleft * 8}px`
183
- : 0,
184
- marginRight: currentColumnConfig?.marginright
185
- ? `${currentColumnConfig.marginright * 8}px`
186
- : 0,
187
- marginTop: currentColumnConfig?.margintop
188
- ? `${currentColumnConfig.margintop * 8}px`
189
- : 0,
190
- marginBottom: currentColumnConfig?.marginbottom
191
- ? `${currentColumnConfig.marginbottom * 8}px`
192
- : 0,
319
+
320
+ // Apply margin
321
+ marginLeft: marginLeft
322
+ ? `${marginLeft * 8}px !important`
323
+ : '0 !important',
324
+ marginRight: marginRight
325
+ ? `${marginRight * 8}px !important`
326
+ : '0 !important',
327
+ marginTop: marginTop
328
+ ? `${marginTop * 8}px !important`
329
+ : '0 !important',
330
+ marginBottom: marginBottom
331
+ ? `${marginBottom * 8}px !important`
332
+ : '0 !important',
333
+
334
+ // Apply padding
335
+ paddingLeft: paddingLeft
336
+ ? `${paddingLeft * 8}px !important`
337
+ : '0 !important',
338
+ paddingRight: paddingRight
339
+ ? `${paddingRight * 8}px !important`
340
+ : '0 !important',
341
+ paddingTop: paddingTop
342
+ ? `${paddingTop * 8}px !important`
343
+ : '0 !important',
344
+ paddingBottom: paddingBottom
345
+ ? `${paddingBottom * 8}px !important`
346
+ : '0 !important',
347
+
193
348
  border: 'none',
194
349
  backgroundColor: currentCellConfig?.backgroundColor,
195
350
  minHeight: 'min-content',
@@ -204,9 +359,7 @@ function CustomGrid({
204
359
  }}
205
360
  onClick={currentCellConfig?.onClick}
206
361
  >
207
- {React.isValidElement(currentColumnConfig?.component)
208
- ? currentColumnConfig?.component
209
- : null}
362
+ {currentColumnConfig?.component as React.ReactNode}
210
363
  </Grid2>
211
364
  )
212
365
  })}