jrs-react 1.2.40 → 1.2.42

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/build/index.es.js CHANGED
@@ -4875,41 +4875,11 @@ class Slider$1 extends React__default.Component {
4875
4875
  }
4876
4876
  }
4877
4877
 
4878
- function styleInject(css, ref) {
4879
- if ( ref === void 0 ) ref = {};
4880
- var insertAt = ref.insertAt;
4881
-
4882
- if (!css || typeof document === 'undefined') { return; }
4883
-
4884
- var head = document.head || document.getElementsByTagName('head')[0];
4885
- var style = document.createElement('style');
4886
- style.type = 'text/css';
4887
-
4888
- if (insertAt === 'top') {
4889
- if (head.firstChild) {
4890
- head.insertBefore(style, head.firstChild);
4891
- } else {
4892
- head.appendChild(style);
4893
- }
4894
- } else {
4895
- head.appendChild(style);
4896
- }
4897
-
4898
- if (style.styleSheet) {
4899
- style.styleSheet.cssText = css;
4900
- } else {
4901
- style.appendChild(document.createTextNode(css));
4902
- }
4903
- }
4904
-
4905
- var css_248z = ".Style-module_test__LrdEc{border:1px solid red;color:red}.Style-module_withMask__LPcai{overflow:hidden!important;position:relative;user-select:none;&:after{a:#868686cc;background:#868686cc;border-radius:inherit;bottom:0;content:\"\";height:10000px;left:0;position:absolute;right:0;top:0;width:10000px}}mask{background:#868686cc;border-radius:inherit;bottom:0;height:10000px;left:0;position:absolute;right:0;top:0;width:10000px}";
4906
- styleInject(css_248z);
4907
-
4908
4878
  const StyledBackdrop = styled.div`
4909
4879
  ${({
4910
4880
  $zIndex
4911
4881
  }) => $zIndex != null ? `z-index:${$zIndex};` : null}
4912
- background : #868686cc;
4882
+ background : rgba(0, 0, 0, 0.25);
4913
4883
  height:100vh;
4914
4884
  width:100vw;
4915
4885
  position: fixed;
@@ -4967,6 +4937,26 @@ const StyledJRWindow = styled.div`
4967
4937
  }
4968
4938
  }
4969
4939
  `;
4940
+ class Backdrop extends JRHTML {
4941
+ backdropConfig = {
4942
+ yo: 'div',
4943
+ style: {
4944
+ background: 'rgba(0, 0, 0, 0.25)',
4945
+ height: '100%',
4946
+ width: '100%',
4947
+ position: 'absolute',
4948
+ top: 0,
4949
+ left: 0
4950
+ }
4951
+ };
4952
+ show() {
4953
+ this.backdrop = this.agregarHijo(this.backdropConfig);
4954
+ }
4955
+ hide() {
4956
+ this.yo.removeChild(this.yo.children[this.yo.children.length - 1]);
4957
+ this.hijos = [];
4958
+ }
4959
+ }
4970
4960
  class JRWindow extends JRFrame {
4971
4961
  // x=0
4972
4962
  // y=0
@@ -4978,7 +4968,19 @@ class JRWindow extends JRFrame {
4978
4968
  super(props);
4979
4969
  this.ref = /*#__PURE__*/React__default.createRef();
4980
4970
  this.titleBarRef = /*#__PURE__*/React__default.createRef();
4981
- // this.init()
4971
+ }
4972
+ createBackdrop() {
4973
+ if (typeof this.props.backdrop === 'string') {
4974
+ const target = document.getElementById(this.props.backdrop);
4975
+ if (target) {
4976
+ this.backdropTarget = new Backdrop({
4977
+ yo: target,
4978
+ style: {
4979
+ position: 'relative'
4980
+ }
4981
+ });
4982
+ }
4983
+ }
4982
4984
  }
4983
4985
  addMaskToTarget = target => {
4984
4986
  this.mask = document.createElement('div');
@@ -5008,18 +5010,17 @@ class JRWindow extends JRFrame {
5008
5010
 
5009
5011
  componentDidMount() {
5010
5012
  super.componentDidMount();
5011
- // if(this.props.backdrop && this.props.open){
5012
- // this.backdropOn(this.props.open)
5013
- // }
5014
-
5013
+ this.createBackdrop();
5015
5014
  if (this.props.open) {
5016
5015
  this.open();
5017
5016
  }
5018
5017
  }
5019
5018
  open() {
5019
+ this.backdropTarget?.show();
5020
5020
  this.props.onOpen?.bind(this)();
5021
5021
  }
5022
5022
  close() {
5023
+ this.backdropTarget?.hide();
5023
5024
  this.props.onClose?.bind(this)();
5024
5025
  }
5025
5026
  componentDidUpdate(prevProps, prevState, snapshot) {
@@ -5083,7 +5084,7 @@ class JRWindow extends JRFrame {
5083
5084
  windowRef: this.ref,
5084
5085
  window: this,
5085
5086
  titleBarRef: this.titleBarRef
5086
- })), this.props.backdrop !== false && /*#__PURE__*/React__default.createElement(StyledBackdrop, {
5087
+ })), this.props.backdrop !== false && typeof this.props.backdrop !== 'string' && /*#__PURE__*/React__default.createElement(StyledBackdrop, {
5087
5088
  $zIndex: this.props.zIndex
5088
5089
  }))) : '' : super.renderer();
5089
5090
  }
package/build/index.js CHANGED
@@ -4902,41 +4902,11 @@ class Slider$1 extends React__default["default"].Component {
4902
4902
  }
4903
4903
  }
4904
4904
 
4905
- function styleInject(css, ref) {
4906
- if ( ref === void 0 ) ref = {};
4907
- var insertAt = ref.insertAt;
4908
-
4909
- if (!css || typeof document === 'undefined') { return; }
4910
-
4911
- var head = document.head || document.getElementsByTagName('head')[0];
4912
- var style = document.createElement('style');
4913
- style.type = 'text/css';
4914
-
4915
- if (insertAt === 'top') {
4916
- if (head.firstChild) {
4917
- head.insertBefore(style, head.firstChild);
4918
- } else {
4919
- head.appendChild(style);
4920
- }
4921
- } else {
4922
- head.appendChild(style);
4923
- }
4924
-
4925
- if (style.styleSheet) {
4926
- style.styleSheet.cssText = css;
4927
- } else {
4928
- style.appendChild(document.createTextNode(css));
4929
- }
4930
- }
4931
-
4932
- var css_248z = ".Style-module_test__LrdEc{border:1px solid red;color:red}.Style-module_withMask__LPcai{overflow:hidden!important;position:relative;user-select:none;&:after{a:#868686cc;background:#868686cc;border-radius:inherit;bottom:0;content:\"\";height:10000px;left:0;position:absolute;right:0;top:0;width:10000px}}mask{background:#868686cc;border-radius:inherit;bottom:0;height:10000px;left:0;position:absolute;right:0;top:0;width:10000px}";
4933
- styleInject(css_248z);
4934
-
4935
4905
  const StyledBackdrop = styled__default["default"].div`
4936
4906
  ${({
4937
4907
  $zIndex
4938
4908
  }) => $zIndex != null ? `z-index:${$zIndex};` : null}
4939
- background : #868686cc;
4909
+ background : rgba(0, 0, 0, 0.25);
4940
4910
  height:100vh;
4941
4911
  width:100vw;
4942
4912
  position: fixed;
@@ -4994,6 +4964,26 @@ const StyledJRWindow = styled__default["default"].div`
4994
4964
  }
4995
4965
  }
4996
4966
  `;
4967
+ class Backdrop extends JRHTML {
4968
+ backdropConfig = {
4969
+ yo: 'div',
4970
+ style: {
4971
+ background: 'rgba(0, 0, 0, 0.25)',
4972
+ height: '100%',
4973
+ width: '100%',
4974
+ position: 'absolute',
4975
+ top: 0,
4976
+ left: 0
4977
+ }
4978
+ };
4979
+ show() {
4980
+ this.backdrop = this.agregarHijo(this.backdropConfig);
4981
+ }
4982
+ hide() {
4983
+ this.yo.removeChild(this.yo.children[this.yo.children.length - 1]);
4984
+ this.hijos = [];
4985
+ }
4986
+ }
4997
4987
  class JRWindow extends JRFrame {
4998
4988
  // x=0
4999
4989
  // y=0
@@ -5005,7 +4995,19 @@ class JRWindow extends JRFrame {
5005
4995
  super(props);
5006
4996
  this.ref = /*#__PURE__*/React__default["default"].createRef();
5007
4997
  this.titleBarRef = /*#__PURE__*/React__default["default"].createRef();
5008
- // this.init()
4998
+ }
4999
+ createBackdrop() {
5000
+ if (typeof this.props.backdrop === 'string') {
5001
+ const target = document.getElementById(this.props.backdrop);
5002
+ if (target) {
5003
+ this.backdropTarget = new Backdrop({
5004
+ yo: target,
5005
+ style: {
5006
+ position: 'relative'
5007
+ }
5008
+ });
5009
+ }
5010
+ }
5009
5011
  }
5010
5012
  addMaskToTarget = target => {
5011
5013
  this.mask = document.createElement('div');
@@ -5035,18 +5037,17 @@ class JRWindow extends JRFrame {
5035
5037
 
5036
5038
  componentDidMount() {
5037
5039
  super.componentDidMount();
5038
- // if(this.props.backdrop && this.props.open){
5039
- // this.backdropOn(this.props.open)
5040
- // }
5041
-
5040
+ this.createBackdrop();
5042
5041
  if (this.props.open) {
5043
5042
  this.open();
5044
5043
  }
5045
5044
  }
5046
5045
  open() {
5046
+ this.backdropTarget?.show();
5047
5047
  this.props.onOpen?.bind(this)();
5048
5048
  }
5049
5049
  close() {
5050
+ this.backdropTarget?.hide();
5050
5051
  this.props.onClose?.bind(this)();
5051
5052
  }
5052
5053
  componentDidUpdate(prevProps, prevState, snapshot) {
@@ -5110,7 +5111,7 @@ class JRWindow extends JRFrame {
5110
5111
  windowRef: this.ref,
5111
5112
  window: this,
5112
5113
  titleBarRef: this.titleBarRef
5113
- })), this.props.backdrop !== false && /*#__PURE__*/React__default["default"].createElement(StyledBackdrop, {
5114
+ })), this.props.backdrop !== false && typeof this.props.backdrop !== 'string' && /*#__PURE__*/React__default["default"].createElement(StyledBackdrop, {
5114
5115
  $zIndex: this.props.zIndex
5115
5116
  }))) : '' : super.renderer();
5116
5117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jrs-react",
3
- "version": "1.2.40",
3
+ "version": "1.2.42",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.es.js",
@@ -2,13 +2,12 @@ import React from "react";
2
2
  import JRFrame from "../JRFrame/JRFrame";
3
3
  import styled from "styled-components";
4
4
  import TitleBar from "./TitleBar";
5
- import { po } from "../JRUtils";
6
5
  import Sliders from "./Slider";
7
- import style from './Style.module.css'
6
+ import { JRHTML } from "jrs-js";
8
7
 
9
8
  const StyledBackdrop=styled.div`
10
9
  ${({$zIndex})=>$zIndex!=null?`z-index:${$zIndex};`:null}
11
- background : #868686cc;
10
+ background : rgba(0, 0, 0, 0.25);
12
11
  height:100vh;
13
12
  width:100vw;
14
13
  position: fixed;
@@ -56,6 +55,28 @@ const StyledJRWindow=styled.div`
56
55
  }
57
56
  `
58
57
 
58
+ class Backdrop extends JRHTML{
59
+ backdropConfig={
60
+ yo:'div'
61
+ ,style:{
62
+ background:'rgba(0, 0, 0, 0.25)'
63
+ ,height: '100%'
64
+ ,width: '100%'
65
+ ,position: 'absolute'
66
+ ,top: 0
67
+ ,left: 0
68
+ }
69
+ }
70
+
71
+ show(){
72
+ this.backdrop=this.agregarHijo(this.backdropConfig)
73
+ }
74
+ hide(){
75
+ this.yo.removeChild(this.yo.children[this.yo.children.length-1])
76
+ this.hijos=[]
77
+ }
78
+ }
79
+
59
80
  export default class JRWindow extends JRFrame {
60
81
  // x=0
61
82
  // y=0
@@ -68,7 +89,20 @@ export default class JRWindow extends JRFrame {
68
89
  super(props)
69
90
  this.ref=React.createRef()
70
91
  this.titleBarRef=React.createRef()
71
- // this.init()
92
+ }
93
+
94
+ createBackdrop(){
95
+ if(typeof this.props.backdrop === 'string'){
96
+ const target=document.getElementById(this.props.backdrop)
97
+ if(target){
98
+ this.backdropTarget=new Backdrop({
99
+ yo:target
100
+ ,style:{
101
+ position: 'relative'
102
+ }
103
+ })
104
+ }
105
+ }
72
106
  }
73
107
 
74
108
  addMaskToTarget=(target)=>{
@@ -99,19 +133,18 @@ export default class JRWindow extends JRFrame {
99
133
 
100
134
  componentDidMount(){
101
135
  super.componentDidMount()
102
- // if(this.props.backdrop && this.props.open){
103
- // this.backdropOn(this.props.open)
104
- // }
105
-
136
+ this.createBackdrop()
106
137
  if(this.props.open){
107
138
  this.open()
108
139
  }
109
140
  }
110
141
 
111
142
  open(){
143
+ this.backdropTarget?.show()
112
144
  this.props.onOpen?.bind(this)()
113
145
  }
114
146
  close(){
147
+ this.backdropTarget?.hide()
115
148
  this.props.onClose?.bind(this)()
116
149
  }
117
150
 
@@ -188,7 +221,7 @@ export default class JRWindow extends JRFrame {
188
221
  />
189
222
  }
190
223
  </main>
191
- {this.props.backdrop!==false && <StyledBackdrop $zIndex={this.props.zIndex}/>}
224
+ {this.props.backdrop!==false && typeof this.props.backdrop!=='string' && <StyledBackdrop $zIndex={this.props.zIndex}/>}
192
225
  </StyledJRWindow>
193
226
  </>
194
227
  :''