@shopgate/pwa-ui-shared 7.25.0-beta.5 → 7.25.0-beta.6
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/Dialog/index.js +4 -5
- package/DiscountBadge/index.js +1 -1
- package/package.json +5 -5
package/Dialog/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
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
|
|
1
|
+
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,{useEffect}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=_defineProperty(_defineProperty(_defineProperty(_defineProperty({},DIALOG_TEXT_MESSAGE,TextMessageDialog),DIALOG_HTML_CONTENT,HtmlContentDialog),MODAL_PIPELINE_ERROR,PipelineErrorDialog),MODAL_VARIANT_SELECT,VariantSelectModal);var supportsInert='inert'in HTMLElement.prototype;/**
|
|
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.
|
|
@@ -6,12 +6,11 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
|
|
|
6
6
|
* @param {Object} props.modal Object with modal data.
|
|
7
7
|
* @param {Function} props.onConfirm The function to call when the confirm button is clicked.
|
|
8
8
|
* @param {Function} props.onDismiss The function to call when the dismiss button is clicked.
|
|
9
|
-
* @param {boolean} props.disableA11YFocusHandling Whether the internal A11Y focus handling
|
|
10
|
-
* should be disabled since it's already handled outside the dialog.
|
|
11
9
|
* @param {NodeList} props.children The children to render inside the modal.
|
|
12
10
|
* @returns {JSX.Element}
|
|
13
|
-
*/var Dialog=function Dialog(_ref){var modal=_ref.modal,onConfirm=_ref.onConfirm,onDismiss=_ref.onDismiss,children=_ref.children
|
|
11
|
+
*/var Dialog=function Dialog(_ref){var modal=_ref.modal,onConfirm=_ref.onConfirm,onDismiss=_ref.onDismiss,children=_ref.children;// Assemble the actions.
|
|
14
12
|
var actions=[];var confirm=modal.confirm,dismiss=modal.dismiss,title=modal.title,titleParams=modal.titleParams,message=modal.message,params=modal.params,type=modal.type,confirmDisabled=modal.confirmDisabled,dismissDisabled=modal.dismissDisabled;// Push dismiss action first so the button is rendered first
|
|
15
13
|
if(dismiss){// We have a dismiss label, add a dismiss action.
|
|
16
14
|
actions.push({label:modal.dismiss,action:onDismiss,type:MODAL_ACTION_TYPE_PRIMARY,disabled:dismissDisabled});}if(confirm){// We have a confirm label, add a confirm action.
|
|
17
|
-
actions.push({label:modal.confirm,action:onConfirm,type:MODAL_ACTION_TYPE_NORMAL,disabled:confirmDisabled});}var dialogType=type;if(!dialogType&&message){dialogType=DIALOG_TEXT_MESSAGE;}var dialogTitle=title;if(titleParams){dialogTitle=React.createElement(I18n.Text,{string:title,params:titleParams});}var dialogProps={actions:actions,title:dialogTitle,params:params,message:message||undefined,children:children};var DialogComponent=dialogTypes[dialogType]||BasicDialog
|
|
15
|
+
actions.push({label:modal.confirm,action:onConfirm,type:MODAL_ACTION_TYPE_NORMAL,disabled:confirmDisabled});}var dialogType=type;if(!dialogType&&message){dialogType=DIALOG_TEXT_MESSAGE;}var dialogTitle=title;if(titleParams){dialogTitle=React.createElement(I18n.Text,{string:title,params:titleParams});}var dialogProps={actions:actions,title:dialogTitle,params:params,message:message||undefined,children:children};var DialogComponent=dialogTypes[dialogType]||BasicDialog;// Effect to toggle aria-hidden on all other modals when the dialog is open.
|
|
16
|
+
useEffect(function(){var otherModals=document.querySelectorAll('.common__modal:not(.ui-shared__dialog-modal), .engage__sheet-drawer');otherModals.forEach(function(entry){if(supportsInert){entry.setAttribute('inert','');}else{entry.setAttribute('aria-hidden','true');}});return function(){otherModals.forEach(function(entry){entry.removeAttribute('inert');entry.removeAttribute('aria-hidden');});};},[]);return React.createElement(Modal,{classes:{container:'ui-shared__dialog-modal'}},React.createElement(Backdrop,{isVisible:true,level:0,opacity:30}),React.createElement(DialogComponent,dialogProps));};Dialog.defaultProps={onConfirm:function onConfirm(){},onDismiss:function onDismiss(){},children:null};export default Dialog;
|
package/DiscountBadge/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from'react';import PropTypes from'prop-types';import{I18n}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import styles from"./style";/**
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import{I18n}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core/helpers';import styles from"./style";/**
|
|
2
2
|
* The discount badge component.
|
|
3
3
|
* @param {Object} props The component props
|
|
4
4
|
* @param {string} [props.className] Additional CSS style definitions
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-ui-shared",
|
|
3
|
-
"version": "7.25.0-beta.
|
|
3
|
+
"version": "7.25.0-beta.6",
|
|
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.25.0-beta.
|
|
9
|
-
"@shopgate/pwa-ui-material": "7.25.0-beta.
|
|
8
|
+
"@shopgate/pwa-ui-ios": "7.25.0-beta.6",
|
|
9
|
+
"@shopgate/pwa-ui-material": "7.25.0-beta.6",
|
|
10
10
|
"react-day-picker": "^7.4.8"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@shopgate/pwa-common": "7.25.0-beta.
|
|
14
|
-
"@shopgate/pwa-common-commerce": "7.25.0-beta.
|
|
13
|
+
"@shopgate/pwa-common": "7.25.0-beta.6",
|
|
14
|
+
"@shopgate/pwa-common-commerce": "7.25.0-beta.6",
|
|
15
15
|
"classnames": "2.5.1",
|
|
16
16
|
"react": "~16.14.0"
|
|
17
17
|
},
|