@snack-uikit/carousel 0.2.21-preview-d46fe148.0 → 0.2.21-preview-1f246c4a.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.
Files changed (48) hide show
  1. package/dist/cjs/components/Carousel/Carousel.js +104 -0
  2. package/dist/cjs/components/Carousel/index.js +25 -0
  3. package/dist/cjs/components/Control/Control.js +45 -0
  4. package/dist/cjs/components/Control/index.js +25 -0
  5. package/dist/{components → cjs/components}/ItemProvider/ItemProvider.d.ts +1 -2
  6. package/dist/cjs/components/ItemProvider/ItemProvider.js +177 -0
  7. package/dist/cjs/components/ItemProvider/helpers.js +14 -0
  8. package/dist/cjs/components/ItemProvider/index.js +25 -0
  9. package/dist/cjs/components/index.js +25 -0
  10. package/dist/cjs/index.js +25 -0
  11. package/dist/cjs/testIds.js +13 -0
  12. package/dist/esm/components/Carousel/Carousel.d.ts +32 -0
  13. package/dist/{components → esm/components}/Carousel/Carousel.js +1 -1
  14. package/dist/esm/components/Control/Control.d.ts +6 -0
  15. package/dist/{components → esm/components}/Control/Control.js +3 -1
  16. package/dist/esm/components/Control/index.js +1 -0
  17. package/dist/esm/components/ItemProvider/ItemProvider.d.ts +13 -0
  18. package/dist/{components → esm/components}/ItemProvider/ItemProvider.js +13 -19
  19. package/dist/esm/components/ItemProvider/helpers.d.ts +2 -0
  20. package/dist/esm/components/ItemProvider/index.js +1 -0
  21. package/dist/esm/components/index.d.ts +1 -0
  22. package/dist/esm/components/index.js +1 -0
  23. package/dist/esm/index.js +1 -0
  24. package/dist/esm/testIds.d.ts +7 -0
  25. package/package.json +10 -8
  26. package/src/components/Carousel/Carousel.tsx +0 -1
  27. package/src/components/Control/Control.tsx +3 -1
  28. package/src/components/ItemProvider/ItemProvider.tsx +13 -39
  29. package/src/components/ItemProvider/styles.module.scss +1 -1
  30. package/dist/components/Carousel/styles.module.css +0 -21
  31. package/dist/components/Control/styles.module.css +0 -45
  32. package/dist/components/ItemProvider/styles.module.css +0 -39
  33. /package/dist/{components → cjs/components}/Carousel/Carousel.d.ts +0 -0
  34. /package/dist/{components → cjs/components}/Carousel/index.d.ts +0 -0
  35. /package/dist/{components → cjs/components}/Control/Control.d.ts +0 -0
  36. /package/dist/{components → cjs/components}/Control/index.d.ts +0 -0
  37. /package/dist/{components → cjs/components}/ItemProvider/helpers.d.ts +0 -0
  38. /package/dist/{components → cjs/components}/ItemProvider/index.d.ts +0 -0
  39. /package/dist/{components → cjs/components}/index.d.ts +0 -0
  40. /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
  41. /package/dist/{testIds.d.ts → cjs/testIds.d.ts} +0 -0
  42. /package/dist/{components/Carousel/index.js → esm/components/Carousel/index.d.ts} +0 -0
  43. /package/dist/{components → esm/components/Carousel}/index.js +0 -0
  44. /package/dist/{components/Control/index.js → esm/components/Control/index.d.ts} +0 -0
  45. /package/dist/{components → esm/components}/ItemProvider/helpers.js +0 -0
  46. /package/dist/{components/ItemProvider/index.js → esm/components/ItemProvider/index.d.ts} +0 -0
  47. /package/dist/{index.js → esm/index.d.ts} +0 -0
  48. /package/dist/{testIds.js → esm/testIds.js} +0 -0
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
4
+ var t = {};
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
8
+ }
9
+ return t;
10
+ };
11
+ var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
12
+ return mod && mod.__esModule ? mod : {
13
+ "default": mod
14
+ };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", {
17
+ value: true
18
+ });
19
+ exports.Carousel = Carousel;
20
+ const jsx_runtime_1 = require("react/jsx-runtime");
21
+ const classnames_1 = __importDefault(require("classnames"));
22
+ const react_1 = require("react");
23
+ const uncontrollable_1 = require("uncontrollable");
24
+ const pagination_1 = require("@snack-uikit/pagination");
25
+ const utils_1 = require("@snack-uikit/utils");
26
+ const testIds_1 = require("../../testIds");
27
+ const Control_1 = require("../Control");
28
+ const ItemProvider_1 = require("../ItemProvider");
29
+ const styles_module_scss_1 = __importDefault({});
30
+ function Carousel(_a) {
31
+ var _b;
32
+ var {
33
+ children: items,
34
+ showItems = 1,
35
+ scrollBy: scrollByProp,
36
+ transition = 0.4,
37
+ swipe = true,
38
+ arrows = true,
39
+ pagination = true,
40
+ className,
41
+ gap,
42
+ state,
43
+ infiniteScroll = false,
44
+ swipeActivateLength = 48
45
+ } = _a,
46
+ rest = __rest(_a, ["children", "showItems", "scrollBy", "transition", "swipe", "arrows", "pagination", "className", "gap", "state", "infiniteScroll", "swipeActivateLength"]);
47
+ const scrollBy = (0, react_1.useMemo)(() => scrollByProp !== null && scrollByProp !== void 0 ? scrollByProp : Math.trunc(showItems), [showItems, scrollByProp]);
48
+ const [page, setPage] = (0, uncontrollable_1.useUncontrolledProp)(state === null || state === void 0 ? void 0 : state.page, (_b = state === null || state === void 0 ? void 0 : state.page) !== null && _b !== void 0 ? _b : 0, newPage => {
49
+ const result = typeof newPage === 'function' ? newPage(page) : newPage;
50
+ state === null || state === void 0 ? void 0 : state.onChange(result);
51
+ });
52
+ const total = (0, react_1.useMemo)(() => Math.trunc(items.length / scrollBy) + (items.length % scrollBy ? 1 : 0), [items.length, scrollBy]);
53
+ const onLeftArrowClick = (0, react_1.useCallback)(() => {
54
+ setPage(page => infiniteScroll ? (total + page - 1) % total : Math.max(0, page - 1));
55
+ }, [infiniteScroll, setPage, total]);
56
+ const onRightArrowClick = (0, react_1.useCallback)(() => {
57
+ setPage(page => infiniteScroll ? (page + 1) % total : Math.min(total - 1, page + 1));
58
+ }, [infiniteScroll, setPage, total]);
59
+ const slideCallback = (0, react_1.useCallback)(direction => {
60
+ if (direction < 0) {
61
+ onRightArrowClick();
62
+ return;
63
+ }
64
+ onLeftArrowClick();
65
+ }, [onLeftArrowClick, onRightArrowClick]);
66
+ return (0, jsx_runtime_1.jsxs)("div", Object.assign({
67
+ className: (0, classnames_1.default)(styles_module_scss_1.default.carousel, className)
68
+ }, (0, utils_1.extractSupportProps)(rest), {
69
+ children: [(0, jsx_runtime_1.jsxs)("div", {
70
+ className: styles_module_scss_1.default.carouselBase,
71
+ children: [(0, jsx_runtime_1.jsx)(ItemProvider_1.ItemProvider, {
72
+ showItems: showItems,
73
+ scrollBy: scrollBy,
74
+ swipe: swipe,
75
+ transition: transition,
76
+ items: items,
77
+ slideCallback: slideCallback,
78
+ page: page,
79
+ gap: gap,
80
+ swipeActivateLength: swipeActivateLength
81
+ }), arrows && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
82
+ children: [(infiniteScroll || page > 0) && (0, jsx_runtime_1.jsx)(Control_1.Control, {
83
+ onClick: onLeftArrowClick,
84
+ variant: 'prev',
85
+ "data-test-id": testIds_1.TEST_IDS.arrowPrev
86
+ }), (infiniteScroll || page + 1 < total) && (0, jsx_runtime_1.jsx)(Control_1.Control, {
87
+ onClick: onRightArrowClick,
88
+ variant: 'next',
89
+ "data-test-id": testIds_1.TEST_IDS.arrowNext
90
+ })]
91
+ })]
92
+ }), pagination && (0, jsx_runtime_1.jsx)("div", {
93
+ className: styles_module_scss_1.default.pagination,
94
+ children: (0, jsx_runtime_1.jsx)(pagination_1.PaginationSlider, {
95
+ "data-test-id": testIds_1.TEST_IDS.pagination,
96
+ page: page + 1,
97
+ onChange: page => {
98
+ setPage(page - 1);
99
+ },
100
+ total: total
101
+ })
102
+ })]
103
+ }));
104
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = {
8
+ enumerable: true,
9
+ get: function () {
10
+ return m[k];
11
+ }
12
+ };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ } : function (o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ });
19
+ var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", {
23
+ value: true
24
+ });
25
+ __exportStar(require("./Carousel"), exports);
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
4
+ var t = {};
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
8
+ }
9
+ return t;
10
+ };
11
+ var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
12
+ return mod && mod.__esModule ? mod : {
13
+ "default": mod
14
+ };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", {
17
+ value: true
18
+ });
19
+ exports.Control = void 0;
20
+ const jsx_runtime_1 = require("react/jsx-runtime");
21
+ const react_1 = require("react");
22
+ const icons_1 = require("@snack-uikit/icons");
23
+ const utils_1 = require("@snack-uikit/utils");
24
+ const styles_module_scss_1 = __importDefault({});
25
+ exports.Control = (0, react_1.forwardRef)((_a, ref) => {
26
+ var {
27
+ onClick,
28
+ variant
29
+ } = _a,
30
+ rest = __rest(_a, ["onClick", "variant"]);
31
+ return (0, jsx_runtime_1.jsx)("button", Object.assign({
32
+ ref: ref,
33
+ className: styles_module_scss_1.default.control,
34
+ onClick: () => {
35
+ onClick === null || onClick === void 0 ? void 0 : onClick();
36
+ },
37
+ type: 'button',
38
+ "data-variant": variant
39
+ }, (0, utils_1.extractSupportProps)(rest), {
40
+ children: (0, jsx_runtime_1.jsx)(icons_1.ChevronLeftSVG, {
41
+ size: 24,
42
+ className: styles_module_scss_1.default.icon
43
+ })
44
+ }));
45
+ });
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = {
8
+ enumerable: true,
9
+ get: function () {
10
+ return m[k];
11
+ }
12
+ };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ } : function (o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ });
19
+ var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", {
23
+ value: true
24
+ });
25
+ __exportStar(require("./Control"), exports);
@@ -4,11 +4,10 @@ export type ItemProviderProps = {
4
4
  showItems: number;
5
5
  scrollBy: number;
6
6
  slideCallback(direction: number): void;
7
- scrollToNextPage(): void;
8
7
  transition: number;
9
8
  swipe: boolean;
10
9
  swipeActivateLength: number;
11
10
  page: number;
12
11
  gap?: string;
13
12
  };
14
- export declare function ItemProvider({ items, showItems, scrollBy, slideCallback, scrollToNextPage, transition, swipe, swipeActivateLength, page, gap, }: ItemProviderProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function ItemProvider({ items, showItems, scrollBy, slideCallback, transition, swipe, swipeActivateLength, page, gap, }: ItemProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+
3
+ var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
4
+ return mod && mod.__esModule ? mod : {
5
+ "default": mod
6
+ };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", {
9
+ value: true
10
+ });
11
+ exports.ItemProvider = ItemProvider;
12
+ const jsx_runtime_1 = require("react/jsx-runtime");
13
+ const lodash_debounce_1 = __importDefault(require("lodash.debounce"));
14
+ const react_1 = require("react");
15
+ const testIds_1 = require("../../testIds");
16
+ const helpers_1 = require("./helpers");
17
+ const styles_module_scss_1 = __importDefault({});
18
+ function ItemProvider(_ref) {
19
+ let {
20
+ items,
21
+ showItems,
22
+ scrollBy,
23
+ slideCallback,
24
+ transition,
25
+ swipe,
26
+ swipeActivateLength,
27
+ page,
28
+ gap
29
+ } = _ref;
30
+ const containerRef = (0, react_1.useRef)(null);
31
+ const [computedValues, setComputedValues] = (0, react_1.useState)({
32
+ itemWidth: 200,
33
+ gap: 0
34
+ });
35
+ const recalculateItemsSize = (0, react_1.useCallback)(() => {
36
+ const containerElement = containerRef.current;
37
+ if (!containerElement) {
38
+ return;
39
+ }
40
+ const styles = getComputedStyle(containerElement);
41
+ const gap = Number.parseFloat(styles.getPropertyValue('--gap'));
42
+ const paddingLeft = Number.parseFloat(styles.getPropertyValue('padding-left'));
43
+ const paddingRight = Number.parseFloat(styles.getPropertyValue('padding-right'));
44
+ const itemWidth = (containerElement.getBoundingClientRect().width - (Math.trunc(showItems) - 1) * gap - paddingLeft - paddingRight) / showItems;
45
+ setComputedValues({
46
+ itemWidth,
47
+ gap
48
+ });
49
+ }, [showItems]);
50
+ (0, react_1.useEffect)(() => {
51
+ const node = containerRef.current;
52
+ if (!node) {
53
+ return;
54
+ }
55
+ recalculateItemsSize();
56
+ const observer = new ResizeObserver((0, lodash_debounce_1.default)(recalculateItemsSize, 100));
57
+ observer.observe(node);
58
+ return () => observer.disconnect();
59
+ }, [recalculateItemsSize]);
60
+ const itemsTrackerRef = (0, react_1.useRef)(null);
61
+ function hideNonVisibleItems() {
62
+ var _a;
63
+ (_a = itemsTrackerRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(`[data-test-id=${testIds_1.TEST_IDS.trackItem}]`).forEach(function (slide) {
64
+ slide.setAttribute('aria-hidden', '0');
65
+ slide.querySelectorAll('a, button, select, input, textarea, [tabindex="0"]').forEach(function (focusableElement) {
66
+ focusableElement.setAttribute('tabindex', '-5');
67
+ focusableElement.classList.add(styles_module_scss_1.default.hiddenItem);
68
+ });
69
+ });
70
+ }
71
+ function showVisibleItems(slide, page, show) {
72
+ var _a;
73
+ (_a = itemsTrackerRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(`[data-test-id=${testIds_1.TEST_IDS.trackItem}]`).forEach((item, i) => {
74
+ if (i >= page * slide && i < page * slide + Math.trunc(show)) {
75
+ item.removeAttribute('aria-hidden');
76
+ item.querySelectorAll('a, button, select, input, textarea, [tabindex="-5"]').forEach(function (focusableElement) {
77
+ focusableElement.setAttribute('tabindex', '0');
78
+ focusableElement.classList.remove(styles_module_scss_1.default.hiddenItem);
79
+ });
80
+ }
81
+ });
82
+ }
83
+ const transform = (0, react_1.useMemo)(() => Number(-(page * scrollBy * computedValues.itemWidth + computedValues.gap * page * scrollBy)), [computedValues.gap, computedValues.itemWidth, page, scrollBy]);
84
+ (0, react_1.useEffect)(() => {
85
+ hideNonVisibleItems();
86
+ showVisibleItems(scrollBy, page, showItems);
87
+ }, [page, scrollBy, showItems]);
88
+ const [drag, setDrag] = (0, react_1.useState)({
89
+ initial: transform,
90
+ start: 0,
91
+ isDown: false,
92
+ drag: 0,
93
+ finished: true,
94
+ pointers: true
95
+ });
96
+ const handleDragStart = e => {
97
+ e.persist();
98
+ setDrag(Object.assign(Object.assign({}, drag), {
99
+ isDown: true,
100
+ start: (0, helpers_1.getPageX)(e),
101
+ initial: transform,
102
+ finished: false
103
+ }));
104
+ };
105
+ const handleDragFinish = e => {
106
+ e.persist();
107
+ if (drag.finished) {
108
+ return;
109
+ }
110
+ if (Math.abs(drag.drag) < swipeActivateLength) {
111
+ return setDrag({
112
+ initial: transform,
113
+ start: 0,
114
+ isDown: false,
115
+ drag: 0,
116
+ finished: true,
117
+ pointers: true
118
+ });
119
+ }
120
+ slideCallback(drag.drag > 0 ? -1 : 1);
121
+ setDrag(Object.assign(Object.assign({}, drag), {
122
+ drag: 0,
123
+ isDown: false,
124
+ finished: true,
125
+ pointers: true
126
+ }));
127
+ return;
128
+ };
129
+ const handleDragMove = e => {
130
+ e.persist();
131
+ if (!drag.isDown) {
132
+ return;
133
+ }
134
+ const pos = (0, helpers_1.getPageX)(e);
135
+ setDrag(Object.assign(Object.assign({}, drag), {
136
+ drag: drag.start - pos,
137
+ pointers: Math.abs(drag.start - pos) < Number.MIN_SAFE_INTEGER
138
+ }));
139
+ };
140
+ const swipeProps = swipe ? {
141
+ onTouchCancel: handleDragFinish,
142
+ onTouchEnd: handleDragFinish,
143
+ onTouchMove: handleDragMove,
144
+ onTouchStart: handleDragStart,
145
+ onMouseDown: handleDragStart,
146
+ onMouseLeave: handleDragFinish,
147
+ onMouseUp: handleDragFinish,
148
+ onMouseMove: handleDragMove
149
+ } : {};
150
+ return (0, jsx_runtime_1.jsx)("div", {
151
+ ref: containerRef,
152
+ className: styles_module_scss_1.default.itemProvider,
153
+ "data-pointers": !drag.pointers || undefined,
154
+ "data-swipe": swipe || undefined,
155
+ style: Object.assign({}, Boolean(gap) ? {
156
+ '--gap': gap
157
+ } : {}),
158
+ children: (0, jsx_runtime_1.jsx)("div", Object.assign({}, swipeProps, {
159
+ className: styles_module_scss_1.default.itemTracker,
160
+ "data-test-id": testIds_1.TEST_IDS.trackLine,
161
+ style: {
162
+ transform: `translateX(${transform - drag.drag}px)`,
163
+ transition: `transform ${transition}s ease 0s`
164
+ },
165
+ ref: itemsTrackerRef,
166
+ children: items.map((item, i) => (0, jsx_runtime_1.jsx)("div", {
167
+ style: {
168
+ width: computedValues.itemWidth
169
+ },
170
+ className: styles_module_scss_1.default.itemContainer,
171
+ role: 'group',
172
+ "data-test-id": testIds_1.TEST_IDS.trackItem,
173
+ children: item
174
+ }, i))
175
+ }))
176
+ });
177
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPageX = getPageX;
7
+ function getPageX(e) {
8
+ if (e.nativeEvent instanceof globalThis.MouseEvent) {
9
+ return e.nativeEvent.pageX;
10
+ } else if (e.nativeEvent instanceof globalThis.TouchEvent) {
11
+ return e.nativeEvent.changedTouches[0].pageX;
12
+ }
13
+ return 0;
14
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = {
8
+ enumerable: true,
9
+ get: function () {
10
+ return m[k];
11
+ }
12
+ };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ } : function (o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ });
19
+ var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", {
23
+ value: true
24
+ });
25
+ __exportStar(require("./ItemProvider"), exports);
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = {
8
+ enumerable: true,
9
+ get: function () {
10
+ return m[k];
11
+ }
12
+ };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ } : function (o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ });
19
+ var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", {
23
+ value: true
24
+ });
25
+ __exportStar(require("./Carousel"), exports);
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = {
8
+ enumerable: true,
9
+ get: function () {
10
+ return m[k];
11
+ }
12
+ };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ } : function (o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ });
19
+ var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", {
23
+ value: true
24
+ });
25
+ __exportStar(require("./components"), exports);
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TEST_IDS = void 0;
7
+ exports.TEST_IDS = {
8
+ arrowNext: 'carousel__arrow-next',
9
+ arrowPrev: 'carousel__arrow-prev',
10
+ pagination: 'carousel__pagination',
11
+ trackLine: 'carousel__track-line',
12
+ trackItem: 'carousel__track-item'
13
+ };
@@ -0,0 +1,32 @@
1
+ import { ReactElement } from 'react';
2
+ import { WithSupportProps } from '@snack-uikit/utils';
3
+ export type CarouselProps = WithSupportProps<{
4
+ /** CSS - класснейм */
5
+ className?: string;
6
+ /** Массив айтемов */
7
+ children: ReactElement[];
8
+ /** Кол-во отображаемых единовременно айтемов @default 1 */
9
+ showItems?: number;
10
+ /** Сдвиг айтемов при смене 1 страницы @default Math.trunc(show) */
11
+ scrollBy?: number;
12
+ /** Время переключения 1 страницы (в s) @default 0.4 */
13
+ transition?: number;
14
+ /** Переключение страниц свайпом @default true */
15
+ swipe?: boolean;
16
+ /** Минимальная длина в px для активации свайпа @default 48 */
17
+ swipeActivateLength?: number;
18
+ /** Использовать стрелки для переключения страниц @default true */
19
+ arrows?: boolean;
20
+ /** Использовать пагинацию для переключения страниц @default true */
21
+ pagination?: boolean;
22
+ /** Расстояние между айтемами @default var(--dimension-2m)*/
23
+ gap?: string;
24
+ /** Управление состоянием извне */
25
+ state?: {
26
+ page: number;
27
+ onChange(page: number): void;
28
+ };
29
+ /** Цикличная прокрутка @default false*/
30
+ infiniteScroll?: boolean;
31
+ }>;
32
+ export declare function Carousel({ children: items, showItems, scrollBy: scrollByProp, transition, swipe, arrows, pagination, className, gap, state, infiniteScroll, swipeActivateLength, ...rest }: CarouselProps): import("react/jsx-runtime").JSX.Element;
@@ -41,7 +41,7 @@ export function Carousel(_a) {
41
41
  }
42
42
  onLeftArrowClick();
43
43
  }, [onLeftArrowClick, onRightArrowClick]);
44
- return (_jsxs("div", Object.assign({ className: cn(styles.carousel, className) }, extractSupportProps(rest), { children: [_jsxs("div", { className: styles.carouselBase, children: [_jsx(ItemProvider, { showItems: showItems, scrollBy: scrollBy, swipe: swipe, transition: transition, items: items, slideCallback: slideCallback, page: page, gap: gap, swipeActivateLength: swipeActivateLength, scrollToNextPage: onRightArrowClick }), arrows && (_jsxs(_Fragment, { children: [(infiniteScroll || page > 0) && (_jsx(Control, { onClick: onLeftArrowClick, variant: 'prev', "data-test-id": TEST_IDS.arrowPrev })), (infiniteScroll || page + 1 < total) && (_jsx(Control, { onClick: onRightArrowClick, variant: 'next', "data-test-id": TEST_IDS.arrowNext }))] }))] }), pagination && (_jsx("div", { className: styles.pagination, children: _jsx(PaginationSlider, { "data-test-id": TEST_IDS.pagination, page: page + 1, onChange: (page) => {
44
+ return (_jsxs("div", Object.assign({ className: cn(styles.carousel, className) }, extractSupportProps(rest), { children: [_jsxs("div", { className: styles.carouselBase, children: [_jsx(ItemProvider, { showItems: showItems, scrollBy: scrollBy, swipe: swipe, transition: transition, items: items, slideCallback: slideCallback, page: page, gap: gap, swipeActivateLength: swipeActivateLength }), arrows && (_jsxs(_Fragment, { children: [(infiniteScroll || page > 0) && (_jsx(Control, { onClick: onLeftArrowClick, variant: 'prev', "data-test-id": TEST_IDS.arrowPrev })), (infiniteScroll || page + 1 < total) && (_jsx(Control, { onClick: onRightArrowClick, variant: 'next', "data-test-id": TEST_IDS.arrowNext }))] }))] }), pagination && (_jsx("div", { className: styles.pagination, children: _jsx(PaginationSlider, { "data-test-id": TEST_IDS.pagination, page: page + 1, onChange: (page) => {
45
45
  setPage(page - 1);
46
46
  }, total: total }) }))] })));
47
47
  }
@@ -0,0 +1,6 @@
1
+ export declare const Control: import("react").ForwardRefExoticComponent<{
2
+ 'data-test-id'?: string;
3
+ } & import("react").AriaAttributes & {
4
+ onClick?(): void;
5
+ variant: "prev" | "next";
6
+ } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -16,5 +16,7 @@ import { extractSupportProps } from '@snack-uikit/utils';
16
16
  import styles from './styles.module.css';
17
17
  export const Control = forwardRef((_a, ref) => {
18
18
  var { onClick, variant } = _a, rest = __rest(_a, ["onClick", "variant"]);
19
- return (_jsx("button", Object.assign({ ref: ref, className: styles.control, onClick: onClick, type: 'button', "data-variant": variant }, extractSupportProps(rest), { children: _jsx(ChevronLeftSVG, { size: 24, className: styles.icon }) })));
19
+ return (_jsx("button", Object.assign({ ref: ref, className: styles.control, onClick: () => {
20
+ onClick === null || onClick === void 0 ? void 0 : onClick();
21
+ }, type: 'button', "data-variant": variant }, extractSupportProps(rest), { children: _jsx(ChevronLeftSVG, { size: 24, className: styles.icon }) })));
20
22
  });
@@ -0,0 +1 @@
1
+ export * from './Control';
@@ -0,0 +1,13 @@
1
+ import { ReactElement } from 'react';
2
+ export type ItemProviderProps = {
3
+ items: ReactElement[];
4
+ showItems: number;
5
+ scrollBy: number;
6
+ slideCallback(direction: number): void;
7
+ transition: number;
8
+ swipe: boolean;
9
+ swipeActivateLength: number;
10
+ page: number;
11
+ gap?: string;
12
+ };
13
+ export declare function ItemProvider({ items, showItems, scrollBy, slideCallback, transition, swipe, swipeActivateLength, page, gap, }: ItemProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import debounce from 'lodash.debounce';
3
- import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
3
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import { TEST_IDS } from '../../testIds';
5
5
  import { getPageX } from './helpers';
6
6
  import styles from './styles.module.css';
7
- export function ItemProvider({ items, showItems, scrollBy, slideCallback, scrollToNextPage, transition, swipe, swipeActivateLength, page, gap, }) {
7
+ export function ItemProvider({ items, showItems, scrollBy, slideCallback, transition, swipe, swipeActivateLength, page, gap, }) {
8
8
  const containerRef = useRef(null);
9
9
  const [computedValues, setComputedValues] = useState({
10
10
  itemWidth: 200,
@@ -37,28 +37,30 @@ export function ItemProvider({ items, showItems, scrollBy, slideCallback, scroll
37
37
  return () => observer.disconnect();
38
38
  }, [recalculateItemsSize]);
39
39
  const itemsTrackerRef = useRef(null);
40
- const hideNonVisibleItems = () => {
40
+ function hideNonVisibleItems() {
41
41
  var _a;
42
- (_a = itemsTrackerRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(`[data-test-id=${TEST_IDS.trackItem}]`).forEach(slide => {
42
+ (_a = itemsTrackerRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(`[data-test-id=${TEST_IDS.trackItem}]`).forEach(function (slide) {
43
43
  slide.setAttribute('aria-hidden', '0');
44
- slide.querySelectorAll('a, button, select, input, textarea, [tabindex="0"]').forEach(focusableElement => {
44
+ slide.querySelectorAll('a, button, select, input, textarea, [tabindex="0"]').forEach(function (focusableElement) {
45
45
  focusableElement.setAttribute('tabindex', '-5');
46
46
  focusableElement.classList.add(styles.hiddenItem);
47
47
  });
48
48
  });
49
- };
50
- const showVisibleItems = (slide, page, show) => {
49
+ }
50
+ function showVisibleItems(slide, page, show) {
51
51
  var _a;
52
52
  (_a = itemsTrackerRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(`[data-test-id=${TEST_IDS.trackItem}]`).forEach((item, i) => {
53
53
  if (i >= page * slide && i < page * slide + Math.trunc(show)) {
54
54
  item.removeAttribute('aria-hidden');
55
- item.querySelectorAll('a, button, select, input, textarea, [tabindex="-5"]').forEach(focusableElement => {
55
+ item
56
+ .querySelectorAll('a, button, select, input, textarea, [tabindex="-5"]')
57
+ .forEach(function (focusableElement) {
56
58
  focusableElement.setAttribute('tabindex', '0');
57
59
  focusableElement.classList.remove(styles.hiddenItem);
58
60
  });
59
61
  }
60
62
  });
61
- };
63
+ }
62
64
  const transform = useMemo(() => Number(-(page * scrollBy * computedValues.itemWidth + computedValues.gap * page * scrollBy)), [computedValues.gap, computedValues.itemWidth, page, scrollBy]);
63
65
  useEffect(() => {
64
66
  hideNonVisibleItems();
@@ -115,16 +117,8 @@ export function ItemProvider({ items, showItems, scrollBy, slideCallback, scroll
115
117
  onMouseMove: handleDragMove,
116
118
  }
117
119
  : {};
118
- const handleSlideClick = useCallback(e => {
119
- const isHidden = e.currentTarget.hasAttribute('aria-hidden');
120
- if (isHidden) {
121
- scrollToNextPage();
122
- }
123
- }, [scrollToNextPage]);
124
- return (_jsx("div", { ref: containerRef, className: styles.itemProvider, "data-pointers": !drag.pointers || undefined, "data-swipe": swipe || undefined, "data-gap": gap, style: Object.assign({}, (Boolean(gap) ? { '--gap': gap } : {})), children: _jsx("div", Object.assign({}, swipeProps, { className: styles.itemTracker, "data-test-id": TEST_IDS.trackLine, style: {
120
+ return (_jsx("div", { ref: containerRef, className: styles.itemProvider, "data-pointers": !drag.pointers || undefined, "data-swipe": swipe || undefined, style: Object.assign({}, (Boolean(gap) ? { '--gap': gap } : {})), children: _jsx("div", Object.assign({}, swipeProps, { className: styles.itemTracker, "data-test-id": TEST_IDS.trackLine, style: {
125
121
  transform: `translateX(${transform - drag.drag}px)`,
126
122
  transition: `transform ${transition}s ease 0s`,
127
- }, ref: itemsTrackerRef, children: items.map((item, i) => (
128
- // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
129
- _jsx("div", { style: { width: computedValues.itemWidth }, className: styles.itemContainer, role: 'group', "data-test-id": TEST_IDS.trackItem, onClick: handleSlideClick, children: item }, i))) })) }));
123
+ }, ref: itemsTrackerRef, children: items.map((item, i) => (_jsx("div", { style: { width: computedValues.itemWidth }, className: styles.itemContainer, role: 'group', "data-test-id": TEST_IDS.trackItem, children: item }, i))) })) }));
130
124
  }
@@ -0,0 +1,2 @@
1
+ import { MouseEvent, TouchEvent } from 'react';
2
+ export declare function getPageX(e: TouchEvent | MouseEvent): number;
@@ -0,0 +1 @@
1
+ export * from './ItemProvider';
@@ -0,0 +1 @@
1
+ export * from './Carousel';
@@ -0,0 +1 @@
1
+ export * from './Carousel';
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,7 @@
1
+ export declare const TEST_IDS: {
2
+ arrowNext: string;
3
+ arrowPrev: string;
4
+ pagination: string;
5
+ trackLine: string;
6
+ trackItem: string;
7
+ };
package/package.json CHANGED
@@ -4,15 +4,16 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.2.21-preview-d46fe148.0",
7
+ "version": "0.2.21-preview-1f246c4a.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
11
11
  "*.woff2"
12
12
  ],
13
13
  "description": "",
14
- "main": "./dist/index.js",
15
- "module": "./dist/index.js",
14
+ "types": "./dist/esm/index.d.ts",
15
+ "main": "./dist/cjs/index.js",
16
+ "module": "./dist/esm/index.js",
16
17
  "homepage": "https://github.com/cloud-ru-tech/snack-uikit/tree/master/packages/carousel",
17
18
  "repository": {
18
19
  "type": "git",
@@ -24,7 +25,8 @@
24
25
  "Nikita Ershov <niershov@cloud.ru>"
25
26
  ],
26
27
  "files": [
27
- "dist",
28
+ "dist/cjs",
29
+ "dist/esm",
28
30
  "src",
29
31
  "./CHANGELOG.md",
30
32
  "./LICENSE"
@@ -32,12 +34,12 @@
32
34
  "license": "Apache-2.0",
33
35
  "scripts": {},
34
36
  "dependencies": {
35
- "@snack-uikit/icons": "0.22.1",
36
- "@snack-uikit/pagination": "0.7.1",
37
- "@snack-uikit/utils": "3.4.0",
37
+ "@snack-uikit/icons": "0.22.2-preview-1f246c4a.0",
38
+ "@snack-uikit/pagination": "0.7.2-preview-1f246c4a.0",
39
+ "@snack-uikit/utils": "3.4.1-preview-1f246c4a.0",
38
40
  "classnames": "2.3.2",
39
41
  "lodash.debounce": "4.0.8",
40
42
  "uncontrollable": "8.0.4"
41
43
  },
42
- "gitHead": "39027f47c1a2c50919d064ec52bc41730821fc55"
44
+ "gitHead": "a185a55c0722b19f70dd168cf299e6f53a0fd93f"
43
45
  }
@@ -100,7 +100,6 @@ export function Carousel({
100
100
  page={page}
101
101
  gap={gap}
102
102
  swipeActivateLength={swipeActivateLength}
103
- scrollToNextPage={onRightArrowClick}
104
103
  />
105
104
 
106
105
  {arrows && (
@@ -15,7 +15,9 @@ export const Control = forwardRef<HTMLButtonElement, ControlProps>(
15
15
  <button
16
16
  ref={ref}
17
17
  className={styles.control}
18
- onClick={onClick}
18
+ onClick={() => {
19
+ onClick?.();
20
+ }}
19
21
  type='button'
20
22
  data-variant={variant}
21
23
  {...extractSupportProps(rest)}
@@ -1,15 +1,5 @@
1
1
  import debounce from 'lodash.debounce';
2
- import {
3
- MouseEvent,
4
- MouseEventHandler,
5
- ReactElement,
6
- TouchEvent,
7
- useCallback,
8
- useEffect,
9
- useMemo,
10
- useRef,
11
- useState,
12
- } from 'react';
2
+ import { MouseEvent, ReactElement, TouchEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';
13
3
 
14
4
  import { TEST_IDS } from '../../testIds';
15
5
  import { getPageX } from './helpers';
@@ -20,7 +10,6 @@ export type ItemProviderProps = {
20
10
  showItems: number;
21
11
  scrollBy: number;
22
12
  slideCallback(direction: number): void;
23
- scrollToNextPage(): void;
24
13
  transition: number;
25
14
  swipe: boolean;
26
15
  swipeActivateLength: number;
@@ -33,7 +22,6 @@ export function ItemProvider({
33
22
  showItems,
34
23
  scrollBy,
35
24
  slideCallback,
36
- scrollToNextPage,
37
25
  transition,
38
26
  swipe,
39
27
  swipeActivateLength,
@@ -85,28 +73,30 @@ export function ItemProvider({
85
73
 
86
74
  const itemsTrackerRef = useRef<HTMLDivElement>(null);
87
75
 
88
- const hideNonVisibleItems = () => {
89
- itemsTrackerRef.current?.querySelectorAll(`[data-test-id=${TEST_IDS.trackItem}]`).forEach(slide => {
76
+ function hideNonVisibleItems() {
77
+ itemsTrackerRef.current?.querySelectorAll(`[data-test-id=${TEST_IDS.trackItem}]`).forEach(function (slide) {
90
78
  slide.setAttribute('aria-hidden', '0');
91
79
 
92
- slide.querySelectorAll('a, button, select, input, textarea, [tabindex="0"]').forEach(focusableElement => {
80
+ slide.querySelectorAll('a, button, select, input, textarea, [tabindex="0"]').forEach(function (focusableElement) {
93
81
  focusableElement.setAttribute('tabindex', '-5');
94
82
  focusableElement.classList.add(styles.hiddenItem);
95
83
  });
96
84
  });
97
- };
85
+ }
98
86
 
99
- const showVisibleItems = (slide: number, page: number, show: number) => {
87
+ function showVisibleItems(slide: number, page: number, show: number) {
100
88
  itemsTrackerRef.current?.querySelectorAll(`[data-test-id=${TEST_IDS.trackItem}]`).forEach((item, i) => {
101
89
  if (i >= page * slide && i < page * slide + Math.trunc(show)) {
102
90
  item.removeAttribute('aria-hidden');
103
- item.querySelectorAll('a, button, select, input, textarea, [tabindex="-5"]').forEach(focusableElement => {
104
- focusableElement.setAttribute('tabindex', '0');
105
- focusableElement.classList.remove(styles.hiddenItem);
106
- });
91
+ item
92
+ .querySelectorAll('a, button, select, input, textarea, [tabindex="-5"]')
93
+ .forEach(function (focusableElement) {
94
+ focusableElement.setAttribute('tabindex', '0');
95
+ focusableElement.classList.remove(styles.hiddenItem);
96
+ });
107
97
  }
108
98
  });
109
- };
99
+ }
110
100
 
111
101
  const transform = useMemo(
112
102
  () => Number(-(page * scrollBy * computedValues.itemWidth + computedValues.gap * page * scrollBy)),
@@ -140,11 +130,9 @@ export function ItemProvider({
140
130
 
141
131
  const handleDragFinish = (e: MouseEvent | TouchEvent) => {
142
132
  e.persist();
143
-
144
133
  if (drag.finished) {
145
134
  return;
146
135
  }
147
-
148
136
  if (Math.abs(drag.drag) < swipeActivateLength) {
149
137
  return setDrag({
150
138
  initial: transform,
@@ -190,24 +178,12 @@ export function ItemProvider({
190
178
  }
191
179
  : {};
192
180
 
193
- const handleSlideClick: MouseEventHandler = useCallback(
194
- e => {
195
- const isHidden = e.currentTarget.hasAttribute('aria-hidden');
196
-
197
- if (isHidden) {
198
- scrollToNextPage();
199
- }
200
- },
201
- [scrollToNextPage],
202
- );
203
-
204
181
  return (
205
182
  <div
206
183
  ref={containerRef}
207
184
  className={styles.itemProvider}
208
185
  data-pointers={!drag.pointers || undefined}
209
186
  data-swipe={swipe || undefined}
210
- data-gap={gap}
211
187
  style={{
212
188
  ...(Boolean(gap) ? { '--gap': gap } : {}),
213
189
  }}
@@ -223,14 +199,12 @@ export function ItemProvider({
223
199
  ref={itemsTrackerRef}
224
200
  >
225
201
  {items.map((item, i) => (
226
- // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
227
202
  <div
228
203
  key={i}
229
204
  style={{ width: computedValues.itemWidth }}
230
205
  className={styles.itemContainer}
231
206
  role='group'
232
207
  data-test-id={TEST_IDS.trackItem}
233
- onClick={handleSlideClick}
234
208
  >
235
209
  {item}
236
210
  </div>
@@ -39,4 +39,4 @@
39
39
  * {
40
40
  pointer-events: none;
41
41
  }
42
- }
42
+ }
@@ -1,21 +0,0 @@
1
- .carouselBase{
2
- position:relative;
3
- display:flex;
4
- box-sizing:border-box;
5
- width:100%;
6
- outline:none;
7
- }
8
-
9
- .carousel{
10
- display:flex;
11
- flex-direction:column;
12
- align-items:center;
13
- box-sizing:border-box;
14
- }
15
-
16
- .pagination{
17
- padding-top:var(--space-carousel-sliders-wrap-padding-top, 8px);
18
- display:flex;
19
- justify-content:center;
20
- box-sizing:border-box;
21
- }
@@ -1,45 +0,0 @@
1
- .control{
2
- width:var(--size-carousel-control-container, 40px);
3
- height:var(--size-carousel-control-container, 40px);
4
- border-radius:var(--radius-carousel-control-container, 24px);
5
- border-width:var(--border-width-025m, 2px);
6
- cursor:pointer;
7
- position:absolute;
8
- top:50%;
9
- left:calc(var(--size-carousel-control-wrap-width, 20px) - var(--size-carousel-control-container, 40px));
10
- transform:translateY(-50%);
11
- display:flex;
12
- flex-shrink:0;
13
- align-items:center;
14
- justify-content:center;
15
- color:var(--sys-neutral-text-light, #8b8e9b);
16
- background-color:var(--sys-neutral-background1-level, #fdfdfd);
17
- border-color:transparent;
18
- border-style:solid;
19
- outline-color:transparent;
20
- box-shadow:var(--box-shadow-elevation-level3, 0px 0px 8px 0px rgba(0, 0, 0, 0.0784313725), 0px 8px 16px 0px rgba(0, 0, 0, 0.0784313725));
21
- }
22
- .control:hover, .control:focus-visible{
23
- color:var(--sys-neutral-text-main, #41424e);
24
- }
25
- .control:hover{
26
- box-shadow:var(--box-shadow-elevation-level4, 0px 0px 8px 0px rgba(0, 0, 0, 0.0784313725), 0px 16px 16px 0px rgba(0, 0, 0, 0.0784313725));
27
- }
28
- .control:focus-visible{
29
- outline-width:var(--border-state-focus-s-border-width, 2px);
30
- outline-style:var(--border-state-focus-s-border-style, solid);
31
- outline-color:var(--border-state-focus-s-border-color, );
32
- border-color:var(--sys-available-complementary, #1c1c24);
33
- outline-color:var(--sys-available-on-complementary, #ffffff);
34
- box-shadow:none;
35
- }
36
- .control[data-variant=next]{
37
- right:calc(var(--size-carousel-control-wrap-width, 20px) - var(--size-carousel-control-container, 40px));
38
- left:auto;
39
- }
40
- .control[data-variant=next]:focus-visible{
41
- outline-offset:var(--dimension-025m, 2px);
42
- }
43
- .control[data-variant=next] .icon{
44
- transform:rotate(180deg);
45
- }
@@ -1,39 +0,0 @@
1
- .itemProvider{
2
- --gap:var(--dimension-2m, 16px);
3
- padding-top:var(--space-carousel-content-layout-padding, 4px);
4
- padding-bottom:var(--space-carousel-content-layout-padding, 4px);
5
- padding-left:var(--space-carousel-content-layout-padding, 4px);
6
- padding-right:var(--space-carousel-content-layout-padding, 4px);
7
- overflow:hidden;
8
- width:100%;
9
- margin:calc(0px - var(--space-carousel-content-layout-padding, 4px));
10
- }
11
- .itemProvider[data-swipe]{
12
- cursor:grab;
13
- }
14
- .itemProvider[data-swipe][data-pointers]{
15
- cursor:grabbing;
16
- -webkit-user-select:none;
17
- -moz-user-select:none;
18
- user-select:none;
19
- -webkit-user-drag:none;
20
- }
21
-
22
- .itemContainer{
23
- flex-shrink:0;
24
- box-sizing:border-box;
25
- }
26
-
27
- .itemTracker{
28
- display:flex;
29
- gap:var(--gap, var(--dimension-2m, 16px));
30
- box-sizing:border-box;
31
- height:100%;
32
- }
33
-
34
- .hiddenItem{
35
- pointer-events:none;
36
- }
37
- .hiddenItem *{
38
- pointer-events:none;
39
- }
File without changes
File without changes
File without changes
File without changes
File without changes