@brilo/base-blocks 0.1.48 → 0.1.49
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/contact/contact-group/edit.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/contact/contact-group/edit.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAGV,sBAAsB,EACtB,mBAAmB,EAKpB,MAAM,SAAS,CAAA;AA+BhB,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,oCAW9D;IACD,UAAU,EAAE,sBAAsB,CAAA;IAClC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAA;CAC5D,iCAyMF"}
|
|
@@ -6,7 +6,7 @@ import clsx from 'clsx';
|
|
|
6
6
|
import { ItemSpacingPanel, itemSpacingStyle } from '../../../components/ItemSpacingControl';
|
|
7
7
|
import { useGroupBlock } from '../../../hooks/useGroupBlock';
|
|
8
8
|
import { useTenantColorPalette } from '../../../hooks/useTenantColorPalette';
|
|
9
|
-
import { CONTACT_COLUMNS, DEFAULT_DIRECTIONS, DEFAULT_ICON_BACKGROUND_SHAPES, DEFAULT_ICON_BACKGROUND_SIZE_PRESETS, DEFAULT_ICON_SIZE_PRESETS, DEFAULT_SHADOWS, ICON_BACKGROUND_SIZE_MAX, ICON_BACKGROUND_SIZE_MIN, ICON_SIZE_MAX, ICON_SIZE_MIN, TEXT_ALIGNS, } from './constants';
|
|
9
|
+
import { CONTACT_COLUMNS, DEFAULT_DIRECTIONS, DEFAULT_ICON_BACKGROUND_SHAPES, DEFAULT_ICON_BACKGROUND_SIZE, DEFAULT_ICON_BACKGROUND_SIZE_PRESETS, DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE_PRESETS, DEFAULT_SHADOWS, ICON_BACKGROUND_SIZE_MAX, ICON_BACKGROUND_SIZE_MIN, ICON_SIZE_MAX, ICON_SIZE_MIN, TEXT_ALIGNS, } from './constants';
|
|
10
10
|
function PresetSizeControl({ label, value, presets, min, max, onChange, }) {
|
|
11
11
|
return (_jsxs(BaseControl, { label: label, id: `contact-group-size-${label}`, children: [_jsx("div", { style: { display: 'flex', gap: 4, marginBottom: 8, flexWrap: 'wrap' }, children: presets.map((p) => (_jsx(Button, { variant: value === p.value ? 'primary' : 'secondary', size: "small", onClick: () => onChange(p.value), children: p.label }, p.label))) }), _jsx(RangeControl, { value: value, onChange: (v) => onChange(v !== null && v !== void 0 ? v : min), min: min, max: max, step: 1, withInputField: true })] }));
|
|
12
12
|
}
|
|
@@ -20,8 +20,28 @@ export function createContactGroupEdit(options) {
|
|
|
20
20
|
const ICON_BACKGROUND_SHAPES = (_f = options.iconBackgroundShapes) !== null && _f !== void 0 ? _f : DEFAULT_ICON_BACKGROUND_SHAPES;
|
|
21
21
|
return function Edit({ attributes, setAttributes, }) {
|
|
22
22
|
var _a, _b;
|
|
23
|
-
const { columns, groupBackgroundColor,
|
|
23
|
+
const { columns, groupBackgroundColor, spacing } = attributes;
|
|
24
24
|
const { paletteColors, resolveHex } = useTenantColorPalette();
|
|
25
|
+
const savedStyle = attributes.style;
|
|
26
|
+
const style = {
|
|
27
|
+
shadow: SHADOWS[0].value,
|
|
28
|
+
direction: DIRECTIONS[0].value,
|
|
29
|
+
textAlign: 'left',
|
|
30
|
+
borderColor: '',
|
|
31
|
+
backgroundColor: '',
|
|
32
|
+
textColor: '',
|
|
33
|
+
...savedStyle,
|
|
34
|
+
icon: {
|
|
35
|
+
size: DEFAULT_ICON_SIZE,
|
|
36
|
+
color: '',
|
|
37
|
+
background: '',
|
|
38
|
+
backgroundSize: DEFAULT_ICON_BACKGROUND_SIZE,
|
|
39
|
+
backgroundShape: ICON_BACKGROUND_SHAPES[0].value,
|
|
40
|
+
borderColor: '',
|
|
41
|
+
borderWidth: 1,
|
|
42
|
+
...savedStyle === null || savedStyle === void 0 ? void 0 : savedStyle.icon,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
25
45
|
const { blockProps, innerBlocksProps } = useGroupBlock({
|
|
26
46
|
blockClassName: clsx((_a = options.blockClassName) !== null && _a !== void 0 ? _a : 'g-contact wp-block-section', `--direction-${style.direction}`, groupBackgroundColor && '--group-background', spacing === 0 && '--connected'),
|
|
27
47
|
containerClassName: [(_b = options.containerClassName) !== null && _b !== void 0 ? _b : 'g-contact__items', `--cols-${columns}`],
|
package/package.json
CHANGED
|
@@ -19,7 +19,9 @@ import {
|
|
|
19
19
|
CONTACT_COLUMNS,
|
|
20
20
|
DEFAULT_DIRECTIONS,
|
|
21
21
|
DEFAULT_ICON_BACKGROUND_SHAPES,
|
|
22
|
+
DEFAULT_ICON_BACKGROUND_SIZE,
|
|
22
23
|
DEFAULT_ICON_BACKGROUND_SIZE_PRESETS,
|
|
24
|
+
DEFAULT_ICON_SIZE,
|
|
23
25
|
DEFAULT_ICON_SIZE_PRESETS,
|
|
24
26
|
DEFAULT_SHADOWS,
|
|
25
27
|
ICON_BACKGROUND_SIZE_MAX,
|
|
@@ -83,9 +85,30 @@ export function createContactGroupEdit(options: ContactGroupOptions) {
|
|
|
83
85
|
attributes: ContactGroupAttributes
|
|
84
86
|
setAttributes: (a: Partial<ContactGroupAttributes>) => void
|
|
85
87
|
}) {
|
|
86
|
-
const {columns, groupBackgroundColor,
|
|
88
|
+
const {columns, groupBackgroundColor, spacing} = attributes
|
|
87
89
|
const {paletteColors, resolveHex} = useTenantColorPalette()
|
|
88
90
|
|
|
91
|
+
const savedStyle = attributes.style as Partial<ContactGroupAttributes['style']> | undefined
|
|
92
|
+
const style: ContactGroupAttributes['style'] = {
|
|
93
|
+
shadow: SHADOWS[0].value,
|
|
94
|
+
direction: DIRECTIONS[0].value,
|
|
95
|
+
textAlign: 'left',
|
|
96
|
+
borderColor: '',
|
|
97
|
+
backgroundColor: '',
|
|
98
|
+
textColor: '',
|
|
99
|
+
...savedStyle,
|
|
100
|
+
icon: {
|
|
101
|
+
size: DEFAULT_ICON_SIZE,
|
|
102
|
+
color: '',
|
|
103
|
+
background: '',
|
|
104
|
+
backgroundSize: DEFAULT_ICON_BACKGROUND_SIZE,
|
|
105
|
+
backgroundShape: ICON_BACKGROUND_SHAPES[0].value,
|
|
106
|
+
borderColor: '',
|
|
107
|
+
borderWidth: 1,
|
|
108
|
+
...savedStyle?.icon,
|
|
109
|
+
},
|
|
110
|
+
}
|
|
111
|
+
|
|
89
112
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
90
113
|
blockClassName: clsx(
|
|
91
114
|
options.blockClassName ?? 'g-contact wp-block-section',
|