New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

armstrong-react

Package Overview
Dependencies
Maintainers
5
Versions
339
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

armstrong-react - npm Package Compare versions

Comparing version

to
2.3.21

6

dist/components/form/form.d.ts

@@ -34,2 +34,4 @@ /// <reference types="react" />

validationMode?: "none" | "icon" | "below" | "both";
/** (boolean) Automatically focus the first input (if it's empty) when the form is rendered */
focusFirstEmptyInput?: boolean;
}

@@ -52,7 +54,9 @@ export interface IFormContext {

export declare class Form extends React.Component<IFormProps, {}> {
private formDom;
static defaultProps: Partial<IFormProps>;
static contextTypes: {
"form": any;
form: any;
};
static getFormContext(context: any): IFormContext;
componentDidMount(): void;
getChildContext(): {

@@ -59,0 +63,0 @@ form: IFormContext;

@@ -76,3 +76,6 @@ "use strict";

var _this = _super !== null && _super.apply(this, arguments) || this;
_this.preventDefault = function (e) { e.preventDefault(); return false; };
_this.preventDefault = function (e) {
e.preventDefault();
return false;
};
_this.notifyChange = function () {

@@ -87,2 +90,13 @@ _this.props.onDataBinderChange && _this.props.onDataBinderChange(_this.props.dataBinder);

};
Form.prototype.componentDidMount = function () {
if (this.props.focusFirstEmptyInput) {
var f = this.formDom;
var input = f.querySelector('input:not([type="hidden"]');
if (input) {
if (!input.value) {
input.focus();
}
}
}
};
Form.prototype.getChildContext = function () {

@@ -103,6 +117,7 @@ return {

Form.prototype.render = function () {
var _this = this;
var ch = this.processChildren(this.props.children, this.props.validationMode);
var hasParentForm = !!Form.getFormContext(this.context);
var className = classNames_1.ClassHelpers.classNames("form", hasParentForm && "form-nested", this.props.className);
return hasParentForm ? React.createFactory("div")({ className: className }, ch) : React.createFactory("form")({ className: className, onSubmit: this.preventDefault }, ch);
return hasParentForm ? React.createFactory("div")({ className: className, ref: function (r) { return (_this.formDom = r); } }, ch) : React.createFactory("form")({ className: className, onSubmit: this.preventDefault, ref: function (r) { return (_this.formDom = r); } }, ch);
};

@@ -159,3 +174,3 @@ Form.prototype.processChildren = function (node, validationMode) {

};
Form.contextTypes = { "form": prop_types_1.PropTypes.object };
Form.contextTypes = { form: prop_types_1.PropTypes.object };
Form.childContextTypes = {

@@ -162,0 +177,0 @@ form: prop_types_1.PropTypes.object

2

package.json
{
"name": "armstrong-react",
"version": "2.3.20",
"version": "2.3.21",
"description": "Rocketmakers Armstrong library of React components",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet