@panneau/intl 4.0.11 → 4.0.14

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.
@@ -0,0 +1,43 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { Resource, ResourceValues } from '@panneau/core';
4
+
5
+ declare class IntlManager {
6
+ locales: any[];
7
+ addLocale(locale: any, messages: any, replace?: boolean): void;
8
+ getLocale(locale: any): any;
9
+ hasLocale(locale: any): boolean;
10
+ getMessages(locale: any): any;
11
+ }
12
+
13
+ interface IntlProviderProps {
14
+ intlManager?: IntlManager;
15
+ locale?: string | null;
16
+ locales?: string[] | null;
17
+ extraMessages?: Record<string, string> | null;
18
+ children?: ReactNode;
19
+ }
20
+ declare function IntlProvider({ intlManager, locale, locales, children, extraMessages, }: IntlProviderProps): react_jsx_runtime.JSX.Element;
21
+
22
+ interface ResourceIntlConfig {
23
+ values?: Record<string, unknown>;
24
+ }
25
+ interface ResourceConfig {
26
+ id?: string;
27
+ name?: string | null;
28
+ intl?: ResourceIntlConfig;
29
+ }
30
+ interface ResourceMessageProps {
31
+ resource?: ResourceConfig | null;
32
+ values?: Record<string, unknown> | null;
33
+ id: string;
34
+ defaultMessage?: string | null;
35
+ description?: string | null;
36
+ }
37
+ declare function ResourceMessage({ resource, values, id, defaultMessage, description, }: ResourceMessageProps): react_jsx_runtime.JSX.Element;
38
+
39
+ declare function useResourceValues(resource: Resource | null, values?: Record<string, unknown>): ResourceValues;
40
+
41
+ declare const intlManager: IntlManager;
42
+
43
+ export { IntlManager, IntlProvider, ResourceMessage, intlManager as default, useResourceValues };
@@ -6,8 +6,6 @@ import { useContext, useMemo } from 'react';
6
6
  import { IntlContext, IntlProvider as IntlProvider$1, useIntl, FormattedMessage } from 'react-intl';
7
7
  import { useLocales, LocalesProvider, useResource } from '@panneau/core/contexts';
8
8
  import { jsx } from 'react/jsx-runtime';
9
- import PropTypes from 'prop-types';
10
- import { PropTypes as PropTypes$1 } from '@panneau/core';
11
9
 
12
10
  var IntlManager = /*#__PURE__*/function () {
13
11
  function IntlManager() {
@@ -84,14 +82,6 @@ function IntlProvider(_ref) {
84
82
  });
85
83
  }
86
84
 
87
- var propTypes = {
88
- resource: PropTypes$1.resource,
89
- values: PropTypes.object,
90
- // eslint-disable-line react/forbid-prop-types,
91
- id: PropTypes.string.isRequired,
92
- defaultMessage: PropTypes.string,
93
- description: PropTypes.string
94
- };
95
85
  function ResourceMessage(_ref) {
96
86
  var _ref$resource = _ref.resource,
97
87
  resource = _ref$resource === void 0 ? null : _ref$resource,
@@ -124,9 +114,8 @@ function ResourceMessage(_ref) {
124
114
  }, resourceValues), values)
125
115
  }, message));
126
116
  }
127
- ResourceMessage.propTypes = propTypes;
128
117
 
129
- var useResourceValues = function useResourceValues(resource) {
118
+ function useResourceValues(resource) {
130
119
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
131
120
  var contextResource = useResource();
132
121
  var allValues = useMemo(function () {
@@ -141,6 +130,6 @@ var useResourceValues = function useResourceValues(resource) {
141
130
  }, resourceValues), values);
142
131
  }, [resource, values, contextResource]);
143
132
  return allValues;
144
- };
133
+ }
145
134
 
146
135
  export { IntlManager, IntlProvider, ResourceMessage, intlManager as default, useResourceValues };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/intl",
3
- "version": "4.0.11",
3
+ "version": "4.0.14",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -34,22 +34,25 @@
34
34
  ],
35
35
  "license": "ISC",
36
36
  "type": "module",
37
- "module": "es/index.js",
37
+ "module": "dist/index.js",
38
+ "types": "dist/index.d.ts",
38
39
  "exports": {
39
- ".": "./es/index.js",
40
+ ".": {
41
+ "default": "./dist/index.js",
42
+ "types": "./dist/index.d.ts"
43
+ },
40
44
  "./locale": "./locale"
41
45
  },
42
46
  "files": [
47
+ "dist",
43
48
  "locale",
44
- "lib",
45
- "es",
46
49
  "scripts",
47
50
  "assets"
48
51
  ],
49
52
  "scripts": {
50
53
  "intl": "../../scripts/build-intl.js '../../!(node_modules)/!(intl)/src/**/*.+(js|jsx|tsx)'",
51
54
  "prepublishOnly": "npm run build",
52
- "build": "rm -rf ./locale && npm run intl && ../../scripts/prepare-package.sh"
55
+ "build": "rm -rf ./locale && npm run intl && ../../scripts/prepare-package.sh --types"
53
56
  },
54
57
  "devDependencies": {
55
58
  "react": "^19.0.0",
@@ -62,13 +65,12 @@
62
65
  "dependencies": {
63
66
  "@babel/runtime": "^7.12.5",
64
67
  "@formatjs/cli-lib": "^6.6.6",
65
- "@panneau/core": "^4.0.11",
68
+ "@panneau/core": "^4.0.14",
66
69
  "commander": "^12.0.0",
67
70
  "fs-extra": "^11.2.0",
68
71
  "gettext-parser": "^7.0.1",
69
72
  "glob": "^10.3.12",
70
- "lodash-es": "^4.17.21",
71
- "prop-types": "^15.7.2",
73
+ "lodash": "^4.17.21",
72
74
  "react-intl": "^5.15.8 || ^6.0.0 || ^7.0.0"
73
75
  },
74
76
  "lang": "locale",
@@ -79,5 +81,5 @@
79
81
  "publishConfig": {
80
82
  "access": "public"
81
83
  },
82
- "gitHead": "fe8264ed2815da0b5a40339dec99999c6fe70751"
84
+ "gitHead": "ce35c2ddb30a7be2efe951882d9826dca577f5d4"
83
85
  }