@elice/material-shared-utils 1.240718.3 → 1.240719.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.
Files changed (43) hide show
  1. package/cjs/_virtual/_rollupPluginBabelHelpers.js +414 -0
  2. package/cjs/hooks/index.js +9 -0
  3. package/cjs/hooks/useCallbackProp.js +7 -3
  4. package/cjs/hooks/useDeepClonedCompareEffect.js +8 -4
  5. package/cjs/index.d.ts +0 -1
  6. package/cjs/index.js +0 -2
  7. package/cjs/material-config/MaterialConfigContext.js +2 -2
  8. package/cjs/material-config/MaterialConfigProvider.js +31 -17
  9. package/cjs/material-config/index.js +13 -0
  10. package/cjs/material-config/useMaterialConfig.js +2 -2
  11. package/cjs/material-config/useMaterialConfigApiClientUpdate.js +8 -4
  12. package/cjs/material-fetch/index.js +9 -0
  13. package/cjs/material-fetch/useMaterialFetch.d.ts +1 -1
  14. package/cjs/material-fetch/useMaterialFetch.js +3 -2
  15. package/cjs/material-fetch/useMaterialFetchRaw.js +71 -54
  16. package/cjs/material-hoc/index.js +8 -0
  17. package/cjs/material-hoc/withMaterial.d.ts +2 -13
  18. package/cjs/material-hoc/withMaterial.js +31 -31
  19. package/es/_virtual/_rollupPluginBabelHelpers.js +402 -0
  20. package/es/hooks/index.js +2 -0
  21. package/es/hooks/useCallbackProp.js +3 -3
  22. package/es/hooks/useDeepClonedCompareEffect.js +4 -4
  23. package/es/index.d.ts +0 -1
  24. package/es/index.js +0 -1
  25. package/es/material-config/MaterialConfigContext.js +2 -2
  26. package/es/material-config/MaterialConfigProvider.js +27 -17
  27. package/es/material-config/index.js +4 -0
  28. package/es/material-config/useMaterialConfig.js +2 -2
  29. package/es/material-config/useMaterialConfigApiClientUpdate.js +8 -4
  30. package/es/material-fetch/index.js +2 -0
  31. package/es/material-fetch/useMaterialFetch.d.ts +1 -1
  32. package/es/material-fetch/useMaterialFetch.js +3 -2
  33. package/es/material-fetch/useMaterialFetchRaw.js +71 -54
  34. package/es/material-hoc/index.js +1 -0
  35. package/es/material-hoc/withMaterial.d.ts +2 -13
  36. package/es/material-hoc/withMaterial.js +32 -32
  37. package/package.json +9 -11
  38. package/cjs/components/MaterialIntlProvider.d.ts +0 -14
  39. package/cjs/components/MaterialIntlProvider.js +0 -27
  40. package/cjs/components/index.d.ts +0 -2
  41. package/es/components/MaterialIntlProvider.d.ts +0 -14
  42. package/es/components/MaterialIntlProvider.js +0 -23
  43. package/es/components/index.d.ts +0 -2
@@ -1,24 +1,10 @@
1
+ import { defineProperty as _defineProperty, slicedToArray as _slicedToArray, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import { useRef, useState, useCallback, useEffect } from 'react';
2
3
  import { getOrgLecturePageResolve, getOrgLecturePageGet } from '@elice/api-client';
3
4
  import { enums } from '@elice/types';
4
5
 
5
- const MATERIAL_FETCH_KEY_MAP = Object.freeze({
6
- [enums.LectureMaterialType.Nothing]: 'materialNothing',
7
- [enums.LectureMaterialType.Note]: 'materialNote',
8
- [enums.LectureMaterialType.Video]: 'materialVideo',
9
- [enums.LectureMaterialType.PDF]: 'materialPdf',
10
- [enums.LectureMaterialType.Exercise]: 'materialExercise',
11
- [enums.LectureMaterialType.Quiz]: 'materialQuiz',
12
- [enums.LectureMaterialType.LegacyRunbox]: 'materialLegacyRunbox',
13
- [enums.LectureMaterialType.VideoFile]: 'materialVideoFile',
14
- [enums.LectureMaterialType.Live]: 'materialLive',
15
- [enums.LectureMaterialType.Assignment]: 'materialAssignment',
16
- [enums.LectureMaterialType.LMSPublicContent]: 'materialLmsPublicContent',
17
- [enums.LectureMaterialType.External]: 'materialExternal',
18
- [enums.LectureMaterialType.Survey]: 'materialSurvey',
19
- [enums.LectureMaterialType.Runbox]: 'materialRunbox',
20
- [enums.LectureMaterialType.Cloud]: 'materialCloud'
21
- });
6
+ var _Object$freeze;
7
+ var MATERIAL_FETCH_KEY_MAP = Object.freeze((_Object$freeze = {}, _defineProperty(_Object$freeze, enums.LectureMaterialType.Nothing, 'materialNothing'), _defineProperty(_Object$freeze, enums.LectureMaterialType.Note, 'materialNote'), _defineProperty(_Object$freeze, enums.LectureMaterialType.Video, 'materialVideo'), _defineProperty(_Object$freeze, enums.LectureMaterialType.PDF, 'materialPdf'), _defineProperty(_Object$freeze, enums.LectureMaterialType.Exercise, 'materialExercise'), _defineProperty(_Object$freeze, enums.LectureMaterialType.Quiz, 'materialQuiz'), _defineProperty(_Object$freeze, enums.LectureMaterialType.LegacyRunbox, 'materialLegacyRunbox'), _defineProperty(_Object$freeze, enums.LectureMaterialType.VideoFile, 'materialVideoFile'), _defineProperty(_Object$freeze, enums.LectureMaterialType.Live, 'materialLive'), _defineProperty(_Object$freeze, enums.LectureMaterialType.Assignment, 'materialAssignment'), _defineProperty(_Object$freeze, enums.LectureMaterialType.LMSPublicContent, 'materialLmsPublicContent'), _defineProperty(_Object$freeze, enums.LectureMaterialType.External, 'materialExternal'), _defineProperty(_Object$freeze, enums.LectureMaterialType.Survey, 'materialSurvey'), _defineProperty(_Object$freeze, enums.LectureMaterialType.Runbox, 'materialRunbox'), _defineProperty(_Object$freeze, enums.LectureMaterialType.Cloud, 'materialCloud'), _Object$freeze));
22
8
  //
23
9
  //
24
10
  //
@@ -40,54 +26,85 @@ const MATERIAL_FETCH_KEY_MAP = Object.freeze({
40
26
  * isReady // boolean
41
27
  * );
42
28
  */
43
- const useMaterialFetchRaw = (materialType, materialFetchFn, isReady = true) => {
44
- const _return = useRef({});
45
- const materialKey = MATERIAL_FETCH_KEY_MAP[materialType];
46
- const _createEmptyFetchRes = () => ({
47
- [materialKey]: null,
48
- materialLecturePage: null
49
- });
50
- const [matFetchRes, setMatFetchRes] = useState(_createEmptyFetchRes);
51
- const [matFetchStatus, setMatFetchStatus] = useState('idle');
29
+ var useMaterialFetchRaw = function useMaterialFetchRaw(materialType, materialFetchFn) {
30
+ var isReady = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
31
+ var _return = useRef({});
32
+ var materialKey = MATERIAL_FETCH_KEY_MAP[materialType];
33
+ var _createEmptyFetchRes = function _createEmptyFetchRes() {
34
+ var _ref;
35
+ return _ref = {}, _defineProperty(_ref, materialKey, null), _defineProperty(_ref, "materialLecturePage", null), _ref;
36
+ };
37
+ var _useState = useState(_createEmptyFetchRes),
38
+ _useState2 = _slicedToArray(_useState, 2),
39
+ matFetchRes = _useState2[0],
40
+ setMatFetchRes = _useState2[1];
41
+ var _useState3 = useState('idle'),
42
+ _useState4 = _slicedToArray(_useState3, 2),
43
+ matFetchStatus = _useState4[0],
44
+ setMatFetchStatus = _useState4[1];
52
45
  /**
53
46
  * fetch material and lecture page
54
47
  */
55
- const fetch = useCallback(async signal => {
56
- setMatFetchStatus('pending');
57
- return materialFetchFn(signal).then(resMaterialGet => resMaterialGet[materialKey]).then(material => Promise.all([material, getOrgLecturePageResolve({
58
- materialId: material.id,
59
- materialType
60
- }, {
61
- signal: signal
62
- }).then(resLecturePageResolve => getOrgLecturePageGet({
63
- lecturePageId: resLecturePageResolve.lecturePageId
64
- }, {
65
- signal: signal
66
- })).then(resLecturePageGet => resLecturePageGet.lecturePage)])).then(([material, materialLecturePage]) => {
67
- setMatFetchRes({
68
- [materialKey]: material,
69
- materialLecturePage
70
- });
71
- setMatFetchStatus('resolved');
72
- }).catch(err => {
73
- if (err.name !== 'AbortError') {
74
- setMatFetchRes(_createEmptyFetchRes);
75
- setMatFetchStatus('rejected');
76
- }
77
- });
78
- },
48
+ var fetch = useCallback( /*#__PURE__*/function () {
49
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(signal) {
50
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
51
+ while (1) switch (_context.prev = _context.next) {
52
+ case 0:
53
+ setMatFetchStatus('pending');
54
+ return _context.abrupt("return", materialFetchFn(signal).then(function (resMaterialGet) {
55
+ return resMaterialGet[materialKey];
56
+ }).then(function (material) {
57
+ return Promise.all([material, getOrgLecturePageResolve({
58
+ materialId: material.id,
59
+ materialType: materialType
60
+ }, {
61
+ signal: signal
62
+ }).then(function (resLecturePageResolve) {
63
+ return getOrgLecturePageGet({
64
+ lecturePageId: resLecturePageResolve.lecturePageId
65
+ }, {
66
+ signal: signal
67
+ });
68
+ }).then(function (resLecturePageGet) {
69
+ return resLecturePageGet.lecturePage;
70
+ })]);
71
+ }).then(function (_ref3) {
72
+ var _setMatFetchRes;
73
+ var _ref4 = _slicedToArray(_ref3, 2),
74
+ material = _ref4[0],
75
+ materialLecturePage = _ref4[1];
76
+ setMatFetchRes((_setMatFetchRes = {}, _defineProperty(_setMatFetchRes, materialKey, material), _defineProperty(_setMatFetchRes, "materialLecturePage", materialLecturePage), _setMatFetchRes));
77
+ setMatFetchStatus('resolved');
78
+ }).catch(function (err) {
79
+ if (err.name !== 'AbortError') {
80
+ setMatFetchRes(_createEmptyFetchRes);
81
+ setMatFetchStatus('rejected');
82
+ }
83
+ }));
84
+ case 2:
85
+ case "end":
86
+ return _context.stop();
87
+ }
88
+ }, _callee);
89
+ }));
90
+ return function (_x) {
91
+ return _ref2.apply(this, arguments);
92
+ };
93
+ }(),
79
94
  // eslint-disable-next-line react-hooks/exhaustive-deps
80
95
  [materialKey, materialFetchFn]);
81
96
  //
82
97
  // emit `fetch` when `isReady` is changed
83
98
  //
84
- useEffect(() => {
99
+ useEffect(function () {
85
100
  if (!isReady) {
86
101
  return;
87
102
  }
88
- const abortCtrl = new AbortController();
89
- fetch(abortCtrl.signal).catch(() => void 0);
90
- return () => {
103
+ var abortCtrl = new AbortController();
104
+ fetch(abortCtrl.signal).catch(function () {
105
+ return void 0;
106
+ });
107
+ return function () {
91
108
  abortCtrl.abort();
92
109
  };
93
110
  },
@@ -0,0 +1 @@
1
+ export { withForwardRefMaterial, withMaterial } from './withMaterial.js';
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import type { MaterialIntlProviderPhrases } from '../components/MaterialIntlProvider';
3
2
  import type { MaterialConfigApiClientUpdateCallback } from '../material-config';
4
3
  type AnyObject = Record<string, any>;
5
4
  /**
@@ -11,16 +10,6 @@ export interface WithMaterialOptions {
11
10
  * - ref: https://recoiljs.org/docs/api-reference/core/RecoilRoot/#props -> `override`
12
11
  */
13
12
  overrideRecoilScope?: boolean;
14
- /**
15
- * Phrases for `IntlProvider`.
16
- */
17
- phrases?: MaterialIntlProviderPhrases;
18
- }
19
- /**
20
- * Common props for material components.
21
- */
22
- export interface MaterialCommponentCommonProps {
23
- locale?: string;
24
13
  }
25
14
  /**
26
15
  * HOC for material components.
@@ -29,7 +18,7 @@ export interface MaterialCommponentCommonProps {
29
18
  * - `<RecoilRoot />`
30
19
  * - `<IntlProvider />`
31
20
  */
32
- export declare const withMaterial: <P extends AnyObject>(Component: React.VFC<P & MaterialCommponentCommonProps>, eliceApiClientConfigInit: MaterialConfigApiClientUpdateCallback, options?: WithMaterialOptions) => React.VFC<P & MaterialCommponentCommonProps>;
21
+ export declare const withMaterial: <P extends AnyObject>(Component: React.VFC<P>, eliceApiClientConfigInit: MaterialConfigApiClientUpdateCallback, options?: WithMaterialOptions) => React.VFC<P>;
33
22
  /**
34
23
  * HOC for material forward ref exotic components.
35
24
  *
@@ -37,5 +26,5 @@ export declare const withMaterial: <P extends AnyObject>(Component: React.VFC<P
37
26
  * - `<RecoilRoot />`
38
27
  * - `<IntlProvider />`
39
28
  */
40
- export declare const withForwardRefMaterial: <T, P extends AnyObject>(Component: React.ForwardRefExoticComponent<P & MaterialCommponentCommonProps & React.RefAttributes<T>>, eliceApiClientConfigInit: MaterialConfigApiClientUpdateCallback, options?: WithMaterialOptions) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P & MaterialCommponentCommonProps> & React.RefAttributes<T>>;
29
+ export declare const withForwardRefMaterial: <T, P extends AnyObject>(Component: React.ForwardRefExoticComponent<P & React.RefAttributes<T>>, eliceApiClientConfigInit: MaterialConfigApiClientUpdateCallback, options?: WithMaterialOptions) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
41
30
  export {};
@@ -1,7 +1,7 @@
1
- import React, { forwardRef } from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { forwardRef } from 'react';
2
3
  import { Flex, Spinner } from '@elice/blocks';
3
4
  import { RecoilRoot } from 'recoil';
4
- import MaterialIntlProvider from '../components/MaterialIntlProvider.js';
5
5
  import '../material-config/MaterialConfigContext.js';
6
6
  import { useMaterialConfigApiClientUpdate } from '../material-config/useMaterialConfigApiClientUpdate.js';
7
7
 
@@ -15,27 +15,27 @@ import { useMaterialConfigApiClientUpdate } from '../material-config/useMaterial
15
15
  * - `<RecoilRoot />`
16
16
  * - `<IntlProvider />`
17
17
  */
18
- const withMaterial = (Component, eliceApiClientConfigInit, options = {}) => {
19
- return props => {
18
+ var withMaterial = function withMaterial(Component, eliceApiClientConfigInit) {
19
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
20
+ return function (props) {
20
21
  var _a;
21
- const isReady = useMaterialConfigApiClientUpdate(eliceApiClientConfigInit);
22
+ var isReady = useMaterialConfigApiClientUpdate(eliceApiClientConfigInit);
22
23
  // do not render component, if material config is not ready
23
24
  if (!isReady) {
24
- return React.createElement(Flex, {
25
+ return jsx(Flex, {
25
26
  justify: "center",
26
27
  align: "center",
27
28
  width: "100%",
28
- height: "100%"
29
- }, React.createElement(Spinner, {
30
- size: "small"
31
- }));
29
+ height: "100%",
30
+ children: jsx(Spinner, {
31
+ size: "small"
32
+ })
33
+ });
32
34
  }
33
- return React.createElement(RecoilRoot, {
34
- override: (_a = options.overrideRecoilScope) !== null && _a !== void 0 ? _a : false
35
- }, React.createElement(MaterialIntlProvider, {
36
- locale: props.locale,
37
- phrases: options.phrases
38
- }, React.createElement(Component, Object.assign({}, props))));
35
+ return jsx(RecoilRoot, {
36
+ override: (_a = options.overrideRecoilScope) !== null && _a !== void 0 ? _a : false,
37
+ children: jsx(Component, Object.assign({}, props))
38
+ });
39
39
  };
40
40
  };
41
41
  /**
@@ -45,29 +45,29 @@ const withMaterial = (Component, eliceApiClientConfigInit, options = {}) => {
45
45
  * - `<RecoilRoot />`
46
46
  * - `<IntlProvider />`
47
47
  */
48
- const withForwardRefMaterial = (Component, eliceApiClientConfigInit, options = {}) => {
49
- return forwardRef((props, ref) => {
48
+ var withForwardRefMaterial = function withForwardRefMaterial(Component, eliceApiClientConfigInit) {
49
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
50
+ return forwardRef(function (props, ref) {
50
51
  var _a;
51
- const isReady = useMaterialConfigApiClientUpdate(eliceApiClientConfigInit);
52
+ var isReady = useMaterialConfigApiClientUpdate(eliceApiClientConfigInit);
52
53
  // do not render component, if material config is not ready
53
54
  if (!isReady) {
54
- return React.createElement(Flex, {
55
+ return jsx(Flex, {
55
56
  justify: "center",
56
57
  align: "center",
57
58
  width: "100%",
58
- height: "100%"
59
- }, React.createElement(Spinner, {
60
- size: "small"
61
- }));
59
+ height: "100%",
60
+ children: jsx(Spinner, {
61
+ size: "small"
62
+ })
63
+ });
62
64
  }
63
- return React.createElement(RecoilRoot, {
64
- override: (_a = options.overrideRecoilScope) !== null && _a !== void 0 ? _a : false
65
- }, React.createElement(MaterialIntlProvider, {
66
- locale: props.locale,
67
- phrases: options.phrases
68
- }, React.createElement(Component, Object.assign({}, props, {
69
- ref: ref
70
- }))));
65
+ return jsx(RecoilRoot, {
66
+ override: (_a = options.overrideRecoilScope) !== null && _a !== void 0 ? _a : false,
67
+ children: jsx(Component, Object.assign({}, props, {
68
+ ref: ref
69
+ }))
70
+ });
71
71
  });
72
72
  };
73
73
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-shared-utils",
3
- "version": "1.240718.3",
3
+ "version": "1.240719.1",
4
4
  "description": "Shared typings for elice material projects",
5
5
  "repository": "https://git.elicer.io/elice/frontend/library/elice-material",
6
6
  "license": "UNLICENSED",
@@ -17,10 +17,8 @@
17
17
  "scripts": {
18
18
  "start": "run-s watch",
19
19
  "prebuild": "run-s clean",
20
- "build": "run-p build:es build:cjs",
21
- "build:es": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es",
22
- "build:cjs": "rollup -c ../../rollup.config.ts --configPlugin typescript -f cjs",
23
- "watch": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es -w",
20
+ "build": "cross-env NODE_ENV=production rollup -c ../../rollup.config.ts --configPlugin typescript -f es -f cjs",
21
+ "watch": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es -f cjs -w",
24
22
  "lint": "eslint --ext .ts,.tsx ./src --max-warnings=0",
25
23
  "clean": "del-cli \"es/*\" \"cjs/*\" \"dist/*\""
26
24
  },
@@ -29,7 +27,7 @@
29
27
  "@elice/material-shared-types": "*",
30
28
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
31
29
  "react-use": "^17.0.0",
32
- "recoil": "~0.7.3"
30
+ "recoil": "^0"
33
31
  },
34
32
  "dependencies": {
35
33
  "lodash-es": "^4.17.21",
@@ -37,11 +35,11 @@
37
35
  },
38
36
  "devDependencies": {
39
37
  "@elice/api-client": "^1.240619.0",
40
- "@elice/material-shared-types": "1.240718.3",
41
- "@elice/types": "^1.240619.0",
38
+ "@elice/material-shared-types": "1.240719.1",
39
+ "@elice/types": "1.240709.0",
42
40
  "@types/lodash-es": "^4.17.6",
43
41
  "@types/react": "~17.0.9",
44
- "react-use": "^17.2.4"
45
- },
46
- "gitHead": "5479962bf1206df7c1f6f4f24b5f2547b90be799"
42
+ "react-use": "^17.2.4",
43
+ "recoil": "~0.7.3"
44
+ }
47
45
  }
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- export type MaterialIntlProviderPhrases = Record<string, Record<string, string>>;
3
- export interface MaterialIntlProviderProps {
4
- children?: React.ReactNode;
5
- /** Locale code. (default: `ko`) */
6
- locale?: string;
7
- /** I18n phrases. */
8
- phrases?: MaterialIntlProviderPhrases;
9
- }
10
- /**
11
- * IntlProvider for material components.
12
- */
13
- declare const MaterialIntlProvider: React.FC<MaterialIntlProviderProps>;
14
- export default MaterialIntlProvider;
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var reactIntl = require('react-intl');
7
-
8
- const INTL_DEFAULT_LOCALE = 'ko';
9
- const INTL_DEFAULT_PHRASES = {};
10
- /**
11
- * IntlProvider for material components.
12
- */
13
- const MaterialIntlProvider = ({
14
- children,
15
- locale = INTL_DEFAULT_LOCALE,
16
- phrases = INTL_DEFAULT_PHRASES
17
- }) => {
18
- const messages = React.useMemo(() => locale in phrases ? phrases[locale] : phrases[INTL_DEFAULT_LOCALE], [locale, phrases]);
19
- return React.createElement(reactIntl.IntlProvider, {
20
- children: children,
21
- locale: locale,
22
- defaultLocale: INTL_DEFAULT_LOCALE,
23
- messages: messages
24
- });
25
- };
26
-
27
- exports.default = MaterialIntlProvider;
@@ -1,2 +0,0 @@
1
- export { default as MaterialIntlProvider } from './MaterialIntlProvider';
2
- export type { MaterialIntlProviderProps, MaterialIntlProviderPhrases, } from './MaterialIntlProvider';
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- export type MaterialIntlProviderPhrases = Record<string, Record<string, string>>;
3
- export interface MaterialIntlProviderProps {
4
- children?: React.ReactNode;
5
- /** Locale code. (default: `ko`) */
6
- locale?: string;
7
- /** I18n phrases. */
8
- phrases?: MaterialIntlProviderPhrases;
9
- }
10
- /**
11
- * IntlProvider for material components.
12
- */
13
- declare const MaterialIntlProvider: React.FC<MaterialIntlProviderProps>;
14
- export default MaterialIntlProvider;
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import { IntlProvider } from 'react-intl';
3
-
4
- const INTL_DEFAULT_LOCALE = 'ko';
5
- const INTL_DEFAULT_PHRASES = {};
6
- /**
7
- * IntlProvider for material components.
8
- */
9
- const MaterialIntlProvider = ({
10
- children,
11
- locale = INTL_DEFAULT_LOCALE,
12
- phrases = INTL_DEFAULT_PHRASES
13
- }) => {
14
- const messages = React.useMemo(() => locale in phrases ? phrases[locale] : phrases[INTL_DEFAULT_LOCALE], [locale, phrases]);
15
- return React.createElement(IntlProvider, {
16
- children: children,
17
- locale: locale,
18
- defaultLocale: INTL_DEFAULT_LOCALE,
19
- messages: messages
20
- });
21
- };
22
-
23
- export { MaterialIntlProvider as default };
@@ -1,2 +0,0 @@
1
- export { default as MaterialIntlProvider } from './MaterialIntlProvider';
2
- export type { MaterialIntlProviderProps, MaterialIntlProviderPhrases, } from './MaterialIntlProvider';