goobs-frontend 0.7.70 → 0.8.0

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/README.md CHANGED
@@ -6,10 +6,6 @@ The NPM repo is available here - https://www.npmjs.com/package/goobs-frontend
6
6
 
7
7
  This entire repository is written in TypeScript, and there is no need for a separate types installation.
8
8
 
9
- ## Version
10
-
11
- This is a beta release of the tools. It is available via npm to ensure functionality is as expected. We will iron out any kinks and expect version v1 to be production-ready for all components, while some components are already production-ready. Installation is confirmed working with the install instructions below.
12
-
13
9
  ## Integrating goobs-frontend with Next.js
14
10
 
15
11
  This guide explains how to integrate the goobs-frontend package with a Next.js project.
@@ -50,90 +46,175 @@ You can see more information on how we got here and how it was incorrectly done
50
46
 
51
47
  **Step 3: Implement into project and build to confirm functionality**
52
48
 
53
- All components should be successfully building as of this release and are being used within production in one way or another. The props may not all work exactly as expected, but as we go through and find a way to document each of the components further, we will determine what needs to be removed or implemented now or in future versions.
49
+ All components should be successfully building as of this release and are being used within production in one way or another.
54
50
 
55
- This README update, along with the following documentation updates, are all part of a push to better document the usage of this project. It is a hard requirement to move from .7-beta of this product to .8-beta as we are getting ready for release and establishing a product version release methodology.
51
+ This README update, along with the following documentation updates, are all part of a push to better document the usage of this project.
56
52
 
57
53
  ## Components
58
54
 
59
- The following components are available within goobs-frontend:
55
+ The following components are available within goobs-frontend. Each component has a dedicated wiki page with detailed documentation, usage examples, and best practices.
60
56
 
61
57
  ### Accordion
62
58
 
63
59
  The Accordion component provides an expandable panel for organizing and presenting content in a collapsible manner.
64
60
 
61
+ [Accordion Wiki](https://github.com/goobz22/goobs-frontend/wiki/Accordion)
62
+
65
63
  ### Button
66
64
 
67
65
  The Button component is a customizable button with support for icons, variants, and styling props. It provides a flexible and reusable way to create buttons in your application.
68
66
 
67
+ [Button Wiki](https://github.com/goobz22/goobs-frontend/wiki/Button)
68
+
69
69
  ### Card
70
70
 
71
- The Card component offers various card layouts for displaying content, including product cards, pricing cards, and more.
71
+ The Card component offers various card layouts for displaying content, including product cards, pricing cards, and more. It supports different variants such as default, inventory, pricing summary, detailed pricing summary, product, and product summary.
72
+
73
+ [Card Wiki](https://github.com/goobz22/goobs-frontend/wiki/Card)
72
74
 
73
75
  ### CodeCopy
74
76
 
75
77
  The CodeCopy component renders a code block with syntax highlighting and a copy-to-clipboard functionality.
76
78
 
79
+ [CodeCopy Wiki](https://github.com/goobz22/goobs-frontend/wiki/CodeCopy)
80
+
77
81
  ### ConfirmationCodeInput
78
82
 
79
83
  The ConfirmationCodeInput component provides an input field for entering confirmation codes, often used in two-factor authentication scenarios.
80
84
 
85
+ [ConfirmationCodeInput Wiki](https://github.com/goobz22/goobs-frontend/wiki/ConfirmationCodeInput)
86
+
81
87
  ### Content
82
88
 
83
- The Content component is a flexible container for rendering various types of content within your application.
89
+ The Content component is a flexible container for rendering various types of content within your application. It supports different content types including typography, radio groups, confirmation code inputs, links, buttons, images, pricing tables, steppers, transfer lists, cards, code copy blocks, text fields, date fields, dropdowns, increment number fields, searchbars, number fields, password fields, and QR codes.
90
+
91
+ [Content Wiki](https://github.com/goobz22/goobs-frontend/wiki/Content)
92
+
93
+ ### DateField
94
+
95
+ The DateField component provides a date picker input field with customizable styling options.
96
+
97
+ [DateField Wiki](https://github.com/goobz22/goobs-frontend/wiki/DateField)
98
+
99
+ ### Dropdown
84
100
 
85
- ### Form
101
+ The Dropdown component offers a customizable select input with various styling options.
86
102
 
87
- The Form component includes the PopupForm subcomponent, which renders a customizable popup form.
103
+ [Dropdown Wiki](https://github.com/goobz22/goobs-frontend/wiki/Dropdown)
88
104
 
89
105
  ### Grid
90
106
 
91
107
  The Grid component is a highly customizable and flexible grid system built with React and Material-UI. It allows you to create complex grid layouts with ease, providing a wide range of configuration options for grids, rows, columns, and cells.
92
108
 
109
+ [Grid Wiki](https://github.com/goobz22/goobs-frontend/wiki/Grid)
110
+
111
+ ### IncrementNumberField
112
+
113
+ The IncrementNumberField component provides an input field for numeric values with increment and decrement buttons.
114
+
115
+ [IncrementNumberField Wiki](https://github.com/goobz22/goobs-frontend/wiki/IncrementNumberField)
116
+
93
117
  ### Nav
94
118
 
95
119
  The Nav component provides navigation functionality, including both horizontal and vertical navigation options.
96
120
 
121
+ [Nav Wiki](https://github.com/goobz22/goobs-frontend/wiki/Nav)
122
+
123
+ ### NumberField
124
+
125
+ The NumberField component offers an input field specifically designed for numeric input with optional minimum and maximum value constraints.
126
+
127
+ [NumberField Wiki](https://github.com/goobz22/goobs-frontend/wiki/NumberField)
128
+
129
+ ### PasswordField
130
+
131
+ The PasswordField component provides a secure input field for password entry with a show/hide password toggle.
132
+
133
+ [PasswordField Wiki](https://github.com/goobz22/goobs-frontend/wiki/PasswordField)
134
+
135
+ ### PhoneNumberField
136
+
137
+ The PhoneNumberField component offers an input field specifically formatted for phone number entry.
138
+
139
+ [PhoneNumberField Wiki](https://github.com/goobz22/goobs-frontend/wiki/PhoneNumberField)
140
+
97
141
  ### PricingTable
98
142
 
99
143
  The PricingTable component renders a customizable pricing table for displaying product or service pricing information.
100
144
 
145
+ [PricingTable Wiki](https://github.com/goobz22/goobs-frontend/wiki/PricingTable)
146
+
147
+ ### QRCode
148
+
149
+ The QRCode component generates and displays QR codes based on the provided value.
150
+
151
+ [QRCode Wiki](https://github.com/goobz22/goobs-frontend/wiki/QRCode)
152
+
101
153
  ### RadioGroup
102
154
 
103
155
  The RadioGroup component renders a group of radio buttons for selecting a single option from multiple choices.
104
156
 
157
+ [RadioGroup Wiki](https://github.com/goobz22/goobs-frontend/wiki/RadioGroup)
158
+
159
+ ### Searchbar
160
+
161
+ The Searchbar component provides a search input field with customizable styling options.
162
+
163
+ [Searchbar Wiki](https://github.com/goobz22/goobs-frontend/wiki/Searchbar)
164
+
105
165
  ### Stepper
106
166
 
107
167
  The Stepper component provides a step-by-step interface for guiding users through a process or workflow.
108
168
 
109
- ### StyledComponent
169
+ [Stepper Wiki](https://github.com/goobz22/goobs-frontend/wiki/Stepper)
170
+
171
+ ### TextField
110
172
 
111
- The StyledComponent is a versatile and customizable input component built with React and Material-UI. It provides a range of input variants and supports various styling options to match your application's design requirements.
173
+ The TextField component offers a customizable text input field with various styling and behavior options.
174
+
175
+ [TextField Wiki](https://github.com/goobz22/goobs-frontend/wiki/TextField)
112
176
 
113
177
  ### Toolbar
114
178
 
115
179
  The Toolbar component offers a customizable toolbar for use in various UI scenarios.
116
180
 
181
+ [Toolbar Wiki](https://github.com/goobz22/goobs-frontend/wiki/Toolbar)
182
+
183
+ ### Tooltip
184
+
185
+ The Tooltip component is a customizable and styled version of the Material-UI Tooltip component. It provides a way to display informative text when users hover over, focus on, or tap an element.
186
+
187
+ [Tooltip Wiki](https://github.com/goobz22/goobs-frontend/wiki/Tooltip)
188
+
117
189
  ### TransferList
118
190
 
119
191
  The TransferList component provides a dual-list interface for transferring items between two lists.
120
192
 
193
+ [TransferList Wiki](https://github.com/goobz22/goobs-frontend/wiki/TransferList)
194
+
121
195
  ### Typography
122
196
 
123
- The Typography component is a text component for rendering customizable typography.
197
+ The Typography component is a text component for rendering customizable typography with support for different font families, variants, and colors.
198
+
199
+ [Typography Wiki](https://github.com/goobz22/goobs-frontend/wiki/Typography)
124
200
 
125
201
  ## Usage
126
202
 
127
- To use the components and utilities in your project, you can import them from the `goobs-frontend` package. For example:
203
+ To use the components, types, and utilities in your project, you can import them from the `goobs-frontend` package. Here's a comprehensive list of all available imports:
128
204
 
129
- ```jsx
205
+ ```typescript
130
206
  import {
207
+ // Components
131
208
  CustomButton,
132
209
  CustomGrid,
133
- StyledComponent,
134
210
  Typography,
135
- RadioGroup,
136
211
  ConfirmationCodeInput,
212
+ RadioGroup,
213
+ PopupForm,
214
+ ContentSection,
215
+ Accordion,
216
+ AccordionSummary,
217
+ AccordionDetails,
137
218
  Card,
138
219
  CodeCopy,
139
220
  Nav,
@@ -141,11 +222,150 @@ import {
141
222
  CustomStepper,
142
223
  CustomToolbar,
143
224
  TransferList,
144
- Accordion,
225
+ StyledTooltip,
226
+ QRCodeComponent,
227
+ DateField,
228
+ Dropdown,
229
+ IncrementNumberField,
230
+ NumberField,
231
+ PasswordField,
232
+ PhoneNumberField,
233
+ Searchbar,
234
+ TextField,
235
+
236
+ // Types
237
+ CustomButtonProps,
238
+ CustomGridProps,
239
+ Alignment,
240
+ BorderProp,
241
+ columnconfig,
242
+ gridconfig,
243
+ cellconfig,
244
+ FontFamily,
245
+ TypographyVariant,
246
+ TypographyProps,
247
+ ConfirmationCodeInputsProps,
248
+ RadioOption,
249
+ RadioGroupProps,
250
+ PopupFormProps,
251
+ ContentSectionProps,
252
+ CardProps,
253
+ CodeCopyProps,
254
+ NavProps,
255
+ PricingProps,
256
+ CustomStepperProps,
257
+ ToolbarProps,
258
+ TransferListProps,
259
+ CustomTooltipProps,
260
+ QRCodeProps,
261
+ DateFieldProps,
262
+ DropdownProps,
263
+ IncrementNumberFieldProps,
264
+ NumberFieldProps,
265
+ PasswordFieldProps,
266
+ PhoneNumberFieldProps,
267
+ SearchbarProps,
268
+ TextFieldProps,
269
+
270
+ // Extended Types
271
+ ExtendedButtonProps,
272
+ ExtendedTypographyProps,
273
+ ExtendedTextFieldProps,
274
+ ExtendedQRCodeProps,
275
+ ExtendedDropdownProps,
276
+ ExtendedDateFieldProps,
277
+ ExtendedNumberFieldProps,
278
+ ExtendedIncrementNumberFieldProps,
279
+ ExtendedPasswordFieldProps,
280
+ ExtendedSearchbarProps,
281
+ ExtendedCodeCopyProps,
282
+ ExtendedCardProps,
283
+ ExtendedTransferListProps,
284
+ ExtendedStepperProps,
285
+ ExtendedPricingProps,
286
+ ExtendedImageProps,
287
+ ExtendedConfirmationCodeInputsProps,
288
+ ExtendedRadioGroupProps,
289
+
290
+ // Component Props Types
291
+ TypographyComponentProps,
292
+ ConfirmationCodeInputProps,
293
+ RadioGroupComponentProps,
294
+ PopupFormComponentProps,
295
+ ContentSectionComponentProps,
296
+ AccordionProps,
297
+ AccordionSummaryProps,
298
+ AccordionDetailsProps,
299
+ CardComponentProps,
300
+ CodeCopyComponentProps,
301
+ NavComponentProps,
302
+ PricingTableComponentProps,
303
+ CustomStepperComponentProps,
304
+ CustomToolbarComponentProps,
305
+ TransferListComponentProps,
306
+ StyledTooltipComponentProps,
307
+
308
+ // Styles
309
+ formContainerStyle,
310
+
311
+ // Animations
312
+ Animation,
313
+
314
+ // Colors
315
+ moss,
316
+ aqua,
317
+ madder,
318
+ woad,
319
+ marine,
320
+ pansy,
321
+ stainlessSteel,
322
+ coal,
323
+ ocean,
324
+ sky,
325
+ salmon,
326
+ lightning,
327
+ sage,
328
+ lilac,
329
+ gunpowder,
330
+ lightMadder,
331
+ black,
332
+ white,
333
+ none,
334
+ semiTransparentWhite,
335
+ semiTransparentBlack,
336
+ red,
337
+ green,
338
+ greyborder,
339
+
340
+ // Typography
341
+ arapeyh1,
342
+ arapeyh2,
343
+ arapeyh3,
344
+ arapeyh4,
345
+ arapeyh5,
346
+ arapeyh6,
347
+ arapeyparagraph,
348
+ interh1,
349
+ interh2,
350
+ interh3,
351
+ interh4,
352
+ interh5,
353
+ interh6,
354
+ interparagraph,
355
+ interhelperheader,
356
+ interhelperfooter,
357
+ merrih1,
358
+ merrih2,
359
+ merrih3,
360
+ merrih4,
361
+ merrih5,
362
+ merrih6,
363
+ merriparagraph,
364
+ merrihelperfooter,
145
365
  } from 'goobs-frontend'
146
366
  ```
147
367
 
148
- Please refer to the individual component and utility files for more details on their usage and available props. We are in the process of documenting each component in the [GitHub wiki](https://github.com/goobz22/goobs-frontend/wiki).
368
+ Please refer to the individual component and utility files for more details on their usage and available props.
149
369
 
150
370
  ## License
151
371
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goobs-frontend",
3
- "version": "0.7.70",
3
+ "version": "0.8.0",
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",
@@ -21,13 +21,13 @@
21
21
  "@emotion/cache": "^11.13.1",
22
22
  "@emotion/react": "^11.13.3",
23
23
  "@emotion/styled": "^11.13.0",
24
- "@mui/icons-material": "^5.16.7",
25
- "@mui/material": "^5.16.7",
24
+ "@mui/icons-material": "^6.0.2",
25
+ "@mui/material": "^6.0.2",
26
26
  "@types/lodash": "^4.17.7",
27
27
  "highlight.js": "^11.10.0",
28
28
  "jotai": "^2.9.3",
29
29
  "lodash": "^4.17.21",
30
- "next": "14.2.6",
30
+ "next": "14.2.8",
31
31
  "react-datepicker": "^7.3.0",
32
32
  "react-qr-code": "^2.0.15"
33
33
  },
@@ -39,7 +39,7 @@
39
39
  "@typescript-eslint/eslint-plugin": "^8.2.0",
40
40
  "@typescript-eslint/parser": "^8.2.0",
41
41
  "eslint": "^8.57.0",
42
- "eslint-config-next": "^14.2.6",
42
+ "eslint-config-next": "^14.2.8",
43
43
  "eslint-config-prettier": "^9.1.0",
44
44
  "eslint-plugin-prettier": "^5.2.1",
45
45
  "prettier": "^3.3.3",
@@ -4,19 +4,73 @@ import {
4
4
  MenuItem,
5
5
  FormControl,
6
6
  InputLabel,
7
- SelectChangeEvent,
7
+ SelectProps,
8
+ FormHelperText,
8
9
  } from '@mui/material'
9
10
  import { styled } from '@mui/material/styles'
10
11
 
11
- export interface DropdownProps {
12
+ export interface DropdownOption {
13
+ value: string
12
14
  label: string
13
- options: string[]
14
- defaultOption?: string
15
- onChange?: () => void
15
+ }
16
+
17
+ export interface DropdownProps extends Omit<SelectProps, 'onChange'> {
18
+ /**
19
+ * The label for the dropdown.
20
+ */
21
+ label: string
22
+ /**
23
+ * The options for the dropdown.
24
+ */
25
+ options: DropdownOption[]
26
+ /**
27
+ * The default value for the dropdown.
28
+ */
29
+ defaultValue?: string
30
+ /**
31
+ * The background color of the dropdown.
32
+ */
16
33
  backgroundcolor?: string
34
+ /**
35
+ * The outline color of the dropdown.
36
+ */
17
37
  outlinecolor?: string
38
+ /**
39
+ * The font color of the dropdown.
40
+ */
18
41
  fontcolor?: string
42
+ /**
43
+ * The font color of the dropdown label when shrunk.
44
+ */
19
45
  shrunkfontcolor?: string
46
+ /**
47
+ * Callback function triggered when the dropdown value changes.
48
+ */
49
+ onChange?: SelectProps['onChange']
50
+ /**
51
+ * Indicates if the dropdown is in an error state.
52
+ */
53
+ error?: boolean
54
+ /**
55
+ * The helper text to display below the dropdown.
56
+ */
57
+ helperText?: string
58
+ /**
59
+ * The name of the dropdown.
60
+ */
61
+ name?: string
62
+ /**
63
+ * Indicates if the dropdown is required.
64
+ */
65
+ required?: boolean
66
+ /**
67
+ * Callback function triggered when the dropdown loses focus.
68
+ */
69
+ onBlur?: SelectProps['onBlur']
70
+ /**
71
+ * Callback function triggered when the dropdown receives focus.
72
+ */
73
+ onFocus?: SelectProps['onFocus']
20
74
  }
21
75
 
22
76
  const StyledFormControl = styled(FormControl)<{
@@ -46,44 +100,74 @@ const StyledInputLabel = styled(InputLabel)<{ shrunkfontcolor?: string }>(
46
100
  })
47
101
  )
48
102
 
103
+ /**
104
+ * Dropdown component built with Material UI.
105
+ */
49
106
  const Dropdown: React.FC<DropdownProps> = ({
50
107
  label,
51
108
  options,
52
- defaultOption,
53
- onChange,
109
+ defaultValue,
54
110
  backgroundcolor,
55
111
  outlinecolor,
56
112
  fontcolor,
57
113
  shrunkfontcolor,
114
+ onChange,
115
+ error = false,
116
+ helperText,
117
+ name,
118
+ required = false,
119
+ onBlur,
120
+ onFocus,
121
+ ...rest
58
122
  }) => {
59
- const [selectedValue, setSelectedValue] = useState(defaultOption || '')
123
+ const [selectedValue, setSelectedValue] = useState(() => {
124
+ const defaultOption = options.find(option => option.value === defaultValue)
125
+ return defaultOption ? defaultOption.value : ''
126
+ })
60
127
 
61
- const handleChange = (event: SelectChangeEvent) => {
128
+ const handleChange: SelectProps['onChange'] = (event, child) => {
62
129
  const newValue = event.target.value as string
63
130
  setSelectedValue(newValue)
64
- onChange?.()
131
+ onChange?.(event, child)
132
+ }
133
+
134
+ const handleBlur: SelectProps['onBlur'] = event => {
135
+ onBlur?.(event)
136
+ }
137
+
138
+ const handleFocus: SelectProps['onFocus'] = event => {
139
+ onFocus?.(event)
65
140
  }
66
141
 
67
142
  return (
68
143
  <StyledFormControl
69
144
  backgroundcolor={backgroundcolor}
70
145
  outlinecolor={outlinecolor}
146
+ error={error}
147
+ required={required}
71
148
  >
72
- <StyledInputLabel shrunkfontcolor={shrunkfontcolor}>
149
+ <StyledInputLabel id={`${name}-label`} shrunkfontcolor={shrunkfontcolor}>
73
150
  {label}
74
151
  </StyledInputLabel>
75
152
  <Select
153
+ labelId={`${name}-label`}
76
154
  value={selectedValue}
77
155
  onChange={handleChange}
156
+ onBlur={handleBlur}
157
+ onFocus={handleFocus}
78
158
  label={label}
79
159
  sx={{ color: fontcolor }}
160
+ name={name}
161
+ aria-labelledby={`${name}-label`}
162
+ {...rest}
80
163
  >
81
164
  {options.map(option => (
82
- <MenuItem key={option} value={option}>
83
- {option}
165
+ <MenuItem key={option.value} value={option.value}>
166
+ {option.label}
84
167
  </MenuItem>
85
168
  ))}
86
169
  </Select>
170
+ {helperText && <FormHelperText>{helperText}</FormHelperText>}
87
171
  </StyledFormControl>
88
172
  )
89
173
  }
@@ -1,7 +1,8 @@
1
1
  'use client'
2
2
 
3
3
  import React from 'react'
4
- import { Grid, Box, GridProps, useMediaQuery, useTheme } from '@mui/material'
4
+ import Grid2, { Grid2Props } from '@mui/material/Grid2'
5
+ import { Box, useMediaQuery, useTheme } from '@mui/material'
5
6
 
6
7
  /** Defines the possible alignment options for grid content */
7
8
  export type Alignment = 'left' | 'center' | 'right' | 'inherit' | 'justify'
@@ -47,7 +48,7 @@ export interface gridconfig {
47
48
  /**
48
49
  * Props for the CustomGrid component
49
50
  */
50
- export interface CustomGridProps extends GridProps {
51
+ export interface CustomGridProps extends Grid2Props {
51
52
  gridconfig?: gridconfig
52
53
  columnconfig?: columnconfig[]
53
54
  cellconfig?: cellconfig
@@ -111,7 +112,6 @@ const CustomGrid: React.FC<CustomGridProps> = ({
111
112
  minWidth={minGridWidth}
112
113
  >
113
114
  <Box
114
- // @ts-ignore
115
115
  mt={gridConfigValues?.margintop || 0}
116
116
  mb={gridConfigValues?.marginbottom || 0}
117
117
  ml={gridConfigValues?.marginleft || 0}
@@ -132,7 +132,7 @@ const CustomGrid: React.FC<CustomGridProps> = ({
132
132
  )
133
133
 
134
134
  return (
135
- <Grid
135
+ <Grid2
136
136
  key={`row-${rowIndex}`}
137
137
  container
138
138
  alignItems="center"
@@ -194,8 +194,7 @@ const CustomGrid: React.FC<CustomGridProps> = ({
194
194
  const computerWidth = currentCellConfig?.computerwidth || '100%'
195
195
 
196
196
  return (
197
- <Grid
198
- item
197
+ <Grid2
199
198
  key={`column-${columnIndex}`}
200
199
  sx={{
201
200
  display: 'flex',
@@ -250,10 +249,10 @@ const CustomGrid: React.FC<CustomGridProps> = ({
250
249
  >
251
250
  {currentColumnConfig?.component || null}
252
251
  </Box>
253
- </Grid>
252
+ </Grid2>
254
253
  )
255
254
  })}
256
- </Grid>
255
+ </Grid2>
257
256
  )
258
257
  })}
259
258
  </Box>