react-kui 3.2.1 → 3.3.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/ai/kui-components.json +819 -162
- package/es/_virtual/_rolldown/runtime.js +2 -3
- package/es/affix/index.js +73 -185
- package/es/alert/index.js +3 -4
- package/es/anchor/anchor-context.js +2 -3
- package/es/anchor/anchor-link.js +3 -4
- package/es/anchor/anchor.js +195 -398
- package/es/auto-complete/index.js +160 -561
- package/es/avatar/avatar-group-context.js +2 -3
- package/es/avatar/avatar-group.js +32 -124
- package/es/avatar/avatar.js +58 -159
- package/es/back-top/index.js +66 -201
- package/es/badge/index.js +4 -5
- package/es/base/teleport.js +22 -54
- package/es/base/transition-props.js +2 -3
- package/es/base/transition.js +2 -3
- package/es/breadcrumb/breadcrumb-context.js +2 -3
- package/es/breadcrumb/breadcrumb-item.js +19 -102
- package/es/breadcrumb/breadcrumb.js +10 -59
- package/es/button/button-group-context.js +2 -3
- package/es/button/button-group.js +15 -75
- package/es/button/button.js +4 -5
- package/es/calendar/index.js +4 -5
- package/es/card/index.js +4 -5
- package/es/carousel/carousel-context.js +2 -3
- package/es/carousel/carousel-item.js +3 -4
- package/es/carousel/carousel.js +281 -628
- package/es/carousel/drag.js +2 -3
- package/es/cascader/index.js +7 -8
- package/es/check-card/check-card-group.js +53 -179
- package/es/check-card/check-card.js +100 -293
- package/es/check-card/context.js +2 -3
- package/es/checkbox/checkbox-group-context.js +2 -3
- package/es/checkbox/checkbox-group.js +34 -138
- package/es/checkbox/checkbox.js +4 -5
- package/es/checkbox/index.js +2 -3
- package/es/collapse/collapse-panel.js +84 -206
- package/es/collapse/collapse.js +38 -170
- package/es/color-picker/alpha.js +44 -125
- package/es/color-picker/hue.js +39 -108
- package/es/color-picker/index.js +7 -6
- package/es/color-picker/mode.js +76 -159
- package/es/color-picker/paint.js +66 -163
- package/es/color-picker/presets.js +12 -44
- package/es/components.js +37 -32
- package/es/config/config-context.js +2 -3
- package/es/config/context.js +2 -3
- package/es/config/index.js +3 -4
- package/es/config/popup-host.js +3 -4
- package/es/config/size-context.js +2 -3
- package/es/config/use-config-appearance.js +3 -4
- package/es/const/var.js +2 -3
- package/es/date-picker/index.js +8 -9
- package/es/descriptions/descriptions-item.js +3 -4
- package/es/descriptions/descriptions.js +53 -144
- package/es/divider/index.js +2 -3
- package/es/drawer/index.js +171 -465
- package/es/dropdown/dropdown-button.js +25 -128
- package/es/dropdown/dropdown-context.js +2 -3
- package/es/dropdown/dropdown.js +56 -207
- package/es/dropdown/trigger.js +37 -125
- package/es/empty/index.js +34 -111
- package/es/feature-card/index.js +2 -3
- package/es/feedback-panel/index.js +30 -155
- package/es/flame-wrap/index.js +3 -4
- package/es/flame-wrap/types.js +2 -3
- package/es/flex/index.js +2 -3
- package/es/form/field-context.js +3 -4
- package/es/form/form-context.js +2 -3
- package/es/form/form-item.js +4 -5
- package/es/form/form.js +108 -279
- package/es/form/utils.js +2 -3
- package/es/gradient-picker/corners.js +55 -0
- package/es/gradient-picker/index.js +191 -0
- package/es/gradient-picker/stops.js +219 -0
- package/es/gradient-picker/types.js +147 -0
- package/es/grid/grid-item.js +25 -116
- package/es/grid/grid.js +40 -151
- package/es/grid/useBreakpoint.js +3 -4
- package/es/icon/index.js +24 -126
- package/es/image/group.js +3 -4
- package/es/image/image-group-context.js +2 -3
- package/es/image/image.js +5 -6
- package/es/image/instance.js +2 -3
- package/es/image/preview.js +4 -5
- package/es/image/utils.js +2 -3
- package/es/index.js +5 -4
- package/es/input/index.js +2 -3
- package/es/input/input-base.js +4 -5
- package/es/input/input-box.js +2 -3
- package/es/input/input-group.js +4 -5
- package/es/input/input.js +3 -4
- package/es/input/textarea.js +3 -4
- package/es/input-number/drag.js +63 -0
- package/es/input-number/index.js +41 -11
- package/es/input-otp/index.js +3 -4
- package/es/input-tag/index.js +5 -6
- package/es/kanban/index.js +31 -168
- package/es/layout/index.js +43 -215
- package/es/layout/layout-context.js +2 -3
- package/es/list-panel/index.js +47 -185
- package/es/loading/index.js +2 -3
- package/es/loading/loading-bar.js +54 -114
- package/es/locale/de.js +2 -3
- package/es/locale/el.js +2 -3
- package/es/locale/en.js +2 -3
- package/es/locale/fr.js +2 -3
- package/es/locale/it.js +2 -3
- package/es/locale/ja.js +2 -3
- package/es/locale/ko.js +2 -3
- package/es/locale/ru.js +2 -3
- package/es/locale/th.js +2 -3
- package/es/locale/uk.js +2 -3
- package/es/locale/vi.js +2 -3
- package/es/locale/zh-CN.js +2 -3
- package/es/locale/zh-TW.js +2 -3
- package/es/mentions/index.js +214 -581
- package/es/menu/menu-context.js +2 -3
- package/es/menu/menu-divider.js +3 -4
- package/es/menu/menu-group.js +3 -4
- package/es/menu/menu-item.js +2 -3
- package/es/menu/menu-keyboard.js +2 -3
- package/es/menu/menu.js +184 -442
- package/es/menu/recursive-menu.js +3 -4
- package/es/menu/sub-menu.js +5 -6
- package/es/message/index.js +2 -3
- package/es/modal/api.js +2 -3
- package/es/modal/modal.js +263 -599
- package/es/modal/toast.js +63 -179
- package/es/node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js +2 -3
- package/es/notice/container.js +2 -3
- package/es/notice/content.js +4 -5
- package/es/notice/index.js +2 -3
- package/es/notice/instance.js +2 -3
- package/es/page/index.js +4 -5
- package/es/page/responsive.js +2 -3
- package/es/page-header/index.js +3 -4
- package/es/popconfirm/index.js +24 -70
- package/es/poptip/index.js +29 -88
- package/es/popup/index.js +8 -6
- package/es/popup/layers.js +2 -3
- package/es/progress/index.js +95 -229
- package/es/qrcode/index.js +3 -4
- package/es/radio/radio-button.js +37 -131
- package/es/radio/radio-group-context.js +2 -3
- package/es/radio/radio-group.js +69 -223
- package/es/radio/radio.js +3 -4
- package/es/rate/index.js +68 -226
- package/es/rate/star.js +38 -129
- package/es/result/index.js +35 -127
- package/es/ripple/index.js +3 -4
- package/es/ripple/types.js +2 -3
- package/es/row-col/col.js +59 -149
- package/es/row-col/row.js +2 -3
- package/es/segmented/index.js +66 -210
- package/es/select/option.js +23 -116
- package/es/select/select.js +9 -10
- package/es/skeleton/skeleton-avatar.js +2 -3
- package/es/skeleton/skeleton-button.js +2 -3
- package/es/skeleton/skeleton-image.js +28 -108
- package/es/skeleton/skeleton-text.js +17 -93
- package/es/skeleton/skeleton.js +46 -133
- package/es/skeleton/use-skeleton-loading.js +3 -4
- package/es/slider/index.js +92 -286
- package/es/slider/thumb.js +43 -133
- package/es/space/index.js +3 -4
- package/es/spin/index.js +2 -3
- package/es/splitter/splitter-panel.js +3 -4
- package/es/splitter/splitter.js +77 -219
- package/es/stat-card/countup.js +46 -141
- package/es/stat-card/rollup.js +27 -105
- package/es/stat-card/stat-card.js +3 -4
- package/es/stat-card/stat-number.js +26 -113
- package/es/stat-card/utils/countup.js +2 -3
- package/es/stat-card/utils/odometer.js +2 -3
- package/es/stat-card/utils/stat-item-key.js +2 -3
- package/es/steps/index.js +45 -123
- package/es/switch/index.js +4 -5
- package/es/table/column-setting.js +43 -139
- package/es/table/index.js +8 -9
- package/es/table/utils.js +2 -3
- package/es/tabs/tab-panel.js +19 -71
- package/es/tabs/tabs.js +6 -7
- package/es/tag/index.js +4 -5
- package/es/time-line/timeline-item.js +3 -4
- package/es/time-line/timeline.js +8 -44
- package/es/tooltip/index.js +41 -142
- package/es/tour/index.js +138 -356
- package/es/transfer/index.js +184 -487
- package/es/tree/index.js +8 -9
- package/es/tree/utils.js +2 -3
- package/es/tree-select/index.js +8 -9
- package/es/typography/index.js +75 -306
- package/es/upload/file-list.js +95 -119
- package/es/upload/index.js +8 -9
- package/es/upload/picture-sort.js +2 -3
- package/es/upload/selector.js +63 -193
- package/es/utils/checked.js +2 -3
- package/es/utils/color.js +2 -3
- package/es/utils/css.js +2 -3
- package/es/utils/focus.js +2 -3
- package/es/utils/number.js +2 -3
- package/es/utils/overlay-order.js +2 -3
- package/es/utils/overlay-stack.js +3 -4
- package/es/utils/placement.js +16 -4
- package/es/utils/popup-arrow.js +45 -0
- package/es/utils/popup.js +2 -3
- package/es/utils/promise.js +2 -3
- package/es/utils/react-node.js +2 -3
- package/es/utils/selection-tags.js +2 -3
- package/es/utils/share.js +2 -3
- package/es/utils/theme.js +2 -3
- package/es/utils/transition.js +2 -3
- package/es/utils/use-value.js +3 -4
- package/es/virtual-list/index.js +49 -187
- package/es/virtual-list/range.js +2 -3
- package/es/watermark/index.js +149 -289
- package/lib/index.cjs +2 -2
- package/lib/locale/de.cjs +1 -1
- package/lib/locale/el.cjs +1 -1
- package/lib/locale/en.cjs +1 -1
- package/lib/locale/fr.cjs +1 -1
- package/lib/locale/it.cjs +1 -1
- package/lib/locale/ja.cjs +1 -1
- package/lib/locale/ko.cjs +1 -1
- package/lib/locale/ru.cjs +1 -1
- package/lib/locale/th.cjs +1 -1
- package/lib/locale/uk.cjs +1 -1
- package/lib/locale/vi.cjs +1 -1
- package/lib/locale/zh-CN.cjs +1 -1
- package/lib/locale/zh-TW.cjs +1 -1
- package/package.json +24 -24
- package/style/base.css +1 -1
- package/style/components.css +2 -2
- package/style/index.css +2 -2
- package/style/theme.css +1 -1
- package/types/affix/index.d.cts +1 -1
- package/types/affix/index.d.ts +1 -1
- package/types/anchor/anchor-link.d.cts +1 -1
- package/types/anchor/anchor-link.d.ts +1 -1
- package/types/anchor/anchor.d.cts +1 -1
- package/types/anchor/anchor.d.ts +1 -1
- package/types/back-top/index.d.cts +1 -1
- package/types/back-top/index.d.ts +1 -1
- package/types/carousel/carousel-item.d.cts +1 -1
- package/types/carousel/carousel-item.d.ts +1 -1
- package/types/cascader/index.d.cts +1 -1
- package/types/cascader/index.d.ts +1 -1
- package/types/color-picker/alpha.d.cts +1 -1
- package/types/color-picker/alpha.d.ts +1 -1
- package/types/color-picker/hue.d.cts +1 -1
- package/types/color-picker/hue.d.ts +1 -1
- package/types/color-picker/index.d.cts +3 -2
- package/types/color-picker/index.d.ts +3 -2
- package/types/color-picker/mode.d.cts +1 -1
- package/types/color-picker/mode.d.ts +1 -1
- package/types/color-picker/paint.d.cts +1 -1
- package/types/color-picker/paint.d.ts +1 -1
- package/types/color-picker/presets.d.cts +1 -1
- package/types/color-picker/presets.d.ts +1 -1
- package/types/components.d.cts +3 -0
- package/types/components.d.ts +3 -0
- package/types/date-picker/index.d.cts +2 -2
- package/types/date-picker/index.d.ts +2 -2
- package/types/feature-card/index.d.cts +1 -1
- package/types/feature-card/index.d.ts +1 -1
- package/types/feedback-panel/index.d.cts +1 -1
- package/types/feedback-panel/index.d.ts +1 -1
- package/types/flame-wrap/index.d.cts +1 -1
- package/types/flame-wrap/index.d.ts +1 -1
- package/types/form/form-item.d.cts +1 -1
- package/types/form/form-item.d.ts +1 -1
- package/types/gradient-picker/corners.d.cts +8 -0
- package/types/gradient-picker/corners.d.ts +8 -0
- package/types/gradient-picker/index.d.cts +25 -0
- package/types/gradient-picker/index.d.ts +25 -0
- package/types/gradient-picker/stops.d.cts +12 -0
- package/types/gradient-picker/stops.d.ts +12 -0
- package/types/gradient-picker/types.d.cts +34 -0
- package/types/gradient-picker/types.d.ts +34 -0
- package/types/grid/grid-item.d.cts +1 -1
- package/types/grid/grid-item.d.ts +1 -1
- package/types/grid/grid.d.cts +1 -1
- package/types/grid/grid.d.ts +1 -1
- package/types/image/group.d.cts +1 -1
- package/types/image/group.d.ts +1 -1
- package/types/input-number/drag.d.cts +9 -0
- package/types/input-number/drag.d.ts +9 -0
- package/types/input-number/index.d.cts +1 -0
- package/types/input-number/index.d.ts +1 -0
- package/types/kanban/index.d.cts +1 -1
- package/types/kanban/index.d.ts +1 -1
- package/types/list-panel/index.d.cts +1 -1
- package/types/list-panel/index.d.ts +1 -1
- package/types/loading/loading-bar.d.cts +1 -1
- package/types/loading/loading-bar.d.ts +1 -1
- package/types/modal/toast.d.cts +1 -1
- package/types/modal/toast.d.ts +1 -1
- package/types/notice/content.d.cts +2 -2
- package/types/notice/content.d.ts +2 -2
- package/types/page-header/index.d.cts +1 -1
- package/types/page-header/index.d.ts +1 -1
- package/types/popconfirm/index.d.cts +1 -0
- package/types/popconfirm/index.d.ts +1 -0
- package/types/poptip/index.d.cts +1 -0
- package/types/poptip/index.d.ts +1 -0
- package/types/popup/index.d.cts +1 -0
- package/types/popup/index.d.ts +1 -0
- package/types/result/index.d.cts +1 -1
- package/types/result/index.d.ts +1 -1
- package/types/ripple/index.d.cts +1 -1
- package/types/ripple/index.d.ts +1 -1
- package/types/slider/index.d.cts +1 -1
- package/types/slider/index.d.ts +1 -1
- package/types/splitter/splitter-panel.d.cts +1 -1
- package/types/splitter/splitter-panel.d.ts +1 -1
- package/types/splitter/splitter.d.cts +1 -1
- package/types/splitter/splitter.d.ts +1 -1
- package/types/stat-card/countup.d.cts +1 -1
- package/types/stat-card/countup.d.ts +1 -1
- package/types/stat-card/rollup.d.cts +1 -1
- package/types/stat-card/rollup.d.ts +1 -1
- package/types/stat-card/stat-card.d.cts +1 -1
- package/types/stat-card/stat-card.d.ts +1 -1
- package/types/stat-card/stat-number.d.cts +1 -1
- package/types/stat-card/stat-number.d.ts +1 -1
- package/types/table/column-setting.d.cts +1 -1
- package/types/table/column-setting.d.ts +1 -1
- package/types/table/index.d.cts +1 -1
- package/types/table/index.d.ts +1 -1
- package/types/time-line/timeline-item.d.cts +1 -1
- package/types/time-line/timeline-item.d.ts +1 -1
- package/types/time-line/timeline.d.cts +1 -1
- package/types/time-line/timeline.d.ts +1 -1
- package/types/tooltip/index.d.cts +1 -0
- package/types/tooltip/index.d.ts +1 -0
- package/types/transfer/index.d.cts +1 -1
- package/types/transfer/index.d.ts +1 -1
- package/types/tree-select/index.d.cts +1 -1
- package/types/tree-select/index.d.ts +1 -1
- package/types/upload/file-list.d.cts +1 -1
- package/types/upload/file-list.d.ts +1 -1
- package/types/upload/selector.d.cts +1 -1
- package/types/upload/selector.d.ts +1 -1
- package/types/utils/placement.d.cts +2 -1
- package/types/utils/placement.d.ts +2 -1
- package/types/utils/popup-arrow.d.cts +5 -0
- package/types/utils/popup-arrow.d.ts +5 -0
- package/types/utils/selection-tags.d.cts +1 -1
- package/types/utils/selection-tags.d.ts +1 -1
- package/types/watermark/index.d.cts +1 -1
- package/types/watermark/index.d.ts +1 -1
package/es/carousel/carousel.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.
|
|
2
|
+
* react-kui v3.3.0
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
6
6
|
* Author: Qiu / https://chuchur.com
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { useValue } from "../utils/use-value.js";
|
|
9
10
|
import { ArrowLeft, ArrowRight } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
|
|
10
11
|
import Icon from "../icon/index.js";
|
|
11
|
-
import { useValue } from "../utils/use-value.js";
|
|
12
12
|
import { CarouselContext } from "./carousel-context.js";
|
|
13
13
|
import { bindCarouselDrag, readCarouselOffset, retargetCarousel } from "./drag.js";
|
|
14
|
-
import { c } from "react/compiler-runtime";
|
|
15
14
|
import clsx from "clsx";
|
|
16
|
-
import { Children, Fragment, cloneElement, forwardRef, isValidElement, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
15
|
+
import { Children, Fragment, cloneElement, forwardRef, isValidElement, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
17
16
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
-
|
|
17
|
+
// components/carousel/carousel.tsx
|
|
19
18
|
function flattenItems(children, parents = []) {
|
|
20
19
|
return Children.toArray(children).flatMap((child) => {
|
|
21
20
|
if (!isValidElement(child)) return [child];
|
|
@@ -24,79 +23,9 @@ function flattenItems(children, parents = []) {
|
|
|
24
23
|
return [cloneElement(child, { key: JSON.stringify(keys) })];
|
|
25
24
|
});
|
|
26
25
|
}
|
|
27
|
-
var Carousel = forwardRef(function Carousel(
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
let className;
|
|
31
|
-
let onChange;
|
|
32
|
-
let onMouseEnter;
|
|
33
|
-
let onMouseLeave;
|
|
34
|
-
let onPointerEnter;
|
|
35
|
-
let onPointerLeave;
|
|
36
|
-
let rest;
|
|
37
|
-
let style;
|
|
38
|
-
let t1;
|
|
39
|
-
let t2;
|
|
40
|
-
let t3;
|
|
41
|
-
let t4;
|
|
42
|
-
let t5;
|
|
43
|
-
let t6;
|
|
44
|
-
let t7;
|
|
45
|
-
let value;
|
|
46
|
-
if ($[0] !== t0) {
|
|
47
|
-
({value, loop: t1, autoplay: t2, delay: t3, height: t4, vertical: t5, dots: t6, swipeable: t7, onChange, onMouseEnter, onMouseLeave, onPointerEnter, onPointerLeave, className, style, children, ...rest} = t0);
|
|
48
|
-
$[0] = t0;
|
|
49
|
-
$[1] = children;
|
|
50
|
-
$[2] = className;
|
|
51
|
-
$[3] = onChange;
|
|
52
|
-
$[4] = onMouseEnter;
|
|
53
|
-
$[5] = onMouseLeave;
|
|
54
|
-
$[6] = onPointerEnter;
|
|
55
|
-
$[7] = onPointerLeave;
|
|
56
|
-
$[8] = rest;
|
|
57
|
-
$[9] = style;
|
|
58
|
-
$[10] = t1;
|
|
59
|
-
$[11] = t2;
|
|
60
|
-
$[12] = t3;
|
|
61
|
-
$[13] = t4;
|
|
62
|
-
$[14] = t5;
|
|
63
|
-
$[15] = t6;
|
|
64
|
-
$[16] = t7;
|
|
65
|
-
$[17] = value;
|
|
66
|
-
} else {
|
|
67
|
-
children = $[1];
|
|
68
|
-
className = $[2];
|
|
69
|
-
onChange = $[3];
|
|
70
|
-
onMouseEnter = $[4];
|
|
71
|
-
onMouseLeave = $[5];
|
|
72
|
-
onPointerEnter = $[6];
|
|
73
|
-
onPointerLeave = $[7];
|
|
74
|
-
rest = $[8];
|
|
75
|
-
style = $[9];
|
|
76
|
-
t1 = $[10];
|
|
77
|
-
t2 = $[11];
|
|
78
|
-
t3 = $[12];
|
|
79
|
-
t4 = $[13];
|
|
80
|
-
t5 = $[14];
|
|
81
|
-
t6 = $[15];
|
|
82
|
-
t7 = $[16];
|
|
83
|
-
value = $[17];
|
|
84
|
-
}
|
|
85
|
-
const loop = t1 === void 0 ? true : t1;
|
|
86
|
-
const autoplay = t2 === void 0 ? false : t2;
|
|
87
|
-
const delay = t3 === void 0 ? 3e3 : t3;
|
|
88
|
-
const height = t4 === void 0 ? 256 : t4;
|
|
89
|
-
const vertical = t5 === void 0 ? false : t5;
|
|
90
|
-
const dots = t6 === void 0 ? true : t6;
|
|
91
|
-
const swipeable = t7 === void 0 ? true : t7;
|
|
92
|
-
let t8;
|
|
93
|
-
if ($[18] !== children) {
|
|
94
|
-
t8 = flattenItems(children);
|
|
95
|
-
$[18] = children;
|
|
96
|
-
$[19] = t8;
|
|
97
|
-
} else t8 = $[19];
|
|
98
|
-
const items = t8;
|
|
99
|
-
const [innerIndex, setInnerIndex] = useValue(value, _temp);
|
|
26
|
+
var Carousel = forwardRef(function Carousel({ value, loop = true, autoplay = false, delay = 3e3, height = 256, vertical = false, dots = true, swipeable = true, onChange, onMouseEnter, onMouseLeave, onPointerEnter, onPointerLeave, className, style, children, ...rest }, ref) {
|
|
27
|
+
const items = flattenItems(children);
|
|
28
|
+
const [innerIndex, setInnerIndex] = useValue(value, (next) => next ?? 0);
|
|
100
29
|
const looping = loop && items.length > 1;
|
|
101
30
|
const initialIndex = Math.max(0, Math.min(items.length - 1, value ?? 0));
|
|
102
31
|
const [position, setPosition] = useState(looping ? initialIndex + 1 : initialIndex);
|
|
@@ -116,97 +45,42 @@ var Carousel = forwardRef(function Carousel(t0, ref) {
|
|
|
116
45
|
const hasItems = items.length > 0;
|
|
117
46
|
const current = Math.max(0, Math.min(items.length - 1, innerIndex));
|
|
118
47
|
const navigationIndex = useRef(current);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
useLayoutEffect(t9, t10);
|
|
134
|
-
let t11;
|
|
135
|
-
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
136
|
-
t11 = () => {
|
|
137
|
-
const element = rootRef.current;
|
|
138
|
-
if (!element) return;
|
|
139
|
-
let measuredWidth = -1;
|
|
140
|
-
const update = () => {
|
|
141
|
-
const next_0 = element.offsetWidth;
|
|
142
|
-
if (next_0 === measuredWidth) return;
|
|
143
|
-
measuredWidth = next_0;
|
|
144
|
-
setAnimate(false);
|
|
145
|
-
setWidth(next_0);
|
|
146
|
-
};
|
|
147
|
-
update();
|
|
148
|
-
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
|
|
149
|
-
observer?.observe(element);
|
|
150
|
-
return () => observer?.disconnect();
|
|
151
|
-
};
|
|
152
|
-
$[23] = t11;
|
|
153
|
-
} else t11 = $[23];
|
|
154
|
-
let t12;
|
|
155
|
-
if ($[24] !== hasItems) {
|
|
156
|
-
t12 = [hasItems];
|
|
157
|
-
$[24] = hasItems;
|
|
158
|
-
$[25] = t12;
|
|
159
|
-
} else t12 = $[25];
|
|
160
|
-
useLayoutEffect(t11, t12);
|
|
161
|
-
let t13;
|
|
162
|
-
if ($[26] !== width) {
|
|
163
|
-
t13 = () => {
|
|
164
|
-
if (!width) return;
|
|
165
|
-
rootRef.current?.querySelector(".k-carousel-wrapper")?.getBoundingClientRect();
|
|
166
|
-
setAnimate(true);
|
|
48
|
+
useLayoutEffect(() => {
|
|
49
|
+
navigationIndex.current = current;
|
|
50
|
+
}, [current]);
|
|
51
|
+
useLayoutEffect(() => {
|
|
52
|
+
const element = rootRef.current;
|
|
53
|
+
if (!element) return;
|
|
54
|
+
let measuredWidth = -1;
|
|
55
|
+
const update = () => {
|
|
56
|
+
const next_0 = element.offsetWidth;
|
|
57
|
+
if (next_0 === measuredWidth) return;
|
|
58
|
+
measuredWidth = next_0;
|
|
59
|
+
setAnimate(false);
|
|
60
|
+
setWidth(next_0);
|
|
167
61
|
};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
useLayoutEffect(t13, t14);
|
|
62
|
+
update();
|
|
63
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
|
|
64
|
+
observer?.observe(element);
|
|
65
|
+
return () => observer?.disconnect();
|
|
66
|
+
}, [hasItems]);
|
|
67
|
+
useLayoutEffect(() => {
|
|
68
|
+
if (!width) return;
|
|
69
|
+
rootRef.current?.querySelector(".k-carousel-wrapper")?.getBoundingClientRect();
|
|
70
|
+
setAnimate(true);
|
|
71
|
+
}, [width, hasItems]);
|
|
179
72
|
const [positionRevision, setPositionRevision] = useState(0);
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
if ($[32] !== positionRevision) {
|
|
192
|
-
t16 = [positionRevision];
|
|
193
|
-
$[32] = positionRevision;
|
|
194
|
-
$[33] = t16;
|
|
195
|
-
} else t16 = $[33];
|
|
196
|
-
useLayoutEffect(t15, t16);
|
|
197
|
-
let t17;
|
|
198
|
-
if ($[34] !== items.length || $[35] !== looping || $[36] !== value) {
|
|
199
|
-
t17 = {
|
|
200
|
-
value,
|
|
201
|
-
count: items.length,
|
|
202
|
-
looping
|
|
203
|
-
};
|
|
204
|
-
$[34] = items.length;
|
|
205
|
-
$[35] = looping;
|
|
206
|
-
$[36] = value;
|
|
207
|
-
$[37] = t17;
|
|
208
|
-
} else t17 = $[37];
|
|
209
|
-
const [syncedPosition, setSyncedPosition] = useState(t17);
|
|
73
|
+
useLayoutEffect(() => {
|
|
74
|
+
if (transitionTimerRef.current) clearTimeout(transitionTimerRef.current);
|
|
75
|
+
transitionTimerRef.current = null;
|
|
76
|
+
transitioningRef.current = false;
|
|
77
|
+
setSettleDuration(null);
|
|
78
|
+
}, [positionRevision]);
|
|
79
|
+
const [syncedPosition, setSyncedPosition] = useState({
|
|
80
|
+
value,
|
|
81
|
+
count: items.length,
|
|
82
|
+
looping
|
|
83
|
+
});
|
|
210
84
|
if (syncedPosition.value !== value || syncedPosition.count !== items.length || syncedPosition.looping !== looping) {
|
|
211
85
|
setSyncedPosition({
|
|
212
86
|
value,
|
|
@@ -217,485 +91,264 @@ var Carousel = forwardRef(function Carousel(t0, ref) {
|
|
|
217
91
|
if (next_1 !== innerIndex) setInnerIndex(next_1);
|
|
218
92
|
if (value !== reportedIndex || syncedPosition.count !== items.length || syncedPosition.looping !== looping) {
|
|
219
93
|
setPosition(looping ? next_1 + 1 : next_1);
|
|
220
|
-
setPositionRevision(
|
|
94
|
+
setPositionRevision((revision) => revision + 1);
|
|
221
95
|
}
|
|
222
96
|
setReportedIndex(null);
|
|
223
97
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
98
|
+
const goTo = useCallback((index) => {
|
|
99
|
+
setSettleDuration(null);
|
|
100
|
+
if (!items.length) return;
|
|
101
|
+
const next_2 = loop ? (index % items.length + items.length) % items.length : Math.max(0, Math.min(items.length - 1, index));
|
|
102
|
+
if (next_2 === navigationIndex.current) return;
|
|
103
|
+
if (transitionTimerRef.current) clearTimeout(transitionTimerRef.current);
|
|
104
|
+
transitionTimerRef.current = null;
|
|
105
|
+
transitioningRef.current = false;
|
|
106
|
+
navigationIndex.current = next_2;
|
|
107
|
+
setInnerIndex(next_2);
|
|
108
|
+
setReportedIndex(next_2);
|
|
109
|
+
setPosition(looping ? next_2 + 1 : next_2);
|
|
110
|
+
onChange?.(next_2);
|
|
111
|
+
}, [
|
|
112
|
+
items.length,
|
|
113
|
+
loop,
|
|
114
|
+
looping,
|
|
115
|
+
onChange,
|
|
116
|
+
setInnerIndex
|
|
117
|
+
]);
|
|
118
|
+
const move = useCallback((step) => {
|
|
119
|
+
if (!items.length || draggingRef.current) return;
|
|
120
|
+
const from = navigationIndex.current;
|
|
121
|
+
const next_3 = loop ? (from + step + items.length) % items.length : Math.max(0, Math.min(items.length - 1, from + step));
|
|
122
|
+
if (next_3 === from) {
|
|
123
|
+
if (timerRef.current) clearInterval(timerRef.current);
|
|
124
|
+
timerRef.current = null;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const interrupted = transitioningRef.current;
|
|
128
|
+
const target = interrupted && looping && rootRef.current ? retargetCarousel(rootRef.current, vertical, vertical ? height : width, items.length, next_3, step) : null;
|
|
129
|
+
if (interrupted) setSettleDuration(280);
|
|
130
|
+
setAnimate(true);
|
|
131
|
+
transitioningRef.current = true;
|
|
132
|
+
navigationIndex.current = next_3;
|
|
133
|
+
setInnerIndex(next_3);
|
|
134
|
+
setReportedIndex(next_3);
|
|
135
|
+
setPosition((previous) => target ?? (looping ? previous + step : next_3));
|
|
136
|
+
onChange?.(next_3);
|
|
137
|
+
if (transitionTimerRef.current) clearTimeout(transitionTimerRef.current);
|
|
138
|
+
transitionTimerRef.current = setTimeout(() => {
|
|
233
139
|
transitioningRef.current = false;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
};
|
|
240
|
-
$[38] = items.length;
|
|
241
|
-
$[39] = loop;
|
|
242
|
-
$[40] = looping;
|
|
243
|
-
$[41] = onChange;
|
|
244
|
-
$[42] = setInnerIndex;
|
|
245
|
-
$[43] = t18;
|
|
246
|
-
} else t18 = $[43];
|
|
247
|
-
const goTo = t18;
|
|
248
|
-
let t19;
|
|
249
|
-
if ($[44] !== height || $[45] !== items.length || $[46] !== loop || $[47] !== looping || $[48] !== onChange || $[49] !== setInnerIndex || $[50] !== vertical || $[51] !== width) {
|
|
250
|
-
t19 = (step) => {
|
|
251
|
-
if (!items.length || draggingRef.current) return;
|
|
252
|
-
const from = navigationIndex.current;
|
|
253
|
-
const next_3 = loop ? (from + step + items.length) % items.length : Math.max(0, Math.min(items.length - 1, from + step));
|
|
254
|
-
if (next_3 === from) {
|
|
255
|
-
if (timerRef.current) clearInterval(timerRef.current);
|
|
256
|
-
timerRef.current = null;
|
|
257
|
-
return;
|
|
140
|
+
transitionTimerRef.current = null;
|
|
141
|
+
if (looping) {
|
|
142
|
+
setAnimate(false);
|
|
143
|
+
setPosition(next_3 + 1);
|
|
144
|
+
requestAnimationFrame(() => setAnimate(true));
|
|
258
145
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
146
|
+
}, 501);
|
|
147
|
+
}, [
|
|
148
|
+
items.length,
|
|
149
|
+
loop,
|
|
150
|
+
looping,
|
|
151
|
+
onChange,
|
|
152
|
+
setInnerIndex,
|
|
153
|
+
vertical,
|
|
154
|
+
height,
|
|
155
|
+
width
|
|
156
|
+
]);
|
|
157
|
+
const stop = useCallback(() => {
|
|
158
|
+
if (timerRef.current) clearInterval(timerRef.current);
|
|
159
|
+
timerRef.current = null;
|
|
160
|
+
}, []);
|
|
161
|
+
const play = useCallback(() => {
|
|
162
|
+
stop();
|
|
163
|
+
if (autoplay && items.length > 1 && !draggingRef.current && !hoveredRef.current) timerRef.current = setInterval(() => move(1), delay);
|
|
164
|
+
}, [
|
|
165
|
+
autoplay,
|
|
166
|
+
delay,
|
|
167
|
+
items.length,
|
|
168
|
+
move,
|
|
169
|
+
stop
|
|
170
|
+
]);
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
play();
|
|
173
|
+
return stop;
|
|
174
|
+
}, [play, stop]);
|
|
175
|
+
useLayoutEffect(() => {
|
|
176
|
+
dragCallbacks.current = {
|
|
177
|
+
options: () => ({
|
|
178
|
+
swipeable,
|
|
179
|
+
vertical,
|
|
180
|
+
size: vertical ? height : width,
|
|
181
|
+
count: items.length,
|
|
182
|
+
index: current,
|
|
183
|
+
loop
|
|
184
|
+
}),
|
|
185
|
+
start: () => {
|
|
186
|
+
const offset = rootRef.current ? readCarouselOffset(rootRef.current, vertical, position, vertical ? height : width) : 0;
|
|
187
|
+
if (transitionTimerRef.current) clearTimeout(transitionTimerRef.current);
|
|
272
188
|
transitionTimerRef.current = null;
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
$[48] = onChange;
|
|
285
|
-
$[49] = setInnerIndex;
|
|
286
|
-
$[50] = vertical;
|
|
287
|
-
$[51] = width;
|
|
288
|
-
$[52] = t19;
|
|
289
|
-
} else t19 = $[52];
|
|
290
|
-
const move = t19;
|
|
291
|
-
let t20;
|
|
292
|
-
if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
|
|
293
|
-
t20 = () => {
|
|
294
|
-
if (timerRef.current) clearInterval(timerRef.current);
|
|
295
|
-
timerRef.current = null;
|
|
296
|
-
};
|
|
297
|
-
$[53] = t20;
|
|
298
|
-
} else t20 = $[53];
|
|
299
|
-
const stop = t20;
|
|
300
|
-
let t21;
|
|
301
|
-
if ($[54] !== autoplay || $[55] !== delay || $[56] !== items.length || $[57] !== move) {
|
|
302
|
-
t21 = () => {
|
|
303
|
-
stop();
|
|
304
|
-
if (autoplay && items.length > 1 && !draggingRef.current && !hoveredRef.current) timerRef.current = setInterval(() => move(1), delay);
|
|
305
|
-
};
|
|
306
|
-
$[54] = autoplay;
|
|
307
|
-
$[55] = delay;
|
|
308
|
-
$[56] = items.length;
|
|
309
|
-
$[57] = move;
|
|
310
|
-
$[58] = t21;
|
|
311
|
-
} else t21 = $[58];
|
|
312
|
-
const play = t21;
|
|
313
|
-
let t22;
|
|
314
|
-
let t23;
|
|
315
|
-
if ($[59] !== play) {
|
|
316
|
-
t22 = () => {
|
|
317
|
-
play();
|
|
318
|
-
return stop;
|
|
319
|
-
};
|
|
320
|
-
t23 = [play, stop];
|
|
321
|
-
$[59] = play;
|
|
322
|
-
$[60] = t22;
|
|
323
|
-
$[61] = t23;
|
|
324
|
-
} else {
|
|
325
|
-
t22 = $[60];
|
|
326
|
-
t23 = $[61];
|
|
327
|
-
}
|
|
328
|
-
useEffect(t22, t23);
|
|
329
|
-
let t24;
|
|
330
|
-
let t25;
|
|
331
|
-
if ($[62] !== current || $[63] !== height || $[64] !== items.length || $[65] !== loop || $[66] !== looping || $[67] !== move || $[68] !== play || $[69] !== position || $[70] !== swipeable || $[71] !== vertical || $[72] !== width) {
|
|
332
|
-
t24 = () => {
|
|
333
|
-
dragCallbacks.current = {
|
|
334
|
-
options: () => ({
|
|
335
|
-
swipeable,
|
|
336
|
-
vertical,
|
|
337
|
-
size: vertical ? height : width,
|
|
338
|
-
count: items.length,
|
|
339
|
-
index: current,
|
|
340
|
-
loop
|
|
341
|
-
}),
|
|
342
|
-
start: () => {
|
|
343
|
-
const offset = rootRef.current ? readCarouselOffset(rootRef.current, vertical, position, vertical ? height : width) : 0;
|
|
344
|
-
if (transitionTimerRef.current) clearTimeout(transitionTimerRef.current);
|
|
345
|
-
transitionTimerRef.current = null;
|
|
346
|
-
transitioningRef.current = false;
|
|
347
|
-
setPosition(looping ? current + 1 : current);
|
|
348
|
-
setSettleDuration(null);
|
|
349
|
-
draggingRef.current = true;
|
|
350
|
-
setIsDragging(true);
|
|
351
|
-
stop();
|
|
352
|
-
return offset;
|
|
353
|
-
},
|
|
354
|
-
offset: setDragOffset,
|
|
355
|
-
settle: setSettleDuration,
|
|
356
|
-
finish: (step_0) => {
|
|
357
|
-
draggingRef.current = false;
|
|
358
|
-
setIsDragging(false);
|
|
359
|
-
setAnimate(true);
|
|
360
|
-
if (step_0) move(step_0);
|
|
361
|
-
play();
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
};
|
|
365
|
-
t25 = [
|
|
366
|
-
swipeable,
|
|
367
|
-
vertical,
|
|
368
|
-
height,
|
|
369
|
-
width,
|
|
370
|
-
items.length,
|
|
371
|
-
current,
|
|
372
|
-
position,
|
|
373
|
-
looping,
|
|
374
|
-
loop,
|
|
375
|
-
stop,
|
|
376
|
-
move,
|
|
377
|
-
play
|
|
378
|
-
];
|
|
379
|
-
$[62] = current;
|
|
380
|
-
$[63] = height;
|
|
381
|
-
$[64] = items.length;
|
|
382
|
-
$[65] = loop;
|
|
383
|
-
$[66] = looping;
|
|
384
|
-
$[67] = move;
|
|
385
|
-
$[68] = play;
|
|
386
|
-
$[69] = position;
|
|
387
|
-
$[70] = swipeable;
|
|
388
|
-
$[71] = vertical;
|
|
389
|
-
$[72] = width;
|
|
390
|
-
$[73] = t24;
|
|
391
|
-
$[74] = t25;
|
|
392
|
-
} else {
|
|
393
|
-
t24 = $[73];
|
|
394
|
-
t25 = $[74];
|
|
395
|
-
}
|
|
396
|
-
useLayoutEffect(t24, t25);
|
|
397
|
-
let t26;
|
|
398
|
-
if ($[75] === Symbol.for("react.memo_cache_sentinel")) {
|
|
399
|
-
t26 = () => {
|
|
400
|
-
const root = rootRef.current;
|
|
401
|
-
if (!root) return;
|
|
402
|
-
const dispose = bindCarouselDrag(root, {
|
|
403
|
-
options: () => dragCallbacks.current.options(),
|
|
404
|
-
start: () => dragCallbacks.current.start(),
|
|
405
|
-
offset: (offset_0) => dragCallbacks.current.offset(offset_0),
|
|
406
|
-
settle: (duration) => dragCallbacks.current.settle?.(duration),
|
|
407
|
-
finish: (step_1) => dragCallbacks.current.finish(step_1)
|
|
408
|
-
});
|
|
409
|
-
return () => {
|
|
410
|
-
dispose();
|
|
189
|
+
transitioningRef.current = false;
|
|
190
|
+
setPosition(looping ? current + 1 : current);
|
|
191
|
+
setSettleDuration(null);
|
|
192
|
+
draggingRef.current = true;
|
|
193
|
+
setIsDragging(true);
|
|
194
|
+
stop();
|
|
195
|
+
return offset;
|
|
196
|
+
},
|
|
197
|
+
offset: setDragOffset,
|
|
198
|
+
settle: setSettleDuration,
|
|
199
|
+
finish: (step_0) => {
|
|
411
200
|
draggingRef.current = false;
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
if ($[76] !== hasItems) {
|
|
418
|
-
t27 = [hasItems];
|
|
419
|
-
$[76] = hasItems;
|
|
420
|
-
$[77] = t27;
|
|
421
|
-
} else t27 = $[77];
|
|
422
|
-
useEffect(t26, t27);
|
|
423
|
-
let t28;
|
|
424
|
-
let t29;
|
|
425
|
-
if ($[78] === Symbol.for("react.memo_cache_sentinel")) {
|
|
426
|
-
t28 = () => () => {
|
|
427
|
-
if (transitionTimerRef.current) clearTimeout(transitionTimerRef.current);
|
|
201
|
+
setIsDragging(false);
|
|
202
|
+
setAnimate(true);
|
|
203
|
+
if (step_0) move(step_0);
|
|
204
|
+
play();
|
|
205
|
+
}
|
|
428
206
|
};
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
207
|
+
}, [
|
|
208
|
+
swipeable,
|
|
209
|
+
vertical,
|
|
210
|
+
height,
|
|
211
|
+
width,
|
|
212
|
+
items.length,
|
|
213
|
+
current,
|
|
214
|
+
position,
|
|
215
|
+
looping,
|
|
216
|
+
loop,
|
|
217
|
+
stop,
|
|
218
|
+
move,
|
|
219
|
+
play
|
|
220
|
+
]);
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
const root = rootRef.current;
|
|
223
|
+
if (!root) return;
|
|
224
|
+
const dispose = bindCarouselDrag(root, {
|
|
225
|
+
options: () => dragCallbacks.current.options(),
|
|
226
|
+
start: () => dragCallbacks.current.start(),
|
|
227
|
+
offset: (offset_0) => dragCallbacks.current.offset(offset_0),
|
|
228
|
+
settle: (duration) => dragCallbacks.current.settle?.(duration),
|
|
229
|
+
finish: (step_1) => dragCallbacks.current.finish(step_1)
|
|
444
230
|
});
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
$[82] = t30;
|
|
449
|
-
$[83] = t31;
|
|
450
|
-
} else {
|
|
451
|
-
t30 = $[82];
|
|
452
|
-
t31 = $[83];
|
|
453
|
-
}
|
|
454
|
-
useImperativeHandle(ref, t30, t31);
|
|
455
|
-
if (!items.length) return null;
|
|
456
|
-
let t32;
|
|
457
|
-
if ($[84] !== items || $[85] !== looping) {
|
|
458
|
-
t32 = looping ? [
|
|
459
|
-
/* @__PURE__ */ jsx(Fragment, { children: items[items.length - 1] }, "clone-last"),
|
|
460
|
-
...items,
|
|
461
|
-
/* @__PURE__ */ jsx(Fragment, { children: items[0] }, "clone-first")
|
|
462
|
-
] : items;
|
|
463
|
-
$[84] = items;
|
|
464
|
-
$[85] = looping;
|
|
465
|
-
$[86] = t32;
|
|
466
|
-
} else t32 = $[86];
|
|
467
|
-
const trackItems = t32;
|
|
468
|
-
const t33 = vertical ? `translate3d(0, ${-position * height + dragOffset}px, 0)` : `translate3d(${-position * width + dragOffset}px, 0, 0)`;
|
|
469
|
-
const t34 = vertical ? void 0 : trackItems.length * width;
|
|
470
|
-
const t35 = vertical ? trackItems.length * height : height;
|
|
471
|
-
const t36 = animate && !isDragging ? settleDuration === null ? void 0 : `${settleDuration}ms` : "0s";
|
|
472
|
-
const t37 = settleDuration === null ? void 0 : "cubic-bezier(0.22, 1, 0.36, 1)";
|
|
473
|
-
const t38 = swipeable && items.length > 1 ? vertical ? "pan-x" : "pan-y" : void 0;
|
|
474
|
-
const t39 = isDragging ? "none" : void 0;
|
|
475
|
-
let t40;
|
|
476
|
-
if ($[87] !== t33 || $[88] !== t34 || $[89] !== t35 || $[90] !== t36 || $[91] !== t37 || $[92] !== t38 || $[93] !== t39) {
|
|
477
|
-
t40 = {
|
|
478
|
-
position: "relative",
|
|
479
|
-
transform: t33,
|
|
480
|
-
width: t34,
|
|
481
|
-
height: t35,
|
|
482
|
-
transitionDuration: t36,
|
|
483
|
-
transitionTimingFunction: t37,
|
|
484
|
-
touchAction: t38,
|
|
485
|
-
userSelect: t39
|
|
486
|
-
};
|
|
487
|
-
$[87] = t33;
|
|
488
|
-
$[88] = t34;
|
|
489
|
-
$[89] = t35;
|
|
490
|
-
$[90] = t36;
|
|
491
|
-
$[91] = t37;
|
|
492
|
-
$[92] = t38;
|
|
493
|
-
$[93] = t39;
|
|
494
|
-
$[94] = t40;
|
|
495
|
-
} else t40 = $[94];
|
|
496
|
-
const wrapperStyle = t40;
|
|
497
|
-
let t41;
|
|
498
|
-
if ($[95] !== current || $[96] !== looping || $[97] !== position) {
|
|
499
|
-
t41 = (event) => {
|
|
500
|
-
if (draggingRef.current) return;
|
|
501
|
-
if (event.target !== event.currentTarget || event.propertyName !== "transform") return;
|
|
502
|
-
setSettleDuration(null);
|
|
503
|
-
if (transitionTimerRef.current) clearTimeout(transitionTimerRef.current);
|
|
504
|
-
transitionTimerRef.current = null;
|
|
505
|
-
transitioningRef.current = false;
|
|
506
|
-
if (!looping || position === current + 1) return;
|
|
507
|
-
setAnimate(false);
|
|
508
|
-
setPosition(current + 1);
|
|
509
|
-
requestAnimationFrame(() => setAnimate(true));
|
|
231
|
+
return () => {
|
|
232
|
+
dispose();
|
|
233
|
+
draggingRef.current = false;
|
|
510
234
|
};
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
235
|
+
}, [hasItems]);
|
|
236
|
+
useEffect(() => () => {
|
|
237
|
+
if (transitionTimerRef.current) clearTimeout(transitionTimerRef.current);
|
|
238
|
+
}, []);
|
|
239
|
+
useImperativeHandle(ref, () => ({
|
|
240
|
+
next: () => move(1),
|
|
241
|
+
prev: () => move(-1),
|
|
242
|
+
goTo
|
|
243
|
+
}), [goTo, move]);
|
|
244
|
+
if (!items.length) return null;
|
|
245
|
+
const trackItems = looping ? [
|
|
246
|
+
/* @__PURE__ */ jsx(Fragment, { children: items[items.length - 1] }, "clone-last"),
|
|
247
|
+
...items,
|
|
248
|
+
/* @__PURE__ */ jsx(Fragment, { children: items[0] }, "clone-first")
|
|
249
|
+
] : items;
|
|
250
|
+
const wrapperStyle = {
|
|
251
|
+
position: "relative",
|
|
252
|
+
transform: vertical ? `translate3d(0, ${-position * height + dragOffset}px, 0)` : `translate3d(${-position * width + dragOffset}px, 0, 0)`,
|
|
253
|
+
width: vertical ? void 0 : trackItems.length * width,
|
|
254
|
+
height: vertical ? trackItems.length * height : height,
|
|
255
|
+
transitionDuration: animate && !isDragging ? settleDuration === null ? void 0 : `${settleDuration}ms` : "0s",
|
|
256
|
+
transitionTimingFunction: settleDuration === null ? void 0 : "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
257
|
+
touchAction: swipeable && items.length > 1 ? vertical ? "pan-x" : "pan-y" : void 0,
|
|
258
|
+
userSelect: isDragging ? "none" : void 0
|
|
259
|
+
};
|
|
260
|
+
const handleTransitionEnd = (event) => {
|
|
261
|
+
if (draggingRef.current) return;
|
|
262
|
+
if (event.target !== event.currentTarget || event.propertyName !== "transform") return;
|
|
263
|
+
setSettleDuration(null);
|
|
264
|
+
if (transitionTimerRef.current) clearTimeout(transitionTimerRef.current);
|
|
265
|
+
transitionTimerRef.current = null;
|
|
266
|
+
transitioningRef.current = false;
|
|
267
|
+
if (!looping || position === current + 1) return;
|
|
268
|
+
setAnimate(false);
|
|
269
|
+
setPosition(current + 1);
|
|
270
|
+
requestAnimationFrame(() => setAnimate(true));
|
|
271
|
+
};
|
|
272
|
+
return /* @__PURE__ */ jsx(CarouselContext.Provider, {
|
|
273
|
+
value: {
|
|
520
274
|
width,
|
|
521
275
|
height,
|
|
522
276
|
vertical
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
$[100] = vertical;
|
|
526
|
-
$[101] = width;
|
|
527
|
-
$[102] = t42;
|
|
528
|
-
} else t42 = $[102];
|
|
529
|
-
let t43;
|
|
530
|
-
if ($[103] !== className || $[104] !== vertical) {
|
|
531
|
-
t43 = clsx("k-carousel", { "k-carousel-vertical": vertical }, className);
|
|
532
|
-
$[103] = className;
|
|
533
|
-
$[104] = vertical;
|
|
534
|
-
$[105] = t43;
|
|
535
|
-
} else t43 = $[105];
|
|
536
|
-
let t44;
|
|
537
|
-
if ($[106] !== height || $[107] !== style) {
|
|
538
|
-
t44 = {
|
|
539
|
-
...style,
|
|
540
|
-
height
|
|
541
|
-
};
|
|
542
|
-
$[106] = height;
|
|
543
|
-
$[107] = style;
|
|
544
|
-
$[108] = t44;
|
|
545
|
-
} else t44 = $[108];
|
|
546
|
-
let t45;
|
|
547
|
-
if ($[109] !== onPointerEnter) {
|
|
548
|
-
t45 = (event_0) => {
|
|
549
|
-
if (event_0.pointerType === "mouse") {
|
|
550
|
-
hoveredRef.current = true;
|
|
551
|
-
stop();
|
|
552
|
-
}
|
|
553
|
-
onPointerEnter?.(event_0);
|
|
554
|
-
};
|
|
555
|
-
$[109] = onPointerEnter;
|
|
556
|
-
$[110] = t45;
|
|
557
|
-
} else t45 = $[110];
|
|
558
|
-
let t46;
|
|
559
|
-
if ($[111] !== onPointerLeave || $[112] !== play) {
|
|
560
|
-
t46 = (event_1) => {
|
|
561
|
-
if (event_1.pointerType === "mouse") {
|
|
562
|
-
hoveredRef.current = false;
|
|
563
|
-
play();
|
|
564
|
-
}
|
|
565
|
-
onPointerLeave?.(event_1);
|
|
566
|
-
};
|
|
567
|
-
$[111] = onPointerLeave;
|
|
568
|
-
$[112] = play;
|
|
569
|
-
$[113] = t46;
|
|
570
|
-
} else t46 = $[113];
|
|
571
|
-
let t47;
|
|
572
|
-
if ($[114] !== height || $[115] !== items || $[116] !== looping || $[117] !== vertical || $[118] !== width) {
|
|
573
|
-
t47 = looping && [-1, 1].map((side) => /* @__PURE__ */ jsx("div", {
|
|
574
|
-
"aria-hidden": "true",
|
|
575
|
-
inert: true,
|
|
576
|
-
style: {
|
|
577
|
-
position: "absolute",
|
|
578
|
-
display: "flex",
|
|
579
|
-
flexDirection: vertical ? "column" : "row",
|
|
580
|
-
left: vertical ? 0 : (side < 0 ? -items.length : items.length + 2) * width,
|
|
581
|
-
top: vertical ? (side < 0 ? -items.length : items.length + 2) * height : 0,
|
|
582
|
-
width: vertical ? "100%" : items.length * width,
|
|
583
|
-
pointerEvents: "none"
|
|
584
|
-
},
|
|
585
|
-
children: items.map((_, i) => /* @__PURE__ */ jsx(Fragment, { children: items[(i + (side < 0 ? items.length - 1 : 1)) % items.length] }, i))
|
|
586
|
-
}, side));
|
|
587
|
-
$[114] = height;
|
|
588
|
-
$[115] = items;
|
|
589
|
-
$[116] = looping;
|
|
590
|
-
$[117] = vertical;
|
|
591
|
-
$[118] = width;
|
|
592
|
-
$[119] = t47;
|
|
593
|
-
} else t47 = $[119];
|
|
594
|
-
let t48;
|
|
595
|
-
if ($[120] !== handleTransitionEnd || $[121] !== t47 || $[122] !== trackItems || $[123] !== wrapperStyle) {
|
|
596
|
-
t48 = /* @__PURE__ */ jsxs("div", {
|
|
597
|
-
className: "k-carousel-wrapper",
|
|
598
|
-
style: wrapperStyle,
|
|
599
|
-
onTransitionEnd: handleTransitionEnd,
|
|
600
|
-
children: [trackItems, t47]
|
|
601
|
-
});
|
|
602
|
-
$[120] = handleTransitionEnd;
|
|
603
|
-
$[121] = t47;
|
|
604
|
-
$[122] = trackItems;
|
|
605
|
-
$[123] = wrapperStyle;
|
|
606
|
-
$[124] = t48;
|
|
607
|
-
} else t48 = $[124];
|
|
608
|
-
let t49;
|
|
609
|
-
if ($[125] !== current || $[126] !== items.length || $[127] !== loop || $[128] !== move || $[129] !== vertical) {
|
|
610
|
-
t49 = !vertical && items.length > 1 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("button", {
|
|
611
|
-
type: "button",
|
|
612
|
-
className: "k-carousel-arrow-left",
|
|
613
|
-
"aria-label": "Previous slide",
|
|
614
|
-
disabled: !loop && current === 0,
|
|
615
|
-
onClick: () => move(-1),
|
|
616
|
-
children: /* @__PURE__ */ jsx(Icon, { type: ArrowLeft })
|
|
617
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
618
|
-
type: "button",
|
|
619
|
-
className: "k-carousel-arrow-right",
|
|
620
|
-
"aria-label": "Next slide",
|
|
621
|
-
disabled: !loop && current === items.length - 1,
|
|
622
|
-
onClick: () => move(1),
|
|
623
|
-
children: /* @__PURE__ */ jsx(Icon, { type: ArrowRight })
|
|
624
|
-
})] });
|
|
625
|
-
$[125] = current;
|
|
626
|
-
$[126] = items.length;
|
|
627
|
-
$[127] = loop;
|
|
628
|
-
$[128] = move;
|
|
629
|
-
$[129] = vertical;
|
|
630
|
-
$[130] = t49;
|
|
631
|
-
} else t49 = $[130];
|
|
632
|
-
let t50;
|
|
633
|
-
if ($[131] !== current || $[132] !== dots || $[133] !== goTo || $[134] !== items) {
|
|
634
|
-
t50 = dots && items.length > 1 && /* @__PURE__ */ jsx("div", {
|
|
635
|
-
className: "k-carousel-dots",
|
|
636
|
-
role: "tablist",
|
|
637
|
-
"aria-label": "Slides",
|
|
638
|
-
children: items.map((__0, index_0) => /* @__PURE__ */ jsx("button", {
|
|
639
|
-
type: "button",
|
|
640
|
-
className: current === index_0 ? "k-carousel-dots-active" : void 0,
|
|
641
|
-
"aria-label": `Go to slide ${index_0 + 1}`,
|
|
642
|
-
"aria-selected": current === index_0,
|
|
643
|
-
role: "tab",
|
|
644
|
-
onClick: () => goTo(index_0)
|
|
645
|
-
}, index_0))
|
|
646
|
-
});
|
|
647
|
-
$[131] = current;
|
|
648
|
-
$[132] = dots;
|
|
649
|
-
$[133] = goTo;
|
|
650
|
-
$[134] = items;
|
|
651
|
-
$[135] = t50;
|
|
652
|
-
} else t50 = $[135];
|
|
653
|
-
let t51;
|
|
654
|
-
if ($[136] !== onMouseEnter || $[137] !== onMouseLeave || $[138] !== rest || $[139] !== t43 || $[140] !== t44 || $[141] !== t45 || $[142] !== t46 || $[143] !== t48 || $[144] !== t49 || $[145] !== t50) {
|
|
655
|
-
t51 = /* @__PURE__ */ jsxs("div", {
|
|
277
|
+
},
|
|
278
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
656
279
|
...rest,
|
|
657
280
|
ref: rootRef,
|
|
658
|
-
className:
|
|
659
|
-
style:
|
|
281
|
+
className: clsx("k-carousel", { "k-carousel-vertical": vertical }, className),
|
|
282
|
+
style: {
|
|
283
|
+
...style,
|
|
284
|
+
height
|
|
285
|
+
},
|
|
660
286
|
onMouseEnter,
|
|
661
287
|
onMouseLeave,
|
|
662
|
-
onPointerEnter:
|
|
663
|
-
|
|
288
|
+
onPointerEnter: (event_0) => {
|
|
289
|
+
if (event_0.pointerType === "mouse") {
|
|
290
|
+
hoveredRef.current = true;
|
|
291
|
+
stop();
|
|
292
|
+
}
|
|
293
|
+
onPointerEnter?.(event_0);
|
|
294
|
+
},
|
|
295
|
+
onPointerLeave: (event_1) => {
|
|
296
|
+
if (event_1.pointerType === "mouse") {
|
|
297
|
+
hoveredRef.current = false;
|
|
298
|
+
play();
|
|
299
|
+
}
|
|
300
|
+
onPointerLeave?.(event_1);
|
|
301
|
+
},
|
|
664
302
|
children: [
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
303
|
+
/* @__PURE__ */ jsxs("div", {
|
|
304
|
+
className: "k-carousel-wrapper",
|
|
305
|
+
style: wrapperStyle,
|
|
306
|
+
onTransitionEnd: handleTransitionEnd,
|
|
307
|
+
children: [trackItems, looping && [-1, 1].map((side) => /* @__PURE__ */ jsx("div", {
|
|
308
|
+
"aria-hidden": "true",
|
|
309
|
+
inert: true,
|
|
310
|
+
style: {
|
|
311
|
+
position: "absolute",
|
|
312
|
+
display: "flex",
|
|
313
|
+
flexDirection: vertical ? "column" : "row",
|
|
314
|
+
left: vertical ? 0 : (side < 0 ? -items.length : items.length + 2) * width,
|
|
315
|
+
top: vertical ? (side < 0 ? -items.length : items.length + 2) * height : 0,
|
|
316
|
+
width: vertical ? "100%" : items.length * width,
|
|
317
|
+
pointerEvents: "none"
|
|
318
|
+
},
|
|
319
|
+
children: items.map((_, i) => /* @__PURE__ */ jsx(Fragment, { children: items[(i + (side < 0 ? items.length - 1 : 1)) % items.length] }, i))
|
|
320
|
+
}, side))]
|
|
321
|
+
}),
|
|
322
|
+
!vertical && items.length > 1 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("button", {
|
|
323
|
+
type: "button",
|
|
324
|
+
className: "k-carousel-arrow-left",
|
|
325
|
+
"aria-label": "Previous slide",
|
|
326
|
+
disabled: !loop && current === 0,
|
|
327
|
+
onClick: () => move(-1),
|
|
328
|
+
children: /* @__PURE__ */ jsx(Icon, { type: ArrowLeft })
|
|
329
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
330
|
+
type: "button",
|
|
331
|
+
className: "k-carousel-arrow-right",
|
|
332
|
+
"aria-label": "Next slide",
|
|
333
|
+
disabled: !loop && current === items.length - 1,
|
|
334
|
+
onClick: () => move(1),
|
|
335
|
+
children: /* @__PURE__ */ jsx(Icon, { type: ArrowRight })
|
|
336
|
+
})] }),
|
|
337
|
+
dots && items.length > 1 && /* @__PURE__ */ jsx("div", {
|
|
338
|
+
className: "k-carousel-dots",
|
|
339
|
+
role: "tablist",
|
|
340
|
+
"aria-label": "Slides",
|
|
341
|
+
children: items.map((__0, index_0) => /* @__PURE__ */ jsx("button", {
|
|
342
|
+
type: "button",
|
|
343
|
+
className: current === index_0 ? "k-carousel-dots-active" : void 0,
|
|
344
|
+
"aria-label": `Go to slide ${index_0 + 1}`,
|
|
345
|
+
"aria-selected": current === index_0,
|
|
346
|
+
role: "tab",
|
|
347
|
+
onClick: () => goTo(index_0)
|
|
348
|
+
}, index_0))
|
|
349
|
+
})
|
|
668
350
|
]
|
|
669
|
-
})
|
|
670
|
-
|
|
671
|
-
$[137] = onMouseLeave;
|
|
672
|
-
$[138] = rest;
|
|
673
|
-
$[139] = t43;
|
|
674
|
-
$[140] = t44;
|
|
675
|
-
$[141] = t45;
|
|
676
|
-
$[142] = t46;
|
|
677
|
-
$[143] = t48;
|
|
678
|
-
$[144] = t49;
|
|
679
|
-
$[145] = t50;
|
|
680
|
-
$[146] = t51;
|
|
681
|
-
} else t51 = $[146];
|
|
682
|
-
let t52;
|
|
683
|
-
if ($[147] !== t42 || $[148] !== t51) {
|
|
684
|
-
t52 = /* @__PURE__ */ jsx(CarouselContext.Provider, {
|
|
685
|
-
value: t42,
|
|
686
|
-
children: t51
|
|
687
|
-
});
|
|
688
|
-
$[147] = t42;
|
|
689
|
-
$[148] = t51;
|
|
690
|
-
$[149] = t52;
|
|
691
|
-
} else t52 = $[149];
|
|
692
|
-
return t52;
|
|
351
|
+
})
|
|
352
|
+
});
|
|
693
353
|
});
|
|
694
|
-
function _temp(next) {
|
|
695
|
-
return next ?? 0;
|
|
696
|
-
}
|
|
697
|
-
function _temp2(revision) {
|
|
698
|
-
return revision + 1;
|
|
699
|
-
}
|
|
700
|
-
//#endregion
|
|
701
354
|
export { Carousel as default };
|