@shopgate/pwa-ui-shared 7.6.0 → 7.6.1-beta.3
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.
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import BasicDialog from"../BasicDialog";/**
|
|
2
|
+
* Renders a simple dialog with a title and html content as a message.
|
|
3
|
+
* This is the default dialog if no type has been specified.
|
|
4
|
+
* @param {Object} props The component properties.
|
|
5
|
+
* @returns {JSX} The rendered component.
|
|
6
|
+
*/var HtmlContentDialog=function HtmlContentDialog(_ref){var actions=_ref.actions,message=_ref.message,title=_ref.title;return React.createElement(BasicDialog,{title:title,actions:actions},React.createElement("div",{dangerouslySetInnerHTML:{__html:message}}));};HtmlContentDialog.defaultProps={title:BasicDialog.defaultProps.title};export default HtmlContentDialog;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import React from'react';import{shallow}from'enzyme';import HtmlContentDialog from"./index";var message='<p><i>This is a html message.</i></p>';var title='This is the title.';describe('<HtmlContentDialog />',function(){it('should render with minimal props',function(){var wrapper=shallow(React.createElement(HtmlContentDialog,{message:message,actions:[]}));expect(wrapper).toMatchSnapshot();expect(wrapper.html()).toMatch(message);});it('should render with title and html message',function(){var wrapper=shallow(React.createElement(HtmlContentDialog,{title:title,message:message,actions:[]}));expect(wrapper).toMatchSnapshot();expect(wrapper.html()).toMatch(title);});it('should render with title, html message and messageParams',function(){var wrapper=shallow(React.createElement(HtmlContentDialog,{title:title,message:"Message with {name}",params:{name:'Placeholder'},actions:[]}));expect(wrapper).toMatchSnapshot();});it('should render the actions',function(){var actions=[{label:'fooAction',action:function action(){}}];var wrapper=shallow(React.createElement(HtmlContentDialog,{title:title,message:message,actions:actions}));expect(wrapper).toMatchSnapshot();expect(wrapper.html()).toMatch(actions[0].label);});it('should pass title through',function(){var customTitle=React.createElement("div",null,"Title");var wrapper=shallow(React.createElement(HtmlContentDialog,{title:customTitle,message:message,params:{},actions:[]}));expect(wrapper.find('BasicDialog').prop('title')).toEqual(customTitle);});});
|
package/Dialog/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var DIALOG_TEXT_MESSAGE='DIALOG_TEXT_MESSAGE';export var MODAL_VARIANT_SELECT='MODAL_VARIANT_SELECT';export var MODAL_ACTION_TYPE_NORMAL='normal';export var MODAL_ACTION_TYPE_PRIMARY='primary';export var MODAL_ACTION_TYPE_DANGER='danger';
|
|
1
|
+
export var DIALOG_TEXT_MESSAGE='DIALOG_TEXT_MESSAGE';export var DIALOG_HTML_CONTENT='DIALOG_HTML_CONTENT';export var MODAL_VARIANT_SELECT='MODAL_VARIANT_SELECT';export var MODAL_ACTION_TYPE_NORMAL='normal';export var MODAL_ACTION_TYPE_PRIMARY='primary';export var MODAL_ACTION_TYPE_DANGER='danger';
|
package/Dialog/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dialogTypes;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 from'react';import PropTypes from'prop-types';import Modal from'@shopgate/pwa-common/components/Modal';import Backdrop from'@shopgate/pwa-common/components/Backdrop';import{MODAL_PIPELINE_ERROR}from'@shopgate/pwa-common/constants/ModalTypes';import I18n from'@shopgate/pwa-common/components/I18n';import{DIALOG_TEXT_MESSAGE,MODAL_VARIANT_SELECT,MODAL_ACTION_TYPE_PRIMARY,MODAL_ACTION_TYPE_NORMAL}from"./constants";import PipelineErrorDialog from"./components/PipelineErrorDialog";import TextMessageDialog from"./components/TextMessageDialog";import BasicDialog from"./components/BasicDialog";import VariantSelectModal from"./components/VariantSelectModal";var dialogTypes=(_dialogTypes={},_defineProperty(_dialogTypes,DIALOG_TEXT_MESSAGE,TextMessageDialog),_defineProperty(_dialogTypes,MODAL_PIPELINE_ERROR,PipelineErrorDialog),_defineProperty(_dialogTypes,MODAL_VARIANT_SELECT,VariantSelectModal),_dialogTypes);/**
|
|
1
|
+
var _dialogTypes;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 from'react';import PropTypes from'prop-types';import Modal from'@shopgate/pwa-common/components/Modal';import Backdrop from'@shopgate/pwa-common/components/Backdrop';import{MODAL_PIPELINE_ERROR}from'@shopgate/pwa-common/constants/ModalTypes';import I18n from'@shopgate/pwa-common/components/I18n';import{DIALOG_TEXT_MESSAGE,MODAL_VARIANT_SELECT,MODAL_ACTION_TYPE_PRIMARY,MODAL_ACTION_TYPE_NORMAL,DIALOG_HTML_CONTENT}from"./constants";import PipelineErrorDialog from"./components/PipelineErrorDialog";import TextMessageDialog from"./components/TextMessageDialog";import HtmlContentDialog from"./components/HtmlContentDialog";import BasicDialog from"./components/BasicDialog";import VariantSelectModal from"./components/VariantSelectModal";var dialogTypes=(_dialogTypes={},_defineProperty(_dialogTypes,DIALOG_TEXT_MESSAGE,TextMessageDialog),_defineProperty(_dialogTypes,DIALOG_HTML_CONTENT,HtmlContentDialog),_defineProperty(_dialogTypes,MODAL_PIPELINE_ERROR,PipelineErrorDialog),_defineProperty(_dialogTypes,MODAL_VARIANT_SELECT,VariantSelectModal),_dialogTypes);/**
|
|
2
2
|
* The main component for rendering dialogs.
|
|
3
3
|
* This component takes care of choosing the correct component body for the given type
|
|
4
4
|
* and render it on a modal overlay.
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-ui-shared",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.1-beta.3",
|
|
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.6.
|
|
9
|
-
"@shopgate/pwa-ui-material": "7.6.
|
|
8
|
+
"@shopgate/pwa-ui-ios": "7.6.1-beta.3",
|
|
9
|
+
"@shopgate/pwa-ui-material": "7.6.1-beta.3",
|
|
10
10
|
"react-day-picker": "^7.4.8"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@shopgate/pwa-common": "7.6.
|
|
14
|
-
"@shopgate/pwa-common-commerce": "7.6.
|
|
13
|
+
"@shopgate/pwa-common": "7.6.1-beta.3",
|
|
14
|
+
"@shopgate/pwa-common-commerce": "7.6.1-beta.3",
|
|
15
15
|
"classnames": "^2.2.5",
|
|
16
16
|
"react": "~16.12.0"
|
|
17
17
|
},
|