polyfire-js
Advanced tools
Comparing version 0.2.35 to 0.2.36
import React, { CSSProperties } from "react"; | ||
export interface AutoCompleteInputProps extends React.InputHTMLAttributes<HTMLInputElement> { | ||
completionColor?: CSSProperties["color"]; | ||
containerStyle?: CSSProperties; | ||
containerClassName?: string; | ||
} | ||
export declare function AutoCompleteInput(props: AutoCompleteInputProps): React.ReactElement; |
@@ -89,3 +89,2 @@ "use strict"; | ||
maxWidth: "100%", | ||
border: "1px solid #ccc", | ||
minHeight: "2rem", | ||
@@ -104,4 +103,4 @@ position: "relative", | ||
paddingBottom: "0", | ||
border: "none", | ||
overflow: "hidden", | ||
border: "1px solid #ccc", | ||
}; | ||
@@ -125,8 +124,8 @@ var completionStyle = { | ||
var _this = this; | ||
var _a = props.completionColor, completionColor = _a === void 0 ? "grey" : _a, _b = props.className, className = _b === void 0 ? "" : _b, inputProps = __rest(props, ["completionColor", "className"]); | ||
var _c = (0, hooks_1.usePolyfire)(), status = _c.auth.status, generate = _c.models.generate; | ||
var _d = (0, react_1.useState)(""), prompt = _d[0], setPrompt = _d[1]; | ||
var _e = (0, react_1.useState)(""), completion = _e[0], setCompletion = _e[1]; | ||
var _a = props.completionColor, completionColor = _a === void 0 ? "grey" : _a, inputProps = __rest(props, ["completionColor"]); | ||
var _b = (0, hooks_1.usePolyfire)(), status = _b.auth.status, generate = _b.models.generate; | ||
var _c = (0, react_1.useState)(""), prompt = _c[0], setPrompt = _c[1]; | ||
var _d = (0, react_1.useState)(""), completion = _d[0], setCompletion = _d[1]; | ||
// This state is used to wait for the user to start typing again before initiating a new completion | ||
var _f = (0, react_1.useState)(false), completionUsed = _f[0], setCompletionUsed = _f[1]; | ||
var _e = (0, react_1.useState)(false), completionUsed = _e[0], setCompletionUsed = _e[1]; | ||
var inputRef = (0, react_1.useRef)(null); | ||
@@ -213,4 +212,4 @@ var hiddenSizerRef = (0, react_1.useRef)(null); | ||
}, [completion]); | ||
return (react_1.default.createElement("div", { style: containerStyle, className: className }, | ||
react_1.default.createElement("input", __assign({}, inputProps, { ref: inputRef, value: prompt, onChange: onChange, onKeyDown: onKeyDown, style: inputStyle, className: className })), | ||
return (react_1.default.createElement("div", { style: __assign(__assign({}, containerStyle), props.containerStyle), className: props.containerClassName }, | ||
react_1.default.createElement("input", __assign({}, inputProps, { ref: inputRef, value: prompt, onChange: onChange, onKeyDown: onKeyDown, style: __assign(__assign({}, inputStyle), props.style), className: props.className })), | ||
react_1.default.createElement("span", { ref: hiddenSizerRef, style: hiddenSizerStyle }), | ||
@@ -217,0 +216,0 @@ react_1.default.createElement("span", { ref: completionRef, style: __assign(__assign({}, completionStyle), { color: completionColor }) }, completion))); |
{ | ||
"name": "polyfire-js", | ||
"version": "0.2.35", | ||
"version": "0.2.36", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "types": "index.d.ts", |
270250
5502