@redneckz/wildless-cms-uni-blocks 0.2.57 → 0.2.60

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 (149) hide show
  1. package/dist/BaseTile.d.ts +4 -3
  2. package/dist/BaseTile.js +24 -11
  3. package/dist/BaseTile.js.map +1 -1
  4. package/dist/Blocks.d.ts +3 -1
  5. package/dist/Blocks.js +2 -0
  6. package/dist/Blocks.js.map +1 -1
  7. package/dist/Icons/AppleIcon.d.ts +1 -0
  8. package/dist/Icons/AppleIcon.js +6 -0
  9. package/dist/Icons/AppleIcon.js.map +1 -0
  10. package/dist/Icons/PlayMarket.d.ts +1 -0
  11. package/dist/Icons/PlayMarket.js +6 -0
  12. package/dist/Icons/PlayMarket.js.map +1 -0
  13. package/dist/Icons/index.d.ts +2 -0
  14. package/dist/Icons/index.js +5 -1
  15. package/dist/Icons/index.js.map +1 -1
  16. package/dist/MobileAppTile.d.ts +2 -1
  17. package/dist/MobileAppTile.js +2 -2
  18. package/dist/MobileAppTile.js.map +1 -1
  19. package/dist/ProductBlock.js +1 -1
  20. package/dist/ProductBlock.js.map +1 -1
  21. package/dist/ProductBlockInner.js +1 -1
  22. package/dist/ProductBlockInner.js.map +1 -1
  23. package/dist/ProductGallery.js +1 -1
  24. package/dist/ProductGallery.js.map +1 -1
  25. package/dist/ProductTile.js +3 -3
  26. package/dist/ProductTile.js.map +1 -1
  27. package/dist/PromoTile.d.ts +8 -0
  28. package/dist/PromoTile.js +18 -0
  29. package/dist/PromoTile.js.map +1 -0
  30. package/dist/Tile.js +14 -1
  31. package/dist/Tile.js.map +1 -1
  32. package/dist/api/DaDataAPI.js +2 -2
  33. package/dist/api/DaDataAPI.js.map +1 -1
  34. package/dist/content-page-repository/ContentPageRepository.js +1 -1
  35. package/dist/content-page-repository/ContentPageRepository.js.map +1 -1
  36. package/dist/content-page-repository/index.d.ts +0 -1
  37. package/dist/content-page-repository/index.js +1 -3
  38. package/dist/content-page-repository/index.js.map +1 -1
  39. package/dist/index.d.ts +2 -1
  40. package/dist/index.js +3 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/{content-page-repository/toMobilePage.d.ts → toMobilePage.d.ts} +1 -1
  43. package/dist/{content-page-repository/toMobilePage.js → toMobilePage.js} +0 -0
  44. package/dist/toMobilePage.js.map +1 -0
  45. package/dist/types.d.ts +2 -0
  46. package/dist/ui-kit/Button.d.ts +1 -3
  47. package/dist/ui-kit/Button.js +3 -3
  48. package/dist/ui-kit/Button.js.map +1 -1
  49. package/dist/ui-kit/IconButton.d.ts +6 -0
  50. package/dist/ui-kit/IconButton.js +11 -0
  51. package/dist/ui-kit/IconButton.js.map +1 -0
  52. package/dist/utils/getColSpan.d.ts +1 -0
  53. package/dist/utils/getColSpan.js +9 -0
  54. package/dist/utils/getColSpan.js.map +1 -0
  55. package/dist/utils/getGeolocation.d.ts +1 -0
  56. package/dist/utils/getGeolocation.js +5 -0
  57. package/dist/utils/getGeolocation.js.map +1 -0
  58. package/lib/BaseTile.d.ts +4 -3
  59. package/lib/BaseTile.js +24 -11
  60. package/lib/BaseTile.js.map +1 -1
  61. package/lib/Blocks.d.ts +3 -1
  62. package/lib/Blocks.js +2 -0
  63. package/lib/Blocks.js.map +1 -1
  64. package/lib/Icons/AppleIcon.d.ts +1 -0
  65. package/lib/Icons/AppleIcon.js +3 -0
  66. package/lib/Icons/AppleIcon.js.map +1 -0
  67. package/lib/Icons/PlayMarket.d.ts +1 -0
  68. package/lib/Icons/PlayMarket.js +3 -0
  69. package/lib/Icons/PlayMarket.js.map +1 -0
  70. package/lib/Icons/index.d.ts +2 -0
  71. package/lib/Icons/index.js +2 -0
  72. package/lib/Icons/index.js.map +1 -1
  73. package/lib/MobileAppTile.d.ts +2 -1
  74. package/lib/MobileAppTile.js +2 -2
  75. package/lib/MobileAppTile.js.map +1 -1
  76. package/lib/ProductBlock.js +1 -1
  77. package/lib/ProductBlock.js.map +1 -1
  78. package/lib/ProductBlockInner.js +1 -1
  79. package/lib/ProductBlockInner.js.map +1 -1
  80. package/lib/ProductGallery.js +1 -1
  81. package/lib/ProductGallery.js.map +1 -1
  82. package/lib/ProductTile.js +3 -3
  83. package/lib/ProductTile.js.map +1 -1
  84. package/lib/PromoTile.d.ts +8 -0
  85. package/lib/PromoTile.js +16 -0
  86. package/lib/PromoTile.js.map +1 -0
  87. package/lib/Tile.js +14 -1
  88. package/lib/Tile.js.map +1 -1
  89. package/lib/api/DaDataAPI.js +2 -2
  90. package/lib/api/DaDataAPI.js.map +1 -1
  91. package/lib/common.css +1 -1
  92. package/lib/content-page-repository/ContentPageRepository.js +1 -1
  93. package/lib/content-page-repository/ContentPageRepository.js.map +1 -1
  94. package/lib/content-page-repository/index.d.ts +0 -1
  95. package/lib/content-page-repository/index.js +0 -1
  96. package/lib/content-page-repository/index.js.map +1 -1
  97. package/lib/index.d.ts +2 -1
  98. package/lib/index.js +1 -0
  99. package/lib/index.js.map +1 -1
  100. package/lib/{content-page-repository/toMobilePage.d.ts → toMobilePage.d.ts} +1 -1
  101. package/lib/{content-page-repository/toMobilePage.js → toMobilePage.js} +0 -0
  102. package/lib/toMobilePage.js.map +1 -0
  103. package/lib/types.d.ts +2 -0
  104. package/lib/ui-kit/Button.d.ts +1 -3
  105. package/lib/ui-kit/Button.js +3 -3
  106. package/lib/ui-kit/Button.js.map +1 -1
  107. package/lib/ui-kit/IconButton.d.ts +6 -0
  108. package/lib/ui-kit/IconButton.js +9 -0
  109. package/lib/ui-kit/IconButton.js.map +1 -0
  110. package/lib/utils/getColSpan.d.ts +1 -0
  111. package/lib/utils/getColSpan.js +6 -0
  112. package/lib/utils/getColSpan.js.map +1 -0
  113. package/lib/utils/getGeolocation.d.ts +1 -0
  114. package/lib/utils/getGeolocation.js +2 -0
  115. package/lib/utils/getGeolocation.js.map +1 -0
  116. package/package.json +1 -1
  117. package/src/BaseTile.tsx +34 -18
  118. package/src/Blocks.ts +3 -0
  119. package/src/ContentPage.fixture.tsx +1 -1
  120. package/src/ContentPage.page.json +35 -22
  121. package/src/Icons/AppleIcon.tsx +15 -0
  122. package/src/Icons/PlayMarket.tsx +8 -0
  123. package/src/Icons/index.ts +2 -0
  124. package/src/MobileAppTile.tsx +4 -3
  125. package/src/ProductBlock.tsx +3 -1
  126. package/src/ProductBlockInner.tsx +3 -3
  127. package/src/ProductGallery.tsx +7 -3
  128. package/src/ProductTile.tsx +3 -3
  129. package/src/PromoTile.tsx +47 -0
  130. package/src/Tile.tsx +18 -1
  131. package/src/api/DaDataAPI.ts +2 -2
  132. package/src/content-page-repository/ContentPageRepository.ts +1 -1
  133. package/src/content-page-repository/index.ts +0 -1
  134. package/src/index.ts +4 -1
  135. package/src/{content-page-repository/toMobilePage.ts → toMobilePage.ts} +1 -1
  136. package/src/types.ts +2 -0
  137. package/src/ui-kit/Button.fixture.tsx +22 -0
  138. package/src/ui-kit/Button.tsx +12 -5
  139. package/src/ui-kit/IconButton.tsx +27 -0
  140. package/src/utils/getColSpan.ts +5 -0
  141. package/src/utils/{getCurrentPosition.ts → getGeolocation.ts} +1 -1
  142. package/dist/content-page-repository/toMobilePage.js.map +0 -1
  143. package/dist/utils/getCurrentPosition.d.ts +0 -1
  144. package/dist/utils/getCurrentPosition.js +0 -5
  145. package/dist/utils/getCurrentPosition.js.map +0 -1
  146. package/lib/content-page-repository/toMobilePage.js.map +0 -1
  147. package/lib/utils/getCurrentPosition.d.ts +0 -1
  148. package/lib/utils/getCurrentPosition.js +0 -2
  149. package/lib/utils/getCurrentPosition.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { getCurrentPosition } from '../utils/getCurrentPosition';
1
+ import { getGeolocation } from '../utils/getGeolocation';
2
2
 
3
3
  import type { DaDataResult } from '../types';
4
4
 
@@ -9,7 +9,7 @@ export function DaDataAPI(baseURL = '') {
9
9
  }
10
10
 
11
11
  try {
12
- const coords = await getCurrentPosition();
12
+ const coords = await getGeolocation();
13
13
  const response = await fetch(`${baseURL}/geolocate`, {
14
14
  method: 'POST',
15
15
  mode: 'cors',
@@ -1,7 +1,7 @@
1
1
  import glob from 'glob';
2
2
  import util from 'util';
3
+ import { toMobilePage } from '../toMobilePage';
3
4
  import type { ContentPageDef } from '../types';
4
- import { toMobilePage } from './toMobilePage';
5
5
  import type { TransformationOptions } from './TransformationOptions';
6
6
  import { transformContentPage } from './transformContentPage';
7
7
 
@@ -1,2 +1 @@
1
1
  export { ContentPageRepository } from './ContentPageRepository';
2
- export { toMobilePage } from './toMobilePage';
package/src/index.ts CHANGED
@@ -16,13 +16,16 @@ export type {
16
16
  export type {
17
17
  ContentPageContext,
18
18
  Router,
19
+ AsyncDataHook,
20
+ GeolocationHook,
19
21
  LikeService,
20
- Search,
21
22
  HandlerDecorator,
23
+ Search,
22
24
  } from './ContentPageContext';
23
25
 
24
26
  export { ContentPageHead } from './ContentPageHead';
25
27
  export { ContentPage } from './ContentPage';
28
+ export { toMobilePage } from './toMobilePage';
26
29
 
27
30
  export { Blocks } from './Blocks';
28
31
  export type { BlockContent } from './Blocks';
@@ -1,4 +1,4 @@
1
- import type { BlockDef, ContentPageDef } from '../types';
1
+ import type { BlockDef, ContentPageDef } from './types';
2
2
 
3
3
  export function toMobilePage(contentPage: ContentPageDef): ContentPageDef {
4
4
  const blocks = contentPage.blocks?.filter(({ mobile }) => !mobile?.hidden).map(toMobileBlock);
package/src/types.ts CHANGED
@@ -15,6 +15,8 @@ import type { ContentPageContext } from './ContentPageContext';
15
15
  export type ColorPalette = 'pc' | 'bc' | 'eo';
16
16
 
17
17
  export type BlockVersion = 'primary' | 'secondary';
18
+ export type ButtonVersion = 'primary' | 'secondary';
19
+ export type TitleSize = 'S' | 'M' | 'L' | 'XL';
18
20
 
19
21
  export interface BlockDef {
20
22
  type: string;
@@ -1,6 +1,7 @@
1
1
  import '../setup-fixture';
2
2
 
3
3
  import { Button } from './Button';
4
+ import { IconButton } from './IconButton';
4
5
 
5
6
  export default {
6
7
  all: (
@@ -60,6 +61,27 @@ export default {
60
61
  />
61
62
  </div>
62
63
  </div>
64
+ <div>
65
+ <p>With Icon</p>
66
+ <div className="flex gap-6" data-theme="pc">
67
+ <IconButton
68
+ href="https://www.rshb.ru/"
69
+ target="_blank"
70
+ aboveText="Доступно в"
71
+ text="Google Play"
72
+ version="secondary"
73
+ icon="PlayMarket"
74
+ />
75
+ <IconButton
76
+ href="https://www.rshb.ru/"
77
+ target="_blank"
78
+ aboveText="Загрузите в"
79
+ text="App Store"
80
+ version="secondary"
81
+ icon="AppleIcon"
82
+ />
83
+ </div>
84
+ </div>
63
85
  </div>
64
86
  ),
65
87
  'primary (Private clients)': (
@@ -1,7 +1,6 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import type { LinkContent } from '../types';
2
+ import type { ButtonVersion, LinkContent } from '../types';
3
3
 
4
- type ButtonVersion = 'primary' | 'secondary';
5
4
  export interface ButtonProps extends LinkContent {
6
5
  className?: string;
7
6
  onClick?: (ev: MouseEvent) => any;
@@ -21,7 +20,7 @@ const buttonDisabledStyleMap: Record<ButtonVersion, string> = {
21
20
  secondary: 'bg-secondary-light text-secondary-text',
22
21
  };
23
22
 
24
- const styleButton = 'inline-block rounded-md px-9 py-3.5 text-center font-sans';
23
+ const styleButton = 'inline-block rounded-md px-8 py-2 text-center font-sans';
25
24
 
26
25
  export const Button = JSX<ButtonProps>(
27
26
  ({
@@ -46,7 +45,11 @@ export const Button = JSX<ButtonProps>(
46
45
  className || ''
47
46
  }`}
48
47
  >
49
- <span className="text-sm font-medium">{text || children}</span>
48
+ {children ? (
49
+ <div>{children}</div>
50
+ ) : (
51
+ <div className="text-sm font-medium py-1.5">{text}</div>
52
+ )}
50
53
  </div>
51
54
  );
52
55
  }
@@ -59,7 +62,11 @@ export const Button = JSX<ButtonProps>(
59
62
  onClick={onClick}
60
63
  aria-label={ariaLabel}
61
64
  >
62
- <span className="text-sm font-medium">{text || children}</span>
65
+ {children ? (
66
+ <div>{children}</div>
67
+ ) : (
68
+ <div className="text-sm font-medium py-1.5">{text}</div>
69
+ )}
63
70
  </a>
64
71
  );
65
72
  },
@@ -0,0 +1,27 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { AppleIcon, PlayMarket } from '../Icons/index';
3
+ import type { ButtonProps } from './Button';
4
+ import { Button } from './Button';
5
+
6
+ const ICONS = { AppleIcon, PlayMarket };
7
+
8
+ export interface IconButtonProps extends ButtonProps {
9
+ icon?: string;
10
+ aboveText?: string;
11
+ }
12
+
13
+ export const IconButton = JSX<IconButtonProps>((props) => {
14
+ return (
15
+ <Button {...props}>
16
+ {props.icon ? (
17
+ <div className="flex items-center">
18
+ <div className="mr-2">{ICONS[props.icon as keyof typeof ICONS]?.()}</div>
19
+ <div>
20
+ <div className="text-xxs text-left">{props.aboveText}</div>
21
+ <div className="text-sm font-medium text-left">{props.text}</div>
22
+ </div>
23
+ </div>
24
+ ) : null}
25
+ </Button>
26
+ );
27
+ });
@@ -0,0 +1,5 @@
1
+ export const getColSpan = (className: string) => {
2
+ const colSpanPrefix = 'col-span-';
3
+ const colSpanStr = className.split(/\s+/).find((_) => _.startsWith(colSpanPrefix));
4
+ return colSpanStr ? parseInt(colSpanStr.substring(colSpanPrefix.length), 10) : 12;
5
+ };
@@ -1,4 +1,4 @@
1
- export const getCurrentPosition = async () =>
1
+ export const getGeolocation = async () =>
2
2
  new Promise<GeolocationCoordinates>((resolve) =>
3
3
  navigator.geolocation.getCurrentPosition(({ coords }) => resolve(coords)),
4
4
  );
@@ -1 +0,0 @@
1
- {"version":3,"file":"toMobilePage.js","sourceRoot":"","sources":["../../src/content-page-repository/toMobilePage.ts"],"names":[],"mappings":";;AAEA,SAAgB,YAAY,CAAC,WAA2B;IACtD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9F,OAAO;QACL,GAAG,WAAW;QACd,MAAM;KACP,CAAC;AACJ,CAAC;AAND,oCAMC;AAED,SAAS,aAAa,CAAC,KAAe;IACpC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,IAAI,MAAM,EAAE;QACV,OAAO;YACL,GAAG,KAAK;YACR,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK;SACzD,CAAC;KACH;SAAM;QACL,OAAO,KAAK,CAAC;KACd;AACH,CAAC"}
@@ -1 +0,0 @@
1
- export declare const getCurrentPosition: () => Promise<GeolocationCoordinates>;
@@ -1,5 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.getCurrentPosition = void 0;
3
- const getCurrentPosition = async () => new Promise((resolve) => navigator.geolocation.getCurrentPosition(({ coords }) => resolve(coords)));
4
- exports.getCurrentPosition = getCurrentPosition;
5
- //# sourceMappingURL=getCurrentPosition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getCurrentPosition.js","sourceRoot":"","sources":["../../src/utils/getCurrentPosition.ts"],"names":[],"mappings":";;AAAO,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE,CAC3C,IAAI,OAAO,CAAyB,CAAC,OAAO,EAAE,EAAE,CAC9C,SAAS,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAC1E,CAAC;AAHS,QAAA,kBAAkB,sBAG3B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"toMobilePage.js","sourceRoot":"","sources":["../../src/content-page-repository/toMobilePage.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,WAA2B;IACtD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9F,OAAO;QACL,GAAG,WAAW;QACd,MAAM;KACP,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,KAAe;IACpC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,IAAI,MAAM,EAAE;QACV,OAAO;YACL,GAAG,KAAK;YACR,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK;SACzD,CAAC;KACH;SAAM;QACL,OAAO,KAAK,CAAC;KACd;AACH,CAAC"}
@@ -1 +0,0 @@
1
- export declare const getCurrentPosition: () => Promise<GeolocationCoordinates>;
@@ -1,2 +0,0 @@
1
- export const getCurrentPosition = async () => new Promise((resolve) => navigator.geolocation.getCurrentPosition(({ coords }) => resolve(coords)));
2
- //# sourceMappingURL=getCurrentPosition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getCurrentPosition.js","sourceRoot":"","sources":["../../src/utils/getCurrentPosition.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE,CAC3C,IAAI,OAAO,CAAyB,CAAC,OAAO,EAAE,EAAE,CAC9C,SAAS,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAC1E,CAAC"}