@synerise/ds-core 0.42.0 → 0.42.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.
- package/CHANGELOG.md +13 -0
- package/dist/i18n/en.json +8 -0
- package/dist/i18n/pl.json +9 -0
- package/dist/js/DSProvider/DSProvider.d.ts +1 -1
- package/dist/js/DSProvider/DSProvider.js +4 -2
- package/dist/js/DSProvider/LocaleProvider/LocaleProvider.d.ts +8 -3
- package/dist/js/DSProvider/LocaleProvider/LocaleProvider.js +26 -10
- package/dist/js/DSProvider/ThemeProvider/ThemeProvider.js +7 -3
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.42.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-core@0.42.0...@synerise/ds-core@0.42.1) (2024-11-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **context-selector:** make texts optional prop ([44279cf](https://github.com/synerise/synerise-design/commit/44279cf859db1d3a9ea4ac0fc6e927423fb63407))
|
|
12
|
+
* **core:** onError fn types ([c34bdfe](https://github.com/synerise/synerise-design/commit/c34bdfe9da898d7999c605f9fbcbba4716dfb6d4))
|
|
13
|
+
* **factors:** deep merge of default and prop texts ([787b436](https://github.com/synerise/synerise-design/commit/787b4367213922eca21292a0a933c7ff5c241dd9))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
# [0.42.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-core@0.41.0...@synerise/ds-core@0.42.0) (2024-11-12)
|
|
7
20
|
|
|
8
21
|
|
package/dist/i18n/en.json
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
"SHOW-LESS": "Show less",
|
|
5
5
|
"SHOW-MORE": "Show more"
|
|
6
6
|
},
|
|
7
|
+
"CONTEXT-SELECTOR": {
|
|
8
|
+
"BUTTON_LABEL": "Choose",
|
|
9
|
+
"SEARCH_PLACEHOLDER": "Search",
|
|
10
|
+
"NO_RESULTS": "No results",
|
|
11
|
+
"SHOW_MORE": "Show more",
|
|
12
|
+
"RECENT": "Recent",
|
|
13
|
+
"ALL": "All"
|
|
14
|
+
},
|
|
7
15
|
"DESCRIPTION": {
|
|
8
16
|
"COPY-VALUE": "Copy value",
|
|
9
17
|
"COPIED": "Copied"
|
package/dist/i18n/pl.json
CHANGED
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
"SHOW-LESS": "Pokaż mniej",
|
|
5
5
|
"SHOW-MORE": "Pokaż więcej"
|
|
6
6
|
},
|
|
7
|
+
"CONTEXT-SELECTOR": {
|
|
8
|
+
"BUTTON_LABEL": "Wybierz",
|
|
9
|
+
"SEARCH_PLACEHOLDER": "Szukaj",
|
|
10
|
+
"NO_RESULTS": "Brak wyników",
|
|
11
|
+
"SHOW_MORE": "Więcej",
|
|
12
|
+
"RECENT": "Ostatnie",
|
|
13
|
+
"ALL": "Wszystkie"
|
|
14
|
+
},
|
|
15
|
+
|
|
7
16
|
"MANAGABLE-LIST": {
|
|
8
17
|
"LESS": "mniej",
|
|
9
18
|
"MORE": "więcej",
|
|
@@ -4,5 +4,5 @@ import { DataFormatConfigProviderProps } from '@synerise/ds-data-format';
|
|
|
4
4
|
import { LocaleProviderProps } from './LocaleProvider/LocaleProvider';
|
|
5
5
|
import { ThemeProviderProps } from './ThemeProvider/ThemeProvider';
|
|
6
6
|
export type DSProviderProps = PropsWithChildren<LocaleProviderProps & ThemeProviderProps & DataFormatConfigProviderProps>;
|
|
7
|
-
declare const DSProvider: ({ locale, messages, timeZone, children, theme, dataFormatConfig,
|
|
7
|
+
declare const DSProvider: ({ locale, defaultLocale, messages, timeZone, children, theme, dataFormatConfig, onErrorIntl, }: DSProviderProps) => React.JSX.Element;
|
|
8
8
|
export default DSProvider;
|
|
@@ -6,17 +6,19 @@ import ThemeProvider from './ThemeProvider';
|
|
|
6
6
|
|
|
7
7
|
var DSProvider = function DSProvider(_ref) {
|
|
8
8
|
var locale = _ref.locale,
|
|
9
|
+
defaultLocale = _ref.defaultLocale,
|
|
9
10
|
messages = _ref.messages,
|
|
10
11
|
timeZone = _ref.timeZone,
|
|
11
12
|
children = _ref.children,
|
|
12
13
|
theme = _ref.theme,
|
|
13
14
|
dataFormatConfig = _ref.dataFormatConfig,
|
|
14
|
-
|
|
15
|
+
onErrorIntl = _ref.onErrorIntl;
|
|
15
16
|
return /*#__PURE__*/React.createElement(LocaleProvider, {
|
|
16
17
|
locale: locale,
|
|
17
18
|
messages: messages,
|
|
18
19
|
timeZone: timeZone,
|
|
19
|
-
|
|
20
|
+
defaultLocale: defaultLocale,
|
|
21
|
+
onErrorIntl: onErrorIntl
|
|
20
22
|
}, /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
21
23
|
theme: theme
|
|
22
24
|
}, /*#__PURE__*/React.createElement(DataFormatConfigProvider, {
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import type { FormatError } from 'intl-messageformat';
|
|
2
|
+
import { OnErrorFn } from '@formatjs/intl';
|
|
4
3
|
type NestedMessages = {
|
|
5
4
|
[key: string]: string | NestedMessages;
|
|
6
5
|
};
|
|
6
|
+
type onErrorFnParameters = Parameters<OnErrorFn>;
|
|
7
7
|
export type LocaleProviderProps = {
|
|
8
8
|
locale?: string;
|
|
9
|
+
defaultLocale?: string;
|
|
9
10
|
messages?: NestedMessages;
|
|
10
11
|
defaultMessages?: NestedMessages;
|
|
11
12
|
timeZone?: string;
|
|
12
13
|
children?: ReactNode;
|
|
13
|
-
|
|
14
|
+
onErrorIntl?: (error: onErrorFnParameters[0], { dsLocalesLoaded }: {
|
|
15
|
+
dsLocalesLoaded: boolean;
|
|
16
|
+
}) => void;
|
|
14
17
|
};
|
|
15
18
|
interface LocaleProviderState {
|
|
16
19
|
dsLocales: NestedMessages;
|
|
20
|
+
dsLocalesLoaded: boolean;
|
|
17
21
|
}
|
|
18
22
|
export default class LocaleProvider extends React.Component<LocaleProviderProps, LocaleProviderState> {
|
|
19
23
|
static defaultProps: {
|
|
@@ -22,6 +26,7 @@ export default class LocaleProvider extends React.Component<LocaleProviderProps,
|
|
|
22
26
|
};
|
|
23
27
|
state: {
|
|
24
28
|
dsLocales: {};
|
|
29
|
+
dsLocalesLoaded: boolean;
|
|
25
30
|
};
|
|
26
31
|
componentDidMount(): void;
|
|
27
32
|
getLangForCode: (code: string) => string;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
|
|
5
|
-
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass
|
|
5
|
+
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
6
6
|
|
|
7
|
-
function
|
|
7
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
8
|
+
|
|
9
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
|
|
13
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
14
|
|
|
9
15
|
import React from 'react';
|
|
10
16
|
import { IntlProvider } from 'react-intl';
|
|
@@ -25,7 +31,8 @@ var LocaleProvider = /*#__PURE__*/function (_React$Component) {
|
|
|
25
31
|
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
26
32
|
|
|
27
33
|
_defineProperty(_this, "state", {
|
|
28
|
-
dsLocales: {}
|
|
34
|
+
dsLocales: {},
|
|
35
|
+
dsLocalesLoaded: false
|
|
29
36
|
});
|
|
30
37
|
|
|
31
38
|
_defineProperty(_this, "getLangForCode", function (code) {
|
|
@@ -45,8 +52,9 @@ var LocaleProvider = /*#__PURE__*/function (_React$Component) {
|
|
|
45
52
|
var locale = this.props.locale;
|
|
46
53
|
var lang = this.getLangForCode(locale || DEFAULT_LANG);
|
|
47
54
|
import("../../../i18n/" + lang + ".json").then(function (dsLocales) {
|
|
48
|
-
|
|
49
|
-
dsLocales: dsLocales
|
|
55
|
+
_this2.setState({
|
|
56
|
+
dsLocales: dsLocales,
|
|
57
|
+
dsLocalesLoaded: true
|
|
50
58
|
});
|
|
51
59
|
});
|
|
52
60
|
};
|
|
@@ -58,10 +66,13 @@ var LocaleProvider = /*#__PURE__*/function (_React$Component) {
|
|
|
58
66
|
_this$props$messages = _this$props.messages,
|
|
59
67
|
messages = _this$props$messages === void 0 ? {} : _this$props$messages,
|
|
60
68
|
locale = _this$props.locale,
|
|
69
|
+
defaultLocale = _this$props.defaultLocale,
|
|
61
70
|
timeZone = _this$props.timeZone,
|
|
62
71
|
children = _this$props.children,
|
|
63
|
-
|
|
64
|
-
var
|
|
72
|
+
onErrorIntl = _this$props.onErrorIntl;
|
|
73
|
+
var _this$state = this.state,
|
|
74
|
+
dsLocales = _this$state.dsLocales,
|
|
75
|
+
dsLocalesLoaded = _this$state.dsLocalesLoaded;
|
|
65
76
|
var code = locale || DEFAULT_LANG;
|
|
66
77
|
var lang = this.getLangForCode(code);
|
|
67
78
|
var localeData = messages || {};
|
|
@@ -75,7 +86,12 @@ var LocaleProvider = /*#__PURE__*/function (_React$Component) {
|
|
|
75
86
|
locale: code,
|
|
76
87
|
messages: currentMessages,
|
|
77
88
|
timeZone: timeZone,
|
|
78
|
-
|
|
89
|
+
defaultLocale: defaultLocale,
|
|
90
|
+
onError: function onError(error) {
|
|
91
|
+
return onErrorIntl == null ? void 0 : onErrorIntl(error, {
|
|
92
|
+
dsLocalesLoaded: dsLocalesLoaded
|
|
93
|
+
});
|
|
94
|
+
}
|
|
79
95
|
}, children));
|
|
80
96
|
};
|
|
81
97
|
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
8
|
+
|
|
9
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
10
|
|
|
7
11
|
import React from 'react';
|
|
8
12
|
import { ThemeProvider as ThemeProviderBase } from 'styled-components';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-core",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"description": "Core Components for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
},
|
|
33
33
|
"types": "dist/js/index.js",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@synerise/ds-data-format": "^0.6.
|
|
35
|
+
"@synerise/ds-data-format": "^0.6.1",
|
|
36
36
|
"deepmerge": "^4.2.2",
|
|
37
37
|
"flat": "^5.0.2",
|
|
38
38
|
"intl-messageformat-parser": "^3.6.4",
|
|
39
|
-
"less-vars-loader": "1.1.0"
|
|
40
|
-
"react-intl": "6.8.4"
|
|
39
|
+
"less-vars-loader": "1.1.0"
|
|
41
40
|
},
|
|
42
41
|
"peerDependencies": {
|
|
43
42
|
"antd": "4.7.0",
|
|
44
43
|
"react": ">=16.9.0 <= 17.0.2",
|
|
44
|
+
"react-intl": ">=3.12.0 <= 6.8",
|
|
45
45
|
"styled-components": "5.0.1"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "05f083c767e2cec3c2f91c9475aee89852a77d6c"
|
|
48
48
|
}
|