@cloudflare/component-checkbox
Advanced tools
Comparing version
@@ -7,3 +7,3 @@ import React from 'react'; | ||
value: string; | ||
label: string | boolean | React.ReactNode; | ||
label?: string | boolean | React.ReactNode; | ||
checked?: boolean; | ||
@@ -21,5 +21,6 @@ onChange?: React.ChangeEventHandler<HTMLInputElement>; | ||
unwrap?: boolean; | ||
marginRight?: string | number; | ||
}; | ||
declare type Props = Omit<React.ComponentProps<typeof Div>, keyof CheckboxProps | 'onChange'> & CheckboxProps; | ||
declare function Checkbox({ id, name, className, indeterminate, checked, value, onChange, disabled, testId, label, invalid, noLabel, spacing, unwrap, ...labelProps }: Props): JSX.Element; | ||
declare function Checkbox({ id, name, className, indeterminate, checked, value, onChange, disabled, testId, label, invalid, noLabel, spacing, unwrap, marginRight, ...labelProps }: Props): JSX.Element; | ||
export default Checkbox; |
@@ -1,2 +0,2 @@ | ||
var _excluded = ["id", "name", "className", "indeterminate", "checked", "value", "onChange", "disabled", "testId", "label", "invalid", "noLabel", "spacing", "unwrap"]; | ||
var _excluded = ["id", "name", "className", "indeterminate", "checked", "value", "onChange", "disabled", "testId", "label", "invalid", "noLabel", "spacing", "unwrap", "marginRight"]; | ||
@@ -34,3 +34,4 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
indeterminate, | ||
disabled | ||
disabled, | ||
marginRight | ||
} = _ref; | ||
@@ -54,3 +55,3 @@ var svgs = isDarkMode() ? darkSvgs : lightSvgs; | ||
})), {}, { | ||
marginRight: 3, | ||
marginRight, | ||
marginLeft: 0, | ||
@@ -78,3 +79,4 @@ backgroundPosition: '-1px 0', | ||
spacing = 2, | ||
unwrap | ||
unwrap, | ||
marginRight = 3 | ||
} = _ref2, | ||
@@ -94,6 +96,7 @@ labelProps = _objectWithoutProperties(_ref2, _excluded); | ||
"data-testid": testId, | ||
value: value | ||
value: value, | ||
marginRight: marginRight | ||
}); | ||
checkbox = unwrap ? checkbox : /*#__PURE__*/React.createElement("div", null, checkbox); | ||
return noLabel ? checkbox : | ||
return noLabel || !label ? checkbox : | ||
/*#__PURE__*/ | ||
@@ -100,0 +103,0 @@ // @ts-ignore |
@@ -16,3 +16,3 @@ "use strict"; | ||
var _excluded = ["id", "name", "className", "indeterminate", "checked", "value", "onChange", "disabled", "testId", "label", "invalid", "noLabel", "spacing", "unwrap"]; | ||
var _excluded = ["id", "name", "className", "indeterminate", "checked", "value", "onChange", "disabled", "testId", "label", "invalid", "noLabel", "spacing", "unwrap", "marginRight"]; | ||
@@ -47,3 +47,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
indeterminate = _ref.indeterminate, | ||
disabled = _ref.disabled; | ||
disabled = _ref.disabled, | ||
marginRight = _ref.marginRight; | ||
var svgs = (0, _styleConst.isDarkMode)() ? darkSvgs : lightSvgs; | ||
@@ -66,3 +67,3 @@ return _objectSpread(_objectSpread(_objectSpread({ | ||
})), {}, { | ||
marginRight: 3, | ||
marginRight: marginRight, | ||
marginLeft: 0, | ||
@@ -93,2 +94,4 @@ backgroundPosition: '-1px 0', | ||
unwrap = _ref2.unwrap, | ||
_ref2$marginRight = _ref2.marginRight, | ||
marginRight = _ref2$marginRight === void 0 ? 3 : _ref2$marginRight, | ||
labelProps = _objectWithoutProperties(_ref2, _excluded); | ||
@@ -107,7 +110,8 @@ | ||
"data-testid": testId, | ||
value: value | ||
value: value, | ||
marginRight: marginRight | ||
}); | ||
checkbox = unwrap ? checkbox : /*#__PURE__*/_react.default.createElement("div", null, checkbox); | ||
return noLabel ? checkbox : | ||
return noLabel || !label ? checkbox : | ||
/*#__PURE__*/ | ||
@@ -114,0 +118,0 @@ // @ts-ignore |
{ | ||
"name": "@cloudflare/component-checkbox", | ||
"description": "Cloudflare Checkbox Component", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "module": "es/index.js", |
Sorry, the diff of this file is too big to display
170814
0.26%388
2.11%