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

uniforms-bootstrap4

Package Overview
Dependencies
Maintainers
1
Versions
191
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uniforms-bootstrap4 - npm Package Compare versions

Comparing version 4.0.0-alpha.3 to 4.0.0-alpha.4

cjs/types.d.ts

2

cjs/AutoField.js

@@ -18,3 +18,3 @@ "use strict";

}
if (props.allowedValues) {
if (props.options) {
return props.checkboxes && props.fieldType !== Array

@@ -21,0 +21,0 @@ ? RadioField_1.default

@@ -10,3 +10,3 @@ "use strict";

return !error ? null : (react_1.default.createElement("div", Object.assign({ className: (0, classnames_1.default)('card', 'mb-3', className) }, (0, uniforms_1.filterDOMProps)(props)),
react_1.default.createElement("div", { className: "card-body" }, children ? children : react_1.default.createElement("h4", { className: "card-title" }, errorMessage))));
react_1.default.createElement("div", { className: "card-body" }, children || react_1.default.createElement("h4", { className: "card-title" }, errorMessage))));
}

@@ -13,0 +13,0 @@ exports.default = (0, uniforms_1.connectField)(Error, {

import { HTMLFieldProps } from 'uniforms';
import type { Option } from './types';
export declare type RadioFieldProps = HTMLFieldProps<string, HTMLDivElement, {
allowedValues?: string[];
options?: Option<string>[];
inline?: boolean;
inputClassName?: string;
transform?: (value: string) => string;
}>;

@@ -8,0 +8,0 @@ declare const _default: import("uniforms").ConnectedField<RadioFieldProps, string | undefined>;

@@ -14,16 +14,18 @@ "use strict";

var _a;
return (0, wrapField_1.default)(props, (_a = props.allowedValues) === null || _a === void 0 ? void 0 : _a.map(item => (react_1.default.createElement("div", { key: item, className: (0, classnames_1.default)(props.inputClassName, 'form-check', 'radio', {
'custom-control-inline': props.inline,
'text-danger': props.error,
'text-success': !props.error && props.changed,
}) },
react_1.default.createElement("label", { htmlFor: `${props.id}-${escape(item)}`, className: "form-check-label" },
react_1.default.createElement("input", { checked: item === props.value, className: "form-check-input", disabled: props.disabled, id: `${props.id}-${escape(item)}`, name: props.name, onChange: () => {
if (!props.readOnly) {
props.onChange(item);
}
}, type: "radio" }),
' ',
props.transform ? props.transform(item) : item)))));
return (0, wrapField_1.default)(props, (_a = props.options) === null || _a === void 0 ? void 0 : _a.map(item => {
var _a, _b, _c, _d;
return (react_1.default.createElement("div", { key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value, className: (0, classnames_1.default)(props.inputClassName, 'form-check', 'radio', {
'custom-control-inline': props.inline,
'text-danger': props.error,
'text-success': !props.error && props.changed,
}) },
react_1.default.createElement("label", { htmlFor: `${props.id}-${(_b = item.key) !== null && _b !== void 0 ? _b : escape(item.value)}`, className: "form-check-label" },
react_1.default.createElement("input", { checked: item.value === props.value, className: "form-check-input", disabled: props.disabled, id: `${props.id}-${(_c = item.key) !== null && _c !== void 0 ? _c : escape(item.value)}`, name: props.name, onChange: () => {
if (!props.readOnly) {
props.onChange(item.value);
}
}, type: "radio" }),
' ', (_d = item.label) !== null && _d !== void 0 ? _d : item.value)));
}));
}
exports.default = (0, uniforms_1.connectField)(Radio, { kind: 'leaf' });
import { Ref } from 'react';
import { HTMLFieldProps } from 'uniforms';
import type { Option } from './types';
export declare type SelectFieldProps = HTMLFieldProps<string | string[], HTMLDivElement, {
allowedValues?: string[];
options?: Option<string>[];
checkboxes?: boolean;
disableItem?: (value: string) => boolean;
inline?: boolean;
inputClassName?: string;
inputRef?: Ref<HTMLSelectElement>;
transform?: (value: string) => string;
}>;

@@ -12,0 +11,0 @@ declare const _default: import("uniforms").ConnectedField<SelectFieldProps, string | string[] | undefined>;

@@ -14,3 +14,3 @@ "use strict";

function Select(_a) {
var { allowedValues, checkboxes, disableItem, disabled, error, fieldType, id, inline, inputClassName, inputRef, label, name, onChange, placeholder, readOnly, required, transform, value } = _a, props = (0, tslib_1.__rest)(_a, ["allowedValues", "checkboxes", "disableItem", "disabled", "error", "fieldType", "id", "inline", "inputClassName", "inputRef", "label", "name", "onChange", "placeholder", "readOnly", "required", "transform", "value"]);
var { options, checkboxes, disabled, error, fieldType, id, inline, inputClassName, inputRef, label, name, onChange, placeholder, readOnly, required, value } = _a, props = (0, tslib_1.__rest)(_a, ["options", "checkboxes", "disabled", "error", "fieldType", "id", "inline", "inputClassName", "inputRef", "label", "name", "onChange", "placeholder", "readOnly", "required", "value"]);
const multiple = fieldType === Array;

@@ -21,10 +21,12 @@ return (0, wrapField_1.default)(Object.assign(Object.assign({}, props), { disabled,

label,
required }), checkboxes ? (allowedValues === null || allowedValues === void 0 ? void 0 : allowedValues.map(item => (react_1.default.createElement("div", { key: item, className: (0, classnames_1.default)(inputClassName, `checkbox${inline ? '-inline' : ''}`) },
react_1.default.createElement("label", { htmlFor: `${id}-${escape(item)}` },
react_1.default.createElement("input", { checked: multiple ? value === null || value === void 0 ? void 0 : value.includes(item) : value === item, disabled: (disableItem === null || disableItem === void 0 ? void 0 : disableItem(item)) || disabled, id: `${id}-${escape(item)}`, name: name, onChange: () => {
if (!readOnly) {
onChange(multiple ? (0, xor_1.default)([item], value) : item);
}
}, type: "checkbox" }),
transform ? transform(item) : item))))) : (react_1.default.createElement("select", { className: (0, classnames_1.default)(inputClassName, 'c-select form-control', {
required }), checkboxes ? (options === null || options === void 0 ? void 0 : options.map(item => {
var _a, _b, _c, _d;
return (react_1.default.createElement("div", { key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value, className: (0, classnames_1.default)(inputClassName, `checkbox${inline ? '-inline' : ''}`) },
react_1.default.createElement("label", { htmlFor: `${id}-${(_b = item.key) !== null && _b !== void 0 ? _b : escape(item.value)}` },
react_1.default.createElement("input", { checked: multiple ? value === null || value === void 0 ? void 0 : value.includes(item.value) : value === item.value, disabled: item.disabled || disabled, id: `${id}-${(_c = item.key) !== null && _c !== void 0 ? _c : escape(item.value)}`, name: name, onChange: () => {
if (!readOnly) {
onChange(multiple ? (0, xor_1.default)([item.value], value) : item.value);
}
}, type: "checkbox" }), (_d = item.label) !== null && _d !== void 0 ? _d : item.value)));
})) : (react_1.default.createElement("select", { className: (0, classnames_1.default)(inputClassName, 'c-select form-control', {
'is-invalid': error,

@@ -44,5 +46,8 @@ 'is-valid': !error && props.changed,

}, ref: inputRef, value: value !== null && value !== void 0 ? value : '' },
(!!placeholder || !required || value === undefined) && !multiple && (react_1.default.createElement("option", { value: "", disabled: required, hidden: required }, placeholder || label)), allowedValues === null || allowedValues === void 0 ? void 0 :
allowedValues.map(allowedValue => (react_1.default.createElement("option", { disabled: disableItem === null || disableItem === void 0 ? void 0 : disableItem(allowedValue), key: allowedValue, value: allowedValue }, transform ? transform(allowedValue) : allowedValue))))));
(!!placeholder || !required || value === undefined) && !multiple && (react_1.default.createElement("option", { value: "", disabled: required, hidden: required }, placeholder || label)), options === null || options === void 0 ? void 0 :
options.map(option => {
var _a, _b;
return (react_1.default.createElement("option", { disabled: option.disabled, key: (_a = option.key) !== null && _a !== void 0 ? _a : option.value, value: option.value }, (_b = option.label) !== null && _b !== void 0 ? _b : option.value));
}))));
}
exports.default = (0, uniforms_1.connectField)(Select, { kind: 'leaf' });

@@ -33,3 +33,2 @@ "use strict";

'rows',
'transform',
])),

@@ -36,0 +35,0 @@ label && (react_1.default.createElement("label", { htmlFor: id, className: (0, classnames_1.default)({

@@ -15,3 +15,3 @@ import invariant from 'invariant';

}
if (props.allowedValues) {
if (props.options) {
return props.checkboxes && props.fieldType !== Array

@@ -18,0 +18,0 @@ ? RadioField

@@ -8,3 +8,3 @@ import { __rest } from "tslib";

return !error ? null : (React.createElement("div", Object.assign({ className: classnames('card', 'mb-3', className) }, filterDOMProps(props)),
React.createElement("div", { className: "card-body" }, children ? children : React.createElement("h4", { className: "card-title" }, errorMessage))));
React.createElement("div", { className: "card-body" }, children || React.createElement("h4", { className: "card-title" }, errorMessage))));
}

@@ -11,0 +11,0 @@ export default connectField(Error, {

import { HTMLFieldProps } from 'uniforms';
import type { Option } from './types';
export declare type RadioFieldProps = HTMLFieldProps<string, HTMLDivElement, {
allowedValues?: string[];
options?: Option<string>[];
inline?: boolean;
inputClassName?: string;
transform?: (value: string) => string;
}>;

@@ -8,0 +8,0 @@ declare const _default: import("uniforms").ConnectedField<RadioFieldProps, string | undefined>;

@@ -11,16 +11,18 @@ import classnames from 'classnames';

var _a;
return wrapField(props, (_a = props.allowedValues) === null || _a === void 0 ? void 0 : _a.map(item => (React.createElement("div", { key: item, className: classnames(props.inputClassName, 'form-check', 'radio', {
'custom-control-inline': props.inline,
'text-danger': props.error,
'text-success': !props.error && props.changed,
}) },
React.createElement("label", { htmlFor: `${props.id}-${escape(item)}`, className: "form-check-label" },
React.createElement("input", { checked: item === props.value, className: "form-check-input", disabled: props.disabled, id: `${props.id}-${escape(item)}`, name: props.name, onChange: () => {
if (!props.readOnly) {
props.onChange(item);
}
}, type: "radio" }),
' ',
props.transform ? props.transform(item) : item)))));
return wrapField(props, (_a = props.options) === null || _a === void 0 ? void 0 : _a.map(item => {
var _a, _b, _c, _d;
return (React.createElement("div", { key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value, className: classnames(props.inputClassName, 'form-check', 'radio', {
'custom-control-inline': props.inline,
'text-danger': props.error,
'text-success': !props.error && props.changed,
}) },
React.createElement("label", { htmlFor: `${props.id}-${(_b = item.key) !== null && _b !== void 0 ? _b : escape(item.value)}`, className: "form-check-label" },
React.createElement("input", { checked: item.value === props.value, className: "form-check-input", disabled: props.disabled, id: `${props.id}-${(_c = item.key) !== null && _c !== void 0 ? _c : escape(item.value)}`, name: props.name, onChange: () => {
if (!props.readOnly) {
props.onChange(item.value);
}
}, type: "radio" }),
' ', (_d = item.label) !== null && _d !== void 0 ? _d : item.value)));
}));
}
export default connectField(Radio, { kind: 'leaf' });
import { Ref } from 'react';
import { HTMLFieldProps } from 'uniforms';
import type { Option } from './types';
export declare type SelectFieldProps = HTMLFieldProps<string | string[], HTMLDivElement, {
allowedValues?: string[];
options?: Option<string>[];
checkboxes?: boolean;
disableItem?: (value: string) => boolean;
inline?: boolean;
inputClassName?: string;
inputRef?: Ref<HTMLSelectElement>;
transform?: (value: string) => string;
}>;

@@ -12,0 +11,0 @@ declare const _default: import("uniforms").ConnectedField<SelectFieldProps, string | string[] | undefined>;

@@ -12,3 +12,3 @@ import { __rest } from "tslib";

function Select(_a) {
var { allowedValues, checkboxes, disableItem, disabled, error, fieldType, id, inline, inputClassName, inputRef, label, name, onChange, placeholder, readOnly, required, transform, value } = _a, props = __rest(_a, ["allowedValues", "checkboxes", "disableItem", "disabled", "error", "fieldType", "id", "inline", "inputClassName", "inputRef", "label", "name", "onChange", "placeholder", "readOnly", "required", "transform", "value"]);
var { options, checkboxes, disabled, error, fieldType, id, inline, inputClassName, inputRef, label, name, onChange, placeholder, readOnly, required, value } = _a, props = __rest(_a, ["options", "checkboxes", "disabled", "error", "fieldType", "id", "inline", "inputClassName", "inputRef", "label", "name", "onChange", "placeholder", "readOnly", "required", "value"]);
const multiple = fieldType === Array;

@@ -19,10 +19,12 @@ return wrapField(Object.assign(Object.assign({}, props), { disabled,

label,
required }), checkboxes ? (allowedValues === null || allowedValues === void 0 ? void 0 : allowedValues.map(item => (React.createElement("div", { key: item, className: classnames(inputClassName, `checkbox${inline ? '-inline' : ''}`) },
React.createElement("label", { htmlFor: `${id}-${escape(item)}` },
React.createElement("input", { checked: multiple ? value === null || value === void 0 ? void 0 : value.includes(item) : value === item, disabled: (disableItem === null || disableItem === void 0 ? void 0 : disableItem(item)) || disabled, id: `${id}-${escape(item)}`, name: name, onChange: () => {
if (!readOnly) {
onChange(multiple ? xor([item], value) : item);
}
}, type: "checkbox" }),
transform ? transform(item) : item))))) : (React.createElement("select", { className: classnames(inputClassName, 'c-select form-control', {
required }), checkboxes ? (options === null || options === void 0 ? void 0 : options.map(item => {
var _a, _b, _c, _d;
return (React.createElement("div", { key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value, className: classnames(inputClassName, `checkbox${inline ? '-inline' : ''}`) },
React.createElement("label", { htmlFor: `${id}-${(_b = item.key) !== null && _b !== void 0 ? _b : escape(item.value)}` },
React.createElement("input", { checked: multiple ? value === null || value === void 0 ? void 0 : value.includes(item.value) : value === item.value, disabled: item.disabled || disabled, id: `${id}-${(_c = item.key) !== null && _c !== void 0 ? _c : escape(item.value)}`, name: name, onChange: () => {
if (!readOnly) {
onChange(multiple ? xor([item.value], value) : item.value);
}
}, type: "checkbox" }), (_d = item.label) !== null && _d !== void 0 ? _d : item.value)));
})) : (React.createElement("select", { className: classnames(inputClassName, 'c-select form-control', {
'is-invalid': error,

@@ -42,5 +44,8 @@ 'is-valid': !error && props.changed,

}, ref: inputRef, value: value !== null && value !== void 0 ? value : '' },
(!!placeholder || !required || value === undefined) && !multiple && (React.createElement("option", { value: "", disabled: required, hidden: required }, placeholder || label)), allowedValues === null || allowedValues === void 0 ? void 0 :
allowedValues.map(allowedValue => (React.createElement("option", { disabled: disableItem === null || disableItem === void 0 ? void 0 : disableItem(allowedValue), key: allowedValue, value: allowedValue }, transform ? transform(allowedValue) : allowedValue))))));
(!!placeholder || !required || value === undefined) && !multiple && (React.createElement("option", { value: "", disabled: required, hidden: required }, placeholder || label)), options === null || options === void 0 ? void 0 :
options.map(option => {
var _a, _b;
return (React.createElement("option", { disabled: option.disabled, key: (_a = option.key) !== null && _a !== void 0 ? _a : option.value, value: option.value }, (_b = option.label) !== null && _b !== void 0 ? _b : option.value));
}))));
}
export default connectField(Select, { kind: 'leaf' });

@@ -31,3 +31,2 @@ import { __rest } from "tslib";

'rows',
'transform',
])),

@@ -34,0 +33,0 @@ label && (React.createElement("label", { htmlFor: id, className: classnames({

{
"name": "uniforms-bootstrap4",
"version": "4.0.0-alpha.3",
"version": "4.0.0-alpha.4",
"license": "MIT",

@@ -38,6 +38,6 @@ "main": "./cjs/index.js",

"tslib": "^2.2.0",
"uniforms": "^4.0.0-alpha.3",
"uniforms": "^4.0.0-alpha.4",
"warning": "^4.0.0"
},
"gitHead": "1353ab3a541d279a50e2dadfbc8e7684fd1a4fab"
"gitHead": "e046d871f3514c8f7e2d45cf957495444507b848"
}

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

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