@sima-land/moleculas 16.0.0-alpha.2 → 16.0.0-alpha.21
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.
- package/README.md +23 -0
- package/common/components/badge/badge.d.ts +8 -0
- package/common/components/badge/badge.js +55 -0
- package/common/components/badge/badge.js.map +1 -0
- package/common/components/badge/badge.m.scss +81 -0
- package/common/components/badge/index.d.ts +2 -19
- package/common/components/badge/index.js +3 -80
- package/common/components/badge/index.js.map +1 -0
- package/common/components/badge/types.d.ts +26 -0
- package/common/components/{intractive-image → badge}/types.js +1 -0
- package/common/components/badge/types.js.map +1 -0
- package/common/components/badge-list/badge-list.d.ts +29 -0
- package/common/components/badge-list/badge-list.js +38 -0
- package/common/components/badge-list/badge-list.js.map +1 -0
- package/common/components/badge-list/index.d.ts +1 -29
- package/common/components/badge-list/index.js +3 -56
- package/common/components/badge-list/index.js.map +1 -0
- package/common/components/breadcrumbs/breadcrumbs.d.ts +46 -0
- package/common/components/breadcrumbs/breadcrumbs.js +83 -0
- package/common/components/breadcrumbs/breadcrumbs.js.map +1 -0
- package/common/components/breadcrumbs/breadcrumbs.m.scss +113 -0
- package/common/components/breadcrumbs/index.d.ts +2 -0
- package/common/components/breadcrumbs/index.js +7 -0
- package/common/components/breadcrumbs/index.js.map +1 -0
- package/common/components/breadcrumbs/types.d.ts +8 -0
- package/common/{types.js → components/breadcrumbs/types.js} +1 -0
- package/common/components/breadcrumbs/types.js.map +1 -0
- package/common/components/img-stub/img-stub.d.ts +14 -0
- package/common/components/img-stub/img-stub.js +21 -0
- package/common/components/img-stub/img-stub.js.map +1 -0
- package/common/components/img-stub/img-stub.m.scss +36 -0
- package/common/components/img-stub/index.d.ts +1 -0
- package/common/components/img-stub/index.js +6 -0
- package/common/components/img-stub/index.js.map +1 -0
- package/common/components/{intractive-image → interactive-image}/index.js +1 -0
- package/common/components/interactive-image/index.js.map +1 -0
- package/common/components/interactive-image/interactive-image.d.ts +15 -0
- package/common/components/interactive-image/interactive-image.js +56 -0
- package/common/components/interactive-image/interactive-image.js.map +1 -0
- package/common/components/{intractive-image → interactive-image}/types.d.ts +4 -4
- package/common/components/interactive-image/types.js +3 -0
- package/common/components/interactive-image/types.js.map +1 -0
- package/common/components/media-gallery/index.d.ts +2 -0
- package/common/components/media-gallery/index.js +7 -0
- package/common/components/media-gallery/index.js.map +1 -0
- package/common/components/media-gallery/media-gallery.d.ts +16 -0
- package/common/components/media-gallery/media-gallery.js +90 -0
- package/common/components/media-gallery/media-gallery.js.map +1 -0
- package/common/components/media-gallery/media-gallery.m.scss +35 -0
- package/common/components/media-gallery/types.d.ts +12 -0
- package/common/components/media-gallery/types.js +3 -0
- package/common/components/media-gallery/types.js.map +1 -0
- package/common/components/media-gallery/utils.d.ts +38 -0
- package/common/components/media-gallery/utils.js +102 -0
- package/common/components/media-gallery/utils.js.map +1 -0
- package/common/components/media-modal/__mocks__/images/armchair.jpg +0 -0
- package/common/components/media-modal/__mocks__/images/cup.jpg +0 -0
- package/common/components/media-modal/__mocks__/images/plant.jpg +0 -0
- package/common/components/media-modal/__mocks__/images/stump.jpg +0 -0
- package/common/components/media-modal/__mocks__/images/table.jpg +0 -0
- package/common/components/media-modal/__mocks__/images/vase.jpg +0 -0
- package/common/components/media-modal/__mocks__/index.d.ts +3 -0
- package/common/components/media-modal/__mocks__/index.js +251 -0
- package/common/components/media-modal/__mocks__/index.js.map +1 -0
- package/common/components/media-modal/__mocks__/thumbnails/armchair.jpg +0 -0
- package/common/components/media-modal/__mocks__/thumbnails/cup.jpg +0 -0
- package/common/components/media-modal/__mocks__/thumbnails/plant.jpg +0 -0
- package/common/components/media-modal/__mocks__/thumbnails/stump.jpg +0 -0
- package/common/components/media-modal/__mocks__/thumbnails/table.jpg +0 -0
- package/common/components/media-modal/__mocks__/thumbnails/vase.jpg +0 -0
- package/common/components/media-modal/__mocks__/thumbnails/video3404953.jpg +0 -0
- package/common/components/media-modal/__mocks__/thumbnails/video3619217.jpg +0 -0
- package/common/components/media-modal/__mocks__/thumbnails/video4093038.jpg +0 -0
- package/common/components/media-modal/__mocks__/thumbnails/video6907296.jpg +0 -0
- package/common/components/media-modal/index.d.ts +11 -0
- package/common/components/media-modal/index.js +29 -0
- package/common/components/media-modal/index.js.map +1 -0
- package/common/components/media-modal/layout.d.ts +36 -0
- package/common/components/media-modal/layout.js +81 -0
- package/common/components/media-modal/layout.js.map +1 -0
- package/common/components/media-modal/layout.m.scss +78 -0
- package/common/components/media-modal/parts/all-round-view.d.ts +7 -0
- package/common/components/media-modal/parts/all-round-view.js +42 -0
- package/common/components/media-modal/parts/all-round-view.js.map +1 -0
- package/common/components/media-modal/parts/all-round-view.m.scss +30 -0
- package/common/components/media-modal/parts/index.d.ts +36 -0
- package/common/components/media-modal/parts/index.js +65 -0
- package/common/components/media-modal/parts/index.js.map +1 -0
- package/common/components/media-modal/parts/media-area.d.ts +25 -0
- package/common/components/media-modal/parts/media-area.js +61 -0
- package/common/components/media-modal/parts/media-area.js.map +1 -0
- package/common/components/media-modal/parts/media-area.m.scss +21 -0
- package/common/components/media-modal/parts/media-view.d.ts +20 -0
- package/common/components/media-modal/parts/media-view.js +46 -0
- package/common/components/media-modal/parts/media-view.js.map +1 -0
- package/common/components/media-modal/parts/media-view.m.scss +34 -0
- package/common/components/media-modal/parts/parts.m.scss +21 -0
- package/common/components/media-modal/parts/product-brief.d.ts +20 -0
- package/common/components/media-modal/parts/product-brief.js +40 -0
- package/common/components/media-modal/parts/product-brief.js.map +1 -0
- package/common/components/media-modal/parts/product-brief.m.scss +149 -0
- package/common/components/media-modal/parts/review.d.ts +15 -0
- package/common/components/media-modal/parts/review.js +32 -0
- package/common/components/media-modal/parts/review.js.map +1 -0
- package/common/components/media-modal/parts/review.m.scss +86 -0
- package/common/components/media-modal/parts/scroll-section.d.ts +11 -0
- package/common/components/media-modal/parts/scroll-section.js +20 -0
- package/common/components/media-modal/parts/scroll-section.js.map +1 -0
- package/common/components/media-modal/parts/scroll-section.m.scss +32 -0
- package/common/components/media-modal/parts/thumbnail.d.ts +22 -0
- package/common/components/media-modal/parts/thumbnail.js +36 -0
- package/common/components/media-modal/parts/thumbnail.js.map +1 -0
- package/common/components/media-modal/parts/thumbnail.m.scss +156 -0
- package/common/components/media-modal/parts/thumbnails.d.ts +13 -0
- package/common/components/media-modal/parts/thumbnails.js +60 -0
- package/common/components/media-modal/parts/thumbnails.js.map +1 -0
- package/common/components/media-modal/parts/thumbnails.m.scss +16 -0
- package/common/components/media-modal/types.d.ts +18 -0
- package/common/components/media-modal/types.js +3 -0
- package/common/components/media-modal/types.js.map +1 -0
- package/common/components/media-modal/utils.d.ts +42 -0
- package/common/components/media-modal/utils.js +110 -0
- package/common/components/media-modal/utils.js.map +1 -0
- package/common/components/modifier/index.d.ts +2 -46
- package/common/components/modifier/index.js +4 -99
- package/common/components/modifier/index.js.map +1 -0
- package/common/components/modifier/modifier.d.ts +13 -0
- package/common/components/modifier/modifier.js +74 -0
- package/common/components/modifier/modifier.js.map +1 -0
- package/common/components/modifier/{modifiers.module.scss → modifier.m.scss} +61 -0
- package/common/components/modifier/types.d.ts +35 -0
- package/common/components/modifier/types.js +3 -0
- package/common/components/modifier/types.js.map +1 -0
- package/common/components/pagination-controls/index.d.ts +2 -0
- package/common/components/pagination-controls/index.js +9 -0
- package/common/components/pagination-controls/index.js.map +1 -0
- package/common/components/pagination-controls/pagination-controls.d.ts +30 -0
- package/common/components/pagination-controls/pagination-controls.js +72 -0
- package/common/components/pagination-controls/pagination-controls.js.map +1 -0
- package/common/components/pagination-controls/pagination-controls.m.scss +70 -0
- package/common/components/pagination-controls/types.d.ts +20 -0
- package/common/components/pagination-controls/types.js +3 -0
- package/common/components/pagination-controls/types.js.map +1 -0
- package/common/components/product-info/index.d.ts +1 -16
- package/common/components/product-info/index.js +5 -41
- package/common/components/product-info/index.js.map +1 -0
- package/common/components/product-info/parts.d.ts +22 -21
- package/common/components/product-info/parts.js +35 -83
- package/common/components/product-info/parts.js.map +1 -0
- package/common/components/product-info/product-info.d.ts +15 -0
- package/common/components/product-info/product-info.js +33 -0
- package/common/components/product-info/product-info.js.map +1 -0
- package/common/components/product-info/{product-info.module.scss → product-info.m.scss} +9 -0
- package/common/components/product-info/types.d.ts +2 -2
- package/common/components/product-info/types.js +1 -0
- package/common/components/product-info/types.js.map +1 -0
- package/common/components/product-info/utils.js +1 -0
- package/common/components/product-info/utils.js.map +1 -0
- package/common/components/rating-counter/index.d.ts +1 -25
- package/common/components/rating-counter/index.js +3 -35
- package/common/components/rating-counter/index.js.map +1 -0
- package/common/components/rating-counter/rating-counter-util.scss +1 -1
- package/common/components/rating-counter/rating-counter.d.ts +35 -0
- package/common/components/rating-counter/rating-counter.js +24 -0
- package/common/components/rating-counter/rating-counter.js.map +1 -0
- package/common/hooks/index.d.ts +19 -0
- package/common/hooks/index.js +39 -0
- package/common/hooks/index.js.map +1 -0
- package/desktop/components/breadcrumbs/breadcrumbs.d.ts +31 -0
- package/desktop/components/breadcrumbs/breadcrumbs.js +56 -0
- package/desktop/components/breadcrumbs/breadcrumbs.js.map +1 -0
- package/desktop/components/breadcrumbs/{breadcrumbs.module.scss → breadcrumbs.m.scss} +36 -1
- package/desktop/components/breadcrumbs/index.d.ts +1 -28
- package/desktop/components/breadcrumbs/index.js +3 -80
- package/desktop/components/breadcrumbs/index.js.map +1 -0
- package/desktop/components/gallery-modal/__mocks__/index.js +1 -0
- package/desktop/components/gallery-modal/__mocks__/index.js.map +1 -0
- package/desktop/components/gallery-modal/components/all-round-view.d.ts +5 -2
- package/desktop/components/gallery-modal/components/all-round-view.js +47 -62
- package/desktop/components/gallery-modal/components/all-round-view.js.map +1 -0
- package/desktop/components/gallery-modal/components/{all-round-view.module.scss → all-round-view.m.scss} +5 -0
- package/desktop/components/gallery-modal/components/gallery-modal.d.ts +4 -5
- package/desktop/components/gallery-modal/components/gallery-modal.js +16 -66
- package/desktop/components/gallery-modal/components/gallery-modal.js.map +1 -0
- package/desktop/components/gallery-modal/components/{gallery-modal.module.scss → gallery-modal.m.scss} +5 -3
- package/desktop/components/gallery-modal/components/image-overlay.d.ts +3 -3
- package/desktop/components/gallery-modal/components/image-overlay.js +4 -17
- package/desktop/components/gallery-modal/components/image-overlay.js.map +1 -0
- package/desktop/components/gallery-modal/components/{image-overlay.module.scss → image-overlay.m.scss} +1 -0
- package/desktop/components/gallery-modal/components/review-info.d.ts +1 -1
- package/desktop/components/gallery-modal/components/review-info.js +11 -52
- package/desktop/components/gallery-modal/components/review-info.js.map +1 -0
- package/desktop/components/gallery-modal/components/thumbnail.d.ts +3 -3
- package/desktop/components/gallery-modal/components/thumbnail.js +7 -10
- package/desktop/components/gallery-modal/components/thumbnail.js.map +1 -0
- package/desktop/components/gallery-modal/index.js +1 -0
- package/desktop/components/gallery-modal/index.js.map +1 -0
- package/desktop/components/gallery-modal/types.js +1 -0
- package/desktop/components/gallery-modal/types.js.map +1 -0
- package/desktop/components/gallery-modal/utils.d.ts +5 -3
- package/desktop/components/gallery-modal/utils.js +18 -8
- package/desktop/components/gallery-modal/utils.js.map +1 -0
- package/desktop/components/person-info/index.d.ts +1 -41
- package/desktop/components/person-info/index.js +3 -43
- package/desktop/components/person-info/index.js.map +1 -0
- package/desktop/components/person-info/person-info.d.ts +42 -0
- package/desktop/components/person-info/person-info.js +24 -0
- package/desktop/components/person-info/person-info.js.map +1 -0
- package/desktop/components/person-info/{person-info.module.scss → person-info.m.scss} +1 -1
- package/desktop/components/product-card/index.d.ts +2 -26
- package/desktop/components/product-card/index.js +7 -103
- package/desktop/components/product-card/index.js.map +1 -0
- package/desktop/components/product-card/product-card.d.ts +23 -0
- package/desktop/components/product-card/product-card.js +94 -0
- package/desktop/components/product-card/product-card.js.map +1 -0
- package/desktop/components/product-card/types.d.ts +19 -0
- package/desktop/components/product-card/types.js +3 -0
- package/desktop/components/product-card/types.js.map +1 -0
- package/desktop/components/product-carousel/hover-card.d.ts +2 -7
- package/desktop/components/product-carousel/hover-card.js +13 -49
- package/desktop/components/product-carousel/hover-card.js.map +1 -0
- package/desktop/components/product-carousel/{hover-card.module.scss → hover-card.m.scss} +2 -2
- package/desktop/components/product-carousel/index.d.ts +2 -31
- package/desktop/components/product-carousel/index.js +3 -133
- package/desktop/components/product-carousel/index.js.map +1 -0
- package/desktop/components/product-carousel/product-carousel.d.ts +7 -0
- package/desktop/components/product-carousel/product-carousel.js +95 -0
- package/desktop/components/product-carousel/product-carousel.js.map +1 -0
- package/desktop/components/product-carousel/{product-carousel.module.scss → product-carousel.m.scss} +1 -1
- package/desktop/components/product-carousel/types.d.ts +33 -0
- package/desktop/components/product-carousel/types.js +3 -0
- package/desktop/components/product-carousel/types.js.map +1 -0
- package/desktop/components/product-carousel/utils.d.ts +4 -4
- package/desktop/components/product-carousel/utils.js +8 -7
- package/desktop/components/product-carousel/utils.js.map +1 -0
- package/desktop/components/promotion-card/banner-title.d.ts +2 -3
- package/desktop/components/promotion-card/banner-title.js +9 -19
- package/desktop/components/promotion-card/banner-title.js.map +1 -0
- package/desktop/components/promotion-card/estimate.d.ts +1 -2
- package/desktop/components/promotion-card/estimate.js +3 -5
- package/desktop/components/promotion-card/estimate.js.map +1 -0
- package/desktop/components/promotion-card/index.d.ts +4 -31
- package/desktop/components/promotion-card/index.js +10 -83
- package/desktop/components/promotion-card/index.js.map +1 -0
- package/desktop/components/promotion-card/placeholder.d.ts +4 -2
- package/desktop/components/promotion-card/placeholder.js +4 -6
- package/desktop/components/promotion-card/placeholder.js.map +1 -0
- package/desktop/components/promotion-card/promotion-card.d.ts +32 -0
- package/desktop/components/promotion-card/promotion-card.js +39 -0
- package/desktop/components/promotion-card/promotion-card.js.map +1 -0
- package/desktop/components/promotion-card/{index.module.scss → promotion-card.m.scss} +8 -6
- package/desktop/components/promotion-card/types.js +1 -0
- package/desktop/components/promotion-card/types.js.map +1 -0
- package/mobile/components/action-circles/action-circles.d.ts +22 -0
- package/mobile/components/action-circles/action-circles.js +31 -0
- package/mobile/components/action-circles/action-circles.js.map +1 -0
- package/mobile/components/action-circles/index.d.ts +1 -22
- package/mobile/components/action-circles/index.js +3 -29
- package/mobile/components/action-circles/index.js.map +1 -0
- package/mobile/components/action-list/action-list.d.ts +29 -0
- package/mobile/components/action-list/action-list.js +40 -0
- package/mobile/components/action-list/action-list.js.map +1 -0
- package/mobile/components/action-list/index.d.ts +1 -23
- package/mobile/components/action-list/index.js +5 -34
- package/mobile/components/action-list/index.js.map +1 -0
- package/mobile/components/breadcrumbs/breadcrumbs.d.ts +12 -0
- package/mobile/components/breadcrumbs/breadcrumbs.js +17 -0
- package/mobile/components/breadcrumbs/breadcrumbs.js.map +1 -0
- package/mobile/components/breadcrumbs/index.d.ts +1 -13
- package/mobile/components/breadcrumbs/index.js +3 -13
- package/mobile/components/breadcrumbs/index.js.map +1 -0
- package/mobile/components/person-info/index.d.ts +1 -44
- package/mobile/components/person-info/index.js +4 -55
- package/mobile/components/person-info/index.js.map +1 -0
- package/mobile/components/person-info/person-info.d.ts +46 -0
- package/mobile/components/person-info/person-info.js +41 -0
- package/mobile/components/person-info/person-info.js.map +1 -0
- package/mobile/components/person-info/{person-info.module.scss → person-info.m.scss} +9 -16
- package/mobile/components/product-row/index.d.ts +1 -41
- package/mobile/components/product-row/index.js +3 -56
- package/mobile/components/product-row/index.js.map +1 -0
- package/mobile/components/product-row/product-row.d.ts +40 -0
- package/mobile/components/product-row/product-row.js +29 -0
- package/mobile/components/product-row/product-row.js.map +1 -0
- package/mobile/components/product-slider/index.d.ts +1 -17
- package/mobile/components/product-slider/index.js +3 -57
- package/mobile/components/product-slider/index.js.map +1 -0
- package/mobile/components/product-slider/product-slider.d.ts +17 -0
- package/mobile/components/product-slider/product-slider.js +37 -0
- package/mobile/components/product-slider/product-slider.js.map +1 -0
- package/mobile/components/search-bar/index.d.ts +1 -39
- package/mobile/components/search-bar/index.js +4 -104
- package/mobile/components/search-bar/index.js.map +1 -0
- package/mobile/components/search-bar/search-bar.d.ts +39 -0
- package/mobile/components/search-bar/search-bar.js +64 -0
- package/mobile/components/search-bar/search-bar.js.map +1 -0
- package/mobile/components/search-bar/{search-bar.module.scss → search-bar.m.scss} +6 -6
- package/mobile/components/select-screen/index.d.ts +1 -20
- package/mobile/components/select-screen/index.js +4 -65
- package/mobile/components/select-screen/index.js.map +1 -0
- package/mobile/components/select-screen/select-screen.d.ts +20 -0
- package/mobile/components/select-screen/select-screen.js +31 -0
- package/mobile/components/select-screen/select-screen.js.map +1 -0
- package/package.json +40 -52
- package/common/components/badge/badge.module.scss +0 -40
- package/common/components/intractive-image/interactive-image.d.ts +0 -15
- package/common/components/intractive-image/interactive-image.js +0 -96
- package/common/components/rating-counter/star.svg +0 -5
- package/common/constants.d.ts +0 -2
- package/common/constants.js +0 -8
- package/common/icons/eighteen-plus.svg +0 -5
- package/common/types.d.ts +0 -1
- package/desktop/components/breadcrumbs/square-arrow-down.svg +0 -8
- package/desktop/components/gallery-modal/icons/360.svg +0 -3
- package/desktop/components/gallery-modal/icons/pause.svg +0 -3
- package/desktop/components/gallery-modal/icons/turn-left.svg +0 -10
- package/desktop/components/gallery-modal/icons/turn-right.svg +0 -10
- package/desktop/components/modifiers/button/index.d.ts +0 -22
- package/desktop/components/modifiers/button/index.js +0 -48
- package/desktop/components/modifiers/button/modifier-button.module.scss +0 -85
- package/desktop/components/modifiers/group/index.d.ts +0 -15
- package/desktop/components/modifiers/group/index.js +0 -70
- package/desktop/components/modifiers/group/modifiers-group.module.scss +0 -33
- package/desktop/components/modifiers/group/utils.d.ts +0 -20
- package/desktop/components/modifiers/group/utils.js +0 -73
- package/desktop/components/modifiers/modifiers.scss +0 -8
- package/mobile/components/modifiers-list/index.d.ts +0 -22
- package/mobile/components/modifiers-list/index.js +0 -25
- package/mobile/components/modifiers-list/modifier-item/index.d.ts +0 -29
- package/mobile/components/modifiers-list/modifier-item/index.js +0 -38
- package/mobile/components/modifiers-list/modifier-item/modifier-item.module.scss +0 -70
- package/mobile/components/modifiers-list/modifiers-list.module.scss +0 -21
- package/mobile/components/pseudo-input/index.d.ts +0 -11
- package/mobile/components/pseudo-input/index.js +0 -34
- package/mobile/components/pseudo-input/pseudo-input.module.scss +0 -24
- /package/common/components/badge-list/{badge-list.module.scss → badge-list.m.scss} +0 -0
- /package/common/components/{intractive-image → interactive-image}/index.d.ts +0 -0
- /package/common/components/{intractive-image → interactive-image}/interactive-image-util.scss +0 -0
- /package/common/components/{intractive-image/interactive-image.module.scss → interactive-image/interactive-image.m.scss} +0 -0
- /package/common/components/rating-counter/{rating-counter.module.scss → rating-counter.m.scss} +0 -0
- /package/desktop/components/gallery-modal/components/{review-info.module.scss → review-info.m.scss} +0 -0
- /package/desktop/components/gallery-modal/components/{thumbnail.module.scss → thumbnail.m.scss} +0 -0
- /package/desktop/components/product-card/{product-card.module.scss → product-card.m.scss} +0 -0
- /package/desktop/components/promotion-card/{banner-title.module.scss → banner-title.m.scss} +0 -0
- /package/desktop/components/promotion-card/{placeholder.module.scss → placeholder.m.scss} +0 -0
- /package/mobile/components/action-circles/{action-circles.module.scss → action-circles.m.scss} +0 -0
- /package/mobile/components/action-list/{action-list.module.scss → action-list.m.scss} +0 -0
- /package/mobile/components/breadcrumbs/{breadcrumbs.module.scss → breadcrumbs.m.scss} +0 -0
- /package/mobile/components/product-row/{product-row.module.scss → product-row.m.scss} +0 -0
- /package/mobile/components/product-slider/{product-slider.module.scss → product-slider.m.scss} +0 -0
- /package/mobile/components/select-screen/{select-screen.module.scss → select-screen.m.scss} +0 -0
|
@@ -1,76 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
4
|
};
|
|
39
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
6
|
exports.HoverCard = void 0;
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const bind_1 = __importDefault(require("classnames/bind"));
|
|
45
|
-
const hover_card_module_scss_1 = __importDefault(require("./hover-card.module.scss"));
|
|
46
|
-
const shapes_1 = require("@sima-land/ui-nucleons/styling/shapes");
|
|
47
|
-
const shadows_1 = require("@sima-land/ui-nucleons/styling/shadows");
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const styling_1 = require("@sima-land/ui-nucleons/styling");
|
|
48
10
|
const product_card_1 = require("../product-card");
|
|
49
|
-
const
|
|
11
|
+
const bind_1 = __importDefault(require("classnames/bind"));
|
|
12
|
+
const hover_card_m_scss_1 = __importDefault(require("./hover-card.m.scss"));
|
|
13
|
+
const helpers_1 = require("@sima-land/ui-nucleons/helpers");
|
|
14
|
+
const cx = bind_1.default.bind(hover_card_m_scss_1.default);
|
|
50
15
|
/**
|
|
51
16
|
* Карточка товара, появляющаяся над элементом карусели.
|
|
52
17
|
* @param props Свойства компонента.
|
|
53
18
|
* @return Элемент.
|
|
54
19
|
*/
|
|
55
|
-
|
|
56
|
-
var { targetRef, onMouseLeave } = _a, productInfoProps = __rest(_a, ["targetRef", "onMouseLeave"]);
|
|
20
|
+
function HoverCard({ targetRef, onMouseLeave, children }) {
|
|
57
21
|
const rootRef = (0, react_1.useRef)(null);
|
|
58
22
|
const [ready, setReady] = (0, react_1.useState)(false);
|
|
59
23
|
(0, react_1.useLayoutEffect)(() => {
|
|
60
24
|
if (targetRef.current && rootRef.current) {
|
|
61
25
|
const element = rootRef.current;
|
|
62
26
|
const rect = targetRef.current.getBoundingClientRect();
|
|
63
|
-
const correction = (0,
|
|
27
|
+
const correction = (0, helpers_1.getPositionedParentOffset)(rootRef.current);
|
|
64
28
|
element.style.left = `${correction.x + rect.left - 16}px`;
|
|
65
29
|
element.style.top = `${correction.y + rect.top - 16}px`;
|
|
66
30
|
element.style.width = `${rect.width + 32}px`;
|
|
67
31
|
setReady(true);
|
|
68
32
|
}
|
|
69
33
|
});
|
|
70
|
-
return (
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(product_card_1.HoverCard, { ref: rootRef, style: { padding: '16px 16px 24px 16px' }, className: cx('root', !ready && 'hidden', styling_1.SmallRounds.all, styling_1.BoxShadow.z4), onMouseLeave: () => {
|
|
71
35
|
setReady(false);
|
|
72
36
|
onMouseLeave && onMouseLeave();
|
|
73
|
-
} }
|
|
74
|
-
|
|
75
|
-
};
|
|
37
|
+
}, children: children }));
|
|
38
|
+
}
|
|
76
39
|
exports.HoverCard = HoverCard;
|
|
40
|
+
//# sourceMappingURL=hover-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover-card.js","sourceRoot":"","sources":["../../../../src/desktop/components/product-carousel/hover-card.tsx"],"names":[],"mappings":";;;;;;;AAAA,iCAA0D;AAE1D,4DAAwE;AACxE,kDAA6D;AAC7D,2DAAyC;AACzC,4EAAyC;AACzC,4DAA2E;AAE3E,MAAM,EAAE,GAAG,cAAU,CAAC,IAAI,CAAC,2BAAM,CAAC,CAAC;AAEnC;;;;GAIG;AACH,SAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAkB;IAC7E,MAAM,OAAO,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAC;IAEnD,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,IAAI,SAAS,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACzC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;YAChC,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;YACvD,MAAM,UAAU,GAAG,IAAA,mCAAyB,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAE9D,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,UAAU,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,EAAE,IAAI,CAAC;YAC1D,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,UAAU,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG,EAAE,IAAI,CAAC;YACxD,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,EAAE,IAAI,CAAC;YAE7C,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,uBAAC,wBAAa,IACZ,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,EACzC,SAAS,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,QAAQ,EAAE,qBAAW,CAAC,GAAG,EAAE,mBAAS,CAAC,EAAE,CAAC,EACxE,YAAY,EAAE,GAAG,EAAE;YACjB,QAAQ,CAAC,KAAK,CAAC,CAAC;YAChB,YAAY,IAAI,YAAY,EAAE,CAAC;QACjC,CAAC,YAEA,QAAQ,GACK,CACjB,CAAC;AACJ,CAAC;AA/BD,8BA+BC"}
|
|
@@ -1,31 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface ItemSize {
|
|
4
|
-
xs?: 2 | 3 | 4;
|
|
5
|
-
s?: 2 | 3 | 4;
|
|
6
|
-
m?: 2 | 3 | 4;
|
|
7
|
-
l?: 2 | 3 | 4;
|
|
8
|
-
xl?: 2 | 3 | 4;
|
|
9
|
-
}
|
|
10
|
-
export type ItemElement = React.ReactElement<ProductInfoProps, typeof ProductInfo>;
|
|
11
|
-
export interface ProductCarouselProps {
|
|
12
|
-
/** CSS-класс для корневого элемента. */
|
|
13
|
-
className?: string;
|
|
14
|
-
/** Элементы карусели. */
|
|
15
|
-
children?: ItemElement | ItemElement[];
|
|
16
|
-
/** Настройки размера элемента карусели. */
|
|
17
|
-
itemSize?: ItemSize;
|
|
18
|
-
/** Сработает при попадании карусели во viewport. */
|
|
19
|
-
onInViewport?: () => void;
|
|
20
|
-
/** Сработает при попадании карусели в область достаточно близкую к viewport'у. */
|
|
21
|
-
onNeedRequest?: () => void;
|
|
22
|
-
/** Нужно ли показывать всплывающую карточку при наведении на элемент карусели. */
|
|
23
|
-
withHoverCard?: boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Карусель рекомендованных товаров.
|
|
27
|
-
* @param props Свойства.
|
|
28
|
-
* @return Элемент.
|
|
29
|
-
*/
|
|
30
|
-
export declare function ProductCarousel({ className, itemSize, onInViewport, onNeedRequest, withHoverCard, children, }: ProductCarouselProps): JSX.Element;
|
|
31
|
-
export {};
|
|
1
|
+
export type { ProductCarouselProps } from './types';
|
|
2
|
+
export { ProductCarousel } from './product-carousel';
|
|
@@ -1,136 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
3
|
exports.ProductCarousel = void 0;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const utils_1 = require("./utils");
|
|
34
|
-
const intersection_1 = require("@sima-land/ui-nucleons/hooks/intersection");
|
|
35
|
-
const media_1 = require("@sima-land/ui-nucleons/hooks/media");
|
|
36
|
-
const product_info_1 = require("../../../common/components/product-info");
|
|
37
|
-
const bind_1 = __importDefault(require("classnames/bind"));
|
|
38
|
-
const product_carousel_module_scss_1 = __importDefault(require("./product-carousel.module.scss"));
|
|
39
|
-
const layer_1 = require("@sima-land/ui-nucleons/helpers/layer");
|
|
40
|
-
const cx = bind_1.default.bind(product_carousel_module_scss_1.default);
|
|
41
|
-
// eslint-disable-next-line require-jsdoc
|
|
42
|
-
const getSizeClasses = (size = {}) => [
|
|
43
|
-
`size-xs-${size.xs || 4}`,
|
|
44
|
-
`size-s-${size.s || 3}`,
|
|
45
|
-
`size-m-${size.m || 2}`,
|
|
46
|
-
`size-l-${size.l || 2}`,
|
|
47
|
-
`size-xl-${size.xl || 2}`,
|
|
48
|
-
];
|
|
49
|
-
/**
|
|
50
|
-
* Карусель рекомендованных товаров.
|
|
51
|
-
* @param props Свойства.
|
|
52
|
-
* @return Элемент.
|
|
53
|
-
*/
|
|
54
|
-
function ProductCarousel({ className, itemSize, onInViewport, onNeedRequest, withHoverCard, children, }) {
|
|
55
|
-
const layer = (0, layer_1.useLayer)();
|
|
56
|
-
const [activeItemIndex, setActiveItemIndex] = (0, react_1.useState)(null);
|
|
57
|
-
const cardShow = (0, utils_1.useAllowFlag)();
|
|
58
|
-
const needBigArrows = (0, media_1.useMedia)('(min-width: 1600px)');
|
|
59
|
-
const rootRef = (0, react_1.useRef)(null);
|
|
60
|
-
const targetItemRef = (0, react_1.useRef)(null);
|
|
61
|
-
let items;
|
|
62
|
-
if (Array.isArray(children)) {
|
|
63
|
-
items = children;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
items = children ? [children] : [];
|
|
67
|
-
}
|
|
68
|
-
// вычисляем ширину элемента карусели для позиционирования стрелок
|
|
69
|
-
const firstItemRef = (0, react_1.useRef)(null);
|
|
70
|
-
const itemWidth = (0, utils_1.useClientWidth)(firstItemRef, [items.length]);
|
|
71
|
-
// инициируем загрузку данных, когда компонент почти попал в зону видимости
|
|
72
|
-
const options = (0, react_1.useMemo)(() => ({ rootMargin: '200px 0px 200px 0px' }), []);
|
|
73
|
-
(0, intersection_1.useIntersection)(rootRef, entry => {
|
|
74
|
-
entry.isIntersecting && onNeedRequest && onNeedRequest();
|
|
75
|
-
}, options);
|
|
76
|
-
// отправляем статистку, когда компонент попадает в зону видимости
|
|
77
|
-
(0, intersection_1.useIntersection)(rootRef, entry => {
|
|
78
|
-
entry.isIntersecting && onInViewport && onInViewport();
|
|
79
|
-
});
|
|
80
|
-
return (react_1.default.createElement("div", { ref: rootRef, className: cx('root', className), "data-testid": 'product-carousel:root' },
|
|
81
|
-
items.length > 0 && (react_1.default.createElement(carousel_1.Carousel, Object.assign({ step: 3, draggable: false,
|
|
82
|
-
// докидываем индекс чтобы позже брать актуальные данные из списка по нему
|
|
83
|
-
items: items.map((item, index) => [item, index]) }, (itemWidth !== null && {
|
|
84
|
-
withControls: undefined,
|
|
85
|
-
controlProps: {
|
|
86
|
-
size: needBigArrows ? 'l' : 's',
|
|
87
|
-
style: {
|
|
88
|
-
zIndex: layer + 2,
|
|
89
|
-
top: `${itemWidth / 2}px`,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
}), { renderItem: ([item, index], realIndex) => (react_1.default.createElement(ProductCarouselItem, { rootRef: realIndex === 0 ? firstItemRef : undefined, withHoverCard: withHoverCard, className: cx(getSizeClasses(itemSize)), onMouseEnter: e => {
|
|
93
|
-
if (cardShow.allowed()) {
|
|
94
|
-
targetItemRef.current = e.currentTarget;
|
|
95
|
-
setActiveItemIndex(index);
|
|
96
|
-
}
|
|
97
|
-
} }, item)),
|
|
98
|
-
// длительность прокрутки в Carousel - 320, делаем слегка с запасом
|
|
99
|
-
// @todo после восстановления проверить позицию курсора чтобы показать карточку (если будет критично)
|
|
100
|
-
onChangeTargetIndex: () => cardShow.disallowFor(360) }))),
|
|
101
|
-
withHoverCard &&
|
|
102
|
-
activeItemIndex !== null &&
|
|
103
|
-
items[activeItemIndex] &&
|
|
104
|
-
[items[activeItemIndex]].map(item => (react_1.default.createElement(hover_card_1.HoverCard, Object.assign({ key: activeItemIndex, targetRef: targetItemRef, onMouseLeave: () => setActiveItemIndex(null) }, item.props))))));
|
|
105
|
-
}
|
|
106
|
-
exports.ProductCarousel = ProductCarousel;
|
|
107
|
-
/**
|
|
108
|
-
* Элемент карусели. Выведет базовый контент.
|
|
109
|
-
* Полное содержимое будет выведено во всплывающей карточке.
|
|
110
|
-
* @inheritdoc
|
|
111
|
-
*/
|
|
112
|
-
function ProductCarouselItem({ rootRef, className, onMouseEnter, withHoverCard, children, }) {
|
|
113
|
-
return (react_1.default.createElement("div", { ref: rootRef, "data-testid": 'product-carousel:item', className: cx('item', className), onMouseEnter: onMouseEnter }, (0, react_1.cloneElement)(children, {
|
|
114
|
-
children: react_1.Children.toArray(children.props.children).reduce((list, child) => {
|
|
115
|
-
if ((0, react_1.isValidElement)(child)) {
|
|
116
|
-
switch (child.type) {
|
|
117
|
-
case product_info_1.Parts.Image: {
|
|
118
|
-
// иконки у картинки скрываем если есть HoverCard
|
|
119
|
-
list.push(withHoverCard ? (0, react_1.cloneElement)(child, { children: undefined }) : child);
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
case product_info_1.Parts.Footer:
|
|
123
|
-
// футер не выводим если есть HoverCard
|
|
124
|
-
!withHoverCard && list.push(child);
|
|
125
|
-
break;
|
|
126
|
-
default: {
|
|
127
|
-
// остальное выводим как есть
|
|
128
|
-
list.push(child);
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return list;
|
|
134
|
-
}, []),
|
|
135
|
-
})));
|
|
136
|
-
}
|
|
4
|
+
var product_carousel_1 = require("./product-carousel");
|
|
5
|
+
Object.defineProperty(exports, "ProductCarousel", { enumerable: true, get: function () { return product_carousel_1.ProductCarousel; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/desktop/components/product-carousel/index.ts"],"names":[],"mappings":";;;AACA,uDAAqD;AAA5C,mHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ProductCarouselProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Карусель рекомендованных товаров.
|
|
4
|
+
* @param props Свойства.
|
|
5
|
+
* @return Элемент.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ProductCarousel({ className, itemSize, itemProps, onInViewport, onNeedRequest, withHoverCard, children, reduceBaseInfo: reduceBaseInfoProp, reduceHoverInfo: reduceHoverInfoProp, }: ProductCarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,95 @@
|
|
|
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.ProductCarousel = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const carousel_1 = require("@sima-land/ui-nucleons/carousel");
|
|
10
|
+
const hover_card_1 = require("./hover-card");
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
const hooks_1 = require("@sima-land/ui-nucleons/hooks");
|
|
13
|
+
const product_info_1 = require("../../../common/components/product-info");
|
|
14
|
+
const helpers_1 = require("@sima-land/ui-nucleons/helpers");
|
|
15
|
+
const product_card_1 = require("../product-card");
|
|
16
|
+
const bind_1 = __importDefault(require("classnames/bind"));
|
|
17
|
+
const product_carousel_m_scss_1 = __importDefault(require("./product-carousel.m.scss"));
|
|
18
|
+
const cx = bind_1.default.bind(product_carousel_m_scss_1.default);
|
|
19
|
+
// eslint-disable-next-line require-jsdoc
|
|
20
|
+
const getSizeClasses = (size) => size && size !== 'unset'
|
|
21
|
+
? [
|
|
22
|
+
`size-xs-${size.xs || 4}`,
|
|
23
|
+
`size-s-${size.s || 3}`,
|
|
24
|
+
`size-m-${size.m || 2}`,
|
|
25
|
+
`size-l-${size.l || 2}`,
|
|
26
|
+
`size-xl-${size.xl || 2}`,
|
|
27
|
+
]
|
|
28
|
+
: [];
|
|
29
|
+
/**
|
|
30
|
+
* Карусель рекомендованных товаров.
|
|
31
|
+
* @param props Свойства.
|
|
32
|
+
* @return Элемент.
|
|
33
|
+
*/
|
|
34
|
+
function ProductCarousel({ className, itemSize = { xs: 4, s: 3, m: 2, l: 2, xl: 2 }, itemProps, onInViewport, onNeedRequest, withHoverCard, children,
|
|
35
|
+
// @todo не совсем правильно заставлять работать с внутренностями реакта - надо придумать что-то более простое
|
|
36
|
+
reduceBaseInfo: reduceBaseInfoProp = withHoverCard ? product_card_1.reduceBaseInfo : element => element, reduceHoverInfo: reduceHoverInfoProp = product_card_1.reduceHoverInfo, }) {
|
|
37
|
+
const layer = (0, helpers_1.useLayer)();
|
|
38
|
+
const [activeItemIndex, setActiveItemIndex] = (0, react_1.useState)(null);
|
|
39
|
+
const cardShow = (0, utils_1.useAllowFlag)();
|
|
40
|
+
const needBigArrows = (0, hooks_1.useMedia)('(min-width: 1600px)');
|
|
41
|
+
const rootRef = (0, react_1.useRef)(null);
|
|
42
|
+
const targetItemRef = (0, react_1.useRef)(null);
|
|
43
|
+
const items = react_1.Children.toArray(children).reduce((acc, item) => {
|
|
44
|
+
if ((0, react_1.isValidElement)(item) && item.type === product_info_1.ProductInfo) {
|
|
45
|
+
acc.push(item);
|
|
46
|
+
}
|
|
47
|
+
return acc;
|
|
48
|
+
}, []);
|
|
49
|
+
// вычисляем ширину элемента карусели для позиционирования стрелок
|
|
50
|
+
const firstItemRef = (0, react_1.useRef)(null);
|
|
51
|
+
const itemWidth = (0, utils_1.useClientWidth)(firstItemRef, [items.length]);
|
|
52
|
+
// инициируем загрузку данных, когда компонент почти попал в зону видимости
|
|
53
|
+
const options = (0, react_1.useMemo)(() => ({ rootMargin: '200px 0px 200px 0px' }), []);
|
|
54
|
+
(0, hooks_1.useIntersection)(rootRef, entry => {
|
|
55
|
+
entry.isIntersecting && onNeedRequest && onNeedRequest();
|
|
56
|
+
}, options);
|
|
57
|
+
// отправляем статистку, когда компонент попадает в зону видимости
|
|
58
|
+
(0, hooks_1.useIntersection)(rootRef, entry => {
|
|
59
|
+
entry.isIntersecting && onInViewport && onInViewport();
|
|
60
|
+
});
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: rootRef, className: cx('root', className), "data-testid": 'product-carousel:root', onMouseLeave: () => setActiveItemIndex(null), children: [items.length > 0 && ((0, jsx_runtime_1.jsx)(carousel_1.Carousel, { step: 3, draggable: false,
|
|
62
|
+
// докидываем индекс чтобы позже брать актуальные данные из списка по нему
|
|
63
|
+
items: items.map((item, index) => [item, index]),
|
|
64
|
+
// ВАЖНО: скрываем кнопки ТОЛЬКО пока itemWidth не вычислен
|
|
65
|
+
withControls: itemWidth !== null ? undefined : false, controlProps: itemWidth !== null
|
|
66
|
+
? {
|
|
67
|
+
size: needBigArrows ? 'l' : 's',
|
|
68
|
+
style: {
|
|
69
|
+
zIndex: layer + 2, // чтобы кнопки были над HoverCard
|
|
70
|
+
top: `${itemWidth / 2}px`,
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
: undefined, renderItem: ([item, index], realIndex) => ((0, jsx_runtime_1.jsx)(CarouselItem, { rootRef: realIndex === 0 ? firstItemRef : undefined, className: cx(getSizeClasses(itemSize), itemProps === null || itemProps === void 0 ? void 0 : itemProps.className), style: itemProps === null || itemProps === void 0 ? void 0 : itemProps.style, onMouseEnter: e => {
|
|
74
|
+
if (cardShow.allowed()) {
|
|
75
|
+
targetItemRef.current = e.currentTarget;
|
|
76
|
+
setActiveItemIndex(index);
|
|
77
|
+
}
|
|
78
|
+
}, children: reduceBaseInfoProp(item) })),
|
|
79
|
+
// длительность прокрутки в Carousel - 320, делаем слегка с запасом
|
|
80
|
+
// @todo после восстановления проверить позицию курсора чтобы показать карточку (если будет критично)
|
|
81
|
+
onChangeTargetIndex: () => cardShow.disallowFor(360) })), withHoverCard &&
|
|
82
|
+
activeItemIndex !== null &&
|
|
83
|
+
items[activeItemIndex] &&
|
|
84
|
+
[items[activeItemIndex]].map(item => ((0, jsx_runtime_1.jsx)(hover_card_1.HoverCard, { targetRef: targetItemRef, onMouseLeave: () => setActiveItemIndex(null), ...item.props, children: reduceHoverInfoProp(item) }, activeItemIndex)))] }));
|
|
85
|
+
}
|
|
86
|
+
exports.ProductCarousel = ProductCarousel;
|
|
87
|
+
/**
|
|
88
|
+
* Элемент карусели. Выведет базовый контент.
|
|
89
|
+
* Полное содержимое будет выведено во всплывающей карточке.
|
|
90
|
+
* @inheritdoc
|
|
91
|
+
*/
|
|
92
|
+
function CarouselItem({ rootRef, className, onMouseEnter, children, style, }) {
|
|
93
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: rootRef, "data-testid": 'product-carousel:item', className: cx('item', className), onMouseEnter: onMouseEnter, style: style, children: children }));
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=product-carousel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-carousel.js","sourceRoot":"","sources":["../../../../src/desktop/components/product-carousel/product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C,CAAC,aAAa,CAAC;4BACxC,kBAAkB,CAAC,KAAK,CAAC,CAAC;wBAC5B,CAAC;oBACH,CAAC,YAEA,kBAAkB,CAAC,IAAI,CAAC,GACZ,CAChB;gBACD,mEAAmE;gBACnE,qGAAqG;gBACrG,mBAAmB,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,GACpD,CACH,EAIA,aAAa;gBACZ,eAAe,KAAK,IAAI;gBACxB,KAAK,CAAC,eAAe,CAAC;gBACtB,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACnC,uBAAC,sBAAS,IAER,SAAS,EAAE,aAAa,EACxB,YAAY,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,KACxC,IAAI,CAAC,KAAK,YAEb,mBAAmB,CAAC,IAAI,CAAC,IALrB,eAAe,CAMV,CACb,CAAC,IACA,CACP,CAAC;AACJ,CAAC;AA9GD,0CA8GC;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,EACpB,OAAO,EACP,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,KAAK,GAON;IACC,OAAO,CACL,gCACE,GAAG,EAAE,OAAO,iBACA,uBAAuB,EACnC,SAAS,EAAE,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,EAChC,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,YAEX,QAAQ,GACL,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode, RefObject } from 'react';
|
|
2
|
+
import type { ProductCardProps } from '../product-card';
|
|
3
|
+
export interface ItemSize {
|
|
4
|
+
xs?: 2 | 3 | 4;
|
|
5
|
+
s?: 2 | 3 | 4;
|
|
6
|
+
m?: 2 | 3 | 4;
|
|
7
|
+
l?: 2 | 3 | 4;
|
|
8
|
+
xl?: 2 | 3 | 4;
|
|
9
|
+
}
|
|
10
|
+
export interface ProductCarouselProps extends Pick<ProductCardProps, 'reduceBaseInfo' | 'reduceHoverInfo'> {
|
|
11
|
+
/** CSS-класс для корневого элемента. */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Элементы карусели. */
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
/** Настройки размера элемента карусели. */
|
|
16
|
+
itemSize?: ItemSize | 'unset';
|
|
17
|
+
/** Сработает при попадании карусели во viewport. */
|
|
18
|
+
onInViewport?: () => void;
|
|
19
|
+
/** Сработает при попадании карусели в область достаточно близкую к viewport'у. */
|
|
20
|
+
onNeedRequest?: () => void;
|
|
21
|
+
/** Нужно ли показывать всплывающую карточку при наведении на элемент карусели. */
|
|
22
|
+
withHoverCard?: boolean;
|
|
23
|
+
/** Предоставит свойства для элемента карусели. */
|
|
24
|
+
itemProps?: {
|
|
25
|
+
style?: CSSProperties;
|
|
26
|
+
className?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface HoverCardProps {
|
|
30
|
+
targetRef: RefObject<HTMLElement | null>;
|
|
31
|
+
onMouseLeave?: () => void;
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/desktop/components/product-carousel/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject, DependencyList } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* Возвращает объект работы с флагом, который автоматически возвращается в true через заданный промежуток времени.
|
|
4
4
|
* @return Объект работы с флагом.
|
|
5
5
|
*/
|
|
6
|
-
export declare
|
|
6
|
+
export declare function useAllowFlag(): {
|
|
7
7
|
allowed: () => boolean;
|
|
8
|
-
disallowFor: (timeout:
|
|
8
|
+
disallowFor: (timeout: number) => void;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Возвращает ширину дочернего элемента.
|
|
@@ -13,4 +13,4 @@ export declare const useAllowFlag: () => {
|
|
|
13
13
|
* @param deps Массив зависимостей от которых зависит пересчет.
|
|
14
14
|
* @return Ширина.
|
|
15
15
|
*/
|
|
16
|
-
export declare
|
|
16
|
+
export declare function useClientWidth(ref: RefObject<HTMLElement | null>, deps?: DependencyList): number | null;
|
|
@@ -6,18 +6,18 @@ const react_1 = require("react");
|
|
|
6
6
|
* Возвращает объект работы с флагом, который автоматически возвращается в true через заданный промежуток времени.
|
|
7
7
|
* @return Объект работы с флагом.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
function useAllowFlag() {
|
|
10
10
|
const ref = (0, react_1.useRef)(true);
|
|
11
11
|
const timerIdRef = (0, react_1.useRef)();
|
|
12
12
|
const allowed = (0, react_1.useCallback)(() => ref.current, []);
|
|
13
|
-
const disallowFor = (0, react_1.useCallback)(timeout => {
|
|
13
|
+
const disallowFor = (0, react_1.useCallback)((timeout) => {
|
|
14
14
|
window.clearTimeout(timerIdRef.current);
|
|
15
15
|
ref.current = false;
|
|
16
16
|
timerIdRef.current = window.setTimeout(() => (ref.current = true), timeout);
|
|
17
17
|
}, []);
|
|
18
18
|
const controlRef = (0, react_1.useRef)({ allowed, disallowFor });
|
|
19
19
|
return controlRef.current;
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
exports.useAllowFlag = useAllowFlag;
|
|
22
22
|
/**
|
|
23
23
|
* Возвращает ширину дочернего элемента.
|
|
@@ -25,7 +25,7 @@ exports.useAllowFlag = useAllowFlag;
|
|
|
25
25
|
* @param deps Массив зависимостей от которых зависит пересчет.
|
|
26
26
|
* @return Ширина.
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
function useClientWidth(ref, deps = []) {
|
|
29
29
|
const [width, setWidth] = (0, react_1.useState)(null);
|
|
30
30
|
(0, react_1.useEffect)(() => {
|
|
31
31
|
if (!ref.current) {
|
|
@@ -35,10 +35,11 @@ const useClientWidth = (ref, deps = []) => {
|
|
|
35
35
|
const observer = new ResizeObserver(() => {
|
|
36
36
|
setWidth(element.clientWidth);
|
|
37
37
|
});
|
|
38
|
-
observer.observe(
|
|
38
|
+
observer.observe(element);
|
|
39
39
|
setWidth(element.clientWidth);
|
|
40
|
-
return observer.disconnect();
|
|
40
|
+
return () => observer.disconnect();
|
|
41
41
|
}, [ref, ...deps]);
|
|
42
42
|
return width;
|
|
43
|
-
}
|
|
43
|
+
}
|
|
44
44
|
exports.useClientWidth = useClientWidth;
|
|
45
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/desktop/components/product-carousel/utils.ts"],"names":[],"mappings":";;;AAAA,iCAA4F;AAE5F;;;GAGG;AACH,SAAgB,YAAY;IAC1B,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,IAAI,CAAC,CAAC;IACzB,MAAM,UAAU,GAAG,IAAA,cAAM,GAAU,CAAC;IAEpC,MAAM,OAAO,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAEnD,MAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,CAAC,OAAe,EAAE,EAAE;QAClD,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACxC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;QACpB,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IAC9E,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,UAAU,GAAG,IAAA,cAAM,EAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;IAEpD,OAAO,UAAU,CAAC,OAAO,CAAC;AAC5B,CAAC;AAfD,oCAeC;AAED;;;;;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"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { PromotionType } from './types';
|
|
3
2
|
export interface BannerTitleProps {
|
|
4
3
|
promotionType: PromotionType;
|
|
@@ -10,7 +9,7 @@ export interface BannerTitleProps {
|
|
|
10
9
|
* @param props Свойства.
|
|
11
10
|
* @return Элемент.
|
|
12
11
|
*/
|
|
13
|
-
export declare const BannerTitle: ({ promotionType, volumeDiscount, dueDate }: BannerTitleProps) => JSX.Element;
|
|
12
|
+
export declare const BannerTitle: ({ promotionType, volumeDiscount, dueDate }: BannerTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
13
|
/**
|
|
15
14
|
* Таймер.
|
|
16
15
|
* @param props Свойства.
|
|
@@ -18,4 +17,4 @@ export declare const BannerTitle: ({ promotionType, volumeDiscount, dueDate }: B
|
|
|
18
17
|
*/
|
|
19
18
|
export declare const CustomTimer: ({ dueDate }: {
|
|
20
19
|
dueDate: Date;
|
|
21
|
-
}) => JSX.Element;
|
|
20
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CustomTimer = exports.BannerTitle = void 0;
|
|
7
|
-
const
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const timer_1 = require("@sima-land/ui-nucleons/timer");
|
|
9
9
|
const date_fns_1 = require("date-fns");
|
|
10
|
-
const
|
|
10
|
+
const banner_title_m_scss_1 = __importDefault(require("./banner-title.m.scss"));
|
|
11
11
|
/**
|
|
12
12
|
* Заголовок баннера.
|
|
13
13
|
* @param props Свойства.
|
|
@@ -21,20 +21,16 @@ const BannerTitle = ({ promotionType, volumeDiscount, dueDate }) => {
|
|
|
21
21
|
break;
|
|
22
22
|
case 'special':
|
|
23
23
|
if (dueDate) {
|
|
24
|
-
content =
|
|
24
|
+
content = (0, jsx_runtime_1.jsx)(exports.CustomTimer, { dueDate: dueDate });
|
|
25
25
|
}
|
|
26
26
|
break;
|
|
27
27
|
case 'volume-discount':
|
|
28
28
|
if (volumeDiscount) {
|
|
29
|
-
content = (
|
|
30
|
-
"\u0441\u043A\u0438\u0434\u043A\u0438 \u0434\u043E",
|
|
31
|
-
react_1.default.createElement("div", { className: banner_title_module_scss_1.default.percent },
|
|
32
|
-
volumeDiscount,
|
|
33
|
-
"%")));
|
|
29
|
+
content = ((0, jsx_runtime_1.jsxs)("div", { className: banner_title_m_scss_1.default.discount, "data-testid": 'promotion-card:banner-discount', children: ["\u0441\u043A\u0438\u0434\u043A\u0438 \u0434\u043E", (0, jsx_runtime_1.jsxs)("div", { className: banner_title_m_scss_1.default.percent, children: [volumeDiscount, "%"] })] }));
|
|
34
30
|
}
|
|
35
31
|
break;
|
|
36
32
|
}
|
|
37
|
-
return
|
|
33
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: content });
|
|
38
34
|
};
|
|
39
35
|
exports.BannerTitle = BannerTitle;
|
|
40
36
|
/**
|
|
@@ -42,23 +38,17 @@ exports.BannerTitle = BannerTitle;
|
|
|
42
38
|
* @param props Свойства.
|
|
43
39
|
* @return Элемент.
|
|
44
40
|
*/
|
|
45
|
-
const CustomTimer = ({ dueDate }) => (
|
|
46
|
-
react_1.default.createElement(TimerPart, { label: '\u0434\u043D\u0435\u0439', value: Math.min(99, days) }),
|
|
47
|
-
react_1.default.createElement(TimerDivider, null),
|
|
48
|
-
react_1.default.createElement(TimerPart, { label: '\u0447\u0430\u0441\u043E\u0432', value: hours % 24 }),
|
|
49
|
-
react_1.default.createElement(TimerDivider, null),
|
|
50
|
-
react_1.default.createElement(TimerPart, { label: '\u043C\u0438\u043D\u0443\u0442', value: minutes % 60 }))) }));
|
|
41
|
+
const CustomTimer = ({ dueDate }) => ((0, jsx_runtime_1.jsx)(timer_1.Timer, { date: (0, date_fns_1.formatISO)(dueDate), timeout: 1000 * 60, format: ({ days, hours, minutes }) => ((0, jsx_runtime_1.jsxs)("div", { className: banner_title_m_scss_1.default.timer, "data-testid": 'promotion-card:banner-timer', children: [(0, jsx_runtime_1.jsx)(TimerPart, { label: '\u0434\u043D\u0435\u0439', value: Math.min(99, days) }), (0, jsx_runtime_1.jsx)(TimerDivider, {}), (0, jsx_runtime_1.jsx)(TimerPart, { label: '\u0447\u0430\u0441\u043E\u0432', value: hours % 24 }), (0, jsx_runtime_1.jsx)(TimerDivider, {}), (0, jsx_runtime_1.jsx)(TimerPart, { label: '\u043C\u0438\u043D\u0443\u0442', value: minutes % 60 })] })) }));
|
|
51
42
|
exports.CustomTimer = CustomTimer;
|
|
52
43
|
/**
|
|
53
44
|
* Часть таймера.
|
|
54
45
|
* @param props Свойства.
|
|
55
46
|
* @return Элемент.
|
|
56
47
|
*/
|
|
57
|
-
const TimerPart = ({ label, value }) => (
|
|
58
|
-
react_1.default.createElement("div", null, `${value}`.padStart(2, '0')),
|
|
59
|
-
react_1.default.createElement("div", { className: banner_title_module_scss_1.default.label }, label)));
|
|
48
|
+
const TimerPart = ({ label, value }) => ((0, jsx_runtime_1.jsxs)("div", { className: banner_title_m_scss_1.default.part, children: [(0, jsx_runtime_1.jsx)("div", { children: `${value}`.padStart(2, '0') }), (0, jsx_runtime_1.jsx)("div", { className: banner_title_m_scss_1.default.label, children: label })] }));
|
|
60
49
|
/**
|
|
61
50
|
* Разделитель частей таймера.
|
|
62
51
|
* @return Элемент.
|
|
63
52
|
*/
|
|
64
|
-
const TimerDivider = () =>
|
|
53
|
+
const TimerDivider = () => (0, jsx_runtime_1.jsx)("div", { className: banner_title_m_scss_1.default.divider, children: ":" });
|
|
54
|
+
//# sourceMappingURL=banner-title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner-title.js","sourceRoot":"","sources":["../../../../src/desktop/components/promotion-card/banner-title.tsx"],"names":[],"mappings":";;;;;;;AAEA,wDAAqD;AACrD,uCAAqC;AACrC,gFAA2C;AAQ3C;;;;GAIG;AACI,MAAM,WAAW,GAAG,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,OAAO,EAAoB,EAAE,EAAE;IAC1F,IAAI,OAAO,GAAc,IAAI,CAAC;IAE9B,QAAQ,aAAa,EAAE,CAAC;QACtB,KAAK,QAAQ;YACX,OAAO,GAAG,OAAO,CAAC;YAClB,MAAM;QACR,KAAK,SAAS;YACZ,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,GAAG,uBAAC,mBAAW,IAAC,OAAO,EAAE,OAAO,GAAI,CAAC;YAC9C,CAAC;YACD,MAAM;QACR,KAAK,iBAAiB;YACpB,IAAI,cAAc,EAAE,CAAC;gBACnB,OAAO,GAAG,CACR,iCAAK,SAAS,EAAE,6BAAM,CAAC,QAAQ,iBAAc,gCAA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;GAGG;AACH,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,gCAAK,SAAS,EAAE,6BAAM,CAAC,OAAO,kBAAS,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export interface EstimateProps {
|
|
3
2
|
dueDate: Date;
|
|
4
3
|
}
|
|
@@ -7,4 +6,4 @@ export interface EstimateProps {
|
|
|
7
6
|
* @param props Свойства.
|
|
8
7
|
* @return Элемент.
|
|
9
8
|
*/
|
|
10
|
-
export declare const Estimate: ({ dueDate }: EstimateProps) => JSX.Element;
|
|
9
|
+
export declare const Estimate: ({ dueDate }: EstimateProps) => import("react/jsx-runtime").JSX.Element;
|