@gem-sdk/core 1.23.0-staging.268 → 1.23.0-staging.270

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.
@@ -116,6 +116,10 @@ function Spacing(props) {
116
116
  }
117
117
  }
118
118
  };
119
+ const isLayoutElement = (el)=>{
120
+ const tag = el.getAttribute('data-component-tag');
121
+ return tag === 'Row' || tag === 'Product';
122
+ };
119
123
  const updateSpacing = react.useCallback(()=>{
120
124
  const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
121
125
  if (!$component) return;
@@ -128,15 +132,22 @@ function Spacing(props) {
128
132
  const $marginBottom = ($spacing?.querySelector('[data-spacing-margin-bottom]')) || null;
129
133
  if ($marginBottom) {
130
134
  if ($bottomBg.current && $bottomDrag.current) {
131
- const value = style.marginBottom;
135
+ let value = style.marginBottom;
136
+ if (parseFloat(value) < 0) {
137
+ value = '0';
138
+ }
132
139
  $bottomBg.current.style.height = value;
133
140
  $bottomDrag.current.style.top = value;
134
141
  $marginBottom.setAttribute('data-spacing-margin-bottom-active', 'true');
135
- const paddingLeft = style.paddingLeft;
136
- const leftValue = `-${paddingLeft}`;
137
- const translateCss = `translate(${leftValue}, -100%)`;
138
- $bottomBg.current.style.left = leftValue;
139
- $bottomDrag.current.style.transform = translateCss;
142
+ if (isLayoutElement($component)) {
143
+ $bottomBg.current.style.left = '0';
144
+ } else {
145
+ const paddingLeft = style.paddingLeft;
146
+ const leftValue = `-${paddingLeft}`;
147
+ const translateCss = `translate(${leftValue}, -100%)`;
148
+ $bottomBg.current.style.left = leftValue;
149
+ $bottomDrag.current.style.transform = translateCss;
150
+ }
140
151
  }
141
152
  }
142
153
  }, []);
@@ -112,6 +112,10 @@ function Spacing(props) {
112
112
  }
113
113
  }
114
114
  };
115
+ const isLayoutElement = (el)=>{
116
+ const tag = el.getAttribute('data-component-tag');
117
+ return tag === 'Row' || tag === 'Product';
118
+ };
115
119
  const updateSpacing = useCallback(()=>{
116
120
  const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
117
121
  if (!$component) return;
@@ -124,15 +128,22 @@ function Spacing(props) {
124
128
  const $marginBottom = ($spacing?.querySelector('[data-spacing-margin-bottom]')) || null;
125
129
  if ($marginBottom) {
126
130
  if ($bottomBg.current && $bottomDrag.current) {
127
- const value = style.marginBottom;
131
+ let value = style.marginBottom;
132
+ if (parseFloat(value) < 0) {
133
+ value = '0';
134
+ }
128
135
  $bottomBg.current.style.height = value;
129
136
  $bottomDrag.current.style.top = value;
130
137
  $marginBottom.setAttribute('data-spacing-margin-bottom-active', 'true');
131
- const paddingLeft = style.paddingLeft;
132
- const leftValue = `-${paddingLeft}`;
133
- const translateCss = `translate(${leftValue}, -100%)`;
134
- $bottomBg.current.style.left = leftValue;
135
- $bottomDrag.current.style.transform = translateCss;
138
+ if (isLayoutElement($component)) {
139
+ $bottomBg.current.style.left = '0';
140
+ } else {
141
+ const paddingLeft = style.paddingLeft;
142
+ const leftValue = `-${paddingLeft}`;
143
+ const translateCss = `translate(${leftValue}, -100%)`;
144
+ $bottomBg.current.style.left = leftValue;
145
+ $bottomDrag.current.style.transform = translateCss;
146
+ }
136
147
  }
137
148
  }
138
149
  }, []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.23.0-staging.268",
3
+ "version": "1.23.0-staging.270",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",