@redneckz/wildless-cms-uni-blocks 0.14.87 → 0.14.89
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/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +12 -5
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/StepsBlock/getIconTextStyle.d.ts +2 -0
- package/bundle/components/Tabs/TabActivationEvent.d.ts +1 -0
- package/bundle/components/Tabs/TabsContent.d.ts +2 -0
- package/bundle/model/ContentPageDef.d.ts +1 -0
- package/dist/components/StepsBlock/StepsBlock.js +2 -2
- package/dist/components/StepsBlock/StepsBlock.js.map +1 -1
- package/dist/components/StepsBlock/StepsBlock.mobile.js +10 -9
- package/dist/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
- package/dist/components/StepsBlock/getIconTextStyle.d.ts +2 -0
- package/dist/components/StepsBlock/getIconTextStyle.js +5 -0
- package/dist/components/StepsBlock/getIconTextStyle.js.map +1 -0
- package/dist/components/Tabs/TabActivationEvent.d.ts +1 -0
- package/dist/components/Tabs/Tabs.js +6 -2
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tabs/TabsContent.d.ts +2 -0
- package/dist/model/ContentPageDef.d.ts +1 -0
- package/dist/ui-kit/BlockWrapper.js +3 -1
- package/dist/ui-kit/BlockWrapper.js.map +1 -1
- package/lib/components/StepsBlock/StepsBlock.js +1 -1
- package/lib/components/StepsBlock/StepsBlock.js.map +1 -1
- package/lib/components/StepsBlock/StepsBlock.mobile.js +10 -9
- package/lib/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
- package/lib/components/StepsBlock/getIconTextStyle.d.ts +2 -0
- package/lib/components/StepsBlock/getIconTextStyle.js +2 -0
- package/lib/components/StepsBlock/getIconTextStyle.js.map +1 -0
- package/lib/components/Tabs/TabActivationEvent.d.ts +1 -0
- package/lib/components/Tabs/Tabs.js +6 -2
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/Tabs/TabsContent.d.ts +2 -0
- package/lib/model/ContentPageDef.d.ts +1 -0
- package/lib/ui-kit/BlockWrapper.js +3 -1
- package/lib/ui-kit/BlockWrapper.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +21 -13
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/StepsBlock/getIconTextStyle.d.ts +2 -0
- package/mobile/bundle/components/Tabs/TabActivationEvent.d.ts +1 -0
- package/mobile/bundle/components/Tabs/TabsContent.d.ts +2 -0
- package/mobile/bundle/model/ContentPageDef.d.ts +1 -0
- package/mobile/dist/components/StepsBlock/StepsBlock.js +10 -9
- package/mobile/dist/components/StepsBlock/StepsBlock.js.map +1 -1
- package/mobile/dist/components/StepsBlock/getIconTextStyle.d.ts +2 -0
- package/mobile/dist/components/StepsBlock/getIconTextStyle.js +5 -0
- package/mobile/dist/components/StepsBlock/getIconTextStyle.js.map +1 -0
- package/mobile/dist/components/Tabs/TabActivationEvent.d.ts +1 -0
- package/mobile/dist/components/Tabs/Tabs.js +6 -2
- package/mobile/dist/components/Tabs/Tabs.js.map +1 -1
- package/mobile/dist/components/Tabs/TabsContent.d.ts +2 -0
- package/mobile/dist/model/ContentPageDef.d.ts +1 -0
- package/mobile/dist/ui-kit/BlockWrapper.js +3 -1
- package/mobile/dist/ui-kit/BlockWrapper.js.map +1 -1
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/StepsBlock/StepsBlock.js +10 -9
- package/mobile/lib/components/StepsBlock/StepsBlock.js.map +1 -1
- package/mobile/lib/components/StepsBlock/getIconTextStyle.d.ts +2 -0
- package/mobile/lib/components/StepsBlock/getIconTextStyle.js +2 -0
- package/mobile/lib/components/StepsBlock/getIconTextStyle.js.map +1 -0
- package/mobile/lib/components/Tabs/TabActivationEvent.d.ts +1 -0
- package/mobile/lib/components/Tabs/Tabs.js +6 -2
- package/mobile/lib/components/Tabs/Tabs.js.map +1 -1
- package/mobile/lib/components/Tabs/TabsContent.d.ts +2 -0
- package/mobile/lib/model/ContentPageDef.d.ts +1 -0
- package/mobile/lib/ui-kit/BlockWrapper.js +3 -1
- package/mobile/lib/ui-kit/BlockWrapper.js.map +1 -1
- package/mobile/src/components/StepsBlock/StepsBlock.tsx +45 -33
- package/mobile/src/components/StepsBlock/getIconTextStyle.ts +4 -0
- package/mobile/src/components/Tabs/TabActivationEvent.ts +1 -0
- package/mobile/src/components/Tabs/Tabs.tsx +6 -2
- package/mobile/src/components/Tabs/TabsContent.ts +2 -0
- package/mobile/src/model/ContentPageDef.ts +1 -0
- package/mobile/src/ui-kit/BlockWrapper.tsx +5 -3
- package/package.json +1 -1
- package/src/components/StepsBlock/StepsBlock.fixture.mobile.tsx +4 -0
- package/src/components/StepsBlock/StepsBlock.mobile.tsx +45 -33
- package/src/components/StepsBlock/StepsBlock.tsx +1 -3
- package/src/components/StepsBlock/getIconTextStyle.ts +4 -0
- package/src/components/Tabs/TabActivationEvent.ts +1 -0
- package/src/components/Tabs/Tabs.tsx +6 -2
- package/src/components/Tabs/TabsContent.ts +2 -0
- package/src/model/ContentPageDef.ts +1 -0
- package/src/ui-kit/BlockWrapper.tsx +5 -3
|
@@ -14,7 +14,9 @@ export const BlockWrapper = JSX(({ className, version = 'primary', isTheme = tru
|
|
|
14
14
|
const Tag = tag;
|
|
15
15
|
const [isHidden, setHidden] = useState(false);
|
|
16
16
|
useEffect(() => defaultEventBus.subscribe('tab', (event) => {
|
|
17
|
-
|
|
17
|
+
if (!event.groupName || event.groupName === block?.labelGroup) {
|
|
18
|
+
setHidden(Boolean(event.label && block?.labels?.length && !block.labels.includes(event.label)));
|
|
19
|
+
}
|
|
18
20
|
}), [block]);
|
|
19
21
|
const isGroup = version && isTheme;
|
|
20
22
|
return (_jsx(Tag, { className: style('@container font-sans', isGroup ? 'group' : '', blockStyles[version], isHidden ? 'hidden' : '', padding || defaultPadding, className), ...(isGroup ? { 'data-ver': version } : {}), ...(block?.anchor ? { id: block.anchor } : {}), role: role, children: children }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockWrapper.js","sourceRoot":"","sources":["../../src/ui-kit/BlockWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAOvC,MAAM,CAAC,MAAM,WAAW,GAAiC;IACvD,OAAO,EAAE,4BAA4B;IACrC,SAAS,EAAE,4BAA4B;IACvC,IAAI,EAAE,mCAAmC;IACzC,WAAW,EAAE,kCAAkC;IAC/C,EAAE,EAAE,EAAE;CACP,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAC7B,CAAC,EACC,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,OAAO,GAAG,IAAI,EACd,cAAc,GAAG,MAAM,EACvB,OAAO,EACP,KAAK,EACL,GAAG,GAAG,SAAS,EACf,IAAI,EACJ,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,GAAG,GAAQ,GAAG,CAAC;IAErB,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,SAAS,CACP,GAAG,EAAE,CACH,eAAe,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;QACzC,SAAS,CACP,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CACrF,CAAC;
|
|
1
|
+
{"version":3,"file":"BlockWrapper.js","sourceRoot":"","sources":["../../src/ui-kit/BlockWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAOvC,MAAM,CAAC,MAAM,WAAW,GAAiC;IACvD,OAAO,EAAE,4BAA4B;IACrC,SAAS,EAAE,4BAA4B;IACvC,IAAI,EAAE,mCAAmC;IACzC,WAAW,EAAE,kCAAkC;IAC/C,EAAE,EAAE,EAAE;CACP,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAC7B,CAAC,EACC,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,OAAO,GAAG,IAAI,EACd,cAAc,GAAG,MAAM,EACvB,OAAO,EACP,KAAK,EACL,GAAG,GAAG,SAAS,EACf,IAAI,EACJ,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,GAAG,GAAQ,GAAG,CAAC;IAErB,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,SAAS,CACP,GAAG,EAAE,CACH,eAAe,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;QACzC,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,KAAK,KAAK,EAAE,UAAU,EAAE;YAC7D,SAAS,CACP,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CACrF,CAAC;SACH;IACH,CAAC,CAAC,EACJ,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,MAAM,OAAO,GAAG,OAAO,IAAI,OAAO,CAAC;IAEnC,OAAO,CACL,KAAC,GAAG,IACF,SAAS,EAAE,KAAK,CACd,sBAAsB,EACtB,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EACtB,WAAW,CAAC,OAAO,CAAC,EACpB,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EACxB,OAAO,IAAI,cAAc,EACzB,SAAS,CACV,KACG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KACxC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAC/C,IAAI,EAAE,IAAI,YAET,QAAQ,GACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -11,6 +11,7 @@ import { assertUnreachable } from '../../utils/assertUnreachable';
|
|
|
11
11
|
import { isIcon } from '../../utils/isIcon';
|
|
12
12
|
import { style } from '../../utils/style';
|
|
13
13
|
import { Headline } from '../Headline/Headline';
|
|
14
|
+
import { getIconTextStyle } from './getIconTextStyle';
|
|
14
15
|
import { type DefaultStep, type Step, type StepsBlockContent } from './StepsBlockContent';
|
|
15
16
|
import { STEPS_BLOCK_STYLE } from './StepsBlockStyleMaps';
|
|
16
17
|
|
|
@@ -38,6 +39,7 @@ export const StepsBlock = JSX<StepsBlockProps>(
|
|
|
38
39
|
steps,
|
|
39
40
|
buttons,
|
|
40
41
|
size = 'normal',
|
|
42
|
+
stepVersion = 'gray',
|
|
41
43
|
version = 'primary',
|
|
42
44
|
...rest
|
|
43
45
|
}) => (
|
|
@@ -57,7 +59,7 @@ export const StepsBlock = JSX<StepsBlockProps>(
|
|
|
57
59
|
{steps?.length ? (
|
|
58
60
|
<div className="box-border">
|
|
59
61
|
<div className="flex flex-col gap-6xl justify-between">
|
|
60
|
-
{steps.map(renderStep(size,
|
|
62
|
+
{steps.map(renderStep(size, stepVersion))}
|
|
61
63
|
</div>
|
|
62
64
|
</div>
|
|
63
65
|
) : null}
|
|
@@ -68,7 +70,7 @@ export const StepsBlock = JSX<StepsBlockProps>(
|
|
|
68
70
|
|
|
69
71
|
// TODO: Create universal function for this case
|
|
70
72
|
const renderStep =
|
|
71
|
-
(size: SizeVersion,
|
|
73
|
+
(size: SizeVersion, stepVersion: BlockVersion) =>
|
|
72
74
|
// Linter doesn't understand that switch processes all cases
|
|
73
75
|
// eslint-disable-next-line consistent-return
|
|
74
76
|
(step: Step, i: number) => {
|
|
@@ -80,7 +82,7 @@ const renderStep =
|
|
|
80
82
|
|
|
81
83
|
switch (type) {
|
|
82
84
|
case 'default':
|
|
83
|
-
return renderDefaultStep(size,
|
|
85
|
+
return renderDefaultStep(size, stepVersion)(step, i);
|
|
84
86
|
case 'rte':
|
|
85
87
|
return <RichText __html={step.__html} />;
|
|
86
88
|
default:
|
|
@@ -89,12 +91,12 @@ const renderStep =
|
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
const renderDefaultStep =
|
|
92
|
-
(size: SizeVersion,
|
|
94
|
+
(size: SizeVersion, stepVersion: BlockVersion) => (step: DefaultStep, i: number) =>
|
|
93
95
|
(
|
|
94
96
|
<div key={String(i)} className="contents">
|
|
95
97
|
<div className="flex flex-row text-center relative">
|
|
96
98
|
<div className="overflow-hidden flex flex-shrink-0 items-center">
|
|
97
|
-
{renderIconArea(size,
|
|
99
|
+
{renderIconArea(size, stepVersion)(step, i)}
|
|
98
100
|
</div>
|
|
99
101
|
<div
|
|
100
102
|
className={style(
|
|
@@ -117,33 +119,43 @@ const renderDefaultStep =
|
|
|
117
119
|
</div>
|
|
118
120
|
);
|
|
119
121
|
|
|
120
|
-
const renderIconArea =
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
const renderIconArea =
|
|
123
|
+
(size: SizeVersion, stepVersion: BlockVersion) => (step: Step, i: number) => {
|
|
124
|
+
const iconVersion = stepVersion === 'secondary' ? 'white' : 'color';
|
|
125
|
+
const isImg = Boolean(step?.icon?.src);
|
|
126
|
+
const iconAreaSize = STEPS_SIZE_MAP[size][isImg ? 'image' : 'icon'];
|
|
127
|
+
const containerStyle = isImg ? '' : 'rounded-md';
|
|
126
128
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
)}
|
|
134
|
-
>
|
|
135
|
-
<span className="flex max-w-full max-h-full self-center text-h4 text-secondary-text group-data-secondary:text-white">
|
|
136
|
-
{isIcon(step?.icon) ? (
|
|
137
|
-
<Img
|
|
138
|
-
image={{ ...step.icon, iconVersion: step.icon?.iconVersion || iconVersion }}
|
|
139
|
-
imageClassName="max-w-full max-h-full"
|
|
140
|
-
width={iconSize}
|
|
141
|
-
height={iconSize}
|
|
142
|
-
/>
|
|
143
|
-
) : (
|
|
144
|
-
<span>{i + 1}</span>
|
|
129
|
+
return (
|
|
130
|
+
<BlockWrapper
|
|
131
|
+
className={style(
|
|
132
|
+
iconAreaSize,
|
|
133
|
+
containerStyle,
|
|
134
|
+
'z-10 mr-s flex justify-center content-center',
|
|
145
135
|
)}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
136
|
+
version={stepVersion}
|
|
137
|
+
>
|
|
138
|
+
<span className="flex max-w-full max-h-full items-center justify-center">
|
|
139
|
+
{isIcon(step?.icon) ? (
|
|
140
|
+
<Img
|
|
141
|
+
image={{ ...step.icon, iconVersion: step.icon?.iconVersion || iconVersion }}
|
|
142
|
+
imageClassName="max-w-full max-h-full"
|
|
143
|
+
width={getIconSizeStyle(size)}
|
|
144
|
+
height={getIconSizeStyle(size)}
|
|
145
|
+
/>
|
|
146
|
+
) : (
|
|
147
|
+
<span
|
|
148
|
+
className={style(
|
|
149
|
+
'text-h4',
|
|
150
|
+
stepVersion === 'transparent' ? styleMap.iconText : getIconTextStyle(stepVersion),
|
|
151
|
+
)}
|
|
152
|
+
>
|
|
153
|
+
{i + 1}
|
|
154
|
+
</span>
|
|
155
|
+
)}
|
|
156
|
+
</span>
|
|
157
|
+
</BlockWrapper>
|
|
158
|
+
);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const getIconSizeStyle = (size: string) => (size === 'normal' ? '38' : '24');
|
|
@@ -40,7 +40,11 @@ export const Tabs = JSX<TabsBlockProps>(
|
|
|
40
40
|
const activeTab = tabs[activeTabIndex];
|
|
41
41
|
|
|
42
42
|
if (activeTab?.type === 'group') {
|
|
43
|
-
defaultEventBus.subject('tab', {
|
|
43
|
+
defaultEventBus.subject('tab', {
|
|
44
|
+
type: activeTab.type,
|
|
45
|
+
label: activeTab.ref,
|
|
46
|
+
groupName: activeTab.name,
|
|
47
|
+
});
|
|
44
48
|
}
|
|
45
49
|
}, [tabs, activeTabIndex]);
|
|
46
50
|
|
|
@@ -88,7 +92,7 @@ export const Tabs = JSX<TabsBlockProps>(
|
|
|
88
92
|
|
|
89
93
|
const fireTabEvent = (tab: TabData) => {
|
|
90
94
|
if (tab.type === 'group') {
|
|
91
|
-
defaultEventBus.fire('tab', { type: tab.type, label: tab.ref });
|
|
95
|
+
defaultEventBus.fire('tab', { type: tab.type, label: tab.ref, groupName: tab.name });
|
|
92
96
|
}
|
|
93
97
|
if (tab.type === 'link') {
|
|
94
98
|
defaultEventBus.fire('tab', { type: tab.type, label: tab.href });
|
|
@@ -37,9 +37,11 @@ export const BlockWrapper = JSX<BlockWrapperProps>(
|
|
|
37
37
|
useEffect(
|
|
38
38
|
() =>
|
|
39
39
|
defaultEventBus.subscribe('tab', (event) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
if (!event.groupName || event.groupName === block?.labelGroup) {
|
|
41
|
+
setHidden(
|
|
42
|
+
Boolean(event.label && block?.labels?.length && !block.labels.includes(event.label)),
|
|
43
|
+
);
|
|
44
|
+
}
|
|
43
45
|
}),
|
|
44
46
|
[block],
|
|
45
47
|
);
|
package/package.json
CHANGED
|
@@ -30,6 +30,7 @@ export default {
|
|
|
30
30
|
description="Откройте мультивалютный вклад, чтобы распределить свои вложения"
|
|
31
31
|
size="normal"
|
|
32
32
|
steps={steps}
|
|
33
|
+
stepVersion="secondary"
|
|
33
34
|
buttons={[
|
|
34
35
|
{
|
|
35
36
|
text: 'Отправить заявку',
|
|
@@ -49,6 +50,7 @@ export default {
|
|
|
49
50
|
title="Рассчитайте условия на онлайн-калькуляторе и оставьте заявку на потребительский кредит"
|
|
50
51
|
size="small"
|
|
51
52
|
steps={steps}
|
|
53
|
+
stepVersion="secondary"
|
|
52
54
|
/>
|
|
53
55
|
</div>
|
|
54
56
|
</div>
|
|
@@ -123,6 +125,7 @@ export default {
|
|
|
123
125
|
size="normal"
|
|
124
126
|
steps={steps}
|
|
125
127
|
version="secondary"
|
|
128
|
+
stepVersion="primary"
|
|
126
129
|
/>
|
|
127
130
|
</div>
|
|
128
131
|
</div>
|
|
@@ -135,6 +138,7 @@ export default {
|
|
|
135
138
|
size="small"
|
|
136
139
|
steps={steps}
|
|
137
140
|
version="secondary"
|
|
141
|
+
stepVersion="primary"
|
|
138
142
|
/>
|
|
139
143
|
</div>
|
|
140
144
|
</div>
|
|
@@ -11,6 +11,7 @@ import { assertUnreachable } from '../../utils/assertUnreachable';
|
|
|
11
11
|
import { isIcon } from '../../utils/isIcon';
|
|
12
12
|
import { style } from '../../utils/style';
|
|
13
13
|
import { Headline } from '../Headline/Headline';
|
|
14
|
+
import { getIconTextStyle } from './getIconTextStyle';
|
|
14
15
|
import { type DefaultStep, type Step, type StepsBlockContent } from './StepsBlockContent';
|
|
15
16
|
import { STEPS_BLOCK_STYLE } from './StepsBlockStyleMaps';
|
|
16
17
|
|
|
@@ -38,6 +39,7 @@ export const StepsBlock = JSX<StepsBlockProps>(
|
|
|
38
39
|
steps,
|
|
39
40
|
buttons,
|
|
40
41
|
size = 'normal',
|
|
42
|
+
stepVersion = 'gray',
|
|
41
43
|
version = 'primary',
|
|
42
44
|
...rest
|
|
43
45
|
}) => (
|
|
@@ -57,7 +59,7 @@ export const StepsBlock = JSX<StepsBlockProps>(
|
|
|
57
59
|
{steps?.length ? (
|
|
58
60
|
<div className="box-border">
|
|
59
61
|
<div className="flex flex-col gap-6xl justify-between">
|
|
60
|
-
{steps.map(renderStep(size,
|
|
62
|
+
{steps.map(renderStep(size, stepVersion))}
|
|
61
63
|
</div>
|
|
62
64
|
</div>
|
|
63
65
|
) : null}
|
|
@@ -68,7 +70,7 @@ export const StepsBlock = JSX<StepsBlockProps>(
|
|
|
68
70
|
|
|
69
71
|
// TODO: Create universal function for this case
|
|
70
72
|
const renderStep =
|
|
71
|
-
(size: SizeVersion,
|
|
73
|
+
(size: SizeVersion, stepVersion: BlockVersion) =>
|
|
72
74
|
// Linter doesn't understand that switch processes all cases
|
|
73
75
|
// eslint-disable-next-line consistent-return
|
|
74
76
|
(step: Step, i: number) => {
|
|
@@ -80,7 +82,7 @@ const renderStep =
|
|
|
80
82
|
|
|
81
83
|
switch (type) {
|
|
82
84
|
case 'default':
|
|
83
|
-
return renderDefaultStep(size,
|
|
85
|
+
return renderDefaultStep(size, stepVersion)(step, i);
|
|
84
86
|
case 'rte':
|
|
85
87
|
return <RichText __html={step.__html} />;
|
|
86
88
|
default:
|
|
@@ -89,12 +91,12 @@ const renderStep =
|
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
const renderDefaultStep =
|
|
92
|
-
(size: SizeVersion,
|
|
94
|
+
(size: SizeVersion, stepVersion: BlockVersion) => (step: DefaultStep, i: number) =>
|
|
93
95
|
(
|
|
94
96
|
<div key={String(i)} className="contents">
|
|
95
97
|
<div className="flex flex-row text-center relative">
|
|
96
98
|
<div className="overflow-hidden flex flex-shrink-0 items-center">
|
|
97
|
-
{renderIconArea(size,
|
|
99
|
+
{renderIconArea(size, stepVersion)(step, i)}
|
|
98
100
|
</div>
|
|
99
101
|
<div
|
|
100
102
|
className={style(
|
|
@@ -117,33 +119,43 @@ const renderDefaultStep =
|
|
|
117
119
|
</div>
|
|
118
120
|
);
|
|
119
121
|
|
|
120
|
-
const renderIconArea =
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
const renderIconArea =
|
|
123
|
+
(size: SizeVersion, stepVersion: BlockVersion) => (step: Step, i: number) => {
|
|
124
|
+
const iconVersion = stepVersion === 'secondary' ? 'white' : 'color';
|
|
125
|
+
const isImg = Boolean(step?.icon?.src);
|
|
126
|
+
const iconAreaSize = STEPS_SIZE_MAP[size][isImg ? 'image' : 'icon'];
|
|
127
|
+
const containerStyle = isImg ? '' : 'rounded-md';
|
|
126
128
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
)}
|
|
134
|
-
>
|
|
135
|
-
<span className="flex max-w-full max-h-full self-center text-h4 text-secondary-text group-data-secondary:text-white">
|
|
136
|
-
{isIcon(step?.icon) ? (
|
|
137
|
-
<Img
|
|
138
|
-
image={{ ...step.icon, iconVersion: step.icon?.iconVersion || iconVersion }}
|
|
139
|
-
imageClassName="max-w-full max-h-full"
|
|
140
|
-
width={iconSize}
|
|
141
|
-
height={iconSize}
|
|
142
|
-
/>
|
|
143
|
-
) : (
|
|
144
|
-
<span>{i + 1}</span>
|
|
129
|
+
return (
|
|
130
|
+
<BlockWrapper
|
|
131
|
+
className={style(
|
|
132
|
+
iconAreaSize,
|
|
133
|
+
containerStyle,
|
|
134
|
+
'z-10 mr-s flex justify-center content-center',
|
|
145
135
|
)}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
136
|
+
version={stepVersion}
|
|
137
|
+
>
|
|
138
|
+
<span className="flex max-w-full max-h-full items-center justify-center">
|
|
139
|
+
{isIcon(step?.icon) ? (
|
|
140
|
+
<Img
|
|
141
|
+
image={{ ...step.icon, iconVersion: step.icon?.iconVersion || iconVersion }}
|
|
142
|
+
imageClassName="max-w-full max-h-full"
|
|
143
|
+
width={getIconSizeStyle(size)}
|
|
144
|
+
height={getIconSizeStyle(size)}
|
|
145
|
+
/>
|
|
146
|
+
) : (
|
|
147
|
+
<span
|
|
148
|
+
className={style(
|
|
149
|
+
'text-h4',
|
|
150
|
+
stepVersion === 'transparent' ? styleMap.iconText : getIconTextStyle(stepVersion),
|
|
151
|
+
)}
|
|
152
|
+
>
|
|
153
|
+
{i + 1}
|
|
154
|
+
</span>
|
|
155
|
+
)}
|
|
156
|
+
</span>
|
|
157
|
+
</BlockWrapper>
|
|
158
|
+
);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const getIconSizeStyle = (size: string) => (size === 'normal' ? '38' : '24');
|
|
@@ -9,6 +9,7 @@ import { isIcon } from '../../utils/isIcon';
|
|
|
9
9
|
import { joinList } from '../../utils/joinList';
|
|
10
10
|
import { style } from '../../utils/style';
|
|
11
11
|
import { Headline } from '../Headline/Headline';
|
|
12
|
+
import { getIconTextStyle } from './getIconTextStyle';
|
|
12
13
|
import { renderStep } from './renderStep';
|
|
13
14
|
import { type Step, type StepsBlockContent } from './StepsBlockContent';
|
|
14
15
|
import { STEPS_BLOCK_STYLE, type StyleType } from './StepsBlockStyleMaps';
|
|
@@ -112,6 +113,3 @@ const renderStepIcon =
|
|
|
112
113
|
};
|
|
113
114
|
|
|
114
115
|
const getIconSizeStyle = (size: string) => (size === 'normal' ? 'h-24 w-24' : 'h-16 w-16');
|
|
115
|
-
|
|
116
|
-
const getIconTextStyle = (version: BlockVersion) =>
|
|
117
|
-
version === 'secondary' ? 'group-data-primary:text-white' : 'text-secondary-text';
|
|
@@ -40,7 +40,11 @@ export const Tabs = JSX<TabsBlockProps>(
|
|
|
40
40
|
const activeTab = tabs[activeTabIndex];
|
|
41
41
|
|
|
42
42
|
if (activeTab?.type === 'group') {
|
|
43
|
-
defaultEventBus.subject('tab', {
|
|
43
|
+
defaultEventBus.subject('tab', {
|
|
44
|
+
type: activeTab.type,
|
|
45
|
+
label: activeTab.ref,
|
|
46
|
+
groupName: activeTab.name,
|
|
47
|
+
});
|
|
44
48
|
}
|
|
45
49
|
}, [tabs, activeTabIndex]);
|
|
46
50
|
|
|
@@ -88,7 +92,7 @@ export const Tabs = JSX<TabsBlockProps>(
|
|
|
88
92
|
|
|
89
93
|
const fireTabEvent = (tab: TabData) => {
|
|
90
94
|
if (tab.type === 'group') {
|
|
91
|
-
defaultEventBus.fire('tab', { type: tab.type, label: tab.ref });
|
|
95
|
+
defaultEventBus.fire('tab', { type: tab.type, label: tab.ref, groupName: tab.name });
|
|
92
96
|
}
|
|
93
97
|
if (tab.type === 'link') {
|
|
94
98
|
defaultEventBus.fire('tab', { type: tab.type, label: tab.href });
|
|
@@ -37,9 +37,11 @@ export const BlockWrapper = JSX<BlockWrapperProps>(
|
|
|
37
37
|
useEffect(
|
|
38
38
|
() =>
|
|
39
39
|
defaultEventBus.subscribe('tab', (event) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
if (!event.groupName || event.groupName === block?.labelGroup) {
|
|
41
|
+
setHidden(
|
|
42
|
+
Boolean(event.label && block?.labels?.length && !block.labels.includes(event.label)),
|
|
43
|
+
);
|
|
44
|
+
}
|
|
43
45
|
}),
|
|
44
46
|
[block],
|
|
45
47
|
);
|