@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
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
// src/components/layout/Carousel.tsx
|
|
2
|
+
import {
|
|
3
|
+
createContext as createContext2,
|
|
4
|
+
forwardRef as forwardRef2,
|
|
5
|
+
useCallback as useCallback2,
|
|
6
|
+
useContext as useContext2,
|
|
7
|
+
useEffect as useEffect2,
|
|
8
|
+
useId,
|
|
9
|
+
useMemo,
|
|
10
|
+
useRef,
|
|
11
|
+
useState as useState3
|
|
12
|
+
} from "react";
|
|
13
|
+
import clsx2 from "clsx";
|
|
14
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
15
|
+
|
|
16
|
+
// src/utils/array.ts
|
|
17
|
+
var defaultRangeOptions = {
|
|
18
|
+
allowEmptyRange: false,
|
|
19
|
+
stepSize: 1,
|
|
20
|
+
exclusiveStart: false,
|
|
21
|
+
exclusiveEnd: true
|
|
22
|
+
};
|
|
23
|
+
var range = (endOrRange, options) => {
|
|
24
|
+
const { allowEmptyRange, stepSize, exclusiveStart, exclusiveEnd } = { ...defaultRangeOptions, ...options };
|
|
25
|
+
let start = 0;
|
|
26
|
+
let end;
|
|
27
|
+
if (typeof endOrRange === "number") {
|
|
28
|
+
end = endOrRange;
|
|
29
|
+
} else {
|
|
30
|
+
start = endOrRange[0];
|
|
31
|
+
end = endOrRange[1];
|
|
32
|
+
}
|
|
33
|
+
if (!exclusiveEnd) {
|
|
34
|
+
end -= 1;
|
|
35
|
+
}
|
|
36
|
+
if (exclusiveStart) {
|
|
37
|
+
start += 1;
|
|
38
|
+
}
|
|
39
|
+
if (end - 1 < start) {
|
|
40
|
+
if (!allowEmptyRange) {
|
|
41
|
+
console.warn(`range: end (${end}) < start (${start}) should be allowed explicitly, set options.allowEmptyRange to true`);
|
|
42
|
+
}
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
return Array.from({ length: end - start }, (_, index) => index * stepSize + start);
|
|
46
|
+
};
|
|
47
|
+
var createLoopingListWithIndex = (list, startIndex = 0, length = 0, forwards = true) => {
|
|
48
|
+
if (length < 0) {
|
|
49
|
+
console.warn(`createLoopingList: length must be >= 0, given ${length}`);
|
|
50
|
+
} else if (length === 0) {
|
|
51
|
+
length = list.length;
|
|
52
|
+
}
|
|
53
|
+
const returnList = [];
|
|
54
|
+
if (forwards) {
|
|
55
|
+
for (let i = startIndex; returnList.length < length; i = (i + 1) % list.length) {
|
|
56
|
+
returnList.push([i, list[i]]);
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
for (let i = startIndex; returnList.length < length; i = i === 0 ? i = list.length - 1 : i - 1) {
|
|
60
|
+
returnList.push([i, list[i]]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return returnList;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/components/user-action/Button.tsx
|
|
67
|
+
import { forwardRef } from "react";
|
|
68
|
+
import clsx from "clsx";
|
|
69
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
70
|
+
var ButtonColorUtil = {
|
|
71
|
+
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
72
|
+
text: ["primary", "negative", "neutral"],
|
|
73
|
+
outline: ["primary"]
|
|
74
|
+
};
|
|
75
|
+
var IconButtonUtil = {
|
|
76
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
77
|
+
};
|
|
78
|
+
var paddingMapping = {
|
|
79
|
+
small: "btn-sm",
|
|
80
|
+
medium: "btn-md",
|
|
81
|
+
large: "btn-lg"
|
|
82
|
+
};
|
|
83
|
+
var iconPaddingMapping = {
|
|
84
|
+
tiny: "icon-btn-xs",
|
|
85
|
+
small: "icon-btn-sm",
|
|
86
|
+
medium: "icon-btn-md",
|
|
87
|
+
large: "icon-btn-lg"
|
|
88
|
+
};
|
|
89
|
+
var ButtonUtil = {
|
|
90
|
+
paddingMapping,
|
|
91
|
+
iconPaddingMapping
|
|
92
|
+
};
|
|
93
|
+
var SolidButton = forwardRef(function SolidButton2({
|
|
94
|
+
children,
|
|
95
|
+
color = "primary",
|
|
96
|
+
size = "medium",
|
|
97
|
+
startIcon,
|
|
98
|
+
endIcon,
|
|
99
|
+
onClick,
|
|
100
|
+
className,
|
|
101
|
+
...restProps
|
|
102
|
+
}, ref) {
|
|
103
|
+
const colorClasses = {
|
|
104
|
+
primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
|
|
105
|
+
secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
|
|
106
|
+
tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
|
|
107
|
+
positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
|
|
108
|
+
warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
|
|
109
|
+
negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
|
|
110
|
+
neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text"
|
|
111
|
+
}[color];
|
|
112
|
+
const iconColorClasses = {
|
|
113
|
+
primary: "not-group-disabled:text-button-solid-primary-icon",
|
|
114
|
+
secondary: "not-group-disabled:text-button-solid-secondary-icon",
|
|
115
|
+
tertiary: "not-group-disabled:text-button-solid-tertiary-icon",
|
|
116
|
+
positive: "not-group-disabled:text-button-solid-positive-icon",
|
|
117
|
+
warning: "not-group-disabled:text-button-solid-warning-icon",
|
|
118
|
+
negative: "not-group-disabled:text-button-solid-negative-icon",
|
|
119
|
+
neutral: "not-group-disabled:text-button-solid-neutral-icon"
|
|
120
|
+
}[color];
|
|
121
|
+
return /* @__PURE__ */ jsxs(
|
|
122
|
+
"button",
|
|
123
|
+
{
|
|
124
|
+
ref,
|
|
125
|
+
onClick,
|
|
126
|
+
className: clsx(
|
|
127
|
+
"group font-semibold",
|
|
128
|
+
colorClasses,
|
|
129
|
+
"not-disabled:hover:brightness-90",
|
|
130
|
+
"disabled:text-disabled-text disabled:bg-disabled-background",
|
|
131
|
+
ButtonUtil.paddingMapping[size],
|
|
132
|
+
className
|
|
133
|
+
),
|
|
134
|
+
...restProps,
|
|
135
|
+
children: [
|
|
136
|
+
startIcon && /* @__PURE__ */ jsx(
|
|
137
|
+
"span",
|
|
138
|
+
{
|
|
139
|
+
className: clsx(
|
|
140
|
+
iconColorClasses,
|
|
141
|
+
"group-disabled:text-disabled-icon"
|
|
142
|
+
),
|
|
143
|
+
children: startIcon
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
children,
|
|
147
|
+
endIcon && /* @__PURE__ */ jsx(
|
|
148
|
+
"span",
|
|
149
|
+
{
|
|
150
|
+
className: clsx(
|
|
151
|
+
iconColorClasses,
|
|
152
|
+
"group-disabled:text-disabled-icon"
|
|
153
|
+
),
|
|
154
|
+
children: endIcon
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
});
|
|
161
|
+
var IconButton = forwardRef(function IconButton2({
|
|
162
|
+
children,
|
|
163
|
+
color = "primary",
|
|
164
|
+
size = "medium",
|
|
165
|
+
className,
|
|
166
|
+
...restProps
|
|
167
|
+
}, ref) {
|
|
168
|
+
const colorClasses = {
|
|
169
|
+
primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
|
|
170
|
+
secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
|
|
171
|
+
tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
|
|
172
|
+
positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
|
|
173
|
+
warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
|
|
174
|
+
negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
|
|
175
|
+
neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text",
|
|
176
|
+
transparent: "not-disabled:bg-transparent"
|
|
177
|
+
}[color];
|
|
178
|
+
return /* @__PURE__ */ jsx(
|
|
179
|
+
"button",
|
|
180
|
+
{
|
|
181
|
+
ref,
|
|
182
|
+
className: clsx(
|
|
183
|
+
colorClasses,
|
|
184
|
+
"not-disabled:hover:brightness-90",
|
|
185
|
+
"disabled:text-disabled-text",
|
|
186
|
+
{
|
|
187
|
+
"disabled:bg-disabled-background": color !== "transparent",
|
|
188
|
+
"disabled:opacity-70": color === "transparent",
|
|
189
|
+
"not-disabled:hover:bg-button-text-hover-background": color === "transparent"
|
|
190
|
+
},
|
|
191
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
192
|
+
className
|
|
193
|
+
),
|
|
194
|
+
...restProps,
|
|
195
|
+
children
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// src/localization/LanguageProvider.tsx
|
|
201
|
+
import { createContext, useContext, useEffect, useState as useState2 } from "react";
|
|
202
|
+
|
|
203
|
+
// src/hooks/useLocalStorage.ts
|
|
204
|
+
import { useCallback, useState } from "react";
|
|
205
|
+
|
|
206
|
+
// src/localization/util.ts
|
|
207
|
+
var languages = ["en", "de"];
|
|
208
|
+
var languagesLocalNames = {
|
|
209
|
+
en: "English",
|
|
210
|
+
de: "Deutsch"
|
|
211
|
+
};
|
|
212
|
+
var DEFAULT_LANGUAGE = "en";
|
|
213
|
+
var LanguageUtil = {
|
|
214
|
+
languages,
|
|
215
|
+
DEFAULT_LANGUAGE,
|
|
216
|
+
languagesLocalNames
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// src/localization/LanguageProvider.tsx
|
|
220
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
221
|
+
var LanguageContext = createContext({
|
|
222
|
+
language: LanguageUtil.DEFAULT_LANGUAGE,
|
|
223
|
+
setLanguage: (v) => v
|
|
224
|
+
});
|
|
225
|
+
var useLanguage = () => useContext(LanguageContext);
|
|
226
|
+
|
|
227
|
+
// src/localization/useTranslation.ts
|
|
228
|
+
var TranslationPluralCount = {
|
|
229
|
+
zero: 0,
|
|
230
|
+
one: 1,
|
|
231
|
+
two: 2,
|
|
232
|
+
few: 3,
|
|
233
|
+
many: 11,
|
|
234
|
+
other: -1
|
|
235
|
+
};
|
|
236
|
+
var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
237
|
+
const { language: languageProp, translation: overwrite } = overwriteTranslation;
|
|
238
|
+
const { language: inferredLanguage } = useLanguage();
|
|
239
|
+
const usedLanguage = languageProp ?? inferredLanguage;
|
|
240
|
+
const usedTranslations = [...translations];
|
|
241
|
+
if (overwrite) {
|
|
242
|
+
usedTranslations.push(overwrite);
|
|
243
|
+
}
|
|
244
|
+
return (key, options) => {
|
|
245
|
+
const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
|
|
246
|
+
try {
|
|
247
|
+
for (let i = translations.length - 1; i >= 0; i--) {
|
|
248
|
+
const translation = translations[i];
|
|
249
|
+
const localizedTranslation = translation[usedLanguage];
|
|
250
|
+
if (!localizedTranslation) {
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
const value = localizedTranslation[key];
|
|
254
|
+
if (!value) {
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
let forProcessing;
|
|
258
|
+
if (typeof value !== "string") {
|
|
259
|
+
if (count === TranslationPluralCount.zero && value?.zero) {
|
|
260
|
+
forProcessing = value.zero;
|
|
261
|
+
} else if (count === TranslationPluralCount.one && value?.one) {
|
|
262
|
+
forProcessing = value.one;
|
|
263
|
+
} else if (count === TranslationPluralCount.two && value?.two) {
|
|
264
|
+
forProcessing = value.two;
|
|
265
|
+
} else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
|
|
266
|
+
forProcessing = value.few;
|
|
267
|
+
} else if (count > TranslationPluralCount.many && value?.many) {
|
|
268
|
+
forProcessing = value.many;
|
|
269
|
+
} else {
|
|
270
|
+
forProcessing = value.other;
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
forProcessing = value;
|
|
274
|
+
}
|
|
275
|
+
forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
|
|
276
|
+
return replacements[placeholder] ?? `{{key:${placeholder}}}`;
|
|
277
|
+
});
|
|
278
|
+
return forProcessing;
|
|
279
|
+
}
|
|
280
|
+
} catch (e) {
|
|
281
|
+
console.error(e);
|
|
282
|
+
}
|
|
283
|
+
return `{{${usedLanguage}:${key}}}`;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
// src/components/layout/Carousel.tsx
|
|
288
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
289
|
+
var CarouselContext = createContext2(null);
|
|
290
|
+
var useCarouselContext = () => {
|
|
291
|
+
const context = useContext2(CarouselContext);
|
|
292
|
+
if (!context) {
|
|
293
|
+
console.error("useCarouselContext must be used within CarouselContext");
|
|
294
|
+
}
|
|
295
|
+
return context;
|
|
296
|
+
};
|
|
297
|
+
var defaultCarouselTabTranslationType = {
|
|
298
|
+
en: {
|
|
299
|
+
showSlide: `Show Slide {{index}}`,
|
|
300
|
+
slideNavigation: "Slide navigation"
|
|
301
|
+
},
|
|
302
|
+
de: {
|
|
303
|
+
showSlide: "Zeige Slide {{index}}",
|
|
304
|
+
slideNavigation: "Slide Navigation"
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
function CarouselTabs({
|
|
308
|
+
onChange
|
|
309
|
+
}) {
|
|
310
|
+
const translation = useTranslation([
|
|
311
|
+
defaultCarouselTabTranslationType
|
|
312
|
+
]);
|
|
313
|
+
const { id, slideCount, currentIndex, isLooping } = useCarouselContext();
|
|
314
|
+
const tabRefs = useRef([]);
|
|
315
|
+
const handleKeyDown = (event, index) => {
|
|
316
|
+
let newIndex = index;
|
|
317
|
+
if (event.key === "ArrowRight") {
|
|
318
|
+
newIndex = isLooping ? (index + 1) % slideCount : Math.max(index + 1, slideCount - 1);
|
|
319
|
+
} else if (event.key === "ArrowLeft") {
|
|
320
|
+
newIndex = isLooping ? (index - 1 + slideCount) % slideCount : Math.max(index - 1, 0);
|
|
321
|
+
} else {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
event.preventDefault();
|
|
325
|
+
onChange(newIndex);
|
|
326
|
+
tabRefs.current[newIndex]?.focus();
|
|
327
|
+
};
|
|
328
|
+
return /* @__PURE__ */ jsx3(
|
|
329
|
+
"div",
|
|
330
|
+
{
|
|
331
|
+
className: "flex-row-1 items-center justify-center w-full my-2",
|
|
332
|
+
role: "tablist",
|
|
333
|
+
"aria-label": translation("slideNavigation"),
|
|
334
|
+
id: `${id}-tablist`,
|
|
335
|
+
children: range(slideCount).map((index) => {
|
|
336
|
+
const isSelected = currentIndex === index;
|
|
337
|
+
return /* @__PURE__ */ jsx3(
|
|
338
|
+
"button",
|
|
339
|
+
{
|
|
340
|
+
id: `${id}-tab-${index}`,
|
|
341
|
+
ref: (el) => tabRefs.current[index] = el,
|
|
342
|
+
onClick: () => onChange(index),
|
|
343
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
344
|
+
className: clsx2(
|
|
345
|
+
"w-8 min-w-8 h-3 min-h-3 first:rounded-l-md last:rounded-r-md",
|
|
346
|
+
{
|
|
347
|
+
"bg-carousel-dot-disabled hover:bg-carousel-dot-active": currentIndex !== index,
|
|
348
|
+
"bg-carousel-dot-active hover:brightness-90": currentIndex === index
|
|
349
|
+
}
|
|
350
|
+
),
|
|
351
|
+
role: "tab",
|
|
352
|
+
tabIndex: isSelected ? 0 : -1,
|
|
353
|
+
"aria-label": translation("showSlide", { replacements: { index: (index + 1).toString() } }),
|
|
354
|
+
"aria-selected": isSelected,
|
|
355
|
+
"aria-controls": `slide-${index}`,
|
|
356
|
+
"aria-disabled": isSelected
|
|
357
|
+
},
|
|
358
|
+
index
|
|
359
|
+
);
|
|
360
|
+
})
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
var defaultCarouselSlideTranslationType = {
|
|
365
|
+
en: {
|
|
366
|
+
slide: "Slide",
|
|
367
|
+
slideOf: `Slide {{index}} of {{length}} slides`
|
|
368
|
+
},
|
|
369
|
+
de: {
|
|
370
|
+
slide: "Slide",
|
|
371
|
+
slideOf: `Slide {{index}} von {{length}} slides`
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
var CarouselSlide = forwardRef2(
|
|
375
|
+
function CarouselSlide2({
|
|
376
|
+
index,
|
|
377
|
+
...props
|
|
378
|
+
}, ref) {
|
|
379
|
+
const translation = useTranslation([defaultCarouselSlideTranslationType]);
|
|
380
|
+
const { id, currentIndex, slideCount } = useCarouselContext();
|
|
381
|
+
const isSelected = currentIndex === index;
|
|
382
|
+
return /* @__PURE__ */ jsx3(
|
|
383
|
+
"div",
|
|
384
|
+
{
|
|
385
|
+
...props,
|
|
386
|
+
ref,
|
|
387
|
+
id: `${id}-slide-${index}`,
|
|
388
|
+
className: clsx2("focus-style-none group/slide", props.className),
|
|
389
|
+
tabIndex: isSelected ? 0 : void 0,
|
|
390
|
+
role: "group",
|
|
391
|
+
"aria-roledescription": translation("slide"),
|
|
392
|
+
"aria-label": translation("slideOf", {
|
|
393
|
+
replacements: {
|
|
394
|
+
index: (index + 1).toString(),
|
|
395
|
+
length: slideCount.toString()
|
|
396
|
+
}
|
|
397
|
+
}),
|
|
398
|
+
"aria-hidden": isSelected ? void 0 : true
|
|
399
|
+
}
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
);
|
|
403
|
+
var defaultCarouselTranslationType = {
|
|
404
|
+
en: {
|
|
405
|
+
slide: "Slide",
|
|
406
|
+
carousel: "Carousel",
|
|
407
|
+
slideOf: `Slide {{index}} of {{length}} slides`,
|
|
408
|
+
chooseSlide: "Choose slide to display"
|
|
409
|
+
},
|
|
410
|
+
de: {
|
|
411
|
+
slide: "Slide",
|
|
412
|
+
carousel: "Karussell",
|
|
413
|
+
slideOf: `Slide {{index}} von {{length}} slides`,
|
|
414
|
+
chooseSlide: "W\xE4hle die angezeigte Slide aus"
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
var Carousel = ({
|
|
418
|
+
children,
|
|
419
|
+
animationTime = 200,
|
|
420
|
+
isLooping = false,
|
|
421
|
+
isAutoPlaying = false,
|
|
422
|
+
autoLoopingTimeOut = 5e3,
|
|
423
|
+
autoLoopAnimationTime = 1e3,
|
|
424
|
+
hintNext = false,
|
|
425
|
+
arrows = false,
|
|
426
|
+
dots = true,
|
|
427
|
+
blurColor = "from-background",
|
|
428
|
+
heightClassName = "h-96",
|
|
429
|
+
widthClassName = "w-[70%] desktop:w-1/2",
|
|
430
|
+
slideContainerProps,
|
|
431
|
+
...props
|
|
432
|
+
}) => {
|
|
433
|
+
const translation = useTranslation([defaultCarouselTranslationType]);
|
|
434
|
+
const slideRefs = useRef([]);
|
|
435
|
+
const [currentIndex, setCurrentIndex] = useState3(0);
|
|
436
|
+
const [hasFocus, setHasFocus] = useState3(false);
|
|
437
|
+
const [dragState, setDragState] = useState3();
|
|
438
|
+
const isPaused = hasFocus;
|
|
439
|
+
const carouselContainerRef = useRef(null);
|
|
440
|
+
const [disableClick, setDisableClick] = useState3(false);
|
|
441
|
+
const timeOut = useRef(void 0);
|
|
442
|
+
const length = useMemo(() => children.length, [children]);
|
|
443
|
+
const paddingItemCount = 3;
|
|
444
|
+
const generatedId = "carousel" + useId();
|
|
445
|
+
const id = props.id ?? generatedId;
|
|
446
|
+
if (isAutoPlaying && !isLooping) {
|
|
447
|
+
console.error("When isAutoLooping is true, isLooping should also be true");
|
|
448
|
+
isLooping = true;
|
|
449
|
+
}
|
|
450
|
+
autoLoopingTimeOut = Math.max(0, autoLoopingTimeOut);
|
|
451
|
+
animationTime = Math.max(100, animationTime);
|
|
452
|
+
autoLoopAnimationTime = Math.max(200, autoLoopAnimationTime);
|
|
453
|
+
useEffect2(() => {
|
|
454
|
+
const carousel = carouselContainerRef.current;
|
|
455
|
+
if (carousel) {
|
|
456
|
+
let onFocus = function() {
|
|
457
|
+
setHasFocus(true);
|
|
458
|
+
}, onBlur = function() {
|
|
459
|
+
setHasFocus(false);
|
|
460
|
+
};
|
|
461
|
+
carousel?.addEventListener("focusin", onFocus);
|
|
462
|
+
carousel?.addEventListener("focusout", onBlur);
|
|
463
|
+
return () => {
|
|
464
|
+
carousel?.removeEventListener("focusin", onFocus);
|
|
465
|
+
carousel?.removeEventListener("focusin", onFocus);
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
}, []);
|
|
469
|
+
const getStyleOffset = (index) => {
|
|
470
|
+
const baseOffset = -50 + (index - currentIndex) * 100;
|
|
471
|
+
return `${baseOffset}%`;
|
|
472
|
+
};
|
|
473
|
+
const canGoLeft = () => {
|
|
474
|
+
return isLooping || currentIndex !== 0;
|
|
475
|
+
};
|
|
476
|
+
const canGoRight = useCallback2(() => {
|
|
477
|
+
return isLooping || currentIndex !== length - 1;
|
|
478
|
+
}, [currentIndex, isLooping, length]);
|
|
479
|
+
const left = () => {
|
|
480
|
+
if (canGoLeft()) {
|
|
481
|
+
setCurrentIndex(currentIndex - 1);
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
const right = useCallback2(() => {
|
|
485
|
+
if (canGoRight()) {
|
|
486
|
+
setCurrentIndex((currentIndex + length + 1) % length);
|
|
487
|
+
}
|
|
488
|
+
}, [canGoRight, currentIndex, length]);
|
|
489
|
+
useEffect2(() => {
|
|
490
|
+
if (!timeOut.current && !isPaused) {
|
|
491
|
+
if (autoLoopingTimeOut > 0) {
|
|
492
|
+
timeOut.current = setTimeout(() => {
|
|
493
|
+
right();
|
|
494
|
+
timeOut.current = void 0;
|
|
495
|
+
}, autoLoopingTimeOut);
|
|
496
|
+
} else {
|
|
497
|
+
right();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
if ((isPaused || !!dragState) && timeOut.current) {
|
|
501
|
+
clearTimeout(timeOut.current);
|
|
502
|
+
timeOut.current = void 0;
|
|
503
|
+
}
|
|
504
|
+
}, [right, isPaused, autoLoopingTimeOut, dragState]);
|
|
505
|
+
let items = children.map((item, index) => ({
|
|
506
|
+
index,
|
|
507
|
+
item
|
|
508
|
+
}));
|
|
509
|
+
let before = [];
|
|
510
|
+
let after = [];
|
|
511
|
+
if (isLooping) {
|
|
512
|
+
before = createLoopingListWithIndex(children, length - 1, paddingItemCount, false).reverse().map(([index, item]) => ({
|
|
513
|
+
index,
|
|
514
|
+
item
|
|
515
|
+
}));
|
|
516
|
+
after = createLoopingListWithIndex(children, 0, paddingItemCount).map(([index, item]) => ({
|
|
517
|
+
index,
|
|
518
|
+
item
|
|
519
|
+
}));
|
|
520
|
+
items = [...before, ...items, ...after];
|
|
521
|
+
}
|
|
522
|
+
const handlePointerDown = (e) => {
|
|
523
|
+
setDragState({
|
|
524
|
+
dragOffsetX: 0,
|
|
525
|
+
dragStartX: e.clientX
|
|
526
|
+
});
|
|
527
|
+
};
|
|
528
|
+
const handlePointerMove = (e) => {
|
|
529
|
+
if (!dragState) return;
|
|
530
|
+
setDragState((prevState) => ({ dragStartX: prevState.dragStartX, dragOffsetX: e.clientX - prevState.dragStartX }));
|
|
531
|
+
};
|
|
532
|
+
const handlePointerUp = () => {
|
|
533
|
+
if (!dragState) return;
|
|
534
|
+
if (dragState.dragOffsetX > 50) {
|
|
535
|
+
left();
|
|
536
|
+
} else if (dragState.dragOffsetX < -50) {
|
|
537
|
+
right();
|
|
538
|
+
}
|
|
539
|
+
setDragState(void 0);
|
|
540
|
+
};
|
|
541
|
+
useEffect2(() => {
|
|
542
|
+
setDisableClick(!dragState);
|
|
543
|
+
}, [dragState]);
|
|
544
|
+
return /* @__PURE__ */ jsx3(CarouselContext.Provider, { value: { id, currentIndex, slideCount: length, isLooping }, children: /* @__PURE__ */ jsxs2(
|
|
545
|
+
"div",
|
|
546
|
+
{
|
|
547
|
+
ref: carouselContainerRef,
|
|
548
|
+
...props,
|
|
549
|
+
className: clsx2("flex-col-2 items-center w-full", props.className),
|
|
550
|
+
id,
|
|
551
|
+
role: "region",
|
|
552
|
+
"aria-roledescription": translation("slide"),
|
|
553
|
+
children: [
|
|
554
|
+
/* @__PURE__ */ jsxs2(
|
|
555
|
+
"div",
|
|
556
|
+
{
|
|
557
|
+
...slideContainerProps,
|
|
558
|
+
className: clsx2(`relative w-full overflow-hidden`, heightClassName, slideContainerProps?.className),
|
|
559
|
+
children: [
|
|
560
|
+
hintNext ? /* @__PURE__ */ jsxs2(
|
|
561
|
+
"div",
|
|
562
|
+
{
|
|
563
|
+
onPointerDown: handlePointerDown,
|
|
564
|
+
onPointerMove: handlePointerMove,
|
|
565
|
+
onPointerUp: handlePointerUp,
|
|
566
|
+
onPointerLeave: handlePointerUp,
|
|
567
|
+
className: clsx2(`flex-row-2 relative h-full`, heightClassName),
|
|
568
|
+
children: [
|
|
569
|
+
/* @__PURE__ */ jsx3("div", { className: "flex-row-2 relative h-full w-full px-2 overflow-hidden", children: items.map(({
|
|
570
|
+
item,
|
|
571
|
+
index
|
|
572
|
+
}, listIndex) => {
|
|
573
|
+
const isInItems = before.length <= listIndex && listIndex < items.length - after.length;
|
|
574
|
+
return /* @__PURE__ */ jsx3(
|
|
575
|
+
CarouselSlide,
|
|
576
|
+
{
|
|
577
|
+
ref: isInItems ? slideRefs[index] : void 0,
|
|
578
|
+
index,
|
|
579
|
+
className: clsx2(
|
|
580
|
+
`absolute left-[50%] h-full overflow-hidden transition-transform ease-in-out`,
|
|
581
|
+
widthClassName
|
|
582
|
+
),
|
|
583
|
+
onClick: () => !disableClick && setCurrentIndex(index),
|
|
584
|
+
style: {
|
|
585
|
+
translate: `calc(${getStyleOffset(listIndex - (isLooping ? paddingItemCount : 0))} + ${dragState ? dragState.dragOffsetX : 0}px)`,
|
|
586
|
+
transitionDuration: dragState ? "0ms" : (isAutoPlaying && !isPaused ? autoLoopAnimationTime : animationTime) + "ms"
|
|
587
|
+
},
|
|
588
|
+
children: item
|
|
589
|
+
},
|
|
590
|
+
listIndex
|
|
591
|
+
);
|
|
592
|
+
}) }),
|
|
593
|
+
/* @__PURE__ */ jsx3(
|
|
594
|
+
"div",
|
|
595
|
+
{
|
|
596
|
+
className: clsx2(`hidden desktop:block pointer-events-none absolute left-0 h-full w-[20%] bg-gradient-to-r to-transparent`, blurColor)
|
|
597
|
+
}
|
|
598
|
+
),
|
|
599
|
+
/* @__PURE__ */ jsx3(
|
|
600
|
+
"div",
|
|
601
|
+
{
|
|
602
|
+
className: clsx2(`hidden desktop:block pointer-events-none absolute right-0 h-full w-[20%] bg-gradient-to-l to-transparent`, blurColor)
|
|
603
|
+
}
|
|
604
|
+
)
|
|
605
|
+
]
|
|
606
|
+
}
|
|
607
|
+
) : /* @__PURE__ */ jsx3(
|
|
608
|
+
"div",
|
|
609
|
+
{
|
|
610
|
+
ref: slideRefs[currentIndex],
|
|
611
|
+
className: clsx2("px-16 h-full"),
|
|
612
|
+
tabIndex: 0,
|
|
613
|
+
role: "group",
|
|
614
|
+
"aria-roledescription": translation("slide"),
|
|
615
|
+
"aria-label": translation("slideOf", {
|
|
616
|
+
replacements: {
|
|
617
|
+
index: (currentIndex + 1).toString(),
|
|
618
|
+
length: items.length.toString()
|
|
619
|
+
}
|
|
620
|
+
}),
|
|
621
|
+
children: children[currentIndex]
|
|
622
|
+
}
|
|
623
|
+
),
|
|
624
|
+
arrows && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
625
|
+
/* @__PURE__ */ jsx3(
|
|
626
|
+
IconButton,
|
|
627
|
+
{
|
|
628
|
+
color: "neutral",
|
|
629
|
+
className: clsx2("absolute z-10 left-2 top-1/2 -translate-y-1/2 shadow-md", { hidden: !canGoLeft() }),
|
|
630
|
+
disabled: !canGoLeft(),
|
|
631
|
+
onClick: () => left(),
|
|
632
|
+
children: /* @__PURE__ */ jsx3(ChevronLeft, { size: 24 })
|
|
633
|
+
}
|
|
634
|
+
),
|
|
635
|
+
/* @__PURE__ */ jsx3(
|
|
636
|
+
IconButton,
|
|
637
|
+
{
|
|
638
|
+
color: "neutral",
|
|
639
|
+
className: clsx2("absolute z-10 right-2 top-1/2 -translate-y-1/2 shadow-md", { hidden: !canGoRight() }),
|
|
640
|
+
disabled: !canGoRight(),
|
|
641
|
+
onClick: () => right(),
|
|
642
|
+
children: /* @__PURE__ */ jsx3(ChevronRight, { size: 24 })
|
|
643
|
+
}
|
|
644
|
+
)
|
|
645
|
+
] })
|
|
646
|
+
]
|
|
647
|
+
}
|
|
648
|
+
),
|
|
649
|
+
dots && /* @__PURE__ */ jsx3(CarouselTabs, { onChange: setCurrentIndex })
|
|
650
|
+
]
|
|
651
|
+
}
|
|
652
|
+
) });
|
|
653
|
+
};
|
|
654
|
+
export {
|
|
655
|
+
Carousel,
|
|
656
|
+
CarouselSlide,
|
|
657
|
+
CarouselTabs as default
|
|
658
|
+
};
|
|
659
|
+
//# sourceMappingURL=Carousel.mjs.map
|