kahuna-base-react-components 0.2.7 → 0.2.8
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/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -32,14 +32,12 @@ export interface KDropdownProps {
|
|
|
32
32
|
textColor?: string
|
|
33
33
|
shadowDisabled?: boolean
|
|
34
34
|
menuBackground?: string
|
|
35
|
-
onInput?: (input: string) => void
|
|
36
35
|
padding?: string
|
|
37
36
|
gap?: string
|
|
38
37
|
hideChosenOptionIcon?: boolean
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
const KDropdown: React.FC<KDropdownProps> = (props) => {
|
|
42
|
-
const [options, setOptions] = useState(props.options)
|
|
43
41
|
const [selectedOption, setSelectedOption] = useState<KSelectOption | MultiValue<KSelectOption>>()
|
|
44
42
|
const [background, setBackground] = useState("#F5F5F5")
|
|
45
43
|
|
|
@@ -59,7 +57,7 @@ const KDropdown: React.FC<KDropdownProps> = (props) => {
|
|
|
59
57
|
const boxShadow = props.shadowDisabled ? "" : "0 0 0 1px rgba(17, 17, 17, 0.04), 0 1px 1px 0 rgba(17, 17, 17, 0.04)"
|
|
60
58
|
const menuBackground = props.menuBackground || "rgb(249, 249, 249)"
|
|
61
59
|
const padding = props.padding || "8px"
|
|
62
|
-
const gap = props.gap || "
|
|
60
|
+
const gap = props.gap || "4px"
|
|
63
61
|
const hideIcon = props.hideChosenOptionIcon || false
|
|
64
62
|
|
|
65
63
|
const getOptionLabels = (option: KSelectOption) => {
|
|
@@ -77,17 +75,6 @@ const KDropdown: React.FC<KDropdownProps> = (props) => {
|
|
|
77
75
|
)
|
|
78
76
|
}
|
|
79
77
|
|
|
80
|
-
const onInputChange = (input: string) => {
|
|
81
|
-
if (props.onInput) {
|
|
82
|
-
props.onInput(input)
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const filteredOptions =
|
|
87
|
-
props.options?.filter((option) => option.label.toLowerCase().includes(input.toLowerCase())) || []
|
|
88
|
-
setOptions([...filteredOptions])
|
|
89
|
-
}
|
|
90
|
-
|
|
91
78
|
return (
|
|
92
79
|
<div
|
|
93
80
|
className={"k-dropdown-container"}
|
|
@@ -100,8 +87,7 @@ const KDropdown: React.FC<KDropdownProps> = (props) => {
|
|
|
100
87
|
isMulti={isMulti}
|
|
101
88
|
name={props.label || ""}
|
|
102
89
|
placeholder={props.placeholder || ""}
|
|
103
|
-
options={options}
|
|
104
|
-
onInputChange={(input) => onInputChange(input)}
|
|
90
|
+
options={props.options}
|
|
105
91
|
className={"k-dropdown"}
|
|
106
92
|
styles={{
|
|
107
93
|
control: (baseStyles, state) => ({
|