@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,26 @@
|
|
|
1
|
+
name: Deploy to GitHub Pages
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: write
|
|
8
|
+
jobs:
|
|
9
|
+
build-and-deploy:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- name: Checkout 🛎️
|
|
13
|
+
uses: actions/checkout@v3
|
|
14
|
+
|
|
15
|
+
- name: Build Docs Site
|
|
16
|
+
env:
|
|
17
|
+
CI: false
|
|
18
|
+
run: |
|
|
19
|
+
npm i
|
|
20
|
+
npm run buildDocs
|
|
21
|
+
|
|
22
|
+
- name: Deploy 🚀
|
|
23
|
+
uses: JamesIves/github-pages-deploy-action@v4
|
|
24
|
+
with:
|
|
25
|
+
folder: ./docs/public
|
|
26
|
+
clean-exclude: pr-preview/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# .github/workflows/preview.yml
|
|
2
|
+
name: Deploy PR preview
|
|
3
|
+
concurrency: preview-${{ github.ref }}
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
types:
|
|
7
|
+
- opened
|
|
8
|
+
- reopened
|
|
9
|
+
- synchronize
|
|
10
|
+
- closed
|
|
11
|
+
jobs:
|
|
12
|
+
deploy-preview:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v3
|
|
16
|
+
- run: npm i && npm run buildDocs
|
|
17
|
+
env:
|
|
18
|
+
CI: false
|
|
19
|
+
if: github.event.action != 'closed'
|
|
20
|
+
- uses: rossjrw/pr-preview-action@v1
|
|
21
|
+
with:
|
|
22
|
+
source-dir: ./docs/public
|
|
23
|
+
preview-branch: gh-pages
|
|
24
|
+
umbrella-dir: pr-preview
|
|
25
|
+
action: auto
|
package/CHANGELOG.md
ADDED
package/NO_LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
header: React.ReactNode;
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const VuiAccordion: ({ header, children, isOpen, setIsOpen, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import classNames from "classnames";
|
|
14
|
+
import { BiChevronDown, BiChevronRight } from "react-icons/bi";
|
|
15
|
+
import { VuiFlexContainer } from "../flex/FlexContainer";
|
|
16
|
+
import { VuiFlexItem } from "../flex/FlexItem";
|
|
17
|
+
import { VuiIcon } from "../icon/Icon";
|
|
18
|
+
import { createId } from "../../utils/createId";
|
|
19
|
+
export const VuiAccordion = (_a) => {
|
|
20
|
+
var { header, children, isOpen, setIsOpen } = _a, rest = __rest(_a, ["header", "children", "isOpen", "setIsOpen"]);
|
|
21
|
+
const buttonId = createId();
|
|
22
|
+
const contentId = createId();
|
|
23
|
+
const classes = classNames("vuiAccordionHeader", {
|
|
24
|
+
"vuiAccordionHeader--isOpen": isOpen
|
|
25
|
+
});
|
|
26
|
+
return (_jsxs(_Fragment, { children: [_jsx("button", Object.assign({ className: classes, onClick: () => setIsOpen(!isOpen), id: buttonId, "aria-controls": contentId, "aria-expanded": isOpen }, rest, { children: _jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", justifyContent: "start", spacing: "xxs" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: _jsx(VuiIcon, Object.assign({ size: "m", color: "neutral" }, { children: isOpen ? _jsx(BiChevronDown, {}) : _jsx(BiChevronRight, {}) })) })), _jsx(VuiFlexItem, Object.assign({ className: "vuiAccordionHeader__title", grow: 1 }, { children: header }))] })) })), isOpen && (_jsx("div", Object.assign({ id: contentId, "aria-labelledby": buttonId }, { children: children })))] }));
|
|
27
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.vuiAccordionHeader {
|
|
2
|
+
font-size: $fontSizeStandard;
|
|
3
|
+
border-bottom: 1px solid $borderColorLight;
|
|
4
|
+
width: 100%;
|
|
5
|
+
padding: $sizeXs 0;
|
|
6
|
+
color: $colorSubdued;
|
|
7
|
+
|
|
8
|
+
&:hover {
|
|
9
|
+
color: $colorPrimary;
|
|
10
|
+
background-color: $colorPrimaryLighterShade;
|
|
11
|
+
text-decoration: underline;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.vuiAccordionHeader--isOpen {
|
|
16
|
+
color: $colorText;
|
|
17
|
+
border-bottom-color: $borderColor;
|
|
18
|
+
font-weight: $fontWeightBold;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.vuiAccordionHeader__title {
|
|
22
|
+
text-align: left;
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type AccountMenuInfo = Array<{
|
|
2
|
+
title: string;
|
|
3
|
+
value: React.ReactNode;
|
|
4
|
+
}>;
|
|
5
|
+
type Props = {
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
8
|
+
button: React.ReactElement;
|
|
9
|
+
info?: AccountMenuInfo;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export declare const VuiAccountMenu: ({ isOpen, setIsOpen, button, info, children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { VuiPopover } from "../popover/Popover";
|
|
3
|
+
import { VuiSpacer } from "../spacer/Spacer";
|
|
4
|
+
export const VuiAccountMenu = ({ isOpen, setIsOpen, button, info, children }) => {
|
|
5
|
+
return (_jsx(VuiPopover, Object.assign({ className: "vuiAccountMenu", isOpen: isOpen, setIsOpen: () => setIsOpen(!isOpen), button: button, header: info &&
|
|
6
|
+
info.length > 0 && (_jsx("div", Object.assign({ className: "vuiAccounrMenuHeader" }, { children: info.map((item, index) => (_jsxs("div", Object.assign({ className: "vuiAccountMenuHeaderItem" }, { children: [_jsx("div", Object.assign({ className: "vuiAccountMenuHeaderItem__title" }, { children: item.title })), _jsx("div", Object.assign({ className: "vuiAccountMenuHeaderItem__value" }, { children: item.value })), index < info.length - 1 && _jsx(VuiSpacer, { size: "m" })] }), index))) }))) }, { children: children })));
|
|
7
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.vuiAccountMenu {
|
|
2
|
+
min-width: 260px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.vuiAccounrMenuHeader {
|
|
6
|
+
padding: $sizeM;
|
|
7
|
+
border-bottom: 1px solid $borderColor;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.vuiAccountMenuHeaderItem__title {
|
|
11
|
+
font-size: $fontSizeSmall;
|
|
12
|
+
font-weight: $fontWeightBold;
|
|
13
|
+
color: $colorDarkerShade;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.vuiAccountMenuHeaderItem__value {
|
|
17
|
+
font-size: $fontSizeStandard;
|
|
18
|
+
color: $colorDarkerShade;
|
|
19
|
+
margin-top: $sizeXxs;
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppContentPadding } from "./types";
|
|
2
|
+
type Props = {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
fullWidth?: boolean;
|
|
6
|
+
padding?: AppContentPadding;
|
|
7
|
+
};
|
|
8
|
+
export declare const VuiAppContent: ({ children, className, fullWidth, padding, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
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 paddingToClassNameMap = {
|
|
15
|
+
none: "vuiAppContent--paddingNone",
|
|
16
|
+
xs: "vuiAppContent--paddingXs",
|
|
17
|
+
s: "vuiAppContent--paddingS",
|
|
18
|
+
m: "vuiAppContent--paddingM",
|
|
19
|
+
l: "vuiAppContent--paddingL",
|
|
20
|
+
xl: "vuiAppContent--paddingXl"
|
|
21
|
+
};
|
|
22
|
+
export const VuiAppContent = (_a) => {
|
|
23
|
+
var { children, className, fullWidth, padding = "none" } = _a, rest = __rest(_a, ["children", "className", "fullWidth", "padding"]);
|
|
24
|
+
const classes = classNames("vuiAppContent", paddingToClassNameMap[padding], {
|
|
25
|
+
"vuiAppContent--fullWidth": fullWidth
|
|
26
|
+
}, className);
|
|
27
|
+
return (_jsx("div", Object.assign({ className: classes }, rest, { children: children })));
|
|
28
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { VuiFlexContainer } from "../flex/FlexContainer";
|
|
14
|
+
import { VuiFlexItem } from "../flex/FlexItem";
|
|
15
|
+
export const VuiAppHeader = (_a) => {
|
|
16
|
+
var { left, right, growRight } = _a, rest = __rest(_a, ["left", "right", "growRight"]);
|
|
17
|
+
return (_jsx("div", Object.assign({ className: "vuiAppHeader" }, rest, { children: _jsxs(VuiFlexContainer, Object.assign({ className: "vuiAppHeader__inner", justifyContent: "spaceBetween", alignItems: "center" }, { children: [Boolean(left) && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: left }))), Boolean(right) && (_jsx(VuiFlexItem, Object.assign({ grow: growRight ? 1 : false, shrink: false }, { children: right })))] })) })));
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Props as VuiAppSideNavProps } from "./appSideNav/AppSideNav";
|
|
2
|
+
type Props = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
navItems?: VuiAppSideNavProps["items"];
|
|
5
|
+
navContent?: React.ReactNode;
|
|
6
|
+
full?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const VuiAppLayout: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { VuiAppSideNav } from "./appSideNav/AppSideNav";
|
|
5
|
+
export const VuiAppLayout = forwardRef(({ children, navItems, navContent, full }, ref) => {
|
|
6
|
+
const classes = classNames("vuiAppLayout", {
|
|
7
|
+
"vuiAppLayout--full": full
|
|
8
|
+
});
|
|
9
|
+
return (_jsxs("div", Object.assign({ className: classes }, { children: [(navItems || navContent) && (_jsx("div", Object.assign({ className: "vuiAppLayout__sideNav" }, { children: _jsx(VuiAppSideNav, { items: navItems, content: navContent }) }))), _jsx("div", Object.assign({ className: "vuiAppLayout__content", ref: ref }, { children: children }))] })));
|
|
10
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@use "sass:map";
|
|
2
|
+
|
|
3
|
+
.vuiAppContent {
|
|
4
|
+
width: 100%;
|
|
5
|
+
max-width: 1200px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.vuiAppContent--fullWidth {
|
|
9
|
+
max-width: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Padding
|
|
13
|
+
$padding: (
|
|
14
|
+
None: 0,
|
|
15
|
+
Xs: $sizeXs $sizeXs * 1.25,
|
|
16
|
+
S: $sizeS $sizeS * 1.25,
|
|
17
|
+
M: $sizeM $sizeM * 1.25,
|
|
18
|
+
L: $sizeL $sizeL * 1.25,
|
|
19
|
+
Xl: $sizeXl $sizeXl * 1.25
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
@each $paddingName, $paddingValue in $padding {
|
|
23
|
+
.vuiAppContent--padding#{$paddingName} {
|
|
24
|
+
padding: #{$paddingValue};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.vuiAppHeader {
|
|
2
|
+
position: fixed;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
width: 100vw;
|
|
6
|
+
height: $appHeaderHeight;
|
|
7
|
+
background-color: $colorEmptyShade;
|
|
8
|
+
padding: $sizeXs $sizeM;
|
|
9
|
+
z-index: $appHeaderZIndex;
|
|
10
|
+
border-bottom: 1px solid $borderColor;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.vuiAppHeader__inner {
|
|
14
|
+
flex-grow: 1;
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.vuiAppLayout {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
padding-top: $appHeaderHeight;
|
|
5
|
+
height: 100vh;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.vuiAppLayout--full {
|
|
9
|
+
padding-top: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.vuiAppLayout__sideNav {
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
overflow-y: auto;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.vuiAppLayout__content {
|
|
18
|
+
flex-grow: 1;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: center;
|
|
22
|
+
overflow-y: auto;
|
|
23
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Sections, Tree } from "../types";
|
|
2
|
+
export declare const buildSideNavItems: (items: Sections | Tree) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export type Props = {
|
|
4
|
+
items?: Sections | Tree;
|
|
5
|
+
content?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare const VuiAppSideNav: ({ items, content }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { BiChevronLeft, BiChevronRight } from "react-icons/bi";
|
|
5
|
+
import { VuiIconButton } from "../../button/IconButton";
|
|
6
|
+
import { VuiIcon } from "../../icon/Icon";
|
|
7
|
+
import { buildSections } from "./AppSideNavSections";
|
|
8
|
+
import { buildTree } from "./AppSideNavTree";
|
|
9
|
+
import { VuiFlexContainer } from "../../flex/FlexContainer";
|
|
10
|
+
import { VuiFlexItem } from "../../flex/FlexItem";
|
|
11
|
+
export const buildSideNavItems = (items) => {
|
|
12
|
+
return isTree(items) ? buildTree(items) : buildSections(items);
|
|
13
|
+
};
|
|
14
|
+
// Type guard to determine if we have a Tree or Sections.
|
|
15
|
+
const isTree = (items) => {
|
|
16
|
+
return items.findIndex((item) => item.path) !== -1;
|
|
17
|
+
};
|
|
18
|
+
export const VuiAppSideNav = ({ items = [], content }) => {
|
|
19
|
+
const [isTouched, setIsTouched] = useState(false);
|
|
20
|
+
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
21
|
+
const collapseButtonRef = useRef(null);
|
|
22
|
+
const expandButtonRef = useRef(null);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
// Prevent the button from being focused when it first renders.
|
|
26
|
+
if (isTouched) {
|
|
27
|
+
if (isCollapsed) {
|
|
28
|
+
(_a = expandButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
(_b = collapseButtonRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}, [isTouched, isCollapsed]);
|
|
35
|
+
const classes = classNames("vuiAppSideNav", {
|
|
36
|
+
"vuiAppSideNav-isCollapsed": isCollapsed
|
|
37
|
+
});
|
|
38
|
+
const contentClasses = classNames("vuiAppSideNavContent", {
|
|
39
|
+
"vuiAppSideNavContent-isHidden": isCollapsed
|
|
40
|
+
});
|
|
41
|
+
const navItems = buildSideNavItems(items);
|
|
42
|
+
return (_jsx("div", Object.assign({ className: classes }, { children: _jsxs("div", Object.assign({ className: "vuiAppSideNav__inner" }, { children: [isCollapsed ? (_jsx(VuiIconButton, { ref: expandButtonRef, "aria-label": "Expand nav", onClick: () => setIsCollapsed(false), className: "vuiAppSideNavExpandButton", color: "neutral", icon: _jsx(VuiIcon, { children: _jsx(BiChevronRight, {}) }) })) : (_jsx(_Fragment, { children: _jsx("button", Object.assign({ ref: collapseButtonRef, className: "vuiAppSideNavCollapseButton", onClick: () => {
|
|
43
|
+
setIsTouched(true);
|
|
44
|
+
setIsCollapsed(true);
|
|
45
|
+
} }, { children: _jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xxs" }, { children: [_jsx(VuiFlexItem, Object.assign({ shrink: false, grow: false }, { children: _jsx(VuiIcon, { children: _jsx(BiChevronLeft, {}) }) })), _jsx(VuiFlexItem, Object.assign({ shrink: false, grow: false }, { children: "Collapse nav" }))] })) })) })), _jsxs("div", Object.assign({ className: contentClasses, inert: isCollapsed ? "" : null }, { children: [navItems, content] }))] })) })));
|
|
46
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TreeItem } from "../types";
|
|
2
|
+
type Props = Pick<TreeItem, "name" | "path" | "iconBefore" | "iconAfter" | "isActive" | "className">;
|
|
3
|
+
export declare const VuiAppSideNavLink: ({ path, name, iconBefore, iconAfter, isActive, className, ...rest }: Props) => JSX.Element;
|
|
4
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import classNames from "classnames";
|
|
14
|
+
import { VuiFlexContainer } from "../../flex/FlexContainer";
|
|
15
|
+
import { VuiFlexItem } from "../../flex/FlexItem";
|
|
16
|
+
import { VuiIcon } from "../../icon/Icon";
|
|
17
|
+
import { useVuiContext } from "../../context/Context";
|
|
18
|
+
export const VuiAppSideNavLink = (_a) => {
|
|
19
|
+
var { path, name, iconBefore, iconAfter, isActive, className } = _a, rest = __rest(_a, ["path", "name", "iconBefore", "iconAfter", "isActive", "className"]);
|
|
20
|
+
const { createLink, getPath } = useVuiContext();
|
|
21
|
+
const classes = classNames("vuiAppSideNavLink", {
|
|
22
|
+
"vuiAppSideNavLink--active": isActive !== null && isActive !== void 0 ? isActive : path === getPath()
|
|
23
|
+
}, className);
|
|
24
|
+
const content = iconBefore || iconAfter ? (_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xxs" }, { children: [iconBefore && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: _jsx(VuiIcon, Object.assign({ size: "s" }, { children: iconBefore })) }))), _jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: name })), iconAfter && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: _jsx(VuiIcon, Object.assign({ size: "s" }, { children: iconAfter })) })))] }))) : (name);
|
|
25
|
+
return createLink(Object.assign({ className: classes, children: content, href: path !== null && path !== void 0 ? path : "/" }, rest));
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { VuiAppSideNavLink } from "./AppSideNavLink";
|
|
3
|
+
export const buildSections = (sections) => {
|
|
4
|
+
return (_jsx("div", Object.assign({ className: "vuiAppSideNavSections" }, { children: sections.map(({ name, pages }) => {
|
|
5
|
+
const renderedPages = pages.map(({ name, path }) => (_jsx(VuiAppSideNavLink, { path: path, name: name }, path !== null && path !== void 0 ? path : name)));
|
|
6
|
+
return (_jsx(VuiAppSideNavSection, Object.assign({ name: name }, { children: renderedPages }), name));
|
|
7
|
+
}) })));
|
|
8
|
+
};
|
|
9
|
+
const VuiAppSideNavSection = ({ name, children }) => {
|
|
10
|
+
return (_jsxs("div", Object.assign({ className: "vuiAppSideNavSection" }, { children: [_jsx("div", Object.assign({ className: "vuiAppSideNavSection__title" }, { children: name })), _jsx("div", Object.assign({ className: "vuiAppSideNavSection__items" }, { children: children }))] }), name));
|
|
11
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useState } from "react";
|
|
14
|
+
import { BiChevronDown, BiChevronUp } from "react-icons/bi";
|
|
15
|
+
import { VuiIcon } from "../../icon/Icon";
|
|
16
|
+
import { VuiIconButton } from "../../button/IconButton";
|
|
17
|
+
import { VuiAppSideNavLink } from "./AppSideNavLink";
|
|
18
|
+
export const buildTree = (items) => {
|
|
19
|
+
return _jsx("div", Object.assign({ className: "vuiAppSideNavTree" }, { children: buildTreeItems(items) }));
|
|
20
|
+
};
|
|
21
|
+
const buildTreeItems = (items) => {
|
|
22
|
+
return items.map((_a) => {
|
|
23
|
+
var { name, pages, path, iconBefore, iconAfter, isActive } = _a, rest = __rest(_a, ["name", "pages", "path", "iconBefore", "iconAfter", "isActive"]);
|
|
24
|
+
if (path) {
|
|
25
|
+
if (pages) {
|
|
26
|
+
const childPages = buildTreeItems(pages);
|
|
27
|
+
return (_jsx(AppSideNavTreeSection, Object.assign({ path: path, name: name, iconBefore: iconBefore, iconAfter: iconAfter, isActive: isActive }, rest, { children: childPages }), path !== null && path !== void 0 ? path : name));
|
|
28
|
+
}
|
|
29
|
+
return (_jsx(VuiAppSideNavLink, Object.assign({ path: path, name: name, iconBefore: iconBefore, iconAfter: iconAfter, isActive: isActive }, rest), path !== null && path !== void 0 ? path : name));
|
|
30
|
+
}
|
|
31
|
+
return (_jsx("div", Object.assign({ className: "vuiAppSideNavTreeSection__subTitle" }, rest, { children: name }), name));
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const AppSideNavTreeSection = (_a) => {
|
|
35
|
+
var { name, path, children, iconBefore, iconAfter, isActive } = _a, rest = __rest(_a, ["name", "path", "children", "iconBefore", "iconAfter", "isActive"]);
|
|
36
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
37
|
+
return (_jsxs("div", Object.assign({ className: "vuiAppSideNavTreeSection" }, { children: [_jsx(VuiAppSideNavLink, Object.assign({ path: path !== null && path !== void 0 ? path : "/", name: name, iconBefore: iconBefore, iconAfter: iconAfter, isActive: isActive }, rest)), _jsx(VuiIconButton, { size: "s", className: "vuiAppSideNavTreeToggleButton", onClick: () => setIsOpen(!isOpen), color: "neutral", icon: _jsx(VuiIcon, { children: isOpen ? _jsx(BiChevronUp, {}) : _jsx(BiChevronDown, {}) }) }), isOpen && _jsx("div", Object.assign({ className: "vuiAppSideNavTreeChildren" }, { children: children }))] })));
|
|
38
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
$appSideNavWidth: 240px;
|
|
2
|
+
$appSideNavWidthCollapsed: 60px;
|
|
3
|
+
$appSideNavLinkSpacing: $sizeXxs + 2px;
|
|
4
|
+
|
|
5
|
+
@mixin appSideNavItem {
|
|
6
|
+
display: block;
|
|
7
|
+
color: $colorText;
|
|
8
|
+
font-size: $fontSizeStandard;
|
|
9
|
+
padding: 0 $sizeM;
|
|
10
|
+
margin-left: -$sizeM;
|
|
11
|
+
padding-top: $appSideNavLinkSpacing;
|
|
12
|
+
padding-bottom: $appSideNavLinkSpacing;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@import "./appSideNav";
|
|
16
|
+
@import "./appSideNavSections";
|
|
17
|
+
@import "./appSideNavTree";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.vuiAppSideNav {
|
|
2
|
+
width: $appSideNavWidth;
|
|
3
|
+
overflow-x: hidden;
|
|
4
|
+
transition: all $transitionSpeed;
|
|
5
|
+
line-height: 1;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.vuiAppSideNav__inner {
|
|
9
|
+
// Prevent content from being squished as nav collapses.
|
|
10
|
+
width: $appSideNavWidth;
|
|
11
|
+
padding: 28px 32px 32px 33px;
|
|
12
|
+
margin-bottom: $sizeXxl * 4;
|
|
13
|
+
transition: all $transitionSpeed;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.vuiAppSideNavContent {
|
|
17
|
+
opacity: 1;
|
|
18
|
+
transition: all $transitionSpeed;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.vuiAppSideNavContent-isHidden {
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
opacity: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.vuiAppSideNav-isCollapsed {
|
|
27
|
+
width: $appSideNavWidthCollapsed;
|
|
28
|
+
// Stop scrolling.
|
|
29
|
+
height: 100%;
|
|
30
|
+
overflow-y: hidden;
|
|
31
|
+
|
|
32
|
+
.vuiAppSideNav__inner {
|
|
33
|
+
padding-left: $sizeM;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.vuiAppSideNavCollapseButton {
|
|
38
|
+
display: block;
|
|
39
|
+
color: $colorSubdued;
|
|
40
|
+
font-size: $fontSizeStandard;
|
|
41
|
+
text-decoration: none;
|
|
42
|
+
padding: 0 $sizeM;
|
|
43
|
+
margin-left: -$sizeXxl;
|
|
44
|
+
margin-bottom: $sizeM;
|
|
45
|
+
|
|
46
|
+
&:hover {
|
|
47
|
+
color: $colorPrimary;
|
|
48
|
+
text-decoration: underline;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.vuiAppSideNavExpandButton {
|
|
53
|
+
margin-top: -$sizeXxs;
|
|
54
|
+
// Ensure the content below the expand/collapse button remains
|
|
55
|
+
// at the same vertical position when collapsed and expanded.
|
|
56
|
+
margin-bottom: 6px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.vuiAppSideNavLink {
|
|
60
|
+
@include truncateText;
|
|
61
|
+
@include appSideNavItem;
|
|
62
|
+
text-decoration: none;
|
|
63
|
+
|
|
64
|
+
&:hover {
|
|
65
|
+
background-color: $colorPrimaryLighterShade;
|
|
66
|
+
border-radius: $sizeM;
|
|
67
|
+
color: $colorPrimary;
|
|
68
|
+
text-decoration: underline;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.vuiAppSideNavLink--active {
|
|
73
|
+
font-weight: $fontWeightBold;
|
|
74
|
+
text-decoration: underline;
|
|
75
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.vuiAppSideNavSections {
|
|
2
|
+
margin-top: $sizeL;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.vuiAppSideNavContent-isHidden {
|
|
6
|
+
.vuiAppSideNavSections {
|
|
7
|
+
margin-top: $sizeXs;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.vuiAppSideNavSection + .vuiAppSideNavSection {
|
|
12
|
+
margin-top: $sizeL;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.vuiAppSideNavSection__title {
|
|
16
|
+
color: $colorText;
|
|
17
|
+
font-weight: $fontWeightBold;
|
|
18
|
+
font-size: $fontSizeStandard;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.vuiAppSideNavSection__items {
|
|
22
|
+
margin-top: $sizeS;
|
|
23
|
+
|
|
24
|
+
& > .vuiAppSideNavLink {
|
|
25
|
+
&:first-child {
|
|
26
|
+
margin-top: -$appSideNavLinkSpacing;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:last-child {
|
|
30
|
+
margin-bottom: -$appSideNavLinkSpacing;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.vuiAppSideNavTree {
|
|
2
|
+
margin-top: -$sizeXxs;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.vuiAppSideNavTreeSection {
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.vuiAppSideNavTreeToggleButton {
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: 0;
|
|
12
|
+
right: -30px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.vuiAppSideNavTreeChildren {
|
|
16
|
+
// Sized to match the width of the icons.
|
|
17
|
+
margin-left: 20px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.vuiAppSideNavTreeSection__subTitle {
|
|
21
|
+
@include appSideNavItem;
|
|
22
|
+
font-size: $fontSizeSmall;
|
|
23
|
+
font-weight: $fontWeightBold;
|
|
24
|
+
color: $colorDarkShade;
|
|
25
|
+
}
|