Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@contentful/field-editor-checkbox

Package Overview
Dependencies
Maintainers
64
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentful/field-editor-checkbox - npm Package Compare versions

Comparing version 0.4.2 to 0.5.0

dist/styles.d.ts

3

dist/CheckboxEditor.d.ts
/// <reference types="react" />
import { FieldAPI } from '@contentful/field-editor-shared';
import { FieldAPI, LocalesAPI } from '@contentful/field-editor-shared';
export interface CheckboxEditorProps {

@@ -9,2 +9,3 @@ /**

field: FieldAPI;
locales: LocalesAPI;
}

@@ -11,0 +12,0 @@ declare type CheckboxOption = {

@@ -8,6 +8,17 @@ 'use strict';

var get = _interopDefault(require('lodash/get'));
var tokens = _interopDefault(require('@contentful/forma-36-tokens'));
var fieldEditorShared = require('@contentful/field-editor-shared');
var forma36ReactComponents = require('@contentful/forma-36-react-components');
var tokens = _interopDefault(require('@contentful/forma-36-tokens'));
var form =
/*#__PURE__*/
emotion.css({
marginTop: tokens.spacingS
});
var rightToLeft =
/*#__PURE__*/
emotion.css({
direction: 'rtl'
});
function isEmptyListValue(value) {

@@ -35,3 +46,4 @@ return value === null || value.length === 0;

function CheckboxEditor(props) {
var field = props.field;
var field = props.field,
locales = props.locales;
var options = getOptions(field);

@@ -44,2 +56,3 @@ var misconfigured = options.length === 0;

var direction = locales.direction[field.locale] || 'ltr';
return React.createElement(fieldEditorShared.FieldConnector, {

@@ -73,5 +86,3 @@ throttle: 0,

spacing: "condensed",
className: emotion.cx(emotion.css({
marginTop: tokens.spacingS
}), 'x--directed')
className: emotion.cx(form, direction === 'rtl' ? rightToLeft : '')
}, options.map(function (item) {

@@ -78,0 +89,0 @@ return React.createElement(forma36ReactComponents.CheckboxField, {

@@ -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"),r=e(require("lodash/get")),i=require("@contentful/field-editor-shared"),l=require("@contentful/forma-36-react-components"),a=e(require("@contentful/forma-36-tokens")),o=n.css({marginTop:a.spacingS}),u=n.css({direction:"rtl"});function c(e){return null===e||0===e.length}function d(e){var a=e.field,d=e.locales,s=function(e){var t=r(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}}))}(a);if(0===s.length)return t.createElement(i.PredefinedValuesError,null);var f=d.direction[a.locale]||"ltr";return t.createElement(i.FieldConnector,{throttle:0,isEmptyValue:c,field:a,isInitiallyDisabled:e.isInitiallyDisabled},(function(e){var r=e.disabled,i=e.setValue,c=e.value||[];return t.createElement(l.Form,{testId:"checkbox-editor",spacing:"condensed",className:n.cx(o,"rtl"===f?u:"")},s.map((function(e){return t.createElement(l.CheckboxField,{key:e.id,labelIsLight:!0,id:e.id,checked:c.includes(e.value),labelText:e.label,disabled:r,value:e.value,name:a.id+"."+a.locale,onChange:function(t){var n,r;t.target.checked?(n=e.value,r=[].concat(c.filter((function(e){return e!==n})),[n]),i(r)):function(e){var t=c.filter((function(t){return t!==e}));i(t)}(e.value)}})})))}))}d.defaultProps={isInitiallyDisabled:!0},exports.CheckboxEditor=d;
//# sourceMappingURL=field-editor-checkbox.cjs.production.min.js.map
import { createElement } from 'react';
import { cx, css } from 'emotion';
import { css, cx } from 'emotion';
import get from 'lodash-es/get';
import tokens from '@contentful/forma-36-tokens';
import { PredefinedValuesError, FieldConnector } from '@contentful/field-editor-shared';
import { Form, CheckboxField } from '@contentful/forma-36-react-components';
import tokens from '@contentful/forma-36-tokens';
var form =
/*#__PURE__*/
css({
marginTop: tokens.spacingS
});
var rightToLeft =
/*#__PURE__*/
css({
direction: 'rtl'
});
function isEmptyListValue(value) {

@@ -30,3 +41,4 @@ return value === null || value.length === 0;

function CheckboxEditor(props) {
var field = props.field;
var field = props.field,
locales = props.locales;
var options = getOptions(field);

@@ -39,2 +51,3 @@ var misconfigured = options.length === 0;

var direction = locales.direction[field.locale] || 'ltr';
return createElement(FieldConnector, {

@@ -68,5 +81,3 @@ throttle: 0,

spacing: "condensed",
className: cx(css({
marginTop: tokens.spacingS
}), 'x--directed')
className: cx(form, direction === 'rtl' ? rightToLeft : '')
}, options.map(function (item) {

@@ -73,0 +84,0 @@ return createElement(CheckboxField, {

{
"name": "@contentful/field-editor-checkbox",
"version": "0.4.2",
"version": "0.5.0",
"main": "dist/index.js",

@@ -24,3 +24,3 @@ "module": "dist/field-editor-checkbox.esm.js",

"dependencies": {
"@contentful/field-editor-shared": "^0.4.0",
"@contentful/field-editor-shared": "^0.5.0",
"@contentful/forma-36-react-components": "^3.18.4",

@@ -33,3 +33,3 @@ "@contentful/forma-36-tokens": "^0.4.5",

"devDependencies": {
"@contentful/field-editor-test-utils": "^0.1.2"
"@contentful/field-editor-test-utils": "^0.2.0"
},

@@ -49,3 +49,3 @@ "peerDependencies": {

},
"gitHead": "f3001b6329054b1e33756f6c87a1ab96e552ac52"
"gitHead": "ea5724b2ff5d9bfcd1cc3c6cde3db99eedc7f04a"
}
# @contentful/field-editor-checkbox
This package contains a React `CheckboxEditor` component and an extension that is used as a default for `Short text / List` field type in the Contentful web application.
This package contains a React `CheckboxEditor` component and an extension that is used as a default for the `Symbol / List` field type in the Contentful web application.

@@ -5,0 +5,0 @@ ## Commands

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc