<commit_before>/** @jsx dom */
import dom from 'magic-virtual-element';
import * as Field from '../field';

export const propTypes = {
	class: {
		type: 'string'
	},
	disabled: {
		type: 'boolean'
	},
	error: {
		type: 'string'
	},
	hint: {
		type: 'string'
	},
	id: {
		type: 'string'
	},
	label: {
		type: 'string'
	},
	max: {
		type: 'number'
	},
	maxLength: {
		type: 'number'
	},
	min: {
		type: 'number'
	},
	minLength: {
		type: 'number'
	},
	name: {
		type: 'string'
	},
	onChange: {
		type: 'function'
	},
	onInput: {
		type: 'function'
	},
	pattern: {
		type: 'string'
	},
	placeholder: {
		type: 'string'
	},
	readonly: {
		type: 'boolean'
	},
	required: {
		type: 'boolean'
	},
	size: {
		type: 'number'
	},
	type: {
		type: 'string'
	},
	validate: {
		type: 'boolean'
	},
	validationMessage: {
		type: 'function'
	},
	value: {
		type: 'string'
	}
};

export const defaultProps = {
	type: 'text',
	validationMessage(valid, el) {
		return el.validationMessage;
	}
};

export function render({props, state}, setState) {
	const {disabled, name, placeholder, readonly, size, type, value} = props;
	const {hint, id, label} = props;
	const {max, maxLength, min, minLength, pattern, required, step} = props;
	const {onChange, onInput} = props;
	const error = props.error || state.error;
	const validate = props.validate || state.validate;
	const fieldAttrs = {error, hint, id, label};
	const inputAttrs = {
		disabled, id, name, placeholder, readonly, size, type,
		max, maxLength, min, minLength, pattern, required, step,
		value: String(value || '')
	};

	function checkError(e) {
		const el = e.target;
		const validity = el.validity;
		setState({error: props.validationMessage(validity, el)});
	}

	function handleInput(e) {
		if (onInput) {
			onInput(e);
		}
<commit_msg>Add `checked` attribute<commit_after>/** @jsx dom */
import dom from 'magic-virtual-element';
import * as Field from '../field';

export const propTypes = {
	checked: {
		type: 'boolean'
	},
	class: {
		type: 'string'
	},
	disabled: {
		type: 'boolean'
	},
	error: {
		type: 'string'
	},
	hint: {
		type: 'string'
	},
	id: {
		type: 'string'
	},
	label: {
		type: 'string'
	},
	max: {
		type: 'number'
	},
	maxLength: {
		type: 'number'
	},
	min: {
		type: 'number'
	},
	minLength: {
		type: 'number'
	},
	name: {
		type: 'string'
	},
	onChange: {
		type: 'function'
	},
	onInput: {
		type: 'function'
	},
	pattern: {
		type: 'string'
	},
	placeholder: {
		type: 'string'
	},
	readonly: {
		type: 'boolean'
	},
	required: {
		type: 'boolean'
	},
	size: {
		type: 'number'
	},
	type: {
		type: 'string'
	},
	validate: {
		type: 'boolean'
	},
	validationMessage: {
		type: 'function'
	},
	value: {
		type: 'string'
	}
};

export const defaultProps = {
	type: 'text',
	validationMessage(valid, el) {
		return el.validationMessage;
	}
};

export function render({props, state}, setState) {
	const {checked, disabled, name, placeholder, readonly, size, type, value} = props;
	const {hint, id, label} = props;
	const {max, maxLength, min, minLength, pattern, required, step} = props;
	const {onChange, onInput} = props;
	const error = props.error || state.error;
	const validate = props.validate || state.validate;
	const fieldAttrs = {error, hint, id, label};
	const inputAttrs = {
		checked, disabled, id, name, placeholder, readonly, size, type,
		max, maxLength, min, minLength, pattern, required, step,
		value: String(value || '')
	};

	function checkError(e) {
		const el = e.target;
		const validity = el.validity;
		setState({error: props.validationMessage(validity, el)});
	}

	function handleInput(e) {
		if (onInput) {
			onInput(e);
		}

{'fraction_non_alphanumeric': 0.1712630998345284, 'fraction_numerical': 0.0, 'mean_word_length': 3.5680100755667508, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '322981', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1371, 'n_words': 347}