@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,47 +0,0 @@
|
|
|
1
|
-
var _excluded = ["cancelButtonLabel", "cancelButtonProps", "children", "confirmButtonAppearance", "confirmButtonLabel", "confirmExtra", "onConfirm", "confirmButtonLoading", "confirmButtonDisabled", "confirmButtonProps"];
|
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
-
import React from "react";
|
|
6
|
-
import Button from "../Button";
|
|
7
|
-
import Modal from "../Modal";
|
|
8
|
-
import ActionButton from "../ActionButton";
|
|
9
|
-
/**
|
|
10
|
-
* `ConfirmationModal` is a specialised version of the [Modal](?path=/docs/modal--default-story) component to prompt a confirmation from the user before executing an action.
|
|
11
|
-
*/
|
|
12
|
-
export var ConfirmationModal = _ref => {
|
|
13
|
-
var {
|
|
14
|
-
cancelButtonLabel = "Cancel",
|
|
15
|
-
cancelButtonProps,
|
|
16
|
-
children,
|
|
17
|
-
confirmButtonAppearance = "negative",
|
|
18
|
-
confirmButtonLabel,
|
|
19
|
-
confirmExtra,
|
|
20
|
-
onConfirm,
|
|
21
|
-
confirmButtonLoading,
|
|
22
|
-
confirmButtonDisabled,
|
|
23
|
-
confirmButtonProps
|
|
24
|
-
} = _ref,
|
|
25
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
-
var handleClick = action => event => {
|
|
27
|
-
if (!props.shouldPropagateClickEvent) {
|
|
28
|
-
event.stopPropagation();
|
|
29
|
-
}
|
|
30
|
-
if (action) {
|
|
31
|
-
action(event);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
return /*#__PURE__*/React.createElement(Modal, _extends({
|
|
35
|
-
buttonRow: /*#__PURE__*/React.createElement(React.Fragment, null, confirmExtra, /*#__PURE__*/React.createElement(Button, _extends({}, cancelButtonProps, {
|
|
36
|
-
className: "u-no-margin--bottom",
|
|
37
|
-
onClick: handleClick(props.close)
|
|
38
|
-
}), cancelButtonLabel), /*#__PURE__*/React.createElement(ActionButton, _extends({}, confirmButtonProps, {
|
|
39
|
-
appearance: confirmButtonAppearance,
|
|
40
|
-
className: "u-no-margin--bottom",
|
|
41
|
-
onClick: handleClick(onConfirm),
|
|
42
|
-
loading: confirmButtonLoading,
|
|
43
|
-
disabled: confirmButtonDisabled
|
|
44
|
-
}), confirmButtonLabel))
|
|
45
|
-
}, props), children);
|
|
46
|
-
};
|
|
47
|
-
export default ConfirmationModal;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./ConfirmationModal";
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
var _excluded = ["autoAdjust", "children", "className", "closeOnEsc", "closeOnOutsideClick", "constrainPanelWidth", "dropdownClassName", "dropdownProps", "hasToggleIcon", "links", "onToggleMenu", "position", "positionNode", "scrollOverflow", "toggle", "toggleAppearance", "toggleClassName", "toggleDisabled", "toggleLabel", "toggleLabelFirst", "toggleProps", "visible"];
|
|
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, { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
7
|
-
import usePortal from "react-useportal";
|
|
8
|
-
import { useListener, usePrevious } from "../../hooks";
|
|
9
|
-
import Button from "../Button";
|
|
10
|
-
import ContextualMenuDropdown from "./ContextualMenuDropdown";
|
|
11
|
-
export var Label = /*#__PURE__*/function (Label) {
|
|
12
|
-
Label["Toggle"] = "Toggle menu";
|
|
13
|
-
return Label;
|
|
14
|
-
}({});
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The props for the ContextualMenu component.
|
|
18
|
-
* @template L - The type of the link props.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Get the node to use for positioning the menu.
|
|
23
|
-
* @param wrapper - The component's wrapping element.
|
|
24
|
-
* @param positionNode - A positioning node, if supplied.
|
|
25
|
-
* @return A node or null.
|
|
26
|
-
*/
|
|
27
|
-
var getPositionNode = (wrapper, positionNode) => {
|
|
28
|
-
if (positionNode) {
|
|
29
|
-
return positionNode;
|
|
30
|
-
} else if (wrapper) {
|
|
31
|
-
// We want to position the menu in relation to the toggle, if it exists.
|
|
32
|
-
var toggle = wrapper.querySelector(".p-contextual-menu__toggle");
|
|
33
|
-
return toggle || wrapper;
|
|
34
|
-
}
|
|
35
|
-
return null;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Whether the positioning node is visible.
|
|
40
|
-
* @param positionNode - The node that is used to position the menu.
|
|
41
|
-
* @return Whether the positioning node is visible.
|
|
42
|
-
*/
|
|
43
|
-
var getPositionNodeVisible = positionNode => {
|
|
44
|
-
return !positionNode || positionNode.offsetParent !== null;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* This is a [React](https://reactjs.org/) component for the Vanilla [Contextual menu](https://docs.vanillaframework.io/patterns//contextual-menu/).
|
|
49
|
-
*
|
|
50
|
-
* A contextual menu can be used in conjunction with any page element to provide a contextual menu.
|
|
51
|
-
*/
|
|
52
|
-
var ContextualMenu = _ref => {
|
|
53
|
-
var {
|
|
54
|
-
autoAdjust = true,
|
|
55
|
-
children,
|
|
56
|
-
className,
|
|
57
|
-
closeOnEsc = true,
|
|
58
|
-
closeOnOutsideClick = true,
|
|
59
|
-
constrainPanelWidth,
|
|
60
|
-
dropdownClassName,
|
|
61
|
-
dropdownProps,
|
|
62
|
-
hasToggleIcon,
|
|
63
|
-
links,
|
|
64
|
-
onToggleMenu,
|
|
65
|
-
position = "right",
|
|
66
|
-
positionNode,
|
|
67
|
-
scrollOverflow,
|
|
68
|
-
toggle,
|
|
69
|
-
toggleAppearance,
|
|
70
|
-
toggleClassName,
|
|
71
|
-
toggleDisabled,
|
|
72
|
-
toggleLabel,
|
|
73
|
-
toggleLabelFirst = true,
|
|
74
|
-
toggleProps,
|
|
75
|
-
visible = false
|
|
76
|
-
} = _ref,
|
|
77
|
-
wrapperProps = _objectWithoutProperties(_ref, _excluded);
|
|
78
|
-
var id = useId();
|
|
79
|
-
var wrapper = useRef(null);
|
|
80
|
-
var [positionCoords, setPositionCoords] = useState();
|
|
81
|
-
var [adjustedPosition, setAdjustedPosition] = useState(position);
|
|
82
|
-
useEffect(() => {
|
|
83
|
-
setAdjustedPosition(position);
|
|
84
|
-
}, [position, autoAdjust]);
|
|
85
|
-
|
|
86
|
-
// Update the coordinates of the position node.
|
|
87
|
-
var updatePositionCoords = useCallback(() => {
|
|
88
|
-
var parent = getPositionNode(wrapper.current, positionNode);
|
|
89
|
-
if (!parent) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
setPositionCoords(parent.getBoundingClientRect());
|
|
93
|
-
}, [wrapper, positionNode]);
|
|
94
|
-
var {
|
|
95
|
-
openPortal,
|
|
96
|
-
closePortal,
|
|
97
|
-
isOpen,
|
|
98
|
-
Portal
|
|
99
|
-
} = usePortal({
|
|
100
|
-
closeOnEsc,
|
|
101
|
-
closeOnOutsideClick,
|
|
102
|
-
isOpen: visible,
|
|
103
|
-
onOpen: () => {
|
|
104
|
-
// Call the toggle callback, if supplied.
|
|
105
|
-
onToggleMenu === null || onToggleMenu === void 0 || onToggleMenu(true);
|
|
106
|
-
// When the menu opens then update the coordinates of the parent.
|
|
107
|
-
updatePositionCoords();
|
|
108
|
-
},
|
|
109
|
-
onClose: () => {
|
|
110
|
-
// Call the toggle callback, if supplied.
|
|
111
|
-
onToggleMenu === null || onToggleMenu === void 0 || onToggleMenu(false);
|
|
112
|
-
},
|
|
113
|
-
programmaticallyOpen: true
|
|
114
|
-
});
|
|
115
|
-
var previousVisible = usePrevious(visible);
|
|
116
|
-
var labelNode = toggleLabel && typeof toggleLabel === "string" ? /*#__PURE__*/React.createElement("span", null, toggleLabel) : /*#__PURE__*/React.isValidElement(toggleLabel) ? toggleLabel : null;
|
|
117
|
-
var contextualMenuClassName = classNames(className, "p-contextual-menu", {
|
|
118
|
-
["p-contextual-menu--".concat(adjustedPosition)]: adjustedPosition !== "right"
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
// Update the coordinates of the wrapper once it mounts to the dom. This uses
|
|
122
|
-
// The callback ref pattern:
|
|
123
|
-
// https://reactjs.org/docs/hooks-faq.html#how-can-i-measure-a-dom-node
|
|
124
|
-
var wrapperRef = useCallback(node => {
|
|
125
|
-
wrapper.current = node;
|
|
126
|
-
if (node !== null) {
|
|
127
|
-
updatePositionCoords();
|
|
128
|
-
}
|
|
129
|
-
}, [updatePositionCoords]);
|
|
130
|
-
|
|
131
|
-
// Handle controlling updates to the menu visibility from outside
|
|
132
|
-
// the component.
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
if (visible !== previousVisible) {
|
|
135
|
-
if (visible && !isOpen) {
|
|
136
|
-
openPortal();
|
|
137
|
-
} else if (!visible && isOpen) {
|
|
138
|
-
closePortal();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}, [closePortal, openPortal, visible, isOpen, previousVisible]);
|
|
142
|
-
var onResize = useCallback(evt => {
|
|
143
|
-
var parent = getPositionNode(wrapper.current, positionNode);
|
|
144
|
-
if (parent && !getPositionNodeVisible(parent)) {
|
|
145
|
-
// Hide the menu if the item has become hidden. This might happen in
|
|
146
|
-
// a responsive table when columns become hidden as the page
|
|
147
|
-
// becomes smaller.
|
|
148
|
-
closePortal(evt);
|
|
149
|
-
} else {
|
|
150
|
-
// Update the coordinates so that the menu stays relative to the
|
|
151
|
-
// toggle button.
|
|
152
|
-
updatePositionCoords();
|
|
153
|
-
}
|
|
154
|
-
}, [closePortal, positionNode, updatePositionCoords]);
|
|
155
|
-
var onScroll = useCallback(e => {
|
|
156
|
-
var parent = getPositionNode(wrapper.current, positionNode);
|
|
157
|
-
// update position if the scroll event is triggered by the parent of the menu
|
|
158
|
-
if (parent && e.target.contains(parent)) {
|
|
159
|
-
// Update the coordinates so that the menu stays relative to the
|
|
160
|
-
// toggle button.
|
|
161
|
-
updatePositionCoords();
|
|
162
|
-
}
|
|
163
|
-
}, [positionNode, updatePositionCoords]);
|
|
164
|
-
useListener(window, onResize, "resize", true, isOpen);
|
|
165
|
-
useListener(window, onScroll, "scroll", false, isOpen, true);
|
|
166
|
-
var toggleNode = null;
|
|
167
|
-
if (toggle) {
|
|
168
|
-
toggleNode = toggle;
|
|
169
|
-
} else if (hasToggleIcon || toggleLabel) {
|
|
170
|
-
toggleNode = /*#__PURE__*/React.createElement(Button, _extends({
|
|
171
|
-
appearance: toggleAppearance,
|
|
172
|
-
"aria-controls": id,
|
|
173
|
-
"aria-expanded": isOpen ? "true" : "false",
|
|
174
|
-
"aria-label": toggleLabel ? null : Label.Toggle,
|
|
175
|
-
"aria-pressed": isOpen ? "true" : "false",
|
|
176
|
-
"aria-haspopup": "true",
|
|
177
|
-
className: classNames("p-contextual-menu__toggle", toggleClassName),
|
|
178
|
-
disabled: toggleDisabled,
|
|
179
|
-
hasIcon: hasToggleIcon,
|
|
180
|
-
onClick: evt => {
|
|
181
|
-
if (!isOpen) {
|
|
182
|
-
openPortal(evt);
|
|
183
|
-
} else {
|
|
184
|
-
closePortal(evt);
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
type: "button"
|
|
188
|
-
}, toggleProps), toggleLabelFirst ? labelNode : null, hasToggleIcon ? /*#__PURE__*/React.createElement("i", {
|
|
189
|
-
className: classNames("p-icon--chevron-down p-contextual-menu__indicator", {
|
|
190
|
-
"is-light": ["negative", "positive"].includes(toggleAppearance)
|
|
191
|
-
})
|
|
192
|
-
}) : null, toggleLabelFirst ? null : labelNode);
|
|
193
|
-
}
|
|
194
|
-
return /*#__PURE__*/React.createElement("span", _extends({
|
|
195
|
-
className: contextualMenuClassName,
|
|
196
|
-
ref: wrapperRef
|
|
197
|
-
}, wrapperProps), toggleNode, isOpen && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(ContextualMenuDropdown, _extends({
|
|
198
|
-
adjustedPosition: adjustedPosition,
|
|
199
|
-
autoAdjust: autoAdjust,
|
|
200
|
-
handleClose: closePortal,
|
|
201
|
-
constrainPanelWidth: constrainPanelWidth,
|
|
202
|
-
dropdownClassName: dropdownClassName,
|
|
203
|
-
dropdownContent: children,
|
|
204
|
-
id: id,
|
|
205
|
-
isOpen: isOpen,
|
|
206
|
-
links: links,
|
|
207
|
-
position: position,
|
|
208
|
-
positionCoords: positionCoords,
|
|
209
|
-
contextualMenuClassName: contextualMenuClassName,
|
|
210
|
-
positionNode: getPositionNode(wrapper.current),
|
|
211
|
-
scrollOverflow: scrollOverflow,
|
|
212
|
-
setAdjustedPosition: setAdjustedPosition
|
|
213
|
-
}, dropdownProps))));
|
|
214
|
-
};
|
|
215
|
-
export default ContextualMenu;
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
var _excluded = ["children", "className", "onClick"],
|
|
2
|
-
_excluded2 = ["adjustedPosition", "autoAdjust", "handleClose", "constrainPanelWidth", "dropdownClassName", "dropdownContent", "id", "isOpen", "links", "position", "positionCoords", "positionNode", "scrollOverflow", "setAdjustedPosition", "contextualMenuClassName"];
|
|
3
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
5
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
6
|
-
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; }
|
|
7
|
-
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; }
|
|
8
|
-
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; }
|
|
9
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
10
|
-
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); }
|
|
11
|
-
import classNames from "classnames";
|
|
12
|
-
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
13
|
-
import { useWindowFitment } from "../../../hooks";
|
|
14
|
-
import Button from "../../Button";
|
|
15
|
-
export var Label = /*#__PURE__*/function (Label) {
|
|
16
|
-
Label["Dropdown"] = "submenu";
|
|
17
|
-
return Label;
|
|
18
|
-
}({});
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The type of the menu links.
|
|
22
|
-
* @template L - The type of the link props.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The props for the ContextualMenuDropdown component.
|
|
27
|
-
* @template L - The type of the link props.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Calculate the styles for the menu.
|
|
32
|
-
* @param position - The menu position.
|
|
33
|
-
* @param positionCoords - The coordinates of the position node.
|
|
34
|
-
* @param constrainPanelWidth - Whether the menu width should be constrained to the position width.
|
|
35
|
-
*/
|
|
36
|
-
var getPositionStyle = (position, verticalPosition, positionCoords, constrainPanelWidth) => {
|
|
37
|
-
if (!positionCoords) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
var {
|
|
41
|
-
height,
|
|
42
|
-
left,
|
|
43
|
-
top,
|
|
44
|
-
width
|
|
45
|
-
} = positionCoords;
|
|
46
|
-
var topPos = verticalPosition === "bottom" ? top + height + (window.scrollY || 0) : top + (window.scrollY || 0);
|
|
47
|
-
var leftPos = left;
|
|
48
|
-
switch (position) {
|
|
49
|
-
case "left":
|
|
50
|
-
leftPos = left;
|
|
51
|
-
break;
|
|
52
|
-
case "center":
|
|
53
|
-
leftPos = left + width / 2;
|
|
54
|
-
break;
|
|
55
|
-
case "right":
|
|
56
|
-
leftPos = left + width;
|
|
57
|
-
break;
|
|
58
|
-
default:
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
return _objectSpread({
|
|
62
|
-
position: "absolute",
|
|
63
|
-
left: leftPos,
|
|
64
|
-
top: topPos
|
|
65
|
-
}, constrainPanelWidth ? {
|
|
66
|
-
width
|
|
67
|
-
} : null);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Calculate the adjusted position in relation to the window.
|
|
72
|
-
* @param position - The requested position.
|
|
73
|
-
* @param fitsWindow - The window fitment info.
|
|
74
|
-
* @return The new position.
|
|
75
|
-
*/
|
|
76
|
-
export var adjustForWindow = (position, fitsWindow) => {
|
|
77
|
-
var newPosition = position;
|
|
78
|
-
if (!fitsWindow.fromRight.fitsLeft && newPosition === "right") {
|
|
79
|
-
newPosition = "left";
|
|
80
|
-
}
|
|
81
|
-
if (!fitsWindow.fromLeft.fitsRight && newPosition === "left") {
|
|
82
|
-
newPosition = "right";
|
|
83
|
-
}
|
|
84
|
-
// If the menu doesn't fit to the left or the right then center it.
|
|
85
|
-
if (!fitsWindow.fromLeft.fitsRight && !fitsWindow.fromRight.fitsLeft && (newPosition === "left" || newPosition === "right")) {
|
|
86
|
-
newPosition = "center";
|
|
87
|
-
}
|
|
88
|
-
// If the menu doesn't fit when centered then find a new position.
|
|
89
|
-
if (newPosition === "center" && (!fitsWindow.fromCenter.fitsCentered.fitsRight || !fitsWindow.fromCenter.fitsCentered.fitsLeft)) {
|
|
90
|
-
if (fitsWindow.fromLeft.fitsRight) {
|
|
91
|
-
newPosition = "left";
|
|
92
|
-
}
|
|
93
|
-
if (fitsWindow.fromRight.fitsLeft) {
|
|
94
|
-
newPosition = "right";
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return newPosition;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Generate a menu link
|
|
102
|
-
* @template L - The type of the link props.
|
|
103
|
-
* @param link - A button
|
|
104
|
-
* @param key - A key for the DOM.
|
|
105
|
-
* @param handleClose - The function to close the menu.
|
|
106
|
-
*/
|
|
107
|
-
var generateLink = (link, key, handleClose) => {
|
|
108
|
-
var {
|
|
109
|
-
children,
|
|
110
|
-
className,
|
|
111
|
-
onClick
|
|
112
|
-
} = link,
|
|
113
|
-
props = _objectWithoutProperties(link, _excluded);
|
|
114
|
-
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
115
|
-
className: classNames("p-contextual-menu__link", className),
|
|
116
|
-
key: key,
|
|
117
|
-
onClick: onClick ? evt => {
|
|
118
|
-
handleClose(evt.nativeEvent);
|
|
119
|
-
onClick(evt);
|
|
120
|
-
} : null
|
|
121
|
-
}, props), children);
|
|
122
|
-
};
|
|
123
|
-
var getClosestScrollableParent = node => {
|
|
124
|
-
var currentNode = node;
|
|
125
|
-
while (currentNode && currentNode !== document.body) {
|
|
126
|
-
var {
|
|
127
|
-
overflowY,
|
|
128
|
-
overflowX
|
|
129
|
-
} = window.getComputedStyle(currentNode);
|
|
130
|
-
if (["auto", "scroll", "overlay"].includes(overflowY) && ["auto", "scroll", "overlay"].includes(overflowX)) {
|
|
131
|
-
return currentNode;
|
|
132
|
-
}
|
|
133
|
-
currentNode = currentNode.parentElement;
|
|
134
|
-
}
|
|
135
|
-
return document.body;
|
|
136
|
-
};
|
|
137
|
-
var ContextualMenuDropdown = _ref => {
|
|
138
|
-
var {
|
|
139
|
-
adjustedPosition,
|
|
140
|
-
autoAdjust,
|
|
141
|
-
handleClose,
|
|
142
|
-
constrainPanelWidth,
|
|
143
|
-
dropdownClassName,
|
|
144
|
-
dropdownContent,
|
|
145
|
-
id,
|
|
146
|
-
isOpen,
|
|
147
|
-
links,
|
|
148
|
-
position,
|
|
149
|
-
positionCoords,
|
|
150
|
-
positionNode,
|
|
151
|
-
scrollOverflow,
|
|
152
|
-
setAdjustedPosition,
|
|
153
|
-
contextualMenuClassName
|
|
154
|
-
} = _ref,
|
|
155
|
-
props = _objectWithoutProperties(_ref, _excluded2);
|
|
156
|
-
var dropdown = useRef(null);
|
|
157
|
-
var [verticalPosition, setVerticalPosition] = useState("bottom");
|
|
158
|
-
var [positionStyle, setPositionStyle] = useState(getPositionStyle(adjustedPosition, verticalPosition, positionCoords, constrainPanelWidth));
|
|
159
|
-
var [maxHeight, setMaxHeight] = useState();
|
|
160
|
-
// Update the styles to position the menu.
|
|
161
|
-
var updatePositionStyle = useCallback(() => {
|
|
162
|
-
setPositionStyle(getPositionStyle(adjustedPosition, verticalPosition, positionCoords, constrainPanelWidth));
|
|
163
|
-
}, [adjustedPosition, positionCoords, verticalPosition, constrainPanelWidth]);
|
|
164
|
-
var updateVerticalPosition = useCallback(() => {
|
|
165
|
-
var _dropdown$current$get;
|
|
166
|
-
if (!positionNode) {
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
var scrollableParent = getClosestScrollableParent(positionNode);
|
|
170
|
-
if (!scrollableParent) {
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
var scrollableParentRect = scrollableParent.getBoundingClientRect();
|
|
174
|
-
var toggleRect = positionNode.getBoundingClientRect();
|
|
175
|
-
|
|
176
|
-
// Calculate the rect in relation to the scrollableParent
|
|
177
|
-
var relativeToScrollParentRect = {
|
|
178
|
-
top: toggleRect.top - scrollableParentRect.top,
|
|
179
|
-
bottom: toggleRect.bottom - scrollableParentRect.top
|
|
180
|
-
};
|
|
181
|
-
var scrollParentSpaceBelow = scrollableParentRect.height - relativeToScrollParentRect.bottom;
|
|
182
|
-
var scrollParentSpaceAbove = relativeToScrollParentRect.top;
|
|
183
|
-
var dropdownHeight = (_dropdown$current$get = dropdown.current.getBoundingClientRect().height) !== null && _dropdown$current$get !== void 0 ? _dropdown$current$get : 0;
|
|
184
|
-
var windowSpaceBelow = window.innerHeight - toggleRect.bottom;
|
|
185
|
-
setVerticalPosition(scrollParentSpaceBelow >= dropdownHeight && windowSpaceBelow >= dropdownHeight || windowSpaceBelow > scrollParentSpaceAbove ? "bottom" : "top");
|
|
186
|
-
}, [positionNode]);
|
|
187
|
-
|
|
188
|
-
// Update the position when the window fitment info changes.
|
|
189
|
-
var onUpdateWindowFitment = useCallback(fitsWindow => {
|
|
190
|
-
if (autoAdjust) {
|
|
191
|
-
setAdjustedPosition(adjustForWindow(position, fitsWindow));
|
|
192
|
-
updateVerticalPosition();
|
|
193
|
-
}
|
|
194
|
-
if (scrollOverflow) {
|
|
195
|
-
setMaxHeight(fitsWindow.fromBottom.spaceBelow - 16);
|
|
196
|
-
}
|
|
197
|
-
}, [autoAdjust, position, scrollOverflow, setAdjustedPosition, updateVerticalPosition]);
|
|
198
|
-
|
|
199
|
-
// Handle adjusting the horizontal position and scrolling of the dropdown so that it remains on screen.
|
|
200
|
-
useWindowFitment(dropdown.current, positionNode, onUpdateWindowFitment, 0, isOpen && (autoAdjust || scrollOverflow));
|
|
201
|
-
|
|
202
|
-
// Update the styles when the position changes.
|
|
203
|
-
useEffect(() => {
|
|
204
|
-
updatePositionStyle();
|
|
205
|
-
}, [adjustedPosition, updatePositionStyle]);
|
|
206
|
-
useEffect(() => {
|
|
207
|
-
updateVerticalPosition();
|
|
208
|
-
}, [updateVerticalPosition]);
|
|
209
|
-
return (
|
|
210
|
-
/*#__PURE__*/
|
|
211
|
-
// Vanilla Framework uses .p-contextual-menu parent modifier classnames to determine the correct position of the .p-contextual-menu__dropdown dropdown (left, center, right).
|
|
212
|
-
// Extra span wrapper is required as the dropdown is rendered in a portal.
|
|
213
|
-
React.createElement("span", {
|
|
214
|
-
className: contextualMenuClassName,
|
|
215
|
-
style: positionStyle
|
|
216
|
-
}, /*#__PURE__*/React.createElement("span", _extends({
|
|
217
|
-
className: classNames("p-contextual-menu__dropdown", dropdownClassName),
|
|
218
|
-
id: id,
|
|
219
|
-
"aria-hidden": isOpen ? "false" : "true",
|
|
220
|
-
"aria-label": Label.Dropdown,
|
|
221
|
-
ref: dropdown,
|
|
222
|
-
style: _objectSpread(_objectSpread(_objectSpread({}, constrainPanelWidth && positionStyle !== null && positionStyle !== void 0 && positionStyle.width ? {
|
|
223
|
-
width: positionStyle.width,
|
|
224
|
-
minWidth: 0,
|
|
225
|
-
maxWidth: "none"
|
|
226
|
-
} : {}), scrollOverflow ? {
|
|
227
|
-
maxHeight,
|
|
228
|
-
minHeight: "2rem",
|
|
229
|
-
overflowX: "auto"
|
|
230
|
-
} : {}), verticalPosition === "top" ? {
|
|
231
|
-
bottom: "0"
|
|
232
|
-
} : {})
|
|
233
|
-
}, props), dropdownContent ? typeof dropdownContent === "function" ? dropdownContent(handleClose) : dropdownContent : links.map((item, i) => {
|
|
234
|
-
if (Array.isArray(item)) {
|
|
235
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
236
|
-
className: "p-contextual-menu__group",
|
|
237
|
-
key: i
|
|
238
|
-
}, item.map((link, j) => generateLink(link, j, handleClose)));
|
|
239
|
-
} else if (typeof item === "string") {
|
|
240
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
241
|
-
className: "p-contextual-menu__non-interactive",
|
|
242
|
-
key: i
|
|
243
|
-
}, item);
|
|
244
|
-
}
|
|
245
|
-
return generateLink(item, i, handleClose);
|
|
246
|
-
})))
|
|
247
|
-
);
|
|
248
|
-
};
|
|
249
|
-
export default ContextualMenuDropdown;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./ContextualMenuDropdown";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./ContextualMenu";
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
var _excluded = ["children", "className", "image", "title"];
|
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
-
import classNames from "classnames";
|
|
6
|
-
import React from "react";
|
|
7
|
-
/**
|
|
8
|
-
* This is a [React](https://reactjs.org/) component to represent an empty state.
|
|
9
|
-
*/
|
|
10
|
-
export var EmptyState = _ref => {
|
|
11
|
-
var {
|
|
12
|
-
children,
|
|
13
|
-
className,
|
|
14
|
-
image,
|
|
15
|
-
title
|
|
16
|
-
} = _ref,
|
|
17
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
19
|
-
className: classNames(["row", className])
|
|
20
|
-
}, props), /*#__PURE__*/React.createElement("div", {
|
|
21
|
-
className: "u-align--right col-4 col-medium-2 col-small-1"
|
|
22
|
-
}, image), /*#__PURE__*/React.createElement("div", {
|
|
23
|
-
className: "u-align--left col-8 col-medium-4 col-small-3"
|
|
24
|
-
}, /*#__PURE__*/React.createElement("p", {
|
|
25
|
-
className: "p-heading--4 u-no-margin--bottom"
|
|
26
|
-
}, title), children));
|
|
27
|
-
};
|
|
28
|
-
export default EmptyState;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./EmptyState";
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
var _excluded = ["caution", "children", "className", "error", "forId", "help", "helpClassName", "helpId", "isSelect", "isTickElement", "label", "labelClassName", "labelFirst", "required", "stacked", "success", "validationId"];
|
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
-
import classNames from "classnames";
|
|
6
|
-
import React from "react";
|
|
7
|
-
import Label from "../Label";
|
|
8
|
-
import Col from "../Col";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* The props for the Field component.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
var generateHelpText = _ref => {
|
|
15
|
-
var {
|
|
16
|
-
help,
|
|
17
|
-
helpId,
|
|
18
|
-
helpClassName,
|
|
19
|
-
isTickElement
|
|
20
|
-
} = _ref;
|
|
21
|
-
return help ? /*#__PURE__*/React.createElement("p", {
|
|
22
|
-
className: classNames("p-form-help-text", helpClassName, {
|
|
23
|
-
"is-tick-element": isTickElement
|
|
24
|
-
}),
|
|
25
|
-
id: helpId
|
|
26
|
-
}, help) : null;
|
|
27
|
-
};
|
|
28
|
-
var generateError = (error, caution, success, validationId) => {
|
|
29
|
-
if (!error && !caution && !success) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
return /*#__PURE__*/React.createElement("p", {
|
|
33
|
-
className: "p-form-validation__message",
|
|
34
|
-
id: validationId
|
|
35
|
-
}, error || caution || success);
|
|
36
|
-
};
|
|
37
|
-
var generateLabel = (forId, required, label, labelClassName, stacked) => {
|
|
38
|
-
if (!label) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
var labelNode = /*#__PURE__*/React.createElement(Label, {
|
|
42
|
-
className: labelClassName,
|
|
43
|
-
forId: forId,
|
|
44
|
-
required: required
|
|
45
|
-
}, label);
|
|
46
|
-
if (stacked) {
|
|
47
|
-
return /*#__PURE__*/React.createElement(Col, {
|
|
48
|
-
size: 4
|
|
49
|
-
}, labelNode);
|
|
50
|
-
}
|
|
51
|
-
return labelNode;
|
|
52
|
-
};
|
|
53
|
-
var generateContent = _ref2 => {
|
|
54
|
-
var {
|
|
55
|
-
isSelect,
|
|
56
|
-
children,
|
|
57
|
-
labelFirst,
|
|
58
|
-
labelNode,
|
|
59
|
-
help,
|
|
60
|
-
helpClassName,
|
|
61
|
-
error,
|
|
62
|
-
caution,
|
|
63
|
-
success,
|
|
64
|
-
validationId,
|
|
65
|
-
helpId,
|
|
66
|
-
isTickElement
|
|
67
|
-
} = _ref2;
|
|
68
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
69
|
-
className: "p-form__control u-clearfix"
|
|
70
|
-
}, isSelect ? /*#__PURE__*/React.createElement("div", {
|
|
71
|
-
className: "p-form-validation__select-wrapper"
|
|
72
|
-
}, children) : children, !labelFirst && labelNode, generateHelpText({
|
|
73
|
-
helpId,
|
|
74
|
-
help,
|
|
75
|
-
helpClassName,
|
|
76
|
-
isTickElement
|
|
77
|
-
}), generateError(error, caution, success, validationId));
|
|
78
|
-
};
|
|
79
|
-
var Field = _ref3 => {
|
|
80
|
-
var {
|
|
81
|
-
caution,
|
|
82
|
-
children,
|
|
83
|
-
className,
|
|
84
|
-
error,
|
|
85
|
-
forId,
|
|
86
|
-
help,
|
|
87
|
-
helpClassName,
|
|
88
|
-
helpId,
|
|
89
|
-
isSelect,
|
|
90
|
-
isTickElement,
|
|
91
|
-
label,
|
|
92
|
-
labelClassName,
|
|
93
|
-
labelFirst = true,
|
|
94
|
-
required,
|
|
95
|
-
stacked,
|
|
96
|
-
success,
|
|
97
|
-
validationId
|
|
98
|
-
} = _ref3,
|
|
99
|
-
props = _objectWithoutProperties(_ref3, _excluded);
|
|
100
|
-
var labelNode = generateLabel(forId, required, label, labelClassName, stacked);
|
|
101
|
-
var content = generateContent({
|
|
102
|
-
isSelect,
|
|
103
|
-
isTickElement,
|
|
104
|
-
children,
|
|
105
|
-
labelFirst,
|
|
106
|
-
labelNode,
|
|
107
|
-
help,
|
|
108
|
-
helpClassName,
|
|
109
|
-
error,
|
|
110
|
-
caution,
|
|
111
|
-
success,
|
|
112
|
-
validationId,
|
|
113
|
-
helpId
|
|
114
|
-
});
|
|
115
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
116
|
-
className: classNames("p-form__group", "p-form-validation", className, {
|
|
117
|
-
"is-error": error,
|
|
118
|
-
"is-caution": caution,
|
|
119
|
-
"is-success": success,
|
|
120
|
-
row: stacked
|
|
121
|
-
})
|
|
122
|
-
}, props), labelFirst && labelNode, stacked ? /*#__PURE__*/React.createElement(Col, {
|
|
123
|
-
size: 8
|
|
124
|
-
}, content) : content);
|
|
125
|
-
};
|
|
126
|
-
export default Field;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./Field";
|