@redneckz/wildless-cms-uni-blocks 0.2.30 → 0.2.34

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 (142) hide show
  1. package/dist/Blocks.d.ts +2 -3
  2. package/dist/Blocks.js +4 -6
  3. package/dist/Blocks.js.map +1 -1
  4. package/dist/ContentPage.js +4 -4
  5. package/dist/ContentPage.js.map +1 -1
  6. package/dist/ContentPageContext.d.ts +4 -1
  7. package/dist/Header/Header.d.ts +7 -0
  8. package/dist/Header/Header.js +25 -0
  9. package/dist/Header/Header.js.map +1 -0
  10. package/dist/Header/HeaderContent.d.ts +9 -0
  11. package/dist/Header/HeaderContent.js +2 -0
  12. package/dist/Header/HeaderContent.js.map +1 -0
  13. package/dist/Header/HeaderSecondaryMenu.d.ts +6 -0
  14. package/dist/Header/HeaderSecondaryMenu.js +11 -0
  15. package/dist/Header/HeaderSecondaryMenu.js.map +1 -0
  16. package/dist/Header/HeaderSecondaryMenuButton.d.ts +5 -0
  17. package/dist/Header/HeaderSecondaryMenuButton.js +6 -0
  18. package/dist/Header/HeaderSecondaryMenuButton.js.map +1 -0
  19. package/dist/Header/index.d.ts +3 -0
  20. package/dist/Header/index.js +5 -0
  21. package/dist/Header/index.js.map +1 -0
  22. package/dist/Header/isSubItemActive.d.ts +3 -0
  23. package/dist/Header/isSubItemActive.js +10 -0
  24. package/dist/Header/isSubItemActive.js.map +1 -0
  25. package/dist/Header/isTopItemActive.d.ts +3 -0
  26. package/dist/Header/isTopItemActive.js +14 -0
  27. package/dist/Header/isTopItemActive.js.map +1 -0
  28. package/dist/Header/mergeTopItems.d.ts +2 -0
  29. package/dist/Header/mergeTopItems.js +10 -0
  30. package/dist/Header/mergeTopItems.js.map +1 -0
  31. package/dist/Icons.d.ts +9 -0
  32. package/dist/Icons.js +16 -4
  33. package/dist/Icons.js.map +1 -1
  34. package/{lib/ProductBlock.d.ts → dist/ProductTile.d.ts} +5 -4
  35. package/dist/ProductTile.js +29 -0
  36. package/dist/ProductTile.js.map +1 -0
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.js +25 -1
  39. package/dist/index.js.map +1 -1
  40. package/dist/types.d.ts +6 -3
  41. package/dist/ui-kit/BlockItem.d.ts +3 -0
  42. package/dist/ui-kit/BlockItem.js +10 -2
  43. package/dist/ui-kit/BlockItem.js.map +1 -1
  44. package/dist/ui-kit/Button.d.ts +3 -2
  45. package/dist/ui-kit/Button.js +13 -5
  46. package/dist/ui-kit/Button.js.map +1 -1
  47. package/dist/ui-kit/HeaderItem.js +2 -3
  48. package/dist/ui-kit/HeaderItem.js.map +1 -1
  49. package/dist/ui-kit/Logo.js +1 -1
  50. package/dist/ui-kit/Logo.js.map +1 -1
  51. package/dist/ui-kit/SVG.d.ts +10 -4
  52. package/dist/ui-kit/SVG.js +2 -2
  53. package/dist/ui-kit/SVG.js.map +1 -1
  54. package/dist/ui-kit/TopItem.d.ts +1 -0
  55. package/dist/ui-kit/TopItem.js +4 -4
  56. package/dist/ui-kit/TopItem.js.map +1 -1
  57. package/dist/useLink.d.ts +6 -3
  58. package/dist/useLink.js +6 -5
  59. package/dist/useLink.js.map +1 -1
  60. package/dist/utils/url.d.ts +4 -0
  61. package/dist/utils/url.js +26 -0
  62. package/dist/utils/url.js.map +1 -0
  63. package/lib/Blocks.d.ts +2 -3
  64. package/lib/Blocks.js +3 -5
  65. package/lib/Blocks.js.map +1 -1
  66. package/lib/ContentPage.js +4 -4
  67. package/lib/ContentPage.js.map +1 -1
  68. package/lib/ContentPageContext.d.ts +4 -1
  69. package/lib/Header/Header.d.ts +7 -0
  70. package/lib/Header/Header.js +23 -0
  71. package/lib/Header/Header.js.map +1 -0
  72. package/lib/Header/HeaderContent.d.ts +9 -0
  73. package/lib/Header/HeaderContent.js +2 -0
  74. package/lib/Header/HeaderContent.js.map +1 -0
  75. package/lib/Header/HeaderSecondaryMenu.d.ts +6 -0
  76. package/lib/Header/HeaderSecondaryMenu.js +9 -0
  77. package/lib/Header/HeaderSecondaryMenu.js.map +1 -0
  78. package/lib/Header/HeaderSecondaryMenuButton.d.ts +5 -0
  79. package/lib/Header/HeaderSecondaryMenuButton.js +4 -0
  80. package/lib/Header/HeaderSecondaryMenuButton.js.map +1 -0
  81. package/lib/Header/index.d.ts +3 -0
  82. package/lib/Header/index.js +2 -0
  83. package/lib/Header/index.js.map +1 -0
  84. package/lib/Header/isSubItemActive.d.ts +3 -0
  85. package/lib/Header/isSubItemActive.js +7 -0
  86. package/lib/Header/isSubItemActive.js.map +1 -0
  87. package/lib/Header/isTopItemActive.d.ts +3 -0
  88. package/lib/Header/isTopItemActive.js +11 -0
  89. package/lib/Header/isTopItemActive.js.map +1 -0
  90. package/lib/Header/mergeTopItems.d.ts +2 -0
  91. package/lib/Header/mergeTopItems.js +7 -0
  92. package/lib/Header/mergeTopItems.js.map +1 -0
  93. package/lib/Icons.d.ts +9 -0
  94. package/lib/Icons.js +9 -3
  95. package/lib/Icons.js.map +1 -1
  96. package/{dist/ProductBlock.d.ts → lib/ProductTile.d.ts} +5 -4
  97. package/lib/ProductTile.js +27 -0
  98. package/lib/ProductTile.js.map +1 -0
  99. package/lib/common.css +1 -1
  100. package/lib/index.d.ts +1 -0
  101. package/lib/index.js +1 -0
  102. package/lib/index.js.map +1 -1
  103. package/lib/types.d.ts +6 -3
  104. package/lib/ui-kit/BlockItem.d.ts +3 -0
  105. package/lib/ui-kit/BlockItem.js +10 -2
  106. package/lib/ui-kit/BlockItem.js.map +1 -1
  107. package/lib/ui-kit/Button.d.ts +3 -2
  108. package/lib/ui-kit/Button.js +13 -5
  109. package/lib/ui-kit/Button.js.map +1 -1
  110. package/lib/ui-kit/HeaderItem.js +3 -4
  111. package/lib/ui-kit/HeaderItem.js.map +1 -1
  112. package/lib/ui-kit/Logo.js +1 -1
  113. package/lib/ui-kit/Logo.js.map +1 -1
  114. package/lib/ui-kit/SVG.d.ts +10 -4
  115. package/lib/ui-kit/SVG.js +2 -2
  116. package/lib/ui-kit/SVG.js.map +1 -1
  117. package/lib/ui-kit/TopItem.d.ts +1 -0
  118. package/lib/ui-kit/TopItem.js +4 -4
  119. package/lib/ui-kit/TopItem.js.map +1 -1
  120. package/lib/useLink.d.ts +6 -3
  121. package/lib/useLink.js +6 -5
  122. package/lib/useLink.js.map +1 -1
  123. package/lib/utils/url.d.ts +4 -0
  124. package/lib/utils/url.js +20 -0
  125. package/lib/utils/url.js.map +1 -0
  126. package/package.json +24 -2
  127. package/dist/Header.d.ts +0 -15
  128. package/dist/Header.js +0 -33
  129. package/dist/Header.js.map +0 -1
  130. package/dist/ProductBlock.js +0 -27
  131. package/dist/ProductBlock.js.map +0 -1
  132. package/dist/ProductColumnBlock.d.ts +0 -13
  133. package/dist/ProductColumnBlock.js +0 -11
  134. package/dist/ProductColumnBlock.js.map +0 -1
  135. package/lib/Header.d.ts +0 -15
  136. package/lib/Header.js +0 -31
  137. package/lib/Header.js.map +0 -1
  138. package/lib/ProductBlock.js +0 -25
  139. package/lib/ProductBlock.js.map +0 -1
  140. package/lib/ProductColumnBlock.d.ts +0 -13
  141. package/lib/ProductColumnBlock.js +0 -9
  142. package/lib/ProductColumnBlock.js.map +0 -1
@@ -3,8 +3,7 @@ exports.HeaderItem = void 0;
3
3
  const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
4
  const uni_jsx_1 = require("@redneckz/uni-jsx");
5
5
  exports.HeaderItem = (0, uni_jsx_1.JSX)(({ className, text, href, target, active, onClick, children }) => {
6
- const linkStyle = active ? 'border-b-brand' : 'border-transparent';
7
- const textStyle = active ? 'text-brand' : 'text-black hover:text-brand';
8
- return ((0, jsx_runtime_1.jsx)("a", { className: `${linkStyle} border-0 border-b-2 border-solid inline-block bg-transparent py-2 text-center font-sans no-underline ${className || ''}`, href: href, target: target, onClick: onClick, children: (0, jsx_runtime_1.jsx)("span", { className: `${textStyle} text-base font-normal`, children: text || children }) }));
6
+ const textStyle = active ? 'text-primary-main' : 'text-primary-text hover:text-primary-main';
7
+ return ((0, jsx_runtime_1.jsxs)("a", { className: `relative inline-block bg-transparent text-center no-underline ${className || ''}`, href: href, target: target, onClick: onClick, children: [(0, jsx_runtime_1.jsx)("span", { className: `font-sans font-normal text-base ${textStyle}`, children: text || children }), active ? ((0, jsx_runtime_1.jsx)("div", { className: "absolute left-0 -bottom-2 w-full h-[2px] bg-primary-main" })) : null] }));
9
8
  });
10
9
  //# sourceMappingURL=HeaderItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderItem.js","sourceRoot":"","sources":["../../src/ui-kit/HeaderItem.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAK3B,QAAA,UAAU,GAAG,IAAA,aAAG,EAC3B,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/D,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,oBAAoB,CAAC;IACnE,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,6BAA6B,CAAC;IACxE,OAAO,CACL,8BACE,SAAS,EAAE,GAAG,SAAS,yGACrB,SAAS,IAAI,EACf,EAAE,EACF,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,YAEhB,iCAAM,SAAS,EAAE,GAAG,SAAS,wBAAwB,YAAG,IAAI,IAAI,QAAQ,GAAQ,GAC9E,CACL,CAAC;AACJ,CAAC,CACF,CAAC"}
1
+ {"version":3,"file":"HeaderItem.js","sourceRoot":"","sources":["../../src/ui-kit/HeaderItem.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAK3B,QAAA,UAAU,GAAG,IAAA,aAAG,EAC3B,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/D,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,2CAA2C,CAAC;IAC7F,OAAO,CACL,+BACE,SAAS,EAAE,iEACT,SAAS,IAAI,EACf,EAAE,EACF,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,aAEhB,iCAAM,SAAS,EAAE,mCAAmC,SAAS,EAAE,YAAG,IAAI,IAAI,QAAQ,GAAQ,EACzF,MAAM,CAAC,CAAC,CAAC,CACR,gCAAK,SAAS,EAAC,0DAA0D,GAAG,CAC7E,CAAC,CAAC,CAAC,IAAI,IACN,CACL,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -11,6 +11,6 @@ const LOGO_PATHS = [
11
11
  'M27.66 40.79c.27-.14.55-.28.8-.43v-5.98h-.8v6.4Z',
12
12
  ];
13
13
  exports.Logo = (0, uni_jsx_1.JSX)(({ className, href, children }) => {
14
- return ((0, jsx_runtime_1.jsxs)("a", { className: `inline-flex items-center font-sans no-underline ${className || ''}`, href: href || 'https://rshb.ru/', target: "_blank", children: [(0, jsx_runtime_1.jsx)(SVG_1.SVG, { className: "text-brand w-10", viewBox: "0 0 40 45", paths: LOGO_PATHS.map((d) => ({ d })) }), (0, jsx_runtime_1.jsx)("span", { className: "text-black text-base font-medium ml-2.5", children: children || 'Россельхозбанк' })] }));
14
+ return ((0, jsx_runtime_1.jsxs)("a", { className: `inline-flex items-center font-sans no-underline ${className || ''}`, href: href || 'https://rshb.ru/', target: "_blank", children: [(0, jsx_runtime_1.jsx)(SVG_1.SVG, { className: "text-primary-main w-10", viewBox: "0 0 40 45", paths: LOGO_PATHS.map((d) => ({ d })) }), (0, jsx_runtime_1.jsx)("span", { className: "text-black text-base font-medium ml-2.5", children: children || 'Россельхозбанк' })] }));
15
15
  });
16
16
  //# sourceMappingURL=Logo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Logo.js","sourceRoot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EAClC,OAAO,EAAC,WAAW,EACnB,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GACrC,EACF,iCAAM,SAAS,EAAC,yCAAyC,YACtD,QAAQ,IAAI,gBAAgB,GACxB,IACL,CACL,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,11 +1,17 @@
1
- interface SVGPath {
2
- d: string;
1
+ interface SVGPathOptions {
3
2
  fill?: string;
3
+ stroke?: string;
4
+ strokeLinecap?: string;
5
+ strokeLinejoin?: string;
6
+ strokeWidth?: string;
7
+ strokeMiterlimit?: string;
8
+ }
9
+ interface SVGPath extends SVGPathOptions {
10
+ d: string;
4
11
  }
5
- export interface SVGProps {
12
+ export interface SVGProps extends SVGPathOptions {
6
13
  className?: string;
7
14
  viewBox?: string;
8
- fill?: string;
9
15
  paths: SVGPath[];
10
16
  }
11
17
  export declare const SVG: (props: import("@redneckz/uni-jsx").PropsWithChildren<SVGProps, any>, context?: any) => any;
@@ -2,7 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
2
2
  exports.SVG = void 0;
3
3
  const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
4
  const uni_jsx_1 = require("@redneckz/uni-jsx");
5
- exports.SVG = (0, uni_jsx_1.JSX)(({ className, viewBox, fill = 'none', paths }) => {
6
- return ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", className: className, viewBox: viewBox, fill: fill, children: paths.map(({ d, fill }, i) => (0, jsx_runtime_1.jsx)("path", { d: d, fill: fill || 'currentColor' }, i)) }));
5
+ exports.SVG = (0, uni_jsx_1.JSX)(({ className, viewBox, fill = 'none', paths, ...commonOptions }) => {
6
+ return ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", className: className, viewBox: viewBox, fill: fill, children: paths.map(({ d, fill, ...options }, i) => ((0, jsx_runtime_1.jsx)("path", { d: d, fill: fill || 'currentColor', ...commonOptions, ...options }, i))) }));
7
7
  });
8
8
  //# sourceMappingURL=SVG.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SVG.js","sourceRoot":"","sources":["../../src/ui-kit/SVG.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAc3B,QAAA,GAAG,GAAG,IAAA,aAAG,EAAW,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IAChF,OAAO,CACL,gCAAK,KAAK,EAAC,4BAA4B,EAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,YACvF,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iCAAc,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,cAAc,IAArC,CAAC,CAAwC,CAAC,GAChF,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"SVG.js","sourceRoot":"","sources":["../../src/ui-kit/SVG.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAqB3B,QAAA,GAAG,GAAG,IAAA,aAAG,EACpB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,GAAG,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,EAAE,EAAE,EAAE;IACjE,OAAO,CACL,gCAAK,KAAK,EAAC,4BAA4B,EAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,YACvF,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CACzC,iCAAc,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,cAAc,KAAM,aAAa,KAAM,OAAO,IAArE,CAAC,CAAwE,CACrF,CAAC,GACE,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -4,6 +4,7 @@ export interface TopItemContent extends LinkContent {
4
4
  }
5
5
  export interface TopItemProps extends TopItemContent {
6
6
  className?: string;
7
+ flat?: boolean;
7
8
  onClick?: (ev: MouseEvent) => any;
8
9
  }
9
10
  export declare const TopItem: (props: import("@redneckz/uni-jsx").PropsWithChildren<TopItemProps, any>, context?: any) => any;
@@ -2,9 +2,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
2
2
  exports.TopItem = void 0;
3
3
  const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
4
  const uni_jsx_1 = require("@redneckz/uni-jsx");
5
- exports.TopItem = (0, uni_jsx_1.JSX)(({ className, text, href, target, active, onClick, children }) => {
6
- const linkStyle = active ? 'border-brand rounded-3xl' : 'border-transparent';
7
- const textStyle = active ? 'text-brand' : 'text-black hover:text-brand';
8
- return ((0, jsx_runtime_1.jsx)("a", { className: `${linkStyle} border border-solid inline-block bg-transparent px-4 py-2 text-center font-sans no-underline ${className || ''}`, href: href, target: target, onClick: onClick, children: (0, jsx_runtime_1.jsx)("span", { className: `${textStyle} text-base font-normal`, children: text || children }) }));
5
+ exports.TopItem = (0, uni_jsx_1.JSX)(({ className, text, href, target, active, flat, onClick, children }) => {
6
+ const linkStyle = active ? 'border-primary-main rounded-3xl' : 'border-transparent';
7
+ const textStyle = active ? 'text-primary-main' : 'text-primary-text hover:text-primary-main';
8
+ return ((0, jsx_runtime_1.jsx)("a", { className: `inline-block border border-solid bg-transparent text-center no-underline ${flat ? '' : 'px-4 py-2'} ${linkStyle} ${className || ''}`, href: href, target: target, onClick: onClick, children: (0, jsx_runtime_1.jsx)("span", { className: `font-sans font-normal text-sm ${textStyle}`, children: text || children }) }));
9
9
  });
10
10
  //# sourceMappingURL=TopItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TopItem.js","sourceRoot":"","sources":["../../src/ui-kit/TopItem.t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,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,YAEhB,iCAAM,SAAS,EAAE,iCAAiC,SAAS,EAAE,YAAG,IAAI,IAAI,QAAQ,GAAQ,GACtF,CACL,CAAC;AACJ,CAAC,CACF,CAAC"}
package/dist/useLink.d.ts CHANGED
@@ -1,8 +1,11 @@
1
- import { ContentPageContext } from './ContentPageContext';
1
+ import { HandlerDecorator, Router } from './ContentPageContext';
2
2
  import type { LinkContent } from './ui-kit/Link';
3
- export declare function useLink({ useRouter, handlerDecorator }: ContentPageContext, link: Partial<LinkContent>): {
3
+ export declare function useLink({ router, handlerDecorator, }: {
4
+ router: Router;
5
+ handlerDecorator?: HandlerDecorator;
6
+ }, link: Partial<LinkContent>): {
7
+ href: string | undefined;
4
8
  onClick: (ev: MouseEvent) => void;
5
9
  text?: string | undefined;
6
- href?: string | undefined;
7
10
  target?: string | undefined;
8
11
  };
package/dist/useLink.js CHANGED
@@ -1,14 +1,15 @@
1
1
  Object.defineProperty(exports, "__esModule", { value: true });
2
2
  exports.useLink = void 0;
3
+ const url_1 = require("./utils/url");
3
4
  const defaultHandlerDecorator = (_) => _;
4
- function useLink({ useRouter, handlerDecorator = defaultHandlerDecorator }, link) {
5
- const router = useRouter();
6
- const { href, target } = link;
5
+ function useLink({ router, handlerDecorator = defaultHandlerDecorator, }, link) {
6
+ const href = (0, url_1.toRelativeHref)(link.href, router.href);
7
7
  return {
8
8
  ...link,
9
+ href,
9
10
  onClick: handlerDecorator((ev) => {
10
- const isLocalHref = href && !href.includes('//');
11
- const isLocalTarget = !target || target === '_self';
11
+ const isLocalHref = href && !(0, url_1.isURL)(href);
12
+ const isLocalTarget = !link.target || link.target === '_self';
12
13
  if (isLocalHref && isLocalTarget) {
13
14
  ev.preventDefault();
14
15
  router.push(href);
@@ -1 +1 @@
1
- {"version":3,"file":"useLink.js","sourceRoot":"","sources":["../src/useLink.ts"],"names":[],"mappings":";;AAGA,MAAM,uBAAuB,GAAoC,CAAC,CA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AM,KAAK,OAAO,CAAC;YAC9D,IAAI,WAAW,IAAI,aAAa,EAAE;gBAChC,EAAE,CAAC,cAAc,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACnB;QACH,CAAC,CAAC;KACH,CAAC;AACJ,CAAC;AApBD,0BAoBC"}
@@ -0,0 +1,4 @@
1
+ export declare const isURL: (href?: string | undefined) => boolean | undefined;
2
+ export declare const withoutQuery: (href?: string | undefined) => string;
3
+ export declare const getOrigin: (href?: string | undefined) => string | undefined;
4
+ export declare const toRelativeHref: (href?: string | undefined, baseURL?: string | undefined) => string | undefined;
@@ -0,0 +1,26 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.toRelativeHref = exports.getOrigin = exports.withoutQuery = exports.isURL = void 0;
3
+ const isURL = (href) => href?.includes('//');
4
+ exports.isURL = isURL;
5
+ const withoutQuery = (href) => (href || '').replace(/\/?\?.*/, '');
6
+ exports.withoutQuery = withoutQuery;
7
+ const getOrigin = (href) => {
8
+ if ((0, exports.isURL)(href)) {
9
+ const url = href;
10
+ const protoSeparator = '://';
11
+ const endOfProto = url.indexOf(protoSeparator);
12
+ const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
13
+ return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
14
+ }
15
+ return undefined;
16
+ };
17
+ exports.getOrigin = getOrigin;
18
+ const toRelativeHref = (href, baseURL) => {
19
+ if (!href) {
20
+ return href;
21
+ }
22
+ const origin = (0, exports.getOrigin)(baseURL);
23
+ return origin ? href.replace(origin, '') || '/' : href;
24
+ };
25
+ exports.toRelativeHref = toRelativeHref;
26
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":";;AAAO,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAAhD,QAAA,KAAK,SAA2C;AAEtD,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAAtE,QAAA,YAAY,gBAA0D;AAE5E,MAAM,SAAS,GAAG,CAAC,IAAa,EAAE,EAAE;IACzC,IAAI,IAAA,aAAK,EAAC,IAAI,CAAC,EAAE;QACf,MAAM,GAAG,GAAG,IAAK,CAAC;QAClB,MAAM,cAAc,GAAG,KAAK,CAAC;QAC7B,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAC/C,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QACzE,OAAO,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;KACjE;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AATW,QAAA,SAAS,aASpB;AAEK,MAAM,cAAc,GAAG,CAAC,IAAa,EAAE,OAAgB,EAAE,EAAE;IAChE,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IACD,MAAM,MAAM,GAAG,IAAA,iBAAS,EAAC,OAAO,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB"}
package/lib/Blocks.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  export declare const Blocks: {
2
- Header: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Header").HeaderProps, any>, context?: any) => any;
3
- ProductColumnBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ProductColumnBlock").ProductColumnBlockProps, any>, context?: any) => any;
2
+ Header: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Header/Header").HeaderProps, any>, context?: any) => any;
4
3
  Text: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Text").TextProps, any>, context?: any) => any;
5
4
  TextWithImage: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./TextWithImage").TextWithImageProps, any>, context?: any) => any;
6
5
  RichText: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./RichText").RichTextProps, any>, context?: any) => any;
7
6
  Placeholder: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Placeholder").PlaceholderProps, any>, context?: any) => any;
8
- ProductBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ProductBlock").ProductBlockProps, any>, context?: any) => any;
7
+ ProductTile: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ProductTile").ProductTileProps, any>, context?: any) => any;
9
8
  };
package/lib/Blocks.js CHANGED
@@ -1,17 +1,15 @@
1
- import { Header } from './Header.js';
1
+ import { Header } from './Header/index.js';
2
2
  import { Placeholder } from './Placeholder.js';
3
- import { ProductColumnBlock } from './ProductColumnBlock.js';
4
3
  import { RichText } from './RichText.js';
5
4
  import { Text } from './Text.js';
6
5
  import { TextWithImage } from './TextWithImage.js';
7
- import { ProductBlock } from './ProductBlock.js';
6
+ import { ProductTile } from './ProductTile.js';
8
7
  export const Blocks = {
9
8
  Header,
10
- ProductColumnBlock,
11
9
  Text,
12
10
  TextWithImage,
13
11
  RichText,
14
12
  Placeholder,
15
- ProductBlock,
13
+ ProductTile,
16
14
  };
17
15
  //# sourceMappingURL=Blocks.js.map
package/lib/Blocks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Blocks.js","sourceRoot":"","sources":["../src/Blocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,MAAM;IACN,kBAAkB;IAClB,IAAI;IACJ,aAAa;IACb,QAAQ;IACR,WAAW;IACX,YAAY;CACb,CAAC"}
1
+ {"version":3,"file":"Blocks.js","sourceRoot":"","sources":["../src/Blocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,MAAM;IACN,IAAI;IACJ,aAAa;IACb,QAAQ;IACR,WAAW;IACX,WAAW;CACZ,CAAC"}
@@ -3,8 +3,8 @@ import { JSX } from '@redneckz/uni-jsx';
3
3
  import { Blocks } from './Blocks.js';
4
4
  import { LikeControl } from './LikeControl.js';
5
5
  const defaultBlockDecorator = ({ blockClassName, block, render }) => render({ blockClassName, block });
6
- export const ContentPage = JSX(({ className, data: { style: pageStyle, blocks, likeControl }, context, blockDecorator = defaultBlockDecorator, }) => {
7
- return (_jsxs("section", { className: "relative", children: [_jsx("div", { className: `grid grid-cols-12 ${style2className(pageStyle)} ${className}`, children: blocks?.length ? blocks.map(renderBlock) : null }), likeControl && (_jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: _jsx(LikeControl, { className: "rounded-tl-lg sticky bottom-0 pointer-events-auto", context: context }) }))] }));
6
+ export const ContentPage = JSX(({ className, data: { style: pageStyle, blocks, likeControl, colorPalette = 'pc' }, context, blockDecorator = defaultBlockDecorator, }) => {
7
+ return (_jsxs("section", { className: "relative", "data-theme": colorPalette, children: [_jsx("div", { className: `grid grid-cols-12 ${style2className(pageStyle)} ${className}`, children: blocks?.length ? blocks.map(renderBlock) : null }), likeControl && (_jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: _jsx(LikeControl, { className: "rounded-tl-lg sticky bottom-0 pointer-events-auto", context: context }) }))] }));
8
8
  function renderBlock(block, i) {
9
9
  const { type } = block;
10
10
  if (!(type in Blocks)) {
@@ -16,8 +16,8 @@ export const ContentPage = JSX(({ className, data: { style: pageStyle, blocks, l
16
16
  blockClassName: style2className(block.style),
17
17
  block,
18
18
  render: (props) => {
19
- const { content, blocks } = props.block;
20
- return (_jsx(BlockComponent, { className: props.blockClassName, context: context, ...content, children: blocks?.length ? blocks.map(renderBlock) : null }, `${type}-${i}`));
19
+ const { version, content, blocks } = props.block;
20
+ return (_jsx(BlockComponent, { className: props.blockClassName, version: version, context: context, ...content, children: blocks?.length ? blocks.map(renderBlock) : null }, `${type}-${i}`));
21
21
  },
22
22
  });
23
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContentPage.js","sourceRoot":"","sources":["../src/ContentPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAmB5C,MAAM,qBAAqB,GAAmB,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,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AAC,qEAAqE,YAClF,KAAC,WAAW,IACV,SAAS,EAAC,mDAAmD,EAC7D,OAAO,EAAE,OAAO,GAChB,GACE,CACP,IACO,CACX,CAAC;IAEF,SAAS,WAAW,CAAC,KAAe,EAAE,CAAS;QAC7C,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,EAAE;YACrB,OAAO,CAAC,IAAI,CAAC,kBAAkB,IAAI,iBAAiB,CAAC,CAAC;YACtD,OAAO,IAAI,CAAC;SACb;QAED,MAAM,cAAc,GAAG,MAAM,CAAC,IAA2B,CAAC,CAAC;QAC3D,OAAO,cAAc,CAAC;YACpB,cAAc,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC;YAC5C,KAAK;YACL,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBAChB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC;gBACjD,OAAO,CACL,KAAC,cAAc,IAEb,SAAS,EAAE,KAAK,CAAC,cAAc,EAC/B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,KACZ,OAAO,YAEV,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,IAN3C,GAAG,IAAI,IAAI,CAAC,EAAE,CAOJ,CAClB,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CACF,CAAC;AAEF,SAAS,eAAe,CAAC,KAAkC;IACzD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACtC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { HeaderContent } from './Header';
1
2
  export interface Router {
2
3
  pathname: string;
3
4
  query: Record<string, string | string[] | undefined>;
@@ -10,8 +11,10 @@ export interface LikeService {
10
11
  like: () => void;
11
12
  dislike: () => void;
12
13
  }
14
+ export declare type HandlerDecorator = <F extends Function>(handler: F) => F;
13
15
  export interface ContentPageContext {
14
16
  useRouter: () => Router;
17
+ useSitemap: () => HeaderContent;
15
18
  useLikeService: () => LikeService;
16
- handlerDecorator?: <F extends Function>(handler: F) => F;
19
+ handlerDecorator?: HandlerDecorator;
17
20
  }
@@ -0,0 +1,7 @@
1
+ import type { ContentPageContext } from '../ContentPageContext';
2
+ import type { HeaderContent } from './HeaderContent';
3
+ export interface HeaderProps extends HeaderContent {
4
+ className?: string;
5
+ context: ContentPageContext;
6
+ }
7
+ export declare const Header: (props: import("@redneckz/uni-jsx").PropsWithChildren<HeaderProps, any>, context?: any) => any;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
+ import { JSX } from '@redneckz/uni-jsx';
3
+ import { HeaderItem } from '../ui-kit/HeaderItem.js';
4
+ import { Logo } from '../ui-kit/Logo.js';
5
+ import { TopItem } from '../ui-kit/TopItem.js';
6
+ import { useLink } from '../useLink.js';
7
+ import { HeaderSecondaryMenu } from './HeaderSecondaryMenu.js';
8
+ import { isSubItemActive } from './isSubItemActive.js';
9
+ import { isTopItemActive } from './isTopItemActive.js';
10
+ import { mergeTopItems } from './mergeTopItems.js';
11
+ export const Header = JSX(({ className, location, context, topItems }) => {
12
+ const router = context.useRouter();
13
+ const sitemap = context.useSitemap();
14
+ const { handlerDecorator } = context;
15
+ const mergedItems = mergeTopItems(sitemap.topItems, topItems);
16
+ const activeTopItem = mergedItems.find(isTopItemActive(router));
17
+ const subItems = activeTopItem?.items;
18
+ const activeSubItem = subItems?.find(isSubItemActive(router));
19
+ const topMenu = mergedItems.map((_, i) => (_jsx(TopItem, { active: _ === activeTopItem, ...useLink({ router, handlerDecorator }, _) }, String(i))));
20
+ const subMenu = subItems?.map((_) => (_jsx(HeaderItem, { className: "mr-8", active: _ === activeSubItem, ...useLink({ router, handlerDecorator }, _) }, _.href)));
21
+ return (_jsxs("div", { className: `pt-5 pb-8 px-20 bg-white rounded-bl-3xl rounded-br-3xl ${className || ''}`, children: [_jsxs("div", { className: "flex items-center", children: [_jsx(Logo, { className: "mr-8" }), topMenu, _jsx(HeaderSecondaryMenu, { location: location, className: "ml-auto" })] }), _jsx("div", { className: "mt-5 h-[1px] bg-main-divider" }), _jsx("div", { className: "mt-5", children: subMenu })] }));
22
+ });
23
+ //# sourceMappingURL=Header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Header.js","sourceRoot":"","sources":["../../src/Header/Header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAOhD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAc,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IACpF,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IACnC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IACrC,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IAErC,MAAM,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CA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Item extends HeaderMenuItem {
4
+ items?: HeaderMenuItem[];
5
+ }
6
+ export interface HeaderContent {
7
+ location?: string;
8
+ topItems?: TopMenuItem[];
9
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=HeaderContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderContent.js","sourceRoot":"","sources":["../../src/Header/HeaderContent.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ interface HeaderSecondaryMenuProps {
2
+ location?: string;
3
+ className?: string;
4
+ }
5
+ export declare const HeaderSecondaryMenu: (props: import("@redneckz/uni-jsx").PropsWithChildren<HeaderSecondaryMenuProps, any>, context?: any) => any;
6
+ export {};
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
+ import { JSX } from '@redneckz/uni-jsx';
3
+ import { GridIcon, LoupeIcon, ProfileIcon } from '../Icons.js';
4
+ import { TopItem } from '../ui-kit/TopItem.js';
5
+ import { HeaderSecondaryMenuButton } from './HeaderSecondaryMenuButton.js';
6
+ export const HeaderSecondaryMenu = JSX(({ location, className }) => {
7
+ return (_jsxs("div", { className: `flex items-center ${className || ''}`, children: [_jsx(TopItem, { className: "mr-5", flat: true, href: "#", text: location }), _jsx(TopItem, { className: "mr-7", flat: true, href: "#", text: "\u041E\u0444\u0438\u0441\u044B \u0438 \u0431\u0430\u043D\u043A\u043E\u043C\u0430\u0442\u044B" }), _jsx(HeaderSecondaryMenuButton, { className: "mr-5 text-primary-text hover:text-primary-main", children: LoupeIcon() }), _jsx(HeaderSecondaryMenuButton, { className: "mr-5 text-primary-text hover:text-primary-main", children: ProfileIcon() }), _jsx(HeaderSecondaryMenuButton, { className: "mr-5 text-main hover:text-secondary-hover w-[32px]", children: GridIcon() })] }));
8
+ });
9
+ //# sourceMappingURL=HeaderSecondaryMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderSecondaryMenu.js","sourceRoot":"","sources":["../../src/Header/HeaderSecondaryMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAOxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAA2B,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;IAC3F,OAAO,CACL,eAAK,SAAS,EAAE,qBAAqB,SAAS,IAAI,EAAE,EAAE,aACpD,KAAC,OAAO,IAAC,SAAS,EAAC,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAC,IAAI,EAAE,QAAQ,GAAI,EACjE,KAAC,OAAO,IAAC,SAAS,EAAC,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAC,IAAI,EAAC,8FAAmB,GAAG,EAC1E,KAAC,yBAAyB,IAAC,SAAS,EAAC,gDAAgD,YAClF,SAAS,EAAE,GACc,EAC5B,KAAC,yBAAyB,IAAC,SAAS,EAAC,gDAAgD,YAClF,WAAW,EAAE,GACY,EAC5B,KAAC,yBAAyB,IAAC,SAAS,EAAC,oDAAoD,YACtF,QAAQ,EAAE,GACe,IACxB,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ interface HeaderSecondaryMenuButtonProps {
2
+ className?: string;
3
+ }
4
+ export declare const HeaderSecondaryMenuButton: (props: import("@redneckz/uni-jsx").PropsWithChildren<HeaderSecondaryMenuButtonProps, any>, context?: any) => any;
5
+ export {};
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
+ import { JSX } from '@redneckz/uni-jsx';
3
+ export const HeaderSecondaryMenuButton = JSX(({ className, children }) => (_jsx("button", { type: "button", className: `border-0 p-0 w-[24px] flex items-center bg-inherit cursor-pointer ${className || ''}`, disabled: true, children: children })));
4
+ //# sourceMappingURL=HeaderSecondaryMenuButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderSecondaryMenuButton.js","sourceRoot":"","sources":["../../src/Header/HeaderSecondaryMenuButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAMxC,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAC1C,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAC3B,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,qEACT,SAAS,IAAI,EACf,EAAE,EACF,QAAQ,EAAE,IAAI,YAEb,QAAQ,GACF,CACV,CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Header } from './Header';
2
+ export type { HeaderProps } from './Header';
3
+ export type { HeaderContent } from './HeaderContent';
@@ -0,0 +1,2 @@
1
+ export { Header } from './Header.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Header/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Router } from '../ContentPageContext';
2
+ import type { LinkContent } from '../ui-kit/Link';
3
+ export declare function isSubItemActive({ href, pathname }: Router): (item: LinkContent) => boolean;
@@ -0,0 +1,7 @@
1
+ import { isURL, withoutQuery } from '../utils/url.js';
2
+ export function isSubItemActive({ href, pathname }) {
3
+ return (item) => {
4
+ return withoutQuery(item.href) === (isURL(item.href) ? withoutQuery(href) : pathname);
5
+ };
6
+ }
7
+ //# sourceMappingURL=isSubItemActive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isSubItemActive.js","sourceRoot":"","sources":["../../src/Header/isSubItemActive.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,UAAU,eAAe,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAU;IACxD,OAAO,CAAC,IAAiB,EAAW,EAAE;QACpC,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACxF,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Router } from '../ContentPageContext';
2
+ import type { LinkContent } from '../ui-kit/Link';
3
+ export declare function isTopItemActive({ href, pathname }: Router): (item: LinkContent) => boolean;
@@ -0,0 +1,11 @@
1
+ import { isURL, withoutQuery } from '../utils/url.js';
2
+ export function isTopItemActive({ href, pathname }) {
3
+ return (item) => {
4
+ const itemHref = withoutQuery(item.href);
5
+ if (isURL(itemHref)) {
6
+ return Boolean(href && href.startsWith(itemHref));
7
+ }
8
+ return Boolean(itemHref && pathname.startsWith(itemHref));
9
+ };
10
+ }
11
+ //# sourceMappingURL=isTopItemActive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isTopItemActive.js","sourceRoot":"","sources":["../../src/Header/isTopItemActive.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,UAAU,eAAe,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAU;IACxD,OAAO,CAAC,IAAiB,EAAW,EAAE;QACpC,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE;YACnB,OAAO,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;SACnD;QACD,OAAO,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { TopMenuItem } from './HeaderContent';
2
+ export declare function mergeTopItems(left?: TopMenuItem[], right?: TopMenuItem[]): TopMenuItem[];
@@ -0,0 +1,7 @@
1
+ const cmp = (a) => (b) => a?.href === b?.href;
2
+ const substitute = (items, substitution) => (items || []).map((_) => substitution?.find(cmp(_)) || _);
3
+ const subtract = (minuend, subtrahend) => (minuend || []).filter((_) => !subtrahend?.find(cmp(_)));
4
+ export function mergeTopItems(left, right) {
5
+ return substitute(left, right).concat(subtract(right, left));
6
+ }
7
+ //# sourceMappingURL=mergeTopItems.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeTopItems.js","sourceRoot":"","sources":["../../src/Header/mergeTopItems.ts"],"names":[],"mappings":"AAEA,MAAM,GAAG,GAAG,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC,EAAE,IAAI,CAAC;AAE1E,MAAM,UAAU,GAAG,CAAC,KAAqB,EAAE,YAA4B,EAAE,EAAE,CACzE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAE5D,MAAM,QAAQ,GAAG,CAAC,OAAuB,EAAE,UAA0B,EAAE,EAAE,CACvE,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3D,MAAM,UAAU,aAAa,CAAC,IAAoB,EAAE,KAAqB;IACvE,OAAO,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAC/D,CAAC"}
package/lib/Icons.d.ts CHANGED
@@ -1,5 +1,14 @@
1
+ export declare const CalendarIcon: () => any;
2
+ export declare const EmptyWalletIcon: () => any;
3
+ export declare const PercentageSquareIcon: () => any;
4
+ export declare const LoupeIcon: () => any;
5
+ export declare const ProfileIcon: () => any;
6
+ export declare const GridIcon: () => any;
1
7
  export declare const Icons: {
2
8
  EmptyWalletIcon: () => any;
3
9
  PercentageSquareIcon: () => any;
4
10
  CalendarIcon: () => any;
11
+ LoupeIcon: () => any;
12
+ ProfileIcon: () => any;
13
+ GridIcon: () => any;
5
14
  };
package/lib/Icons.js CHANGED
@@ -1,10 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
- const CalendarIcon = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("path", { stroke: "#1C1C1C", strokeLinecap: "round", strokeLinejoin: "round", strokeMiterlimit: "10", strokeWidth: "2", d: "M8 2v3M16 2v3M3.5 9.09h17M3 13.01V8.5c0-3 1.5-5 5-5h8c3.5 0 5 2 5 5V17c0 3-1.5 5-5 5H8c-3.5 0-5-2-5-5" }), _jsx("path", { stroke: "#42AB44", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "3", d: "M15.991 13h.018M15.991 17.006h.018M11.991 13h.018M11.991 17.006h.018M7.991 13h.018M7.991 17.006h.018" })] }));
3
- const EmptyWalletIcon = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("path", { stroke: "#292D32", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M2.5 14.07v-2.56c0-2.07 1.69-3.76 3.76-3.76h11.48c2.07 0 3.76 1.69 3.76 3.76v1.44h-2.02c-.56 0-1.07.22-1.44.6-.42.41-.66 1-.6 1.63.09 1.08 1.08 1.87 2.16 1.87h1.9v1.19c0 2.07-1.69 3.76-3.76 3.76H6.26c-2.07 0-3.76-1.69-3.76-3.76M12.28 2.17a1.9 1.9 0 0 1 2.57 1.78v3.8" }), _jsx("path", { stroke: "#292D32", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M2.5 12.41V7.84c0-1.19.73-2.25 1.84-2.67l3.97-1.5M22.56 13.97v2.06c0 .55-.44 1-1 1.02H19.6c-1.08 0-2.07-.79-2.16-1.87-.06-.63.18-1.22.6-1.63.37-.38.88-.6 1.44-.6h2.08c.56.02 1 .47 1 1.02Z" }), _jsx("path", { stroke: "#42AB44", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M7 12h7" })] }));
4
- const PercentageSquareIcon = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("path", { stroke: "#1C1C1C", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M2 13.05V15c0 5 2 7 7 7h6c5 0 7-2 7-7V9c0-5-2-7-7-7H9C4 2 2 4 2 9" }), _jsx("path", { stroke: "#42AB44", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m8.32 15.27 6.54-6.54M8.73 10.37a1.23 1.23 0 1 0 0-2.46 1.23 1.23 0 0 0 0 2.46ZM15.27 16.09a1.23 1.23 0 1 0 0-2.46 1.23 1.23 0 0 0 0 2.46Z" })] }));
2
+ export const CalendarIcon = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("path", { stroke: "#1C1C1C", strokeLinecap: "round", strokeLinejoin: "round", strokeMiterlimit: "10", strokeWidth: "2", d: "M8 2v3M16 2v3M3.5 9.09h17M3 13.01V8.5c0-3 1.5-5 5-5h8c3.5 0 5 2 5 5V17c0 3-1.5 5-5 5H8c-3.5 0-5-2-5-5" }), _jsx("path", { stroke: "#42AB44", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "3", d: "M15.991 13h.018M15.991 17.006h.018M11.991 13h.018M11.991 17.006h.018M7.991 13h.018M7.991 17.006h.018" })] }));
3
+ export const EmptyWalletIcon = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("path", { stroke: "#292D32", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M2.5 14.07v-2.56c0-2.07 1.69-3.76 3.76-3.76h11.48c2.07 0 3.76 1.69 3.76 3.76v1.44h-2.02c-.56 0-1.07.22-1.44.6-.42.41-.66 1-.6 1.63.09 1.08 1.08 1.87 2.16 1.87h1.9v1.19c0 2.07-1.69 3.76-3.76 3.76H6.26c-2.07 0-3.76-1.69-3.76-3.76M12.28 2.17a1.9 1.9 0 0 1 2.57 1.78v3.8" }), _jsx("path", { stroke: "#292D32", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M2.5 12.41V7.84c0-1.19.73-2.25 1.84-2.67l3.97-1.5M22.56 13.97v2.06c0 .55-.44 1-1 1.02H19.6c-1.08 0-2.07-.79-2.16-1.87-.06-.63.18-1.22.6-1.63.37-.38.88-.6 1.44-.6h2.08c.56.02 1 .47 1 1.02Z" }), _jsx("path", { stroke: "#42AB44", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M7 12h7" })] }));
4
+ export const PercentageSquareIcon = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("path", { stroke: "#1C1C1C", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M2 13.05V15c0 5 2 7 7 7h6c5 0 7-2 7-7V9c0-5-2-7-7-7H9C4 2 2 4 2 9" }), _jsx("path", { stroke: "#42AB44", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m8.32 15.27 6.54-6.54M8.73 10.37a1.23 1.23 0 1 0 0-2.46 1.23 1.23 0 0 0 0 2.46ZM15.27 16.09a1.23 1.23 0 1 0 0-2.46 1.23 1.23 0 0 0 0 2.46Z" })] }));
5
+ export const LoupeIcon = () => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M19.5 20.5 16 17a7.5 7.5 0 1 1 2.376-3" }) }));
6
+ export const ProfileIcon = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M14.94 8.54c.22.44.35.94.35 1.47-.01 1.77-1.4 3.22-3.16 3.27a.963.963 0 0 0-.24 0 3.269 3.269 0 0 1-3.16-3.27c0-1.81 1.46-3.28 3.28-3.28M18.74 19.88A9.934 9.934 0 0 1 12 22.5c-2.6 0-4.96-.99-6.74-2.62.1-.94.7-1.86 1.77-2.58 2.74-1.82 7.22-1.82 9.94 0 1.07.72 1.67 1.64 1.77 2.58Z" }), _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M4 6.5c-1.25 1.67-2 3.75-2 6 0 5.52 4.48 10 10 10s10-4.48 10-10-4.48-10-10-10c-1.43 0-2.8.3-4.03.85" })] }));
7
+ export const GridIcon = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 32 32", children: [_jsx("rect", { y: ".5", width: "32", height: "32", rx: "16", fill: "currentColor" }), _jsx("path", { fill: "#1c1c1c", d: "M13 11.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0ZM13 16.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0ZM11.5 23a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM18 11.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0ZM16.5 18a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM18 21.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0ZM21.5 13a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM23 16.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0ZM21.5 23a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z" })] }));
5
8
  export const Icons = {
6
9
  EmptyWalletIcon,
7
10
  PercentageSquareIcon,
8
11
  CalendarIcon,
12
+ LoupeIcon,
13
+ ProfileIcon,
14
+ GridIcon,
9
15
  };
10
16
  //# sourceMappingURL=Icons.js.map
package/lib/Icons.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Icons.js","sourceRoot":"","sources":["../src/Icons.tsx"],"names":[],"mappings":";AAAA,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,CACzB,eAAK,KAAK,EAAC,4BAA4B,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW,aACrE,eACE,MAAM,EAAC,SAAS,EAChB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,gBAAgB,EAAC,IAAI,EACrB,WAAW,EAAC,GAAG,EACf,CAAC,EAAC,uGAAuG,GACzG,EACF,eACE,MAAM,EAAC,SAAS,EAChB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,WAAW,EAAC,GAAG,EACf,CAAC,EAAC,sGAAsG,GACxG,IACE,CACP,CAAC;AACF,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,CAC5B,eAAK,KAAK,EAAC,4BAA4B,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW,aACrE,eACE,MAAM,EAAC,SAAS,EAChB,aAAa,EAAC,O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rE,eACE,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,WAAW,EAAC,GAAG,EACf,CAAC,EAAC,wCAAwC,GAC1C,GACE,CACP,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,CAC/B,eAAK,KAAK,EAAC,4BAA4B,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW,aACrE,eACE,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,WAAW,EAAC,GAAG,EACf,CAAC,EAAC,yRAAyR,GAC3R,EACF,eACE,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,WAAW,EAAC,GAAG,EACf,CAAC,EAAC,qGAAqG,GACvG,IACE,CACP,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,CAC5B,eAAK,KAAK,EAAC,4BAA4B,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW,aACrE,eAAM,CAAC,EAAC,IAAI,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,IAAI,EAAC,cAAc,GAAG,EAClE,eACE,IAAI,EAAC,SAAS,EACd,CAAC,EAAC,uZAAuZ,GACzZ,IACE,CACP,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,eAAe;IACf,oBAAoB;IACpB,YAAY;IACZ,SAAS;IACT,WAAW;IACX,QAAQ;CACT,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { ContentPageContext } from './ContentPageContext';
2
2
  import { Icons } from './Icons';
3
- import { Picture } from './types';
3
+ import { BlockVersion, Picture } from './types';
4
4
  import type { ButtonProps } from './ui-kit/Button';
5
5
  import { BreadcrumbProps } from './ui-kit/Breadcrumb';
6
6
  export interface Benefit {
@@ -8,7 +8,7 @@ export interface Benefit {
8
8
  description?: string;
9
9
  icon?: keyof typeof Icons;
10
10
  }
11
- export interface ProductBlockContent {
11
+ export interface ProductTileContent {
12
12
  title?: string;
13
13
  description?: string;
14
14
  breadcrumbs?: BreadcrumbProps[];
@@ -17,8 +17,9 @@ export interface ProductBlockContent {
17
17
  items?: string[];
18
18
  buttons?: ButtonProps[];
19
19
  }
20
- export interface ProductBlockProps extends ProductBlockContent {
20
+ export interface ProductTileProps extends ProductTileContent {
21
21
  className?: string;
22
+ version?: BlockVersion;
22
23
  context: ContentPageContext;
23
24
  }
24
- export declare const ProductBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<ProductBlockProps, any>, context?: any) => any;
25
+ export declare const ProductTile: (props: import("@redneckz/uni-jsx").PropsWithChildren<ProductTileProps, any>, context?: any) => any;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
+ import { JSX } from '@redneckz/uni-jsx';
3
+ import { Icons } from './Icons.js';
4
+ import { Img } from './Img.js';
5
+ import { BlockItem } from './ui-kit/BlockItem.js';
6
+ import { Button } from './ui-kit/Button.js';
7
+ import { Breadcrumb } from './ui-kit/Breadcrumb.js';
8
+ import { useLink } from './useLink.js';
9
+ const productBlockStyleMap = {
10
+ primary: 'bg-white text-primary-text',
11
+ secondary: 'bg-brand text-white',
12
+ };
13
+ export const ProductTile = JSX(({ className, context, title, description, breadcrumbs, benefits, buttons, image, items, version = 'primary', }) => {
14
+ const router = context.useRouter();
15
+ const { handlerDecorator } = context;
16
+ return (_jsxs("section", { className: `font-sans p-9 rounded-[40px] flex justify-between items-stretch relative ${className || ''} ${productBlockStyleMap[version]}`, children: [_jsxs("div", { className: "flex flex-col", children: [breadcrumbs?.length ? (_jsx("div", { className: "text-xs mb-6", children: join(_jsx("span", { className: "text-secondary mx-2", children: "/" }))(breadcrumbs.map((breadcrumb, i) => (_jsx(Breadcrumb, { ...useLink({ router, handlerDecorator }, { className: 'text-secondary', ...breadcrumb }) }, String(i))))) })) : null, title && _jsx("h1", { className: "font-medium text-title m-0 whitespace-pre-wrap", children: title }), description && (_jsx("div", { className: "font-normal text-base max-w-[600px] mt-4", children: description })), benefits?.length ? (_jsx("div", { className: "flex gap-6 mt-7", children: benefits.map(renderBenefit) })) : null, items?.length ? (_jsx("section", { className: "space-y-2.5 mt-5", role: "list", children: items.map((_, i) => (_jsx(BlockItem, { text: _, version: version }, String(i)))) })) : null, buttons?.length ? (_jsx("div", { className: "flex mt-auto gap-4", children: buttons.map((button, index) => renderButton(useLink({ router, handlerDecorator }, button), index)) })) : null] }), image && _jsx(Img, { image: image, className: "absolute bottom-9 right-9" })] }));
17
+ });
18
+ function renderBenefit(benefit, i) {
19
+ return (_jsxs("div", { className: "flex gap-4 items-center", children: [benefit.icon && (_jsx("div", { className: "h-11 w-11 min-w-11 min-h-11 bg-main rounded-full p-[10px] box-border", children: Icons[benefit.icon]() })), _jsxs("div", { className: "flex gap-1 flex-col h-full", children: [_jsx("h4", { className: "font-medium text-xl m-0", children: benefit.label }), benefit.description && (_jsx("div", { className: "font-normal text-sm text-secondary", children: benefit.description }))] })] }, String(i)));
20
+ }
21
+ function renderButton(button, i) {
22
+ return button?.text ? (_jsx(Button, { ...button, className: "mt-8", version: button.version }, String(i))) : null;
23
+ }
24
+ function join(sep) {
25
+ return (list) => list.reduce((acc, el) => (acc.length ? acc.concat(sep, el) : [el]), []);
26
+ }
27
+ //# sourceMappingURL=ProductTile.js.map