@bone-ui/checkbox
Advanced tools
Comparing version 0.34.1 to 0.35.0
@@ -13,3 +13,3 @@ 'use strict'; | ||
var hooks = require('@bone-ui/hooks'); | ||
var icons = require('@bone-ui/icons'); | ||
var iconify = require('@bone-ui/iconify'); | ||
@@ -118,2 +118,8 @@ function _extends() { | ||
var CheckOutline = /*#__PURE__*/iconify.iconify({ | ||
displayName: 'CheckOutline', | ||
fill: 'none', | ||
d: 'M4.5 12.75L10.5 18.75L19.5 5.25' | ||
}); | ||
var checkboxDefaultRender = function checkboxDefaultRender(_ref) { | ||
@@ -133,3 +139,3 @@ var checked = _ref.checked, | ||
borderGray400: !checked | ||
}, atomicProps), React__default.createElement(icons.CheckOutline, { | ||
}, atomicProps), React__default.createElement(CheckOutline, { | ||
white: true, | ||
@@ -136,0 +142,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");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; | ||
"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/iconify");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 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=u.iconify({displayName:"CheckOutline",fill:"none",d:"M4.5 12.75L10.5 18.75L19.5 5.25"}),C=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(b,{white:!0,"square-20":!0,strokeWidth:4,hidden:!n}))},k=["children","colorScheme","render","value","defaultChecked","disabled","onChange"],p=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?C:s,b=e.value,p=e.defaultChecked,g=i(e,k),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:o.cx("bone-checkbox-input",t.css("square0","opacity-0","hidden")),type:"checkbox",value:b},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))})),g=["defaultValue","value","onChange","options","name","children"],x=o.forwardRef((function(e,o){var t=e.children,u=i(e,g),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=p,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'; | ||
import { iconify } from '@bone-ui/iconify'; | ||
@@ -111,2 +111,8 @@ function _extends() { | ||
var CheckOutline = /*#__PURE__*/iconify({ | ||
displayName: 'CheckOutline', | ||
fill: 'none', | ||
d: 'M4.5 12.75L10.5 18.75L19.5 5.25' | ||
}); | ||
var checkboxDefaultRender = function checkboxDefaultRender(_ref) { | ||
@@ -113,0 +119,0 @@ var checked = _ref.checked, |
{ | ||
"name": "@bone-ui/checkbox", | ||
"version": "0.34.1", | ||
"version": "0.35.0", | ||
"license": "MIT", | ||
@@ -23,5 +23,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@bone-ui/icons": "^0.34.1", | ||
"@bone-ui/utils": "^0.34.1" | ||
"@bone-ui/utils": "^0.35.0" | ||
} | ||
} |
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
76670
1
29
861
+ Added@bone-ui/utils@0.35.0(transitive)
- Removed@bone-ui/icons@^0.34.1
- Removed@bone-ui/iconify@0.34.1(transitive)
- Removed@bone-ui/icons@0.34.1(transitive)
- Removed@bone-ui/utils@0.34.1(transitive)
Updated@bone-ui/utils@^0.35.0