@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,78 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { VuiOptionsList } from "../optionsList/OptionsList";
|
|
4
|
+
import { VuiPopover } from "../popover/Popover";
|
|
5
|
+
import { VuiTextInput } from "../form";
|
|
6
|
+
import { VuiSpacer } from "../spacer/Spacer";
|
|
7
|
+
// https://github.com/typescript-eslint/typescript-eslint/issues/4062
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
9
|
+
export const VuiSearchSelect = ({ children, title, isOpen, setIsOpen, options, onSelect, isMultiSelect = true, selected = [] }) => {
|
|
10
|
+
const [searchValue, setSearchValue] = useState("");
|
|
11
|
+
const [selectedOptions, setSelectedOptions] = useState();
|
|
12
|
+
const [orderedOptions, setOrderedOptions] = useState([]);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
// When the popover is opened, initialize the selected options,
|
|
15
|
+
// and sort the options so the selected ones are on top.
|
|
16
|
+
if (isOpen) {
|
|
17
|
+
const selectedOptionsCopy = selected.concat();
|
|
18
|
+
setSelectedOptions(selectedOptionsCopy);
|
|
19
|
+
const sortedOptions = options.concat().sort((first, second) => {
|
|
20
|
+
const isFirstSelected = selectedOptionsCopy.includes(first.value);
|
|
21
|
+
const isSecondSelected = selectedOptionsCopy.includes(second.value);
|
|
22
|
+
if (isFirstSelected && !isSecondSelected) {
|
|
23
|
+
return -1;
|
|
24
|
+
}
|
|
25
|
+
if (!isFirstSelected && isSecondSelected) {
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
return 0;
|
|
29
|
+
});
|
|
30
|
+
setOrderedOptions(sortedOptions);
|
|
31
|
+
}
|
|
32
|
+
}, [isOpen]);
|
|
33
|
+
const updateOpen = () => {
|
|
34
|
+
if (isOpen) {
|
|
35
|
+
// When the popover is closed, notify the consumer of the
|
|
36
|
+
// selected options.
|
|
37
|
+
onSelect(selectedOptions !== null && selectedOptions !== void 0 ? selectedOptions : []);
|
|
38
|
+
// Signal the popover to be closed. We don't depend on the
|
|
39
|
+
// original isOpen because it will cause a flicker when the
|
|
40
|
+
// options are sorted.
|
|
41
|
+
setSelectedOptions(undefined);
|
|
42
|
+
}
|
|
43
|
+
setIsOpen(!isOpen);
|
|
44
|
+
};
|
|
45
|
+
const onSelectOption = (value) => {
|
|
46
|
+
if (isMultiSelect) {
|
|
47
|
+
setSelectedOptions((prev) => {
|
|
48
|
+
if (!prev)
|
|
49
|
+
return [];
|
|
50
|
+
const updated = prev.concat();
|
|
51
|
+
const index = prev.findIndex((item) => item === value);
|
|
52
|
+
if (index !== -1) {
|
|
53
|
+
updated.splice(index, 1);
|
|
54
|
+
return updated;
|
|
55
|
+
}
|
|
56
|
+
updated.push(value);
|
|
57
|
+
return updated;
|
|
58
|
+
});
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
// If the user can only select one option at a time,
|
|
62
|
+
// close the search select as soon as they make a choice.
|
|
63
|
+
onSelect([value]);
|
|
64
|
+
// Signal the popover to be closed. We don't depend on the
|
|
65
|
+
// original isOpen because it will cause a flicker when the
|
|
66
|
+
// options are sorted.
|
|
67
|
+
setSelectedOptions(undefined);
|
|
68
|
+
setIsOpen(false);
|
|
69
|
+
};
|
|
70
|
+
const visibleOptions = orderedOptions.filter((option) => {
|
|
71
|
+
if (!searchValue.trim())
|
|
72
|
+
return true;
|
|
73
|
+
if (option.label.toLowerCase().includes(searchValue.toLowerCase()))
|
|
74
|
+
return true;
|
|
75
|
+
return false;
|
|
76
|
+
});
|
|
77
|
+
return (_jsxs(VuiPopover, Object.assign({ isOpen: selectedOptions !== undefined, setIsOpen: updateOpen, button: children, header: title }, { children: [_jsxs("div", Object.assign({ className: "vuiSearchSelect__search" }, { children: [_jsx(VuiTextInput, { placeholder: "Search", value: searchValue, onChange: (event) => setSearchValue(event.target.value) }), _jsx(VuiSpacer, { size: "xxs" })] })), _jsx(VuiOptionsList, { isSelectable: true, isScrollable: true, onSelectOption: onSelectOption, selected: selectedOptions, options: visibleOptions })] })));
|
|
78
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.vuiSearchSelectHeader {
|
|
2
|
+
background-color: $colorLightShade;
|
|
3
|
+
padding: $sizeM;
|
|
4
|
+
border-bottom: 1px solid $borderColor;
|
|
5
|
+
font-weight: $fontWeightBold;
|
|
6
|
+
font-size: $fontSizeStandard;
|
|
7
|
+
color: $colorDarkerShade;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.vuiSearchSelect__search {
|
|
11
|
+
padding: $sizeXxs $sizeXs;
|
|
12
|
+
border-bottom: 1px solid $borderColor;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
title: string;
|
|
3
|
+
label: string;
|
|
4
|
+
badge?: string;
|
|
5
|
+
helpUrl?: string;
|
|
6
|
+
description?: React.ReactNode;
|
|
7
|
+
isEnabled?: boolean;
|
|
8
|
+
onToggle?: () => void;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare const VuiSetting: ({ title, label, badge, helpUrl, description, isEnabled, onToggle, children, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import { VuiSpacer } from "../spacer/Spacer";
|
|
14
|
+
import { VuiText } from "../typography/Text";
|
|
15
|
+
import { VuiTextColor } from "../typography/TextColor";
|
|
16
|
+
import { VuiFlexContainer } from "../flex/FlexContainer";
|
|
17
|
+
import { VuiFlexItem } from "../flex/FlexItem";
|
|
18
|
+
import { VuiLinkInternal } from "../link/Link";
|
|
19
|
+
import { VuiBadge } from "../badge/Badge";
|
|
20
|
+
import { VuiToggle } from "../toggle/Toggle";
|
|
21
|
+
export const VuiSetting = (_a) => {
|
|
22
|
+
var { title, label, badge, helpUrl, description, isEnabled, onToggle, children } = _a, rest = __rest(_a, ["title", "label", "badge", "helpUrl", "description", "isEnabled", "onToggle", "children"]);
|
|
23
|
+
return (_jsxs(_Fragment, { 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: [_jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiText, Object.assign({ size: "m" }, { children: _jsx("p", { children: title }) })) })), badge && (_jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiBadge, Object.assign({ color: "neutral" }, { children: badge })) })))] })) })), helpUrl && (_jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiText, Object.assign({ size: "s" }, { children: _jsx("p", { children: _jsx(VuiLinkInternal, Object.assign({ href: helpUrl, target: "_blank" }, { children: "Learn more" })) }) })) })))] })), description && (_jsxs(_Fragment, { children: [_jsx(VuiSpacer, { size: "xxs" }), _jsx(VuiText, { children: _jsx(VuiTextColor, Object.assign({ color: "subdued" }, { children: _jsx("p", { children: description }) })) })] })), _jsx(VuiSpacer, { size: "xs" }), _jsx(VuiToggle, Object.assign({}, rest, { checked: isEnabled, label: label, onChange: onToggle })), isEnabled && children && (_jsxs(_Fragment, { children: [_jsx(VuiSpacer, { size: "s" }), children] }))] }));
|
|
24
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.vuiSpacer {
|
|
2
|
+
flex-shrink: 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
$size: (
|
|
6
|
+
xxxs: $sizeXxxs,
|
|
7
|
+
xxs: $sizeXxs,
|
|
8
|
+
xs: $sizeXs,
|
|
9
|
+
s: $sizeS,
|
|
10
|
+
m: $sizeM,
|
|
11
|
+
l: $sizeL,
|
|
12
|
+
xl: $sizeXl,
|
|
13
|
+
xxl: $sizeXxl
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
@each $sizeName, $sizeValue in $size {
|
|
17
|
+
.vuiSpacer--#{$sizeName} {
|
|
18
|
+
height: $sizeValue;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SPACER_SIZE: readonly ["xxxs", "xxs", "xs", "s", "m", "l", "xl", "xxl"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SPACER_SIZE = ["xxxs", "xxs", "xs", "s", "m", "l", "xl", "xxl"];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
const sizeToClassNameMap = {
|
|
4
|
+
xs: "vuiSpinner--xs",
|
|
5
|
+
s: "vuiSpinner--s",
|
|
6
|
+
m: "vuiSpinner--m",
|
|
7
|
+
l: "vuiSpinner--l",
|
|
8
|
+
xl: "vuiSpinner--xl",
|
|
9
|
+
xxl: "vuiSpinner--xxl",
|
|
10
|
+
xxxl: "vuiSpinner--xxxl"
|
|
11
|
+
};
|
|
12
|
+
export const VuiSpinner = ({ color = "accent", size = "m" }) => {
|
|
13
|
+
const classes = classNames("vuiSpinner", sizeToClassNameMap[size], `vuiSpinner--${color}`);
|
|
14
|
+
return (_jsx("div", Object.assign({ className: classes }, { children: _jsx("svg", Object.assign({ version: "1.1", xmlns: "http://www.w3.org/2000/svg", x: "0px", y: "0px", viewBox: "0 0 50 50" }, { children: _jsx("path", Object.assign({ fill: "#000", d: "M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z" }, { children: _jsx("animateTransform", { attributeType: "xml", attributeName: "transform", type: "rotate", from: "0 25 25", to: "360 25 25", dur: "0.6s", repeatCount: "indefinite" }) })) })) })));
|
|
15
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
@use "sass:map";
|
|
2
|
+
|
|
3
|
+
// Color
|
|
4
|
+
$color: (
|
|
5
|
+
accent: (
|
|
6
|
+
"color": $colorAccent
|
|
7
|
+
),
|
|
8
|
+
primary: (
|
|
9
|
+
"color": $colorPrimary
|
|
10
|
+
),
|
|
11
|
+
success: (
|
|
12
|
+
"color": $colorSuccess
|
|
13
|
+
),
|
|
14
|
+
danger: (
|
|
15
|
+
"color": $colorDanger
|
|
16
|
+
),
|
|
17
|
+
warning: (
|
|
18
|
+
"color": $colorWarning
|
|
19
|
+
),
|
|
20
|
+
empty: (
|
|
21
|
+
"color": $colorEmptyShade
|
|
22
|
+
),
|
|
23
|
+
dark: (
|
|
24
|
+
"color": $colorDarkerShade
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
@each $colorName, $colorValue in $color {
|
|
29
|
+
.vuiSpinner--#{$colorName} {
|
|
30
|
+
svg path,
|
|
31
|
+
svg rect {
|
|
32
|
+
fill: #{map.get($colorValue, "color")};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
$size: (
|
|
38
|
+
xs: $sizeXs * 1.75,
|
|
39
|
+
s: $sizeS * 1.325,
|
|
40
|
+
m: $sizeM * 1.255,
|
|
41
|
+
l: $sizeL * 2,
|
|
42
|
+
xl: $sizeXl * 2,
|
|
43
|
+
xxl: $sizeXxl * 2,
|
|
44
|
+
xxxl: $sizeXxl * 2.5
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
@each $sizeName, $sizeValue in $size {
|
|
48
|
+
.vuiSpinner--#{$sizeName} {
|
|
49
|
+
width: $sizeValue;
|
|
50
|
+
height: $sizeValue;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { VuiFlexContainer } from "../flex/FlexContainer";
|
|
3
|
+
import { VuiFlexItem } from "../flex/FlexItem";
|
|
4
|
+
import { VuiLink } from "../link/Link";
|
|
5
|
+
import { VuiSpacer } from "../spacer/Spacer";
|
|
6
|
+
import { VuiText } from "../typography/Text";
|
|
7
|
+
const VuiStat = ({ name, value }) => {
|
|
8
|
+
return (_jsx(_Fragment, { children: _jsxs(VuiFlexContainer, Object.assign({ alignItems: "start", spacing: "m" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false, className: "vuiStatName" }, { children: _jsx(VuiText, { children: _jsx("p", { children: _jsx("strong", { children: name }) }) }) })), _jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiText, { children: _jsx("p", { children: value }) }) }))] })) }));
|
|
9
|
+
};
|
|
10
|
+
export const VuiStatList = ({ stats }) => {
|
|
11
|
+
return (_jsx(_Fragment, { children: stats.map(({ name, value }, index) => {
|
|
12
|
+
const renderedValue = name === "url" || (typeof value === "string" && value.indexOf("http") === 0) ? (_jsx(VuiLink, Object.assign({ href: value, target: "_blank" }, { children: value }))) : (value);
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsx(VuiStat, { name: name, value: renderedValue }, `${name}:${value}`), index < stats.length - 1 && _jsx(VuiSpacer, { size: "s" })] }));
|
|
14
|
+
}) }));
|
|
15
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BiCheck, BiError, BiInfoCircle, BiSolidHand } from "react-icons/bi";
|
|
3
|
+
import { VuiFlexContainer } from "../flex/FlexContainer";
|
|
4
|
+
import { VuiFlexItem } from "../flex/FlexItem";
|
|
5
|
+
import { VuiIcon } from "../icon/Icon";
|
|
6
|
+
import { VuiText } from "../typography/Text";
|
|
7
|
+
import { VuiTextColor } from "../typography/TextColor";
|
|
8
|
+
const statusToColor = {
|
|
9
|
+
error: "danger",
|
|
10
|
+
warning: "warning",
|
|
11
|
+
success: "success",
|
|
12
|
+
info: "primary"
|
|
13
|
+
};
|
|
14
|
+
const statusToIcon = {
|
|
15
|
+
error: _jsx(BiError, {}),
|
|
16
|
+
warning: _jsx(BiSolidHand, {}),
|
|
17
|
+
success: _jsx(BiCheck, {}),
|
|
18
|
+
info: _jsx(BiInfoCircle, {})
|
|
19
|
+
};
|
|
20
|
+
export const VuiStatus = ({ status, label }) => {
|
|
21
|
+
const color = statusToColor[status];
|
|
22
|
+
const icon = statusToIcon[status];
|
|
23
|
+
return (_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xs" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiIcon, Object.assign({ color: color }, { children: icon })) })), _jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiText, { children: _jsx("p", { children: _jsx(VuiTextColor, Object.assign({ color: color }, { children: label })) }) }) }))] })));
|
|
24
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import Markdown from "markdown-to-jsx";
|
|
4
|
+
import { extractCitations } from "../../utils/citations/extractCitations";
|
|
5
|
+
import { VuiText } from "../typography/Text";
|
|
6
|
+
const markDownCitations = (summary) => {
|
|
7
|
+
const citations = extractCitations(summary);
|
|
8
|
+
return citations
|
|
9
|
+
.reduce((accum, { text, references }) => {
|
|
10
|
+
if (references) {
|
|
11
|
+
accum.push(text);
|
|
12
|
+
const marginBefore = text ? text[text.length - 1] !== " " : false;
|
|
13
|
+
if (marginBefore) {
|
|
14
|
+
accum.push(" ");
|
|
15
|
+
}
|
|
16
|
+
references.forEach((reference, referenceIndex) => {
|
|
17
|
+
if (referenceIndex > 0) {
|
|
18
|
+
accum.push(" ");
|
|
19
|
+
}
|
|
20
|
+
accum.push(`<SummaryCitation reference={${reference}} />`);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
accum.push(text);
|
|
25
|
+
}
|
|
26
|
+
return accum;
|
|
27
|
+
}, [])
|
|
28
|
+
.join("");
|
|
29
|
+
};
|
|
30
|
+
export const VuiSummary = ({ summary, className, SummaryCitation }) => {
|
|
31
|
+
// Protect users' privacy in FullStory.
|
|
32
|
+
// https://help.fullstory.com/hc/en-us/articles/360020623574-How-do-I-protect-my-users-privacy-in-FullStory-#01F5DPW1AJHZHR8TBM9YQEDRMH
|
|
33
|
+
const classes = classNames("vuiSummary", "fs-mask", className);
|
|
34
|
+
const markdown = markDownCitations(summary);
|
|
35
|
+
return (_jsx("div", Object.assign({ className: classes, dir: "auto" }, { children: _jsx(VuiText, Object.assign({ size: "m" }, { children: _jsx(Markdown, { children: markdown, options: {
|
|
36
|
+
forceBlock: true,
|
|
37
|
+
overrides: {
|
|
38
|
+
SummaryCitation: {
|
|
39
|
+
component: SummaryCitation
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
} }) })) })));
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|