@sima-land/moleculas 16.0.0-alpha.21 → 16.0.0-alpha.23

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 (141) hide show
  1. package/README.md +1 -1
  2. package/common/components/hover-slider/hover-slider-nav.d.ts +7 -0
  3. package/common/components/hover-slider/hover-slider-nav.js +21 -0
  4. package/common/components/hover-slider/hover-slider-nav.js.map +1 -0
  5. package/common/components/hover-slider/hover-slider-nav.m.scss +22 -0
  6. package/common/components/hover-slider/hover-slider.d.ts +9 -0
  7. package/common/components/hover-slider/hover-slider.js +88 -0
  8. package/common/components/hover-slider/hover-slider.js.map +1 -0
  9. package/common/components/hover-slider/hover-slider.m.scss +36 -0
  10. package/common/components/hover-slider/index.d.ts +3 -0
  11. package/common/components/hover-slider/index.js +9 -0
  12. package/common/components/hover-slider/index.js.map +1 -0
  13. package/common/components/hover-slider/types.d.ts +28 -0
  14. package/common/components/hover-slider/types.js.map +1 -0
  15. package/common/components/hover-slider/utils.d.ts +8 -0
  16. package/common/components/hover-slider/utils.js +23 -0
  17. package/common/components/hover-slider/utils.js.map +1 -0
  18. package/common/components/media-gallery/utils.d.ts +1 -1
  19. package/common/components/media-gallery/utils.js +1 -1
  20. package/common/components/product-image/index.d.ts +3 -0
  21. package/common/components/product-image/index.js +8 -0
  22. package/common/components/product-image/index.js.map +1 -0
  23. package/common/components/product-image/product-image.d.ts +10 -0
  24. package/common/components/product-image/product-image.js +33 -0
  25. package/common/components/product-image/product-image.js.map +1 -0
  26. package/common/components/product-image/product-image.m.scss +62 -0
  27. package/common/components/product-image/types.d.ts +30 -0
  28. package/common/components/product-image/types.js +3 -0
  29. package/common/components/product-image/types.js.map +1 -0
  30. package/common/components/product-image/utils.d.ts +3 -0
  31. package/common/components/product-image/utils.js +6 -0
  32. package/common/components/product-image/utils.js.map +1 -0
  33. package/common/components/product-info/index.d.ts +4 -1
  34. package/common/components/product-info/index.js +5 -2
  35. package/common/components/product-info/index.js.map +1 -1
  36. package/common/components/product-info/parts/adult-confirm-button.d.ts +7 -0
  37. package/common/components/product-info/parts/adult-confirm-button.js +20 -0
  38. package/common/components/product-info/parts/adult-confirm-button.js.map +1 -0
  39. package/common/components/product-info/parts/badges.d.ts +7 -0
  40. package/common/components/product-info/parts/badges.js +20 -0
  41. package/common/components/product-info/parts/badges.js.map +1 -0
  42. package/common/components/product-info/parts/badges.m.scss +3 -0
  43. package/common/components/product-info/parts/cart-control.d.ts +7 -0
  44. package/common/components/product-info/parts/cart-control.js +19 -0
  45. package/common/components/product-info/parts/cart-control.js.map +1 -0
  46. package/common/components/product-info/parts/cart-control.m.scss +41 -0
  47. package/common/components/product-info/parts/footer.d.ts +7 -0
  48. package/common/components/product-info/parts/footer.js +22 -0
  49. package/common/components/product-info/parts/footer.js.map +1 -0
  50. package/common/components/product-info/parts/footer.m.scss +3 -0
  51. package/common/components/product-info/parts/image-button.d.ts +7 -0
  52. package/common/components/product-info/parts/image-button.js +39 -0
  53. package/common/components/product-info/parts/image-button.js.map +1 -0
  54. package/common/components/product-info/parts/image-button.m.scss +40 -0
  55. package/common/components/product-info/parts/image.d.ts +7 -0
  56. package/common/components/product-info/parts/image.js +27 -0
  57. package/common/components/product-info/parts/image.js.map +1 -0
  58. package/common/components/product-info/parts/image.m.scss +24 -0
  59. package/common/components/product-info/parts/index.d.ts +34 -0
  60. package/common/components/product-info/parts/index.js +38 -0
  61. package/common/components/product-info/parts/index.js.map +1 -0
  62. package/common/components/product-info/parts/media.d.ts +7 -0
  63. package/common/components/product-info/parts/media.js +19 -0
  64. package/common/components/product-info/parts/media.js.map +1 -0
  65. package/common/components/product-info/parts/media.m.scss +10 -0
  66. package/common/components/product-info/parts/parts.m.scss +15 -0
  67. package/common/components/product-info/parts/prices.d.ts +7 -0
  68. package/common/components/product-info/parts/prices.js +26 -0
  69. package/common/components/product-info/parts/prices.js.map +1 -0
  70. package/common/components/product-info/parts/prices.m.scss +28 -0
  71. package/common/components/product-info/parts/rating-counter.m.scss +12 -0
  72. package/common/components/product-info/parts/rating-couter.d.ts +7 -0
  73. package/common/components/product-info/parts/rating-couter.js +20 -0
  74. package/common/components/product-info/parts/rating-couter.js.map +1 -0
  75. package/common/components/product-info/parts/secondary-info.d.ts +7 -0
  76. package/common/components/product-info/parts/secondary-info.js +19 -0
  77. package/common/components/product-info/parts/secondary-info.js.map +1 -0
  78. package/common/components/product-info/parts/secondary-info.m.scss +8 -0
  79. package/common/components/product-info/parts/title.d.ts +7 -0
  80. package/common/components/product-info/parts/title.js +24 -0
  81. package/common/components/product-info/parts/title.js.map +1 -0
  82. package/common/components/product-info/parts/title.m.scss +23 -0
  83. package/common/components/product-info/parts/trademark-link.d.ts +7 -0
  84. package/common/components/product-info/parts/trademark-link.js +20 -0
  85. package/common/components/product-info/parts/trademark-link.js.map +1 -0
  86. package/common/components/product-info/parts/trademark-link.m.scss +9 -0
  87. package/common/components/product-info/parts/wait-list-add-link.d.ts +7 -0
  88. package/common/components/product-info/parts/wait-list-add-link.js +20 -0
  89. package/common/components/product-info/parts/wait-list-add-link.js.map +1 -0
  90. package/common/components/product-info/parts/wait-list-added-link.d.ts +7 -0
  91. package/common/components/product-info/parts/wait-list-added-link.js +22 -0
  92. package/common/components/product-info/parts/wait-list-added-link.js.map +1 -0
  93. package/common/components/product-info/parts/wait-list-added-link.m.scss +13 -0
  94. package/common/components/product-info/product-info.d.ts +3 -6
  95. package/common/components/product-info/product-info.js +15 -10
  96. package/common/components/product-info/product-info.js.map +1 -1
  97. package/common/components/product-info/types.d.ts +59 -2
  98. package/common/components/product-info/utils.d.ts +3 -0
  99. package/common/components/product-info/utils.js +7 -2
  100. package/common/components/product-info/utils.js.map +1 -1
  101. package/common/components/rating-counter/rating-counter.js +1 -1
  102. package/common/components/rating-counter/rating-counter.js.map +1 -1
  103. package/common/hooks/index.d.ts +3 -19
  104. package/common/hooks/index.js +7 -36
  105. package/common/hooks/index.js.map +1 -1
  106. package/common/hooks/use-client-width.d.ts +8 -0
  107. package/common/hooks/use-client-width.js +28 -0
  108. package/common/hooks/use-client-width.js.map +1 -0
  109. package/common/hooks/use-image-stub.d.ts +14 -0
  110. package/common/hooks/use-image-stub.js +26 -0
  111. package/common/hooks/use-image-stub.js.map +1 -0
  112. package/common/hooks/use-mounted.d.ts +5 -0
  113. package/common/hooks/use-mounted.js +19 -0
  114. package/common/hooks/use-mounted.js.map +1 -0
  115. package/desktop/components/product-carousel/product-carousel.d.ts +1 -1
  116. package/desktop/components/product-carousel/product-carousel.js +20 -40
  117. package/desktop/components/product-carousel/product-carousel.js.map +1 -1
  118. package/desktop/components/product-carousel/product-carousel.m.scss +0 -6
  119. package/desktop/components/product-carousel/types.d.ts +1 -4
  120. package/package.json +2 -2
  121. package/common/components/product-info/parts.d.ts +0 -69
  122. package/common/components/product-info/parts.js +0 -160
  123. package/common/components/product-info/parts.js.map +0 -1
  124. package/common/components/product-info/product-info.m.scss +0 -280
  125. package/desktop/components/product-card/index.d.ts +0 -2
  126. package/desktop/components/product-card/index.js +0 -9
  127. package/desktop/components/product-card/index.js.map +0 -1
  128. package/desktop/components/product-card/product-card.d.ts +0 -23
  129. package/desktop/components/product-card/product-card.js +0 -94
  130. package/desktop/components/product-card/product-card.js.map +0 -1
  131. package/desktop/components/product-card/product-card.m.scss +0 -12
  132. package/desktop/components/product-card/types.d.ts +0 -19
  133. package/desktop/components/product-card/types.js.map +0 -1
  134. package/desktop/components/product-carousel/hover-card.d.ts +0 -7
  135. package/desktop/components/product-carousel/hover-card.js +0 -40
  136. package/desktop/components/product-carousel/hover-card.js.map +0 -1
  137. package/desktop/components/product-carousel/hover-card.m.scss +0 -14
  138. package/desktop/components/product-carousel/utils.d.ts +0 -16
  139. package/desktop/components/product-carousel/utils.js +0 -45
  140. package/desktop/components/product-carousel/utils.js.map +0 -1
  141. /package/{desktop/components/product-card → common/components/hover-slider}/types.js +0 -0
@@ -0,0 +1,23 @@
1
+ @use 'node_modules/@sima-land/ui-nucleons/colors';
2
+
3
+ .root {
4
+ max-width: 100%;
5
+ font-size: 14px;
6
+ line-height: 20px;
7
+ &.line-clamp {
8
+ overflow: hidden;
9
+ word-break: break-word;
10
+ max-height: 40px;
11
+ display: -webkit-box;
12
+ -webkit-line-clamp: 2;
13
+ -webkit-box-orient: vertical;
14
+ }
15
+ }
16
+
17
+ .adult-placeholder {
18
+ display: block;
19
+ max-width: 100%;
20
+ font-size: 14px;
21
+ line-height: 20px;
22
+ color: colors.$basic-gray87;
23
+ }
@@ -0,0 +1,7 @@
1
+ import { type LinkProps } from '@sima-land/ui-nucleons/link';
2
+ /**
3
+ * Слот для вывода ссылки торговой марки.
4
+ * @param props Свойства.
5
+ * @return Элемент.
6
+ */
7
+ export declare function ProductInfoTrademarkLink({ href, color, children, className, 'data-testid': testId, ...restProps }: LinkProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ProductInfoTrademarkLink = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const link_1 = require("@sima-land/ui-nucleons/link");
9
+ const classnames_1 = __importDefault(require("classnames"));
10
+ const trademark_link_m_scss_1 = __importDefault(require("./trademark-link.m.scss"));
11
+ /**
12
+ * Слот для вывода ссылки торговой марки.
13
+ * @param props Свойства.
14
+ * @return Элемент.
15
+ */
16
+ function ProductInfoTrademarkLink({ href, color = 'basic-blue', children, className, 'data-testid': testId = 'product-info:trademark-link', ...restProps }) {
17
+ return ((0, jsx_runtime_1.jsx)(link_1.Link, { ...restProps, className: (0, classnames_1.default)(trademark_link_m_scss_1.default.root, className), href: href, color: color, "data-testid": testId, children: children }));
18
+ }
19
+ exports.ProductInfoTrademarkLink = ProductInfoTrademarkLink;
20
+ //# sourceMappingURL=trademark-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trademark-link.js","sourceRoot":"","sources":["../../../../../src/common/components/product-info/parts/trademark-link.tsx"],"names":[],"mappings":";;;;;;;AAAA,sDAAmE;AACnE,4DAAoC;AACpC,oFAA6C;AAE7C;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,KAAK,GAAG,YAAY,EACpB,QAAQ,EACR,SAAS,EACT,aAAa,EAAE,MAAM,GAAG,6BAA6B,EACrD,GAAG,SAAS,EACF;IACV,OAAO,CACL,uBAAC,WAAI,OACC,SAAS,EACb,SAAS,EAAE,IAAA,oBAAU,EAAC,+BAAM,CAAC,IAAI,EAAE,SAAS,CAAC,EAC7C,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,iBACC,MAAM,YAElB,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC;AAnBD,4DAmBC"}
@@ -0,0 +1,9 @@
1
+ .root {
2
+ display: block;
3
+ margin-top: 8px;
4
+ font-size: 14px;
5
+ line-height: 20px;
6
+ white-space: nowrap;
7
+ overflow: hidden;
8
+ text-overflow: ellipsis;
9
+ }
@@ -0,0 +1,7 @@
1
+ import { type LinkProps } from '@sima-land/ui-nucleons/link';
2
+ /**
3
+ * Кнопка "В лист ожидания".
4
+ * @param props Свойства.
5
+ * @return Элемент.
6
+ */
7
+ export declare function WaitListAddLink({ color, children, pseudo, className, 'data-testid': testId, ...restProps }: LinkProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.WaitListAddLink = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const link_1 = require("@sima-land/ui-nucleons/link");
9
+ const classnames_1 = __importDefault(require("classnames"));
10
+ const parts_m_scss_1 = __importDefault(require("./parts.m.scss"));
11
+ /**
12
+ * Кнопка "В лист ожидания".
13
+ * @param props Свойства.
14
+ * @return Элемент.
15
+ */
16
+ function WaitListAddLink({ color = 'basic-blue', children = 'В лист ожидания', pseudo = true, className, 'data-testid': testId = 'product-info:wait-list-add-button', ...restProps }) {
17
+ return ((0, jsx_runtime_1.jsx)(link_1.Link, { pseudo: pseudo, color: color, className: (0, classnames_1.default)(parts_m_scss_1.default['text-button'], className), "data-testid": testId, ...restProps, children: children }));
18
+ }
19
+ exports.WaitListAddLink = WaitListAddLink;
20
+ //# sourceMappingURL=wait-list-add-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-list-add-link.js","sourceRoot":"","sources":["../../../../../src/common/components/product-info/parts/wait-list-add-link.tsx"],"names":[],"mappings":";;;;;;;AAAA,sDAAmE;AACnE,4DAAoC;AACpC,kEAAoC;AAEpC;;;;GAIG;AACH,SAAgB,eAAe,CAAC,EAC9B,KAAK,GAAG,YAAY,EACpB,QAAQ,GAAG,iBAAiB,EAC5B,MAAM,GAAG,IAAI,EACb,SAAS,EACT,aAAa,EAAE,MAAM,GAAG,mCAAmC,EAC3D,GAAG,SAAS,EACF;IACV,OAAO,CACL,uBAAC,WAAI,IACH,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,IAAA,oBAAU,EAAC,sBAAM,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC,iBAC1C,MAAM,KACf,SAAS,YAEZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC;AAnBD,0CAmBC"}
@@ -0,0 +1,7 @@
1
+ import type { ProductInfoWaitListAddedLinkProps } from '../types';
2
+ /**
3
+ * Текст со ссылкой "Товар добавлен в лист ожидания".
4
+ * @param props Свойства.
5
+ * @return Элемент.
6
+ */
7
+ export declare function WaitListAddedLink({ contentBefore, children, color, className, rootRef, rootProps, 'data-testid': testId, ...restProps }: ProductInfoWaitListAddedLinkProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.WaitListAddedLink = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const link_1 = require("@sima-land/ui-nucleons/link");
9
+ const classnames_1 = __importDefault(require("classnames"));
10
+ const wait_list_added_link_m_scss_1 = __importDefault(require("./wait-list-added-link.m.scss"));
11
+ const defaultContentBefore = (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "\u0422\u043E\u0432\u0430\u0440 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D \u0432 " });
12
+ const defaultChildren = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u043B\u0438\u0441\u0442", '\u00A0', "\u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F"] });
13
+ /**
14
+ * Текст со ссылкой "Товар добавлен в лист ожидания".
15
+ * @param props Свойства.
16
+ * @return Элемент.
17
+ */
18
+ function WaitListAddedLink({ contentBefore = defaultContentBefore, children = defaultChildren, color = 'basic-blue', className, rootRef, rootProps, 'data-testid': testId = 'product-info:wait-list-added-link', ...restProps }) {
19
+ return ((0, jsx_runtime_1.jsxs)("span", { ref: rootRef, ...rootProps, className: (0, classnames_1.default)(wait_list_added_link_m_scss_1.default.root, rootProps === null || rootProps === void 0 ? void 0 : rootProps.className), children: [contentBefore, (0, jsx_runtime_1.jsx)(link_1.Link, { ...restProps, color: color, className: (0, classnames_1.default)(wait_list_added_link_m_scss_1.default['text-button'], className), "data-testid": testId, children: children })] }));
20
+ }
21
+ exports.WaitListAddedLink = WaitListAddedLink;
22
+ //# sourceMappingURL=wait-list-added-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-list-added-link.js","sourceRoot":"","sources":["../../../../../src/common/components/product-info/parts/wait-list-added-link.tsx"],"names":[],"mappings":";;;;;;;AACA,sDAAmD;AACnD,4DAAoC;AACpC,gGAAmD;AAEnD,MAAM,oBAAoB,GAAG,uJAAsB,CAAC;AAEpD,MAAM,eAAe,GAAG,yFAAO,QAAQ,wDAAY,CAAC;AAEpD;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,EAChC,aAAa,GAAG,oBAAoB,EACpC,QAAQ,GAAG,eAAe,EAC1B,KAAK,GAAG,YAAY,EACpB,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EAAE,MAAM,GAAG,mCAAmC,EAC3D,GAAG,SAAS,EACsB;IAClC,OAAO,CACL,kCAAM,GAAG,EAAE,OAAO,KAAM,SAAS,EAAE,SAAS,EAAE,IAAA,oBAAU,EAAC,qCAAM,CAAC,IAAI,EAAE,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS,CAAC,aACxF,aAAa,EACd,uBAAC,WAAI,OACC,SAAS,EACb,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,IAAA,oBAAU,EAAC,qCAAM,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC,iBAC1C,MAAM,YAElB,QAAQ,GACJ,IACF,CACR,CAAC;AACJ,CAAC;AAvBD,8CAuBC"}
@@ -0,0 +1,13 @@
1
+ @use 'node_modules/@sima-land/ui-nucleons/colors';
2
+ @use 'node_modules/@sima-land/ui-nucleons/breakpoints';
3
+
4
+ .root {
5
+ font-size: 16px;
6
+ line-height: 24px;
7
+ font-weight: 600;
8
+ color: colors.$basic-gray24;
9
+ @include breakpoints.down('ml') {
10
+ font-size: 14px;
11
+ line-height: 20px;
12
+ }
13
+ }
@@ -1,15 +1,12 @@
1
- import { ProductInfoProps } from './types';
2
- import { Parts } from './parts';
3
- export type { ProductInfoProps };
1
+ import type { ProductInfoProps } from './types';
4
2
  export declare const UNAVAILABLE_REASON: {
5
3
  readonly notEnough: "Нет в наличии";
6
4
  readonly unavailableInRegion: "Товар недоступен в вашем регионе";
7
5
  readonly onlyForLegalEntities: "Товар доступен только для юридических лиц";
8
6
  };
9
7
  /**
10
- * Блок информации о товаре по дизайн-гайдам.
8
+ * Блок информации о товаре.
11
9
  * @param props Свойства.
12
10
  * @return Элемент.
13
11
  */
14
- export declare const ProductInfo: ({ restriction, children }: ProductInfoProps) => import("react/jsx-runtime").JSX.Element;
15
- export { Parts };
12
+ export declare function ProductInfo({ strict, restriction, children }: ProductInfoProps): import("react/jsx-runtime").JSX.Element;
@@ -1,33 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Parts = exports.ProductInfo = exports.UNAVAILABLE_REASON = void 0;
3
+ exports.ProductInfo = exports.UNAVAILABLE_REASON = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const helpers_1 = require("@sima-land/ui-nucleons/helpers");
6
5
  const utils_1 = require("./utils");
7
6
  const parts_1 = require("./parts");
8
- Object.defineProperty(exports, "Parts", { enumerable: true, get: function () { return parts_1.Parts; } });
7
+ const helpers_1 = require("@sima-land/ui-nucleons/helpers");
8
+ const product_image_1 = require("../product-image");
9
9
  exports.UNAVAILABLE_REASON = {
10
10
  notEnough: 'Нет в наличии',
11
11
  unavailableInRegion: 'Товар недоступен в вашем регионе',
12
12
  onlyForLegalEntities: 'Товар доступен только для юридических лиц',
13
13
  };
14
14
  /**
15
- * Блок информации о товаре по дизайн-гайдам.
15
+ * Блок информации о товаре.
16
16
  * @param props Свойства.
17
17
  * @return Элемент.
18
18
  */
19
- const ProductInfo = ({ restriction, children }) => {
20
- const { image, badges, prices, title, trademark, footer, secondaryInfo, ratingCounter } = (0, helpers_1.defineSlots)(children, {
19
+ function ProductInfo({ strict = true, restriction, children }) {
20
+ if (!strict) {
21
+ return ((0, jsx_runtime_1.jsx)(utils_1.ProductInfoContext.Provider, { value: { restriction }, children: children }));
22
+ }
23
+ const { media, image, badges, prices, title, trademark, footer, secondaryInfo, ratingCounter } = (0, helpers_1.defineSlots)(children, {
24
+ media: parts_1.Parts.Media,
21
25
  image: parts_1.Parts.Image,
22
26
  badges: parts_1.Parts.Badges,
23
27
  prices: parts_1.Parts.Prices,
24
28
  title: parts_1.Parts.Title,
25
- trademark: parts_1.Parts.TrademarkLink,
26
- footer: parts_1.Parts.Footer,
27
29
  secondaryInfo: parts_1.Parts.SecondaryInfo,
30
+ trademark: parts_1.Parts.TrademarkLink,
28
31
  ratingCounter: parts_1.Parts.RatingCounter,
32
+ footer: parts_1.Parts.Footer,
29
33
  });
30
- return ((0, jsx_runtime_1.jsxs)(utils_1.ProductInfoContext.Provider, { value: { restriction }, children: [image, restriction !== 'adult' && badges, prices, title, restriction !== 'adult' && secondaryInfo, !restriction && trademark, restriction !== 'adult' && ratingCounter, footer] }));
31
- };
34
+ const adult = restriction === 'adult';
35
+ return ((0, jsx_runtime_1.jsxs)(utils_1.ProductInfoContext.Provider, { value: { restriction }, children: [(0, jsx_runtime_1.jsx)(product_image_1.ProductImageContext.Provider, { value: { adult }, children: image !== null && image !== void 0 ? image : media }), !adult && badges, prices, title, !adult && secondaryInfo, !restriction && trademark, !adult && ratingCounter, footer] }));
36
+ }
32
37
  exports.ProductInfo = ProductInfo;
33
38
  //# sourceMappingURL=product-info.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-info.js","sourceRoot":"","sources":["../../../../src/common/components/product-info/product-info.tsx"],"names":[],"mappings":";;;;AAAA,4DAA6D;AAE7D,mCAA6C;AAC7C,mCAAgC;AA0CvB,sFA1CA,aAAK,OA0CA;AAtCD,QAAA,kBAAkB,GAAG;IAChC,SAAS,EAAE,eAAe;IAC1B,mBAAmB,EAAE,kCAAkC;IACvD,oBAAoB,EAAE,2CAA2C;CACzD,CAAC;AAEX;;;;GAIG;AACI,MAAM,WAAW,GAAG,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAoB,EAAE,EAAE;IACzE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GACrF,IAAA,qBAAW,EAAC,QAAQ,EAAE;QACpB,KAAK,EAAE,aAAK,CAAC,KAAK;QAClB,MAAM,EAAE,aAAK,CAAC,MAAM;QACpB,MAAM,EAAE,aAAK,CAAC,MAAM;QACpB,KAAK,EAAE,aAAK,CAAC,KAAK;QAClB,SAAS,EAAE,aAAK,CAAC,aAAa;QAC9B,MAAM,EAAE,aAAK,CAAC,MAAM;QACpB,aAAa,EAAE,aAAK,CAAC,aAAa;QAClC,aAAa,EAAE,aAAK,CAAC,aAAa;KACnC,CAAC,CAAC;IAEL,OAAO,CACL,wBAAC,0BAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,WAAW,EAAE,aAChD,KAAK,EACL,WAAW,KAAK,OAAO,IAAI,MAAM,EACjC,MAAM,EACN,KAAK,EACL,WAAW,KAAK,OAAO,IAAI,aAAa,EACxC,CAAC,WAAW,IAAI,SAAS,EACzB,WAAW,KAAK,OAAO,IAAI,aAAa,EACxC,MAAM,IACqB,CAC/B,CAAC;AACJ,CAAC,CAAC;AAzBW,QAAA,WAAW,eAyBtB"}
1
+ {"version":3,"file":"product-info.js","sourceRoot":"","sources":["../../../../src/common/components/product-info/product-info.tsx"],"names":[],"mappings":";;;;AACA,mCAA6C;AAC7C,mCAAgC;AAChC,4DAA6D;AAC7D,oDAAuD;AAE1C,QAAA,kBAAkB,GAAG;IAChC,SAAS,EAAE,eAAe;IAC1B,mBAAmB,EAAE,kCAAkC;IACvD,oBAAoB,EAAE,2CAA2C;CACzD,CAAC;AAEX;;;;GAIG;AACH,SAAgB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAoB;IACpF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CACL,uBAAC,0BAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,WAAW,EAAE,YAAG,QAAQ,GAA+B,CAC9F,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAC5F,IAAA,qBAAW,EAAC,QAAQ,EAAE;QACpB,KAAK,EAAE,aAAK,CAAC,KAAK;QAClB,KAAK,EAAE,aAAK,CAAC,KAAK;QAClB,MAAM,EAAE,aAAK,CAAC,MAAM;QACpB,MAAM,EAAE,aAAK,CAAC,MAAM;QACpB,KAAK,EAAE,aAAK,CAAC,KAAK;QAClB,aAAa,EAAE,aAAK,CAAC,aAAa;QAClC,SAAS,EAAE,aAAK,CAAC,aAAa;QAC9B,aAAa,EAAE,aAAK,CAAC,aAAa;QAClC,MAAM,EAAE,aAAK,CAAC,MAAM;KACrB,CAAC,CAAC;IAEL,MAAM,KAAK,GAAG,WAAW,KAAK,OAAO,CAAC;IAEtC,OAAO,CACL,wBAAC,0BAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,WAAW,EAAE,aACjD,uBAAC,mCAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,YAC3C,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,KAAK,GACc,EAE9B,CAAC,KAAK,IAAI,MAAM,EAEhB,MAAM,EAEN,KAAK,EAEL,CAAC,KAAK,IAAI,aAAa,EAEvB,CAAC,WAAW,IAAI,SAAS,EAEzB,CAAC,KAAK,IAAI,aAAa,EAEvB,MAAM,IACqB,CAC/B,CAAC;AACJ,CAAC;AA3CD,kCA2CC"}
@@ -1,7 +1,64 @@
1
- import type { ReactNode } from 'react';
1
+ import type { LinkProps } from '@sima-land/ui-nucleons/link';
2
+ import type { StrokedSVGProps } from '@sima-land/ui-nucleons/stroked-svg';
3
+ import type { ProductImageStyle } from '../product-image';
4
+ import type { AnchorHTMLAttributes, CSSProperties, ElementType, HTMLAttributes, ReactNode, Ref, SVGAttributes } from 'react';
5
+ export type ProductInfoRestriction = 'adult' | 'unavailable';
2
6
  export interface ProductInfoProps {
3
7
  /** Ограничение товара. Влияет на отображение информации. */
4
- restriction?: 'adult' | 'unavailable';
8
+ restriction?: ProductInfoRestriction;
5
9
  /** Содержимое. */
6
10
  children?: ReactNode;
11
+ /** Нужно ли фильтровать содержимое и четко задавать порядок слотов. */
12
+ strict?: boolean;
13
+ }
14
+ export interface ProductInfoMediaStyle extends CSSProperties {
15
+ '--product-info-media-ratio'?: string;
16
+ }
17
+ export interface ProductInfoMediaProps extends HTMLAttributes<HTMLDivElement> {
18
+ /** Включено ли фиксированное соотношение сторон. */
19
+ aspectRatio?: boolean;
20
+ /** Стили. */
21
+ style?: ProductInfoMediaStyle & ProductImageStyle;
22
+ }
23
+ export interface ProductInfoImageProps extends ProductInfoMediaProps {
24
+ /** Ссылка на картинку или список ссылок для вывода слайдера. */
25
+ src?: string | string[];
26
+ /** Ссылка на товар. */
27
+ href?: string;
28
+ /** Прочие атрибуты элемента-ссылки. */
29
+ anchorProps?: AnchorHTMLAttributes<HTMLAnchorElement>;
30
+ }
31
+ export interface ImageButtonProps extends Omit<StrokedSVGProps, 'component'> {
32
+ icon: ElementType<SVGAttributes<SVGSVGElement>>;
33
+ /** Задает абсолютное позиционирование. */
34
+ position?: {
35
+ x: 'left' | 'right';
36
+ y: 'top' | 'bottom';
37
+ };
38
+ /** Хинт. */
39
+ hint?: ReactNode;
40
+ /** Направление хинта. */
41
+ hintDirection?: 'top' | 'left' | 'bottom' | 'right';
42
+ }
43
+ export interface ProductInfoTitleProps extends LinkProps {
44
+ adultPlaceholder?: ReactNode;
45
+ }
46
+ export interface ProductInfoPricesProps {
47
+ price: number;
48
+ oldPrice?: number;
49
+ currencyGrapheme?: string;
50
+ unavailableReason?: ReactNode;
51
+ }
52
+ export interface ProductInfoWaitListAddedLinkProps extends LinkProps {
53
+ contentBefore?: ReactNode;
54
+ rootRef?: Ref<HTMLSpanElement>;
55
+ rootProps?: HTMLAttributes<HTMLSpanElement>;
56
+ }
57
+ export interface ProductInfoFooterProps extends HTMLAttributes<HTMLDivElement> {
58
+ }
59
+ export interface ProductInfoCartControlProps {
60
+ children?: ReactNode;
61
+ stepText?: string;
62
+ markupText?: string;
63
+ loading?: boolean;
7
64
  }
@@ -1,3 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ProductInfoProps } from './types';
3
3
  export declare const ProductInfoContext: import("react").Context<Pick<ProductInfoProps, "restriction">>;
4
+ export declare const ProductInfoFooterContext: import("react").Context<{
5
+ className?: string | undefined;
6
+ }>;
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProductInfoContext = void 0;
3
+ exports.ProductInfoFooterContext = exports.ProductInfoContext = void 0;
4
4
  const react_1 = require("react");
5
- exports.ProductInfoContext = (0, react_1.createContext)({});
5
+ exports.ProductInfoContext = (0, react_1.createContext)({
6
+ restriction: undefined,
7
+ });
8
+ exports.ProductInfoFooterContext = (0, react_1.createContext)({
9
+ className: undefined,
10
+ });
6
11
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/common/components/product-info/utils.ts"],"names":[],"mappings":";;;AAAA,iCAAsC;AAGzB,QAAA,kBAAkB,GAAG,IAAA,qBAAa,EAAwC,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/common/components/product-info/utils.ts"],"names":[],"mappings":";;;AAAA,iCAAsC;AAGzB,QAAA,kBAAkB,GAAG,IAAA,qBAAa,EAAwC;IACrF,WAAW,EAAE,SAAS;CACvB,CAAC,CAAC;AAEU,QAAA,wBAAwB,GAAG,IAAA,qBAAa,EAAyB;IAC5E,SAAS,EAAE,SAAS;CACrB,CAAC,CAAC"}
@@ -16,7 +16,7 @@ const cx = bind_1.default.bind(rating_counter_m_scss_1.default);
16
16
  * @return Элемент.
17
17
  */
18
18
  function RatingCounter({ size = 's', value, reviewCount, className, hoverDisabled, 'data-testid': testId = 'rating-counter', ...restProps }) {
19
- return ((0, jsx_runtime_1.jsxs)("div", { className: cx('root', `size-${size}`, !(value > 0) && 'empty', hoverDisabled && 'hover-disabled', className), "data-testid": testId, ...restProps, children: [(0, jsx_runtime_1.jsx)(Star_1.default, { className: cx('star') }), value > 0 && (0, jsx_runtime_1.jsx)("span", { className: cx('value'), children: String(value).replace('.', ',') }), (0, jsx_runtime_1.jsx)("span", { className: cx('count'), children: reviewCount > 0
19
+ return ((0, jsx_runtime_1.jsxs)("div", { className: cx('root', `size-${size}`, !(value > 0) && 'empty', hoverDisabled && 'hover-disabled', className), "data-testid": testId, ...restProps, children: [(0, jsx_runtime_1.jsx)(Star_1.default, { className: cx('star') }), value > 0 && (0, jsx_runtime_1.jsx)("span", { className: cx('value'), children: value }), (0, jsx_runtime_1.jsx)("span", { className: cx('count'), children: reviewCount > 0
20
20
  ? `${reviewCount} ${(0, helpers_1.getDeclination)(reviewCount, ['отзыв', 'отзыва', 'отзывов'])}`
21
21
  : 'Нет отзывов' })] }));
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"rating-counter.js","sourceRoot":"","sources":["../../../../src/common/components/rating-counter/rating-counter.tsx"],"names":[],"mappings":";;;;;;;AACA,wFAAmE;AACnE,4DAAgE;AAChE,2DAAyC;AACzC,oFAA6C;AAuC7C,MAAM,EAAE,GAAG,cAAU,CAAC,IAAI,CAAC,+BAAM,CAAC,CAAC;AAEnC;;;;GAIG;AACH,SAAgB,aAAa,CAAC,EAC5B,IAAI,GAAG,GAAG,EACV,KAAK,EACL,WAAW,EACX,SAAS,EACT,aAAa,EACb,aAAa,EAAE,MAAM,GAAG,gBAAgB,EACxC,GAAG,SAAS,EACO;IACnB,OAAO,CACL,iCACE,SAAS,EAAE,EAAE,CACX,MAAM,EACN,QAAQ,IAAI,EAAE,EACd,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,OAAO,EACvB,aAAa,IAAI,gBAAgB,EACjC,SAAS,CACV,iBACY,MAAM,KACf,SAAS,aAEb,uBAAC,cAAO,IAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,GAAI,EAEjC,KAAK,GAAG,CAAC,IAAI,iCAAM,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,YAAG,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,GAAQ,EAEpF,iCAAM,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,YACzB,WAAW,GAAG,CAAC;oBACd,CAAC,CAAC,GAAG,WAAW,IAAI,IAAA,wBAAc,EAAC,WAAW,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,EAAE;oBACjF,CAAC,CAAC,aAAa,GACZ,IACH,CACP,CAAC;AACJ,CAAC;AAhCD,sCAgCC"}
1
+ {"version":3,"file":"rating-counter.js","sourceRoot":"","sources":["../../../../src/common/components/rating-counter/rating-counter.tsx"],"names":[],"mappings":";;;;;;;AACA,wFAAmE;AACnE,4DAAgE;AAChE,2DAAyC;AACzC,oFAA6C;AAuC7C,MAAM,EAAE,GAAG,cAAU,CAAC,IAAI,CAAC,+BAAM,CAAC,CAAC;AAEnC;;;;GAIG;AACH,SAAgB,aAAa,CAAC,EAC5B,IAAI,GAAG,GAAG,EACV,KAAK,EACL,WAAW,EACX,SAAS,EACT,aAAa,EACb,aAAa,EAAE,MAAM,GAAG,gBAAgB,EACxC,GAAG,SAAS,EACO;IACnB,OAAO,CACL,iCACE,SAAS,EAAE,EAAE,CACX,MAAM,EACN,QAAQ,IAAI,EAAE,EACd,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,OAAO,EACvB,aAAa,IAAI,gBAAgB,EACjC,SAAS,CACV,iBACY,MAAM,KACf,SAAS,aAEb,uBAAC,cAAO,IAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,GAAI,EAEjC,KAAK,GAAG,CAAC,IAAI,iCAAM,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,YAAG,KAAK,GAAQ,EAE1D,iCAAM,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,YACzB,WAAW,GAAG,CAAC;oBACd,CAAC,CAAC,GAAG,WAAW,IAAI,IAAA,wBAAc,EAAC,WAAW,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,EAAE;oBACjF,CAAC,CAAC,aAAa,GACZ,IACH,CACP,CAAC;AACJ,CAAC;AAhCD,sCAgCC"}
@@ -1,19 +1,3 @@
1
- import { ReactEventHandler } from 'react';
2
- /**
3
- * Возвращает true если компонент смонтирован.
4
- * @return True если компонент смонтирован.
5
- */
6
- export declare function useMounted(): boolean;
7
- /**
8
- * Хук состояния ошибки загрузки изображения.
9
- * @param src Ссылка на картинку.
10
- * @param onError Обработчик ошибки.
11
- * @return Управление состоянием.
12
- * @todo Переименовать в useImageError?
13
- * @todo Объединить с тем что есть в AllRoundView!
14
- */
15
- export declare function useImageStub(src?: string, onError?: ReactEventHandler<HTMLImageElement>): {
16
- failed: boolean;
17
- setFailed: import("react").Dispatch<import("react").SetStateAction<boolean>>;
18
- handleError: ReactEventHandler<HTMLImageElement>;
19
- };
1
+ export { useClientWidth } from './use-client-width';
2
+ export { useImageStub } from './use-image-stub';
3
+ export { useMounted } from './use-mounted';
@@ -1,39 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useImageStub = exports.useMounted = void 0;
4
- const hooks_1 = require("@sima-land/ui-nucleons/hooks");
5
- const react_1 = require("react");
6
- /**
7
- * Возвращает true если компонент смонтирован.
8
- * @return True если компонент смонтирован.
9
- */
10
- function useMounted() {
11
- const [mounted, setMounted] = (0, react_1.useState)(false);
12
- (0, hooks_1.useIsomorphicLayoutEffect)(() => {
13
- setMounted(true);
14
- return () => setMounted(false);
15
- }, []);
16
- return mounted;
17
- }
18
- exports.useMounted = useMounted;
19
- /**
20
- * Хук состояния ошибки загрузки изображения.
21
- * @param src Ссылка на картинку.
22
- * @param onError Обработчик ошибки.
23
- * @return Управление состоянием.
24
- * @todo Переименовать в useImageError?
25
- * @todo Объединить с тем что есть в AllRoundView!
26
- */
27
- function useImageStub(src, onError) {
28
- const [failed, setFailed] = (0, react_1.useState)(false);
29
- (0, hooks_1.useIsomorphicLayoutEffect)(() => {
30
- setFailed(false);
31
- }, [src]);
32
- const handleError = (0, react_1.useCallback)(event => {
33
- setFailed(true);
34
- onError === null || onError === void 0 ? void 0 : onError(event);
35
- }, [onError]);
36
- return { failed, setFailed, handleError };
37
- }
38
- exports.useImageStub = useImageStub;
3
+ exports.useMounted = exports.useImageStub = exports.useClientWidth = void 0;
4
+ var use_client_width_1 = require("./use-client-width");
5
+ Object.defineProperty(exports, "useClientWidth", { enumerable: true, get: function () { return use_client_width_1.useClientWidth; } });
6
+ var use_image_stub_1 = require("./use-image-stub");
7
+ Object.defineProperty(exports, "useImageStub", { enumerable: true, get: function () { return use_image_stub_1.useImageStub; } });
8
+ var use_mounted_1 = require("./use-mounted");
9
+ Object.defineProperty(exports, "useMounted", { enumerable: true, get: function () { return use_mounted_1.useMounted; } });
39
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/hooks/index.ts"],"names":[],"mappings":";;;AAAA,wDAAyE;AACzE,iCAAiE;AAEjE;;;GAGG;AACH,SAAgB,UAAU;IACxB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE9C,IAAA,iCAAyB,EAAC,GAAG,EAAE;QAC7B,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CAAC;AACjB,CAAC;AATD,gCASC;AAED;;;;;;;GAOG;AACH,SAAgB,YAAY,CAAC,GAAY,EAAE,OAA6C;IACtF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE5C,IAAA,iCAAyB,EAAC,GAAG,EAAE;QAC7B,SAAS,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,MAAM,WAAW,GAAG,IAAA,mBAAW,EAC7B,KAAK,CAAC,EAAE;QACN,SAAS,CAAC,IAAI,CAAC,CAAC;QAChB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,KAAK,CAAC,CAAC;IACnB,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AAC5C,CAAC;AAhBD,oCAgBC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/hooks/index.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAA3C,kHAAA,cAAc,OAAA;AACvB,mDAAgD;AAAvC,8GAAA,YAAY,OAAA;AACrB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA"}
@@ -0,0 +1,8 @@
1
+ import { RefObject, DependencyList } from 'react';
2
+ /**
3
+ * Возвращает актуальное значение clientWidth элемента.
4
+ * @param ref Ref с элементом.
5
+ * @param deps Массив зависимостей от которых зависит пересчет.
6
+ * @return Значение свойства clientWidth.
7
+ */
8
+ export declare function useClientWidth(ref: RefObject<HTMLElement | null>, deps?: DependencyList): number | null;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useClientWidth = void 0;
4
+ const react_1 = require("react");
5
+ /**
6
+ * Возвращает актуальное значение clientWidth элемента.
7
+ * @param ref Ref с элементом.
8
+ * @param deps Массив зависимостей от которых зависит пересчет.
9
+ * @return Значение свойства clientWidth.
10
+ */
11
+ function useClientWidth(ref, deps = []) {
12
+ const [width, setWidth] = (0, react_1.useState)(null);
13
+ (0, react_1.useEffect)(() => {
14
+ if (!ref.current) {
15
+ return;
16
+ }
17
+ const element = ref.current;
18
+ const observer = new ResizeObserver(() => {
19
+ setWidth(element.clientWidth);
20
+ });
21
+ observer.observe(element);
22
+ setWidth(element.clientWidth);
23
+ return () => observer.disconnect();
24
+ }, [ref, ...deps]);
25
+ return width;
26
+ }
27
+ exports.useClientWidth = useClientWidth;
28
+ //# sourceMappingURL=use-client-width.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-client-width.js","sourceRoot":"","sources":["../../../src/common/hooks/use-client-width.ts"],"names":[],"mappings":";;;AAAA,iCAAuE;AAEvE;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,GAAkC,EAAE,OAAuB,EAAE;IAC1F,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAgB,IAAI,CAAC,CAAC;IAExD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAE5B,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,GAAG,EAAE;YACvC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAE1B,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAE9B,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IAEnB,OAAO,KAAK,CAAC;AACf,CAAC;AAtBD,wCAsBC"}
@@ -0,0 +1,14 @@
1
+ import { ReactEventHandler } from 'react';
2
+ /**
3
+ * Хук состояния ошибки загрузки изображения.
4
+ * @param src Ссылка на картинку.
5
+ * @param onError Обработчик ошибки.
6
+ * @return Управление состоянием.
7
+ * @todo Переименовать в useImageError?
8
+ * @todo Объединить с тем что есть в AllRoundView!
9
+ */
10
+ export declare function useImageStub(src?: string, onError?: ReactEventHandler<HTMLImageElement>): {
11
+ failed: boolean;
12
+ setFailed: import("react").Dispatch<import("react").SetStateAction<boolean>>;
13
+ handleError: ReactEventHandler<HTMLImageElement>;
14
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useImageStub = void 0;
4
+ const hooks_1 = require("@sima-land/ui-nucleons/hooks");
5
+ const react_1 = require("react");
6
+ /**
7
+ * Хук состояния ошибки загрузки изображения.
8
+ * @param src Ссылка на картинку.
9
+ * @param onError Обработчик ошибки.
10
+ * @return Управление состоянием.
11
+ * @todo Переименовать в useImageError?
12
+ * @todo Объединить с тем что есть в AllRoundView!
13
+ */
14
+ function useImageStub(src, onError) {
15
+ const [failed, setFailed] = (0, react_1.useState)(false);
16
+ (0, hooks_1.useIsomorphicLayoutEffect)(() => {
17
+ setFailed(false);
18
+ }, [src]);
19
+ const handleError = (0, react_1.useCallback)(event => {
20
+ setFailed(true);
21
+ onError === null || onError === void 0 ? void 0 : onError(event);
22
+ }, [onError]);
23
+ return { failed, setFailed, handleError };
24
+ }
25
+ exports.useImageStub = useImageStub;
26
+ //# sourceMappingURL=use-image-stub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-image-stub.js","sourceRoot":"","sources":["../../../src/common/hooks/use-image-stub.ts"],"names":[],"mappings":";;;AAAA,wDAAyE;AACzE,iCAAiE;AAEjE;;;;;;;GAOG;AACH,SAAgB,YAAY,CAAC,GAAY,EAAE,OAA6C;IACtF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE5C,IAAA,iCAAyB,EAAC,GAAG,EAAE;QAC7B,SAAS,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,MAAM,WAAW,GAAG,IAAA,mBAAW,EAC7B,KAAK,CAAC,EAAE;QACN,SAAS,CAAC,IAAI,CAAC,CAAC;QAChB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,KAAK,CAAC,CAAC;IACnB,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AAC5C,CAAC;AAhBD,oCAgBC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Возвращает true если компонент смонтирован.
3
+ * @return True если компонент смонтирован.
4
+ */
5
+ export declare function useMounted(): boolean;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMounted = void 0;
4
+ const hooks_1 = require("@sima-land/ui-nucleons/hooks");
5
+ const react_1 = require("react");
6
+ /**
7
+ * Возвращает true если компонент смонтирован.
8
+ * @return True если компонент смонтирован.
9
+ */
10
+ function useMounted() {
11
+ const [mounted, setMounted] = (0, react_1.useState)(false);
12
+ (0, hooks_1.useIsomorphicLayoutEffect)(() => {
13
+ setMounted(true);
14
+ return () => setMounted(false);
15
+ }, []);
16
+ return mounted;
17
+ }
18
+ exports.useMounted = useMounted;
19
+ //# sourceMappingURL=use-mounted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-mounted.js","sourceRoot":"","sources":["../../../src/common/hooks/use-mounted.ts"],"names":[],"mappings":";;;AAAA,wDAAyE;AACzE,iCAAiC;AAEjC;;;GAGG;AACH,SAAgB,UAAU;IACxB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE9C,IAAA,iCAAyB,EAAC,GAAG,EAAE;QAC7B,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CAAC;AACjB,CAAC;AATD,gCASC"}
@@ -4,4 +4,4 @@ import { ProductCarouselProps } from './types';
4
4
  * @param props Свойства.
5
5
  * @return Элемент.
6
6
  */
7
- export declare function ProductCarousel({ className, itemSize, itemProps, onInViewport, onNeedRequest, withHoverCard, children, reduceBaseInfo: reduceBaseInfoProp, reduceHoverInfo: reduceHoverInfoProp, }: ProductCarouselProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function ProductCarousel({ className, itemSize, itemProps, onInViewport, onNeedRequest, children, }: ProductCarouselProps): import("react/jsx-runtime").JSX.Element;