lib-pixelbuild 0.4.1 → 0.4.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.
@@ -28,6 +28,10 @@ const DividerComponent = memo(function DividerComponent({ component }) {
28
28
  marginLeft,
29
29
  marginRight
30
30
  };
31
- return (_jsx(ComponentShell, { component: component, outer: "div", children: _jsx("div", { style: { display: 'flex', flexDirection: isVertical ? 'row' : 'column', minHeight: isVertical ? undefined : '1px' }, children: _jsx("div", { style: line, "aria-hidden": "true" }) }) }));
31
+ return (_jsx(ComponentShell, { component: component, outer: "div", children: _jsx("div", { style: {
32
+ display: 'flex',
33
+ flexDirection: isVertical ? 'row' : 'column',
34
+ minHeight: isVertical ? undefined : '1px'
35
+ }, children: _jsx("div", { style: line, "aria-hidden": "true" }) }) }));
32
36
  });
33
37
  export { DividerComponent };
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { memo, useMemo } from 'react';
3
- import { ComponentShell } from '../ui/PbComponentShell.js';
4
3
  import { ElementFactory } from '../factories/ElementFactory.js';
5
4
  import { orderBySort } from '../utils/orderBySort.js';
6
5
  import { getString } from '../utils/propertyUtils.js';
@@ -17,6 +16,7 @@ const HeroComponent = memo(function HeroComponent({ component }) {
17
16
  : 0.5;
18
17
  const contentAlign = getString(properties, 'contentAlign', 'center');
19
18
  const contentVerticalAlign = getString(properties, 'contentVerticalAlign', 'center');
19
+ const contentPadding = getString(properties, 'contentPadding', '');
20
20
  const elements = useMemo(() => orderBySort(component.elements), [component.elements]);
21
21
  const justifyContent = contentAlign === 'left' ? 'flex-start' : contentAlign === 'right' ? 'flex-end' : 'center';
22
22
  const alignItems = contentVerticalAlign === 'top' ? 'flex-start' : contentVerticalAlign === 'bottom' ? 'flex-end' : 'center';
@@ -30,6 +30,8 @@ const HeroComponent = memo(function HeroComponent({ component }) {
30
30
  alignItems: justifyContent,
31
31
  textAlign: contentAlign === 'left' || contentAlign === 'right' ? contentAlign : 'center'
32
32
  };
33
+ if (contentPadding)
34
+ contentStyle.padding = contentPadding;
33
35
  const media = useMemo(() => {
34
36
  if (mediaType === 'video' && mediaSrc) {
35
37
  return (_jsx("video", { autoPlay: true, muted: true, loop: true, playsInline: true, src: mediaSrc, poster: mediaPoster || undefined, style: { position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover' } }));
@@ -46,6 +48,6 @@ const HeroComponent = memo(function HeroComponent({ component }) {
46
48
  backgroundColor: overlayColor,
47
49
  opacity: overlayOpacity
48
50
  } }));
49
- return (_jsx(ComponentShell, { component: component, outer: "div", children: _jsxs("div", { style: { position: 'relative', overflow: 'hidden', minHeight }, children: [media, overlay, _jsx("div", { style: contentStyle, children: elements.map((element) => elementFactory.build(element)) })] }) }));
51
+ return (_jsx("div", { "data-pb-component": component.id, style: component.styles, children: _jsxs("div", { style: { position: 'relative', overflow: 'hidden', minHeight }, children: [media, overlay, _jsx("div", { style: contentStyle, children: elements.map((element) => elementFactory.build(element)) })] }) }));
50
52
  });
51
53
  export { HeroComponent };
@@ -9,8 +9,11 @@ function gridClass(id) {
9
9
  return `pixelbuild-grid-${String(id).replace(/[^a-zA-Z0-9_-]/g, '_')}`;
10
10
  }
11
11
  const BlockGrid = memo(function BlockGrid({ block, editionMode, componentDefaults }) {
12
+ var _a;
12
13
  const grid = gridClass(block.id);
13
14
  const components = orderBySort(block.components);
15
+ const gap = (_a = block.properties) === null || _a === void 0 ? void 0 : _a.gap;
16
+ const gapValue = gap === '' || gap === undefined || gap === null ? '0' : String(gap);
14
17
  const css = useMemo(() => {
15
18
  const rules = components
16
19
  .map((component) => {
@@ -29,8 +32,8 @@ const BlockGrid = memo(function BlockGrid({ block, editionMode, componentDefault
29
32
  ].join('');
30
33
  })
31
34
  .join('');
32
- return `.${grid}{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:0}${rules}`;
33
- }, [grid, components]);
35
+ return `.${grid}{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:${gapValue}}${rules}`;
36
+ }, [grid, components, gapValue]);
34
37
  if (editionMode && components.length === 0) {
35
38
  return (_jsxs("div", { "data-pixelbuild-empty-block": block.id, style: {
36
39
  minHeight: 80,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lib-pixelbuild",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "engines": {
5
5
  "node": "^24.0.0",
6
6
  "npm": ">=10"