@contentful/field-editor-tags 1.6.1 → 1.6.2

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.
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "TagsEditorConstraints", {
10
10
  });
11
11
  const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
12
  const _f36components = require("@contentful/f36-components");
13
+ const _core = require("@lingui/core");
13
14
  const _emotion = require("emotion");
14
15
  function _getRequireWildcardCache(nodeInterop) {
15
16
  if (typeof WeakMap !== "function") return null;
@@ -54,6 +55,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
54
55
  }
55
56
  function TagsEditorConstraints(props) {
56
57
  const { constraintsType, constraints } = props;
58
+ const min = constraints.min;
59
+ const max = constraints.max;
57
60
  return /*#__PURE__*/ _react.createElement(_f36components.Text, {
58
61
  as: "p",
59
62
  fontColor: "gray600",
@@ -63,5 +66,30 @@ function TagsEditorConstraints(props) {
63
66
  fontStyle: 'italic'
64
67
  }),
65
68
  testId: "tag-editor-constraints"
66
- }, constraintsType === 'min' && /*#__PURE__*/ _react.createElement("span", null, "Requires at least ", constraints.min, " ", constraints.min === 1 ? 'tag' : 'tags'), constraintsType === 'max' && /*#__PURE__*/ _react.createElement("span", null, "Requires no more than ", constraints.max, " ", constraints.max === 1 ? 'tag' : 'tags'), constraintsType === 'min-max' && constraints.max !== constraints.min && /*#__PURE__*/ _react.createElement("span", null, "Requires between ", constraints.min, " and ", constraints.max, " tags"), constraintsType === 'min-max' && constraints.max === constraints.min && /*#__PURE__*/ _react.createElement("span", null, "Requires exactly ", constraints.max, " ", constraints.max === 1 ? 'tag' : 'tags'));
69
+ }, constraintsType === 'min' && /*#__PURE__*/ _react.createElement("span", null, _core.i18n._({
70
+ id: "FieldEditors.Tags.TagsEditorConstraints.RequiresAtLeastNTags",
71
+ message: "{0, plural, one {Requires at least # tag} other {Requires at least # tags}}",
72
+ values: {
73
+ 0: min || 0
74
+ }
75
+ })), constraintsType === 'max' && /*#__PURE__*/ _react.createElement("span", null, _core.i18n._({
76
+ id: "FieldEditors.Tags.TagsEditorConstraints.RequiresNoMoreThanNTags",
77
+ message: "{0, plural, one {Requires no more than # tag} other {Requires no more than # tags}}",
78
+ values: {
79
+ 0: max || 0
80
+ }
81
+ })), constraintsType === 'min-max' && max !== min && /*#__PURE__*/ _react.createElement("span", null, _core.i18n._({
82
+ id: "FieldEditors.Tags.TagsEditorConstraints.RequiresBetweenNAndMTags",
83
+ message: "Requires between {min} and {max} tags",
84
+ values: {
85
+ min: min,
86
+ max: max
87
+ }
88
+ })), constraintsType === 'min-max' && max === min && /*#__PURE__*/ _react.createElement("span", null, _core.i18n._({
89
+ id: "FieldEditors.Tags.TagsEditorConstraints.RequiresExactlyNTags",
90
+ message: "{0, plural, one {Requires exactly # tag} other {Requires exactly # tags}}",
91
+ values: {
92
+ 0: max || 0
93
+ }
94
+ })));
67
95
  }
@@ -1,8 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { Text } from '@contentful/f36-components';
3
+ import { i18n as $_i18n } from "@lingui/core";
3
4
  import { css } from 'emotion';
4
5
  export function TagsEditorConstraints(props) {
5
6
  const { constraintsType, constraints } = props;
7
+ const min = constraints.min;
8
+ const max = constraints.max;
6
9
  return /*#__PURE__*/ React.createElement(Text, {
7
10
  as: "p",
8
11
  fontColor: "gray600",
@@ -12,5 +15,30 @@ export function TagsEditorConstraints(props) {
12
15
  fontStyle: 'italic'
13
16
  }),
14
17
  testId: "tag-editor-constraints"
15
- }, constraintsType === 'min' && /*#__PURE__*/ React.createElement("span", null, "Requires at least ", constraints.min, " ", constraints.min === 1 ? 'tag' : 'tags'), constraintsType === 'max' && /*#__PURE__*/ React.createElement("span", null, "Requires no more than ", constraints.max, " ", constraints.max === 1 ? 'tag' : 'tags'), constraintsType === 'min-max' && constraints.max !== constraints.min && /*#__PURE__*/ React.createElement("span", null, "Requires between ", constraints.min, " and ", constraints.max, " tags"), constraintsType === 'min-max' && constraints.max === constraints.min && /*#__PURE__*/ React.createElement("span", null, "Requires exactly ", constraints.max, " ", constraints.max === 1 ? 'tag' : 'tags'));
18
+ }, constraintsType === 'min' && /*#__PURE__*/ React.createElement("span", null, $_i18n._({
19
+ id: "FieldEditors.Tags.TagsEditorConstraints.RequiresAtLeastNTags",
20
+ message: "{0, plural, one {Requires at least # tag} other {Requires at least # tags}}",
21
+ values: {
22
+ 0: min || 0
23
+ }
24
+ })), constraintsType === 'max' && /*#__PURE__*/ React.createElement("span", null, $_i18n._({
25
+ id: "FieldEditors.Tags.TagsEditorConstraints.RequiresNoMoreThanNTags",
26
+ message: "{0, plural, one {Requires no more than # tag} other {Requires no more than # tags}}",
27
+ values: {
28
+ 0: max || 0
29
+ }
30
+ })), constraintsType === 'min-max' && max !== min && /*#__PURE__*/ React.createElement("span", null, $_i18n._({
31
+ id: "FieldEditors.Tags.TagsEditorConstraints.RequiresBetweenNAndMTags",
32
+ message: "Requires between {min} and {max} tags",
33
+ values: {
34
+ min: min,
35
+ max: max
36
+ }
37
+ })), constraintsType === 'min-max' && max === min && /*#__PURE__*/ React.createElement("span", null, $_i18n._({
38
+ id: "FieldEditors.Tags.TagsEditorConstraints.RequiresExactlyNTags",
39
+ message: "{0, plural, one {Requires exactly # tag} other {Requires exactly # tags}}",
40
+ values: {
41
+ 0: max || 0
42
+ }
43
+ })));
16
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-tags",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -38,7 +38,7 @@
38
38
  "@contentful/f36-components": "^4.70.0",
39
39
  "@contentful/f36-icons": "^4.29.0",
40
40
  "@contentful/f36-tokens": "^4.0.5",
41
- "@contentful/field-editor-shared": "^2.9.0",
41
+ "@contentful/field-editor-shared": "^2.9.1",
42
42
  "@dnd-kit/core": "^6.0.8",
43
43
  "@dnd-kit/modifiers": "^7.0.0",
44
44
  "@dnd-kit/sortable": "^8.0.0",
@@ -56,5 +56,5 @@
56
56
  "publishConfig": {
57
57
  "registry": "https://npm.pkg.github.com/"
58
58
  },
59
- "gitHead": "44e5546797a12db4d96f290e039a483297265ffa"
59
+ "gitHead": "4fa62eaa25b40c592cc3671df8626dd18013a206"
60
60
  }