@redneckz/wildless-cms-uni-blocks 0.9.0 → 0.9.2

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 (105) hide show
  1. package/bin/migration-scripts/0.8.24.js +6 -0
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +18 -12
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/CarouselEventCard/CarouselEventCard.d.ts +1 -1
  6. package/bundle/components/CarouselProductCard/CarouselProductCard.d.ts +1 -1
  7. package/bundle/components/CarouselProductCard/CarouselProductCardContent.d.ts +2 -1
  8. package/bundle/components/Footer/FooterContent.d.ts +2 -2
  9. package/bundle/components/ProductBlock/ProductBlockContent.d.ts +2 -0
  10. package/dist/components/CarouselEventCard/CarouselEventCard.d.ts +1 -1
  11. package/dist/components/CarouselEventCard/CarouselEventCard.js +9 -3
  12. package/dist/components/CarouselEventCard/CarouselEventCard.js.map +1 -1
  13. package/dist/components/CarouselProductCard/CarouselProductCard.d.ts +1 -1
  14. package/dist/components/CarouselProductCard/CarouselProductCard.js +9 -5
  15. package/dist/components/CarouselProductCard/CarouselProductCard.js.map +1 -1
  16. package/dist/components/CarouselProductCard/CarouselProductCardContent.d.ts +2 -1
  17. package/dist/components/Filtration/FiltrationInner.js +1 -1
  18. package/dist/components/Filtration/FiltrationInner.js.map +1 -1
  19. package/dist/components/Footer/FooterContent.d.ts +2 -2
  20. package/dist/components/ProductBlock/ProductBlockContent.d.ts +2 -0
  21. package/dist/components/ProductBlock/ProductBlockInner.js +2 -2
  22. package/dist/components/ProductBlock/ProductBlockInner.js.map +1 -1
  23. package/dist/ui-kit/Foldable/DefaultFoldButton.js +3 -5
  24. package/dist/ui-kit/Foldable/DefaultFoldButton.js.map +1 -1
  25. package/lib/common.css +1 -1
  26. package/lib/components/CarouselEventCard/CarouselEventCard.d.ts +1 -1
  27. package/lib/components/CarouselEventCard/CarouselEventCard.js +9 -3
  28. package/lib/components/CarouselEventCard/CarouselEventCard.js.map +1 -1
  29. package/lib/components/CarouselProductCard/CarouselProductCard.d.ts +1 -1
  30. package/lib/components/CarouselProductCard/CarouselProductCard.js +9 -5
  31. package/lib/components/CarouselProductCard/CarouselProductCard.js.map +1 -1
  32. package/lib/components/CarouselProductCard/CarouselProductCardContent.d.ts +2 -1
  33. package/lib/components/Filtration/FiltrationInner.js +1 -1
  34. package/lib/components/Filtration/FiltrationInner.js.map +1 -1
  35. package/lib/components/Footer/FooterContent.d.ts +2 -2
  36. package/lib/components/ProductBlock/ProductBlock.fixture.d.ts +1 -0
  37. package/lib/components/ProductBlock/ProductBlockContent.d.ts +2 -0
  38. package/lib/components/ProductBlock/ProductBlockInner.js +2 -2
  39. package/lib/components/ProductBlock/ProductBlockInner.js.map +1 -1
  40. package/lib/ui-kit/Foldable/DefaultFoldButton.js +3 -5
  41. package/lib/ui-kit/Foldable/DefaultFoldButton.js.map +1 -1
  42. package/mobile/bundle/bundle.umd.js +4 -6
  43. package/mobile/bundle/bundle.umd.min.js +1 -1
  44. package/mobile/bundle/components/CarouselEventCard/CarouselEventCard.d.ts +1 -1
  45. package/mobile/bundle/components/CarouselProductCard/CarouselProductCard.d.ts +1 -1
  46. package/mobile/bundle/components/CarouselProductCard/CarouselProductCardContent.d.ts +2 -1
  47. package/mobile/bundle/components/Footer/FooterContent.d.ts +2 -2
  48. package/mobile/bundle/components/ProductBlock/ProductBlockContent.d.ts +2 -0
  49. package/mobile/dist/components/CarouselEventCard/CarouselEventCard.d.ts +1 -1
  50. package/mobile/dist/components/CarouselEventCard/CarouselEventCard.js +9 -3
  51. package/mobile/dist/components/CarouselEventCard/CarouselEventCard.js.map +1 -1
  52. package/mobile/dist/components/CarouselProductCard/CarouselProductCard.d.ts +1 -1
  53. package/mobile/dist/components/CarouselProductCard/CarouselProductCard.js +9 -5
  54. package/mobile/dist/components/CarouselProductCard/CarouselProductCard.js.map +1 -1
  55. package/mobile/dist/components/CarouselProductCard/CarouselProductCardContent.d.ts +2 -1
  56. package/mobile/dist/components/Filtration/FiltrationInner.js +1 -1
  57. package/mobile/dist/components/Filtration/FiltrationInner.js.map +1 -1
  58. package/mobile/dist/components/Footer/FooterContent.d.ts +2 -2
  59. package/mobile/dist/components/ProductBlock/ProductBlockContent.d.ts +2 -0
  60. package/mobile/dist/ui-kit/Foldable/DefaultFoldButton.js +3 -5
  61. package/mobile/dist/ui-kit/Foldable/DefaultFoldButton.js.map +1 -1
  62. package/mobile/lib/components/CarouselEventCard/CarouselEventCard.d.ts +1 -1
  63. package/mobile/lib/components/CarouselEventCard/CarouselEventCard.js +9 -3
  64. package/mobile/lib/components/CarouselEventCard/CarouselEventCard.js.map +1 -1
  65. package/mobile/lib/components/CarouselProductCard/CarouselProductCard.d.ts +1 -1
  66. package/mobile/lib/components/CarouselProductCard/CarouselProductCard.js +9 -5
  67. package/mobile/lib/components/CarouselProductCard/CarouselProductCard.js.map +1 -1
  68. package/mobile/lib/components/CarouselProductCard/CarouselProductCardContent.d.ts +2 -1
  69. package/mobile/lib/components/Filtration/FiltrationInner.js +1 -1
  70. package/mobile/lib/components/Filtration/FiltrationInner.js.map +1 -1
  71. package/mobile/lib/components/Footer/FooterContent.d.ts +2 -2
  72. package/mobile/lib/components/ProductBlock/ProductBlockContent.d.ts +2 -0
  73. package/mobile/lib/ui-kit/Foldable/DefaultFoldButton.js +3 -5
  74. package/mobile/lib/ui-kit/Foldable/DefaultFoldButton.js.map +1 -1
  75. package/mobile/src/components/CarouselCatalogCard/CarouselCatalogCard.example.json +0 -1
  76. package/mobile/src/components/CarouselEventCard/CarouselEventCard.example.json +1 -3
  77. package/mobile/src/components/CarouselEventCard/CarouselEventCard.tsx +19 -9
  78. package/mobile/src/components/CarouselProductCard/CarouselProductCard.example.json +0 -1
  79. package/mobile/src/components/CarouselProductCard/CarouselProductCard.tsx +21 -12
  80. package/mobile/src/components/CarouselProductCard/CarouselProductCardContent.ts +3 -1
  81. package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCard.example.json +0 -2
  82. package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCard.example.json +0 -1
  83. package/mobile/src/components/Filtration/FiltrationInner.tsx +2 -2
  84. package/mobile/src/components/Footer/Footer.ui.json +1 -11
  85. package/mobile/src/components/Footer/FooterContent.ts +2 -3
  86. package/mobile/src/components/ProductBlock/ProductBlock.example.json +2 -1
  87. package/mobile/src/components/ProductBlock/ProductBlockContent.ts +2 -0
  88. package/mobile/src/ui-kit/Foldable/DefaultFoldButton.tsx +3 -9
  89. package/package.json +1 -1
  90. package/src/components/CarouselCatalogCard/CarouselCatalogCard.example.json +0 -1
  91. package/src/components/CarouselEventCard/CarouselEventCard.example.json +1 -3
  92. package/src/components/CarouselEventCard/CarouselEventCard.tsx +19 -9
  93. package/src/components/CarouselProductCard/CarouselProductCard.example.json +0 -1
  94. package/src/components/CarouselProductCard/CarouselProductCard.tsx +21 -12
  95. package/src/components/CarouselProductCard/CarouselProductCardContent.ts +3 -1
  96. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.example.json +0 -2
  97. package/src/components/CarouselTariffsCard/CarouselTariffsCard.example.json +0 -1
  98. package/src/components/Filtration/FiltrationInner.tsx +2 -2
  99. package/src/components/Footer/Footer.ui.json +1 -11
  100. package/src/components/Footer/FooterContent.ts +2 -3
  101. package/src/components/ProductBlock/ProductBlock.example.json +2 -1
  102. package/src/components/ProductBlock/ProductBlock.fixture.tsx +17 -0
  103. package/src/components/ProductBlock/ProductBlockContent.ts +2 -0
  104. package/src/components/ProductBlock/ProductBlockInner.tsx +4 -1
  105. package/src/ui-kit/Foldable/DefaultFoldButton.tsx +3 -9
@@ -36,6 +36,8 @@ export type ProductBlockInnerContent = HeadlineProps &
36
36
  * @hidden
37
37
  */
38
38
  textBlockClassName?: string;
39
+ /** @title Картинка справа/текст слева */
40
+ directionRight?: boolean;
39
41
  };
40
42
 
41
43
  /**
@@ -16,19 +16,13 @@ interface DefaultFoldButtonProps {
16
16
 
17
17
  export const DefaultFoldButton = JSX<DefaultFoldButtonProps>(
18
18
  ({ className = '', label, icon, dataTheme = '', disabled = false, onClick }) => {
19
- const STATE_STYLE =
20
- 'hover:bg-primary-hover focus:border-primary-text active:bg-primary-active outline-none';
21
- const DIMENSIONS_STYLE = 'flex justify-center w-full px-0 py-5';
22
-
23
19
  return (
24
20
  <button
25
21
  className={style(
26
- 'border border-transparent bg-primary-main font-sans text-white cursor-pointer',
27
- STATE_STYLE,
28
- DIMENSIONS_STYLE,
22
+ 'flex justify-center w-full px-0 py-5 border border-transparent outline-none focus:border-primary-text',
29
23
  disabled
30
- ? 'bg-main-divider text-main-disabled cursor-not-allowed hover:bg-main-divider active:bg-main-divider'
31
- : '',
24
+ ? 'bg-main-divider text-main-disabled hover:bg-main-divider'
25
+ : 'bg-primary-main text-white hover:bg-primary-hove',
32
26
  className,
33
27
  )}
34
28
  onClick={onClick}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -9,7 +9,6 @@
9
9
  }
10
10
  },
11
11
  "button": {
12
- "href": "",
13
12
  "text": "Подробнее",
14
13
  "target": "_self",
15
14
  "version": "primary",
@@ -8,7 +8,5 @@
8
8
  }
9
9
  },
10
10
  "title": "Заголовок",
11
- "description": "Описание",
12
- "target": null,
13
- "href": null
11
+ "description": "Описание"
14
12
  }
@@ -1,19 +1,29 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
3
+ import { getIconWithVersion } from '../../utils/getIconWithVersion';
3
4
  import { Heading } from '../../ui-kit/Heading/Heading';
4
5
  import { Img } from '../../ui-kit/Img/Img';
5
- import { Text } from '../../ui-kit/Text/Text';
6
- import { getIconWithVersion } from '../../utils/getIconWithVersion';
7
6
  import { style } from '../../utils/style';
8
- import type { UniBlockProps } from '../../model/JSXBlock';
7
+ import { Text } from '../../ui-kit/Text/Text';
8
+ import { useLink } from '../../hooks/useLink';
9
9
  import type { CarouselEventCardContent } from './CarouselEventCardContent';
10
+ import type { UniBlockProps } from '../../model/JSXBlock';
10
11
 
11
12
  export interface CarouselEventCardProps extends CarouselEventCardContent, UniBlockProps {}
12
13
 
13
14
  export const CarouselEventCard = JSX<CarouselEventCardProps>(
14
- ({ className = '', icon, title, description, href, target, ...rest }) => (
15
- <BlockWrapper className={style('flex flex-col w-[365px]', className)} {...rest}>
16
- <a href={href} target={target} role="link">
15
+ ({ className = '', icon, title, description, href, target, ...rest }) => {
16
+ const link = useLink();
17
+ const adjustedProps = link({ href, target });
18
+ const tagName = href ? 'a' : 'section';
19
+
20
+ return (
21
+ <BlockWrapper
22
+ className={style('flex flex-col w-[365px]', className)}
23
+ extraProps={adjustedProps}
24
+ tag={tagName}
25
+ {...rest}
26
+ >
17
27
  {icon?.icon ? <Img image={getIconWithVersion(icon)} asSVG /> : null}
18
28
  {icon?.src ? <Img image={icon} /> : null}
19
29
  {title ? (
@@ -26,7 +36,7 @@ export const CarouselEventCard = JSX<CarouselEventCardProps>(
26
36
  </Text>
27
37
  </div>
28
38
  ) : null}
29
- </a>
30
- </BlockWrapper>
31
- ),
39
+ </BlockWrapper>
40
+ );
41
+ },
32
42
  );
@@ -17,7 +17,6 @@
17
17
  },
18
18
  "title": "Заголовок 1",
19
19
  "description": "Описание 1",
20
- "href": "/credit-cards",
21
20
  "version": "primary",
22
21
  "isDotted": true,
23
22
  "items": [
@@ -1,34 +1,41 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import type { BlockVersion } from '../../model/BlockVersion';
3
- import type { UniBlockProps } from '../../model/JSXBlock';
4
- import type { Picture } from '../../model/Picture';
5
2
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
6
- import { renderButtonsSection } from '../../ui-kit/Button/renderButtonsSection';
3
+ import { HEADLINE_SMALL_VERSION } from '../Headline/headlineVersionStyles';
7
4
  import { Img } from '../../ui-kit/Img/Img';
8
5
  import { List } from '../../ui-kit/List/List';
9
6
  import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
10
- import { Text } from '../../ui-kit/Text/Text';
7
+ import { renderButtonsSection } from '../../ui-kit/Button/renderButtonsSection';
11
8
  import { style } from '../../utils/style';
12
- import { HEADLINE_SMALL_VERSION } from '../Headline/headlineVersionStyles';
9
+ import { Text } from '../../ui-kit/Text/Text';
10
+ import { useLink } from '../../hooks/useLink';
11
+ import type { BlockVersion } from '../../model/BlockVersion';
13
12
  import type { CarouselProductCardContent, ListProps } from './CarouselProductCardContent';
13
+ import type { Picture } from '../../model/Picture';
14
+ import type { UniBlockProps } from '../../model/JSXBlock';
14
15
 
15
16
  export interface CarouselProductCardProps extends CarouselProductCardContent, UniBlockProps {}
16
17
 
17
18
  export const CarouselProductCard = JSX<CarouselProductCardProps>(
18
19
  ({
20
+ additionalDescription,
21
+ align = 'text-center',
22
+ button = {},
19
23
  className = '',
20
- title,
21
- headlineSmallVersion = 'H6',
22
24
  description,
23
- additionalDescription,
25
+ headlineSmallVersion = 'H6',
26
+ href,
24
27
  icon,
28
+ isDotted = true,
25
29
  items = [],
26
- button = {},
30
+ target,
31
+ title,
27
32
  version = 'primary',
28
- isDotted = true,
29
- align = 'text-center',
30
33
  ...rest
31
34
  }) => {
35
+ const link = useLink();
36
+ const adjustedProps = link({ href, target });
37
+ const tagName = href ? 'a' : 'section';
38
+
32
39
  return (
33
40
  <BlockWrapper
34
41
  className={style(
@@ -37,6 +44,8 @@ export const CarouselProductCard = JSX<CarouselProductCardProps>(
37
44
  align,
38
45
  className,
39
46
  )}
47
+ extraProps={adjustedProps}
48
+ tag={tagName}
40
49
  version={version}
41
50
  {...rest}
42
51
  >
@@ -3,6 +3,7 @@ import type { ButtonCommonIconProps } from '../../model/Button';
3
3
  import type { AdditionalDescriptionProps, HeadlineSmallProps } from '../../model/HeadlineType';
4
4
  import type { UniBlockContent } from '../../model/JSXBlock';
5
5
  import type { IconProps } from '../../model/Picture';
6
+ import type { LinkCommonProps } from '../../model/LinkProps';
6
7
  import type { TextAlign } from '../../ui-kit/Text/TextProps';
7
8
 
8
9
  /**
@@ -21,7 +22,8 @@ export type CarouselProductCardContent = UniBlockContent &
21
22
  AdditionalDescriptionProps &
22
23
  IconProps &
23
24
  ButtonCommonIconProps &
24
- BulletsProps & {
25
+ BulletsProps &
26
+ LinkCommonProps & {
25
27
  /** @title Список */
26
28
  items?: ListProps[];
27
29
  align?: TextAlign;
@@ -18,8 +18,6 @@
18
18
  },
19
19
  "title": "Заголовок 1",
20
20
  "description": "Описание 1",
21
- "target": null,
22
- "href": null,
23
21
  "socialMedia": [
24
22
  {
25
23
  "href": "https://t.me",
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "title": "Заголовок карточки",
3
3
  "button": {
4
- "href": "",
5
4
  "text": "Кнопка",
6
5
  "target": "_self",
7
6
  "version": "secondary"
@@ -51,8 +51,8 @@ export const FiltrationInner = JSX<FiltrationInnerProps>(
51
51
  }}
52
52
  renderFoldButton={({ isUnfolded, onToggle }) => (
53
53
  <DefaultFoldButton
54
- className="mt-11"
55
- disabled={topItemsCount > hiddenBlocks.length}
54
+ className={style('mt-11', topItemsCount < 1 ? 'hidden' : '')}
55
+ disabled={!hiddenBlocks?.length}
56
56
  label={label}
57
57
  icon={ICONS[Number(isUnfolded)]}
58
58
  dataTheme={rest.options?.page?.colorPalette}
@@ -1,11 +1 @@
1
- {
2
- "content": {
3
- "subMenu": {
4
- "items": {
5
- "icon": {
6
- "ui:field": "icon"
7
- }
8
- }
9
- }
10
- }
11
- }
1
+ {}
@@ -1,6 +1,7 @@
1
1
  import type { DescriptionProps } from '../../model/HeadlineType';
2
2
  import type { LinkProps } from '../../model/LinkProps';
3
3
  import type { IconProps } from '../../model/Picture';
4
+ import type { UniBlockContent } from '../../model/JSXBlock';
4
5
 
5
6
  /**
6
7
  * @title Тип контакта
@@ -27,7 +28,5 @@ export type SubMenuItem = LinkProps & IconProps;
27
28
 
28
29
  /**
29
30
  * @title Подвал
30
- * @hidden
31
31
  */
32
- // eslint-disable-next-line @typescript-eslint/ban-types
33
- export type FooterContent = {};
32
+ export type FooterContent = UniBlockContent & {};
@@ -46,6 +46,7 @@
46
46
  "icon": "SignDocsIcon"
47
47
  }
48
48
  }
49
- ]
49
+ ],
50
+ "directionRight": true
50
51
  }
51
52
  }
@@ -93,6 +93,23 @@ export default {
93
93
  />
94
94
  </div>
95
95
  ),
96
+ 'primary with back button direction left': (
97
+ <div className="container grid grid-cols-12">
98
+ <ProductBlock
99
+ className="col-span-12"
100
+ backwardButton={backwardButton}
101
+ headlineVersion="L"
102
+ title="Потребительский кредит наличными"
103
+ description="Кредит наличными без залога и поручительства. Потребительский кредит на любые цели. Нужен только паспорт."
104
+ benefitsCountOfRow={2}
105
+ benefits={benefits}
106
+ benefitsVersion="normal"
107
+ buttons={buttons}
108
+ image={image}
109
+ directionRight={false}
110
+ />
111
+ </div>
112
+ ),
96
113
  'primary with color benefits': (
97
114
  <div className="container grid grid-cols-12">
98
115
  <ProductBlock
@@ -36,6 +36,8 @@ export type ProductBlockInnerContent = HeadlineProps &
36
36
  * @hidden
37
37
  */
38
38
  textBlockClassName?: string;
39
+ /** @title Картинка справа/текст слева */
40
+ directionRight?: boolean;
39
41
  };
40
42
 
41
43
  /**
@@ -29,12 +29,16 @@ export const ProductBlockInner = JSX<ProductBlockInnerProps>(
29
29
  version = 'primary',
30
30
  isDotted = true,
31
31
  textBlockClassName = '',
32
+ directionRight = true,
32
33
  }) => {
33
34
  const benefitsCount = benefits?.filter((_) => _.label)?.length;
34
35
  const benefitsContainerStyles = getBenefitsContainerStyles(benefitsCountOfRow);
35
36
 
36
37
  return (
37
38
  <div className={style('flex grow justify-between items-stretch h-full', className)}>
39
+ {image?.src ? (
40
+ <Img className={`mt-[-50px] ${directionRight ? 'order-2' : ''}`} image={image} />
41
+ ) : null}
38
42
  <div className={style('flex flex-col', textBlockClassName)}>
39
43
  <Headline
40
44
  className="!p-0 max-w-[600px]"
@@ -67,7 +71,6 @@ export const ProductBlockInner = JSX<ProductBlockInnerProps>(
67
71
  {footnote ? <p className="text-m-light pt-12">{footnote}</p> : null}
68
72
  </div>
69
73
  </div>
70
- {image?.src && <Img className="mt-[-50px]" image={image} />}
71
74
  </div>
72
75
  );
73
76
  },
@@ -16,19 +16,13 @@ interface DefaultFoldButtonProps {
16
16
 
17
17
  export const DefaultFoldButton = JSX<DefaultFoldButtonProps>(
18
18
  ({ className = '', label, icon, dataTheme = '', disabled = false, onClick }) => {
19
- const STATE_STYLE =
20
- 'hover:bg-primary-hover focus:border-primary-text active:bg-primary-active outline-none';
21
- const DIMENSIONS_STYLE = 'flex justify-center w-full px-0 py-5';
22
-
23
19
  return (
24
20
  <button
25
21
  className={style(
26
- 'border border-transparent bg-primary-main font-sans text-white cursor-pointer',
27
- STATE_STYLE,
28
- DIMENSIONS_STYLE,
22
+ 'flex justify-center w-full px-0 py-5 border border-transparent outline-none focus:border-primary-text',
29
23
  disabled
30
- ? 'bg-main-divider text-main-disabled cursor-not-allowed hover:bg-main-divider active:bg-main-divider'
31
- : '',
24
+ ? 'bg-main-divider text-main-disabled hover:bg-main-divider'
25
+ : 'bg-primary-main text-white hover:bg-primary-hove',
32
26
  className,
33
27
  )}
34
28
  onClick={onClick}