@contentful/field-editor-shared
Advanced tools
Comparing version 1.4.8 to 1.4.9
@@ -66,15 +66,13 @@ "use strict"; | ||
function CharCounter(props) { | ||
const { constraints, value, checkConstraint } = props; | ||
let count = 0; | ||
if (value) { | ||
count = value.length; | ||
if (props.value) { | ||
count = props.value.length; | ||
} | ||
const valid = count === 0 || checkConstraint(count); | ||
const valid = count === 0 || props.checkConstraint(count); | ||
return _react.createElement("span", { | ||
"data-status-code": valid ? null : 'invalid-size', | ||
"data-test-id": "cf-ui-char-counter", | ||
className: (0, _emotion.cx)({ | ||
[styles.invalid]: !valid | ||
}) | ||
}, constraints.type === 'min' ? `${count}` : `${count} / ${constraints.max}`); | ||
}, count, " characters"); | ||
} |
@@ -27,2 +27,5 @@ "use strict"; | ||
}, | ||
CharValidation: function() { | ||
return _CharValidation.CharValidation; | ||
}, | ||
ConstraintsUtils: function() { | ||
@@ -106,2 +109,3 @@ return _constraints; | ||
const _CharCounter = require("./CharCounter"); | ||
const _CharValidation = require("./CharValidation"); | ||
const _FieldConnector = require("./FieldConnector"); | ||
@@ -108,0 +112,0 @@ const _PredefinedValuesError = require("./PredefinedValuesError"); |
@@ -10,15 +10,13 @@ import * as React from 'react'; | ||
export function CharCounter(props) { | ||
const { constraints, value, checkConstraint } = props; | ||
let count = 0; | ||
if (value) { | ||
count = value.length; | ||
if (props.value) { | ||
count = props.value.length; | ||
} | ||
const valid = count === 0 || checkConstraint(count); | ||
const valid = count === 0 || props.checkConstraint(count); | ||
return React.createElement("span", { | ||
"data-status-code": valid ? null : 'invalid-size', | ||
"data-test-id": "cf-ui-char-counter", | ||
className: cx({ | ||
[styles.invalid]: !valid | ||
}) | ||
}, constraints.type === 'min' ? `${count}` : `${count} / ${constraints.max}`); | ||
}, count, " characters"); | ||
} |
export { AccessAPI, AppConfigAPI, BaseAppSDK, ContentType, DialogsAPI, EntryAPI, EntryFieldAPI, FieldAPI, FieldAppSDK, IdsAPI, LocalesAPI, LocationAPI, NavigatorAPI, NotifierAPI, OpenCustomWidgetOptions, ParametersAPI, SpaceAPI, WindowAPI } from '@contentful/app-sdk'; | ||
export { CharCounter } from './CharCounter'; | ||
export { CharValidation } from './CharValidation'; | ||
export { FieldConnector } from './FieldConnector'; | ||
@@ -4,0 +5,0 @@ export { PredefinedValuesError } from './PredefinedValuesError'; |
/// <reference types="react" /> | ||
import { ValidationType } from 'types'; | ||
interface CharCounterProps { | ||
value?: string; | ||
checkConstraint: (n: number) => boolean; | ||
constraints: ValidationType; | ||
} | ||
export declare function CharCounter(props: CharCounterProps): JSX.Element; | ||
export {}; |
export { AccessAPI, AppConfigAPI, BaseAppSDK, ContentType, DialogsAPI, EntryAPI, EntryFieldAPI, FieldAPI, FieldAppSDK, IdsAPI, LocalesAPI, LocationAPI, NavigatorAPI, NotifierAPI, OpenCustomWidgetOptions, ParametersAPI, SpaceAPI, WindowAPI, } from '@contentful/app-sdk'; | ||
export { CharCounter } from './CharCounter'; | ||
export { CharValidation } from './CharValidation'; | ||
export { FieldConnector } from './FieldConnector'; | ||
@@ -4,0 +5,0 @@ export type { FieldConnectorChildProps } from './FieldConnector'; |
{ | ||
"name": "@contentful/field-editor-shared", | ||
"version": "1.4.8", | ||
"version": "1.4.9", | ||
"main": "dist/cjs/index.js", | ||
@@ -54,3 +54,3 @@ "module": "dist/esm/index.js", | ||
}, | ||
"gitHead": "1d7d630fe6f9576ee4cf35feed8badc8440acbf1" | ||
"gitHead": "29cf5fb16a8d61f6c23678dad618c61aceec320d" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63828
42
1877