@canonical/react-components 0.41.0 → 0.42.0
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 +0 -2
- package/dist/components/Accordion/Accordion.js +13 -37
- package/dist/components/Accordion/AccordionSection/AccordionSection.js +8 -14
- package/dist/components/Accordion/AccordionSection/index.js +0 -2
- package/dist/components/Accordion/index.js +0 -2
- package/dist/components/ActionButton/ActionButton.js +32 -65
- package/dist/components/ActionButton/index.js +0 -2
- package/dist/components/ArticlePagination/ArticlePagination.js +5 -15
- package/dist/components/ArticlePagination/index.js +0 -2
- package/dist/components/Badge/Badge.js +10 -28
- package/dist/components/Badge/index.js +0 -2
- package/dist/components/Button/Button.js +12 -25
- package/dist/components/Button/index.js +0 -4
- package/dist/components/Card/Card.js +6 -17
- package/dist/components/Card/index.js +0 -2
- package/dist/components/CheckboxInput/CheckableInput/CheckableInput.js +6 -20
- package/dist/components/CheckboxInput/CheckableInput/index.js +0 -2
- package/dist/components/CheckboxInput/CheckboxInput.js +3 -13
- package/dist/components/CheckboxInput/index.js +0 -2
- package/dist/components/Chip/Chip.js +14 -30
- package/dist/components/Chip/index.js +0 -2
- package/dist/components/Code/Code.js +5 -23
- package/dist/components/Code/index.js +0 -2
- package/dist/components/CodeSnippet/CodeSnippet.js +2 -12
- package/dist/components/CodeSnippet/CodeSnippetBlock.js +10 -18
- package/dist/components/CodeSnippet/CodeSnippetDropdown.js +5 -14
- package/dist/components/CodeSnippet/index.js +0 -3
- package/dist/components/Col/Col.js +15 -25
- package/dist/components/Col/index.js +0 -4
- package/dist/components/ContextualMenu/ContextualMenu.js +66 -101
- package/dist/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.js +47 -84
- package/dist/components/ContextualMenu/ContextualMenuDropdown/index.js +0 -2
- package/dist/components/ContextualMenu/index.js +0 -2
- package/dist/components/Field/Field.js +35 -51
- package/dist/components/Field/index.js +0 -2
- package/dist/components/Form/Form.js +4 -14
- package/dist/components/Form/index.js +0 -2
- package/dist/components/Icon/Icon.js +3 -14
- package/dist/components/Icon/index.js +0 -4
- package/dist/components/Input/Input.js +21 -39
- package/dist/components/Input/index.js +0 -2
- package/dist/components/Label/Label.js +7 -13
- package/dist/components/Label/index.js +0 -2
- package/dist/components/Link/Link.js +10 -22
- package/dist/components/Link/index.js +0 -2
- package/dist/components/List/List.js +18 -31
- package/dist/components/List/index.js +0 -2
- package/dist/components/Loader/Loader.js +0 -7
- package/dist/components/Loader/index.js +0 -2
- package/dist/components/MainTable/MainTable.js +59 -111
- package/dist/components/MainTable/index.js +0 -2
- package/dist/components/Modal/Modal.js +7 -34
- package/dist/components/Modal/index.js +0 -2
- package/dist/components/ModularTable/ModularTable.d.ts +9 -1
- package/dist/components/ModularTable/ModularTable.js +39 -46
- package/dist/components/ModularTable/index.js +0 -2
- package/dist/components/Navigation/Navigation.js +46 -82
- package/dist/components/Navigation/NavigationLink/NavigationLink.js +15 -30
- package/dist/components/Navigation/NavigationLink/index.js +0 -2
- package/dist/components/Navigation/NavigationMenu/NavigationMenu.js +12 -35
- package/dist/components/Navigation/NavigationMenu/index.js +0 -2
- package/dist/components/Navigation/index.js +0 -2
- package/dist/components/Notification/Notification.js +25 -41
- package/dist/components/Notification/index.js +0 -4
- package/dist/components/Pagination/Pagination.js +14 -44
- package/dist/components/Pagination/PaginationButton/PaginationButton.js +3 -10
- package/dist/components/Pagination/PaginationButton/index.js +0 -2
- package/dist/components/Pagination/PaginationItem/PaginationItem.js +3 -8
- package/dist/components/Pagination/PaginationItem/index.js +0 -2
- package/dist/components/Pagination/index.js +0 -2
- package/dist/components/PasswordToggle/PasswordToggle.js +16 -45
- package/dist/components/PasswordToggle/index.js +0 -2
- package/dist/components/RadioInput/RadioInput.js +1 -11
- package/dist/components/RadioInput/index.js +0 -2
- package/dist/components/Row/Row.js +2 -12
- package/dist/components/Row/index.js +0 -2
- package/dist/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.js +27 -49
- package/dist/components/SearchAndFilter/FilterPanelSection/index.js +0 -2
- package/dist/components/SearchAndFilter/SearchAndFilter.d.ts +9 -1
- package/dist/components/SearchAndFilter/SearchAndFilter.js +68 -104
- package/dist/components/SearchAndFilter/index.js +0 -2
- package/dist/components/SearchAndFilter/utils.js +1 -7
- package/dist/components/SearchBox/SearchBox.js +14 -34
- package/dist/components/SearchBox/index.js +0 -2
- package/dist/components/Select/Select.js +20 -33
- package/dist/components/Select/index.js +0 -2
- package/dist/components/Slider/Slider.js +16 -32
- package/dist/components/Slider/index.js +0 -2
- package/dist/components/Spinner/Spinner.js +8 -19
- package/dist/components/Spinner/index.js +0 -2
- package/dist/components/StatusLabel/StatusLabel.js +4 -15
- package/dist/components/StatusLabel/index.js +0 -4
- package/dist/components/Strip/Strip.js +25 -36
- package/dist/components/Strip/index.js +0 -2
- package/dist/components/SummaryButton/SummaryButton.js +4 -10
- package/dist/components/SummaryButton/index.js +0 -2
- package/dist/components/Switch/Switch.js +3 -12
- package/dist/components/Switch/index.js +0 -2
- package/dist/components/Table/Table.js +6 -16
- package/dist/components/Table/index.js +0 -2
- package/dist/components/TableCell/TableCell.js +10 -20
- package/dist/components/TableCell/index.js +0 -2
- package/dist/components/TableHeader/TableHeader.js +2 -11
- package/dist/components/TableHeader/index.js +0 -2
- package/dist/components/TableRow/TableRow.js +1 -10
- package/dist/components/TableRow/index.js +0 -2
- package/dist/components/Tabs/Tabs.js +7 -17
- package/dist/components/Tabs/index.js +0 -2
- package/dist/components/Textarea/Textarea.js +23 -36
- package/dist/components/Textarea/index.js +0 -2
- package/dist/components/Tooltip/Tooltip.js +37 -87
- package/dist/components/Tooltip/index.js +0 -4
- package/dist/enums.js +0 -2
- package/dist/hooks/index.js +0 -8
- package/dist/hooks/useClickOutside.js +2 -7
- package/dist/hooks/useId.js +0 -4
- package/dist/hooks/useListener.js +0 -8
- package/dist/hooks/useOnEscapePressed.js +0 -3
- package/dist/hooks/usePagination.js +13 -25
- package/dist/hooks/usePrevious.js +0 -3
- package/dist/hooks/useThrottle.js +1 -15
- package/dist/hooks/useWindowFitment.js +6 -13
- package/dist/index.js +0 -52
- package/dist/utils.js +3 -10
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -371,105 +370,54 @@ Object.defineProperty(exports, "useWindowFitment", {
|
|
|
371
370
|
return _hooks.useWindowFitment;
|
|
372
371
|
}
|
|
373
372
|
});
|
|
374
|
-
|
|
375
373
|
var _Accordion = _interopRequireDefault(require("./components/Accordion"));
|
|
376
|
-
|
|
377
374
|
var _ActionButton = _interopRequireDefault(require("./components/ActionButton"));
|
|
378
|
-
|
|
379
375
|
var _ArticlePagination = _interopRequireDefault(require("./components/ArticlePagination"));
|
|
380
|
-
|
|
381
376
|
var _Badge = _interopRequireDefault(require("./components/Badge"));
|
|
382
|
-
|
|
383
377
|
var _Button = _interopRequireWildcard(require("./components/Button"));
|
|
384
|
-
|
|
385
378
|
var _Card = _interopRequireDefault(require("./components/Card"));
|
|
386
|
-
|
|
387
379
|
var _CheckboxInput = _interopRequireDefault(require("./components/CheckboxInput"));
|
|
388
|
-
|
|
389
380
|
var _Chip = _interopRequireDefault(require("./components/Chip"));
|
|
390
|
-
|
|
391
381
|
var _Code = _interopRequireDefault(require("./components/Code"));
|
|
392
|
-
|
|
393
382
|
var _CodeSnippet = _interopRequireWildcard(require("./components/CodeSnippet"));
|
|
394
|
-
|
|
395
383
|
var _Col = _interopRequireDefault(require("./components/Col"));
|
|
396
|
-
|
|
397
384
|
var _ContextualMenu = _interopRequireDefault(require("./components/ContextualMenu"));
|
|
398
|
-
|
|
399
385
|
var _Field = _interopRequireDefault(require("./components/Field"));
|
|
400
|
-
|
|
401
386
|
var _Form = _interopRequireDefault(require("./components/Form"));
|
|
402
|
-
|
|
403
387
|
var _Icon = _interopRequireWildcard(require("./components/Icon"));
|
|
404
|
-
|
|
405
388
|
var _Input = _interopRequireDefault(require("./components/Input"));
|
|
406
|
-
|
|
407
389
|
var _Label = _interopRequireDefault(require("./components/Label"));
|
|
408
|
-
|
|
409
390
|
var _Link = _interopRequireDefault(require("./components/Link"));
|
|
410
|
-
|
|
411
391
|
var _List = _interopRequireDefault(require("./components/List"));
|
|
412
|
-
|
|
413
392
|
var _Loader = _interopRequireDefault(require("./components/Loader"));
|
|
414
|
-
|
|
415
393
|
var _MainTable = _interopRequireDefault(require("./components/MainTable"));
|
|
416
|
-
|
|
417
394
|
var _ModularTable = _interopRequireDefault(require("./components/ModularTable"));
|
|
418
|
-
|
|
419
395
|
var _Navigation = _interopRequireDefault(require("./components/Navigation"));
|
|
420
|
-
|
|
421
396
|
var _Modal = _interopRequireDefault(require("./components/Modal"));
|
|
422
|
-
|
|
423
397
|
var _Notification = _interopRequireWildcard(require("./components/Notification"));
|
|
424
|
-
|
|
425
398
|
var _Pagination = _interopRequireDefault(require("./components/Pagination"));
|
|
426
|
-
|
|
427
399
|
var _PasswordToggle = _interopRequireDefault(require("./components/PasswordToggle"));
|
|
428
|
-
|
|
429
400
|
var _RadioInput = _interopRequireDefault(require("./components/RadioInput"));
|
|
430
|
-
|
|
431
401
|
var _Row = _interopRequireDefault(require("./components/Row"));
|
|
432
|
-
|
|
433
402
|
var _SearchAndFilter = _interopRequireDefault(require("./components/SearchAndFilter"));
|
|
434
|
-
|
|
435
403
|
var _SearchBox = _interopRequireDefault(require("./components/SearchBox"));
|
|
436
|
-
|
|
437
404
|
var _Select = _interopRequireDefault(require("./components/Select"));
|
|
438
|
-
|
|
439
405
|
var _Slider = _interopRequireDefault(require("./components/Slider"));
|
|
440
|
-
|
|
441
406
|
var _Switch = _interopRequireDefault(require("./components/Switch"));
|
|
442
|
-
|
|
443
407
|
var _Spinner = _interopRequireDefault(require("./components/Spinner"));
|
|
444
|
-
|
|
445
408
|
var _StatusLabel = _interopRequireWildcard(require("./components/StatusLabel"));
|
|
446
|
-
|
|
447
409
|
var _Strip = _interopRequireDefault(require("./components/Strip"));
|
|
448
|
-
|
|
449
410
|
var _SummaryButton = _interopRequireDefault(require("./components/SummaryButton"));
|
|
450
|
-
|
|
451
411
|
var _Table = _interopRequireDefault(require("./components/Table"));
|
|
452
|
-
|
|
453
412
|
var _TableCell = _interopRequireDefault(require("./components/TableCell"));
|
|
454
|
-
|
|
455
413
|
var _TableHeader = _interopRequireDefault(require("./components/TableHeader"));
|
|
456
|
-
|
|
457
414
|
var _TableRow = _interopRequireDefault(require("./components/TableRow"));
|
|
458
|
-
|
|
459
415
|
var _Tabs = _interopRequireDefault(require("./components/Tabs"));
|
|
460
|
-
|
|
461
416
|
var _Textarea = _interopRequireDefault(require("./components/Textarea"));
|
|
462
|
-
|
|
463
417
|
var _Tooltip = _interopRequireDefault(require("./components/Tooltip"));
|
|
464
|
-
|
|
465
418
|
var _hooks = require("./hooks");
|
|
466
|
-
|
|
467
419
|
var _utils = require("./utils");
|
|
468
|
-
|
|
469
420
|
var _enums = require("./enums");
|
|
470
|
-
|
|
471
421
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
472
|
-
|
|
473
422
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
474
|
-
|
|
475
423
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/dist/utils.js
CHANGED
|
@@ -5,15 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.isNavigationButton = exports.isNavigationAnchor = exports.highlightSubString = exports.IS_DEV = void 0;
|
|
7
7
|
var IS_DEV = process.env.NODE_ENV === "development";
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
10
|
* Find substring and wrap in <strong /> tag
|
|
10
11
|
* @param {string} str - The string to search
|
|
11
12
|
* @param {string} subString - The substring to find
|
|
12
13
|
* @return {Obj} newStr - Object with text and match bool
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
15
|
exports.IS_DEV = IS_DEV;
|
|
16
|
-
|
|
17
16
|
var highlightSubString = function highlightSubString(str, subString) {
|
|
18
17
|
if (typeof str !== "string" || typeof subString !== "string") {
|
|
19
18
|
return {
|
|
@@ -21,7 +20,6 @@ var highlightSubString = function highlightSubString(str, subString) {
|
|
|
21
20
|
match: false
|
|
22
21
|
};
|
|
23
22
|
}
|
|
24
|
-
|
|
25
23
|
var caseInsensitiveRegex = new RegExp(subString, "gi");
|
|
26
24
|
var newStr = str.replace(caseInsensitiveRegex, function (match) {
|
|
27
25
|
return "<strong>".concat(match, "</strong>");
|
|
@@ -31,27 +29,22 @@ var highlightSubString = function highlightSubString(str, subString) {
|
|
|
31
29
|
match: newStr !== str
|
|
32
30
|
};
|
|
33
31
|
};
|
|
32
|
+
|
|
34
33
|
/**
|
|
35
34
|
* Whether a navigation item is an anchor.
|
|
36
35
|
* @param link - The navigation item.
|
|
37
36
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
37
|
exports.highlightSubString = highlightSubString;
|
|
41
|
-
|
|
42
38
|
var isNavigationAnchor = function isNavigationAnchor(link) {
|
|
43
39
|
return !!link.url;
|
|
44
40
|
};
|
|
41
|
+
|
|
45
42
|
/**
|
|
46
43
|
* Whether a navigation item is a button.
|
|
47
44
|
* @param link - The navigation item.
|
|
48
45
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
46
|
exports.isNavigationAnchor = isNavigationAnchor;
|
|
52
|
-
|
|
53
47
|
var isNavigationButton = function isNavigationButton(link) {
|
|
54
48
|
return !link.url;
|
|
55
49
|
};
|
|
56
|
-
|
|
57
50
|
exports.isNavigationButton = isNavigationButton;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/react-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"author": "Huw Wilkins <huw.wilkins@canonical.com>",
|
|
@@ -38,8 +38,7 @@
|
|
|
38
38
|
"@testing-library/cypress": "9.0.0",
|
|
39
39
|
"@testing-library/dom": "9.2.0",
|
|
40
40
|
"@testing-library/jest-dom": "5.16.5",
|
|
41
|
-
"@testing-library/react": "
|
|
42
|
-
"@testing-library/react-hooks": "8.0.1",
|
|
41
|
+
"@testing-library/react": "13.4.0",
|
|
43
42
|
"@testing-library/user-event": "14.4.3",
|
|
44
43
|
"@typescript-eslint/eslint-plugin": "5.59.1",
|
|
45
44
|
"@typescript-eslint/parser": "5.59.1",
|
|
@@ -65,9 +64,9 @@
|
|
|
65
64
|
"jest": "27.5.1",
|
|
66
65
|
"npm-package-json-lint": "5.4.2",
|
|
67
66
|
"prettier": "2.8.8",
|
|
68
|
-
"react": "
|
|
67
|
+
"react": "18.2.0",
|
|
69
68
|
"react-docgen-typescript-loader": "3.7.2",
|
|
70
|
-
"react-dom": "
|
|
69
|
+
"react-dom": "18.2.0",
|
|
71
70
|
"sass": "1.62.1",
|
|
72
71
|
"sass-loader": "10.4.1",
|
|
73
72
|
"style-loader": "3.3.2",
|
|
@@ -101,6 +100,8 @@
|
|
|
101
100
|
"postcss": "^8.3.11"
|
|
102
101
|
},
|
|
103
102
|
"peerDependencies": {
|
|
103
|
+
"@types/react": "^17.0.2 || ^18.0.0",
|
|
104
|
+
"@types/react-dom": "^17.0.2 || ^18.0.0",
|
|
104
105
|
"react": "^17.0.2 || ^18.0.0",
|
|
105
106
|
"react-dom": "^17.0.2 || ^18.0.0",
|
|
106
107
|
"vanilla-framework": "3.14.0"
|