@prezly/theme-kit-nextjs 10.6.3-beta.0 → 10.8.0-alpha.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.
@@ -28,13 +28,17 @@ var IntlAdapter;
28
28
  function _useIntl() {
29
29
  _useIntl = _asyncToGenerator(function* (locale) {
30
30
  var timezone = yield _themeKitCore.AsyncResolvable.resolve(config.timezone);
31
+ var dateFormat = config.dateFormat ? yield _themeKitCore.AsyncResolvable.resolve(config.dateFormat) : undefined;
32
+ var timeFormat = config.timeFormat ? yield _themeKitCore.AsyncResolvable.resolve(config.timeFormat) : undefined;
31
33
  var messages = yield resolveDictionary(locale);
32
34
  return {
33
35
  messages,
34
36
  formatMessage(descriptor, values) {
35
37
  return (0, _themeKitIntl.formatMessageString)(locale, descriptor, messages, values);
36
38
  },
37
- timezone
39
+ timezone,
40
+ dateFormat,
41
+ timeFormat
38
42
  };
39
43
  });
40
44
  return _useIntl.apply(this, arguments);
@@ -55,8 +59,10 @@ var IntlAdapter;
55
59
  function _FormattedDate() {
56
60
  _FormattedDate = _asyncToGenerator(function* (props) {
57
61
  var timezone = yield _themeKitCore.AsyncResolvable.resolve(config.timezone);
62
+ var dateFormat = config.dateFormat ? yield _themeKitCore.AsyncResolvable.resolve(config.dateFormat) : undefined;
58
63
  return /*#__PURE__*/_react.default.createElement(_themeKitReact.FormattedDate, _extends({
59
- timezone: timezone
64
+ timezone: timezone,
65
+ dateFormat: dateFormat
60
66
  }, props));
61
67
  });
62
68
  return _FormattedDate.apply(this, arguments);
@@ -67,8 +73,10 @@ var IntlAdapter;
67
73
  function _FormattedTime() {
68
74
  _FormattedTime = _asyncToGenerator(function* (props) {
69
75
  var timezone = yield _themeKitCore.AsyncResolvable.resolve(config.timezone);
76
+ var timeFormat = config.timeFormat ? yield _themeKitCore.AsyncResolvable.resolve(config.timeFormat) : undefined;
70
77
  return /*#__PURE__*/_react.default.createElement(_themeKitReact.FormattedTime, _extends({
71
- timezone: timezone
78
+ timezone: timezone,
79
+ timeFormat: timeFormat
72
80
  }, props));
73
81
  });
74
82
  return _FormattedTime.apply(this, arguments);
@@ -7,12 +7,22 @@ export declare namespace IntlAdapter {
7
7
  interface Configuration {
8
8
  resolveDictionary?: (localeCode: Locale.Code) => Awaitable<IntlDictionary>;
9
9
  timezone: AsyncResolvable<Timezone>;
10
+ /**
11
+ * Optional moment.js style date format from `Newsroom['date_format']`.
12
+ */
13
+ dateFormat?: AsyncResolvable<string | undefined>;
14
+ /**
15
+ * Optional moment.js style time format from `Newsroom['time_format']`.
16
+ */
17
+ timeFormat?: AsyncResolvable<string | undefined>;
10
18
  }
11
19
  function connect({ resolveDictionary, ...config }: Configuration): {
12
20
  useIntl: (locale: Locale.Code) => Promise<{
13
21
  messages: Partial<Record<string, import("@prezly/theme-kit-intl").IntlMessageFormat>>;
14
22
  formatMessage(descriptor: IntlMessageDescriptor, values?: IntlMessageValues<string>): string;
15
23
  timezone: string;
24
+ dateFormat: string | undefined;
25
+ timeFormat: string | undefined;
16
26
  }>;
17
27
  FormattedMessage: (props: {
18
28
  for: IntlMessageDescriptor;
@@ -21,13 +21,17 @@ export var IntlAdapter;
21
21
  function _useIntl() {
22
22
  _useIntl = _asyncToGenerator(function* (locale) {
23
23
  var timezone = yield AsyncResolvable.resolve(config.timezone);
24
+ var dateFormat = config.dateFormat ? yield AsyncResolvable.resolve(config.dateFormat) : undefined;
25
+ var timeFormat = config.timeFormat ? yield AsyncResolvable.resolve(config.timeFormat) : undefined;
24
26
  var messages = yield resolveDictionary(locale);
25
27
  return {
26
28
  messages,
27
29
  formatMessage(descriptor, values) {
28
30
  return formatMessageString(locale, descriptor, messages, values);
29
31
  },
30
- timezone
32
+ timezone,
33
+ dateFormat,
34
+ timeFormat
31
35
  };
32
36
  });
33
37
  return _useIntl.apply(this, arguments);
@@ -48,8 +52,10 @@ export var IntlAdapter;
48
52
  function _FormattedDate() {
49
53
  _FormattedDate = _asyncToGenerator(function* (props) {
50
54
  var timezone = yield AsyncResolvable.resolve(config.timezone);
55
+ var dateFormat = config.dateFormat ? yield AsyncResolvable.resolve(config.dateFormat) : undefined;
51
56
  return /*#__PURE__*/React.createElement(BaseFormattedDate, _extends({
52
- timezone: timezone
57
+ timezone: timezone,
58
+ dateFormat: dateFormat
53
59
  }, props));
54
60
  });
55
61
  return _FormattedDate.apply(this, arguments);
@@ -60,8 +66,10 @@ export var IntlAdapter;
60
66
  function _FormattedTime() {
61
67
  _FormattedTime = _asyncToGenerator(function* (props) {
62
68
  var timezone = yield AsyncResolvable.resolve(config.timezone);
69
+ var timeFormat = config.timeFormat ? yield AsyncResolvable.resolve(config.timeFormat) : undefined;
63
70
  return /*#__PURE__*/React.createElement(BaseFormattedTime, _extends({
64
- timezone: timezone
71
+ timezone: timezone,
72
+ timeFormat: timeFormat
65
73
  }, props));
66
74
  });
67
75
  return _FormattedTime.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/theme-kit-nextjs",
3
- "version": "10.6.3-beta.0",
3
+ "version": "10.8.0-alpha.0",
4
4
  "description": "Data layer and utility library for developing Prezly themes with NextJS",
5
5
  "type": "module",
6
6
  "main": "build/index.mjs",
@@ -95,9 +95,9 @@
95
95
  }
96
96
  },
97
97
  "dependencies": {
98
- "@prezly/theme-kit-core": "^10.6.3-beta.0",
99
- "@prezly/theme-kit-intl": "^10.6.2",
100
- "@prezly/theme-kit-react": "^10.6.2",
98
+ "@prezly/theme-kit-core": "^10.8.0-alpha.0",
99
+ "@prezly/theme-kit-intl": "^10.8.0-alpha.0",
100
+ "@prezly/theme-kit-react": "^10.8.0-alpha.0",
101
101
  "@technically/is-not-undefined": "^1.0.0",
102
102
  "@technically/omit-undefined": "^1.0.4",
103
103
  "json-stable-stringify": "^1.2.1",
@@ -111,5 +111,5 @@
111
111
  "access": "public"
112
112
  },
113
113
  "sideEffects": false,
114
- "gitHead": "3d8b36a298d0b106bea1a79c90510e18abc9302c"
114
+ "gitHead": "d056a9b0e4ca7ef2adc14ef502c9a2eafb7dcf96"
115
115
  }