@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,9 @@
1
+ import { ChatTurn } from "./types";
2
+ type Props = {
3
+ turn: ChatTurn;
4
+ isInspectionEnabled?: boolean;
5
+ setInspectedTurn: (turn: ChatTurn) => void;
6
+ onRetry: (turn: ChatTurn) => void;
7
+ };
8
+ export declare const VuiChatTurn: ({ turn, isInspectionEnabled, setInspectedTurn, onRetry }: Props) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { BiError, BiListUl } from "react-icons/bi";
3
+ import classNames from "classnames";
4
+ import { VuiFlexContainer } from "../flex/FlexContainer";
5
+ import { VuiFlexItem } from "../flex/FlexItem";
6
+ import { VuiSpinner } from "../spinner/Spinner";
7
+ import { VuiText } from "../typography/Text";
8
+ import { VuiTextColor } from "../typography/TextColor";
9
+ import { VuiIcon } from "../icon/Icon";
10
+ import { VuiIconButton } from "../button/IconButton";
11
+ import { VuiButtonSecondary } from "../button/ButtonSecondary";
12
+ import { VuiSpacer } from "../spacer/Spacer";
13
+ export const VuiChatTurn = ({ turn, isInspectionEnabled, setInspectedTurn, onRetry }) => {
14
+ var _a;
15
+ const turnClasses = classNames("vuiChatQuestion", {
16
+ "vuiChatQuestion--error": !turn.isLoading && turn.error
17
+ });
18
+ return (_jsxs("div", Object.assign({ className: "vuiChatTurn" }, { children: [_jsxs(VuiFlexContainer, Object.assign({ alignItems: "start", justifyContent: "spaceBetween", spacing: "xs" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: 1 }, { children: _jsx("div", Object.assign({ className: turnClasses }, { children: _jsx("h3", { children: turn.question }) })) })), isInspectionEnabled && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: _jsx(VuiIconButton, { size: "xs", className: "vuiChat__inspectButton", color: "neutral", icon: _jsx(VuiIcon, Object.assign({ size: "s" }, { children: _jsx(BiListUl, {}) })), onClick: () => setInspectedTurn(turn) }) })))] })), _jsx("div", Object.assign({ className: "vuiChatAnswer" }, { children: turn.isLoading ? (_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xs" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiSpinner, { size: "xs" }) })), _jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiText, { children: _jsx("p", { children: _jsx(VuiTextColor, Object.assign({ color: "subdued" }, { children: "Thinking\u2026" })) }) }) }))] }))) : turn.error ? (_jsxs(_Fragment, { children: [_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xs" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiIcon, Object.assign({ color: "subdued" }, { children: _jsx(BiError, {}) })) })), _jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiText, { children: _jsx("p", { children: _jsx(VuiTextColor, Object.assign({ color: "subdued" }, { children: (_a = turn.error) === null || _a === void 0 ? void 0 : _a.message })) }) }) }))] })), _jsx(VuiSpacer, { size: "s" }), _jsx(VuiButtonSecondary, Object.assign({ size: "xs", color: "neutral", onClick: () => onRetry(turn) }, { children: "Ask again" }))] })) : (turn.answer) }))] })));
19
+ };
@@ -0,0 +1,150 @@
1
+ @import "chatTurn";
2
+
3
+ $minChatHeight: 600px;
4
+ $minChatWidth: 600px;
5
+
6
+ .vuiChatButton,
7
+ .vuiChat {
8
+ position: fixed;
9
+ right: $sizeXxs;
10
+ bottom: $sizeXxs;
11
+ z-index: $chatZIndex;
12
+ }
13
+
14
+ .vuiChatButton-isHidden,
15
+ .vuiChat--closed {
16
+ // If we used display: none, then the button's animation would play every
17
+ // time the button is shown.
18
+ visibility: hidden;
19
+ // For some reason the buttons inside the header are visible for an extra frame
20
+ // after closing the chat. This fixes that flicker.
21
+ opacity: 0;
22
+ }
23
+
24
+ .vuiChatButton {
25
+ padding: $sizeXs $sizeS;
26
+ font-size: $fontSizeStandard;
27
+ color: $colorText;
28
+ background-color: $colorPrimaryLightShade;
29
+ border: 1px solid $borderColor;
30
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
31
+ transition: all $transitionSpeed;
32
+ animation: popUp 0.4s cubic-bezier(0.5, 0, 0.5, 1) 1;
33
+
34
+ &:hover {
35
+ box-shadow: $shadowLargeEnd;
36
+ translate: translateY(-20px);
37
+ }
38
+ }
39
+
40
+ @keyframes popUp {
41
+ 0% {
42
+ transform: translateY(40px);
43
+ }
44
+
45
+ 50% {
46
+ transform: translateY(-10px);
47
+ }
48
+
49
+ 100% {
50
+ transform: translateY(0);
51
+ }
52
+ }
53
+
54
+ .vuiChat {
55
+ display: flex;
56
+ flex-direction: column;
57
+ width: 100%;
58
+ max-width: 420px;
59
+ border-radius: $sizeXs;
60
+ overflow: hidden;
61
+ border: 1px solid $borderColor;
62
+ background-color: $colorLightShade;
63
+
64
+ @media screen and (max-height: $minChatHeight) {
65
+ & {
66
+ bottom: $sizeXxs;
67
+ height: calc(100vh - 2 * #{$sizeXxs});
68
+ }
69
+
70
+ .vuiChat__conversation {
71
+ max-height: 100%;
72
+ }
73
+ }
74
+
75
+ @media screen and (max-width: $minChatWidth) {
76
+ & {
77
+ right: $sizeXxs;
78
+ width: calc(100vw - 2 * #{$sizeXxs});
79
+ max-width: 100% !important;
80
+ }
81
+ }
82
+ }
83
+
84
+ .vuiChat--tall {
85
+ bottom: $sizeXxs;
86
+ height: calc(100vh - 2 * #{$sizeXxs});
87
+
88
+ .vuiChat__conversation {
89
+ max-height: 100%;
90
+ }
91
+ }
92
+
93
+ .vuiChat--fullScreen {
94
+ height: calc(100vh - 2 * #{$sizeXxs});
95
+ width: calc(100vw - 2 * #{$sizeXxs});
96
+ max-width: 100% !important;
97
+
98
+ .vuiChat__conversation {
99
+ max-height: 100%;
100
+ }
101
+ }
102
+
103
+ .vuiChat__header {
104
+ padding: $sizeXs $sizeS;
105
+ font-size: $fontSizeStandard;
106
+ color: $colorText;
107
+ background-color: $colorPrimaryLightShade;
108
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
109
+ // Ensure shadow overlaps on top of conversation.
110
+ z-index: 2;
111
+ }
112
+
113
+ .vuiChat__conversation {
114
+ flex-grow: 1;
115
+ max-height: 400px;
116
+ overflow-y: auto;
117
+ }
118
+
119
+ .vuiChat__introduction {
120
+ padding: $sizeM $sizeL 0;
121
+ font-size: $fontSizeStandard;
122
+ color: $colorFullShade;
123
+ }
124
+
125
+ .vuiChat__turns {
126
+ font-size: $fontSizeStandard;
127
+ }
128
+
129
+ .vuiChat__conversationActions {
130
+ padding: $sizeS;
131
+ }
132
+
133
+ .vuiChat__input {
134
+ border-top: 1px solid $borderColorLight;
135
+ padding: $sizeXs $sizeS;
136
+ }
137
+
138
+ .vuiChatPanel {
139
+ position: absolute;
140
+ z-index: 5;
141
+ top: $sizeXxs;
142
+ left: $sizeXxs;
143
+ right: $sizeXxs;
144
+ bottom: $sizeXxs;
145
+ padding: $sizeXxs $sizeS;
146
+ overflow-y: auto;
147
+ background-color: $colorEmptyShade;
148
+ border: 1px solid $borderColor;
149
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
150
+ }
@@ -0,0 +1,38 @@
1
+ .vuiChatTurn {
2
+ position: relative;
3
+ left: 0;
4
+ box-shadow: $shadowLargeStart;
5
+ background-color: $colorEmptyShade;
6
+ padding: $sizeL $sizeS $sizeL $sizeL;
7
+ margin-right: $sizeXxs;
8
+ transition: all $transitionSpeed;
9
+
10
+ &:hover {
11
+ box-shadow: $shadowLargeEnd;
12
+ z-index: 1;
13
+ left: $sizeXxs;
14
+ }
15
+ }
16
+
17
+ .vuiChatTurn + .vuiChatTurn {
18
+ margin-top: 1px;
19
+ }
20
+
21
+ .vuiChatQuestion {
22
+ color: $colorAccent;
23
+ font-weight: $fontWeightBold;
24
+ font-size: $fontSizeStandard;
25
+ margin-bottom: $sizeXs;
26
+ }
27
+
28
+ .vuiChatQuestion--error {
29
+ color: $colorDanger;
30
+ }
31
+
32
+ .vuiChat__inspectButton {
33
+ margin-top: -$sizeXxs;
34
+ }
35
+
36
+ .vuiChatAnswer {
37
+ color: $colorFullShade;
38
+ }
@@ -0,0 +1,17 @@
1
+ import { SearchResult } from "../searchResult/SearchResult";
2
+ export type ChatTurn = {
3
+ question: string;
4
+ isLoading?: boolean;
5
+ error?: {
6
+ code?: string;
7
+ message: string;
8
+ };
9
+ answer?: string;
10
+ query?: string;
11
+ language?: ChatLanguage;
12
+ results?: SearchResult[];
13
+ };
14
+ export declare const CHAT_LANGUAGES: readonly ["auto", "eng", "deu", "fra", "zho", "kor", "ara", "rus", "tha", "nld", "ita", "por", "spa", "jpn", "pol", "tur"];
15
+ export type ChatLanguage = (typeof CHAT_LANGUAGES)[number];
16
+ export declare const CHAT_STYLE_ORDER: readonly ["closed", "condensed", "tall", "fullScreen"];
17
+ export type ChatStyle = (typeof CHAT_STYLE_ORDER)[number];
@@ -0,0 +1,19 @@
1
+ export const CHAT_LANGUAGES = [
2
+ "auto",
3
+ "eng",
4
+ "deu",
5
+ "fra",
6
+ "zho",
7
+ "kor",
8
+ "ara",
9
+ "rus",
10
+ "tha",
11
+ "nld",
12
+ "ita",
13
+ "por",
14
+ "spa",
15
+ "jpn",
16
+ "pol",
17
+ "tur",
18
+ ];
19
+ export const CHAT_STYLE_ORDER = ["closed", "condensed", "tall", "fullScreen"];
@@ -0,0 +1,17 @@
1
+ import "prismjs/themes/prism.css";
2
+ import "prismjs/components/prism-json";
3
+ import "prismjs/components/prism-javascript";
4
+ import "prismjs/components/prism-typescript";
5
+ import "prismjs/components/prism-bash";
6
+ import "prismjs/components/prism-jsx";
7
+ import "prismjs/components/prism-tsx";
8
+ import { CodeLanguage } from "./types";
9
+ type Props = {
10
+ language?: CodeLanguage;
11
+ onCopy?: () => void;
12
+ children?: string;
13
+ fullHeight?: boolean;
14
+ "data-testid"?: string;
15
+ };
16
+ export declare const VuiCode: ({ onCopy, language, fullHeight, children, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,44 @@
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 { useEffect } from "react";
14
+ import Prism from "prismjs";
15
+ import "prismjs/themes/prism.css";
16
+ import "prismjs/components/prism-json";
17
+ import "prismjs/components/prism-javascript";
18
+ import "prismjs/components/prism-typescript";
19
+ import "prismjs/components/prism-bash";
20
+ import "prismjs/components/prism-jsx";
21
+ import "prismjs/components/prism-tsx";
22
+ import classNames from "classnames";
23
+ import { BiClipboard } from "react-icons/bi";
24
+ import { VuiIconButton } from "../button/IconButton";
25
+ import { VuiIcon } from "../icon/Icon";
26
+ // PrismJS clears highlighting when language-none is set.
27
+ export const VuiCode = (_a) => {
28
+ var { onCopy, language = "none", fullHeight, children = "" } = _a, rest = __rest(_a, ["onCopy", "language", "fullHeight", "children"]);
29
+ useEffect(() => {
30
+ Prism.highlightAll();
31
+ }, [children, language]);
32
+ const containerClasses = classNames("vuiCodeContainer", {
33
+ "vuiCodeContainer--fullHeight": fullHeight
34
+ });
35
+ const classes = classNames("vuiCode", `language-${language}`, {
36
+ "vuiCode--fullHeight": fullHeight
37
+ });
38
+ const testId = rest["data-testid"];
39
+ return (_jsxs("div", Object.assign({ className: containerClasses }, rest, { children: [_jsx("pre", Object.assign({ className: "vuiCodePre" }, { children: _jsx("code", Object.assign({ className: classes }, { children: children })) })), _jsx(VuiIconButton, { color: "neutral", icon: _jsx(VuiIcon, { children: _jsx(BiClipboard, { size: 20 }) }), "aria-label": "Copy to clipboard", className: "vuiCodeCopyButton", onClick: () => {
40
+ navigator.clipboard.writeText(children);
41
+ if (onCopy)
42
+ onCopy();
43
+ } }), testId && (_jsx("div", Object.assign({ "data-testid": `${testId}-hidden`, hidden: true }, { children: children })))] })));
44
+ };
@@ -0,0 +1,33 @@
1
+ .vuiCodeContainer {
2
+ position: relative;
3
+ border-left: $sizeXxs solid $colorMediumShade;
4
+ max-height: 480px;
5
+ }
6
+
7
+ .vuiCodeContainer--fullHeight {
8
+ max-height: 100%;
9
+ }
10
+
11
+ .vuiCodeCopyButton {
12
+ position: absolute;
13
+ right: $sizeXxs;
14
+ top: $sizeXxs;
15
+ }
16
+
17
+ .vuiCodePre {
18
+ padding: 0 !important;
19
+ margin: 0 !important;
20
+ max-height: inherit;
21
+ }
22
+
23
+ .vuiCode {
24
+ display: block;
25
+ width: 100%;
26
+ padding: $sizeM $sizeL;
27
+ background-color: $colorLightShade;
28
+ color: $colorText;
29
+ font-family: "Roboto Mono", monospace;
30
+ word-wrap: break-word;
31
+ white-space: pre-wrap;
32
+ font-size: $fontSizeSmall !important;
33
+ }
@@ -0,0 +1 @@
1
+ export type CodeLanguage = "json" | "js" | "ts" | "jsx" | "tsx" | "bash" | "none";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from "react";
2
+ import { LinkProps } from "../link/types";
3
+ type LinkProvider = (linkConfig: LinkProps) => JSX.Element;
4
+ type PathProvider = () => string;
5
+ interface VuiContextType {
6
+ createLink: LinkProvider;
7
+ getPath: PathProvider;
8
+ DrawerTitle: keyof JSX.IntrinsicElements;
9
+ }
10
+ type Props = {
11
+ children: ReactNode;
12
+ linkProvider?: LinkProvider;
13
+ pathProvider?: PathProvider;
14
+ drawerTitle?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
15
+ };
16
+ export declare const VuiContextProvider: ({ children, linkProvider, pathProvider, drawerTitle }: Props) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const useVuiContext: () => VuiContextType;
18
+ export {};
@@ -0,0 +1,34 @@
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 } from "react/jsx-runtime";
13
+ import { createContext, useContext } from "react";
14
+ const VuiContext = createContext(undefined);
15
+ export const VuiContextProvider = ({ children, linkProvider, pathProvider, drawerTitle = "h2" }) => {
16
+ const createLink = (linkConfig) => {
17
+ if (linkProvider)
18
+ return linkProvider(linkConfig);
19
+ const { className, href, onClick, children } = linkConfig, rest = __rest(linkConfig, ["className", "href", "onClick", "children"]);
20
+ return (_jsx("a", Object.assign({ className: className, href: href, onClick: onClick }, rest, { children: children })));
21
+ };
22
+ const getPath = () => {
23
+ return pathProvider ? pathProvider() : window.location.pathname;
24
+ };
25
+ const DrawerTitle = drawerTitle;
26
+ return _jsx(VuiContext.Provider, Object.assign({ value: { createLink, getPath, DrawerTitle } }, { children: children }));
27
+ };
28
+ export const useVuiContext = () => {
29
+ const context = useContext(VuiContext);
30
+ if (context === undefined) {
31
+ throw new Error("useVuiContext must be used within a VuiContextProvider");
32
+ }
33
+ return context;
34
+ };
@@ -0,0 +1,2 @@
1
+ import { render } from "@testing-library/react";
2
+ export declare const renderWithContext: (children: React.ReactNode, ...rest: any) => ReturnType<typeof render>;
@@ -0,0 +1,22 @@
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 } from "react/jsx-runtime";
13
+ import { render } from "@testing-library/react";
14
+ import { Link } from "react-router-dom";
15
+ import { VuiContextProvider } from "./Context";
16
+ const linkProvider = (linkConfig) => {
17
+ const { className, href, onClick, children } = linkConfig, rest = __rest(linkConfig, ["className", "href", "onClick", "children"]);
18
+ return (_jsx(Link, Object.assign({ className: className, to: href !== null && href !== void 0 ? href : "", onClick: onClick }, rest, { children: children })));
19
+ };
20
+ export const renderWithContext = (children, ...rest) => {
21
+ return render(_jsx(VuiContextProvider, Object.assign({ linkProvider: linkProvider }, { children: children })), ...rest);
22
+ };
@@ -0,0 +1,10 @@
1
+ import { Props as OptionsButtonProps } from "../optionsButton/OptionsButton";
2
+ type Props = {
3
+ value: string;
4
+ options?: OptionsButtonProps["options"];
5
+ size: OptionsButtonProps["size"];
6
+ label?: string;
7
+ title?: string;
8
+ };
9
+ export declare const VuiCopyButton: ({ value, options, label, size, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,50 @@
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 } from "react/jsx-runtime";
13
+ import { useEffect, useState } from "react";
14
+ import { VuiOptionsButton } from "../optionsButton/OptionsButton";
15
+ import { VuiIcon } from "../icon/Icon";
16
+ import { BiCheck, BiClipboard } from "react-icons/bi";
17
+ import { VuiButtonSecondary } from "../button/ButtonSecondary";
18
+ const sizeToIconSizeMap = {
19
+ xs: "s",
20
+ s: "s",
21
+ m: "m",
22
+ l: "m",
23
+ xl: "m"
24
+ };
25
+ export const VuiCopyButton = (_a) => {
26
+ var { value, options, label, size = "s" } = _a, rest = __rest(_a, ["value", "options", "label", "size"]);
27
+ const [isOpen, setIsOpen] = useState(false);
28
+ const [isCopied, setIsCopied] = useState(false);
29
+ useEffect(() => {
30
+ if (isCopied) {
31
+ const timeout = setTimeout(() => {
32
+ setIsCopied(false);
33
+ }, 2400);
34
+ return () => clearTimeout(timeout);
35
+ }
36
+ }, [isCopied]);
37
+ const icon = isCopied ? (_jsx(VuiIcon, Object.assign({ size: sizeToIconSizeMap[size], color: "success" }, { children: _jsx(BiCheck, {}) }))) : (_jsx(VuiIcon, Object.assign({ size: sizeToIconSizeMap[size] }, { children: _jsx(BiClipboard, {}) })));
38
+ const copy = (copyValue = value) => {
39
+ navigator.clipboard.writeText(copyValue);
40
+ setIsCopied(true);
41
+ };
42
+ return options ? (_jsx(VuiOptionsButton, Object.assign({ type: "secondary", icon: icon, isOpen: isOpen, setIsOpen: setIsOpen, color: "neutral", size: size, onClick: () => {
43
+ copy();
44
+ }, onSelectOption: (value) => {
45
+ copy(value);
46
+ setIsOpen(false);
47
+ }, options: options }, rest, { children: label }))) : (_jsx(VuiButtonSecondary, Object.assign({ size: size, icon: icon, color: "neutral", onClick: () => {
48
+ copy(value);
49
+ } }, rest, { children: label })));
50
+ };
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from "react";
2
+ declare const COLOR: readonly ["primary", "danger"];
3
+ type Props = {
4
+ className?: string;
5
+ title: ReactNode;
6
+ icon?: ReactNode;
7
+ children: ReactNode;
8
+ isOpen?: boolean;
9
+ onClose?: () => void;
10
+ color?: (typeof COLOR)[number];
11
+ };
12
+ export declare const VuiDrawer: ({ className, color, title, icon, children, isOpen, onClose, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,53 @@
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 { useEffect, useRef } from "react";
14
+ import classNames from "classnames";
15
+ import { FocusOn } from "react-focus-on";
16
+ import { BiX } from "react-icons/bi";
17
+ import { VuiFlexContainer } from "../flex/FlexContainer";
18
+ import { VuiFlexItem } from "../flex/FlexItem";
19
+ import { VuiIconButton } from "../button/IconButton";
20
+ import { VuiIcon } from "../icon/Icon";
21
+ import { VuiPortal } from "../portal/Portal";
22
+ import { VuiScreenBlock } from "../screenBlock/ScreenBlock";
23
+ import { useVuiContext } from "../context/Context";
24
+ const COLOR = ["primary", "danger"];
25
+ export const VuiDrawer = (_a) => {
26
+ var { className, color = "primary", title, icon, children, isOpen, onClose } = _a, rest = __rest(_a, ["className", "color", "title", "icon", "children", "isOpen", "onClose"]);
27
+ const { DrawerTitle } = useVuiContext();
28
+ const returnFocusElRef = useRef(null);
29
+ // Return focus on unmount.
30
+ useEffect(() => {
31
+ var _a;
32
+ if (isOpen) {
33
+ returnFocusElRef.current = document.activeElement;
34
+ }
35
+ else {
36
+ (_a = returnFocusElRef.current) === null || _a === void 0 ? void 0 : _a.focus();
37
+ returnFocusElRef.current = null;
38
+ }
39
+ }, [isOpen]);
40
+ // Allow contents to respond to blur events before unmounting.
41
+ const onCloseDelayed = () => {
42
+ window.setTimeout(() => {
43
+ onClose === null || onClose === void 0 ? void 0 : onClose();
44
+ }, 0);
45
+ };
46
+ const classes = classNames("vuiDrawer", `vuiDrawer--${color}`, className);
47
+ return (_jsx(VuiPortal, { children: isOpen && (_jsx(VuiScreenBlock, { children: _jsx(FocusOn, Object.assign({ onEscapeKey: onCloseDelayed, onClickOutside: onCloseDelayed,
48
+ // Enable manual focus return to work.
49
+ returnFocus: false,
50
+ // Enable focus on contents when it's open,
51
+ // but enable manual focus return to work when it's closed.
52
+ autoFocus: isOpen }, { children: _jsxs("div", Object.assign({ className: classes }, rest, { children: [_jsx("div", Object.assign({ className: "vuiDrawerHeader" }, { children: _jsxs(VuiFlexContainer, Object.assign({ justifyContent: "spaceBetween", alignItems: "center" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xs" }, { children: [icon && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: _jsx(VuiIcon, Object.assign({ size: "l" }, { children: icon })) }))), _jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx("div", Object.assign({ className: "vuiDrawerHeader__title" }, { children: _jsx(DrawerTitle, { children: title }) })) }))] })) })), onClose && (_jsx(VuiFlexItem, { children: _jsx(VuiIconButton, { "data-testid": "drawerCloseButton", onClick: onCloseDelayed, color: "neutral", icon: _jsx(VuiIcon, Object.assign({ size: "m", color: "neutral" }, { children: _jsx(BiX, {}) })) }) }))] })) })), _jsx("div", Object.assign({ className: "vuiDrawerContent" }, { children: _jsx("div", Object.assign({ className: "vuiDrawerContent__inner" }, { children: children })) }))] })) })) })) }));
53
+ };
@@ -0,0 +1,73 @@
1
+ @use "sass:map";
2
+
3
+ $drawerWidth: 680px;
4
+
5
+ @keyframes drawerIn {
6
+ 0% {
7
+ right: -$drawerWidth;
8
+ }
9
+
10
+ 100% {
11
+ right: 0;
12
+ }
13
+ }
14
+
15
+ .vuiDrawer {
16
+ display: flex;
17
+ flex-direction: column;
18
+ position: fixed;
19
+ top: 0;
20
+ right: 0;
21
+ bottom: 0;
22
+ width: 100%;
23
+ max-width: $drawerWidth;
24
+ background-color: $colorEmptyShade;
25
+ border-left: 1px solid $borderColor;
26
+ z-index: $drawerZIndex;
27
+ animation: drawerIn $transitionSpeed cubic-bezier(0, 1, 0, 1);
28
+ }
29
+
30
+ .vuiDrawerHeader {
31
+ padding: $sizeL $sizeL;
32
+ }
33
+
34
+ .vuiDrawerHeader__title {
35
+ font-size: $fontSizeXLarge;
36
+ font-weight: $fontWeightBold;
37
+ line-height: 1.2;
38
+ color: $colorText;
39
+ }
40
+
41
+ .vuiDrawerContent {
42
+ overflow-y: auto;
43
+ overscroll-behavior: contain;
44
+ }
45
+
46
+ .vuiDrawerContent__inner {
47
+ padding: $sizeL $sizeL;
48
+ }
49
+
50
+ // Color
51
+ $color: (
52
+ primary: (
53
+ "background-color": $colorPrimaryLightShade,
54
+ "color": $colorText
55
+ ),
56
+ danger: (
57
+ "background-color": $colorDangerLightShade,
58
+ "color": $colorDanger
59
+ )
60
+ );
61
+
62
+ @each $colorName, $colorValue in $color {
63
+ .vuiDrawer--#{$colorName} {
64
+ .vuiDrawerHeader {
65
+ background-color: #{map.get($colorValue, "background-color")};
66
+
67
+ .vuiDrawerHeader__title,
68
+ .vuiIcon {
69
+ color: #{map.get($colorValue, "color")};
70
+ }
71
+ }
72
+ }
73
+ }