@vectara/vectara-ui 18.3.0 → 19.0.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.
Files changed (40) hide show
  1. package/lib/components/card/SimpleCard.d.ts +1 -1
  2. package/lib/components/card/_index.scss +5 -30
  3. package/lib/components/chip/Chip.d.ts +9 -0
  4. package/lib/components/chip/Chip.js +20 -0
  5. package/lib/components/chip/_index.scss +49 -0
  6. package/lib/components/composer/Composer.d.ts +41 -0
  7. package/lib/components/composer/Composer.js +148 -0
  8. package/lib/components/composer/_index.scss +4 -0
  9. package/lib/components/composer/useComposerHistory.d.ts +34 -0
  10. package/lib/components/composer/useComposerHistory.js +127 -0
  11. package/lib/components/context/Theme.d.ts +24 -0
  12. package/lib/components/context/Theme.js +78 -2
  13. package/lib/components/fileDropTarget/FileDropTarget.d.ts +8 -0
  14. package/lib/components/fileDropTarget/FileDropTarget.js +69 -0
  15. package/lib/components/fileDropTarget/_index.scss +34 -0
  16. package/lib/components/index.d.ts +6 -2
  17. package/lib/components/index.js +5 -1
  18. package/lib/components/patch/VuiPatch.d.ts +10 -0
  19. package/lib/components/patch/VuiPatch.js +32 -0
  20. package/lib/components/patch/_index.scss +30 -0
  21. package/lib/styles/index.css +167 -28
  22. package/package.json +1 -1
  23. package/src/docs/pages/card/SimpleCard.tsx +72 -6
  24. package/src/docs/pages/chip/Chip.tsx +49 -0
  25. package/src/docs/pages/chip/index.tsx +11 -0
  26. package/src/docs/pages/colorPalette/CategoricalColors.tsx +89 -0
  27. package/src/docs/pages/colorPalette/NeutralColors.tsx +42 -0
  28. package/src/docs/pages/colorPalette/SemanticColors.tsx +64 -0
  29. package/src/docs/pages/colorPalette/Swatch.tsx +59 -0
  30. package/src/docs/pages/colorPalette/TextAndBorderColors.tsx +37 -0
  31. package/src/docs/pages/colorPalette/Usage.tsx +72 -0
  32. package/src/docs/pages/colorPalette/index.tsx +43 -0
  33. package/src/docs/pages/composer/Composer.tsx +130 -0
  34. package/src/docs/pages/composer/index.tsx +11 -0
  35. package/src/docs/pages/fileDropTarget/FileDropTarget.tsx +80 -0
  36. package/src/docs/pages/fileDropTarget/index.tsx +11 -0
  37. package/src/docs/pages/patch/Icons.tsx +16 -0
  38. package/src/docs/pages/patch/Sizes.tsx +20 -0
  39. package/src/docs/pages/patch/index.tsx +22 -0
  40. package/src/docs/pages.tsx +11 -4
@@ -0,0 +1,80 @@
1
+ import { useRef, useState } from "react";
2
+ import { VuiFileDropTarget, VuiSpacer, VuiText, VuiTextColor, VuiToggle } from "../../../lib";
3
+
4
+ export const FileDropTarget = () => {
5
+ const [isScoped, setIsScoped] = useState(false);
6
+ const [droppedFiles, setDroppedFiles] = useState<string[]>([]);
7
+ const scopeRef = useRef<HTMLDivElement>(null);
8
+
9
+ // Only one target is mounted at a time: the global target listens on the whole
10
+ // document, so it would intercept drops meant for a scoped target.
11
+ return (
12
+ <>
13
+ <VuiToggle
14
+ label="Scope drop target to an element"
15
+ checked={isScoped}
16
+ onChange={(e) => {
17
+ setIsScoped(e.target.checked);
18
+ setDroppedFiles([]);
19
+ }}
20
+ />
21
+
22
+ <VuiSpacer size="m" />
23
+
24
+ <VuiText>
25
+ <p>
26
+ <VuiTextColor color="subdued">
27
+ {isScoped
28
+ ? "Drag a file over the box below. The overlay is scoped to the positioned container."
29
+ : "Drag a file anywhere over the page to reveal a full-screen overlay."}
30
+ </VuiTextColor>
31
+ </p>
32
+ </VuiText>
33
+
34
+ {droppedFiles.length > 0 && (
35
+ <>
36
+ <VuiSpacer size="xs" />
37
+ <VuiText size="s">
38
+ <p>Dropped: {droppedFiles.join(", ")}</p>
39
+ </VuiText>
40
+ </>
41
+ )}
42
+
43
+ <VuiSpacer size="s" />
44
+
45
+ {isScoped ? (
46
+ <div
47
+ ref={scopeRef}
48
+ style={{
49
+ position: "relative",
50
+ minHeight: 160,
51
+ display: "flex",
52
+ alignItems: "center",
53
+ justifyContent: "center",
54
+ padding: 16,
55
+ border: "1px dashed var(--vui-color-border)",
56
+ borderRadius: 8
57
+ }}
58
+ >
59
+ <VuiText>
60
+ <p>
61
+ <VuiTextColor color="subdued">Drop zone</VuiTextColor>
62
+ </p>
63
+ </VuiText>
64
+
65
+ <VuiFileDropTarget
66
+ scopeRef={scopeRef}
67
+ message={
68
+ <VuiText align="center" size="l">
69
+ <p>Release to drop here</p>
70
+ </VuiText>
71
+ }
72
+ onFilesDropped={(files) => setDroppedFiles(files.map((file) => file.name))}
73
+ />
74
+ </div>
75
+ ) : (
76
+ <VuiFileDropTarget onFilesDropped={(files) => setDroppedFiles(files.map((file) => file.name))} />
77
+ )}
78
+ </>
79
+ );
80
+ };
@@ -0,0 +1,11 @@
1
+ import { FileDropTarget } from "./FileDropTarget";
2
+ const FileDropTargetSource = require("!!raw-loader!./FileDropTarget");
3
+
4
+ export const fileDropTarget = {
5
+ name: "File drop target",
6
+ path: "/fileDropTarget",
7
+ example: {
8
+ component: <FileDropTarget />,
9
+ source: FileDropTargetSource.default.toString()
10
+ }
11
+ };
@@ -0,0 +1,16 @@
1
+ import { BiHelpCircle } from "react-icons/bi";
2
+ import { PATCH_COLOR, VuiIcon, VuiPatch, VuiFlexContainer } from "../../../lib";
3
+
4
+ export const Icons = () => {
5
+ return (
6
+ <VuiFlexContainer spacing="m" wrap>
7
+ {PATCH_COLOR.map((color) => (
8
+ <VuiPatch color={color}>
9
+ <VuiIcon size="m">
10
+ <BiHelpCircle />
11
+ </VuiIcon>
12
+ </VuiPatch>
13
+ ))}
14
+ </VuiFlexContainer>
15
+ );
16
+ };
@@ -0,0 +1,20 @@
1
+ import { BiCompass } from "react-icons/bi";
2
+ import { VuiPatch, VuiFlexContainer, VuiIcon } from "../../../lib";
3
+
4
+ const sizes = ["xs", "s", "m"] as const;
5
+
6
+ export const Sizes = () => {
7
+ return (
8
+ <VuiFlexContainer spacing="m" wrap>
9
+ {sizes.map((size) => (
10
+ <div>
11
+ <VuiPatch color="indigo" size={size}>
12
+ <VuiIcon>
13
+ <BiCompass />
14
+ </VuiIcon>
15
+ </VuiPatch>
16
+ </div>
17
+ ))}
18
+ </VuiFlexContainer>
19
+ );
20
+ };
@@ -0,0 +1,22 @@
1
+ import { Icons } from "./Icons";
2
+ import { Sizes } from "./Sizes";
3
+
4
+ const IconsSource = require("!!raw-loader!./Icons");
5
+ const SizesSource = require("!!raw-loader!./Sizes");
6
+
7
+ export const patch = {
8
+ name: "Patch",
9
+ path: "/patch",
10
+ examples: [
11
+ {
12
+ name: "Icons",
13
+ component: <Icons />,
14
+ source: IconsSource.default.toString()
15
+ },
16
+ {
17
+ name: "Sizes",
18
+ component: <Sizes />,
19
+ source: SizesSource.default.toString()
20
+ }
21
+ ]
22
+ };
@@ -8,14 +8,18 @@ import { callout } from "./pages/callout";
8
8
  import { card } from "./pages/card";
9
9
  import { chat } from "./pages/chat";
10
10
  import { checkbox } from "./pages/checkbox";
11
+ import { chip } from "./pages/chip";
11
12
  import { code } from "./pages/code";
12
13
  import { codeEditor } from "./pages/codeEditor";
14
+ import { colorPalette } from "./pages/colorPalette";
13
15
  import { complexConfigurationButton } from "./pages/complexConfigurationButton";
16
+ import { composer } from "./pages/composer";
14
17
  import { copyButton } from "./pages/copyButton";
15
18
  import { datePicker } from "./pages/datePicker";
16
19
  import { drawer } from "./pages/drawer";
17
20
  import { durationBar } from "./pages/durationBar";
18
21
  import { errorBoundary } from "./pages/errorBoundary";
22
+ import { fileDropTarget } from "./pages/fileDropTarget";
19
23
  import { flex } from "./pages/flex";
20
24
  import { formGroup } from "./pages/formGroup";
21
25
  import { grid } from "./pages/grid";
@@ -39,6 +43,7 @@ import { optionsButton } from "./pages/optionsButton";
39
43
  import { optionsList } from "./pages/optionsList";
40
44
  import { pagination } from "./pages/pagination";
41
45
  import { panel } from "./pages/panel";
46
+ import { patch } from "./pages/patch";
42
47
  import { popover } from "./pages/popover";
43
48
  import { progressBar } from "./pages/progressBar";
44
49
  import { prompt } from "./pages/prompt";
@@ -83,11 +88,11 @@ type Example = { component: React.ReactNode; source: string };
83
88
  export const categories: Category[] = [
84
89
  {
85
90
  name: "Query",
86
- pages: [chat, prompt, searchInput, searchResult, summary]
91
+ pages: [chat, composer, prompt, searchInput, searchResult, summary]
87
92
  },
88
93
  {
89
94
  name: "Application",
90
- pages: [app, drawer, modal, portalContainer, notifications, accountButton, theme]
95
+ pages: [app, drawer, modal, portalContainer, notifications, accountButton, theme, colorPalette]
91
96
  },
92
97
  {
93
98
  name: "Info",
@@ -99,12 +104,13 @@ export const categories: Category[] = [
99
104
  },
100
105
  {
101
106
  name: "Navigation",
102
- pages: [tabs, stepsVertical, steps]
107
+ pages: [tabs, stepsVertical, steps, chip]
103
108
  },
104
109
  {
105
110
  name: "Content",
106
111
  pages: [
107
112
  badge,
113
+ patch,
108
114
  status,
109
115
  callout,
110
116
  code,
@@ -137,7 +143,8 @@ export const categories: Category[] = [
137
143
  radioButton,
138
144
  superCheckboxGroup,
139
145
  superRadioGroup,
140
- itemsInput
146
+ itemsInput,
147
+ fileDropTarget
141
148
  ]
142
149
  },
143
150
  {