@redneckz/wildless-cms-uni-blocks 0.14.530 → 0.14.532

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 (63) hide show
  1. package/bin/migration-scripts/0.14.519.js +13 -0
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +8 -11
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/StepsBlock/StepsBlockContent.d.ts +3 -7
  6. package/bundle/components/StepsBlock/renderStepMobile.d.ts +4 -0
  7. package/dist/components/ContactsBlock/ContactsBlock.js +2 -2
  8. package/dist/components/ContactsBlock/ContactsBlock.js.map +1 -1
  9. package/dist/components/StepsBlock/StepsBlock.js +6 -9
  10. package/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  11. package/dist/components/StepsBlock/StepsBlock.mobile.js +5 -26
  12. package/dist/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  13. package/dist/components/StepsBlock/StepsBlockContent.d.ts +3 -7
  14. package/dist/components/StepsBlock/renderStepMobile.d.ts +4 -0
  15. package/dist/components/StepsBlock/renderStepMobile.js +48 -0
  16. package/dist/components/StepsBlock/renderStepMobile.js.map +1 -0
  17. package/lib/common.css +1 -1
  18. package/lib/components/ContactsBlock/ContactsBlock.js +2 -2
  19. package/lib/components/ContactsBlock/ContactsBlock.js.map +1 -1
  20. package/lib/components/StepsBlock/StepsBlock.fixture.mobile.d.ts +1 -0
  21. package/lib/components/StepsBlock/StepsBlock.js +7 -10
  22. package/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  23. package/lib/components/StepsBlock/StepsBlock.mobile.js +5 -26
  24. package/lib/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  25. package/lib/components/StepsBlock/StepsBlockContent.d.ts +3 -7
  26. package/lib/components/StepsBlock/renderStepMobile.d.ts +3 -0
  27. package/lib/components/StepsBlock/renderStepMobile.js +45 -0
  28. package/lib/components/StepsBlock/renderStepMobile.js.map +1 -0
  29. package/mobile/bundle/bundle.umd.js +41 -22
  30. package/mobile/bundle/bundle.umd.min.js +1 -1
  31. package/mobile/bundle/components/StepsBlock/StepsBlockContent.d.ts +3 -7
  32. package/mobile/bundle/components/StepsBlock/renderStepMobile.d.ts +4 -0
  33. package/mobile/dist/components/ContactsBlock/ContactsBlock.js +2 -2
  34. package/mobile/dist/components/ContactsBlock/ContactsBlock.js.map +1 -1
  35. package/mobile/dist/components/StepsBlock/StepsBlock.js +5 -26
  36. package/mobile/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  37. package/mobile/dist/components/StepsBlock/StepsBlockContent.d.ts +3 -7
  38. package/mobile/dist/components/StepsBlock/renderStepMobile.d.ts +4 -0
  39. package/mobile/dist/components/StepsBlock/renderStepMobile.js +48 -0
  40. package/mobile/dist/components/StepsBlock/renderStepMobile.js.map +1 -0
  41. package/mobile/lib/common.css +1 -1
  42. package/mobile/lib/components/ContactsBlock/ContactsBlock.js +2 -2
  43. package/mobile/lib/components/ContactsBlock/ContactsBlock.js.map +1 -1
  44. package/mobile/lib/components/StepsBlock/StepsBlock.js +5 -26
  45. package/mobile/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  46. package/mobile/lib/components/StepsBlock/StepsBlockContent.d.ts +3 -7
  47. package/mobile/lib/components/StepsBlock/renderStepMobile.d.ts +4 -0
  48. package/mobile/lib/components/StepsBlock/renderStepMobile.js +45 -0
  49. package/mobile/lib/components/StepsBlock/renderStepMobile.js.map +1 -0
  50. package/mobile/src/components/ContactsBlock/ContactsBlock.tsx +4 -2
  51. package/mobile/src/components/StepsBlock/StepsBlock.tsx +24 -112
  52. package/mobile/src/components/StepsBlock/StepsBlock.ui.json +3 -0
  53. package/mobile/src/components/StepsBlock/StepsBlockContent.ts +3 -6
  54. package/mobile/src/components/StepsBlock/renderStepMobile.tsx +139 -0
  55. package/package.json +1 -1
  56. package/src/components/ContactsBlock/ContactsBlock.tsx +4 -2
  57. package/src/components/StepsBlock/StepsBlock.fixture.mobile.tsx +44 -8
  58. package/src/components/StepsBlock/StepsBlock.fixture.tsx +0 -1
  59. package/src/components/StepsBlock/StepsBlock.mobile.tsx +24 -112
  60. package/src/components/StepsBlock/StepsBlock.tsx +8 -19
  61. package/src/components/StepsBlock/StepsBlock.ui.json +3 -0
  62. package/src/components/StepsBlock/StepsBlockContent.ts +3 -6
  63. package/src/components/StepsBlock/renderStepMobile.tsx +139 -0
@@ -1,32 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { type BlockVersion } from '../../model/BlockVersion';
3
- import { type SizeVersion } from '../../model/SizeVersion';
4
2
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
5
- import { Img } from '../../ui-kit/Img/Img';
6
3
  import { renderButtonsSection } from '../../ui-kit/LinkButton/renderButtonsSection';
7
- import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
8
- import { RichText } from '../../ui-kit/RichText/RichText';
9
4
  import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
10
- import { isIcon } from '../../utils/isIcon';
11
5
  import { style } from '../../utils/style';
12
6
  import { Headline } from '../Headline/Headline';
13
- import { getIconTextStyle } from './getIconTextStyle';
14
- import { type StepProps, type StepsBlockContent } from './StepsBlockContent';
15
- import { STEPS_BLOCK_STYLE } from './StepsBlockStyleMaps';
16
-
17
- type StepIconVersion = Record<'icon' | 'image', string>;
18
-
19
- const STEPS_SIZE_MAP: Record<SizeVersion, StepIconVersion> = {
20
- normal: { icon: 'h-11 w-11', image: 'h-14 w-14' },
21
- small: { icon: 'h-12 w-12', image: 'h-14 w-14' },
22
- };
23
-
24
- const STEPS_TILE_DESCRIPTION_HEIGHT_MAP: Record<SizeVersion, string> = {
25
- normal: '',
26
- small: 'min-h-6xl',
27
- };
28
-
29
- const styleMap = STEPS_BLOCK_STYLE;
7
+ import { renderStepMobile } from './renderStepMobile';
8
+ import { type StepsBlockContent } from './StepsBlockContent';
30
9
 
31
10
  export interface StepsBlockProps extends StepsBlockContent, UniBlockProps {}
32
11
 
@@ -35,102 +14,35 @@ export const StepsBlock = JSX<StepsBlockProps>(
35
14
  className = '',
36
15
  title,
37
16
  description,
38
- steps,
17
+ steps = [],
39
18
  buttons,
40
- size = 'normal',
41
19
  stepVersion = 'gray',
42
20
  version = 'primary',
43
21
  ...rest
44
- }) => (
45
- <BlockWrapper
46
- className={style('box-border flex flex-col gap-xl', className)}
47
- defaultPadding="p-6xl"
48
- version={version}
49
- {...rest}
50
- >
51
- <Headline
52
- title={title}
53
- description={description}
54
- headlineVersion="M"
55
- isEmbedded={true}
56
- align="text-left"
57
- />
58
- {steps?.length ? (
59
- <div className="box-border">
60
- <div className="flex flex-col gap-6xl justify-between">
61
- {steps.map(renderStep(size, stepVersion))}
62
- </div>
63
- </div>
64
- ) : null}
65
- {renderButtonsSection(buttons, { isVertical: true })}
66
- </BlockWrapper>
67
- ),
68
- );
69
-
70
- // TODO: Create universal function for this case
71
- const renderStep = (size: SizeVersion, stepVersion: BlockVersion) => (step: StepProps, i: number) =>
72
- (
73
- <div key={String(i)} className="contents">
74
- <div className="flex flex-row items-center relative">
75
- <div className="overflow-hidden flex flex-shrink-0 items-center">
76
- {renderIconArea(size, stepVersion)(step, i)}
77
- </div>
78
- <div
79
- className={style(
80
- 'flex flex-col justify-center h-fit',
81
- STEPS_TILE_DESCRIPTION_HEIGHT_MAP[size],
82
- )}
83
- >
84
- {step.label ? (
85
- <Paragraph size="text-l" align="text-left">
86
- {step.label}
87
- </Paragraph>
88
- ) : null}
89
- {step.description ? (
90
- <div className={style('text-s font-light text-left', styleMap.description)}>
91
- {step.description}
92
- </div>
93
- ) : null}
94
- <RichText __html={step.__html} />
95
- </div>
96
- </div>
97
- </div>
98
- );
99
-
100
- const renderIconArea =
101
- (size: SizeVersion, stepVersion: BlockVersion) => (step: StepProps, i: number) => {
102
- const iconVersion = stepVersion === 'secondary' ? 'white' : 'color';
103
- const isImg = Boolean(step?.icon?.src);
104
- const iconAreaSize = STEPS_SIZE_MAP[size][isImg ? 'image' : 'icon'];
105
- const containerVersion = isImg ? stepVersion === 'transparent' : stepVersion;
22
+ }) => {
23
+ const isBigSizeSteps = steps.length > 3;
106
24
 
107
25
  return (
108
26
  <BlockWrapper
109
- className={style(iconAreaSize, 'z-10 mr-s flex justify-center content-center rounded-md')}
110
- defaultPadding=""
111
- version={containerVersion as BlockVersion}
27
+ className={style('box-border flex flex-col gap-xl', className)}
28
+ defaultPadding="p-6xl"
29
+ version={version}
30
+ {...rest}
112
31
  >
113
- <span className="flex max-w-full max-h-full items-center justify-center">
114
- {isIcon(step?.icon) ? (
115
- <Img
116
- image={{ ...step.icon, iconVersion: step.icon?.iconVersion || iconVersion }}
117
- imageClassName="max-w-full max-h-full"
118
- width={getIconSizeStyle(size)}
119
- height={getIconSizeStyle(size)}
120
- />
121
- ) : (
122
- <span
123
- className={style(
124
- 'text-h4',
125
- stepVersion === 'transparent' ? styleMap.iconText : getIconTextStyle(stepVersion),
126
- )}
127
- >
128
- {i + 1}
129
- </span>
130
- )}
131
- </span>
32
+ <Headline
33
+ title={title}
34
+ description={description}
35
+ headlineVersion="M"
36
+ isEmbedded={true}
37
+ align="text-left"
38
+ />
39
+ {steps?.length ? (
40
+ <div className="flex flex-col gap-6xl justify-between box-border">
41
+ {steps.map(renderStepMobile(isBigSizeSteps, version, stepVersion))}
42
+ </div>
43
+ ) : null}
44
+ {renderButtonsSection(buttons, { isVertical: true })}
132
45
  </BlockWrapper>
133
46
  );
134
- };
135
-
136
- const getIconSizeStyle = (size: string) => (size === 'normal' ? '38' : '24');
47
+ },
48
+ );
@@ -11,7 +11,7 @@ import { joinList } from '../../utils/joinList';
11
11
  import { style } from '../../utils/style';
12
12
  import { Headline } from '../Headline/Headline';
13
13
  import { getIconTextStyle } from './getIconTextStyle';
14
- import { renderStep, STEP_BREAKPOINT } from './renderStep';
14
+ import { renderStep } from './renderStep';
15
15
  import { type StepProps, type StepsBlockContent } from './StepsBlockContent';
16
16
  import { STEPS_BLOCK_STYLE, type StyleType } from './StepsBlockStyleMaps';
17
17
 
@@ -25,16 +25,13 @@ export const StepsBlock = JSX<StepsBlockProps>(
25
25
  className = '',
26
26
  description,
27
27
  showLines = true,
28
- size = 'normal',
29
28
  steps = [],
30
29
  stepVersion = 'gray',
31
30
  title,
32
31
  version = 'primary',
33
32
  ...rest
34
33
  }) => {
35
- const stepsLength = steps.length;
36
-
37
- const shortGaps = stepsLength > 3;
34
+ const isBigSizeSteps = steps.length > 3;
38
35
 
39
36
  const styleMap = STEPS_BLOCK_STYLE;
40
37
 
@@ -42,9 +39,6 @@ export const StepsBlock = JSX<StepsBlockProps>(
42
39
 
43
40
  const isMobileMode = useMobileMode();
44
41
 
45
- const paddingXNormal = stepsLength < STEP_BREAKPOINT ? 'px-24' : 'px-16';
46
- const paddingXSmall = stepsLength < STEP_BREAKPOINT ? 'px-28' : 'px-20';
47
-
48
42
  return (
49
43
  <BlockWrapper
50
44
  className={style(
@@ -65,17 +59,12 @@ export const StepsBlock = JSX<StepsBlockProps>(
65
59
  />
66
60
  {steps?.length ? (
67
61
  <div className="box-border space-y-lg flex flex-col justify-center">
68
- <div
69
- className={style(
70
- 'flex items-center',
71
- size === 'normal' ? paddingXNormal : paddingXSmall,
72
- )}
73
- >
62
+ <div className={style('flex items-center', isBigSizeSteps ? 'px-16' : 'px-24')}>
74
63
  {joinList(
75
64
  <div className={style('h-0.5 w-full bg-secondary-light flex-1', lineOpacity)} />,
76
- )(steps.map(renderStepIcon(styleMap, size, stepVersion)))}
65
+ )(steps.map(renderStepIcon(styleMap, isBigSizeSteps, stepVersion)))}
77
66
  </div>
78
- <div className={style('flex justify-between', shortGaps ? 'gap-x-s' : 'gap-x-20')}>
67
+ <div className={style('flex justify-between', isBigSizeSteps ? 'gap-x-s' : 'gap-x-20')}>
79
68
  {steps.map(renderStep({ styleMap, version }))}
80
69
  </div>
81
70
  </div>
@@ -87,7 +76,7 @@ export const StepsBlock = JSX<StepsBlockProps>(
87
76
  );
88
77
 
89
78
  const renderStepIcon =
90
- (styleMap: StyleType, size: string, stepVersion: BlockVersion) =>
79
+ (styleMap: StyleType, stepsSize: boolean, stepVersion: BlockVersion) =>
91
80
  ({ icon }: StepProps, i: number) => {
92
81
  const iconVersion = stepVersion === 'secondary' ? 'white' : 'color';
93
82
 
@@ -96,7 +85,7 @@ const renderStepIcon =
96
85
  key={String(i)}
97
86
  defaultPadding=""
98
87
  className={`${getIconSizeStyle(
99
- size,
88
+ stepsSize,
100
89
  )} flex justify-center items-center text-center rounded-full box-border z-10`}
101
90
  version={stepVersion}
102
91
  >
@@ -120,4 +109,4 @@ const renderStepIcon =
120
109
  );
121
110
  };
122
111
 
123
- const getIconSizeStyle = (size: string) => (size === 'normal' ? 'h-24 w-24' : 'h-16 w-16');
112
+ const getIconSizeStyle = (stepsSize: boolean) => (stepsSize ? 'h-16 w-16' : 'h-24 w-24');
@@ -18,6 +18,9 @@
18
18
  "icon": {
19
19
  "ui:field": "icon"
20
20
  },
21
+ "image": {
22
+ "ui:field": "picture"
23
+ },
21
24
  "button": {
22
25
  "href": {
23
26
  "ui:field": "attachmentHref"
@@ -2,7 +2,7 @@ import { type BlockVersion } from '../../model/BlockVersion';
2
2
  import { type BulletsProps } from '../../model/Bullets';
3
3
  import { type DescriptionProps, type LabelProps, type TitleProps } from '../../model/HeadlineType';
4
4
  import { type IconProps } from '../../model/Picture';
5
- import { type SizeVersion } from '../../model/SizeVersion';
5
+ import { type ImageContent } from '../../ui-kit/Img/ImgProps';
6
6
  import { type ButtonsSectionContent } from '../../ui-kit/LinkButton/ButtonsSectionContent';
7
7
  import { type LinkButtonContent } from '../../ui-kit/LinkButton/LinkButtonContent';
8
8
  import type { RichTextProps } from '../../ui-kit/RichText/RichTextProps';
@@ -12,6 +12,7 @@ import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
12
12
  * @title Шаг
13
13
  */
14
14
  export type StepProps = DescriptionProps &
15
+ ImageContent &
15
16
  LabelProps &
16
17
  RichTextProps &
17
18
  IconProps &
@@ -34,10 +35,6 @@ export type StepsBlockContent = UniBlockContent &
34
35
  * @maxItems 5
35
36
  */
36
37
  steps?: StepProps[];
37
- /**
38
- * @title Тема шагов
39
- */
38
+ /** @title Тема шагов */
40
39
  stepVersion?: BlockVersion;
41
- /** @title Размер шагов */
42
- size?: SizeVersion; // TODO: mobile content
43
40
  };
@@ -0,0 +1,139 @@
1
+ import { type BlockVersion } from '../../model/BlockVersion';
2
+ import { type IconVersion } from '../../model/IconVersion';
3
+ import { type LinkButtonVersion } from '../../model/LinkButtonVersion';
4
+ import { BlockWrapper } from '../../ui-kit/BlockWrapper';
5
+ import { Img } from '../../ui-kit/Img/Img';
6
+ import { LinkButton } from '../../ui-kit/LinkButton/LinkButton';
7
+ import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
8
+ import { RichText } from '../../ui-kit/RichText/RichText';
9
+ import { isIcon } from '../../utils/isIcon';
10
+ import { style } from '../../utils/style';
11
+ import { getIconTextStyle } from './getIconTextStyle';
12
+ import { type StepProps } from './StepsBlockContent';
13
+ import { STEPS_BLOCK_STYLE } from './StepsBlockStyleMaps';
14
+
15
+ const styleMap = STEPS_BLOCK_STYLE;
16
+
17
+ export const renderStepMobile =
18
+ (stepsSize: boolean, version: BlockVersion, stepVersion: BlockVersion) =>
19
+ (step: StepProps, i: number) => {
20
+ const { button, image } = step;
21
+
22
+ const styleStepMobile = button?.text && image?.src;
23
+
24
+ return (
25
+ <div key={String(i)} className="contents">
26
+ <div className={style('flex items-center relative', image?.src ? 'flex-col' : 'flex-row')}>
27
+ {image?.src ? renderText(step) : null}
28
+ <div className="overflow-hidden flex flex-shrink-0 items-center">
29
+ {renderIconArea(stepsSize, stepVersion)(step, i)}
30
+ </div>
31
+ <div
32
+ className={style('flex flex-col justify-center h-fit w-full', {
33
+ 'min-h-6xl': stepsSize,
34
+ })}
35
+ >
36
+ {image?.src ? null : renderText(step)}
37
+ {styleStepMobile ? (
38
+ <LinkButton
39
+ className="box-border py-s w-full max-w-60 mt-lg"
40
+ version={version as LinkButtonVersion}
41
+ {...button}
42
+ >
43
+ {button?.text}
44
+ </LinkButton>
45
+ ) : null}
46
+ </div>
47
+ </div>
48
+ </div>
49
+ );
50
+ };
51
+
52
+ const renderIconArea =
53
+ (stepsSize: boolean, stepVersion: BlockVersion) => (step: StepProps, i: number) => {
54
+ const iconVersion = stepVersion === 'secondary' ? 'white' : 'color';
55
+ const isImg = Boolean(step?.icon?.src);
56
+ const iconAreaSize = getIconAreaSize(stepsSize, isImg);
57
+ const containerVersion = isImg ? stepVersion === 'transparent' : stepVersion;
58
+ const isImgSrc = step.image?.src;
59
+
60
+ return (
61
+ <BlockWrapper
62
+ className={style(
63
+ { 'w-32': Boolean(isImgSrc) },
64
+ 'z-10 mr-s flex justify-center content-center rounded-md',
65
+ !isImgSrc && iconAreaSize,
66
+ )}
67
+ defaultPadding=""
68
+ version={containerVersion as BlockVersion}
69
+ >
70
+ <div className="flex max-w-full max-h-full items-center justify-center">
71
+ {renderIcon({ step, iconVersion, i, stepVersion })}
72
+ </div>
73
+ </BlockWrapper>
74
+ );
75
+ };
76
+
77
+ const renderText = (step: StepProps) => {
78
+ const visibleStyle = Boolean(step.button?.text && step.image?.src);
79
+
80
+ return (
81
+ <div
82
+ className={style({
83
+ 'mb-lg w-full': visibleStyle,
84
+ })}
85
+ >
86
+ {step?.label ? (
87
+ <Paragraph size="text-l" align="text-left">
88
+ {step.label}
89
+ </Paragraph>
90
+ ) : null}
91
+ {step?.description ? (
92
+ <div className={style('text-s font-light text-left', styleMap.description)}>
93
+ {step.description}
94
+ </div>
95
+ ) : null}
96
+ <RichText __html={step.__html} />
97
+ </div>
98
+ );
99
+ };
100
+
101
+ const getIconAreaSize = (stepsSize: boolean, isImg: boolean) => {
102
+ return stepsSize && isImg ? 'h-14 w-14' : 'h-11 w-11';
103
+ };
104
+
105
+ const renderIcon = ({
106
+ step,
107
+ iconVersion,
108
+ i,
109
+ stepVersion,
110
+ }: {
111
+ step: StepProps;
112
+ iconVersion: IconVersion;
113
+ i: number;
114
+ stepVersion: BlockVersion;
115
+ }) => {
116
+ if (isIcon(step?.icon)) {
117
+ return (
118
+ <Img
119
+ image={{ ...step.icon, iconVersion: step.icon?.iconVersion || iconVersion }}
120
+ imageClassName="max-w-full max-h-full"
121
+ width="24"
122
+ height="24"
123
+ />
124
+ );
125
+ } else if (isIcon(step.image)) {
126
+ return <Img image={{ ...step.image, size: { width: 120, height: 120 } }} />;
127
+ }
128
+
129
+ return (
130
+ <span
131
+ className={style(
132
+ 'text-h4',
133
+ stepVersion === 'transparent' ? styleMap.iconText : getIconTextStyle(stepVersion),
134
+ )}
135
+ >
136
+ {i + 1}
137
+ </span>
138
+ );
139
+ };