@helpwave/hightide 0.1.26 → 0.1.28
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/dist/coloring/index.d.mts +2 -0
- package/dist/coloring/index.d.ts +2 -0
- package/dist/coloring/index.js +85 -0
- package/dist/coloring/index.js.map +1 -0
- package/dist/coloring/index.mjs +48 -0
- package/dist/coloring/index.mjs.map +1 -0
- package/dist/components/branding/index.d.mts +3 -0
- package/dist/components/branding/index.d.ts +3 -0
- package/dist/components/branding/index.js +140 -0
- package/dist/components/branding/index.js.map +1 -0
- package/dist/components/branding/index.mjs +104 -0
- package/dist/components/branding/index.mjs.map +1 -0
- package/dist/components/date/DatePicker.js +1 -1
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +1 -1
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +1 -1
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +1 -1
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/date/index.d.mts +10 -0
- package/dist/components/date/index.d.ts +10 -0
- package/dist/components/date/index.js +1168 -0
- package/dist/components/date/index.js.map +1 -0
- package/dist/components/date/index.mjs +1124 -0
- package/dist/components/date/index.mjs.map +1 -0
- package/dist/components/dialog/ConfirmDialog.d.mts +1 -1
- package/dist/components/dialog/ConfirmDialog.d.ts +1 -1
- package/dist/components/dialog/ConfirmDialog.js +2 -2
- package/dist/components/dialog/ConfirmDialog.js.map +1 -1
- package/dist/components/dialog/ConfirmDialog.mjs +2 -2
- package/dist/components/dialog/ConfirmDialog.mjs.map +1 -1
- package/dist/components/dialog/Dialog.d.mts +1 -1
- package/dist/components/dialog/Dialog.d.ts +1 -1
- package/dist/components/dialog/Dialog.js +2 -2
- package/dist/components/dialog/Dialog.js.map +1 -1
- package/dist/components/dialog/Dialog.mjs +2 -2
- package/dist/components/dialog/Dialog.mjs.map +1 -1
- package/dist/components/dialog/DiscardChangesDialog.d.mts +1 -1
- package/dist/components/dialog/DiscardChangesDialog.d.ts +1 -1
- package/dist/components/dialog/DiscardChangesDialog.js +2 -2
- package/dist/components/dialog/DiscardChangesDialog.js.map +1 -1
- package/dist/components/dialog/DiscardChangesDialog.mjs +2 -2
- package/dist/components/dialog/DiscardChangesDialog.mjs.map +1 -1
- package/dist/components/dialog/InputDialog.d.mts +1 -1
- package/dist/components/dialog/InputDialog.d.ts +1 -1
- package/dist/components/dialog/InputDialog.js +2 -2
- package/dist/components/dialog/InputDialog.js.map +1 -1
- package/dist/components/dialog/InputDialog.mjs +2 -2
- package/dist/components/dialog/InputDialog.mjs.map +1 -1
- package/dist/components/dialog/LanguageDialog.d.mts +1 -1
- package/dist/components/dialog/LanguageDialog.d.ts +1 -1
- package/dist/components/dialog/LanguageDialog.js +28 -15
- package/dist/components/dialog/LanguageDialog.js.map +1 -1
- package/dist/components/dialog/LanguageDialog.mjs +28 -15
- package/dist/components/dialog/LanguageDialog.mjs.map +1 -1
- package/dist/components/dialog/ThemeDialog.d.mts +1 -1
- package/dist/components/dialog/ThemeDialog.d.ts +1 -1
- package/dist/components/dialog/ThemeDialog.js +69 -33
- package/dist/components/dialog/ThemeDialog.js.map +1 -1
- package/dist/components/dialog/ThemeDialog.mjs +60 -24
- package/dist/components/dialog/ThemeDialog.mjs.map +1 -1
- package/dist/components/dialog/index.d.mts +1 -1
- package/dist/components/dialog/index.d.ts +1 -1
- package/dist/components/dialog/index.js +61 -25
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/dialog/index.mjs +61 -25
- package/dist/components/dialog/index.mjs.map +1 -1
- package/dist/components/form/index.d.mts +5 -0
- package/dist/components/form/index.d.ts +5 -0
- package/dist/components/form/index.js +100 -0
- package/dist/components/form/index.js.map +1 -0
- package/dist/components/form/index.mjs +64 -0
- package/dist/components/form/index.mjs.map +1 -0
- package/dist/components/icons-and-geometry/index.d.mts +7 -0
- package/dist/components/icons-and-geometry/index.d.ts +7 -0
- package/dist/components/icons-and-geometry/index.js +3955 -0
- package/dist/components/icons-and-geometry/index.js.map +1 -0
- package/dist/components/icons-and-geometry/index.mjs +3939 -0
- package/dist/components/icons-and-geometry/index.mjs.map +1 -0
- package/dist/components/index.d.mts +83 -0
- package/dist/components/index.d.ts +83 -0
- package/dist/components/index.js +15471 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +15377 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/components/layout/Carousel.d.mts +33 -0
- package/dist/components/layout/Carousel.d.ts +33 -0
- package/dist/components/layout/Carousel.js +684 -0
- package/dist/components/layout/Carousel.js.map +1 -0
- package/dist/components/layout/Carousel.mjs +659 -0
- package/dist/components/layout/Carousel.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/Chip.js +1 -1
- package/dist/components/layout/Chip.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/Chip.mjs +1 -1
- package/dist/components/layout/Chip.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/DividerInserter.js +1 -1
- package/dist/components/layout/DividerInserter.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/DividerInserter.mjs +1 -1
- package/dist/components/layout/DividerInserter.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/Expandable.js +2 -2
- package/dist/components/layout/Expandable.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/Expandable.mjs +2 -2
- package/dist/components/layout/Expandable.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/FAQSection.js +5 -5
- package/dist/components/layout/FAQSection.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/FAQSection.mjs +5 -5
- package/dist/components/layout/FAQSection.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/FloatingContainer.js +2 -2
- package/dist/components/layout/FloatingContainer.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/FloatingContainer.mjs +2 -2
- package/dist/components/layout/FloatingContainer.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/ListBox.js +2 -2
- package/dist/components/layout/ListBox.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/ListBox.mjs +2 -2
- package/dist/components/layout/ListBox.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/MarkdownInterpreter.js +1 -1
- package/dist/components/layout/MarkdownInterpreter.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/MarkdownInterpreter.mjs +1 -1
- package/dist/components/layout/MarkdownInterpreter.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/ScrollArea.js +2 -2
- package/dist/components/layout/ScrollArea.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/ScrollArea.mjs +1 -1
- package/dist/components/layout/ScrollArea.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/TextImage.js +3 -3
- package/dist/components/layout/TextImage.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/TextImage.mjs +2 -2
- package/dist/components/layout/TextImage.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/VerticalDivider.js +1 -1
- package/dist/components/layout/VerticalDivider.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/VerticalDivider.mjs +1 -1
- package/dist/components/layout/VerticalDivider.mjs.map +1 -0
- package/dist/components/layout/index.d.mts +18 -0
- package/dist/components/layout/index.d.ts +18 -0
- package/dist/components/layout/index.js +3111 -0
- package/dist/components/layout/index.js.map +1 -0
- package/dist/components/layout/index.mjs +3064 -0
- package/dist/components/layout/index.mjs.map +1 -0
- package/dist/components/loading-states/index.d.mts +12 -0
- package/dist/components/loading-states/index.d.ts +12 -0
- package/dist/components/loading-states/index.js +614 -0
- package/dist/components/loading-states/index.js.map +1 -0
- package/dist/components/loading-states/index.mjs +573 -0
- package/dist/components/loading-states/index.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → navigation}/BreadCrumb.js +1 -1
- package/dist/components/navigation/BreadCrumb.js.map +1 -0
- package/dist/components/{layout-and-navigation → navigation}/BreadCrumb.mjs +1 -1
- package/dist/components/navigation/BreadCrumb.mjs.map +1 -0
- package/dist/components/navigation/Navigation.d.mts +21 -0
- package/dist/components/navigation/Navigation.d.ts +21 -0
- package/dist/components/navigation/Navigation.js +4018 -0
- package/dist/components/navigation/Navigation.js.map +1 -0
- package/dist/components/navigation/Navigation.mjs +4012 -0
- package/dist/components/navigation/Navigation.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → navigation}/Pagination.js +3 -3
- package/dist/components/navigation/Pagination.js.map +1 -0
- package/dist/components/{layout-and-navigation → navigation}/Pagination.mjs +3 -3
- package/dist/components/navigation/Pagination.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → navigation}/StepperBar.js +3 -3
- package/dist/components/navigation/StepperBar.js.map +1 -0
- package/dist/components/{layout-and-navigation → navigation}/StepperBar.mjs +3 -3
- package/dist/components/navigation/StepperBar.mjs.map +1 -0
- package/dist/components/navigation/index.d.mts +9 -0
- package/dist/components/navigation/index.d.ts +9 -0
- package/dist/components/navigation/index.js +4660 -0
- package/dist/components/navigation/index.js.map +1 -0
- package/dist/components/navigation/index.mjs +4648 -0
- package/dist/components/navigation/index.mjs.map +1 -0
- package/dist/components/properties/MultiSelectProperty.js +27 -14
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +27 -14
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.js +27 -14
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +27 -14
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/index.d.mts +12 -0
- package/dist/components/properties/index.d.ts +12 -0
- package/dist/components/properties/index.js +2983 -0
- package/dist/components/properties/index.js.map +1 -0
- package/dist/components/properties/index.mjs +2951 -0
- package/dist/components/properties/index.mjs.map +1 -0
- package/dist/components/table/Table.js +1 -1
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +1 -1
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/index.d.mts +10 -0
- package/dist/components/table/index.d.ts +10 -0
- package/dist/components/table/index.js +2329 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/table/index.mjs +2293 -0
- package/dist/components/table/index.mjs.map +1 -0
- package/dist/components/user-action/DateAndTimePicker.js +1 -1
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/index.d.mts +30 -0
- package/dist/components/user-action/index.d.ts +30 -0
- package/dist/components/user-action/index.js +4257 -0
- package/dist/components/user-action/index.js.map +1 -0
- package/dist/components/user-action/index.mjs +4195 -0
- package/dist/components/user-action/index.mjs.map +1 -0
- package/dist/components/user-action/input/index.d.mts +6 -0
- package/dist/components/user-action/input/index.d.ts +6 -0
- package/dist/components/user-action/input/index.js +398 -0
- package/dist/components/user-action/input/index.js.map +1 -0
- package/dist/components/user-action/input/index.mjs +357 -0
- package/dist/components/user-action/input/index.mjs.map +1 -0
- package/dist/components/user-action/select/Select.d.mts +5 -1
- package/dist/components/user-action/select/Select.d.ts +5 -1
- package/dist/components/user-action/select/Select.js +27 -14
- package/dist/components/user-action/select/Select.js.map +1 -1
- package/dist/components/user-action/select/Select.mjs +27 -14
- package/dist/components/user-action/select/Select.mjs.map +1 -1
- package/dist/components/user-action/select/index.d.mts +4 -0
- package/dist/components/user-action/select/index.d.ts +4 -0
- package/dist/components/user-action/select/index.js +1369 -0
- package/dist/components/user-action/select/index.js.map +1 -0
- package/dist/components/user-action/select/index.mjs +1333 -0
- package/dist/components/user-action/select/index.mjs.map +1 -0
- package/dist/components/utils/index.d.mts +4 -0
- package/dist/components/utils/index.d.ts +4 -0
- package/dist/components/utils/index.js +302 -0
- package/dist/components/utils/index.js.map +1 -0
- package/dist/components/utils/index.mjs +275 -0
- package/dist/components/utils/index.mjs.map +1 -0
- package/dist/hooks/focus/index.d.mts +6 -0
- package/dist/hooks/focus/index.d.ts +6 -0
- package/dist/hooks/focus/index.js +379 -0
- package/dist/hooks/focus/index.js.map +1 -0
- package/dist/hooks/focus/index.mjs +339 -0
- package/dist/hooks/focus/index.mjs.map +1 -0
- package/dist/hooks/index.d.mts +16 -0
- package/dist/hooks/index.d.ts +16 -0
- package/dist/hooks/index.js +844 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +794 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +110 -0
- package/dist/index.d.ts +110 -0
- package/dist/index.js +16101 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +15941 -0
- package/dist/index.mjs.map +1 -0
- package/dist/localization/defaults/index.d.mts +4 -0
- package/dist/localization/defaults/index.d.ts +4 -0
- package/dist/localization/defaults/index.js +223 -0
- package/dist/localization/defaults/index.js.map +1 -0
- package/dist/localization/defaults/index.mjs +195 -0
- package/dist/localization/defaults/index.mjs.map +1 -0
- package/dist/localization/index.d.mts +7 -0
- package/dist/localization/index.d.ts +7 -0
- package/dist/localization/index.js +415 -0
- package/dist/localization/index.js.map +1 -0
- package/dist/localization/index.mjs +380 -0
- package/dist/localization/index.mjs.map +1 -0
- package/dist/style/globals.css +63 -10
- package/dist/style/uncompiled/globals.css +5 -4
- package/dist/style/uncompiled/utitlity/shadow.css +4 -0
- package/dist/theming/index.d.mts +5 -0
- package/dist/theming/index.d.ts +5 -0
- package/dist/theming/index.js +174 -0
- package/dist/theming/index.js.map +1 -0
- package/dist/theming/index.mjs +145 -0
- package/dist/theming/index.mjs.map +1 -0
- package/dist/theming/useTheme.d.mts +3 -1
- package/dist/theming/useTheme.d.ts +3 -1
- package/dist/theming/useTheme.js +40 -17
- package/dist/theming/useTheme.js.map +1 -1
- package/dist/theming/useTheme.mjs +38 -15
- package/dist/theming/useTheme.mjs.map +1 -1
- package/dist/utils/index.d.mts +15 -0
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.js +553 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +493 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +25 -24
- package/dist/components/layout-and-navigation/BreadCrumb.js.map +0 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs.map +0 -1
- package/dist/components/layout-and-navigation/Carousel.d.mts +0 -25
- package/dist/components/layout-and-navigation/Carousel.d.ts +0 -25
- package/dist/components/layout-and-navigation/Carousel.js +0 -643
- package/dist/components/layout-and-navigation/Carousel.js.map +0 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +0 -609
- package/dist/components/layout-and-navigation/Carousel.mjs.map +0 -1
- package/dist/components/layout-and-navigation/Chip.js.map +0 -1
- package/dist/components/layout-and-navigation/Chip.mjs.map +0 -1
- package/dist/components/layout-and-navigation/DividerInserter.js.map +0 -1
- package/dist/components/layout-and-navigation/DividerInserter.mjs.map +0 -1
- package/dist/components/layout-and-navigation/Expandable.js.map +0 -1
- package/dist/components/layout-and-navigation/Expandable.mjs.map +0 -1
- package/dist/components/layout-and-navigation/FAQSection.js.map +0 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs.map +0 -1
- package/dist/components/layout-and-navigation/FloatingContainer.js.map +0 -1
- package/dist/components/layout-and-navigation/FloatingContainer.mjs.map +0 -1
- package/dist/components/layout-and-navigation/ListBox.js.map +0 -1
- package/dist/components/layout-and-navigation/ListBox.mjs.map +0 -1
- package/dist/components/layout-and-navigation/MarkdownInterpreter.js.map +0 -1
- package/dist/components/layout-and-navigation/MarkdownInterpreter.mjs.map +0 -1
- package/dist/components/layout-and-navigation/Pagination.js.map +0 -1
- package/dist/components/layout-and-navigation/Pagination.mjs.map +0 -1
- package/dist/components/layout-and-navigation/ScrollArea.js.map +0 -1
- package/dist/components/layout-and-navigation/ScrollArea.mjs.map +0 -1
- package/dist/components/layout-and-navigation/StepperBar.js.map +0 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +0 -1
- package/dist/components/layout-and-navigation/TextImage.js.map +0 -1
- package/dist/components/layout-and-navigation/TextImage.mjs.map +0 -1
- package/dist/components/layout-and-navigation/VerticalDivider.js.map +0 -1
- package/dist/components/layout-and-navigation/VerticalDivider.mjs.map +0 -1
- /package/dist/components/{layout-and-navigation → layout}/Chip.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/Chip.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/DividerInserter.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/DividerInserter.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/Expandable.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/Expandable.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/FAQSection.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/FAQSection.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/FloatingContainer.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/FloatingContainer.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/ListBox.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/ListBox.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/MarkdownInterpreter.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/MarkdownInterpreter.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/ScrollArea.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/ScrollArea.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/TextImage.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/TextImage.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/VerticalDivider.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/VerticalDivider.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → navigation}/BreadCrumb.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → navigation}/BreadCrumb.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → navigation}/Pagination.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → navigation}/Pagination.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → navigation}/StepperBar.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → navigation}/StepperBar.d.ts +0 -0
|
@@ -1,609 +0,0 @@
|
|
|
1
|
-
// src/components/layout-and-navigation/Carousel.tsx
|
|
2
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import clsx2 from "clsx";
|
|
4
|
-
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
5
|
-
|
|
6
|
-
// src/utils/array.ts
|
|
7
|
-
var defaultRangeOptions = {
|
|
8
|
-
allowEmptyRange: false,
|
|
9
|
-
stepSize: 1,
|
|
10
|
-
exclusiveStart: false,
|
|
11
|
-
exclusiveEnd: true
|
|
12
|
-
};
|
|
13
|
-
var range = (endOrRange, options) => {
|
|
14
|
-
const { allowEmptyRange, stepSize, exclusiveStart, exclusiveEnd } = { ...defaultRangeOptions, ...options };
|
|
15
|
-
let start = 0;
|
|
16
|
-
let end;
|
|
17
|
-
if (typeof endOrRange === "number") {
|
|
18
|
-
end = endOrRange;
|
|
19
|
-
} else {
|
|
20
|
-
start = endOrRange[0];
|
|
21
|
-
end = endOrRange[1];
|
|
22
|
-
}
|
|
23
|
-
if (!exclusiveEnd) {
|
|
24
|
-
end -= 1;
|
|
25
|
-
}
|
|
26
|
-
if (exclusiveStart) {
|
|
27
|
-
start += 1;
|
|
28
|
-
}
|
|
29
|
-
if (end - 1 < start) {
|
|
30
|
-
if (!allowEmptyRange) {
|
|
31
|
-
console.warn(`range: end (${end}) < start (${start}) should be allowed explicitly, set options.allowEmptyRange to true`);
|
|
32
|
-
}
|
|
33
|
-
return [];
|
|
34
|
-
}
|
|
35
|
-
return Array.from({ length: end - start }, (_, index) => index * stepSize + start);
|
|
36
|
-
};
|
|
37
|
-
var createLoopingListWithIndex = (list, startIndex = 0, length = 0, forwards = true) => {
|
|
38
|
-
if (length < 0) {
|
|
39
|
-
console.warn(`createLoopingList: length must be >= 0, given ${length}`);
|
|
40
|
-
} else if (length === 0) {
|
|
41
|
-
length = list.length;
|
|
42
|
-
}
|
|
43
|
-
const returnList = [];
|
|
44
|
-
if (forwards) {
|
|
45
|
-
for (let i = startIndex; returnList.length < length; i = (i + 1) % list.length) {
|
|
46
|
-
returnList.push([i, list[i]]);
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
for (let i = startIndex; returnList.length < length; i = i === 0 ? i = list.length - 1 : i - 1) {
|
|
50
|
-
returnList.push([i, list[i]]);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return returnList;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// src/utils/math.ts
|
|
57
|
-
var clamp = (value, range2 = [0, 1]) => {
|
|
58
|
-
const [min, max] = range2;
|
|
59
|
-
return Math.min(Math.max(value, min), max);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// src/utils/easeFunctions.ts
|
|
63
|
-
var EaseFunctions = class _EaseFunctions {
|
|
64
|
-
static cubicBezierGeneric(x1, y1, x2, y2) {
|
|
65
|
-
const cx = 3 * x1;
|
|
66
|
-
const bx = 3 * (x2 - x1) - cx;
|
|
67
|
-
const ax = 1 - cx - bx;
|
|
68
|
-
const cy = 3 * y1;
|
|
69
|
-
const by = 3 * (y2 - y1) - cy;
|
|
70
|
-
const ay = 1 - cy - by;
|
|
71
|
-
const x = (t) => ((ax * t + bx) * t + cx) * t;
|
|
72
|
-
const y = (t) => ((ay * t + by) * t + cy) * t;
|
|
73
|
-
return {
|
|
74
|
-
x,
|
|
75
|
-
y
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
static cubicBezier(x1, y1, x2, y2) {
|
|
79
|
-
const { y } = _EaseFunctions.cubicBezierGeneric(x1, y1, x2, y2);
|
|
80
|
-
return (t) => {
|
|
81
|
-
t = clamp(t);
|
|
82
|
-
return y(t);
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
static easeInEaseOut(t) {
|
|
86
|
-
return _EaseFunctions.cubicBezier(0.65, 0, 0.35, 1)(t);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// src/utils/loopingArray.ts
|
|
91
|
-
var LoopingArrayCalculator = class _LoopingArrayCalculator {
|
|
92
|
-
constructor(length, isLooping = true, allowedOverScroll = 0.1) {
|
|
93
|
-
if (allowedOverScroll < 0 || length < 1) {
|
|
94
|
-
throw new Error("Invalid parameters: allowedOverScroll >= 0 and length >= 1 must be true");
|
|
95
|
-
}
|
|
96
|
-
this.length = length;
|
|
97
|
-
this.isLooping = isLooping;
|
|
98
|
-
this.allowedOverScroll = allowedOverScroll;
|
|
99
|
-
}
|
|
100
|
-
getCorrectedPosition(position) {
|
|
101
|
-
if (!this.isLooping) {
|
|
102
|
-
return Math.max(-this.allowedOverScroll, Math.min(this.allowedOverScroll + this.length - 1, position));
|
|
103
|
-
}
|
|
104
|
-
if (position >= this.length) {
|
|
105
|
-
return position % this.length;
|
|
106
|
-
}
|
|
107
|
-
if (position < 0) {
|
|
108
|
-
return this.length - Math.abs(position) % this.length;
|
|
109
|
-
}
|
|
110
|
-
return position;
|
|
111
|
-
}
|
|
112
|
-
static withoutOffset(position) {
|
|
113
|
-
return position + _LoopingArrayCalculator.getOffset(position);
|
|
114
|
-
}
|
|
115
|
-
static getOffset(position) {
|
|
116
|
-
return Math.round(position) - position;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* @return absolute distance forwards or Infinity when the target cannot be reached (only possible when not isLooping)
|
|
120
|
-
*/
|
|
121
|
-
getDistanceDirectional(position, target, direction) {
|
|
122
|
-
if (!this.isLooping && (position < -this.allowedOverScroll || position > this.allowedOverScroll + this.length - 1)) {
|
|
123
|
-
throw new Error("Invalid parameters: position is out of bounds.");
|
|
124
|
-
}
|
|
125
|
-
const isForwardInvalid = direction === 1 && position > target;
|
|
126
|
-
const isBackwardInvalid = direction === -1 && target < position;
|
|
127
|
-
if (!this.isLooping && (isForwardInvalid || isBackwardInvalid)) {
|
|
128
|
-
return Infinity;
|
|
129
|
-
}
|
|
130
|
-
if (direction === -1) {
|
|
131
|
-
return this.getDistanceDirectional(target, position, 1);
|
|
132
|
-
}
|
|
133
|
-
position = this.getCorrectedPosition(position);
|
|
134
|
-
target = this.getCorrectedPosition(target);
|
|
135
|
-
let distance = (target - position) * direction;
|
|
136
|
-
if (distance < 0) {
|
|
137
|
-
distance = this.length - Math.abs(position) % this.length + target;
|
|
138
|
-
}
|
|
139
|
-
return distance;
|
|
140
|
-
}
|
|
141
|
-
getDistanceForward(position, target) {
|
|
142
|
-
return this.getDistanceDirectional(position, target, 1);
|
|
143
|
-
}
|
|
144
|
-
getDistanceBackward(position, target) {
|
|
145
|
-
return this.getDistanceDirectional(position, target, -1);
|
|
146
|
-
}
|
|
147
|
-
getDistance(position, target) {
|
|
148
|
-
const forwardDistance = this.getDistanceForward(position, target);
|
|
149
|
-
const backwardDistance = this.getDistanceBackward(position, target);
|
|
150
|
-
return Math.min(forwardDistance, backwardDistance);
|
|
151
|
-
}
|
|
152
|
-
getBestDirection(position, target) {
|
|
153
|
-
const forwardDistance = this.getDistanceForward(position, target);
|
|
154
|
-
const backwardDistance = this.getDistanceBackward(position, target);
|
|
155
|
-
return forwardDistance < backwardDistance ? 1 : -1;
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
// src/components/user-action/Button.tsx
|
|
160
|
-
import { forwardRef } from "react";
|
|
161
|
-
import clsx from "clsx";
|
|
162
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
163
|
-
var ButtonColorUtil = {
|
|
164
|
-
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
165
|
-
text: ["primary", "negative", "neutral"],
|
|
166
|
-
outline: ["primary"]
|
|
167
|
-
};
|
|
168
|
-
var IconButtonUtil = {
|
|
169
|
-
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
170
|
-
};
|
|
171
|
-
var paddingMapping = {
|
|
172
|
-
small: "btn-sm",
|
|
173
|
-
medium: "btn-md",
|
|
174
|
-
large: "btn-lg"
|
|
175
|
-
};
|
|
176
|
-
var iconPaddingMapping = {
|
|
177
|
-
tiny: "icon-btn-xs",
|
|
178
|
-
small: "icon-btn-sm",
|
|
179
|
-
medium: "icon-btn-md",
|
|
180
|
-
large: "icon-btn-lg"
|
|
181
|
-
};
|
|
182
|
-
var ButtonUtil = {
|
|
183
|
-
paddingMapping,
|
|
184
|
-
iconPaddingMapping
|
|
185
|
-
};
|
|
186
|
-
var SolidButton = forwardRef(function SolidButton2({
|
|
187
|
-
children,
|
|
188
|
-
color = "primary",
|
|
189
|
-
size = "medium",
|
|
190
|
-
startIcon,
|
|
191
|
-
endIcon,
|
|
192
|
-
onClick,
|
|
193
|
-
className,
|
|
194
|
-
...restProps
|
|
195
|
-
}, ref) {
|
|
196
|
-
const colorClasses = {
|
|
197
|
-
primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
|
|
198
|
-
secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
|
|
199
|
-
tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
|
|
200
|
-
positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
|
|
201
|
-
warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
|
|
202
|
-
negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
|
|
203
|
-
neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text"
|
|
204
|
-
}[color];
|
|
205
|
-
const iconColorClasses = {
|
|
206
|
-
primary: "not-group-disabled:text-button-solid-primary-icon",
|
|
207
|
-
secondary: "not-group-disabled:text-button-solid-secondary-icon",
|
|
208
|
-
tertiary: "not-group-disabled:text-button-solid-tertiary-icon",
|
|
209
|
-
positive: "not-group-disabled:text-button-solid-positive-icon",
|
|
210
|
-
warning: "not-group-disabled:text-button-solid-warning-icon",
|
|
211
|
-
negative: "not-group-disabled:text-button-solid-negative-icon",
|
|
212
|
-
neutral: "not-group-disabled:text-button-solid-neutral-icon"
|
|
213
|
-
}[color];
|
|
214
|
-
return /* @__PURE__ */ jsxs(
|
|
215
|
-
"button",
|
|
216
|
-
{
|
|
217
|
-
ref,
|
|
218
|
-
onClick,
|
|
219
|
-
className: clsx(
|
|
220
|
-
"group font-semibold",
|
|
221
|
-
colorClasses,
|
|
222
|
-
"not-disabled:hover:brightness-90",
|
|
223
|
-
"disabled:text-disabled-text disabled:bg-disabled-background",
|
|
224
|
-
ButtonUtil.paddingMapping[size],
|
|
225
|
-
className
|
|
226
|
-
),
|
|
227
|
-
...restProps,
|
|
228
|
-
children: [
|
|
229
|
-
startIcon && /* @__PURE__ */ jsx(
|
|
230
|
-
"span",
|
|
231
|
-
{
|
|
232
|
-
className: clsx(
|
|
233
|
-
iconColorClasses,
|
|
234
|
-
"group-disabled:text-disabled-icon"
|
|
235
|
-
),
|
|
236
|
-
children: startIcon
|
|
237
|
-
}
|
|
238
|
-
),
|
|
239
|
-
children,
|
|
240
|
-
endIcon && /* @__PURE__ */ jsx(
|
|
241
|
-
"span",
|
|
242
|
-
{
|
|
243
|
-
className: clsx(
|
|
244
|
-
iconColorClasses,
|
|
245
|
-
"group-disabled:text-disabled-icon"
|
|
246
|
-
),
|
|
247
|
-
children: endIcon
|
|
248
|
-
}
|
|
249
|
-
)
|
|
250
|
-
]
|
|
251
|
-
}
|
|
252
|
-
);
|
|
253
|
-
});
|
|
254
|
-
var IconButton = forwardRef(function IconButton2({
|
|
255
|
-
children,
|
|
256
|
-
color = "primary",
|
|
257
|
-
size = "medium",
|
|
258
|
-
className,
|
|
259
|
-
...restProps
|
|
260
|
-
}, ref) {
|
|
261
|
-
const colorClasses = {
|
|
262
|
-
primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
|
|
263
|
-
secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
|
|
264
|
-
tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
|
|
265
|
-
positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
|
|
266
|
-
warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
|
|
267
|
-
negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
|
|
268
|
-
neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text",
|
|
269
|
-
transparent: "not-disabled:bg-transparent"
|
|
270
|
-
}[color];
|
|
271
|
-
return /* @__PURE__ */ jsx(
|
|
272
|
-
"button",
|
|
273
|
-
{
|
|
274
|
-
ref,
|
|
275
|
-
className: clsx(
|
|
276
|
-
colorClasses,
|
|
277
|
-
"not-disabled:hover:brightness-90",
|
|
278
|
-
"disabled:text-disabled-text",
|
|
279
|
-
{
|
|
280
|
-
"disabled:bg-disabled-background": color !== "transparent",
|
|
281
|
-
"disabled:opacity-70": color === "transparent",
|
|
282
|
-
"not-disabled:hover:bg-button-text-hover-background": color === "transparent"
|
|
283
|
-
},
|
|
284
|
-
ButtonUtil.iconPaddingMapping[size],
|
|
285
|
-
className
|
|
286
|
-
),
|
|
287
|
-
...restProps,
|
|
288
|
-
children
|
|
289
|
-
}
|
|
290
|
-
);
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
// src/components/layout-and-navigation/Carousel.tsx
|
|
294
|
-
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
295
|
-
var Carousel = ({
|
|
296
|
-
children,
|
|
297
|
-
animationTime = 200,
|
|
298
|
-
isLooping = false,
|
|
299
|
-
isAutoLooping = false,
|
|
300
|
-
autoLoopingTimeOut = 5e3,
|
|
301
|
-
autoLoopAnimationTime = 500,
|
|
302
|
-
hintNext = false,
|
|
303
|
-
arrows = false,
|
|
304
|
-
dots = true,
|
|
305
|
-
overScrollThreshold = 0.1,
|
|
306
|
-
blurColor = "from-background",
|
|
307
|
-
className = "",
|
|
308
|
-
heightClassName = "h-96",
|
|
309
|
-
widthClassName = "w-[70%] desktop:w-1/2"
|
|
310
|
-
}) => {
|
|
311
|
-
if (isAutoLooping && !isLooping) {
|
|
312
|
-
console.error("When isAutoLooping is true, isLooping should also be true");
|
|
313
|
-
isLooping = true;
|
|
314
|
-
}
|
|
315
|
-
const [{
|
|
316
|
-
currentPosition,
|
|
317
|
-
dragState,
|
|
318
|
-
animationState
|
|
319
|
-
}, setCarouselInformation] = useState({
|
|
320
|
-
currentPosition: 0
|
|
321
|
-
});
|
|
322
|
-
const animationId = useRef(void 0);
|
|
323
|
-
const timeOut = useRef(void 0);
|
|
324
|
-
autoLoopingTimeOut = Math.max(0, autoLoopingTimeOut);
|
|
325
|
-
const length = children.length;
|
|
326
|
-
const paddingItemCount = 3;
|
|
327
|
-
const util = useMemo(() => new LoopingArrayCalculator(length, isLooping, overScrollThreshold), [length, isLooping, overScrollThreshold]);
|
|
328
|
-
const currentIndex = util.getCorrectedPosition(LoopingArrayCalculator.withoutOffset(currentPosition));
|
|
329
|
-
animationTime = Math.max(200, animationTime);
|
|
330
|
-
autoLoopAnimationTime = Math.max(200, autoLoopAnimationTime);
|
|
331
|
-
const getStyleOffset = (index) => {
|
|
332
|
-
const baseOffset = -50 + (index - currentPosition) * 100;
|
|
333
|
-
return `${baseOffset}%`;
|
|
334
|
-
};
|
|
335
|
-
const animation = useCallback((time) => {
|
|
336
|
-
let keepAnimating = true;
|
|
337
|
-
setCarouselInformation((state) => {
|
|
338
|
-
const {
|
|
339
|
-
animationState: animationState2,
|
|
340
|
-
dragState: dragState2
|
|
341
|
-
} = state;
|
|
342
|
-
if (animationState2 === void 0 || dragState2 !== void 0) {
|
|
343
|
-
keepAnimating = false;
|
|
344
|
-
return state;
|
|
345
|
-
}
|
|
346
|
-
if (!animationState2.startTime || !animationState2.lastUpdateTime) {
|
|
347
|
-
return {
|
|
348
|
-
...state,
|
|
349
|
-
animationState: {
|
|
350
|
-
...animationState2,
|
|
351
|
-
startTime: time,
|
|
352
|
-
lastUpdateTime: time
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
const useAnimationTime = animationState2.isAutoLooping ? autoLoopAnimationTime : animationTime;
|
|
357
|
-
const progress = clamp((time - animationState2.startTime) / useAnimationTime);
|
|
358
|
-
const easedProgress = EaseFunctions.easeInEaseOut(progress);
|
|
359
|
-
const distance = util.getDistanceDirectional(animationState2.startPosition, animationState2.targetPosition, animationState2.direction);
|
|
360
|
-
const newPosition = util.getCorrectedPosition(easedProgress * distance * animationState2.direction + animationState2.startPosition);
|
|
361
|
-
if (animationState2.targetPosition === newPosition || progress === 1) {
|
|
362
|
-
keepAnimating = false;
|
|
363
|
-
return {
|
|
364
|
-
currentPosition: LoopingArrayCalculator.withoutOffset(newPosition),
|
|
365
|
-
animationState: void 0
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
return {
|
|
369
|
-
currentPosition: newPosition,
|
|
370
|
-
animationState: {
|
|
371
|
-
...animationState2,
|
|
372
|
-
lastUpdateTime: time
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
});
|
|
376
|
-
if (keepAnimating) {
|
|
377
|
-
animationId.current = requestAnimationFrame((time1) => animation(time1));
|
|
378
|
-
}
|
|
379
|
-
}, [animationTime, autoLoopAnimationTime, util]);
|
|
380
|
-
useEffect(() => {
|
|
381
|
-
if (animationState) {
|
|
382
|
-
animationId.current = requestAnimationFrame(animation);
|
|
383
|
-
}
|
|
384
|
-
return () => {
|
|
385
|
-
if (animationId.current) {
|
|
386
|
-
cancelAnimationFrame(animationId.current);
|
|
387
|
-
animationId.current = 0;
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
}, [animationState]);
|
|
391
|
-
const startAutoLoop = () => setCarouselInformation((prevState) => ({
|
|
392
|
-
...prevState,
|
|
393
|
-
dragState: prevState.dragState,
|
|
394
|
-
animationState: prevState.animationState || prevState.dragState ? prevState.animationState : {
|
|
395
|
-
startPosition: currentPosition,
|
|
396
|
-
targetPosition: (currentPosition + 1) % length,
|
|
397
|
-
direction: 1,
|
|
398
|
-
// always move forward
|
|
399
|
-
isAutoLooping: true
|
|
400
|
-
}
|
|
401
|
-
}));
|
|
402
|
-
useEffect(() => {
|
|
403
|
-
if (!animationId.current && !animationState && !dragState && !timeOut.current) {
|
|
404
|
-
if (autoLoopingTimeOut > 0) {
|
|
405
|
-
timeOut.current = setTimeout(() => {
|
|
406
|
-
startAutoLoop();
|
|
407
|
-
timeOut.current = void 0;
|
|
408
|
-
}, autoLoopingTimeOut);
|
|
409
|
-
} else {
|
|
410
|
-
startAutoLoop();
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}, [animationState, dragState, animationId.current, timeOut.current]);
|
|
414
|
-
const startAnimation = (targetPosition) => {
|
|
415
|
-
if (targetPosition === void 0) {
|
|
416
|
-
targetPosition = LoopingArrayCalculator.withoutOffset(currentPosition);
|
|
417
|
-
}
|
|
418
|
-
if (targetPosition === currentPosition) {
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
const direction = util.getBestDirection(currentPosition, targetPosition);
|
|
422
|
-
clearTimeout(timeOut.current);
|
|
423
|
-
timeOut.current = void 0;
|
|
424
|
-
if (animationId.current) {
|
|
425
|
-
cancelAnimationFrame(animationId.current);
|
|
426
|
-
animationId.current = void 0;
|
|
427
|
-
}
|
|
428
|
-
setCarouselInformation((prevState) => ({
|
|
429
|
-
...prevState,
|
|
430
|
-
dragState: void 0,
|
|
431
|
-
animationState: {
|
|
432
|
-
targetPosition,
|
|
433
|
-
direction,
|
|
434
|
-
startPosition: currentPosition,
|
|
435
|
-
isAutoLooping: false
|
|
436
|
-
},
|
|
437
|
-
timeOut: void 0
|
|
438
|
-
}));
|
|
439
|
-
};
|
|
440
|
-
const canGoLeft = () => {
|
|
441
|
-
return isLooping || currentPosition !== 0;
|
|
442
|
-
};
|
|
443
|
-
const canGoRight = () => {
|
|
444
|
-
return isLooping || currentPosition !== length - 1;
|
|
445
|
-
};
|
|
446
|
-
const left = () => {
|
|
447
|
-
if (canGoLeft()) {
|
|
448
|
-
startAnimation(currentPosition === 0 ? length - 1 : LoopingArrayCalculator.withoutOffset(currentPosition - 1));
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
const right = () => {
|
|
452
|
-
if (canGoRight()) {
|
|
453
|
-
startAnimation(LoopingArrayCalculator.withoutOffset((currentPosition + 1) % length));
|
|
454
|
-
}
|
|
455
|
-
};
|
|
456
|
-
let items = children.map((item, index) => ({
|
|
457
|
-
index,
|
|
458
|
-
item
|
|
459
|
-
}));
|
|
460
|
-
if (isLooping) {
|
|
461
|
-
const before = createLoopingListWithIndex(children, length - 1, paddingItemCount, false).reverse().map(([index, item]) => ({
|
|
462
|
-
index,
|
|
463
|
-
item
|
|
464
|
-
}));
|
|
465
|
-
const after = createLoopingListWithIndex(children, 0, paddingItemCount).map(([index, item]) => ({
|
|
466
|
-
index,
|
|
467
|
-
item
|
|
468
|
-
}));
|
|
469
|
-
items = [
|
|
470
|
-
...before,
|
|
471
|
-
...items,
|
|
472
|
-
...after
|
|
473
|
-
];
|
|
474
|
-
}
|
|
475
|
-
const onDragStart = (x) => setCarouselInformation((prevState) => ({
|
|
476
|
-
...prevState,
|
|
477
|
-
dragState: {
|
|
478
|
-
lastX: x,
|
|
479
|
-
startX: x,
|
|
480
|
-
startTime: Date.now(),
|
|
481
|
-
startIndex: currentPosition
|
|
482
|
-
},
|
|
483
|
-
animationState: void 0
|
|
484
|
-
// cancel animation
|
|
485
|
-
}));
|
|
486
|
-
const onDrag = (x, width) => {
|
|
487
|
-
if (!dragState || x === 0) {
|
|
488
|
-
return;
|
|
489
|
-
}
|
|
490
|
-
const offsetUpdate = (dragState.lastX - x) / width;
|
|
491
|
-
const newPosition = util.getCorrectedPosition(currentPosition + offsetUpdate);
|
|
492
|
-
setCarouselInformation((prevState) => ({
|
|
493
|
-
...prevState,
|
|
494
|
-
currentPosition: newPosition,
|
|
495
|
-
dragState: {
|
|
496
|
-
...dragState,
|
|
497
|
-
lastX: x
|
|
498
|
-
}
|
|
499
|
-
}));
|
|
500
|
-
};
|
|
501
|
-
const onDragEnd = (x, width) => {
|
|
502
|
-
if (!dragState) {
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
|
-
const distance = dragState.startX - x;
|
|
506
|
-
const relativeDistance = distance / width;
|
|
507
|
-
const duration = Date.now() - dragState.startTime;
|
|
508
|
-
const velocity = distance / (Date.now() - dragState.startTime);
|
|
509
|
-
const isSlide = Math.abs(velocity) > 2 || duration < 200 && (Math.abs(relativeDistance) > 0.2 || Math.abs(distance) > 50);
|
|
510
|
-
if (isSlide) {
|
|
511
|
-
if (distance > 0 && canGoRight()) {
|
|
512
|
-
right();
|
|
513
|
-
return;
|
|
514
|
-
} else if (distance < 0 && canGoLeft()) {
|
|
515
|
-
left();
|
|
516
|
-
return;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
startAnimation();
|
|
520
|
-
};
|
|
521
|
-
const dragHandlers = {
|
|
522
|
-
draggable: true,
|
|
523
|
-
onDragStart: (event) => {
|
|
524
|
-
onDragStart(event.clientX);
|
|
525
|
-
event.dataTransfer.setDragImage(document.createElement("div"), 0, 0);
|
|
526
|
-
},
|
|
527
|
-
onDrag: (event) => onDrag(event.clientX, event.target.getBoundingClientRect().width),
|
|
528
|
-
onDragEnd: (event) => onDragEnd(event.clientX, event.target.getBoundingClientRect().width),
|
|
529
|
-
onTouchStart: (event) => onDragStart(event.touches[0].clientX),
|
|
530
|
-
onTouchMove: (event) => onDrag(event.touches[0].clientX, event.target.getBoundingClientRect().width),
|
|
531
|
-
onTouchEnd: (event) => onDragEnd(event.changedTouches[0].clientX, event.target.getBoundingClientRect().width),
|
|
532
|
-
onTouchCancel: (event) => onDragEnd(event.changedTouches[0].clientX, event.target.getBoundingClientRect().width)
|
|
533
|
-
};
|
|
534
|
-
return /* @__PURE__ */ jsxs2("div", { className: "flex-col-2 items-center w-full", children: [
|
|
535
|
-
/* @__PURE__ */ jsxs2("div", { className: clsx2(`relative w-full overflow-hidden`, heightClassName, className), children: [
|
|
536
|
-
arrows && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
537
|
-
/* @__PURE__ */ jsx2(
|
|
538
|
-
IconButton,
|
|
539
|
-
{
|
|
540
|
-
color: "neutral",
|
|
541
|
-
className: clsx2("absolute z-10 left-2 top-1/2 -translate-y-1/2 shadow-md", { hidden: !canGoLeft() }),
|
|
542
|
-
disabled: !canGoLeft(),
|
|
543
|
-
onClick: () => left(),
|
|
544
|
-
children: /* @__PURE__ */ jsx2(ChevronLeft, { size: 24 })
|
|
545
|
-
}
|
|
546
|
-
),
|
|
547
|
-
/* @__PURE__ */ jsx2(
|
|
548
|
-
IconButton,
|
|
549
|
-
{
|
|
550
|
-
color: "neutral",
|
|
551
|
-
className: clsx2("absolute z-10 right-2 top-1/2 -translate-y-1/2 shadow-md", { hidden: !canGoRight() }),
|
|
552
|
-
disabled: !canGoRight(),
|
|
553
|
-
onClick: () => right(),
|
|
554
|
-
children: /* @__PURE__ */ jsx2(ChevronRight, { size: 24 })
|
|
555
|
-
}
|
|
556
|
-
)
|
|
557
|
-
] }),
|
|
558
|
-
hintNext ? /* @__PURE__ */ jsxs2("div", { className: clsx2(`flex-row-2 relative h-full`, heightClassName), children: [
|
|
559
|
-
/* @__PURE__ */ jsx2("div", { className: "flex-row-2 relative h-full w-full px-2 overflow-hidden", children: items.map(({
|
|
560
|
-
item,
|
|
561
|
-
index
|
|
562
|
-
}, listIndex) => /* @__PURE__ */ jsx2(
|
|
563
|
-
"div",
|
|
564
|
-
{
|
|
565
|
-
className: clsx2(`absolute left-[50%] h-full overflow-hidden`, widthClassName, { "!cursor-grabbing": !!dragState }),
|
|
566
|
-
style: { translate: getStyleOffset(listIndex - (isLooping ? paddingItemCount : 0)) },
|
|
567
|
-
...dragHandlers,
|
|
568
|
-
onClick: () => startAnimation(index),
|
|
569
|
-
children: item
|
|
570
|
-
},
|
|
571
|
-
listIndex
|
|
572
|
-
)) }),
|
|
573
|
-
/* @__PURE__ */ jsx2(
|
|
574
|
-
"div",
|
|
575
|
-
{
|
|
576
|
-
className: clsx2(`hidden pointer-events-none desktop:block absolute left-0 h-full w-[20%] bg-gradient-to-r to-transparent`, blurColor)
|
|
577
|
-
}
|
|
578
|
-
),
|
|
579
|
-
/* @__PURE__ */ jsx2(
|
|
580
|
-
"div",
|
|
581
|
-
{
|
|
582
|
-
className: clsx2(`hidden pointer-events-none desktop:block absolute right-0 h-full w-[20%] bg-gradient-to-l to-transparent`, blurColor)
|
|
583
|
-
}
|
|
584
|
-
)
|
|
585
|
-
] }) : /* @__PURE__ */ jsx2("div", { className: clsx2("px-16 h-full", { "!cursor-grabbing": !!dragState }), ...dragHandlers, children: children[currentIndex] })
|
|
586
|
-
] }),
|
|
587
|
-
dots && /* @__PURE__ */ jsx2(
|
|
588
|
-
"div",
|
|
589
|
-
{
|
|
590
|
-
className: "flex-row-2 items-center justify-center w-full my-2",
|
|
591
|
-
children: range(length).map((index) => /* @__PURE__ */ jsx2(
|
|
592
|
-
"button",
|
|
593
|
-
{
|
|
594
|
-
className: clsx2("w-8 min-w-8 h-3 min-h-3 first:rounded-l-md last:rounded-r-md", {
|
|
595
|
-
"bg-carousel-dot-disabled hover:bg-carousel-dot-active": currentIndex !== index,
|
|
596
|
-
"bg-carousel-dot-active hover:brightness-90": currentIndex === index
|
|
597
|
-
}),
|
|
598
|
-
onClick: () => startAnimation(index)
|
|
599
|
-
},
|
|
600
|
-
index
|
|
601
|
-
))
|
|
602
|
-
}
|
|
603
|
-
)
|
|
604
|
-
] });
|
|
605
|
-
};
|
|
606
|
-
export {
|
|
607
|
-
Carousel
|
|
608
|
-
};
|
|
609
|
-
//# sourceMappingURL=Carousel.mjs.map
|