@contentful/field-editor-checkbox
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("react"),n=require("emotion"),i=e(require("lodash/get")),r=e(require("@contentful/forma-36-tokens")),l=require("@contentful/field-editor-shared"),a=require("@contentful/forma-36-react-components");function u(e){return null===e||0===e.length}function o(e){var o=e.field,c=function(e){var t=i(e,["items","validations"],[]).filter(function(e){return e.in}).map(function(e){return e.in});return(t.length>0?t[0]:[]).map(function(t,n){return{id:["entity",e.id,e.locale,n].join("."),value:t,label:t}})}(o);return 0===c.length?t.createElement(l.PredefinedValuesError,null):t.createElement(l.FieldConnector,{throttle:0,isEmptyValue:u,field:o,isInitiallyDisabled:e.isInitiallyDisabled},function(e){var i=e.disabled,l=e.setValue,u=e.value||[];return t.createElement(a.Form,{testId:"checkbox-editor",spacing:"condensed",className:n.cx(n.css({marginTop:r.spacingS}),"x--directed")},c.map(function(e){return t.createElement(a.CheckboxField,{key:e.id,labelIsLight:!0,id:e.id,checked:u.includes(e.value),labelText:e.label,disabled:i,value:e.value,name:o.id+"."+o.locale,onChange:function(t){var n,i;t.target.checked?(n=e.value,i=[].concat(u.filter(function(e){return e!==n}),[n]),l(i)):function(e){var t=u.filter(function(t){return t!==e});l(t)}(e.value)}})}))})}o.defaultProps={isInitiallyDisabled:!0},exports.CheckboxEditor=o; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("react"),n=require("emotion"),i=e(require("lodash/get")),r=e(require("@contentful/forma-36-tokens")),l=require("@contentful/field-editor-shared"),a=require("@contentful/forma-36-react-components");function u(e){return null===e||0===e.length}function o(e){var o=e.field,c=function(e){var t=i(e,["items","validations"],[]).filter((function(e){return e.in})).map((function(e){return e.in}));return(t.length>0?t[0]:[]).map((function(t,n){return{id:["entity",e.id,e.locale,n].join("."),value:t,label:t}}))}(o);return 0===c.length?t.createElement(l.PredefinedValuesError,null):t.createElement(l.FieldConnector,{throttle:0,isEmptyValue:u,field:o,isInitiallyDisabled:e.isInitiallyDisabled},(function(e){var i=e.disabled,l=e.setValue,u=e.value||[];return t.createElement(a.Form,{testId:"checkbox-editor",spacing:"condensed",className:n.cx(n.css({marginTop:r.spacingS}),"x--directed")},c.map((function(e){return t.createElement(a.CheckboxField,{key:e.id,labelIsLight:!0,id:e.id,checked:u.includes(e.value),labelText:e.label,disabled:i,value:e.value,name:o.id+"."+o.locale,onChange:function(t){var n,i;t.target.checked?(n=e.value,i=[].concat(u.filter((function(e){return e!==n})),[n]),l(i)):function(e){var t=u.filter((function(t){return t!==e}));l(t)}(e.value)}})})))}))}o.defaultProps={isInitiallyDisabled:!0},exports.CheckboxEditor=o; | ||
//# sourceMappingURL=field-editor-checkbox.cjs.production.min.js.map |
@@ -1,1 +0,16 @@ | ||
export { CheckboxEditor } from './CheckboxEditor'; | ||
/// <reference types="react" /> | ||
import { FieldAPI } from "@contentful/field-editor-shared"; | ||
interface CheckboxEditorProps { | ||
/** | ||
* is the field disabled initially | ||
*/ | ||
isInitiallyDisabled: boolean; | ||
field: FieldAPI; | ||
} | ||
declare function CheckboxEditor(props: CheckboxEditorProps): JSX.Element; | ||
declare namespace CheckboxEditor { | ||
declare var defaultProps: { | ||
isInitiallyDisabled: boolean; | ||
}; | ||
} | ||
export { CheckboxEditor }; |
{ | ||
"name": "@contentful/field-editor-checkbox", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"main": "dist/index.js", | ||
@@ -18,3 +18,3 @@ "module": "dist/field-editor-checkbox.esm.js", | ||
"dependencies": { | ||
"@contentful/field-editor-shared": "^0.2.0", | ||
"@contentful/field-editor-shared": "^0.3.0", | ||
"@contentful/forma-36-react-components": "^3.18.4", | ||
@@ -26,2 +26,5 @@ "@contentful/forma-36-tokens": "^0.4.5", | ||
}, | ||
"devDependencies": { | ||
"@contentful/field-editor-test-utils": "^0.1.0" | ||
}, | ||
"peerDependencies": { | ||
@@ -40,3 +43,3 @@ "react": ">=16.8.0" | ||
}, | ||
"gitHead": "44f474ffed2e60eca2a7a75ad7b23b7bbfa1b1b7" | ||
"gitHead": "9bdefb6ecd9b8f05de4187ca92f0172767877ea2" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
27291
1
10
205
+ Added@contentful/field-editor-shared@0.3.1(transitive)
- Removed@contentful/field-editor-shared@0.2.0(transitive)