@datarobot/design-system 29.0.0 → 29.1.0
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/cjs/typeahead/typeahead.d.ts +6 -1
- package/cjs/typeahead/typeahead.js +3 -2
- package/esm/typeahead/typeahead.d.ts +6 -1
- package/esm/typeahead/typeahead.js +3 -2
- package/js/bundle/bundle.js +4 -2
- package/js/bundle/bundle.min.js +1 -1
- package/js/bundle/index.d.ts +6 -1
- package/package.json +1 -1
|
@@ -76,11 +76,16 @@ export type TypeaheadProps = {
|
|
|
76
76
|
optionalLabelText?: string;
|
|
77
77
|
autoFocus?: boolean;
|
|
78
78
|
noItemsText?: string;
|
|
79
|
+
/**
|
|
80
|
+
* By default, on select won't be invoked if the label of selected option is the same as defaultValue
|
|
81
|
+
* but there are cases when we do want to call it anyway. In that cases this prop should be set to true
|
|
82
|
+
*/
|
|
83
|
+
shouldCallOnSelectWithOldValue?: boolean;
|
|
79
84
|
};
|
|
80
85
|
/** Searchable select
|
|
81
86
|
* [CAPITALIZATION] Use sentence case for options, label, and input text. Do not end with ellipses (...).
|
|
82
87
|
* @midnight-gray-supported
|
|
83
88
|
* @alpine-light-supported
|
|
84
89
|
*/
|
|
85
|
-
declare function Typeahead({ defaultValue, onSearch, optionComponent, OptionList, onBlur, onKeyDown, onClear, onSelect, onDelete, searchFields, placement, options, items, optionId, optionLabel, isMultiSelect, focused, isTouched, forceShowAllOnFocus, showAllOnFocus, isDisabled, disabledInfo, isRequired, isOptional, isClearable, optionalLabelText, handleFocus, placeholder, containerRef, inputRef: inputRefProp, helperTextPosition, testId, id, label, labelTestId, ariaLabel, validity, validationTestId, asyncValidation, labelIcon, labelIconTooltipText, labelIconTestId, dropdownContentClass, wrapperClass, fieldClass, helperText, autoComplete, keepInvalidText, formatSearchValue, className, autoFocus, noItemsText, }: TypeaheadProps): import("react/jsx-runtime").JSX.Element;
|
|
90
|
+
declare function Typeahead({ defaultValue, onSearch, optionComponent, OptionList, onBlur, onKeyDown, onClear, onSelect, onDelete, searchFields, placement, options, items, optionId, optionLabel, isMultiSelect, focused, isTouched, forceShowAllOnFocus, showAllOnFocus, isDisabled, disabledInfo, isRequired, isOptional, isClearable, optionalLabelText, handleFocus, placeholder, containerRef, inputRef: inputRefProp, helperTextPosition, testId, id, label, labelTestId, ariaLabel, validity, validationTestId, asyncValidation, labelIcon, labelIconTooltipText, labelIconTestId, dropdownContentClass, wrapperClass, fieldClass, helperText, autoComplete, keepInvalidText, formatSearchValue, className, autoFocus, noItemsText, shouldCallOnSelectWithOldValue, }: TypeaheadProps): import("react/jsx-runtime").JSX.Element;
|
|
86
91
|
export default Typeahead;
|
|
@@ -80,7 +80,8 @@ function Typeahead({
|
|
|
80
80
|
formatSearchValue,
|
|
81
81
|
className,
|
|
82
82
|
autoFocus = false,
|
|
83
|
-
noItemsText
|
|
83
|
+
noItemsText,
|
|
84
|
+
shouldCallOnSelectWithOldValue = false
|
|
84
85
|
}) {
|
|
85
86
|
const {
|
|
86
87
|
t
|
|
@@ -125,7 +126,7 @@ function Typeahead({
|
|
|
125
126
|
}
|
|
126
127
|
if (isMultiSelect) {
|
|
127
128
|
onSelect(option);
|
|
128
|
-
} else if (String(option?.[optionLabel]) !== defaultValue) {
|
|
129
|
+
} else if (String(option?.[optionLabel]) !== defaultValue || shouldCallOnSelectWithOldValue) {
|
|
129
130
|
onSelect(option);
|
|
130
131
|
}
|
|
131
132
|
setIsTouched(true);
|
|
@@ -76,11 +76,16 @@ export type TypeaheadProps = {
|
|
|
76
76
|
optionalLabelText?: string;
|
|
77
77
|
autoFocus?: boolean;
|
|
78
78
|
noItemsText?: string;
|
|
79
|
+
/**
|
|
80
|
+
* By default, on select won't be invoked if the label of selected option is the same as defaultValue
|
|
81
|
+
* but there are cases when we do want to call it anyway. In that cases this prop should be set to true
|
|
82
|
+
*/
|
|
83
|
+
shouldCallOnSelectWithOldValue?: boolean;
|
|
79
84
|
};
|
|
80
85
|
/** Searchable select
|
|
81
86
|
* [CAPITALIZATION] Use sentence case for options, label, and input text. Do not end with ellipses (...).
|
|
82
87
|
* @midnight-gray-supported
|
|
83
88
|
* @alpine-light-supported
|
|
84
89
|
*/
|
|
85
|
-
declare function Typeahead({ defaultValue, onSearch, optionComponent, OptionList, onBlur, onKeyDown, onClear, onSelect, onDelete, searchFields, placement, options, items, optionId, optionLabel, isMultiSelect, focused, isTouched, forceShowAllOnFocus, showAllOnFocus, isDisabled, disabledInfo, isRequired, isOptional, isClearable, optionalLabelText, handleFocus, placeholder, containerRef, inputRef: inputRefProp, helperTextPosition, testId, id, label, labelTestId, ariaLabel, validity, validationTestId, asyncValidation, labelIcon, labelIconTooltipText, labelIconTestId, dropdownContentClass, wrapperClass, fieldClass, helperText, autoComplete, keepInvalidText, formatSearchValue, className, autoFocus, noItemsText, }: TypeaheadProps): import("react/jsx-runtime").JSX.Element;
|
|
90
|
+
declare function Typeahead({ defaultValue, onSearch, optionComponent, OptionList, onBlur, onKeyDown, onClear, onSelect, onDelete, searchFields, placement, options, items, optionId, optionLabel, isMultiSelect, focused, isTouched, forceShowAllOnFocus, showAllOnFocus, isDisabled, disabledInfo, isRequired, isOptional, isClearable, optionalLabelText, handleFocus, placeholder, containerRef, inputRef: inputRefProp, helperTextPosition, testId, id, label, labelTestId, ariaLabel, validity, validationTestId, asyncValidation, labelIcon, labelIconTooltipText, labelIconTestId, dropdownContentClass, wrapperClass, fieldClass, helperText, autoComplete, keepInvalidText, formatSearchValue, className, autoFocus, noItemsText, shouldCallOnSelectWithOldValue, }: TypeaheadProps): import("react/jsx-runtime").JSX.Element;
|
|
86
91
|
export default Typeahead;
|
|
@@ -72,7 +72,8 @@ function Typeahead({
|
|
|
72
72
|
formatSearchValue,
|
|
73
73
|
className,
|
|
74
74
|
autoFocus = false,
|
|
75
|
-
noItemsText
|
|
75
|
+
noItemsText,
|
|
76
|
+
shouldCallOnSelectWithOldValue = false
|
|
76
77
|
}) {
|
|
77
78
|
const {
|
|
78
79
|
t
|
|
@@ -117,7 +118,7 @@ function Typeahead({
|
|
|
117
118
|
}
|
|
118
119
|
if (isMultiSelect) {
|
|
119
120
|
onSelect(option);
|
|
120
|
-
} else if (String(option?.[optionLabel]) !== defaultValue) {
|
|
121
|
+
} else if (String(option?.[optionLabel]) !== defaultValue || shouldCallOnSelectWithOldValue) {
|
|
121
122
|
onSelect(option);
|
|
122
123
|
}
|
|
123
124
|
setIsTouched(true);
|
package/js/bundle/bundle.js
CHANGED
|
@@ -86219,7 +86219,9 @@ function Typeahead(_ref) {
|
|
|
86219
86219
|
className = _ref.className,
|
|
86220
86220
|
_ref$autoFocus = _ref.autoFocus,
|
|
86221
86221
|
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
|
|
86222
|
-
noItemsText = _ref.noItemsText
|
|
86222
|
+
noItemsText = _ref.noItemsText,
|
|
86223
|
+
_ref$shouldCallOnSele = _ref.shouldCallOnSelectWithOldValue,
|
|
86224
|
+
shouldCallOnSelectWithOldValue = _ref$shouldCallOnSele === void 0 ? false : _ref$shouldCallOnSele;
|
|
86223
86225
|
var _useTranslation = (0,_hooks_use_translation__WEBPACK_IMPORTED_MODULE_10__.useTranslation)(),
|
|
86224
86226
|
t = _useTranslation.t;
|
|
86225
86227
|
var listId = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
|
|
@@ -86290,7 +86292,7 @@ function Typeahead(_ref) {
|
|
|
86290
86292
|
}
|
|
86291
86293
|
if (isMultiSelect) {
|
|
86292
86294
|
onSelect(option);
|
|
86293
|
-
} else if (String(option === null || option === void 0 ? void 0 : option[optionLabel]) !== defaultValue) {
|
|
86295
|
+
} else if (String(option === null || option === void 0 ? void 0 : option[optionLabel]) !== defaultValue || shouldCallOnSelectWithOldValue) {
|
|
86294
86296
|
onSelect(option);
|
|
86295
86297
|
}
|
|
86296
86298
|
setIsTouched(true);
|