@bone-ui/checkbox
Advanced tools
Comparing version 0.8.0 to 0.9.0
@@ -13,3 +13,3 @@ 'use strict'; | ||
var hooks = require('@bone-ui/hooks'); | ||
var CheckOutline = require('@bone-ui/icons/lib/CheckOutline'); | ||
var icons = require('@bone-ui/icons'); | ||
@@ -154,3 +154,3 @@ function _extends() { | ||
borderGray400: !checked | ||
}, atomicProps), React__default.createElement(CheckOutline.CheckOutline, { | ||
}, atomicProps), React__default.createElement(icons.CheckOutline, { | ||
white: true, | ||
@@ -157,0 +157,0 @@ "square-20": true, |
@@ -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,t=require("@bone-ui/utils"),o=require("@fower/core"),l=require("@fower/react"),a=require("@bone-ui/hooks"),u=require("@bone-ui/icons/lib/CheckOutline");function c(){return(c=Object.assign||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,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: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"],x=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=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,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; | ||
//# sourceMappingURL=checkbox.cjs.production.min.js.map |
@@ -6,3 +6,3 @@ import React, { createContext, useContext, useState, useCallback, useMemo } from 'react'; | ||
import { useControlledInfo, useSafeLayoutEffect } from '@bone-ui/hooks'; | ||
import { CheckOutline } from '@bone-ui/icons/lib/CheckOutline'; | ||
import { CheckOutline } from '@bone-ui/icons'; | ||
@@ -9,0 +9,0 @@ function _extends() { |
{ | ||
"name": "@bone-ui/checkbox", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"license": "MIT", | ||
@@ -23,6 +23,6 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@bone-ui/icons": "^0.8.0", | ||
"@bone-ui/utils": "^0.8.0" | ||
"@bone-ui/icons": "^0.9.0", | ||
"@bone-ui/utils": "^0.9.0" | ||
}, | ||
"gitHead": "4cd129e6d060c68ba5c082289490a4f67669c92f" | ||
"gitHead": "39637b7194afc0f5277b29e5a6617732aca2f91d" | ||
} |
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
18
74089
+ Added@bone-ui/iconify@0.9.0(transitive)
+ Added@bone-ui/icons@0.9.0(transitive)
+ Added@bone-ui/utils@0.9.0(transitive)
- Removed@bone-ui/iconify@0.8.0(transitive)
- Removed@bone-ui/icons@0.8.0(transitive)
- Removed@bone-ui/utils@0.8.0(transitive)
Updated@bone-ui/icons@^0.9.0
Updated@bone-ui/utils@^0.9.0