@cntrl-site/sdk-nextjs 0.18.0 → 0.19.1

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.
@@ -94,7 +94,7 @@ const Item = ({ item, sectionId, articleHeight }) => {
94
94
  if (!layout)
95
95
  return null;
96
96
  const styles = {
97
- top: `${(0, getAnchoredItemTop_1.getAnchoredItemTop)(stickyTop, sectionHeight[layout], item.area[layout].anchorSide)}`,
97
+ top: stickyTop,
98
98
  height: isRichText && itemHeight ? `${itemHeight * 100}vw` : 'unset'
99
99
  };
100
100
  return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `item-wrapper-${item.id}`, ref: itemWrapperRef, style: isInitialRef.current ? {} : Object.assign({ top, left }, (wrapperHeight !== undefined ? { height: `${wrapperHeight * 100}vw` } : {})) }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ suppressHydrationWarning: true, className: `item-${item.id}`, style: isInitialRef.current ? {} : styles }, { children: (0, jsx_runtime_1.jsx)(RichTextWrapper, Object.assign({ isRichText: isRichText }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: `item-${item.id}-inner`, style: {
@@ -127,7 +127,7 @@ const Item = ({ item, sectionId, articleHeight }) => {
127
127
  --webkit-backface-visibility: hidden;
128
128
  }
129
129
  .item-wrapper-${item.id} {
130
- position: absolute;
130
+ position: ${area.positionType === sdk_1.PositionType.ScreenBased ? 'fixed' : 'absolute'};
131
131
  z-index: ${area.zIndex};
132
132
  -webkit-transform: translate3d(0, 0, 0);
133
133
  transform: translate3d(0, 0, 0);
@@ -23,9 +23,14 @@ const CustomItem = ({ item, onResize }) => {
23
23
  return (`
24
24
  .custom-component-${item.id} {
25
25
  transition: ${(0, HoverStyles_1.getTransitions)(['angle'], hoverParams)};
26
+ height: 100%;
27
+ width: 100%;
28
+ position: absolute;
29
+ left: 0;
30
+ top: 0;
26
31
  }
27
32
  .custom-component-${item.id}:hover {
28
- ${(0, HoverStyles_1.getHoverStyles)(['angle'], hoverParams)}
33
+ ${(0, HoverStyles_1.getHoverStyles)(['angle'], hoverParams)};
29
34
  }
30
35
  `);
31
36
  })}` }))] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "0.18.0",
3
+ "version": "0.19.1",
4
4
  "description": "SDK for Next.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.ts",
@@ -22,7 +22,7 @@
22
22
  "homepage": "https://github.com/cntrl-site/sdk-nextjs#readme",
23
23
  "dependencies": {
24
24
  "@cntrl-site/color": "^1.0.0",
25
- "@cntrl-site/sdk": "^1.3.0",
25
+ "@cntrl-site/sdk": "^1.4.0",
26
26
  "@types/vimeo__player": "^2.18.0",
27
27
  "@vimeo/player": "^2.20.1",
28
28
  "html-react-parser": "^3.0.1",
@@ -5,6 +5,7 @@ import {
5
5
  getLayoutStyles,
6
6
  Item as TItem,
7
7
  ItemAny,
8
+ PositionType
8
9
  } from '@cntrl-site/sdk';
9
10
  import { RectangleItem } from './items/RectangleItem';
10
11
  import { ImageItem } from './items/ImageItem';
@@ -115,9 +116,8 @@ export const Item: FC<ItemWrapperProps> = ({ item, sectionId, articleHeight }) =
115
116
  const isRichText = isItemType(item, ArticleItemType.RichText);
116
117
 
117
118
  if (!layout) return null;
118
-
119
119
  const styles = {
120
- top: `${getAnchoredItemTop(stickyTop, sectionHeight[layout], item.area[layout].anchorSide)}`,
120
+ top: stickyTop,
121
121
  height: isRichText && itemHeight ? `${itemHeight * 100}vw` : 'unset'
122
122
  };
123
123
 
@@ -171,7 +171,7 @@ export const Item: FC<ItemWrapperProps> = ({ item, sectionId, articleHeight }) =
171
171
  --webkit-backface-visibility: hidden;
172
172
  }
173
173
  .item-wrapper-${item.id} {
174
- position: absolute;
174
+ position: ${area.positionType === PositionType.ScreenBased ? 'fixed': 'absolute'};
175
175
  z-index: ${area.zIndex};
176
176
  -webkit-transform: translate3d(0, 0, 0);
177
177
  transform: translate3d(0, 0, 0);
@@ -21,9 +21,14 @@ export const CustomItem: FC<ItemProps<TCustomItem>> = ({ item, onResize }) => {
21
21
  return (`
22
22
  .custom-component-${item.id} {
23
23
  transition: ${getTransitions<ArticleItemType.Custom>(['angle'], hoverParams)};
24
+ height: 100%;
25
+ width: 100%;
26
+ position: absolute;
27
+ left: 0;
28
+ top: 0;
24
29
  }
25
30
  .custom-component-${item.id}:hover {
26
- ${getHoverStyles<ArticleItemType.Custom>(['angle'], hoverParams)}
31
+ ${getHoverStyles<ArticleItemType.Custom>(['angle'], hoverParams)};
27
32
  }
28
33
  `);
29
34
  })}`}