@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,63 @@
|
|
|
1
|
+
@use "sass:map";
|
|
2
|
+
|
|
3
|
+
.vuiProgressBar {
|
|
4
|
+
position: relative;
|
|
5
|
+
border-radius: $sizeXxs;
|
|
6
|
+
height: $sizeS;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.vuiProgressBar__empty,
|
|
11
|
+
.vuiProgressBar__bar,
|
|
12
|
+
.vuiProgressBar__outline {
|
|
13
|
+
position: absolute;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.vuiProgressBar__empty {
|
|
19
|
+
z-index: 0;
|
|
20
|
+
background-color: $colorLightShade;
|
|
21
|
+
box-shadow: inset rgba(0, 0, 0, 0.05) 0px 2px 2px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.vuiProgressBar__bar {
|
|
25
|
+
transition: all $transitionSpeed;
|
|
26
|
+
z-index: 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.vuiProgressBar__outline {
|
|
30
|
+
z-index: 2;
|
|
31
|
+
border-radius: $sizeXxs;
|
|
32
|
+
box-shadow: inset 0 0 0 1px rgba(#000000, 0.1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Color
|
|
36
|
+
$color: (
|
|
37
|
+
accent: (
|
|
38
|
+
"background-color": $colorAccent
|
|
39
|
+
),
|
|
40
|
+
primary: (
|
|
41
|
+
"background-color": $colorPrimary
|
|
42
|
+
),
|
|
43
|
+
success: (
|
|
44
|
+
"background-color": $colorSuccess
|
|
45
|
+
),
|
|
46
|
+
warning: (
|
|
47
|
+
"background-color": $colorWarning
|
|
48
|
+
),
|
|
49
|
+
danger: (
|
|
50
|
+
"background-color": $colorDanger
|
|
51
|
+
),
|
|
52
|
+
neutral: (
|
|
53
|
+
"background-color": $colorDarkShade
|
|
54
|
+
)
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
@each $colorName, $colorValue in $color {
|
|
58
|
+
.vuiProgressBar--#{$colorName} {
|
|
59
|
+
.vuiProgressBar__bar {
|
|
60
|
+
background-color: #{map.get($colorValue, "background-color")};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
declare const COLOR: readonly ["danger", "neutral"];
|
|
3
|
+
declare const paddingToClassNameMap: {
|
|
4
|
+
readonly xs: "vuiPrompt--paddingXs";
|
|
5
|
+
readonly s: "vuiPrompt--paddingS";
|
|
6
|
+
readonly m: "vuiPrompt--paddingM";
|
|
7
|
+
readonly l: "vuiPrompt--paddingL";
|
|
8
|
+
readonly xl: "vuiPrompt--paddingXl";
|
|
9
|
+
readonly xxl: "vuiPrompt--paddingXxl";
|
|
10
|
+
};
|
|
11
|
+
type Props = {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
color?: (typeof COLOR)[number];
|
|
15
|
+
padding?: keyof typeof paddingToClassNameMap;
|
|
16
|
+
onClick?: () => void;
|
|
17
|
+
isSpeechBubble?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare const VuiPrompt: ({ children, className, onClick, color, padding, isSpeechBubble }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
const COLOR = ["danger", "neutral"];
|
|
4
|
+
const paddingToClassNameMap = {
|
|
5
|
+
xs: "vuiPrompt--paddingXs",
|
|
6
|
+
s: "vuiPrompt--paddingS",
|
|
7
|
+
m: "vuiPrompt--paddingM",
|
|
8
|
+
l: "vuiPrompt--paddingL",
|
|
9
|
+
xl: "vuiPrompt--paddingXl",
|
|
10
|
+
xxl: "vuiPrompt--paddingXxl"
|
|
11
|
+
};
|
|
12
|
+
export const VuiPrompt = ({ children, className, onClick, color = "neutral", padding = "l", isSpeechBubble }) => {
|
|
13
|
+
const Component = onClick ? "button" : "div";
|
|
14
|
+
const classes = classNames(className, "vuiPrompt", `vuiPrompt--${color}`, paddingToClassNameMap[padding], {
|
|
15
|
+
"vuiPrompt--interactive": onClick !== undefined,
|
|
16
|
+
"vuiPrompt--speechBubble": isSpeechBubble
|
|
17
|
+
});
|
|
18
|
+
return (_jsx(Component, Object.assign({ className: classes, onClick: onClick }, { children: children })));
|
|
19
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
@use "sass:map";
|
|
2
|
+
|
|
3
|
+
.vuiPrompt {
|
|
4
|
+
position: relative;
|
|
5
|
+
border-radius: $sizeM;
|
|
6
|
+
transition: all $transitionSpeed;
|
|
7
|
+
word-wrap: break-word;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.vuiPrompt--speechBubble {
|
|
11
|
+
&::after {
|
|
12
|
+
content: "";
|
|
13
|
+
position: absolute;
|
|
14
|
+
bottom: 0;
|
|
15
|
+
width: 0;
|
|
16
|
+
height: 0;
|
|
17
|
+
left: 48px;
|
|
18
|
+
border-style: solid;
|
|
19
|
+
border-left-color: transparent;
|
|
20
|
+
border-right-color: transparent;
|
|
21
|
+
border-bottom-color: transparent;
|
|
22
|
+
border-width: 20px;
|
|
23
|
+
margin-left: -20px;
|
|
24
|
+
margin-bottom: -20px;
|
|
25
|
+
border-top-color: $colorLightShade;
|
|
26
|
+
border-bottom: 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.vuiPrompt--interactive {
|
|
31
|
+
&:hover {
|
|
32
|
+
background-color: $colorAccentLightShade;
|
|
33
|
+
color: $colorAccent;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Color
|
|
38
|
+
$color: (
|
|
39
|
+
danger: (
|
|
40
|
+
"color": $colorDanger,
|
|
41
|
+
"background-color": $colorDangerLightShade
|
|
42
|
+
),
|
|
43
|
+
neutral: (
|
|
44
|
+
"color": $colorDarkShade,
|
|
45
|
+
"background-color": $colorLightShade
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
@each $colorName, $colorValue in $color {
|
|
50
|
+
.vuiPrompt--#{$colorName} {
|
|
51
|
+
color: #{map.get($colorValue, "color")};
|
|
52
|
+
background-color: #{map.get($colorValue, "background-color")};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Padding
|
|
57
|
+
$padding: (
|
|
58
|
+
paddingXs: $sizeXs,
|
|
59
|
+
paddingS: $sizeS,
|
|
60
|
+
paddingM: $sizeM,
|
|
61
|
+
paddingL: $sizeL,
|
|
62
|
+
paddingXl: $sizeXl,
|
|
63
|
+
paddingXxl: $sizeXl * 2
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
@each $paddingName, $paddingValue in $padding {
|
|
67
|
+
.vuiPrompt--#{$paddingName} {
|
|
68
|
+
padding: $paddingValue;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const VuiScreenBlock = ({ onClick, children }) => {
|
|
3
|
+
return (_jsxs("div", Object.assign({ className: "vuiScreenBlock" }, { children: [children, _jsx("div", { className: "vuiScreenBlock__mask", onClick: onClick })] })));
|
|
4
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.vuiScreenBlock {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
right: 0;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
z-index: $screenBlockZIndex;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.vuiScreenBlock__mask {
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
background-color: transparentize($colorFullShade, 0.4);
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChangeEventHandler, FormEventHandler } from "react";
|
|
2
|
+
declare const SIZE: readonly ["m", "l"];
|
|
3
|
+
type Props = {
|
|
4
|
+
className?: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
size?: (typeof SIZE)[number];
|
|
7
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
autoFocus?: boolean;
|
|
10
|
+
onSubmit?: FormEventHandler;
|
|
11
|
+
};
|
|
12
|
+
export declare const VuiSearchInput: ({ className, size, value, onChange, placeholder, autoFocus, onSubmit, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
const SIZE = ["m", "l"];
|
|
15
|
+
export const VuiSearchInput = (_a) => {
|
|
16
|
+
var { className, size = "m", value, onChange, placeholder, autoFocus, onSubmit } = _a, rest = __rest(_a, ["className", "size", "value", "onChange", "placeholder", "autoFocus", "onSubmit"]);
|
|
17
|
+
const classes = classNames("vuiSearchInput", `vuiSearchInput--${size}`, className);
|
|
18
|
+
return (_jsx("form", Object.assign({ onSubmit: onSubmit }, { children: _jsx("div", Object.assign({ className: classes }, { children: _jsx("input", Object.assign({ className: "vuiSearchInput__input", type: "text", autoComplete: "off", autoCapitalize: "off", spellCheck: "false", autoFocus: autoFocus, placeholder: placeholder, value: value, onChange: onChange }, rest)) })) })));
|
|
19
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.vuiSearchInput {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.vuiSearchInput__input {
|
|
8
|
+
flex-grow: 1;
|
|
9
|
+
background-color: $colorEmptyShade;
|
|
10
|
+
border: 1px solid $colorMediumShade;
|
|
11
|
+
border-radius: $sizeXs;
|
|
12
|
+
box-shadow: $shadowSmallStart;
|
|
13
|
+
transition: all $transitionSpeed;
|
|
14
|
+
outline-width: 1px !important;
|
|
15
|
+
outline-style: solid;
|
|
16
|
+
outline-color: transparent;
|
|
17
|
+
outline-offset: -1px !important;
|
|
18
|
+
|
|
19
|
+
&:focus-visible {
|
|
20
|
+
outline-color: $colorPrimary !important;
|
|
21
|
+
box-shadow: $shadowSmallEnd;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.vuiSearchInput__submitButton {
|
|
26
|
+
position: absolute;
|
|
27
|
+
right: $sizeS;
|
|
28
|
+
line-height: 0; // TODO: Should this be applied to all buttons?
|
|
29
|
+
color: $colorDarkShade;
|
|
30
|
+
transition: all $transitionSpeed;
|
|
31
|
+
|
|
32
|
+
&:hover {
|
|
33
|
+
color: $colorAccent;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.vuiSearchInput--m {
|
|
38
|
+
.vuiSearchInput__input {
|
|
39
|
+
padding: $sizeXs $sizeM;
|
|
40
|
+
font-size: $fontSizeStandard;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.vuiSearchInput--l {
|
|
45
|
+
.vuiSearchInput__input {
|
|
46
|
+
padding: $sizeS $sizeM;
|
|
47
|
+
font-size: $fontSizeLarge;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
position: number;
|
|
14
|
+
isSelected?: boolean;
|
|
15
|
+
subTitle?: React.ReactNode;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
snippetProps?: any;
|
|
19
|
+
};
|
|
20
|
+
export declare const VuiSearchResult: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement | null>>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { forwardRef } from "react";
|
|
14
|
+
import classNames from "classnames";
|
|
15
|
+
import { VuiTitle } from "../typography/Title";
|
|
16
|
+
import { VuiLink } from "../link/Link";
|
|
17
|
+
import { VuiSpacer } from "../spacer/Spacer";
|
|
18
|
+
import { VuiText } from "../typography/Text";
|
|
19
|
+
import { VuiTextColor } from "../typography/TextColor";
|
|
20
|
+
const highlightUrl = (url, text) => `${url}#:~:text=${text}`;
|
|
21
|
+
export const VuiSearchResult = forwardRef((_a, ref) => {
|
|
22
|
+
var { result, position, isSelected, subTitle, children, className, snippetProps } = _a, rest = __rest(_a, ["result", "position", "isSelected", "subTitle", "children", "className", "snippetProps"]);
|
|
23
|
+
const { title, url, date, snippet: { pre, post, text } } = result;
|
|
24
|
+
// Protect users' privacy in FullStory.
|
|
25
|
+
// https://help.fullstory.com/hc/en-us/articles/360020623574-How-do-I-protect-my-users-privacy-in-FullStory-#01F5DPW1AJHZHR8TBM9YQEDRMH
|
|
26
|
+
const classes = classNames("vuiSearchResult", "fs-mask", className);
|
|
27
|
+
const positionClasses = classNames("vuiSearchResultPosition", {
|
|
28
|
+
"vuiSearchResultPosition--selected": isSelected
|
|
29
|
+
});
|
|
30
|
+
const hasTitle = title && title.trim().length > 0;
|
|
31
|
+
const hasUrl = url && url.trim().length > 0;
|
|
32
|
+
return (_jsxs("div", Object.assign({ className: classes, ref: ref }, rest, { children: [_jsx("div", Object.assign({ "data-testid": `searchResultCitation-${position}`, className: positionClasses }, { children: position })), (hasTitle || hasUrl) && (_jsx(VuiTitle, Object.assign({ size: "s" }, { children: hasUrl ? (_jsx(VuiLink, Object.assign({ href: highlightUrl(url, text), target: "_blank" }, { children: _jsx("h3", { children: hasTitle ? title : url }) }))) : (_jsx("h3", { children: title })) }))), subTitle && (_jsxs(_Fragment, { children: [title && _jsx(VuiSpacer, { size: "xs" }), subTitle] })), _jsx(VuiText, Object.assign({}, snippetProps, { size: "s" }, { children: _jsxs("p", { children: [date && _jsxs(VuiTextColor, Object.assign({ color: "subdued" }, { children: [date, " \u2014 "] })), pre, " ", _jsx("strong", { children: text }), " ", post] }) })), children && (_jsxs(_Fragment, { children: [_jsx(VuiSpacer, { size: "s" }), children] }))] })));
|
|
33
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MemoryRouter } from "react-router-dom";
|
|
3
|
+
import "@testing-library/jest-dom";
|
|
4
|
+
import { VuiSearchResult } from "./SearchResult";
|
|
5
|
+
import { renderWithContext } from "../context/Context.test.util";
|
|
6
|
+
describe("VuiSearchResult", () => {
|
|
7
|
+
describe("renders", () => {
|
|
8
|
+
test("all props", () => {
|
|
9
|
+
const { asFragment } = renderWithContext(_jsx(VuiSearchResult, Object.assign({ result: {
|
|
10
|
+
title: "title",
|
|
11
|
+
url: "url",
|
|
12
|
+
date: "date",
|
|
13
|
+
snippet: { pre: "pre", text: "text", post: "" }
|
|
14
|
+
}, position: 1, subTitle: _jsx("div", { children: "subTitle" }), className: "customClass", snippetProps: {
|
|
15
|
+
className: "snippetCustomClass"
|
|
16
|
+
} }, { children: _jsx("div", { children: "children" }) })), { wrapper: MemoryRouter });
|
|
17
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
18
|
+
<DocumentFragment>
|
|
19
|
+
<div
|
|
20
|
+
class="vuiSearchResult fs-mask customClass"
|
|
21
|
+
>
|
|
22
|
+
<div
|
|
23
|
+
class="vuiSearchResultPosition"
|
|
24
|
+
data-testid="searchResultCitation-1"
|
|
25
|
+
>
|
|
26
|
+
1
|
|
27
|
+
</div>
|
|
28
|
+
<a
|
|
29
|
+
class="vuiLink vuiTitle vuiTitle--s"
|
|
30
|
+
href="/url#:~:text=text"
|
|
31
|
+
rel="noopener"
|
|
32
|
+
target="_blank"
|
|
33
|
+
>
|
|
34
|
+
<h3>
|
|
35
|
+
title
|
|
36
|
+
</h3>
|
|
37
|
+
</a>
|
|
38
|
+
<div
|
|
39
|
+
class="vuiSpacer vuiSpacer--xs"
|
|
40
|
+
/>
|
|
41
|
+
<div>
|
|
42
|
+
subTitle
|
|
43
|
+
</div>
|
|
44
|
+
<div
|
|
45
|
+
class="vuiText vuiText--s snippetCustomClass"
|
|
46
|
+
>
|
|
47
|
+
<p>
|
|
48
|
+
<span
|
|
49
|
+
class="vuiTextColor vuiTextColor--subdued"
|
|
50
|
+
>
|
|
51
|
+
date —
|
|
52
|
+
</span>
|
|
53
|
+
pre
|
|
54
|
+
<strong>
|
|
55
|
+
text
|
|
56
|
+
</strong>
|
|
57
|
+
|
|
58
|
+
</p>
|
|
59
|
+
</div>
|
|
60
|
+
<div
|
|
61
|
+
class="vuiSpacer vuiSpacer--s"
|
|
62
|
+
/>
|
|
63
|
+
<div>
|
|
64
|
+
children
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</DocumentFragment>
|
|
68
|
+
`);
|
|
69
|
+
});
|
|
70
|
+
test("missing optional props", () => {
|
|
71
|
+
const { asFragment } = renderWithContext(_jsx(VuiSearchResult, Object.assign({ result: { snippet: { pre: "pre", text: "text", post: "" } }, position: 1 }, { children: _jsx("div", { children: "children" }) })), { wrapper: MemoryRouter });
|
|
72
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
73
|
+
<DocumentFragment>
|
|
74
|
+
<div
|
|
75
|
+
class="vuiSearchResult fs-mask"
|
|
76
|
+
>
|
|
77
|
+
<div
|
|
78
|
+
class="vuiSearchResultPosition"
|
|
79
|
+
data-testid="searchResultCitation-1"
|
|
80
|
+
>
|
|
81
|
+
1
|
|
82
|
+
</div>
|
|
83
|
+
<div
|
|
84
|
+
class="vuiText vuiText--s"
|
|
85
|
+
>
|
|
86
|
+
<p>
|
|
87
|
+
pre
|
|
88
|
+
<strong>
|
|
89
|
+
text
|
|
90
|
+
</strong>
|
|
91
|
+
|
|
92
|
+
</p>
|
|
93
|
+
</div>
|
|
94
|
+
<div
|
|
95
|
+
class="vuiSpacer vuiSpacer--s"
|
|
96
|
+
/>
|
|
97
|
+
<div>
|
|
98
|
+
children
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</DocumentFragment>
|
|
102
|
+
`);
|
|
103
|
+
});
|
|
104
|
+
test("has title but missing url", () => {
|
|
105
|
+
const { asFragment } = renderWithContext(_jsx(VuiSearchResult, Object.assign({ result: {
|
|
106
|
+
title: "title",
|
|
107
|
+
snippet: { pre: "pre", text: "text", post: "" }
|
|
108
|
+
}, position: 1 }, { children: _jsx("div", { children: "children" }) })), { wrapper: MemoryRouter });
|
|
109
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
110
|
+
<DocumentFragment>
|
|
111
|
+
<div
|
|
112
|
+
class="vuiSearchResult fs-mask"
|
|
113
|
+
>
|
|
114
|
+
<div
|
|
115
|
+
class="vuiSearchResultPosition"
|
|
116
|
+
data-testid="searchResultCitation-1"
|
|
117
|
+
>
|
|
118
|
+
1
|
|
119
|
+
</div>
|
|
120
|
+
<h3
|
|
121
|
+
class="vuiTitle vuiTitle--s"
|
|
122
|
+
>
|
|
123
|
+
title
|
|
124
|
+
</h3>
|
|
125
|
+
<div
|
|
126
|
+
class="vuiText vuiText--s"
|
|
127
|
+
>
|
|
128
|
+
<p>
|
|
129
|
+
pre
|
|
130
|
+
<strong>
|
|
131
|
+
text
|
|
132
|
+
</strong>
|
|
133
|
+
|
|
134
|
+
</p>
|
|
135
|
+
</div>
|
|
136
|
+
<div
|
|
137
|
+
class="vuiSpacer vuiSpacer--s"
|
|
138
|
+
/>
|
|
139
|
+
<div>
|
|
140
|
+
children
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</DocumentFragment>
|
|
144
|
+
`);
|
|
145
|
+
});
|
|
146
|
+
test("missing title but has url", () => {
|
|
147
|
+
const { asFragment } = renderWithContext(_jsx(VuiSearchResult, Object.assign({ result: {
|
|
148
|
+
url: "url",
|
|
149
|
+
snippet: { pre: "pre", text: "text", post: "" }
|
|
150
|
+
}, position: 1 }, { children: _jsx("div", { children: "children" }) })), { wrapper: MemoryRouter });
|
|
151
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
152
|
+
<DocumentFragment>
|
|
153
|
+
<div
|
|
154
|
+
class="vuiSearchResult fs-mask"
|
|
155
|
+
>
|
|
156
|
+
<div
|
|
157
|
+
class="vuiSearchResultPosition"
|
|
158
|
+
data-testid="searchResultCitation-1"
|
|
159
|
+
>
|
|
160
|
+
1
|
|
161
|
+
</div>
|
|
162
|
+
<a
|
|
163
|
+
class="vuiLink vuiTitle vuiTitle--s"
|
|
164
|
+
href="/url#:~:text=text"
|
|
165
|
+
rel="noopener"
|
|
166
|
+
target="_blank"
|
|
167
|
+
>
|
|
168
|
+
<h3>
|
|
169
|
+
url
|
|
170
|
+
</h3>
|
|
171
|
+
</a>
|
|
172
|
+
<div
|
|
173
|
+
class="vuiText vuiText--s"
|
|
174
|
+
>
|
|
175
|
+
<p>
|
|
176
|
+
pre
|
|
177
|
+
<strong>
|
|
178
|
+
text
|
|
179
|
+
</strong>
|
|
180
|
+
|
|
181
|
+
</p>
|
|
182
|
+
</div>
|
|
183
|
+
<div
|
|
184
|
+
class="vuiSpacer vuiSpacer--s"
|
|
185
|
+
/>
|
|
186
|
+
<div>
|
|
187
|
+
children
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</DocumentFragment>
|
|
191
|
+
`);
|
|
192
|
+
});
|
|
193
|
+
test("has empty title but has url", () => {
|
|
194
|
+
const { asFragment } = renderWithContext(_jsx(VuiSearchResult, Object.assign({ result: {
|
|
195
|
+
title: " ",
|
|
196
|
+
url: "url",
|
|
197
|
+
snippet: { pre: "pre", text: "text", post: "" }
|
|
198
|
+
}, position: 1 }, { children: _jsx("div", { children: "children" }) })), { wrapper: MemoryRouter });
|
|
199
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
200
|
+
<DocumentFragment>
|
|
201
|
+
<div
|
|
202
|
+
class="vuiSearchResult fs-mask"
|
|
203
|
+
>
|
|
204
|
+
<div
|
|
205
|
+
class="vuiSearchResultPosition"
|
|
206
|
+
data-testid="searchResultCitation-1"
|
|
207
|
+
>
|
|
208
|
+
1
|
|
209
|
+
</div>
|
|
210
|
+
<a
|
|
211
|
+
class="vuiLink vuiTitle vuiTitle--s"
|
|
212
|
+
href="/url#:~:text=text"
|
|
213
|
+
rel="noopener"
|
|
214
|
+
target="_blank"
|
|
215
|
+
>
|
|
216
|
+
<h3>
|
|
217
|
+
url
|
|
218
|
+
</h3>
|
|
219
|
+
</a>
|
|
220
|
+
<div
|
|
221
|
+
class="vuiText vuiText--s"
|
|
222
|
+
>
|
|
223
|
+
<p>
|
|
224
|
+
pre
|
|
225
|
+
<strong>
|
|
226
|
+
text
|
|
227
|
+
</strong>
|
|
228
|
+
|
|
229
|
+
</p>
|
|
230
|
+
</div>
|
|
231
|
+
<div
|
|
232
|
+
class="vuiSpacer vuiSpacer--s"
|
|
233
|
+
/>
|
|
234
|
+
<div>
|
|
235
|
+
children
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
</DocumentFragment>
|
|
239
|
+
`);
|
|
240
|
+
});
|
|
241
|
+
test("has empty title and empty url", () => {
|
|
242
|
+
const { asFragment } = renderWithContext(_jsx(VuiSearchResult, Object.assign({ result: {
|
|
243
|
+
title: " ",
|
|
244
|
+
url: " ",
|
|
245
|
+
snippet: { pre: "pre", text: "text", post: "" }
|
|
246
|
+
}, position: 1 }, { children: _jsx("div", { children: "children" }) })), { wrapper: MemoryRouter });
|
|
247
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
248
|
+
<DocumentFragment>
|
|
249
|
+
<div
|
|
250
|
+
class="vuiSearchResult fs-mask"
|
|
251
|
+
>
|
|
252
|
+
<div
|
|
253
|
+
class="vuiSearchResultPosition"
|
|
254
|
+
data-testid="searchResultCitation-1"
|
|
255
|
+
>
|
|
256
|
+
1
|
|
257
|
+
</div>
|
|
258
|
+
<div
|
|
259
|
+
class="vuiText vuiText--s"
|
|
260
|
+
>
|
|
261
|
+
<p>
|
|
262
|
+
pre
|
|
263
|
+
<strong>
|
|
264
|
+
text
|
|
265
|
+
</strong>
|
|
266
|
+
|
|
267
|
+
</p>
|
|
268
|
+
</div>
|
|
269
|
+
<div
|
|
270
|
+
class="vuiSpacer vuiSpacer--s"
|
|
271
|
+
/>
|
|
272
|
+
<div>
|
|
273
|
+
children
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
</DocumentFragment>
|
|
277
|
+
`);
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.vuiSearchResult {
|
|
2
|
+
position: relative;
|
|
3
|
+
|
|
4
|
+
& + & {
|
|
5
|
+
margin-top: $sizeL;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.vuiSearchResultPosition {
|
|
10
|
+
position: absolute;
|
|
11
|
+
left: -42px;
|
|
12
|
+
top: 0;
|
|
13
|
+
font-weight: 600;
|
|
14
|
+
padding: $sizeXs;
|
|
15
|
+
color: $colorSubdued;
|
|
16
|
+
padding: 4px 8px;
|
|
17
|
+
width: 30px;
|
|
18
|
+
text-align: center;
|
|
19
|
+
font-size: 12px;
|
|
20
|
+
border-radius: $sizeXs;
|
|
21
|
+
height: 23px;
|
|
22
|
+
transition: all $transitionSpeed;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.vuiSearchResultPosition--selected {
|
|
26
|
+
background-color: $colorPrimary;
|
|
27
|
+
color: $colorEmptyShade;
|
|
28
|
+
height: 100%;
|
|
29
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Props as OptionsListProps } from "../optionsList/OptionsList";
|
|
2
|
+
import { Props as PopoverProps } from "../popover/Popover";
|
|
3
|
+
type Props<T> = Pick<PopoverProps, "isOpen" | "setIsOpen"> & Pick<OptionsListProps<T>, "options"> & {
|
|
4
|
+
children: PopoverProps["button"];
|
|
5
|
+
title?: string;
|
|
6
|
+
selected: T[];
|
|
7
|
+
onSelect: (selected: T[]) => void;
|
|
8
|
+
isMultiSelect?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const VuiSearchSelect: <T extends unknown = unknown>({ children, title, isOpen, setIsOpen, options, onSelect, isMultiSelect, selected }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|