@canonical/react-components 0.47.0 → 0.47.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/dist/__mocks__/nanoid.js +3 -3
- package/dist/components/Accordion/Accordion.js +28 -41
- package/dist/components/Accordion/AccordionSection/AccordionSection.js +18 -18
- package/dist/components/Accordion/AccordionSection/index.js +1 -1
- package/dist/components/Accordion/index.js +1 -1
- package/dist/components/ActionButton/ActionButton.js +34 -66
- package/dist/components/ActionButton/index.js +1 -1
- package/dist/components/ArticlePagination/ArticlePagination.js +10 -12
- package/dist/components/ArticlePagination/index.js +1 -1
- package/dist/components/Badge/Badge.js +24 -29
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Button/Button.js +21 -26
- package/dist/components/Button/index.js +4 -5
- package/dist/components/Card/Card.js +12 -14
- package/dist/components/Card/index.js +1 -1
- package/dist/components/CheckboxInput/CheckableInput/CheckableInput.js +15 -19
- package/dist/components/CheckboxInput/CheckableInput/index.js +1 -1
- package/dist/components/CheckboxInput/CheckboxInput.js +7 -10
- package/dist/components/CheckboxInput/index.js +1 -1
- package/dist/components/Chip/Chip.js +23 -33
- package/dist/components/Chip/index.js +1 -1
- package/dist/components/Code/Code.js +14 -17
- package/dist/components/Code/index.js +1 -1
- package/dist/components/CodeSnippet/CodeSnippet.js +9 -14
- package/dist/components/CodeSnippet/CodeSnippetBlock.js +24 -29
- package/dist/components/CodeSnippet/CodeSnippetDropdown.js +11 -11
- package/dist/components/CodeSnippet/index.js +2 -2
- package/dist/components/Col/Col.js +24 -26
- package/dist/components/Col/index.js +4 -5
- package/dist/components/ConfirmationButton/ConfirmationButton.js +18 -21
- package/dist/components/ConfirmationButton/index.js +1 -1
- package/dist/components/ConfirmationModal/ConfirmationModal.js +11 -15
- package/dist/components/ConfirmationModal/index.js +1 -1
- package/dist/components/ContextualMenu/ContextualMenu.js +89 -107
- package/dist/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.d.ts +4 -4
- package/dist/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.js +97 -107
- package/dist/components/ContextualMenu/ContextualMenuDropdown/index.js +1 -1
- package/dist/components/ContextualMenu/index.js +1 -1
- package/dist/components/EmptyState/EmptyState.js +9 -11
- package/dist/components/EmptyState/index.js +1 -1
- package/dist/components/Field/Field.js +66 -65
- package/dist/components/Field/index.js +1 -1
- package/dist/components/Form/Form.js +9 -11
- package/dist/components/Form/index.js +1 -1
- package/dist/components/Icon/Icon.js +9 -12
- package/dist/components/Icon/index.js +4 -5
- package/dist/components/Input/Input.js +38 -45
- package/dist/components/Input/index.js +1 -1
- package/dist/components/Label/Label.js +9 -11
- package/dist/components/Label/index.js +1 -1
- package/dist/components/Link/Link.js +12 -18
- package/dist/components/Link/index.js +1 -1
- package/dist/components/List/List.js +50 -54
- package/dist/components/List/index.js +1 -1
- package/dist/components/Loader/Loader.js +2 -3
- package/dist/components/Loader/index.js +1 -1
- package/dist/components/MainTable/MainTable.js +87 -104
- package/dist/components/MainTable/index.js +1 -1
- package/dist/components/Modal/Modal.js +45 -40
- package/dist/components/Modal/index.js +1 -1
- package/dist/components/ModularTable/ModularTable.js +63 -77
- package/dist/components/ModularTable/index.js +1 -1
- package/dist/components/Navigation/Navigation.js +63 -97
- package/dist/components/Navigation/NavigationLink/NavigationLink.js +32 -35
- package/dist/components/Navigation/NavigationLink/index.js +1 -1
- package/dist/components/Navigation/NavigationMenu/NavigationMenu.js +26 -45
- package/dist/components/Navigation/NavigationMenu/index.js +1 -1
- package/dist/components/Navigation/index.js +1 -1
- package/dist/components/Notification/Notification.js +49 -59
- package/dist/components/Notification/index.js +4 -5
- package/dist/components/NotificationProvider/NotificationProvider.js +47 -68
- package/dist/components/NotificationProvider/index.js +7 -7
- package/dist/components/NotificationProvider/messageBuilder.js +9 -9
- package/dist/components/NotificationProvider/types.d.ts +1 -0
- package/dist/components/Pagination/Pagination.js +55 -74
- package/dist/components/Pagination/PaginationButton/PaginationButton.js +11 -12
- package/dist/components/Pagination/PaginationButton/index.js +1 -1
- package/dist/components/Pagination/PaginationItem/PaginationItem.js +7 -7
- package/dist/components/Pagination/PaginationItem/index.js +1 -1
- package/dist/components/Pagination/index.js +1 -1
- package/dist/components/PasswordToggle/PasswordToggle.d.ts +1 -1
- package/dist/components/PasswordToggle/PasswordToggle.js +25 -40
- package/dist/components/PasswordToggle/index.js +1 -1
- package/dist/components/RadioInput/RadioInput.js +6 -8
- package/dist/components/RadioInput/index.js +1 -1
- package/dist/components/Row/Row.js +7 -9
- package/dist/components/Row/index.js +1 -1
- package/dist/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.js +38 -51
- package/dist/components/SearchAndFilter/FilterPanelSection/index.js +1 -1
- package/dist/components/SearchAndFilter/SearchAndFilter.js +75 -135
- package/dist/components/SearchAndFilter/index.js +1 -1
- package/dist/components/SearchAndFilter/utils.js +4 -8
- package/dist/components/SearchBox/SearchBox.js +25 -33
- package/dist/components/SearchBox/index.js +1 -1
- package/dist/components/Select/Select.js +38 -44
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Slider/Slider.js +27 -35
- package/dist/components/Slider/index.js +1 -1
- package/dist/components/Spinner/Spinner.js +10 -15
- package/dist/components/Spinner/index.js +1 -1
- package/dist/components/StatusLabel/StatusLabel.js +11 -13
- package/dist/components/StatusLabel/index.js +4 -5
- package/dist/components/Strip/Strip.js +27 -34
- package/dist/components/Strip/index.js +1 -1
- package/dist/components/SummaryButton/SummaryButton.js +9 -8
- package/dist/components/SummaryButton/index.js +1 -1
- package/dist/components/Switch/Switch.js +7 -10
- package/dist/components/Switch/index.js +1 -1
- package/dist/components/Table/Table.js +9 -13
- package/dist/components/Table/index.js +1 -1
- package/dist/components/TableCell/TableCell.js +11 -17
- package/dist/components/TableCell/index.js +1 -1
- package/dist/components/TableHeader/TableHeader.js +7 -9
- package/dist/components/TableHeader/index.js +1 -1
- package/dist/components/TablePagination/TablePagination.d.ts +37 -0
- package/dist/components/TablePagination/TablePagination.js +125 -0
- package/dist/components/TablePagination/TablePagination.scss +40 -0
- package/dist/components/TablePagination/TablePaginationControls/TablePaginationControls.d.ts +16 -0
- package/dist/components/TablePagination/TablePaginationControls/TablePaginationControls.js +66 -0
- package/dist/components/TablePagination/TablePaginationControls/index.d.ts +2 -0
- package/dist/components/TablePagination/TablePaginationControls/index.js +13 -0
- package/dist/components/TablePagination/index.d.ts +2 -0
- package/dist/components/TablePagination/index.js +13 -0
- package/dist/components/TableRow/TableRow.js +6 -8
- package/dist/components/TableRow/index.js +1 -1
- package/dist/components/Tabs/Tabs.js +17 -17
- package/dist/components/Tabs/index.js +1 -1
- package/dist/components/Textarea/Textarea.js +51 -45
- package/dist/components/Textarea/index.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +5 -1
- package/dist/components/Tooltip/Tooltip.js +76 -79
- package/dist/components/Tooltip/index.js +4 -5
- package/dist/enums.js +2 -3
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +16 -10
- package/dist/hooks/useId.js +1 -3
- package/dist/hooks/useListener.d.ts +2 -1
- package/dist/hooks/useListener.js +25 -24
- package/dist/hooks/useOnClickOutside.d.ts +12 -0
- package/dist/hooks/useOnClickOutside.js +45 -0
- package/dist/hooks/useOnEscapePressed.d.ts +3 -1
- package/dist/hooks/useOnEscapePressed.js +13 -6
- package/dist/hooks/usePagination.js +17 -29
- package/dist/hooks/usePrevious.js +4 -4
- package/dist/hooks/useThrottle.js +16 -25
- package/dist/hooks/useWindowFitment.js +30 -28
- package/dist/index.d.ts +3 -1
- package/dist/index.js +86 -74
- package/dist/utils.js +6 -13
- package/package.json +56 -49
- package/dist/hooks/useClickOutside.d.ts +0 -6
- package/dist/hooks/useClickOutside.js +0 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/react-components",
|
|
3
|
-
"version": "0.47.
|
|
3
|
+
"version": "0.47.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"author": "Huw Wilkins <huw.wilkins@canonical.com>",
|
|
@@ -22,84 +22,91 @@
|
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://canonical.github.io/react-components",
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@babel/cli": "7.
|
|
26
|
-
"@babel/eslint-parser": "7.
|
|
27
|
-
"@babel/preset-typescript": "7.
|
|
28
|
-
"@percy/cli": "1.
|
|
29
|
-
"@percy/storybook": "4.3.
|
|
30
|
-
"@storybook/addon-a11y": "6.
|
|
31
|
-
"@storybook/addon-
|
|
32
|
-
"@storybook/addon-
|
|
33
|
-
"@storybook/
|
|
34
|
-
"@storybook/
|
|
35
|
-
"@storybook/
|
|
36
|
-
"@storybook/
|
|
37
|
-
"@storybook/
|
|
25
|
+
"@babel/cli": "7.23.4",
|
|
26
|
+
"@babel/eslint-parser": "7.23.3",
|
|
27
|
+
"@babel/preset-typescript": "7.23.3",
|
|
28
|
+
"@percy/cli": "1.27.6",
|
|
29
|
+
"@percy/storybook": "4.3.7",
|
|
30
|
+
"@storybook/addon-a11y": "7.6.7",
|
|
31
|
+
"@storybook/addon-essentials": "7.6.7",
|
|
32
|
+
"@storybook/addon-interactions": "7.6.7",
|
|
33
|
+
"@storybook/addon-links": "7.6.7",
|
|
34
|
+
"@storybook/addon-mdx-gfm": "7.6.7",
|
|
35
|
+
"@storybook/addon-onboarding": "1.0.10",
|
|
36
|
+
"@storybook/blocks": "7.6.7",
|
|
37
|
+
"@storybook/react": "7.6.7",
|
|
38
|
+
"@storybook/react-webpack5": "7.6.7",
|
|
38
39
|
"@testing-library/cypress": "9.0.0",
|
|
39
|
-
"@testing-library/dom": "9.3.
|
|
40
|
-
"@testing-library/jest-dom": "5.
|
|
41
|
-
"@testing-library/react": "14.
|
|
42
|
-
"@testing-library/user-event": "14.
|
|
40
|
+
"@testing-library/dom": "9.3.3",
|
|
41
|
+
"@testing-library/jest-dom": "5.17.0",
|
|
42
|
+
"@testing-library/react": "14.1.2",
|
|
43
|
+
"@testing-library/user-event": "14.5.2",
|
|
43
44
|
"@types/react-router-dom": "5.3.3",
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
45
|
-
"@typescript-eslint/parser": "5.
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "5.62.0",
|
|
46
|
+
"@typescript-eslint/parser": "5.62.0",
|
|
46
47
|
"babel-jest": "27.5.1",
|
|
47
|
-
"babel-loader": "9.1.
|
|
48
|
+
"babel-loader": "9.1.3",
|
|
48
49
|
"babel-plugin-module-resolver": "5.0.0",
|
|
49
50
|
"babel-plugin-typescript-to-proptypes": "2.1.0",
|
|
50
|
-
"concurrently": "8.2.
|
|
51
|
+
"concurrently": "8.2.2",
|
|
51
52
|
"css-loader": "6.8.1",
|
|
52
|
-
"cypress": "12.
|
|
53
|
+
"cypress": "12.17.4",
|
|
53
54
|
"deepmerge": "4.3.1",
|
|
54
|
-
"eslint": "8.
|
|
55
|
-
"eslint-config-prettier": "8.
|
|
55
|
+
"eslint": "8.56.0",
|
|
56
|
+
"eslint-config-prettier": "8.10.0",
|
|
56
57
|
"eslint-config-react-app": "7.0.1",
|
|
57
|
-
"eslint-plugin-cypress": "2.
|
|
58
|
+
"eslint-plugin-cypress": "2.15.1",
|
|
58
59
|
"eslint-plugin-flowtype": "8.0.3",
|
|
59
|
-
"eslint-plugin-import": "2.
|
|
60
|
-
"eslint-plugin-jsx-a11y": "6.
|
|
60
|
+
"eslint-plugin-import": "2.29.1",
|
|
61
|
+
"eslint-plugin-jsx-a11y": "6.8.0",
|
|
61
62
|
"eslint-plugin-prettier": "4.2.1",
|
|
62
|
-
"eslint-plugin-react": "7.
|
|
63
|
+
"eslint-plugin-react": "7.33.2",
|
|
63
64
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
64
|
-
"eslint-plugin-
|
|
65
|
+
"eslint-plugin-storybook": "0.6.15",
|
|
66
|
+
"eslint-plugin-testing-library": "5.11.1",
|
|
65
67
|
"jest": "27.5.1",
|
|
66
68
|
"npm-package-json-lint": "5.4.2",
|
|
67
69
|
"prettier": "2.8.8",
|
|
68
70
|
"react": "18.2.0",
|
|
69
71
|
"react-docgen-typescript-loader": "3.7.2",
|
|
70
72
|
"react-dom": "18.2.0",
|
|
71
|
-
"sass": "1.
|
|
72
|
-
"sass-loader": "10.
|
|
73
|
+
"sass": "1.69.7",
|
|
74
|
+
"sass-loader": "10.5.1",
|
|
75
|
+
"storybook": "7.6.7",
|
|
73
76
|
"style-loader": "3.3.3",
|
|
74
|
-
"stylelint": "15.
|
|
77
|
+
"stylelint": "15.11.0",
|
|
75
78
|
"stylelint-config-prettier": "9.0.5",
|
|
76
79
|
"stylelint-config-recommended-scss": "5.0.2",
|
|
77
80
|
"stylelint-order": "5.0.0",
|
|
78
81
|
"stylelint-prettier": "2.0.0",
|
|
79
82
|
"ts-jest": "27.1.5",
|
|
80
|
-
"tsc-alias": "1.8.
|
|
83
|
+
"tsc-alias": "1.8.8",
|
|
81
84
|
"typescript": "4.9.5",
|
|
82
|
-
"vanilla-framework": "4.
|
|
85
|
+
"vanilla-framework": "4.6.0",
|
|
83
86
|
"wait-on": "5.3.0",
|
|
84
|
-
"webpack": "5.
|
|
87
|
+
"webpack": "5.89.0"
|
|
85
88
|
},
|
|
86
89
|
"dependencies": {
|
|
87
90
|
"@types/jest": "27.5.2",
|
|
88
|
-
"@types/node": "18.
|
|
89
|
-
"@types/react": "18.2.
|
|
90
|
-
"@types/react-dom": "18.2.
|
|
91
|
-
"@types/react-table": "7.7.
|
|
92
|
-
"classnames": "2.
|
|
93
|
-
"nanoid": "3.3.
|
|
91
|
+
"@types/node": "18.19.4",
|
|
92
|
+
"@types/react": "18.2.46",
|
|
93
|
+
"@types/react-dom": "18.2.18",
|
|
94
|
+
"@types/react-table": "7.7.19",
|
|
95
|
+
"classnames": "2.5.1",
|
|
96
|
+
"nanoid": "3.3.7",
|
|
94
97
|
"prop-types": "15.8.1",
|
|
95
|
-
"react-router-dom": "6.
|
|
98
|
+
"react-router-dom": "6.21.1",
|
|
96
99
|
"react-table": "7.8.0",
|
|
97
|
-
"react-useportal": "1.0.
|
|
100
|
+
"react-useportal": "1.0.19"
|
|
98
101
|
},
|
|
99
102
|
"resolutions": {
|
|
100
|
-
"@types/react": "18.2.
|
|
101
|
-
"@types/react-dom": "18.2.
|
|
102
|
-
"postcss": "^8.3.11"
|
|
103
|
+
"@types/react": "18.2.46",
|
|
104
|
+
"@types/react-dom": "18.2.18",
|
|
105
|
+
"postcss": "^8.3.11",
|
|
106
|
+
"string-width": "^4",
|
|
107
|
+
"jackspeak": "^2",
|
|
108
|
+
"strip-ansi": "^6.0.0",
|
|
109
|
+
"strip-ansi-cjs": "^8.0.0"
|
|
103
110
|
},
|
|
104
111
|
"peerDependencies": {
|
|
105
112
|
"@types/react": "^17.0.2 || ^18.0.0",
|
|
@@ -113,9 +120,9 @@
|
|
|
113
120
|
"build-local": "NODE_ENV=production babel src --out-dir dist --copy-files --extensions '.js,.jsx,.ts,.tsx'",
|
|
114
121
|
"build-declaration": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
|
|
115
122
|
"build-watch": "yarn run build-local --watch",
|
|
116
|
-
"build-docs": "
|
|
123
|
+
"build-docs": "storybook build -c .storybook -o docs",
|
|
117
124
|
"clean": "rm -rf node_modules dist .out",
|
|
118
|
-
"docs": "
|
|
125
|
+
"docs": "storybook dev -p ${PORT:-9009}",
|
|
119
126
|
"link-packages": "yarn install && yarn build && yarn link && cd node_modules/react && yarn link && cd ../react-dom && yarn link",
|
|
120
127
|
"lint-js": "eslint src",
|
|
121
128
|
"lint-style": "stylelint src/**/*.scss",
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { MutableRefObject } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Handle clicks outside an element.
|
|
4
|
-
* @returns A ref to pass to the element to handle clicks outside of.
|
|
5
|
-
*/
|
|
6
|
-
export declare const useClickOutside: <E extends HTMLElement>(onClickOutside: () => void) => MutableRefObject<E>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useClickOutside = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
/**
|
|
9
|
-
* Handle clicks outside an element.
|
|
10
|
-
* @returns A ref to pass to the element to handle clicks outside of.
|
|
11
|
-
*/
|
|
12
|
-
var useClickOutside = function useClickOutside(onClickOutside) {
|
|
13
|
-
var ref = (0, _react.useRef)(null);
|
|
14
|
-
var handleClickOutside = (0, _react.useCallback)(function (evt) {
|
|
15
|
-
var _evt$target, _ref$current;
|
|
16
|
-
var target = evt.target;
|
|
17
|
-
// The target might be something like an SVG node which doesn't provide
|
|
18
|
-
// the class name as a string.
|
|
19
|
-
var isValidTarget = typeof (evt === null || evt === void 0 ? void 0 : (_evt$target = evt.target) === null || _evt$target === void 0 ? void 0 : _evt$target.className) === "string";
|
|
20
|
-
if (!isValidTarget || ref.current && !((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains(target)) && ref.current !== target) {
|
|
21
|
-
onClickOutside();
|
|
22
|
-
}
|
|
23
|
-
}, [onClickOutside]);
|
|
24
|
-
(0, _react.useEffect)(function () {
|
|
25
|
-
document.addEventListener("click", handleClickOutside, false);
|
|
26
|
-
return function () {
|
|
27
|
-
return document.removeEventListener("click", handleClickOutside, false);
|
|
28
|
-
};
|
|
29
|
-
}, [handleClickOutside]);
|
|
30
|
-
return ref;
|
|
31
|
-
};
|
|
32
|
-
exports.useClickOutside = useClickOutside;
|