goobs-frontend 0.9.2 → 0.9.4
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 +2 -1
- package/src/components/Content/Structure/Address/useAddress.tsx +21 -0
- package/src/components/Content/Structure/CIDR/useCIDR.tsx +19 -0
- package/src/components/Content/Structure/Subnet/useSubnet.tsx +19 -0
- package/src/components/Content/Structure/Supernet/useSupernet.tsx +21 -0
- package/src/components/Content/Structure/USD/useUSD.tsx +145 -0
- package/src/components/Content/Structure/VLAN/useVLAN.tsx +19 -0
- package/src/components/Content/Structure/datefield/useDateField.tsx +1 -1
- package/src/components/Content/Structure/dropdown/useDropdown.tsx +1 -1
- package/src/components/Content/Structure/incremementNumberField/useIncremementNumberField.tsx +1 -1
- package/src/components/Content/Structure/multiSelect/useMultiSelect.tsx +3 -1
- package/src/components/Content/Structure/numberField/useNumberField.tsx +7 -3
- package/src/components/Content/Structure/passwordField/usePasswordField.tsx +1 -1
- package/src/components/Content/Structure/phoneNumber/usePhoneNumber.tsx +2 -2
- package/src/components/Content/Structure/searchableDropdown/useSearchableDropdown.tsx +1 -1
- package/src/components/Content/Structure/searchbar/useSearchbar.tsx +1 -1
- package/src/components/Content/Structure/textfield/useTextField.tsx +1 -1
- package/src/components/Content/index.tsx +36 -10
- package/src/components/DataGrid/ManageColumn/index.tsx +1 -1
- package/src/components/DataGrid/Table/ColumnHeaderRow/index.tsx +1 -1
- package/src/components/DataGrid/types/index.ts +2 -2
- package/src/components/DataGrid/utils/useToolbarSearchbar.tsx +1 -1
- package/src/components/{DateField → Field/Date}/datefield.stories.tsx +1 -1
- package/src/components/{DateField → Field/Date}/index.tsx +1 -1
- package/src/components/{MultiSelect → Field/Dropdown/MultiSelect}/multiselect.stories.tsx +1 -1
- package/src/components/{Dropdown → Field/Dropdown/Regular}/dropdown.stories.tsx +1 -1
- package/src/components/{Dropdown → Field/Dropdown/Regular}/index.tsx +2 -2
- package/src/components/{SearchableDropdown → Field/Dropdown/Searchable}/index.tsx +2 -2
- package/src/components/{SearchableDropdown → Field/Dropdown/Searchable}/searchabledropdown.stories.tsx +1 -1
- package/src/components/Field/IPAM/Address/Address.stories.tsx +138 -0
- package/src/components/Field/IPAM/Address/index.tsx +275 -0
- package/src/components/Field/IPAM/CIDR/CIDR.stories.tsx +217 -0
- package/src/components/Field/IPAM/CIDR/index.tsx +265 -0
- package/src/components/Field/IPAM/Subnet/Subnet.stories.tsx +130 -0
- package/src/components/Field/IPAM/Subnet/index.tsx +262 -0
- package/src/components/Field/IPAM/Supernet/Supernet.stories.tsx +175 -0
- package/src/components/Field/IPAM/Supernet/index.tsx +267 -0
- package/src/components/Field/IPAM/VLAN/VLAN.stories.tsx +113 -0
- package/src/components/Field/IPAM/VLAN/index.tsx +352 -0
- package/src/components/{IncrementNumberField → Field/Number/ExternalIncrement}/incrementnumberfield.stories.tsx +1 -1
- package/src/components/Field/Number/InternalIncrement/index.tsx +226 -0
- package/src/components/Field/Number/InternalIncrement/numberfield.stories.tsx +228 -0
- package/src/components/{PasswordField → Field/Password}/index.tsx +1 -1
- package/src/components/{PasswordField → Field/Password}/passwordfield.stories.tsx +1 -1
- package/src/components/Field/Percentage/index.tsx +265 -0
- package/src/components/Field/Percentage/percentagefield.stories.tsx +173 -0
- package/src/components/{PhoneNumberField → Field/PhoneNumber}/index.tsx +1 -1
- package/src/components/{PhoneNumberField → Field/PhoneNumber}/phonenumberfield.stories.tsx +1 -1
- package/src/components/{Searchbar → Field/Search}/index.tsx +1 -1
- package/src/components/{Searchbar → Field/Search}/searchbar.stories.tsx +1 -1
- package/src/components/{TextField → Field/Text}/textfield.stories.tsx +1 -1
- package/src/components/Field/USD/index.tsx +119 -0
- package/src/components/Field/USD/usd.stories.tsx +194 -0
- package/src/components/Form/Dialog/index.tsx +5 -3
- package/src/components/Form/Popup/index.tsx +7 -5
- package/src/components/Nav/index.tsx +1 -1
- package/src/components/PricingTable/index.tsx +1 -1
- package/src/components/ProjectBoard/board/desktop/index.tsx +1 -1
- package/src/components/ProjectBoard/board/mobile/index.tsx +1 -1
- package/src/components/ProjectBoard/board/tablet/index.tsx +1 -1
- package/src/components/ProjectBoard/forms/AddTask/administrator/companyDropdown/index.tsx +3 -3
- package/src/components/ProjectBoard/forms/AddTask/administrator/companyProvided/index.tsx +3 -3
- package/src/components/ProjectBoard/forms/AddTask/company/customerDropdown/index.tsx +3 -3
- package/src/components/ProjectBoard/forms/AddTask/company/customerProvided/index.tsx +3 -3
- package/src/components/ProjectBoard/forms/AddTask/customer/index.tsx +3 -3
- package/src/components/ProjectBoard/forms/AddTask/noUser/index.tsx +2 -2
- package/src/components/ProjectBoard/forms/ShowTask/client.tsx +4 -4
- package/src/components/ProjectBoard/types/index.tsx +1 -1
- package/src/components/Toolbar/index.tsx +2 -2
- package/src/components/Toolbar/leftCenter/index.tsx +1 -1
- package/src/components/Toolbar/right/index.tsx +1 -1
- package/src/components/Toolbar/toolbar.stories.tsx +2 -2
- package/src/components/TransferList/index.tsx +1 -1
- package/src/index.ts +18 -13
- package/src/components/NumberField/index.tsx +0 -69
- package/src/components/NumberField/numberfield.stories.tsx +0 -137
- /package/src/components/{MultiSelect → Field/Dropdown/MultiSelect}/index.tsx +0 -0
- /package/src/components/{IncrementNumberField → Field/Number/ExternalIncrement}/index.tsx +0 -0
- /package/src/components/{TextField → Field/Text}/index.tsx +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goobs-frontend",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A comprehensive React-based libary that extends the functionality of Material-UI",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"@storybook/nextjs": "^8",
|
|
56
56
|
"@storybook/react": "^8",
|
|
57
57
|
"@storybook/test": "^8",
|
|
58
|
+
"@types/node": "^22.13.8",
|
|
58
59
|
"@types/react": "^19",
|
|
59
60
|
"@types/react-dom": "^19",
|
|
60
61
|
"@typescript-eslint/eslint-plugin": "^8",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import AddressStructure from '../../../Field/IPAM/Address'
|
|
3
|
+
import type { IPAddressFieldProps } from '../../../Field/IPAM/Address'
|
|
4
|
+
|
|
5
|
+
export interface UseAddressProps {
|
|
6
|
+
address?: IPAddressFieldProps | IPAddressFieldProps[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const useAddress = ({
|
|
10
|
+
address,
|
|
11
|
+
}: UseAddressProps): React.ReactElement[] | null => {
|
|
12
|
+
if (!address) return null
|
|
13
|
+
|
|
14
|
+
const addressArray = Array.isArray(address) ? address : [address]
|
|
15
|
+
|
|
16
|
+
return addressArray.map((props, index) => (
|
|
17
|
+
<AddressStructure key={index} {...props} />
|
|
18
|
+
))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default useAddress
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import CIDRStructure from '../../../Field/IPAM/CIDR'
|
|
3
|
+
import type { CIDRFieldProps } from '../../../Field/IPAM/CIDR'
|
|
4
|
+
|
|
5
|
+
export interface UseCIDRProps {
|
|
6
|
+
cidr?: CIDRFieldProps | CIDRFieldProps[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const useCIDR = ({ cidr }: UseCIDRProps): React.ReactElement[] | null => {
|
|
10
|
+
if (!cidr) return null
|
|
11
|
+
|
|
12
|
+
const cidrArray = Array.isArray(cidr) ? cidr : [cidr]
|
|
13
|
+
|
|
14
|
+
return cidrArray.map((props, index) => (
|
|
15
|
+
<CIDRStructure key={index} {...props} />
|
|
16
|
+
))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default useCIDR
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import SubnetField from '../../../../components/Field/IPAM/Subnet'
|
|
3
|
+
import type { InternalIncrementNumberFieldProps as SubnetFieldProps } from '../../../../components/Field/IPAM/Subnet'
|
|
4
|
+
|
|
5
|
+
interface UseSubnetProps {
|
|
6
|
+
subnet?: SubnetFieldProps | SubnetFieldProps[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const useSubnet = ({ subnet }: UseSubnetProps): React.ReactElement[] | null => {
|
|
10
|
+
if (!subnet) return null
|
|
11
|
+
|
|
12
|
+
const subnetArray = Array.isArray(subnet) ? subnet : [subnet]
|
|
13
|
+
|
|
14
|
+
return subnetArray.map((props, index) => (
|
|
15
|
+
<SubnetField key={index} {...props} />
|
|
16
|
+
))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default useSubnet
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import SupernetField from '../../../../components/Field/IPAM/Subnet'
|
|
3
|
+
import type { InternalIncrementNumberFieldProps as SupernetFieldProps } from '../../../../components/Field/IPAM/Subnet'
|
|
4
|
+
|
|
5
|
+
interface UseSupernet {
|
|
6
|
+
supernet?: SupernetFieldProps | SupernetFieldProps[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const useSupernet = ({
|
|
10
|
+
supernet,
|
|
11
|
+
}: UseSupernet): React.ReactElement[] | null => {
|
|
12
|
+
if (!supernet) return null
|
|
13
|
+
|
|
14
|
+
const supernetArray = Array.isArray(supernet) ? supernet : [supernet]
|
|
15
|
+
|
|
16
|
+
return supernetArray.map((props, index) => (
|
|
17
|
+
<SupernetField key={index} {...props} />
|
|
18
|
+
))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default useSupernet
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { Box, InputAdornment } from '@mui/material'
|
|
4
|
+
import TextField from '../../../Field/Text'
|
|
5
|
+
import { black } from '../../../../styles/palette'
|
|
6
|
+
|
|
7
|
+
export interface UseUSDProps {
|
|
8
|
+
usdField?: USDFieldProps | USDFieldProps[]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface USDFieldProps {
|
|
12
|
+
initialValue?: string
|
|
13
|
+
onChange?: (value: string) => void
|
|
14
|
+
label?: string
|
|
15
|
+
min?: number
|
|
16
|
+
max?: number
|
|
17
|
+
precision?: number
|
|
18
|
+
readOnly?: boolean
|
|
19
|
+
disabled?: boolean
|
|
20
|
+
error?: boolean
|
|
21
|
+
helperText?: string
|
|
22
|
+
placeholder?: string
|
|
23
|
+
sx?: React.CSSProperties
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const formatCurrency = (value: string): string => {
|
|
27
|
+
// Remove all non-numeric characters except decimal point
|
|
28
|
+
const numericValue = value.replace(/[^0-9.]/g, '')
|
|
29
|
+
|
|
30
|
+
// Handle empty input
|
|
31
|
+
if (!numericValue) return ''
|
|
32
|
+
|
|
33
|
+
// Allow manual decimal input
|
|
34
|
+
if (numericValue === '.') return '.'
|
|
35
|
+
|
|
36
|
+
// Handle multiple decimal points - keep only the first one
|
|
37
|
+
const parts = numericValue.split('.')
|
|
38
|
+
if (parts.length > 2) {
|
|
39
|
+
return `${parts[0]}.${parts.slice(1).join('')}`
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// If there's a decimal point, allow manual input
|
|
43
|
+
if (numericValue.includes('.')) {
|
|
44
|
+
return numericValue
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// For whole numbers, convert and format
|
|
48
|
+
const number = parseFloat(numericValue)
|
|
49
|
+
if (isNaN(number)) return ''
|
|
50
|
+
|
|
51
|
+
return number.toString()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const USDComponent: React.FC<USDFieldProps> = ({
|
|
55
|
+
initialValue = '',
|
|
56
|
+
onChange,
|
|
57
|
+
label = 'Amount',
|
|
58
|
+
min,
|
|
59
|
+
max,
|
|
60
|
+
precision = 2,
|
|
61
|
+
readOnly = false,
|
|
62
|
+
disabled = false,
|
|
63
|
+
error = false,
|
|
64
|
+
helperText,
|
|
65
|
+
placeholder,
|
|
66
|
+
sx,
|
|
67
|
+
}) => {
|
|
68
|
+
const [value, setValue] = useState(initialValue)
|
|
69
|
+
|
|
70
|
+
const handleChange = useCallback(
|
|
71
|
+
(event: React.ChangeEvent<HTMLInputElement>) => {
|
|
72
|
+
if (readOnly) return
|
|
73
|
+
|
|
74
|
+
const newValue = event.target.value
|
|
75
|
+
const formattedValue = formatCurrency(newValue)
|
|
76
|
+
|
|
77
|
+
// Validate min/max if provided
|
|
78
|
+
const numericValue = parseFloat(formattedValue)
|
|
79
|
+
if (!isNaN(numericValue)) {
|
|
80
|
+
if (min !== undefined && numericValue < min) {
|
|
81
|
+
const minValue = min.toFixed(precision)
|
|
82
|
+
setValue(minValue)
|
|
83
|
+
onChange?.(minValue)
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
if (max !== undefined && numericValue > max) {
|
|
87
|
+
const maxValue = max.toFixed(precision)
|
|
88
|
+
setValue(maxValue)
|
|
89
|
+
onChange?.(maxValue)
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
setValue(formattedValue)
|
|
95
|
+
onChange?.(formattedValue)
|
|
96
|
+
},
|
|
97
|
+
[onChange, precision, min, max, readOnly]
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<Box>
|
|
102
|
+
<TextField
|
|
103
|
+
value={value}
|
|
104
|
+
onChange={handleChange}
|
|
105
|
+
label={label}
|
|
106
|
+
type="text"
|
|
107
|
+
inputMode="decimal"
|
|
108
|
+
variant="outlined"
|
|
109
|
+
disabled={disabled}
|
|
110
|
+
error={error}
|
|
111
|
+
helperText={helperText}
|
|
112
|
+
placeholder={placeholder}
|
|
113
|
+
sx={sx}
|
|
114
|
+
slotProps={{
|
|
115
|
+
input: {
|
|
116
|
+
readOnly,
|
|
117
|
+
startAdornment: (
|
|
118
|
+
<InputAdornment position="start" sx={{ color: black.main }}>
|
|
119
|
+
$
|
|
120
|
+
</InputAdornment>
|
|
121
|
+
),
|
|
122
|
+
sx: {
|
|
123
|
+
'& .MuiInputBase-input': {
|
|
124
|
+
marginLeft: '-10px',
|
|
125
|
+
},
|
|
126
|
+
'&::placeholder': {
|
|
127
|
+
marginLeft: '-10px',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
}}
|
|
132
|
+
/>
|
|
133
|
+
</Box>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export const useUSD = ({ usdField }: UseUSDProps): React.ReactElement[] => {
|
|
138
|
+
if (!usdField) return []
|
|
139
|
+
|
|
140
|
+
const fields = Array.isArray(usdField) ? usdField : [usdField]
|
|
141
|
+
|
|
142
|
+
return fields.map((field, index) => <USDComponent key={index} {...field} />)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export default useUSD
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import VLANStructure from '../../../Field/IPAM/VLAN'
|
|
3
|
+
import type { VLANFieldProps } from '../../../Field/IPAM/VLAN'
|
|
4
|
+
|
|
5
|
+
export interface UseVLANProps {
|
|
6
|
+
vlan?: VLANFieldProps | VLANFieldProps[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const useVLAN = ({ vlan }: UseVLANProps): React.ReactElement[] | null => {
|
|
10
|
+
if (!vlan) return null
|
|
11
|
+
|
|
12
|
+
const vlanArray = Array.isArray(vlan) ? vlan : [vlan]
|
|
13
|
+
|
|
14
|
+
return vlanArray.map((props, index) => (
|
|
15
|
+
<VLANStructure key={index} {...props} />
|
|
16
|
+
))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default useVLAN
|
package/src/components/Content/Structure/incremementNumberField/useIncremementNumberField.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import IncrementNumberField, {
|
|
4
4
|
IncrementNumberFieldProps,
|
|
5
|
-
} from '
|
|
5
|
+
} from '../../../Field/Number/ExternalIncrement'
|
|
6
6
|
|
|
7
7
|
const useIncrementNumberField = (props: {
|
|
8
8
|
incrementNumberField?: IncrementNumberFieldProps | IncrementNumberFieldProps[]
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import MultipleSelectChip, {
|
|
3
|
+
import MultipleSelectChip, {
|
|
4
|
+
MultiSelectChipProps,
|
|
5
|
+
} from '../../../Field/Dropdown/MultiSelect'
|
|
4
6
|
|
|
5
7
|
const useMultiSelect = (props: {
|
|
6
8
|
multiSelect?: MultiSelectChipProps | MultiSelectChipProps[]
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import NumberField, {
|
|
3
|
+
import NumberField, {
|
|
4
|
+
InternalIncrementNumberFieldProps,
|
|
5
|
+
} from '../../../Field/Number/InternalIncrement'
|
|
4
6
|
|
|
5
7
|
const useNumberField = (props: {
|
|
6
|
-
numberField?:
|
|
8
|
+
numberField?:
|
|
9
|
+
| InternalIncrementNumberFieldProps
|
|
10
|
+
| InternalIncrementNumberFieldProps[]
|
|
7
11
|
}): React.ReactElement[] | null => {
|
|
8
12
|
if (!props.numberField) return null
|
|
9
13
|
|
|
10
14
|
const renderNumberField = (
|
|
11
|
-
numberFieldItem:
|
|
15
|
+
numberFieldItem: InternalIncrementNumberFieldProps,
|
|
12
16
|
index: number
|
|
13
17
|
): React.ReactElement => {
|
|
14
18
|
return <NumberField key={`number-field-${index}`} {...numberFieldItem} />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import PasswordField, { PasswordFieldProps } from '
|
|
3
|
+
import PasswordField, { PasswordFieldProps } from '../../../Field/Password'
|
|
4
4
|
|
|
5
5
|
const usePasswordField = (props: {
|
|
6
6
|
passwordField?: PasswordFieldProps | PasswordFieldProps[]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import PhoneNumberField from '../../../
|
|
4
|
-
import type { TextFieldProps } from '../../../
|
|
3
|
+
import PhoneNumberField from '../../../Field/PhoneNumber'
|
|
4
|
+
import type { TextFieldProps } from '../../../Field/Text'
|
|
5
5
|
|
|
6
6
|
const usePhoneNumber = (props: {
|
|
7
7
|
phoneNumberField?: TextFieldProps | TextFieldProps[]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import SearchableDropdown, {
|
|
4
4
|
SearchableDropdownProps,
|
|
5
|
-
} from '
|
|
5
|
+
} from '../../../Field/Dropdown/Searchable'
|
|
6
6
|
|
|
7
7
|
const useSearchableDropdown = (props: {
|
|
8
8
|
searchableDropdown?: SearchableDropdownProps | SearchableDropdownProps[]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import TextField, { TextFieldProps } from '
|
|
3
|
+
import TextField, { TextFieldProps } from '../../../Field/Text'
|
|
4
4
|
|
|
5
5
|
const useTextField = (props: {
|
|
6
6
|
textfield?: TextFieldProps | TextFieldProps[]
|
|
@@ -5,7 +5,7 @@ import { Box, BoxProps } from '@mui/material'
|
|
|
5
5
|
import { TypographyProps } from '../Typography'
|
|
6
6
|
import { RadioGroupProps } from '../RadioGroup'
|
|
7
7
|
import { ConfirmationCodeInputsProps } from '../ConfirmationCodeInput'
|
|
8
|
-
import { TextFieldProps } from '../
|
|
8
|
+
import { TextFieldProps } from '../Field/Text'
|
|
9
9
|
import { CustomButtonProps } from '../Button'
|
|
10
10
|
import { ImageProps } from './Structure/image/useImage'
|
|
11
11
|
import { PricingProps } from '../PricingTable'
|
|
@@ -13,20 +13,26 @@ import { CustomStepperProps } from '../Stepper'
|
|
|
13
13
|
import { TransferListProps } from '../TransferList'
|
|
14
14
|
import { CardProps } from '../Card'
|
|
15
15
|
import { CodeCopyProps } from '../CodeCopy'
|
|
16
|
-
import { DateFieldProps } from '../
|
|
17
|
-
import { DropdownProps } from '../Dropdown'
|
|
18
|
-
import { IncrementNumberFieldProps } from '../
|
|
19
|
-
import { SearchbarProps } from '../
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
16
|
+
import { DateFieldProps } from '../Field/Date'
|
|
17
|
+
import { DropdownProps } from '../Field/Dropdown/Regular'
|
|
18
|
+
import { IncrementNumberFieldProps } from '../Field/Number/ExternalIncrement'
|
|
19
|
+
import { SearchbarProps } from '../Field/Search'
|
|
20
|
+
import { InternalIncrementNumberFieldProps } from '../Field/Number/InternalIncrement'
|
|
21
|
+
import { InternalIncrementNumberFieldProps as SubnetFieldProps } from '../Field/IPAM/Subnet'
|
|
22
|
+
import { InternalIncrementNumberFieldProps as SupernetFieldProps } from '../Field/IPAM/Subnet'
|
|
23
|
+
import { PasswordFieldProps } from '../Field/Password'
|
|
22
24
|
import { QRCodeProps } from '../QRCode'
|
|
23
25
|
import { ComplexTextEditorProps } from '../ComplexTextEditor'
|
|
24
|
-
import { SearchableDropdownProps } from '../
|
|
26
|
+
import { SearchableDropdownProps } from '../Field/Dropdown/Searchable'
|
|
25
27
|
import { AccordionProps } from '../Accordion'
|
|
26
28
|
import { ProjectBoardProps } from '../ProjectBoard/types'
|
|
27
|
-
import { MultiSelectChipProps } from '../MultiSelect'
|
|
29
|
+
import { MultiSelectChipProps } from '../Field/Dropdown/MultiSelect'
|
|
28
30
|
import { CheckboxProps } from '../Checkbox'
|
|
29
31
|
import { LinkProps } from './Structure/link/useLink'
|
|
32
|
+
import type { USDFieldProps } from './Structure/USD/useUSD'
|
|
33
|
+
import { CIDRFieldProps } from '../Field/IPAM/CIDR'
|
|
34
|
+
import { IPAddressFieldProps } from '../Field/IPAM/Address'
|
|
35
|
+
import { VLANFieldProps } from '../Field/IPAM/VLAN'
|
|
30
36
|
|
|
31
37
|
// Import hooks
|
|
32
38
|
import useTypography from './Structure/typography/useTypography'
|
|
@@ -55,6 +61,12 @@ import useSearchableDropdown from './Structure/searchableDropdown/useSearchableD
|
|
|
55
61
|
import useAccordion from './Structure/accordion/useAccordion'
|
|
56
62
|
import useProjectBoard from './Structure/projectboard/useProjectBoard'
|
|
57
63
|
import useMultiSelect from './Structure/multiSelect/useMultiSelect'
|
|
64
|
+
import useSubnet from './Structure/Subnet/useSubnet'
|
|
65
|
+
import useSupernet from './Structure/Supernet/useSupernet'
|
|
66
|
+
import useCIDR from './Structure/CIDR/useCIDR'
|
|
67
|
+
import useAddress from './Structure/Address/useAddress'
|
|
68
|
+
import useVLAN from './Structure/VLAN/useVLAN'
|
|
69
|
+
import useUSD from './Structure/USD/useUSD'
|
|
58
70
|
|
|
59
71
|
export interface ContentSectionProps {
|
|
60
72
|
grids: Array<{
|
|
@@ -83,12 +95,20 @@ export interface ContentSectionProps {
|
|
|
83
95
|
| IncrementNumberFieldProps
|
|
84
96
|
| IncrementNumberFieldProps[]
|
|
85
97
|
searchbar?: SearchbarProps | SearchbarProps[]
|
|
86
|
-
numberField?:
|
|
98
|
+
numberField?:
|
|
99
|
+
| InternalIncrementNumberFieldProps
|
|
100
|
+
| InternalIncrementNumberFieldProps[]
|
|
87
101
|
passwordField?: PasswordFieldProps | PasswordFieldProps[]
|
|
88
102
|
qrcode?: QRCodeProps | QRCodeProps[]
|
|
89
103
|
phoneNumberField?: TextFieldProps | TextFieldProps[]
|
|
90
104
|
checkbox?: CheckboxProps | CheckboxProps[]
|
|
91
105
|
multiSelect?: MultiSelectChipProps | MultiSelectChipProps[]
|
|
106
|
+
subnet?: SubnetFieldProps | SubnetFieldProps[]
|
|
107
|
+
supernet?: SupernetFieldProps | SupernetFieldProps[]
|
|
108
|
+
cidr?: CIDRFieldProps | CIDRFieldProps[]
|
|
109
|
+
address?: IPAddressFieldProps | IPAddressFieldProps[]
|
|
110
|
+
vlan?: VLANFieldProps | VLANFieldProps[]
|
|
111
|
+
usdField?: USDFieldProps | USDFieldProps[]
|
|
92
112
|
// Added optional style property for grid customization
|
|
93
113
|
style?: React.CSSProperties
|
|
94
114
|
}>
|
|
@@ -144,6 +164,12 @@ const RenderContent: React.FC<ContentSectionProps['grids'][0]> = ({
|
|
|
144
164
|
addElements(useNumberField({ numberField: props.numberField }))
|
|
145
165
|
addElements(usePasswordField({ passwordField: props.passwordField }))
|
|
146
166
|
addElements(useQRCode({ qrcode: props.qrcode }))
|
|
167
|
+
addElements(useSubnet({ subnet: props.subnet }))
|
|
168
|
+
addElements(useSupernet({ supernet: props.supernet }))
|
|
169
|
+
addElements(useCIDR({ cidr: props.cidr }))
|
|
170
|
+
addElements(useAddress({ address: props.address }))
|
|
171
|
+
addElements(useVLAN({ vlan: props.vlan }))
|
|
172
|
+
addElements(useUSD({ usdField: props.usdField }))
|
|
147
173
|
|
|
148
174
|
// Merge any style provided in boxProps with the grid's style property
|
|
149
175
|
const mergedStyle = { ...(boxProps?.style || {}), ...style }
|
|
@@ -4,7 +4,7 @@ import React from 'react'
|
|
|
4
4
|
import { Box, Popover, IconButton } from '@mui/material'
|
|
5
5
|
import { useManageColumn } from '../utils/useManageColumn'
|
|
6
6
|
import CustomButton from '../../Button'
|
|
7
|
-
import Searchbar from '../../
|
|
7
|
+
import Searchbar from '../../Field/Search'
|
|
8
8
|
import Checkbox from '../../Checkbox'
|
|
9
9
|
import ShowHideEyeIcon from '../../Icons/ShowHideEye'
|
|
10
10
|
import { ColumnDef } from '../types'
|
|
@@ -4,7 +4,7 @@ import React from 'react'
|
|
|
4
4
|
import { TableRow, TableCell, Checkbox } from '@mui/material'
|
|
5
5
|
import type { ColumnDef } from '../../types'
|
|
6
6
|
import { white } from '../../../../styles/palette'
|
|
7
|
-
import SearchableDropdown from '../../../
|
|
7
|
+
import SearchableDropdown from '../../../Field/Dropdown/Searchable'
|
|
8
8
|
|
|
9
9
|
interface ColumnHeaderRowProps {
|
|
10
10
|
isMobile: boolean
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import type { CustomButtonProps } from '../../Button'
|
|
5
|
-
import type { DropdownProps } from '../../Dropdown'
|
|
6
|
-
import type { SearchbarProps } from '../../
|
|
5
|
+
import type { DropdownProps } from '../../Field/Dropdown/Regular'
|
|
6
|
+
import type { SearchbarProps } from '../../Field/Search'
|
|
7
7
|
|
|
8
8
|
export interface ColumnDef {
|
|
9
9
|
field: string
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useMemo, useState, useEffect } from 'react'
|
|
4
4
|
import type { ColumnDef, RowData } from '../types'
|
|
5
|
-
import type { SearchbarProps } from '../../
|
|
5
|
+
import type { SearchbarProps } from '../../Field/Search'
|
|
6
6
|
import * as palette from '../../../styles/palette'
|
|
7
7
|
|
|
8
8
|
interface UseSearchbarProps {
|
|
@@ -3,7 +3,7 @@ import React, { useState, forwardRef } from 'react'
|
|
|
3
3
|
import DatePicker from 'react-datepicker'
|
|
4
4
|
import 'react-datepicker/dist/react-datepicker.css'
|
|
5
5
|
import CalendarTodayIcon from '@mui/icons-material/CalendarToday'
|
|
6
|
-
import TextField, { TextFieldProps } from '
|
|
6
|
+
import TextField, { TextFieldProps } from '../../Field/Text'
|
|
7
7
|
|
|
8
8
|
export interface DateFieldProps
|
|
9
9
|
extends Omit<TextFieldProps, 'onChange' | 'value' | 'endAdornment'> {
|
|
@@ -9,7 +9,7 @@ import { within, userEvent, expect } from '@storybook/test'
|
|
|
9
9
|
import MultipleSelectChip from './index'
|
|
10
10
|
|
|
11
11
|
const meta: Meta<typeof MultipleSelectChip> = {
|
|
12
|
-
title: 'Components/
|
|
12
|
+
title: 'Components/Field/Dropdown/MultiSelect',
|
|
13
13
|
component: MultipleSelectChip,
|
|
14
14
|
parameters: {
|
|
15
15
|
a11y: { disable: false },
|
|
@@ -8,7 +8,7 @@ import Dropdown from './index'
|
|
|
8
8
|
* Setup story metadata
|
|
9
9
|
*/
|
|
10
10
|
const meta: Meta<typeof Dropdown> = {
|
|
11
|
-
title: 'Components/Dropdown',
|
|
11
|
+
title: 'Components/Field/Dropdown/Regular',
|
|
12
12
|
component: Dropdown,
|
|
13
13
|
// Let Storybook build color pickers and other controls for these props
|
|
14
14
|
argTypes: {
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
OutlinedInput,
|
|
19
19
|
SelectChangeEvent,
|
|
20
20
|
} from '@mui/material'
|
|
21
|
-
import Typography from '
|
|
22
|
-
import { black, white } from '
|
|
21
|
+
import Typography from '../../../Typography'
|
|
22
|
+
import { black, white } from '../../../../styles/palette'
|
|
23
23
|
|
|
24
24
|
export interface SimpleDropdownOption {
|
|
25
25
|
value: string
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
FormControl,
|
|
10
10
|
} from '@mui/material'
|
|
11
11
|
import { styled } from '@mui/material/styles'
|
|
12
|
-
import { black, white } from '
|
|
13
|
-
import Typography from '
|
|
12
|
+
import { black, white } from '../../../../styles/palette'
|
|
13
|
+
import Typography from '../../../Typography'
|
|
14
14
|
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'
|
|
15
15
|
|
|
16
16
|
export interface DropdownOption {
|
|
@@ -20,7 +20,7 @@ const sampleOptions = [
|
|
|
20
20
|
* Storybook metadata
|
|
21
21
|
*/
|
|
22
22
|
const meta: Meta<typeof SearchableDropdown> = {
|
|
23
|
-
title: 'Components/
|
|
23
|
+
title: 'Components/Field/Dropdown/Searchable',
|
|
24
24
|
component: SearchableDropdown,
|
|
25
25
|
argTypes: {
|
|
26
26
|
backgroundcolor: { control: 'color' },
|