@openedx/paragon 23.22.2 → 23.23.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/README.md CHANGED
@@ -90,7 +90,7 @@ Use `paragon help` to see more information.
90
90
 
91
91
  ## Internationalization
92
92
 
93
- Paragon supports internationalization for its components out of the box with the support of [react-intl](https://formatjs.io/docs/react-intl/). You may view translated strings for each component on the documentation website by switching languages in the settings.
93
+ Paragon supports internationalization for its components out of the box with the support of [react-intl](https://formatjs.io/docs/react-intl/). ``react-intl`` 5.x, 6.x, or 10.1.20+ may be used. You may view translated strings for each component on the documentation website by switching languages in the settings.
94
94
 
95
95
  Due to Paragon's dependence on ``react-intl``, that means that your whole app needs to be wrapped in its provider, e.g.:
96
96
 
@@ -265,59 +265,30 @@ When developing a new component you should generally follow three rules:
265
265
  />
266
266
  ```
267
267
 
268
- - For places where the display string has to be a plain JavaScript string use ``formatMessage``, this would require access to ``intl`` object from ``react-intl``, e.g.
269
-
270
- - For class components use ``injectIntl`` HOC
271
-
272
- ```javascript
273
- import { injectIntl } from 'react-intl';
274
-
275
- class MyClassComponent extends React.Component {
276
- render() {
277
- const { altText, intl } = this.props;
278
- const intlAltText = altText || intl.formatMessage({
279
- id: 'pgn.MyComponent.altText',
280
- defaultMessage: 'Close',
281
- description: 'Close label for Toast component',
282
- });
283
-
284
- return (
285
- <IconButton
286
- alt={intlCloseLabel}
287
- onClick={() => {}}
288
- variant="primary"
289
- />
290
- )
291
- }
292
- }
293
-
294
- export default injectIntl(MyClassComponent);
295
- ```
296
-
297
- - For functional components use ``useIntl`` hook
298
-
299
- ```javascript
300
- import { useIntl } from 'react-intl';
301
-
302
- const MyFunctionComponent = ({ altText }) => {
303
- const intls = useIntl();
304
- const intlAltText = altText || intl.formatMessage({
305
- id: 'pgn.MyComponent.altText',
306
- defaultMessage: 'Close',
307
- description: 'Close label for Toast component',
308
- });
309
-
310
- return (
311
- <IconButton
312
- alt={intlCloseLabel}
313
- onClick={() => {}}
314
- variant="primary"
315
- />
316
- )
317
- }
318
-
319
- export default MyFunctionComponent;
320
- ```
268
+ - For places where the display string has to be a plain JavaScript string use ``formatMessage``, this would require access to ``intl`` object from ``react-intl``, which is provided by the ``useIntl`` hook (the ``injectIntl`` HOC must not be used, as it was removed in ``react-intl`` 10)
269
+
270
+ ```javascript
271
+ import { useIntl } from 'react-intl';
272
+
273
+ const MyFunctionComponent = ({ altText }) => {
274
+ const intl = useIntl();
275
+ const intlAltText = altText || intl.formatMessage({
276
+ id: 'pgn.MyComponent.altText',
277
+ defaultMessage: 'Close',
278
+ description: 'Close label for Toast component',
279
+ });
280
+
281
+ return (
282
+ <IconButton
283
+ alt={intlAltText}
284
+ onClick={() => {}}
285
+ variant="primary"
286
+ />
287
+ )
288
+ }
289
+
290
+ export default MyFunctionComponent;
291
+ ```
321
292
 
322
293
  **Notes on the format above**:
323
294
  - `id` is required and must be a dot-separated string of the format `pgn.<componentName>.<subcomponentName>.<propName>`
@@ -1,6 +1,6 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
- const { spawn } = require('child_process');
3
+ const { spawn } = require('node:child_process');
4
4
  const os = require('os');
5
5
  const sass = require('sass');
6
6
 
@@ -1,10 +1,10 @@
1
1
  const inquirer = require('inquirer');
2
- const childProcess = require('child_process');
2
+ const childProcess = require('node:child_process');
3
3
 
4
4
  const themeCommand = require('../install-theme');
5
5
 
6
6
  jest.mock('inquirer');
7
- jest.mock('child_process');
7
+ jest.mock('node:child_process');
8
8
 
9
9
  describe('install-theme', () => {
10
10
  beforeEach(() => {
@@ -1,5 +1,5 @@
1
1
  const inquirer = require('inquirer');
2
- const childProcess = require('child_process');
2
+ const childProcess = require('node:child_process');
3
3
 
4
4
  /**
5
5
  * Prompts the user to enter the @edx/brand package they want to install.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openedx/paragon",
3
- "version": "23.22.2",
3
+ "version": "23.23.0",
4
4
  "description": "Accessible, responsive UI component library based on Bootstrap.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -67,7 +67,6 @@
67
67
  "axios": "^1.0.0",
68
68
  "bootstrap": "^4.6.2",
69
69
  "chalk": "^4.1.2",
70
- "child_process": "^1.0.2",
71
70
  "chroma-js": "^3.0.0",
72
71
  "classnames": "^2.3.1",
73
72
  "cli-progress": "^3.12.0",
@@ -110,7 +109,7 @@
110
109
  "peerDependencies": {
111
110
  "react": "^16.8.6 || ^17 || ^18",
112
111
  "react-dom": "^16.8.6 || ^17 || ^18",
113
- "react-intl": "^5.25.1 || ^6.4.0"
112
+ "react-intl": "^5.25.1 || ^6.4.0 || ^10.1.20"
114
113
  },
115
114
  "devDependencies": {
116
115
  "@babel/cli": "^7.16.8",
@@ -156,6 +155,7 @@
156
155
  "jest-environment-jsdom": "^29.7.0",
157
156
  "markdown-loader-jest": "^0.1.1",
158
157
  "react": "^18",
158
+ "react-intl": "^10.1.20",
159
159
  "react-test-renderer": "^18",
160
160
  "regenerator-runtime": "^0.14.0",
161
161
  "semantic-release": "^25.0.0",
@@ -197,7 +197,7 @@
197
197
  "/component-generator/"
198
198
  ],
199
199
  "transformIgnorePatterns": [
200
- "/node_modules/(?!(@openedx/paragon)/).*/"
200
+ "/node_modules/(?!(@openedx/paragon|react-intl|@formatjs|intl-messageformat)/).*/"
201
201
  ]
202
202
  },
203
203
  "browserslist": [