@react-md/autocomplete
Advanced tools
Comparing version 5.0.0 to 5.1.0
@@ -6,2 +6,14 @@ # Change Log | ||
# [5.1.0](https://github.com/mlaursen/react-md/compare/v5.0.0...v5.1.0) (2022-03-18) | ||
### Other Internal Changes | ||
* run lint-scripts --fix for consistent-type-imports ([42d839d](https://github.com/mlaursen/react-md/commit/42d839d359922e0a8ee3775a75162b9755a2c2b6)) | ||
# [5.0.0](https://github.com/mlaursen/react-md/compare/v4.0.3...v5.0.0) (2022-01-31) | ||
@@ -8,0 +20,0 @@ |
@@ -51,3 +51,3 @@ var __assign = (this && this.__assign) || function () { | ||
import cn from "classnames"; | ||
import { isListboxOptionProps, Option, TextField, } from "@react-md/form"; | ||
import { isListboxOptionProps, Option, TextField } from "@react-md/form"; | ||
import { List } from "@react-md/list"; | ||
@@ -112,3 +112,3 @@ import { ScaleTransition } from "@react-md/transition"; | ||
}), ref = _3.ref, match = _3.match, value = _3.value, visible = _3.visible, activeId = _3.activeId, itemRefs = _3.itemRefs, filteredData = _3.filteredData, listboxRef = _3.listboxRef, fixedStyle = _3.fixedStyle, transitionHooks = _3.transitionHooks, handleBlur = _3.handleBlur, handleFocus = _3.handleFocus, handleClick = _3.handleClick, handleChange = _3.handleChange, handleKeyDown = _3.handleKeyDown, handleAutoComplete = _3.handleAutoComplete; | ||
return (_jsxs(_Fragment, { children: [_jsx(TextField, __assign({}, props, { "aria-autocomplete": autoComplete, "aria-controls": comboboxId, "aria-activedescendant": activeId, autoComplete: "off", value: propValue !== null && propValue !== void 0 ? propValue : match, onBlur: handleBlur, onFocus: handleFocus, onClick: handleClick, onKeyDown: handleKeyDown, onChange: handleChange, ref: ref, className: cn(block(), className), containerProps: __assign(__assign({}, containerProps), { "aria-haspopup": "listbox", "aria-owns": suggestionsId, "aria-expanded": visible, id: comboboxId, role: "combobox" }) }), void 0), _jsx(ScaleTransition, __assign({ nodeRef: listboxRef, portal: portal, portalInto: portalInto, portalIntoId: portalIntoId, vertical: true, transitionIn: visible }, transitionHooks, { className: cn(listbox({ temporary: true }), listboxClassName) }, { children: _jsxs(List, __assign({ id: suggestionsId, role: "listbox", style: fixedStyle }, { children: [beforeResultsChildren, filteredData.map(function (datum, i) { | ||
return (_jsxs(_Fragment, { children: [_jsx(TextField, __assign({}, props, { "aria-autocomplete": autoComplete, "aria-controls": comboboxId, "aria-activedescendant": activeId, autoComplete: "off", value: propValue !== null && propValue !== void 0 ? propValue : match, onBlur: handleBlur, onFocus: handleFocus, onClick: handleClick, onKeyDown: handleKeyDown, onChange: handleChange, ref: ref, className: cn(block(), className), containerProps: __assign(__assign({}, containerProps), { "aria-haspopup": "listbox", "aria-owns": suggestionsId, "aria-expanded": visible, id: comboboxId, role: "combobox" }) })), _jsx(ScaleTransition, __assign({ nodeRef: listboxRef, portal: portal, portalInto: portalInto, portalIntoId: portalIntoId, vertical: true, transitionIn: visible }, transitionHooks, { className: cn(listbox({ temporary: true }), listboxClassName) }, { children: _jsxs(List, __assign({ id: suggestionsId, role: "listbox", style: fixedStyle }, { children: [beforeResultsChildren, filteredData.map(function (datum, i) { | ||
var resultId = getResultId(suggestionsId, i); | ||
@@ -119,5 +119,5 @@ var optionProps; | ||
} | ||
return (_jsx(Option, __assign({}, optionProps, { id: resultId, selected: false, focused: resultId === activeId, ref: itemRefs[i], onClick: function () { return handleAutoComplete(i); } }, { children: _jsx(HighlightedResult, __assign({ id: "".concat(resultId, "-match"), style: highlightStyle, className: highlightClassName, value: propValue !== null && propValue !== void 0 ? propValue : value, enabled: highlight, repeatable: highlightReapeating }, { children: getResultLabel(datum, labelKey, value) }), void 0) }), resultId)); | ||
}), afterResultsChildren] }), void 0) }), void 0)] }, void 0)); | ||
return (_jsx(Option, __assign({}, optionProps, { id: resultId, selected: false, focused: resultId === activeId, ref: itemRefs[i], onClick: function () { return handleAutoComplete(i); } }, { children: _jsx(HighlightedResult, __assign({ id: "".concat(resultId, "-match"), style: highlightStyle, className: highlightClassName, value: propValue !== null && propValue !== void 0 ? propValue : value, enabled: highlight, repeatable: highlightReapeating }, { children: getResultLabel(datum, labelKey, value) })) }), resultId)); | ||
}), afterResultsChildren] })) }))] })); | ||
}); | ||
//# sourceMappingURL=AutoComplete.js.map |
@@ -21,7 +21,7 @@ var __assign = (this && this.__assign) || function () { | ||
if (!enabled || !value || typeof children !== "string") { | ||
return _jsx(_Fragment, { children: children }, void 0); | ||
return _jsx(_Fragment, { children: children }); | ||
} | ||
var i = children.toLowerCase().indexOf(value.toLowerCase()); | ||
if (i === -1) { | ||
return _jsx(_Fragment, { children: children }, void 0); | ||
return _jsx(_Fragment, { children: children }); | ||
} | ||
@@ -33,4 +33,4 @@ var end = i + value.length; | ||
} | ||
return (_jsxs(_Fragment, { children: [i > 0 && children.substring(0, i), _jsx("span", __assign({ id: id, style: style, className: cn("rmd-typography--bold", className) }, { children: children.substring(i, end) }), void 0), end < children.length && (_jsx(HighlightedResult, __assign({ style: style, className: className, value: value, enabled: enabled && repeatable, repeatable: repeatable, index: index + 1 }, { children: children.substring(end) }), void 0))] }, void 0)); | ||
return (_jsxs(_Fragment, { children: [i > 0 && children.substring(0, i), _jsx("span", __assign({ id: id, style: style, className: cn("rmd-typography--bold", className) }, { children: children.substring(i, end) })), end < children.length && (_jsx(HighlightedResult, __assign({ style: style, className: className, value: value, enabled: enabled && repeatable, repeatable: repeatable, index: index + 1 }, { children: children.substring(end) })))] })); | ||
} | ||
//# sourceMappingURL=HighlightedResult.js.map |
@@ -28,4 +28,4 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
import { useCallback, useEffect, useRef, useState, } from "react"; | ||
import { useFixedPositioning, } from "@react-md/transition"; | ||
import { useCallback, useEffect, useRef, useState } from "react"; | ||
import { useFixedPositioning } from "@react-md/transition"; | ||
import { MovementPresets, scrollIntoView, useActiveDescendantMovement, useCloseOnOutsideClick, useEnsuredRef, useIsUserInteractionMode, useToggle, } from "@react-md/utils"; | ||
@@ -32,0 +32,0 @@ import { getFilterFunction } from "./utils"; |
@@ -117,3 +117,3 @@ "use strict"; | ||
}), ref = _3.ref, match = _3.match, value = _3.value, visible = _3.visible, activeId = _3.activeId, itemRefs = _3.itemRefs, filteredData = _3.filteredData, listboxRef = _3.listboxRef, fixedStyle = _3.fixedStyle, transitionHooks = _3.transitionHooks, handleBlur = _3.handleBlur, handleFocus = _3.handleFocus, handleClick = _3.handleClick, handleChange = _3.handleChange, handleKeyDown = _3.handleKeyDown, handleAutoComplete = _3.handleAutoComplete; | ||
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(form_1.TextField, __assign({}, props, { "aria-autocomplete": autoComplete, "aria-controls": comboboxId, "aria-activedescendant": activeId, autoComplete: "off", value: propValue !== null && propValue !== void 0 ? propValue : match, onBlur: handleBlur, onFocus: handleFocus, onClick: handleClick, onKeyDown: handleKeyDown, onChange: handleChange, ref: ref, className: (0, classnames_1.default)(block(), className), containerProps: __assign(__assign({}, containerProps), { "aria-haspopup": "listbox", "aria-owns": suggestionsId, "aria-expanded": visible, id: comboboxId, role: "combobox" }) }), void 0), (0, jsx_runtime_1.jsx)(transition_1.ScaleTransition, __assign({ nodeRef: listboxRef, portal: portal, portalInto: portalInto, portalIntoId: portalIntoId, vertical: true, transitionIn: visible }, transitionHooks, { className: (0, classnames_1.default)(listbox({ temporary: true }), listboxClassName) }, { children: (0, jsx_runtime_1.jsxs)(list_1.List, __assign({ id: suggestionsId, role: "listbox", style: fixedStyle }, { children: [beforeResultsChildren, filteredData.map(function (datum, i) { | ||
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(form_1.TextField, __assign({}, props, { "aria-autocomplete": autoComplete, "aria-controls": comboboxId, "aria-activedescendant": activeId, autoComplete: "off", value: propValue !== null && propValue !== void 0 ? propValue : match, onBlur: handleBlur, onFocus: handleFocus, onClick: handleClick, onKeyDown: handleKeyDown, onChange: handleChange, ref: ref, className: (0, classnames_1.default)(block(), className), containerProps: __assign(__assign({}, containerProps), { "aria-haspopup": "listbox", "aria-owns": suggestionsId, "aria-expanded": visible, id: comboboxId, role: "combobox" }) })), (0, jsx_runtime_1.jsx)(transition_1.ScaleTransition, __assign({ nodeRef: listboxRef, portal: portal, portalInto: portalInto, portalIntoId: portalIntoId, vertical: true, transitionIn: visible }, transitionHooks, { className: (0, classnames_1.default)(listbox({ temporary: true }), listboxClassName) }, { children: (0, jsx_runtime_1.jsxs)(list_1.List, __assign({ id: suggestionsId, role: "listbox", style: fixedStyle }, { children: [beforeResultsChildren, filteredData.map(function (datum, i) { | ||
var resultId = getResultId(suggestionsId, i); | ||
@@ -124,5 +124,5 @@ var optionProps; | ||
} | ||
return ((0, jsx_runtime_1.jsx)(form_1.Option, __assign({}, optionProps, { id: resultId, selected: false, focused: resultId === activeId, ref: itemRefs[i], onClick: function () { return handleAutoComplete(i); } }, { children: (0, jsx_runtime_1.jsx)(HighlightedResult_1.HighlightedResult, __assign({ id: "".concat(resultId, "-match"), style: highlightStyle, className: highlightClassName, value: propValue !== null && propValue !== void 0 ? propValue : value, enabled: highlight, repeatable: highlightReapeating }, { children: getResultLabel(datum, labelKey, value) }), void 0) }), resultId)); | ||
}), afterResultsChildren] }), void 0) }), void 0)] }, void 0)); | ||
return ((0, jsx_runtime_1.jsx)(form_1.Option, __assign({}, optionProps, { id: resultId, selected: false, focused: resultId === activeId, ref: itemRefs[i], onClick: function () { return handleAutoComplete(i); } }, { children: (0, jsx_runtime_1.jsx)(HighlightedResult_1.HighlightedResult, __assign({ id: "".concat(resultId, "-match"), style: highlightStyle, className: highlightClassName, value: propValue !== null && propValue !== void 0 ? propValue : value, enabled: highlight, repeatable: highlightReapeating }, { children: getResultLabel(datum, labelKey, value) })) }), resultId)); | ||
}), afterResultsChildren] })) }))] })); | ||
}); | ||
//# sourceMappingURL=AutoComplete.js.map |
@@ -27,7 +27,7 @@ "use strict"; | ||
if (!enabled || !value || typeof children !== "string") { | ||
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }, void 0); | ||
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }); | ||
} | ||
var i = children.toLowerCase().indexOf(value.toLowerCase()); | ||
if (i === -1) { | ||
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }, void 0); | ||
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }); | ||
} | ||
@@ -39,5 +39,5 @@ var end = i + value.length; | ||
} | ||
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [i > 0 && children.substring(0, i), (0, jsx_runtime_1.jsx)("span", __assign({ id: id, style: style, className: (0, classnames_1.default)("rmd-typography--bold", className) }, { children: children.substring(i, end) }), void 0), end < children.length && ((0, jsx_runtime_1.jsx)(HighlightedResult, __assign({ style: style, className: className, value: value, enabled: enabled && repeatable, repeatable: repeatable, index: index + 1 }, { children: children.substring(end) }), void 0))] }, void 0)); | ||
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [i > 0 && children.substring(0, i), (0, jsx_runtime_1.jsx)("span", __assign({ id: id, style: style, className: (0, classnames_1.default)("rmd-typography--bold", className) }, { children: children.substring(i, end) })), end < children.length && ((0, jsx_runtime_1.jsx)(HighlightedResult, __assign({ style: style, className: className, value: value, enabled: enabled && repeatable, repeatable: repeatable, index: index + 1 }, { children: children.substring(end) })))] })); | ||
} | ||
exports.HighlightedResult = HighlightedResult; | ||
//# sourceMappingURL=HighlightedResult.js.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -1,5 +0,5 @@ | ||
import { ChangeEventHandler, CSSProperties, FocusEventHandler, HTMLAttributes, KeyboardEventHandler, MouseEventHandler, Ref } from "react"; | ||
import type { ChangeEventHandler, CSSProperties, FocusEventHandler, HTMLAttributes, KeyboardEventHandler, MouseEventHandler, Ref } from "react"; | ||
import type { ListElement } from "@react-md/list"; | ||
import { FixedPositioningTransitionCallbacks } from "@react-md/transition"; | ||
import { ItemRefList } from "@react-md/utils"; | ||
import type { FixedPositioningTransitionCallbacks } from "@react-md/transition"; | ||
import type { ItemRefList } from "@react-md/utils"; | ||
import type { AutoCompleteData, AutoCompleteListboxPositionOptions, AutoCompleteProps } from "./types"; | ||
@@ -6,0 +6,0 @@ declare type EventHandlers = Pick<HTMLAttributes<HTMLInputElement>, "onBlur" | "onFocus" | "onChange" | "onClick" | "onKeyDown">; |
{ | ||
"name": "@react-md/autocomplete", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "", | ||
@@ -34,10 +34,10 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"@react-md/form": "^5.0.0", | ||
"@react-md/list": "^5.0.0", | ||
"@react-md/portal": "^5.0.0", | ||
"@react-md/states": "^5.0.0", | ||
"@react-md/theme": "^5.0.0", | ||
"@react-md/transition": "^5.0.0", | ||
"@react-md/typography": "^5.0.0", | ||
"@react-md/utils": "^5.0.0", | ||
"@react-md/form": "^5.1.0", | ||
"@react-md/list": "^5.1.0", | ||
"@react-md/portal": "^5.1.0", | ||
"@react-md/states": "^5.1.0", | ||
"@react-md/theme": "^5.1.0", | ||
"@react-md/transition": "^5.1.0", | ||
"@react-md/typography": "^5.1.0", | ||
"@react-md/utils": "^5.1.0", | ||
"classnames": "^2.3.1" | ||
@@ -64,3 +64,3 @@ }, | ||
}, | ||
"gitHead": "a67e871627db20ca8ee4b672f6e99f2f7f438c96" | ||
"gitHead": "d2446029706ae96aada0131f93ed7c1adcc14d70" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { | ||
import type { | ||
ChangeEventHandler, | ||
@@ -9,14 +9,9 @@ CSSProperties, | ||
Ref, | ||
useCallback, | ||
useEffect, | ||
useRef, | ||
useState, | ||
} from "react"; | ||
import { useCallback, useEffect, useRef, useState } from "react"; | ||
import type { ListElement } from "@react-md/list"; | ||
import type { FixedPositioningTransitionCallbacks } from "@react-md/transition"; | ||
import { useFixedPositioning } from "@react-md/transition"; | ||
import type { ItemRefList } from "@react-md/utils"; | ||
import { | ||
FixedPositioningTransitionCallbacks, | ||
useFixedPositioning, | ||
} from "@react-md/transition"; | ||
import { | ||
ItemRefList, | ||
MovementPresets, | ||
@@ -23,0 +18,0 @@ scrollIntoView, |
@@ -1,5 +0,5 @@ | ||
import { ChangeEventHandler, CSSProperties, FocusEventHandler, HTMLAttributes, KeyboardEventHandler, MouseEventHandler, Ref } from "react"; | ||
import type { ChangeEventHandler, CSSProperties, FocusEventHandler, HTMLAttributes, KeyboardEventHandler, MouseEventHandler, Ref } from "react"; | ||
import type { ListElement } from "@react-md/list"; | ||
import { FixedPositioningTransitionCallbacks } from "@react-md/transition"; | ||
import { ItemRefList } from "@react-md/utils"; | ||
import type { FixedPositioningTransitionCallbacks } from "@react-md/transition"; | ||
import type { ItemRefList } from "@react-md/utils"; | ||
import type { AutoCompleteData, AutoCompleteListboxPositionOptions, AutoCompleteProps } from "./types"; | ||
@@ -6,0 +6,0 @@ declare type EventHandlers = Pick<HTMLAttributes<HTMLInputElement>, "onBlur" | "onFocus" | "onChange" | "onClick" | "onKeyDown">; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
182891
3267
Updated@react-md/form@^5.1.0
Updated@react-md/list@^5.1.0
Updated@react-md/portal@^5.1.0
Updated@react-md/states@^5.1.0
Updated@react-md/theme@^5.1.0
Updated@react-md/transition@^5.1.0
Updated@react-md/typography@^5.1.0
Updated@react-md/utils@^5.1.0