@vectara/vectara-ui 16.10.0 → 16.12.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.
@@ -1,5 +1,6 @@
1
1
  import { BasicProps as DatePickerProps } from "./DatePicker";
2
2
  import { Props as PopoverProps } from "../popover/Popover";
3
+ import { JSXElementConstructor, ReactElement } from "react";
3
4
  type DateProps = Pick<DatePickerProps, "placeholder" | "data-testid">;
4
5
  type Props = Pick<PopoverProps, "isOpen" | "setIsOpen" | "anchorSide" | "header"> & {
5
6
  startDate?: Date;
@@ -8,7 +9,8 @@ type Props = Pick<PopoverProps, "isOpen" | "setIsOpen" | "anchorSide" | "header"
8
9
  dateRangeProps?: DateProps;
9
10
  fullWidth?: boolean;
10
11
  canClear?: boolean;
12
+ input?: ReactElement<any, string | JSXElementConstructor<any>>;
11
13
  "data-testid"?: string;
12
14
  };
13
- export declare const VuiDateRangePicker: ({ setIsOpen, startDate, endDate, onChange, dateRangeProps, fullWidth, canClear, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const VuiDateRangePicker: ({ setIsOpen, startDate, endDate, onChange, dateRangeProps, fullWidth, canClear, input, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
14
16
  export {};
@@ -16,7 +16,7 @@ import { formatDate } from "../../utils";
16
16
  import { useEffect, useState } from "react";
17
17
  import { VuiCalendar } from "./Calendar";
18
18
  export const VuiDateRangePicker = (_a) => {
19
- var { setIsOpen, startDate, endDate, onChange, dateRangeProps, fullWidth, canClear } = _a, rest = __rest(_a, ["setIsOpen", "startDate", "endDate", "onChange", "dateRangeProps", "fullWidth", "canClear"]);
19
+ var { setIsOpen, startDate, endDate, onChange, dateRangeProps, fullWidth, canClear, input } = _a, rest = __rest(_a, ["setIsOpen", "startDate", "endDate", "onChange", "dateRangeProps", "fullWidth", "canClear", "input"]);
20
20
  const [initialStartDate, setInitialStartDate] = useState();
21
21
  const [initialEndDate, setInitialEndDate] = useState();
22
22
  // When the startDate or endDate props change, update the internal state.
@@ -42,7 +42,7 @@ export const VuiDateRangePicker = (_a) => {
42
42
  const humanizedStartDate = initialStartDate ? formatDate(initialStartDate) : "Unselected start date";
43
43
  const humanizedEndDate = initialEndDate ? formatDate(initialEndDate) : "unselected end date";
44
44
  const { "data-testid": testId } = rest, restProps = __rest(rest, ["data-testid"]);
45
- const input = (_jsx(VuiTextInput, { className: "vuiDateRangePickerInput", value: !initialStartDate && !initialEndDate ? "Select date range" : `${humanizedStartDate} to ${humanizedEndDate}`, fullWidth: fullWidth, "data-testid": testId }));
45
+ const inputEl = input !== null && input !== void 0 ? input : (_jsx(VuiTextInput, { className: "vuiDateRangePickerInput", value: !initialStartDate && !initialEndDate ? "Select date range" : `${humanizedStartDate} to ${humanizedEndDate}`, fullWidth: fullWidth, "data-testid": testId }));
46
46
  return (_jsx(VuiPopover, Object.assign({ setIsOpen: (isOpen) => {
47
47
  if (isOpen) {
48
48
  // Set temporary internal state to the provided values when opening the popover.
@@ -54,5 +54,5 @@ export const VuiDateRangePicker = (_a) => {
54
54
  onChange === null || onChange === void 0 ? void 0 : onChange(initialStartDate, initialEndDate);
55
55
  }
56
56
  setIsOpen(isOpen);
57
- }, button: input }, restProps, { children: dateRangePicker })));
57
+ }, button: inputEl }, restProps, { children: dateRangePicker })));
58
58
  };
@@ -1,4 +1,4 @@
1
- declare const SIZE: readonly ["m", "l"];
1
+ declare const SIZE: readonly ["s", "m", "l"];
2
2
  export type BasicInputProps = Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "size" | "autoComplete" | "ref"> & {
3
3
  isInvalid?: boolean;
4
4
  size?: (typeof SIZE)[number];
@@ -8,7 +8,7 @@ export type BasicInputProps = Omit<React.DetailedHTMLProps<React.InputHTMLAttrib
8
8
  };
9
9
  export declare const VuiBasicInput: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref" | "size" | "autoComplete"> & {
10
10
  isInvalid?: boolean | undefined;
11
- size?: "m" | "l" | undefined;
11
+ size?: "s" | "m" | "l" | undefined;
12
12
  fullWidth?: boolean | undefined;
13
13
  autoComplete?: string | boolean | undefined;
14
14
  isSelected?: boolean | undefined;
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import classNames from "classnames";
14
14
  import { forwardRef } from "react";
15
- const SIZE = ["m", "l"];
15
+ const SIZE = ["s", "m", "l"];
16
16
  export const VuiBasicInput = forwardRef((_a, ref) => {
17
17
  var { className, id, name, placeholder, size = "m", fullWidth, onSubmit, isInvalid, autoFocus, autoComplete, isSelected, onChange = () => undefined } = _a, rest = __rest(_a, ["className", "id", "name", "placeholder", "size", "fullWidth", "onSubmit", "isInvalid", "autoFocus", "autoComplete", "isSelected", "onChange"]);
18
18
  const classes = classNames("vuiInput", `vuiInput--${size}`, {
@@ -1,6 +1,6 @@
1
1
  export declare const VuiPasswordInput: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref" | "size" | "autoComplete"> & {
2
2
  isInvalid?: boolean | undefined;
3
- size?: "m" | "l" | undefined;
3
+ size?: "s" | "m" | "l" | undefined;
4
4
  fullWidth?: boolean | undefined;
5
5
  autoComplete?: string | boolean | undefined;
6
6
  isSelected?: boolean | undefined;
@@ -6,7 +6,7 @@ export type Props = BasicInputProps & {
6
6
  };
7
7
  export declare const VuiTextInput: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref" | "size" | "autoComplete"> & {
8
8
  isInvalid?: boolean | undefined;
9
- size?: "m" | "l" | undefined;
9
+ size?: "s" | "m" | "l" | undefined;
10
10
  fullWidth?: boolean | undefined;
11
11
  autoComplete?: string | boolean | undefined;
12
12
  isSelected?: boolean | undefined;
@@ -5,6 +5,11 @@
5
5
  background-color: var(--vui-color-empty-shade);
6
6
  }
7
7
 
8
+ .vuiInput--s {
9
+ padding: $sizeXs * 0.75 $sizeS;
10
+ font-size: $fontSizeSmall;
11
+ }
12
+
8
13
  .vuiInput--m {
9
14
  padding: $sizeXs $sizeM;
10
15
  font-size: $fontSizeStandard;
@@ -1,6 +1,6 @@
1
1
  import { ChangeEventHandler, FormEventHandler, KeyboardEventHandler } from "react";
2
2
  import { SearchSuggestion } from "./types";
3
- declare const SIZE: readonly ["m", "l"];
3
+ declare const SIZE: readonly ["s", "m", "l"];
4
4
  type Props = {
5
5
  className?: string;
6
6
  value?: string;
@@ -18,7 +18,12 @@ import { VuiIcon } from "../icon/Icon";
18
18
  import { VuiSearchInputSuggestions } from "./SearchInputSuggestions";
19
19
  import { createId } from "../../utils/createId";
20
20
  import { VuiSpinner } from "../spinner/Spinner";
21
- const SIZE = ["m", "l"];
21
+ const SIZE = ["s", "m", "l"];
22
+ const sizeToIconSizeMap = {
23
+ s: "xs",
24
+ m: "s",
25
+ l: "m"
26
+ };
22
27
  export const VuiSearchInput = (_a) => {
23
28
  var { className, size = "m", value, onChange, onKeyDown, placeholder, autoFocus, onSubmit, isClearable, onClear, suggestions, onSelectSuggestion, isLoading } = _a, rest = __rest(_a, ["className", "size", "value", "onChange", "onKeyDown", "placeholder", "autoFocus", "onSubmit", "isClearable", "onClear", "suggestions", "onSelectSuggestion", "isLoading"]);
24
29
  const classes = classNames("vuiSearchInput", `vuiSearchInput--${size}`, className);
@@ -169,7 +174,7 @@ export const VuiSearchInput = (_a) => {
169
174
  return (_jsx("form", Object.assign({ onSubmit: onSubmit, role: "search" }, { 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: (e) => {
170
175
  handleInputKeyDown(e);
171
176
  onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
172
- }, "aria-autocomplete": "list", "aria-controls": hasSuggestions ? controlsId : undefined }, rest)), ghostText && (_jsxs("div", Object.assign({ className: "vuiSearchInput__ghostText", "aria-hidden": "true" }, { children: [_jsx("span", Object.assign({ className: "vuiSearchInput__ghostText--hidden" }, { children: value })), _jsx("span", Object.assign({ className: "vuiSearchInput__ghostText--visible" }, { children: ghostText }))] }))), _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) => {
177
+ }, "aria-autocomplete": "list", "aria-controls": hasSuggestions ? controlsId : undefined }, rest)), ghostText && (_jsxs("div", Object.assign({ className: "vuiSearchInput__ghostText", "aria-hidden": "true" }, { children: [_jsx("span", Object.assign({ className: "vuiSearchInput__ghostText--hidden" }, { children: value })), _jsx("span", Object.assign({ className: "vuiSearchInput__ghostText--visible" }, { children: ghostText }))] }))), _jsx("div", Object.assign({ className: "vuiSearchInput__icon" }, { children: isLoading ? (_jsx(VuiSpinner, { size: size === "m" ? "s" : "m" })) : (_jsx(VuiIcon, Object.assign({ color: "subdued", size: sizeToIconSizeMap[size] }, { children: _jsx(BiSearch, {}) }))) })), isClearable && value && (_jsx(VuiIconButton, { "aria-label": "Clear input", className: "vuiSearchInput__clearButton", icon: _jsx(VuiIcon, { children: _jsx(BiX, {}) }), onClick: (e) => {
173
178
  e.preventDefault();
174
179
  onClear();
175
180
  } })), hasSuggestions && (_jsx(VuiSearchInputSuggestions, { id: controlsId, suggestions: suggestions, onSuggestionKeyDown: handleSuggestionKeyDown, suggestionRefs: suggestionRefs, onSelectSuggestion: onSelectSuggestion }))] })) })));
@@ -45,6 +45,17 @@
45
45
  }
46
46
  }
47
47
 
48
+ .vuiSearchInput--s {
49
+ .vuiSearchInput__icon {
50
+ top: $sizeXxs + 3px;
51
+ }
52
+
53
+ .vuiSearchInput__input {
54
+ padding: $sizeXs * 0.6 $sizeS $sizeXs * 0.6 $sizeL + $sizeS;
55
+ font-size: $fontSizeStandard;
56
+ }
57
+ }
58
+
48
59
  .vuiSearchInput--m {
49
60
  .vuiSearchInput__icon {
50
61
  top: $sizeXs + 1px;
@@ -2848,6 +2848,11 @@ h2.react-datepicker__current-month {
2848
2848
  background-color: var(--vui-color-empty-shade);
2849
2849
  }
2850
2850
 
2851
+ .vuiInput--s {
2852
+ padding: 6px 12px;
2853
+ font-size: 12px;
2854
+ }
2855
+
2851
2856
  .vuiInput--m {
2852
2857
  padding: 8px 16px;
2853
2858
  font-size: 14px;
@@ -4723,6 +4728,14 @@ h2.react-datepicker__current-month {
4723
4728
  color: var(--vui-color-accent-shade);
4724
4729
  }
4725
4730
 
4731
+ .vuiSearchInput--s .vuiSearchInput__icon {
4732
+ top: 7px;
4733
+ }
4734
+ .vuiSearchInput--s .vuiSearchInput__input {
4735
+ padding: 4.8px 12px 4.8px 36px;
4736
+ font-size: 14px;
4737
+ }
4738
+
4726
4739
  .vuiSearchInput--m .vuiSearchInput__icon {
4727
4740
  top: 9px;
4728
4741
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectara/vectara-ui",
3
- "version": "16.10.0",
3
+ "version": "16.12.0",
4
4
  "homepage": "./",
5
5
  "description": "Vectara's design system, codified as a React and Sass component library",
6
6
  "author": "Vectara",
@@ -8,7 +8,7 @@ type Props = {
8
8
  export const Subsection = ({ title, children }: Props) => {
9
9
  return (
10
10
  <>
11
- <VuiTitle size="s">
11
+ <VuiTitle size="xs">
12
12
  <h4>{title}</h4>
13
13
  </VuiTitle>
14
14
 
@@ -0,0 +1,66 @@
1
+ import { useState } from "react";
2
+ import { VuiButtonSecondary, VuiDateRangePicker, VuiSpacer, VuiText, VuiTextInput } from "../../../lib";
3
+ import { formatDate } from "../../../lib/utils";
4
+
5
+ export const DateRangePickerCustomInput = () => {
6
+ const [isOpen, setIsOpen] = useState<boolean>(false);
7
+ const [startDate, setStartDate] = useState<Date | undefined>(
8
+ new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000)
9
+ );
10
+ const [endDate, setEndDate] = useState<Date | undefined>(undefined);
11
+
12
+ const humanizedStartDate = startDate ? formatDate(startDate) : "Unselected start date";
13
+ const humanizedEndDate = endDate ? formatDate(endDate) : "unselected end date";
14
+
15
+ return (
16
+ <>
17
+ <VuiText>
18
+ <p>
19
+ From {startDate?.toUTCString() ?? "unknown"} to {endDate?.toUTCString() ?? "unknown"}
20
+ </p>
21
+ </VuiText>
22
+
23
+ <VuiSpacer size="s" />
24
+
25
+ <VuiButtonSecondary
26
+ color="neutral"
27
+ onClick={() => {
28
+ // Add one day to the end date.
29
+ setEndDate((prevEndDate) => {
30
+ if (!prevEndDate) return new Date();
31
+ const newEndDate = new Date(prevEndDate);
32
+ newEndDate.setDate(newEndDate.getDate() + 1);
33
+ return newEndDate;
34
+ });
35
+ }}
36
+ >
37
+ Add day to verify external control
38
+ </VuiButtonSecondary>
39
+
40
+ <VuiSpacer size="s" />
41
+
42
+ <VuiDateRangePicker
43
+ header="Date filter"
44
+ startDate={startDate}
45
+ endDate={endDate}
46
+ onChange={(startDate, endDate) => {
47
+ setStartDate(startDate);
48
+ setEndDate(endDate);
49
+ }}
50
+ isOpen={isOpen}
51
+ setIsOpen={setIsOpen}
52
+ anchorSide="left"
53
+ data-testid="dateRangePickerButton"
54
+ dateRangeProps={{ "data-testid": "dateRangePicker" }}
55
+ canClear
56
+ input={
57
+ <VuiTextInput
58
+ size="s"
59
+ className="vuiDateRangePickerInput"
60
+ value={!startDate && !endDate ? "Select date range" : `${humanizedStartDate} to ${humanizedEndDate}`}
61
+ />
62
+ }
63
+ />
64
+ </>
65
+ );
66
+ };
@@ -1,11 +1,13 @@
1
1
  import { DatePicker } from "./DatePicker";
2
2
  import { Inline } from "./Inline";
3
3
  import { DateRangePicker } from "./DateRangePicker";
4
+ import { DateRangePickerCustomInput } from "./DateRangePickerCustomInput";
4
5
  import { WithTimeSelection } from "./WithTimeSelection";
5
6
 
6
7
  const DatePickerSource = require("!!raw-loader!./DatePicker");
7
8
  const InlineSource = require("!!raw-loader!./Inline");
8
9
  const DateRangePickerSource = require("!!raw-loader!./DateRangePicker");
10
+ const DateRangePickerCustomInputSource = require("!!raw-loader!./DateRangePickerCustomInput");
9
11
  const WithTimeSelectionSource = require("!!raw-loader!./WithTimeSelection");
10
12
 
11
13
  export const datePicker = {
@@ -27,6 +29,11 @@ export const datePicker = {
27
29
  component: <DateRangePicker />,
28
30
  source: DateRangePickerSource.default.toString()
29
31
  },
32
+ {
33
+ name: "Date range with custom input",
34
+ component: <DateRangePickerCustomInput />,
35
+ source: DateRangePickerCustomInputSource.default.toString()
36
+ },
30
37
  {
31
38
  name: "With time selection",
32
39
  component: <WithTimeSelection />,
@@ -0,0 +1,47 @@
1
+ import { useState } from "react";
2
+ import { VuiTextInput } from "../../../lib";
3
+ import { Subsection } from "../../components/Subsection";
4
+
5
+ export const Sizes = () => {
6
+ const [value, setValue] = useState<string | undefined>();
7
+
8
+ return (
9
+ <>
10
+ <Subsection title="Large">
11
+ <VuiTextInput
12
+ size="l"
13
+ id="textInput"
14
+ name="text"
15
+ placeholder="Type something…"
16
+ value={value}
17
+ onSubmit={() => alert("Submit")}
18
+ onChange={(event) => setValue(event.target.value)}
19
+ />
20
+ </Subsection>
21
+
22
+ <Subsection title="Medium">
23
+ <VuiTextInput
24
+ size="m"
25
+ id="textInput"
26
+ name="text"
27
+ placeholder="Type something…"
28
+ value={value}
29
+ onSubmit={() => alert("Submit")}
30
+ onChange={(event) => setValue(event.target.value)}
31
+ />
32
+ </Subsection>
33
+
34
+ <Subsection title="Small">
35
+ <VuiTextInput
36
+ size="s"
37
+ id="textInput"
38
+ name="text"
39
+ placeholder="Type something…"
40
+ value={value}
41
+ onSubmit={() => alert("Submit")}
42
+ onChange={(event) => setValue(event.target.value)}
43
+ />
44
+ </Subsection>
45
+ </>
46
+ );
47
+ };
@@ -2,13 +2,13 @@ import { TextInput } from "./TextInput";
2
2
  import { NumberInput } from "./NumberInput";
3
3
  import { PasswordInput } from "./PasswordInput";
4
4
  import { FullWidth } from "./FullWidth";
5
- import { Large } from "./Large";
5
+ import { Sizes } from "./Sizes";
6
6
 
7
7
  const TextInputSource = require("!!raw-loader!./TextInput");
8
8
  const NumberInputSource = require("!!raw-loader!./NumberInput");
9
9
  const PasswordInputSource = require("!!raw-loader!./PasswordInput");
10
10
  const FullWidthSource = require("!!raw-loader!./FullWidth");
11
- const LargeSource = require("!!raw-loader!./Large");
11
+ const SizesSource = require("!!raw-loader!./Sizes");
12
12
 
13
13
  export const input = {
14
14
  name: "Input",
@@ -35,9 +35,9 @@ export const input = {
35
35
  source: FullWidthSource.default.toString()
36
36
  },
37
37
  {
38
- name: "Large size",
39
- component: <Large />,
40
- source: LargeSource.default.toString()
38
+ name: "Sizes",
39
+ component: <Sizes />,
40
+ source: SizesSource.default.toString()
41
41
  }
42
42
  ]
43
43
  };
@@ -1,31 +1,86 @@
1
1
  import { useState } from "react";
2
2
  import { VuiButtonPrimary, VuiFlexContainer, VuiFlexItem, VuiSearchInput } from "../../../lib";
3
+ import { Subsection } from "../../components/Subsection";
3
4
 
4
5
  export const SearchInput = () => {
5
6
  const [searchValue, setSearchValue] = useState("");
6
7
 
7
8
  return (
8
- <form>
9
- <VuiFlexContainer alignItems="center">
10
- <VuiFlexItem grow={1}>
11
- <VuiSearchInput
12
- autoFocus
13
- placeholder="Ask a question"
14
- value={searchValue}
15
- onChange={(e) => setSearchValue(e.target.value)}
16
- onSubmit={(e) => {
17
- e.preventDefault();
18
- alert(`Submit ${searchValue}`);
19
- }}
20
- />
21
- </VuiFlexItem>
9
+ <>
10
+ <Subsection title="Large size">
11
+ <VuiFlexContainer alignItems="center">
12
+ <VuiFlexItem grow={1}>
13
+ <VuiSearchInput
14
+ size="l"
15
+ placeholder="Ask a question"
16
+ value={searchValue}
17
+ onChange={(e) => setSearchValue(e.target.value)}
18
+ onSubmit={(e) => {
19
+ e.preventDefault();
20
+ alert(`Submit ${searchValue}`);
21
+ }}
22
+ />
23
+ </VuiFlexItem>
22
24
 
23
- <VuiFlexItem>
24
- <VuiButtonPrimary color="primary" size="m">
25
- Search
26
- </VuiButtonPrimary>
27
- </VuiFlexItem>
28
- </VuiFlexContainer>
29
- </form>
25
+ <VuiFlexItem>
26
+ <VuiButtonPrimary color="primary" size="l">
27
+ Search
28
+ </VuiButtonPrimary>
29
+ </VuiFlexItem>
30
+ </VuiFlexContainer>
31
+ </Subsection>
32
+
33
+ <Subsection title="Medium size">
34
+ <form>
35
+ <VuiFlexContainer alignItems="center" spacing="s">
36
+ <VuiFlexItem grow={1}>
37
+ <VuiSearchInput
38
+ autoFocus
39
+ placeholder="Ask a question"
40
+ value={searchValue}
41
+ onChange={(e) => setSearchValue(e.target.value)}
42
+ onSubmit={(e) => {
43
+ e.preventDefault();
44
+ alert(`Submit ${searchValue}`);
45
+ }}
46
+ size="m"
47
+ />
48
+ </VuiFlexItem>
49
+
50
+ <VuiFlexItem>
51
+ <VuiButtonPrimary color="primary" size="m">
52
+ Search
53
+ </VuiButtonPrimary>
54
+ </VuiFlexItem>
55
+ </VuiFlexContainer>
56
+ </form>
57
+ </Subsection>
58
+
59
+ <Subsection title="Small size">
60
+ <form>
61
+ <VuiFlexContainer alignItems="center" spacing="xs">
62
+ <VuiFlexItem grow={1}>
63
+ <VuiSearchInput
64
+ autoFocus
65
+ placeholder="Ask a question"
66
+ value={searchValue}
67
+ onChange={(e) => setSearchValue(e.target.value)}
68
+ onSubmit={(e) => {
69
+ e.preventDefault();
70
+ alert(`Submit ${searchValue}`);
71
+ }}
72
+ size="s"
73
+ />
74
+ </VuiFlexItem>
75
+
76
+ <VuiFlexItem>
77
+ <VuiButtonPrimary color="primary" size="s">
78
+ Search
79
+ </VuiButtonPrimary>
80
+ </VuiFlexItem>
81
+ </VuiFlexContainer>
82
+ </form>
83
+ </Subsection>
84
+ </>
30
85
  );
31
86
  };
@@ -1,11 +1,9 @@
1
1
  import { SearchInput } from "./SearchInput";
2
- import { Large } from "./Large";
3
2
  import { ClearableSearchInput } from "./Clearable";
4
3
  import { Suggestions } from "./Suggestions";
5
4
  import { ValueSuggestions } from "./ValueSuggestions";
6
5
 
7
6
  const SearchInputSource = require("!!raw-loader!./SearchInput");
8
- const LargeSource = require("!!raw-loader!./Large");
9
7
  const ClearableInputSource = require("!!raw-loader!./Clearable");
10
8
  const SuggestionsSource = require("!!raw-loader!./Suggestions");
11
9
  const ValueSuggestionsSource = require("!!raw-loader!./ValueSuggestions");
@@ -15,15 +13,10 @@ export const searchInput = {
15
13
  path: "/searchInput",
16
14
  examples: [
17
15
  {
18
- name: "Medium size",
16
+ name: "Sizes",
19
17
  component: <SearchInput />,
20
18
  source: SearchInputSource.default.toString()
21
19
  },
22
- {
23
- name: "Large size",
24
- component: <Large />,
25
- source: LargeSource.default.toString()
26
- },
27
20
  {
28
21
  name: "Clearable input",
29
22
  component: <ClearableSearchInput />,
@@ -1,18 +0,0 @@
1
- import { useState } from "react";
2
- import { VuiTextInput } from "../../../lib";
3
-
4
- export const Large = () => {
5
- const [value, setValue] = useState<string | undefined>();
6
-
7
- return (
8
- <VuiTextInput
9
- size="l"
10
- id="textInput"
11
- name="text"
12
- placeholder="Type something…"
13
- value={value}
14
- onSubmit={() => alert("Submit")}
15
- onChange={(event) => setValue(event.target.value)}
16
- />
17
- );
18
- };
@@ -1,29 +0,0 @@
1
- import { useState } from "react";
2
- import { VuiButtonPrimary, VuiFlexContainer, VuiFlexItem, VuiSearchInput } from "../../../lib";
3
-
4
- export const Large = () => {
5
- const [searchValue, setSearchValue] = useState("");
6
-
7
- return (
8
- <VuiFlexContainer alignItems="center">
9
- <VuiFlexItem grow={1}>
10
- <VuiSearchInput
11
- size="l"
12
- placeholder="Ask a question"
13
- value={searchValue}
14
- onChange={(e) => setSearchValue(e.target.value)}
15
- onSubmit={(e) => {
16
- e.preventDefault();
17
- alert(`Submit ${searchValue}`);
18
- }}
19
- />
20
- </VuiFlexItem>
21
-
22
- <VuiFlexItem>
23
- <VuiButtonPrimary color="primary" size="l">
24
- Search
25
- </VuiButtonPrimary>
26
- </VuiFlexItem>
27
- </VuiFlexContainer>
28
- );
29
- };