@bolttech/molecules-dropdown 0.22.0 → 0.22.1
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/index.cjs
CHANGED
|
@@ -2459,9 +2459,11 @@ const ReusableDropdownComponent = _a => {
|
|
|
2459
2459
|
inputRef,
|
|
2460
2460
|
placeholder,
|
|
2461
2461
|
onBlur,
|
|
2462
|
-
onFocus
|
|
2462
|
+
onFocus,
|
|
2463
|
+
onKeyUp,
|
|
2464
|
+
onKeyDown
|
|
2463
2465
|
} = _a,
|
|
2464
|
-
props = __rest(_a, ["id", "dataTestId", "label", "variant", "required", "inputValue", "inputLabel", "disabled", "errorMessage", "onChangeInputValue", "onChangeInputLabel", "setShowSelectComponent", "showSelectComponent", "setSelectedOptionOnInputValue", "disableSearch", "inputRef", "placeholder", "onBlur", "onFocus"]);
|
|
2466
|
+
props = __rest(_a, ["id", "dataTestId", "label", "variant", "required", "inputValue", "inputLabel", "disabled", "errorMessage", "onChangeInputValue", "onChangeInputLabel", "setShowSelectComponent", "showSelectComponent", "setSelectedOptionOnInputValue", "disableSearch", "inputRef", "placeholder", "onBlur", "onFocus", "onKeyUp", "onKeyDown"]);
|
|
2465
2467
|
const hasError = !!errorMessage;
|
|
2466
2468
|
// we have to type cast because of jest. when testing it sets the type of useTheme to DefaultTheme
|
|
2467
2469
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
@@ -2516,8 +2518,10 @@ const ReusableDropdownComponent = _a => {
|
|
|
2516
2518
|
setSelectedOptionOnInputValue();
|
|
2517
2519
|
setShowSelectComponent(false);
|
|
2518
2520
|
onBlur && onBlur(event);
|
|
2519
|
-
}
|
|
2520
|
-
|
|
2521
|
+
},
|
|
2522
|
+
onKeyUp: onKeyUp,
|
|
2523
|
+
onKeyDown: onKeyDown
|
|
2524
|
+
}, uiUtils.applyDataAttributes(props, 'input')))
|
|
2521
2525
|
})]
|
|
2522
2526
|
}), jsxRuntime.jsx(ClickableElement, {
|
|
2523
2527
|
onClick: () => {
|
|
@@ -2682,9 +2686,11 @@ const Dropdown = /*#__PURE__*/react.forwardRef((_a, ref) => {
|
|
|
2682
2686
|
onChange,
|
|
2683
2687
|
onBlur,
|
|
2684
2688
|
onFocus,
|
|
2685
|
-
placeholder
|
|
2689
|
+
placeholder,
|
|
2690
|
+
onKeyUp,
|
|
2691
|
+
onKeyDown
|
|
2686
2692
|
} = _a,
|
|
2687
|
-
props = __rest(_a, ["label", "variant", "required", "optionList", "disabled", "errorMessage", "urlFilterOptions", "id", "dataTestId", "filterOptionsParam", "value", "onChange", "onBlur", "onFocus", "placeholder"]);
|
|
2693
|
+
props = __rest(_a, ["label", "variant", "required", "optionList", "disabled", "errorMessage", "urlFilterOptions", "id", "dataTestId", "filterOptionsParam", "value", "onChange", "onBlur", "onFocus", "placeholder", "onKeyUp", "onKeyDown"]);
|
|
2688
2694
|
const [isFirstRender, setIsFirstRender] = react.useState(true);
|
|
2689
2695
|
const [showSelectComponent, setShowSelectComponent] = react.useState(false);
|
|
2690
2696
|
const [currentOptionList, setCurrentOptionList] = react.useState([]);
|
|
@@ -2764,7 +2770,9 @@ const Dropdown = /*#__PURE__*/react.forwardRef((_a, ref) => {
|
|
|
2764
2770
|
setSelectedOptionOnInputValue: setSelectedOptionOnInputValue,
|
|
2765
2771
|
onChangeInputLabel: setInputLabel,
|
|
2766
2772
|
onBlur: onBlur,
|
|
2767
|
-
onFocus: onFocus
|
|
2773
|
+
onFocus: onFocus,
|
|
2774
|
+
onKeyUp: onKeyUp,
|
|
2775
|
+
onKeyDown: onKeyDown
|
|
2768
2776
|
}, props)), showSelectComponent && !disabled && jsxRuntime.jsx(DropdownOptionsContainer, {
|
|
2769
2777
|
children: jsxRuntime.jsx(atomsSelect.Select, Object.assign({
|
|
2770
2778
|
id: `${id}-select`,
|
|
@@ -2801,9 +2809,11 @@ const DropdownWithHeaders = /*#__PURE__*/react.forwardRef((_a, ref) => {
|
|
|
2801
2809
|
onChange,
|
|
2802
2810
|
onBlur,
|
|
2803
2811
|
onFocus,
|
|
2804
|
-
placeholder
|
|
2812
|
+
placeholder,
|
|
2813
|
+
onKeyUp,
|
|
2814
|
+
onKeyDown
|
|
2805
2815
|
} = _a,
|
|
2806
|
-
props = __rest(_a, ["label", "variant", "required", "optionList", "disabled", "errorMessage", "urlFilterOptions", "dataTestId", "filterOptionsParam", "value", "onChange", "onBlur", "onFocus", "placeholder"]);
|
|
2816
|
+
props = __rest(_a, ["label", "variant", "required", "optionList", "disabled", "errorMessage", "urlFilterOptions", "dataTestId", "filterOptionsParam", "value", "onChange", "onBlur", "onFocus", "placeholder", "onKeyUp", "onKeyDown"]);
|
|
2807
2817
|
const [isFirstRender, setIsFirstRender] = react.useState(true);
|
|
2808
2818
|
const [showSelectComponent, setShowSelectComponent] = react.useState(false);
|
|
2809
2819
|
const [currentOptionList, setCurrentOptionList] = react.useState([]);
|
|
@@ -2885,7 +2895,9 @@ const DropdownWithHeaders = /*#__PURE__*/react.forwardRef((_a, ref) => {
|
|
|
2885
2895
|
onChangeInputLabel: setInputLabel,
|
|
2886
2896
|
setSelectedOptionOnInputValue: setSelectedOptionOnInputValue,
|
|
2887
2897
|
onBlur: onBlur,
|
|
2888
|
-
onFocus: onFocus
|
|
2898
|
+
onFocus: onFocus,
|
|
2899
|
+
onKeyUp: onKeyUp,
|
|
2900
|
+
onKeyDown: onKeyDown
|
|
2889
2901
|
}, props)), showSelectComponent && !disabled && jsxRuntime.jsx(DropdownOptionsContainer, {
|
|
2890
2902
|
children: jsxRuntime.jsx(atomsSelect.SelectWithHeaders, Object.assign({
|
|
2891
2903
|
dataTestId: `${dataTestId}-select`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { OptionWithHeaderType, OptionType } from '@bolttech/atoms-select';
|
|
3
|
-
export declare const DropdownWithHeaders: import("react").ForwardRefExoticComponent<
|
|
3
|
+
export declare const DropdownWithHeaders: import("react").ForwardRefExoticComponent<Pick<import("react").DOMAttributes<HTMLInputElement>, "onKeyUp" | "onKeyDown"> & import("@bolttech/ui-utils").DefaultProps & {
|
|
4
4
|
label: string;
|
|
5
5
|
placeholder?: string | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { OptionType } from '@bolttech/atoms-select';
|
|
3
|
-
export declare const Dropdown: import("react").ForwardRefExoticComponent<
|
|
3
|
+
export declare const Dropdown: import("react").ForwardRefExoticComponent<Pick<import("react").DOMAttributes<HTMLInputElement>, "onKeyUp" | "onKeyDown"> & import("@bolttech/ui-utils").DefaultProps & {
|
|
4
4
|
label: string;
|
|
5
5
|
placeholder?: string | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
@@ -40,7 +40,7 @@ type DefaultDropdownProps = {
|
|
|
40
40
|
@property setSelectedOption - A function to set the selected option
|
|
41
41
|
@property selectedOption - An optional object representing the currently selected option
|
|
42
42
|
*/
|
|
43
|
-
export type DropdownProps =
|
|
43
|
+
export type DropdownProps = Pick<DOMAttributes<HTMLInputElement>, 'onKeyUp' | 'onKeyDown'> & DefaultProps & DefaultDropdownProps & {
|
|
44
44
|
optionList?: OptionType[];
|
|
45
45
|
/**
|
|
46
46
|
* An optional function that filters the option list based on input value
|
|
@@ -100,7 +100,7 @@ export type DropdownProps = Omit<DOMAttributes<HTMLInputElement>, 'children' | '
|
|
|
100
100
|
@property setSelectedOption - A function to set the selected option
|
|
101
101
|
@property selectedOption - An optional object representing the currently selected option
|
|
102
102
|
*/
|
|
103
|
-
export type DropdownWithHeadersProps =
|
|
103
|
+
export type DropdownWithHeadersProps = Pick<DOMAttributes<HTMLInputElement>, 'onKeyUp' | 'onKeyDown'> & DefaultProps & DefaultDropdownProps & {
|
|
104
104
|
optionList?: OptionWithHeaderType[];
|
|
105
105
|
/**
|
|
106
106
|
* An optional function that filters the option list based on input value
|
|
@@ -170,7 +170,7 @@ export type DropdownWithHeadersProps = Omit<DOMAttributes<HTMLInputElement>, 'ch
|
|
|
170
170
|
@property setSelectedOptionOnInputValue - A function to set the selected option based on the input value
|
|
171
171
|
@property inputRef - A ref to the input element of the dropdown
|
|
172
172
|
*/
|
|
173
|
-
export type ReusableDropdownComponentProps = DefaultProps &
|
|
173
|
+
export type ReusableDropdownComponentProps = DefaultProps & Pick<DOMAttributes<HTMLInputElement>, 'onKeyUp' | 'onKeyDown'> & DefaultDropdownProps & {
|
|
174
174
|
setShowSelectComponent: React.Dispatch<React.SetStateAction<boolean>>;
|
|
175
175
|
showSelectComponent: boolean;
|
|
176
176
|
onChangeInputValue: React.Dispatch<React.SetStateAction<string>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ReusableDropdownComponentProps } from './molecules-dropdown.type';
|
|
2
|
-
export declare const ReusableDropdownComponent: ({ id, dataTestId, label, variant, required, inputValue, inputLabel, disabled, errorMessage, onChangeInputValue, onChangeInputLabel, setShowSelectComponent, showSelectComponent, setSelectedOptionOnInputValue, disableSearch, inputRef, placeholder, onBlur, onFocus, ...props }: ReusableDropdownComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const ReusableDropdownComponent: ({ id, dataTestId, label, variant, required, inputValue, inputLabel, disabled, errorMessage, onChangeInputValue, onChangeInputLabel, setShowSelectComponent, showSelectComponent, setSelectedOptionOnInputValue, disableSearch, inputRef, placeholder, onBlur, onFocus, onKeyUp, onKeyDown, ...props }: ReusableDropdownComponentProps) => import("react/jsx-runtime").JSX.Element;
|