@bone-ui/checkbox
Advanced tools
Comparing version 0.25.0 to 0.29.0
@@ -16,6 +16,5 @@ 'use strict'; | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
_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) { | ||
@@ -27,9 +26,6 @@ if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
@@ -40,3 +36,2 @@ if (source == null) return {}; | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
@@ -47,3 +42,2 @@ key = sourceKeys[i]; | ||
} | ||
return target; | ||
@@ -60,4 +54,4 @@ } | ||
var _e$target = e.target, | ||
checked = _e$target.checked, | ||
targeValue = _e$target.value; | ||
checked = _e$target.checked, | ||
targeValue = _e$target.value; | ||
return checked ? [].concat(currentGroupValue, [targeValue]) : currentGroupValue.filter(function (i) { | ||
@@ -70,9 +64,6 @@ return i !== targeValue; | ||
var _props$disabled; | ||
var inputProps = {}; | ||
var _useState = React.useState((_props$disabled = props.disabled) != null ? _props$disabled : false), | ||
disabled = _useState[0], | ||
setDisabled = _useState[1]; | ||
disabled = _useState[0], | ||
setDisabled = _useState[1]; | ||
var context = useCheckboxGroupContext(); | ||
@@ -82,21 +73,16 @@ /** | ||
*/ | ||
if (context != null && context.controlled) { | ||
var _context$value; | ||
props.checked = (_context$value = context.value) == null ? void 0 : _context$value.includes(props.value); | ||
} | ||
var _useState2 = React.useState(function () { | ||
if (!context) return props.defaultChecked; | ||
var groupvalue = context.value; | ||
return groupvalue == null ? void 0 : groupvalue.includes(props.value); | ||
}), | ||
checkedState = _useState2[0], | ||
setCheckedState = _useState2[1]; | ||
if (!context) return props.defaultChecked; | ||
var groupvalue = context.value; | ||
return groupvalue == null ? void 0 : groupvalue.includes(props.value); | ||
}), | ||
checkedState = _useState2[0], | ||
setCheckedState = _useState2[1]; | ||
var _useControlledInfo = hooks.useControlledInfo(props.checked, checkedState), | ||
controlled = _useControlledInfo.controlled, | ||
checked = _useControlledInfo.value; | ||
controlled = _useControlledInfo.controlled, | ||
checked = _useControlledInfo.value; | ||
hooks.useSafeLayoutEffect(function () { | ||
@@ -106,3 +92,2 @@ if (typeof props.disabled !== 'boolean') return; | ||
}, [props.disabled]); | ||
inputProps.onChange = function (e) { | ||
@@ -116,10 +101,7 @@ /** no context */ | ||
/** has context */ | ||
var _context$value2 = context.value, | ||
groupValue = _context$value2 === void 0 ? [] : _context$value2; | ||
groupValue = _context$value2 === void 0 ? [] : _context$value2; | ||
var _e$target = e.target, | ||
targetChecked = _e$target.checked, | ||
targetValue = _e$target.value; | ||
targetChecked = _e$target.checked, | ||
targetValue = _e$target.value; | ||
if (controlled) { | ||
@@ -131,6 +113,4 @@ setCheckedState(targetChecked); | ||
} | ||
props.onChange == null ? void 0 : props.onChange(e); | ||
}; | ||
inputProps.disabled = disabled; | ||
@@ -149,5 +129,4 @@ if (controlled) inputProps.checked = checked; | ||
var checked = _ref.checked, | ||
colorScheme = _ref.colorScheme; | ||
colorScheme = _ref.colorScheme; | ||
var atomicProps = {}; | ||
if (!!checked) { | ||
@@ -157,3 +136,2 @@ atomicProps.borderColor = colorScheme; | ||
} | ||
return React__default.createElement(react.Box, Object.assign({ | ||
@@ -176,12 +154,10 @@ toCenter: true, | ||
var children = props.children, | ||
_props$colorScheme = props.colorScheme, | ||
colorScheme = _props$colorScheme === void 0 ? 'brand500' : _props$colorScheme, | ||
_props$render = props.render, | ||
render = _props$render === void 0 ? checkboxDefaultRender : _props$render, | ||
value = props.value, | ||
defaultChecked = props.defaultChecked, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
_props$colorScheme = props.colorScheme, | ||
colorScheme = _props$colorScheme === void 0 ? 'brand500' : _props$colorScheme, | ||
_props$render = props.render, | ||
render = _props$render === void 0 ? checkboxDefaultRender : _props$render, | ||
value = props.value, | ||
defaultChecked = props.defaultChecked, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
var context = useCheckboxGroupContext(); | ||
var onChange = function onChange(e) { | ||
@@ -191,13 +167,10 @@ context == null ? void 0 : context.onChange(e); | ||
}; | ||
var _useCheckbox = useCheckbox(_extends({}, props, { | ||
onChange: onChange | ||
})), | ||
inputProps = _useCheckbox.inputProps, | ||
state = _useCheckbox.state; | ||
var disabled = state.disabled; // TODO: need refactor | ||
onChange: onChange | ||
})), | ||
inputProps = _useCheckbox.inputProps, | ||
state = _useCheckbox.state; | ||
var disabled = state.disabled; | ||
// TODO: need refactor | ||
var checkedProps = {}; | ||
if (Reflect.has(props, 'defaultChecked')) { | ||
@@ -208,3 +181,2 @@ checkedProps.defaultChecked = defaultChecked; | ||
} | ||
return React__default.createElement(react.Box, Object.assign({ | ||
@@ -236,14 +208,12 @@ as: "label", | ||
var _props$defaultValue = props.defaultValue, | ||
defaultValue = _props$defaultValue === void 0 ? [] : _props$defaultValue, | ||
onChangeProp = props.onChange; // checkGroup inner state | ||
defaultValue = _props$defaultValue === void 0 ? [] : _props$defaultValue, | ||
onChangeProp = props.onChange; | ||
// checkGroup inner state | ||
var _useState = React.useState(defaultValue), | ||
state = _useState[0], | ||
setState = _useState[1]; | ||
state = _useState[0], | ||
setState = _useState[1]; | ||
var _useControlledInfo = hooks.useControlledInfo(props.value, state), | ||
controlled = _useControlledInfo.controlled, | ||
_useControlledInfo$va = _useControlledInfo.value, | ||
groupValue = _useControlledInfo$va === void 0 ? [] : _useControlledInfo$va; | ||
controlled = _useControlledInfo.controlled, | ||
_useControlledInfo$va = _useControlledInfo.value, | ||
groupValue = _useControlledInfo$va === void 0 ? [] : _useControlledInfo$va; | ||
var setValue = React.useCallback(function (nextValue) { | ||
@@ -254,3 +224,2 @@ if (!controlled) setState(nextValue); | ||
/** @example <CheckGroup onChange={...}></CheckGroup> */ | ||
var onChange = React.useCallback(function (e) { | ||
@@ -271,10 +240,8 @@ var nextValue = getNextCheckboxGroupValue(e, groupValue); | ||
var children = props.children, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded$1); | ||
rest = _objectWithoutPropertiesLoose(props, _excluded$1); | ||
var _useCheckboxGroup = useCheckboxGroup(props), | ||
value = _useCheckboxGroup.value, | ||
onChange = _useCheckboxGroup.onChange, | ||
setValue = _useCheckboxGroup.setValue, | ||
controlled = _useCheckboxGroup.controlled; | ||
value = _useCheckboxGroup.value, | ||
onChange = _useCheckboxGroup.onChange, | ||
setValue = _useCheckboxGroup.setValue, | ||
controlled = _useCheckboxGroup.controlled; | ||
var contextValue = React.useMemo(function () { | ||
@@ -281,0 +248,0 @@ return { |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n=require("react"),r=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,o=require("@bone-ui/utils"),t=require("@fower/core"),l=require("@fower/react"),a=require("@bone-ui/hooks"),u=require("@bone-ui/icons");function c(){return(c=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function i(e,n){if(null==e)return{};var r,o,t={},l=Object.keys(e);for(o=0;o<l.length;o++)n.indexOf(r=l[o])>=0||(t[r]=e[r]);return t}var d=n.createContext(null),s=d.Provider;function h(){return n.useContext(d)}function f(e,n){var r=e.target,o=r.value;return r.checked?[].concat(n,[o]):n.filter((function(e){return e!==o}))}function v(e){var r,o,t={},l=n.useState(null!=(r=e.disabled)&&r),u=l[0],c=l[1],i=h();null!=i&&i.controlled&&(e.checked=null==(o=i.value)?void 0:o.includes(e.value));var d=n.useState((function(){if(!i)return e.defaultChecked;var n=i.value;return null==n?void 0:n.includes(e.value)})),s=d[1],v=a.useControlledInfo(e.checked,d[0]),b=v.controlled,C=v.value;return a.useSafeLayoutEffect((function(){"boolean"==typeof e.disabled&&c(!!e.disabled)}),[e.disabled]),t.onChange=function(n){if(!i)return b||s(n.target.checked),void(null==e||null==e.onChange||e.onChange(n));var r=i.value,o=void 0===r?[]:r,t=n.target,l=t.value;if(b)s(t.checked);else{var a=f(n,o);s(a.includes(l))}null==e.onChange||e.onChange(n)},t.disabled=u,b&&(t.checked=C),{inputProps:t,state:{disabled:u,checked:C}}}var b=function(e){var n=e.checked,o=e.colorScheme,t={};return n&&(t.borderColor=o,t.bg=o),r.createElement(l.Box,Object.assign({toCenter:!0,"square-20":!0,"border-2":!0,"rounded-4":!0,borderGray400:!n},t),r.createElement(u.CheckOutline,{white:!0,"square-20":!0,strokeWidth:4,hidden:!n}))},C=["children","colorScheme","render","value","defaultChecked","disabled","onChange"],k=o.forwardRef((function(e,n){var a=e.children,u=e.colorScheme,d=void 0===u?"brand500":u,s=e.render,f=void 0===s?b:s,k=e.value,p=e.defaultChecked,x=i(e,C),g=h(),m=v(c({},e,{onChange:function(n){return null==g||g.onChange(n),null==e||null==e.onChange?void 0:e.onChange(n)}})),y=m.inputProps,O=m.state,j=O.disabled,q={};return Reflect.has(e,"defaultChecked")?q.defaultChecked=p:q.checked=O.checked,r.createElement(l.Box,Object.assign({as:"label",className:"bone-checkbox",inlineFlex:!0,toCenterY:!0,toLeft:!0,cursorPointer:!j,cursorNotAllowed:j,"opacity-50":j},x),r.createElement("input",Object.assign({ref:n,className:o.cx("bone-checkbox-input",t.css("square0","opacity-0","hidden")),type:"checkbox",value:k},q,y)),f(c({},O,{children:a,colorScheme:d})),a&&r.createElement(l.Box,{className:"bone-checkbox-label","ml-8":!0,"leading-1em":!0},a))})),p=["defaultValue","value","onChange","options","name","children"],x=o.forwardRef((function(e,o){var t=e.children,u=i(e,p),c=function(e){var r=e.defaultValue,o=e.onChange,t=n.useState(void 0===r?[]:r),l=t[1],u=a.useControlledInfo(e.value,t[0]),c=u.controlled,i=u.value,d=void 0===i?[]:i,s=n.useCallback((function(e){c||l(e),null==o||o(e)}),[c,o]),h=n.useCallback((function(e){var n=f(e,d);s(n)}),[d,s]);return{controlled:c,value:d,onChange:h,setValue:s}}(e),d=c.value,h=c.onChange,v=c.setValue,b=c.controlled,C=n.useMemo((function(){return{controlled:b,onChange:h,value:d,setValue:v}}),[b,d,h,v]);return r.createElement(s,{value:C},r.createElement(l.Box,Object.assign({ref:o,toLeft:!0,"spaceX-8":!0},u),t))}));exports.Checkbox=k,exports.CheckboxGroup=x,exports.CheckboxGroupProvider=s,exports.checkboxGroupContext=d,exports.useCheckbox=v,exports.useCheckboxGroupContext=h; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n=require("react"),r=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,t=require("@bone-ui/utils"),o=require("@fower/core"),l=require("@fower/react"),a=require("@bone-ui/hooks"),u=require("@bone-ui/icons");function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}function i(e,n){if(null==e)return{};var r,t,o={},l=Object.keys(e);for(t=0;t<l.length;t++)n.indexOf(r=l[t])>=0||(o[r]=e[r]);return o}var d=n.createContext(null),s=d.Provider;function h(){return n.useContext(d)}function f(e,n){var r=e.target,t=r.value;return r.checked?[].concat(n,[t]):n.filter((function(e){return e!==t}))}function v(e){var r,t,o={},l=n.useState(null!=(r=e.disabled)&&r),u=l[0],c=l[1],i=h();null!=i&&i.controlled&&(e.checked=null==(t=i.value)?void 0:t.includes(e.value));var d=n.useState((function(){if(!i)return e.defaultChecked;var n=i.value;return null==n?void 0:n.includes(e.value)})),s=d[1],v=a.useControlledInfo(e.checked,d[0]),b=v.controlled,C=v.value;return a.useSafeLayoutEffect((function(){"boolean"==typeof e.disabled&&c(!!e.disabled)}),[e.disabled]),o.onChange=function(n){if(!i)return b||s(n.target.checked),void(null==e||null==e.onChange||e.onChange(n));var r=i.value,t=void 0===r?[]:r,o=n.target,l=o.value;if(b)s(o.checked);else{var a=f(n,t);s(a.includes(l))}null==e.onChange||e.onChange(n)},o.disabled=u,b&&(o.checked=C),{inputProps:o,state:{disabled:u,checked:C}}}var b=function(e){var n=e.checked,t=e.colorScheme,o={};return n&&(o.borderColor=t,o.bg=t),r.createElement(l.Box,Object.assign({toCenter:!0,"square-20":!0,"border-2":!0,"rounded-4":!0,borderGray400:!n},o),r.createElement(u.CheckOutline,{white:!0,"square-20":!0,strokeWidth:4,hidden:!n}))},C=["children","colorScheme","render","value","defaultChecked","disabled","onChange"],k=t.forwardRef((function(e,n){var a=e.children,u=e.colorScheme,d=void 0===u?"brand500":u,s=e.render,f=void 0===s?b:s,k=e.value,p=e.defaultChecked,g=i(e,C),x=h(),m=v(c({},e,{onChange:function(n){return null==x||x.onChange(n),null==e||null==e.onChange?void 0:e.onChange(n)}})),y=m.inputProps,O=m.state,j=O.disabled,q={};return Reflect.has(e,"defaultChecked")?q.defaultChecked=p:q.checked=O.checked,r.createElement(l.Box,Object.assign({as:"label",className:"bone-checkbox",inlineFlex:!0,toCenterY:!0,toLeft:!0,cursorPointer:!j,cursorNotAllowed:j,"opacity-50":j},g),r.createElement("input",Object.assign({ref:n,className:t.cx("bone-checkbox-input",o.css("square0","opacity-0","hidden")),type:"checkbox",value:k},q,y)),f(c({},O,{children:a,colorScheme:d})),a&&r.createElement(l.Box,{className:"bone-checkbox-label","ml-8":!0,"leading-1em":!0},a))})),p=["defaultValue","value","onChange","options","name","children"],g=t.forwardRef((function(e,t){var o=e.children,u=i(e,p),c=function(e){var r=e.defaultValue,t=e.onChange,o=n.useState(void 0===r?[]:r),l=o[1],u=a.useControlledInfo(e.value,o[0]),c=u.controlled,i=u.value,d=void 0===i?[]:i,s=n.useCallback((function(e){c||l(e),null==t||t(e)}),[c,t]),h=n.useCallback((function(e){var n=f(e,d);s(n)}),[d,s]);return{controlled:c,value:d,onChange:h,setValue:s}}(e),d=c.value,h=c.onChange,v=c.setValue,b=c.controlled,C=n.useMemo((function(){return{controlled:b,onChange:h,value:d,setValue:v}}),[b,d,h,v]);return r.createElement(s,{value:C},r.createElement(l.Box,Object.assign({ref:t,toLeft:!0,"spaceX-8":!0},u),o))}));exports.Checkbox=k,exports.CheckboxGroup=g,exports.CheckboxGroupProvider=s,exports.checkboxGroupContext=d,exports.useCheckbox=v,exports.useCheckboxGroupContext=h; | ||
//# sourceMappingURL=checkbox.cjs.production.min.js.map |
@@ -9,6 +9,5 @@ import React, { createContext, useContext, useState, useCallback, useMemo } from 'react'; | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
_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) { | ||
@@ -20,9 +19,6 @@ if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
@@ -33,3 +29,2 @@ if (source == null) return {}; | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
@@ -40,3 +35,2 @@ key = sourceKeys[i]; | ||
} | ||
return target; | ||
@@ -53,4 +47,4 @@ } | ||
var _e$target = e.target, | ||
checked = _e$target.checked, | ||
targeValue = _e$target.value; | ||
checked = _e$target.checked, | ||
targeValue = _e$target.value; | ||
return checked ? [].concat(currentGroupValue, [targeValue]) : currentGroupValue.filter(function (i) { | ||
@@ -63,9 +57,6 @@ return i !== targeValue; | ||
var _props$disabled; | ||
var inputProps = {}; | ||
var _useState = useState((_props$disabled = props.disabled) != null ? _props$disabled : false), | ||
disabled = _useState[0], | ||
setDisabled = _useState[1]; | ||
disabled = _useState[0], | ||
setDisabled = _useState[1]; | ||
var context = useCheckboxGroupContext(); | ||
@@ -75,21 +66,16 @@ /** | ||
*/ | ||
if (context != null && context.controlled) { | ||
var _context$value; | ||
props.checked = (_context$value = context.value) == null ? void 0 : _context$value.includes(props.value); | ||
} | ||
var _useState2 = useState(function () { | ||
if (!context) return props.defaultChecked; | ||
var groupvalue = context.value; | ||
return groupvalue == null ? void 0 : groupvalue.includes(props.value); | ||
}), | ||
checkedState = _useState2[0], | ||
setCheckedState = _useState2[1]; | ||
if (!context) return props.defaultChecked; | ||
var groupvalue = context.value; | ||
return groupvalue == null ? void 0 : groupvalue.includes(props.value); | ||
}), | ||
checkedState = _useState2[0], | ||
setCheckedState = _useState2[1]; | ||
var _useControlledInfo = useControlledInfo(props.checked, checkedState), | ||
controlled = _useControlledInfo.controlled, | ||
checked = _useControlledInfo.value; | ||
controlled = _useControlledInfo.controlled, | ||
checked = _useControlledInfo.value; | ||
useSafeLayoutEffect(function () { | ||
@@ -99,3 +85,2 @@ if (typeof props.disabled !== 'boolean') return; | ||
}, [props.disabled]); | ||
inputProps.onChange = function (e) { | ||
@@ -109,10 +94,7 @@ /** no context */ | ||
/** has context */ | ||
var _context$value2 = context.value, | ||
groupValue = _context$value2 === void 0 ? [] : _context$value2; | ||
groupValue = _context$value2 === void 0 ? [] : _context$value2; | ||
var _e$target = e.target, | ||
targetChecked = _e$target.checked, | ||
targetValue = _e$target.value; | ||
targetChecked = _e$target.checked, | ||
targetValue = _e$target.value; | ||
if (controlled) { | ||
@@ -124,6 +106,4 @@ setCheckedState(targetChecked); | ||
} | ||
props.onChange == null ? void 0 : props.onChange(e); | ||
}; | ||
inputProps.disabled = disabled; | ||
@@ -142,5 +122,4 @@ if (controlled) inputProps.checked = checked; | ||
var checked = _ref.checked, | ||
colorScheme = _ref.colorScheme; | ||
colorScheme = _ref.colorScheme; | ||
var atomicProps = {}; | ||
if (!!checked) { | ||
@@ -150,3 +129,2 @@ atomicProps.borderColor = colorScheme; | ||
} | ||
return React.createElement(Box, Object.assign({ | ||
@@ -169,12 +147,10 @@ toCenter: true, | ||
var children = props.children, | ||
_props$colorScheme = props.colorScheme, | ||
colorScheme = _props$colorScheme === void 0 ? 'brand500' : _props$colorScheme, | ||
_props$render = props.render, | ||
render = _props$render === void 0 ? checkboxDefaultRender : _props$render, | ||
value = props.value, | ||
defaultChecked = props.defaultChecked, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
_props$colorScheme = props.colorScheme, | ||
colorScheme = _props$colorScheme === void 0 ? 'brand500' : _props$colorScheme, | ||
_props$render = props.render, | ||
render = _props$render === void 0 ? checkboxDefaultRender : _props$render, | ||
value = props.value, | ||
defaultChecked = props.defaultChecked, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
var context = useCheckboxGroupContext(); | ||
var onChange = function onChange(e) { | ||
@@ -184,13 +160,10 @@ context == null ? void 0 : context.onChange(e); | ||
}; | ||
var _useCheckbox = useCheckbox(_extends({}, props, { | ||
onChange: onChange | ||
})), | ||
inputProps = _useCheckbox.inputProps, | ||
state = _useCheckbox.state; | ||
var disabled = state.disabled; // TODO: need refactor | ||
onChange: onChange | ||
})), | ||
inputProps = _useCheckbox.inputProps, | ||
state = _useCheckbox.state; | ||
var disabled = state.disabled; | ||
// TODO: need refactor | ||
var checkedProps = {}; | ||
if (Reflect.has(props, 'defaultChecked')) { | ||
@@ -201,3 +174,2 @@ checkedProps.defaultChecked = defaultChecked; | ||
} | ||
return React.createElement(Box, Object.assign({ | ||
@@ -229,14 +201,12 @@ as: "label", | ||
var _props$defaultValue = props.defaultValue, | ||
defaultValue = _props$defaultValue === void 0 ? [] : _props$defaultValue, | ||
onChangeProp = props.onChange; // checkGroup inner state | ||
defaultValue = _props$defaultValue === void 0 ? [] : _props$defaultValue, | ||
onChangeProp = props.onChange; | ||
// checkGroup inner state | ||
var _useState = useState(defaultValue), | ||
state = _useState[0], | ||
setState = _useState[1]; | ||
state = _useState[0], | ||
setState = _useState[1]; | ||
var _useControlledInfo = useControlledInfo(props.value, state), | ||
controlled = _useControlledInfo.controlled, | ||
_useControlledInfo$va = _useControlledInfo.value, | ||
groupValue = _useControlledInfo$va === void 0 ? [] : _useControlledInfo$va; | ||
controlled = _useControlledInfo.controlled, | ||
_useControlledInfo$va = _useControlledInfo.value, | ||
groupValue = _useControlledInfo$va === void 0 ? [] : _useControlledInfo$va; | ||
var setValue = useCallback(function (nextValue) { | ||
@@ -247,3 +217,2 @@ if (!controlled) setState(nextValue); | ||
/** @example <CheckGroup onChange={...}></CheckGroup> */ | ||
var onChange = useCallback(function (e) { | ||
@@ -264,10 +233,8 @@ var nextValue = getNextCheckboxGroupValue(e, groupValue); | ||
var children = props.children, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded$1); | ||
rest = _objectWithoutPropertiesLoose(props, _excluded$1); | ||
var _useCheckboxGroup = useCheckboxGroup(props), | ||
value = _useCheckboxGroup.value, | ||
onChange = _useCheckboxGroup.onChange, | ||
setValue = _useCheckboxGroup.setValue, | ||
controlled = _useCheckboxGroup.controlled; | ||
value = _useCheckboxGroup.value, | ||
onChange = _useCheckboxGroup.onChange, | ||
setValue = _useCheckboxGroup.setValue, | ||
controlled = _useCheckboxGroup.controlled; | ||
var contextValue = useMemo(function () { | ||
@@ -274,0 +241,0 @@ return { |
import { FowerColor, FowerHTMLProps } from '@fower/core'; | ||
import { ReactNode } from 'react'; | ||
export declare type InputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>; | ||
declare type InputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>; | ||
declare type StringOrNumber = string | number; | ||
@@ -5,0 +5,0 @@ export declare type CheckboxGroupValue = StringOrNumber[]; |
import { ChangeEvent } from 'react'; | ||
import { CheckboxGroupValue } from './types'; | ||
export declare function getNextCheckboxGroupValue(e: ChangeEvent<HTMLInputElement>, currentGroupValue: CheckboxGroupValue): (string | number)[]; | ||
export declare function getNextCheckboxGroupValue(e: ChangeEvent<HTMLInputElement>, currentGroupValue: CheckboxGroupValue): any[]; |
{ | ||
"name": "@bone-ui/checkbox", | ||
"version": "0.25.0", | ||
"version": "0.29.0", | ||
"license": "MIT", | ||
@@ -23,6 +23,5 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@bone-ui/icons": "^0.25.0", | ||
"@bone-ui/utils": "^0.25.0" | ||
}, | ||
"gitHead": "39b7d355e13975accaae6ac2ecc011a68e3078ff" | ||
"@bone-ui/icons": "^0.29.0", | ||
"@bone-ui/utils": "^0.29.0" | ||
} | ||
} |
import { FowerColor, FowerHTMLProps } from '@fower/core' | ||
import { ReactNode } from 'react' | ||
export type InputProps = React.DetailedHTMLProps< | ||
type InputProps = React.DetailedHTMLProps< | ||
React.InputHTMLAttributes<HTMLInputElement>, | ||
@@ -6,0 +6,0 @@ HTMLInputElement |
@@ -8,3 +8,3 @@ import { ChangeEvent } from 'react' | ||
) { | ||
const { checked, value: targeValue } = e.target | ||
const { checked, value: targeValue } = e.target as any | ||
@@ -11,0 +11,0 @@ return checked |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74930
841
27
+ Added@bone-ui/iconify@0.29.0(transitive)
+ Added@bone-ui/icons@0.29.0(transitive)
+ Added@bone-ui/utils@0.29.0(transitive)
- Removed@bone-ui/iconify@0.25.0(transitive)
- Removed@bone-ui/icons@0.25.0(transitive)
- Removed@bone-ui/utils@0.25.0(transitive)
Updated@bone-ui/icons@^0.29.0
Updated@bone-ui/utils@^0.29.0