@canonical/react-components 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -10
- package/dist-esm/components/Accordion/Accordion.js +0 -52
- package/dist-esm/components/Accordion/AccordionSection/AccordionSection.js +0 -47
- package/dist-esm/components/Accordion/AccordionSection/index.js +0 -1
- package/dist-esm/components/Accordion/index.js +0 -1
- package/dist-esm/components/ActionButton/ActionButton.js +0 -106
- package/dist-esm/components/ActionButton/index.js +0 -1
- package/dist-esm/components/ApplicationLayout/AppAside/AppAside.js +0 -29
- package/dist-esm/components/ApplicationLayout/AppAside/index.js +0 -1
- package/dist-esm/components/ApplicationLayout/AppMain/AppMain.js +0 -21
- package/dist-esm/components/ApplicationLayout/AppMain/index.js +0 -1
- package/dist-esm/components/ApplicationLayout/AppNavigation/AppNavigation.js +0 -31
- package/dist-esm/components/ApplicationLayout/AppNavigation/index.js +0 -1
- package/dist-esm/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.js +0 -24
- package/dist-esm/components/ApplicationLayout/AppNavigationBar/index.js +0 -1
- package/dist-esm/components/ApplicationLayout/AppStatus/AppStatus.js +0 -21
- package/dist-esm/components/ApplicationLayout/AppStatus/index.js +0 -1
- package/dist-esm/components/ApplicationLayout/Application/Application.js +0 -22
- package/dist-esm/components/ApplicationLayout/Application/index.js +0 -1
- package/dist-esm/components/ApplicationLayout/ApplicationLayout.js +0 -113
- package/dist-esm/components/ApplicationLayout/index.js +0 -7
- package/dist-esm/components/ArticlePagination/ArticlePagination.js +0 -39
- package/dist-esm/components/ArticlePagination/index.js +0 -1
- package/dist-esm/components/Badge/Badge.js +0 -64
- package/dist-esm/components/Badge/index.js +0 -1
- package/dist-esm/components/Button/Button.js +0 -55
- package/dist-esm/components/Button/index.js +0 -1
- package/dist-esm/components/Card/Card.js +0 -45
- package/dist-esm/components/Card/index.js +0 -1
- package/dist-esm/components/CheckboxInput/CheckableInput/CheckableInput.js +0 -35
- package/dist-esm/components/CheckboxInput/CheckableInput/index.js +0 -1
- package/dist-esm/components/CheckboxInput/CheckboxInput.js +0 -24
- package/dist-esm/components/CheckboxInput/index.js +0 -1
- package/dist-esm/components/Chip/Chip.js +0 -81
- package/dist-esm/components/Chip/index.js +0 -1
- package/dist-esm/components/Code/Code.js +0 -49
- package/dist-esm/components/Code/index.js +0 -1
- package/dist-esm/components/CodeSnippet/CodeSnippet.js +0 -28
- package/dist-esm/components/CodeSnippet/CodeSnippetBlock.js +0 -64
- package/dist-esm/components/CodeSnippet/CodeSnippetDropdown.js +0 -27
- package/dist-esm/components/CodeSnippet/index.js +0 -2
- package/dist-esm/components/Col/Col.js +0 -38
- package/dist-esm/components/Col/index.js +0 -1
- package/dist-esm/components/ConfirmationButton/ConfirmationButton.js +0 -63
- package/dist-esm/components/ConfirmationButton/index.js +0 -1
- package/dist-esm/components/ConfirmationModal/ConfirmationModal.js +0 -47
- package/dist-esm/components/ConfirmationModal/index.js +0 -1
- package/dist-esm/components/ContextualMenu/ContextualMenu.js +0 -215
- package/dist-esm/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.js +0 -249
- package/dist-esm/components/ContextualMenu/ContextualMenuDropdown/index.js +0 -1
- package/dist-esm/components/ContextualMenu/index.js +0 -1
- package/dist-esm/components/EmptyState/EmptyState.js +0 -28
- package/dist-esm/components/EmptyState/index.js +0 -1
- package/dist-esm/components/Field/Field.js +0 -126
- package/dist-esm/components/Field/index.js +0 -1
- package/dist-esm/components/Form/Form.js +0 -28
- package/dist-esm/components/Form/index.js +0 -1
- package/dist-esm/components/FormikField/FormikField.js +0 -33
- package/dist-esm/components/FormikField/index.js +0 -1
- package/dist-esm/components/Icon/Icon.js +0 -61
- package/dist-esm/components/Icon/index.js +0 -1
- package/dist-esm/components/Input/Input.js +0 -103
- package/dist-esm/components/Input/index.js +0 -1
- package/dist-esm/components/Label/Label.js +0 -27
- package/dist-esm/components/Label/index.js +0 -1
- package/dist-esm/components/Link/Link.js +0 -37
- package/dist-esm/components/Link/index.js +0 -1
- package/dist-esm/components/List/List.js +0 -110
- package/dist-esm/components/List/index.js +0 -1
- package/dist-esm/components/Loader/Loader.js +0 -14
- package/dist-esm/components/Loader/index.js +0 -1
- package/dist-esm/components/LoginPageLayout/LoginPageLayout.js +0 -63
- package/dist-esm/components/LoginPageLayout/index.js +0 -1
- package/dist-esm/components/MainTable/MainTable.js +0 -211
- package/dist-esm/components/MainTable/index.js +0 -1
- package/dist-esm/components/Modal/Modal.js +0 -135
- package/dist-esm/components/Modal/index.js +0 -1
- package/dist-esm/components/ModularTable/ModularTable.js +0 -166
- package/dist-esm/components/ModularTable/index.js +0 -1
- package/dist-esm/components/MultiSelect/FadeInDown/FadeInDown.js +0 -25
- package/dist-esm/components/MultiSelect/FadeInDown/index.js +0 -1
- package/dist-esm/components/MultiSelect/MultiSelect.js +0 -308
- package/dist-esm/components/MultiSelect/index.js +0 -1
- package/dist-esm/components/Navigation/Navigation.js +0 -215
- package/dist-esm/components/Navigation/NavigationLink/NavigationLink.js +0 -58
- package/dist-esm/components/Navigation/NavigationLink/index.js +0 -1
- package/dist-esm/components/Navigation/NavigationMenu/NavigationMenu.js +0 -57
- package/dist-esm/components/Navigation/NavigationMenu/index.js +0 -1
- package/dist-esm/components/Navigation/index.js +0 -1
- package/dist-esm/components/Navigation/types.js +0 -1
- package/dist-esm/components/Notification/Notification.js +0 -119
- package/dist-esm/components/Notification/index.js +0 -1
- package/dist-esm/components/NotificationProvider/NotificationProvider.js +0 -83
- package/dist-esm/components/NotificationProvider/index.js +0 -2
- package/dist-esm/components/NotificationProvider/messageBuilder.js +0 -31
- package/dist-esm/components/NotificationProvider/types.js +0 -1
- package/dist-esm/components/Pagination/Pagination.js +0 -173
- package/dist-esm/components/Pagination/PaginationButton/PaginationButton.js +0 -31
- package/dist-esm/components/Pagination/PaginationButton/index.js +0 -1
- package/dist-esm/components/Pagination/PaginationItem/PaginationItem.js +0 -20
- package/dist-esm/components/Pagination/PaginationItem/index.js +0 -1
- package/dist-esm/components/Pagination/index.js +0 -1
- package/dist-esm/components/Panel/Panel.js +0 -89
- package/dist-esm/components/Panel/index.js +0 -1
- package/dist-esm/components/PasswordToggle/PasswordToggle.js +0 -90
- package/dist-esm/components/PasswordToggle/index.js +0 -1
- package/dist-esm/components/RadioInput/RadioInput.js +0 -22
- package/dist-esm/components/RadioInput/index.js +0 -1
- package/dist-esm/components/Row/Row.js +0 -22
- package/dist-esm/components/Row/index.js +0 -1
- package/dist-esm/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.js +0 -107
- package/dist-esm/components/SearchAndFilter/FilterPanelSection/index.js +0 -1
- package/dist-esm/components/SearchAndFilter/SearchAndFilter.js +0 -286
- package/dist-esm/components/SearchAndFilter/index.js +0 -1
- package/dist-esm/components/SearchAndFilter/types.js +0 -1
- package/dist-esm/components/SearchAndFilter/utils.js +0 -22
- package/dist-esm/components/SearchBox/SearchBox.js +0 -95
- package/dist-esm/components/SearchBox/index.js +0 -1
- package/dist-esm/components/Select/Select.js +0 -84
- package/dist-esm/components/Select/index.js +0 -1
- package/dist-esm/components/SideNavigation/SideNavigation.js +0 -89
- package/dist-esm/components/SideNavigation/SideNavigationBase/SideNavigationBase.js +0 -31
- package/dist-esm/components/SideNavigation/SideNavigationBase/index.js +0 -1
- package/dist-esm/components/SideNavigation/SideNavigationItem/SideNavigationItem.js +0 -32
- package/dist-esm/components/SideNavigation/SideNavigationItem/index.js +0 -1
- package/dist-esm/components/SideNavigation/SideNavigationLink/SideNavigationLink.js +0 -25
- package/dist-esm/components/SideNavigation/SideNavigationLink/index.js +0 -1
- package/dist-esm/components/SideNavigation/SideNavigationText/SideNavigationText.js +0 -20
- package/dist-esm/components/SideNavigation/SideNavigationText/index.js +0 -1
- package/dist-esm/components/SideNavigation/index.js +0 -4
- package/dist-esm/components/Slider/Slider.js +0 -83
- package/dist-esm/components/Slider/index.js +0 -1
- package/dist-esm/components/Spinner/Spinner.js +0 -36
- package/dist-esm/components/Spinner/index.js +0 -1
- package/dist-esm/components/StatusLabel/StatusLabel.js +0 -36
- package/dist-esm/components/StatusLabel/index.js +0 -1
- package/dist-esm/components/Strip/Strip.js +0 -50
- package/dist-esm/components/Strip/index.js +0 -1
- package/dist-esm/components/SummaryButton/SummaryButton.js +0 -28
- package/dist-esm/components/SummaryButton/index.js +0 -1
- package/dist-esm/components/Switch/Switch.js +0 -28
- package/dist-esm/components/Switch/index.js +0 -1
- package/dist-esm/components/Table/Table.js +0 -23
- package/dist-esm/components/Table/index.js +0 -1
- package/dist-esm/components/TableCell/TableCell.js +0 -26
- package/dist-esm/components/TableCell/index.js +0 -1
- package/dist-esm/components/TableHeader/TableHeader.js +0 -17
- package/dist-esm/components/TableHeader/index.js +0 -1
- package/dist-esm/components/TablePagination/TablePagination.js +0 -104
- package/dist-esm/components/TablePagination/TablePaginationControls/TablePaginationControls.js +0 -120
- package/dist-esm/components/TablePagination/TablePaginationControls/index.js +0 -1
- package/dist-esm/components/TablePagination/index.js +0 -1
- package/dist-esm/components/TablePagination/utils.js +0 -67
- package/dist-esm/components/TableRow/TableRow.js +0 -15
- package/dist-esm/components/TableRow/index.js +0 -1
- package/dist-esm/components/Tabs/Tabs.js +0 -42
- package/dist-esm/components/Tabs/index.js +0 -1
- package/dist-esm/components/Textarea/Textarea.js +0 -115
- package/dist-esm/components/Textarea/index.js +0 -1
- package/dist-esm/components/Tooltip/Tooltip.js +0 -245
- package/dist-esm/components/Tooltip/index.js +0 -1
- package/dist-esm/enums.js +0 -8
- package/dist-esm/hooks/index.js +0 -8
- package/dist-esm/hooks/useId.js +0 -13
- package/dist-esm/hooks/useListener.js +0 -51
- package/dist-esm/hooks/useOnClickOutside.js +0 -38
- package/dist-esm/hooks/useOnEscapePressed.js +0 -25
- package/dist-esm/hooks/usePagination.js +0 -45
- package/dist-esm/hooks/usePrevious.js +0 -16
- package/dist-esm/hooks/useThrottle.js +0 -49
- package/dist-esm/hooks/useWindowFitment.js +0 -109
- package/dist-esm/index.js +0 -69
- package/dist-esm/types/index.js +0 -1
- package/dist-esm/types/react-table-config.d.js +0 -1
- package/dist-esm/utils.js +0 -41
- /package/{dist-types → dist}/components/Accordion/Accordion.d.ts +0 -0
- /package/{dist-types → dist}/components/Accordion/AccordionSection/AccordionSection.d.ts +0 -0
- /package/{dist-types → dist}/components/Accordion/AccordionSection/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Accordion/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ActionButton/ActionButton.d.ts +0 -0
- /package/{dist-types → dist}/components/ActionButton/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/AppAside/AppAside.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/AppAside/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/AppMain/AppMain.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/AppMain/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/AppNavigation/AppNavigation.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/AppNavigation/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/AppNavigationBar/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/AppStatus/AppStatus.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/AppStatus/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/Application/Application.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/Application/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/ApplicationLayout.d.ts +0 -0
- /package/{dist-types → dist}/components/ApplicationLayout/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ArticlePagination/ArticlePagination.d.ts +0 -0
- /package/{dist-types → dist}/components/ArticlePagination/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Badge/Badge.d.ts +0 -0
- /package/{dist-types → dist}/components/Badge/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Button/Button.d.ts +0 -0
- /package/{dist-types → dist}/components/Button/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Card/Card.d.ts +0 -0
- /package/{dist-types → dist}/components/Card/index.d.ts +0 -0
- /package/{dist-types → dist}/components/CheckboxInput/CheckableInput/CheckableInput.d.ts +0 -0
- /package/{dist-types → dist}/components/CheckboxInput/CheckableInput/index.d.ts +0 -0
- /package/{dist-types → dist}/components/CheckboxInput/CheckboxInput.d.ts +0 -0
- /package/{dist-types → dist}/components/CheckboxInput/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Chip/Chip.d.ts +0 -0
- /package/{dist-types → dist}/components/Chip/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Code/Code.d.ts +0 -0
- /package/{dist-types → dist}/components/Code/index.d.ts +0 -0
- /package/{dist-types → dist}/components/CodeSnippet/CodeSnippet.d.ts +0 -0
- /package/{dist-types → dist}/components/CodeSnippet/CodeSnippetBlock.d.ts +0 -0
- /package/{dist-types → dist}/components/CodeSnippet/CodeSnippetDropdown.d.ts +0 -0
- /package/{dist-types → dist}/components/CodeSnippet/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Col/Col.d.ts +0 -0
- /package/{dist-types → dist}/components/Col/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ConfirmationButton/ConfirmationButton.d.ts +0 -0
- /package/{dist-types → dist}/components/ConfirmationButton/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ConfirmationModal/ConfirmationModal.d.ts +0 -0
- /package/{dist-types → dist}/components/ConfirmationModal/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ContextualMenu/ContextualMenu.d.ts +0 -0
- /package/{dist-types → dist}/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.d.ts +0 -0
- /package/{dist-types → dist}/components/ContextualMenu/ContextualMenuDropdown/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ContextualMenu/index.d.ts +0 -0
- /package/{dist-types → dist}/components/EmptyState/EmptyState.d.ts +0 -0
- /package/{dist-types → dist}/components/EmptyState/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Field/Field.d.ts +0 -0
- /package/{dist-types → dist}/components/Field/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Form/Form.d.ts +0 -0
- /package/{dist-types → dist}/components/Form/index.d.ts +0 -0
- /package/{dist-types → dist}/components/FormikField/FormikField.d.ts +0 -0
- /package/{dist-types → dist}/components/FormikField/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Icon/Icon.d.ts +0 -0
- /package/{dist-types → dist}/components/Icon/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Input/Input.d.ts +0 -0
- /package/{dist-types → dist}/components/Input/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Label/Label.d.ts +0 -0
- /package/{dist-types → dist}/components/Label/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Link/Link.d.ts +0 -0
- /package/{dist-types → dist}/components/Link/index.d.ts +0 -0
- /package/{dist-types → dist}/components/List/List.d.ts +0 -0
- /package/{dist-types → dist}/components/List/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Loader/Loader.d.ts +0 -0
- /package/{dist-types → dist}/components/Loader/index.d.ts +0 -0
- /package/{dist-types → dist}/components/LoginPageLayout/LoginPageLayout.d.ts +0 -0
- /package/{dist-types → dist}/components/LoginPageLayout/index.d.ts +0 -0
- /package/{dist-types → dist}/components/MainTable/MainTable.d.ts +0 -0
- /package/{dist-types → dist}/components/MainTable/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Modal/Modal.d.ts +0 -0
- /package/{dist-types → dist}/components/Modal/index.d.ts +0 -0
- /package/{dist-types → dist}/components/ModularTable/ModularTable.d.ts +0 -0
- /package/{dist-types → dist}/components/ModularTable/index.d.ts +0 -0
- /package/{dist-types → dist}/components/MultiSelect/FadeInDown/FadeInDown.d.ts +0 -0
- /package/{dist-types → dist}/components/MultiSelect/FadeInDown/index.d.ts +0 -0
- /package/{dist-types → dist}/components/MultiSelect/MultiSelect.d.ts +0 -0
- /package/{dist-types → dist}/components/MultiSelect/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Navigation/Navigation.d.ts +0 -0
- /package/{dist-types → dist}/components/Navigation/NavigationLink/NavigationLink.d.ts +0 -0
- /package/{dist-types → dist}/components/Navigation/NavigationLink/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Navigation/NavigationMenu/NavigationMenu.d.ts +0 -0
- /package/{dist-types → dist}/components/Navigation/NavigationMenu/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Navigation/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Navigation/types.d.ts +0 -0
- /package/{dist-types → dist}/components/Notification/Notification.d.ts +0 -0
- /package/{dist-types → dist}/components/Notification/index.d.ts +0 -0
- /package/{dist-types → dist}/components/NotificationProvider/NotificationProvider.d.ts +0 -0
- /package/{dist-types → dist}/components/NotificationProvider/index.d.ts +0 -0
- /package/{dist-types → dist}/components/NotificationProvider/messageBuilder.d.ts +0 -0
- /package/{dist-types → dist}/components/NotificationProvider/types.d.ts +0 -0
- /package/{dist-types → dist}/components/Pagination/Pagination.d.ts +0 -0
- /package/{dist-types → dist}/components/Pagination/PaginationButton/PaginationButton.d.ts +0 -0
- /package/{dist-types → dist}/components/Pagination/PaginationButton/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Pagination/PaginationItem/PaginationItem.d.ts +0 -0
- /package/{dist-types → dist}/components/Pagination/PaginationItem/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Pagination/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Panel/Panel.d.ts +0 -0
- /package/{dist-types → dist}/components/Panel/index.d.ts +0 -0
- /package/{dist-types → dist}/components/PasswordToggle/PasswordToggle.d.ts +0 -0
- /package/{dist-types → dist}/components/PasswordToggle/index.d.ts +0 -0
- /package/{dist-types → dist}/components/RadioInput/RadioInput.d.ts +0 -0
- /package/{dist-types → dist}/components/RadioInput/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Row/Row.d.ts +0 -0
- /package/{dist-types → dist}/components/Row/index.d.ts +0 -0
- /package/{dist-types → dist}/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.d.ts +0 -0
- /package/{dist-types → dist}/components/SearchAndFilter/FilterPanelSection/index.d.ts +0 -0
- /package/{dist-types → dist}/components/SearchAndFilter/SearchAndFilter.d.ts +0 -0
- /package/{dist-types → dist}/components/SearchAndFilter/index.d.ts +0 -0
- /package/{dist-types → dist}/components/SearchAndFilter/types.d.ts +0 -0
- /package/{dist-types → dist}/components/SearchAndFilter/utils.d.ts +0 -0
- /package/{dist-types → dist}/components/SearchBox/SearchBox.d.ts +0 -0
- /package/{dist-types → dist}/components/SearchBox/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Select/Select.d.ts +0 -0
- /package/{dist-types → dist}/components/Select/index.d.ts +0 -0
- /package/{dist-types → dist}/components/SideNavigation/SideNavigation.d.ts +0 -0
- /package/{dist-types → dist}/components/SideNavigation/SideNavigationBase/SideNavigationBase.d.ts +0 -0
- /package/{dist-types → dist}/components/SideNavigation/SideNavigationBase/index.d.ts +0 -0
- /package/{dist-types → dist}/components/SideNavigation/SideNavigationItem/SideNavigationItem.d.ts +0 -0
- /package/{dist-types → dist}/components/SideNavigation/SideNavigationItem/index.d.ts +0 -0
- /package/{dist-types → dist}/components/SideNavigation/SideNavigationLink/SideNavigationLink.d.ts +0 -0
- /package/{dist-types → dist}/components/SideNavigation/SideNavigationLink/index.d.ts +0 -0
- /package/{dist-types → dist}/components/SideNavigation/SideNavigationText/SideNavigationText.d.ts +0 -0
- /package/{dist-types → dist}/components/SideNavigation/SideNavigationText/index.d.ts +0 -0
- /package/{dist-types → dist}/components/SideNavigation/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Slider/Slider.d.ts +0 -0
- /package/{dist-types → dist}/components/Slider/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Spinner/Spinner.d.ts +0 -0
- /package/{dist-types → dist}/components/Spinner/index.d.ts +0 -0
- /package/{dist-types → dist}/components/StatusLabel/StatusLabel.d.ts +0 -0
- /package/{dist-types → dist}/components/StatusLabel/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Strip/Strip.d.ts +0 -0
- /package/{dist-types → dist}/components/Strip/index.d.ts +0 -0
- /package/{dist-types → dist}/components/SummaryButton/SummaryButton.d.ts +0 -0
- /package/{dist-types → dist}/components/SummaryButton/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Switch/Switch.d.ts +0 -0
- /package/{dist-types → dist}/components/Switch/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Table/Table.d.ts +0 -0
- /package/{dist-types → dist}/components/Table/index.d.ts +0 -0
- /package/{dist-types → dist}/components/TableCell/TableCell.d.ts +0 -0
- /package/{dist-types → dist}/components/TableCell/index.d.ts +0 -0
- /package/{dist-types → dist}/components/TableHeader/TableHeader.d.ts +0 -0
- /package/{dist-types → dist}/components/TableHeader/index.d.ts +0 -0
- /package/{dist-types → dist}/components/TablePagination/TablePagination.d.ts +0 -0
- /package/{dist-types → dist}/components/TablePagination/TablePaginationControls/TablePaginationControls.d.ts +0 -0
- /package/{dist-types → dist}/components/TablePagination/TablePaginationControls/index.d.ts +0 -0
- /package/{dist-types → dist}/components/TablePagination/index.d.ts +0 -0
- /package/{dist-types → dist}/components/TablePagination/utils.d.ts +0 -0
- /package/{dist-types → dist}/components/TableRow/TableRow.d.ts +0 -0
- /package/{dist-types → dist}/components/TableRow/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Tabs/Tabs.d.ts +0 -0
- /package/{dist-types → dist}/components/Tabs/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Textarea/Textarea.d.ts +0 -0
- /package/{dist-types → dist}/components/Textarea/index.d.ts +0 -0
- /package/{dist-types → dist}/components/Tooltip/Tooltip.d.ts +0 -0
- /package/{dist-types → dist}/components/Tooltip/index.d.ts +0 -0
- /package/{dist-types → dist}/enums.d.ts +0 -0
- /package/{dist-types → dist}/hooks/index.d.ts +0 -0
- /package/{dist-types → dist}/hooks/useId.d.ts +0 -0
- /package/{dist-types → dist}/hooks/useListener.d.ts +0 -0
- /package/{dist-types → dist}/hooks/useOnClickOutside.d.ts +0 -0
- /package/{dist-types → dist}/hooks/useOnEscapePressed.d.ts +0 -0
- /package/{dist-types → dist}/hooks/usePagination.d.ts +0 -0
- /package/{dist-types → dist}/hooks/usePrevious.d.ts +0 -0
- /package/{dist-types → dist}/hooks/useThrottle.d.ts +0 -0
- /package/{dist-types → dist}/hooks/useWindowFitment.d.ts +0 -0
- /package/{dist-types → dist}/index.d.ts +0 -0
- /package/{dist-types → dist}/types/index.d.ts +0 -0
- /package/{dist-types → dist}/utils.d.ts +0 -0
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
var _excluded = ["content", "sortKey"],
|
|
2
|
-
_excluded2 = ["columns", "expanded", "expandedContent", "key", "sortData"],
|
|
3
|
-
_excluded3 = ["content"],
|
|
4
|
-
_excluded4 = ["defaultSort", "defaultSortDirection", "emptyStateMsg", "expanding", "headers", "onUpdateSort", "paginate", "rows", "responsive", "sortable", "sortFunction", "hiddenCaption"];
|
|
5
|
-
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); }
|
|
6
|
-
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; }
|
|
7
|
-
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; }
|
|
8
|
-
import React, { useEffect, useMemo, useState } from "react";
|
|
9
|
-
import Pagination from "../Pagination";
|
|
10
|
-
import Table from "../Table";
|
|
11
|
-
import TableRow from "../TableRow";
|
|
12
|
-
import TableHeader from "../TableHeader";
|
|
13
|
-
import TableCell from "../TableCell";
|
|
14
|
-
import { usePagination } from "../../hooks";
|
|
15
|
-
var updateSort = (setSortKey, setSortDirection, sortKey, sortDirection) => {
|
|
16
|
-
var newDirection = null;
|
|
17
|
-
if (sortDirection === "none") {
|
|
18
|
-
newDirection = "ascending";
|
|
19
|
-
} else if (sortDirection === "ascending") {
|
|
20
|
-
newDirection = "descending";
|
|
21
|
-
} else {
|
|
22
|
-
sortKey = null;
|
|
23
|
-
}
|
|
24
|
-
setSortKey(sortKey);
|
|
25
|
-
setSortDirection(newDirection);
|
|
26
|
-
};
|
|
27
|
-
var generateHeaders = (currentSortKey, currentSortDirection, expanding, headers, sortable, setSortKey, setSortDirection) => {
|
|
28
|
-
var headerItems = headers.map((_ref, index) => {
|
|
29
|
-
var {
|
|
30
|
-
content,
|
|
31
|
-
sortKey
|
|
32
|
-
} = _ref,
|
|
33
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
-
var sortDirection;
|
|
35
|
-
if (sortable && sortKey) {
|
|
36
|
-
if (currentSortKey === sortKey) {
|
|
37
|
-
sortDirection = currentSortDirection;
|
|
38
|
-
} else {
|
|
39
|
-
sortDirection = "none";
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return /*#__PURE__*/React.createElement(TableHeader, _extends({
|
|
43
|
-
key: index,
|
|
44
|
-
sort: sortDirection,
|
|
45
|
-
onClick: sortable && sortKey ? updateSort.bind(this, setSortKey, setSortDirection, sortKey, sortDirection) : undefined
|
|
46
|
-
}, props), content);
|
|
47
|
-
});
|
|
48
|
-
// When there is expanding content then provide an extra hidden header to
|
|
49
|
-
// account for the extra cell in the body rows.
|
|
50
|
-
return /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement(TableRow, null, headerItems, expanding && /*#__PURE__*/React.createElement(TableHeader, {
|
|
51
|
-
"aria-hidden": "true"
|
|
52
|
-
})));
|
|
53
|
-
};
|
|
54
|
-
var generateRows = _ref2 => {
|
|
55
|
-
var {
|
|
56
|
-
rows,
|
|
57
|
-
headers,
|
|
58
|
-
responsive,
|
|
59
|
-
expanding
|
|
60
|
-
} = _ref2;
|
|
61
|
-
return rows.map((_ref3, index) => {
|
|
62
|
-
var {
|
|
63
|
-
columns,
|
|
64
|
-
expanded,
|
|
65
|
-
expandedContent,
|
|
66
|
-
key,
|
|
67
|
-
sortData: _
|
|
68
|
-
} = _ref3,
|
|
69
|
-
rowProps = _objectWithoutProperties(_ref3, _excluded2);
|
|
70
|
-
var cellItems = columns === null || columns === void 0 ? void 0 : columns.map((_ref4, index) => {
|
|
71
|
-
var {
|
|
72
|
-
content
|
|
73
|
-
} = _ref4,
|
|
74
|
-
cellProps = _objectWithoutProperties(_ref4, _excluded3);
|
|
75
|
-
var headerContent = headers && headers[index]["content"];
|
|
76
|
-
var headerReplacement = headers && headers[index]["heading"];
|
|
77
|
-
if (responsive) {
|
|
78
|
-
cellProps["data-heading"] = typeof headerContent === "string" ? headerContent : headerReplacement;
|
|
79
|
-
}
|
|
80
|
-
return /*#__PURE__*/React.createElement(TableCell, _extends({
|
|
81
|
-
key: index
|
|
82
|
-
}, cellProps), content);
|
|
83
|
-
});
|
|
84
|
-
// if key was not provided as a prop, use row's index instead
|
|
85
|
-
if (key === null || typeof key === "undefined") {
|
|
86
|
-
key = index;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// The expanding cell is alway created to match the correct number of
|
|
90
|
-
// table cells in rows that do have expanding content.
|
|
91
|
-
return /*#__PURE__*/React.createElement(TableRow, _extends({
|
|
92
|
-
key: key
|
|
93
|
-
}, rowProps), cellItems, expanding && /*#__PURE__*/React.createElement(TableCell, {
|
|
94
|
-
expanding: true,
|
|
95
|
-
hidden: !expanded
|
|
96
|
-
}, expandedContent));
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
var sortRows = _ref5 => {
|
|
100
|
-
var {
|
|
101
|
-
currentSortDirection,
|
|
102
|
-
currentSortKey,
|
|
103
|
-
rows,
|
|
104
|
-
sortable,
|
|
105
|
-
sortFunction
|
|
106
|
-
} = _ref5;
|
|
107
|
-
if (!rows) {
|
|
108
|
-
return [];
|
|
109
|
-
}
|
|
110
|
-
// Clone the rows so we can restore the original order.
|
|
111
|
-
var sortedRows = [...rows];
|
|
112
|
-
if (sortable && currentSortKey) {
|
|
113
|
-
if (!sortFunction) {
|
|
114
|
-
sortFunction = (a, b) => {
|
|
115
|
-
if (!a.sortData || !b.sortData) {
|
|
116
|
-
return 0;
|
|
117
|
-
}
|
|
118
|
-
if (a.sortData[currentSortKey] > b.sortData[currentSortKey]) {
|
|
119
|
-
return currentSortDirection === "ascending" ? 1 : -1;
|
|
120
|
-
} else if (a.sortData[currentSortKey] < b.sortData[currentSortKey]) {
|
|
121
|
-
return currentSortDirection === "ascending" ? -1 : 1;
|
|
122
|
-
}
|
|
123
|
-
return 0;
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
sortedRows.sort((a, b) => sortFunction(a, b, currentSortDirection, currentSortKey));
|
|
127
|
-
}
|
|
128
|
-
return sortedRows;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* This is a [React](https://reactjs.org/) component to support many table use cases.
|
|
133
|
-
*/
|
|
134
|
-
var MainTable = _ref6 => {
|
|
135
|
-
var {
|
|
136
|
-
defaultSort,
|
|
137
|
-
defaultSortDirection,
|
|
138
|
-
emptyStateMsg = "",
|
|
139
|
-
expanding,
|
|
140
|
-
headers,
|
|
141
|
-
onUpdateSort,
|
|
142
|
-
paginate,
|
|
143
|
-
rows,
|
|
144
|
-
responsive,
|
|
145
|
-
sortable,
|
|
146
|
-
sortFunction,
|
|
147
|
-
hiddenCaption
|
|
148
|
-
} = _ref6,
|
|
149
|
-
props = _objectWithoutProperties(_ref6, _excluded4);
|
|
150
|
-
var [currentSortKey, setSortKey] = useState(defaultSort);
|
|
151
|
-
var [currentSortDirection, setSortDirection] = useState(defaultSortDirection);
|
|
152
|
-
|
|
153
|
-
// Update the current sort state if the prop changes.
|
|
154
|
-
useEffect(() => {
|
|
155
|
-
setSortKey(defaultSort);
|
|
156
|
-
}, [defaultSort]);
|
|
157
|
-
|
|
158
|
-
// Update the current sort direction state if the prop changes.
|
|
159
|
-
useEffect(() => {
|
|
160
|
-
setSortDirection(defaultSortDirection);
|
|
161
|
-
}, [defaultSortDirection]);
|
|
162
|
-
var updateSort = newSort => {
|
|
163
|
-
setSortKey(newSort);
|
|
164
|
-
onUpdateSort && onUpdateSort(newSort);
|
|
165
|
-
};
|
|
166
|
-
var sortedRows = useMemo(() => sortRows({
|
|
167
|
-
currentSortDirection,
|
|
168
|
-
currentSortKey,
|
|
169
|
-
rows,
|
|
170
|
-
sortable,
|
|
171
|
-
sortFunction
|
|
172
|
-
}), [currentSortDirection, currentSortKey, rows, sortable, sortFunction]);
|
|
173
|
-
var {
|
|
174
|
-
pageData: finalRows,
|
|
175
|
-
currentPage,
|
|
176
|
-
paginate: setCurrentPage
|
|
177
|
-
} = usePagination(sortedRows, {
|
|
178
|
-
itemsPerPage: paginate,
|
|
179
|
-
autoResetPage: true
|
|
180
|
-
});
|
|
181
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Table, _extends({
|
|
182
|
-
expanding: expanding,
|
|
183
|
-
responsive: responsive
|
|
184
|
-
}, props), hiddenCaption && /*#__PURE__*/React.createElement("caption", {
|
|
185
|
-
"data-testid": "hidden-caption",
|
|
186
|
-
style: {
|
|
187
|
-
height: "1px",
|
|
188
|
-
left: "-1000px",
|
|
189
|
-
overflow: "hidden",
|
|
190
|
-
position: "absolute",
|
|
191
|
-
top: "auto",
|
|
192
|
-
width: "1px"
|
|
193
|
-
}
|
|
194
|
-
}, hiddenCaption), !!headers && generateHeaders(currentSortKey, currentSortDirection, expanding, headers, sortable, updateSort, setSortDirection),
|
|
195
|
-
// If the table has no rows, return empty state message
|
|
196
|
-
Object.entries(finalRows).length === 0 && emptyStateMsg ? /*#__PURE__*/React.createElement("caption", null, emptyStateMsg) : /*#__PURE__*/React.createElement("tbody", null, generateRows({
|
|
197
|
-
rows: finalRows,
|
|
198
|
-
headers,
|
|
199
|
-
responsive,
|
|
200
|
-
expanding
|
|
201
|
-
}))), paginate && rows && rows.length > 0 && /*#__PURE__*/React.createElement(Pagination, {
|
|
202
|
-
currentPage: currentPage,
|
|
203
|
-
itemsPerPage: paginate,
|
|
204
|
-
paginate: setCurrentPage,
|
|
205
|
-
style: {
|
|
206
|
-
marginTop: "1rem"
|
|
207
|
-
},
|
|
208
|
-
totalItems: rows.length
|
|
209
|
-
}));
|
|
210
|
-
};
|
|
211
|
-
export default MainTable;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./MainTable";
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
var _excluded = ["buttonRow", "children", "className", "close", "title", "shouldPropagateClickEvent"];
|
|
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, { useId, useRef, useEffect } from "react";
|
|
7
|
-
/**
|
|
8
|
-
* This is a [React](https://reactjs.org/) component for the Vanilla [Modal](https://docs.vanillaframework.io/patterns/modal/).
|
|
9
|
-
*
|
|
10
|
-
* The modal component can be used to overlay an area of the screen which can contain a prompt, dialog or interaction.
|
|
11
|
-
*/
|
|
12
|
-
export var Modal = _ref => {
|
|
13
|
-
var {
|
|
14
|
-
buttonRow,
|
|
15
|
-
children,
|
|
16
|
-
className,
|
|
17
|
-
close,
|
|
18
|
-
title,
|
|
19
|
-
shouldPropagateClickEvent = false
|
|
20
|
-
} = _ref,
|
|
21
|
-
wrapperProps = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
-
// list of focusable selectors is based on this Stack Overflow answer:
|
|
23
|
-
// https://stackoverflow.com/a/30753870/3732840
|
|
24
|
-
var focusableElementSelectors = 'a[href]:not([tabindex="-1"]), button:not([disabled]), textarea:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([tabindex="-1"]), select:not([disabled]):not([tabindex="-1"]), area[href]:not([tabindex="-1"]), iframe:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"]), [contentEditable=true]:not([tabindex="-1"])';
|
|
25
|
-
var descriptionId = useId();
|
|
26
|
-
var titleId = useId();
|
|
27
|
-
var shouldClose = useRef(false);
|
|
28
|
-
var modalRef = useRef(null);
|
|
29
|
-
var focusableModalElements = useRef(null);
|
|
30
|
-
var handleTabKey = event => {
|
|
31
|
-
if (focusableModalElements.current.length > 0) {
|
|
32
|
-
var firstElement = focusableModalElements.current[0];
|
|
33
|
-
var lastElement = focusableModalElements.current[focusableModalElements.current.length - 1];
|
|
34
|
-
if (!event.shiftKey && document.activeElement === lastElement) {
|
|
35
|
-
firstElement.focus();
|
|
36
|
-
event.preventDefault();
|
|
37
|
-
}
|
|
38
|
-
if (event.shiftKey && document.activeElement === firstElement) {
|
|
39
|
-
lastElement.focus();
|
|
40
|
-
return event.preventDefault();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var handleEscKey = event => {
|
|
45
|
-
if ("nativeEvent" in event && event.nativeEvent.stopImmediatePropagation) {
|
|
46
|
-
event.nativeEvent.stopImmediatePropagation();
|
|
47
|
-
} else if ("stopImmediatePropagation" in event) {
|
|
48
|
-
event.stopImmediatePropagation();
|
|
49
|
-
} else if (event.stopPropagation) {
|
|
50
|
-
event.stopPropagation();
|
|
51
|
-
}
|
|
52
|
-
if (close) {
|
|
53
|
-
close();
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
var keyListenersMap = new Map([["Escape", handleEscKey], ["Tab", handleTabKey]]);
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
modalRef.current.focus();
|
|
59
|
-
}, [modalRef]);
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
var _focusableModalElemen;
|
|
62
|
-
focusableModalElements.current = modalRef.current.querySelectorAll(focusableElementSelectors);
|
|
63
|
-
var focusIndex = 0;
|
|
64
|
-
// when the close button is rendered, focus on the 2nd content element and not the close btn.
|
|
65
|
-
if (close && focusableModalElements.current.length > 1) {
|
|
66
|
-
focusIndex = 1;
|
|
67
|
-
}
|
|
68
|
-
(_focusableModalElemen = focusableModalElements.current[focusIndex]) === null || _focusableModalElemen === void 0 || _focusableModalElemen.focus({
|
|
69
|
-
preventScroll: true
|
|
70
|
-
});
|
|
71
|
-
}, [close]);
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
var keyDown = event => {
|
|
74
|
-
var listener = keyListenersMap.get(event.code);
|
|
75
|
-
return listener && listener(event);
|
|
76
|
-
};
|
|
77
|
-
document.addEventListener("keydown", keyDown);
|
|
78
|
-
return () => {
|
|
79
|
-
document.removeEventListener("keydown", keyDown);
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
var handleContentOnMouseDown = () => {
|
|
83
|
-
shouldClose.current = false;
|
|
84
|
-
};
|
|
85
|
-
var handleContentOnMouseUp = () => {
|
|
86
|
-
shouldClose.current = false;
|
|
87
|
-
};
|
|
88
|
-
var handleOverlayOnMouseDown = event => {
|
|
89
|
-
if (event.target === modalRef.current) {
|
|
90
|
-
shouldClose.current = true;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
var handleClose = event => {
|
|
94
|
-
if (!shouldPropagateClickEvent) {
|
|
95
|
-
event.stopPropagation();
|
|
96
|
-
}
|
|
97
|
-
if (close) {
|
|
98
|
-
close();
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
var handleOverlayOnClick = event => {
|
|
102
|
-
if (shouldClose.current) {
|
|
103
|
-
handleClose(event);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
107
|
-
className: classNames("p-modal", className),
|
|
108
|
-
onClick: handleOverlayOnClick,
|
|
109
|
-
onMouseDown: handleOverlayOnMouseDown
|
|
110
|
-
}, wrapperProps, {
|
|
111
|
-
ref: modalRef
|
|
112
|
-
}), /*#__PURE__*/React.createElement("section", {
|
|
113
|
-
className: "p-modal__dialog",
|
|
114
|
-
role: "dialog",
|
|
115
|
-
"aria-modal": "true",
|
|
116
|
-
"aria-labelledby": titleId,
|
|
117
|
-
"aria-describedby": descriptionId,
|
|
118
|
-
onMouseDown: handleContentOnMouseDown,
|
|
119
|
-
onMouseUp: handleContentOnMouseUp
|
|
120
|
-
}, !!title && /*#__PURE__*/React.createElement("header", {
|
|
121
|
-
className: "p-modal__header"
|
|
122
|
-
}, /*#__PURE__*/React.createElement("h2", {
|
|
123
|
-
className: "p-modal__title",
|
|
124
|
-
id: titleId
|
|
125
|
-
}, title), !!close && /*#__PURE__*/React.createElement("button", {
|
|
126
|
-
className: "p-modal__close",
|
|
127
|
-
"aria-label": "Close active modal",
|
|
128
|
-
onClick: handleClose
|
|
129
|
-
}, "Close")), /*#__PURE__*/React.createElement("div", {
|
|
130
|
-
id: descriptionId
|
|
131
|
-
}, children), !!buttonRow && /*#__PURE__*/React.createElement("footer", {
|
|
132
|
-
className: "p-modal__footer"
|
|
133
|
-
}, buttonRow)));
|
|
134
|
-
};
|
|
135
|
-
export default Modal;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./Modal";
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
var _excluded = ["data", "columns", "emptyMsg", "footer", "sortable", "getHeaderProps", "getRowProps", "getCellProps", "getRowId", "initialSortColumn", "initialSortDirection", "autoResetSortBy"];
|
|
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
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
8
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
-
import React, { useMemo, isValidElement } from "react";
|
|
11
|
-
import { useTable, useSortBy } from "react-table";
|
|
12
|
-
import Table from "../Table";
|
|
13
|
-
import TableRow from "../TableRow";
|
|
14
|
-
import TableHeader from "../TableHeader";
|
|
15
|
-
import TableCell from "../TableCell";
|
|
16
|
-
import Icon from "../Icon";
|
|
17
|
-
var generateCell = (cell, getCellProps) => {
|
|
18
|
-
var _cell$column$getCellI, _cell$column;
|
|
19
|
-
var hasColumnIcon = cell.column.getCellIcon;
|
|
20
|
-
var iconName = hasColumnIcon && ((_cell$column$getCellI = (_cell$column = cell.column).getCellIcon) === null || _cell$column$getCellI === void 0 ? void 0 : _cell$column$getCellI.call(_cell$column, cell));
|
|
21
|
-
return /*#__PURE__*/React.createElement(TableCell, cell.getCellProps([{
|
|
22
|
-
className: cell.column.className
|
|
23
|
-
}, {
|
|
24
|
-
className: hasColumnIcon ? "p-table__cell--icon-placeholder" : ""
|
|
25
|
-
}, _objectSpread({}, getCellProps === null || getCellProps === void 0 ? void 0 : getCellProps(cell))]), iconName && /*#__PURE__*/React.createElement(Icon, {
|
|
26
|
-
name: iconName
|
|
27
|
-
}), cell.render("Cell"));
|
|
28
|
-
};
|
|
29
|
-
var generateRows = (rows, prepareRow, getRowProps, getCellProps) => {
|
|
30
|
-
var tableRows = [];
|
|
31
|
-
rows.forEach(row => {
|
|
32
|
-
var _row$subRows;
|
|
33
|
-
// This function is responsible for lazily preparing a row for rendering.
|
|
34
|
-
// Any row that you intend to render in your table needs to be passed to this function before every render.
|
|
35
|
-
// see: https://react-table.tanstack.com/docs/api/useTable#instance-properties
|
|
36
|
-
prepareRow(row);
|
|
37
|
-
tableRows.push( /*#__PURE__*/React.createElement(TableRow, row.getRowProps(getRowProps === null || getRowProps === void 0 ? void 0 : getRowProps(row)), row.cells.map(cell => generateCell(cell, getCellProps))));
|
|
38
|
-
if ((_row$subRows = row.subRows) !== null && _row$subRows !== void 0 && _row$subRows.length) {
|
|
39
|
-
tableRows = tableRows.concat(generateRows(row.subRows, prepareRow, getRowProps, getCellProps));
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
return tableRows;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
This is a [React](https://reactjs.org/) component to support many table use cases.
|
|
47
|
-
|
|
48
|
-
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.
|
|
49
|
-
|
|
50
|
-
`columns` - The core columns configuration object for the entire table. https://react-table.tanstack.com/docs/api/useTable#column-options
|
|
51
|
-
`data` - The data array that you want to display on the table.
|
|
52
|
-
### Important note!
|
|
53
|
-
Values passed to both of these params have to me memoized (for example via{" "}
|
|
54
|
-
<code>React.useMemo</code>). Memoization ensures that our data isn't recreated
|
|
55
|
-
on every render. If we didn't use <code>React.useMemo</code>, the table would
|
|
56
|
-
think it was receiving new data on every render and attempt to recalulate a
|
|
57
|
-
lot of logic every single time.
|
|
58
|
-
|
|
59
|
-
#### Custom column options
|
|
60
|
-
|
|
61
|
-
In addition to standard column propeties from [`useTable`](https://react-table.tanstack.com/docs/api/useTable) `ModularTable` accepts some custom properties.
|
|
62
|
-
|
|
63
|
-
##### Class names
|
|
64
|
-
|
|
65
|
-
Custom `className` can be used to provide a specific CSS class name that will be added to all cells in given column.
|
|
66
|
-
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).
|
|
67
|
-
|
|
68
|
-
```js
|
|
69
|
-
getCellProps={({ value, column }) => ({
|
|
70
|
-
className: `table__cell--${column.id} ${value === "1 minute" ? "p-heading--5" : ""}`,
|
|
71
|
-
})}
|
|
72
|
-
columns = {
|
|
73
|
-
Header: "Hidden on mobile",
|
|
74
|
-
accessor: "example",
|
|
75
|
-
className: "u-hide--small"
|
|
76
|
-
}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
##### Icons
|
|
80
|
-
|
|
81
|
-
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.
|
|
82
|
-
|
|
83
|
-
The `ICONS` const contains all [the Vanilla built in icons](https://vanillaframework.io/docs/patterns/icons) such as "plus", "minus", "success", "error", etc.
|
|
84
|
-
|
|
85
|
-
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}`.
|
|
86
|
-
|
|
87
|
-
```js
|
|
88
|
-
columns = {
|
|
89
|
-
Header: "With icons",
|
|
90
|
-
accessor: "status",
|
|
91
|
-
getCellIcon: ({ value }) => {
|
|
92
|
-
return value === "released" ? ICONS.success : false;
|
|
93
|
-
},
|
|
94
|
-
};
|
|
95
|
-
```
|
|
96
|
-
*/
|
|
97
|
-
function ModularTable(_ref) {
|
|
98
|
-
var {
|
|
99
|
-
data,
|
|
100
|
-
columns,
|
|
101
|
-
emptyMsg,
|
|
102
|
-
footer,
|
|
103
|
-
sortable,
|
|
104
|
-
getHeaderProps,
|
|
105
|
-
getRowProps,
|
|
106
|
-
getCellProps,
|
|
107
|
-
getRowId,
|
|
108
|
-
initialSortColumn,
|
|
109
|
-
initialSortDirection,
|
|
110
|
-
autoResetSortBy = false
|
|
111
|
-
} = _ref,
|
|
112
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
113
|
-
var sortBy = useMemo(() => initialSortColumn ? [{
|
|
114
|
-
id: initialSortColumn,
|
|
115
|
-
desc: initialSortDirection === "descending"
|
|
116
|
-
}] : [], [initialSortColumn, initialSortDirection]);
|
|
117
|
-
var {
|
|
118
|
-
getTableProps,
|
|
119
|
-
getTableBodyProps,
|
|
120
|
-
headerGroups,
|
|
121
|
-
rows,
|
|
122
|
-
prepareRow
|
|
123
|
-
} = useTable({
|
|
124
|
-
columns,
|
|
125
|
-
data,
|
|
126
|
-
getRowId: getRowId || undefined,
|
|
127
|
-
initialState: {
|
|
128
|
-
sortBy
|
|
129
|
-
},
|
|
130
|
-
autoResetSortBy
|
|
131
|
-
}, sortable ? useSortBy : undefined);
|
|
132
|
-
var showEmpty = !!emptyMsg && (!rows || rows.length === 0);
|
|
133
|
-
|
|
134
|
-
// Function returns whether table can be sorted by a specific column.
|
|
135
|
-
// Returns true if sorting is enabled for the column and there is text
|
|
136
|
-
// or JSX provided for the header, otherwise returns false.
|
|
137
|
-
var isColumnSortable = column => column.canSort && ( /*#__PURE__*/isValidElement(column.Header) || (typeof column.Header === "string" || typeof column.Header === "number") && !!String(column.Header).trim());
|
|
138
|
-
var getColumnSortDirection = column => {
|
|
139
|
-
if (!isColumnSortable(column)) {
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
if (!column.isSorted) {
|
|
143
|
-
return "none";
|
|
144
|
-
}
|
|
145
|
-
return column.isSortedDesc ? "descending" : "ascending";
|
|
146
|
-
};
|
|
147
|
-
return /*#__PURE__*/React.createElement(Table, _extends({}, getTableProps(), props), /*#__PURE__*/React.createElement("thead", null, headerGroups.map((headerGroup, i) => /*#__PURE__*/React.createElement(TableRow, _extends({}, headerGroup.getHeaderGroupProps(), {
|
|
148
|
-
key: i
|
|
149
|
-
}), headerGroup.headers.map((column, j) => /*#__PURE__*/React.createElement(TableHeader, _extends({
|
|
150
|
-
key: j,
|
|
151
|
-
sort: getColumnSortDirection(column)
|
|
152
|
-
}, column.getHeaderProps([{
|
|
153
|
-
className: column.className
|
|
154
|
-
}, {
|
|
155
|
-
className: column.getCellIcon ? "p-table__cell--icon-placeholder" : ""
|
|
156
|
-
}, _objectSpread({}, getHeaderProps === null || getHeaderProps === void 0 ? void 0 : getHeaderProps(column)),
|
|
157
|
-
// Only call this if we want it to be sortable too.
|
|
158
|
-
sortable && isColumnSortable(column) ? column.getSortByToggleProps({
|
|
159
|
-
title: undefined
|
|
160
|
-
}) : {}])), column.render("Header")))))), /*#__PURE__*/React.createElement("tbody", getTableBodyProps(), generateRows(rows, prepareRow, getRowProps, getCellProps), showEmpty && /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, {
|
|
161
|
-
colSpan: columns.length
|
|
162
|
-
}, emptyMsg)), footer && /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, {
|
|
163
|
-
colSpan: columns.length
|
|
164
|
-
}, footer))));
|
|
165
|
-
}
|
|
166
|
-
export default ModularTable;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./ModularTable";
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import _pt from "prop-types";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
import "./FadeInDown.scss";
|
|
5
|
-
/**
|
|
6
|
-
* EXPERIMENTAL: This component is experimental and should be used internally only.
|
|
7
|
-
*/
|
|
8
|
-
export var FadeInDown = _ref => {
|
|
9
|
-
var {
|
|
10
|
-
children,
|
|
11
|
-
className,
|
|
12
|
-
isVisible
|
|
13
|
-
} = _ref;
|
|
14
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
-
className: classNames("fade-in--down", className),
|
|
16
|
-
"aria-hidden": isVisible ? "false" : "true",
|
|
17
|
-
style: {
|
|
18
|
-
visibility: isVisible ? "visible" : "hidden"
|
|
19
|
-
}
|
|
20
|
-
}, children);
|
|
21
|
-
};
|
|
22
|
-
FadeInDown.propTypes = {
|
|
23
|
-
isVisible: _pt.bool.isRequired,
|
|
24
|
-
className: _pt.string
|
|
25
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./FadeInDown";
|