@redneckz/wildless-cms-uni-blocks 0.3.9 → 0.3.10

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 (101) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/dist/components/ComparisonTable/ComparisonTable.mobile.d.ts +5 -0
  3. package/dist/components/ComparisonTable/ComparisonTable.mobile.js +46 -0
  4. package/dist/components/ComparisonTable/ComparisonTable.mobile.js.map +1 -0
  5. package/dist/components/ComparisonTable/ComparisonTableContent.d.ts +4 -0
  6. package/dist/components/ComparisonTable/HeaderCell.mobile.d.ts +12 -0
  7. package/dist/components/ComparisonTable/HeaderCell.mobile.js +9 -0
  8. package/dist/components/ComparisonTable/HeaderCell.mobile.js.map +1 -0
  9. package/dist/components/ComparisonTable/TableCell.d.ts +3 -2
  10. package/dist/components/ComparisonTable/TableCell.js.map +1 -1
  11. package/dist/components/ComparisonTable/TableCell.mobile.d.ts +9 -0
  12. package/dist/components/ComparisonTable/TableCell.mobile.js +12 -0
  13. package/dist/components/ComparisonTable/TableCell.mobile.js.map +1 -0
  14. package/dist/components/ComparisonTable/TableColumn.d.ts +10 -0
  15. package/dist/components/ComparisonTable/TableColumn.js +19 -0
  16. package/dist/components/ComparisonTable/TableColumn.js.map +1 -0
  17. package/dist/components/Gallery/Gallery.mobile.js +2 -2
  18. package/dist/components/Gallery/Gallery.mobile.js.map +1 -1
  19. package/dist/ui-kit/SwipeListControl/SwipeListControl.js +11 -6
  20. package/dist/ui-kit/SwipeListControl/SwipeListControl.js.map +1 -1
  21. package/dist/ui-kit/SwipeListControl/SwipeListControlProps.d.ts +1 -0
  22. package/lib/common.css +1 -1
  23. package/lib/components/ComparisonTable/ComparisonTable.fixture.mobile.d.ts +5 -0
  24. package/lib/components/ComparisonTable/ComparisonTable.mobile.d.ts +5 -0
  25. package/lib/components/ComparisonTable/ComparisonTable.mobile.js +44 -0
  26. package/lib/components/ComparisonTable/ComparisonTable.mobile.js.map +1 -0
  27. package/lib/components/ComparisonTable/ComparisonTableContent.d.ts +4 -0
  28. package/lib/components/ComparisonTable/HeaderCell.mobile.d.ts +12 -0
  29. package/lib/components/ComparisonTable/HeaderCell.mobile.js +7 -0
  30. package/lib/components/ComparisonTable/HeaderCell.mobile.js.map +1 -0
  31. package/lib/components/ComparisonTable/TableCell.d.ts +3 -2
  32. package/lib/components/ComparisonTable/TableCell.js.map +1 -1
  33. package/lib/components/ComparisonTable/TableCell.mobile.d.ts +9 -0
  34. package/lib/components/ComparisonTable/TableCell.mobile.js +10 -0
  35. package/lib/components/ComparisonTable/TableCell.mobile.js.map +1 -0
  36. package/lib/components/ComparisonTable/TableColumn.d.ts +10 -0
  37. package/lib/components/ComparisonTable/TableColumn.js +17 -0
  38. package/lib/components/ComparisonTable/TableColumn.js.map +1 -0
  39. package/lib/components/Gallery/Gallery.mobile.js +2 -2
  40. package/lib/components/Gallery/Gallery.mobile.js.map +1 -1
  41. package/lib/ui-kit/SwipeListControl/SwipeListControl.js +12 -7
  42. package/lib/ui-kit/SwipeListControl/SwipeListControl.js.map +1 -1
  43. package/lib/ui-kit/SwipeListControl/SwipeListControlProps.d.ts +1 -0
  44. package/mobile/bundle/bundle.umd.js +65 -60
  45. package/mobile/bundle/bundle.umd.min.js +1 -1
  46. package/mobile/dist/components/ComparisonTable/ComparisonTable.js +38 -28
  47. package/mobile/dist/components/ComparisonTable/ComparisonTable.js.map +1 -1
  48. package/mobile/dist/components/ComparisonTable/ComparisonTableContent.d.ts +4 -0
  49. package/mobile/dist/components/ComparisonTable/HeaderCell.d.ts +2 -0
  50. package/mobile/dist/components/ComparisonTable/HeaderCell.js +1 -3
  51. package/mobile/dist/components/ComparisonTable/HeaderCell.js.map +1 -1
  52. package/mobile/dist/components/ComparisonTable/TableCell.d.ts +4 -3
  53. package/mobile/dist/components/ComparisonTable/TableCell.js +5 -5
  54. package/mobile/dist/components/ComparisonTable/TableCell.js.map +1 -1
  55. package/mobile/dist/components/ComparisonTable/TableColumn.d.ts +10 -0
  56. package/mobile/dist/components/ComparisonTable/TableColumn.js +19 -0
  57. package/mobile/dist/components/ComparisonTable/TableColumn.js.map +1 -0
  58. package/mobile/dist/components/Gallery/Gallery.js +2 -2
  59. package/mobile/dist/components/Gallery/Gallery.js.map +1 -1
  60. package/mobile/dist/ui-kit/SwipeListControl/SwipeListControl.js +11 -6
  61. package/mobile/dist/ui-kit/SwipeListControl/SwipeListControl.js.map +1 -1
  62. package/mobile/dist/ui-kit/SwipeListControl/SwipeListControlProps.d.ts +1 -0
  63. package/mobile/lib/components/ComparisonTable/ComparisonTable.js +38 -28
  64. package/mobile/lib/components/ComparisonTable/ComparisonTable.js.map +1 -1
  65. package/mobile/lib/components/ComparisonTable/ComparisonTableContent.d.ts +4 -0
  66. package/mobile/lib/components/ComparisonTable/HeaderCell.d.ts +2 -0
  67. package/mobile/lib/components/ComparisonTable/HeaderCell.js +1 -3
  68. package/mobile/lib/components/ComparisonTable/HeaderCell.js.map +1 -1
  69. package/mobile/lib/components/ComparisonTable/TableCell.d.ts +4 -3
  70. package/mobile/lib/components/ComparisonTable/TableCell.js +6 -6
  71. package/mobile/lib/components/ComparisonTable/TableCell.js.map +1 -1
  72. package/mobile/lib/components/ComparisonTable/TableColumn.d.ts +10 -0
  73. package/mobile/lib/components/ComparisonTable/TableColumn.js +17 -0
  74. package/mobile/lib/components/ComparisonTable/TableColumn.js.map +1 -0
  75. package/mobile/lib/components/Gallery/Gallery.js +2 -2
  76. package/mobile/lib/components/Gallery/Gallery.js.map +1 -1
  77. package/mobile/lib/ui-kit/SwipeListControl/SwipeListControl.js +12 -7
  78. package/mobile/lib/ui-kit/SwipeListControl/SwipeListControl.js.map +1 -1
  79. package/mobile/lib/ui-kit/SwipeListControl/SwipeListControlProps.d.ts +1 -0
  80. package/mobile/src/common.css +0 -2
  81. package/mobile/src/components/ComparisonTable/ComparisonTable.tsx +90 -102
  82. package/mobile/src/components/ComparisonTable/ComparisonTableContent.ts +4 -0
  83. package/mobile/src/components/ComparisonTable/HeaderCell.tsx +34 -30
  84. package/mobile/src/components/ComparisonTable/TableCell.tsx +30 -27
  85. package/mobile/src/components/ComparisonTable/TableColumn.tsx +66 -0
  86. package/mobile/src/components/Gallery/Gallery.tsx +2 -2
  87. package/mobile/src/ui-kit/SwipeListControl/SwipeListControl.tsx +27 -19
  88. package/mobile/src/ui-kit/SwipeListControl/SwipeListControlProps.ts +1 -0
  89. package/package.json +1 -1
  90. package/src/common.css +0 -2
  91. package/src/components/ComparisonTable/ComparisonTable.fixture.mobile.tsx +152 -0
  92. package/src/components/ComparisonTable/ComparisonTable.mobile.tsx +121 -0
  93. package/src/components/ComparisonTable/ComparisonTableContent.ts +4 -0
  94. package/src/components/ComparisonTable/HeaderCell.mobile.tsx +50 -0
  95. package/src/components/ComparisonTable/TableCell.mobile.tsx +46 -0
  96. package/src/components/ComparisonTable/TableCell.tsx +3 -2
  97. package/src/components/ComparisonTable/TableColumn.tsx +66 -0
  98. package/src/components/Gallery/Gallery.mobile.tsx +2 -2
  99. package/src/ui-kit/Button/Button.fixture.tsx +2 -6
  100. package/src/ui-kit/SwipeListControl/SwipeListControl.tsx +27 -19
  101. package/src/ui-kit/SwipeListControl/SwipeListControlProps.ts +1 -0
@@ -0,0 +1,46 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import type { CellData } from './ComparisonTableContent';
3
+ import { DIVIDER_CLASSES } from './constants';
4
+
5
+ export interface TableCellProps {
6
+ cell: CellData[];
7
+ rowHeader?: string;
8
+ isLastRow?: boolean;
9
+ isFirstRow?: boolean;
10
+ isFillGradient?: boolean;
11
+ }
12
+
13
+ export const TableCell = JSX<TableCellProps>(({ cell, rowHeader, isFillGradient = false }) => {
14
+ const cellWrapperClasses = `box-border flex flex-col`;
15
+
16
+ const cellClasses = `h-full ${DIVIDER_CLASSES}`;
17
+
18
+ return (
19
+ <div className={cellWrapperClasses} role="cell">
20
+ <div className={cellClasses}>{cell.map(renderCellInner(isFillGradient, rowHeader))}</div>
21
+ </div>
22
+ );
23
+ });
24
+
25
+ const renderCellInner =
26
+ (isFillGradient: boolean, rowHeader?: string) =>
27
+ ({ label, description }: CellData, i: number) =>
28
+ (
29
+ <div key={String(i)} className="flex justify-between text-m-sm py-3.5">
30
+ <div className={`${isFillGradient ? 'text-white/80' : 'text-secondary-text'}`}>
31
+ {rowHeader}
32
+ </div>
33
+ <div className="basis-1/2">
34
+ {label && (
35
+ <div className={`text-right ${isFillGradient ? 'text-white' : ''}`}>{label}</div>
36
+ )}
37
+ {description && (
38
+ <div
39
+ className={`text-right ${isFillGradient ? 'text-white/80' : 'text-secondary-text'}`}
40
+ >
41
+ {description}
42
+ </div>
43
+ )}
44
+ </div>
45
+ </div>
46
+ );
@@ -4,8 +4,9 @@ import { BORDER_CLASSES, DIVIDER_CLASSES, GRADIENT } from './constants';
4
4
 
5
5
  export interface TableCellProps {
6
6
  cell: CellData[];
7
- isLastRow: boolean;
8
- isFirstRow: boolean;
7
+ isLastRow?: boolean;
8
+ isFirstRow?: boolean;
9
+ rowHeader?: string;
9
10
  isFillGradient: boolean;
10
11
  }
11
12
 
@@ -0,0 +1,66 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import type { ButtonVersion } from '../../model/ButtonVersion';
3
+ import type { UniBlockProps } from '../../types';
4
+ import { Button } from '../../ui-kit/Button/Button';
5
+ import { GRADIENT } from './constants';
6
+ import { HeaderCell } from './HeaderCell';
7
+ import { TableCell } from './TableCell';
8
+
9
+ export interface TableColumnProps extends UniBlockProps {
10
+ header: any;
11
+ columnData: any;
12
+ visibleRowLength: number;
13
+ isFillGradient: boolean;
14
+ showRow: boolean;
15
+ onToggleColumn: () => void;
16
+ }
17
+
18
+ export const TableColumn = JSX<TableColumnProps>(
19
+ ({ header, columnData, visibleRowLength = 0, isFillGradient, showRow, onToggleColumn }) => {
20
+ const columnDataView = columnData.slice(0, showRow ? columnData.length : visibleRowLength);
21
+ const gradientClassName = isFillGradient ? GRADIENT : '';
22
+ const buttonVersion: ButtonVersion = isFillGradient ? 'secondary' : 'primary';
23
+ return (
24
+ <div className={`border border-main-stroke rounded-md p-4 mb-3.5 ${gradientClassName}`}>
25
+ <HeaderCell {...header} isFillGradient={isFillGradient} />
26
+ {columnDataView?.length
27
+ ? columnDataView.map(({ rowHeader, cell }, i) => (
28
+ <TableCell
29
+ key={String(i)}
30
+ cell={cell}
31
+ rowHeader={rowHeader}
32
+ isFillGradient={isFillGradient}
33
+ />
34
+ ))
35
+ : null}
36
+
37
+ {showRow && renderButton({ header, buttonVersion })}
38
+ {renderToggleButton({ onToggleColumn, isFillGradient, showRow })}
39
+ </div>
40
+ );
41
+ },
42
+ );
43
+
44
+ const renderButton = ({ header, buttonVersion }) => (
45
+ <Button
46
+ href={header.link.href}
47
+ target={header.link.target}
48
+ version={buttonVersion}
49
+ className="font-medium text-m-sm mt-4 py-[11px]"
50
+ >
51
+ {header.link.text}
52
+ </Button>
53
+ );
54
+
55
+ const renderToggleButton = ({ onToggleColumn, isFillGradient, showRow }) => (
56
+ <div className="mt-5">
57
+ <a
58
+ onClick={onToggleColumn}
59
+ className={`font-medium text-m-sm cursor-pointer ${
60
+ isFillGradient ? 'text-white/80' : 'text-primary-main'
61
+ }`}
62
+ >
63
+ {!showRow ? 'Показать описание' : 'Скрыть'}
64
+ </a>
65
+ </div>
66
+ );
@@ -2,12 +2,12 @@ import { JSX } from '@redneckz/uni-jsx';
2
2
  import { BlockVersion } from '../../model/BlockVersion';
3
3
  import { Button } from '../../ui-kit/Button/Button';
4
4
  import { Heading } from '../../ui-kit/Heading/Heading';
5
+ import { Icon } from '../../ui-kit/Icon/Icon';
5
6
  import { Img } from '../../ui-kit/Img/Img';
6
7
  import { SwipeListControl } from '../../ui-kit/SwipeListControl/SwipeListControl';
7
8
  import type { GalleryCard } from './GalleryContent';
8
9
  import { GalleryItem } from './GalleryContent';
9
10
  import type { GalleryProps } from './GalleryProps';
10
- import { Icon } from '../../ui-kit/Icon/Icon';
11
11
 
12
12
  const blockStyle: Record<BlockVersion, string> = {
13
13
  primary: 'bg-white',
@@ -57,7 +57,7 @@ function renderCard(card: GalleryCard, key: number) {
57
57
  {card.description ? renderDescription(card) : null}
58
58
  {card.items?.length ? renderItems(card.items) : null}
59
59
  </div>
60
- {card?.button?.href ? renderButton(card.button) : null}
60
+ {card?.button?.text ? renderButton(card.button) : null}
61
61
  </div>
62
62
  );
63
63
  }
@@ -9,12 +9,8 @@ export default {
9
9
  <p>Private clients</p>
10
10
  <div className="flex gap-6" data-theme="pc">
11
11
  <Button href="https://www.rshb.ru/" target="_blank" text="Primary" version="primary" />
12
- <Button
13
- href="https://www.rshb.ru/"
14
- target="_blank"
15
- text="Secondary"
16
- version="secondary"
17
- />
12
+ <Button href="https://www.rshb.ru/" target="_blank" text="Link" version="secondary" />
13
+ <Button href="https://www.rshb.ru/" target="_blank" text="Secondary" version="link" />
18
14
  </div>
19
15
  </div>
20
16
  <div>
@@ -1,10 +1,10 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { DEFAULT_GAP, DEFAULT_PADDING } from './constants';
3
+ import { SwipeListControlDots } from './SwipeListControlDots';
4
+ import { SwipeListControlList } from './SwipeListControlList';
2
5
  import type { SwipeListControlProps } from './SwipeListControlProps';
3
- import { getScrollPoints } from './utils/getScrollPoints';
4
6
  import { getIndexParts } from './utils/getIndexParts';
5
- import { SwipeListControlList } from './SwipeListControlList';
6
- import { SwipeListControlDots } from './SwipeListControlDots';
7
- import { DEFAULT_GAP, DEFAULT_PADDING } from './constants';
7
+ import { getScrollPoints } from './utils/getScrollPoints';
8
8
 
9
9
  export const SwipeListControl = JSX<SwipeListControlProps>(
10
10
  ({
@@ -14,6 +14,7 @@ export const SwipeListControl = JSX<SwipeListControlProps>(
14
14
  gap = DEFAULT_GAP,
15
15
  padding = DEFAULT_PADDING,
16
16
  showDots = true,
17
+ onSlideChange,
17
18
  }) => {
18
19
  const [activeIndex, setActiveIndex] = context.useState<number>(0);
19
20
  const [indexFraction, setIndexFraction] = context.useState<number>(0);
@@ -35,28 +36,35 @@ export const SwipeListControl = JSX<SwipeListControlProps>(
35
36
  });
36
37
 
37
38
  const { index, fraction } = getIndexParts(scrollLeft, scrollPoints);
39
+ if (index !== activeIndex && onSlideChange) {
40
+ onSlideChange();
41
+ }
38
42
  setActiveIndex(index);
39
43
  setIndexFraction(fraction);
40
44
  };
41
45
 
42
46
  return (
43
47
  <div className={className}>
44
- <SwipeListControlList
45
- gap={gap}
46
- padding={padding}
47
- activeIndex={activeIndex}
48
- onScroll={handleScroll}
49
- >
50
- {children}
51
- </SwipeListControlList>
52
- <SwipeListControlDots
53
- activeIndex={activeIndex}
54
- indexFraction={indexFraction}
55
- showDots={showDots}
56
- >
57
- {children}
58
- </SwipeListControlDots>
48
+ {renderSwipeList({ gap, padding, activeIndex, handleScroll, children })}
49
+ {renderSwipelistDots({ activeIndex, indexFraction, showDots, children })}
59
50
  </div>
60
51
  );
61
52
  },
62
53
  );
54
+
55
+ const renderSwipeList = ({ gap, padding, activeIndex, handleScroll, children }) => (
56
+ <SwipeListControlList
57
+ gap={gap}
58
+ padding={padding}
59
+ activeIndex={activeIndex}
60
+ onScroll={handleScroll}
61
+ >
62
+ {children}
63
+ </SwipeListControlList>
64
+ );
65
+
66
+ const renderSwipelistDots = ({ activeIndex, indexFraction, showDots, children }) => (
67
+ <SwipeListControlDots activeIndex={activeIndex} indexFraction={indexFraction} showDots={showDots}>
68
+ {children}
69
+ </SwipeListControlDots>
70
+ );
@@ -16,4 +16,5 @@ export interface SwipeContainer {
16
16
  export interface SwipeListControlProps extends SwipeContainer, UniBlockProps {
17
17
  /** @title Точки-индикаторы */
18
18
  showDots?: boolean;
19
+ onSlideChange?: () => void;
19
20
  }