@canonical/react-components 1.2.5 → 1.3.1
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/README.md +2 -2
- package/dist-esm/components/Accordion/Accordion.js +52 -0
- package/dist-esm/components/Accordion/AccordionSection/AccordionSection.js +47 -0
- package/dist-esm/components/Accordion/AccordionSection/index.js +1 -0
- package/dist-esm/components/Accordion/index.js +1 -0
- package/dist-esm/components/ActionButton/ActionButton.js +106 -0
- package/dist-esm/components/ActionButton/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/AppAside/AppAside.js +29 -0
- package/dist-esm/components/ApplicationLayout/AppAside/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/AppMain/AppMain.js +21 -0
- package/dist-esm/components/ApplicationLayout/AppMain/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/AppNavigation/AppNavigation.js +31 -0
- package/dist-esm/components/ApplicationLayout/AppNavigation/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.js +24 -0
- package/dist-esm/components/ApplicationLayout/AppNavigationBar/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/AppStatus/AppStatus.js +21 -0
- package/dist-esm/components/ApplicationLayout/AppStatus/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/Application/Application.js +22 -0
- package/dist-esm/components/ApplicationLayout/Application/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/ApplicationLayout.js +113 -0
- package/dist-esm/components/ApplicationLayout/index.js +7 -0
- package/dist-esm/components/ArticlePagination/ArticlePagination.js +39 -0
- package/dist-esm/components/ArticlePagination/index.js +1 -0
- package/dist-esm/components/Badge/Badge.js +64 -0
- package/dist-esm/components/Badge/index.js +1 -0
- package/dist-esm/components/Button/Button.js +55 -0
- package/dist-esm/components/Button/index.js +1 -0
- package/dist-esm/components/Card/Card.js +45 -0
- package/dist-esm/components/Card/index.js +1 -0
- package/dist-esm/components/CheckboxInput/CheckableInput/CheckableInput.js +35 -0
- package/dist-esm/components/CheckboxInput/CheckableInput/index.js +1 -0
- package/dist-esm/components/CheckboxInput/CheckboxInput.js +24 -0
- package/dist-esm/components/CheckboxInput/index.js +1 -0
- package/dist-esm/components/Chip/Chip.js +81 -0
- package/dist-esm/components/Chip/index.js +1 -0
- package/dist-esm/components/Code/Code.js +49 -0
- package/dist-esm/components/Code/index.js +1 -0
- package/dist-esm/components/CodeSnippet/CodeSnippet.js +28 -0
- package/dist-esm/components/CodeSnippet/CodeSnippetBlock.js +64 -0
- package/dist-esm/components/CodeSnippet/CodeSnippetDropdown.js +27 -0
- package/dist-esm/components/CodeSnippet/index.js +2 -0
- package/dist-esm/components/Col/Col.js +38 -0
- package/dist-esm/components/Col/index.js +1 -0
- package/dist-esm/components/ConfirmationButton/ConfirmationButton.js +63 -0
- package/dist-esm/components/ConfirmationButton/index.js +1 -0
- package/dist-esm/components/ConfirmationModal/ConfirmationModal.js +47 -0
- package/dist-esm/components/ConfirmationModal/index.js +1 -0
- package/dist-esm/components/ContextualMenu/ContextualMenu.js +215 -0
- package/dist-esm/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.js +249 -0
- package/dist-esm/components/ContextualMenu/ContextualMenuDropdown/index.js +1 -0
- package/dist-esm/components/ContextualMenu/index.js +1 -0
- package/dist-esm/components/EmptyState/EmptyState.js +28 -0
- package/dist-esm/components/EmptyState/index.js +1 -0
- package/dist-esm/components/Field/Field.js +126 -0
- package/dist-esm/components/Field/index.js +1 -0
- package/dist-esm/components/Form/Form.js +28 -0
- package/dist-esm/components/Form/index.js +1 -0
- package/dist-esm/components/FormikField/FormikField.js +33 -0
- package/dist-esm/components/FormikField/index.js +1 -0
- package/dist-esm/components/Icon/Icon.js +61 -0
- package/dist-esm/components/Icon/index.js +1 -0
- package/dist-esm/components/Input/Input.js +103 -0
- package/dist-esm/components/Input/index.js +1 -0
- package/dist-esm/components/Label/Label.js +27 -0
- package/dist-esm/components/Label/index.js +1 -0
- package/dist-esm/components/Link/Link.js +37 -0
- package/dist-esm/components/Link/index.js +1 -0
- package/dist-esm/components/List/List.js +110 -0
- package/dist-esm/components/List/index.js +1 -0
- package/dist-esm/components/Loader/Loader.js +14 -0
- package/dist-esm/components/Loader/index.js +1 -0
- package/dist-esm/components/LoginPageLayout/LoginPageLayout.js +63 -0
- package/dist-esm/components/LoginPageLayout/index.js +1 -0
- package/dist-esm/components/MainTable/MainTable.js +211 -0
- package/dist-esm/components/MainTable/index.js +1 -0
- package/dist-esm/components/Modal/Modal.js +135 -0
- package/dist-esm/components/Modal/index.js +1 -0
- package/dist-esm/components/ModularTable/ModularTable.js +166 -0
- package/dist-esm/components/ModularTable/index.js +1 -0
- package/dist-esm/components/MultiSelect/FadeInDown/FadeInDown.js +25 -0
- package/dist-esm/components/MultiSelect/FadeInDown/index.js +1 -0
- package/dist-esm/components/MultiSelect/MultiSelect.js +308 -0
- package/dist-esm/components/MultiSelect/index.js +1 -0
- package/dist-esm/components/Navigation/Navigation.js +215 -0
- package/dist-esm/components/Navigation/NavigationLink/NavigationLink.js +58 -0
- package/dist-esm/components/Navigation/NavigationLink/index.js +1 -0
- package/dist-esm/components/Navigation/NavigationMenu/NavigationMenu.js +57 -0
- package/dist-esm/components/Navigation/NavigationMenu/index.js +1 -0
- package/dist-esm/components/Navigation/index.js +1 -0
- package/dist-esm/components/Navigation/types.js +1 -0
- package/dist-esm/components/Notification/Notification.js +119 -0
- package/dist-esm/components/Notification/index.js +1 -0
- package/dist-esm/components/NotificationProvider/NotificationProvider.js +83 -0
- package/dist-esm/components/NotificationProvider/index.js +2 -0
- package/dist-esm/components/NotificationProvider/messageBuilder.js +31 -0
- package/dist-esm/components/NotificationProvider/types.js +1 -0
- package/dist-esm/components/Pagination/Pagination.js +173 -0
- package/dist-esm/components/Pagination/PaginationButton/PaginationButton.js +31 -0
- package/dist-esm/components/Pagination/PaginationButton/index.js +1 -0
- package/dist-esm/components/Pagination/PaginationItem/PaginationItem.js +20 -0
- package/dist-esm/components/Pagination/PaginationItem/index.js +1 -0
- package/dist-esm/components/Pagination/index.js +1 -0
- package/dist-esm/components/Panel/Panel.js +89 -0
- package/dist-esm/components/Panel/index.js +1 -0
- package/dist-esm/components/PasswordToggle/PasswordToggle.js +90 -0
- package/dist-esm/components/PasswordToggle/index.js +1 -0
- package/dist-esm/components/RadioInput/RadioInput.js +22 -0
- package/dist-esm/components/RadioInput/index.js +1 -0
- package/dist-esm/components/Row/Row.js +22 -0
- package/dist-esm/components/Row/index.js +1 -0
- package/dist-esm/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.js +107 -0
- package/dist-esm/components/SearchAndFilter/FilterPanelSection/index.js +1 -0
- package/dist-esm/components/SearchAndFilter/SearchAndFilter.js +286 -0
- package/dist-esm/components/SearchAndFilter/index.js +1 -0
- package/dist-esm/components/SearchAndFilter/types.js +1 -0
- package/dist-esm/components/SearchAndFilter/utils.js +22 -0
- package/dist-esm/components/SearchBox/SearchBox.js +95 -0
- package/dist-esm/components/SearchBox/index.js +1 -0
- package/dist-esm/components/Select/Select.js +84 -0
- package/dist-esm/components/Select/index.js +1 -0
- package/dist-esm/components/SideNavigation/SideNavigation.js +89 -0
- package/dist-esm/components/SideNavigation/SideNavigationBase/SideNavigationBase.js +31 -0
- package/dist-esm/components/SideNavigation/SideNavigationBase/index.js +1 -0
- package/dist-esm/components/SideNavigation/SideNavigationItem/SideNavigationItem.js +32 -0
- package/dist-esm/components/SideNavigation/SideNavigationItem/index.js +1 -0
- package/dist-esm/components/SideNavigation/SideNavigationLink/SideNavigationLink.js +25 -0
- package/dist-esm/components/SideNavigation/SideNavigationLink/index.js +1 -0
- package/dist-esm/components/SideNavigation/SideNavigationText/SideNavigationText.js +20 -0
- package/dist-esm/components/SideNavigation/SideNavigationText/index.js +1 -0
- package/dist-esm/components/SideNavigation/index.js +4 -0
- package/dist-esm/components/Slider/Slider.js +83 -0
- package/dist-esm/components/Slider/index.js +1 -0
- package/dist-esm/components/Spinner/Spinner.js +36 -0
- package/dist-esm/components/Spinner/index.js +1 -0
- package/dist-esm/components/StatusLabel/StatusLabel.js +36 -0
- package/dist-esm/components/StatusLabel/index.js +1 -0
- package/dist-esm/components/Strip/Strip.js +50 -0
- package/dist-esm/components/Strip/index.js +1 -0
- package/dist-esm/components/SummaryButton/SummaryButton.js +28 -0
- package/dist-esm/components/SummaryButton/index.js +1 -0
- package/dist-esm/components/Switch/Switch.js +28 -0
- package/dist-esm/components/Switch/index.js +1 -0
- package/dist-esm/components/Table/Table.js +23 -0
- package/dist-esm/components/Table/index.js +1 -0
- package/dist-esm/components/TableCell/TableCell.js +26 -0
- package/dist-esm/components/TableCell/index.js +1 -0
- package/dist-esm/components/TableHeader/TableHeader.js +17 -0
- package/dist-esm/components/TableHeader/index.js +1 -0
- package/dist-esm/components/TablePagination/TablePagination.js +104 -0
- package/dist-esm/components/TablePagination/TablePaginationControls/TablePaginationControls.js +120 -0
- package/dist-esm/components/TablePagination/TablePaginationControls/index.js +1 -0
- package/dist-esm/components/TablePagination/index.js +1 -0
- package/dist-esm/components/TablePagination/utils.js +67 -0
- package/dist-esm/components/TableRow/TableRow.js +15 -0
- package/dist-esm/components/TableRow/index.js +1 -0
- package/dist-esm/components/Tabs/Tabs.js +42 -0
- package/dist-esm/components/Tabs/index.js +1 -0
- package/dist-esm/components/Textarea/Textarea.js +115 -0
- package/dist-esm/components/Textarea/index.js +1 -0
- package/dist-esm/components/Tooltip/Tooltip.js +245 -0
- package/dist-esm/components/Tooltip/index.js +1 -0
- package/dist-esm/enums.js +8 -0
- package/dist-esm/hooks/index.js +8 -0
- package/dist-esm/hooks/useId.js +13 -0
- package/dist-esm/hooks/useListener.js +51 -0
- package/dist-esm/hooks/useOnClickOutside.js +38 -0
- package/dist-esm/hooks/useOnEscapePressed.js +25 -0
- package/dist-esm/hooks/usePagination.js +45 -0
- package/dist-esm/hooks/usePrevious.js +16 -0
- package/dist-esm/hooks/useThrottle.js +49 -0
- package/dist-esm/hooks/useWindowFitment.js +109 -0
- package/dist-esm/index.js +69 -0
- package/dist-esm/types/index.js +1 -0
- package/dist-esm/types/react-table-config.d.js +1 -0
- package/dist-esm/utils.js +41 -0
- package/package.json +11 -6
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -18
- package/dist/components/Accordion/Accordion.stories.js +0 -117
- package/dist/components/ActionButton/ActionButton.stories.d.ts +0 -7
- package/dist/components/ActionButton/ActionButton.stories.js +0 -36
- package/dist/components/ApplicationLayout/AppAside/AppAside.stories.d.ts +0 -13
- package/dist/components/ApplicationLayout/AppAside/AppAside.stories.js +0 -116
- package/dist/components/ApplicationLayout/AppMain/AppMain.stories.d.ts +0 -14
- package/dist/components/ApplicationLayout/AppMain/AppMain.stories.js +0 -45
- package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.stories.d.ts +0 -12
- package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.stories.js +0 -104
- package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.stories.d.ts +0 -15
- package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.stories.js +0 -52
- package/dist/components/ApplicationLayout/AppStatus/AppStatus.stories.d.ts +0 -13
- package/dist/components/ApplicationLayout/AppStatus/AppStatus.stories.js +0 -41
- package/dist/components/ApplicationLayout/Application/Application.stories.d.ts +0 -6
- package/dist/components/ApplicationLayout/Application/Application.stories.js +0 -16
- package/dist/components/ApplicationLayout/ApplicationLayout.stories.d.ts +0 -24
- package/dist/components/ApplicationLayout/ApplicationLayout.stories.js +0 -232
- package/dist/components/ArticlePagination/ArticlePagination.stories.d.ts +0 -6
- package/dist/components/ArticlePagination/ArticlePagination.stories.js +0 -22
- package/dist/components/Badge/Badge.stories.d.ts +0 -15
- package/dist/components/Badge/Badge.stories.js +0 -62
- package/dist/components/Button/Button.stories.d.ts +0 -32
- package/dist/components/Button/Button.stories.js +0 -180
- package/dist/components/Card/Card.stories.d.ts +0 -33
- package/dist/components/Card/Card.stories.js +0 -51
- package/dist/components/CheckboxInput/CheckboxInput.stories.d.ts +0 -11
- package/dist/components/CheckboxInput/CheckboxInput.stories.js +0 -84
- package/dist/components/Chip/Chip.stories.d.ts +0 -9
- package/dist/components/Chip/Chip.stories.js +0 -45
- package/dist/components/CodeSnippet/CodeSnippet.stories.d.ts +0 -45
- package/dist/components/CodeSnippet/CodeSnippet.stories.js +0 -279
- package/dist/components/Col/Col.stories.d.ts +0 -11
- package/dist/components/Col/Col.stories.js +0 -154
- package/dist/components/ConfirmationButton/ConfirmationButton.stories.d.ts +0 -9
- package/dist/components/ConfirmationButton/ConfirmationButton.stories.js +0 -108
- package/dist/components/ConfirmationModal/ConfirmationModal.stories.d.ts +0 -18
- package/dist/components/ConfirmationModal/ConfirmationModal.stories.js +0 -135
- package/dist/components/ContextualMenu/ContextualMenu.stories.d.ts +0 -13
- package/dist/components/ContextualMenu/ContextualMenu.stories.js +0 -107
- package/dist/components/EmptyState/EmptyState.stories.d.ts +0 -7
- package/dist/components/EmptyState/EmptyState.stories.js +0 -49
- package/dist/components/Form/Form.stories.d.ts +0 -12
- package/dist/components/Form/Form.stories.js +0 -179
- package/dist/components/FormikField/FormikField.stories.d.ts +0 -8
- package/dist/components/FormikField/FormikField.stories.js +0 -85
- package/dist/components/Icon/Icon.stories.d.ts +0 -16
- package/dist/components/Icon/Icon.stories.js +0 -49
- package/dist/components/Input/Input.stories.d.ts +0 -14
- package/dist/components/Input/Input.stories.js +0 -148
- package/dist/components/Link/Link.stories.d.ts +0 -9
- package/dist/components/Link/Link.stories.js +0 -48
- package/dist/components/List/List.stories.d.ts +0 -15
- package/dist/components/List/List.stories.js +0 -122
- package/dist/components/LoginPageLayout/LoginPageLayout.stories.d.ts +0 -9
- package/dist/components/LoginPageLayout/LoginPageLayout.stories.js +0 -58
- package/dist/components/MainTable/MainTable.stories.d.ts +0 -15
- package/dist/components/MainTable/MainTable.stories.js +0 -553
- package/dist/components/Modal/Modal.stories.d.ts +0 -6
- package/dist/components/Modal/Modal.stories.js +0 -57
- package/dist/components/ModularTable/ModularTable.stories.d.ts +0 -27
- package/dist/components/ModularTable/ModularTable.stories.js +0 -343
- package/dist/components/MultiSelect/MultiSelect.stories.d.ts +0 -8
- package/dist/components/MultiSelect/MultiSelect.stories.js +0 -70
- package/dist/components/Navigation/Navigation.stories.d.ts +0 -43
- package/dist/components/Navigation/Navigation.stories.js +0 -232
- package/dist/components/Notification/Notification.stories.d.ts +0 -45
- package/dist/components/Notification/Notification.stories.js +0 -201
- package/dist/components/Pagination/Pagination.stories.d.ts +0 -14
- package/dist/components/Pagination/Pagination.stories.js +0 -94
- package/dist/components/Panel/Panel.stories.d.ts +0 -17
- package/dist/components/Panel/Panel.stories.js +0 -60
- package/dist/components/PasswordToggle/PasswordToggle.stories.d.ts +0 -12
- package/dist/components/PasswordToggle/PasswordToggle.stories.js +0 -74
- package/dist/components/RadioInput/RadioInput.stories.d.ts +0 -10
- package/dist/components/RadioInput/RadioInput.stories.js +0 -83
- package/dist/components/Row/Row.stories.d.ts +0 -9
- package/dist/components/Row/Row.stories.js +0 -29
- package/dist/components/SearchAndFilter/SearchAndFilter.stories.d.ts +0 -8
- package/dist/components/SearchAndFilter/SearchAndFilter.stories.js +0 -218
- package/dist/components/SearchBox/SearchBox.stories.d.ts +0 -14
- package/dist/components/SearchBox/SearchBox.stories.js +0 -106
- package/dist/components/Select/Select.stories.d.ts +0 -7
- package/dist/components/Select/Select.stories.js +0 -97
- package/dist/components/SideNavigation/SideNavigation.stories.d.ts +0 -14
- package/dist/components/SideNavigation/SideNavigation.stories.js +0 -62
- package/dist/components/SideNavigation/SideNavigationItem/SideNavigationItem.stories.d.ts +0 -22
- package/dist/components/SideNavigation/SideNavigationItem/SideNavigationItem.stories.js +0 -70
- package/dist/components/SideNavigation/SideNavigationLink/SideNavigationLink.stories.d.ts +0 -7
- package/dist/components/SideNavigation/SideNavigationLink/SideNavigationLink.stories.js +0 -32
- package/dist/components/SideNavigation/SideNavigationText/SideNavigationText.stories.d.ts +0 -6
- package/dist/components/SideNavigation/SideNavigationText/SideNavigationText.stories.js +0 -25
- package/dist/components/Slider/Slider.stories.d.ts +0 -10
- package/dist/components/Slider/Slider.stories.js +0 -74
- package/dist/components/Spinner/Spinner.stories.d.ts +0 -8
- package/dist/components/Spinner/Spinner.stories.js +0 -28
- package/dist/components/StatusLabel/StatusLabel.stories.d.ts +0 -10
- package/dist/components/StatusLabel/StatusLabel.stories.js +0 -61
- package/dist/components/Strip/Strip.stories.d.ts +0 -12
- package/dist/components/Strip/Strip.stories.js +0 -130
- package/dist/components/SummaryButton/SummaryButton.stories.d.ts +0 -18
- package/dist/components/SummaryButton/SummaryButton.stories.js +0 -59
- package/dist/components/Switch/Switch.stories.d.ts +0 -7
- package/dist/components/Switch/Switch.stories.js +0 -26
- package/dist/components/TablePagination/TablePagination.stories.d.ts +0 -14
- package/dist/components/TablePagination/TablePagination.stories.js +0 -330
- package/dist/components/Tabs/Tabs.stories.d.ts +0 -11
- package/dist/components/Tabs/Tabs.stories.js +0 -56
- package/dist/components/Textarea/Textarea.stories.d.ts +0 -7
- package/dist/components/Textarea/Textarea.stories.js +0 -62
- package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -12
- package/dist/components/Tooltip/Tooltip.stories.js +0 -71
- /package/{dist → dist-types}/components/Accordion/Accordion.d.ts +0 -0
- /package/{dist → dist-types}/components/Accordion/AccordionSection/AccordionSection.d.ts +0 -0
- /package/{dist → dist-types}/components/Accordion/AccordionSection/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Accordion/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ActionButton/ActionButton.d.ts +0 -0
- /package/{dist → dist-types}/components/ActionButton/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppAside/AppAside.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppAside/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppMain/AppMain.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppMain/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppNavigation/AppNavigation.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppNavigation/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppNavigationBar/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppStatus/AppStatus.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppStatus/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/Application/Application.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/Application/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/ApplicationLayout.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ArticlePagination/ArticlePagination.d.ts +0 -0
- /package/{dist → dist-types}/components/ArticlePagination/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Badge/Badge.d.ts +0 -0
- /package/{dist → dist-types}/components/Badge/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Button/Button.d.ts +0 -0
- /package/{dist → dist-types}/components/Button/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Card/Card.d.ts +0 -0
- /package/{dist → dist-types}/components/Card/index.d.ts +0 -0
- /package/{dist → dist-types}/components/CheckboxInput/CheckableInput/CheckableInput.d.ts +0 -0
- /package/{dist → dist-types}/components/CheckboxInput/CheckableInput/index.d.ts +0 -0
- /package/{dist → dist-types}/components/CheckboxInput/CheckboxInput.d.ts +0 -0
- /package/{dist → dist-types}/components/CheckboxInput/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Chip/Chip.d.ts +0 -0
- /package/{dist → dist-types}/components/Chip/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Code/Code.d.ts +0 -0
- /package/{dist → dist-types}/components/Code/index.d.ts +0 -0
- /package/{dist → dist-types}/components/CodeSnippet/CodeSnippet.d.ts +0 -0
- /package/{dist → dist-types}/components/CodeSnippet/CodeSnippetBlock.d.ts +0 -0
- /package/{dist → dist-types}/components/CodeSnippet/CodeSnippetDropdown.d.ts +0 -0
- /package/{dist → dist-types}/components/CodeSnippet/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Col/Col.d.ts +0 -0
- /package/{dist → dist-types}/components/Col/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ConfirmationButton/ConfirmationButton.d.ts +0 -0
- /package/{dist → dist-types}/components/ConfirmationButton/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ConfirmationModal/ConfirmationModal.d.ts +0 -0
- /package/{dist → dist-types}/components/ConfirmationModal/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ContextualMenu/ContextualMenu.d.ts +0 -0
- /package/{dist → dist-types}/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.d.ts +0 -0
- /package/{dist → dist-types}/components/ContextualMenu/ContextualMenuDropdown/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ContextualMenu/index.d.ts +0 -0
- /package/{dist → dist-types}/components/EmptyState/EmptyState.d.ts +0 -0
- /package/{dist → dist-types}/components/EmptyState/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Field/Field.d.ts +0 -0
- /package/{dist → dist-types}/components/Field/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Form/Form.d.ts +0 -0
- /package/{dist → dist-types}/components/Form/index.d.ts +0 -0
- /package/{dist → dist-types}/components/FormikField/FormikField.d.ts +0 -0
- /package/{dist → dist-types}/components/FormikField/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Icon/Icon.d.ts +0 -0
- /package/{dist → dist-types}/components/Icon/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Input/Input.d.ts +0 -0
- /package/{dist → dist-types}/components/Input/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Label/Label.d.ts +0 -0
- /package/{dist → dist-types}/components/Label/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Link/Link.d.ts +0 -0
- /package/{dist → dist-types}/components/Link/index.d.ts +0 -0
- /package/{dist → dist-types}/components/List/List.d.ts +0 -0
- /package/{dist → dist-types}/components/List/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Loader/Loader.d.ts +0 -0
- /package/{dist → dist-types}/components/Loader/index.d.ts +0 -0
- /package/{dist → dist-types}/components/LoginPageLayout/LoginPageLayout.d.ts +0 -0
- /package/{dist → dist-types}/components/LoginPageLayout/index.d.ts +0 -0
- /package/{dist → dist-types}/components/MainTable/MainTable.d.ts +0 -0
- /package/{dist → dist-types}/components/MainTable/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Modal/Modal.d.ts +0 -0
- /package/{dist → dist-types}/components/Modal/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ModularTable/ModularTable.d.ts +0 -0
- /package/{dist → dist-types}/components/ModularTable/index.d.ts +0 -0
- /package/{dist → dist-types}/components/MultiSelect/FadeInDown/FadeInDown.d.ts +0 -0
- /package/{dist → dist-types}/components/MultiSelect/FadeInDown/index.d.ts +0 -0
- /package/{dist → dist-types}/components/MultiSelect/MultiSelect.d.ts +0 -0
- /package/{dist → dist-types}/components/MultiSelect/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/Navigation.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/NavigationLink/NavigationLink.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/NavigationLink/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/NavigationMenu/NavigationMenu.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/NavigationMenu/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/types.d.ts +0 -0
- /package/{dist → dist-types}/components/Notification/Notification.d.ts +0 -0
- /package/{dist → dist-types}/components/Notification/index.d.ts +0 -0
- /package/{dist → dist-types}/components/NotificationProvider/NotificationProvider.d.ts +0 -0
- /package/{dist → dist-types}/components/NotificationProvider/index.d.ts +0 -0
- /package/{dist → dist-types}/components/NotificationProvider/messageBuilder.d.ts +0 -0
- /package/{dist → dist-types}/components/NotificationProvider/types.d.ts +0 -0
- /package/{dist → dist-types}/components/Pagination/Pagination.d.ts +0 -0
- /package/{dist → dist-types}/components/Pagination/PaginationButton/PaginationButton.d.ts +0 -0
- /package/{dist → dist-types}/components/Pagination/PaginationButton/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Pagination/PaginationItem/PaginationItem.d.ts +0 -0
- /package/{dist → dist-types}/components/Pagination/PaginationItem/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Pagination/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Panel/Panel.d.ts +0 -0
- /package/{dist → dist-types}/components/Panel/index.d.ts +0 -0
- /package/{dist → dist-types}/components/PasswordToggle/PasswordToggle.d.ts +0 -0
- /package/{dist → dist-types}/components/PasswordToggle/index.d.ts +0 -0
- /package/{dist → dist-types}/components/RadioInput/RadioInput.d.ts +0 -0
- /package/{dist → dist-types}/components/RadioInput/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Row/Row.d.ts +0 -0
- /package/{dist → dist-types}/components/Row/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchAndFilter/FilterPanelSection/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchAndFilter/SearchAndFilter.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchAndFilter/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchAndFilter/types.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchAndFilter/utils.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchBox/SearchBox.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchBox/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Select/Select.d.ts +0 -0
- /package/{dist → dist-types}/components/Select/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigation.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationBase/SideNavigationBase.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationBase/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationItem/SideNavigationItem.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationItem/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationLink/SideNavigationLink.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationLink/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationText/SideNavigationText.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationText/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Slider/Slider.d.ts +0 -0
- /package/{dist → dist-types}/components/Slider/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Spinner/Spinner.d.ts +0 -0
- /package/{dist → dist-types}/components/Spinner/index.d.ts +0 -0
- /package/{dist → dist-types}/components/StatusLabel/StatusLabel.d.ts +0 -0
- /package/{dist → dist-types}/components/StatusLabel/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Strip/Strip.d.ts +0 -0
- /package/{dist → dist-types}/components/Strip/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SummaryButton/SummaryButton.d.ts +0 -0
- /package/{dist → dist-types}/components/SummaryButton/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Switch/Switch.d.ts +0 -0
- /package/{dist → dist-types}/components/Switch/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Table/Table.d.ts +0 -0
- /package/{dist → dist-types}/components/Table/index.d.ts +0 -0
- /package/{dist → dist-types}/components/TableCell/TableCell.d.ts +0 -0
- /package/{dist → dist-types}/components/TableCell/index.d.ts +0 -0
- /package/{dist → dist-types}/components/TableHeader/TableHeader.d.ts +0 -0
- /package/{dist → dist-types}/components/TableHeader/index.d.ts +0 -0
- /package/{dist → dist-types}/components/TablePagination/TablePagination.d.ts +0 -0
- /package/{dist → dist-types}/components/TablePagination/TablePaginationControls/TablePaginationControls.d.ts +0 -0
- /package/{dist → dist-types}/components/TablePagination/TablePaginationControls/index.d.ts +0 -0
- /package/{dist → dist-types}/components/TablePagination/index.d.ts +0 -0
- /package/{dist → dist-types}/components/TablePagination/utils.d.ts +0 -0
- /package/{dist → dist-types}/components/TableRow/TableRow.d.ts +0 -0
- /package/{dist → dist-types}/components/TableRow/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Tabs/Tabs.d.ts +0 -0
- /package/{dist → dist-types}/components/Tabs/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Textarea/Textarea.d.ts +0 -0
- /package/{dist → dist-types}/components/Textarea/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Tooltip/Tooltip.d.ts +0 -0
- /package/{dist → dist-types}/components/Tooltip/index.d.ts +0 -0
- /package/{dist → dist-types}/enums.d.ts +0 -0
- /package/{dist → dist-types}/hooks/index.d.ts +0 -0
- /package/{dist → dist-types}/hooks/useId.d.ts +0 -0
- /package/{dist → dist-types}/hooks/useListener.d.ts +0 -0
- /package/{dist → dist-types}/hooks/useOnClickOutside.d.ts +0 -0
- /package/{dist → dist-types}/hooks/useOnEscapePressed.d.ts +0 -0
- /package/{dist → dist-types}/hooks/usePagination.d.ts +0 -0
- /package/{dist → dist-types}/hooks/usePrevious.d.ts +0 -0
- /package/{dist → dist-types}/hooks/useThrottle.d.ts +0 -0
- /package/{dist → dist-types}/hooks/useWindowFitment.d.ts +0 -0
- /package/{dist → dist-types}/index.d.ts +0 -0
- /package/{dist → dist-types}/types/index.d.ts +0 -0
- /package/{dist → dist-types}/utils.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# React components for Vanilla Framework
|
|
2
2
|

|
|
3
3
|
|
|
4
|
-
This is a collection of components designed to be the way to consume [Vanilla Framework](http://vanillaframework.io) when using React.
|
|
4
|
+
This is a collection of components designed to be the way to consume [Vanilla Framework](http://vanillaframework.io) when using React. The library exposes both a CJS and an ESM build.
|
|
5
5
|
|
|
6
6
|
**[Storybook](https://canonical.github.io/react-components/)** contains component docs with usage instructions.
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
## Requirements
|
|
10
10
|
|
|
11
|
-
Canonical react components currently require that your build is configured with [sass-loader](https://github.com/webpack-contrib/sass-loader) (or equivalent), to compile
|
|
11
|
+
Canonical react components currently require that your build is configured with [sass-loader](https://github.com/webpack-contrib/sass-loader) (or equivalent), to compile Sass.
|
|
12
12
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var _excluded = ["key"],
|
|
2
|
+
_excluded2 = ["className", "expanded", "externallyControlled", "onExpandedChange", "sections", "titleElement"];
|
|
3
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
5
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
import React, { useState } from "react";
|
|
8
|
+
import AccordionSection from "./AccordionSection";
|
|
9
|
+
var generateSections = (sections, setExpanded, expanded, titleElement) => sections.map((_ref, i) => {
|
|
10
|
+
var {
|
|
11
|
+
key
|
|
12
|
+
} = _ref,
|
|
13
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
+
return /*#__PURE__*/React.createElement(AccordionSection, _extends({
|
|
15
|
+
expanded: expanded,
|
|
16
|
+
key: key || i,
|
|
17
|
+
sectionKey: key === null || key === void 0 ? void 0 : key.toString(),
|
|
18
|
+
setExpanded: setExpanded,
|
|
19
|
+
titleElement: titleElement
|
|
20
|
+
}, props));
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Accordion](https://docs.vanillaframework.io/patterns/accordion/).
|
|
25
|
+
*
|
|
26
|
+
* The sidebar accordion, used in listing pages or as navigation, can hold multiple navigation items or to be used as a filter for content.
|
|
27
|
+
*/
|
|
28
|
+
var Accordion = _ref2 => {
|
|
29
|
+
var {
|
|
30
|
+
className,
|
|
31
|
+
expanded,
|
|
32
|
+
externallyControlled,
|
|
33
|
+
onExpandedChange,
|
|
34
|
+
sections,
|
|
35
|
+
titleElement
|
|
36
|
+
} = _ref2,
|
|
37
|
+
asideProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
38
|
+
var [expandedSection, setExpandedSection] = useState(expanded);
|
|
39
|
+
var setExpanded = (id, title) => {
|
|
40
|
+
setExpandedSection(id);
|
|
41
|
+
onExpandedChange && onExpandedChange(id, title);
|
|
42
|
+
};
|
|
43
|
+
return /*#__PURE__*/React.createElement("aside", _extends({
|
|
44
|
+
className: classNames(className, "p-accordion")
|
|
45
|
+
}, asideProps, {
|
|
46
|
+
role: "tablist",
|
|
47
|
+
"aria-multiselectable": "true"
|
|
48
|
+
}), /*#__PURE__*/React.createElement("ul", {
|
|
49
|
+
className: "p-accordion__list"
|
|
50
|
+
}, generateSections(sections, setExpanded, externallyControlled ? expanded : expandedSection, titleElement)));
|
|
51
|
+
};
|
|
52
|
+
export default Accordion;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useId } from "react";
|
|
2
|
+
var AccordionSection = _ref => {
|
|
3
|
+
var {
|
|
4
|
+
content,
|
|
5
|
+
expanded,
|
|
6
|
+
onTitleClick,
|
|
7
|
+
sectionKey,
|
|
8
|
+
setExpanded,
|
|
9
|
+
title,
|
|
10
|
+
titleElement,
|
|
11
|
+
headingLevel = 3
|
|
12
|
+
} = _ref;
|
|
13
|
+
var sectionId = useId();
|
|
14
|
+
var tabId = useId();
|
|
15
|
+
var key = sectionKey || sectionId;
|
|
16
|
+
var isExpanded = expanded === key;
|
|
17
|
+
var Title = titleElement || "div";
|
|
18
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
19
|
+
className: "p-accordion__group"
|
|
20
|
+
}, /*#__PURE__*/React.createElement(Title, {
|
|
21
|
+
role: titleElement ? null : "heading",
|
|
22
|
+
"aria-level": titleElement ? null : headingLevel,
|
|
23
|
+
className: "p-accordion__heading"
|
|
24
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
25
|
+
"aria-controls": "#".concat(sectionId),
|
|
26
|
+
"aria-expanded": isExpanded ? "true" : "false",
|
|
27
|
+
className: "p-accordion__tab",
|
|
28
|
+
id: tabId,
|
|
29
|
+
onClick: () => {
|
|
30
|
+
if (isExpanded) {
|
|
31
|
+
setExpanded(null, null);
|
|
32
|
+
} else {
|
|
33
|
+
setExpanded(key, title);
|
|
34
|
+
}
|
|
35
|
+
onTitleClick && onTitleClick(!isExpanded, key);
|
|
36
|
+
},
|
|
37
|
+
role: "tab",
|
|
38
|
+
type: "button"
|
|
39
|
+
}, title)), /*#__PURE__*/React.createElement("section", {
|
|
40
|
+
"aria-hidden": isExpanded ? "false" : "true",
|
|
41
|
+
"aria-labelledby": tabId,
|
|
42
|
+
className: "p-accordion__panel",
|
|
43
|
+
id: sectionId,
|
|
44
|
+
role: "tabpanel"
|
|
45
|
+
}, content));
|
|
46
|
+
};
|
|
47
|
+
export default AccordionSection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./AccordionSection";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Accordion";
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
var _excluded = ["appearance", "children", "className", "disabled", "inline", "loading", "success"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import classNames from "classnames";
|
|
6
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
7
|
+
import Icon from "../Icon";
|
|
8
|
+
export var LOADER_MIN_DURATION = 400; // minimium duration (ms) loader displays
|
|
9
|
+
export var SUCCESS_DURATION = 2000; // duration (ms) success tick is displayed
|
|
10
|
+
|
|
11
|
+
export var Label = /*#__PURE__*/function (Label) {
|
|
12
|
+
Label["WAITING"] = "Waiting for action to complete";
|
|
13
|
+
Label["SUCCESS"] = "Action completed";
|
|
14
|
+
return Label;
|
|
15
|
+
}({});
|
|
16
|
+
/**
|
|
17
|
+
* This is a not an existing Vanilla component. It can be used to display submitting states for forms or other actions.
|
|
18
|
+
*
|
|
19
|
+
* ActionButton accepts the props from
|
|
20
|
+
* [Button](?path=/docs/components-button--docs) in addition to those in the
|
|
21
|
+
* props table:
|
|
22
|
+
*/
|
|
23
|
+
var ActionButton = _ref => {
|
|
24
|
+
var {
|
|
25
|
+
appearance,
|
|
26
|
+
children,
|
|
27
|
+
className,
|
|
28
|
+
disabled = false,
|
|
29
|
+
inline = false,
|
|
30
|
+
loading = false,
|
|
31
|
+
success = false
|
|
32
|
+
} = _ref,
|
|
33
|
+
buttonProps = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
+
var [height, setHeight] = useState();
|
|
35
|
+
var [width, setWidth] = useState();
|
|
36
|
+
var [showLoader, setShowLoader] = useState(false);
|
|
37
|
+
var [showSuccess, setShowSuccess] = useState(false);
|
|
38
|
+
var ref = useRef(null);
|
|
39
|
+
|
|
40
|
+
// Set up loader timer
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
var loaderTimeout;
|
|
43
|
+
if (loading) {
|
|
44
|
+
// Explicitly set button dimensions
|
|
45
|
+
if (ref.current && !!ref.current.getBoundingClientRect()) {
|
|
46
|
+
setHeight(ref.current.getBoundingClientRect().height);
|
|
47
|
+
setWidth(ref.current.getBoundingClientRect().width);
|
|
48
|
+
}
|
|
49
|
+
setShowLoader(true);
|
|
50
|
+
}
|
|
51
|
+
if (!loading && showLoader) {
|
|
52
|
+
loaderTimeout = window.setTimeout(() => {
|
|
53
|
+
setShowLoader(false);
|
|
54
|
+
if (success) {
|
|
55
|
+
setShowSuccess(true);
|
|
56
|
+
}
|
|
57
|
+
}, LOADER_MIN_DURATION);
|
|
58
|
+
}
|
|
59
|
+
if (!loading && !showLoader) {
|
|
60
|
+
setHeight(null);
|
|
61
|
+
setWidth(null);
|
|
62
|
+
}
|
|
63
|
+
return () => window.clearTimeout(loaderTimeout);
|
|
64
|
+
}, [loading, showLoader, success]);
|
|
65
|
+
|
|
66
|
+
// Set up success timer
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
var successTimeout;
|
|
69
|
+
if (showSuccess) {
|
|
70
|
+
successTimeout = window.setTimeout(() => {
|
|
71
|
+
setHeight(null);
|
|
72
|
+
setWidth(null);
|
|
73
|
+
setShowSuccess(false);
|
|
74
|
+
}, SUCCESS_DURATION);
|
|
75
|
+
}
|
|
76
|
+
return () => window.clearTimeout(successTimeout);
|
|
77
|
+
}, [showSuccess]);
|
|
78
|
+
var buttonClasses = classNames(className, "p-action-button", appearance ? "p-button--".concat(appearance) : "p-button", {
|
|
79
|
+
"is-processing": showLoader || showSuccess,
|
|
80
|
+
"is-disabled": disabled,
|
|
81
|
+
"is-inline": inline
|
|
82
|
+
});
|
|
83
|
+
var showIcon = showLoader || showSuccess;
|
|
84
|
+
var icon = showLoader && "spinner" || showSuccess && "success" || null;
|
|
85
|
+
var iconLight = appearance === "positive" || appearance === "negative";
|
|
86
|
+
|
|
87
|
+
// This component uses the base button element instead of the Button component
|
|
88
|
+
// as the button requires a ref and Button would have to be updated to use
|
|
89
|
+
// forwardRef which is not currently supported by components that use
|
|
90
|
+
// typescript generics.
|
|
91
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
92
|
+
className: buttonClasses,
|
|
93
|
+
disabled: disabled,
|
|
94
|
+
ref: ref,
|
|
95
|
+
style: height && width ? {
|
|
96
|
+
height: "".concat(height, "px"),
|
|
97
|
+
width: "".concat(width, "px")
|
|
98
|
+
} : undefined
|
|
99
|
+
}, buttonProps), showIcon ? /*#__PURE__*/React.createElement(Icon, {
|
|
100
|
+
"aria-label": showLoader ? Label.WAITING : Label.SUCCESS,
|
|
101
|
+
className: showLoader ? "u-animation--spin" : null,
|
|
102
|
+
light: iconLight,
|
|
103
|
+
name: icon
|
|
104
|
+
}) : children);
|
|
105
|
+
};
|
|
106
|
+
export default ActionButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ActionButton";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var _excluded = ["children", "className", "collapsed", "narrow", "forwardRef", "pinned", "wide"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import React from "react";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
var AppAside = _ref => {
|
|
8
|
+
var {
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
collapsed,
|
|
12
|
+
narrow,
|
|
13
|
+
forwardRef,
|
|
14
|
+
pinned,
|
|
15
|
+
wide
|
|
16
|
+
} = _ref,
|
|
17
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
+
return /*#__PURE__*/React.createElement("aside", _extends({
|
|
19
|
+
className: classNames("l-aside", className, {
|
|
20
|
+
"is-collapsed": collapsed,
|
|
21
|
+
"is-narrow": narrow,
|
|
22
|
+
"is-pinned": pinned,
|
|
23
|
+
"is-wide": wide
|
|
24
|
+
})
|
|
25
|
+
}, props, {
|
|
26
|
+
ref: forwardRef
|
|
27
|
+
}), children);
|
|
28
|
+
};
|
|
29
|
+
export default AppAside;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./AppAside";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var _excluded = ["children", "className"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import React from "react";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
/**
|
|
8
|
+
* This is a [React](https://reactjs.org/) component for main content area in the Vanilla
|
|
9
|
+
* [Application Layout](https://vanillaframework.io/docs/layouts/application).
|
|
10
|
+
*/
|
|
11
|
+
var AppMain = _ref => {
|
|
12
|
+
var {
|
|
13
|
+
children,
|
|
14
|
+
className
|
|
15
|
+
} = _ref,
|
|
16
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
return /*#__PURE__*/React.createElement("main", _extends({
|
|
18
|
+
className: classNames("l-main", className)
|
|
19
|
+
}, props), children);
|
|
20
|
+
};
|
|
21
|
+
export default AppMain;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./AppMain";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var _excluded = ["children", "className", "collapsed", "pinned"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import React from "react";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
/**
|
|
8
|
+
* This is a [React](https://reactjs.org/) component for the navigation panel in the Vanilla
|
|
9
|
+
* [Application Layout](https://vanillaframework.io/docs/layouts/application).
|
|
10
|
+
*
|
|
11
|
+
* This component is used to display the left navigation panel. It should be
|
|
12
|
+
* used alongside [`AppNavigationBar`](/docs/components-applicationlayout-appnavigationbar--docs).
|
|
13
|
+
*/
|
|
14
|
+
var AppNavigation = _ref => {
|
|
15
|
+
var {
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
collapsed,
|
|
19
|
+
pinned
|
|
20
|
+
} = _ref,
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
return /*#__PURE__*/React.createElement("header", _extends({
|
|
23
|
+
className: classNames("l-navigation", className, {
|
|
24
|
+
"is-collapsed": collapsed,
|
|
25
|
+
"is-pinned": pinned
|
|
26
|
+
})
|
|
27
|
+
}, props), /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "l-navigation__drawer"
|
|
29
|
+
}, children));
|
|
30
|
+
};
|
|
31
|
+
export default AppNavigation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./AppNavigation";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var _excluded = ["children", "className"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import React from "react";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
/**
|
|
8
|
+
* This is a [React](https://reactjs.org/) component for navigation bar in the Vanilla
|
|
9
|
+
* [Application Layout](https://vanillaframework.io/docs/layouts/application).
|
|
10
|
+
*
|
|
11
|
+
* This component is used to display the navigation panel on mobile or small
|
|
12
|
+
* screens. It should be used alongside [`AppNavigation`](/docs/components-applicationlayout-appnavigation--docs).
|
|
13
|
+
*/
|
|
14
|
+
var AppNavigationBar = _ref => {
|
|
15
|
+
var {
|
|
16
|
+
children,
|
|
17
|
+
className
|
|
18
|
+
} = _ref,
|
|
19
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
return /*#__PURE__*/React.createElement("header", _extends({
|
|
21
|
+
className: classNames("l-navigation-bar", className)
|
|
22
|
+
}, props), children);
|
|
23
|
+
};
|
|
24
|
+
export default AppNavigationBar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./AppNavigationBar";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var _excluded = ["children", "className"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import React from "react";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
/**
|
|
8
|
+
* This is a [React](https://reactjs.org/) component for status area in the Vanilla
|
|
9
|
+
* [Application Layout](https://vanillaframework.io/docs/layouts/application).
|
|
10
|
+
*/
|
|
11
|
+
var AppStatus = _ref => {
|
|
12
|
+
var {
|
|
13
|
+
children,
|
|
14
|
+
className
|
|
15
|
+
} = _ref,
|
|
16
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
return /*#__PURE__*/React.createElement("aside", _extends({
|
|
18
|
+
className: classNames("l-status", className)
|
|
19
|
+
}, props), children);
|
|
20
|
+
};
|
|
21
|
+
export default AppStatus;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./AppStatus";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var _excluded = ["children", "className"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import React from "react";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
/**
|
|
8
|
+
* This is a [React](https://reactjs.org/) component for the application wrapper in the Vanilla
|
|
9
|
+
* [Application Layout](https://vanillaframework.io/docs/layouts/application).
|
|
10
|
+
*/
|
|
11
|
+
var Application = _ref => {
|
|
12
|
+
var {
|
|
13
|
+
children,
|
|
14
|
+
className
|
|
15
|
+
} = _ref,
|
|
16
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
18
|
+
className: classNames("l-application", className),
|
|
19
|
+
role: "presentation"
|
|
20
|
+
}, props), children);
|
|
21
|
+
};
|
|
22
|
+
export default Application;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Application";
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
var _excluded = ["aside", "children", "dark", "logo", "mainClassName", "menuCollapsed", "menuPinned", "navigationBarClassName", "navigationClassName", "navItems", "navLinkComponent", "onCollapseMenu", "onPinMenu", "sideNavigation", "status", "statusClassName"];
|
|
2
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
3
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
4
|
+
import React from "react";
|
|
5
|
+
import classNames from "classnames";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import Panel from "../Panel";
|
|
8
|
+
import SideNavigation from "../SideNavigation";
|
|
9
|
+
import AppMain from "./AppMain";
|
|
10
|
+
import AppNavigation from "./AppNavigation";
|
|
11
|
+
import AppNavigationBar from "./AppNavigationBar";
|
|
12
|
+
import AppStatus from "./AppStatus";
|
|
13
|
+
import Application from "./Application";
|
|
14
|
+
import Button from "../Button";
|
|
15
|
+
import Icon from "../Icon";
|
|
16
|
+
/**
|
|
17
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla
|
|
18
|
+
* [Application Layout](https://vanillaframework.io/docs/layouts/application).
|
|
19
|
+
*
|
|
20
|
+
* This component combines the various sub-components that make up the
|
|
21
|
+
* Application Layout to make it easier to consume. For some applications this
|
|
22
|
+
* component maybe not be flexible enough, in which case you may choose to use
|
|
23
|
+
* the sub-components directly. Be aware that the application layout requires a
|
|
24
|
+
* specific structure and states to function correctly so there will be a
|
|
25
|
+
* trade-off when using the sub-components directly.
|
|
26
|
+
*/
|
|
27
|
+
var ApplicationLayout = _ref => {
|
|
28
|
+
var {
|
|
29
|
+
aside,
|
|
30
|
+
children,
|
|
31
|
+
dark = true,
|
|
32
|
+
logo,
|
|
33
|
+
mainClassName,
|
|
34
|
+
menuCollapsed,
|
|
35
|
+
menuPinned,
|
|
36
|
+
navigationBarClassName,
|
|
37
|
+
navigationClassName,
|
|
38
|
+
navItems,
|
|
39
|
+
navLinkComponent,
|
|
40
|
+
onCollapseMenu,
|
|
41
|
+
onPinMenu,
|
|
42
|
+
sideNavigation,
|
|
43
|
+
status,
|
|
44
|
+
statusClassName
|
|
45
|
+
} = _ref,
|
|
46
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
47
|
+
var [internalMenuPinned, setInternalMenuPinned] = useState(false);
|
|
48
|
+
var [internalMenuCollapsed, setInternalMenuCollapsed] = useState(true);
|
|
49
|
+
var menuIsPinned = menuPinned !== null && menuPinned !== void 0 ? menuPinned : internalMenuPinned;
|
|
50
|
+
var setMenuPinned = onPinMenu !== null && onPinMenu !== void 0 ? onPinMenu : setInternalMenuPinned;
|
|
51
|
+
var menuIsCollapsed = menuCollapsed !== null && menuCollapsed !== void 0 ? menuCollapsed : internalMenuCollapsed;
|
|
52
|
+
var setMenuCollapsed = onCollapseMenu !== null && onCollapseMenu !== void 0 ? onCollapseMenu : setInternalMenuCollapsed;
|
|
53
|
+
return /*#__PURE__*/React.createElement(Application, props, (navItems || sideNavigation) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AppNavigationBar, {
|
|
54
|
+
className: navigationBarClassName
|
|
55
|
+
}, /*#__PURE__*/React.createElement(Panel, {
|
|
56
|
+
dark: dark,
|
|
57
|
+
logo: logo,
|
|
58
|
+
toggle: {
|
|
59
|
+
label: "Menu",
|
|
60
|
+
onClick: () => setMenuCollapsed(!menuIsCollapsed)
|
|
61
|
+
}
|
|
62
|
+
})), /*#__PURE__*/React.createElement(AppNavigation, {
|
|
63
|
+
className: navigationClassName,
|
|
64
|
+
collapsed: menuIsCollapsed,
|
|
65
|
+
pinned: menuIsPinned
|
|
66
|
+
}, /*#__PURE__*/React.createElement(Panel, {
|
|
67
|
+
dark: dark,
|
|
68
|
+
controls: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
69
|
+
hasIcon: true,
|
|
70
|
+
appearance: "base",
|
|
71
|
+
className: classNames("u-no-margin u-hide--medium", {
|
|
72
|
+
"is-dark": dark
|
|
73
|
+
}),
|
|
74
|
+
onClick: evt => {
|
|
75
|
+
setMenuCollapsed(true);
|
|
76
|
+
// The menu stays open while its content has focus, so the
|
|
77
|
+
// close button must blur to actually close the menu.
|
|
78
|
+
evt.currentTarget.blur();
|
|
79
|
+
}
|
|
80
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
81
|
+
name: "close",
|
|
82
|
+
className: classNames({
|
|
83
|
+
"is-light": dark
|
|
84
|
+
})
|
|
85
|
+
}, "Close menu")), /*#__PURE__*/React.createElement(Button, {
|
|
86
|
+
hasIcon: true,
|
|
87
|
+
appearance: "base",
|
|
88
|
+
className: classNames("u-no-margin u-hide--small", {
|
|
89
|
+
"is-dark": dark
|
|
90
|
+
}),
|
|
91
|
+
onClick: () => {
|
|
92
|
+
setMenuPinned(!menuIsPinned);
|
|
93
|
+
}
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
95
|
+
name: menuIsPinned ? "close" : "pin",
|
|
96
|
+
className: classNames({
|
|
97
|
+
"is-light": dark
|
|
98
|
+
})
|
|
99
|
+
}, menuIsPinned ? "Unpin menu" : "Pin menu"))),
|
|
100
|
+
controlsClassName: "u-hide--large",
|
|
101
|
+
stickyHeader: true,
|
|
102
|
+
logo: logo
|
|
103
|
+
}, navItems ? /*#__PURE__*/React.createElement(SideNavigation, {
|
|
104
|
+
dark: dark,
|
|
105
|
+
items: navItems,
|
|
106
|
+
linkComponent: navLinkComponent
|
|
107
|
+
}) : sideNavigation))), /*#__PURE__*/React.createElement(AppMain, {
|
|
108
|
+
className: mainClassName
|
|
109
|
+
}, children), aside, status && /*#__PURE__*/React.createElement(AppStatus, {
|
|
110
|
+
className: statusClassName
|
|
111
|
+
}, status));
|
|
112
|
+
};
|
|
113
|
+
export default ApplicationLayout;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default } from "./ApplicationLayout";
|
|
2
|
+
export { default as AppAside } from "./AppAside";
|
|
3
|
+
export { default as Application } from "./Application";
|
|
4
|
+
export { default as AppMain } from "./AppMain";
|
|
5
|
+
export { default as AppNavigation } from "./AppNavigation";
|
|
6
|
+
export { default as AppNavigationBar } from "./AppNavigationBar";
|
|
7
|
+
export { default as AppStatus } from "./AppStatus";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var _excluded = ["className", "nextURL", "nextLabel", "previousURL", "previousLabel"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import classNames from "classnames";
|
|
6
|
+
import React from "react";
|
|
7
|
+
/**
|
|
8
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Article pagination](https://docs.vanillaframework.io/patterns/article-pagination/).
|
|
9
|
+
*
|
|
10
|
+
* The article pagination component should be used to navigate from one article to the next, or previous, in chronological order.
|
|
11
|
+
*/
|
|
12
|
+
var ArticlePagination = _ref => {
|
|
13
|
+
var {
|
|
14
|
+
className,
|
|
15
|
+
nextURL,
|
|
16
|
+
nextLabel,
|
|
17
|
+
previousURL,
|
|
18
|
+
previousLabel
|
|
19
|
+
} = _ref,
|
|
20
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
return /*#__PURE__*/React.createElement("footer", _extends({
|
|
22
|
+
className: classNames(className, "p-article-pagination")
|
|
23
|
+
}, props), previousURL && previousLabel && /*#__PURE__*/React.createElement("a", {
|
|
24
|
+
className: "p-article-pagination__link--previous",
|
|
25
|
+
href: previousURL
|
|
26
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
27
|
+
className: "p-article-pagination__label"
|
|
28
|
+
}, "Previous"), /*#__PURE__*/React.createElement("span", {
|
|
29
|
+
className: "p-article-pagination__title"
|
|
30
|
+
}, previousLabel)), nextURL && nextLabel && /*#__PURE__*/React.createElement("a", {
|
|
31
|
+
className: "p-article-pagination__link--next",
|
|
32
|
+
href: nextURL
|
|
33
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
34
|
+
className: "p-article-pagination__label"
|
|
35
|
+
}, "Next"), /*#__PURE__*/React.createElement("span", {
|
|
36
|
+
className: "p-article-pagination__title"
|
|
37
|
+
}, nextLabel)));
|
|
38
|
+
};
|
|
39
|
+
export default ArticlePagination;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ArticlePagination";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var _excluded = ["value", "badgeType", "className", "isNegative"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import classNames from "classnames";
|
|
6
|
+
import React from "react";
|
|
7
|
+
export var BadgeType = {
|
|
8
|
+
ROUNDED_LARGE_NUMBER: "ROUNDED_LARGE_NUMBER",
|
|
9
|
+
UNDEFINED_LARGE_NUMBER: "UNDEFINED_LARGE_NUMBER"
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The props for the Badge component.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var MAX_VAL = 999;
|
|
17
|
+
var units = ["", "k", "M", "B", "T"];
|
|
18
|
+
var round = function round(value) {
|
|
19
|
+
var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
20
|
+
if (value < 1000) {
|
|
21
|
+
var truncatedValue = Number(value.toString().slice(0, 3));
|
|
22
|
+
return "".concat(truncatedValue).concat(units[unit]);
|
|
23
|
+
}
|
|
24
|
+
if (unit >= units.length - 1) {
|
|
25
|
+
return "999T";
|
|
26
|
+
}
|
|
27
|
+
var newValue = value / 1000;
|
|
28
|
+
return round(newValue, unit + 1);
|
|
29
|
+
};
|
|
30
|
+
var clamp = value => {
|
|
31
|
+
if (value > MAX_VAL) {
|
|
32
|
+
return "".concat(MAX_VAL, "+");
|
|
33
|
+
}
|
|
34
|
+
return value;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Badge](https://vanillaframework.io/docs/patterns/badge).
|
|
39
|
+
*
|
|
40
|
+
* It can be used to display a numeric values.
|
|
41
|
+
*/
|
|
42
|
+
var Badge = _ref => {
|
|
43
|
+
var {
|
|
44
|
+
value,
|
|
45
|
+
badgeType = BadgeType.UNDEFINED_LARGE_NUMBER,
|
|
46
|
+
className,
|
|
47
|
+
isNegative
|
|
48
|
+
} = _ref,
|
|
49
|
+
spanProps = _objectWithoutProperties(_ref, _excluded);
|
|
50
|
+
var badgeClassName = classNames({
|
|
51
|
+
["p-badge--negative"]: !!isNegative,
|
|
52
|
+
"p-badge": !isNegative
|
|
53
|
+
}, className);
|
|
54
|
+
var safeValue = Math.round(value);
|
|
55
|
+
if (value < 0) {
|
|
56
|
+
console.error("The value used in the badge should be positive");
|
|
57
|
+
safeValue = 0;
|
|
58
|
+
}
|
|
59
|
+
var formattedValue = badgeType === BadgeType.ROUNDED_LARGE_NUMBER ? round(safeValue) : clamp(safeValue);
|
|
60
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, spanProps, {
|
|
61
|
+
className: badgeClassName
|
|
62
|
+
}), formattedValue);
|
|
63
|
+
};
|
|
64
|
+
export default Badge;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Badge";
|