@brilo/base-blocks 0.1.16 → 0.1.18
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/build/.tsbuildinfo +1 -1
- package/build/blocks/signpost/signpost-item/index.js +1 -1
- package/build/blocks/usp/usp-group/constants.d.ts +48 -35
- package/build/blocks/usp/usp-group/constants.d.ts.map +1 -1
- package/build/blocks/usp/usp-group/constants.js +27 -17
- package/build/blocks/usp/usp-group/edit.d.ts.map +1 -1
- package/build/blocks/usp/usp-group/edit.js +10 -7
- package/build/blocks/usp/usp-group/factory.d.ts +2 -2
- package/build/blocks/usp/usp-group/factory.d.ts.map +1 -1
- package/build/blocks/usp/usp-group/factory.js +27 -19
- package/build/blocks/usp/usp-group/types.d.ts +19 -13
- package/build/blocks/usp/usp-group/types.d.ts.map +1 -1
- package/build/blocks/usp/usp-item/buildPreviewStyle.d.ts +25 -0
- package/build/blocks/usp/usp-item/buildPreviewStyle.d.ts.map +1 -0
- package/build/blocks/usp/usp-item/buildPreviewStyle.js +30 -0
- package/build/blocks/usp/usp-item/edit.d.ts +5 -1
- package/build/blocks/usp/usp-item/edit.d.ts.map +1 -1
- package/build/blocks/usp/usp-item/edit.js +7 -3
- package/build/blocks/usp/usp-item/factory.d.ts.map +1 -1
- package/build/blocks/usp/usp-item/factory.js +1 -0
- package/build/components/ItemIconControl/ItemIconPreview.d.ts +1 -1
- package/build/components/ItemIconControl/ItemIconPreview.d.ts.map +1 -1
- package/build/components/ItemIconControl/ItemIconPreview.js +4 -4
- package/package.json +1 -1
- package/src/blocks/groups/text-and-media-group/editor.scss +14 -0
- package/src/blocks/signpost/signpost-item/index.ts +1 -1
- package/src/blocks/usp/usp-group/constants.ts +29 -17
- package/src/blocks/usp/usp-group/edit.tsx +109 -34
- package/src/blocks/usp/usp-group/factory.tsx +19 -27
- package/src/blocks/usp/usp-group/types.ts +22 -16
- package/src/blocks/usp/usp-item/buildPreviewStyle.ts +66 -0
- package/src/blocks/usp/usp-item/edit.tsx +15 -2
- package/src/blocks/usp/usp-item/editor.scss +140 -1
- package/src/blocks/usp/usp-item/factory.tsx +1 -0
- package/src/components/ItemIconControl/ItemIconPreview.tsx +4 -4
- package/src/components/ItemIconControl/types.d.ts +2 -0
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
.i-usp {
|
|
2
2
|
width: 100%;
|
|
3
3
|
margin-inline: 0;
|
|
4
|
+
text-align: var(--text-align, left);
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
|
|
7
|
+
&.--shadow {
|
|
8
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&.--shadow-md {
|
|
12
|
+
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&.--border {
|
|
16
|
+
border: 1px solid var(--border-color, transparent);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.--background-color {
|
|
20
|
+
background-color: var(--background-color, transparent);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.--text-color {
|
|
24
|
+
color: var(--text-color);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.i-usp__inner {
|
|
29
|
+
display: flex;
|
|
30
|
+
gap: 8px;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
align-items: flex-start;
|
|
33
|
+
|
|
34
|
+
.i-usp.--direction-horizontal & {
|
|
35
|
+
flex-direction: row;
|
|
36
|
+
align-items: center;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.i-usp.--align-center & {
|
|
40
|
+
align-items: center;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.i-usp__body {
|
|
45
|
+
text-align: var(--body-text-align, inherit);
|
|
4
46
|
}
|
|
5
47
|
|
|
6
48
|
.i-usp__title {
|
|
@@ -11,7 +53,104 @@
|
|
|
11
53
|
|
|
12
54
|
.i-usp__content {
|
|
13
55
|
font-size: 14px;
|
|
14
|
-
color:
|
|
56
|
+
color: var(--text-color);
|
|
15
57
|
margin: 0;
|
|
16
58
|
line-height: 1.5;
|
|
17
59
|
}
|
|
60
|
+
|
|
61
|
+
.i-usp__icon {
|
|
62
|
+
--icon-box-size: max(var(--icon-background-size, 88px), var(--icon-size, 88px));
|
|
63
|
+
|
|
64
|
+
width: var(--icon-box-size);
|
|
65
|
+
height: var(--icon-box-size);
|
|
66
|
+
flex: 0 0 var(--icon-box-size);
|
|
67
|
+
display: grid;
|
|
68
|
+
grid-template-areas: "pile";
|
|
69
|
+
place-items: center;
|
|
70
|
+
isolation: isolate;
|
|
71
|
+
|
|
72
|
+
&::before,
|
|
73
|
+
&::after {
|
|
74
|
+
content: "";
|
|
75
|
+
grid-area: pile;
|
|
76
|
+
width: var(--icon-background-size, 88px);
|
|
77
|
+
height: var(--icon-background-size, 88px);
|
|
78
|
+
border-radius: inherit;
|
|
79
|
+
clip-path: var(--icon-background-shape, none);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&::before {
|
|
83
|
+
z-index: 0;
|
|
84
|
+
background-color: var(--icon-outline-color, transparent);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&::after {
|
|
88
|
+
z-index: 1;
|
|
89
|
+
width: calc(var(--icon-background-size, 88px) - var(--icon-outline-width, 0px) * 2);
|
|
90
|
+
height: calc(var(--icon-background-size, 88px) - var(--icon-outline-width, 0px) * 2);
|
|
91
|
+
background-color: var(--icon-background-color, transparent);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
img,
|
|
95
|
+
svg,
|
|
96
|
+
span {
|
|
97
|
+
grid-area: pile;
|
|
98
|
+
position: relative;
|
|
99
|
+
z-index: 2;
|
|
100
|
+
width: var(--icon-size, 88px);
|
|
101
|
+
height: var(--icon-size, 88px);
|
|
102
|
+
object-fit: contain;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
svg path {
|
|
106
|
+
fill: var(--icon-color, currentcolor);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
span {
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
color: var(--icon-color, currentcolor);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&.--background-shape-circle {
|
|
117
|
+
--icon-background-shape: circle(50% at 50% 50%);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&.--background-shape-triangle {
|
|
121
|
+
--icon-background-shape: polygon(50% 0%, 0% 100%, 100% 100%);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&.--background-shape-rhombus {
|
|
125
|
+
--icon-background-shape: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&.--background-shape-octagon {
|
|
129
|
+
--icon-background-shape: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&.--background-shape-bevel {
|
|
133
|
+
--icon-background-shape: polygon(20% 0%, 80% 0%, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0% 80%, 0% 20%);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&.--background-shape-rabbet {
|
|
137
|
+
--icon-background-shape: polygon(
|
|
138
|
+
0% 15%,
|
|
139
|
+
15% 15%,
|
|
140
|
+
15% 0%,
|
|
141
|
+
85% 0%,
|
|
142
|
+
85% 15%,
|
|
143
|
+
100% 15%,
|
|
144
|
+
100% 85%,
|
|
145
|
+
85% 85%,
|
|
146
|
+
85% 100%,
|
|
147
|
+
15% 100%,
|
|
148
|
+
15% 85%,
|
|
149
|
+
0% 85%
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&.--background-shape-parallelogram {
|
|
154
|
+
--icon-background-shape: polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -15,6 +15,7 @@ export function createUspItemBlock(options: UspItemOptions): BlockConfiguration<
|
|
|
15
15
|
...(options.parent && {parent: options.parent}),
|
|
16
16
|
icon: options.icon ?? 'star-filled',
|
|
17
17
|
supports: {html: false, customClassName: false},
|
|
18
|
+
usesContext: ['brilo/usp-style'],
|
|
18
19
|
attributes: {
|
|
19
20
|
title: {type: 'string', default: ''},
|
|
20
21
|
content: {type: 'string', default: ''},
|
|
@@ -4,7 +4,7 @@ import {useMediaUrl} from '~/components/ImagePicker'
|
|
|
4
4
|
import type {ItemIconPreviewProps} from './types'
|
|
5
5
|
import {ItemIconModal} from './ItemIconModal'
|
|
6
6
|
|
|
7
|
-
export function ItemIconPreview({icon, className, options, setAttributes}: ItemIconPreviewProps) {
|
|
7
|
+
export function ItemIconPreview({icon, className, modifierClassName, style, options, setAttributes}: ItemIconPreviewProps) {
|
|
8
8
|
const [isModalOpen, setModalOpen] = useState(false)
|
|
9
9
|
const mediaIconUrl = useMediaUrl(icon.media?.id ?? 0)
|
|
10
10
|
const preselectedIconUrl = icon.type === 'preselected' && icon.src ? `${options.iconsSrc}${icon.src}.svg` : ''
|
|
@@ -13,7 +13,7 @@ export function ItemIconPreview({icon, className, options, setAttributes}: ItemI
|
|
|
13
13
|
if (icon.type === 'preselected') {
|
|
14
14
|
if (preselectedIconUrl) {
|
|
15
15
|
return (
|
|
16
|
-
<div className={clsx('i-item-icon', className)}>
|
|
16
|
+
<div className={clsx('i-item-icon', className, modifierClassName)} style={style}>
|
|
17
17
|
<img
|
|
18
18
|
src={preselectedIconUrl}
|
|
19
19
|
alt=""
|
|
@@ -43,7 +43,7 @@ export function ItemIconPreview({icon, className, options, setAttributes}: ItemI
|
|
|
43
43
|
if (icon.type === 'media') {
|
|
44
44
|
if (icon.media?.id && mediaIconUrl) {
|
|
45
45
|
return (
|
|
46
|
-
<div className={clsx('i-item-icon', className)}>
|
|
46
|
+
<div className={clsx('i-item-icon', className, modifierClassName)} style={style}>
|
|
47
47
|
<img src={mediaIconUrl} alt={icon.media.alt} className={clsx(className ? `${className}-img` : null, 'i-item-icon__img')} />
|
|
48
48
|
</div>
|
|
49
49
|
)
|
|
@@ -58,7 +58,7 @@ export function ItemIconPreview({icon, className, options, setAttributes}: ItemI
|
|
|
58
58
|
if (icon.type === 'number') {
|
|
59
59
|
if (icon.src) {
|
|
60
60
|
return (
|
|
61
|
-
<div className={clsx('i-item-icon', className)}>
|
|
61
|
+
<div className={clsx('i-item-icon', className, modifierClassName)} style={style}>
|
|
62
62
|
<span className={clsx(className ? `${className}-number` : 'i-item-icon__number')}>{icon.src}</span>
|
|
63
63
|
</div>
|
|
64
64
|
)
|
|
@@ -17,6 +17,8 @@ export interface ItemIconControlProps {
|
|
|
17
17
|
export interface ItemIconPreviewProps {
|
|
18
18
|
icon: Icon
|
|
19
19
|
className?: string
|
|
20
|
+
modifierClassName?: string
|
|
21
|
+
style?: Record<string, string>
|
|
20
22
|
options: ItemIconOptions
|
|
21
23
|
setAttributes: (attributes: {icon: Icon}) => void
|
|
22
24
|
}
|