@salutejs/plasma-new-hope 0.321.1-canary.1945.14661970912.0 → 0.321.1-canary.1946.14663041744.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/cjs/index.css +0 -7
- package/cjs/index.js +0 -7
- package/cjs/index.js.map +1 -1
- package/emotion/cjs/index.js +0 -11
- package/emotion/es/index.js +1 -2
- package/es/index.css +0 -7
- package/es/index.js +0 -3
- package/es/index.js.map +1 -1
- package/package.json +4 -4
- package/styled-components/cjs/index.js +0 -11
- package/styled-components/es/index.js +1 -2
- package/types/index.d.ts +0 -1
- package/types/index.d.ts.map +1 -1
- package/cjs/components/Carousel/Carousel.css +0 -4
- package/cjs/components/Carousel/Carousel.js +0 -80
- package/cjs/components/Carousel/Carousel.js.map +0 -1
- package/cjs/components/Carousel/Carousel.styles.js +0 -67
- package/cjs/components/Carousel/Carousel.styles.js.map +0 -1
- package/cjs/components/Carousel/Carousel.styles_1lyqijv.css +0 -4
- package/cjs/components/Carousel/CarouselItem.js +0 -53
- package/cjs/components/Carousel/CarouselItem.js.map +0 -1
- package/cjs/components/Carousel/CarouselItem_cqjszm.css +0 -1
- package/cjs/components/Carousel/useCarousel.js +0 -487
- package/cjs/components/Carousel/useCarousel.js.map +0 -1
- package/cjs/components/Carousel/useDragScroll.js +0 -62
- package/cjs/components/Carousel/useDragScroll.js.map +0 -1
- package/emotion/cjs/components/Carousel/Carousel.js +0 -77
- package/emotion/cjs/components/Carousel/Carousel.styles.js +0 -49
- package/emotion/cjs/components/Carousel/Carousel.types.js +0 -5
- package/emotion/cjs/components/Carousel/CarouselItem.js +0 -38
- package/emotion/cjs/components/Carousel/index.js +0 -32
- package/emotion/cjs/components/Carousel/useCarousel.js +0 -478
- package/emotion/cjs/components/Carousel/useDragScroll.js +0 -65
- package/emotion/cjs/examples/plasma_b2c/components/Carousel/Carousel.config.js +0 -10
- package/emotion/cjs/examples/plasma_b2c/components/Carousel/Carousel.js +0 -18
- package/emotion/cjs/examples/plasma_b2c/components/Carousel/Carousel.stories.tsx +0 -80
- package/emotion/cjs/examples/plasma_web/components/Carousel/Carousel.config.js +0 -10
- package/emotion/cjs/examples/plasma_web/components/Carousel/Carousel.js +0 -18
- package/emotion/cjs/examples/plasma_web/components/Carousel/Carousel.stories.tsx +0 -80
- package/emotion/es/components/Carousel/Carousel.js +0 -69
- package/emotion/es/components/Carousel/Carousel.styles.js +0 -42
- package/emotion/es/components/Carousel/Carousel.types.js +0 -1
- package/emotion/es/components/Carousel/CarouselItem.js +0 -31
- package/emotion/es/components/Carousel/index.js +0 -3
- package/emotion/es/components/Carousel/useCarousel.js +0 -468
- package/emotion/es/components/Carousel/useDragScroll.js +0 -59
- package/emotion/es/examples/plasma_b2c/components/Carousel/Carousel.config.js +0 -4
- package/emotion/es/examples/plasma_b2c/components/Carousel/Carousel.js +0 -6
- package/emotion/es/examples/plasma_b2c/components/Carousel/Carousel.stories.tsx +0 -80
- package/emotion/es/examples/plasma_web/components/Carousel/Carousel.config.js +0 -4
- package/emotion/es/examples/plasma_web/components/Carousel/Carousel.js +0 -6
- package/emotion/es/examples/plasma_web/components/Carousel/Carousel.stories.tsx +0 -80
- package/es/components/Carousel/Carousel.css +0 -4
- package/es/components/Carousel/Carousel.js +0 -71
- package/es/components/Carousel/Carousel.js.map +0 -1
- package/es/components/Carousel/Carousel.styles.js +0 -60
- package/es/components/Carousel/Carousel.styles.js.map +0 -1
- package/es/components/Carousel/Carousel.styles_1lyqijv.css +0 -4
- package/es/components/Carousel/CarouselItem.js +0 -45
- package/es/components/Carousel/CarouselItem.js.map +0 -1
- package/es/components/Carousel/CarouselItem_cqjszm.css +0 -1
- package/es/components/Carousel/useCarousel.js +0 -472
- package/es/components/Carousel/useCarousel.js.map +0 -1
- package/es/components/Carousel/useDragScroll.js +0 -58
- package/es/components/Carousel/useDragScroll.js.map +0 -1
- package/styled-components/cjs/components/Carousel/Carousel.js +0 -77
- package/styled-components/cjs/components/Carousel/Carousel.styles.js +0 -38
- package/styled-components/cjs/components/Carousel/Carousel.types.js +0 -5
- package/styled-components/cjs/components/Carousel/CarouselItem.js +0 -37
- package/styled-components/cjs/components/Carousel/index.js +0 -32
- package/styled-components/cjs/components/Carousel/useCarousel.js +0 -478
- package/styled-components/cjs/components/Carousel/useDragScroll.js +0 -65
- package/styled-components/cjs/examples/plasma_b2c/components/Carousel/Carousel.config.js +0 -10
- package/styled-components/cjs/examples/plasma_b2c/components/Carousel/Carousel.js +0 -18
- package/styled-components/cjs/examples/plasma_b2c/components/Carousel/Carousel.stories.tsx +0 -80
- package/styled-components/cjs/examples/plasma_web/components/Carousel/Carousel.config.js +0 -10
- package/styled-components/cjs/examples/plasma_web/components/Carousel/Carousel.js +0 -18
- package/styled-components/cjs/examples/plasma_web/components/Carousel/Carousel.stories.tsx +0 -80
- package/styled-components/es/components/Carousel/Carousel.js +0 -69
- package/styled-components/es/components/Carousel/Carousel.styles.js +0 -30
- package/styled-components/es/components/Carousel/Carousel.types.js +0 -1
- package/styled-components/es/components/Carousel/CarouselItem.js +0 -30
- package/styled-components/es/components/Carousel/index.js +0 -3
- package/styled-components/es/components/Carousel/useCarousel.js +0 -468
- package/styled-components/es/components/Carousel/useDragScroll.js +0 -59
- package/styled-components/es/examples/plasma_b2c/components/Carousel/Carousel.config.js +0 -4
- package/styled-components/es/examples/plasma_b2c/components/Carousel/Carousel.js +0 -6
- package/styled-components/es/examples/plasma_b2c/components/Carousel/Carousel.stories.tsx +0 -80
- package/styled-components/es/examples/plasma_web/components/Carousel/Carousel.config.js +0 -4
- package/styled-components/es/examples/plasma_web/components/Carousel/Carousel.js +0 -6
- package/styled-components/es/examples/plasma_web/components/Carousel/Carousel.stories.tsx +0 -80
- package/types/components/Carousel/Carousel.d.ts +0 -22
- package/types/components/Carousel/Carousel.d.ts.map +0 -1
- package/types/components/Carousel/Carousel.styles.d.ts +0 -16
- package/types/components/Carousel/Carousel.styles.d.ts.map +0 -1
- package/types/components/Carousel/Carousel.types.d.ts +0 -111
- package/types/components/Carousel/Carousel.types.d.ts.map +0 -1
- package/types/components/Carousel/CarouselItem.d.ts +0 -4
- package/types/components/Carousel/CarouselItem.d.ts.map +0 -1
- package/types/components/Carousel/index.d.ts +0 -5
- package/types/components/Carousel/index.d.ts.map +0 -1
- package/types/components/Carousel/useCarousel.d.ts +0 -63
- package/types/components/Carousel/useCarousel.d.ts.map +0 -1
- package/types/components/Carousel/useDragScroll.d.ts +0 -3
- package/types/components/Carousel/useDragScroll.d.ts.map +0 -1
@@ -1,65 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.useDragScroll = void 0;
|
7
|
-
var _react = /*#__PURE__*/require("react");
|
8
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
9
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
10
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
11
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
12
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
13
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
14
|
-
var SCROLL_SPEED = 2;
|
15
|
-
var useDragScroll = exports.useDragScroll = function useDragScroll(scrollRef, isDragScrollDisabled) {
|
16
|
-
var _useState = (0, _react.useState)(false),
|
17
|
-
_useState2 = _slicedToArray(_useState, 2),
|
18
|
-
isDragging = _useState2[0],
|
19
|
-
setDragging = _useState2[1];
|
20
|
-
var _useState3 = (0, _react.useState)(0),
|
21
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
22
|
-
startX = _useState4[0],
|
23
|
-
setStartX = _useState4[1];
|
24
|
-
var _useState5 = (0, _react.useState)(0),
|
25
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
26
|
-
scrollLeft = _useState6[0],
|
27
|
-
setScrollLeft = _useState6[1];
|
28
|
-
var handleMouseMove = (0, _react.useCallback)(function (e) {
|
29
|
-
if (isDragging && scrollRef && scrollRef.current) {
|
30
|
-
var dx = (e.clientX - startX) * SCROLL_SPEED;
|
31
|
-
scrollRef.current.scrollLeft = scrollLeft - dx;
|
32
|
-
}
|
33
|
-
}, [scrollRef, scrollLeft, isDragging, startX]);
|
34
|
-
var handleMouseUp = (0, _react.useCallback)(function () {
|
35
|
-
setDragging(false);
|
36
|
-
if (scrollRef && scrollRef.current) {
|
37
|
-
scrollRef.current.style.cursor = 'grab';
|
38
|
-
}
|
39
|
-
}, [scrollRef, setDragging]);
|
40
|
-
var handleMouseDown = (0, _react.useCallback)(function (e) {
|
41
|
-
setDragging(true);
|
42
|
-
if (scrollRef && scrollRef.current) {
|
43
|
-
setStartX(e.clientX);
|
44
|
-
setScrollLeft(scrollRef.current.scrollLeft);
|
45
|
-
scrollRef.current.style.cursor = 'grabbing';
|
46
|
-
}
|
47
|
-
}, [scrollRef, setDragging, setStartX, setScrollLeft, handleMouseUp, handleMouseMove]);
|
48
|
-
(0, _react.useEffect)(function () {
|
49
|
-
if (scrollRef && scrollRef.current && !isDragScrollDisabled) {
|
50
|
-
scrollRef.current.style.userSelect = 'none';
|
51
|
-
scrollRef.current.addEventListener('mousedown', handleMouseDown);
|
52
|
-
scrollRef.current.addEventListener('mouseup', handleMouseUp);
|
53
|
-
scrollRef.current.addEventListener('mouseleave', handleMouseUp);
|
54
|
-
scrollRef.current.addEventListener('mousemove', handleMouseMove);
|
55
|
-
}
|
56
|
-
return function () {
|
57
|
-
if (scrollRef && scrollRef.current && !isDragScrollDisabled) {
|
58
|
-
scrollRef.current.removeEventListener('mousedown', handleMouseDown);
|
59
|
-
scrollRef.current.removeEventListener('mouseup', handleMouseUp);
|
60
|
-
scrollRef.current.removeEventListener('mouseleave', handleMouseUp);
|
61
|
-
scrollRef.current.removeEventListener('mousemove', handleMouseMove);
|
62
|
-
}
|
63
|
-
};
|
64
|
-
}, [scrollRef, handleMouseDown, handleMouseUp, handleMouseMove, isDragScrollDisabled]);
|
65
|
-
};
|
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Carousel = void 0;
|
7
|
-
Object.defineProperty(exports, "CarouselItem", {
|
8
|
-
enumerable: true,
|
9
|
-
get: function get() {
|
10
|
-
return _Carousel.CarouselItem;
|
11
|
-
}
|
12
|
-
});
|
13
|
-
exports.mergedConfig = void 0;
|
14
|
-
var _Carousel = /*#__PURE__*/require("../../../../components/Carousel");
|
15
|
-
var _engines = /*#__PURE__*/require("../../../../engines");
|
16
|
-
var _Carousel2 = /*#__PURE__*/require("./Carousel.config");
|
17
|
-
var mergedConfig = exports.mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Carousel.carouselConfig, _Carousel2.config);
|
18
|
-
var Carousel = exports.Carousel = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|
@@ -1,80 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import type { ComponentProps } from 'react';
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
4
|
-
import styled from 'styled-components';
|
5
|
-
|
6
|
-
import { WithTheme } from '../../../_helpers';
|
7
|
-
|
8
|
-
import { Carousel, CarouselItem } from './Carousel';
|
9
|
-
|
10
|
-
type StoryCarouselProps = ComponentProps<typeof Carousel>;
|
11
|
-
|
12
|
-
const meta: Meta<StoryCarouselProps> = {
|
13
|
-
title: 'b2c/Data Display/Carousel',
|
14
|
-
component: Carousel,
|
15
|
-
decorators: [WithTheme],
|
16
|
-
argTypes: {
|
17
|
-
align: {
|
18
|
-
options: ['center', 'start', 'end'],
|
19
|
-
control: {
|
20
|
-
type: 'inline-radio',
|
21
|
-
},
|
22
|
-
},
|
23
|
-
isDragScrollDisabled: {
|
24
|
-
control: 'boolean',
|
25
|
-
},
|
26
|
-
},
|
27
|
-
args: {
|
28
|
-
align: 'center',
|
29
|
-
isDragScrollDisabled: false,
|
30
|
-
},
|
31
|
-
parameters: {
|
32
|
-
controls: {
|
33
|
-
include: ['align', 'isDragScrollDisabled'],
|
34
|
-
},
|
35
|
-
},
|
36
|
-
};
|
37
|
-
|
38
|
-
export default meta;
|
39
|
-
|
40
|
-
const items = Array(25)
|
41
|
-
.fill({
|
42
|
-
title: 'Заголовок',
|
43
|
-
})
|
44
|
-
.map(({ title }, i) => ({
|
45
|
-
id: i,
|
46
|
-
title: `${title} ${i}`,
|
47
|
-
}));
|
48
|
-
|
49
|
-
const StyledCard = styled.div`
|
50
|
-
position: relative;
|
51
|
-
border-radius: 8px;
|
52
|
-
width: 350px;
|
53
|
-
height: 50px;
|
54
|
-
padding: 8px;
|
55
|
-
background-color: #add8e6;
|
56
|
-
`;
|
57
|
-
|
58
|
-
const StoryDefault = ({ align, isDragScrollDisabled }: StoryCarouselProps) => {
|
59
|
-
const [index, setIndex] = React.useState(0);
|
60
|
-
|
61
|
-
return (
|
62
|
-
<Carousel
|
63
|
-
index={index}
|
64
|
-
detectActive
|
65
|
-
onIndexChange={setIndex}
|
66
|
-
scrollAlign={align}
|
67
|
-
isDragScrollDisabled={isDragScrollDisabled}
|
68
|
-
>
|
69
|
-
{items.map((item, i) => (
|
70
|
-
<CarouselItem key={i} style={{ padding: '0 0.5rem' }} scrollSnapAlign={align}>
|
71
|
-
<StyledCard>{item.title}</StyledCard>
|
72
|
-
</CarouselItem>
|
73
|
-
))}
|
74
|
-
</Carousel>
|
75
|
-
);
|
76
|
-
};
|
77
|
-
|
78
|
-
export const Default: StoryObj<StoryCarouselProps> = {
|
79
|
-
render: (args) => <StoryDefault {...args} />,
|
80
|
-
};
|
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Carousel = void 0;
|
7
|
-
Object.defineProperty(exports, "CarouselItem", {
|
8
|
-
enumerable: true,
|
9
|
-
get: function get() {
|
10
|
-
return _Carousel.CarouselItem;
|
11
|
-
}
|
12
|
-
});
|
13
|
-
exports.mergedConfig = void 0;
|
14
|
-
var _Carousel = /*#__PURE__*/require("../../../../components/Carousel");
|
15
|
-
var _engines = /*#__PURE__*/require("../../../../engines");
|
16
|
-
var _Carousel2 = /*#__PURE__*/require("./Carousel.config");
|
17
|
-
var mergedConfig = exports.mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Carousel.carouselConfig, _Carousel2.config);
|
18
|
-
var Carousel = exports.Carousel = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|
@@ -1,80 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import type { ComponentProps } from 'react';
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
4
|
-
import styled from 'styled-components';
|
5
|
-
|
6
|
-
import { WithTheme } from '../../../_helpers';
|
7
|
-
|
8
|
-
import { Carousel, CarouselItem } from './Carousel';
|
9
|
-
|
10
|
-
type StoryCarouselProps = ComponentProps<typeof Carousel>;
|
11
|
-
|
12
|
-
const meta: Meta<StoryCarouselProps> = {
|
13
|
-
title: 'web/Data Display/Carousel',
|
14
|
-
component: Carousel,
|
15
|
-
decorators: [WithTheme],
|
16
|
-
argTypes: {
|
17
|
-
align: {
|
18
|
-
options: ['center', 'start', 'end'],
|
19
|
-
control: {
|
20
|
-
type: 'inline-radio',
|
21
|
-
},
|
22
|
-
},
|
23
|
-
isDragScrollDisabled: {
|
24
|
-
control: 'boolean',
|
25
|
-
},
|
26
|
-
},
|
27
|
-
args: {
|
28
|
-
align: 'center',
|
29
|
-
isDragScrollDisabled: false,
|
30
|
-
},
|
31
|
-
parameters: {
|
32
|
-
controls: {
|
33
|
-
include: ['align', 'isDragScrollDisabled'],
|
34
|
-
},
|
35
|
-
},
|
36
|
-
};
|
37
|
-
|
38
|
-
export default meta;
|
39
|
-
|
40
|
-
const items = Array(25)
|
41
|
-
.fill({
|
42
|
-
title: 'Заголовок',
|
43
|
-
})
|
44
|
-
.map(({ title }, i) => ({
|
45
|
-
id: i,
|
46
|
-
title: `${title} ${i}`,
|
47
|
-
}));
|
48
|
-
|
49
|
-
const StyledCard = styled.div`
|
50
|
-
position: relative;
|
51
|
-
border-radius: 8px;
|
52
|
-
width: 350px;
|
53
|
-
height: 50px;
|
54
|
-
padding: 8px;
|
55
|
-
background-color: #add8e6;
|
56
|
-
`;
|
57
|
-
|
58
|
-
const StoryDefault = ({ align, isDragScrollDisabled }: StoryCarouselProps) => {
|
59
|
-
const [index, setIndex] = React.useState(0);
|
60
|
-
|
61
|
-
return (
|
62
|
-
<Carousel
|
63
|
-
index={index}
|
64
|
-
detectActive
|
65
|
-
onIndexChange={setIndex}
|
66
|
-
scrollAlign={align}
|
67
|
-
isDragScrollDisabled={isDragScrollDisabled}
|
68
|
-
>
|
69
|
-
{items.map((item, i) => (
|
70
|
-
<CarouselItem key={i} style={{ padding: '0 0.5rem' }} scrollSnapAlign={align}>
|
71
|
-
<StyledCard>{item.title}</StyledCard>
|
72
|
-
</CarouselItem>
|
73
|
-
))}
|
74
|
-
</Carousel>
|
75
|
-
);
|
76
|
-
};
|
77
|
-
|
78
|
-
export const Default: StoryObj<StoryCarouselProps> = {
|
79
|
-
render: (args) => <StoryDefault {...args} />,
|
80
|
-
};
|
@@ -1,69 +0,0 @@
|
|
1
|
-
var _excluded = ["index", "scrollSnapType", "scrollAlign", "detectActive", "detectThreshold", "scaleCallback", "scaleResetCallback", "onIndexChange", "paddingStart", "paddingEnd", "children", "ariaLive", "isDragScrollDisabled"];
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
3
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
4
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
5
|
-
import React, { forwardRef } from 'react';
|
6
|
-
import { useForkRef } from '@salutejs/plasma-core';
|
7
|
-
import { base, CarouselWrapper, CarouselTrack } from "./Carousel.styles";
|
8
|
-
import { useCarousel } from "./useCarousel";
|
9
|
-
import { useDragScroll } from "./useDragScroll";
|
10
|
-
|
11
|
-
/**
|
12
|
-
* Компонент для создания списков с прокруткой.
|
13
|
-
*/
|
14
|
-
export var carouselRoot = function carouselRoot(Root) {
|
15
|
-
return /*#__PURE__*/forwardRef(function (_ref, ref) {
|
16
|
-
var _ref$index = _ref.index,
|
17
|
-
index = _ref$index === void 0 ? 0 : _ref$index,
|
18
|
-
_ref$scrollSnapType = _ref.scrollSnapType,
|
19
|
-
scrollSnapType = _ref$scrollSnapType === void 0 ? 'mandatory' : _ref$scrollSnapType,
|
20
|
-
scrollAlign = _ref.scrollAlign,
|
21
|
-
detectActive = _ref.detectActive,
|
22
|
-
detectThreshold = _ref.detectThreshold,
|
23
|
-
scaleCallback = _ref.scaleCallback,
|
24
|
-
scaleResetCallback = _ref.scaleResetCallback,
|
25
|
-
onIndexChange = _ref.onIndexChange,
|
26
|
-
paddingStart = _ref.paddingStart,
|
27
|
-
paddingEnd = _ref.paddingEnd,
|
28
|
-
children = _ref.children,
|
29
|
-
_ref$ariaLive = _ref.ariaLive,
|
30
|
-
ariaLive = _ref$ariaLive === void 0 ? 'off' : _ref$ariaLive,
|
31
|
-
_ref$isDragScrollDisa = _ref.isDragScrollDisabled,
|
32
|
-
isDragScrollDisabled = _ref$isDragScrollDisa === void 0 ? false : _ref$isDragScrollDisa,
|
33
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
34
|
-
var axis = 'x';
|
35
|
-
var _useCarousel = useCarousel({
|
36
|
-
index: index,
|
37
|
-
axis: axis,
|
38
|
-
scrollAlign: scrollAlign,
|
39
|
-
detectActive: detectActive,
|
40
|
-
detectThreshold: detectThreshold,
|
41
|
-
scaleCallback: scaleCallback,
|
42
|
-
scaleResetCallback: scaleResetCallback,
|
43
|
-
onIndexChange: onIndexChange
|
44
|
-
}),
|
45
|
-
scrollRef = _useCarousel.scrollRef,
|
46
|
-
trackRef = _useCarousel.trackRef;
|
47
|
-
var handleRef = useForkRef(scrollRef, ref);
|
48
|
-
useDragScroll(scrollRef, isDragScrollDisabled);
|
49
|
-
return /*#__PURE__*/React.createElement(Root, {
|
50
|
-
index: index
|
51
|
-
}, /*#__PURE__*/React.createElement(CarouselWrapper, _extends({
|
52
|
-
ref: handleRef,
|
53
|
-
scrollSnapType: scrollSnapType
|
54
|
-
}, rest), /*#__PURE__*/React.createElement(CarouselTrack, {
|
55
|
-
ref: trackRef,
|
56
|
-
paddingStart: paddingStart,
|
57
|
-
paddingEnd: paddingEnd,
|
58
|
-
"aria-live": ariaLive
|
59
|
-
}, children)));
|
60
|
-
});
|
61
|
-
};
|
62
|
-
export var carouselConfig = {
|
63
|
-
name: 'Carousel',
|
64
|
-
tag: 'div',
|
65
|
-
layout: carouselRoot,
|
66
|
-
base: base,
|
67
|
-
variations: {},
|
68
|
-
defaults: {}
|
69
|
-
};
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import styled from 'styled-components';
|
2
|
-
import { css } from 'styled-components';
|
3
|
-
export var base = /*#__PURE__*/css([""]);
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Компонент применяется, если требуется компенсировать отступы контейнера в сетке.
|
7
|
-
* При обертывании вокруг ``Carousel``, добавляет карусели и ее прокрутке дополнительные отступы.
|
8
|
-
* Стилизованный компонент, обладающий всеми свойствами ``div``.
|
9
|
-
*/
|
10
|
-
export var CarouselGridWrapper = /*#__PURE__*/styled.div.withConfig({
|
11
|
-
componentId: "plasma-new-hope__sc-9g0yg0-0"
|
12
|
-
})(["overflow:hidden;margin-left:calc(var(--plasma-grid-margin) * -1);margin-right:calc(var(--plasma-grid-margin) * -1);"]);
|
13
|
-
export var CarouselWrapper = /*#__PURE__*/styled.div.withConfig({
|
14
|
-
componentId: "plasma-new-hope__sc-9g0yg0-1"
|
15
|
-
})(["position:relative;margin:0;padding:0;list-style:none;::-webkit-scrollbar{display:none;}overflow-x:auto;overflow-y:hidden;scroll-behavior:smooth;scroll-snap-type:", ";", " &{scroll-padding:0 var(--plasma-grid-margin);padding-left:var(--plasma-grid-margin);}user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);"], function (_ref) {
|
16
|
-
var scrollSnapType = _ref.scrollSnapType;
|
17
|
-
return "x ".concat(scrollSnapType);
|
18
|
-
}, CarouselGridWrapper);
|
19
|
-
export var CarouselTrack = /*#__PURE__*/styled.div.withConfig({
|
20
|
-
componentId: "plasma-new-hope__sc-9g0yg0-2"
|
21
|
-
})(["display:inline-flex;flex-direction:row;padding-left:", ";padding-right:", ";", " &{padding-right:", ";}"], function (_ref2) {
|
22
|
-
var paddingStart = _ref2.paddingStart;
|
23
|
-
return paddingStart || 0;
|
24
|
-
}, function (_ref3) {
|
25
|
-
var paddingEnd = _ref3.paddingEnd;
|
26
|
-
return paddingEnd || 0;
|
27
|
-
}, CarouselGridWrapper, function (_ref4) {
|
28
|
-
var paddingEnd = _ref4.paddingEnd;
|
29
|
-
return paddingEnd || 'var(--plasma-grid-margin)';
|
30
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,30 +0,0 @@
|
|
1
|
-
var _excluded = ["scrollSnapAlign", "scrollSnapStop", "children"];
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
3
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
4
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
5
|
-
import React from 'react';
|
6
|
-
import styled from 'styled-components';
|
7
|
-
var StyledItem = /*#__PURE__*/styled.div.withConfig({
|
8
|
-
componentId: "plasma-new-hope__sc-1h5d6du-0"
|
9
|
-
})(["scroll-snap-align:", ";scroll-snap-stop:", ";"], function (_ref) {
|
10
|
-
var scrollSnapAlign = _ref.scrollSnapAlign;
|
11
|
-
return scrollSnapAlign || 'none';
|
12
|
-
}, function (_ref2) {
|
13
|
-
var scrollSnapAlign = _ref2.scrollSnapAlign,
|
14
|
-
scrollSnapStop = _ref2.scrollSnapStop;
|
15
|
-
return scrollSnapAlign ? scrollSnapStop : 'normal';
|
16
|
-
});
|
17
|
-
export var CarouselItem = function CarouselItem(_ref3) {
|
18
|
-
var _ref3$scrollSnapAlign = _ref3.scrollSnapAlign,
|
19
|
-
scrollSnapAlign = _ref3$scrollSnapAlign === void 0 ? 'center' : _ref3$scrollSnapAlign,
|
20
|
-
_ref3$scrollSnapStop = _ref3.scrollSnapStop,
|
21
|
-
scrollSnapStop = _ref3$scrollSnapStop === void 0 ? 'always' : _ref3$scrollSnapStop,
|
22
|
-
children = _ref3.children,
|
23
|
-
rest = _objectWithoutProperties(_ref3, _excluded);
|
24
|
-
return /*#__PURE__*/React.createElement(StyledItem, _extends({
|
25
|
-
scrollSnapAlign: scrollSnapAlign,
|
26
|
-
scrollSnapStop: scrollSnapStop,
|
27
|
-
role: "group",
|
28
|
-
"aria-roledescription": "slide"
|
29
|
-
}, rest), children);
|
30
|
-
};
|