lib-pixelbuild 0.2.1 → 0.2.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.
- package/dist/builders/PageBuilder.js +42 -26
- package/dist/components/ButtonsComponent.d.ts +5 -0
- package/dist/components/ButtonsComponent.js +45 -0
- package/dist/components/CardComponent.js +31 -6
- package/dist/components/FormComponent.js +9 -4
- package/dist/components/{CarouselComponent.d.ts → IconComponent.d.ts} +3 -2
- package/dist/components/IconComponent.js +12 -0
- package/dist/components/ImageComponent.d.ts +5 -0
- package/dist/components/ImageComponent.js +18 -0
- package/dist/components/ListComponent.js +5 -2
- package/dist/components/LoadingComponent.js +2 -2
- package/dist/components/MapComponent.js +11 -12
- package/dist/components/SliderComponent.d.ts +0 -1
- package/dist/components/SliderComponent.js +173 -93
- package/dist/components/SocialIconsComponent.d.ts +3 -2
- package/dist/components/SocialIconsComponent.js +20 -16
- package/dist/components/TextComponent.js +5 -3
- package/dist/constants/ComponentEnum.d.ts +2 -0
- package/dist/constants/ComponentEnum.js +2 -0
- package/dist/designSystem/baseCss.d.ts +8 -0
- package/dist/designSystem/baseCss.js +406 -0
- package/dist/designSystem/buildSiteCss.d.ts +8 -0
- package/dist/designSystem/buildSiteCss.js +11 -0
- package/dist/designSystem/index.d.ts +6 -0
- package/dist/designSystem/index.js +5 -0
- package/dist/designSystem/theme.d.ts +9 -0
- package/dist/designSystem/theme.js +11 -0
- package/dist/designSystem/themeVars.d.ts +8 -0
- package/dist/designSystem/themeVars.js +9 -0
- package/dist/designSystem/tokens.d.ts +82 -0
- package/dist/designSystem/tokens.js +144 -0
- package/dist/elements/AlertElement.js +4 -4
- package/dist/elements/ButtonElement.js +21 -7
- package/dist/elements/ElementColWrapper.js +11 -2
- package/dist/elements/IconElement.js +5 -5
- package/dist/elements/IconMap.js +101 -28
- package/dist/elements/InputElement.js +10 -9
- package/dist/elements/TextElement.js +5 -1
- package/dist/factories/ButtonActionFactory.d.ts +3 -4
- package/dist/factories/ButtonActionFactory.js +2 -2
- package/dist/factories/ComponentFactory.d.ts +2 -1
- package/dist/factories/ComponentFactory.js +29 -12
- package/dist/index.d.ts +20 -5
- package/dist/index.js +15 -1
- package/dist/layouts/Footer.js +13 -2
- package/dist/layouts/Header.js +43 -16
- package/dist/layouts/SiteLayout.d.ts +8 -1
- package/dist/layouts/SiteLayout.js +36 -3
- package/dist/renderers/BlockRenderer.d.ts +8 -0
- package/dist/renderers/BlockRenderer.js +68 -0
- package/dist/services/EmailService.d.ts +14 -5
- package/dist/services/EmailService.js +21 -24
- package/dist/stores/UseFormStore.d.ts +7 -2
- package/dist/stores/UseFormStore.js +8 -3
- package/dist/types/{SectionColumnType.d.ts → BlockType.d.ts} +2 -6
- package/dist/types/ComponentType.d.ts +3 -0
- package/dist/types/ElementType.d.ts +1 -0
- package/dist/types/EmailSettingsType.d.ts +5 -0
- package/dist/types/HeaderPropertiesType.d.ts +1 -0
- package/dist/types/MailBodyType.d.ts +2 -0
- package/dist/types/PageType.d.ts +2 -2
- package/dist/types/SocialPropertiesType.d.ts +3 -11
- package/dist/types/StylesType.d.ts +12 -0
- package/dist/types/WebsitePropertiesType.d.ts +2 -0
- package/dist/types/WebsiteType.d.ts +6 -0
- package/dist/ui/PbAlert.d.ts +10 -0
- package/dist/ui/PbAlert.js +8 -0
- package/dist/ui/PbButton.d.ts +20 -0
- package/dist/ui/PbButton.js +20 -0
- package/dist/ui/PbCol.d.ts +14 -0
- package/dist/ui/PbCol.js +43 -0
- package/dist/ui/PbContainer.d.ts +7 -0
- package/dist/ui/PbContainer.js +17 -0
- package/dist/ui/PbRow.d.ts +7 -0
- package/dist/ui/PbRow.js +17 -0
- package/dist/ui/PbSpinner.d.ts +3 -0
- package/dist/ui/PbSpinner.js +5 -0
- package/dist/ui/index.d.ts +6 -0
- package/dist/ui/index.js +6 -0
- package/dist/utils/emailTemplate.d.ts +7 -0
- package/dist/utils/emailTemplate.js +66 -0
- package/dist/utils/fonts.d.ts +2 -0
- package/dist/utils/fonts.js +10 -0
- package/dist/utils/imageCustomization.d.ts +3 -0
- package/dist/utils/imageCustomization.js +9 -0
- package/dist/utils/responsiveProperties.d.ts +2 -0
- package/dist/utils/responsiveProperties.js +28 -0
- package/dist/utils/responsiveStyles.d.ts +6 -0
- package/dist/utils/responsiveStyles.js +73 -0
- package/package.json +1 -8
- package/dist/components/CarouselComponent.js +0 -6
- package/dist/layouts/Menu.d.ts +0 -5
- package/dist/layouts/Menu.js +0 -34
- package/dist/renderers/SectionRenderer.d.ts +0 -6
- package/dist/renderers/SectionRenderer.js +0 -73
- package/dist/types/SectionType.d.ts +0 -10
- /package/dist/types/{SectionColumnType.js → BlockType.js} +0 -0
- /package/dist/types/{SectionType.js → EmailSettingsType.js} +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense, memo, useMemo } from 'react';
|
|
3
3
|
import { Helmet } from 'react-helmet-async';
|
|
4
|
-
import {
|
|
4
|
+
import { BlockRenderer } from '../renderers/BlockRenderer.js';
|
|
5
|
+
import { buildResponsiveCssForStyles } from '../utils/responsiveStyles.js';
|
|
6
|
+
import { buildFontFamily } from '../utils/fonts.js';
|
|
5
7
|
function mergeStyles(websiteStyles, pageStyles) {
|
|
6
8
|
const merged = Object.assign({}, websiteStyles);
|
|
7
9
|
for (const key of Object.keys(pageStyles)) {
|
|
@@ -19,31 +21,45 @@ function toCssValue(val) {
|
|
|
19
21
|
return undefined;
|
|
20
22
|
}
|
|
21
23
|
const PageBuilder = memo(function PageBuilder({ website, page, editionMode }) {
|
|
24
|
+
var _a, _b, _c, _d;
|
|
22
25
|
const mergedStyles = useMemo(() => mergeStyles(website.styles, page.styles), [website.styles, page.styles]);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
?
|
|
28
|
-
: mergedStyles.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
26
|
+
const designSystem = website.designSystem;
|
|
27
|
+
const pageStyle = useMemo(() => {
|
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
29
|
+
return ({
|
|
30
|
+
backgroundColor: (_b = toCssValue((_a = designSystem === null || designSystem === void 0 ? void 0 : designSystem.colors) === null || _a === void 0 ? void 0 : _a.background)) !== null && _b !== void 0 ? _b : toCssValue(mergedStyles.backgroundColor),
|
|
31
|
+
color: (_d = toCssValue((_c = designSystem === null || designSystem === void 0 ? void 0 : designSystem.colors) === null || _c === void 0 ? void 0 : _c.text)) !== null && _d !== void 0 ? _d : toCssValue(mergedStyles.color),
|
|
32
|
+
backgroundImage: mergedStyles.backgroundGradientColorStart
|
|
33
|
+
? `linear-gradient(${mergedStyles.backgroundGradientColorStart}, ${mergedStyles.backgroundGradientColorEnd}), url(${mergedStyles.backgroundImage})`
|
|
34
|
+
: mergedStyles.backgroundImage
|
|
35
|
+
? `url(${mergedStyles.backgroundImage})`
|
|
36
|
+
: undefined,
|
|
37
|
+
backgroundSize: toCssValue(mergedStyles.backgroundSize),
|
|
38
|
+
backgroundPosition: toCssValue(mergedStyles.backgroundPosition),
|
|
39
|
+
width: toCssValue(mergedStyles.width),
|
|
40
|
+
height: toCssValue(mergedStyles.height),
|
|
41
|
+
fontFamily: toCssValue((_e = designSystem === null || designSystem === void 0 ? void 0 : designSystem.typography) === null || _e === void 0 ? void 0 : _e.fontFamily)
|
|
42
|
+
? buildFontFamily(designSystem.typography.fontFamily)
|
|
43
|
+
: buildFontFamily(mergedStyles.fontFamily),
|
|
44
|
+
fontSize: (_g = toCssValue((_f = designSystem === null || designSystem === void 0 ? void 0 : designSystem.typography) === null || _f === void 0 ? void 0 : _f.fontSizeBase)) !== null && _g !== void 0 ? _g : toCssValue(mergedStyles.fontSize),
|
|
45
|
+
fontWeight: toCssValue(mergedStyles.fontWeight),
|
|
46
|
+
textAlign: mergedStyles.textAlign,
|
|
47
|
+
paddingTop: toCssValue(mergedStyles.paddingTop),
|
|
48
|
+
paddingBottom: toCssValue(mergedStyles.paddingBottom),
|
|
49
|
+
paddingLeft: toCssValue(mergedStyles.paddingLeft),
|
|
50
|
+
paddingRight: toCssValue(mergedStyles.paddingRight),
|
|
51
|
+
marginTop: toCssValue(mergedStyles.marginTop),
|
|
52
|
+
marginBottom: toCssValue(mergedStyles.marginBottom),
|
|
53
|
+
borderRadius: toCssValue(mergedStyles.borderRadius),
|
|
54
|
+
minHeight: '100vh'
|
|
55
|
+
});
|
|
56
|
+
}, [
|
|
57
|
+
(_a = designSystem === null || designSystem === void 0 ? void 0 : designSystem.colors) === null || _a === void 0 ? void 0 : _a.background,
|
|
58
|
+
(_b = designSystem === null || designSystem === void 0 ? void 0 : designSystem.colors) === null || _b === void 0 ? void 0 : _b.text,
|
|
59
|
+
(_c = designSystem === null || designSystem === void 0 ? void 0 : designSystem.typography) === null || _c === void 0 ? void 0 : _c.fontFamily,
|
|
60
|
+
(_d = designSystem === null || designSystem === void 0 ? void 0 : designSystem.typography) === null || _d === void 0 ? void 0 : _d.fontSizeBase,
|
|
61
|
+
mergedStyles
|
|
62
|
+
]);
|
|
63
|
+
return (_jsxs(Suspense, { fallback: _jsx("div", { children: website.properties.loadingMessage }), children: [!editionMode && (_jsxs(Helmet, { children: [_jsx("title", { children: page.title }), _jsx("meta", { name: "description", content: page.title }), _jsx("meta", { property: "og:title", content: page.title }), _jsx("meta", { property: "og:description", content: page.title }), _jsx("meta", { property: "og:image", content: page.title })] })), _jsxs("div", { style: pageStyle, "data-pb-page": true, children: [_jsx("style", { children: buildResponsiveCssForStyles('[data-pb-page]', page.styles) }), _jsx(BlockRenderer, { blocks: page.blocks, editionMode: editionMode, componentDefaults: website.componentDefaults }), page.blocks.length === 0 && editionMode && (_jsx("div", { style: { padding: '40px', textAlign: 'center', color: '#94a3b8' }, children: "Nenhum conte\u00FAdo adicionado." }))] })] }));
|
|
48
64
|
});
|
|
49
65
|
export { PageBuilder };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
3
|
+
import { PbContainer } from '../ui/PbContainer.js';
|
|
4
|
+
import { PbButton } from '../ui/PbButton.js';
|
|
5
|
+
import { orderBySort } from '../utils/orderBySort.js';
|
|
6
|
+
import { getString, getNumber, getBoolean } from '../utils/propertyUtils.js';
|
|
7
|
+
const ALIGN_JUSTIFY = {
|
|
8
|
+
left: 'flex-start',
|
|
9
|
+
center: 'center',
|
|
10
|
+
right: 'flex-end'
|
|
11
|
+
};
|
|
12
|
+
const ButtonsComponent = memo(function ButtonsComponent({ component }) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const elements = useMemo(() => orderBySort(component.elements), [component.elements]);
|
|
15
|
+
const properties = component.properties || {};
|
|
16
|
+
const isColumn = getString(properties, 'layout', 'row') === 'column';
|
|
17
|
+
const gap = (_a = getNumber(properties, 'gap', 12)) !== null && _a !== void 0 ? _a : 12;
|
|
18
|
+
const fullWidth = getBoolean(properties, 'fullWidth', false);
|
|
19
|
+
const align = (_b = ALIGN_JUSTIFY[getString(properties, 'align', 'left')]) !== null && _b !== void 0 ? _b : 'flex-start';
|
|
20
|
+
const containerStyle = {
|
|
21
|
+
display: 'flex',
|
|
22
|
+
flexDirection: isColumn ? 'column' : 'row',
|
|
23
|
+
flexWrap: 'wrap',
|
|
24
|
+
gap: `${gap}px`
|
|
25
|
+
};
|
|
26
|
+
if (isColumn)
|
|
27
|
+
containerStyle.alignItems = align;
|
|
28
|
+
else
|
|
29
|
+
containerStyle.justifyContent = align;
|
|
30
|
+
return (_jsx(PbContainer, { "data-pb-component": component.id, style: component.styles, children: _jsx("div", { style: containerStyle, children: elements.map((element) => {
|
|
31
|
+
const props = element.properties || {};
|
|
32
|
+
const href = getString(props, 'path') || getString(props, 'href');
|
|
33
|
+
const text = getString(props, 'text') || getString(props, 'title');
|
|
34
|
+
const size = getString(props, 'size');
|
|
35
|
+
const style = Object.assign({}, element.styles);
|
|
36
|
+
if (fullWidth) {
|
|
37
|
+
if (isColumn)
|
|
38
|
+
style.width = '100%';
|
|
39
|
+
else
|
|
40
|
+
style.flex = '1 1 0%';
|
|
41
|
+
}
|
|
42
|
+
return (_jsx(PbButton, { "data-pb-element": element.id, href: href || undefined, variant: getString(props, 'variant', 'primary'), size: size === 'sm' || size === 'lg' ? size : undefined, target: href ? getString(props, 'target', '_self') : undefined, style: style, children: text }, element.id));
|
|
43
|
+
}) }) }));
|
|
44
|
+
});
|
|
45
|
+
export { ButtonsComponent };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { PbContainer } from '../ui/PbContainer.js';
|
|
4
|
+
import { PbRow } from '../ui/PbRow.js';
|
|
4
5
|
import { ElementFactory } from '../factories/ElementFactory.js';
|
|
5
6
|
import { orderBySort } from '../utils/orderBySort.js';
|
|
6
7
|
const elementFactory = new ElementFactory();
|
|
@@ -24,7 +25,13 @@ function applyCardStyles(element, props) {
|
|
|
24
25
|
if (props.cardTextSize)
|
|
25
26
|
overrides.fontSize = props.cardTextSize;
|
|
26
27
|
}
|
|
27
|
-
return Object.assign(Object.assign({}, element), { styles: Object.assign(Object.assign({}, element.styles), overrides) });
|
|
28
|
+
return Object.assign(Object.assign({}, element), { styles: Object.assign(Object.assign({}, element.styles), overrides), fullBleed: element.elementType === 'image' ? true : element.fullBleed });
|
|
29
|
+
}
|
|
30
|
+
function stripWidth(element) {
|
|
31
|
+
return Object.assign(Object.assign({}, element), { width: {} });
|
|
32
|
+
}
|
|
33
|
+
function centerStyles(element) {
|
|
34
|
+
return Object.assign(Object.assign({}, element), { width: {}, styles: Object.assign(Object.assign({}, element.styles), { textAlign: 'center' }) });
|
|
28
35
|
}
|
|
29
36
|
const CardComponent = memo(function CardComponent({ component }) {
|
|
30
37
|
const { properties } = component;
|
|
@@ -38,7 +45,8 @@ const CardComponent = memo(function CardComponent({ component }) {
|
|
|
38
45
|
cardTitleColor: properties === null || properties === void 0 ? void 0 : properties.cardTitleColor,
|
|
39
46
|
cardTitleSize: properties === null || properties === void 0 ? void 0 : properties.cardTitleSize,
|
|
40
47
|
cardTextColor: properties === null || properties === void 0 ? void 0 : properties.cardTextColor,
|
|
41
|
-
cardTextSize: properties === null || properties === void 0 ? void 0 : properties.cardTextSize
|
|
48
|
+
cardTextSize: properties === null || properties === void 0 ? void 0 : properties.cardTextSize,
|
|
49
|
+
cardElementGap: properties === null || properties === void 0 ? void 0 : properties.cardElementGap
|
|
42
50
|
}), [
|
|
43
51
|
properties === null || properties === void 0 ? void 0 : properties.cardElement1,
|
|
44
52
|
properties === null || properties === void 0 ? void 0 : properties.cardElement2,
|
|
@@ -49,7 +57,8 @@ const CardComponent = memo(function CardComponent({ component }) {
|
|
|
49
57
|
properties === null || properties === void 0 ? void 0 : properties.cardTitleColor,
|
|
50
58
|
properties === null || properties === void 0 ? void 0 : properties.cardTitleSize,
|
|
51
59
|
properties === null || properties === void 0 ? void 0 : properties.cardTextColor,
|
|
52
|
-
properties === null || properties === void 0 ? void 0 : properties.cardTextSize
|
|
60
|
+
properties === null || properties === void 0 ? void 0 : properties.cardTextSize,
|
|
61
|
+
properties === null || properties === void 0 ? void 0 : properties.cardElementGap
|
|
53
62
|
]);
|
|
54
63
|
const orderedElements = useMemo(() => {
|
|
55
64
|
const cardOrder = [
|
|
@@ -72,6 +81,22 @@ const CardComponent = memo(function CardComponent({ component }) {
|
|
|
72
81
|
component.elements
|
|
73
82
|
]);
|
|
74
83
|
const elements = useMemo(() => orderedElements.map((el) => applyCardStyles(el, cardProps)), [orderedElements, cardProps]);
|
|
75
|
-
|
|
84
|
+
const layout = String((properties === null || properties === void 0 ? void 0 : properties.cardLayout) || 'stacked');
|
|
85
|
+
const rawGap = cardProps.cardElementGap;
|
|
86
|
+
const elementGap = rawGap === '' || rawGap == null ? '0' : String(rawGap);
|
|
87
|
+
const rowGapStyle = { gap: elementGap };
|
|
88
|
+
if (layout === 'icon-left' || layout === 'icon-right') {
|
|
89
|
+
const icon = elements.find((element) => element.elementType === 'icon');
|
|
90
|
+
const others = elements.filter((element) => element !== icon);
|
|
91
|
+
const iconBox = icon ? _jsx("div", { style: { flex: '0 0 auto' }, children: elementFactory.build(stripWidth(icon)) }) : null;
|
|
92
|
+
const contentBox = (_jsx("div", { style: { flex: '1 1 220px', minWidth: 0 }, children: others.map((element) => elementFactory.build(stripWidth(element))) }));
|
|
93
|
+
return (_jsx(PbContainer, { "data-pb-component": component.id, style: component.styles, children: _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: elementGap, flexWrap: 'wrap' }, children: [layout === 'icon-left' ? iconBox : contentBox, layout === 'icon-left' ? contentBox : iconBox] }) }));
|
|
94
|
+
}
|
|
95
|
+
if (layout === 'icon-top') {
|
|
96
|
+
const icon = elements.find((element) => element.elementType === 'icon');
|
|
97
|
+
const others = elements.filter((element) => element !== icon);
|
|
98
|
+
return (_jsx(PbContainer, { "data-pb-component": component.id, style: component.styles, children: _jsxs("div", { style: { textAlign: 'center', display: 'flex', flexDirection: 'column', gap: elementGap }, children: [icon && _jsx("div", { style: { display: 'inline-block' }, children: elementFactory.build(centerStyles(icon)) }), _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: elementGap }, children: others.map((element) => elementFactory.build(centerStyles(element))) })] }) }));
|
|
99
|
+
}
|
|
100
|
+
return (_jsx(PbContainer, { style: component.styles, children: _jsx(PbRow, { id: "element-row", style: rowGapStyle, children: elements.map((element) => elementFactory.build(element)) }) }));
|
|
76
101
|
});
|
|
77
102
|
export { CardComponent };
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useEffect, useMemo } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { PbContainer } from '../ui/PbContainer.js';
|
|
4
|
+
import { PbRow } from '../ui/PbRow.js';
|
|
4
5
|
import { UseFormStore } from '../stores/UseFormStore.js';
|
|
5
6
|
import { ElementFactory } from '../factories/ElementFactory.js';
|
|
6
7
|
import { orderBySort } from '../utils/orderBySort.js';
|
|
7
8
|
const elementFactory = new ElementFactory();
|
|
8
9
|
const FormComponent = memo(function FormComponent({ component }) {
|
|
9
10
|
const registerForm = UseFormStore((state) => state.registerForm);
|
|
11
|
+
const properties = component.properties;
|
|
10
12
|
useEffect(() => {
|
|
11
|
-
registerForm(component.id
|
|
12
|
-
|
|
13
|
+
registerForm(component.id, {
|
|
14
|
+
recipient: typeof properties.recipient === 'string' ? properties.recipient : undefined,
|
|
15
|
+
subject: typeof properties.subject === 'string' ? properties.subject : undefined
|
|
16
|
+
});
|
|
17
|
+
}, [registerForm, component.id, properties.recipient, properties.subject]);
|
|
13
18
|
const elements = useMemo(() => orderBySort(component.elements), [component.elements]);
|
|
14
19
|
const handleSubmit = (event) => {
|
|
15
20
|
event.preventDefault();
|
|
16
21
|
};
|
|
17
|
-
return (_jsx(
|
|
22
|
+
return (_jsx(PbContainer, { "data-pb-component": component.id, style: component.styles, children: _jsx("form", { onSubmit: handleSubmit, noValidate: true, children: _jsx(PbRow, { children: elements.map((element) => elementFactory.build(element, component.id)) }) }) }));
|
|
18
23
|
});
|
|
19
24
|
export { FormComponent };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ComponentType } from '../types/ComponentType.js';
|
|
2
|
-
|
|
2
|
+
declare const IconComponent: import("react").NamedExoticComponent<{
|
|
3
3
|
readonly component: ComponentType;
|
|
4
|
-
}
|
|
4
|
+
}>;
|
|
5
|
+
export { IconComponent };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
3
|
+
import { PbContainer } from '../ui/PbContainer.js';
|
|
4
|
+
import { PbRow } from '../ui/PbRow.js';
|
|
5
|
+
import { ElementFactory } from '../factories/ElementFactory.js';
|
|
6
|
+
import { orderBySort } from '../utils/orderBySort.js';
|
|
7
|
+
const elementFactory = new ElementFactory();
|
|
8
|
+
const IconComponent = memo(function IconComponent({ component }) {
|
|
9
|
+
const elements = useMemo(() => orderBySort(component.elements), [component.elements]);
|
|
10
|
+
return (_jsx(PbContainer, { "data-pb-component": component.id, style: component.styles, children: _jsx(PbRow, { id: "element-row", style: { justifyContent: 'center' }, children: elements.map((element) => elementFactory.build(element)) }) }));
|
|
11
|
+
});
|
|
12
|
+
export { IconComponent };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
3
|
+
import { PbContainer } from '../ui/PbContainer.js';
|
|
4
|
+
import { PbRow } from '../ui/PbRow.js';
|
|
5
|
+
import { ElementFactory } from '../factories/ElementFactory.js';
|
|
6
|
+
import { orderBySort } from '../utils/orderBySort.js';
|
|
7
|
+
import { resolveImageElement } from '../utils/imageCustomization.js';
|
|
8
|
+
import { getBoolean } from '../utils/propertyUtils.js';
|
|
9
|
+
const elementFactory = new ElementFactory();
|
|
10
|
+
const ImageComponent = memo(function ImageComponent({ component }) {
|
|
11
|
+
const fullBleed = getBoolean(component.properties, 'fullBleed', false);
|
|
12
|
+
const elements = useMemo(() => orderBySort(component.elements).map((element) => resolveImageElement(component, element)), [component.elements, component.properties]);
|
|
13
|
+
if (fullBleed) {
|
|
14
|
+
return (_jsx("div", { "data-pb-component": component.id, style: Object.assign(Object.assign({}, component.styles), { width: 'calc(100% + var(--pb-gutter, 1.5rem))', marginLeft: 'calc(var(--pb-gutter, 1.5rem) * -0.5)', marginRight: 'calc(var(--pb-gutter, 1.5rem) * -0.5)' }), children: elements.map((element) => elementFactory.build(Object.assign(Object.assign({}, element), { fullBleed: true }))) }));
|
|
15
|
+
}
|
|
16
|
+
return (_jsx(PbContainer, { "data-pb-component": component.id, style: component.styles, children: _jsx(PbRow, { id: "element-row", children: elements.map((element) => elementFactory.build(element)) }) }));
|
|
17
|
+
});
|
|
18
|
+
export { ImageComponent };
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from 'react';
|
|
3
|
-
import { Col } from 'react-bootstrap';
|
|
4
3
|
import { ElementFactory } from '../factories/ElementFactory.js';
|
|
5
4
|
import { ElementTypeEnum } from '../constants/ElementEnum.js';
|
|
6
5
|
import { orderBySort } from '../utils/orderBySort.js';
|
|
7
6
|
const elementFactory = new ElementFactory();
|
|
8
7
|
const ListComponent = memo(function ListComponent({ component }) {
|
|
9
8
|
const elements = useMemo(() => orderBySort(component.elements), [component.elements]);
|
|
9
|
+
const properties = component.properties || {};
|
|
10
|
+
const itemFontSize = String(properties.itemFontSize || '22px');
|
|
11
|
+
const itemGap = String(properties.itemGap || '8px');
|
|
12
|
+
const itemAlign = String(properties.itemAlign || 'center');
|
|
10
13
|
const items = useMemo(() => {
|
|
11
14
|
const result = [];
|
|
12
15
|
for (let i = 0; i < elements.length; i++) {
|
|
@@ -24,6 +27,6 @@ const ListComponent = memo(function ListComponent({ component }) {
|
|
|
24
27
|
}
|
|
25
28
|
return result;
|
|
26
29
|
}, [elements]);
|
|
27
|
-
return (_jsx(
|
|
30
|
+
return (_jsx("div", { "data-pb-component": component.id, style: component.styles, children: _jsx("ul", { style: { listStyle: 'none', paddingLeft: 0 }, children: items.map(({ icon, text, id }) => (_jsxs("li", { style: { display: 'flex', alignItems: 'center', justifyContent: itemAlign, marginBottom: itemGap }, children: [_jsx("span", { children: elementFactory.build(icon) }), _jsx("span", { style: { fontSize: itemFontSize }, children: text ? elementFactory.build(text) : null })] }, id))) }) }));
|
|
28
31
|
});
|
|
29
32
|
export { ListComponent };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { PbSpinner } from '../ui/PbSpinner.js';
|
|
3
3
|
export function LoadingComponent() {
|
|
4
|
-
return (_jsxs(
|
|
4
|
+
return (_jsxs("div", { className: "pb-loading", children: [_jsx("output", { "aria-busy": "true", children: _jsx(PbSpinner, {}) }), _jsx("p", { className: "pb-mb-0", children: "LOADING" })] }));
|
|
5
5
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { Row, Col } from 'react-bootstrap';
|
|
4
3
|
const COORDS_PATTERN = /^-?\d+(\.\d+)?$/;
|
|
5
4
|
function isValidCoord(value) {
|
|
6
5
|
if (typeof value !== 'string')
|
|
@@ -8,7 +7,7 @@ function isValidCoord(value) {
|
|
|
8
7
|
return COORDS_PATTERN.test(value.trim()) && Math.abs(Number(value)) <= 180;
|
|
9
8
|
}
|
|
10
9
|
export function MapComponent({ component }) {
|
|
11
|
-
const { lat, lng, zoom = 15, height = '400px' } = component.properties;
|
|
10
|
+
const { lat, lng, zoom = 15, height = '400px', placeholderBackgroundColor = '#e0e0e0', placeholderTextColor = '#666' } = component.properties;
|
|
12
11
|
const src = useMemo(() => {
|
|
13
12
|
if (!lat || !lng)
|
|
14
13
|
return null;
|
|
@@ -19,14 +18,14 @@ export function MapComponent({ component }) {
|
|
|
19
18
|
}
|
|
20
19
|
return `https://maps.google.com/maps?q=${encodeURIComponent(`${latStr},${lngStr}`)}&z=${zoom}&output=embed`;
|
|
21
20
|
}, [lat, lng, zoom]);
|
|
22
|
-
return (_jsx(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
return (_jsx("div", { "data-pb-component": component.id, style: component.styles, children: src ? (_jsx("iframe", { title: "Localiza\u00E7\u00E3o", src: src, width: "100%", height: height, style: { border: 0, borderRadius: '4px' }, allowFullScreen: true, loading: "lazy", referrerPolicy: "no-referrer-when-downgrade" })) : (_jsx("div", { style: {
|
|
22
|
+
width: '100%',
|
|
23
|
+
height,
|
|
24
|
+
backgroundColor: placeholderBackgroundColor,
|
|
25
|
+
display: 'flex',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
justifyContent: 'center',
|
|
28
|
+
borderRadius: '4px',
|
|
29
|
+
color: placeholderTextColor
|
|
30
|
+
}, children: "Map not configured" })) }));
|
|
32
31
|
}
|