goobs-frontend 0.7.67 → 0.7.69

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.
Files changed (42) hide show
  1. package/package.json +14 -16
  2. package/src/app/_app.tsx +8 -8
  3. package/src/components/Button/index.tsx +95 -203
  4. package/src/components/ConfirmationCodeInput/index.tsx +4 -6
  5. package/src/components/Content/Structure/button/useButton.tsx +1 -35
  6. package/src/components/Content/Structure/datefield/useDateField.tsx +55 -0
  7. package/src/components/Content/Structure/dropdown/useDropdown.tsx +55 -0
  8. package/src/components/Content/Structure/incremementNumberField/useIncremementNumberField.tsx +65 -0
  9. package/src/components/Content/Structure/numberField/useNumberField.tsx +55 -0
  10. package/src/components/Content/Structure/passwordField/usePasswordField.tsx +57 -0
  11. package/src/components/Content/Structure/phoneNumber/usePhoneNumber.tsx +0 -0
  12. package/src/components/Content/Structure/qrcode/useQRCode.tsx +69 -0
  13. package/src/components/Content/Structure/searchbar/useSearchbar.tsx +55 -0
  14. package/src/components/Content/Structure/textfield/useTextField.tsx +84 -0
  15. package/src/components/Content/index.tsx +44 -7
  16. package/src/components/DateField/index.tsx +112 -0
  17. package/src/components/Dropdown/index.tsx +91 -0
  18. package/src/components/Form/Popup/index.tsx +1 -1
  19. package/src/components/IncrementNumberField/index.tsx +123 -0
  20. package/src/components/Nav/HorizontalVariant/index.tsx +18 -12
  21. package/src/components/Nav/VerticalVariant/index.tsx +14 -10
  22. package/src/components/NumberField/index.tsx +95 -0
  23. package/src/components/PasswordField/index.tsx +105 -0
  24. package/src/components/PhoneNumberField/index.tsx +102 -0
  25. package/src/components/PricingTable/index.tsx +10 -8
  26. package/src/components/QRCode/index.tsx +105 -0
  27. package/src/components/Searchbar/index.tsx +77 -0
  28. package/src/components/TextField/index.tsx +130 -0
  29. package/src/components/Toolbar/index.tsx +11 -10
  30. package/src/index.ts +54 -9
  31. package/src/components/Button/hook/useHelperFooter.tsx +0 -214
  32. package/src/components/Content/Structure/styledcomponent/useStyledComponent.tsx +0 -104
  33. package/src/components/StyledComponent/adornment/index.tsx +0 -125
  34. package/src/components/StyledComponent/hooks/useDropdown.tsx +0 -150
  35. package/src/components/StyledComponent/hooks/useInputHelperFooter.tsx +0 -524
  36. package/src/components/StyledComponent/hooks/usePhoneNumber.tsx +0 -99
  37. package/src/components/StyledComponent/hooks/useRequiredFieldsValidator.tsx +0 -190
  38. package/src/components/StyledComponent/hooks/useSearchbar.tsx +0 -46
  39. package/src/components/StyledComponent/hooks/useSplitButton.tsx +0 -70
  40. package/src/components/StyledComponent/index.tsx +0 -473
  41. package/src/components/StyledComponent/useCallbacks/index.tsx +0 -46
  42. package/src/styles/StyledComponent/Label/index.ts +0 -76
@@ -0,0 +1,65 @@
1
+ 'use client'
2
+ import React from 'react'
3
+ import IncrementNumberField, {
4
+ IncrementNumberFieldProps,
5
+ } from './../../../IncrementNumberField'
6
+ import { columnconfig, cellconfig } from '../../../Grid'
7
+
8
+ export interface ExtendedIncrementNumberFieldProps
9
+ extends IncrementNumberFieldProps {
10
+ columnconfig?: Partial<columnconfig>
11
+ cellconfig?: cellconfig
12
+ }
13
+
14
+ const useIncrementNumberField = (grid: {
15
+ incrementNumberField?:
16
+ | ExtendedIncrementNumberFieldProps
17
+ | ExtendedIncrementNumberFieldProps[]
18
+ }) => {
19
+ if (!grid.incrementNumberField) return null
20
+
21
+ const renderIncrementNumberField = (
22
+ incrementNumberFieldItem: ExtendedIncrementNumberFieldProps,
23
+ index: number
24
+ ): columnconfig => {
25
+ const {
26
+ columnconfig: itemColumnConfig,
27
+ cellconfig,
28
+ ...restProps
29
+ } = incrementNumberFieldItem
30
+
31
+ if (
32
+ !itemColumnConfig ||
33
+ typeof itemColumnConfig !== 'object' ||
34
+ typeof itemColumnConfig.row !== 'number' ||
35
+ typeof itemColumnConfig.column !== 'number'
36
+ ) {
37
+ throw new Error(
38
+ 'columnconfig must be an object with row and column as numbers'
39
+ )
40
+ }
41
+
42
+ const mergedConfig: columnconfig = {
43
+ ...(itemColumnConfig as columnconfig),
44
+ cellconfig: {
45
+ ...cellconfig,
46
+ },
47
+ component: (
48
+ <IncrementNumberField
49
+ key={`increment-number-field-${index}`}
50
+ {...restProps}
51
+ />
52
+ ),
53
+ }
54
+
55
+ return mergedConfig
56
+ }
57
+
58
+ if (Array.isArray(grid.incrementNumberField)) {
59
+ return grid.incrementNumberField.map(renderIncrementNumberField)
60
+ } else {
61
+ return [renderIncrementNumberField(grid.incrementNumberField, 0)]
62
+ }
63
+ }
64
+
65
+ export default useIncrementNumberField
@@ -0,0 +1,55 @@
1
+ 'use client'
2
+ import React from 'react'
3
+ import NumberField, { NumberFieldProps } from './../../../NumberField'
4
+ import { columnconfig, cellconfig } from '../../../Grid'
5
+
6
+ export interface ExtendedNumberFieldProps extends NumberFieldProps {
7
+ columnconfig?: Partial<columnconfig>
8
+ cellconfig?: cellconfig
9
+ }
10
+
11
+ const useNumberField = (grid: {
12
+ numberField?: ExtendedNumberFieldProps | ExtendedNumberFieldProps[]
13
+ }) => {
14
+ if (!grid.numberField) return null
15
+
16
+ const renderNumberField = (
17
+ numberFieldItem: ExtendedNumberFieldProps,
18
+ index: number
19
+ ): columnconfig => {
20
+ const {
21
+ columnconfig: itemColumnConfig,
22
+ cellconfig,
23
+ ...restProps
24
+ } = numberFieldItem
25
+
26
+ if (
27
+ !itemColumnConfig ||
28
+ typeof itemColumnConfig !== 'object' ||
29
+ typeof itemColumnConfig.row !== 'number' ||
30
+ typeof itemColumnConfig.column !== 'number'
31
+ ) {
32
+ throw new Error(
33
+ 'columnconfig must be an object with row and column as numbers'
34
+ )
35
+ }
36
+
37
+ const mergedConfig: columnconfig = {
38
+ ...(itemColumnConfig as columnconfig),
39
+ cellconfig: {
40
+ ...cellconfig,
41
+ },
42
+ component: <NumberField key={`number-field-${index}`} {...restProps} />,
43
+ }
44
+
45
+ return mergedConfig
46
+ }
47
+
48
+ if (Array.isArray(grid.numberField)) {
49
+ return grid.numberField.map(renderNumberField)
50
+ } else {
51
+ return [renderNumberField(grid.numberField, 0)]
52
+ }
53
+ }
54
+
55
+ export default useNumberField
@@ -0,0 +1,57 @@
1
+ 'use client'
2
+ import React from 'react'
3
+ import PasswordField, { PasswordFieldProps } from './../../../PasswordField'
4
+ import { columnconfig, cellconfig } from '../../../Grid'
5
+
6
+ export interface ExtendedPasswordFieldProps extends PasswordFieldProps {
7
+ columnconfig?: Partial<columnconfig>
8
+ cellconfig?: cellconfig
9
+ }
10
+
11
+ const usePasswordField = (grid: {
12
+ passwordField?: ExtendedPasswordFieldProps | ExtendedPasswordFieldProps[]
13
+ }) => {
14
+ if (!grid.passwordField) return null
15
+
16
+ const renderPasswordField = (
17
+ passwordFieldItem: ExtendedPasswordFieldProps,
18
+ index: number
19
+ ): columnconfig => {
20
+ const {
21
+ columnconfig: itemColumnConfig,
22
+ cellconfig,
23
+ ...restProps
24
+ } = passwordFieldItem
25
+
26
+ if (
27
+ !itemColumnConfig ||
28
+ typeof itemColumnConfig !== 'object' ||
29
+ typeof itemColumnConfig.row !== 'number' ||
30
+ typeof itemColumnConfig.column !== 'number'
31
+ ) {
32
+ throw new Error(
33
+ 'columnconfig must be an object with row and column as numbers'
34
+ )
35
+ }
36
+
37
+ const mergedConfig: columnconfig = {
38
+ ...(itemColumnConfig as columnconfig),
39
+ cellconfig: {
40
+ ...cellconfig,
41
+ },
42
+ component: (
43
+ <PasswordField key={`password-field-${index}`} {...restProps} />
44
+ ),
45
+ }
46
+
47
+ return mergedConfig
48
+ }
49
+
50
+ if (Array.isArray(grid.passwordField)) {
51
+ return grid.passwordField.map(renderPasswordField)
52
+ } else {
53
+ return [renderPasswordField(grid.passwordField, 0)]
54
+ }
55
+ }
56
+
57
+ export default usePasswordField
@@ -0,0 +1,69 @@
1
+ import React from 'react'
2
+ import QRCodeComponent, { QRCodeProps } from '../../../../components/QRCode'
3
+ import { columnconfig, cellconfig } from '../../../Grid'
4
+
5
+ type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
6
+ component?: columnconfig['component']
7
+ }
8
+
9
+ export interface ExtendedQRCodeProps extends Omit<QRCodeProps, 'sx'> {
10
+ columnconfig?: ExtendedColumnConfig
11
+ cellconfig?: cellconfig
12
+ }
13
+
14
+ const useQRCode = (grid: {
15
+ qrcode?: ExtendedQRCodeProps | ExtendedQRCodeProps[]
16
+ }): columnconfig | columnconfig[] | null => {
17
+ if (!grid.qrcode) return null
18
+
19
+ const renderQRCode = (
20
+ component: ExtendedQRCodeProps,
21
+ index: number
22
+ ): columnconfig => {
23
+ const {
24
+ value,
25
+ size,
26
+ title,
27
+ columnconfig: itemColumnConfig,
28
+ cellconfig,
29
+ ...restProps
30
+ } = component
31
+
32
+ if (
33
+ !itemColumnConfig ||
34
+ typeof itemColumnConfig !== 'object' ||
35
+ typeof itemColumnConfig.row !== 'number' ||
36
+ typeof itemColumnConfig.column !== 'number'
37
+ ) {
38
+ throw new Error(
39
+ 'columnconfig must be an object with row and column as numbers'
40
+ )
41
+ }
42
+
43
+ const mergedConfig: columnconfig = {
44
+ ...itemColumnConfig,
45
+ cellconfig: {
46
+ ...cellconfig,
47
+ },
48
+ component: (
49
+ <QRCodeComponent
50
+ key={`qrcode-${index}`}
51
+ value={value}
52
+ size={size}
53
+ title={title}
54
+ {...restProps}
55
+ />
56
+ ),
57
+ }
58
+
59
+ return mergedConfig
60
+ }
61
+
62
+ if (Array.isArray(grid.qrcode)) {
63
+ return grid.qrcode.map(renderQRCode)
64
+ } else {
65
+ return renderQRCode(grid.qrcode, 0)
66
+ }
67
+ }
68
+
69
+ export default useQRCode
@@ -0,0 +1,55 @@
1
+ 'use client'
2
+ import React from 'react'
3
+ import Searchbar, { SearchbarProps } from './../../../Searchbar'
4
+ import { columnconfig, cellconfig } from '../../../Grid'
5
+
6
+ export interface ExtendedSearchbarProps extends SearchbarProps {
7
+ columnconfig?: Partial<columnconfig>
8
+ cellconfig?: cellconfig
9
+ }
10
+
11
+ const useSearchbar = (grid: {
12
+ searchbar?: ExtendedSearchbarProps | ExtendedSearchbarProps[]
13
+ }) => {
14
+ if (!grid.searchbar) return null
15
+
16
+ const renderSearchbar = (
17
+ searchbarItem: ExtendedSearchbarProps,
18
+ index: number
19
+ ): columnconfig => {
20
+ const {
21
+ columnconfig: itemColumnConfig,
22
+ cellconfig,
23
+ ...restProps
24
+ } = searchbarItem
25
+
26
+ if (
27
+ !itemColumnConfig ||
28
+ typeof itemColumnConfig !== 'object' ||
29
+ typeof itemColumnConfig.row !== 'number' ||
30
+ typeof itemColumnConfig.column !== 'number'
31
+ ) {
32
+ throw new Error(
33
+ 'columnconfig must be an object with row and column as numbers'
34
+ )
35
+ }
36
+
37
+ const mergedConfig: columnconfig = {
38
+ ...(itemColumnConfig as columnconfig),
39
+ cellconfig: {
40
+ ...cellconfig,
41
+ },
42
+ component: <Searchbar key={`searchbar-${index}`} {...restProps} />,
43
+ }
44
+
45
+ return mergedConfig
46
+ }
47
+
48
+ if (Array.isArray(grid.searchbar)) {
49
+ return grid.searchbar.map(renderSearchbar)
50
+ } else {
51
+ return [renderSearchbar(grid.searchbar, 0)]
52
+ }
53
+ }
54
+
55
+ export default useSearchbar
@@ -0,0 +1,84 @@
1
+ import React from 'react'
2
+ import TextField, {
3
+ CustomTextFieldProps,
4
+ } from '../../../../components/TextField'
5
+ import { columnconfig, cellconfig } from '../../../Grid'
6
+
7
+ type ExtendedColumnConfig = Omit<columnconfig, 'component'> & {
8
+ component?: columnconfig['component']
9
+ }
10
+
11
+ export interface ExtendedTextFieldProps
12
+ extends Omit<CustomTextFieldProps, 'columnconfig'> {
13
+ columnconfig?: ExtendedColumnConfig
14
+ cellconfig?: cellconfig
15
+ }
16
+
17
+ const useTextField = (grid: {
18
+ textfield?: ExtendedTextFieldProps | ExtendedTextFieldProps[]
19
+ }): columnconfig | columnconfig[] | null => {
20
+ if (!grid.textfield) return null
21
+
22
+ const renderTextField = (
23
+ component: ExtendedTextFieldProps,
24
+ index: number
25
+ ): columnconfig => {
26
+ const {
27
+ name,
28
+ label,
29
+ placeholder,
30
+ value,
31
+ onChange,
32
+ onFocus,
33
+ onBlur,
34
+ error,
35
+ InputProps,
36
+ columnconfig: itemColumnConfig,
37
+ cellconfig,
38
+ ...restProps
39
+ } = component
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,
54
+ cellconfig: {
55
+ ...cellconfig,
56
+ },
57
+ component: (
58
+ <TextField
59
+ key={`textfield-${index}`}
60
+ name={name}
61
+ label={label}
62
+ placeholder={placeholder}
63
+ value={value}
64
+ onChange={onChange}
65
+ onFocus={onFocus}
66
+ onBlur={onBlur}
67
+ error={error}
68
+ InputProps={InputProps}
69
+ {...restProps}
70
+ />
71
+ ),
72
+ }
73
+
74
+ return mergedConfig
75
+ }
76
+
77
+ if (Array.isArray(grid.textfield)) {
78
+ return grid.textfield.map(renderTextField)
79
+ } else {
80
+ return renderTextField(grid.textfield, 0)
81
+ }
82
+ }
83
+
84
+ export default useTextField
@@ -5,9 +5,6 @@ import CustomGrid, { columnconfig, gridconfig } from '../../components/Grid'
5
5
  import useGridTypography, {
6
6
  ExtendedTypographyProps as TypographyProps,
7
7
  } from './Structure/typography/useGridTypography'
8
- import useStyledComponent, {
9
- ExtendedStyledComponentProps,
10
- } from '../../components/Content/Structure/styledcomponent/useStyledComponent'
11
8
  import useGridRadioGroup, {
12
9
  ExtendedRadioGroupProps,
13
10
  } from './Structure/radiogroup/useRadioGroup'
@@ -38,6 +35,28 @@ import useCard, {
38
35
  import useCodeCopy, {
39
36
  ExtendedCodeCopyProps,
40
37
  } from './../../components/Content/Structure/codecopy/useCodeCopy'
38
+ import useTextField, {
39
+ ExtendedTextFieldProps,
40
+ } from './Structure/textfield/useTextField'
41
+ import useDateField, {
42
+ ExtendedDateFieldProps,
43
+ } from './Structure/datefield/useDateField'
44
+ import useDropdown, {
45
+ ExtendedDropdownProps,
46
+ } from './Structure/dropdown/useDropdown'
47
+ import useIncrementNumberField, {
48
+ ExtendedIncrementNumberFieldProps,
49
+ } from './Structure/incremementNumberField/useIncremementNumberField'
50
+ import useSearchbar, {
51
+ ExtendedSearchbarProps,
52
+ } from './Structure/searchbar/useSearchbar'
53
+ import useNumberField, {
54
+ ExtendedNumberFieldProps,
55
+ } from './Structure/numberField/useNumberField'
56
+ import usePasswordField, {
57
+ ExtendedPasswordFieldProps,
58
+ } from './Structure/passwordField/usePasswordField'
59
+ import useQRCode, { ExtendedQRCodeProps } from './Structure/qrcode/useQRCode'
41
60
 
42
61
  /**
43
62
  * Props for the ContentSection component.
@@ -52,9 +71,6 @@ export interface ContentSectionProps {
52
71
  | ExtendedConfirmationCodeInputsProps
53
72
  | ExtendedConfirmationCodeInputsProps[]
54
73
  typography?: TypographyProps | TypographyProps[]
55
- styledcomponent?:
56
- | ExtendedStyledComponentProps
57
- | ExtendedStyledComponentProps[]
58
74
  radiogroup?: ExtendedRadioGroupProps | ExtendedRadioGroupProps[]
59
75
  link?: LinkProps | LinkProps[]
60
76
  button?: ExtendedButtonProps | ExtendedButtonProps[]
@@ -64,6 +80,16 @@ export interface ContentSectionProps {
64
80
  transferlist?: ExtendedTransferListProps | ExtendedTransferListProps[]
65
81
  card?: ExtendedCardProps | ExtendedCardProps[]
66
82
  codecopy?: ExtendedCodeCopyProps | ExtendedCodeCopyProps[]
83
+ textfield?: ExtendedTextFieldProps | ExtendedTextFieldProps[]
84
+ datefield?: ExtendedDateFieldProps | ExtendedDateFieldProps[]
85
+ dropdown?: ExtendedDropdownProps | ExtendedDropdownProps[]
86
+ incrementNumberField?:
87
+ | ExtendedIncrementNumberFieldProps
88
+ | ExtendedIncrementNumberFieldProps[]
89
+ searchbar?: ExtendedSearchbarProps | ExtendedSearchbarProps[]
90
+ numberField?: ExtendedNumberFieldProps | ExtendedNumberFieldProps[]
91
+ passwordField?: ExtendedPasswordFieldProps | ExtendedPasswordFieldProps[]
92
+ qrcode?: ExtendedQRCodeProps | ExtendedQRCodeProps[]
67
93
  }>
68
94
  width?: number
69
95
  }
@@ -90,7 +116,6 @@ const RenderContent: React.FC<
90
116
 
91
117
  // Add configurations for each content type
92
118
  addToColumnConfigs(useGridTypography(props))
93
- addToColumnConfigs(useStyledComponent(props))
94
119
  addToColumnConfigs(useGridRadioGroup(props))
95
120
  addToColumnConfigs(
96
121
  useConfirmationInput({ confirmationcodeinput: props.confirmationcodeinput })
@@ -103,6 +128,18 @@ const RenderContent: React.FC<
103
128
  addToColumnConfigs(useTransferList(props))
104
129
  addToColumnConfigs(useCard(props))
105
130
  addToColumnConfigs(useCodeCopy(props))
131
+ addToColumnConfigs(useTextField(props))
132
+ addToColumnConfigs(useDateField(props))
133
+ addToColumnConfigs(useDropdown(props))
134
+ addToColumnConfigs(
135
+ useIncrementNumberField({
136
+ incrementNumberField: props.incrementNumberField,
137
+ })
138
+ )
139
+ addToColumnConfigs(useSearchbar(props))
140
+ addToColumnConfigs(useNumberField({ numberField: props.numberField }))
141
+ addToColumnConfigs(usePasswordField({ passwordField: props.passwordField }))
142
+ addToColumnConfigs(useQRCode({ qrcode: props.qrcode }))
106
143
 
107
144
  const updatedGridConfig: gridconfig = {
108
145
  ...grid.gridconfig,
@@ -0,0 +1,112 @@
1
+ 'use client'
2
+ import React, { useState, useRef } from 'react'
3
+ import { TextField, InputAdornment, TextFieldProps } from '@mui/material'
4
+ import { styled } from '@mui/material/styles'
5
+ import DatePicker from 'react-datepicker'
6
+ import 'react-datepicker/dist/react-datepicker.css'
7
+ import CalendarTodayIcon from '@mui/icons-material/CalendarToday'
8
+
9
+ export interface DateFieldProps extends Omit<TextFieldProps, 'onChange'> {
10
+ onChange?: () => void
11
+ backgroundcolor?: string
12
+ outlinecolor?: string
13
+ fontcolor?: string
14
+ label?: string
15
+ }
16
+
17
+ const StyledTextField = styled(TextField)<{
18
+ backgroundcolor?: string
19
+ outlinecolor?: string
20
+ fontcolor?: string
21
+ }>(({ theme, backgroundcolor, outlinecolor, fontcolor }) => ({
22
+ '& .MuiOutlinedInput-root': {
23
+ backgroundColor: backgroundcolor || theme.palette.background.paper,
24
+ '& fieldset': {
25
+ borderColor: outlinecolor || theme.palette.primary.main,
26
+ },
27
+ '&:hover fieldset': {
28
+ borderColor: outlinecolor || theme.palette.primary.main,
29
+ },
30
+ '&.Mui-focused fieldset': {
31
+ borderColor: outlinecolor || theme.palette.primary.main,
32
+ },
33
+ },
34
+ '& .MuiInputLabel-root': {
35
+ color: fontcolor || theme.palette.text.primary,
36
+ '&.Mui-focused': {
37
+ color: fontcolor || theme.palette.primary.main,
38
+ },
39
+ },
40
+ '& .MuiInputBase-input': {
41
+ color: fontcolor || theme.palette.text.primary,
42
+ },
43
+ }))
44
+
45
+ const DateField: React.FC<DateFieldProps> = ({
46
+ onChange,
47
+ backgroundcolor,
48
+ outlinecolor,
49
+ fontcolor,
50
+ label = 'Select Date Range',
51
+ ...rest
52
+ }) => {
53
+ const [dateRange, setDateRange] = useState<[Date | null, Date | null]>([
54
+ null,
55
+ null,
56
+ ])
57
+ const datePickerRef = useRef<DatePicker>(null)
58
+
59
+ const handleChange = (dates: [Date | null, Date | null]) => {
60
+ setDateRange(dates)
61
+ onChange?.()
62
+ }
63
+
64
+ const formatDateRange = (range: [Date | null, Date | null]) => {
65
+ const [start, end] = range
66
+ if (start && end) {
67
+ return `${start.toLocaleDateString()} - ${end.toLocaleDateString()}`
68
+ } else if (start) {
69
+ return start.toLocaleDateString()
70
+ }
71
+ return ''
72
+ }
73
+
74
+ const openDatePicker = () => {
75
+ if (datePickerRef.current) {
76
+ datePickerRef.current.setOpen(true)
77
+ }
78
+ }
79
+
80
+ return (
81
+ <StyledTextField
82
+ label={label}
83
+ value={formatDateRange(dateRange)}
84
+ InputProps={{
85
+ endAdornment: (
86
+ <InputAdornment position="end">
87
+ <CalendarTodayIcon />
88
+ </InputAdornment>
89
+ ),
90
+ readOnly: true,
91
+ }}
92
+ backgroundcolor={backgroundcolor}
93
+ outlinecolor={outlinecolor}
94
+ fontcolor={fontcolor}
95
+ onClick={openDatePicker}
96
+ {...rest}
97
+ >
98
+ <DatePicker
99
+ ref={datePickerRef}
100
+ selectsRange={true}
101
+ startDate={dateRange[0] || undefined}
102
+ endDate={dateRange[1] || undefined}
103
+ onChange={(update: [Date | null, Date | null]) => {
104
+ handleChange(update)
105
+ }}
106
+ customInput={<input style={{ display: 'none' }} />}
107
+ />
108
+ </StyledTextField>
109
+ )
110
+ }
111
+
112
+ export default DateField
@@ -0,0 +1,91 @@
1
+ import React, { useState } from 'react'
2
+ import {
3
+ Select,
4
+ MenuItem,
5
+ FormControl,
6
+ InputLabel,
7
+ SelectChangeEvent,
8
+ } from '@mui/material'
9
+ import { styled } from '@mui/material/styles'
10
+
11
+ export interface DropdownProps {
12
+ label: string
13
+ options: string[]
14
+ defaultOption?: string
15
+ onChange?: () => void
16
+ backgroundcolor?: string
17
+ outlinecolor?: string
18
+ fontcolor?: string
19
+ shrunkfontcolor?: string
20
+ }
21
+
22
+ const StyledFormControl = styled(FormControl)<{
23
+ backgroundcolor?: string
24
+ outlinecolor?: string
25
+ }>(({ theme, backgroundcolor, outlinecolor }) => ({
26
+ width: '100%',
27
+ '& .MuiOutlinedInput-root': {
28
+ backgroundColor: backgroundcolor || theme.palette.background.paper,
29
+ '& fieldset': {
30
+ borderColor: outlinecolor || theme.palette.primary.main,
31
+ },
32
+ '&:hover fieldset': {
33
+ borderColor: outlinecolor || theme.palette.primary.main,
34
+ },
35
+ '&.Mui-focused fieldset': {
36
+ borderColor: outlinecolor || theme.palette.primary.main,
37
+ },
38
+ },
39
+ }))
40
+
41
+ const StyledInputLabel = styled(InputLabel)<{ shrunkfontcolor?: string }>(
42
+ ({ theme, shrunkfontcolor }) => ({
43
+ '&.Mui-focused': {
44
+ color: shrunkfontcolor || theme.palette.primary.main,
45
+ },
46
+ })
47
+ )
48
+
49
+ const Dropdown: React.FC<DropdownProps> = ({
50
+ label,
51
+ options,
52
+ defaultOption,
53
+ onChange,
54
+ backgroundcolor,
55
+ outlinecolor,
56
+ fontcolor,
57
+ shrunkfontcolor,
58
+ }) => {
59
+ const [selectedValue, setSelectedValue] = useState(defaultOption || '')
60
+
61
+ const handleChange = (event: SelectChangeEvent) => {
62
+ const newValue = event.target.value as string
63
+ setSelectedValue(newValue)
64
+ onChange?.()
65
+ }
66
+
67
+ return (
68
+ <StyledFormControl
69
+ backgroundcolor={backgroundcolor}
70
+ outlinecolor={outlinecolor}
71
+ >
72
+ <StyledInputLabel shrunkfontcolor={shrunkfontcolor}>
73
+ {label}
74
+ </StyledInputLabel>
75
+ <Select
76
+ value={selectedValue}
77
+ onChange={handleChange}
78
+ label={label}
79
+ sx={{ color: fontcolor }}
80
+ >
81
+ {options.map(option => (
82
+ <MenuItem key={option} value={option}>
83
+ {option}
84
+ </MenuItem>
85
+ ))}
86
+ </Select>
87
+ </StyledFormControl>
88
+ )
89
+ }
90
+
91
+ export default Dropdown
@@ -66,7 +66,7 @@ const PopupForm: React.FC<PopupFormProps> = ({
66
66
  grid: {
67
67
  gridconfig: {
68
68
  gridname: 'formHeader',
69
- marginbottom: 1,
69
+ marginbottom: 0.5,
70
70
  gridwidth: '100%',
71
71
  },
72
72
  },