@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.
Files changed (83) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +12 -5
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/StepsBlock/getIconTextStyle.d.ts +2 -0
  5. package/bundle/components/Tabs/TabActivationEvent.d.ts +1 -0
  6. package/bundle/components/Tabs/TabsContent.d.ts +2 -0
  7. package/bundle/model/ContentPageDef.d.ts +1 -0
  8. package/dist/components/StepsBlock/StepsBlock.js +2 -2
  9. package/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  10. package/dist/components/StepsBlock/StepsBlock.mobile.js +10 -9
  11. package/dist/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  12. package/dist/components/StepsBlock/getIconTextStyle.d.ts +2 -0
  13. package/dist/components/StepsBlock/getIconTextStyle.js +5 -0
  14. package/dist/components/StepsBlock/getIconTextStyle.js.map +1 -0
  15. package/dist/components/Tabs/TabActivationEvent.d.ts +1 -0
  16. package/dist/components/Tabs/Tabs.js +6 -2
  17. package/dist/components/Tabs/Tabs.js.map +1 -1
  18. package/dist/components/Tabs/TabsContent.d.ts +2 -0
  19. package/dist/model/ContentPageDef.d.ts +1 -0
  20. package/dist/ui-kit/BlockWrapper.js +3 -1
  21. package/dist/ui-kit/BlockWrapper.js.map +1 -1
  22. package/lib/components/StepsBlock/StepsBlock.js +1 -1
  23. package/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  24. package/lib/components/StepsBlock/StepsBlock.mobile.js +10 -9
  25. package/lib/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  26. package/lib/components/StepsBlock/getIconTextStyle.d.ts +2 -0
  27. package/lib/components/StepsBlock/getIconTextStyle.js +2 -0
  28. package/lib/components/StepsBlock/getIconTextStyle.js.map +1 -0
  29. package/lib/components/Tabs/TabActivationEvent.d.ts +1 -0
  30. package/lib/components/Tabs/Tabs.js +6 -2
  31. package/lib/components/Tabs/Tabs.js.map +1 -1
  32. package/lib/components/Tabs/TabsContent.d.ts +2 -0
  33. package/lib/model/ContentPageDef.d.ts +1 -0
  34. package/lib/ui-kit/BlockWrapper.js +3 -1
  35. package/lib/ui-kit/BlockWrapper.js.map +1 -1
  36. package/mobile/bundle/bundle.umd.js +21 -13
  37. package/mobile/bundle/bundle.umd.min.js +1 -1
  38. package/mobile/bundle/components/StepsBlock/getIconTextStyle.d.ts +2 -0
  39. package/mobile/bundle/components/Tabs/TabActivationEvent.d.ts +1 -0
  40. package/mobile/bundle/components/Tabs/TabsContent.d.ts +2 -0
  41. package/mobile/bundle/model/ContentPageDef.d.ts +1 -0
  42. package/mobile/dist/components/StepsBlock/StepsBlock.js +10 -9
  43. package/mobile/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  44. package/mobile/dist/components/StepsBlock/getIconTextStyle.d.ts +2 -0
  45. package/mobile/dist/components/StepsBlock/getIconTextStyle.js +5 -0
  46. package/mobile/dist/components/StepsBlock/getIconTextStyle.js.map +1 -0
  47. package/mobile/dist/components/Tabs/TabActivationEvent.d.ts +1 -0
  48. package/mobile/dist/components/Tabs/Tabs.js +6 -2
  49. package/mobile/dist/components/Tabs/Tabs.js.map +1 -1
  50. package/mobile/dist/components/Tabs/TabsContent.d.ts +2 -0
  51. package/mobile/dist/model/ContentPageDef.d.ts +1 -0
  52. package/mobile/dist/ui-kit/BlockWrapper.js +3 -1
  53. package/mobile/dist/ui-kit/BlockWrapper.js.map +1 -1
  54. package/mobile/lib/common.css +1 -1
  55. package/mobile/lib/components/StepsBlock/StepsBlock.js +10 -9
  56. package/mobile/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  57. package/mobile/lib/components/StepsBlock/getIconTextStyle.d.ts +2 -0
  58. package/mobile/lib/components/StepsBlock/getIconTextStyle.js +2 -0
  59. package/mobile/lib/components/StepsBlock/getIconTextStyle.js.map +1 -0
  60. package/mobile/lib/components/Tabs/TabActivationEvent.d.ts +1 -0
  61. package/mobile/lib/components/Tabs/Tabs.js +6 -2
  62. package/mobile/lib/components/Tabs/Tabs.js.map +1 -1
  63. package/mobile/lib/components/Tabs/TabsContent.d.ts +2 -0
  64. package/mobile/lib/model/ContentPageDef.d.ts +1 -0
  65. package/mobile/lib/ui-kit/BlockWrapper.js +3 -1
  66. package/mobile/lib/ui-kit/BlockWrapper.js.map +1 -1
  67. package/mobile/src/components/StepsBlock/StepsBlock.tsx +45 -33
  68. package/mobile/src/components/StepsBlock/getIconTextStyle.ts +4 -0
  69. package/mobile/src/components/Tabs/TabActivationEvent.ts +1 -0
  70. package/mobile/src/components/Tabs/Tabs.tsx +6 -2
  71. package/mobile/src/components/Tabs/TabsContent.ts +2 -0
  72. package/mobile/src/model/ContentPageDef.ts +1 -0
  73. package/mobile/src/ui-kit/BlockWrapper.tsx +5 -3
  74. package/package.json +1 -1
  75. package/src/components/StepsBlock/StepsBlock.fixture.mobile.tsx +4 -0
  76. package/src/components/StepsBlock/StepsBlock.mobile.tsx +45 -33
  77. package/src/components/StepsBlock/StepsBlock.tsx +1 -3
  78. package/src/components/StepsBlock/getIconTextStyle.ts +4 -0
  79. package/src/components/Tabs/TabActivationEvent.ts +1 -0
  80. package/src/components/Tabs/Tabs.tsx +6 -2
  81. package/src/components/Tabs/TabsContent.ts +2 -0
  82. package/src/model/ContentPageDef.ts +1 -0
  83. 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
- setHidden(Boolean(event.label && block?.labels?.length && !block.labels.includes(event.label)));
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,C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,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, version))}
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, version: BlockVersion) =>
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, version)(step, i);
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, version: BlockVersion) => (step: DefaultStep, i: number) =>
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, version)(step, i)}
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 = (size: SizeVersion, version: BlockVersion) => (step: Step, i: number) => {
121
- const iconSize = size === 'normal' ? '38' : '24';
122
- const iconVersion = version === 'secondary' ? 'white' : 'color';
123
- const isImg = Boolean(step?.icon?.src);
124
- const iconAreaSize = STEPS_SIZE_MAP[size][isImg ? 'image' : 'icon'];
125
- const containerStyle = isImg ? '' : `rounded-md ${styleMap.iconBackground}`;
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
- return (
128
- <div
129
- className={style(
130
- iconAreaSize,
131
- containerStyle,
132
- 'z-10 mr-s flex justify-center content-center',
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
- </span>
147
- </div>
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');
@@ -0,0 +1,4 @@
1
+ import { type BlockVersion } from '../../model/BlockVersion';
2
+
3
+ export const getIconTextStyle = (version: BlockVersion) =>
4
+ version === 'secondary' ? 'group-data-primary:text-white' : 'text-secondary-text';
@@ -2,5 +2,6 @@ import { type TabData } from './TabsContent';
2
2
 
3
3
  export interface TabActivationEvent {
4
4
  type?: TabData['type'];
5
+ groupName?: string;
5
6
  label?: string;
6
7
  }
@@ -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', { type: activeTab.type, label: activeTab.ref });
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 });
@@ -8,6 +8,8 @@ import { type LinkProps } from '../../model/LinkProps';
8
8
  export type GroupTabData = TitleProps & {
9
9
  /** @default group */
10
10
  type: 'group';
11
+ /** @title Имя группы */
12
+ name?: string;
11
13
  /** @title Тег */
12
14
  ref?: string;
13
15
  };
@@ -10,6 +10,7 @@ export interface BaseBlockDef extends Slot {
10
10
  hidden?: boolean;
11
11
  anchor?: string;
12
12
  labels?: string[]; // TODO: Remove and refactor group tabs
13
+ labelGroup?: string;
13
14
  }
14
15
 
15
16
  export interface BlockDef extends BaseBlockDef {
@@ -37,9 +37,11 @@ export const BlockWrapper = JSX<BlockWrapperProps>(
37
37
  useEffect(
38
38
  () =>
39
39
  defaultEventBus.subscribe('tab', (event) => {
40
- setHidden(
41
- Boolean(event.label && block?.labels?.length && !block.labels.includes(event.label)),
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.87",
3
+ "version": "0.14.89",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -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, version))}
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, version: BlockVersion) =>
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, version)(step, i);
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, version: BlockVersion) => (step: DefaultStep, i: number) =>
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, version)(step, i)}
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 = (size: SizeVersion, version: BlockVersion) => (step: Step, i: number) => {
121
- const iconSize = size === 'normal' ? '38' : '24';
122
- const iconVersion = version === 'secondary' ? 'white' : 'color';
123
- const isImg = Boolean(step?.icon?.src);
124
- const iconAreaSize = STEPS_SIZE_MAP[size][isImg ? 'image' : 'icon'];
125
- const containerStyle = isImg ? '' : `rounded-md ${styleMap.iconBackground}`;
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
- return (
128
- <div
129
- className={style(
130
- iconAreaSize,
131
- containerStyle,
132
- 'z-10 mr-s flex justify-center content-center',
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
- </span>
147
- </div>
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';
@@ -0,0 +1,4 @@
1
+ import { type BlockVersion } from '../../model/BlockVersion';
2
+
3
+ export const getIconTextStyle = (version: BlockVersion) =>
4
+ version === 'secondary' ? 'group-data-primary:text-white' : 'text-secondary-text';
@@ -2,5 +2,6 @@ import { type TabData } from './TabsContent';
2
2
 
3
3
  export interface TabActivationEvent {
4
4
  type?: TabData['type'];
5
+ groupName?: string;
5
6
  label?: string;
6
7
  }
@@ -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', { type: activeTab.type, label: activeTab.ref });
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 });
@@ -8,6 +8,8 @@ import { type LinkProps } from '../../model/LinkProps';
8
8
  export type GroupTabData = TitleProps & {
9
9
  /** @default group */
10
10
  type: 'group';
11
+ /** @title Имя группы */
12
+ name?: string;
11
13
  /** @title Тег */
12
14
  ref?: string;
13
15
  };
@@ -10,6 +10,7 @@ export interface BaseBlockDef extends Slot {
10
10
  hidden?: boolean;
11
11
  anchor?: string;
12
12
  labels?: string[]; // TODO: Remove and refactor group tabs
13
+ labelGroup?: string;
13
14
  }
14
15
 
15
16
  export interface BlockDef extends BaseBlockDef {
@@ -37,9 +37,11 @@ export const BlockWrapper = JSX<BlockWrapperProps>(
37
37
  useEffect(
38
38
  () =>
39
39
  defaultEventBus.subscribe('tab', (event) => {
40
- setHidden(
41
- Boolean(event.label && block?.labels?.length && !block.labels.includes(event.label)),
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
  );