@cloud-ru/uikit-product-site-section 1.5.4 → 1.5.5-preview-0099cd8a.0
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 +1 -0
- package/dist/cjs/components/SectionLeading/SectionLeading.d.ts +2 -2
- package/dist/cjs/components/SectionLeading/SectionLeading.js +2 -2
- package/dist/esm/components/SectionLeading/SectionLeading.d.ts +2 -2
- package/dist/esm/components/SectionLeading/SectionLeading.js +2 -2
- package/package.json +2 -2
- package/src/components/SectionLeading/SectionLeading.tsx +6 -1
package/README.md
CHANGED
|
@@ -225,6 +225,7 @@
|
|
|
225
225
|
| titleSectionSize | enum Size: `"s"`, `"m"`, `"l"` | m | Размер шрифтов заголовка и подзаголовка |
|
|
226
226
|
| titleTag | enum SectionTag: `"h2"`, `"h3"`, `"h4"` | - | Тег заголовка |
|
|
227
227
|
| backgroundColor | enum SectionColor: `"neutral-background1-level"`, `"neutral-background"`, `"graphite-accent-default"` | - | Цвет фона |
|
|
228
|
+
| moreButton | `{ label?: string; href?: string; onClick: MouseEventHandler<HTMLElement>; 'data-test-id'?: string; }` | - | Кнопка внизу секции |
|
|
228
229
|
| autoSwipe | `number` | 9 | Автоматическое переключение слайдов в секундах |
|
|
229
230
|
| id | `string` | - | id секции |
|
|
230
231
|
| footerDescription | `string` | - | Описание секции |
|
|
@@ -2,7 +2,7 @@ import { WithLayoutType, WithSupportProps } from '@cloud-ru/uikit-product-utils'
|
|
|
2
2
|
import { CarouselProps } from '@snack-uikit/carousel';
|
|
3
3
|
import { CardLeadingItem } from '../../helperComponents';
|
|
4
4
|
import { SectionBasicProps } from '../SectionBasic';
|
|
5
|
-
export type SectionLeadingProps = WithSupportProps<WithLayoutType<Pick<SectionBasicProps, 'title' | 'description' | 'titleSectionSize' | 'titleTag' | 'backgroundColor'> & Pick<CarouselProps, 'autoSwipe'> & {
|
|
5
|
+
export type SectionLeadingProps = WithSupportProps<WithLayoutType<Pick<SectionBasicProps, 'title' | 'description' | 'titleSectionSize' | 'titleTag' | 'backgroundColor' | 'moreButton'> & Pick<CarouselProps, 'autoSwipe'> & {
|
|
6
6
|
/** id секции */
|
|
7
7
|
id?: string;
|
|
8
8
|
/** Массив айтемов */
|
|
@@ -12,4 +12,4 @@ export type SectionLeadingProps = WithSupportProps<WithLayoutType<Pick<SectionBa
|
|
|
12
12
|
/** CSS - класснейм */
|
|
13
13
|
className?: string;
|
|
14
14
|
}>>;
|
|
15
|
-
export declare function SectionLeading({ id, title, description, titleSectionSize, titleTag, items, footerDescription, backgroundColor, className, layoutType, autoSwipe, ...rest }: SectionLeadingProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function SectionLeading({ id, title, description, titleSectionSize, titleTag, items, footerDescription, backgroundColor, moreButton, className, layoutType, autoSwipe, ...rest }: SectionLeadingProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -27,7 +27,7 @@ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
|
27
27
|
const utils_1 = require("./utils");
|
|
28
28
|
const MOBILE_LAYOUTS = ['tablet', 'mobile'];
|
|
29
29
|
function SectionLeading(_a) {
|
|
30
|
-
var { id, title, description, titleSectionSize = 'm', titleTag, items, footerDescription, backgroundColor, className, layoutType, autoSwipe = 9 } = _a, rest = __rest(_a, ["id", "title", "description", "titleSectionSize", "titleTag", "items", "footerDescription", "backgroundColor", "className", "layoutType", "autoSwipe"]);
|
|
30
|
+
var { id, title, description, titleSectionSize = 'm', titleTag, items, footerDescription, backgroundColor, moreButton, className, layoutType, autoSwipe = 9 } = _a, rest = __rest(_a, ["id", "title", "description", "titleSectionSize", "titleTag", "items", "footerDescription", "backgroundColor", "moreButton", "className", "layoutType", "autoSwipe"]);
|
|
31
31
|
const [currentPage, setCurrentPage] = (0, react_1.useState)(0);
|
|
32
32
|
const [itemsPerPageAmount, setItemsPerPageAmount] = (0, react_1.useState)(0);
|
|
33
33
|
const wrapperRef = (0, react_1.useRef)(null);
|
|
@@ -53,5 +53,5 @@ function SectionLeading(_a) {
|
|
|
53
53
|
}
|
|
54
54
|
return items.length > itemsPerPageAmount;
|
|
55
55
|
}, [items.length, itemsPerPageAmount, layoutType]);
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)(SectionBasic_1.SectionBasic, Object.assign({ id: id, layoutType: layoutType, className: className, backgroundColor: backgroundColor, title: title, description: description, titleSectionSize: titleSectionSize, titleTag: titleTag }, (0, uikit_product_utils_1.extractSupportProps)(rest), { children: (0, jsx_runtime_1.jsxs)("div", { ref: wrapperRef, className: styles_module_scss_1.default.leadingSection, "data-layout-type": layoutType, children: [itemsPerPageAmount > 0 && ((0, jsx_runtime_1.jsx)(carousel_1.Carousel, { state: { page: currentPage, onChange: setCurrentPage }, arrows: showArrows, controlsVisibility: 'always', showItems: itemsPerPageAmount, pagination: items.length > itemsPerPageAmount, swipe: items.length > itemsPerPageAmount, autoSwipe: autoSwipe, infiniteScroll: true, gap: '2px', children: items.map(item => ((0, jsx_runtime_1.jsx)(helperComponents_1.CardLeading, Object.assign({}, item, { layoutType: layoutType, "data-test-id": item['data-test-id'] }), item.label))) })), footerDescription && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.footerDescription, "data-layout-type": layoutType, children: (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyL, { className: styles_module_scss_1.default.footerDescriptionText, children: footerDescription }) }))] }) })));
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(SectionBasic_1.SectionBasic, Object.assign({ id: id, layoutType: layoutType, className: className, backgroundColor: backgroundColor, title: title, description: description, titleSectionSize: titleSectionSize, titleTag: titleTag, moreButton: moreButton }, (0, uikit_product_utils_1.extractSupportProps)(rest), { children: (0, jsx_runtime_1.jsxs)("div", { ref: wrapperRef, className: styles_module_scss_1.default.leadingSection, "data-layout-type": layoutType, children: [itemsPerPageAmount > 0 && ((0, jsx_runtime_1.jsx)(carousel_1.Carousel, { state: { page: currentPage, onChange: setCurrentPage }, arrows: showArrows, controlsVisibility: 'always', showItems: itemsPerPageAmount, pagination: items.length > itemsPerPageAmount, swipe: items.length > itemsPerPageAmount, autoSwipe: autoSwipe, infiniteScroll: true, gap: '2px', children: items.map(item => ((0, jsx_runtime_1.jsx)(helperComponents_1.CardLeading, Object.assign({}, item, { layoutType: layoutType, "data-test-id": item['data-test-id'] }), item.label))) })), footerDescription && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.footerDescription, "data-layout-type": layoutType, children: (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyL, { className: styles_module_scss_1.default.footerDescriptionText, children: footerDescription }) }))] }) })));
|
|
57
57
|
}
|
|
@@ -2,7 +2,7 @@ import { WithLayoutType, WithSupportProps } from '@cloud-ru/uikit-product-utils'
|
|
|
2
2
|
import { CarouselProps } from '@snack-uikit/carousel';
|
|
3
3
|
import { CardLeadingItem } from '../../helperComponents';
|
|
4
4
|
import { SectionBasicProps } from '../SectionBasic';
|
|
5
|
-
export type SectionLeadingProps = WithSupportProps<WithLayoutType<Pick<SectionBasicProps, 'title' | 'description' | 'titleSectionSize' | 'titleTag' | 'backgroundColor'> & Pick<CarouselProps, 'autoSwipe'> & {
|
|
5
|
+
export type SectionLeadingProps = WithSupportProps<WithLayoutType<Pick<SectionBasicProps, 'title' | 'description' | 'titleSectionSize' | 'titleTag' | 'backgroundColor' | 'moreButton'> & Pick<CarouselProps, 'autoSwipe'> & {
|
|
6
6
|
/** id секции */
|
|
7
7
|
id?: string;
|
|
8
8
|
/** Массив айтемов */
|
|
@@ -12,4 +12,4 @@ export type SectionLeadingProps = WithSupportProps<WithLayoutType<Pick<SectionBa
|
|
|
12
12
|
/** CSS - класснейм */
|
|
13
13
|
className?: string;
|
|
14
14
|
}>>;
|
|
15
|
-
export declare function SectionLeading({ id, title, description, titleSectionSize, titleTag, items, footerDescription, backgroundColor, className, layoutType, autoSwipe, ...rest }: SectionLeadingProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function SectionLeading({ id, title, description, titleSectionSize, titleTag, items, footerDescription, backgroundColor, moreButton, className, layoutType, autoSwipe, ...rest }: SectionLeadingProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -21,7 +21,7 @@ import styles from './styles.module.css';
|
|
|
21
21
|
import { calculateAmountOfItemsPerPage } from './utils';
|
|
22
22
|
const MOBILE_LAYOUTS = ['tablet', 'mobile'];
|
|
23
23
|
export function SectionLeading(_a) {
|
|
24
|
-
var { id, title, description, titleSectionSize = 'm', titleTag, items, footerDescription, backgroundColor, className, layoutType, autoSwipe = 9 } = _a, rest = __rest(_a, ["id", "title", "description", "titleSectionSize", "titleTag", "items", "footerDescription", "backgroundColor", "className", "layoutType", "autoSwipe"]);
|
|
24
|
+
var { id, title, description, titleSectionSize = 'm', titleTag, items, footerDescription, backgroundColor, moreButton, className, layoutType, autoSwipe = 9 } = _a, rest = __rest(_a, ["id", "title", "description", "titleSectionSize", "titleTag", "items", "footerDescription", "backgroundColor", "moreButton", "className", "layoutType", "autoSwipe"]);
|
|
25
25
|
const [currentPage, setCurrentPage] = useState(0);
|
|
26
26
|
const [itemsPerPageAmount, setItemsPerPageAmount] = useState(0);
|
|
27
27
|
const wrapperRef = useRef(null);
|
|
@@ -47,5 +47,5 @@ export function SectionLeading(_a) {
|
|
|
47
47
|
}
|
|
48
48
|
return items.length > itemsPerPageAmount;
|
|
49
49
|
}, [items.length, itemsPerPageAmount, layoutType]);
|
|
50
|
-
return (_jsx(SectionBasic, Object.assign({ id: id, layoutType: layoutType, className: className, backgroundColor: backgroundColor, title: title, description: description, titleSectionSize: titleSectionSize, titleTag: titleTag }, extractSupportProps(rest), { children: _jsxs("div", { ref: wrapperRef, className: styles.leadingSection, "data-layout-type": layoutType, children: [itemsPerPageAmount > 0 && (_jsx(Carousel, { state: { page: currentPage, onChange: setCurrentPage }, arrows: showArrows, controlsVisibility: 'always', showItems: itemsPerPageAmount, pagination: items.length > itemsPerPageAmount, swipe: items.length > itemsPerPageAmount, autoSwipe: autoSwipe, infiniteScroll: true, gap: '2px', children: items.map(item => (_jsx(CardLeading, Object.assign({}, item, { layoutType: layoutType, "data-test-id": item['data-test-id'] }), item.label))) })), footerDescription && (_jsx("div", { className: styles.footerDescription, "data-layout-type": layoutType, children: _jsx(Typography.SansBodyL, { className: styles.footerDescriptionText, children: footerDescription }) }))] }) })));
|
|
50
|
+
return (_jsx(SectionBasic, Object.assign({ id: id, layoutType: layoutType, className: className, backgroundColor: backgroundColor, title: title, description: description, titleSectionSize: titleSectionSize, titleTag: titleTag, moreButton: moreButton }, extractSupportProps(rest), { children: _jsxs("div", { ref: wrapperRef, className: styles.leadingSection, "data-layout-type": layoutType, children: [itemsPerPageAmount > 0 && (_jsx(Carousel, { state: { page: currentPage, onChange: setCurrentPage }, arrows: showArrows, controlsVisibility: 'always', showItems: itemsPerPageAmount, pagination: items.length > itemsPerPageAmount, swipe: items.length > itemsPerPageAmount, autoSwipe: autoSwipe, infiniteScroll: true, gap: '2px', children: items.map(item => (_jsx(CardLeading, Object.assign({}, item, { layoutType: layoutType, "data-test-id": item['data-test-id'] }), item.label))) })), footerDescription && (_jsx("div", { className: styles.footerDescription, "data-layout-type": layoutType, children: _jsx(Typography.SansBodyL, { className: styles.footerDescriptionText, children: footerDescription }) }))] }) })));
|
|
51
51
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/uikit-product-site-section",
|
|
3
3
|
"title": "Site Section",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.5-preview-0099cd8a.0",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css",
|
|
7
7
|
"*.woff",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"@cloud-ru/uikit-product-locale": "*",
|
|
68
68
|
"@snack-uikit/figma-tokens": "*"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "10786e92abb77f1b3033e3d79f5df81afc5551e1"
|
|
71
71
|
}
|
|
@@ -12,7 +12,10 @@ import { calculateAmountOfItemsPerPage } from './utils';
|
|
|
12
12
|
|
|
13
13
|
export type SectionLeadingProps = WithSupportProps<
|
|
14
14
|
WithLayoutType<
|
|
15
|
-
Pick<
|
|
15
|
+
Pick<
|
|
16
|
+
SectionBasicProps,
|
|
17
|
+
'title' | 'description' | 'titleSectionSize' | 'titleTag' | 'backgroundColor' | 'moreButton'
|
|
18
|
+
> &
|
|
16
19
|
Pick<CarouselProps, 'autoSwipe'> & {
|
|
17
20
|
/** id секции */
|
|
18
21
|
id?: string;
|
|
@@ -37,6 +40,7 @@ export function SectionLeading({
|
|
|
37
40
|
items,
|
|
38
41
|
footerDescription,
|
|
39
42
|
backgroundColor,
|
|
43
|
+
moreButton,
|
|
40
44
|
className,
|
|
41
45
|
layoutType,
|
|
42
46
|
autoSwipe = 9,
|
|
@@ -85,6 +89,7 @@ export function SectionLeading({
|
|
|
85
89
|
description={description}
|
|
86
90
|
titleSectionSize={titleSectionSize}
|
|
87
91
|
titleTag={titleTag}
|
|
92
|
+
moreButton={moreButton}
|
|
88
93
|
{...extractSupportProps(rest)}
|
|
89
94
|
>
|
|
90
95
|
<div ref={wrapperRef} className={styles.leadingSection} data-layout-type={layoutType}>
|