@vectara/vectara-ui 9.10.1 → 9.11.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.
@@ -10,6 +10,7 @@ type Props = {
10
10
  autoFocus?: boolean;
11
11
  onSubmit?: FormEventHandler;
12
12
  suggestions?: SearchSuggestion[];
13
+ isLoading?: boolean;
13
14
  };
14
15
  type ClearableProps = {
15
16
  isClearable?: true;
@@ -18,5 +19,5 @@ type ClearableProps = {
18
19
  isClearable?: false;
19
20
  onClear?: never;
20
21
  };
21
- export declare const VuiSearchInput: ({ className, size, value, onChange, placeholder, autoFocus, onSubmit, isClearable, onClear, suggestions, ...rest }: Props & ClearableProps) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const VuiSearchInput: ({ className, size, value, onChange, placeholder, autoFocus, onSubmit, isClearable, onClear, suggestions, isLoading, ...rest }: Props & ClearableProps) => import("react/jsx-runtime").JSX.Element;
22
23
  export {};
@@ -13,13 +13,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useRef, useState, useEffect, useMemo } from "react";
14
14
  import classNames from "classnames";
15
15
  import { VuiIconButton } from "../button/IconButton";
16
- import { BiX } from "react-icons/bi";
16
+ import { BiSearch, BiX } from "react-icons/bi";
17
17
  import { VuiIcon } from "../icon/Icon";
18
18
  import { VuiSearchInputSuggestions } from "./SearchInputSuggestions";
19
19
  import { createId } from "../../utils/createId";
20
+ import { VuiSpinner } from "../spinner/Spinner";
20
21
  const SIZE = ["m", "l"];
21
22
  export const VuiSearchInput = (_a) => {
22
- var { className, size = "m", value, onChange, placeholder, autoFocus, onSubmit, isClearable, onClear, suggestions } = _a, rest = __rest(_a, ["className", "size", "value", "onChange", "placeholder", "autoFocus", "onSubmit", "isClearable", "onClear", "suggestions"]);
23
+ var { className, size = "m", value, onChange, placeholder, autoFocus, onSubmit, isClearable, onClear, suggestions, isLoading } = _a, rest = __rest(_a, ["className", "size", "value", "onChange", "placeholder", "autoFocus", "onSubmit", "isClearable", "onClear", "suggestions", "isLoading"]);
23
24
  const classes = classNames("vuiSearchInput", `vuiSearchInput--${size}`, className);
24
25
  const inputRef = useRef(null);
25
26
  const containerRef = useRef(null);
@@ -132,7 +133,7 @@ export const VuiSearchInput = (_a) => {
132
133
  const inputClasses = classNames("vuiSearchInput__input", {
133
134
  "vuiSearchInput__input--hasSuggestions": hasSuggestions
134
135
  });
135
- return (_jsx("form", Object.assign({ onSubmit: onSubmit }, { children: _jsxs("div", Object.assign({ ref: containerRef, className: classes }, { children: [_jsx("input", Object.assign({ ref: inputRef, className: inputClasses, type: "text", autoComplete: "off", autoCapitalize: "off", spellCheck: "false", autoFocus: autoFocus, placeholder: placeholder, value: value, onChange: onChange, onFocus: handleInputFocus, onKeyDown: handleInputKeyDown, "aria-autocomplete": "list", "aria-controls": hasSuggestions ? controlsId : undefined }, rest)), isClearable && value && (_jsx(VuiIconButton, { "aria-label": "Clear input", className: "vuiSearchInput__clearButton", icon: _jsx(VuiIcon, { children: _jsx(BiX, {}) }), onClick: (e) => {
136
+ return (_jsx("form", Object.assign({ onSubmit: onSubmit }, { children: _jsxs("div", Object.assign({ ref: containerRef, className: classes, "aria-live": "polite", "aria-atomic": "true", "aria-busy": isLoading ? "true" : "false" }, { children: [_jsx("input", Object.assign({ ref: inputRef, className: inputClasses, type: "text", autoComplete: "off", autoCapitalize: "off", spellCheck: "false", autoFocus: autoFocus, placeholder: placeholder, value: value, onChange: onChange, onFocus: handleInputFocus, onKeyDown: handleInputKeyDown, "aria-autocomplete": "list", "aria-controls": hasSuggestions ? controlsId : undefined }, rest)), _jsx("div", Object.assign({ className: "vuiSearchInput__icon" }, { children: isLoading ? (_jsx(VuiSpinner, { size: size === "m" ? "s" : "m" })) : (_jsx(VuiIcon, Object.assign({ color: "subdued", size: size === "m" ? "s" : "m" }, { children: _jsx(BiSearch, {}) }))) })), isClearable && value && (_jsx(VuiIconButton, { "aria-label": "Clear input", className: "vuiSearchInput__clearButton", icon: _jsx(VuiIcon, { children: _jsx(BiX, {}) }), onClick: (e) => {
136
137
  e.preventDefault();
137
138
  onClear();
138
139
  } })), hasSuggestions && (_jsx(VuiSearchInputSuggestions, { id: controlsId, suggestions: suggestions, onSuggestionKeyDown: handleSuggestionKeyDown, suggestionRefs: suggestionRefs }))] })) })));
@@ -4,6 +4,12 @@
4
4
  align-items: center;
5
5
  }
6
6
 
7
+ .vuiSearchInput__icon {
8
+ position: absolute;
9
+ left: $sizeM;
10
+ pointer-events: none;
11
+ }
12
+
7
13
  .vuiSearchInput__input {
8
14
  flex-grow: 1;
9
15
  background-color: $colorEmptyShade;
@@ -40,15 +46,23 @@
40
46
  }
41
47
 
42
48
  .vuiSearchInput--m {
49
+ .vuiSearchInput__icon {
50
+ top: $sizeXs + 1px;
51
+ }
52
+
43
53
  .vuiSearchInput__input {
44
- padding: $sizeXs $sizeM;
54
+ padding: $sizeXs $sizeM $sizeXs $sizeXl + $sizeXs;
45
55
  font-size: $fontSizeStandard;
46
56
  }
47
57
  }
48
58
 
49
59
  .vuiSearchInput--l {
60
+ .vuiSearchInput__icon {
61
+ top: $sizeS + 1px;
62
+ }
63
+
50
64
  .vuiSearchInput__input {
51
- padding: $sizeS $sizeM;
65
+ padding: $sizeS $sizeM $sizeS $sizeXl + $sizeS;
52
66
  font-size: $fontSizeLarge;
53
67
  }
54
68
  }
@@ -3637,6 +3637,12 @@ h2.react-datepicker__current-month {
3637
3637
  align-items: center;
3638
3638
  }
3639
3639
 
3640
+ .vuiSearchInput__icon {
3641
+ position: absolute;
3642
+ left: 16px;
3643
+ pointer-events: none;
3644
+ }
3645
+
3640
3646
  .vuiSearchInput__input {
3641
3647
  flex-grow: 1;
3642
3648
  background-color: #ffffff;
@@ -3670,13 +3676,19 @@ h2.react-datepicker__current-month {
3670
3676
  color: #5f30c3;
3671
3677
  }
3672
3678
 
3679
+ .vuiSearchInput--m .vuiSearchInput__icon {
3680
+ top: 9px;
3681
+ }
3673
3682
  .vuiSearchInput--m .vuiSearchInput__input {
3674
- padding: 8px 16px;
3683
+ padding: 8px 16px 8px 40px;
3675
3684
  font-size: 14px;
3676
3685
  }
3677
3686
 
3687
+ .vuiSearchInput--l .vuiSearchInput__icon {
3688
+ top: 13px;
3689
+ }
3678
3690
  .vuiSearchInput--l .vuiSearchInput__input {
3679
- padding: 12px 16px;
3691
+ padding: 12px 16px 12px 44px;
3680
3692
  font-size: 18px;
3681
3693
  }
3682
3694
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectara/vectara-ui",
3
- "version": "9.10.1",
3
+ "version": "9.11.0",
4
4
  "homepage": "./",
5
5
  "description": "Vectara's design system, codified as a React and Sass component library",
6
6
  "author": "Vectara",