@redneckz/wildless-cms-uni-blocks 0.14.531 → 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 (53) 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 +7 -10
  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/StepsBlock/StepsBlock.js +6 -9
  8. package/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  9. package/dist/components/StepsBlock/StepsBlock.mobile.js +5 -26
  10. package/dist/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  11. package/dist/components/StepsBlock/StepsBlockContent.d.ts +3 -7
  12. package/dist/components/StepsBlock/renderStepMobile.d.ts +4 -0
  13. package/dist/components/StepsBlock/renderStepMobile.js +48 -0
  14. package/dist/components/StepsBlock/renderStepMobile.js.map +1 -0
  15. package/lib/common.css +1 -1
  16. package/lib/components/StepsBlock/StepsBlock.fixture.mobile.d.ts +1 -0
  17. package/lib/components/StepsBlock/StepsBlock.js +7 -10
  18. package/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  19. package/lib/components/StepsBlock/StepsBlock.mobile.js +5 -26
  20. package/lib/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  21. package/lib/components/StepsBlock/StepsBlockContent.d.ts +3 -7
  22. package/lib/components/StepsBlock/renderStepMobile.d.ts +3 -0
  23. package/lib/components/StepsBlock/renderStepMobile.js +45 -0
  24. package/lib/components/StepsBlock/renderStepMobile.js.map +1 -0
  25. package/mobile/bundle/bundle.umd.js +41 -22
  26. package/mobile/bundle/bundle.umd.min.js +1 -1
  27. package/mobile/bundle/components/StepsBlock/StepsBlockContent.d.ts +3 -7
  28. package/mobile/bundle/components/StepsBlock/renderStepMobile.d.ts +4 -0
  29. package/mobile/dist/components/StepsBlock/StepsBlock.js +5 -26
  30. package/mobile/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  31. package/mobile/dist/components/StepsBlock/StepsBlockContent.d.ts +3 -7
  32. package/mobile/dist/components/StepsBlock/renderStepMobile.d.ts +4 -0
  33. package/mobile/dist/components/StepsBlock/renderStepMobile.js +48 -0
  34. package/mobile/dist/components/StepsBlock/renderStepMobile.js.map +1 -0
  35. package/mobile/lib/common.css +1 -1
  36. package/mobile/lib/components/StepsBlock/StepsBlock.js +5 -26
  37. package/mobile/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  38. package/mobile/lib/components/StepsBlock/StepsBlockContent.d.ts +3 -7
  39. package/mobile/lib/components/StepsBlock/renderStepMobile.d.ts +4 -0
  40. package/mobile/lib/components/StepsBlock/renderStepMobile.js +45 -0
  41. package/mobile/lib/components/StepsBlock/renderStepMobile.js.map +1 -0
  42. package/mobile/src/components/StepsBlock/StepsBlock.tsx +24 -112
  43. package/mobile/src/components/StepsBlock/StepsBlock.ui.json +3 -0
  44. package/mobile/src/components/StepsBlock/StepsBlockContent.ts +3 -6
  45. package/mobile/src/components/StepsBlock/renderStepMobile.tsx +139 -0
  46. package/package.json +1 -1
  47. package/src/components/StepsBlock/StepsBlock.fixture.mobile.tsx +44 -8
  48. package/src/components/StepsBlock/StepsBlock.fixture.tsx +0 -1
  49. package/src/components/StepsBlock/StepsBlock.mobile.tsx +24 -112
  50. package/src/components/StepsBlock/StepsBlock.tsx +8 -19
  51. package/src/components/StepsBlock/StepsBlock.ui.json +3 -0
  52. package/src/components/StepsBlock/StepsBlockContent.ts +3 -6
  53. package/src/components/StepsBlock/renderStepMobile.tsx +139 -0
@@ -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
+ };