@redneckz/wildless-cms-uni-blocks 0.3.15 → 0.3.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.
Files changed (68) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +19 -6
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/dist/components/ComparisonTable/TableColumn.js +1 -1
  5. package/dist/components/ComparisonTable/TableColumn.js.map +1 -1
  6. package/dist/components/Headline/Headline.js +2 -1
  7. package/dist/components/Headline/Headline.js.map +1 -1
  8. package/dist/components/Headline/Headline.mobile.js +2 -1
  9. package/dist/components/Headline/Headline.mobile.js.map +1 -1
  10. package/dist/components/Headline/constants.d.ts +7 -1
  11. package/dist/components/Headline/constants.js +17 -5
  12. package/dist/components/Headline/constants.js.map +1 -1
  13. package/dist/components/StepsBlock/StepsBlock.mobile.js +28 -6
  14. package/dist/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  15. package/dist/components/StepsBlock/StepsBlockContent.d.ts +2 -0
  16. package/dist/components/TariffsTable/TariffsTable.js +3 -3
  17. package/dist/components/TariffsTable/TariffsTable.js.map +1 -1
  18. package/lib/components/ComparisonTable/TableColumn.js +1 -1
  19. package/lib/components/ComparisonTable/TableColumn.js.map +1 -1
  20. package/lib/components/Headline/Headline.js +3 -2
  21. package/lib/components/Headline/Headline.js.map +1 -1
  22. package/lib/components/Headline/Headline.mobile.js +3 -2
  23. package/lib/components/Headline/Headline.mobile.js.map +1 -1
  24. package/lib/components/Headline/constants.d.ts +7 -1
  25. package/lib/components/Headline/constants.js +16 -4
  26. package/lib/components/Headline/constants.js.map +1 -1
  27. package/lib/components/StepsBlock/StepsBlock.fixture.mobile.d.ts +1 -4
  28. package/lib/components/StepsBlock/StepsBlock.mobile.js +28 -6
  29. package/lib/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  30. package/lib/components/StepsBlock/StepsBlockContent.d.ts +2 -0
  31. package/lib/components/TariffsTable/TariffsTable.js +3 -3
  32. package/lib/components/TariffsTable/TariffsTable.js.map +1 -1
  33. package/mobile/bundle/bundle.umd.js +47 -12
  34. package/mobile/bundle/bundle.umd.min.js +1 -1
  35. package/mobile/dist/components/ComparisonTable/TableColumn.js +1 -1
  36. package/mobile/dist/components/ComparisonTable/TableColumn.js.map +1 -1
  37. package/mobile/dist/components/Headline/Headline.js +2 -1
  38. package/mobile/dist/components/Headline/Headline.js.map +1 -1
  39. package/mobile/dist/components/Headline/constants.d.ts +7 -1
  40. package/mobile/dist/components/Headline/constants.js +17 -5
  41. package/mobile/dist/components/Headline/constants.js.map +1 -1
  42. package/mobile/dist/components/StepsBlock/StepsBlock.js +28 -6
  43. package/mobile/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  44. package/mobile/dist/components/StepsBlock/StepsBlockContent.d.ts +2 -0
  45. package/mobile/lib/components/ComparisonTable/TableColumn.js +1 -1
  46. package/mobile/lib/components/ComparisonTable/TableColumn.js.map +1 -1
  47. package/mobile/lib/components/Headline/Headline.js +3 -2
  48. package/mobile/lib/components/Headline/Headline.js.map +1 -1
  49. package/mobile/lib/components/Headline/constants.d.ts +7 -1
  50. package/mobile/lib/components/Headline/constants.js +16 -4
  51. package/mobile/lib/components/Headline/constants.js.map +1 -1
  52. package/mobile/lib/components/StepsBlock/StepsBlock.js +28 -6
  53. package/mobile/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  54. package/mobile/lib/components/StepsBlock/StepsBlockContent.d.ts +2 -0
  55. package/mobile/src/components/ComparisonTable/TableColumn.tsx +1 -1
  56. package/mobile/src/components/Headline/Headline.tsx +9 -4
  57. package/mobile/src/components/Headline/constants.ts +22 -4
  58. package/mobile/src/components/StepsBlock/StepsBlock.tsx +60 -19
  59. package/mobile/src/components/StepsBlock/StepsBlockContent.ts +2 -1
  60. package/package.json +1 -1
  61. package/src/components/ComparisonTable/TableColumn.tsx +1 -1
  62. package/src/components/Headline/Headline.mobile.tsx +9 -4
  63. package/src/components/Headline/Headline.tsx +3 -2
  64. package/src/components/Headline/constants.ts +22 -4
  65. package/src/components/StepsBlock/StepsBlock.fixture.mobile.tsx +127 -72
  66. package/src/components/StepsBlock/StepsBlock.mobile.tsx +60 -19
  67. package/src/components/StepsBlock/StepsBlockContent.ts +2 -1
  68. package/src/components/TariffsTable/TariffsTable.tsx +5 -5
@@ -1,26 +1,62 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { SizeVersion } from '../../model/SizeVersion';
3
- import type { UniBlockProps } from '../../types';
4
2
  import { Heading } from '../../ui-kit/Heading/Heading';
5
3
  import { Icon } from '../../ui-kit/Icon/Icon';
4
+ import type { SizeVersion } from '../../model/SizeVersion';
5
+ import type { UniBlockProps } from '../../types';
6
6
  import type { Step, StepsBlockContent } from './StepsBlockContent';
7
+ import type { BlockVersion } from '../../model/BlockVersion';
7
8
 
8
9
  export interface StepsBlockProps extends StepsBlockContent, UniBlockProps {}
9
10
 
11
+ type StyleType = {
12
+ background: string;
13
+ title: string;
14
+ description: string;
15
+ iconBackground: string;
16
+ iconConnector: string;
17
+ };
18
+
19
+ const STEPS_BLOCK_STYLE_MAPS: Record<BlockVersion, StyleType> = {
20
+ primary: {
21
+ background: 'bg-white',
22
+ title: 'text-primary-text',
23
+ description: 'text-secondary-text',
24
+ iconBackground: 'bg-secondary-light',
25
+ iconConnector: 'bg-secondary-light',
26
+ },
27
+ secondary: {
28
+ background: 'bg-primary-main',
29
+ title: 'text-white',
30
+ description: 'text-white/80',
31
+ iconBackground: 'bg-white/30',
32
+ iconConnector: 'bg-white',
33
+ },
34
+ };
35
+
36
+ const styleMaps = (version: BlockVersion): StyleType => STEPS_BLOCK_STYLE_MAPS[version];
37
+
10
38
  export const StepsBlock = JSX<StepsBlockProps>(
11
- ({ className, title, description, steps, size = 'normal' }) => {
39
+ ({ className, title, description, steps, size = 'normal', version = 'primary' }) => {
40
+ const style = styleMaps(version);
12
41
  return (
13
42
  <section
14
- className={`box-border font-sans text-primary-text bg-white px-4 py-6 flex flex-col ${
15
- className || ''
16
- }`}
43
+ className={`box-border font-sans bg-white px-4 py-6 flex flex-col
44
+ ${style.background} ${style.title} ${className || ''}`}
17
45
  >
18
- {title && <Heading headingType="h3" className="text-center" title={title} />}
19
- {description && <p className={`text-m-md text-center ${title && 'mt-2'}`}>{description}</p>}
46
+ {title && (
47
+ <Heading headingType="h3" className={`text-center ${style.title}`} title={title} />
48
+ )}
49
+ {description && (
50
+ <p className={`text-m-md text-center ${style.description} ${title && 'mt-2'}`}>
51
+ {description}
52
+ </p>
53
+ )}
20
54
  {steps?.length ? (
21
55
  <div className={`box-border py-0.5 mb-0.5 mt-5`}>
22
56
  <div className="flex flex-col justify-between gap-x-[101px]">
23
- {steps.map((step, i) => renderStepTitle({ step, size, i, length: steps.length }))}
57
+ {steps.map((step, i) =>
58
+ renderStepTitle({ step, size, i, length: steps.length, version: version }),
59
+ )}
24
60
  </div>
25
61
  </div>
26
62
  ) : null}
@@ -34,20 +70,23 @@ interface RenderStepTitleParams {
34
70
  size: SizeVersion;
35
71
  i: number;
36
72
  length: number;
73
+ version: BlockVersion;
37
74
  }
38
75
 
39
76
  const renderStepTitle = (params: RenderStepTitleParams) => {
40
- const { step, size, i, length } = params;
41
-
77
+ const { step, size, i, length, version } = params;
42
78
  const isLastStep = length - 1 === i;
43
79
  const margin = size === 'normal' ? 'ml-[34px]' : 'ml-[24px]';
80
+ const style = styleMaps(version);
44
81
 
45
82
  return (
46
83
  <div key={String(i)}>
47
84
  <div key={String(i)} className="flex flex-row text-center relative">
48
- <div>
49
- {renderIconArea(step, size, i)}
50
- {!isLastStep && <div className={`min-h-8 h-full w-[2px] bg-secondary-light ${margin}`} />}
85
+ <div className="overflow-hidden">
86
+ {renderIconArea(params)}
87
+ {!isLastStep && (
88
+ <div className={`min-h-8 h-full w-[2px] ${style.iconConnector} ${margin}`} />
89
+ )}
51
90
  </div>
52
91
  <div className="flex flex-col justify-start relative">
53
92
  {step.label && (
@@ -55,7 +94,7 @@ const renderStepTitle = (params: RenderStepTitleParams) => {
55
94
  )}
56
95
  {step.description && (
57
96
  <div
58
- className={`font-normal text-sm text-secondary-text text-left ${
97
+ className={`font-normal text-sm ${style.description} text-left ${
59
98
  step.label ? 'mt-1' : ''
60
99
  }`}
61
100
  >
@@ -68,7 +107,9 @@ const renderStepTitle = (params: RenderStepTitleParams) => {
68
107
  );
69
108
  };
70
109
 
71
- const renderIconArea = (step: Step, size: SizeVersion, i: number) => {
110
+ const renderIconArea = (params: RenderStepTitleParams) => {
111
+ const { step, size, i, version } = params;
112
+ const style = styleMaps(version);
72
113
  const iconAreaSize =
73
114
  size === 'normal'
74
115
  ? 'h-[70px] w-[70px] min-w-[70px] min-h-[70px]'
@@ -79,10 +120,10 @@ const renderIconArea = (step: Step, size: SizeVersion, i: number) => {
79
120
 
80
121
  return (
81
122
  <div
82
- className={`${iconAreaSize} bg-secondary-light rounded-full z-10 mr-3 flex justify-center content-center`}
123
+ className={`${iconAreaSize} ${style.iconBackground} rounded-full z-10 mr-3 flex justify-center content-center`}
83
124
  >
84
- <span className={`font-medium text-secondary-text self-center ${iconTextSize}`}>
85
- {(step.icon && <Icon name={step.icon} width={iconSize} height={iconSize} />) || i + 1}
125
+ <span className={`font-medium flex self-center ${style.title} ${iconTextSize}`}>
126
+ {(step.icon && <Icon name={step.icon} width={iconSize} height={iconSize} asSVG />) || i + 1}
86
127
  </span>
87
128
  </div>
88
129
  );
@@ -1,6 +1,6 @@
1
1
  import type { IconName } from '../../ui-kit/Icon/IconProps';
2
-
3
2
  import type { SizeVersion } from '../../model/SizeVersion';
3
+ import type { BlockVersion } from '../../model/BlockVersion';
4
4
 
5
5
  /**
6
6
  * @title Шаг
@@ -30,4 +30,5 @@ export interface StepsBlockContent {
30
30
  */
31
31
  steps?: Step[];
32
32
  size?: SizeVersion; // TODO: mobile content
33
+ version?: BlockVersion; // TODO: mobile content
33
34
  }
@@ -1,16 +1,16 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { useTableArrowScrollControl } from '../../hooks/useTableArrowScrollControl';
3
+ import type { UniBlockProps } from '../../types';
2
4
  import { Heading } from '../../ui-kit/Heading/Heading';
3
- import { COLS_LENGTH_FOR_SCROLL } from './constants';
4
- import { TariffsTableRow } from './TariffsTableRow';
5
5
  import { TableArrowScrollControl } from '../../ui-kit/TableArrowScrollControl/TableArrowScrollControl';
6
- import type { UniBlockProps } from '../../types';
6
+ import { COLS_LENGTH_FOR_SCROLL } from './constants';
7
7
  import type {
8
8
  TariffsTableCellData,
9
9
  TariffsTableColumn,
10
10
  TariffsTableContent,
11
11
  TariffsTableRowHeader,
12
12
  } from './TariffsTableContent';
13
- import { useTableArrowScrollControl } from '../../hooks/useTableArrowScrollControl';
13
+ import { TariffsTableRow } from './TariffsTableRow';
14
14
 
15
15
  export interface TariffsTableProps extends TariffsTableContent, UniBlockProps {}
16
16
 
@@ -46,7 +46,7 @@ export const TariffsTable = JSX<TariffsTableProps>(
46
46
  {rowData?.length ? (
47
47
  <div role="table">
48
48
  <div className="relative">
49
- {rowData.map((row, i) => (
49
+ {rowData.map((row, i, { length }) => (
50
50
  <TariffsTableRow
51
51
  key={String(i)}
52
52
  row={row}