@canonical/react-components 0.31.0 → 0.34.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.
Files changed (38) hide show
  1. package/dist/__mocks__/nanoid.d.ts +1 -0
  2. package/dist/__mocks__/nanoid.js +17 -0
  3. package/dist/components/AccordionSection/AccordionSection.js +8 -12
  4. package/dist/components/CheckableInput/CheckableInput.d.ts +9 -1
  5. package/dist/components/CheckableInput/CheckableInput.js +8 -7
  6. package/dist/components/Chip/Chip.d.ts +5 -5
  7. package/dist/components/Chip/Chip.js +21 -13
  8. package/dist/components/CodeSnippet/CodeSnippet.d.ts +5 -4
  9. package/dist/components/CodeSnippet/CodeSnippet.js +13 -11
  10. package/dist/components/ContextualMenu/ContextualMenu.js +5 -5
  11. package/dist/components/Field/Field.d.ts +9 -1
  12. package/dist/components/Field/Field.js +12 -8
  13. package/dist/components/Input/Input.js +33 -13
  14. package/dist/components/MainTable/MainTable.d.ts +4 -0
  15. package/dist/components/MainTable/MainTable.js +9 -2
  16. package/dist/components/Modal/Modal.js +8 -8
  17. package/dist/components/ModularTable/ModularTable.d.ts +20 -5
  18. package/dist/components/ModularTable/ModularTable.js +30 -16
  19. package/dist/components/PaginationItem/PaginationItem.js +2 -1
  20. package/dist/components/PasswordToggle/PasswordToggle.js +14 -3
  21. package/dist/components/SearchBox/SearchBox.d.ts +5 -4
  22. package/dist/components/SearchBox/SearchBox.js +12 -14
  23. package/dist/components/Select/Select.js +11 -1
  24. package/dist/components/Slider/Slider.js +14 -1
  25. package/dist/components/Spinner/Spinner.d.ts +9 -1
  26. package/dist/components/Spinner/Spinner.js +12 -4
  27. package/dist/components/Switch/Switch.d.ts +14 -0
  28. package/dist/components/Switch/Switch.js +42 -0
  29. package/dist/components/Switch/index.d.ts +2 -0
  30. package/dist/components/Switch/index.js +15 -0
  31. package/dist/components/Textarea/Textarea.js +11 -1
  32. package/dist/hooks/index.d.ts +1 -0
  33. package/dist/hooks/index.js +9 -1
  34. package/dist/hooks/useId.d.ts +6 -0
  35. package/dist/hooks/useId.js +21 -0
  36. package/dist/index.d.ts +3 -0
  37. package/dist/index.js +40 -0
  38. package/package.json +32 -29
package/dist/index.js CHANGED
@@ -233,6 +233,12 @@ Object.defineProperty(exports, "SummaryButton", {
233
233
  return _SummaryButton.default;
234
234
  }
235
235
  });
236
+ Object.defineProperty(exports, "Switch", {
237
+ enumerable: true,
238
+ get: function get() {
239
+ return _Switch.default;
240
+ }
241
+ });
236
242
  Object.defineProperty(exports, "Table", {
237
243
  enumerable: true,
238
244
  get: function get() {
@@ -275,6 +281,36 @@ Object.defineProperty(exports, "Tooltip", {
275
281
  return _Tooltip.default;
276
282
  }
277
283
  });
284
+ Object.defineProperty(exports, "useId", {
285
+ enumerable: true,
286
+ get: function get() {
287
+ return _hooks.useId;
288
+ }
289
+ });
290
+ Object.defineProperty(exports, "useListener", {
291
+ enumerable: true,
292
+ get: function get() {
293
+ return _hooks.useListener;
294
+ }
295
+ });
296
+ Object.defineProperty(exports, "usePrevious", {
297
+ enumerable: true,
298
+ get: function get() {
299
+ return _hooks.usePrevious;
300
+ }
301
+ });
302
+ Object.defineProperty(exports, "useThrottle", {
303
+ enumerable: true,
304
+ get: function get() {
305
+ return _hooks.useThrottle;
306
+ }
307
+ });
308
+ Object.defineProperty(exports, "useWindowFitment", {
309
+ enumerable: true,
310
+ get: function get() {
311
+ return _hooks.useWindowFitment;
312
+ }
313
+ });
278
314
 
279
315
  var _Accordion = _interopRequireDefault(require("./components/Accordion"));
280
316
 
@@ -338,6 +374,8 @@ var _Select = _interopRequireDefault(require("./components/Select"));
338
374
 
339
375
  var _Slider = _interopRequireDefault(require("./components/Slider"));
340
376
 
377
+ var _Switch = _interopRequireDefault(require("./components/Switch"));
378
+
341
379
  var _Spinner = _interopRequireDefault(require("./components/Spinner"));
342
380
 
343
381
  var _Strip = _interopRequireDefault(require("./components/Strip"));
@@ -358,6 +396,8 @@ var _Textarea = _interopRequireDefault(require("./components/Textarea"));
358
396
 
359
397
  var _Tooltip = _interopRequireDefault(require("./components/Tooltip"));
360
398
 
399
+ var _hooks = require("./hooks");
400
+
361
401
  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); }
362
402
 
363
403
  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; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonical/react-components",
3
- "version": "0.31.0",
3
+ "version": "0.34.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "Huw Wilkins <huw.wilkins@canonical.com>",
@@ -22,73 +22,76 @@
22
22
  },
23
23
  "homepage": "/react-components/",
24
24
  "devDependencies": {
25
- "@babel/cli": "7.17.0",
25
+ "@babel/cli": "7.17.6",
26
26
  "@babel/eslint-parser": "7.17.0",
27
27
  "@babel/preset-typescript": "7.16.7",
28
- "@percy/cli": "1.0.0-beta.74",
28
+ "@percy/cli": "1.0.0-beta.76",
29
29
  "@percy/storybook": "4.1.0",
30
- "@storybook/addon-a11y": "6.4.18",
31
- "@storybook/addon-controls": "6.4.18",
32
- "@storybook/addon-docs": "6.4.18",
33
- "@storybook/addons": "6.4.18",
34
- "@storybook/react": "6.4.18",
35
- "@storybook/theming": "6.4.18",
30
+ "@storybook/addon-a11y": "6.4.19",
31
+ "@storybook/addon-controls": "6.4.19",
32
+ "@storybook/addon-docs": "6.4.19",
33
+ "@storybook/addons": "6.4.19",
34
+ "@storybook/react": "6.4.19",
35
+ "@storybook/theming": "6.4.19",
36
36
  "@testing-library/cypress": "8.0.2",
37
37
  "@testing-library/dom": "8.11.3",
38
+ "@testing-library/jest-dom": "5.16.2",
39
+ "@testing-library/react": "12.1.3",
38
40
  "@testing-library/react-hooks": "7.0.2",
39
41
  "@testing-library/user-event": "13.5.0",
40
- "@typescript-eslint/eslint-plugin": "5.10.2",
41
- "@typescript-eslint/parser": "5.10.2",
42
+ "@typescript-eslint/eslint-plugin": "5.13.0",
43
+ "@typescript-eslint/parser": "5.13.0",
42
44
  "@wojtekmaj/enzyme-adapter-react-17": "0.6.6",
43
- "babel-jest": "27.4.6",
45
+ "babel-jest": "27.5.1",
44
46
  "babel-loader": "8.2.3",
45
47
  "babel-plugin-module-resolver": "4.1.0",
46
48
  "babel-plugin-typescript-to-proptypes": "2.0.0",
47
49
  "concurrently": "7.0.0",
48
50
  "css-loader": "5.2.7",
49
- "cypress": "9.4.1",
51
+ "cypress": "9.5.1",
50
52
  "deepmerge": "4.2.2",
51
53
  "enzyme": "3.11.0",
52
54
  "enzyme-adapter-react-16": "1.15.6",
53
55
  "enzyme-to-json": "3.6.2",
54
- "eslint": "8.8.0",
55
- "eslint-config-prettier": "8.3.0",
56
+ "eslint": "8.10.0",
57
+ "eslint-config-prettier": "8.5.0",
56
58
  "eslint-config-react-app": "7.0.0",
57
59
  "eslint-plugin-cypress": "2.12.1",
58
60
  "eslint-plugin-flowtype": "8.0.3",
59
61
  "eslint-plugin-import": "2.25.4",
60
62
  "eslint-plugin-jsx-a11y": "6.5.1",
61
63
  "eslint-plugin-prettier": "4.0.0",
62
- "eslint-plugin-react": "7.28.0",
64
+ "eslint-plugin-react": "7.29.2",
63
65
  "eslint-plugin-react-hooks": "4.3.0",
64
- "jest": "27.4.7",
66
+ "eslint-plugin-testing-library": "5.0.5",
67
+ "jest": "27.5.1",
65
68
  "npm-package-json-lint": "5.4.2",
66
69
  "prettier": "2.5.1",
67
70
  "react": "17.0.2",
68
71
  "react-docgen-typescript-loader": "3.7.2",
69
72
  "react-dom": "17.0.2",
70
- "sass": "1.49.7",
73
+ "sass": "1.49.9",
71
74
  "sass-loader": "10.2.1",
72
75
  "style-loader": "2.0.0",
73
- "stylelint": "14.3.0",
76
+ "stylelint": "14.5.3",
74
77
  "stylelint-config-prettier": "9.0.3",
75
78
  "stylelint-config-recommended-scss": "5.0.2",
76
79
  "stylelint-order": "5.0.0",
77
80
  "stylelint-prettier": "2.0.0",
78
81
  "ts-jest": "27.1.3",
79
- "tsc-alias": "1.5.0",
80
- "typescript": "4.5.5",
81
- "vanilla-framework": "3.1.0",
82
+ "tsc-alias": "1.6.3",
83
+ "typescript": "4.6.2",
84
+ "vanilla-framework": "3.1.1",
82
85
  "wait-on": "5.3.0"
83
86
  },
84
87
  "dependencies": {
85
- "@types/jest": "27.4.0",
86
- "@types/node": "16.11.22",
88
+ "@types/jest": "27.4.1",
89
+ "@types/node": "16.11.26",
87
90
  "@types/react": "17.0.39",
88
- "@types/react-dom": "17.0.11",
91
+ "@types/react-dom": "17.0.13",
89
92
  "@types/react-table": "7.7.9",
90
93
  "classnames": "2.3.1",
91
- "nanoid": "3.2.0",
94
+ "nanoid": "3.3.1",
92
95
  "prop-types": "15.8.1",
93
96
  "react-table": "7.7.0",
94
97
  "react-useportal": "1.0.16"
@@ -99,7 +102,7 @@
99
102
  "peerDependencies": {
100
103
  "react": "17.0.2",
101
104
  "react-dom": "17.0.2",
102
- "vanilla-framework": "3.1.0"
105
+ "vanilla-framework": "3.1.1"
103
106
  },
104
107
  "scripts": {
105
108
  "build": "rm -rf dist && yarn build-local; yarn build-declaration",
@@ -151,10 +154,10 @@
151
154
  "snapshotSerializers": [
152
155
  "enzyme-to-json/serializer"
153
156
  ],
154
- "setupFiles": [
157
+ "setupFilesAfterEnv": [
155
158
  "<rootDir>/src/setupTests.js"
156
159
  ],
157
- "testEnvironment": "jsdom",
160
+ "testEnvironment": "jest-environment-jsdom",
158
161
  "moduleDirectories": [
159
162
  "node_modules",
160
163
  "src"