@canonical/react-components 1.3.0 → 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/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/dist-types/components/Accordion/Accordion.d.ts +46 -0
- package/dist-types/components/Accordion/AccordionSection/AccordionSection.d.ts +34 -0
- package/dist-types/components/Accordion/AccordionSection/index.d.ts +2 -0
- package/dist-types/components/Accordion/index.d.ts +2 -0
- package/dist-types/components/ActionButton/ActionButton.d.ts +48 -0
- package/dist-types/components/ActionButton/index.d.ts +2 -0
- package/dist-types/components/ApplicationLayout/AppAside/AppAside.d.ts +33 -0
- package/dist-types/components/ApplicationLayout/AppAside/index.d.ts +2 -0
- package/dist-types/components/ApplicationLayout/AppMain/AppMain.d.ts +14 -0
- package/dist-types/components/ApplicationLayout/AppMain/index.d.ts +2 -0
- package/dist-types/components/ApplicationLayout/AppNavigation/AppNavigation.d.ts +26 -0
- package/dist-types/components/ApplicationLayout/AppNavigation/index.d.ts +2 -0
- package/dist-types/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.d.ts +18 -0
- package/dist-types/components/ApplicationLayout/AppNavigationBar/index.d.ts +2 -0
- package/dist-types/components/ApplicationLayout/AppStatus/AppStatus.d.ts +14 -0
- package/dist-types/components/ApplicationLayout/AppStatus/index.d.ts +2 -0
- package/dist-types/components/ApplicationLayout/Application/Application.d.ts +15 -0
- package/dist-types/components/ApplicationLayout/Application/index.d.ts +2 -0
- package/dist-types/components/ApplicationLayout/ApplicationLayout.d.ts +89 -0
- package/dist-types/components/ApplicationLayout/index.d.ts +7 -0
- package/dist-types/components/ArticlePagination/ArticlePagination.d.ts +31 -0
- package/dist-types/components/ArticlePagination/index.d.ts +2 -0
- package/dist-types/components/Badge/Badge.d.ts +34 -0
- package/dist-types/components/Badge/index.d.ts +2 -0
- package/dist-types/components/Button/Button.d.ts +64 -0
- package/dist-types/components/Button/index.d.ts +2 -0
- package/dist-types/components/Card/Card.d.ts +35 -0
- package/dist-types/components/Card/index.d.ts +2 -0
- package/dist-types/components/CheckboxInput/CheckableInput/CheckableInput.d.ts +27 -0
- package/dist-types/components/CheckboxInput/CheckableInput/index.d.ts +2 -0
- package/dist-types/components/CheckboxInput/CheckboxInput.d.ts +9 -0
- package/dist-types/components/CheckboxInput/index.d.ts +2 -0
- package/dist-types/components/Chip/Chip.d.ts +56 -0
- package/dist-types/components/Chip/index.d.ts +2 -0
- package/dist-types/components/Code/Code.d.ts +13 -0
- package/dist-types/components/Code/index.d.ts +2 -0
- package/dist-types/components/CodeSnippet/CodeSnippet.d.ts +21 -0
- package/dist-types/components/CodeSnippet/CodeSnippetBlock.d.ts +40 -0
- package/dist-types/components/CodeSnippet/CodeSnippetDropdown.d.ts +18 -0
- package/dist-types/components/CodeSnippet/index.d.ts +5 -0
- package/dist-types/components/Col/Col.d.ts +53 -0
- package/dist-types/components/Col/index.d.ts +2 -0
- package/dist-types/components/ConfirmationButton/ConfirmationButton.d.ts +28 -0
- package/dist-types/components/ConfirmationButton/index.d.ts +2 -0
- package/dist-types/components/ConfirmationModal/ConfirmationModal.d.ts +53 -0
- package/dist-types/components/ConfirmationModal/index.d.ts +2 -0
- package/dist-types/components/ContextualMenu/ContextualMenu.d.ts +110 -0
- package/dist-types/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.d.ts +43 -0
- package/dist-types/components/ContextualMenu/ContextualMenuDropdown/index.d.ts +2 -0
- package/dist-types/components/ContextualMenu/index.d.ts +3 -0
- package/dist-types/components/EmptyState/EmptyState.d.ts +25 -0
- package/dist-types/components/EmptyState/index.d.ts +2 -0
- package/dist-types/components/Field/Field.d.ts +77 -0
- package/dist-types/components/Field/index.d.ts +2 -0
- package/dist-types/components/Form/Form.d.ts +21 -0
- package/dist-types/components/Form/index.d.ts +2 -0
- package/dist-types/components/FormikField/FormikField.d.ts +25 -0
- package/dist-types/components/FormikField/index.d.ts +1 -0
- package/dist-types/components/Icon/Icon.d.ts +59 -0
- package/dist-types/components/Icon/index.d.ts +2 -0
- package/dist-types/components/Input/Input.d.ts +70 -0
- package/dist-types/components/Input/index.d.ts +2 -0
- package/dist-types/components/Label/Label.d.ts +25 -0
- package/dist-types/components/Label/index.d.ts +2 -0
- package/dist-types/components/Link/Link.d.ts +31 -0
- package/dist-types/components/Link/index.d.ts +2 -0
- package/dist-types/components/List/List.d.ts +36 -0
- package/dist-types/components/List/index.d.ts +2 -0
- package/dist-types/components/Loader/Loader.d.ts +6 -0
- package/dist-types/components/Loader/index.d.ts +1 -0
- package/dist-types/components/LoginPageLayout/LoginPageLayout.d.ts +17 -0
- package/dist-types/components/LoginPageLayout/index.d.ts +2 -0
- package/dist-types/components/MainTable/MainTable.d.ts +102 -0
- package/dist-types/components/MainTable/index.d.ts +2 -0
- package/dist-types/components/Modal/Modal.d.ts +36 -0
- package/dist-types/components/Modal/index.d.ts +2 -0
- package/dist-types/components/ModularTable/ModularTable.d.ts +105 -0
- package/dist-types/components/ModularTable/index.d.ts +2 -0
- package/dist-types/components/MultiSelect/FadeInDown/FadeInDown.d.ts +10 -0
- package/dist-types/components/MultiSelect/FadeInDown/index.d.ts +1 -0
- package/dist-types/components/MultiSelect/MultiSelect.d.ts +57 -0
- package/dist-types/components/MultiSelect/index.d.ts +1 -0
- package/dist-types/components/Navigation/Navigation.d.ts +66 -0
- package/dist-types/components/Navigation/NavigationLink/NavigationLink.d.ts +10 -0
- package/dist-types/components/Navigation/NavigationLink/index.d.ts +1 -0
- package/dist-types/components/Navigation/NavigationMenu/NavigationMenu.d.ts +11 -0
- package/dist-types/components/Navigation/NavigationMenu/index.d.ts +1 -0
- package/dist-types/components/Navigation/index.d.ts +3 -0
- package/dist-types/components/Navigation/types.d.ts +64 -0
- package/dist-types/components/Notification/Notification.d.ts +110 -0
- package/dist-types/components/Notification/index.d.ts +2 -0
- package/dist-types/components/NotificationProvider/NotificationProvider.d.ts +5 -0
- package/dist-types/components/NotificationProvider/index.d.ts +3 -0
- package/dist-types/components/NotificationProvider/messageBuilder.d.ts +6 -0
- package/dist-types/components/NotificationProvider/types.d.ts +35 -0
- package/dist-types/components/Pagination/Pagination.d.ts +102 -0
- package/dist-types/components/Pagination/PaginationButton/PaginationButton.d.ts +30 -0
- package/dist-types/components/Pagination/PaginationButton/index.d.ts +2 -0
- package/dist-types/components/Pagination/PaginationItem/PaginationItem.d.ts +17 -0
- package/dist-types/components/Pagination/PaginationItem/index.d.ts +2 -0
- package/dist-types/components/Pagination/index.d.ts +2 -0
- package/dist-types/components/Panel/Panel.d.ts +123 -0
- package/dist-types/components/Panel/index.d.ts +1 -0
- package/dist-types/components/PasswordToggle/PasswordToggle.d.ts +108 -0
- package/dist-types/components/PasswordToggle/index.d.ts +2 -0
- package/dist-types/components/RadioInput/RadioInput.d.ts +9 -0
- package/dist-types/components/RadioInput/index.d.ts +2 -0
- package/dist-types/components/Row/Row.d.ts +19 -0
- package/dist-types/components/Row/index.d.ts +2 -0
- package/dist-types/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.d.ts +25 -0
- package/dist-types/components/SearchAndFilter/FilterPanelSection/index.d.ts +1 -0
- package/dist-types/components/SearchAndFilter/SearchAndFilter.d.ts +33 -0
- package/dist-types/components/SearchAndFilter/index.d.ts +2 -0
- package/dist-types/components/SearchAndFilter/types.d.ts +11 -0
- package/dist-types/components/SearchAndFilter/utils.d.ts +13 -0
- package/dist-types/components/SearchBox/SearchBox.d.ts +63 -0
- package/dist-types/components/SearchBox/index.d.ts +2 -0
- package/dist-types/components/Select/Select.d.ts +71 -0
- package/dist-types/components/Select/index.d.ts +2 -0
- package/dist-types/components/SideNavigation/SideNavigation.d.ts +50 -0
- package/dist-types/components/SideNavigation/SideNavigationBase/SideNavigationBase.d.ts +31 -0
- package/dist-types/components/SideNavigation/SideNavigationBase/index.d.ts +1 -0
- package/dist-types/components/SideNavigation/SideNavigationItem/SideNavigationItem.d.ts +20 -0
- package/dist-types/components/SideNavigation/SideNavigationItem/index.d.ts +1 -0
- package/dist-types/components/SideNavigation/SideNavigationLink/SideNavigationLink.d.ts +18 -0
- package/dist-types/components/SideNavigation/SideNavigationLink/index.d.ts +1 -0
- package/dist-types/components/SideNavigation/SideNavigationText/SideNavigationText.d.ts +7 -0
- package/dist-types/components/SideNavigation/SideNavigationText/index.d.ts +1 -0
- package/dist-types/components/SideNavigation/index.d.ts +5 -0
- package/dist-types/components/Slider/Slider.d.ts +62 -0
- package/dist-types/components/Slider/index.d.ts +2 -0
- package/dist-types/components/Spinner/Spinner.d.ts +29 -0
- package/dist-types/components/Spinner/index.d.ts +2 -0
- package/dist-types/components/StatusLabel/StatusLabel.d.ts +33 -0
- package/dist-types/components/StatusLabel/index.d.ts +2 -0
- package/dist-types/components/Strip/Strip.d.ts +64 -0
- package/dist-types/components/Strip/index.d.ts +2 -0
- package/dist-types/components/SummaryButton/SummaryButton.d.ts +29 -0
- package/dist-types/components/SummaryButton/index.d.ts +2 -0
- package/dist-types/components/Switch/Switch.d.ts +17 -0
- package/dist-types/components/Switch/index.d.ts +2 -0
- package/dist-types/components/Table/Table.d.ts +22 -0
- package/dist-types/components/Table/index.d.ts +2 -0
- package/dist-types/components/TableCell/TableCell.d.ts +26 -0
- package/dist-types/components/TableCell/index.d.ts +2 -0
- package/dist-types/components/TableHeader/TableHeader.d.ts +14 -0
- package/dist-types/components/TableHeader/index.d.ts +2 -0
- package/dist-types/components/TablePagination/TablePagination.d.ts +98 -0
- package/dist-types/components/TablePagination/TablePaginationControls/TablePaginationControls.d.ts +24 -0
- package/dist-types/components/TablePagination/TablePaginationControls/index.d.ts +2 -0
- package/dist-types/components/TablePagination/index.d.ts +2 -0
- package/dist-types/components/TablePagination/utils.d.ts +27 -0
- package/dist-types/components/TableRow/TableRow.d.ts +10 -0
- package/dist-types/components/TableRow/index.d.ts +2 -0
- package/dist-types/components/Tabs/Tabs.d.ts +45 -0
- package/dist-types/components/Tabs/index.d.ts +2 -0
- package/dist-types/components/Textarea/Textarea.d.ts +70 -0
- package/dist-types/components/Textarea/index.d.ts +2 -0
- package/dist-types/components/Tooltip/Tooltip.d.ts +75 -0
- package/dist-types/components/Tooltip/index.d.ts +2 -0
- package/dist-types/enums.d.ts +13 -0
- package/dist-types/hooks/index.d.ts +9 -0
- package/dist-types/hooks/useId.d.ts +4 -0
- package/dist-types/hooks/useListener.d.ts +11 -0
- package/dist-types/hooks/useOnClickOutside.d.ts +12 -0
- package/dist-types/hooks/useOnEscapePressed.d.ts +6 -0
- package/dist-types/hooks/usePagination.d.ts +19 -0
- package/dist-types/hooks/usePrevious.d.ts +7 -0
- package/dist-types/hooks/useThrottle.d.ts +9 -0
- package/dist-types/hooks/useWindowFitment.d.ts +54 -0
- package/dist-types/index.d.ts +132 -0
- package/dist-types/types/index.d.ts +38 -0
- package/dist-types/utils.d.ts +27 -0
- package/package.json +3 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ClassName } from "../../types";
|
|
3
|
+
/**
|
|
4
|
+
* The props for the Field component.
|
|
5
|
+
*/
|
|
6
|
+
export type Props = {
|
|
7
|
+
/**
|
|
8
|
+
* The content for caution validation.
|
|
9
|
+
*/
|
|
10
|
+
caution?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* The content of the Field component.
|
|
13
|
+
*/
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Optional class(es) to pass to the Field wrapper div.
|
|
17
|
+
*/
|
|
18
|
+
className?: ClassName;
|
|
19
|
+
/**
|
|
20
|
+
* The content for error validation.
|
|
21
|
+
*/
|
|
22
|
+
error?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* The id of the input this Field component is controlling.
|
|
25
|
+
*/
|
|
26
|
+
forId?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Help text to show below the field.
|
|
29
|
+
*/
|
|
30
|
+
help?: ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Optional class(es) to pass to the help text element.
|
|
33
|
+
*/
|
|
34
|
+
helpClassName?: string;
|
|
35
|
+
/**
|
|
36
|
+
* An id to give to the help element.
|
|
37
|
+
*/
|
|
38
|
+
helpId?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the component is wrapping a select element.
|
|
41
|
+
*/
|
|
42
|
+
isSelect?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the component is wrapping a checkbox or radio element.
|
|
45
|
+
*/
|
|
46
|
+
isTickElement?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The label for the field.
|
|
49
|
+
*/
|
|
50
|
+
label?: ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* Optional class(es) to pass to the label component.
|
|
53
|
+
*/
|
|
54
|
+
labelClassName?: string | null;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the label should show before the input.
|
|
57
|
+
*/
|
|
58
|
+
labelFirst?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Whether the field is required.
|
|
61
|
+
*/
|
|
62
|
+
required?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Whether the form field should have a stacked appearance.
|
|
65
|
+
*/
|
|
66
|
+
stacked?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The content for success validation.
|
|
69
|
+
*/
|
|
70
|
+
success?: ReactNode;
|
|
71
|
+
/**
|
|
72
|
+
* An id to give to the caution, error or success element.
|
|
73
|
+
*/
|
|
74
|
+
validationId?: string;
|
|
75
|
+
};
|
|
76
|
+
declare const Field: ({ caution, children, className, error, forId, help, helpClassName, helpId, isSelect, isTickElement, label, labelClassName, labelFirst, required, stacked, success, validationId, ...props }: Props) => JSX.Element;
|
|
77
|
+
export default Field;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HTMLProps, ReactNode } from "react";
|
|
2
|
+
import type { ClassName, PropsWithSpread } from "../../types";
|
|
3
|
+
export type Props = PropsWithSpread<{
|
|
4
|
+
/**
|
|
5
|
+
* The content of the form.
|
|
6
|
+
*/
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Optional class(es) to pass to the form element.
|
|
10
|
+
*/
|
|
11
|
+
className?: ClassName;
|
|
12
|
+
inline?: boolean;
|
|
13
|
+
stacked?: boolean;
|
|
14
|
+
}, HTMLProps<HTMLFormElement>>;
|
|
15
|
+
/**
|
|
16
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Form](https://docs.vanillaframework.io/base/forms).
|
|
17
|
+
*
|
|
18
|
+
* Form controls have global styling defined at the HTML element level. Labels and most input types are 100% width of the `<form>` parent element.
|
|
19
|
+
*/
|
|
20
|
+
declare const Form: ({ children, className, inline, stacked, ...props }: Props) => JSX.Element;
|
|
21
|
+
export default Form;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ComponentProps, type ComponentType, type ElementType, type HTMLProps } from "react";
|
|
2
|
+
import Input from "../Input";
|
|
3
|
+
export type Props<C extends ElementType | ComponentType = typeof Input> = {
|
|
4
|
+
/**
|
|
5
|
+
* The component to display.
|
|
6
|
+
* @default Input
|
|
7
|
+
*/
|
|
8
|
+
component?: C;
|
|
9
|
+
/**
|
|
10
|
+
* This can be used to hide errors returned by Formik.
|
|
11
|
+
*/
|
|
12
|
+
displayError?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The name of the field as given to Formik.
|
|
15
|
+
*/
|
|
16
|
+
name: string;
|
|
17
|
+
value?: HTMLProps<HTMLElement>["value"];
|
|
18
|
+
} & ComponentProps<C>;
|
|
19
|
+
/**
|
|
20
|
+
* This component makes it easier to use Vanilla form inputs with Formik. It
|
|
21
|
+
* makes use of Formik's context to automatically map errors, values, states
|
|
22
|
+
* etc. onto the provided field.
|
|
23
|
+
*/
|
|
24
|
+
declare const FormikField: <C extends ElementType | ComponentType = ({ caution, className, error, help, helpClassName, id, label, labelClassName, required, stacked, success, takeFocus, takeFocusDelay, type, wrapperClassName, ...inputProps }: import("../Input").InputProps) => JSX.Element>({ component: Component, displayError, name, value, label, ...props }: Props<C>) => JSX.Element;
|
|
25
|
+
export default FormikField;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, type Props as FormikFieldProps } from "./FormikField";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { HTMLProps } from "react";
|
|
2
|
+
import type { ClassName, PropsWithSpread, ValueOf } from "../../types";
|
|
3
|
+
export declare const ICONS: {
|
|
4
|
+
readonly anchor: "anchor";
|
|
5
|
+
readonly chevronDown: "chevron-down";
|
|
6
|
+
readonly chevronUp: "chevron-up";
|
|
7
|
+
readonly close: "close";
|
|
8
|
+
readonly code: "code";
|
|
9
|
+
readonly collapse: "collapse";
|
|
10
|
+
readonly copy: "copy";
|
|
11
|
+
readonly delete: "delete";
|
|
12
|
+
readonly drag: "drag";
|
|
13
|
+
readonly error: "error";
|
|
14
|
+
readonly expand: "expand";
|
|
15
|
+
readonly externalLink: "external-link";
|
|
16
|
+
readonly help: "help";
|
|
17
|
+
readonly information: "information";
|
|
18
|
+
readonly menu: "menu";
|
|
19
|
+
readonly minus: "minus";
|
|
20
|
+
readonly plus: "plus";
|
|
21
|
+
readonly search: "search";
|
|
22
|
+
readonly share: "share";
|
|
23
|
+
readonly spinner: "spinner";
|
|
24
|
+
readonly success: "success";
|
|
25
|
+
readonly user: "user";
|
|
26
|
+
readonly warning: "warning";
|
|
27
|
+
readonly facebook: "facebook";
|
|
28
|
+
readonly twitter: "twitter";
|
|
29
|
+
readonly instagram: "instagram";
|
|
30
|
+
readonly linkedin: "linkedin";
|
|
31
|
+
readonly youtube: "youtube";
|
|
32
|
+
readonly github: "github";
|
|
33
|
+
readonly rss: "rss";
|
|
34
|
+
readonly email: "email";
|
|
35
|
+
};
|
|
36
|
+
export type Props = PropsWithSpread<{
|
|
37
|
+
/**
|
|
38
|
+
* Optional classes to add to the icon element.
|
|
39
|
+
*/
|
|
40
|
+
className?: ClassName;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to show the light variant of the icon.
|
|
43
|
+
*/
|
|
44
|
+
light?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The name of the icon.
|
|
47
|
+
*/
|
|
48
|
+
name: ValueOf<typeof ICONS> | string;
|
|
49
|
+
}, HTMLProps<HTMLElement>>;
|
|
50
|
+
/**
|
|
51
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Icon](https://docs.vanillaframework.io/patterns/icons/).
|
|
52
|
+
*
|
|
53
|
+
* Icons provide visual context and enhance usability.
|
|
54
|
+
*
|
|
55
|
+
* @param name One of built-in Vanilla icons or a name of a custom icon that follows `p-icon--{name}` convention.
|
|
56
|
+
* @returns Icon
|
|
57
|
+
*/
|
|
58
|
+
declare const Icon: ({ className, light, name, ...props }: Props) => JSX.Element;
|
|
59
|
+
export default Icon;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import type { ClassName, PropsWithSpread } from "../../types";
|
|
3
|
+
/**
|
|
4
|
+
* The props for the Input component.
|
|
5
|
+
*/
|
|
6
|
+
export type Props = PropsWithSpread<{
|
|
7
|
+
/**
|
|
8
|
+
* The content for caution validation.
|
|
9
|
+
*/
|
|
10
|
+
caution?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Optional class(es) to pass to the input element.
|
|
13
|
+
*/
|
|
14
|
+
className?: ClassName;
|
|
15
|
+
/**
|
|
16
|
+
* The content for error validation message. Controls the value of aria-invalid attribute.
|
|
17
|
+
*/
|
|
18
|
+
error?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Help text to show below the field.
|
|
21
|
+
*/
|
|
22
|
+
help?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Optional class(es) to pass to the help text element.
|
|
25
|
+
*/
|
|
26
|
+
helpClassName?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* The id of the input.
|
|
29
|
+
*/
|
|
30
|
+
id?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The label for the field.
|
|
33
|
+
*/
|
|
34
|
+
label?: ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Optional class(es) to pass to the label component.
|
|
37
|
+
*/
|
|
38
|
+
labelClassName?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the field is required.
|
|
41
|
+
*/
|
|
42
|
+
required?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the form field should have a stacked appearance.
|
|
45
|
+
*/
|
|
46
|
+
stacked?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The content for success validation.
|
|
49
|
+
*/
|
|
50
|
+
success?: ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* Whether to focus on the input on initial render.
|
|
53
|
+
*/
|
|
54
|
+
takeFocus?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Delay takeFocus in milliseconds i.e. to let animations finish
|
|
57
|
+
*/
|
|
58
|
+
takeFocusDelay?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Optional class(es) to pass to the wrapping Field component
|
|
61
|
+
*/
|
|
62
|
+
wrapperClassName?: string;
|
|
63
|
+
}, InputHTMLAttributes<HTMLInputElement>>;
|
|
64
|
+
/**
|
|
65
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Input](https://docs.vanillaframework.io/base/forms/#input).
|
|
66
|
+
*
|
|
67
|
+
* An input field where the user can enter data, which can vary in many ways, depending on the type attribute.
|
|
68
|
+
*/
|
|
69
|
+
declare const Input: ({ caution, className, error, help, helpClassName, id, label, labelClassName, required, stacked, success, takeFocus, takeFocusDelay, type, wrapperClassName, ...inputProps }: Props) => JSX.Element;
|
|
70
|
+
export default Input;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LabelHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import type { ClassName, PropsWithSpread } from "../../types";
|
|
3
|
+
/**
|
|
4
|
+
* The props for the Label component.
|
|
5
|
+
*/
|
|
6
|
+
export type Props = PropsWithSpread<{
|
|
7
|
+
/**
|
|
8
|
+
* The label content.
|
|
9
|
+
*/
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Optional class(es) to give to the label element.
|
|
13
|
+
*/
|
|
14
|
+
className?: ClassName;
|
|
15
|
+
/**
|
|
16
|
+
* The id of the input this label is connected to.
|
|
17
|
+
*/
|
|
18
|
+
forId?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to apply required styling to the label.
|
|
21
|
+
*/
|
|
22
|
+
required?: boolean;
|
|
23
|
+
}, LabelHTMLAttributes<HTMLLabelElement>>;
|
|
24
|
+
declare const Label: ({ children, className, forId, required, ...props }: Props) => JSX.Element;
|
|
25
|
+
export default Label;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HTMLProps, ReactNode } from "react";
|
|
2
|
+
import type { ClassName, PropsWithSpread } from "../../types";
|
|
3
|
+
export type Props = PropsWithSpread<{
|
|
4
|
+
/**
|
|
5
|
+
* The content of the link.
|
|
6
|
+
*/
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Optional class(es) to pass to the wrapping anchor element.
|
|
10
|
+
*/
|
|
11
|
+
className?: ClassName;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the link should have inverted styling.
|
|
14
|
+
*/
|
|
15
|
+
inverted?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the link should have soft styling.
|
|
18
|
+
*/
|
|
19
|
+
soft?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the link should have "back to top" styling.
|
|
22
|
+
*/
|
|
23
|
+
top?: boolean;
|
|
24
|
+
}, HTMLProps<HTMLAnchorElement>>;
|
|
25
|
+
/**
|
|
26
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Link](https://docs.vanillaframework.io/patterns/links/).
|
|
27
|
+
*
|
|
28
|
+
* Links are used to embed actions or pathways to more information, allowing users to click their way from page to page.
|
|
29
|
+
*/
|
|
30
|
+
declare const Link: ({ children, className, href, inverted, soft, top, ...props }: Props) => JSX.Element;
|
|
31
|
+
export default Link;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { HTMLProps, ReactNode } from "react";
|
|
2
|
+
import { ClassName, Headings, PropsWithSpread } from "../../types";
|
|
3
|
+
export type ListItem = ReactNode | PropsWithSpread<{
|
|
4
|
+
content: ReactNode;
|
|
5
|
+
}, HTMLProps<HTMLLIElement>>;
|
|
6
|
+
export type SteppedListItem = PropsWithSpread<{
|
|
7
|
+
content: ReactNode;
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
titleElement?: Headings;
|
|
10
|
+
}, HTMLProps<HTMLLIElement>>;
|
|
11
|
+
export type Props = {
|
|
12
|
+
/**
|
|
13
|
+
* Optional class(es) to pass to the wrapping element.
|
|
14
|
+
*/
|
|
15
|
+
className?: ClassName;
|
|
16
|
+
/**
|
|
17
|
+
* The list's items.
|
|
18
|
+
*/
|
|
19
|
+
items: ListItem[] | SteppedListItem[];
|
|
20
|
+
detailed?: boolean;
|
|
21
|
+
divided?: boolean;
|
|
22
|
+
inline?: boolean;
|
|
23
|
+
isDark?: boolean;
|
|
24
|
+
middot?: boolean;
|
|
25
|
+
split?: boolean;
|
|
26
|
+
stepped?: boolean;
|
|
27
|
+
stretch?: boolean;
|
|
28
|
+
ticked?: boolean;
|
|
29
|
+
} & Omit<HTMLProps<HTMLOListElement>, "type">;
|
|
30
|
+
/**
|
|
31
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [List](https://docs.vanillaframework.io/patterns/lists/).
|
|
32
|
+
*
|
|
33
|
+
* If you want to display lists in a way that is more visually distinctive than the standard `<ol>` and `<ul>`, we have 7 list styles at your disposal.
|
|
34
|
+
*/
|
|
35
|
+
declare const List: ({ className, detailed, divided, inline, isDark, items, middot, stretch, split, stepped, ticked, ...props }: Props) => JSX.Element;
|
|
36
|
+
export default List;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Loader";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import "./LoginPageLayout.scss";
|
|
3
|
+
export type Props = {
|
|
4
|
+
title: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
logo?: {
|
|
7
|
+
src: string;
|
|
8
|
+
title: string;
|
|
9
|
+
url: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* This is a layout component that is used to display a page with a title and children.
|
|
14
|
+
* The LoginPageLayout recommended usages are in the login flow like registration, sign up and error pages.
|
|
15
|
+
*/
|
|
16
|
+
declare const LoginPageLayout: FC<Props>;
|
|
17
|
+
export default LoginPageLayout;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { HTMLProps, ReactNode } from "react";
|
|
2
|
+
import type { ClassName, PropsWithSpread, SortDirection } from "../../types";
|
|
3
|
+
import type { TableProps } from "../Table";
|
|
4
|
+
import type { TableCellProps } from "../TableCell";
|
|
5
|
+
export type MainTableHeader = PropsWithSpread<{
|
|
6
|
+
/**
|
|
7
|
+
* The content of the table header.
|
|
8
|
+
*/
|
|
9
|
+
content?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Optional classes to apply to the table header.
|
|
12
|
+
*/
|
|
13
|
+
className?: ClassName;
|
|
14
|
+
/**
|
|
15
|
+
* A key to sort the rows by. It should match a key given to the row `sortData`.
|
|
16
|
+
*/
|
|
17
|
+
sortKey?: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Replacement value for data-heading if content is not a string.
|
|
20
|
+
*/
|
|
21
|
+
heading?: string;
|
|
22
|
+
}, HTMLProps<HTMLTableHeaderCellElement>>;
|
|
23
|
+
export type MainTableCell = PropsWithSpread<{
|
|
24
|
+
/**
|
|
25
|
+
* The content of the table cell.
|
|
26
|
+
*/
|
|
27
|
+
content?: ReactNode;
|
|
28
|
+
}, Omit<TableCellProps, "children">>;
|
|
29
|
+
export type MainTableRow = PropsWithSpread<{
|
|
30
|
+
/**
|
|
31
|
+
* Optional class(es) to apply to the row.
|
|
32
|
+
*/
|
|
33
|
+
className?: ClassName;
|
|
34
|
+
/**
|
|
35
|
+
* The columns in this row.
|
|
36
|
+
*/
|
|
37
|
+
columns?: MainTableCell[];
|
|
38
|
+
/**
|
|
39
|
+
* Whether this row should display as expanded.
|
|
40
|
+
*/
|
|
41
|
+
expanded?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The content to display when this column is expanded.
|
|
44
|
+
*/
|
|
45
|
+
expandedContent?: ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* An optional key to identify this table row.
|
|
48
|
+
*/
|
|
49
|
+
key?: number | string | null;
|
|
50
|
+
/**
|
|
51
|
+
* An object of data for use when sorting the rows. The keys of this object
|
|
52
|
+
* should match the header sort keys.
|
|
53
|
+
*/
|
|
54
|
+
sortData?: Record<string, unknown>;
|
|
55
|
+
}, HTMLProps<HTMLTableRowElement>>;
|
|
56
|
+
export type Props = PropsWithSpread<{
|
|
57
|
+
/**
|
|
58
|
+
* The default key to sort the rows by.
|
|
59
|
+
*/
|
|
60
|
+
defaultSort?: MainTableHeader["sortKey"];
|
|
61
|
+
/**
|
|
62
|
+
* The default direction the row data should be sorted by.
|
|
63
|
+
*/
|
|
64
|
+
defaultSortDirection?: SortDirection;
|
|
65
|
+
/**
|
|
66
|
+
* A message to display when there are no table rows.
|
|
67
|
+
*/
|
|
68
|
+
emptyStateMsg?: ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* The header columns for this table.
|
|
71
|
+
*/
|
|
72
|
+
headers?: MainTableHeader[];
|
|
73
|
+
/**
|
|
74
|
+
* A function that is called when the sort key is changed.
|
|
75
|
+
*/
|
|
76
|
+
onUpdateSort?: (sortKey: MainTableHeader["sortKey"]) => void;
|
|
77
|
+
/**
|
|
78
|
+
* A number of rows to paginate by.
|
|
79
|
+
*/
|
|
80
|
+
paginate?: number | null;
|
|
81
|
+
/**
|
|
82
|
+
* The rows to display in the table.
|
|
83
|
+
*/
|
|
84
|
+
rows?: MainTableRow[];
|
|
85
|
+
/**
|
|
86
|
+
* Whether this table should be sortable.
|
|
87
|
+
*/
|
|
88
|
+
sortable?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* A function to be used when sorting.
|
|
91
|
+
*/
|
|
92
|
+
sortFunction?: (a: MainTableRow, b: MainTableRow, currentSortDirection: SortDirection, currentSortKey: MainTableHeader["sortKey"]) => -1 | 0 | 1;
|
|
93
|
+
/**
|
|
94
|
+
* A hidden caption to display on the table for screen readers
|
|
95
|
+
*/
|
|
96
|
+
hiddenCaption?: string | null;
|
|
97
|
+
}, TableProps>;
|
|
98
|
+
/**
|
|
99
|
+
* This is a [React](https://reactjs.org/) component to support many table use cases.
|
|
100
|
+
*/
|
|
101
|
+
declare const MainTable: ({ defaultSort, defaultSortDirection, emptyStateMsg, expanding, headers, onUpdateSort, paginate, rows, responsive, sortable, sortFunction, hiddenCaption, ...props }: Props) => JSX.Element;
|
|
102
|
+
export default MainTable;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import type { HTMLProps, ReactNode } from "react";
|
|
3
|
+
import { ClassName, PropsWithSpread } from "../../types";
|
|
4
|
+
export type Props = PropsWithSpread<{
|
|
5
|
+
/**
|
|
6
|
+
* Buttons to display underneath the main modal content.
|
|
7
|
+
*/
|
|
8
|
+
buttonRow?: ReactNode | null;
|
|
9
|
+
/**
|
|
10
|
+
* Optional class(es) to apply to the wrapping element.
|
|
11
|
+
*/
|
|
12
|
+
className?: ClassName;
|
|
13
|
+
/**
|
|
14
|
+
* The content of the modal.
|
|
15
|
+
*/
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Function to handle closing the modal.
|
|
19
|
+
*/
|
|
20
|
+
close?: () => void | null;
|
|
21
|
+
/**
|
|
22
|
+
* The title of the modal.
|
|
23
|
+
*/
|
|
24
|
+
title?: ReactNode | null;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the button click event should propagate.
|
|
27
|
+
*/
|
|
28
|
+
shouldPropagateClickEvent?: boolean;
|
|
29
|
+
}, HTMLProps<HTMLDivElement>>;
|
|
30
|
+
/**
|
|
31
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Modal](https://docs.vanillaframework.io/patterns/modal/).
|
|
32
|
+
*
|
|
33
|
+
* The modal component can be used to overlay an area of the screen which can contain a prompt, dialog or interaction.
|
|
34
|
+
*/
|
|
35
|
+
export declare const Modal: ({ buttonRow, children, className, close, title, shouldPropagateClickEvent, ...wrapperProps }: Props) => ReactElement;
|
|
36
|
+
export default Modal;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ReactNode, HTMLProps } from "react";
|
|
2
|
+
import { TableCellProps, TableHeaderProps, TableRowProps } from "react-table";
|
|
3
|
+
import type { Column, UseTableOptions, Cell, Row, HeaderGroup } from "react-table";
|
|
4
|
+
import { PropsWithSpread } from "../../types";
|
|
5
|
+
export type Props<D extends Record<string, unknown>> = PropsWithSpread<{
|
|
6
|
+
/**
|
|
7
|
+
* The columns of the table.
|
|
8
|
+
*/
|
|
9
|
+
columns: Column<D>[];
|
|
10
|
+
/**
|
|
11
|
+
* The data of the table.
|
|
12
|
+
*/
|
|
13
|
+
data: D[];
|
|
14
|
+
/**
|
|
15
|
+
* A message to display if data is empty.
|
|
16
|
+
*/
|
|
17
|
+
emptyMsg?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional extra row to display underneath the main table content.
|
|
20
|
+
*/
|
|
21
|
+
footer?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Optional argument to make the tables be sortable and use the `useSortBy` plugin.
|
|
24
|
+
*/
|
|
25
|
+
sortable?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* This function is used to resolve any props needed for a particular column's header cell.
|
|
28
|
+
*/
|
|
29
|
+
getHeaderProps?: (header: HeaderGroup<D>) => Partial<TableHeaderProps & HTMLProps<HTMLTableHeaderCellElement>>;
|
|
30
|
+
/**
|
|
31
|
+
* This function is used to resolve any props needed for a particular row.
|
|
32
|
+
*/
|
|
33
|
+
getRowProps?: (row: Row<D>) => Partial<TableRowProps & HTMLProps<HTMLTableRowElement>>;
|
|
34
|
+
/**
|
|
35
|
+
* This function is used to resolve any props needed for a particular cell.
|
|
36
|
+
*/
|
|
37
|
+
getCellProps?: (cell: Cell<D>) => Partial<TableCellProps & HTMLProps<HTMLTableCellElement>>;
|
|
38
|
+
getRowId?: UseTableOptions<D>["getRowId"];
|
|
39
|
+
/**
|
|
40
|
+
* The column that the table will be sorted by (this should match a cell selector).
|
|
41
|
+
*/
|
|
42
|
+
initialSortColumn?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The direction of the initial sort.
|
|
45
|
+
*/
|
|
46
|
+
initialSortDirection?: "ascending" | "descending";
|
|
47
|
+
/**
|
|
48
|
+
* Whether the sort by needs to be reset after each data change.
|
|
49
|
+
*/
|
|
50
|
+
autoResetSortBy?: boolean;
|
|
51
|
+
}, HTMLProps<HTMLTableElement>>;
|
|
52
|
+
/**
|
|
53
|
+
This is a [React](https://reactjs.org/) component to support many table use cases.
|
|
54
|
+
|
|
55
|
+
ModularTable components accepts `columns` and `data` arguments in the same format as [`useTable`](https://react-table.tanstack.com/docs/api/useTable) hook of the ReactTable library.
|
|
56
|
+
|
|
57
|
+
`columns` - The core columns configuration object for the entire table. https://react-table.tanstack.com/docs/api/useTable#column-options
|
|
58
|
+
`data` - The data array that you want to display on the table.
|
|
59
|
+
### Important note!
|
|
60
|
+
Values passed to both of these params have to me memoized (for example via{" "}
|
|
61
|
+
<code>React.useMemo</code>). Memoization ensures that our data isn't recreated
|
|
62
|
+
on every render. If we didn't use <code>React.useMemo</code>, the table would
|
|
63
|
+
think it was receiving new data on every render and attempt to recalulate a
|
|
64
|
+
lot of logic every single time.
|
|
65
|
+
|
|
66
|
+
#### Custom column options
|
|
67
|
+
|
|
68
|
+
In addition to standard column propeties from [`useTable`](https://react-table.tanstack.com/docs/api/useTable) `ModularTable` accepts some custom properties.
|
|
69
|
+
|
|
70
|
+
##### Class names
|
|
71
|
+
|
|
72
|
+
Custom `className` can be used to provide a specific CSS class name that will be added to all cells in given column.
|
|
73
|
+
You can also provide `getHeaderProps`, `getRowProps` and `getCellProps` to resolve additional custom props for a specific element. More on this in [`useTable - cell properties`](https://react-table.tanstack.com/docs/api/useTable#cell-properties).
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
getCellProps={({ value, column }) => ({
|
|
77
|
+
className: `table__cell--${column.id} ${value === "1 minute" ? "p-heading--5" : ""}`,
|
|
78
|
+
})}
|
|
79
|
+
columns = {
|
|
80
|
+
Header: "Hidden on mobile",
|
|
81
|
+
accessor: "example",
|
|
82
|
+
className: "u-hide--small"
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
##### Icons
|
|
87
|
+
|
|
88
|
+
To show an icon in the cells of a column `getCellIcon` function should be defined. The function takes a cell data as an argument and should return one of built in icons (from the `ICONS` const), a string with a custom icon name, or `false` if no icon should be shown.
|
|
89
|
+
|
|
90
|
+
The `ICONS` const contains all [the Vanilla built in icons](https://vanillaframework.io/docs/patterns/icons) such as "plus", "minus", "success", "error", etc.
|
|
91
|
+
|
|
92
|
+
Product specific icons can be used as well, assuming that the product provides the necessary CSS styling and the icon follows the Vanilla naming convention `p-icon--{name}`.
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
columns = {
|
|
96
|
+
Header: "With icons",
|
|
97
|
+
accessor: "status",
|
|
98
|
+
getCellIcon: ({ value }) => {
|
|
99
|
+
return value === "released" ? ICONS.success : false;
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
```
|
|
103
|
+
*/
|
|
104
|
+
declare function ModularTable<D extends Record<string, unknown>>({ data, columns, emptyMsg, footer, sortable, getHeaderProps, getRowProps, getCellProps, getRowId, initialSortColumn, initialSortDirection, autoResetSortBy, ...props }: Props<D>): JSX.Element;
|
|
105
|
+
export default ModularTable;
|