@shopgate/pwa-ui-shared 7.12.7-beta.1 → 7.12.7-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Checkbox/index.js +6 -5
- package/Checkbox/style.js +1 -1
- package/Form/Checkbox/index.js +16 -2
- package/package.json +5 -5
package/Checkbox/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
function _extends(){_extends=Object.assign||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 _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}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 React from'react';import PropTypes from'prop-types';import classNames from'classnames';import BaseCheckbox from'@shopgate/pwa-common/components/Checkbox';import CheckedIcon from"../icons/CheckedIcon";import UncheckedIcon from"../icons/UncheckedIcon";import styles from"./style";/**
|
|
2
2
|
* The checkbox template component.
|
|
3
|
-
* @param {
|
|
4
|
-
* @param {string}
|
|
5
|
-
* @param {
|
|
6
|
-
* @
|
|
7
|
-
|
|
3
|
+
* @param {Object} props The component props
|
|
4
|
+
* @param {string} props.className Class for the underlying Checkbox component
|
|
5
|
+
* @param {string} props.checkedClassName Class for checked icon.
|
|
6
|
+
* @param {string} props.unCheckedClassName Class for unchecked icon.
|
|
7
|
+
* @returns {JSX.Element}
|
|
8
|
+
*/var Checkbox=function Checkbox(_ref){var checkedClassName=_ref.checkedClassName,unCheckedClassName=_ref.unCheckedClassName,className=_ref.className,props=_objectWithoutProperties(_ref,["checkedClassName","unCheckedClassName","className"]);return React.createElement(BaseCheckbox,_extends({},props,{className:"ui-shared__checkbox ".concat(className),checkedIcon:React.createElement(CheckedIcon,{className:classNames(styles.icon,checkedClassName,'checkedIcon')}),uncheckedIcon:React.createElement(UncheckedIcon,{className:classNames(styles.icon,unCheckedClassName,'uncheckedIcon')})}));};Checkbox.defaultProps={checkedClassName:styles.checkedIcon,className:'',unCheckedClassName:styles.uncheckedIcon};export default Checkbox;
|
package/Checkbox/style.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var icon=css({width:24,height:24}).toString();var checkedIcon=css({color:"var(--color-secondary, ".concat(themeConfig.colors.accent,")")}).toString();var uncheckedIcon=css({color:themeConfig.colors.shade6}).toString();export default{icon:icon,checkedIcon:checkedIcon,uncheckedIcon:uncheckedIcon};
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var icon=css({width:24,height:24,flexShrink:0}).toString();var checkedIcon=css({color:"var(--color-secondary, ".concat(themeConfig.colors.accent,")")}).toString();var uncheckedIcon=css({color:themeConfig.colors.shade6}).toString();export default{icon:icon,checkedIcon:checkedIcon,uncheckedIcon:uncheckedIcon};
|
package/Form/Checkbox/index.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _extends(){_extends=Object.assign||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 _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}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;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import classNames from'classnames';import I18n from'@shopgate/pwa-common/components/I18n';import UICheckbox from'@shopgate/pwa-ui-shared/Checkbox';import FormElement from'@shopgate/pwa-ui-shared/FormElement';import style from"./style";/**
|
|
2
|
+
* @typedef {Object} Props
|
|
3
|
+
* @property {string} label Label for the checkbox
|
|
4
|
+
* @property {string} name Name for the form element that's used as "htmlFor" attribute to create
|
|
5
|
+
* a connection between label and checkbox elements.
|
|
6
|
+
* @property {string} [checkboxClassName] Class name for the underlying Checkbox component
|
|
7
|
+
* @property {string} [className] Class name for the underlying FormElement component
|
|
8
|
+
* @property {boolean} [defaultChecked] Whether the checkbox is checked by default
|
|
9
|
+
* @property {boolean} [disabled] Whether the checkbox is disabled (default `false`)
|
|
10
|
+
* @property {string} [errorText] An error text for the form element
|
|
11
|
+
* @property {boolean} [showErrorText] Whether to show the error text when present (default `true`)
|
|
12
|
+
* @property {boolean} [translateErrorText] Whether `errorText` is a translation key
|
|
13
|
+
* @property {Function} [onChange] Change handler for the checkbox
|
|
14
|
+
*/ /**
|
|
2
15
|
* A component that provides a styled checkbox field.
|
|
3
|
-
* @
|
|
16
|
+
* @extends {React.Component<Props>}
|
|
17
|
+
* @returns {JSX.Element}
|
|
4
18
|
*/var Checkbox=/*#__PURE__*/function(_PureComponent){_inherits(Checkbox,_PureComponent);function Checkbox(){_classCallCheck(this,Checkbox);return _possibleConstructorReturn(this,_getPrototypeOf(Checkbox).apply(this,arguments));}_createClass(Checkbox,[{key:"render",/**
|
|
5
19
|
* @return {JSX}
|
|
6
|
-
*/value:function render(){var _this$props=this.props,name=_this$props.name,label=_this$props.label,onChange=_this$props.onChange,className=_this$props.className,errorText=_this$props.errorText,translateErrorText=_this$props.translateErrorText,showErrorText=_this$props.showErrorText,restProps=_objectWithoutProperties(_this$props,["name","label","onChange","className","errorText","translateErrorText","showErrorText"]);return React.createElement(FormElement,{className:classNames(className,style.root,'checkbox'),htmlFor:name,errorText:errorText,translateErrorText:translateErrorText,hasUnderline:false,hasPlaceholder:false,disabled:restProps.disabled,showErrorText:showErrorText},React.createElement(UICheckbox,_extends({},restProps,{name:name,onCheck:onChange,checkedClassName:"".concat(className," ").concat(style.checked),unCheckedClassName:className,labelPosition:"right",label:React.createElement("div",{className:classNames(style.labelWrapper,'label')},React.createElement(I18n.Text,{className:style.label,string:label}))})));}}]);return Checkbox;}(PureComponent);_defineProperty(Checkbox,"defaultProps",{className:'',defaultChecked:undefined,errorText:'',label:'',onChange:function onChange(){},translateErrorText:true,disabled:false,showErrorText:true});export default Checkbox;
|
|
20
|
+
*/value:function render(){var _this$props=this.props,name=_this$props.name,label=_this$props.label,onChange=_this$props.onChange,className=_this$props.className,errorText=_this$props.errorText,translateErrorText=_this$props.translateErrorText,showErrorText=_this$props.showErrorText,checkboxClassName=_this$props.checkboxClassName,restProps=_objectWithoutProperties(_this$props,["name","label","onChange","className","errorText","translateErrorText","showErrorText","checkboxClassName"]);return React.createElement(FormElement,{className:classNames(className,style.root,'checkbox','ui-shared__form__checkbox'),htmlFor:name,errorText:errorText,translateErrorText:translateErrorText,hasUnderline:false,hasPlaceholder:false,disabled:restProps.disabled,showErrorText:showErrorText},React.createElement(UICheckbox,_extends({},restProps,{className:checkboxClassName,name:name,onCheck:onChange,checkedClassName:"".concat(className," ").concat(style.checked),unCheckedClassName:className,labelPosition:"right",label:typeof label==='string'?React.createElement("div",{className:classNames(style.labelWrapper,'label')},React.createElement(I18n.Text,{className:style.label,string:label})):label})));}}]);return Checkbox;}(PureComponent);_defineProperty(Checkbox,"defaultProps",{className:'',checkboxClassName:undefined,defaultChecked:undefined,errorText:'',label:'',onChange:function onChange(){},translateErrorText:true,disabled:false,showErrorText:true});export default Checkbox;
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-ui-shared",
|
|
3
|
-
"version": "7.12.7-beta.
|
|
3
|
+
"version": "7.12.7-beta.2",
|
|
4
4
|
"description": "Shopgate's shared UI components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@shopgate/pwa-ui-ios": "7.12.7-beta.
|
|
9
|
-
"@shopgate/pwa-ui-material": "7.12.7-beta.
|
|
8
|
+
"@shopgate/pwa-ui-ios": "7.12.7-beta.2",
|
|
9
|
+
"@shopgate/pwa-ui-material": "7.12.7-beta.2",
|
|
10
10
|
"react-day-picker": "^7.4.8"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@shopgate/pwa-common": "7.12.7-beta.
|
|
14
|
-
"@shopgate/pwa-common-commerce": "7.12.7-beta.
|
|
13
|
+
"@shopgate/pwa-common": "7.12.7-beta.2",
|
|
14
|
+
"@shopgate/pwa-common-commerce": "7.12.7-beta.2",
|
|
15
15
|
"classnames": "^2.2.5",
|
|
16
16
|
"react": "~16.12.0"
|
|
17
17
|
},
|