@campxdev/shared 1.4.11 → 1.4.12

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": "@campxdev/shared",
3
- "version": "1.4.11",
3
+ "version": "1.4.12",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -10,19 +10,7 @@ import {
10
10
  import { ReactNode } from 'react'
11
11
  import { BpCheckedIcon, BpIcon } from './SingleCheckbox'
12
12
  import TextField from './TextField'
13
-
14
- interface MultiSelectProps {
15
- label: ReactNode
16
- name?: string
17
- options: { label: string | ReactNode; value: any }[]
18
- placeholder?: string
19
- loading?: boolean
20
- value: { label: string | ReactNode; value: any }[]
21
- onChange: (value: any) => void
22
- required?: boolean
23
- error?: boolean
24
- helperText?: string
25
- }
13
+ import { IOption } from './types'
26
14
 
27
15
  const StyledAutocomplete = styled(Autocomplete)(({ theme }) => ({
28
16
  '& .MuiAutocomplete-tag': {
@@ -48,7 +36,6 @@ const StyledPopper = styled(Popper)(({ theme }) => ({
48
36
  borderTopRightRadius: 0,
49
37
  borderTopLeftRadius: 0,
50
38
  boxShadow: '0px 4px 16px #0000000F',
51
- maxHeight: 360,
52
39
  marginTop: '1px',
53
40
  '& .MuiAutocomplete-listbox': {
54
41
  minWidth: '240px',
@@ -81,6 +68,20 @@ const StyledPopper = styled(Popper)(({ theme }) => ({
81
68
  },
82
69
  }))
83
70
 
71
+ interface MultiSelectProps {
72
+ label: ReactNode
73
+ name?: string
74
+ options: IOption[]
75
+ placeholder?: string
76
+ loading?: boolean
77
+ value: IOption[] | IOption
78
+ onChange: (value: IOption[] | IOption) => void
79
+ required?: boolean
80
+ error?: boolean
81
+ helperText?: string
82
+ multiple?: boolean
83
+ }
84
+
84
85
  export default function MultiSelect({
85
86
  name,
86
87
  options,
@@ -91,22 +92,23 @@ export default function MultiSelect({
91
92
  required,
92
93
  error,
93
94
  helperText,
95
+ multiple,
94
96
  ...props
95
97
  }: MultiSelectProps) {
96
98
  return (
97
99
  <StyledAutocomplete
98
- multiple
100
+ multiple={multiple}
99
101
  value={value}
100
102
  loading={loading}
101
103
  fullWidth
102
104
  getOptionLabel={(option: any) => option?.label || ''}
103
105
  options={options || []}
104
- onChange={(e, value) => {
106
+ onChange={(e, value: any) => {
105
107
  if (!onChange) return
106
108
  onChange(value)
107
109
  }}
108
110
  isOptionEqualToValue={(option: any, value: any) =>
109
- option.value === value.value
111
+ option?.value === value?.value
110
112
  }
111
113
  disableCloseOnSelect
112
114
  PopperComponent={StyledPopper}