@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "11.6.3",
3
+ "version": "11.6.4",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -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;
@@ -3,6 +3,7 @@ export * from "./badge";
3
3
  export * from "./button-with-action";
4
4
  export * from "./button-with-link";
5
5
  export * from "./card";
6
+ export * from "./dropdown";
6
7
  export * from "./sortable-table-heading";
7
8
  export * from "./form-layouts";
8
9
  export * from "./form-select";