@sk-web-gui/button
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -5,27 +5,18 @@ "use strict"; | ||
exports.ButtonGroup = void 0; | ||
var _utils = require("@sk-web-gui/utils"); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _excluded = ["size", "color", "variant", "attached", "disabled", "children", "className"]; | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
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); } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
var ButtonGroup = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
var size = props.size, | ||
color = props.color, | ||
variant = props.variant, | ||
attached = props.attached, | ||
disabled = props.disabled, | ||
children = props.children, | ||
className = props.className, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
color = props.color, | ||
variant = props.variant, | ||
attached = props.attached, | ||
disabled = props.disabled, | ||
children = props.children, | ||
className = props.className, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
var validChildren = (0, _utils.getValidChildren)(children); | ||
@@ -47,3 +38,2 @@ var clones = validChildren.map(function (child) { | ||
exports.ButtonGroup = ButtonGroup; | ||
if (_utils.__DEV__) { | ||
@@ -50,0 +40,0 @@ ButtonGroup.displayName = 'ButtonGroup'; |
@@ -5,40 +5,29 @@ "use strict"; | ||
exports.Button = void 0; | ||
var _spinner = require("@sk-web-gui/spinner"); | ||
var _utils = require("@sk-web-gui/utils"); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _styles = require("./styles"); | ||
var _excluded = ["disabled", "loading", "active", "loadingText", "type", "leftIcon", "rightIcon", "children", "className", "color", "variant", "size", "rounded"]; | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
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); } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
var Button = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
var _disabled = props.disabled, | ||
loading = props.loading, | ||
active = props.active, | ||
loadingText = props.loadingText, | ||
type = props.type, | ||
leftIcon = props.leftIcon, | ||
rightIcon = props.rightIcon, | ||
children = props.children, | ||
className = props.className, | ||
color = props.color, | ||
_props$variant = props.variant, | ||
variant = _props$variant === void 0 ? 'outline' : _props$variant, | ||
_props$size = props.size, | ||
size = _props$size === void 0 ? 'md' : _props$size, | ||
_props$rounded = props.rounded, | ||
rounded = _props$rounded === void 0 ? false : _props$rounded, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
loading = props.loading, | ||
active = props.active, | ||
loadingText = props.loadingText, | ||
type = props.type, | ||
leftIcon = props.leftIcon, | ||
rightIcon = props.rightIcon, | ||
children = props.children, | ||
className = props.className, | ||
color = props.color, | ||
_props$variant = props.variant, | ||
variant = _props$variant === void 0 ? 'outline' : _props$variant, | ||
_props$size = props.size, | ||
size = _props$size === void 0 ? 'md' : _props$size, | ||
_props$rounded = props.rounded, | ||
rounded = _props$rounded === void 0 ? false : _props$rounded, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
var disabled = _disabled || loading; | ||
@@ -67,3 +56,2 @@ var classes = (0, _styles.useButtonClass)({ | ||
exports.Button = Button; | ||
if (_utils.__DEV__) { | ||
@@ -70,0 +58,0 @@ Button.displayName = 'Button'; |
@@ -5,35 +5,23 @@ "use strict"; | ||
exports.IconButton = void 0; | ||
var _utils = require("@sk-web-gui/utils"); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _button = require("./button"); | ||
var _excluded = ["icon", "children", "aria-label", "className"]; | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
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); } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
var IconButton = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
var icon = props.icon, | ||
children = props.children, | ||
ariaLabel = props['aria-label'], | ||
className = props.className, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
children = props.children, | ||
ariaLabel = props['aria-label'], | ||
className = props.className, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
var classes = (0, _utils.cx)('btn-icon', className); | ||
var classes = (0, _utils.cx)('btn-icon', className); | ||
/** | ||
* Passing the icon as prop or children should work | ||
*/ | ||
var element = icon || children; | ||
var _children = /*#__PURE__*/React.isValidElement(element) ? /*#__PURE__*/React.cloneElement(element, {}) : null; | ||
return /*#__PURE__*/React.createElement(_button.Button, _extends({ | ||
@@ -46,3 +34,2 @@ className: classes, | ||
exports.IconButton = IconButton; | ||
if (_utils.__DEV__) { | ||
@@ -49,0 +36,0 @@ IconButton.displayName = 'IconButton'; |
@@ -5,11 +5,6 @@ "use strict"; | ||
exports.Button = void 0; | ||
var _button = require("./button"); | ||
var _buttonGroup = require("./button-group"); | ||
exports.ButtonGroup = _buttonGroup.ButtonGroup; | ||
var _iconButton = require("./icon-button"); | ||
exports.IconButton = _iconButton.IconButton; | ||
@@ -16,0 +11,0 @@ var Button = _button.Button; |
@@ -5,7 +5,4 @@ "use strict"; | ||
exports.useButtonClass = void 0; | ||
var _theme = require("@sk-web-gui/theme"); | ||
var _utils = require("@sk-web-gui/utils"); | ||
var useButtonClass = (0, _theme.createMemoClass)(function (props) { | ||
@@ -12,0 +9,0 @@ var variantClasses = { |
var _excluded = ["size", "color", "variant", "attached", "disabled", "children", "className"]; | ||
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); } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
import { cx, getValidChildren, __DEV__ } from '@sk-web-gui/utils'; | ||
@@ -11,12 +8,11 @@ import * as React from 'react'; | ||
var { | ||
size, | ||
color, | ||
variant, | ||
attached, | ||
disabled, | ||
children, | ||
className | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
size, | ||
color, | ||
variant, | ||
attached, | ||
disabled, | ||
children, | ||
className | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
var validChildren = getValidChildren(children); | ||
@@ -37,3 +33,2 @@ var clones = validChildren.map(child => { | ||
}); | ||
if (__DEV__) { | ||
@@ -40,0 +35,0 @@ ButtonGroup.displayName = 'ButtonGroup'; |
var _excluded = ["disabled", "loading", "active", "loadingText", "type", "leftIcon", "rightIcon", "children", "className", "color", "variant", "size", "rounded"]; | ||
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); } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
import { Spinner } from '@sk-web-gui/spinner'; | ||
@@ -13,18 +10,17 @@ import { cx, __DEV__ } from '@sk-web-gui/utils'; | ||
var { | ||
disabled: _disabled, | ||
loading, | ||
active, | ||
loadingText, | ||
type, | ||
leftIcon, | ||
rightIcon, | ||
children, | ||
className, | ||
color, | ||
variant = 'outline', | ||
size = 'md', | ||
rounded = false | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
disabled: _disabled, | ||
loading, | ||
active, | ||
loadingText, | ||
type, | ||
leftIcon, | ||
rightIcon, | ||
children, | ||
className, | ||
color, | ||
variant = 'outline', | ||
size = 'md', | ||
rounded = false | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
var disabled = _disabled || loading; | ||
@@ -52,3 +48,2 @@ var classes = useButtonClass({ | ||
}); | ||
if (__DEV__) { | ||
@@ -55,0 +50,0 @@ Button.displayName = 'Button'; |
var _excluded = ["icon", "children", "aria-label", "className"]; | ||
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); } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
import { cx, __DEV__ } from '@sk-web-gui/utils'; | ||
@@ -12,18 +9,15 @@ import * as React from 'react'; | ||
var { | ||
icon, | ||
children, | ||
'aria-label': ariaLabel, | ||
className | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
icon, | ||
children, | ||
'aria-label': ariaLabel, | ||
className | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, _excluded); | ||
var classes = cx('btn-icon', className); | ||
var classes = cx('btn-icon', className); | ||
/** | ||
* Passing the icon as prop or children should work | ||
*/ | ||
var element = icon || children; | ||
var _children = /*#__PURE__*/React.isValidElement(element) ? /*#__PURE__*/React.cloneElement(element, {}) : null; | ||
return /*#__PURE__*/React.createElement(Button, _extends({ | ||
@@ -35,3 +29,2 @@ className: classes, | ||
}); | ||
if (__DEV__) { | ||
@@ -38,0 +31,0 @@ IconButton.displayName = 'IconButton'; |
{ | ||
"name": "@sk-web-gui/button", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"sideEffects": false, | ||
@@ -40,4 +40,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@sk-web-gui/spinner": "0.1.5", | ||
"@sk-web-gui/theme": "0.1.5", | ||
"@sk-web-gui/spinner": "0.1.6", | ||
"@sk-web-gui/theme": "0.1.6", | ||
"@sk-web-gui/utils": "0.1.4" | ||
@@ -48,3 +48,3 @@ }, | ||
}, | ||
"gitHead": "7f394c9a25f1bd8bcd43d4b259ad025c146b1527" | ||
"gitHead": "a14791d11b9d1fa052b5135525d06707fc3d9e7d" | ||
} |
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
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
46151
+ Added@sk-web-gui/spinner@0.1.6(transitive)
+ Added@sk-web-gui/theme@0.1.6(transitive)
- Removed@sk-web-gui/spinner@0.1.5(transitive)
- Removed@sk-web-gui/theme@0.1.5(transitive)
Updated@sk-web-gui/spinner@0.1.6
Updated@sk-web-gui/theme@0.1.6