@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.
- package/.github/workflows/deploy-pages-site.yml +26 -0
- package/.github/workflows/deploy-pr-preview.yml +25 -0
- package/CHANGELOG.md +13 -0
- package/NO_LICENSE +3 -0
- package/lib/components/accordion/Accordion.d.ts +8 -0
- package/lib/components/accordion/Accordion.js +27 -0
- package/lib/components/accordion/_index.scss +23 -0
- package/lib/components/accountMenu/AccountMenu.d.ts +13 -0
- package/lib/components/accountMenu/AccountMenu.js +7 -0
- package/lib/components/accountMenu/_index.scss +20 -0
- package/lib/components/app/AppContent.d.ts +9 -0
- package/lib/components/app/AppContent.js +28 -0
- package/lib/components/app/AppHeader.d.ts +7 -0
- package/lib/components/app/AppHeader.js +18 -0
- package/lib/components/app/AppLayout.d.ts +9 -0
- package/lib/components/app/AppLayout.js +10 -0
- package/lib/components/app/_index.scss +4 -0
- package/lib/components/app/appContent.scss +26 -0
- package/lib/components/app/appHeader.scss +15 -0
- package/lib/components/app/appLayout.scss +23 -0
- package/lib/components/app/appSideNav/AppSideNav.d.ts +7 -0
- package/lib/components/app/appSideNav/AppSideNav.js +46 -0
- package/lib/components/app/appSideNav/AppSideNavLink.d.ts +4 -0
- package/lib/components/app/appSideNav/AppSideNavLink.js +26 -0
- package/lib/components/app/appSideNav/AppSideNavSections.d.ts +2 -0
- package/lib/components/app/appSideNav/AppSideNavSections.js +11 -0
- package/lib/components/app/appSideNav/AppSideNavTree.d.ts +2 -0
- package/lib/components/app/appSideNav/AppSideNavTree.js +38 -0
- package/lib/components/app/appSideNav/_index.scss +17 -0
- package/lib/components/app/appSideNav/appSideNav.scss +75 -0
- package/lib/components/app/appSideNav/appSideNavSections.scss +33 -0
- package/lib/components/app/appSideNav/appSideNavTree.scss +25 -0
- package/lib/components/app/types.d.ts +21 -0
- package/lib/components/app/types.js +1 -0
- package/lib/components/badge/Badge.d.ts +14 -0
- package/lib/components/badge/Badge.js +33 -0
- package/lib/components/badge/_index.scss +64 -0
- package/lib/components/button/BaseButton.d.ts +28 -0
- package/lib/components/button/BaseButton.js +65 -0
- package/lib/components/button/ButtonPrimary.d.ts +8 -0
- package/lib/components/button/ButtonPrimary.js +42 -0
- package/lib/components/button/ButtonSecondary.d.ts +10 -0
- package/lib/components/button/ButtonSecondary.js +43 -0
- package/lib/components/button/ButtonTertiary.d.ts +10 -0
- package/lib/components/button/ButtonTertiary.js +43 -0
- package/lib/components/button/IconButton.d.ts +16 -0
- package/lib/components/button/IconButton.js +29 -0
- package/lib/components/button/_index.scss +5 -0
- package/lib/components/button/baseButton.scss +94 -0
- package/lib/components/button/buttonPrimary.scss +51 -0
- package/lib/components/button/buttonSecondary.scss +54 -0
- package/lib/components/button/buttonTertiary.scss +56 -0
- package/lib/components/button/createButtonIcon.d.ts +3 -0
- package/lib/components/button/createButtonIcon.js +24 -0
- package/lib/components/button/iconButton.scss +44 -0
- package/lib/components/button/types.d.ts +3 -0
- package/lib/components/button/types.js +2 -0
- package/lib/components/callout/Callout.d.ts +13 -0
- package/lib/components/callout/Callout.js +40 -0
- package/lib/components/callout/_index.scss +49 -0
- package/lib/components/callout/types.d.ts +3 -0
- package/lib/components/callout/types.js +2 -0
- package/lib/components/card/Card.d.ts +14 -0
- package/lib/components/card/Card.js +29 -0
- package/lib/components/card/_index.scss +114 -0
- package/lib/components/chat/Chat.d.ts +17 -0
- package/lib/components/chat/Chat.js +130 -0
- package/lib/components/chat/ChatInspector.d.ts +7 -0
- package/lib/components/chat/ChatInspector.js +12 -0
- package/lib/components/chat/ChatPanel.d.ts +7 -0
- package/lib/components/chat/ChatPanel.js +11 -0
- package/lib/components/chat/ChatSearchResult.d.ts +16 -0
- package/lib/components/chat/ChatSearchResult.js +26 -0
- package/lib/components/chat/ChatTurn.d.ts +9 -0
- package/lib/components/chat/ChatTurn.js +19 -0
- package/lib/components/chat/_index.scss +150 -0
- package/lib/components/chat/chatTurn.scss +38 -0
- package/lib/components/chat/types.d.ts +17 -0
- package/lib/components/chat/types.js +19 -0
- package/lib/components/code/Code.d.ts +17 -0
- package/lib/components/code/Code.js +44 -0
- package/lib/components/code/_index.scss +33 -0
- package/lib/components/code/types.d.ts +1 -0
- package/lib/components/code/types.js +1 -0
- package/lib/components/context/Context.d.ts +18 -0
- package/lib/components/context/Context.js +34 -0
- package/lib/components/context/Context.test.util.d.ts +2 -0
- package/lib/components/context/Context.test.util.js +22 -0
- package/lib/components/copyButton/CopyButton.d.ts +10 -0
- package/lib/components/copyButton/CopyButton.js +50 -0
- package/lib/components/drawer/Drawer.d.ts +13 -0
- package/lib/components/drawer/Drawer.js +53 -0
- package/lib/components/drawer/_index.scss +73 -0
- package/lib/components/flex/FlexContainer.d.ts +36 -0
- package/lib/components/flex/FlexContainer.js +53 -0
- package/lib/components/flex/FlexItem.d.ts +22 -0
- package/lib/components/flex/FlexItem.js +36 -0
- package/lib/components/flex/_flexContainer.scss +79 -0
- package/lib/components/flex/_flexItem.scss +64 -0
- package/lib/components/flex/_index.scss +2 -0
- package/lib/components/flex/types.d.ts +2 -0
- package/lib/components/flex/types.js +1 -0
- package/lib/components/form/_index.scss +7 -0
- package/lib/components/form/checkbox/Checkbox.d.ts +8 -0
- package/lib/components/form/checkbox/Checkbox.js +24 -0
- package/lib/components/form/checkbox/_index.scss +3 -0
- package/lib/components/form/index.d.ts +10 -0
- package/lib/components/form/index.js +9 -0
- package/lib/components/form/input/BasicInput.d.ts +15 -0
- package/lib/components/form/input/BasicInput.js +30 -0
- package/lib/components/form/input/NumberInput.d.ts +8 -0
- package/lib/components/form/input/NumberInput.js +61 -0
- package/lib/components/form/input/PasswordInput.d.ts +7 -0
- package/lib/components/form/input/PasswordInput.js +21 -0
- package/lib/components/form/input/TextInput.d.ts +6 -0
- package/lib/components/form/input/TextInput.js +21 -0
- package/lib/components/form/input/_index.scss +24 -0
- package/lib/components/form/label/Label.d.ts +7 -0
- package/lib/components/form/label/Label.js +18 -0
- package/lib/components/form/label/_index.scss +5 -0
- package/lib/components/form/radioButton/RadioButton.d.ts +9 -0
- package/lib/components/form/radioButton/RadioButton.js +24 -0
- package/lib/components/form/radioButton/_index.scss +3 -0
- package/lib/components/form/select/Select.d.ts +17 -0
- package/lib/components/form/select/Select.js +34 -0
- package/lib/components/form/select/_index.scss +56 -0
- package/lib/components/form/superRadioGroup/SuperRadioButton.d.ts +7 -0
- package/lib/components/form/superRadioGroup/SuperRadioButton.js +22 -0
- package/lib/components/form/superRadioGroup/SuperRadioGroup.d.ts +8 -0
- package/lib/components/form/superRadioGroup/SuperRadioGroup.js +6 -0
- package/lib/components/form/superRadioGroup/_index.scss +31 -0
- package/lib/components/form/superRadioGroup/types.d.ts +8 -0
- package/lib/components/form/superRadioGroup/types.js +1 -0
- package/lib/components/form/textArea/TextArea.d.ts +12 -0
- package/lib/components/form/textArea/TextArea.js +21 -0
- package/lib/components/form/textArea/_index.scss +14 -0
- package/lib/components/formGroup/FormGroup.d.ts +10 -0
- package/lib/components/formGroup/FormGroup.js +27 -0
- package/lib/components/grid/Grid.d.ts +12 -0
- package/lib/components/grid/Grid.js +20 -0
- package/lib/components/grid/_index.scss +51 -0
- package/lib/components/horizontalRule/HorizontalRule.d.ts +6 -0
- package/lib/components/horizontalRule/HorizontalRule.js +4 -0
- package/lib/components/horizontalRule/_index.scss +40 -0
- package/lib/components/icon/Icon.d.ts +11 -0
- package/lib/components/icon/Icon.js +37 -0
- package/lib/components/icon/_index.scss +25 -0
- package/lib/components/icon/types.d.ts +2 -0
- package/lib/components/icon/types.js +12 -0
- package/lib/components/index.d.ts +75 -0
- package/lib/components/index.js +67 -0
- package/lib/components/infoTable/InfoTable.d.ts +24 -0
- package/lib/components/infoTable/InfoTable.js +24 -0
- package/lib/components/infoTable/_index.scss +53 -0
- package/lib/components/link/Link.d.ts +3 -0
- package/lib/components/link/Link.js +36 -0
- package/lib/components/link/Link.test.d.ts +1 -0
- package/lib/components/link/Link.test.js +40 -0
- package/lib/components/link/_index.scss +17 -0
- package/lib/components/link/types.d.ts +15 -0
- package/lib/components/link/types.js +1 -0
- package/lib/components/list/List.d.ts +12 -0
- package/lib/components/list/List.js +15 -0
- package/lib/components/list/_index.scss +29 -0
- package/lib/components/menu/Menu.d.ts +7 -0
- package/lib/components/menu/Menu.js +6 -0
- package/lib/components/menu/MenuItem.d.ts +10 -0
- package/lib/components/menu/MenuItem.js +31 -0
- package/lib/components/menu/_index.scss +75 -0
- package/lib/components/modal/Modal.d.ts +13 -0
- package/lib/components/modal/Modal.js +53 -0
- package/lib/components/modal/_index.scss +85 -0
- package/lib/components/notification/Notification.d.ts +12 -0
- package/lib/components/notification/Notification.js +23 -0
- package/lib/components/notification/Notifications.d.ts +10 -0
- package/lib/components/notification/Notifications.js +35 -0
- package/lib/components/notification/_index.scss +99 -0
- package/lib/components/optionsButton/OptionsButton.d.ts +7 -0
- package/lib/components/optionsButton/OptionsButton.js +25 -0
- package/lib/components/optionsButton/_index.scss +42 -0
- package/lib/components/optionsList/OptionsList.d.ts +13 -0
- package/lib/components/optionsList/OptionsList.js +31 -0
- package/lib/components/optionsList/OptionsListItem.d.ts +10 -0
- package/lib/components/optionsList/OptionsListItem.js +41 -0
- package/lib/components/optionsList/_index.scss +84 -0
- package/lib/components/optionsList/types.d.ts +13 -0
- package/lib/components/optionsList/types.js +1 -0
- package/lib/components/popover/Popover.d.ts +11 -0
- package/lib/components/popover/Popover.js +91 -0
- package/lib/components/popover/_index.scss +29 -0
- package/lib/components/portal/Portal.d.ts +6 -0
- package/lib/components/portal/Portal.js +16 -0
- package/lib/components/progressBar/ProgressBar.d.ts +9 -0
- package/lib/components/progressBar/ProgressBar.js +26 -0
- package/lib/components/progressBar/_index.scss +63 -0
- package/lib/components/prompt/Prompt.d.ts +20 -0
- package/lib/components/prompt/Prompt.js +19 -0
- package/lib/components/prompt/_index.scss +70 -0
- package/lib/components/screenBlock/ScreenBlock.d.ts +6 -0
- package/lib/components/screenBlock/ScreenBlock.js +4 -0
- package/lib/components/screenBlock/_index.scss +17 -0
- package/lib/components/searchInput/SearchInput.d.ts +13 -0
- package/lib/components/searchInput/SearchInput.js +19 -0
- package/lib/components/searchInput/_index.scss +49 -0
- package/lib/components/searchResult/SearchResult.d.ts +21 -0
- package/lib/components/searchResult/SearchResult.js +33 -0
- package/lib/components/searchResult/SearchResult.test.d.ts +1 -0
- package/lib/components/searchResult/SearchResult.test.js +280 -0
- package/lib/components/searchResult/_index.scss +29 -0
- package/lib/components/searchSelect/SearchSelect.d.ts +11 -0
- package/lib/components/searchSelect/SearchSelect.js +78 -0
- package/lib/components/searchSelect/_index.scss +13 -0
- package/lib/components/setting/Setting.d.ts +12 -0
- package/lib/components/setting/Setting.js +24 -0
- package/lib/components/spacer/Spacer.d.ts +6 -0
- package/lib/components/spacer/Spacer.js +6 -0
- package/lib/components/spacer/_index.scss +20 -0
- package/lib/components/spacer/types.d.ts +1 -0
- package/lib/components/spacer/types.js +1 -0
- package/lib/components/spinner/Spinner.d.ts +7 -0
- package/lib/components/spinner/Spinner.js +15 -0
- package/lib/components/spinner/_index.scss +52 -0
- package/lib/components/spinner/types.d.ts +3 -0
- package/lib/components/spinner/types.js +2 -0
- package/lib/components/statList/StatList.d.ts +9 -0
- package/lib/components/statList/StatList.js +15 -0
- package/lib/components/statList/_index.scss +3 -0
- package/lib/components/status/Status.d.ts +6 -0
- package/lib/components/status/Status.js +24 -0
- package/lib/components/summary/Summary.d.ts +7 -0
- package/lib/components/summary/Summary.js +43 -0
- package/lib/components/summary/Summary.test.d.ts +1 -0
- package/lib/components/summary/Summary.test.js +544 -0
- package/lib/components/summary/SummaryCitation.d.ts +8 -0
- package/lib/components/summary/SummaryCitation.js +20 -0
- package/lib/components/summary/_index.scss +29 -0
- package/lib/components/table/Table.d.ts +44 -0
- package/lib/components/table/Table.js +117 -0
- package/lib/components/table/TableBulkActions.d.ts +7 -0
- package/lib/components/table/TableBulkActions.js +34 -0
- package/lib/components/table/TableCell.d.ts +5 -0
- package/lib/components/table/TableCell.js +4 -0
- package/lib/components/table/TableContent.d.ts +6 -0
- package/lib/components/table/TableContent.js +6 -0
- package/lib/components/table/TableHeaderCell.d.ts +9 -0
- package/lib/components/table/TableHeaderCell.js +8 -0
- package/lib/components/table/TablePager.d.ts +9 -0
- package/lib/components/table/TablePager.js +9 -0
- package/lib/components/table/TablePagination.d.ts +10 -0
- package/lib/components/table/TablePagination.js +18 -0
- package/lib/components/table/TableRowActions.d.ts +15 -0
- package/lib/components/table/TableRowActions.js +29 -0
- package/lib/components/table/_index.scss +70 -0
- package/lib/components/table/createPagination.d.ts +4 -0
- package/lib/components/table/createPagination.js +44 -0
- package/lib/components/table/createPagination.test.d.ts +1 -0
- package/lib/components/table/createPagination.test.js +32 -0
- package/lib/components/table/types.d.ts +1 -0
- package/lib/components/table/types.js +1 -0
- package/lib/components/tabs/Tab.d.ts +9 -0
- package/lib/components/tabs/Tab.js +27 -0
- package/lib/components/tabs/TabbedRoutes.d.ts +15 -0
- package/lib/components/tabs/TabbedRoutes.js +15 -0
- package/lib/components/tabs/Tabs.d.ts +10 -0
- package/lib/components/tabs/Tabs.js +8 -0
- package/lib/components/tabs/_index.scss +103 -0
- package/lib/components/tabs/types.d.ts +2 -0
- package/lib/components/tabs/types.js +1 -0
- package/lib/components/toggle/Toggle.d.ts +8 -0
- package/lib/components/toggle/Toggle.js +25 -0
- package/lib/components/toggle/_index.scss +55 -0
- package/lib/components/topicButton/TopicButton.d.ts +10 -0
- package/lib/components/topicButton/TopicButton.js +30 -0
- package/lib/components/topicButton/_index.scss +21 -0
- package/lib/components/typography/Text.d.ts +13 -0
- package/lib/components/typography/Text.js +24 -0
- package/lib/components/typography/TextColor.d.ts +9 -0
- package/lib/components/typography/TextColor.js +6 -0
- package/lib/components/typography/Title.d.ts +11 -0
- package/lib/components/typography/Title.js +20 -0
- package/lib/components/typography/_index.scss +3 -0
- package/lib/components/typography/_text.scss +150 -0
- package/lib/components/typography/_textColor.scss +15 -0
- package/lib/components/typography/_title.scss +68 -0
- package/lib/components/typography/types.d.ts +4 -0
- package/lib/components/typography/types.js +3 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/sassUtils/_animation.scss +1 -0
- package/lib/sassUtils/_app.scss +1 -0
- package/lib/sassUtils/_borders.scss +2 -0
- package/lib/sassUtils/_colors.scss +24 -0
- package/lib/sassUtils/_depth.scss +8 -0
- package/lib/sassUtils/_mixins.scss +11 -0
- package/lib/sassUtils/_shadows.scss +5 -0
- package/lib/sassUtils/_sizes.scss +10 -0
- package/lib/sassUtils/_typography.scss +20 -0
- package/lib/sassUtils/index.scss +10 -0
- package/lib/styles/index.css +3229 -0
- package/lib/utils/citations/applyCitationOrder.d.ts +1 -0
- package/lib/utils/citations/applyCitationOrder.js +19 -0
- package/lib/utils/citations/applyCitationOrder.test.d.ts +1 -0
- package/lib/utils/citations/applyCitationOrder.test.js +65 -0
- package/lib/utils/citations/extractCitations.d.ts +4 -0
- package/lib/utils/citations/extractCitations.js +26 -0
- package/lib/utils/citations/extractCitations.test.d.ts +1 -0
- package/lib/utils/citations/extractCitations.test.js +40 -0
- package/lib/utils/citations/index.d.ts +5 -0
- package/lib/utils/citations/index.js +5 -0
- package/lib/utils/citations/removeCitations.d.ts +1 -0
- package/lib/utils/citations/removeCitations.js +2 -0
- package/lib/utils/citations/removeCitations.test.d.ts +1 -0
- package/lib/utils/citations/removeCitations.test.js +11 -0
- package/lib/utils/citations/reorderCitations.d.ts +1 -0
- package/lib/utils/citations/reorderCitations.js +9 -0
- package/lib/utils/citations/reorderCitations.test.d.ts +1 -0
- package/lib/utils/citations/reorderCitations.test.js +6 -0
- package/lib/utils/citations/sanitizeCitations.d.ts +1 -0
- package/lib/utils/citations/sanitizeCitations.js +30 -0
- package/lib/utils/citations/sanitizeCitations.test.d.ts +1 -0
- package/lib/utils/citations/sanitizeCitations.test.js +11 -0
- package/lib/utils/createId.d.ts +1 -0
- package/lib/utils/createId.js +10 -0
- package/lib/utils/getTrackingProps.d.ts +7 -0
- package/lib/utils/getTrackingProps.js +18 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/truncateString.d.ts +2 -0
- package/lib/utils/truncateString.js +20 -0
- package/lib/utils/truncateString.test.d.ts +1 -0
- package/lib/utils/truncateString.test.js +59 -0
- package/licenses.txt +9035 -0
- package/package.json +100 -0
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom";
|
|
4
|
+
import { VuiSummary } from "./Summary";
|
|
5
|
+
import { VuiSummaryCitation } from "./SummaryCitation";
|
|
6
|
+
describe("VuiSummary", () => {
|
|
7
|
+
describe("renders markdown", () => {
|
|
8
|
+
test("without citations", () => {
|
|
9
|
+
const summary = `
|
|
10
|
+
# Here's a heading 1
|
|
11
|
+
|
|
12
|
+
## Here's a heading 2
|
|
13
|
+
|
|
14
|
+
### Here's a heading 3
|
|
15
|
+
|
|
16
|
+
#### Here's a heading 4
|
|
17
|
+
|
|
18
|
+
With some **bold** and _emphasized_ test. Here is a [link](https://www.vectara.com).
|
|
19
|
+
|
|
20
|
+
* An
|
|
21
|
+
* Unordered
|
|
22
|
+
* List
|
|
23
|
+
|
|
24
|
+
1. An
|
|
25
|
+
1. Ordered
|
|
26
|
+
1. List
|
|
27
|
+
|
|
28
|
+
| Syntax | Description |
|
|
29
|
+
| ----------- | ----------- |
|
|
30
|
+
| Header | Title |
|
|
31
|
+
| Paragraph | Text |
|
|
32
|
+
`;
|
|
33
|
+
const { asFragment } = render(_jsx(VuiSummary, { summary: summary, SummaryCitation: VuiSummaryCitation }));
|
|
34
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
35
|
+
<DocumentFragment>
|
|
36
|
+
<div
|
|
37
|
+
class="vuiSummary fs-mask"
|
|
38
|
+
dir="auto"
|
|
39
|
+
>
|
|
40
|
+
<div
|
|
41
|
+
class="vuiText vuiText--m"
|
|
42
|
+
>
|
|
43
|
+
<div>
|
|
44
|
+
<h1
|
|
45
|
+
id="heres-a-heading-1"
|
|
46
|
+
>
|
|
47
|
+
Here's a heading 1
|
|
48
|
+
</h1>
|
|
49
|
+
<h2
|
|
50
|
+
id="heres-a-heading-2"
|
|
51
|
+
>
|
|
52
|
+
Here's a heading 2
|
|
53
|
+
</h2>
|
|
54
|
+
<h3
|
|
55
|
+
id="heres-a-heading-3"
|
|
56
|
+
>
|
|
57
|
+
Here's a heading 3
|
|
58
|
+
</h3>
|
|
59
|
+
<h4
|
|
60
|
+
id="heres-a-heading-4"
|
|
61
|
+
>
|
|
62
|
+
Here's a heading 4
|
|
63
|
+
</h4>
|
|
64
|
+
<p>
|
|
65
|
+
With some
|
|
66
|
+
<strong>
|
|
67
|
+
bold
|
|
68
|
+
</strong>
|
|
69
|
+
and
|
|
70
|
+
<em>
|
|
71
|
+
emphasized
|
|
72
|
+
</em>
|
|
73
|
+
test. Here is a
|
|
74
|
+
<a
|
|
75
|
+
href="https://www.vectara.com"
|
|
76
|
+
>
|
|
77
|
+
link
|
|
78
|
+
</a>
|
|
79
|
+
.
|
|
80
|
+
</p>
|
|
81
|
+
<ul>
|
|
82
|
+
<li>
|
|
83
|
+
An
|
|
84
|
+
</li>
|
|
85
|
+
<li>
|
|
86
|
+
Unordered
|
|
87
|
+
</li>
|
|
88
|
+
<li>
|
|
89
|
+
List
|
|
90
|
+
</li>
|
|
91
|
+
</ul>
|
|
92
|
+
<ol
|
|
93
|
+
start="1"
|
|
94
|
+
>
|
|
95
|
+
<li>
|
|
96
|
+
An
|
|
97
|
+
</li>
|
|
98
|
+
<li>
|
|
99
|
+
Ordered
|
|
100
|
+
</li>
|
|
101
|
+
<li>
|
|
102
|
+
List
|
|
103
|
+
</li>
|
|
104
|
+
</ol>
|
|
105
|
+
<table>
|
|
106
|
+
<thead>
|
|
107
|
+
<tr>
|
|
108
|
+
<th>
|
|
109
|
+
Syntax
|
|
110
|
+
</th>
|
|
111
|
+
<th>
|
|
112
|
+
Description
|
|
113
|
+
</th>
|
|
114
|
+
</tr>
|
|
115
|
+
</thead>
|
|
116
|
+
<tbody>
|
|
117
|
+
<tr>
|
|
118
|
+
<td>
|
|
119
|
+
Header
|
|
120
|
+
</td>
|
|
121
|
+
<td>
|
|
122
|
+
Title
|
|
123
|
+
</td>
|
|
124
|
+
</tr>
|
|
125
|
+
<tr>
|
|
126
|
+
<td>
|
|
127
|
+
Paragraph
|
|
128
|
+
</td>
|
|
129
|
+
<td>
|
|
130
|
+
Text
|
|
131
|
+
</td>
|
|
132
|
+
</tr>
|
|
133
|
+
</tbody>
|
|
134
|
+
</table>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
</DocumentFragment>
|
|
139
|
+
`);
|
|
140
|
+
});
|
|
141
|
+
test("with citations", () => {
|
|
142
|
+
const summary = `
|
|
143
|
+
# [1] Here's a heading 1
|
|
144
|
+
|
|
145
|
+
## [1] Here's a heading 2
|
|
146
|
+
|
|
147
|
+
### [1] Here's a heading 3
|
|
148
|
+
|
|
149
|
+
#### [1] Here's a heading 4
|
|
150
|
+
|
|
151
|
+
With some **bold** [2][3] and _emphasized_ [2][3] test. Here is a [link](https://www.vectara.com) [2][3].
|
|
152
|
+
|
|
153
|
+
* An [2][3]
|
|
154
|
+
* Unordered [2][3]
|
|
155
|
+
* List [2][3]
|
|
156
|
+
|
|
157
|
+
1. An [2][3]
|
|
158
|
+
1. Ordered [2][3]
|
|
159
|
+
1. List [2][3]
|
|
160
|
+
|
|
161
|
+
| Syntax | Description |
|
|
162
|
+
| ----------- | ----------- |
|
|
163
|
+
| Header | Title [2][3] |
|
|
164
|
+
| Paragraph | Text |
|
|
165
|
+
`;
|
|
166
|
+
const { asFragment } = render(_jsx(VuiSummary, { summary: summary, SummaryCitation: VuiSummaryCitation }));
|
|
167
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
168
|
+
<DocumentFragment>
|
|
169
|
+
<div
|
|
170
|
+
class="vuiSummary fs-mask"
|
|
171
|
+
dir="auto"
|
|
172
|
+
>
|
|
173
|
+
<div
|
|
174
|
+
class="vuiText vuiText--m"
|
|
175
|
+
>
|
|
176
|
+
<div>
|
|
177
|
+
<h1
|
|
178
|
+
id="summarycitation-reference1--heres-a-heading-1"
|
|
179
|
+
>
|
|
180
|
+
<button
|
|
181
|
+
class="vuiSummaryCitation"
|
|
182
|
+
>
|
|
183
|
+
1
|
|
184
|
+
</button>
|
|
185
|
+
Here's a heading 1
|
|
186
|
+
</h1>
|
|
187
|
+
<h2
|
|
188
|
+
id="summarycitation-reference1--heres-a-heading-2"
|
|
189
|
+
>
|
|
190
|
+
<button
|
|
191
|
+
class="vuiSummaryCitation"
|
|
192
|
+
>
|
|
193
|
+
1
|
|
194
|
+
</button>
|
|
195
|
+
Here's a heading 2
|
|
196
|
+
</h2>
|
|
197
|
+
<h3
|
|
198
|
+
id="summarycitation-reference1--heres-a-heading-3"
|
|
199
|
+
>
|
|
200
|
+
<button
|
|
201
|
+
class="vuiSummaryCitation"
|
|
202
|
+
>
|
|
203
|
+
1
|
|
204
|
+
</button>
|
|
205
|
+
Here's a heading 3
|
|
206
|
+
</h3>
|
|
207
|
+
<h4
|
|
208
|
+
id="summarycitation-reference1--heres-a-heading-4"
|
|
209
|
+
>
|
|
210
|
+
<button
|
|
211
|
+
class="vuiSummaryCitation"
|
|
212
|
+
>
|
|
213
|
+
1
|
|
214
|
+
</button>
|
|
215
|
+
Here's a heading 4
|
|
216
|
+
</h4>
|
|
217
|
+
<p>
|
|
218
|
+
With some
|
|
219
|
+
<strong>
|
|
220
|
+
bold
|
|
221
|
+
</strong>
|
|
222
|
+
<button
|
|
223
|
+
class="vuiSummaryCitation"
|
|
224
|
+
>
|
|
225
|
+
2
|
|
226
|
+
</button>
|
|
227
|
+
<button
|
|
228
|
+
class="vuiSummaryCitation"
|
|
229
|
+
>
|
|
230
|
+
3
|
|
231
|
+
</button>
|
|
232
|
+
and
|
|
233
|
+
<em>
|
|
234
|
+
emphasized
|
|
235
|
+
</em>
|
|
236
|
+
<button
|
|
237
|
+
class="vuiSummaryCitation"
|
|
238
|
+
>
|
|
239
|
+
2
|
|
240
|
+
</button>
|
|
241
|
+
<button
|
|
242
|
+
class="vuiSummaryCitation"
|
|
243
|
+
>
|
|
244
|
+
3
|
|
245
|
+
</button>
|
|
246
|
+
test. Here is a
|
|
247
|
+
<a
|
|
248
|
+
href="https://www.vectara.com"
|
|
249
|
+
>
|
|
250
|
+
link
|
|
251
|
+
</a>
|
|
252
|
+
<button
|
|
253
|
+
class="vuiSummaryCitation"
|
|
254
|
+
>
|
|
255
|
+
2
|
|
256
|
+
</button>
|
|
257
|
+
<button
|
|
258
|
+
class="vuiSummaryCitation"
|
|
259
|
+
>
|
|
260
|
+
3
|
|
261
|
+
</button>
|
|
262
|
+
.
|
|
263
|
+
</p>
|
|
264
|
+
<ul>
|
|
265
|
+
<li>
|
|
266
|
+
An
|
|
267
|
+
<button
|
|
268
|
+
class="vuiSummaryCitation"
|
|
269
|
+
>
|
|
270
|
+
2
|
|
271
|
+
</button>
|
|
272
|
+
<button
|
|
273
|
+
class="vuiSummaryCitation"
|
|
274
|
+
>
|
|
275
|
+
3
|
|
276
|
+
</button>
|
|
277
|
+
</li>
|
|
278
|
+
<li>
|
|
279
|
+
Unordered
|
|
280
|
+
<button
|
|
281
|
+
class="vuiSummaryCitation"
|
|
282
|
+
>
|
|
283
|
+
2
|
|
284
|
+
</button>
|
|
285
|
+
<button
|
|
286
|
+
class="vuiSummaryCitation"
|
|
287
|
+
>
|
|
288
|
+
3
|
|
289
|
+
</button>
|
|
290
|
+
</li>
|
|
291
|
+
<li>
|
|
292
|
+
List
|
|
293
|
+
<button
|
|
294
|
+
class="vuiSummaryCitation"
|
|
295
|
+
>
|
|
296
|
+
2
|
|
297
|
+
</button>
|
|
298
|
+
<button
|
|
299
|
+
class="vuiSummaryCitation"
|
|
300
|
+
>
|
|
301
|
+
3
|
|
302
|
+
</button>
|
|
303
|
+
</li>
|
|
304
|
+
</ul>
|
|
305
|
+
<ol
|
|
306
|
+
start="1"
|
|
307
|
+
>
|
|
308
|
+
<li>
|
|
309
|
+
An
|
|
310
|
+
<button
|
|
311
|
+
class="vuiSummaryCitation"
|
|
312
|
+
>
|
|
313
|
+
2
|
|
314
|
+
</button>
|
|
315
|
+
<button
|
|
316
|
+
class="vuiSummaryCitation"
|
|
317
|
+
>
|
|
318
|
+
3
|
|
319
|
+
</button>
|
|
320
|
+
</li>
|
|
321
|
+
<li>
|
|
322
|
+
Ordered
|
|
323
|
+
<button
|
|
324
|
+
class="vuiSummaryCitation"
|
|
325
|
+
>
|
|
326
|
+
2
|
|
327
|
+
</button>
|
|
328
|
+
<button
|
|
329
|
+
class="vuiSummaryCitation"
|
|
330
|
+
>
|
|
331
|
+
3
|
|
332
|
+
</button>
|
|
333
|
+
</li>
|
|
334
|
+
<li>
|
|
335
|
+
List
|
|
336
|
+
<button
|
|
337
|
+
class="vuiSummaryCitation"
|
|
338
|
+
>
|
|
339
|
+
2
|
|
340
|
+
</button>
|
|
341
|
+
<button
|
|
342
|
+
class="vuiSummaryCitation"
|
|
343
|
+
>
|
|
344
|
+
3
|
|
345
|
+
</button>
|
|
346
|
+
</li>
|
|
347
|
+
</ol>
|
|
348
|
+
<table>
|
|
349
|
+
<thead>
|
|
350
|
+
<tr>
|
|
351
|
+
<th>
|
|
352
|
+
Syntax
|
|
353
|
+
</th>
|
|
354
|
+
<th>
|
|
355
|
+
Description
|
|
356
|
+
</th>
|
|
357
|
+
</tr>
|
|
358
|
+
</thead>
|
|
359
|
+
<tbody>
|
|
360
|
+
<tr>
|
|
361
|
+
<td>
|
|
362
|
+
Header
|
|
363
|
+
</td>
|
|
364
|
+
<td>
|
|
365
|
+
Title
|
|
366
|
+
<button
|
|
367
|
+
class="vuiSummaryCitation"
|
|
368
|
+
>
|
|
369
|
+
2
|
|
370
|
+
</button>
|
|
371
|
+
<button
|
|
372
|
+
class="vuiSummaryCitation"
|
|
373
|
+
>
|
|
374
|
+
3
|
|
375
|
+
</button>
|
|
376
|
+
</td>
|
|
377
|
+
</tr>
|
|
378
|
+
<tr>
|
|
379
|
+
<td>
|
|
380
|
+
Paragraph
|
|
381
|
+
</td>
|
|
382
|
+
<td>
|
|
383
|
+
Text
|
|
384
|
+
</td>
|
|
385
|
+
</tr>
|
|
386
|
+
</tbody>
|
|
387
|
+
</table>
|
|
388
|
+
</div>
|
|
389
|
+
</div>
|
|
390
|
+
</div>
|
|
391
|
+
</DocumentFragment>
|
|
392
|
+
`);
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
describe("renders citations with correct spacing", () => {
|
|
396
|
+
test("with single citations", () => {
|
|
397
|
+
const summary = "[1] Beginning of summary. [2][3] Multiple at beginning of sentence, and before comma [4], single at middle [5] of sentence. At end of sentence [6].";
|
|
398
|
+
const { asFragment } = render(_jsx(VuiSummary, { summary: summary, SummaryCitation: VuiSummaryCitation }));
|
|
399
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
400
|
+
<DocumentFragment>
|
|
401
|
+
<div
|
|
402
|
+
class="vuiSummary fs-mask"
|
|
403
|
+
dir="auto"
|
|
404
|
+
>
|
|
405
|
+
<div
|
|
406
|
+
class="vuiText vuiText--m"
|
|
407
|
+
>
|
|
408
|
+
<div>
|
|
409
|
+
<button
|
|
410
|
+
class="vuiSummaryCitation"
|
|
411
|
+
>
|
|
412
|
+
1
|
|
413
|
+
</button>
|
|
414
|
+
Beginning of summary.
|
|
415
|
+
<button
|
|
416
|
+
class="vuiSummaryCitation"
|
|
417
|
+
>
|
|
418
|
+
2
|
|
419
|
+
</button>
|
|
420
|
+
<button
|
|
421
|
+
class="vuiSummaryCitation"
|
|
422
|
+
>
|
|
423
|
+
3
|
|
424
|
+
</button>
|
|
425
|
+
Multiple at beginning of sentence, and before comma
|
|
426
|
+
<button
|
|
427
|
+
class="vuiSummaryCitation"
|
|
428
|
+
>
|
|
429
|
+
4
|
|
430
|
+
</button>
|
|
431
|
+
, single at middle
|
|
432
|
+
<button
|
|
433
|
+
class="vuiSummaryCitation"
|
|
434
|
+
>
|
|
435
|
+
5
|
|
436
|
+
</button>
|
|
437
|
+
of sentence. At end of sentence
|
|
438
|
+
<button
|
|
439
|
+
class="vuiSummaryCitation"
|
|
440
|
+
>
|
|
441
|
+
6
|
|
442
|
+
</button>
|
|
443
|
+
.
|
|
444
|
+
|
|
445
|
+
</div>
|
|
446
|
+
</div>
|
|
447
|
+
</div>
|
|
448
|
+
</DocumentFragment>
|
|
449
|
+
`);
|
|
450
|
+
});
|
|
451
|
+
test("at the end of the summary", () => {
|
|
452
|
+
const summary = "End of summary. [1]";
|
|
453
|
+
const { asFragment } = render(_jsx(VuiSummary, { summary: summary, SummaryCitation: VuiSummaryCitation }));
|
|
454
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
455
|
+
<DocumentFragment>
|
|
456
|
+
<div
|
|
457
|
+
class="vuiSummary fs-mask"
|
|
458
|
+
dir="auto"
|
|
459
|
+
>
|
|
460
|
+
<div
|
|
461
|
+
class="vuiText vuiText--m"
|
|
462
|
+
>
|
|
463
|
+
<p>
|
|
464
|
+
End of summary.
|
|
465
|
+
<button
|
|
466
|
+
class="vuiSummaryCitation"
|
|
467
|
+
>
|
|
468
|
+
1
|
|
469
|
+
</button>
|
|
470
|
+
</p>
|
|
471
|
+
</div>
|
|
472
|
+
</div>
|
|
473
|
+
</DocumentFragment>
|
|
474
|
+
`);
|
|
475
|
+
});
|
|
476
|
+
test("with multiple comma-delimited citations", () => {
|
|
477
|
+
const summary = "Two citations [1, 2] and seven citations [1, 2, 3, 4, 5, 6, 7].";
|
|
478
|
+
const { asFragment } = render(_jsx(VuiSummary, { summary: summary, SummaryCitation: VuiSummaryCitation }));
|
|
479
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
480
|
+
<DocumentFragment>
|
|
481
|
+
<div
|
|
482
|
+
class="vuiSummary fs-mask"
|
|
483
|
+
dir="auto"
|
|
484
|
+
>
|
|
485
|
+
<div
|
|
486
|
+
class="vuiText vuiText--m"
|
|
487
|
+
>
|
|
488
|
+
<p>
|
|
489
|
+
Two citations
|
|
490
|
+
<button
|
|
491
|
+
class="vuiSummaryCitation"
|
|
492
|
+
>
|
|
493
|
+
1
|
|
494
|
+
</button>
|
|
495
|
+
<button
|
|
496
|
+
class="vuiSummaryCitation"
|
|
497
|
+
>
|
|
498
|
+
2
|
|
499
|
+
</button>
|
|
500
|
+
and seven citations
|
|
501
|
+
<button
|
|
502
|
+
class="vuiSummaryCitation"
|
|
503
|
+
>
|
|
504
|
+
1
|
|
505
|
+
</button>
|
|
506
|
+
<button
|
|
507
|
+
class="vuiSummaryCitation"
|
|
508
|
+
>
|
|
509
|
+
2
|
|
510
|
+
</button>
|
|
511
|
+
<button
|
|
512
|
+
class="vuiSummaryCitation"
|
|
513
|
+
>
|
|
514
|
+
3
|
|
515
|
+
</button>
|
|
516
|
+
<button
|
|
517
|
+
class="vuiSummaryCitation"
|
|
518
|
+
>
|
|
519
|
+
4
|
|
520
|
+
</button>
|
|
521
|
+
<button
|
|
522
|
+
class="vuiSummaryCitation"
|
|
523
|
+
>
|
|
524
|
+
5
|
|
525
|
+
</button>
|
|
526
|
+
<button
|
|
527
|
+
class="vuiSummaryCitation"
|
|
528
|
+
>
|
|
529
|
+
6
|
|
530
|
+
</button>
|
|
531
|
+
<button
|
|
532
|
+
class="vuiSummaryCitation"
|
|
533
|
+
>
|
|
534
|
+
7
|
|
535
|
+
</button>
|
|
536
|
+
.
|
|
537
|
+
</p>
|
|
538
|
+
</div>
|
|
539
|
+
</div>
|
|
540
|
+
</DocumentFragment>
|
|
541
|
+
`);
|
|
542
|
+
});
|
|
543
|
+
});
|
|
544
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
reference: string;
|
|
3
|
+
isSelected?: boolean;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const VuiSummaryCitation: ({ reference, isSelected, onClick, className, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
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 classNames from "classnames";
|
|
14
|
+
export const VuiSummaryCitation = (_a) => {
|
|
15
|
+
var { reference, isSelected, onClick, className } = _a, rest = __rest(_a, ["reference", "isSelected", "onClick", "className"]);
|
|
16
|
+
const classes = classNames("vuiSummaryCitation", className, {
|
|
17
|
+
"vuiSummaryCitation-isSelected": isSelected
|
|
18
|
+
});
|
|
19
|
+
return (_jsx("button", Object.assign({ className: classes, onClick: onClick }, rest, { children: reference })));
|
|
20
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.vuiSummary {
|
|
2
|
+
font-size: $fontSizeMedium;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.vuiSummaryCitation {
|
|
6
|
+
vertical-align: middle;
|
|
7
|
+
position: relative;
|
|
8
|
+
top: -2px;
|
|
9
|
+
display: inline-block;
|
|
10
|
+
background-color: $colorLightShade;
|
|
11
|
+
color: $colorDarkShade;
|
|
12
|
+
padding: $sizeXxxs $sizeXs;
|
|
13
|
+
font-size: $fontSizeSmall;
|
|
14
|
+
border-radius: $sizeXxs;
|
|
15
|
+
font-weight: $fontWeightBold;
|
|
16
|
+
line-height: 1.4;
|
|
17
|
+
transition: all $transitionSpeed;
|
|
18
|
+
|
|
19
|
+
&:hover {
|
|
20
|
+
color: $colorPrimary;
|
|
21
|
+
background-color: $colorPrimaryLightShade;
|
|
22
|
+
text-decoration: underline;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.vuiSummaryCitation-isSelected {
|
|
27
|
+
background-color: $colorPrimary;
|
|
28
|
+
color: $colorEmptyShade;
|
|
29
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Props as TableRowActionsProps } from "./TableRowActions";
|
|
3
|
+
import { Props as TableHeaderCellProps } from "./TableHeaderCell";
|
|
4
|
+
import { Pagination } from "./TablePagination";
|
|
5
|
+
import { Pager } from "./TablePager";
|
|
6
|
+
import { Props as TableBulkActionProps } from "./TableBulkActions";
|
|
7
|
+
import { Row } from "./types";
|
|
8
|
+
type Column<T> = {
|
|
9
|
+
name: string;
|
|
10
|
+
width?: string;
|
|
11
|
+
header: TableHeaderCellProps["header"];
|
|
12
|
+
render?: (row: T) => React.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
type Props<T> = {
|
|
16
|
+
isLoading?: boolean;
|
|
17
|
+
idField: keyof T | ((row: T) => string);
|
|
18
|
+
columns: Column<T>[];
|
|
19
|
+
rows: T[];
|
|
20
|
+
actions?: TableRowActionsProps<T>["actions"];
|
|
21
|
+
actionsTestIdProvider?: (row: T) => string;
|
|
22
|
+
pagination?: Pagination | Pager;
|
|
23
|
+
selection?: Selection<T>;
|
|
24
|
+
search?: Search;
|
|
25
|
+
customControls?: React.ReactNode;
|
|
26
|
+
onSort?: TableHeaderCellProps["onSort"];
|
|
27
|
+
onReload?: () => void;
|
|
28
|
+
content?: React.ReactNode;
|
|
29
|
+
className?: string;
|
|
30
|
+
fluid?: boolean;
|
|
31
|
+
};
|
|
32
|
+
type Selection<T> = {
|
|
33
|
+
bulkActions?: TableBulkActionProps<T[]>["actions"];
|
|
34
|
+
onSelectRow?: (selectedRows: T[]) => void;
|
|
35
|
+
selectedRows?: T[];
|
|
36
|
+
};
|
|
37
|
+
type Search = {
|
|
38
|
+
searchValue?: string;
|
|
39
|
+
searchPlaceholder?: string;
|
|
40
|
+
onSearchChange?: (value: string) => void;
|
|
41
|
+
"data-testid"?: string;
|
|
42
|
+
};
|
|
43
|
+
export declare const VuiTable: <T extends Row>({ isLoading, idField, columns, rows, actions, actionsTestIdProvider, pagination, selection, search, customControls, onSort, onReload, content, className, fluid, ...rest }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export {};
|