@vectara/vectara-ui 0.0.2

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 (333) hide show
  1. package/.github/workflows/deploy-pages-site.yml +26 -0
  2. package/.github/workflows/deploy-pr-preview.yml +25 -0
  3. package/CHANGELOG.md +13 -0
  4. package/NO_LICENSE +3 -0
  5. package/lib/components/accordion/Accordion.d.ts +8 -0
  6. package/lib/components/accordion/Accordion.js +27 -0
  7. package/lib/components/accordion/_index.scss +23 -0
  8. package/lib/components/accountMenu/AccountMenu.d.ts +13 -0
  9. package/lib/components/accountMenu/AccountMenu.js +7 -0
  10. package/lib/components/accountMenu/_index.scss +20 -0
  11. package/lib/components/app/AppContent.d.ts +9 -0
  12. package/lib/components/app/AppContent.js +28 -0
  13. package/lib/components/app/AppHeader.d.ts +7 -0
  14. package/lib/components/app/AppHeader.js +18 -0
  15. package/lib/components/app/AppLayout.d.ts +9 -0
  16. package/lib/components/app/AppLayout.js +10 -0
  17. package/lib/components/app/_index.scss +4 -0
  18. package/lib/components/app/appContent.scss +26 -0
  19. package/lib/components/app/appHeader.scss +15 -0
  20. package/lib/components/app/appLayout.scss +23 -0
  21. package/lib/components/app/appSideNav/AppSideNav.d.ts +7 -0
  22. package/lib/components/app/appSideNav/AppSideNav.js +46 -0
  23. package/lib/components/app/appSideNav/AppSideNavLink.d.ts +4 -0
  24. package/lib/components/app/appSideNav/AppSideNavLink.js +26 -0
  25. package/lib/components/app/appSideNav/AppSideNavSections.d.ts +2 -0
  26. package/lib/components/app/appSideNav/AppSideNavSections.js +11 -0
  27. package/lib/components/app/appSideNav/AppSideNavTree.d.ts +2 -0
  28. package/lib/components/app/appSideNav/AppSideNavTree.js +38 -0
  29. package/lib/components/app/appSideNav/_index.scss +17 -0
  30. package/lib/components/app/appSideNav/appSideNav.scss +75 -0
  31. package/lib/components/app/appSideNav/appSideNavSections.scss +33 -0
  32. package/lib/components/app/appSideNav/appSideNavTree.scss +25 -0
  33. package/lib/components/app/types.d.ts +21 -0
  34. package/lib/components/app/types.js +1 -0
  35. package/lib/components/badge/Badge.d.ts +14 -0
  36. package/lib/components/badge/Badge.js +33 -0
  37. package/lib/components/badge/_index.scss +64 -0
  38. package/lib/components/button/BaseButton.d.ts +28 -0
  39. package/lib/components/button/BaseButton.js +65 -0
  40. package/lib/components/button/ButtonPrimary.d.ts +8 -0
  41. package/lib/components/button/ButtonPrimary.js +42 -0
  42. package/lib/components/button/ButtonSecondary.d.ts +10 -0
  43. package/lib/components/button/ButtonSecondary.js +43 -0
  44. package/lib/components/button/ButtonTertiary.d.ts +10 -0
  45. package/lib/components/button/ButtonTertiary.js +43 -0
  46. package/lib/components/button/IconButton.d.ts +16 -0
  47. package/lib/components/button/IconButton.js +29 -0
  48. package/lib/components/button/_index.scss +5 -0
  49. package/lib/components/button/baseButton.scss +94 -0
  50. package/lib/components/button/buttonPrimary.scss +51 -0
  51. package/lib/components/button/buttonSecondary.scss +54 -0
  52. package/lib/components/button/buttonTertiary.scss +56 -0
  53. package/lib/components/button/createButtonIcon.d.ts +3 -0
  54. package/lib/components/button/createButtonIcon.js +24 -0
  55. package/lib/components/button/iconButton.scss +44 -0
  56. package/lib/components/button/types.d.ts +3 -0
  57. package/lib/components/button/types.js +2 -0
  58. package/lib/components/callout/Callout.d.ts +13 -0
  59. package/lib/components/callout/Callout.js +40 -0
  60. package/lib/components/callout/_index.scss +49 -0
  61. package/lib/components/callout/types.d.ts +3 -0
  62. package/lib/components/callout/types.js +2 -0
  63. package/lib/components/card/Card.d.ts +14 -0
  64. package/lib/components/card/Card.js +29 -0
  65. package/lib/components/card/_index.scss +114 -0
  66. package/lib/components/chat/Chat.d.ts +17 -0
  67. package/lib/components/chat/Chat.js +130 -0
  68. package/lib/components/chat/ChatInspector.d.ts +7 -0
  69. package/lib/components/chat/ChatInspector.js +12 -0
  70. package/lib/components/chat/ChatPanel.d.ts +7 -0
  71. package/lib/components/chat/ChatPanel.js +11 -0
  72. package/lib/components/chat/ChatSearchResult.d.ts +16 -0
  73. package/lib/components/chat/ChatSearchResult.js +26 -0
  74. package/lib/components/chat/ChatTurn.d.ts +9 -0
  75. package/lib/components/chat/ChatTurn.js +19 -0
  76. package/lib/components/chat/_index.scss +150 -0
  77. package/lib/components/chat/chatTurn.scss +38 -0
  78. package/lib/components/chat/types.d.ts +17 -0
  79. package/lib/components/chat/types.js +19 -0
  80. package/lib/components/code/Code.d.ts +17 -0
  81. package/lib/components/code/Code.js +44 -0
  82. package/lib/components/code/_index.scss +33 -0
  83. package/lib/components/code/types.d.ts +1 -0
  84. package/lib/components/code/types.js +1 -0
  85. package/lib/components/context/Context.d.ts +18 -0
  86. package/lib/components/context/Context.js +34 -0
  87. package/lib/components/context/Context.test.util.d.ts +2 -0
  88. package/lib/components/context/Context.test.util.js +22 -0
  89. package/lib/components/copyButton/CopyButton.d.ts +10 -0
  90. package/lib/components/copyButton/CopyButton.js +50 -0
  91. package/lib/components/drawer/Drawer.d.ts +13 -0
  92. package/lib/components/drawer/Drawer.js +53 -0
  93. package/lib/components/drawer/_index.scss +73 -0
  94. package/lib/components/flex/FlexContainer.d.ts +36 -0
  95. package/lib/components/flex/FlexContainer.js +53 -0
  96. package/lib/components/flex/FlexItem.d.ts +22 -0
  97. package/lib/components/flex/FlexItem.js +36 -0
  98. package/lib/components/flex/_flexContainer.scss +79 -0
  99. package/lib/components/flex/_flexItem.scss +64 -0
  100. package/lib/components/flex/_index.scss +2 -0
  101. package/lib/components/flex/types.d.ts +2 -0
  102. package/lib/components/flex/types.js +1 -0
  103. package/lib/components/form/_index.scss +7 -0
  104. package/lib/components/form/checkbox/Checkbox.d.ts +8 -0
  105. package/lib/components/form/checkbox/Checkbox.js +24 -0
  106. package/lib/components/form/checkbox/_index.scss +3 -0
  107. package/lib/components/form/index.d.ts +10 -0
  108. package/lib/components/form/index.js +9 -0
  109. package/lib/components/form/input/BasicInput.d.ts +15 -0
  110. package/lib/components/form/input/BasicInput.js +30 -0
  111. package/lib/components/form/input/NumberInput.d.ts +8 -0
  112. package/lib/components/form/input/NumberInput.js +61 -0
  113. package/lib/components/form/input/PasswordInput.d.ts +7 -0
  114. package/lib/components/form/input/PasswordInput.js +21 -0
  115. package/lib/components/form/input/TextInput.d.ts +6 -0
  116. package/lib/components/form/input/TextInput.js +21 -0
  117. package/lib/components/form/input/_index.scss +24 -0
  118. package/lib/components/form/label/Label.d.ts +7 -0
  119. package/lib/components/form/label/Label.js +18 -0
  120. package/lib/components/form/label/_index.scss +5 -0
  121. package/lib/components/form/radioButton/RadioButton.d.ts +9 -0
  122. package/lib/components/form/radioButton/RadioButton.js +24 -0
  123. package/lib/components/form/radioButton/_index.scss +3 -0
  124. package/lib/components/form/select/Select.d.ts +17 -0
  125. package/lib/components/form/select/Select.js +34 -0
  126. package/lib/components/form/select/_index.scss +56 -0
  127. package/lib/components/form/superRadioGroup/SuperRadioButton.d.ts +7 -0
  128. package/lib/components/form/superRadioGroup/SuperRadioButton.js +22 -0
  129. package/lib/components/form/superRadioGroup/SuperRadioGroup.d.ts +8 -0
  130. package/lib/components/form/superRadioGroup/SuperRadioGroup.js +6 -0
  131. package/lib/components/form/superRadioGroup/_index.scss +31 -0
  132. package/lib/components/form/superRadioGroup/types.d.ts +8 -0
  133. package/lib/components/form/superRadioGroup/types.js +1 -0
  134. package/lib/components/form/textArea/TextArea.d.ts +12 -0
  135. package/lib/components/form/textArea/TextArea.js +21 -0
  136. package/lib/components/form/textArea/_index.scss +14 -0
  137. package/lib/components/formGroup/FormGroup.d.ts +10 -0
  138. package/lib/components/formGroup/FormGroup.js +27 -0
  139. package/lib/components/grid/Grid.d.ts +12 -0
  140. package/lib/components/grid/Grid.js +20 -0
  141. package/lib/components/grid/_index.scss +51 -0
  142. package/lib/components/horizontalRule/HorizontalRule.d.ts +6 -0
  143. package/lib/components/horizontalRule/HorizontalRule.js +4 -0
  144. package/lib/components/horizontalRule/_index.scss +40 -0
  145. package/lib/components/icon/Icon.d.ts +11 -0
  146. package/lib/components/icon/Icon.js +37 -0
  147. package/lib/components/icon/_index.scss +25 -0
  148. package/lib/components/icon/types.d.ts +2 -0
  149. package/lib/components/icon/types.js +12 -0
  150. package/lib/components/index.d.ts +75 -0
  151. package/lib/components/index.js +67 -0
  152. package/lib/components/infoTable/InfoTable.d.ts +24 -0
  153. package/lib/components/infoTable/InfoTable.js +24 -0
  154. package/lib/components/infoTable/_index.scss +53 -0
  155. package/lib/components/link/Link.d.ts +3 -0
  156. package/lib/components/link/Link.js +36 -0
  157. package/lib/components/link/Link.test.d.ts +1 -0
  158. package/lib/components/link/Link.test.js +40 -0
  159. package/lib/components/link/_index.scss +17 -0
  160. package/lib/components/link/types.d.ts +15 -0
  161. package/lib/components/link/types.js +1 -0
  162. package/lib/components/list/List.d.ts +12 -0
  163. package/lib/components/list/List.js +15 -0
  164. package/lib/components/list/_index.scss +29 -0
  165. package/lib/components/menu/Menu.d.ts +7 -0
  166. package/lib/components/menu/Menu.js +6 -0
  167. package/lib/components/menu/MenuItem.d.ts +10 -0
  168. package/lib/components/menu/MenuItem.js +31 -0
  169. package/lib/components/menu/_index.scss +75 -0
  170. package/lib/components/modal/Modal.d.ts +13 -0
  171. package/lib/components/modal/Modal.js +53 -0
  172. package/lib/components/modal/_index.scss +85 -0
  173. package/lib/components/notification/Notification.d.ts +12 -0
  174. package/lib/components/notification/Notification.js +23 -0
  175. package/lib/components/notification/Notifications.d.ts +10 -0
  176. package/lib/components/notification/Notifications.js +35 -0
  177. package/lib/components/notification/_index.scss +99 -0
  178. package/lib/components/optionsButton/OptionsButton.d.ts +7 -0
  179. package/lib/components/optionsButton/OptionsButton.js +25 -0
  180. package/lib/components/optionsButton/_index.scss +42 -0
  181. package/lib/components/optionsList/OptionsList.d.ts +13 -0
  182. package/lib/components/optionsList/OptionsList.js +31 -0
  183. package/lib/components/optionsList/OptionsListItem.d.ts +10 -0
  184. package/lib/components/optionsList/OptionsListItem.js +41 -0
  185. package/lib/components/optionsList/_index.scss +84 -0
  186. package/lib/components/optionsList/types.d.ts +13 -0
  187. package/lib/components/optionsList/types.js +1 -0
  188. package/lib/components/popover/Popover.d.ts +11 -0
  189. package/lib/components/popover/Popover.js +91 -0
  190. package/lib/components/popover/_index.scss +29 -0
  191. package/lib/components/portal/Portal.d.ts +6 -0
  192. package/lib/components/portal/Portal.js +16 -0
  193. package/lib/components/progressBar/ProgressBar.d.ts +9 -0
  194. package/lib/components/progressBar/ProgressBar.js +26 -0
  195. package/lib/components/progressBar/_index.scss +63 -0
  196. package/lib/components/prompt/Prompt.d.ts +20 -0
  197. package/lib/components/prompt/Prompt.js +19 -0
  198. package/lib/components/prompt/_index.scss +70 -0
  199. package/lib/components/screenBlock/ScreenBlock.d.ts +6 -0
  200. package/lib/components/screenBlock/ScreenBlock.js +4 -0
  201. package/lib/components/screenBlock/_index.scss +17 -0
  202. package/lib/components/searchInput/SearchInput.d.ts +13 -0
  203. package/lib/components/searchInput/SearchInput.js +19 -0
  204. package/lib/components/searchInput/_index.scss +49 -0
  205. package/lib/components/searchResult/SearchResult.d.ts +21 -0
  206. package/lib/components/searchResult/SearchResult.js +33 -0
  207. package/lib/components/searchResult/SearchResult.test.d.ts +1 -0
  208. package/lib/components/searchResult/SearchResult.test.js +280 -0
  209. package/lib/components/searchResult/_index.scss +29 -0
  210. package/lib/components/searchSelect/SearchSelect.d.ts +11 -0
  211. package/lib/components/searchSelect/SearchSelect.js +78 -0
  212. package/lib/components/searchSelect/_index.scss +13 -0
  213. package/lib/components/setting/Setting.d.ts +12 -0
  214. package/lib/components/setting/Setting.js +24 -0
  215. package/lib/components/spacer/Spacer.d.ts +6 -0
  216. package/lib/components/spacer/Spacer.js +6 -0
  217. package/lib/components/spacer/_index.scss +20 -0
  218. package/lib/components/spacer/types.d.ts +1 -0
  219. package/lib/components/spacer/types.js +1 -0
  220. package/lib/components/spinner/Spinner.d.ts +7 -0
  221. package/lib/components/spinner/Spinner.js +15 -0
  222. package/lib/components/spinner/_index.scss +52 -0
  223. package/lib/components/spinner/types.d.ts +3 -0
  224. package/lib/components/spinner/types.js +2 -0
  225. package/lib/components/statList/StatList.d.ts +9 -0
  226. package/lib/components/statList/StatList.js +15 -0
  227. package/lib/components/statList/_index.scss +3 -0
  228. package/lib/components/status/Status.d.ts +6 -0
  229. package/lib/components/status/Status.js +24 -0
  230. package/lib/components/summary/Summary.d.ts +7 -0
  231. package/lib/components/summary/Summary.js +43 -0
  232. package/lib/components/summary/Summary.test.d.ts +1 -0
  233. package/lib/components/summary/Summary.test.js +544 -0
  234. package/lib/components/summary/SummaryCitation.d.ts +8 -0
  235. package/lib/components/summary/SummaryCitation.js +20 -0
  236. package/lib/components/summary/_index.scss +29 -0
  237. package/lib/components/table/Table.d.ts +44 -0
  238. package/lib/components/table/Table.js +117 -0
  239. package/lib/components/table/TableBulkActions.d.ts +7 -0
  240. package/lib/components/table/TableBulkActions.js +34 -0
  241. package/lib/components/table/TableCell.d.ts +5 -0
  242. package/lib/components/table/TableCell.js +4 -0
  243. package/lib/components/table/TableContent.d.ts +6 -0
  244. package/lib/components/table/TableContent.js +6 -0
  245. package/lib/components/table/TableHeaderCell.d.ts +9 -0
  246. package/lib/components/table/TableHeaderCell.js +8 -0
  247. package/lib/components/table/TablePager.d.ts +9 -0
  248. package/lib/components/table/TablePager.js +9 -0
  249. package/lib/components/table/TablePagination.d.ts +10 -0
  250. package/lib/components/table/TablePagination.js +18 -0
  251. package/lib/components/table/TableRowActions.d.ts +15 -0
  252. package/lib/components/table/TableRowActions.js +29 -0
  253. package/lib/components/table/_index.scss +70 -0
  254. package/lib/components/table/createPagination.d.ts +4 -0
  255. package/lib/components/table/createPagination.js +44 -0
  256. package/lib/components/table/createPagination.test.d.ts +1 -0
  257. package/lib/components/table/createPagination.test.js +32 -0
  258. package/lib/components/table/types.d.ts +1 -0
  259. package/lib/components/table/types.js +1 -0
  260. package/lib/components/tabs/Tab.d.ts +9 -0
  261. package/lib/components/tabs/Tab.js +27 -0
  262. package/lib/components/tabs/TabbedRoutes.d.ts +15 -0
  263. package/lib/components/tabs/TabbedRoutes.js +15 -0
  264. package/lib/components/tabs/Tabs.d.ts +10 -0
  265. package/lib/components/tabs/Tabs.js +8 -0
  266. package/lib/components/tabs/_index.scss +103 -0
  267. package/lib/components/tabs/types.d.ts +2 -0
  268. package/lib/components/tabs/types.js +1 -0
  269. package/lib/components/toggle/Toggle.d.ts +8 -0
  270. package/lib/components/toggle/Toggle.js +25 -0
  271. package/lib/components/toggle/_index.scss +55 -0
  272. package/lib/components/topicButton/TopicButton.d.ts +10 -0
  273. package/lib/components/topicButton/TopicButton.js +30 -0
  274. package/lib/components/topicButton/_index.scss +21 -0
  275. package/lib/components/typography/Text.d.ts +13 -0
  276. package/lib/components/typography/Text.js +24 -0
  277. package/lib/components/typography/TextColor.d.ts +9 -0
  278. package/lib/components/typography/TextColor.js +6 -0
  279. package/lib/components/typography/Title.d.ts +11 -0
  280. package/lib/components/typography/Title.js +20 -0
  281. package/lib/components/typography/_index.scss +3 -0
  282. package/lib/components/typography/_text.scss +150 -0
  283. package/lib/components/typography/_textColor.scss +15 -0
  284. package/lib/components/typography/_title.scss +68 -0
  285. package/lib/components/typography/types.d.ts +4 -0
  286. package/lib/components/typography/types.js +3 -0
  287. package/lib/index.d.ts +1 -0
  288. package/lib/index.js +1 -0
  289. package/lib/sassUtils/_animation.scss +1 -0
  290. package/lib/sassUtils/_app.scss +1 -0
  291. package/lib/sassUtils/_borders.scss +2 -0
  292. package/lib/sassUtils/_colors.scss +24 -0
  293. package/lib/sassUtils/_depth.scss +8 -0
  294. package/lib/sassUtils/_mixins.scss +11 -0
  295. package/lib/sassUtils/_shadows.scss +5 -0
  296. package/lib/sassUtils/_sizes.scss +10 -0
  297. package/lib/sassUtils/_typography.scss +20 -0
  298. package/lib/sassUtils/index.scss +10 -0
  299. package/lib/styles/index.css +3229 -0
  300. package/lib/utils/citations/applyCitationOrder.d.ts +1 -0
  301. package/lib/utils/citations/applyCitationOrder.js +19 -0
  302. package/lib/utils/citations/applyCitationOrder.test.d.ts +1 -0
  303. package/lib/utils/citations/applyCitationOrder.test.js +65 -0
  304. package/lib/utils/citations/extractCitations.d.ts +4 -0
  305. package/lib/utils/citations/extractCitations.js +26 -0
  306. package/lib/utils/citations/extractCitations.test.d.ts +1 -0
  307. package/lib/utils/citations/extractCitations.test.js +40 -0
  308. package/lib/utils/citations/index.d.ts +5 -0
  309. package/lib/utils/citations/index.js +5 -0
  310. package/lib/utils/citations/removeCitations.d.ts +1 -0
  311. package/lib/utils/citations/removeCitations.js +2 -0
  312. package/lib/utils/citations/removeCitations.test.d.ts +1 -0
  313. package/lib/utils/citations/removeCitations.test.js +11 -0
  314. package/lib/utils/citations/reorderCitations.d.ts +1 -0
  315. package/lib/utils/citations/reorderCitations.js +9 -0
  316. package/lib/utils/citations/reorderCitations.test.d.ts +1 -0
  317. package/lib/utils/citations/reorderCitations.test.js +6 -0
  318. package/lib/utils/citations/sanitizeCitations.d.ts +1 -0
  319. package/lib/utils/citations/sanitizeCitations.js +30 -0
  320. package/lib/utils/citations/sanitizeCitations.test.d.ts +1 -0
  321. package/lib/utils/citations/sanitizeCitations.test.js +11 -0
  322. package/lib/utils/createId.d.ts +1 -0
  323. package/lib/utils/createId.js +10 -0
  324. package/lib/utils/getTrackingProps.d.ts +7 -0
  325. package/lib/utils/getTrackingProps.js +18 -0
  326. package/lib/utils/index.d.ts +1 -0
  327. package/lib/utils/index.js +1 -0
  328. package/lib/utils/truncateString.d.ts +2 -0
  329. package/lib/utils/truncateString.js +20 -0
  330. package/lib/utils/truncateString.test.d.ts +1 -0
  331. package/lib/utils/truncateString.test.js +59 -0
  332. package/licenses.txt +9035 -0
  333. package/package.json +100 -0
@@ -0,0 +1,56 @@
1
+ @use "sass:map";
2
+
3
+ .vuiButtonTertiary {
4
+ padding-left: $sizeXs;
5
+ padding-right: $sizeXs;
6
+
7
+ &:hover {
8
+ text-decoration: underline;
9
+ }
10
+ }
11
+
12
+ .vuiButtonTertiary-noPadding {
13
+ padding: 0;
14
+ }
15
+
16
+ // Color
17
+ $color: (
18
+ accent: (
19
+ "color": $colorAccent,
20
+ "selected-color": transparentize($colorAccent, 0.9)
21
+ ),
22
+ primary: (
23
+ "color": $colorPrimary,
24
+ "selected-color": transparentize($colorPrimary, 0.9)
25
+ ),
26
+ success: (
27
+ "color": $colorSuccess,
28
+ "selected-color": transparentize($colorSuccess, 0.9)
29
+ ),
30
+ danger: (
31
+ "color": $colorDanger,
32
+ "selected-color": transparentize($colorDanger, 0.9)
33
+ ),
34
+ warning: (
35
+ "color": $colorWarning,
36
+ "selected-color": transparentize($colorWarning, 0.9)
37
+ ),
38
+ neutral: (
39
+ "color": $colorText,
40
+ "selected-color": transparentize($colorText, 0.9)
41
+ ),
42
+ subdued: (
43
+ "color": $colorSubdued,
44
+ "selected-color": transparentize($colorSubdued, 0.9)
45
+ )
46
+ );
47
+
48
+ @each $colorName, $colorValue in $color {
49
+ .vuiButtonTertiary--#{$colorName} {
50
+ color: #{map.get($colorValue, "color")};
51
+
52
+ &.vuiButtonTertiary-isSelected {
53
+ background-color: #{map.get($colorValue, "selected-color")};
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,3 @@
1
+ import { BaseButtonProps } from "./BaseButton";
2
+ import { ButtonColor } from "./types";
3
+ export declare const createButtonIcon: (icon: BaseButtonProps["icon"], size: BaseButtonProps["size"], color: ButtonColor, colorToIconColorMap?: Record<ButtonColor, string>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
@@ -0,0 +1,24 @@
1
+ import { cloneElement } from "react";
2
+ const sizeToIconSizeMap = {
3
+ xs: "xs",
4
+ s: "xs",
5
+ m: "s",
6
+ l: "m"
7
+ };
8
+ const defaultColorToIconColorMap = {
9
+ accent: "accent",
10
+ primary: "primary",
11
+ success: "success",
12
+ danger: "danger",
13
+ warning: "warning",
14
+ neutral: "neutral",
15
+ subdued: "subdued"
16
+ };
17
+ export const createButtonIcon = (icon, size, color, colorToIconColorMap = defaultColorToIconColorMap) => {
18
+ return icon
19
+ ? cloneElement(icon, {
20
+ size: size ? sizeToIconSizeMap[size] : "s",
21
+ color: icon.props.color === "inherit" ? colorToIconColorMap[color] : icon.props.color
22
+ })
23
+ : null;
24
+ };
@@ -0,0 +1,44 @@
1
+ .vuiIconButton {
2
+ display: inline-block;
3
+ border-radius: $sizeXxs;
4
+ padding: $sizeXxs;
5
+ line-height: 1;
6
+ }
7
+
8
+ // Color
9
+ $color: (
10
+ accent: $colorAccent,
11
+ primary: $colorPrimary,
12
+ success: $colorSuccess,
13
+ warning: $colorWarning,
14
+ danger: $colorDanger,
15
+ neutral: $colorText,
16
+ subdued: $colorSubdued
17
+ );
18
+
19
+ @each $colorName, $colorValue in $color {
20
+ .vuiIconButton--#{$colorName} {
21
+ color: $colorValue;
22
+ background-color: transparentize($color: $colorValue, $amount: 1);
23
+
24
+ &:hover {
25
+ background-color: transparentize($color: $colorValue, $amount: 0.9);
26
+ }
27
+ }
28
+ }
29
+
30
+ // Size
31
+ .vuiIconButton--xs {
32
+ padding: $sizeXxs;
33
+ height: 24px;
34
+ }
35
+
36
+ .vuiIconButton--s {
37
+ padding: $sizeXs * 0.75;
38
+ height: 28px;
39
+ }
40
+
41
+ .vuiIconButton--m {
42
+ padding: $sizeXs;
43
+ height: 34px;
44
+ }
@@ -0,0 +1,3 @@
1
+ export declare const BUTTON_SIZE: readonly ["xs", "s", "m", "l"];
2
+ export declare const BUTTON_COLOR: readonly ["accent", "primary", "success", "danger", "warning", "neutral", "subdued"];
3
+ export type ButtonColor = (typeof BUTTON_COLOR)[number];
@@ -0,0 +1,2 @@
1
+ export const BUTTON_SIZE = ["xs", "s", "m", "l"];
2
+ export const BUTTON_COLOR = ["accent", "primary", "success", "danger", "warning", "neutral", "subdued"];
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from "react";
2
+ import { CALLOUT_SIZE, CalloutColor } from "./types";
3
+ declare const HEADING_ELEMENT: readonly ["h1", "h2", "h3", "h4", "h5", "h6", "p"];
4
+ type Props = {
5
+ children?: ReactNode;
6
+ title: string;
7
+ headingElement: (typeof HEADING_ELEMENT)[number];
8
+ color: CalloutColor;
9
+ size?: (typeof CALLOUT_SIZE)[number];
10
+ onDismiss?: () => void;
11
+ };
12
+ export declare const VuiCallout: ({ children, title, headingElement, color, size, onDismiss, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,40 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import classNames from "classnames";
14
+ import { VuiSpacer } from "../spacer/Spacer";
15
+ import { VuiTitle } from "../typography/Title";
16
+ import { VuiTextColor } from "../typography/TextColor";
17
+ import { VuiText } from "../typography/Text";
18
+ import { VuiFlexContainer } from "../flex/FlexContainer";
19
+ import { VuiFlexItem } from "../flex/FlexItem";
20
+ import { VuiIconButton } from "../button/IconButton";
21
+ import { BiX } from "react-icons/bi";
22
+ const HEADING_ELEMENT = ["h1", "h2", "h3", "h4", "h5", "h6", "p"];
23
+ const sizeToTitleSizeMap = {
24
+ s: "xs",
25
+ m: "s"
26
+ };
27
+ const sizeToSpacerSizeMap = {
28
+ s: "xxs",
29
+ m: "xs"
30
+ };
31
+ const sizeToContentSizeMap = {
32
+ s: "xs",
33
+ m: "s"
34
+ };
35
+ export const VuiCallout = (_a) => {
36
+ var { children, title, headingElement, color, size = "m", onDismiss } = _a, rest = __rest(_a, ["children", "title", "headingElement", "color", "size", "onDismiss"]);
37
+ const classes = classNames("vuiCallout", `vuiCallout--${color}`, `vuiCallout--${size}`);
38
+ const HeadingElement = headingElement;
39
+ return (_jsxs("div", Object.assign({ className: classes }, rest, { children: [_jsxs(VuiFlexContainer, Object.assign({ alignItems: "start", justifyContent: "spaceBetween" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: 1 }, { children: _jsx(VuiTitle, Object.assign({ size: sizeToTitleSizeMap[size] }, { children: _jsx(HeadingElement, { children: _jsx(VuiTextColor, Object.assign({ color: color }, { children: title })) }) })) })), onDismiss && (_jsx(VuiFlexItem, Object.assign({ shrink: false, grow: false }, { children: _jsx(VuiIconButton, { className: "vuiCallout__closeButton", "data-testid": "calloutCloseButton", color: color, onClick: onDismiss, icon: _jsx(BiX, {}), size: "s" }) })))] })), children && (_jsxs(_Fragment, { children: [_jsx(VuiSpacer, { size: sizeToSpacerSizeMap[size] }), _jsx(VuiText, Object.assign({ size: sizeToContentSizeMap[size] }, { children: children }))] }))] })));
40
+ };
@@ -0,0 +1,49 @@
1
+ @use "sass:map";
2
+
3
+ .vuiCallout {
4
+ width: 100%;
5
+ }
6
+
7
+ .vuiCallout--m {
8
+ padding: $sizeM;
9
+
10
+ .vuiCallout__closeButton {
11
+ margin: -$sizeM * 0.5;
12
+ }
13
+ }
14
+
15
+ .vuiCallout--s {
16
+ padding: $sizeS;
17
+
18
+ .vuiCallout__closeButton {
19
+ margin: -$sizeS * 0.5;
20
+ }
21
+ }
22
+
23
+ // Color
24
+ $color: (
25
+ accent: (
26
+ "background-color": transparentize($colorAccent, 0.9)
27
+ ),
28
+ primary: (
29
+ "background-color": $colorPrimaryLightShade
30
+ ),
31
+ success: (
32
+ "background-color": transparentize($colorSuccess, 0.9)
33
+ ),
34
+ warning: (
35
+ "background-color": transparentize($colorWarning, 0.9)
36
+ ),
37
+ danger: (
38
+ "background-color": $colorDangerLightShade
39
+ ),
40
+ neutral: (
41
+ "background-color": $colorLightShade
42
+ )
43
+ );
44
+
45
+ @each $colorName, $colorValue in $color {
46
+ .vuiCallout--#{$colorName} {
47
+ background-color: #{map.get($colorValue, "background-color")};
48
+ }
49
+ }
@@ -0,0 +1,3 @@
1
+ export declare const CALLOUT_COLOR: readonly ["neutral", "primary", "danger", "success", "accent", "warning"];
2
+ export declare const CALLOUT_SIZE: readonly ["s", "m"];
3
+ export type CalloutColor = (typeof CALLOUT_COLOR)[number];
@@ -0,0 +1,2 @@
1
+ export const CALLOUT_COLOR = ["neutral", "primary", "danger", "success", "accent", "warning"];
2
+ export const CALLOUT_SIZE = ["s", "m"];
@@ -0,0 +1,14 @@
1
+ type Props = {
2
+ header?: React.ReactNode;
3
+ body?: React.ReactNode;
4
+ footer?: React.ReactNode;
5
+ align?: "center" | "left" | "right";
6
+ className?: string;
7
+ interactive?: boolean;
8
+ href?: string;
9
+ padding?: "s" | "m" | "l";
10
+ highlight?: boolean;
11
+ ungrouped?: boolean;
12
+ };
13
+ export declare const VuiCard: ({ header, body, footer, align, interactive, href, className, padding, highlight, ungrouped, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,29 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import classNames from "classnames";
14
+ export const VuiCard = (_a) => {
15
+ var { header, body, footer, align = "left", interactive, href, className, padding = "s", highlight, ungrouped } = _a, rest = __rest(_a, ["header", "body", "footer", "align", "interactive", "href", "className", "padding", "highlight", "ungrouped"]);
16
+ const classes = classNames("vuiCard", `vuiCard--${align}`, `vuiCard--${padding}`, {
17
+ "vuiCard--interactive": interactive && !href,
18
+ "vuiCard--link": href,
19
+ "vuiCard--highlight": highlight,
20
+ "vuiCard--ungrouped": ungrouped
21
+ }, className);
22
+ const headerContent = header && _jsx("div", Object.assign({ className: "vuiCard__header" }, { children: header }));
23
+ const bodyContent = body && _jsx("div", Object.assign({ className: "vuiCard__body" }, { children: body }));
24
+ const footerContent = footer && _jsx("div", Object.assign({ className: "vuiCard__footer" }, { children: footer }));
25
+ if (href) {
26
+ return (_jsxs("a", Object.assign({ className: classes, href: href }, rest, { children: [headerContent, bodyContent, footerContent] })));
27
+ }
28
+ return (_jsxs("div", Object.assign({ className: classes }, rest, { children: [headerContent, bodyContent, footerContent] })));
29
+ };
@@ -0,0 +1,114 @@
1
+ .vuiCard {
2
+ display: flex;
3
+ flex-direction: column;
4
+ background-color: $colorEmptyShade;
5
+ border-radius: $sizeXs;
6
+ box-shadow: $shadowLargeStart;
7
+ width: 100%;
8
+ height: 100%;
9
+ transition: box-shadow $transitionSpeed;
10
+ overflow: hidden;
11
+ }
12
+
13
+ .vuiCard--interactive {
14
+ &:hover {
15
+ box-shadow: $shadowLargeEnd;
16
+ z-index: 1;
17
+ }
18
+ }
19
+
20
+ .vuiCard--ungrouped {
21
+ height: auto;
22
+ }
23
+
24
+ .vuiCard--center {
25
+ align-items: center;
26
+ text-align: center;
27
+
28
+ .vuiCard__header,
29
+ .vuiCard__body,
30
+ .vuiCard__footer {
31
+ align-items: center;
32
+ text-align: center;
33
+ }
34
+ }
35
+
36
+ .vuiCard--left {
37
+ align-items: flex-start;
38
+ text-align: left;
39
+
40
+ .vuiCard__header,
41
+ .vuiCard__body,
42
+ .vuiCard__footer {
43
+ align-items: flex-start;
44
+ text-align: left;
45
+ }
46
+ }
47
+
48
+ .vuiCard__header {
49
+ display: flex;
50
+ flex-direction: column;
51
+ width: 100%;
52
+ padding: $sizeM $sizeL;
53
+ }
54
+
55
+ .vuiCard__body {
56
+ display: flex;
57
+ flex-direction: column;
58
+ width: 100%;
59
+ border-top: 1px solid $borderColorLight;
60
+ padding: $sizeM $sizeL;
61
+ flex-grow: 1;
62
+ }
63
+
64
+ .vuiCard__footer {
65
+ display: flex;
66
+ flex-direction: column;
67
+ width: 100%;
68
+ padding: 0 $sizeL $sizeM;
69
+ }
70
+
71
+ .vuiCard--s {
72
+ .vuiCard__header,
73
+ .vuiCard__body {
74
+ padding: $sizeM $sizeL;
75
+ }
76
+
77
+ .vuiCard__footer {
78
+ padding: 0 $sizeL $sizeM;
79
+ }
80
+ }
81
+
82
+ .vuiCard--m {
83
+ .vuiCard__header,
84
+ .vuiCard__body {
85
+ padding: $sizeL $sizeXl;
86
+ }
87
+
88
+ .vuiCard__footer {
89
+ padding: 0 $sizeXl $sizeL;
90
+ }
91
+ }
92
+
93
+ .vuiCard--l {
94
+ .vuiCard__header,
95
+ .vuiCard__body {
96
+ padding: $sizeXl $sizeXxl;
97
+ }
98
+
99
+ .vuiCard__footer {
100
+ padding: 0 $sizeXxl $sizeXl;
101
+ }
102
+ }
103
+
104
+ .vuiCard--highlight {
105
+ border: 2px solid $colorAccent;
106
+
107
+ .vuiCard__header {
108
+ background-color: $colorAccentLightShade;
109
+ }
110
+
111
+ .vuiCard__body {
112
+ border-top: $colorAccentLightShade;
113
+ }
114
+ }
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { ChatStyle, ChatTurn } from "./types";
3
+ type Props = {
4
+ openPrompt: string;
5
+ chatStyle: ChatStyle;
6
+ setChatStyle: (chatStyle: ChatStyle) => void;
7
+ introduction?: string;
8
+ suggestions?: string[];
9
+ onInput: (input: string) => void;
10
+ onRetry: (trun: ChatTurn) => void;
11
+ onReset: () => void;
12
+ conversation: ChatTurn[];
13
+ settings?: React.ReactNode;
14
+ isInspectionEnabled?: boolean;
15
+ };
16
+ export declare const VuiChat: ({ openPrompt, chatStyle, setChatStyle, introduction, suggestions, onInput, onRetry, onReset, conversation, settings, isInspectionEnabled }: Props) => import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,130 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { BiChat, BiExpand, BiExpandVertical, BiPaperPlane, BiX } from "react-icons/bi";
4
+ import classNames from "classnames";
5
+ import { VuiFlexContainer } from "../flex/FlexContainer";
6
+ import { VuiFlexItem } from "../flex/FlexItem";
7
+ import { VuiIcon } from "../icon/Icon";
8
+ import { VuiIconButton } from "../button/IconButton";
9
+ import { VuiTextInput } from "../form";
10
+ import { CHAT_STYLE_ORDER } from "./types";
11
+ import { VuiButtonSecondary } from "../button/ButtonSecondary";
12
+ import { VuiChatInspector } from "./ChatInspector";
13
+ import { VuiSpacer } from "../spacer/Spacer";
14
+ import { VuiButtonTertiary } from "../button/ButtonTertiary";
15
+ import { VuiChatTurn } from "./ChatTurn";
16
+ import { VuiChatPanel } from "./ChatPanel";
17
+ const chatStyleToIconMap = {
18
+ closed: _jsx(BiX, {}),
19
+ condensed: _jsx(BiExpandVertical, {}),
20
+ tall: _jsx(BiExpand, {}),
21
+ fullScreen: _jsx(BiX, {})
22
+ };
23
+ export const VuiChat = ({ openPrompt, chatStyle, setChatStyle, introduction, suggestions, onInput, onRetry, onReset, conversation, settings, isInspectionEnabled }) => {
24
+ const [isTouched, setIsTouched] = useState(false);
25
+ const [isSettingsOpen, setIsSettingsOpen] = useState(false);
26
+ const [input, setInput] = useState("");
27
+ const [inspectedTurn, setInspectedTurn] = useState();
28
+ const buttonRef = useRef(null);
29
+ const conversationRef = useRef(null);
30
+ const inputRef = useRef(null);
31
+ const isScrolledToBottomRef = useRef(true);
32
+ const prevConversationRef = useRef({
33
+ isBottomQuestionLoading: true,
34
+ length: 0
35
+ });
36
+ const isOpen = chatStyle !== "closed";
37
+ useEffect(() => {
38
+ var _a;
39
+ const onScrollChat = (e) => {
40
+ isScrolledToBottomRef.current = conversationRef.current
41
+ ? Math.abs(conversationRef.current.scrollHeight -
42
+ conversationRef.current.clientHeight -
43
+ conversationRef.current.scrollTop) < 1
44
+ : true;
45
+ };
46
+ // We're going to track the scroll position, which will determine
47
+ // or not the user is at the bottom of the chat.
48
+ (_a = conversationRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener("scroll", onScrollChat);
49
+ return () => {
50
+ var _a;
51
+ (_a = conversationRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("scroll", onScrollChat);
52
+ };
53
+ }, []);
54
+ useEffect(() => {
55
+ // Scrolling UX rules:
56
+ // * Scroll down if the last recorded scroll position was already
57
+ // at the bottom of the list and if the last question has resolved
58
+ // to an answer.
59
+ // * If the user has scrolled to another position, then don’t
60
+ // auto-scroll.
61
+ // * If the question that has resolved is not the last question,
62
+ // don’t auto-scroll.
63
+ //
64
+ // This way if the user takes control of the scroll position, they
65
+ // remain in control. If the user hasn’t taken control of the scroll
66
+ // position, then the scroll feels stable (by staying at the
67
+ // bottom) as opposed to scrolling unpredictably through the list
68
+ // as questions resolve.
69
+ var _a, _b, _c;
70
+ const hasBottomQuestionJustChanged =
71
+ // A new question has been added to the bottom of the list.
72
+ prevConversationRef.current.length !== conversation.length ||
73
+ // The last question has just resolved to an answer.
74
+ prevConversationRef.current.isBottomQuestionLoading !== Boolean((_a = conversation[conversation.length - 1]) === null || _a === void 0 ? void 0 : _a.isLoading);
75
+ // If the intro is really long, the chat can be in a state where
76
+ // the user is at the top of the chat and their first question is
77
+ // off-screen. In this case, we want to scroll to the bottom.
78
+ const shouldStickToBottom = conversation.length === 1 || (isScrolledToBottomRef.current && hasBottomQuestionJustChanged);
79
+ if (isOpen && shouldStickToBottom) {
80
+ // Scroll to the bottom of the chat to keep the latest turn in view.
81
+ (_b = conversationRef.current) === null || _b === void 0 ? void 0 : _b.scrollTo({
82
+ left: 0,
83
+ top: (_c = conversationRef.current) === null || _c === void 0 ? void 0 : _c.scrollHeight,
84
+ behavior: "smooth"
85
+ });
86
+ }
87
+ prevConversationRef.current = {
88
+ length: conversation.length,
89
+ isBottomQuestionLoading: conversation.length > 0 ? Boolean(conversation[conversation.length - 1].isLoading) : false
90
+ };
91
+ }, [conversation]);
92
+ useEffect(() => {
93
+ var _a, _b;
94
+ // Only autofocus if the user has interacted with the component.
95
+ // This prevents the component stealing focus when it first mounts.
96
+ if (isTouched) {
97
+ if (isOpen) {
98
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
99
+ }
100
+ else {
101
+ (_b = buttonRef.current) === null || _b === void 0 ? void 0 : _b.focus();
102
+ }
103
+ }
104
+ }, [isOpen]);
105
+ const onSubmit = () => {
106
+ if (!(input === null || input === void 0 ? void 0 : input.trim()))
107
+ return;
108
+ onInput(input);
109
+ setInput("");
110
+ };
111
+ const cycleChatStyle = () => {
112
+ setIsTouched(true);
113
+ const currentIndex = CHAT_STYLE_ORDER.indexOf(chatStyle);
114
+ setChatStyle(currentIndex === CHAT_STYLE_ORDER.length - 1 ? CHAT_STYLE_ORDER[0] : CHAT_STYLE_ORDER[currentIndex + 1]);
115
+ };
116
+ const buttonClasses = classNames("vuiChatButton", {
117
+ "vuiChatButton-isHidden": isOpen
118
+ });
119
+ const classes = classNames("vuiChat", `vuiChat--${chatStyle}`);
120
+ return (_jsxs(_Fragment, { children: [_jsx("button", Object.assign({
121
+ // @ts-expect-error React doesn't support inert yet
122
+ inert: isOpen ? "" : null, className: buttonClasses, onClick: () => setChatStyle("condensed"), ref: buttonRef }, { children: _jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "s" }, { children: [_jsx(VuiFlexItem, Object.assign({ shrink: false, grow: false }, { children: _jsx(VuiIcon, Object.assign({ size: "s" }, { children: _jsx(BiChat, {}) })) })), _jsx(VuiFlexItem, Object.assign({ grow: 1 }, { children: _jsx("div", Object.assign({ className: "vuiChatButton__prompt" }, { children: openPrompt })) }))] })) })), _jsxs("div", Object.assign({
123
+ // @ts-expect-error React doesn't support inert yet
124
+ inert: !isOpen ? "" : null, className: classes, onKeyDown: (e) => {
125
+ if (e.key === "Escape")
126
+ setChatStyle("closed");
127
+ } }, { children: [_jsx("div", Object.assign({ className: "vuiChat__header" }, { children: _jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", justifyContent: "spaceBetween" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: 1 }, { children: _jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "s" }, { children: [_jsx(VuiFlexItem, Object.assign({ shrink: false, grow: false }, { children: _jsx(VuiIcon, Object.assign({ size: "s" }, { children: _jsx(BiChat, {}) })) })), _jsx(VuiFlexItem, Object.assign({ grow: 1 }, { children: _jsx("div", Object.assign({ className: "vuiChatButton__prompt" }, { children: _jsx("h2", { children: openPrompt }) })) }))] })) })), settings && (_jsx(VuiFlexItem, Object.assign({ shrink: false, grow: false }, { children: _jsx(VuiButtonSecondary, Object.assign({ color: "neutral", size: "xs", onClick: () => setIsSettingsOpen(true) }, { children: "Settings" })) })))] })) })), _jsxs("div", Object.assign({ className: "vuiChat__conversation", ref: conversationRef }, { children: [(introduction || suggestions) && (_jsxs("div", Object.assign({ className: "vuiChat__introduction" }, { children: [introduction, introduction && _jsx(VuiSpacer, { size: "s" }), suggestions === null || suggestions === void 0 ? void 0 : suggestions.map((suggestion) => (_jsx("div", { children: _jsx(VuiButtonTertiary, Object.assign({ size: "s", color: "primary", onClick: () => onInput(suggestion), noPadding: true }, { children: suggestion }), suggestion) }))), suggestions && suggestions.length > 0 && _jsx(VuiSpacer, { size: "s" })] }))), conversation.length > 0 && (_jsx("div", Object.assign({ className: "vuiChat__turns" }, { children: conversation.map((turn, index) => (_jsx(VuiChatTurn, { turn: turn, isInspectionEnabled: isInspectionEnabled, setInspectedTurn: setInspectedTurn, onRetry: onRetry }, index))) }))), conversation.length > 0 && (_jsx("div", Object.assign({ className: "vuiChat__conversationActions" }, { children: _jsx(VuiFlexContainer, Object.assign({ alignItems: "center", justifyContent: "center" }, { children: _jsx(VuiFlexItem, { children: _jsx(VuiButtonSecondary, Object.assign({ color: "neutral", size: "xs", onClick: onReset }, { children: "Start over" })) }) })) })))] })), _jsx("div", Object.assign({ className: "vuiChat__input" }, { children: _jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xxs" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: 1 }, { children: _jsx(VuiTextInput, { value: input, onChange: (e) => {
128
+ setInput(e.currentTarget.value);
129
+ }, onSubmit: onSubmit, fullWidth: true, ref: inputRef }) })), _jsx(VuiFlexItem, Object.assign({ shrink: false, grow: false }, { children: _jsx(VuiIconButton, { icon: _jsx(VuiIcon, { children: _jsx(BiPaperPlane, {}) }), color: "primary", onClick: onSubmit }) })), _jsx(VuiFlexItem, Object.assign({ shrink: false, grow: false }, { children: _jsx(VuiIconButton, { icon: _jsx(VuiIcon, { children: chatStyleToIconMap[chatStyle] }), color: "neutral", onClick: cycleChatStyle }) }))] })) })), isSettingsOpen && (_jsx(VuiChatPanel, Object.assign({ title: "Chat settings", onClose: () => setIsSettingsOpen(false) }, { children: settings }))), Boolean(inspectedTurn) && (_jsx(VuiChatInspector, { turn: inspectedTurn, onClose: () => setInspectedTurn(undefined) }))] }))] }));
130
+ };
@@ -0,0 +1,7 @@
1
+ import { ChatTurn } from "./types";
2
+ type Props = {
3
+ turn?: ChatTurn;
4
+ onClose: () => void;
5
+ };
6
+ export declare const VuiChatInspector: ({ turn, onClose }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { VuiSpacer } from "../spacer/Spacer";
3
+ import { VuiText } from "../typography/Text";
4
+ import { VuiChatPanel } from "./ChatPanel";
5
+ import { VuiChatSearchResult } from "./ChatSearchResult";
6
+ export const VuiChatInspector = ({ turn, onClose }) => {
7
+ var _a;
8
+ return (_jsxs(VuiChatPanel, Object.assign({ title: "Chat inspector", onClose: onClose }, { children: [_jsx(VuiText, { children: _jsxs("p", { children: [_jsx("strong", { children: "You asked," }), " \"", turn === null || turn === void 0 ? void 0 : turn.question, "\""] }) }), _jsx(VuiSpacer, { size: "xs" }), _jsx(VuiText, { children: _jsxs("p", { children: [_jsx("strong", { children: "This was interpreted as:" }), " \"", turn === null || turn === void 0 ? void 0 : turn.query, "\""] }) }), _jsx(VuiSpacer, { size: "xs" }), _jsx(VuiText, { children: _jsxs("p", { children: [_jsx("strong", { children: "This was the response:" }), " \"", turn === null || turn === void 0 ? void 0 : turn.answer, "\""] }) }), _jsx(VuiSpacer, { size: "xs" }), _jsx(VuiText, { children: _jsx("p", { children: _jsx("strong", { children: "We created this response based on the preceding conversation and this information:" }) }) }), _jsx(VuiSpacer, { size: "xs" }), (_a = turn === null || turn === void 0 ? void 0 : turn.results) === null || _a === void 0 ? void 0 : _a.map((result, index) => {
9
+ var _a, _b;
10
+ return (_jsxs(_Fragment, { children: [_jsx(VuiChatSearchResult, { result: result }), index < ((_b = (_a = turn.results) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) - 1 && _jsx(VuiSpacer, { size: "s" })] }));
11
+ })] })));
12
+ };
@@ -0,0 +1,7 @@
1
+ type Props = {
2
+ title: React.ReactNode;
3
+ onClose: () => void;
4
+ children?: React.ReactNode;
5
+ };
6
+ export declare const VuiChatPanel: ({ title, onClose, children }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BiX } from "react-icons/bi";
3
+ import { VuiIconButton } from "../button/IconButton";
4
+ import { VuiFlexContainer } from "../flex/FlexContainer";
5
+ import { VuiFlexItem } from "../flex/FlexItem";
6
+ import { VuiIcon } from "../icon/Icon";
7
+ import { VuiSpacer } from "../spacer/Spacer";
8
+ import { VuiTitle } from "../typography/Title";
9
+ export const VuiChatPanel = ({ title, onClose, children }) => {
10
+ return (_jsxs("div", Object.assign({ className: "vuiChatPanel" }, { children: [_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", justifyContent: "spaceBetween" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: 1 }, { children: _jsx(VuiTitle, Object.assign({ size: "s" }, { children: _jsx("h3", { children: title }) })) })), _jsx(VuiFlexItem, Object.assign({ shrink: false, grow: false }, { children: _jsx(VuiIconButton, { icon: _jsx(VuiIcon, { children: _jsx(BiX, {}) }), color: "neutral", onClick: () => onClose() }) }))] })), _jsx(VuiSpacer, { size: "s" }), children, _jsx(VuiSpacer, { size: "l" })] })));
11
+ };
@@ -0,0 +1,16 @@
1
+ export type SearchResult = {
2
+ title?: string;
3
+ url?: string;
4
+ date?: string;
5
+ snippet: {
6
+ pre: string;
7
+ text: string;
8
+ post: string;
9
+ };
10
+ };
11
+ type Props = {
12
+ result: SearchResult;
13
+ className?: string;
14
+ };
15
+ export declare const VuiChatSearchResult: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement | null>>;
16
+ export {};
@@ -0,0 +1,26 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { forwardRef } from "react";
14
+ import classNames from "classnames";
15
+ import { VuiLink } from "../link/Link";
16
+ import { VuiText } from "../typography/Text";
17
+ import { VuiTextColor } from "../typography/TextColor";
18
+ const highlightUrl = (url, text) => `${url}#:~:text=${text}`;
19
+ export const VuiChatSearchResult = forwardRef((_a, ref) => {
20
+ var { result, className } = _a, rest = __rest(_a, ["result", "className"]);
21
+ const { title, url, date, snippet: { pre, post, text } } = result;
22
+ // Protect users' privacy in FullStory.
23
+ // https://help.fullstory.com/hc/en-us/articles/360020623574-How-do-I-protect-my-users-privacy-in-FullStory-#01F5DPW1AJHZHR8TBM9YQEDRMH
24
+ const classes = classNames("vuiChatSearchResult", "fs-mask", className);
25
+ return (_jsxs("div", Object.assign({ className: classes, ref: ref }, rest, { children: [(title || url) && (_jsx(VuiText, { children: url ? (_jsx(VuiLink, Object.assign({ href: highlightUrl(url, text), target: "_blank" }, { children: _jsx("p", { children: title !== null && title !== void 0 ? title : url }) }))) : (_jsx("p", { children: title })) })), _jsx(VuiText, Object.assign({ size: "s" }, { children: _jsxs("p", { children: [date && _jsxs(VuiTextColor, Object.assign({ color: "subdued" }, { children: [date, " \u2014 "] })), pre, " ", _jsx("strong", { children: text }), " ", post] }) }))] })));
26
+ });