@thecb/components 11.6.3 → 11.6.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/dist/index.cjs.js +3 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +55 -1
- package/dist/index.esm.js +3 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +3 -2
- package/src/components/atoms/dropdown/index.d.ts +59 -0
- package/src/components/atoms/index.d.ts +1 -0
package/package.json
CHANGED
|
@@ -135,7 +135,8 @@ const Dropdown = ({
|
|
|
135
135
|
autocompleteValue, // browser autofill value, like country-name
|
|
136
136
|
smoothScroll = true,
|
|
137
137
|
ariaInvalid = false,
|
|
138
|
-
isRequired = false
|
|
138
|
+
isRequired = false,
|
|
139
|
+
extraStyles
|
|
139
140
|
}) => {
|
|
140
141
|
const [inputValue, setInputValue] = useState("");
|
|
141
142
|
const [optionsState, setOptionsState] = useState([]);
|
|
@@ -316,7 +317,7 @@ const Dropdown = ({
|
|
|
316
317
|
<Box
|
|
317
318
|
padding="0"
|
|
318
319
|
background={isOpen ? themeValues.hoverColor : WHITE}
|
|
319
|
-
extraStyles={`position: relative
|
|
320
|
+
extraStyles={`position: relative;${extraStyles ? ` ${extraStyles}` : ""}`}
|
|
320
321
|
minWidth="100%"
|
|
321
322
|
onClick={() => {
|
|
322
323
|
if (!isOpen) {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Expand from "../../../util/expand";
|
|
3
|
+
import { FormSelectOption } from "../../../types/common";
|
|
4
|
+
|
|
5
|
+
export interface DropdownThemeValues {
|
|
6
|
+
selectedColor?: string;
|
|
7
|
+
hoverColor?: string;
|
|
8
|
+
focusColor?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface DropdownProps {
|
|
12
|
+
/** Placeholder text displayed when no value is selected */
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
/** Array of options to display in the dropdown */
|
|
15
|
+
options: FormSelectOption[];
|
|
16
|
+
/** Currently selected value */
|
|
17
|
+
value?: string;
|
|
18
|
+
/** Whether the dropdown is currently open */
|
|
19
|
+
isOpen?: boolean;
|
|
20
|
+
/** Whether the dropdown is in an error state */
|
|
21
|
+
isError?: boolean;
|
|
22
|
+
/** Callback fired when an option is selected */
|
|
23
|
+
onSelect: (value: string) => void;
|
|
24
|
+
/** Array of values that should be disabled */
|
|
25
|
+
disabledValues?: string[];
|
|
26
|
+
/** Callback fired when the dropdown is clicked */
|
|
27
|
+
onClick?: () => void;
|
|
28
|
+
/** Theme values for styling the dropdown */
|
|
29
|
+
themeValues?: DropdownThemeValues;
|
|
30
|
+
/** Maximum height of the dropdown content */
|
|
31
|
+
maxHeight?: string;
|
|
32
|
+
/** Whether the dropdown width should fit its content */
|
|
33
|
+
widthFitOptions?: boolean;
|
|
34
|
+
/** Whether the dropdown is disabled */
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/** Whether to show title attributes on options */
|
|
37
|
+
hasTitles?: boolean;
|
|
38
|
+
/** Whether to auto-erase type-ahead input after timeout */
|
|
39
|
+
autoEraseTypeAhead?: boolean;
|
|
40
|
+
/** ID of the element that labels this dropdown */
|
|
41
|
+
ariaLabelledby?: string;
|
|
42
|
+
/** ID of the element that describes this dropdown */
|
|
43
|
+
ariaDescribedby?: string;
|
|
44
|
+
/** Autocomplete attribute value for browser autofill */
|
|
45
|
+
autocompleteValue?: string;
|
|
46
|
+
/** Whether to use smooth scrolling when scrolling to selected item */
|
|
47
|
+
smoothScroll?: boolean;
|
|
48
|
+
/** Whether the dropdown has an invalid value */
|
|
49
|
+
ariaInvalid?: boolean;
|
|
50
|
+
/** Whether the dropdown is required */
|
|
51
|
+
isRequired?: boolean;
|
|
52
|
+
/** Custom CSS styles */
|
|
53
|
+
extraStyles?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const Dropdown: React.FC<Expand<DropdownProps> &
|
|
57
|
+
Omit<React.HTMLAttributes<HTMLElement>, "onSelect">>;
|
|
58
|
+
|
|
59
|
+
export default Dropdown;
|