@cntrl-site/sdk-nextjs 0.28.2 → 0.28.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.
@@ -39,13 +39,17 @@ const itemsMap = {
39
39
  [sdk_1.ArticleItemType.Custom]: CustomItem_1.CustomItem,
40
40
  [sdk_1.ArticleItemType.Group]: GroupItem_1.GroupItem
41
41
  };
42
+ const stickyFix = `
43
+ -webkit-transform: translate3d(0, 0, 0);
44
+ transform: translate3d(0, 0, 0);
45
+ `;
42
46
  const RichTextWrapper = ({ isRichText, children }) => {
43
47
  if (!isRichText)
44
48
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
45
49
  return ((0, jsx_runtime_1.jsx)("div", { style: { transformOrigin: 'top left', transform: 'scale(var(--layout-deviation))' }, children: children }));
46
50
  };
47
51
  const noop = () => null;
48
- const Item = ({ item, sectionId, articleHeight }) => {
52
+ const Item = ({ item, sectionId, articleHeight, isInGroup = false }) => {
49
53
  const itemWrapperRef = (0, react_1.useRef)(null);
50
54
  const rectObserver = (0, react_1.useContext)(ArticleRectContext_1.ArticleRectContext);
51
55
  const id = (0, react_1.useId)();
@@ -131,8 +135,7 @@ const Item = ({ item, sectionId, articleHeight }) => {
131
135
  .item-wrapper-${item.id} {
132
136
  position: ${area.positionType === sdk_1.PositionType.ScreenBased ? 'fixed' : 'absolute'};
133
137
  z-index: ${area.zIndex};
134
- -webkit-transform: translate3d(0, 0, 0);
135
- transform: translate3d(0, 0, 0);
138
+ ${!isInGroup && stickyFix}
136
139
  pointer-events: none;
137
140
  bottom: ${isScreenBasedBottom ? `${-area.top * 100}vw` : 'unset'};
138
141
  top: ${isScreenBasedBottom ? 'unset' : (0, getItemTopStyle_1.getItemTopStyle)(area.top, area.anchorSide)};
@@ -27,7 +27,7 @@ const GroupItem = ({ item, sectionId, onResize, articleHeight }) => {
27
27
  return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, target: (_b = item.link) === null || _b === void 0 ? void 0 : _b.target, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `group-${item.id}`, ref: setRef, style: {
28
28
  opacity,
29
29
  transform: `rotate(${angle}deg)`,
30
- }, children: items && items.map(item => ((0, jsx_runtime_1.jsx)(Item_1.Item, { item: item, sectionId: sectionId, articleHeight: articleHeight }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
30
+ }, children: items && items.map(item => ((0, jsx_runtime_1.jsx)(Item_1.Item, { item: item, sectionId: sectionId, articleHeight: articleHeight, isInGroup: true }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
31
31
  .group-${item.id} {
32
32
  position: absolute;
33
33
  width: 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "0.28.2",
3
+ "version": "0.28.3",
4
4
  "description": "SDK for Next.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.ts",
@@ -39,6 +39,7 @@ export interface ItemProps<I extends ItemAny> {
39
39
 
40
40
  export interface ItemWrapperProps extends ItemProps<ItemAny> {
41
41
  articleHeight: number;
42
+ isInGroup?: boolean;
42
43
  }
43
44
 
44
45
  const itemsMap: Record<ArticleItemType, ComponentType<ItemProps<any>>> = {
@@ -56,6 +57,11 @@ interface RTWrapperProps {
56
57
  isRichText: boolean;
57
58
  }
58
59
 
60
+ const stickyFix = `
61
+ -webkit-transform: translate3d(0, 0, 0);
62
+ transform: translate3d(0, 0, 0);
63
+ `;
64
+
59
65
  const RichTextWrapper: FC<PropsWithChildren<RTWrapperProps>> = ({ isRichText, children }) => {
60
66
  if (!isRichText) return <>{children}</>;
61
67
  return (
@@ -67,7 +73,7 @@ const RichTextWrapper: FC<PropsWithChildren<RTWrapperProps>> = ({ isRichText, ch
67
73
 
68
74
  const noop = () => null;
69
75
 
70
- export const Item: FC<ItemWrapperProps> = ({ item, sectionId, articleHeight }) => {
76
+ export const Item: FC<ItemWrapperProps> = ({ item, sectionId, articleHeight, isInGroup = false }) => {
71
77
  const itemWrapperRef = useRef<HTMLDivElement | null>(null);
72
78
  const rectObserver = useContext(ArticleRectContext);
73
79
  const id = useId();
@@ -177,8 +183,7 @@ export const Item: FC<ItemWrapperProps> = ({ item, sectionId, articleHeight }) =
177
183
  .item-wrapper-${item.id} {
178
184
  position: ${area.positionType === PositionType.ScreenBased ? 'fixed': 'absolute'};
179
185
  z-index: ${area.zIndex};
180
- -webkit-transform: translate3d(0, 0, 0);
181
- transform: translate3d(0, 0, 0);
186
+ ${!isInGroup && stickyFix}
182
187
  pointer-events: none;
183
188
  bottom: ${isScreenBasedBottom ? `${-area.top * 100}vw` : 'unset'};
184
189
  top: ${isScreenBasedBottom ? 'unset' : getItemTopStyle(area.top, area.anchorSide)};
@@ -35,6 +35,7 @@ export const GroupItem: FC<ItemProps<TGroupItem>> = ({ item, sectionId, onResize
35
35
  key={item.id}
36
36
  sectionId={sectionId}
37
37
  articleHeight={articleHeight}
38
+ isInGroup
38
39
  />
39
40
  ))}
40
41
  </div>