goobs-frontend 0.8.24 → 0.8.25

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.8.24",
3
+ "version": "0.8.25",
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",
@@ -1,7 +1,8 @@
1
+ // src\components\Card\index.tsx
1
2
  'use client'
2
3
 
3
- import React, { JSX } from 'react'
4
- import { BoxProps } from '@mui/material'
4
+ import React from 'react'
5
+ import { Box, BoxProps } from '@mui/material'
5
6
  import { CustomStepperProps } from '../Stepper'
6
7
  import InventoryCard from './variants/inventory'
7
8
  import SimplePricingSummary from './variants/simplepricingsummary'
@@ -9,18 +10,24 @@ import DetailedPricingSummary from './variants/detailedpricingsummary'
9
10
  import ProductCard from './variants/product'
10
11
  import ProductSummaryCard from './variants/productsummary'
11
12
  import DefaultCard from './variants/defaultconfig'
12
- import TaskCard from './variants/task' // <-- NEW
13
+ import TaskCard from './variants/task'
13
14
  import { columnconfig } from '../Grid'
14
15
  import { CustomButtonProps } from '../Button'
15
16
 
16
17
  /**
17
- * We omit children, draggable, and the drag event props from BoxProps,
18
- * to avoid conflicts with our custom "draggable" and "onDragX" logic
19
- * for the task variant.
18
+ * We omit children, draggable, and drag event props from BoxProps,
19
+ * to avoid type conflicts with MUI. We also omit `color`/`border`
20
+ * so they don’t conflict with PaperProps in <TaskCard>.
20
21
  */
21
22
  type CardProps = Omit<
22
23
  BoxProps,
23
- 'children' | 'draggable' | 'onDragStart' | 'onDragOver' | 'onDrop'
24
+ | 'children'
25
+ | 'draggable'
26
+ | 'onDragStart'
27
+ | 'onDragOver'
28
+ | 'onDrop'
29
+ | 'color'
30
+ | 'border'
24
31
  > & {
25
32
  /** Title of the card */
26
33
  title?: string
@@ -48,8 +55,18 @@ type CardProps = Omit<
48
55
  breadcrumbEnabled?: boolean
49
56
  /** Whether to enable links */
50
57
  linkEnabled?: boolean
51
- /** Width of the card */
52
- width?: string
58
+ /**
59
+ * Width of the card. Can be a string/number or MUI responsive object, e.g.:
60
+ * width={{
61
+ * xs: 250,
62
+ * sm: 300,
63
+ * md: 400
64
+ * }}
65
+ */
66
+ width?:
67
+ | string
68
+ | number
69
+ | Partial<Record<'xs' | 'sm' | 'md' | 'lg' | 'xl', string | number>>
53
70
  /** Height of the card */
54
71
  height?: string | number
55
72
  /** Whether to show a stepper */
@@ -66,7 +83,7 @@ type CardProps = Omit<
66
83
  | 'detailedpricingsummary'
67
84
  | 'product'
68
85
  | 'productsummary'
69
- | 'task' // <-- NEW
86
+ | 'task'
70
87
  /** Props for the pricing summary variant */
71
88
  pricingSummaryProps?: {
72
89
  subtotal?: string
@@ -142,7 +159,6 @@ type CardProps = Omit<
142
159
  /**
143
160
  * Optional drag & drop props if you want the card itself
144
161
  * to handle drag events.
145
- * Must be booleans or DragEventHandlers, not strings like "true".
146
162
  */
147
163
  draggable?: boolean
148
164
  onDragStart?: React.DragEventHandler<HTMLDivElement>
@@ -180,109 +196,134 @@ function Card({
180
196
  productSummaryProps,
181
197
  taskProps,
182
198
  ...rest
183
- }: CardProps): JSX.Element | null {
199
+ }: CardProps): React.ReactNode | null {
200
+ // --------------------------
201
+ // 1. "DEFAULT" VARIANT
202
+ // --------------------------
184
203
  if (variant === 'default') {
185
204
  return (
186
- <DefaultCard
187
- title={title}
188
- titleUnderline={titleUnderline}
189
- body={body}
190
- image={image}
191
- imagePosition={imagePosition}
192
- parentText={parentText}
193
- parentLink={parentLink}
194
- childText={childText}
195
- childLink={childLink}
196
- grandchildLink={grandchildLink}
197
- favoriteEnabled={favoriteEnabled}
198
- breadcrumbEnabled={breadcrumbEnabled}
199
- linkEnabled={linkEnabled}
200
- width={width}
201
- height={height}
202
- stepperEnabled={stepperEnabled}
203
- stepperActiveStep={stepperActiveStep}
204
- stepperSteps={stepperSteps}
205
- {...rest}
206
- />
205
+ <Box sx={{ width, height }} {...rest}>
206
+ <DefaultCard
207
+ title={title}
208
+ titleUnderline={titleUnderline}
209
+ body={body}
210
+ image={image}
211
+ imagePosition={imagePosition}
212
+ parentText={parentText}
213
+ parentLink={parentLink}
214
+ childText={childText}
215
+ childLink={childLink}
216
+ grandchildLink={grandchildLink}
217
+ favoriteEnabled={favoriteEnabled}
218
+ breadcrumbEnabled={breadcrumbEnabled}
219
+ linkEnabled={linkEnabled}
220
+ height={height}
221
+ stepperEnabled={stepperEnabled}
222
+ stepperActiveStep={stepperActiveStep}
223
+ stepperSteps={stepperSteps}
224
+ />
225
+ </Box>
207
226
  )
208
227
  }
209
228
 
229
+ // --------------------------
230
+ // 2. "INVENTORY" VARIANT
231
+ // --------------------------
210
232
  if (variant === 'inventory') {
211
233
  return (
212
- <InventoryCard
213
- title={title}
214
- image={image}
215
- width={width}
216
- height={height}
217
- {...inventoryProps}
218
- {...rest}
219
- />
234
+ <Box sx={{ width, height }} {...rest}>
235
+ <InventoryCard
236
+ title={title}
237
+ image={image}
238
+ height={height}
239
+ {...inventoryProps}
240
+ />
241
+ </Box>
220
242
  )
221
243
  }
222
244
 
245
+ // --------------------------
246
+ // 3. "PRICINGSUMMARY" VARIANT
247
+ // --------------------------
223
248
  if (variant === 'pricingsummary') {
224
249
  return (
225
- <SimplePricingSummary
226
- width={width}
227
- height={height}
228
- {...pricingSummaryProps}
229
- {...rest}
230
- />
250
+ <Box sx={{ width, height }} {...rest}>
251
+ <SimplePricingSummary height={height} {...pricingSummaryProps} />
252
+ </Box>
231
253
  )
232
254
  }
233
255
 
256
+ // --------------------------
257
+ // 4. "DETAILEDPRICINGSUMMARY" VARIANT
258
+ // --------------------------
234
259
  if (variant === 'detailedpricingsummary') {
235
260
  return (
236
- <DetailedPricingSummary
237
- width={width}
238
- height={height}
239
- {...detailedPricingSummaryProps}
240
- {...rest}
241
- />
261
+ <Box sx={{ width, height }} {...rest}>
262
+ <DetailedPricingSummary
263
+ height={height}
264
+ {...detailedPricingSummaryProps}
265
+ />
266
+ </Box>
242
267
  )
243
268
  }
244
269
 
270
+ // --------------------------
271
+ // 5. "PRODUCT" VARIANT
272
+ // --------------------------
245
273
  if (variant === 'product') {
246
274
  return (
247
- <ProductCard width={width} height={height} {...productProps} {...rest} />
275
+ <Box sx={{ width, height }} {...rest}>
276
+ <ProductCard height={height} {...productProps} />
277
+ </Box>
248
278
  )
249
279
  }
250
280
 
281
+ // --------------------------
282
+ // 6. "PRODUCTSUMMARY" VARIANT
283
+ // --------------------------
251
284
  if (variant === 'productsummary') {
252
285
  return (
253
- <ProductSummaryCard
254
- title={title}
255
- body={body}
256
- annualPrice={productSummaryProps?.annualPrice}
257
- monthlyPrice={productSummaryProps?.monthlyPrice}
258
- width={width}
259
- height={height}
260
- button1Props={productSummaryProps?.button1Props}
261
- button2Props={productSummaryProps?.button2Props}
262
- {...rest}
263
- />
286
+ <Box sx={{ width, height }} {...rest}>
287
+ <ProductSummaryCard
288
+ title={title}
289
+ body={body}
290
+ annualPrice={productSummaryProps?.annualPrice}
291
+ monthlyPrice={productSummaryProps?.monthlyPrice}
292
+ height={height}
293
+ button1Props={productSummaryProps?.button1Props}
294
+ button2Props={productSummaryProps?.button2Props}
295
+ />
296
+ </Box>
264
297
  )
265
298
  }
266
299
 
267
- // NEW: Return our "task" variant
300
+ // --------------------------
301
+ // 7. "TASK" VARIANT
302
+ // --------------------------
268
303
  if (variant === 'task') {
304
+ // We handle drag & drop on this outer Box, plus the width/height here
269
305
  return (
270
- <TaskCard
271
- title={taskProps?.title}
272
- description={taskProps?.description}
273
- checked={taskProps?.checked}
274
- onCheck={taskProps?.onCheck}
306
+ <Box
275
307
  draggable={taskProps?.draggable}
276
308
  onDragStart={taskProps?.onDragStart}
277
309
  onDragOver={taskProps?.onDragOver}
278
310
  onDrop={taskProps?.onDrop}
279
- width={width}
280
- height={height}
311
+ sx={{ width, height }}
281
312
  {...rest}
282
- />
313
+ >
314
+ <TaskCard
315
+ title={taskProps?.title}
316
+ description={taskProps?.description}
317
+ checked={taskProps?.checked}
318
+ onCheck={taskProps?.onCheck}
319
+ />
320
+ </Box>
283
321
  )
284
322
  }
285
323
 
324
+ // --------------------------
325
+ // FALLBACK: NO MATCH
326
+ // --------------------------
286
327
  return null
287
328
  }
288
329
 
@@ -44,7 +44,6 @@ interface DefaultCardProps extends BoxProps {
44
44
  /** Whether to enable links */
45
45
  linkEnabled?: boolean
46
46
  /** Width of the card */
47
- width?: string
48
47
  /** Height of the card */
49
48
  height?: string | number
50
49
  /** Whether to show a stepper */
@@ -34,7 +34,6 @@ interface DetailedPricingSummaryProps {
34
34
  * It displays product details, vendor information, subtotal, VAT, total, and a proceed button.
35
35
  */
36
36
  const DetailedPricingSummary: React.FC<DetailedPricingSummaryProps> = ({
37
- width = '100%',
38
37
  height,
39
38
  product = 'Goobs Repo Unlimited × 1',
40
39
  vendor = 'Technologies Unlimited',
@@ -55,7 +54,6 @@ const DetailedPricingSummary: React.FC<DetailedPricingSummaryProps> = ({
55
54
  justifyContent: 'flex-start',
56
55
  alignItems: 'stretch',
57
56
  border: '1px solid #e8e8e8',
58
- width: width,
59
57
  minHeight: height,
60
58
  padding: '16px',
61
59
  }}
@@ -11,9 +11,6 @@ interface InventoryCardProps {
11
11
  title?: string
12
12
  /** URL or path of the image to display */
13
13
  image?: string
14
- /** Width of the inventory card */
15
- width?: string
16
- /** Height of the inventory card */
17
14
  height?: string | number
18
15
  /** License information for the item */
19
16
  license?: string
@@ -38,7 +35,6 @@ interface InventoryCardProps {
38
35
  const InventoryCard: React.FC<InventoryCardProps> = ({
39
36
  title,
40
37
  image,
41
- width,
42
38
  height,
43
39
  license,
44
40
  developmentUse,
@@ -58,7 +54,6 @@ const InventoryCard: React.FC<InventoryCardProps> = ({
58
54
  justifyContent: 'flex-start',
59
55
  alignItems: 'stretch',
60
56
  border: '1px solid #e8e8e8',
61
- width: width,
62
57
  minHeight: height,
63
58
  }}
64
59
  >
@@ -30,7 +30,6 @@ const ProductSummaryCard: React.FC<ProductSummaryCardProps> = ({
30
30
  body,
31
31
  annualPrice,
32
32
  monthlyPrice,
33
- width,
34
33
  height,
35
34
  button1Props,
36
35
  button2Props,
@@ -56,7 +55,6 @@ const ProductSummaryCard: React.FC<ProductSummaryCardProps> = ({
56
55
  justifyContent: 'flex-start',
57
56
  alignItems: 'stretch',
58
57
  border: '1px solid #e8e8e8',
59
- width: width,
60
58
  height: height,
61
59
  ...rest.sx,
62
60
  }}
@@ -7,8 +7,6 @@ import CustomButton from '../../../../components/Button'
7
7
  * Props for the SimplePricingSummary component.
8
8
  */
9
9
  interface SimplePricingSummaryProps {
10
- /** Width of the pricing summary card */
11
- width?: string
12
10
  /** Height of the pricing summary card */
13
11
  height?: string | number
14
12
  /** Subtotal amount */
@@ -30,7 +28,6 @@ interface SimplePricingSummaryProps {
30
28
  * including subtotal, total, proceed button, and additional information about taxes and discounts.
31
29
  */
32
30
  const SimplePricingSummary: React.FC<SimplePricingSummaryProps> = ({
33
- width = '100%',
34
31
  height,
35
32
  subtotal = 'USD 180.00',
36
33
  total = 'USD 180.00',
@@ -49,7 +46,6 @@ const SimplePricingSummary: React.FC<SimplePricingSummaryProps> = ({
49
46
  justifyContent: 'flex-start',
50
47
  alignItems: 'stretch',
51
48
  border: '1px solid #e8e8e8',
52
- width: width,
53
49
  minHeight: height,
54
50
  padding: '16px',
55
51
  }}
@@ -1,24 +1,22 @@
1
+ // src\components\Card\variants\task\index.tsx
1
2
  'use client'
2
3
 
3
4
  import React from 'react'
4
- import { Paper, Box, Checkbox } from '@mui/material'
5
+ import { Paper, Box, Checkbox, PaperProps } from '@mui/material'
5
6
  import Typography from '../../../../components/Typography'
6
7
 
7
- interface TaskCardProps {
8
+ /**
9
+ * A simpler definition: we extend PaperProps directly
10
+ * but REMOVE all drag-related props.
11
+ */
12
+ interface TaskCardProps extends PaperProps {
8
13
  title?: string
9
14
  description?: string
10
15
  /** Whether the card is currently checked/selected. */
11
16
  checked?: boolean
12
17
  /** Called when the user toggles the checkbox. */
13
18
  onCheck?: (event: React.ChangeEvent<HTMLInputElement>) => void
14
- /** Whether this card is “draggable.” Typically true only if `checked` is true. */
15
- draggable?: boolean
16
- /** Drag event handlers from your board logic. */
17
- onDragStart?: (e: React.DragEvent<HTMLDivElement>) => void
18
- onDragOver?: (e: React.DragEvent<HTMLDivElement>) => void
19
- onDrop?: (e: React.DragEvent<HTMLDivElement>) => void
20
19
 
21
- width?: string
22
20
  height?: string | number
23
21
  }
24
22
 
@@ -27,35 +25,28 @@ const TaskCard: React.FC<TaskCardProps> = ({
27
25
  description = 'Description',
28
26
  checked = false,
29
27
  onCheck,
30
- draggable = false, // default to not draggable
31
- onDragStart,
32
- onDragOver,
33
- onDrop,
34
- width = '100%',
35
28
  height = 'auto',
29
+ sx,
30
+ ...rest
36
31
  }) => {
37
32
  return (
38
33
  <Paper
39
34
  elevation={1}
40
- /*
41
- Make the entire Paper draggable if the parent says so
42
- (based on whether it’s selected).
43
- */
44
- draggable={draggable}
45
- onDragStart={onDragStart}
46
- onDragOver={onDragOver}
47
- onDrop={onDrop}
48
35
  sx={{
49
36
  position: 'relative',
50
37
  display: 'flex',
51
38
  flexDirection: 'column',
52
39
  justifyContent: 'flex-start',
53
40
  alignItems: 'flex-start',
54
- width,
55
- height,
41
+
42
+ // Default width/height (can be overridden by sx)
43
+ ...(height && { height }),
44
+
56
45
  p: 2,
57
46
  border: '1px solid #e8e8e8',
47
+ ...sx,
58
48
  }}
49
+ {...rest}
59
50
  >
60
51
  {/* A checkbox in the upper-right corner */}
61
52
  <Checkbox
@@ -0,0 +1,99 @@
1
+ 'use client'
2
+
3
+ import React, { useMemo } from 'react'
4
+ import { Dialog, Box } from '@mui/material'
5
+ import ContentSection, { ContentSectionProps } from '../../Content'
6
+ import { formContainerStyle } from '../../../styles/Form'
7
+ import { ExtendedTypographyProps } from '../../Content/Structure/typography/useGridTypography'
8
+
9
+ export interface DialogFormProps {
10
+ title?: string
11
+ description?: string
12
+ grids?: ContentSectionProps['grids']
13
+ content?: React.ReactNode
14
+ width?: number
15
+ }
16
+
17
+ function CustomDialog({
18
+ title,
19
+ description,
20
+ grids,
21
+ content,
22
+ width = 450,
23
+ }: DialogFormProps) {
24
+ // We render this dialog as always open (embedded in pages).
25
+
26
+ const headerGrid = useMemo(
27
+ (): ContentSectionProps['grids'][0] => ({
28
+ grid: {
29
+ gridconfig: {
30
+ gridname: 'formHeader',
31
+ marginbottom: 0.5,
32
+ gridwidth: '100%',
33
+ },
34
+ },
35
+ typography: [
36
+ {
37
+ text: title,
38
+ fontvariant: 'merrih5',
39
+ fontcolor: 'black',
40
+ columnconfig: {
41
+ row: 1,
42
+ column: 1,
43
+ gridname: 'formHeader',
44
+ columnwidth: '100%',
45
+ alignment: 'left',
46
+ marginbottom: 1.5,
47
+ },
48
+ },
49
+ {
50
+ text: description,
51
+ fontvariant: 'merriparagraph',
52
+ fontcolor: 'black',
53
+ columnconfig: {
54
+ row: 2,
55
+ column: 1,
56
+ alignment: 'left',
57
+ gridname: 'formHeader',
58
+ columnwidth: '100%',
59
+ },
60
+ },
61
+ ] as ExtendedTypographyProps[],
62
+ }),
63
+ [title, description]
64
+ )
65
+
66
+ const renderHeader = useMemo(
67
+ () => <ContentSection grids={[headerGrid]} />,
68
+ [headerGrid]
69
+ )
70
+
71
+ const renderContent = useMemo(
72
+ () => (
73
+ <Box sx={formContainerStyle}>
74
+ <Box mb={0}>{renderHeader}</Box>
75
+ {content || (grids && <ContentSection grids={grids} />)}
76
+ </Box>
77
+ ),
78
+ [renderHeader, content, grids]
79
+ )
80
+
81
+ return (
82
+ <Dialog
83
+ open
84
+ // No close icon, no user-initiated closing from outside or ESC
85
+ onClose={() => {}}
86
+ fullWidth
87
+ maxWidth={false}
88
+ PaperProps={{
89
+ style: {
90
+ width: `${width}px`,
91
+ },
92
+ }}
93
+ >
94
+ {renderContent}
95
+ </Dialog>
96
+ )
97
+ }
98
+
99
+ export default CustomDialog