@vectara/vectara-ui 9.10.1 → 9.11.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.
@@ -26,5 +26,5 @@ export type BaseButtonProps = {
26
26
  isLoading?: boolean;
27
27
  };
28
28
  export declare const BaseButton: import("react").ForwardRefExoticComponent<BaseButtonProps & {
29
- spinnerColor?: "accent" | "primary" | "success" | "warning" | "danger" | "empty" | "dark" | undefined;
29
+ spinnerColor?: "accent" | "primary" | "success" | "warning" | "danger" | "subdued" | "empty" | "dark" | undefined;
30
30
  } & import("react").RefAttributes<HTMLButtonElement | null>>;
@@ -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
  }
@@ -9,7 +9,7 @@ const sizeToClassNameMap = {
9
9
  xxl: "vuiSpinner--xxl",
10
10
  xxxl: "vuiSpinner--xxxl"
11
11
  };
12
- export const VuiSpinner = ({ color = "accent", size = "m" }) => {
12
+ export const VuiSpinner = ({ color = "subdued", size = "m" }) => {
13
13
  const classes = classNames("vuiSpinner", sizeToClassNameMap[size], `vuiSpinner--${color}`);
14
14
  return (_jsx("span", Object.assign({ className: classes }, { children: _jsx("svg", Object.assign({ version: "1.1", xmlns: "http://www.w3.org/2000/svg", x: "0px", y: "0px", viewBox: "0 0 50 50" }, { children: _jsx("path", Object.assign({ fill: "#000", d: "M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z" }, { children: _jsx("animateTransform", { attributeType: "xml", attributeName: "transform", type: "rotate", from: "0 25 25", to: "360 25 25", dur: "0.6s", repeatCount: "indefinite" }) })) })) })));
15
15
  };
@@ -26,6 +26,9 @@ $color: (
26
26
  ),
27
27
  dark: (
28
28
  "color": $colorDarkerShade
29
+ ),
30
+ subdued: (
31
+ "color": $colorSubdued
29
32
  )
30
33
  );
31
34
 
@@ -1,3 +1,3 @@
1
- export declare const SPINNER_COLOR: readonly ["accent", "primary", "success", "danger", "warning", "empty", "dark"];
1
+ export declare const SPINNER_COLOR: readonly ["accent", "primary", "success", "danger", "warning", "empty", "dark", "subdued"];
2
2
  export declare const SPINNER_SIZE: readonly ["xs", "s", "m", "l", "xl", "xxl", "xxxl"];
3
3
  export type SpinnerColor = (typeof SPINNER_COLOR)[number];
@@ -1,2 +1,2 @@
1
- export const SPINNER_COLOR = ["accent", "primary", "success", "danger", "warning", "empty", "dark"];
1
+ export const SPINNER_COLOR = ["accent", "primary", "success", "danger", "warning", "empty", "dark", "subdued"];
2
2
  export const SPINNER_SIZE = ["xs", "s", "m", "l", "xl", "xxl", "xxxl"];
@@ -21,6 +21,7 @@ $colorDangerLighterShade: #fff1f1 !default;
21
21
 
22
22
  // Special colors
23
23
  $colorPrimaryHighlight: #d9e2ff !default;
24
+ $colorSubdued: #6d7686;
24
25
 
25
26
  // Neutral colors
26
27
  $colorEmptyShade: #ffffff !default;
@@ -9,7 +9,7 @@ $fontSizeXxLarge: 30px;
9
9
  $fontSizeXxxLarge: 40px;
10
10
 
11
11
  $colorText: $colorDarkerShade;
12
- $colorSubdued: #6d7686;
12
+ $colorSubdued: $colorSubdued;
13
13
 
14
14
  $fontWeightLight: 300;
15
15
  $fontWeightNormal: 400;
@@ -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
 
@@ -3861,6 +3873,11 @@ h2.react-datepicker__current-month {
3861
3873
  fill: #1c1d22;
3862
3874
  }
3863
3875
 
3876
+ .vuiSpinner--subdued svg path,
3877
+ .vuiSpinner--subdued svg rect {
3878
+ fill: #6d7686;
3879
+ }
3880
+
3864
3881
  .vuiSpinner--xs {
3865
3882
  width: 14px;
3866
3883
  height: 14px;
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.1",
4
4
  "homepage": "./",
5
5
  "description": "Vectara's design system, codified as a React and Sass component library",
6
6
  "author": "Vectara",