@canonical/react-components 1.2.5 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist-esm/components/Accordion/Accordion.js +52 -0
- package/dist-esm/components/Accordion/AccordionSection/AccordionSection.js +47 -0
- package/dist-esm/components/Accordion/AccordionSection/index.js +1 -0
- package/dist-esm/components/Accordion/index.js +1 -0
- package/dist-esm/components/ActionButton/ActionButton.js +106 -0
- package/dist-esm/components/ActionButton/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/AppAside/AppAside.js +29 -0
- package/dist-esm/components/ApplicationLayout/AppAside/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/AppMain/AppMain.js +21 -0
- package/dist-esm/components/ApplicationLayout/AppMain/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/AppNavigation/AppNavigation.js +31 -0
- package/dist-esm/components/ApplicationLayout/AppNavigation/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.js +24 -0
- package/dist-esm/components/ApplicationLayout/AppNavigationBar/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/AppStatus/AppStatus.js +21 -0
- package/dist-esm/components/ApplicationLayout/AppStatus/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/Application/Application.js +22 -0
- package/dist-esm/components/ApplicationLayout/Application/index.js +1 -0
- package/dist-esm/components/ApplicationLayout/ApplicationLayout.js +113 -0
- package/dist-esm/components/ApplicationLayout/index.js +7 -0
- package/dist-esm/components/ArticlePagination/ArticlePagination.js +39 -0
- package/dist-esm/components/ArticlePagination/index.js +1 -0
- package/dist-esm/components/Badge/Badge.js +64 -0
- package/dist-esm/components/Badge/index.js +1 -0
- package/dist-esm/components/Button/Button.js +55 -0
- package/dist-esm/components/Button/index.js +1 -0
- package/dist-esm/components/Card/Card.js +45 -0
- package/dist-esm/components/Card/index.js +1 -0
- package/dist-esm/components/CheckboxInput/CheckableInput/CheckableInput.js +35 -0
- package/dist-esm/components/CheckboxInput/CheckableInput/index.js +1 -0
- package/dist-esm/components/CheckboxInput/CheckboxInput.js +24 -0
- package/dist-esm/components/CheckboxInput/index.js +1 -0
- package/dist-esm/components/Chip/Chip.js +81 -0
- package/dist-esm/components/Chip/index.js +1 -0
- package/dist-esm/components/Code/Code.js +49 -0
- package/dist-esm/components/Code/index.js +1 -0
- package/dist-esm/components/CodeSnippet/CodeSnippet.js +28 -0
- package/dist-esm/components/CodeSnippet/CodeSnippetBlock.js +64 -0
- package/dist-esm/components/CodeSnippet/CodeSnippetDropdown.js +27 -0
- package/dist-esm/components/CodeSnippet/index.js +2 -0
- package/dist-esm/components/Col/Col.js +38 -0
- package/dist-esm/components/Col/index.js +1 -0
- package/dist-esm/components/ConfirmationButton/ConfirmationButton.js +63 -0
- package/dist-esm/components/ConfirmationButton/index.js +1 -0
- package/dist-esm/components/ConfirmationModal/ConfirmationModal.js +47 -0
- package/dist-esm/components/ConfirmationModal/index.js +1 -0
- package/dist-esm/components/ContextualMenu/ContextualMenu.js +215 -0
- package/dist-esm/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.js +249 -0
- package/dist-esm/components/ContextualMenu/ContextualMenuDropdown/index.js +1 -0
- package/dist-esm/components/ContextualMenu/index.js +1 -0
- package/dist-esm/components/EmptyState/EmptyState.js +28 -0
- package/dist-esm/components/EmptyState/index.js +1 -0
- package/dist-esm/components/Field/Field.js +126 -0
- package/dist-esm/components/Field/index.js +1 -0
- package/dist-esm/components/Form/Form.js +28 -0
- package/dist-esm/components/Form/index.js +1 -0
- package/dist-esm/components/FormikField/FormikField.js +33 -0
- package/dist-esm/components/FormikField/index.js +1 -0
- package/dist-esm/components/Icon/Icon.js +61 -0
- package/dist-esm/components/Icon/index.js +1 -0
- package/dist-esm/components/Input/Input.js +103 -0
- package/dist-esm/components/Input/index.js +1 -0
- package/dist-esm/components/Label/Label.js +27 -0
- package/dist-esm/components/Label/index.js +1 -0
- package/dist-esm/components/Link/Link.js +37 -0
- package/dist-esm/components/Link/index.js +1 -0
- package/dist-esm/components/List/List.js +110 -0
- package/dist-esm/components/List/index.js +1 -0
- package/dist-esm/components/Loader/Loader.js +14 -0
- package/dist-esm/components/Loader/index.js +1 -0
- package/dist-esm/components/LoginPageLayout/LoginPageLayout.js +63 -0
- package/dist-esm/components/LoginPageLayout/index.js +1 -0
- package/dist-esm/components/MainTable/MainTable.js +211 -0
- package/dist-esm/components/MainTable/index.js +1 -0
- package/dist-esm/components/Modal/Modal.js +135 -0
- package/dist-esm/components/Modal/index.js +1 -0
- package/dist-esm/components/ModularTable/ModularTable.js +166 -0
- package/dist-esm/components/ModularTable/index.js +1 -0
- package/dist-esm/components/MultiSelect/FadeInDown/FadeInDown.js +25 -0
- package/dist-esm/components/MultiSelect/FadeInDown/index.js +1 -0
- package/dist-esm/components/MultiSelect/MultiSelect.js +308 -0
- package/dist-esm/components/MultiSelect/index.js +1 -0
- package/dist-esm/components/Navigation/Navigation.js +215 -0
- package/dist-esm/components/Navigation/NavigationLink/NavigationLink.js +58 -0
- package/dist-esm/components/Navigation/NavigationLink/index.js +1 -0
- package/dist-esm/components/Navigation/NavigationMenu/NavigationMenu.js +57 -0
- package/dist-esm/components/Navigation/NavigationMenu/index.js +1 -0
- package/dist-esm/components/Navigation/index.js +1 -0
- package/dist-esm/components/Navigation/types.js +1 -0
- package/dist-esm/components/Notification/Notification.js +119 -0
- package/dist-esm/components/Notification/index.js +1 -0
- package/dist-esm/components/NotificationProvider/NotificationProvider.js +83 -0
- package/dist-esm/components/NotificationProvider/index.js +2 -0
- package/dist-esm/components/NotificationProvider/messageBuilder.js +31 -0
- package/dist-esm/components/NotificationProvider/types.js +1 -0
- package/dist-esm/components/Pagination/Pagination.js +173 -0
- package/dist-esm/components/Pagination/PaginationButton/PaginationButton.js +31 -0
- package/dist-esm/components/Pagination/PaginationButton/index.js +1 -0
- package/dist-esm/components/Pagination/PaginationItem/PaginationItem.js +20 -0
- package/dist-esm/components/Pagination/PaginationItem/index.js +1 -0
- package/dist-esm/components/Pagination/index.js +1 -0
- package/dist-esm/components/Panel/Panel.js +89 -0
- package/dist-esm/components/Panel/index.js +1 -0
- package/dist-esm/components/PasswordToggle/PasswordToggle.js +90 -0
- package/dist-esm/components/PasswordToggle/index.js +1 -0
- package/dist-esm/components/RadioInput/RadioInput.js +22 -0
- package/dist-esm/components/RadioInput/index.js +1 -0
- package/dist-esm/components/Row/Row.js +22 -0
- package/dist-esm/components/Row/index.js +1 -0
- package/dist-esm/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.js +107 -0
- package/dist-esm/components/SearchAndFilter/FilterPanelSection/index.js +1 -0
- package/dist-esm/components/SearchAndFilter/SearchAndFilter.js +286 -0
- package/dist-esm/components/SearchAndFilter/index.js +1 -0
- package/dist-esm/components/SearchAndFilter/types.js +1 -0
- package/dist-esm/components/SearchAndFilter/utils.js +22 -0
- package/dist-esm/components/SearchBox/SearchBox.js +95 -0
- package/dist-esm/components/SearchBox/index.js +1 -0
- package/dist-esm/components/Select/Select.js +84 -0
- package/dist-esm/components/Select/index.js +1 -0
- package/dist-esm/components/SideNavigation/SideNavigation.js +89 -0
- package/dist-esm/components/SideNavigation/SideNavigationBase/SideNavigationBase.js +31 -0
- package/dist-esm/components/SideNavigation/SideNavigationBase/index.js +1 -0
- package/dist-esm/components/SideNavigation/SideNavigationItem/SideNavigationItem.js +32 -0
- package/dist-esm/components/SideNavigation/SideNavigationItem/index.js +1 -0
- package/dist-esm/components/SideNavigation/SideNavigationLink/SideNavigationLink.js +25 -0
- package/dist-esm/components/SideNavigation/SideNavigationLink/index.js +1 -0
- package/dist-esm/components/SideNavigation/SideNavigationText/SideNavigationText.js +20 -0
- package/dist-esm/components/SideNavigation/SideNavigationText/index.js +1 -0
- package/dist-esm/components/SideNavigation/index.js +4 -0
- package/dist-esm/components/Slider/Slider.js +83 -0
- package/dist-esm/components/Slider/index.js +1 -0
- package/dist-esm/components/Spinner/Spinner.js +36 -0
- package/dist-esm/components/Spinner/index.js +1 -0
- package/dist-esm/components/StatusLabel/StatusLabel.js +36 -0
- package/dist-esm/components/StatusLabel/index.js +1 -0
- package/dist-esm/components/Strip/Strip.js +50 -0
- package/dist-esm/components/Strip/index.js +1 -0
- package/dist-esm/components/SummaryButton/SummaryButton.js +28 -0
- package/dist-esm/components/SummaryButton/index.js +1 -0
- package/dist-esm/components/Switch/Switch.js +28 -0
- package/dist-esm/components/Switch/index.js +1 -0
- package/dist-esm/components/Table/Table.js +23 -0
- package/dist-esm/components/Table/index.js +1 -0
- package/dist-esm/components/TableCell/TableCell.js +26 -0
- package/dist-esm/components/TableCell/index.js +1 -0
- package/dist-esm/components/TableHeader/TableHeader.js +17 -0
- package/dist-esm/components/TableHeader/index.js +1 -0
- package/dist-esm/components/TablePagination/TablePagination.js +104 -0
- package/dist-esm/components/TablePagination/TablePaginationControls/TablePaginationControls.js +120 -0
- package/dist-esm/components/TablePagination/TablePaginationControls/index.js +1 -0
- package/dist-esm/components/TablePagination/index.js +1 -0
- package/dist-esm/components/TablePagination/utils.js +67 -0
- package/dist-esm/components/TableRow/TableRow.js +15 -0
- package/dist-esm/components/TableRow/index.js +1 -0
- package/dist-esm/components/Tabs/Tabs.js +42 -0
- package/dist-esm/components/Tabs/index.js +1 -0
- package/dist-esm/components/Textarea/Textarea.js +115 -0
- package/dist-esm/components/Textarea/index.js +1 -0
- package/dist-esm/components/Tooltip/Tooltip.js +245 -0
- package/dist-esm/components/Tooltip/index.js +1 -0
- package/dist-esm/enums.js +8 -0
- package/dist-esm/hooks/index.js +8 -0
- package/dist-esm/hooks/useId.js +13 -0
- package/dist-esm/hooks/useListener.js +51 -0
- package/dist-esm/hooks/useOnClickOutside.js +38 -0
- package/dist-esm/hooks/useOnEscapePressed.js +25 -0
- package/dist-esm/hooks/usePagination.js +45 -0
- package/dist-esm/hooks/usePrevious.js +16 -0
- package/dist-esm/hooks/useThrottle.js +49 -0
- package/dist-esm/hooks/useWindowFitment.js +109 -0
- package/dist-esm/index.js +69 -0
- package/dist-esm/types/index.js +1 -0
- package/dist-esm/types/react-table-config.d.js +1 -0
- package/dist-esm/utils.js +41 -0
- package/package.json +11 -6
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -18
- package/dist/components/Accordion/Accordion.stories.js +0 -117
- package/dist/components/ActionButton/ActionButton.stories.d.ts +0 -7
- package/dist/components/ActionButton/ActionButton.stories.js +0 -36
- package/dist/components/ApplicationLayout/AppAside/AppAside.stories.d.ts +0 -13
- package/dist/components/ApplicationLayout/AppAside/AppAside.stories.js +0 -116
- package/dist/components/ApplicationLayout/AppMain/AppMain.stories.d.ts +0 -14
- package/dist/components/ApplicationLayout/AppMain/AppMain.stories.js +0 -45
- package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.stories.d.ts +0 -12
- package/dist/components/ApplicationLayout/AppNavigation/AppNavigation.stories.js +0 -104
- package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.stories.d.ts +0 -15
- package/dist/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.stories.js +0 -52
- package/dist/components/ApplicationLayout/AppStatus/AppStatus.stories.d.ts +0 -13
- package/dist/components/ApplicationLayout/AppStatus/AppStatus.stories.js +0 -41
- package/dist/components/ApplicationLayout/Application/Application.stories.d.ts +0 -6
- package/dist/components/ApplicationLayout/Application/Application.stories.js +0 -16
- package/dist/components/ApplicationLayout/ApplicationLayout.stories.d.ts +0 -24
- package/dist/components/ApplicationLayout/ApplicationLayout.stories.js +0 -232
- package/dist/components/ArticlePagination/ArticlePagination.stories.d.ts +0 -6
- package/dist/components/ArticlePagination/ArticlePagination.stories.js +0 -22
- package/dist/components/Badge/Badge.stories.d.ts +0 -15
- package/dist/components/Badge/Badge.stories.js +0 -62
- package/dist/components/Button/Button.stories.d.ts +0 -32
- package/dist/components/Button/Button.stories.js +0 -180
- package/dist/components/Card/Card.stories.d.ts +0 -33
- package/dist/components/Card/Card.stories.js +0 -51
- package/dist/components/CheckboxInput/CheckboxInput.stories.d.ts +0 -11
- package/dist/components/CheckboxInput/CheckboxInput.stories.js +0 -84
- package/dist/components/Chip/Chip.stories.d.ts +0 -9
- package/dist/components/Chip/Chip.stories.js +0 -45
- package/dist/components/CodeSnippet/CodeSnippet.stories.d.ts +0 -45
- package/dist/components/CodeSnippet/CodeSnippet.stories.js +0 -279
- package/dist/components/Col/Col.stories.d.ts +0 -11
- package/dist/components/Col/Col.stories.js +0 -154
- package/dist/components/ConfirmationButton/ConfirmationButton.stories.d.ts +0 -9
- package/dist/components/ConfirmationButton/ConfirmationButton.stories.js +0 -108
- package/dist/components/ConfirmationModal/ConfirmationModal.stories.d.ts +0 -18
- package/dist/components/ConfirmationModal/ConfirmationModal.stories.js +0 -135
- package/dist/components/ContextualMenu/ContextualMenu.stories.d.ts +0 -13
- package/dist/components/ContextualMenu/ContextualMenu.stories.js +0 -107
- package/dist/components/EmptyState/EmptyState.stories.d.ts +0 -7
- package/dist/components/EmptyState/EmptyState.stories.js +0 -49
- package/dist/components/Form/Form.stories.d.ts +0 -12
- package/dist/components/Form/Form.stories.js +0 -179
- package/dist/components/FormikField/FormikField.stories.d.ts +0 -8
- package/dist/components/FormikField/FormikField.stories.js +0 -85
- package/dist/components/Icon/Icon.stories.d.ts +0 -16
- package/dist/components/Icon/Icon.stories.js +0 -49
- package/dist/components/Input/Input.stories.d.ts +0 -14
- package/dist/components/Input/Input.stories.js +0 -148
- package/dist/components/Link/Link.stories.d.ts +0 -9
- package/dist/components/Link/Link.stories.js +0 -48
- package/dist/components/List/List.stories.d.ts +0 -15
- package/dist/components/List/List.stories.js +0 -122
- package/dist/components/LoginPageLayout/LoginPageLayout.stories.d.ts +0 -9
- package/dist/components/LoginPageLayout/LoginPageLayout.stories.js +0 -58
- package/dist/components/MainTable/MainTable.stories.d.ts +0 -15
- package/dist/components/MainTable/MainTable.stories.js +0 -553
- package/dist/components/Modal/Modal.stories.d.ts +0 -6
- package/dist/components/Modal/Modal.stories.js +0 -57
- package/dist/components/ModularTable/ModularTable.stories.d.ts +0 -27
- package/dist/components/ModularTable/ModularTable.stories.js +0 -343
- package/dist/components/MultiSelect/MultiSelect.stories.d.ts +0 -8
- package/dist/components/MultiSelect/MultiSelect.stories.js +0 -70
- package/dist/components/Navigation/Navigation.stories.d.ts +0 -43
- package/dist/components/Navigation/Navigation.stories.js +0 -232
- package/dist/components/Notification/Notification.stories.d.ts +0 -45
- package/dist/components/Notification/Notification.stories.js +0 -201
- package/dist/components/Pagination/Pagination.stories.d.ts +0 -14
- package/dist/components/Pagination/Pagination.stories.js +0 -94
- package/dist/components/Panel/Panel.stories.d.ts +0 -17
- package/dist/components/Panel/Panel.stories.js +0 -60
- package/dist/components/PasswordToggle/PasswordToggle.stories.d.ts +0 -12
- package/dist/components/PasswordToggle/PasswordToggle.stories.js +0 -74
- package/dist/components/RadioInput/RadioInput.stories.d.ts +0 -10
- package/dist/components/RadioInput/RadioInput.stories.js +0 -83
- package/dist/components/Row/Row.stories.d.ts +0 -9
- package/dist/components/Row/Row.stories.js +0 -29
- package/dist/components/SearchAndFilter/SearchAndFilter.stories.d.ts +0 -8
- package/dist/components/SearchAndFilter/SearchAndFilter.stories.js +0 -218
- package/dist/components/SearchBox/SearchBox.stories.d.ts +0 -14
- package/dist/components/SearchBox/SearchBox.stories.js +0 -106
- package/dist/components/Select/Select.stories.d.ts +0 -7
- package/dist/components/Select/Select.stories.js +0 -97
- package/dist/components/SideNavigation/SideNavigation.stories.d.ts +0 -14
- package/dist/components/SideNavigation/SideNavigation.stories.js +0 -62
- package/dist/components/SideNavigation/SideNavigationItem/SideNavigationItem.stories.d.ts +0 -22
- package/dist/components/SideNavigation/SideNavigationItem/SideNavigationItem.stories.js +0 -70
- package/dist/components/SideNavigation/SideNavigationLink/SideNavigationLink.stories.d.ts +0 -7
- package/dist/components/SideNavigation/SideNavigationLink/SideNavigationLink.stories.js +0 -32
- package/dist/components/SideNavigation/SideNavigationText/SideNavigationText.stories.d.ts +0 -6
- package/dist/components/SideNavigation/SideNavigationText/SideNavigationText.stories.js +0 -25
- package/dist/components/Slider/Slider.stories.d.ts +0 -10
- package/dist/components/Slider/Slider.stories.js +0 -74
- package/dist/components/Spinner/Spinner.stories.d.ts +0 -8
- package/dist/components/Spinner/Spinner.stories.js +0 -28
- package/dist/components/StatusLabel/StatusLabel.stories.d.ts +0 -10
- package/dist/components/StatusLabel/StatusLabel.stories.js +0 -61
- package/dist/components/Strip/Strip.stories.d.ts +0 -12
- package/dist/components/Strip/Strip.stories.js +0 -130
- package/dist/components/SummaryButton/SummaryButton.stories.d.ts +0 -18
- package/dist/components/SummaryButton/SummaryButton.stories.js +0 -59
- package/dist/components/Switch/Switch.stories.d.ts +0 -7
- package/dist/components/Switch/Switch.stories.js +0 -26
- package/dist/components/TablePagination/TablePagination.stories.d.ts +0 -14
- package/dist/components/TablePagination/TablePagination.stories.js +0 -330
- package/dist/components/Tabs/Tabs.stories.d.ts +0 -11
- package/dist/components/Tabs/Tabs.stories.js +0 -56
- package/dist/components/Textarea/Textarea.stories.d.ts +0 -7
- package/dist/components/Textarea/Textarea.stories.js +0 -62
- package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -12
- package/dist/components/Tooltip/Tooltip.stories.js +0 -71
- /package/{dist → dist-types}/components/Accordion/Accordion.d.ts +0 -0
- /package/{dist → dist-types}/components/Accordion/AccordionSection/AccordionSection.d.ts +0 -0
- /package/{dist → dist-types}/components/Accordion/AccordionSection/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Accordion/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ActionButton/ActionButton.d.ts +0 -0
- /package/{dist → dist-types}/components/ActionButton/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppAside/AppAside.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppAside/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppMain/AppMain.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppMain/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppNavigation/AppNavigation.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppNavigation/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppNavigationBar/AppNavigationBar.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppNavigationBar/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppStatus/AppStatus.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/AppStatus/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/Application/Application.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/Application/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/ApplicationLayout.d.ts +0 -0
- /package/{dist → dist-types}/components/ApplicationLayout/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ArticlePagination/ArticlePagination.d.ts +0 -0
- /package/{dist → dist-types}/components/ArticlePagination/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Badge/Badge.d.ts +0 -0
- /package/{dist → dist-types}/components/Badge/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Button/Button.d.ts +0 -0
- /package/{dist → dist-types}/components/Button/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Card/Card.d.ts +0 -0
- /package/{dist → dist-types}/components/Card/index.d.ts +0 -0
- /package/{dist → dist-types}/components/CheckboxInput/CheckableInput/CheckableInput.d.ts +0 -0
- /package/{dist → dist-types}/components/CheckboxInput/CheckableInput/index.d.ts +0 -0
- /package/{dist → dist-types}/components/CheckboxInput/CheckboxInput.d.ts +0 -0
- /package/{dist → dist-types}/components/CheckboxInput/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Chip/Chip.d.ts +0 -0
- /package/{dist → dist-types}/components/Chip/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Code/Code.d.ts +0 -0
- /package/{dist → dist-types}/components/Code/index.d.ts +0 -0
- /package/{dist → dist-types}/components/CodeSnippet/CodeSnippet.d.ts +0 -0
- /package/{dist → dist-types}/components/CodeSnippet/CodeSnippetBlock.d.ts +0 -0
- /package/{dist → dist-types}/components/CodeSnippet/CodeSnippetDropdown.d.ts +0 -0
- /package/{dist → dist-types}/components/CodeSnippet/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Col/Col.d.ts +0 -0
- /package/{dist → dist-types}/components/Col/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ConfirmationButton/ConfirmationButton.d.ts +0 -0
- /package/{dist → dist-types}/components/ConfirmationButton/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ConfirmationModal/ConfirmationModal.d.ts +0 -0
- /package/{dist → dist-types}/components/ConfirmationModal/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ContextualMenu/ContextualMenu.d.ts +0 -0
- /package/{dist → dist-types}/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.d.ts +0 -0
- /package/{dist → dist-types}/components/ContextualMenu/ContextualMenuDropdown/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ContextualMenu/index.d.ts +0 -0
- /package/{dist → dist-types}/components/EmptyState/EmptyState.d.ts +0 -0
- /package/{dist → dist-types}/components/EmptyState/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Field/Field.d.ts +0 -0
- /package/{dist → dist-types}/components/Field/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Form/Form.d.ts +0 -0
- /package/{dist → dist-types}/components/Form/index.d.ts +0 -0
- /package/{dist → dist-types}/components/FormikField/FormikField.d.ts +0 -0
- /package/{dist → dist-types}/components/FormikField/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Icon/Icon.d.ts +0 -0
- /package/{dist → dist-types}/components/Icon/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Input/Input.d.ts +0 -0
- /package/{dist → dist-types}/components/Input/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Label/Label.d.ts +0 -0
- /package/{dist → dist-types}/components/Label/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Link/Link.d.ts +0 -0
- /package/{dist → dist-types}/components/Link/index.d.ts +0 -0
- /package/{dist → dist-types}/components/List/List.d.ts +0 -0
- /package/{dist → dist-types}/components/List/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Loader/Loader.d.ts +0 -0
- /package/{dist → dist-types}/components/Loader/index.d.ts +0 -0
- /package/{dist → dist-types}/components/LoginPageLayout/LoginPageLayout.d.ts +0 -0
- /package/{dist → dist-types}/components/LoginPageLayout/index.d.ts +0 -0
- /package/{dist → dist-types}/components/MainTable/MainTable.d.ts +0 -0
- /package/{dist → dist-types}/components/MainTable/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Modal/Modal.d.ts +0 -0
- /package/{dist → dist-types}/components/Modal/index.d.ts +0 -0
- /package/{dist → dist-types}/components/ModularTable/ModularTable.d.ts +0 -0
- /package/{dist → dist-types}/components/ModularTable/index.d.ts +0 -0
- /package/{dist → dist-types}/components/MultiSelect/FadeInDown/FadeInDown.d.ts +0 -0
- /package/{dist → dist-types}/components/MultiSelect/FadeInDown/index.d.ts +0 -0
- /package/{dist → dist-types}/components/MultiSelect/MultiSelect.d.ts +0 -0
- /package/{dist → dist-types}/components/MultiSelect/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/Navigation.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/NavigationLink/NavigationLink.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/NavigationLink/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/NavigationMenu/NavigationMenu.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/NavigationMenu/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Navigation/types.d.ts +0 -0
- /package/{dist → dist-types}/components/Notification/Notification.d.ts +0 -0
- /package/{dist → dist-types}/components/Notification/index.d.ts +0 -0
- /package/{dist → dist-types}/components/NotificationProvider/NotificationProvider.d.ts +0 -0
- /package/{dist → dist-types}/components/NotificationProvider/index.d.ts +0 -0
- /package/{dist → dist-types}/components/NotificationProvider/messageBuilder.d.ts +0 -0
- /package/{dist → dist-types}/components/NotificationProvider/types.d.ts +0 -0
- /package/{dist → dist-types}/components/Pagination/Pagination.d.ts +0 -0
- /package/{dist → dist-types}/components/Pagination/PaginationButton/PaginationButton.d.ts +0 -0
- /package/{dist → dist-types}/components/Pagination/PaginationButton/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Pagination/PaginationItem/PaginationItem.d.ts +0 -0
- /package/{dist → dist-types}/components/Pagination/PaginationItem/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Pagination/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Panel/Panel.d.ts +0 -0
- /package/{dist → dist-types}/components/Panel/index.d.ts +0 -0
- /package/{dist → dist-types}/components/PasswordToggle/PasswordToggle.d.ts +0 -0
- /package/{dist → dist-types}/components/PasswordToggle/index.d.ts +0 -0
- /package/{dist → dist-types}/components/RadioInput/RadioInput.d.ts +0 -0
- /package/{dist → dist-types}/components/RadioInput/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Row/Row.d.ts +0 -0
- /package/{dist → dist-types}/components/Row/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchAndFilter/FilterPanelSection/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchAndFilter/SearchAndFilter.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchAndFilter/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchAndFilter/types.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchAndFilter/utils.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchBox/SearchBox.d.ts +0 -0
- /package/{dist → dist-types}/components/SearchBox/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Select/Select.d.ts +0 -0
- /package/{dist → dist-types}/components/Select/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigation.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationBase/SideNavigationBase.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationBase/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationItem/SideNavigationItem.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationItem/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationLink/SideNavigationLink.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationLink/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationText/SideNavigationText.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/SideNavigationText/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SideNavigation/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Slider/Slider.d.ts +0 -0
- /package/{dist → dist-types}/components/Slider/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Spinner/Spinner.d.ts +0 -0
- /package/{dist → dist-types}/components/Spinner/index.d.ts +0 -0
- /package/{dist → dist-types}/components/StatusLabel/StatusLabel.d.ts +0 -0
- /package/{dist → dist-types}/components/StatusLabel/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Strip/Strip.d.ts +0 -0
- /package/{dist → dist-types}/components/Strip/index.d.ts +0 -0
- /package/{dist → dist-types}/components/SummaryButton/SummaryButton.d.ts +0 -0
- /package/{dist → dist-types}/components/SummaryButton/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Switch/Switch.d.ts +0 -0
- /package/{dist → dist-types}/components/Switch/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Table/Table.d.ts +0 -0
- /package/{dist → dist-types}/components/Table/index.d.ts +0 -0
- /package/{dist → dist-types}/components/TableCell/TableCell.d.ts +0 -0
- /package/{dist → dist-types}/components/TableCell/index.d.ts +0 -0
- /package/{dist → dist-types}/components/TableHeader/TableHeader.d.ts +0 -0
- /package/{dist → dist-types}/components/TableHeader/index.d.ts +0 -0
- /package/{dist → dist-types}/components/TablePagination/TablePagination.d.ts +0 -0
- /package/{dist → dist-types}/components/TablePagination/TablePaginationControls/TablePaginationControls.d.ts +0 -0
- /package/{dist → dist-types}/components/TablePagination/TablePaginationControls/index.d.ts +0 -0
- /package/{dist → dist-types}/components/TablePagination/index.d.ts +0 -0
- /package/{dist → dist-types}/components/TablePagination/utils.d.ts +0 -0
- /package/{dist → dist-types}/components/TableRow/TableRow.d.ts +0 -0
- /package/{dist → dist-types}/components/TableRow/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Tabs/Tabs.d.ts +0 -0
- /package/{dist → dist-types}/components/Tabs/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Textarea/Textarea.d.ts +0 -0
- /package/{dist → dist-types}/components/Textarea/index.d.ts +0 -0
- /package/{dist → dist-types}/components/Tooltip/Tooltip.d.ts +0 -0
- /package/{dist → dist-types}/components/Tooltip/index.d.ts +0 -0
- /package/{dist → dist-types}/enums.d.ts +0 -0
- /package/{dist → dist-types}/hooks/index.d.ts +0 -0
- /package/{dist → dist-types}/hooks/useId.d.ts +0 -0
- /package/{dist → dist-types}/hooks/useListener.d.ts +0 -0
- /package/{dist → dist-types}/hooks/useOnClickOutside.d.ts +0 -0
- /package/{dist → dist-types}/hooks/useOnEscapePressed.d.ts +0 -0
- /package/{dist → dist-types}/hooks/usePagination.d.ts +0 -0
- /package/{dist → dist-types}/hooks/usePrevious.d.ts +0 -0
- /package/{dist → dist-types}/hooks/useThrottle.d.ts +0 -0
- /package/{dist → dist-types}/hooks/useWindowFitment.d.ts +0 -0
- /package/{dist → dist-types}/index.d.ts +0 -0
- /package/{dist → dist-types}/types/index.d.ts +0 -0
- /package/{dist → dist-types}/utils.d.ts +0 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
var _excluded = ["actions", "borderless", "children", "className", "close", "inline", "onDismiss", "severity", "status", "timeout", "timestamp", "title", "titleElement", "type"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import classNames from "classnames";
|
|
6
|
+
import React, { useEffect, useRef } from "react";
|
|
7
|
+
import Button, { ButtonAppearance } from "../Button";
|
|
8
|
+
import { IS_DEV } from "../../utils";
|
|
9
|
+
export var Label = /*#__PURE__*/function (Label) {
|
|
10
|
+
Label["Close"] = "Close notification";
|
|
11
|
+
return Label;
|
|
12
|
+
}({});
|
|
13
|
+
export var NotificationSeverity = {
|
|
14
|
+
CAUTION: "caution",
|
|
15
|
+
INFORMATION: "information",
|
|
16
|
+
NEGATIVE: "negative",
|
|
17
|
+
POSITIVE: "positive"
|
|
18
|
+
};
|
|
19
|
+
export var DefaultTitles = {
|
|
20
|
+
[NotificationSeverity.CAUTION]: "Warning",
|
|
21
|
+
[NotificationSeverity.INFORMATION]: "Info",
|
|
22
|
+
[NotificationSeverity.NEGATIVE]: "Error",
|
|
23
|
+
[NotificationSeverity.POSITIVE]: "Success"
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The props for the Notification component.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
This is a [React](https://reactjs.org/) component for the Vanilla [Notification](https://docs.vanillaframework.io/patterns/notification/).
|
|
32
|
+
|
|
33
|
+
Notifications are used to display global information, our notification variants consist of default, caution, negative or positive.
|
|
34
|
+
|
|
35
|
+
The `NotificationProvider` component can be used to manage the notification state globally. Wrap your application components with it and then in any child component you can get the helper with `const notify = useNotify()` to easily trigger notifications:
|
|
36
|
+
|
|
37
|
+
* `notify.info("You should keep this in mind")`
|
|
38
|
+
* `notify.failure("Error when fooing a bar", errorObjectFromCatch)`
|
|
39
|
+
* `notify.success("The bar was foo'd", "Success")`
|
|
40
|
+
|
|
41
|
+
The `NotificationConsumer` component can be used to display notifications. It will automatically display any notifications that are added to the `NotificationProvider` state.
|
|
42
|
+
|
|
43
|
+
The Notification API has changed since v0.18 in order to support new variants
|
|
44
|
+
and align with our component prop naming conventions.
|
|
45
|
+
|
|
46
|
+
| Deprecated prop names | Replaced by |
|
|
47
|
+
| --------------------- | ----------- |
|
|
48
|
+
| `type` | `severity` |
|
|
49
|
+
| `status` | `title` |
|
|
50
|
+
| `close` | `onDismiss` |
|
|
51
|
+
|
|
52
|
+
The `notificationTypes` const has also been replaced with `NotificationSeverity`
|
|
53
|
+
to reflect the new prop name.
|
|
54
|
+
*/
|
|
55
|
+
var Notification = _ref => {
|
|
56
|
+
var {
|
|
57
|
+
actions,
|
|
58
|
+
borderless = false,
|
|
59
|
+
children,
|
|
60
|
+
className,
|
|
61
|
+
close,
|
|
62
|
+
inline = false,
|
|
63
|
+
onDismiss,
|
|
64
|
+
severity = NotificationSeverity.INFORMATION,
|
|
65
|
+
status,
|
|
66
|
+
timeout,
|
|
67
|
+
timestamp,
|
|
68
|
+
title,
|
|
69
|
+
titleElement: TitleComponent = "h5",
|
|
70
|
+
type
|
|
71
|
+
} = _ref,
|
|
72
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
73
|
+
var timeoutId = useRef(null);
|
|
74
|
+
var hasActions = (actions === null || actions === void 0 ? void 0 : actions.length) > 0;
|
|
75
|
+
var showMeta = !!timestamp || hasActions;
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (timeout && onDismiss) {
|
|
78
|
+
timeoutId.current = setTimeout(() => onDismiss(), timeout);
|
|
79
|
+
}
|
|
80
|
+
return () => clearTimeout(timeoutId.current);
|
|
81
|
+
}, [onDismiss, timeout]);
|
|
82
|
+
if (IS_DEV && (close || status || type)) {
|
|
83
|
+
console.warn("The Notification component is using deprecated props. Refer to the deprecated list for details: https://canonical.github.io/react-components/?path=/docs/notification--information#deprecated");
|
|
84
|
+
}
|
|
85
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
86
|
+
className: classNames(className, {
|
|
87
|
+
["p-notification--".concat(severity)]: !!severity,
|
|
88
|
+
"p-notification": !severity,
|
|
89
|
+
"is-borderless": borderless,
|
|
90
|
+
"is-inline": inline
|
|
91
|
+
})
|
|
92
|
+
}, props), /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
className: "p-notification__content"
|
|
94
|
+
}, title && /*#__PURE__*/React.createElement(TitleComponent, {
|
|
95
|
+
className: "p-notification__title",
|
|
96
|
+
"data-testid": "notification-title"
|
|
97
|
+
}, title), inline && /*#__PURE__*/React.createElement(React.Fragment, null, "\u2002"), /*#__PURE__*/React.createElement("p", {
|
|
98
|
+
className: "p-notification__message"
|
|
99
|
+
}, children), onDismiss && /*#__PURE__*/React.createElement("button", {
|
|
100
|
+
className: "p-notification__close",
|
|
101
|
+
"data-testid": "notification-close-button",
|
|
102
|
+
onClick: onDismiss
|
|
103
|
+
}, Label.Close)), showMeta && /*#__PURE__*/React.createElement("div", {
|
|
104
|
+
className: "p-notification__meta",
|
|
105
|
+
"data-testid": "notification-meta"
|
|
106
|
+
}, timestamp && /*#__PURE__*/React.createElement("span", {
|
|
107
|
+
className: "p-notification__timestamp",
|
|
108
|
+
"data-testid": "notification-timestamp"
|
|
109
|
+
}, timestamp), hasActions ? /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
className: "p-notification__actions"
|
|
111
|
+
}, actions.map((action, i) => /*#__PURE__*/React.createElement(Button, {
|
|
112
|
+
appearance: ButtonAppearance.LINK,
|
|
113
|
+
className: "p-notification__action",
|
|
114
|
+
"data-testid": "notification-action",
|
|
115
|
+
key: "".concat(action.label, "-").concat(i),
|
|
116
|
+
onClick: action.onClick
|
|
117
|
+
}, action.label))) : null));
|
|
118
|
+
};
|
|
119
|
+
export default Notification;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, NotificationSeverity } from "./Notification";
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React, { createContext, useContext, useEffect, useRef, useState } from "react";
|
|
2
|
+
import isEqual from "lodash/isEqual";
|
|
3
|
+
import { info as _info, failure as _failure, success as _success, queue } from "./messageBuilder";
|
|
4
|
+
import Notification, { DefaultTitles } from "../Notification/Notification";
|
|
5
|
+
var NotifyContext = /*#__PURE__*/createContext({
|
|
6
|
+
notification: null,
|
|
7
|
+
clear: () => undefined,
|
|
8
|
+
failure: () => undefined,
|
|
9
|
+
success: () => undefined,
|
|
10
|
+
info: () => undefined,
|
|
11
|
+
queue: () => undefined,
|
|
12
|
+
setDeduplicated: () => undefined
|
|
13
|
+
});
|
|
14
|
+
export var NotificationProvider = _ref => {
|
|
15
|
+
var {
|
|
16
|
+
children,
|
|
17
|
+
state,
|
|
18
|
+
pathname
|
|
19
|
+
} = _ref;
|
|
20
|
+
var [notification, setNotification] = useState(null);
|
|
21
|
+
var clear = () => notification !== null && setNotification(null);
|
|
22
|
+
var setDeduplicated = value => {
|
|
23
|
+
if (!isEqual(value, notification)) {
|
|
24
|
+
setNotification(value);
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (state !== null && state !== void 0 && state.queuedNotification) {
|
|
30
|
+
setDeduplicated(state.queuedNotification);
|
|
31
|
+
window.history.replaceState({}, "");
|
|
32
|
+
} else {
|
|
33
|
+
clear();
|
|
34
|
+
}
|
|
35
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
|
+
}, [state, pathname]);
|
|
37
|
+
var helper = {
|
|
38
|
+
notification,
|
|
39
|
+
clear,
|
|
40
|
+
queue,
|
|
41
|
+
failure: (title, error, message, actions) => setDeduplicated(_failure(title, error, message, actions)),
|
|
42
|
+
info: (message, title) => setDeduplicated(_info(message, title)),
|
|
43
|
+
success: (message, title) => setDeduplicated(_success(message, title)),
|
|
44
|
+
setDeduplicated
|
|
45
|
+
};
|
|
46
|
+
return /*#__PURE__*/React.createElement(NotifyContext.Provider, {
|
|
47
|
+
value: helper
|
|
48
|
+
}, children);
|
|
49
|
+
};
|
|
50
|
+
export function useNotify() {
|
|
51
|
+
return useContext(NotifyContext);
|
|
52
|
+
}
|
|
53
|
+
export var NotificationConsumer = () => {
|
|
54
|
+
var notify = useNotify();
|
|
55
|
+
var ref = useRef(null);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
var _ref$current;
|
|
58
|
+
if ((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.hasAttribute("scrollIntoView")) {
|
|
59
|
+
ref.current.scrollIntoView({
|
|
60
|
+
behavior: "smooth",
|
|
61
|
+
block: "center",
|
|
62
|
+
inline: "start"
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}, [notify.notification]);
|
|
66
|
+
if (!notify.notification) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
var {
|
|
70
|
+
actions,
|
|
71
|
+
title,
|
|
72
|
+
type,
|
|
73
|
+
message
|
|
74
|
+
} = notify.notification;
|
|
75
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
ref: ref
|
|
77
|
+
}, /*#__PURE__*/React.createElement(Notification, {
|
|
78
|
+
title: title !== null && title !== void 0 ? title : DefaultTitles[type],
|
|
79
|
+
actions: actions,
|
|
80
|
+
severity: type,
|
|
81
|
+
onDismiss: notify.clear
|
|
82
|
+
}, message));
|
|
83
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NotificationSeverity } from "../Notification";
|
|
3
|
+
export var queue = notification => {
|
|
4
|
+
return {
|
|
5
|
+
state: {
|
|
6
|
+
queuedNotification: notification
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export var info = (message, title) => {
|
|
11
|
+
return {
|
|
12
|
+
message,
|
|
13
|
+
title,
|
|
14
|
+
type: NotificationSeverity.INFORMATION
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export var success = (message, title) => {
|
|
18
|
+
return {
|
|
19
|
+
message,
|
|
20
|
+
title,
|
|
21
|
+
type: NotificationSeverity.POSITIVE
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export var failure = (title, error, message, actions) => {
|
|
25
|
+
return {
|
|
26
|
+
actions,
|
|
27
|
+
message: error && error instanceof Error ? /*#__PURE__*/React.createElement(React.Fragment, null, message, " ", error.message) : message,
|
|
28
|
+
title,
|
|
29
|
+
type: NotificationSeverity.NEGATIVE
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
var _excluded = ["itemsPerPage", "totalItems", "paginate", "currentPage", "scrollToTop", "truncateThreshold", "centered", "showLabels", "hideNumbers", "onForward", "onBack", "forwardDisabled", "backDisabled", "forwardLabel", "backLabel"];
|
|
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 PaginationButton from "./PaginationButton";
|
|
8
|
+
import PaginationItem from "./PaginationItem";
|
|
9
|
+
var scrollTop = () => window.scrollTo(0, 0);
|
|
10
|
+
var generatePaginationItems = (pageNumbers, currentPage, truncateThreshold, changePage) => {
|
|
11
|
+
var lastPage = pageNumbers.length;
|
|
12
|
+
var truncated = lastPage > truncateThreshold;
|
|
13
|
+
var visiblePages;
|
|
14
|
+
if (truncated) {
|
|
15
|
+
// the default range for pages outside the start and end threshold
|
|
16
|
+
var start = currentPage - 2;
|
|
17
|
+
var end = currentPage + 1;
|
|
18
|
+
// on page 1, also show pages 2, 3 and 4
|
|
19
|
+
if (currentPage === 1) {
|
|
20
|
+
start = 1;
|
|
21
|
+
end = Math.min(lastPage - 1, currentPage + 3);
|
|
22
|
+
}
|
|
23
|
+
// on page 2, show page 1, and also pages 3, and 4
|
|
24
|
+
if (currentPage === 2) {
|
|
25
|
+
start = 1;
|
|
26
|
+
end = Math.min(lastPage - 1, currentPage + 3);
|
|
27
|
+
}
|
|
28
|
+
// on the last page and page before last, also show the 3 previous pages
|
|
29
|
+
if (currentPage === lastPage || currentPage === lastPage - 1) {
|
|
30
|
+
start = Math.max(1, lastPage - 4);
|
|
31
|
+
end = lastPage - 1;
|
|
32
|
+
}
|
|
33
|
+
visiblePages = pageNumbers.slice(start, end);
|
|
34
|
+
} else {
|
|
35
|
+
visiblePages = pageNumbers;
|
|
36
|
+
}
|
|
37
|
+
var items = [];
|
|
38
|
+
if (truncated) {
|
|
39
|
+
// render first in sequence
|
|
40
|
+
items.push( /*#__PURE__*/React.createElement(PaginationItem, {
|
|
41
|
+
key: 1,
|
|
42
|
+
number: 1,
|
|
43
|
+
isActive: currentPage === 1,
|
|
44
|
+
onClick: () => changePage(1)
|
|
45
|
+
}));
|
|
46
|
+
if (!visiblePages.includes(2)) {
|
|
47
|
+
items.push( /*#__PURE__*/React.createElement(PaginationItemSeparator, {
|
|
48
|
+
key: "sep1"
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
items.push(visiblePages.map(number => /*#__PURE__*/React.createElement(PaginationItem, {
|
|
53
|
+
key: number,
|
|
54
|
+
number: number,
|
|
55
|
+
isActive: number === currentPage,
|
|
56
|
+
onClick: () => changePage(number)
|
|
57
|
+
})));
|
|
58
|
+
if (truncated) {
|
|
59
|
+
// render last in sequence
|
|
60
|
+
if (!visiblePages.includes(lastPage - 1)) {
|
|
61
|
+
items.push( /*#__PURE__*/React.createElement(PaginationItemSeparator, {
|
|
62
|
+
key: "sep2"
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
items.push( /*#__PURE__*/React.createElement(PaginationItem, {
|
|
66
|
+
key: lastPage,
|
|
67
|
+
number: lastPage,
|
|
68
|
+
isActive: currentPage === lastPage,
|
|
69
|
+
onClick: () => changePage(lastPage)
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
return items;
|
|
73
|
+
};
|
|
74
|
+
var PaginationItemSeparator = () => /*#__PURE__*/React.createElement("li", {
|
|
75
|
+
className: "p-pagination__item p-pagination__item--truncation"
|
|
76
|
+
}, "\u2026");
|
|
77
|
+
|
|
78
|
+
// Props that are used in both types of paginations.
|
|
79
|
+
|
|
80
|
+
// Used when number of items per page, number of total items,
|
|
81
|
+
// current page and paginate function is defined. Pagination
|
|
82
|
+
// is handled by paginate function and optional onForward and
|
|
83
|
+
// onBack functions.
|
|
84
|
+
|
|
85
|
+
// Used when number of items per page, number of total items,
|
|
86
|
+
// current page and paginate function are undefined.
|
|
87
|
+
// Pagination is handled by onForward and onBack function.
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
This is a [React](https://reactjs.org/) component for the Vanilla [Pagination](https://docs.vanillaframework.io/patterns/pagination/).
|
|
91
|
+
|
|
92
|
+
The pagination component should be used to navigate between pages of content. There are two types of pagination being provided:
|
|
93
|
+
|
|
94
|
+
* **Numbered Pagination:** used when the total number of items is known.<br />
|
|
95
|
+
Depending on the length provided, the pagination component will automatically scale.<br />
|
|
96
|
+
**Required props:** itemsPerPage, totalItems, paginate, currentPage.
|
|
97
|
+
|
|
98
|
+
* **Buttons-only Pagination:** used when the total number of items is unknown.<br />
|
|
99
|
+
**Required props:** onForward, onBack.
|
|
100
|
+
*/
|
|
101
|
+
var Pagination = _ref => {
|
|
102
|
+
var {
|
|
103
|
+
itemsPerPage,
|
|
104
|
+
totalItems,
|
|
105
|
+
paginate,
|
|
106
|
+
currentPage,
|
|
107
|
+
scrollToTop,
|
|
108
|
+
truncateThreshold = 10,
|
|
109
|
+
centered,
|
|
110
|
+
showLabels,
|
|
111
|
+
hideNumbers,
|
|
112
|
+
onForward,
|
|
113
|
+
onBack,
|
|
114
|
+
forwardDisabled,
|
|
115
|
+
backDisabled,
|
|
116
|
+
forwardLabel,
|
|
117
|
+
backLabel
|
|
118
|
+
} = _ref,
|
|
119
|
+
navProps = _objectWithoutProperties(_ref, _excluded);
|
|
120
|
+
var isNumberedPagination = !!itemsPerPage && !!totalItems && !!currentPage && !!paginate;
|
|
121
|
+
var pageNumbers = [];
|
|
122
|
+
if (isNumberedPagination) {
|
|
123
|
+
// return early if no pagination is required
|
|
124
|
+
if (totalItems <= itemsPerPage) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
for (var i = 1; i <= Math.ceil(totalItems / itemsPerPage); i++) {
|
|
128
|
+
pageNumbers.push(i);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
var changeNumberedPage = page => {
|
|
132
|
+
paginate(page);
|
|
133
|
+
if (page > currentPage) {
|
|
134
|
+
onForward === null || onForward === void 0 || onForward(page);
|
|
135
|
+
}
|
|
136
|
+
if (page < currentPage) {
|
|
137
|
+
onBack === null || onBack === void 0 || onBack(page);
|
|
138
|
+
}
|
|
139
|
+
scrollToTop && scrollTop();
|
|
140
|
+
};
|
|
141
|
+
var changeButtonsOnlyPage = direction => {
|
|
142
|
+
if (direction === "forward") {
|
|
143
|
+
onForward === null || onForward === void 0 || onForward(undefined);
|
|
144
|
+
}
|
|
145
|
+
if (direction === "back") {
|
|
146
|
+
onBack === null || onBack === void 0 || onBack(undefined);
|
|
147
|
+
}
|
|
148
|
+
scrollToTop && scrollTop();
|
|
149
|
+
};
|
|
150
|
+
return /*#__PURE__*/React.createElement("nav", _extends({
|
|
151
|
+
className: "p-pagination",
|
|
152
|
+
"aria-label": "Pagination"
|
|
153
|
+
}, navProps), /*#__PURE__*/React.createElement("ol", {
|
|
154
|
+
className: classNames("p-pagination__items", {
|
|
155
|
+
"u-align--center": centered
|
|
156
|
+
})
|
|
157
|
+
}, /*#__PURE__*/React.createElement(PaginationButton, {
|
|
158
|
+
key: "back",
|
|
159
|
+
direction: "back",
|
|
160
|
+
disabled: backDisabled || currentPage === 1,
|
|
161
|
+
onClick: () => isNumberedPagination ? changeNumberedPage(currentPage - 1) : changeButtonsOnlyPage("back"),
|
|
162
|
+
showLabel: showLabels,
|
|
163
|
+
label: backLabel
|
|
164
|
+
}), isNumberedPagination && !hideNumbers ? generatePaginationItems(pageNumbers, currentPage, truncateThreshold, changeNumberedPage) : null, /*#__PURE__*/React.createElement(PaginationButton, {
|
|
165
|
+
key: "forward",
|
|
166
|
+
direction: "forward",
|
|
167
|
+
disabled: forwardDisabled || currentPage === pageNumbers.length,
|
|
168
|
+
onClick: () => isNumberedPagination ? changeNumberedPage(currentPage + 1) : changeButtonsOnlyPage("forward"),
|
|
169
|
+
showLabel: showLabels,
|
|
170
|
+
label: forwardLabel
|
|
171
|
+
})));
|
|
172
|
+
};
|
|
173
|
+
export default Pagination;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export var Label = /*#__PURE__*/function (Label) {
|
|
4
|
+
Label["Next"] = "Next page";
|
|
5
|
+
Label["Previous"] = "Previous page";
|
|
6
|
+
return Label;
|
|
7
|
+
}({});
|
|
8
|
+
var PaginationButton = _ref => {
|
|
9
|
+
var {
|
|
10
|
+
direction,
|
|
11
|
+
onClick,
|
|
12
|
+
disabled = false,
|
|
13
|
+
showLabel,
|
|
14
|
+
label
|
|
15
|
+
} = _ref;
|
|
16
|
+
var buttonLabel = label || (direction === "back" ? Label.Previous : Label.Next);
|
|
17
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
18
|
+
className: "p-pagination__item"
|
|
19
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
20
|
+
className: classNames({
|
|
21
|
+
"p-pagination__link--previous": direction === "back",
|
|
22
|
+
"p-pagination__link--next": direction === "forward"
|
|
23
|
+
}),
|
|
24
|
+
disabled: disabled,
|
|
25
|
+
onClick: onClick,
|
|
26
|
+
type: "button"
|
|
27
|
+
}, direction === "forward" && showLabel && /*#__PURE__*/React.createElement("span", null, buttonLabel), /*#__PURE__*/React.createElement("i", {
|
|
28
|
+
className: "p-icon--chevron-down"
|
|
29
|
+
}, buttonLabel), direction === "back" && showLabel && /*#__PURE__*/React.createElement("span", null, buttonLabel)));
|
|
30
|
+
};
|
|
31
|
+
export default PaginationButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./PaginationButton";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import React from "react";
|
|
3
|
+
var PaginationItem = _ref => {
|
|
4
|
+
var {
|
|
5
|
+
number,
|
|
6
|
+
onClick,
|
|
7
|
+
isActive = false
|
|
8
|
+
} = _ref;
|
|
9
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
10
|
+
className: "p-pagination__item"
|
|
11
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
12
|
+
className: classNames("p-pagination__link", {
|
|
13
|
+
"is-active": isActive
|
|
14
|
+
}),
|
|
15
|
+
onClick: onClick,
|
|
16
|
+
"aria-current": isActive ? "page" : undefined,
|
|
17
|
+
type: "button"
|
|
18
|
+
}, number));
|
|
19
|
+
};
|
|
20
|
+
export default PaginationItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./PaginationItem";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Pagination";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
var _excluded = ["icon", "iconAlt", "name", "nameAlt", "component"],
|
|
2
|
+
_excluded2 = ["forwardRef", "children", "className", "contentClassName", "controlsClassName", "controls", "dark", "header", "logo", "stickyHeader", "title", "titleClassName", "titleComponent", "titleId", "toggle", "wrapContent"];
|
|
3
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
5
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
6
|
+
import React from "react";
|
|
7
|
+
import classNames from "classnames";
|
|
8
|
+
import { isReactNode } from "../../utils";
|
|
9
|
+
var generateLogo = logo => {
|
|
10
|
+
if (isReactNode(logo)) {
|
|
11
|
+
return logo;
|
|
12
|
+
}
|
|
13
|
+
var {
|
|
14
|
+
icon,
|
|
15
|
+
iconAlt,
|
|
16
|
+
name,
|
|
17
|
+
nameAlt,
|
|
18
|
+
component: Component = "a"
|
|
19
|
+
} = logo,
|
|
20
|
+
props = _objectWithoutProperties(logo, _excluded);
|
|
21
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
22
|
+
className: "p-panel__logo"
|
|
23
|
+
}, props), /*#__PURE__*/React.createElement("img", {
|
|
24
|
+
className: "p-panel__logo-icon",
|
|
25
|
+
src: icon,
|
|
26
|
+
alt: iconAlt,
|
|
27
|
+
width: "24",
|
|
28
|
+
height: "24"
|
|
29
|
+
}), /*#__PURE__*/React.createElement("img", {
|
|
30
|
+
className: "p-panel__logo-name is-fading-when-collapsed",
|
|
31
|
+
src: name,
|
|
32
|
+
alt: nameAlt,
|
|
33
|
+
height: "16"
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* This is a [React](https://reactjs.org/) component for panels in the
|
|
39
|
+
* [Vanilla](https://vanillaframework.io/docs/) layouts.
|
|
40
|
+
*
|
|
41
|
+
* The Panel component can be used in many areas of the application layout. It
|
|
42
|
+
* can be the child element of `AppAside`, `AppMain`, `AppNavigation`, `AppNavigationBar`
|
|
43
|
+
* and `AppStatus`.
|
|
44
|
+
*/
|
|
45
|
+
var Panel = _ref => {
|
|
46
|
+
var {
|
|
47
|
+
forwardRef,
|
|
48
|
+
children,
|
|
49
|
+
className,
|
|
50
|
+
contentClassName,
|
|
51
|
+
controlsClassName,
|
|
52
|
+
controls,
|
|
53
|
+
dark,
|
|
54
|
+
header,
|
|
55
|
+
logo,
|
|
56
|
+
stickyHeader,
|
|
57
|
+
title,
|
|
58
|
+
titleClassName,
|
|
59
|
+
titleComponent: TitleComponent = "h4",
|
|
60
|
+
titleId,
|
|
61
|
+
toggle,
|
|
62
|
+
wrapContent = true
|
|
63
|
+
} = _ref,
|
|
64
|
+
props = _objectWithoutProperties(_ref, _excluded2);
|
|
65
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
66
|
+
className: classNames("p-panel", className, {
|
|
67
|
+
"is-dark": dark
|
|
68
|
+
}),
|
|
69
|
+
ref: forwardRef
|
|
70
|
+
}), logo || title || controls || toggle ? /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: classNames("p-panel__header", {
|
|
72
|
+
"is-sticky": stickyHeader
|
|
73
|
+
})
|
|
74
|
+
}, logo ? generateLogo(logo) : /*#__PURE__*/React.createElement(TitleComponent, {
|
|
75
|
+
className: classNames("p-panel__title", titleClassName),
|
|
76
|
+
id: titleId
|
|
77
|
+
}, title), /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: classNames("p-panel__controls", controlsClassName)
|
|
79
|
+
}, toggle ? /*#__PURE__*/React.createElement("span", {
|
|
80
|
+
role: "button",
|
|
81
|
+
tabIndex: 0,
|
|
82
|
+
className: "p-panel__toggle",
|
|
83
|
+
onClick: () => toggle.onClick(),
|
|
84
|
+
onKeyDown: () => toggle.onClick()
|
|
85
|
+
}, toggle.label) : null, controls)) : header, children && wrapContent ? /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: classNames("p-panel__content", contentClassName)
|
|
87
|
+
}, children) : children);
|
|
88
|
+
};
|
|
89
|
+
export default Panel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Panel";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var _excluded = ["caution", "className", "error", "help", "id", "label", "readOnly", "required", "success", "type", "wrapperClassName"];
|
|
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, useState } from "react";
|
|
7
|
+
import Button from "../Button";
|
|
8
|
+
import Field from "../Field";
|
|
9
|
+
import VanillaLabel from "../Label";
|
|
10
|
+
export var Label = /*#__PURE__*/function (Label) {
|
|
11
|
+
Label["Hide"] = "Hide";
|
|
12
|
+
Label["Show"] = "Show";
|
|
13
|
+
return Label;
|
|
14
|
+
}({});
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The props for the Password Toggle component.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* This is a [React](https://reactjs.org/) component for the Vanilla [Password Toggle](https://docs.vanillaframework.io/base/forms/#password-toggle).
|
|
22
|
+
*
|
|
23
|
+
* It can be used when an input needs to obscure its value, whilst giving the user a way to reveal it if needed.
|
|
24
|
+
*/
|
|
25
|
+
var PasswordToggle = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
26
|
+
var {
|
|
27
|
+
caution,
|
|
28
|
+
className,
|
|
29
|
+
error,
|
|
30
|
+
help,
|
|
31
|
+
id,
|
|
32
|
+
label,
|
|
33
|
+
readOnly,
|
|
34
|
+
required,
|
|
35
|
+
success,
|
|
36
|
+
type,
|
|
37
|
+
wrapperClassName
|
|
38
|
+
} = _ref,
|
|
39
|
+
inputProps = _objectWithoutProperties(_ref, _excluded);
|
|
40
|
+
var [isPassword, setIsPassword] = useState(true);
|
|
41
|
+
var validationId = useId();
|
|
42
|
+
var helpId = useId();
|
|
43
|
+
var hasError = !!error;
|
|
44
|
+
var defaultPasswordToggleId = useId();
|
|
45
|
+
var passwordToggleId = id || defaultPasswordToggleId;
|
|
46
|
+
var togglePassword = () => {
|
|
47
|
+
if (isPassword) {
|
|
48
|
+
setIsPassword(false);
|
|
49
|
+
} else {
|
|
50
|
+
setIsPassword(true);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
54
|
+
caution: caution,
|
|
55
|
+
className: wrapperClassName,
|
|
56
|
+
error: error,
|
|
57
|
+
help: help,
|
|
58
|
+
helpId: helpId,
|
|
59
|
+
required: required,
|
|
60
|
+
success: success,
|
|
61
|
+
validationId: validationId
|
|
62
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: "p-form-password-toggle"
|
|
64
|
+
}, /*#__PURE__*/React.createElement(VanillaLabel, {
|
|
65
|
+
forId: passwordToggleId,
|
|
66
|
+
required: required
|
|
67
|
+
}, label), /*#__PURE__*/React.createElement(Button, {
|
|
68
|
+
appearance: "base",
|
|
69
|
+
type: type ? type : "button",
|
|
70
|
+
className: "u-no-margin--bottom",
|
|
71
|
+
hasIcon: true,
|
|
72
|
+
"aria-controls": id,
|
|
73
|
+
"aria-live": "polite",
|
|
74
|
+
onClick: () => togglePassword()
|
|
75
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
76
|
+
className: "p-form-password-toggle__label"
|
|
77
|
+
}, isPassword ? Label.Show : Label.Hide), /*#__PURE__*/React.createElement("i", {
|
|
78
|
+
className: isPassword ? "p-icon--show" : "p-icon--hide"
|
|
79
|
+
}))), /*#__PURE__*/React.createElement("input", _extends({
|
|
80
|
+
"aria-describedby": [help ? helpId : null, success ? validationId : null].filter(Boolean).join(" "),
|
|
81
|
+
"aria-errormessage": hasError ? validationId : null,
|
|
82
|
+
"aria-invalid": hasError,
|
|
83
|
+
className: classNames("p-form-validation__input", className),
|
|
84
|
+
id: passwordToggleId,
|
|
85
|
+
readOnly: readOnly,
|
|
86
|
+
ref: ref,
|
|
87
|
+
type: isPassword ? "password" : "text"
|
|
88
|
+
}, inputProps)));
|
|
89
|
+
});
|
|
90
|
+
export default PasswordToggle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./PasswordToggle";
|