@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,3064 @@
|
|
|
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
|
+
|
|
655
|
+
// src/components/layout/Chip.tsx
|
|
656
|
+
import clsx3 from "clsx";
|
|
657
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
658
|
+
var chipColors = ["default", "dark", "red", "yellow", "green", "blue", "pink", "orange"];
|
|
659
|
+
var ChipUtil = {
|
|
660
|
+
colors: chipColors
|
|
661
|
+
};
|
|
662
|
+
var Chip = ({
|
|
663
|
+
children,
|
|
664
|
+
trailingIcon,
|
|
665
|
+
color = "default",
|
|
666
|
+
size = "md",
|
|
667
|
+
icon = false,
|
|
668
|
+
variant = "normal",
|
|
669
|
+
className = "",
|
|
670
|
+
...restProps
|
|
671
|
+
}) => {
|
|
672
|
+
const colorMapping = {
|
|
673
|
+
default: "text-tag-default-text bg-tag-default-background",
|
|
674
|
+
dark: "text-tag-dark-text bg-tag-dark-background",
|
|
675
|
+
red: "text-tag-red-text bg-tag-red-background",
|
|
676
|
+
yellow: "text-tag-yellow-text bg-tag-yellow-background",
|
|
677
|
+
green: "text-tag-green-text bg-tag-green-background",
|
|
678
|
+
blue: "text-tag-blue-text bg-tag-blue-background",
|
|
679
|
+
pink: "text-tag-pink-text bg-tag-pink-background",
|
|
680
|
+
orange: "text-tag-orange-text bg-tag-orange-background"
|
|
681
|
+
}[color];
|
|
682
|
+
const colorMappingIcon = {
|
|
683
|
+
default: "text-tag-default-icon",
|
|
684
|
+
dark: "text-tag-dark-icon",
|
|
685
|
+
red: "text-tag-red-icon",
|
|
686
|
+
yellow: "text-tag-yellow-icon",
|
|
687
|
+
green: "text-tag-green-icon",
|
|
688
|
+
blue: "text-tag-blue-icon",
|
|
689
|
+
pink: "text-tag-pink-icon",
|
|
690
|
+
orange: "text-tag-orange-icon"
|
|
691
|
+
}[color];
|
|
692
|
+
return /* @__PURE__ */ jsxs3(
|
|
693
|
+
"div",
|
|
694
|
+
{
|
|
695
|
+
...restProps,
|
|
696
|
+
className: clsx3(
|
|
697
|
+
`flex-row-0 w-fit font-semibold`,
|
|
698
|
+
colorMapping,
|
|
699
|
+
!icon ? {
|
|
700
|
+
"px-1 py-0.5": size === "sm",
|
|
701
|
+
"px-2 py-1": size === "md",
|
|
702
|
+
"px-4 py-2": size === "lg"
|
|
703
|
+
} : {
|
|
704
|
+
"p-0.5": size === "sm",
|
|
705
|
+
"p-1": size === "md",
|
|
706
|
+
"p-2": size === "lg"
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
"rounded-md": variant === "normal",
|
|
710
|
+
"rounded-full": variant === "fullyRounded"
|
|
711
|
+
},
|
|
712
|
+
className
|
|
713
|
+
),
|
|
714
|
+
children: [
|
|
715
|
+
children,
|
|
716
|
+
trailingIcon && /* @__PURE__ */ jsx4("span", { className: colorMappingIcon, children: trailingIcon })
|
|
717
|
+
]
|
|
718
|
+
}
|
|
719
|
+
);
|
|
720
|
+
};
|
|
721
|
+
var ChipList = ({
|
|
722
|
+
list,
|
|
723
|
+
className = ""
|
|
724
|
+
}) => {
|
|
725
|
+
return /* @__PURE__ */ jsx4("div", { className: clsx3("flex flex-wrap gap-x-2 gap-y-2", className), children: list.map((value, index) => /* @__PURE__ */ jsx4(
|
|
726
|
+
Chip,
|
|
727
|
+
{
|
|
728
|
+
...value,
|
|
729
|
+
color: value.color ?? "default",
|
|
730
|
+
variant: value.variant ?? "normal",
|
|
731
|
+
children: value.children
|
|
732
|
+
},
|
|
733
|
+
index
|
|
734
|
+
)) });
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
// src/components/layout/DividerInserter.tsx
|
|
738
|
+
import clsx4 from "clsx";
|
|
739
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
740
|
+
var DividerInserter = ({
|
|
741
|
+
children,
|
|
742
|
+
divider,
|
|
743
|
+
className,
|
|
744
|
+
...restProps
|
|
745
|
+
}) => {
|
|
746
|
+
const nodes = [];
|
|
747
|
+
for (let index = 0; index < children.length; index++) {
|
|
748
|
+
const element = children[index];
|
|
749
|
+
if (element !== void 0) {
|
|
750
|
+
nodes.push(element);
|
|
751
|
+
if (index < children.length - 1) {
|
|
752
|
+
nodes.push(divider(index));
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
return /* @__PURE__ */ jsx5("div", { className: clsx4(className), ...restProps, children: nodes });
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
// src/components/layout/Expandable.tsx
|
|
760
|
+
import { forwardRef as forwardRef3, useCallback as useCallback3, useEffect as useEffect3, useId as useId2, useState as useState4 } from "react";
|
|
761
|
+
import { ChevronDown } from "lucide-react";
|
|
762
|
+
import clsx5 from "clsx";
|
|
763
|
+
|
|
764
|
+
// src/utils/noop.ts
|
|
765
|
+
var noop = () => void 0;
|
|
766
|
+
|
|
767
|
+
// src/components/layout/Expandable.tsx
|
|
768
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
769
|
+
var ExpansionIcon = ({ isExpanded, className }) => {
|
|
770
|
+
return /* @__PURE__ */ jsx6(
|
|
771
|
+
ChevronDown,
|
|
772
|
+
{
|
|
773
|
+
"aria-hidden": true,
|
|
774
|
+
className: clsx5(
|
|
775
|
+
"min-w-6 w-6 min-h-6 h-6 transition-transform motion-safe:duration-200 motion-reduce:duration-0 ease-in-out",
|
|
776
|
+
{ "rotate-180": isExpanded },
|
|
777
|
+
className
|
|
778
|
+
)
|
|
779
|
+
}
|
|
780
|
+
);
|
|
781
|
+
};
|
|
782
|
+
var Expandable = forwardRef3(function Expandable2({
|
|
783
|
+
children,
|
|
784
|
+
id: providedId,
|
|
785
|
+
label,
|
|
786
|
+
icon,
|
|
787
|
+
isExpanded = false,
|
|
788
|
+
onChange = noop,
|
|
789
|
+
clickOnlyOnHeader = true,
|
|
790
|
+
disabled = false,
|
|
791
|
+
className,
|
|
792
|
+
headerClassName,
|
|
793
|
+
contentClassName,
|
|
794
|
+
contentExpandedClassName
|
|
795
|
+
}, ref) {
|
|
796
|
+
const defaultIcon = useCallback3((expanded) => /* @__PURE__ */ jsx6(ExpansionIcon, { isExpanded: expanded }), []);
|
|
797
|
+
icon ??= defaultIcon;
|
|
798
|
+
const generatedId = useId2();
|
|
799
|
+
const id = providedId ?? generatedId;
|
|
800
|
+
return /* @__PURE__ */ jsxs4(
|
|
801
|
+
"div",
|
|
802
|
+
{
|
|
803
|
+
ref,
|
|
804
|
+
onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
805
|
+
className: clsx5(
|
|
806
|
+
"flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm",
|
|
807
|
+
{ "cursor-pointer": !clickOnlyOnHeader && !disabled },
|
|
808
|
+
className
|
|
809
|
+
),
|
|
810
|
+
children: [
|
|
811
|
+
/* @__PURE__ */ jsxs4(
|
|
812
|
+
"button",
|
|
813
|
+
{
|
|
814
|
+
onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
815
|
+
className: clsx5(
|
|
816
|
+
"flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
|
|
817
|
+
{
|
|
818
|
+
"group-hover:brightness-97": !isExpanded,
|
|
819
|
+
"hover:brightness-97": isExpanded && !disabled,
|
|
820
|
+
"cursor-pointer": clickOnlyOnHeader && !disabled
|
|
821
|
+
},
|
|
822
|
+
headerClassName
|
|
823
|
+
),
|
|
824
|
+
"aria-expanded": isExpanded,
|
|
825
|
+
"aria-controls": `${id}-content`,
|
|
826
|
+
"aria-disabled": disabled ?? void 0,
|
|
827
|
+
children: [
|
|
828
|
+
label,
|
|
829
|
+
icon(isExpanded)
|
|
830
|
+
]
|
|
831
|
+
}
|
|
832
|
+
),
|
|
833
|
+
/* @__PURE__ */ jsx6(
|
|
834
|
+
"div",
|
|
835
|
+
{
|
|
836
|
+
id: `${id}-content`,
|
|
837
|
+
className: clsx5(
|
|
838
|
+
"flex-col-2 px-4 transition-all duration-300 ease-in-out",
|
|
839
|
+
{
|
|
840
|
+
[clsx5("max-h-96 opacity-100 pb-2 overflow-y-auto", contentExpandedClassName)]: isExpanded,
|
|
841
|
+
"max-h-0 opacity-0 overflow-hidden": !isExpanded
|
|
842
|
+
},
|
|
843
|
+
contentClassName
|
|
844
|
+
),
|
|
845
|
+
role: "region",
|
|
846
|
+
children
|
|
847
|
+
}
|
|
848
|
+
)
|
|
849
|
+
]
|
|
850
|
+
}
|
|
851
|
+
);
|
|
852
|
+
});
|
|
853
|
+
var ExpandableUncontrolled = forwardRef3(function ExpandableUncontrolled2({
|
|
854
|
+
isExpanded,
|
|
855
|
+
onChange = noop,
|
|
856
|
+
...props
|
|
857
|
+
}, ref) {
|
|
858
|
+
const [usedIsExpanded, setUsedIsExpanded] = useState4(isExpanded);
|
|
859
|
+
useEffect3(() => {
|
|
860
|
+
setUsedIsExpanded(isExpanded);
|
|
861
|
+
}, [isExpanded]);
|
|
862
|
+
return /* @__PURE__ */ jsx6(
|
|
863
|
+
Expandable,
|
|
864
|
+
{
|
|
865
|
+
...props,
|
|
866
|
+
ref,
|
|
867
|
+
isExpanded: usedIsExpanded,
|
|
868
|
+
onChange: (value) => {
|
|
869
|
+
onChange(value);
|
|
870
|
+
setUsedIsExpanded(value);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
);
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
// src/components/layout/FAQSection.tsx
|
|
877
|
+
import clsx6 from "clsx";
|
|
878
|
+
|
|
879
|
+
// src/components/layout/MarkdownInterpreter.tsx
|
|
880
|
+
import { Fragment as Fragment2, jsx as jsx7 } from "react/jsx-runtime";
|
|
881
|
+
var astNodeInserterType = ["helpwave", "newline"];
|
|
882
|
+
var ASTNodeInterpreter = ({
|
|
883
|
+
node,
|
|
884
|
+
isRoot = false,
|
|
885
|
+
className = ""
|
|
886
|
+
}) => {
|
|
887
|
+
switch (node.type) {
|
|
888
|
+
case "newline":
|
|
889
|
+
return /* @__PURE__ */ jsx7("br", {});
|
|
890
|
+
case "text":
|
|
891
|
+
return isRoot ? /* @__PURE__ */ jsx7("span", { className, children: node.text }) : node.text;
|
|
892
|
+
case "helpwave":
|
|
893
|
+
return /* @__PURE__ */ jsx7("span", { className: "font-bold font-space no-underline", children: "helpwave" });
|
|
894
|
+
case "none":
|
|
895
|
+
return isRoot ? /* @__PURE__ */ jsx7("span", { className, children: node.children.map((value, index) => /* @__PURE__ */ jsx7(
|
|
896
|
+
ASTNodeInterpreter,
|
|
897
|
+
{
|
|
898
|
+
node: value
|
|
899
|
+
},
|
|
900
|
+
index
|
|
901
|
+
)) }) : /* @__PURE__ */ jsx7(Fragment2, { children: node.children.map((value, index) => /* @__PURE__ */ jsx7(ASTNodeInterpreter, { node: value }, index)) });
|
|
902
|
+
case "bold":
|
|
903
|
+
return /* @__PURE__ */ jsx7("b", { children: node.children.map((value, index) => /* @__PURE__ */ jsx7(ASTNodeInterpreter, { node: value }, index)) });
|
|
904
|
+
case "italic":
|
|
905
|
+
return /* @__PURE__ */ jsx7("i", { children: node.children.map((value, index) => /* @__PURE__ */ jsx7(ASTNodeInterpreter, { node: value }, index)) });
|
|
906
|
+
case "underline":
|
|
907
|
+
return /* @__PURE__ */ jsx7("u", { children: node.children.map((value, index) => /* @__PURE__ */ jsx7(ASTNodeInterpreter, { node: value }, index)) });
|
|
908
|
+
case "font-space":
|
|
909
|
+
return /* @__PURE__ */ jsx7("span", { className: "font-space", children: node.children.map((value, index) => /* @__PURE__ */ jsx7(
|
|
910
|
+
ASTNodeInterpreter,
|
|
911
|
+
{
|
|
912
|
+
node: value
|
|
913
|
+
},
|
|
914
|
+
index
|
|
915
|
+
)) });
|
|
916
|
+
case "primary":
|
|
917
|
+
return /* @__PURE__ */ jsx7("span", { className: "text-primary", children: node.children.map((value, index) => /* @__PURE__ */ jsx7(
|
|
918
|
+
ASTNodeInterpreter,
|
|
919
|
+
{
|
|
920
|
+
node: value
|
|
921
|
+
},
|
|
922
|
+
index
|
|
923
|
+
)) });
|
|
924
|
+
case "secondary":
|
|
925
|
+
return /* @__PURE__ */ jsx7("span", { className: "text-secondary", children: node.children.map((value, index) => /* @__PURE__ */ jsx7(
|
|
926
|
+
ASTNodeInterpreter,
|
|
927
|
+
{
|
|
928
|
+
node: value
|
|
929
|
+
},
|
|
930
|
+
index
|
|
931
|
+
)) });
|
|
932
|
+
case "warn":
|
|
933
|
+
return /* @__PURE__ */ jsx7("span", { className: "text-warning", children: node.children.map((value, index) => /* @__PURE__ */ jsx7(
|
|
934
|
+
ASTNodeInterpreter,
|
|
935
|
+
{
|
|
936
|
+
node: value
|
|
937
|
+
},
|
|
938
|
+
index
|
|
939
|
+
)) });
|
|
940
|
+
case "positive":
|
|
941
|
+
return /* @__PURE__ */ jsx7("span", { className: "text-positive", children: node.children.map((value, index) => /* @__PURE__ */ jsx7(
|
|
942
|
+
ASTNodeInterpreter,
|
|
943
|
+
{
|
|
944
|
+
node: value
|
|
945
|
+
},
|
|
946
|
+
index
|
|
947
|
+
)) });
|
|
948
|
+
case "negative":
|
|
949
|
+
return /* @__PURE__ */ jsx7("span", { className: "text-negative", children: node.children.map((value, index) => /* @__PURE__ */ jsx7(
|
|
950
|
+
ASTNodeInterpreter,
|
|
951
|
+
{
|
|
952
|
+
node: value
|
|
953
|
+
},
|
|
954
|
+
index
|
|
955
|
+
)) });
|
|
956
|
+
default:
|
|
957
|
+
return null;
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
var modifierIdentifierMapping = [
|
|
961
|
+
{ id: "i", name: "italic" },
|
|
962
|
+
{ id: "b", name: "bold" },
|
|
963
|
+
{ id: "u", name: "underline" },
|
|
964
|
+
{ id: "space", name: "font-space" },
|
|
965
|
+
{ id: "primary", name: "primary" },
|
|
966
|
+
{ id: "secondary", name: "secondary" },
|
|
967
|
+
{ id: "warn", name: "warn" },
|
|
968
|
+
{ id: "positive", name: "positive" },
|
|
969
|
+
{ id: "negative", name: "negative" }
|
|
970
|
+
];
|
|
971
|
+
var inserterIdentifierMapping = [
|
|
972
|
+
{ id: "helpwave", name: "helpwave" },
|
|
973
|
+
{ id: "newline", name: "newline" }
|
|
974
|
+
];
|
|
975
|
+
var parseMarkdown = (text, commandStart = "\\", open = "{", close = "}") => {
|
|
976
|
+
let start = text.indexOf(commandStart);
|
|
977
|
+
const children = [];
|
|
978
|
+
while (text !== "") {
|
|
979
|
+
if (start === -1) {
|
|
980
|
+
children.push({
|
|
981
|
+
type: "text",
|
|
982
|
+
text
|
|
983
|
+
});
|
|
984
|
+
break;
|
|
985
|
+
}
|
|
986
|
+
children.push(parseMarkdown(text.substring(0, start)));
|
|
987
|
+
text = text.substring(start);
|
|
988
|
+
if (text.length <= 1) {
|
|
989
|
+
children.push({
|
|
990
|
+
type: "text",
|
|
991
|
+
text
|
|
992
|
+
});
|
|
993
|
+
text = "";
|
|
994
|
+
continue;
|
|
995
|
+
}
|
|
996
|
+
const simpleReplace = [commandStart, open, close];
|
|
997
|
+
if (simpleReplace.some((value) => text[1] === value)) {
|
|
998
|
+
children.push({
|
|
999
|
+
type: "text",
|
|
1000
|
+
text: simpleReplace.find((value) => text[1] === value)
|
|
1001
|
+
});
|
|
1002
|
+
text = text.substring(2);
|
|
1003
|
+
start = text.indexOf(commandStart);
|
|
1004
|
+
continue;
|
|
1005
|
+
}
|
|
1006
|
+
const inserter = inserterIdentifierMapping.find((value) => text.substring(1).startsWith(value.id));
|
|
1007
|
+
if (inserter) {
|
|
1008
|
+
children.push({
|
|
1009
|
+
type: inserter.name
|
|
1010
|
+
});
|
|
1011
|
+
text = text.substring(inserter.id.length + 1);
|
|
1012
|
+
start = text.indexOf(commandStart);
|
|
1013
|
+
continue;
|
|
1014
|
+
}
|
|
1015
|
+
const modifier = modifierIdentifierMapping.find((value) => text.substring(1).startsWith(value.id));
|
|
1016
|
+
if (modifier) {
|
|
1017
|
+
if (text[modifier.id.length + 1] !== open) {
|
|
1018
|
+
children.push({
|
|
1019
|
+
type: "text",
|
|
1020
|
+
text: text.substring(0, modifier.id.length + 1)
|
|
1021
|
+
});
|
|
1022
|
+
text = text.substring(modifier.id.length + 2);
|
|
1023
|
+
start = text.indexOf(commandStart);
|
|
1024
|
+
continue;
|
|
1025
|
+
}
|
|
1026
|
+
let closing = -1;
|
|
1027
|
+
let index = modifier.id.length + 2;
|
|
1028
|
+
let counter = 1;
|
|
1029
|
+
let escaping = false;
|
|
1030
|
+
while (index < text.length) {
|
|
1031
|
+
if (text[index] === open && !escaping) {
|
|
1032
|
+
counter++;
|
|
1033
|
+
}
|
|
1034
|
+
if (text[index] === close && !escaping) {
|
|
1035
|
+
counter--;
|
|
1036
|
+
if (counter === 0) {
|
|
1037
|
+
closing = index;
|
|
1038
|
+
break;
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
escaping = text[index] === commandStart;
|
|
1042
|
+
index++;
|
|
1043
|
+
}
|
|
1044
|
+
if (closing !== -1) {
|
|
1045
|
+
children.push({
|
|
1046
|
+
type: modifier.name,
|
|
1047
|
+
children: [parseMarkdown(text.substring(modifier.id.length + 2, closing))]
|
|
1048
|
+
});
|
|
1049
|
+
text = text.substring(closing + 1);
|
|
1050
|
+
start = text.indexOf(commandStart);
|
|
1051
|
+
continue;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
children.push({
|
|
1055
|
+
type: "text",
|
|
1056
|
+
text: text[0]
|
|
1057
|
+
});
|
|
1058
|
+
text = text.substring(1);
|
|
1059
|
+
start = text.indexOf(commandStart);
|
|
1060
|
+
}
|
|
1061
|
+
return {
|
|
1062
|
+
type: "none",
|
|
1063
|
+
children
|
|
1064
|
+
};
|
|
1065
|
+
};
|
|
1066
|
+
var optimizeTree = (node) => {
|
|
1067
|
+
if (node.type === "text") {
|
|
1068
|
+
return !node.text ? void 0 : node;
|
|
1069
|
+
}
|
|
1070
|
+
if (astNodeInserterType.some((value) => value === node.type)) {
|
|
1071
|
+
return node;
|
|
1072
|
+
}
|
|
1073
|
+
const currentNode = node;
|
|
1074
|
+
if (currentNode.children.length === 0) {
|
|
1075
|
+
return void 0;
|
|
1076
|
+
}
|
|
1077
|
+
let children = [];
|
|
1078
|
+
for (let i = 0; i < currentNode.children.length; i++) {
|
|
1079
|
+
const child = optimizeTree(currentNode.children[i]);
|
|
1080
|
+
if (!child) {
|
|
1081
|
+
continue;
|
|
1082
|
+
}
|
|
1083
|
+
if (child.type === "none") {
|
|
1084
|
+
children.push(...child.children);
|
|
1085
|
+
} else {
|
|
1086
|
+
children.push(child);
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
currentNode.children = children;
|
|
1090
|
+
children = [];
|
|
1091
|
+
for (let i = 0; i < currentNode.children.length; i++) {
|
|
1092
|
+
const child = currentNode.children[i];
|
|
1093
|
+
if (child) {
|
|
1094
|
+
if (child.type === "text" && children[children.length - 1]?.type === "text") {
|
|
1095
|
+
children[children.length - 1].text += child.text;
|
|
1096
|
+
} else {
|
|
1097
|
+
children.push(child);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
currentNode.children = children;
|
|
1102
|
+
return currentNode;
|
|
1103
|
+
};
|
|
1104
|
+
var MarkdownInterpreter = ({ text, className }) => {
|
|
1105
|
+
const tree = parseMarkdown(text);
|
|
1106
|
+
const optimizedTree = optimizeTree(tree);
|
|
1107
|
+
return /* @__PURE__ */ jsx7(ASTNodeInterpreter, { node: optimizedTree, isRoot: true, className });
|
|
1108
|
+
};
|
|
1109
|
+
|
|
1110
|
+
// src/components/layout/FAQSection.tsx
|
|
1111
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1112
|
+
var FAQSection = ({
|
|
1113
|
+
entries,
|
|
1114
|
+
expandableClassName
|
|
1115
|
+
}) => {
|
|
1116
|
+
return /* @__PURE__ */ jsx8("ul", { className: "flex-col-4", children: entries.map(({ id, title, content, ...restProps }) => /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsx8(
|
|
1117
|
+
ExpandableUncontrolled,
|
|
1118
|
+
{
|
|
1119
|
+
...restProps,
|
|
1120
|
+
label: /* @__PURE__ */ jsx8("h3", { id, className: "typography-title-md-semibold", children: title }),
|
|
1121
|
+
clickOnlyOnHeader: false,
|
|
1122
|
+
icon: (expanded) => /* @__PURE__ */ jsx8(ExpansionIcon, { isExpanded: expanded, className: "text-primary" }),
|
|
1123
|
+
className: clsx6("rounded-xl", expandableClassName),
|
|
1124
|
+
children: /* @__PURE__ */ jsx8("div", { className: "mt-2", children: content.type === "markdown" ? /* @__PURE__ */ jsx8(MarkdownInterpreter, { text: content.value }) : content.value })
|
|
1125
|
+
},
|
|
1126
|
+
id
|
|
1127
|
+
) }, id)) });
|
|
1128
|
+
};
|
|
1129
|
+
|
|
1130
|
+
// src/components/layout/FloatingContainer.tsx
|
|
1131
|
+
import { forwardRef as forwardRef4, useImperativeHandle, useRef as useRef2 } from "react";
|
|
1132
|
+
import { createPortal } from "react-dom";
|
|
1133
|
+
import { clsx as clsx7 } from "clsx";
|
|
1134
|
+
|
|
1135
|
+
// src/hooks/useFloatingElement.ts
|
|
1136
|
+
import { useCallback as useCallback4, useEffect as useEffect5, useState as useState6 } from "react";
|
|
1137
|
+
|
|
1138
|
+
// src/utils/math.ts
|
|
1139
|
+
var clamp = (value, range2 = [0, 1]) => {
|
|
1140
|
+
const [min, max] = range2;
|
|
1141
|
+
return Math.min(Math.max(value, min), max);
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1144
|
+
// src/hooks/focus/useIsMounted.ts
|
|
1145
|
+
import { useEffect as useEffect4, useLayoutEffect, useState as useState5 } from "react";
|
|
1146
|
+
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
1147
|
+
var useIsomorphicEffect = isClient ? useLayoutEffect : useEffect4;
|
|
1148
|
+
var useIsMounted = () => {
|
|
1149
|
+
const [isMounted, setIsMounted] = useState5(false);
|
|
1150
|
+
useIsomorphicEffect(() => {
|
|
1151
|
+
setIsMounted(true);
|
|
1152
|
+
return () => {
|
|
1153
|
+
setIsMounted(false);
|
|
1154
|
+
};
|
|
1155
|
+
}, []);
|
|
1156
|
+
return isMounted;
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
// src/hooks/useFloatingElement.ts
|
|
1160
|
+
function calculatePosition({
|
|
1161
|
+
windowRect,
|
|
1162
|
+
containerRect,
|
|
1163
|
+
anchorRect,
|
|
1164
|
+
options
|
|
1165
|
+
}) {
|
|
1166
|
+
const { verticalAlignment, horizontalAlignment, gap, screenPadding } = options;
|
|
1167
|
+
const windowWidth = windowRect.width;
|
|
1168
|
+
const windowHeight = windowRect.height;
|
|
1169
|
+
const maxWidth = windowWidth - 2 * screenPadding;
|
|
1170
|
+
const maxHeight = windowHeight - 2 * screenPadding;
|
|
1171
|
+
const width = Math.min(containerRect.width, maxWidth);
|
|
1172
|
+
const height = Math.min(containerRect.height, maxHeight);
|
|
1173
|
+
const leftSuggestion = {
|
|
1174
|
+
beforeStart: anchorRect.left - width - gap,
|
|
1175
|
+
afterStart: anchorRect.left,
|
|
1176
|
+
center: anchorRect.left + anchorRect.width / 2 - width / 2,
|
|
1177
|
+
beforeEnd: anchorRect.right - width,
|
|
1178
|
+
afterEnd: anchorRect.right + gap
|
|
1179
|
+
}[horizontalAlignment];
|
|
1180
|
+
const topSuggestion = {
|
|
1181
|
+
beforeStart: anchorRect.top - height - gap,
|
|
1182
|
+
afterStart: anchorRect.top,
|
|
1183
|
+
center: anchorRect.top + anchorRect.height / 2 - height / 2,
|
|
1184
|
+
beforeEnd: anchorRect.bottom - height,
|
|
1185
|
+
afterEnd: anchorRect.bottom + gap
|
|
1186
|
+
}[verticalAlignment];
|
|
1187
|
+
const left = clamp(leftSuggestion, [
|
|
1188
|
+
screenPadding,
|
|
1189
|
+
windowWidth - screenPadding - width
|
|
1190
|
+
]);
|
|
1191
|
+
const top = clamp(topSuggestion, [
|
|
1192
|
+
screenPadding,
|
|
1193
|
+
windowHeight - screenPadding - height
|
|
1194
|
+
]);
|
|
1195
|
+
return {
|
|
1196
|
+
left,
|
|
1197
|
+
top,
|
|
1198
|
+
maxWidth,
|
|
1199
|
+
maxHeight
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
function useFloatingElement({
|
|
1203
|
+
active = true,
|
|
1204
|
+
windowRef,
|
|
1205
|
+
anchorRef,
|
|
1206
|
+
containerRef,
|
|
1207
|
+
isPolling = false,
|
|
1208
|
+
pollingInterval = 100,
|
|
1209
|
+
verticalAlignment = "afterEnd",
|
|
1210
|
+
horizontalAlignment = "afterStart",
|
|
1211
|
+
screenPadding = 16,
|
|
1212
|
+
gap = 4
|
|
1213
|
+
}) {
|
|
1214
|
+
const [style, setStyle] = useState6();
|
|
1215
|
+
const isMounted = useIsMounted();
|
|
1216
|
+
const calculate = useCallback4(() => {
|
|
1217
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
1218
|
+
const windowRect = windowRef?.current.getBoundingClientRect() ?? {
|
|
1219
|
+
top: 0,
|
|
1220
|
+
bottom: window.innerHeight,
|
|
1221
|
+
left: 0,
|
|
1222
|
+
right: window.innerWidth,
|
|
1223
|
+
width: window.innerWidth,
|
|
1224
|
+
height: window.innerHeight
|
|
1225
|
+
};
|
|
1226
|
+
const anchorElement = anchorRef?.current;
|
|
1227
|
+
if (anchorRef && !anchorElement) {
|
|
1228
|
+
console.warn("FloatingContainer anchor provided, but its value is undefined");
|
|
1229
|
+
}
|
|
1230
|
+
const anchorRect = anchorElement?.getBoundingClientRect() ?? windowRect;
|
|
1231
|
+
const calculateProps = {
|
|
1232
|
+
windowRect,
|
|
1233
|
+
anchorRect,
|
|
1234
|
+
containerRect,
|
|
1235
|
+
options: {
|
|
1236
|
+
horizontalAlignment,
|
|
1237
|
+
verticalAlignment,
|
|
1238
|
+
screenPadding,
|
|
1239
|
+
gap
|
|
1240
|
+
}
|
|
1241
|
+
};
|
|
1242
|
+
setStyle(calculatePosition(calculateProps));
|
|
1243
|
+
}, [anchorRef, containerRef, gap, horizontalAlignment, screenPadding, verticalAlignment, windowRef]);
|
|
1244
|
+
const height = containerRef.current?.getBoundingClientRect().height;
|
|
1245
|
+
const width = containerRef.current?.getBoundingClientRect().width;
|
|
1246
|
+
useEffect5(() => {
|
|
1247
|
+
if (active && isMounted) {
|
|
1248
|
+
calculate();
|
|
1249
|
+
} else {
|
|
1250
|
+
setStyle(void 0);
|
|
1251
|
+
}
|
|
1252
|
+
}, [calculate, active, isMounted, height, width]);
|
|
1253
|
+
useEffect5(() => {
|
|
1254
|
+
window.addEventListener("resize", calculate);
|
|
1255
|
+
let timeout;
|
|
1256
|
+
if (isPolling) {
|
|
1257
|
+
timeout = setInterval(calculate, pollingInterval);
|
|
1258
|
+
}
|
|
1259
|
+
return () => {
|
|
1260
|
+
window.removeEventListener("resize", calculate);
|
|
1261
|
+
if (timeout) {
|
|
1262
|
+
clearInterval(timeout);
|
|
1263
|
+
}
|
|
1264
|
+
};
|
|
1265
|
+
}, [calculate, isPolling, pollingInterval]);
|
|
1266
|
+
return style;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
// src/components/layout/FloatingContainer.tsx
|
|
1270
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1271
|
+
var FloatingContainer = forwardRef4(function FloatingContainer2({
|
|
1272
|
+
children,
|
|
1273
|
+
backgroundOverlay,
|
|
1274
|
+
anchor,
|
|
1275
|
+
isPolling = false,
|
|
1276
|
+
pollingInterval = 100,
|
|
1277
|
+
verticalAlignment = "afterEnd",
|
|
1278
|
+
horizontalAlignment = "afterStart",
|
|
1279
|
+
screenPadding = 16,
|
|
1280
|
+
gap = 4,
|
|
1281
|
+
...props
|
|
1282
|
+
}, forwardRef9) {
|
|
1283
|
+
const innerRef = useRef2(null);
|
|
1284
|
+
useImperativeHandle(forwardRef9, () => innerRef.current);
|
|
1285
|
+
const position = useFloatingElement({
|
|
1286
|
+
active: !props.hidden,
|
|
1287
|
+
containerRef: innerRef,
|
|
1288
|
+
anchorRef: anchor,
|
|
1289
|
+
isPolling,
|
|
1290
|
+
pollingInterval,
|
|
1291
|
+
verticalAlignment,
|
|
1292
|
+
horizontalAlignment,
|
|
1293
|
+
gap,
|
|
1294
|
+
screenPadding
|
|
1295
|
+
});
|
|
1296
|
+
return createPortal(
|
|
1297
|
+
/* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1298
|
+
backgroundOverlay,
|
|
1299
|
+
/* @__PURE__ */ jsx9(
|
|
1300
|
+
"div",
|
|
1301
|
+
{
|
|
1302
|
+
...props,
|
|
1303
|
+
ref: innerRef,
|
|
1304
|
+
style: {
|
|
1305
|
+
position: "fixed",
|
|
1306
|
+
overflow: "hidden",
|
|
1307
|
+
opacity: position ? void 0 : 0,
|
|
1308
|
+
// hide when position calculation isn't done yet
|
|
1309
|
+
transition: position ? `top ${pollingInterval}ms linear, left ${pollingInterval}ms linear` : void 0,
|
|
1310
|
+
...position,
|
|
1311
|
+
...props.style
|
|
1312
|
+
},
|
|
1313
|
+
className: clsx7("motion-safe:duration-100 motion-reduce:duration-0", props.className),
|
|
1314
|
+
children
|
|
1315
|
+
}
|
|
1316
|
+
)
|
|
1317
|
+
] }),
|
|
1318
|
+
document.body
|
|
1319
|
+
);
|
|
1320
|
+
});
|
|
1321
|
+
|
|
1322
|
+
// src/components/layout/ListBox.tsx
|
|
1323
|
+
import React2, { createContext as createContext3, forwardRef as forwardRef5, useCallback as useCallback5, useContext as useContext3, useEffect as useEffect6, useRef as useRef3, useState as useState7 } from "react";
|
|
1324
|
+
import { clsx as clsx8 } from "clsx";
|
|
1325
|
+
|
|
1326
|
+
// src/utils/match.ts
|
|
1327
|
+
var match = (key, values) => {
|
|
1328
|
+
return values[key];
|
|
1329
|
+
};
|
|
1330
|
+
|
|
1331
|
+
// src/components/layout/ListBox.tsx
|
|
1332
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1333
|
+
var ListBoxContext = createContext3(null);
|
|
1334
|
+
function useListBoxContext() {
|
|
1335
|
+
const ctx = useContext3(ListBoxContext);
|
|
1336
|
+
if (!ctx) {
|
|
1337
|
+
throw new Error("ListBoxItem must be used within a ListBoxPrimitive");
|
|
1338
|
+
}
|
|
1339
|
+
return ctx;
|
|
1340
|
+
}
|
|
1341
|
+
var ListBoxItem = forwardRef5(
|
|
1342
|
+
function ListBoxItem2({ value, disabled = false, children, className, ...rest }, ref) {
|
|
1343
|
+
const {
|
|
1344
|
+
registerItem,
|
|
1345
|
+
unregisterItem,
|
|
1346
|
+
highlightedId,
|
|
1347
|
+
setHighlightedId,
|
|
1348
|
+
onItemClick,
|
|
1349
|
+
isSelected
|
|
1350
|
+
} = useListBoxContext();
|
|
1351
|
+
const itemRef = useRef3(null);
|
|
1352
|
+
const id = React2.useId();
|
|
1353
|
+
useEffect6(() => {
|
|
1354
|
+
registerItem({ id, value, disabled, ref: itemRef });
|
|
1355
|
+
return () => unregisterItem(id);
|
|
1356
|
+
}, [id, value, disabled, registerItem, unregisterItem]);
|
|
1357
|
+
const isHighlighted = highlightedId === id;
|
|
1358
|
+
const selected = isSelected(value);
|
|
1359
|
+
return /* @__PURE__ */ jsx10(
|
|
1360
|
+
"li",
|
|
1361
|
+
{
|
|
1362
|
+
ref: (node) => {
|
|
1363
|
+
itemRef.current = node;
|
|
1364
|
+
if (typeof ref === "function") ref(node);
|
|
1365
|
+
else if (ref) ref.current = node;
|
|
1366
|
+
},
|
|
1367
|
+
id,
|
|
1368
|
+
role: "option",
|
|
1369
|
+
"aria-disabled": disabled,
|
|
1370
|
+
"aria-selected": selected,
|
|
1371
|
+
"data-highlighted": isHighlighted ? "" : void 0,
|
|
1372
|
+
"data-selected": selected ? "" : void 0,
|
|
1373
|
+
"data-disabled": disabled ? "" : void 0,
|
|
1374
|
+
className: clsx8(
|
|
1375
|
+
"flex-row-1 items-center px-2 py-1 rounded-md",
|
|
1376
|
+
"data-highlighted:bg-primary/20",
|
|
1377
|
+
"data-disabled:text-disabled data-disabled:cursor-not-allowed",
|
|
1378
|
+
"not-data-disabled:cursor-pointer",
|
|
1379
|
+
className
|
|
1380
|
+
),
|
|
1381
|
+
onClick: () => {
|
|
1382
|
+
if (!disabled) onItemClick(id);
|
|
1383
|
+
},
|
|
1384
|
+
onMouseEnter: () => {
|
|
1385
|
+
if (!disabled) {
|
|
1386
|
+
setHighlightedId(id);
|
|
1387
|
+
}
|
|
1388
|
+
},
|
|
1389
|
+
...rest,
|
|
1390
|
+
children: children ?? value
|
|
1391
|
+
}
|
|
1392
|
+
);
|
|
1393
|
+
}
|
|
1394
|
+
);
|
|
1395
|
+
var ListBoxPrimitive = forwardRef5(
|
|
1396
|
+
function ListBoxPrimitive2({
|
|
1397
|
+
value,
|
|
1398
|
+
onSelectionChanged,
|
|
1399
|
+
onItemClicked,
|
|
1400
|
+
isSelection = false,
|
|
1401
|
+
isMultiple = false,
|
|
1402
|
+
orientation = "vertical",
|
|
1403
|
+
...props
|
|
1404
|
+
}, ref) {
|
|
1405
|
+
const itemsRef = useRef3([]);
|
|
1406
|
+
const [highlightedIndex, setHighlightedIndex] = useState7(void 0);
|
|
1407
|
+
const registerItem = useCallback5((item) => {
|
|
1408
|
+
itemsRef.current.push(item);
|
|
1409
|
+
itemsRef.current.sort((a, b) => {
|
|
1410
|
+
const aEl = a.ref.current;
|
|
1411
|
+
const bEl = b.ref.current;
|
|
1412
|
+
if (!aEl || !bEl) return 0;
|
|
1413
|
+
return aEl.compareDocumentPosition(bEl) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
1414
|
+
});
|
|
1415
|
+
}, []);
|
|
1416
|
+
const unregisterItem = useCallback5((id) => {
|
|
1417
|
+
itemsRef.current = itemsRef.current.filter((i) => i.id !== id);
|
|
1418
|
+
}, []);
|
|
1419
|
+
const isSelected = useCallback5(
|
|
1420
|
+
(val) => (value ?? []).includes(val),
|
|
1421
|
+
[value]
|
|
1422
|
+
);
|
|
1423
|
+
const onItemClickedHandler = useCallback5(
|
|
1424
|
+
(id) => {
|
|
1425
|
+
const index = itemsRef.current.findIndex((i) => i.id === id);
|
|
1426
|
+
if (index === -1) {
|
|
1427
|
+
console.error("ListBoxItem provided an invalid id");
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
const item = itemsRef.current[index];
|
|
1431
|
+
const val = item.value;
|
|
1432
|
+
onItemClicked?.(val);
|
|
1433
|
+
setHighlightedIndex(index);
|
|
1434
|
+
if (!isSelection) return;
|
|
1435
|
+
if (!isMultiple) {
|
|
1436
|
+
onSelectionChanged?.([val]);
|
|
1437
|
+
} else {
|
|
1438
|
+
if (isSelected(val)) {
|
|
1439
|
+
onSelectionChanged?.((value ?? []).filter((v) => v !== val));
|
|
1440
|
+
} else {
|
|
1441
|
+
onSelectionChanged?.([...value ?? [], val]);
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
},
|
|
1445
|
+
[onItemClicked, isSelection, isMultiple, onSelectionChanged, isSelected, value]
|
|
1446
|
+
);
|
|
1447
|
+
const setHighlightedId = useCallback5((id) => {
|
|
1448
|
+
const index = itemsRef.current.findIndex((i) => i.id === id);
|
|
1449
|
+
if (index !== -1) {
|
|
1450
|
+
setHighlightedIndex(index);
|
|
1451
|
+
}
|
|
1452
|
+
}, []);
|
|
1453
|
+
useEffect6(() => {
|
|
1454
|
+
if (highlightedIndex !== void 0) {
|
|
1455
|
+
itemsRef.current[highlightedIndex]?.ref.current?.scrollIntoView({ block: "nearest", behavior: "auto" });
|
|
1456
|
+
}
|
|
1457
|
+
}, [highlightedIndex]);
|
|
1458
|
+
const highlightedItem = itemsRef.current[highlightedIndex];
|
|
1459
|
+
const ctxValue = {
|
|
1460
|
+
registerItem,
|
|
1461
|
+
unregisterItem,
|
|
1462
|
+
highlightedId: highlightedItem?.id,
|
|
1463
|
+
setHighlightedId,
|
|
1464
|
+
onItemClick: onItemClickedHandler,
|
|
1465
|
+
isSelected
|
|
1466
|
+
};
|
|
1467
|
+
const moveHighlight = (delta) => {
|
|
1468
|
+
if (itemsRef.current.length === 0) return;
|
|
1469
|
+
let nextIndex = highlightedIndex ?? -1;
|
|
1470
|
+
for (let i = 0; i < itemsRef.current.length; i++) {
|
|
1471
|
+
nextIndex = (nextIndex + delta + itemsRef.current.length) % itemsRef.current.length;
|
|
1472
|
+
if (!itemsRef.current[nextIndex].disabled) break;
|
|
1473
|
+
}
|
|
1474
|
+
setHighlightedIndex(nextIndex);
|
|
1475
|
+
};
|
|
1476
|
+
return /* @__PURE__ */ jsx10(ListBoxContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsx10(
|
|
1477
|
+
"ul",
|
|
1478
|
+
{
|
|
1479
|
+
ref,
|
|
1480
|
+
...props,
|
|
1481
|
+
onFocus: (event) => {
|
|
1482
|
+
if (highlightedIndex === void 0) {
|
|
1483
|
+
const firstEnabled = itemsRef.current.findIndex((i) => !i.disabled);
|
|
1484
|
+
setHighlightedIndex(firstEnabled !== -1 ? firstEnabled : void 0);
|
|
1485
|
+
}
|
|
1486
|
+
props.onFocus?.(event);
|
|
1487
|
+
},
|
|
1488
|
+
onBlur: (event) => {
|
|
1489
|
+
setHighlightedIndex(void 0);
|
|
1490
|
+
props.onBlur?.(event);
|
|
1491
|
+
},
|
|
1492
|
+
onKeyDown: (event) => {
|
|
1493
|
+
switch (event.key) {
|
|
1494
|
+
case match(orientation, {
|
|
1495
|
+
vertical: "ArrowDown",
|
|
1496
|
+
horizontal: "ArrowUp"
|
|
1497
|
+
}):
|
|
1498
|
+
moveHighlight(1);
|
|
1499
|
+
event.preventDefault();
|
|
1500
|
+
break;
|
|
1501
|
+
case match(orientation, {
|
|
1502
|
+
vertical: "ArrowUp",
|
|
1503
|
+
horizontal: "ArrowDown"
|
|
1504
|
+
}):
|
|
1505
|
+
moveHighlight(-1);
|
|
1506
|
+
event.preventDefault();
|
|
1507
|
+
break;
|
|
1508
|
+
case "Home":
|
|
1509
|
+
setHighlightedIndex(itemsRef.current.findIndex((i) => !i.disabled));
|
|
1510
|
+
event.preventDefault();
|
|
1511
|
+
break;
|
|
1512
|
+
case "End":
|
|
1513
|
+
for (let i = itemsRef.current.length - 1; i >= 0; i--) {
|
|
1514
|
+
if (!itemsRef.current[i].disabled) {
|
|
1515
|
+
setHighlightedIndex(i);
|
|
1516
|
+
break;
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
event.preventDefault();
|
|
1520
|
+
break;
|
|
1521
|
+
case "Enter":
|
|
1522
|
+
case " ":
|
|
1523
|
+
if (highlightedIndex !== void 0) {
|
|
1524
|
+
event.preventDefault();
|
|
1525
|
+
onItemClickedHandler(itemsRef.current[highlightedIndex].id);
|
|
1526
|
+
}
|
|
1527
|
+
break;
|
|
1528
|
+
}
|
|
1529
|
+
props.onKeyDown?.(event);
|
|
1530
|
+
},
|
|
1531
|
+
role: "listbox",
|
|
1532
|
+
"aria-multiselectable": isSelection ? isMultiple : void 0,
|
|
1533
|
+
"aria-orientation": orientation,
|
|
1534
|
+
tabIndex: 0,
|
|
1535
|
+
children: props.children
|
|
1536
|
+
}
|
|
1537
|
+
) });
|
|
1538
|
+
}
|
|
1539
|
+
);
|
|
1540
|
+
var ListBoxMultiple = ({ ...props }) => {
|
|
1541
|
+
return /* @__PURE__ */ jsx10(ListBoxPrimitive, { ...props });
|
|
1542
|
+
};
|
|
1543
|
+
var ListBoxMultipleUncontrolled = ({
|
|
1544
|
+
value: initialValue,
|
|
1545
|
+
onSelectionChanged,
|
|
1546
|
+
...props
|
|
1547
|
+
}) => {
|
|
1548
|
+
const [value, setValue] = useState7(initialValue);
|
|
1549
|
+
useEffect6(() => {
|
|
1550
|
+
setValue(initialValue);
|
|
1551
|
+
}, [initialValue]);
|
|
1552
|
+
return /* @__PURE__ */ jsx10(
|
|
1553
|
+
ListBoxMultiple,
|
|
1554
|
+
{
|
|
1555
|
+
...props,
|
|
1556
|
+
value,
|
|
1557
|
+
onSelectionChanged: (newValue) => {
|
|
1558
|
+
setValue(newValue);
|
|
1559
|
+
onSelectionChanged?.(newValue);
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
);
|
|
1563
|
+
};
|
|
1564
|
+
var ListBox = forwardRef5(function ListBox2({
|
|
1565
|
+
value,
|
|
1566
|
+
onSelectionChanged,
|
|
1567
|
+
...props
|
|
1568
|
+
}, ref) {
|
|
1569
|
+
return /* @__PURE__ */ jsx10(
|
|
1570
|
+
ListBoxPrimitive,
|
|
1571
|
+
{
|
|
1572
|
+
ref,
|
|
1573
|
+
value: value !== void 0 ? [value] : void 0,
|
|
1574
|
+
onSelectionChanged: (newValue) => {
|
|
1575
|
+
onSelectionChanged(newValue[0] ?? value);
|
|
1576
|
+
},
|
|
1577
|
+
isMultiple: false,
|
|
1578
|
+
...props
|
|
1579
|
+
}
|
|
1580
|
+
);
|
|
1581
|
+
});
|
|
1582
|
+
var ListBoxUncontrolled = ({
|
|
1583
|
+
value: initialValue,
|
|
1584
|
+
onSelectionChanged,
|
|
1585
|
+
...props
|
|
1586
|
+
}) => {
|
|
1587
|
+
const [value, setValue] = useState7(initialValue);
|
|
1588
|
+
useEffect6(() => {
|
|
1589
|
+
setValue(initialValue);
|
|
1590
|
+
}, [initialValue]);
|
|
1591
|
+
return /* @__PURE__ */ jsx10(
|
|
1592
|
+
ListBox,
|
|
1593
|
+
{
|
|
1594
|
+
...props,
|
|
1595
|
+
value,
|
|
1596
|
+
onSelectionChanged: (newValue) => {
|
|
1597
|
+
setValue(newValue);
|
|
1598
|
+
onSelectionChanged?.(newValue);
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
);
|
|
1602
|
+
};
|
|
1603
|
+
|
|
1604
|
+
// node_modules/@radix-ui/react-scroll-area/dist/index.mjs
|
|
1605
|
+
import * as React23 from "react";
|
|
1606
|
+
|
|
1607
|
+
// node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
1608
|
+
import * as React5 from "react";
|
|
1609
|
+
import * as ReactDOM from "react-dom";
|
|
1610
|
+
|
|
1611
|
+
// node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
1612
|
+
import * as React4 from "react";
|
|
1613
|
+
|
|
1614
|
+
// node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
1615
|
+
import * as React3 from "react";
|
|
1616
|
+
function setRef(ref, value) {
|
|
1617
|
+
if (typeof ref === "function") {
|
|
1618
|
+
return ref(value);
|
|
1619
|
+
} else if (ref !== null && ref !== void 0) {
|
|
1620
|
+
ref.current = value;
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
function composeRefs(...refs) {
|
|
1624
|
+
return (node) => {
|
|
1625
|
+
let hasCleanup = false;
|
|
1626
|
+
const cleanups = refs.map((ref) => {
|
|
1627
|
+
const cleanup = setRef(ref, node);
|
|
1628
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
1629
|
+
hasCleanup = true;
|
|
1630
|
+
}
|
|
1631
|
+
return cleanup;
|
|
1632
|
+
});
|
|
1633
|
+
if (hasCleanup) {
|
|
1634
|
+
return () => {
|
|
1635
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
1636
|
+
const cleanup = cleanups[i];
|
|
1637
|
+
if (typeof cleanup == "function") {
|
|
1638
|
+
cleanup();
|
|
1639
|
+
} else {
|
|
1640
|
+
setRef(refs[i], null);
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
};
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
}
|
|
1647
|
+
function useComposedRefs(...refs) {
|
|
1648
|
+
return React3.useCallback(composeRefs(...refs), refs);
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
// node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
1652
|
+
import { Fragment as Fragment22, jsx as jsx11 } from "react/jsx-runtime";
|
|
1653
|
+
// @__NO_SIDE_EFFECTS__
|
|
1654
|
+
function createSlot(ownerName) {
|
|
1655
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
1656
|
+
const Slot2 = React4.forwardRef((props, forwardedRef) => {
|
|
1657
|
+
const { children, ...slotProps } = props;
|
|
1658
|
+
const childrenArray = React4.Children.toArray(children);
|
|
1659
|
+
const slottable = childrenArray.find(isSlottable);
|
|
1660
|
+
if (slottable) {
|
|
1661
|
+
const newElement = slottable.props.children;
|
|
1662
|
+
const newChildren = childrenArray.map((child) => {
|
|
1663
|
+
if (child === slottable) {
|
|
1664
|
+
if (React4.Children.count(newElement) > 1) return React4.Children.only(null);
|
|
1665
|
+
return React4.isValidElement(newElement) ? newElement.props.children : null;
|
|
1666
|
+
} else {
|
|
1667
|
+
return child;
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
return /* @__PURE__ */ jsx11(SlotClone, { ...slotProps, ref: forwardedRef, children: React4.isValidElement(newElement) ? React4.cloneElement(newElement, void 0, newChildren) : null });
|
|
1671
|
+
}
|
|
1672
|
+
return /* @__PURE__ */ jsx11(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
1673
|
+
});
|
|
1674
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
1675
|
+
return Slot2;
|
|
1676
|
+
}
|
|
1677
|
+
// @__NO_SIDE_EFFECTS__
|
|
1678
|
+
function createSlotClone(ownerName) {
|
|
1679
|
+
const SlotClone = React4.forwardRef((props, forwardedRef) => {
|
|
1680
|
+
const { children, ...slotProps } = props;
|
|
1681
|
+
if (React4.isValidElement(children)) {
|
|
1682
|
+
const childrenRef = getElementRef(children);
|
|
1683
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
1684
|
+
if (children.type !== React4.Fragment) {
|
|
1685
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
1686
|
+
}
|
|
1687
|
+
return React4.cloneElement(children, props2);
|
|
1688
|
+
}
|
|
1689
|
+
return React4.Children.count(children) > 1 ? React4.Children.only(null) : null;
|
|
1690
|
+
});
|
|
1691
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
1692
|
+
return SlotClone;
|
|
1693
|
+
}
|
|
1694
|
+
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
1695
|
+
function isSlottable(child) {
|
|
1696
|
+
return React4.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
1697
|
+
}
|
|
1698
|
+
function mergeProps(slotProps, childProps) {
|
|
1699
|
+
const overrideProps = { ...childProps };
|
|
1700
|
+
for (const propName in childProps) {
|
|
1701
|
+
const slotPropValue = slotProps[propName];
|
|
1702
|
+
const childPropValue = childProps[propName];
|
|
1703
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
1704
|
+
if (isHandler) {
|
|
1705
|
+
if (slotPropValue && childPropValue) {
|
|
1706
|
+
overrideProps[propName] = (...args) => {
|
|
1707
|
+
const result = childPropValue(...args);
|
|
1708
|
+
slotPropValue(...args);
|
|
1709
|
+
return result;
|
|
1710
|
+
};
|
|
1711
|
+
} else if (slotPropValue) {
|
|
1712
|
+
overrideProps[propName] = slotPropValue;
|
|
1713
|
+
}
|
|
1714
|
+
} else if (propName === "style") {
|
|
1715
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
1716
|
+
} else if (propName === "className") {
|
|
1717
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
return { ...slotProps, ...overrideProps };
|
|
1721
|
+
}
|
|
1722
|
+
function getElementRef(element) {
|
|
1723
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
1724
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1725
|
+
if (mayWarn) {
|
|
1726
|
+
return element.ref;
|
|
1727
|
+
}
|
|
1728
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
1729
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1730
|
+
if (mayWarn) {
|
|
1731
|
+
return element.props.ref;
|
|
1732
|
+
}
|
|
1733
|
+
return element.props.ref || element.ref;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
// node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
1737
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1738
|
+
var NODES = [
|
|
1739
|
+
"a",
|
|
1740
|
+
"button",
|
|
1741
|
+
"div",
|
|
1742
|
+
"form",
|
|
1743
|
+
"h2",
|
|
1744
|
+
"h3",
|
|
1745
|
+
"img",
|
|
1746
|
+
"input",
|
|
1747
|
+
"label",
|
|
1748
|
+
"li",
|
|
1749
|
+
"nav",
|
|
1750
|
+
"ol",
|
|
1751
|
+
"p",
|
|
1752
|
+
"select",
|
|
1753
|
+
"span",
|
|
1754
|
+
"svg",
|
|
1755
|
+
"ul"
|
|
1756
|
+
];
|
|
1757
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
1758
|
+
const Slot = createSlot(`Primitive.${node}`);
|
|
1759
|
+
const Node2 = React5.forwardRef((props, forwardedRef) => {
|
|
1760
|
+
const { asChild, ...primitiveProps } = props;
|
|
1761
|
+
const Comp = asChild ? Slot : node;
|
|
1762
|
+
if (typeof window !== "undefined") {
|
|
1763
|
+
window[Symbol.for("radix-ui")] = true;
|
|
1764
|
+
}
|
|
1765
|
+
return /* @__PURE__ */ jsx12(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
1766
|
+
});
|
|
1767
|
+
Node2.displayName = `Primitive.${node}`;
|
|
1768
|
+
return { ...primitive, [node]: Node2 };
|
|
1769
|
+
}, {});
|
|
1770
|
+
|
|
1771
|
+
// node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
1772
|
+
import * as React22 from "react";
|
|
1773
|
+
|
|
1774
|
+
// node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
1775
|
+
import * as React6 from "react";
|
|
1776
|
+
var useLayoutEffect22 = globalThis?.document ? React6.useLayoutEffect : () => {
|
|
1777
|
+
};
|
|
1778
|
+
|
|
1779
|
+
// node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
1780
|
+
import * as React7 from "react";
|
|
1781
|
+
function useStateMachine(initialState, machine) {
|
|
1782
|
+
return React7.useReducer((state, event) => {
|
|
1783
|
+
const nextState = machine[state][event];
|
|
1784
|
+
return nextState ?? state;
|
|
1785
|
+
}, initialState);
|
|
1786
|
+
}
|
|
1787
|
+
var Presence = (props) => {
|
|
1788
|
+
const { present, children } = props;
|
|
1789
|
+
const presence = usePresence(present);
|
|
1790
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React22.Children.only(children);
|
|
1791
|
+
const ref = useComposedRefs(presence.ref, getElementRef2(child));
|
|
1792
|
+
const forceMount = typeof children === "function";
|
|
1793
|
+
return forceMount || presence.isPresent ? React22.cloneElement(child, { ref }) : null;
|
|
1794
|
+
};
|
|
1795
|
+
Presence.displayName = "Presence";
|
|
1796
|
+
function usePresence(present) {
|
|
1797
|
+
const [node, setNode] = React22.useState();
|
|
1798
|
+
const stylesRef = React22.useRef(null);
|
|
1799
|
+
const prevPresentRef = React22.useRef(present);
|
|
1800
|
+
const prevAnimationNameRef = React22.useRef("none");
|
|
1801
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
1802
|
+
const [state, send] = useStateMachine(initialState, {
|
|
1803
|
+
mounted: {
|
|
1804
|
+
UNMOUNT: "unmounted",
|
|
1805
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
1806
|
+
},
|
|
1807
|
+
unmountSuspended: {
|
|
1808
|
+
MOUNT: "mounted",
|
|
1809
|
+
ANIMATION_END: "unmounted"
|
|
1810
|
+
},
|
|
1811
|
+
unmounted: {
|
|
1812
|
+
MOUNT: "mounted"
|
|
1813
|
+
}
|
|
1814
|
+
});
|
|
1815
|
+
React22.useEffect(() => {
|
|
1816
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
1817
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
1818
|
+
}, [state]);
|
|
1819
|
+
useLayoutEffect22(() => {
|
|
1820
|
+
const styles = stylesRef.current;
|
|
1821
|
+
const wasPresent = prevPresentRef.current;
|
|
1822
|
+
const hasPresentChanged = wasPresent !== present;
|
|
1823
|
+
if (hasPresentChanged) {
|
|
1824
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
1825
|
+
const currentAnimationName = getAnimationName(styles);
|
|
1826
|
+
if (present) {
|
|
1827
|
+
send("MOUNT");
|
|
1828
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
1829
|
+
send("UNMOUNT");
|
|
1830
|
+
} else {
|
|
1831
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
1832
|
+
if (wasPresent && isAnimating) {
|
|
1833
|
+
send("ANIMATION_OUT");
|
|
1834
|
+
} else {
|
|
1835
|
+
send("UNMOUNT");
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
prevPresentRef.current = present;
|
|
1839
|
+
}
|
|
1840
|
+
}, [present, send]);
|
|
1841
|
+
useLayoutEffect22(() => {
|
|
1842
|
+
if (node) {
|
|
1843
|
+
let timeoutId;
|
|
1844
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
1845
|
+
const handleAnimationEnd = (event) => {
|
|
1846
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
1847
|
+
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
1848
|
+
if (event.target === node && isCurrentAnimation) {
|
|
1849
|
+
send("ANIMATION_END");
|
|
1850
|
+
if (!prevPresentRef.current) {
|
|
1851
|
+
const currentFillMode = node.style.animationFillMode;
|
|
1852
|
+
node.style.animationFillMode = "forwards";
|
|
1853
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
1854
|
+
if (node.style.animationFillMode === "forwards") {
|
|
1855
|
+
node.style.animationFillMode = currentFillMode;
|
|
1856
|
+
}
|
|
1857
|
+
});
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
};
|
|
1861
|
+
const handleAnimationStart = (event) => {
|
|
1862
|
+
if (event.target === node) {
|
|
1863
|
+
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
1864
|
+
}
|
|
1865
|
+
};
|
|
1866
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
1867
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
1868
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
1869
|
+
return () => {
|
|
1870
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
1871
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
1872
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
1873
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
1874
|
+
};
|
|
1875
|
+
} else {
|
|
1876
|
+
send("ANIMATION_END");
|
|
1877
|
+
}
|
|
1878
|
+
}, [node, send]);
|
|
1879
|
+
return {
|
|
1880
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
1881
|
+
ref: React22.useCallback((node2) => {
|
|
1882
|
+
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
1883
|
+
setNode(node2);
|
|
1884
|
+
}, [])
|
|
1885
|
+
};
|
|
1886
|
+
}
|
|
1887
|
+
function getAnimationName(styles) {
|
|
1888
|
+
return styles?.animationName || "none";
|
|
1889
|
+
}
|
|
1890
|
+
function getElementRef2(element) {
|
|
1891
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
1892
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1893
|
+
if (mayWarn) {
|
|
1894
|
+
return element.ref;
|
|
1895
|
+
}
|
|
1896
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
1897
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1898
|
+
if (mayWarn) {
|
|
1899
|
+
return element.props.ref;
|
|
1900
|
+
}
|
|
1901
|
+
return element.props.ref || element.ref;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
// node_modules/@radix-ui/react-context/dist/index.mjs
|
|
1905
|
+
import * as React8 from "react";
|
|
1906
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1907
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
1908
|
+
let defaultContexts = [];
|
|
1909
|
+
function createContext32(rootComponentName, defaultContext) {
|
|
1910
|
+
const BaseContext = React8.createContext(defaultContext);
|
|
1911
|
+
const index = defaultContexts.length;
|
|
1912
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
1913
|
+
const Provider = (props) => {
|
|
1914
|
+
const { scope, children, ...context } = props;
|
|
1915
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
1916
|
+
const value = React8.useMemo(() => context, Object.values(context));
|
|
1917
|
+
return /* @__PURE__ */ jsx13(Context.Provider, { value, children });
|
|
1918
|
+
};
|
|
1919
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
1920
|
+
function useContext22(consumerName, scope) {
|
|
1921
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
1922
|
+
const context = React8.useContext(Context);
|
|
1923
|
+
if (context) return context;
|
|
1924
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
1925
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
1926
|
+
}
|
|
1927
|
+
return [Provider, useContext22];
|
|
1928
|
+
}
|
|
1929
|
+
const createScope = () => {
|
|
1930
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
1931
|
+
return React8.createContext(defaultContext);
|
|
1932
|
+
});
|
|
1933
|
+
return function useScope(scope) {
|
|
1934
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
1935
|
+
return React8.useMemo(
|
|
1936
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
1937
|
+
[scope, contexts]
|
|
1938
|
+
);
|
|
1939
|
+
};
|
|
1940
|
+
};
|
|
1941
|
+
createScope.scopeName = scopeName;
|
|
1942
|
+
return [createContext32, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
1943
|
+
}
|
|
1944
|
+
function composeContextScopes(...scopes) {
|
|
1945
|
+
const baseScope = scopes[0];
|
|
1946
|
+
if (scopes.length === 1) return baseScope;
|
|
1947
|
+
const createScope = () => {
|
|
1948
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
1949
|
+
useScope: createScope2(),
|
|
1950
|
+
scopeName: createScope2.scopeName
|
|
1951
|
+
}));
|
|
1952
|
+
return function useComposedScopes(overrideScopes) {
|
|
1953
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
1954
|
+
const scopeProps = useScope(overrideScopes);
|
|
1955
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
1956
|
+
return { ...nextScopes2, ...currentScope };
|
|
1957
|
+
}, {});
|
|
1958
|
+
return React8.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
1959
|
+
};
|
|
1960
|
+
};
|
|
1961
|
+
createScope.scopeName = baseScope.scopeName;
|
|
1962
|
+
return createScope;
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
// node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
|
|
1966
|
+
import * as React9 from "react";
|
|
1967
|
+
function useCallbackRef(callback) {
|
|
1968
|
+
const callbackRef = React9.useRef(callback);
|
|
1969
|
+
React9.useEffect(() => {
|
|
1970
|
+
callbackRef.current = callback;
|
|
1971
|
+
});
|
|
1972
|
+
return React9.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
// node_modules/@radix-ui/react-direction/dist/index.mjs
|
|
1976
|
+
import * as React10 from "react";
|
|
1977
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1978
|
+
var DirectionContext = React10.createContext(void 0);
|
|
1979
|
+
function useDirection(localDir) {
|
|
1980
|
+
const globalDir = React10.useContext(DirectionContext);
|
|
1981
|
+
return localDir || globalDir || "ltr";
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
// node_modules/@radix-ui/number/dist/index.mjs
|
|
1985
|
+
function clamp2(value, [min, max]) {
|
|
1986
|
+
return Math.min(max, Math.max(min, value));
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
// node_modules/@radix-ui/primitive/dist/index.mjs
|
|
1990
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
1991
|
+
return function handleEvent(event) {
|
|
1992
|
+
originalEventHandler?.(event);
|
|
1993
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
1994
|
+
return ourEventHandler?.(event);
|
|
1995
|
+
}
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
// node_modules/@radix-ui/react-scroll-area/dist/index.mjs
|
|
2000
|
+
import * as React11 from "react";
|
|
2001
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2002
|
+
function useStateMachine2(initialState, machine) {
|
|
2003
|
+
return React11.useReducer((state, event) => {
|
|
2004
|
+
const nextState = machine[state][event];
|
|
2005
|
+
return nextState ?? state;
|
|
2006
|
+
}, initialState);
|
|
2007
|
+
}
|
|
2008
|
+
var SCROLL_AREA_NAME = "ScrollArea";
|
|
2009
|
+
var [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME);
|
|
2010
|
+
var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);
|
|
2011
|
+
var ScrollArea = React23.forwardRef(
|
|
2012
|
+
(props, forwardedRef) => {
|
|
2013
|
+
const {
|
|
2014
|
+
__scopeScrollArea,
|
|
2015
|
+
type = "hover",
|
|
2016
|
+
dir,
|
|
2017
|
+
scrollHideDelay = 600,
|
|
2018
|
+
...scrollAreaProps
|
|
2019
|
+
} = props;
|
|
2020
|
+
const [scrollArea, setScrollArea] = React23.useState(null);
|
|
2021
|
+
const [viewport, setViewport] = React23.useState(null);
|
|
2022
|
+
const [content, setContent] = React23.useState(null);
|
|
2023
|
+
const [scrollbarX, setScrollbarX] = React23.useState(null);
|
|
2024
|
+
const [scrollbarY, setScrollbarY] = React23.useState(null);
|
|
2025
|
+
const [cornerWidth, setCornerWidth] = React23.useState(0);
|
|
2026
|
+
const [cornerHeight, setCornerHeight] = React23.useState(0);
|
|
2027
|
+
const [scrollbarXEnabled, setScrollbarXEnabled] = React23.useState(false);
|
|
2028
|
+
const [scrollbarYEnabled, setScrollbarYEnabled] = React23.useState(false);
|
|
2029
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setScrollArea(node));
|
|
2030
|
+
const direction = useDirection(dir);
|
|
2031
|
+
return /* @__PURE__ */ jsx15(
|
|
2032
|
+
ScrollAreaProvider,
|
|
2033
|
+
{
|
|
2034
|
+
scope: __scopeScrollArea,
|
|
2035
|
+
type,
|
|
2036
|
+
dir: direction,
|
|
2037
|
+
scrollHideDelay,
|
|
2038
|
+
scrollArea,
|
|
2039
|
+
viewport,
|
|
2040
|
+
onViewportChange: setViewport,
|
|
2041
|
+
content,
|
|
2042
|
+
onContentChange: setContent,
|
|
2043
|
+
scrollbarX,
|
|
2044
|
+
onScrollbarXChange: setScrollbarX,
|
|
2045
|
+
scrollbarXEnabled,
|
|
2046
|
+
onScrollbarXEnabledChange: setScrollbarXEnabled,
|
|
2047
|
+
scrollbarY,
|
|
2048
|
+
onScrollbarYChange: setScrollbarY,
|
|
2049
|
+
scrollbarYEnabled,
|
|
2050
|
+
onScrollbarYEnabledChange: setScrollbarYEnabled,
|
|
2051
|
+
onCornerWidthChange: setCornerWidth,
|
|
2052
|
+
onCornerHeightChange: setCornerHeight,
|
|
2053
|
+
children: /* @__PURE__ */ jsx15(
|
|
2054
|
+
Primitive.div,
|
|
2055
|
+
{
|
|
2056
|
+
dir: direction,
|
|
2057
|
+
...scrollAreaProps,
|
|
2058
|
+
ref: composedRefs,
|
|
2059
|
+
style: {
|
|
2060
|
+
position: "relative",
|
|
2061
|
+
// Pass corner sizes as CSS vars to reduce re-renders of context consumers
|
|
2062
|
+
["--radix-scroll-area-corner-width"]: cornerWidth + "px",
|
|
2063
|
+
["--radix-scroll-area-corner-height"]: cornerHeight + "px",
|
|
2064
|
+
...props.style
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
)
|
|
2068
|
+
}
|
|
2069
|
+
);
|
|
2070
|
+
}
|
|
2071
|
+
);
|
|
2072
|
+
ScrollArea.displayName = SCROLL_AREA_NAME;
|
|
2073
|
+
var VIEWPORT_NAME = "ScrollAreaViewport";
|
|
2074
|
+
var ScrollAreaViewport = React23.forwardRef(
|
|
2075
|
+
(props, forwardedRef) => {
|
|
2076
|
+
const { __scopeScrollArea, children, nonce, ...viewportProps } = props;
|
|
2077
|
+
const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);
|
|
2078
|
+
const ref = React23.useRef(null);
|
|
2079
|
+
const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);
|
|
2080
|
+
return /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
2081
|
+
/* @__PURE__ */ jsx15(
|
|
2082
|
+
"style",
|
|
2083
|
+
{
|
|
2084
|
+
dangerouslySetInnerHTML: {
|
|
2085
|
+
__html: `[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`
|
|
2086
|
+
},
|
|
2087
|
+
nonce
|
|
2088
|
+
}
|
|
2089
|
+
),
|
|
2090
|
+
/* @__PURE__ */ jsx15(
|
|
2091
|
+
Primitive.div,
|
|
2092
|
+
{
|
|
2093
|
+
"data-radix-scroll-area-viewport": "",
|
|
2094
|
+
...viewportProps,
|
|
2095
|
+
ref: composedRefs,
|
|
2096
|
+
style: {
|
|
2097
|
+
/**
|
|
2098
|
+
* We don't support `visible` because the intention is to have at least one scrollbar
|
|
2099
|
+
* if this component is used and `visible` will behave like `auto` in that case
|
|
2100
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description
|
|
2101
|
+
*
|
|
2102
|
+
* We don't handle `auto` because the intention is for the native implementation
|
|
2103
|
+
* to be hidden if using this component. We just want to ensure the node is scrollable
|
|
2104
|
+
* so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
|
|
2105
|
+
* the browser from having to work out whether to render native scrollbars or not,
|
|
2106
|
+
* we tell it to with the intention of hiding them in CSS.
|
|
2107
|
+
*/
|
|
2108
|
+
overflowX: context.scrollbarXEnabled ? "scroll" : "hidden",
|
|
2109
|
+
overflowY: context.scrollbarYEnabled ? "scroll" : "hidden",
|
|
2110
|
+
...props.style
|
|
2111
|
+
},
|
|
2112
|
+
children: /* @__PURE__ */ jsx15("div", { ref: context.onContentChange, style: { minWidth: "100%", display: "table" }, children })
|
|
2113
|
+
}
|
|
2114
|
+
)
|
|
2115
|
+
] });
|
|
2116
|
+
}
|
|
2117
|
+
);
|
|
2118
|
+
ScrollAreaViewport.displayName = VIEWPORT_NAME;
|
|
2119
|
+
var SCROLLBAR_NAME = "ScrollAreaScrollbar";
|
|
2120
|
+
var ScrollAreaScrollbar = React23.forwardRef(
|
|
2121
|
+
(props, forwardedRef) => {
|
|
2122
|
+
const { forceMount, ...scrollbarProps } = props;
|
|
2123
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
2124
|
+
const { onScrollbarXEnabledChange, onScrollbarYEnabledChange } = context;
|
|
2125
|
+
const isHorizontal = props.orientation === "horizontal";
|
|
2126
|
+
React23.useEffect(() => {
|
|
2127
|
+
isHorizontal ? onScrollbarXEnabledChange(true) : onScrollbarYEnabledChange(true);
|
|
2128
|
+
return () => {
|
|
2129
|
+
isHorizontal ? onScrollbarXEnabledChange(false) : onScrollbarYEnabledChange(false);
|
|
2130
|
+
};
|
|
2131
|
+
}, [isHorizontal, onScrollbarXEnabledChange, onScrollbarYEnabledChange]);
|
|
2132
|
+
return context.type === "hover" ? /* @__PURE__ */ jsx15(ScrollAreaScrollbarHover, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === "scroll" ? /* @__PURE__ */ jsx15(ScrollAreaScrollbarScroll, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === "auto" ? /* @__PURE__ */ jsx15(ScrollAreaScrollbarAuto, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === "always" ? /* @__PURE__ */ jsx15(ScrollAreaScrollbarVisible, { ...scrollbarProps, ref: forwardedRef }) : null;
|
|
2133
|
+
}
|
|
2134
|
+
);
|
|
2135
|
+
ScrollAreaScrollbar.displayName = SCROLLBAR_NAME;
|
|
2136
|
+
var ScrollAreaScrollbarHover = React23.forwardRef((props, forwardedRef) => {
|
|
2137
|
+
const { forceMount, ...scrollbarProps } = props;
|
|
2138
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
2139
|
+
const [visible, setVisible] = React23.useState(false);
|
|
2140
|
+
React23.useEffect(() => {
|
|
2141
|
+
const scrollArea = context.scrollArea;
|
|
2142
|
+
let hideTimer = 0;
|
|
2143
|
+
if (scrollArea) {
|
|
2144
|
+
const handlePointerEnter = () => {
|
|
2145
|
+
window.clearTimeout(hideTimer);
|
|
2146
|
+
setVisible(true);
|
|
2147
|
+
};
|
|
2148
|
+
const handlePointerLeave = () => {
|
|
2149
|
+
hideTimer = window.setTimeout(() => setVisible(false), context.scrollHideDelay);
|
|
2150
|
+
};
|
|
2151
|
+
scrollArea.addEventListener("pointerenter", handlePointerEnter);
|
|
2152
|
+
scrollArea.addEventListener("pointerleave", handlePointerLeave);
|
|
2153
|
+
return () => {
|
|
2154
|
+
window.clearTimeout(hideTimer);
|
|
2155
|
+
scrollArea.removeEventListener("pointerenter", handlePointerEnter);
|
|
2156
|
+
scrollArea.removeEventListener("pointerleave", handlePointerLeave);
|
|
2157
|
+
};
|
|
2158
|
+
}
|
|
2159
|
+
}, [context.scrollArea, context.scrollHideDelay]);
|
|
2160
|
+
return /* @__PURE__ */ jsx15(Presence, { present: forceMount || visible, children: /* @__PURE__ */ jsx15(
|
|
2161
|
+
ScrollAreaScrollbarAuto,
|
|
2162
|
+
{
|
|
2163
|
+
"data-state": visible ? "visible" : "hidden",
|
|
2164
|
+
...scrollbarProps,
|
|
2165
|
+
ref: forwardedRef
|
|
2166
|
+
}
|
|
2167
|
+
) });
|
|
2168
|
+
});
|
|
2169
|
+
var ScrollAreaScrollbarScroll = React23.forwardRef((props, forwardedRef) => {
|
|
2170
|
+
const { forceMount, ...scrollbarProps } = props;
|
|
2171
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
2172
|
+
const isHorizontal = props.orientation === "horizontal";
|
|
2173
|
+
const debounceScrollEnd = useDebounceCallback(() => send("SCROLL_END"), 100);
|
|
2174
|
+
const [state, send] = useStateMachine2("hidden", {
|
|
2175
|
+
hidden: {
|
|
2176
|
+
SCROLL: "scrolling"
|
|
2177
|
+
},
|
|
2178
|
+
scrolling: {
|
|
2179
|
+
SCROLL_END: "idle",
|
|
2180
|
+
POINTER_ENTER: "interacting"
|
|
2181
|
+
},
|
|
2182
|
+
interacting: {
|
|
2183
|
+
SCROLL: "interacting",
|
|
2184
|
+
POINTER_LEAVE: "idle"
|
|
2185
|
+
},
|
|
2186
|
+
idle: {
|
|
2187
|
+
HIDE: "hidden",
|
|
2188
|
+
SCROLL: "scrolling",
|
|
2189
|
+
POINTER_ENTER: "interacting"
|
|
2190
|
+
}
|
|
2191
|
+
});
|
|
2192
|
+
React23.useEffect(() => {
|
|
2193
|
+
if (state === "idle") {
|
|
2194
|
+
const hideTimer = window.setTimeout(() => send("HIDE"), context.scrollHideDelay);
|
|
2195
|
+
return () => window.clearTimeout(hideTimer);
|
|
2196
|
+
}
|
|
2197
|
+
}, [state, context.scrollHideDelay, send]);
|
|
2198
|
+
React23.useEffect(() => {
|
|
2199
|
+
const viewport = context.viewport;
|
|
2200
|
+
const scrollDirection = isHorizontal ? "scrollLeft" : "scrollTop";
|
|
2201
|
+
if (viewport) {
|
|
2202
|
+
let prevScrollPos = viewport[scrollDirection];
|
|
2203
|
+
const handleScroll = () => {
|
|
2204
|
+
const scrollPos = viewport[scrollDirection];
|
|
2205
|
+
const hasScrollInDirectionChanged = prevScrollPos !== scrollPos;
|
|
2206
|
+
if (hasScrollInDirectionChanged) {
|
|
2207
|
+
send("SCROLL");
|
|
2208
|
+
debounceScrollEnd();
|
|
2209
|
+
}
|
|
2210
|
+
prevScrollPos = scrollPos;
|
|
2211
|
+
};
|
|
2212
|
+
viewport.addEventListener("scroll", handleScroll);
|
|
2213
|
+
return () => viewport.removeEventListener("scroll", handleScroll);
|
|
2214
|
+
}
|
|
2215
|
+
}, [context.viewport, isHorizontal, send, debounceScrollEnd]);
|
|
2216
|
+
return /* @__PURE__ */ jsx15(Presence, { present: forceMount || state !== "hidden", children: /* @__PURE__ */ jsx15(
|
|
2217
|
+
ScrollAreaScrollbarVisible,
|
|
2218
|
+
{
|
|
2219
|
+
"data-state": state === "hidden" ? "hidden" : "visible",
|
|
2220
|
+
...scrollbarProps,
|
|
2221
|
+
ref: forwardedRef,
|
|
2222
|
+
onPointerEnter: composeEventHandlers(props.onPointerEnter, () => send("POINTER_ENTER")),
|
|
2223
|
+
onPointerLeave: composeEventHandlers(props.onPointerLeave, () => send("POINTER_LEAVE"))
|
|
2224
|
+
}
|
|
2225
|
+
) });
|
|
2226
|
+
});
|
|
2227
|
+
var ScrollAreaScrollbarAuto = React23.forwardRef((props, forwardedRef) => {
|
|
2228
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
2229
|
+
const { forceMount, ...scrollbarProps } = props;
|
|
2230
|
+
const [visible, setVisible] = React23.useState(false);
|
|
2231
|
+
const isHorizontal = props.orientation === "horizontal";
|
|
2232
|
+
const handleResize = useDebounceCallback(() => {
|
|
2233
|
+
if (context.viewport) {
|
|
2234
|
+
const isOverflowX = context.viewport.offsetWidth < context.viewport.scrollWidth;
|
|
2235
|
+
const isOverflowY = context.viewport.offsetHeight < context.viewport.scrollHeight;
|
|
2236
|
+
setVisible(isHorizontal ? isOverflowX : isOverflowY);
|
|
2237
|
+
}
|
|
2238
|
+
}, 10);
|
|
2239
|
+
useResizeObserver(context.viewport, handleResize);
|
|
2240
|
+
useResizeObserver(context.content, handleResize);
|
|
2241
|
+
return /* @__PURE__ */ jsx15(Presence, { present: forceMount || visible, children: /* @__PURE__ */ jsx15(
|
|
2242
|
+
ScrollAreaScrollbarVisible,
|
|
2243
|
+
{
|
|
2244
|
+
"data-state": visible ? "visible" : "hidden",
|
|
2245
|
+
...scrollbarProps,
|
|
2246
|
+
ref: forwardedRef
|
|
2247
|
+
}
|
|
2248
|
+
) });
|
|
2249
|
+
});
|
|
2250
|
+
var ScrollAreaScrollbarVisible = React23.forwardRef((props, forwardedRef) => {
|
|
2251
|
+
const { orientation = "vertical", ...scrollbarProps } = props;
|
|
2252
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
2253
|
+
const thumbRef = React23.useRef(null);
|
|
2254
|
+
const pointerOffsetRef = React23.useRef(0);
|
|
2255
|
+
const [sizes, setSizes] = React23.useState({
|
|
2256
|
+
content: 0,
|
|
2257
|
+
viewport: 0,
|
|
2258
|
+
scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
|
|
2259
|
+
});
|
|
2260
|
+
const thumbRatio = getThumbRatio(sizes.viewport, sizes.content);
|
|
2261
|
+
const commonProps = {
|
|
2262
|
+
...scrollbarProps,
|
|
2263
|
+
sizes,
|
|
2264
|
+
onSizesChange: setSizes,
|
|
2265
|
+
hasThumb: Boolean(thumbRatio > 0 && thumbRatio < 1),
|
|
2266
|
+
onThumbChange: (thumb) => thumbRef.current = thumb,
|
|
2267
|
+
onThumbPointerUp: () => pointerOffsetRef.current = 0,
|
|
2268
|
+
onThumbPointerDown: (pointerPos) => pointerOffsetRef.current = pointerPos
|
|
2269
|
+
};
|
|
2270
|
+
function getScrollPosition(pointerPos, dir) {
|
|
2271
|
+
return getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes, dir);
|
|
2272
|
+
}
|
|
2273
|
+
if (orientation === "horizontal") {
|
|
2274
|
+
return /* @__PURE__ */ jsx15(
|
|
2275
|
+
ScrollAreaScrollbarX,
|
|
2276
|
+
{
|
|
2277
|
+
...commonProps,
|
|
2278
|
+
ref: forwardedRef,
|
|
2279
|
+
onThumbPositionChange: () => {
|
|
2280
|
+
if (context.viewport && thumbRef.current) {
|
|
2281
|
+
const scrollPos = context.viewport.scrollLeft;
|
|
2282
|
+
const offset = getThumbOffsetFromScroll(scrollPos, sizes, context.dir);
|
|
2283
|
+
thumbRef.current.style.transform = `translate3d(${offset}px, 0, 0)`;
|
|
2284
|
+
}
|
|
2285
|
+
},
|
|
2286
|
+
onWheelScroll: (scrollPos) => {
|
|
2287
|
+
if (context.viewport) context.viewport.scrollLeft = scrollPos;
|
|
2288
|
+
},
|
|
2289
|
+
onDragScroll: (pointerPos) => {
|
|
2290
|
+
if (context.viewport) {
|
|
2291
|
+
context.viewport.scrollLeft = getScrollPosition(pointerPos, context.dir);
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
);
|
|
2296
|
+
}
|
|
2297
|
+
if (orientation === "vertical") {
|
|
2298
|
+
return /* @__PURE__ */ jsx15(
|
|
2299
|
+
ScrollAreaScrollbarY,
|
|
2300
|
+
{
|
|
2301
|
+
...commonProps,
|
|
2302
|
+
ref: forwardedRef,
|
|
2303
|
+
onThumbPositionChange: () => {
|
|
2304
|
+
if (context.viewport && thumbRef.current) {
|
|
2305
|
+
const scrollPos = context.viewport.scrollTop;
|
|
2306
|
+
const offset = getThumbOffsetFromScroll(scrollPos, sizes);
|
|
2307
|
+
thumbRef.current.style.transform = `translate3d(0, ${offset}px, 0)`;
|
|
2308
|
+
}
|
|
2309
|
+
},
|
|
2310
|
+
onWheelScroll: (scrollPos) => {
|
|
2311
|
+
if (context.viewport) context.viewport.scrollTop = scrollPos;
|
|
2312
|
+
},
|
|
2313
|
+
onDragScroll: (pointerPos) => {
|
|
2314
|
+
if (context.viewport) context.viewport.scrollTop = getScrollPosition(pointerPos);
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
);
|
|
2318
|
+
}
|
|
2319
|
+
return null;
|
|
2320
|
+
});
|
|
2321
|
+
var ScrollAreaScrollbarX = React23.forwardRef((props, forwardedRef) => {
|
|
2322
|
+
const { sizes, onSizesChange, ...scrollbarProps } = props;
|
|
2323
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
2324
|
+
const [computedStyle, setComputedStyle] = React23.useState();
|
|
2325
|
+
const ref = React23.useRef(null);
|
|
2326
|
+
const composeRefs2 = useComposedRefs(forwardedRef, ref, context.onScrollbarXChange);
|
|
2327
|
+
React23.useEffect(() => {
|
|
2328
|
+
if (ref.current) setComputedStyle(getComputedStyle(ref.current));
|
|
2329
|
+
}, [ref]);
|
|
2330
|
+
return /* @__PURE__ */ jsx15(
|
|
2331
|
+
ScrollAreaScrollbarImpl,
|
|
2332
|
+
{
|
|
2333
|
+
"data-orientation": "horizontal",
|
|
2334
|
+
...scrollbarProps,
|
|
2335
|
+
ref: composeRefs2,
|
|
2336
|
+
sizes,
|
|
2337
|
+
style: {
|
|
2338
|
+
bottom: 0,
|
|
2339
|
+
left: context.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
2340
|
+
right: context.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
2341
|
+
["--radix-scroll-area-thumb-width"]: getThumbSize(sizes) + "px",
|
|
2342
|
+
...props.style
|
|
2343
|
+
},
|
|
2344
|
+
onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.x),
|
|
2345
|
+
onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.x),
|
|
2346
|
+
onWheelScroll: (event, maxScrollPos) => {
|
|
2347
|
+
if (context.viewport) {
|
|
2348
|
+
const scrollPos = context.viewport.scrollLeft + event.deltaX;
|
|
2349
|
+
props.onWheelScroll(scrollPos);
|
|
2350
|
+
if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) {
|
|
2351
|
+
event.preventDefault();
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
},
|
|
2355
|
+
onResize: () => {
|
|
2356
|
+
if (ref.current && context.viewport && computedStyle) {
|
|
2357
|
+
onSizesChange({
|
|
2358
|
+
content: context.viewport.scrollWidth,
|
|
2359
|
+
viewport: context.viewport.offsetWidth,
|
|
2360
|
+
scrollbar: {
|
|
2361
|
+
size: ref.current.clientWidth,
|
|
2362
|
+
paddingStart: toInt(computedStyle.paddingLeft),
|
|
2363
|
+
paddingEnd: toInt(computedStyle.paddingRight)
|
|
2364
|
+
}
|
|
2365
|
+
});
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
);
|
|
2370
|
+
});
|
|
2371
|
+
var ScrollAreaScrollbarY = React23.forwardRef((props, forwardedRef) => {
|
|
2372
|
+
const { sizes, onSizesChange, ...scrollbarProps } = props;
|
|
2373
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
2374
|
+
const [computedStyle, setComputedStyle] = React23.useState();
|
|
2375
|
+
const ref = React23.useRef(null);
|
|
2376
|
+
const composeRefs2 = useComposedRefs(forwardedRef, ref, context.onScrollbarYChange);
|
|
2377
|
+
React23.useEffect(() => {
|
|
2378
|
+
if (ref.current) setComputedStyle(getComputedStyle(ref.current));
|
|
2379
|
+
}, [ref]);
|
|
2380
|
+
return /* @__PURE__ */ jsx15(
|
|
2381
|
+
ScrollAreaScrollbarImpl,
|
|
2382
|
+
{
|
|
2383
|
+
"data-orientation": "vertical",
|
|
2384
|
+
...scrollbarProps,
|
|
2385
|
+
ref: composeRefs2,
|
|
2386
|
+
sizes,
|
|
2387
|
+
style: {
|
|
2388
|
+
top: 0,
|
|
2389
|
+
right: context.dir === "ltr" ? 0 : void 0,
|
|
2390
|
+
left: context.dir === "rtl" ? 0 : void 0,
|
|
2391
|
+
bottom: "var(--radix-scroll-area-corner-height)",
|
|
2392
|
+
["--radix-scroll-area-thumb-height"]: getThumbSize(sizes) + "px",
|
|
2393
|
+
...props.style
|
|
2394
|
+
},
|
|
2395
|
+
onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.y),
|
|
2396
|
+
onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.y),
|
|
2397
|
+
onWheelScroll: (event, maxScrollPos) => {
|
|
2398
|
+
if (context.viewport) {
|
|
2399
|
+
const scrollPos = context.viewport.scrollTop + event.deltaY;
|
|
2400
|
+
props.onWheelScroll(scrollPos);
|
|
2401
|
+
if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) {
|
|
2402
|
+
event.preventDefault();
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
},
|
|
2406
|
+
onResize: () => {
|
|
2407
|
+
if (ref.current && context.viewport && computedStyle) {
|
|
2408
|
+
onSizesChange({
|
|
2409
|
+
content: context.viewport.scrollHeight,
|
|
2410
|
+
viewport: context.viewport.offsetHeight,
|
|
2411
|
+
scrollbar: {
|
|
2412
|
+
size: ref.current.clientHeight,
|
|
2413
|
+
paddingStart: toInt(computedStyle.paddingTop),
|
|
2414
|
+
paddingEnd: toInt(computedStyle.paddingBottom)
|
|
2415
|
+
}
|
|
2416
|
+
});
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
);
|
|
2421
|
+
});
|
|
2422
|
+
var [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME);
|
|
2423
|
+
var ScrollAreaScrollbarImpl = React23.forwardRef((props, forwardedRef) => {
|
|
2424
|
+
const {
|
|
2425
|
+
__scopeScrollArea,
|
|
2426
|
+
sizes,
|
|
2427
|
+
hasThumb,
|
|
2428
|
+
onThumbChange,
|
|
2429
|
+
onThumbPointerUp,
|
|
2430
|
+
onThumbPointerDown,
|
|
2431
|
+
onThumbPositionChange,
|
|
2432
|
+
onDragScroll,
|
|
2433
|
+
onWheelScroll,
|
|
2434
|
+
onResize,
|
|
2435
|
+
...scrollbarProps
|
|
2436
|
+
} = props;
|
|
2437
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea);
|
|
2438
|
+
const [scrollbar, setScrollbar] = React23.useState(null);
|
|
2439
|
+
const composeRefs2 = useComposedRefs(forwardedRef, (node) => setScrollbar(node));
|
|
2440
|
+
const rectRef = React23.useRef(null);
|
|
2441
|
+
const prevWebkitUserSelectRef = React23.useRef("");
|
|
2442
|
+
const viewport = context.viewport;
|
|
2443
|
+
const maxScrollPos = sizes.content - sizes.viewport;
|
|
2444
|
+
const handleWheelScroll = useCallbackRef(onWheelScroll);
|
|
2445
|
+
const handleThumbPositionChange = useCallbackRef(onThumbPositionChange);
|
|
2446
|
+
const handleResize = useDebounceCallback(onResize, 10);
|
|
2447
|
+
function handleDragScroll(event) {
|
|
2448
|
+
if (rectRef.current) {
|
|
2449
|
+
const x = event.clientX - rectRef.current.left;
|
|
2450
|
+
const y = event.clientY - rectRef.current.top;
|
|
2451
|
+
onDragScroll({ x, y });
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
React23.useEffect(() => {
|
|
2455
|
+
const handleWheel = (event) => {
|
|
2456
|
+
const element = event.target;
|
|
2457
|
+
const isScrollbarWheel = scrollbar?.contains(element);
|
|
2458
|
+
if (isScrollbarWheel) handleWheelScroll(event, maxScrollPos);
|
|
2459
|
+
};
|
|
2460
|
+
document.addEventListener("wheel", handleWheel, { passive: false });
|
|
2461
|
+
return () => document.removeEventListener("wheel", handleWheel, { passive: false });
|
|
2462
|
+
}, [viewport, scrollbar, maxScrollPos, handleWheelScroll]);
|
|
2463
|
+
React23.useEffect(handleThumbPositionChange, [sizes, handleThumbPositionChange]);
|
|
2464
|
+
useResizeObserver(scrollbar, handleResize);
|
|
2465
|
+
useResizeObserver(context.content, handleResize);
|
|
2466
|
+
return /* @__PURE__ */ jsx15(
|
|
2467
|
+
ScrollbarProvider,
|
|
2468
|
+
{
|
|
2469
|
+
scope: __scopeScrollArea,
|
|
2470
|
+
scrollbar,
|
|
2471
|
+
hasThumb,
|
|
2472
|
+
onThumbChange: useCallbackRef(onThumbChange),
|
|
2473
|
+
onThumbPointerUp: useCallbackRef(onThumbPointerUp),
|
|
2474
|
+
onThumbPositionChange: handleThumbPositionChange,
|
|
2475
|
+
onThumbPointerDown: useCallbackRef(onThumbPointerDown),
|
|
2476
|
+
children: /* @__PURE__ */ jsx15(
|
|
2477
|
+
Primitive.div,
|
|
2478
|
+
{
|
|
2479
|
+
...scrollbarProps,
|
|
2480
|
+
ref: composeRefs2,
|
|
2481
|
+
style: { position: "absolute", ...scrollbarProps.style },
|
|
2482
|
+
onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
|
|
2483
|
+
const mainPointer = 0;
|
|
2484
|
+
if (event.button === mainPointer) {
|
|
2485
|
+
const element = event.target;
|
|
2486
|
+
element.setPointerCapture(event.pointerId);
|
|
2487
|
+
rectRef.current = scrollbar.getBoundingClientRect();
|
|
2488
|
+
prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;
|
|
2489
|
+
document.body.style.webkitUserSelect = "none";
|
|
2490
|
+
if (context.viewport) context.viewport.style.scrollBehavior = "auto";
|
|
2491
|
+
handleDragScroll(event);
|
|
2492
|
+
}
|
|
2493
|
+
}),
|
|
2494
|
+
onPointerMove: composeEventHandlers(props.onPointerMove, handleDragScroll),
|
|
2495
|
+
onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {
|
|
2496
|
+
const element = event.target;
|
|
2497
|
+
if (element.hasPointerCapture(event.pointerId)) {
|
|
2498
|
+
element.releasePointerCapture(event.pointerId);
|
|
2499
|
+
}
|
|
2500
|
+
document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
|
|
2501
|
+
if (context.viewport) context.viewport.style.scrollBehavior = "";
|
|
2502
|
+
rectRef.current = null;
|
|
2503
|
+
})
|
|
2504
|
+
}
|
|
2505
|
+
)
|
|
2506
|
+
}
|
|
2507
|
+
);
|
|
2508
|
+
});
|
|
2509
|
+
var THUMB_NAME = "ScrollAreaThumb";
|
|
2510
|
+
var ScrollAreaThumb = React23.forwardRef(
|
|
2511
|
+
(props, forwardedRef) => {
|
|
2512
|
+
const { forceMount, ...thumbProps } = props;
|
|
2513
|
+
const scrollbarContext = useScrollbarContext(THUMB_NAME, props.__scopeScrollArea);
|
|
2514
|
+
return /* @__PURE__ */ jsx15(Presence, { present: forceMount || scrollbarContext.hasThumb, children: /* @__PURE__ */ jsx15(ScrollAreaThumbImpl, { ref: forwardedRef, ...thumbProps }) });
|
|
2515
|
+
}
|
|
2516
|
+
);
|
|
2517
|
+
var ScrollAreaThumbImpl = React23.forwardRef(
|
|
2518
|
+
(props, forwardedRef) => {
|
|
2519
|
+
const { __scopeScrollArea, style, ...thumbProps } = props;
|
|
2520
|
+
const scrollAreaContext = useScrollAreaContext(THUMB_NAME, __scopeScrollArea);
|
|
2521
|
+
const scrollbarContext = useScrollbarContext(THUMB_NAME, __scopeScrollArea);
|
|
2522
|
+
const { onThumbPositionChange } = scrollbarContext;
|
|
2523
|
+
const composedRef = useComposedRefs(
|
|
2524
|
+
forwardedRef,
|
|
2525
|
+
(node) => scrollbarContext.onThumbChange(node)
|
|
2526
|
+
);
|
|
2527
|
+
const removeUnlinkedScrollListenerRef = React23.useRef(void 0);
|
|
2528
|
+
const debounceScrollEnd = useDebounceCallback(() => {
|
|
2529
|
+
if (removeUnlinkedScrollListenerRef.current) {
|
|
2530
|
+
removeUnlinkedScrollListenerRef.current();
|
|
2531
|
+
removeUnlinkedScrollListenerRef.current = void 0;
|
|
2532
|
+
}
|
|
2533
|
+
}, 100);
|
|
2534
|
+
React23.useEffect(() => {
|
|
2535
|
+
const viewport = scrollAreaContext.viewport;
|
|
2536
|
+
if (viewport) {
|
|
2537
|
+
const handleScroll = () => {
|
|
2538
|
+
debounceScrollEnd();
|
|
2539
|
+
if (!removeUnlinkedScrollListenerRef.current) {
|
|
2540
|
+
const listener = addUnlinkedScrollListener(viewport, onThumbPositionChange);
|
|
2541
|
+
removeUnlinkedScrollListenerRef.current = listener;
|
|
2542
|
+
onThumbPositionChange();
|
|
2543
|
+
}
|
|
2544
|
+
};
|
|
2545
|
+
onThumbPositionChange();
|
|
2546
|
+
viewport.addEventListener("scroll", handleScroll);
|
|
2547
|
+
return () => viewport.removeEventListener("scroll", handleScroll);
|
|
2548
|
+
}
|
|
2549
|
+
}, [scrollAreaContext.viewport, debounceScrollEnd, onThumbPositionChange]);
|
|
2550
|
+
return /* @__PURE__ */ jsx15(
|
|
2551
|
+
Primitive.div,
|
|
2552
|
+
{
|
|
2553
|
+
"data-state": scrollbarContext.hasThumb ? "visible" : "hidden",
|
|
2554
|
+
...thumbProps,
|
|
2555
|
+
ref: composedRef,
|
|
2556
|
+
style: {
|
|
2557
|
+
width: "var(--radix-scroll-area-thumb-width)",
|
|
2558
|
+
height: "var(--radix-scroll-area-thumb-height)",
|
|
2559
|
+
...style
|
|
2560
|
+
},
|
|
2561
|
+
onPointerDownCapture: composeEventHandlers(props.onPointerDownCapture, (event) => {
|
|
2562
|
+
const thumb = event.target;
|
|
2563
|
+
const thumbRect = thumb.getBoundingClientRect();
|
|
2564
|
+
const x = event.clientX - thumbRect.left;
|
|
2565
|
+
const y = event.clientY - thumbRect.top;
|
|
2566
|
+
scrollbarContext.onThumbPointerDown({ x, y });
|
|
2567
|
+
}),
|
|
2568
|
+
onPointerUp: composeEventHandlers(props.onPointerUp, scrollbarContext.onThumbPointerUp)
|
|
2569
|
+
}
|
|
2570
|
+
);
|
|
2571
|
+
}
|
|
2572
|
+
);
|
|
2573
|
+
ScrollAreaThumb.displayName = THUMB_NAME;
|
|
2574
|
+
var CORNER_NAME = "ScrollAreaCorner";
|
|
2575
|
+
var ScrollAreaCorner = React23.forwardRef(
|
|
2576
|
+
(props, forwardedRef) => {
|
|
2577
|
+
const context = useScrollAreaContext(CORNER_NAME, props.__scopeScrollArea);
|
|
2578
|
+
const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
|
|
2579
|
+
const hasCorner = context.type !== "scroll" && hasBothScrollbarsVisible;
|
|
2580
|
+
return hasCorner ? /* @__PURE__ */ jsx15(ScrollAreaCornerImpl, { ...props, ref: forwardedRef }) : null;
|
|
2581
|
+
}
|
|
2582
|
+
);
|
|
2583
|
+
ScrollAreaCorner.displayName = CORNER_NAME;
|
|
2584
|
+
var ScrollAreaCornerImpl = React23.forwardRef((props, forwardedRef) => {
|
|
2585
|
+
const { __scopeScrollArea, ...cornerProps } = props;
|
|
2586
|
+
const context = useScrollAreaContext(CORNER_NAME, __scopeScrollArea);
|
|
2587
|
+
const [width, setWidth] = React23.useState(0);
|
|
2588
|
+
const [height, setHeight] = React23.useState(0);
|
|
2589
|
+
const hasSize = Boolean(width && height);
|
|
2590
|
+
useResizeObserver(context.scrollbarX, () => {
|
|
2591
|
+
const height2 = context.scrollbarX?.offsetHeight || 0;
|
|
2592
|
+
context.onCornerHeightChange(height2);
|
|
2593
|
+
setHeight(height2);
|
|
2594
|
+
});
|
|
2595
|
+
useResizeObserver(context.scrollbarY, () => {
|
|
2596
|
+
const width2 = context.scrollbarY?.offsetWidth || 0;
|
|
2597
|
+
context.onCornerWidthChange(width2);
|
|
2598
|
+
setWidth(width2);
|
|
2599
|
+
});
|
|
2600
|
+
return hasSize ? /* @__PURE__ */ jsx15(
|
|
2601
|
+
Primitive.div,
|
|
2602
|
+
{
|
|
2603
|
+
...cornerProps,
|
|
2604
|
+
ref: forwardedRef,
|
|
2605
|
+
style: {
|
|
2606
|
+
width,
|
|
2607
|
+
height,
|
|
2608
|
+
position: "absolute",
|
|
2609
|
+
right: context.dir === "ltr" ? 0 : void 0,
|
|
2610
|
+
left: context.dir === "rtl" ? 0 : void 0,
|
|
2611
|
+
bottom: 0,
|
|
2612
|
+
...props.style
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
) : null;
|
|
2616
|
+
});
|
|
2617
|
+
function toInt(value) {
|
|
2618
|
+
return value ? parseInt(value, 10) : 0;
|
|
2619
|
+
}
|
|
2620
|
+
function getThumbRatio(viewportSize, contentSize) {
|
|
2621
|
+
const ratio = viewportSize / contentSize;
|
|
2622
|
+
return isNaN(ratio) ? 0 : ratio;
|
|
2623
|
+
}
|
|
2624
|
+
function getThumbSize(sizes) {
|
|
2625
|
+
const ratio = getThumbRatio(sizes.viewport, sizes.content);
|
|
2626
|
+
const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
|
|
2627
|
+
const thumbSize = (sizes.scrollbar.size - scrollbarPadding) * ratio;
|
|
2628
|
+
return Math.max(thumbSize, 18);
|
|
2629
|
+
}
|
|
2630
|
+
function getScrollPositionFromPointer(pointerPos, pointerOffset, sizes, dir = "ltr") {
|
|
2631
|
+
const thumbSizePx = getThumbSize(sizes);
|
|
2632
|
+
const thumbCenter = thumbSizePx / 2;
|
|
2633
|
+
const offset = pointerOffset || thumbCenter;
|
|
2634
|
+
const thumbOffsetFromEnd = thumbSizePx - offset;
|
|
2635
|
+
const minPointerPos = sizes.scrollbar.paddingStart + offset;
|
|
2636
|
+
const maxPointerPos = sizes.scrollbar.size - sizes.scrollbar.paddingEnd - thumbOffsetFromEnd;
|
|
2637
|
+
const maxScrollPos = sizes.content - sizes.viewport;
|
|
2638
|
+
const scrollRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
|
|
2639
|
+
const interpolate = linearScale([minPointerPos, maxPointerPos], scrollRange);
|
|
2640
|
+
return interpolate(pointerPos);
|
|
2641
|
+
}
|
|
2642
|
+
function getThumbOffsetFromScroll(scrollPos, sizes, dir = "ltr") {
|
|
2643
|
+
const thumbSizePx = getThumbSize(sizes);
|
|
2644
|
+
const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
|
|
2645
|
+
const scrollbar = sizes.scrollbar.size - scrollbarPadding;
|
|
2646
|
+
const maxScrollPos = sizes.content - sizes.viewport;
|
|
2647
|
+
const maxThumbPos = scrollbar - thumbSizePx;
|
|
2648
|
+
const scrollClampRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
|
|
2649
|
+
const scrollWithoutMomentum = clamp2(scrollPos, scrollClampRange);
|
|
2650
|
+
const interpolate = linearScale([0, maxScrollPos], [0, maxThumbPos]);
|
|
2651
|
+
return interpolate(scrollWithoutMomentum);
|
|
2652
|
+
}
|
|
2653
|
+
function linearScale(input, output) {
|
|
2654
|
+
return (value) => {
|
|
2655
|
+
if (input[0] === input[1] || output[0] === output[1]) return output[0];
|
|
2656
|
+
const ratio = (output[1] - output[0]) / (input[1] - input[0]);
|
|
2657
|
+
return output[0] + ratio * (value - input[0]);
|
|
2658
|
+
};
|
|
2659
|
+
}
|
|
2660
|
+
function isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos) {
|
|
2661
|
+
return scrollPos > 0 && scrollPos < maxScrollPos;
|
|
2662
|
+
}
|
|
2663
|
+
var addUnlinkedScrollListener = (node, handler = () => {
|
|
2664
|
+
}) => {
|
|
2665
|
+
let prevPosition = { left: node.scrollLeft, top: node.scrollTop };
|
|
2666
|
+
let rAF = 0;
|
|
2667
|
+
(function loop() {
|
|
2668
|
+
const position = { left: node.scrollLeft, top: node.scrollTop };
|
|
2669
|
+
const isHorizontalScroll = prevPosition.left !== position.left;
|
|
2670
|
+
const isVerticalScroll = prevPosition.top !== position.top;
|
|
2671
|
+
if (isHorizontalScroll || isVerticalScroll) handler();
|
|
2672
|
+
prevPosition = position;
|
|
2673
|
+
rAF = window.requestAnimationFrame(loop);
|
|
2674
|
+
})();
|
|
2675
|
+
return () => window.cancelAnimationFrame(rAF);
|
|
2676
|
+
};
|
|
2677
|
+
function useDebounceCallback(callback, delay) {
|
|
2678
|
+
const handleCallback = useCallbackRef(callback);
|
|
2679
|
+
const debounceTimerRef = React23.useRef(0);
|
|
2680
|
+
React23.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
|
|
2681
|
+
return React23.useCallback(() => {
|
|
2682
|
+
window.clearTimeout(debounceTimerRef.current);
|
|
2683
|
+
debounceTimerRef.current = window.setTimeout(handleCallback, delay);
|
|
2684
|
+
}, [handleCallback, delay]);
|
|
2685
|
+
}
|
|
2686
|
+
function useResizeObserver(element, onResize) {
|
|
2687
|
+
const handleResize = useCallbackRef(onResize);
|
|
2688
|
+
useLayoutEffect22(() => {
|
|
2689
|
+
let rAF = 0;
|
|
2690
|
+
if (element) {
|
|
2691
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
2692
|
+
cancelAnimationFrame(rAF);
|
|
2693
|
+
rAF = window.requestAnimationFrame(handleResize);
|
|
2694
|
+
});
|
|
2695
|
+
resizeObserver.observe(element);
|
|
2696
|
+
return () => {
|
|
2697
|
+
window.cancelAnimationFrame(rAF);
|
|
2698
|
+
resizeObserver.unobserve(element);
|
|
2699
|
+
};
|
|
2700
|
+
}
|
|
2701
|
+
}, [element, handleResize]);
|
|
2702
|
+
}
|
|
2703
|
+
var Root = ScrollArea;
|
|
2704
|
+
var Viewport = ScrollAreaViewport;
|
|
2705
|
+
var Scrollbar = ScrollAreaScrollbar;
|
|
2706
|
+
var Thumb = ScrollAreaThumb;
|
|
2707
|
+
var Corner = ScrollAreaCorner;
|
|
2708
|
+
|
|
2709
|
+
// src/components/layout/ScrollArea.tsx
|
|
2710
|
+
import { clsx as clsx9 } from "clsx";
|
|
2711
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2712
|
+
var ScrollArea2 = ({
|
|
2713
|
+
children,
|
|
2714
|
+
scrollbarSize = "md",
|
|
2715
|
+
scrollbarType = "auto",
|
|
2716
|
+
scrollbarAxis = "both",
|
|
2717
|
+
className,
|
|
2718
|
+
...props
|
|
2719
|
+
}) => {
|
|
2720
|
+
const scrollbarStyle = {
|
|
2721
|
+
sm: { "--scrollbar-size": "calc(4px + var(--spacing))" },
|
|
2722
|
+
md: { "--scrollbar-size": "calc(6px + var(--spacing))" }
|
|
2723
|
+
}[scrollbarSize];
|
|
2724
|
+
const hasHorizontalScrollBar = scrollbarAxis === "horizontal" || scrollbarAxis === "both";
|
|
2725
|
+
const hasVerticalScrollBar = scrollbarAxis === "vertical" || scrollbarAxis === "both";
|
|
2726
|
+
return /* @__PURE__ */ jsxs7(
|
|
2727
|
+
Root,
|
|
2728
|
+
{
|
|
2729
|
+
...props,
|
|
2730
|
+
className: clsx9(
|
|
2731
|
+
"overflow-hidden",
|
|
2732
|
+
className
|
|
2733
|
+
),
|
|
2734
|
+
style: {
|
|
2735
|
+
...scrollbarStyle,
|
|
2736
|
+
...props.style
|
|
2737
|
+
},
|
|
2738
|
+
type: scrollbarType,
|
|
2739
|
+
children: [
|
|
2740
|
+
hasHorizontalScrollBar && /* @__PURE__ */ jsx16(
|
|
2741
|
+
Scrollbar,
|
|
2742
|
+
{
|
|
2743
|
+
orientation: "horizontal",
|
|
2744
|
+
className: clsx9(
|
|
2745
|
+
"peer/horizontal group/scrollbar flex-col-0 rounded-full select-none touch-none bg-scrollbar-track/50 hover:bg-scrollbar-track",
|
|
2746
|
+
{
|
|
2747
|
+
"h-[var(--scrollbar-size)]": scrollbarType === "always",
|
|
2748
|
+
"data-[state=visible]:h-[var(--scrollbar-size)]": scrollbarType !== "always"
|
|
2749
|
+
}
|
|
2750
|
+
),
|
|
2751
|
+
children: /* @__PURE__ */ jsx16(
|
|
2752
|
+
Thumb,
|
|
2753
|
+
{
|
|
2754
|
+
className: clsx9(
|
|
2755
|
+
"flex relative rounded-full bg-scrollbar-thumb group-hover/scrollbar:bg-primary",
|
|
2756
|
+
{
|
|
2757
|
+
"min-h-[var(--scrollbar-size)]": scrollbarType === "always",
|
|
2758
|
+
"data-[state=visible]:min-h-[var(--scrollbar-size)]": scrollbarType !== "always"
|
|
2759
|
+
}
|
|
2760
|
+
)
|
|
2761
|
+
}
|
|
2762
|
+
)
|
|
2763
|
+
}
|
|
2764
|
+
),
|
|
2765
|
+
hasVerticalScrollBar && /* @__PURE__ */ jsx16(
|
|
2766
|
+
Scrollbar,
|
|
2767
|
+
{
|
|
2768
|
+
orientation: "vertical",
|
|
2769
|
+
className: clsx9(
|
|
2770
|
+
"peer/vertical group/scrollbar flex-col-0 rounded-full select-none touch-none bg-scrollbar-track/50 hover:bg-scrollbar-track",
|
|
2771
|
+
{
|
|
2772
|
+
"w-[var(--scrollbar-size)]": scrollbarType === "always",
|
|
2773
|
+
"data-[state=visible]:w-[var(--scrollbar-size)]": scrollbarType !== "always"
|
|
2774
|
+
}
|
|
2775
|
+
),
|
|
2776
|
+
children: /* @__PURE__ */ jsx16(
|
|
2777
|
+
Thumb,
|
|
2778
|
+
{
|
|
2779
|
+
className: clsx9(
|
|
2780
|
+
"flex relative rounded-full bg-scrollbar-thumb group-hover/scrollbar:bg-primary",
|
|
2781
|
+
{
|
|
2782
|
+
"min-w-[var(--scrollbar-size)]": scrollbarType === "always",
|
|
2783
|
+
"data-[state=visible]:min-w-[var(--scrollbar-size)]": scrollbarType !== "always"
|
|
2784
|
+
}
|
|
2785
|
+
)
|
|
2786
|
+
}
|
|
2787
|
+
)
|
|
2788
|
+
}
|
|
2789
|
+
),
|
|
2790
|
+
/* @__PURE__ */ jsx16(
|
|
2791
|
+
Viewport,
|
|
2792
|
+
{
|
|
2793
|
+
className: clsx9(
|
|
2794
|
+
"border-inherit",
|
|
2795
|
+
{
|
|
2796
|
+
"w-[calc(100%_-_var(--scrollbar-size))] h-[calc(100%_-_var(--scrollbar-size))]": scrollbarType === "always",
|
|
2797
|
+
"w-full h-full": scrollbarType === "scroll" || scrollbarType === "hover" || scrollbarType === "auto",
|
|
2798
|
+
"peer-[&:where([data-state=visible])]/horizontal:h-[calc(100%_-_var(--scrollbar-size))] peer-[&:where([data-state=visible])]/vertical:w-[calc(100%_-_var(--scrollbar-size))]": scrollbarType === "auto"
|
|
2799
|
+
}
|
|
2800
|
+
),
|
|
2801
|
+
children
|
|
2802
|
+
}
|
|
2803
|
+
),
|
|
2804
|
+
/* @__PURE__ */ jsx16(
|
|
2805
|
+
Corner,
|
|
2806
|
+
{
|
|
2807
|
+
className: clsx9(
|
|
2808
|
+
"bg-scrollbar-track rounded-full"
|
|
2809
|
+
)
|
|
2810
|
+
}
|
|
2811
|
+
)
|
|
2812
|
+
]
|
|
2813
|
+
}
|
|
2814
|
+
);
|
|
2815
|
+
};
|
|
2816
|
+
|
|
2817
|
+
// src/components/layout/TextImage.tsx
|
|
2818
|
+
import clsx10 from "clsx";
|
|
2819
|
+
|
|
2820
|
+
// src/localization/defaults/form.ts
|
|
2821
|
+
var formTranslation = {
|
|
2822
|
+
en: {
|
|
2823
|
+
add: "Add",
|
|
2824
|
+
all: "All",
|
|
2825
|
+
apply: "Apply",
|
|
2826
|
+
back: "Back",
|
|
2827
|
+
cancel: "Cancel",
|
|
2828
|
+
change: "Change",
|
|
2829
|
+
clear: "Clear",
|
|
2830
|
+
click: "Click",
|
|
2831
|
+
clickToCopy: "Click to Copy",
|
|
2832
|
+
close: "Close",
|
|
2833
|
+
confirm: "Confirm",
|
|
2834
|
+
copy: "Copy",
|
|
2835
|
+
copied: "Copied",
|
|
2836
|
+
create: "Create",
|
|
2837
|
+
decline: "Decline",
|
|
2838
|
+
delete: "Delete",
|
|
2839
|
+
discard: "Discard",
|
|
2840
|
+
discardChanges: "Discard Changes",
|
|
2841
|
+
done: "Done",
|
|
2842
|
+
edit: "Edit",
|
|
2843
|
+
enterText: "Enter text here",
|
|
2844
|
+
error: "Error",
|
|
2845
|
+
exit: "Exit",
|
|
2846
|
+
fieldRequiredError: "This field is required.",
|
|
2847
|
+
invalidEmailError: "Please enter a valid email address.",
|
|
2848
|
+
less: "Less",
|
|
2849
|
+
loading: "Loading",
|
|
2850
|
+
maxLengthError: "Maximum length exceeded.",
|
|
2851
|
+
minLengthError: "Minimum length not met.",
|
|
2852
|
+
more: "More",
|
|
2853
|
+
next: "Next",
|
|
2854
|
+
no: "No",
|
|
2855
|
+
none: "None",
|
|
2856
|
+
nothingFound: "Nothing found",
|
|
2857
|
+
of: "of",
|
|
2858
|
+
optional: "Optional",
|
|
2859
|
+
pleaseWait: "Please wait...",
|
|
2860
|
+
previous: "Previous",
|
|
2861
|
+
remove: "Remove",
|
|
2862
|
+
required: "Required",
|
|
2863
|
+
reset: "Reset",
|
|
2864
|
+
save: "Save",
|
|
2865
|
+
saved: "Saved",
|
|
2866
|
+
search: "Search",
|
|
2867
|
+
select: "Select",
|
|
2868
|
+
selectOption: "Select an option",
|
|
2869
|
+
show: "Show",
|
|
2870
|
+
showMore: "Show more",
|
|
2871
|
+
showLess: "Show less",
|
|
2872
|
+
submit: "Submit",
|
|
2873
|
+
success: "Success",
|
|
2874
|
+
update: "Update",
|
|
2875
|
+
unsavedChanges: "Unsaved Changes",
|
|
2876
|
+
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
2877
|
+
yes: "Yes"
|
|
2878
|
+
},
|
|
2879
|
+
de: {
|
|
2880
|
+
add: "Hinzuf\xFCgen",
|
|
2881
|
+
all: "Alle",
|
|
2882
|
+
apply: "Anwenden",
|
|
2883
|
+
back: "Zur\xFCck",
|
|
2884
|
+
cancel: "Abbrechen",
|
|
2885
|
+
change: "\xC4ndern",
|
|
2886
|
+
clear: "L\xF6schen",
|
|
2887
|
+
click: "Klicken",
|
|
2888
|
+
clickToCopy: "Zum kopieren klicken",
|
|
2889
|
+
close: "Schlie\xDFen",
|
|
2890
|
+
confirm: "Best\xE4tigen",
|
|
2891
|
+
copy: "Kopieren",
|
|
2892
|
+
copied: "Kopiert",
|
|
2893
|
+
create: "Erstellen",
|
|
2894
|
+
decline: "Ablehnen",
|
|
2895
|
+
delete: "L\xF6schen",
|
|
2896
|
+
discard: "Verwerfen",
|
|
2897
|
+
discardChanges: "\xC4nderungen Verwerfen",
|
|
2898
|
+
done: "Fertig",
|
|
2899
|
+
edit: "Bearbeiten",
|
|
2900
|
+
enterText: "Text hier eingeben",
|
|
2901
|
+
error: "Fehler",
|
|
2902
|
+
exit: "Beenden",
|
|
2903
|
+
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
2904
|
+
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
2905
|
+
less: "Weniger",
|
|
2906
|
+
loading: "L\xE4dt",
|
|
2907
|
+
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
2908
|
+
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
2909
|
+
more: "Mehr",
|
|
2910
|
+
next: "Weiter",
|
|
2911
|
+
no: "Nein",
|
|
2912
|
+
none: "Nichts",
|
|
2913
|
+
nothingFound: "Nichts gefunden",
|
|
2914
|
+
of: "von",
|
|
2915
|
+
optional: "Optional",
|
|
2916
|
+
pleaseWait: "Bitte warten...",
|
|
2917
|
+
previous: "Vorherige",
|
|
2918
|
+
remove: "Entfernen",
|
|
2919
|
+
required: "Erforderlich",
|
|
2920
|
+
reset: "Zur\xFCcksetzen",
|
|
2921
|
+
save: "Speichern",
|
|
2922
|
+
saved: "Gespeichert",
|
|
2923
|
+
search: "Suche",
|
|
2924
|
+
select: "Select",
|
|
2925
|
+
selectOption: "Option ausw\xE4hlen",
|
|
2926
|
+
show: "Anzeigen",
|
|
2927
|
+
showMore: "Mehr anzeigen",
|
|
2928
|
+
showLess: "Weniger anzeigen",
|
|
2929
|
+
submit: "Abschicken",
|
|
2930
|
+
success: "Erfolg",
|
|
2931
|
+
update: "Update",
|
|
2932
|
+
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
2933
|
+
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
2934
|
+
yes: "Ja"
|
|
2935
|
+
}
|
|
2936
|
+
};
|
|
2937
|
+
|
|
2938
|
+
// src/components/layout/TextImage.tsx
|
|
2939
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2940
|
+
var TextImage = ({
|
|
2941
|
+
overwriteTranslation,
|
|
2942
|
+
title,
|
|
2943
|
+
description,
|
|
2944
|
+
imageUrl,
|
|
2945
|
+
onShowMoreClicked,
|
|
2946
|
+
color = "primary",
|
|
2947
|
+
badge,
|
|
2948
|
+
contentClassName = "",
|
|
2949
|
+
className = ""
|
|
2950
|
+
}) => {
|
|
2951
|
+
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
2952
|
+
const chipColorMapping = {
|
|
2953
|
+
primary: "text-text-image-primary-background bg-text-image-primary-text",
|
|
2954
|
+
secondary: "text-text-image-secondary-background bg-text-image-secondary-text",
|
|
2955
|
+
dark: "text-text-image-dark-background bg-text-image-dark-text"
|
|
2956
|
+
};
|
|
2957
|
+
const colorMapping = {
|
|
2958
|
+
primary: "text-text-image-primary-text bg-linear-to-r from-30% from-text-image-primary-background to-text-image-primary-background/55",
|
|
2959
|
+
secondary: "text-text-image-secondary-text bg-linear-to-r from-30% from-text-image-secondary-background to-text-image-secondary-background/55",
|
|
2960
|
+
dark: "text-text-image-dark-text bg-linear-to-r from-30% from-text-image-dark-background to-text-image-dark-background/55"
|
|
2961
|
+
};
|
|
2962
|
+
return /* @__PURE__ */ jsx17(
|
|
2963
|
+
"div",
|
|
2964
|
+
{
|
|
2965
|
+
className: clsx10("rounded-2xl w-full", className),
|
|
2966
|
+
style: {
|
|
2967
|
+
backgroundImage: `url(${imageUrl})`,
|
|
2968
|
+
backgroundSize: "cover"
|
|
2969
|
+
},
|
|
2970
|
+
children: /* @__PURE__ */ jsxs8(
|
|
2971
|
+
"div",
|
|
2972
|
+
{
|
|
2973
|
+
className: clsx10(`flex-col-2 px-6 py-12 rounded-2xl h-full`, colorMapping[color], contentClassName),
|
|
2974
|
+
children: [
|
|
2975
|
+
badge && /* @__PURE__ */ jsx17("div", { className: clsx10(`chip-full mb-2 py-2 px-4 w-fit`, chipColorMapping[color]), children: /* @__PURE__ */ jsx17("span", { className: "text-lg font-bold", children: badge }) }),
|
|
2976
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex-col-1 overflow-hidden", children: [
|
|
2977
|
+
/* @__PURE__ */ jsx17("span", { className: "typography-title-lg-semibold", children: title }),
|
|
2978
|
+
/* @__PURE__ */ jsx17("span", { className: "text-ellipsis overflow-hidden", children: description })
|
|
2979
|
+
] }),
|
|
2980
|
+
onShowMoreClicked && /* @__PURE__ */ jsx17("div", { className: "flex-row-2 mt-2 underline", children: /* @__PURE__ */ jsx17("button", { onClick: onShowMoreClicked, children: translation("showMore") }) })
|
|
2981
|
+
]
|
|
2982
|
+
}
|
|
2983
|
+
)
|
|
2984
|
+
}
|
|
2985
|
+
);
|
|
2986
|
+
};
|
|
2987
|
+
|
|
2988
|
+
// src/components/layout/VerticalDivider.tsx
|
|
2989
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2990
|
+
var VerticalDivider = ({
|
|
2991
|
+
width = 1,
|
|
2992
|
+
height = 100,
|
|
2993
|
+
strokeWidth = 4,
|
|
2994
|
+
dashGap = 4,
|
|
2995
|
+
dashLength = 4
|
|
2996
|
+
}) => {
|
|
2997
|
+
return /* @__PURE__ */ jsx18("div", { style: { width: width + "px", height: height + "px" }, children: /* @__PURE__ */ jsxs9(
|
|
2998
|
+
"svg",
|
|
2999
|
+
{
|
|
3000
|
+
width,
|
|
3001
|
+
height,
|
|
3002
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
3003
|
+
fill: "none",
|
|
3004
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3005
|
+
children: [
|
|
3006
|
+
/* @__PURE__ */ jsx18(
|
|
3007
|
+
"line",
|
|
3008
|
+
{
|
|
3009
|
+
opacity: "0.5",
|
|
3010
|
+
x1: width / 2,
|
|
3011
|
+
y1: height,
|
|
3012
|
+
x2: width / 2,
|
|
3013
|
+
y2: "0",
|
|
3014
|
+
stroke: "url(#paint_linear)",
|
|
3015
|
+
strokeWidth,
|
|
3016
|
+
strokeDasharray: `${dashLength} ${dashLength + dashGap}`,
|
|
3017
|
+
strokeLinecap: "round"
|
|
3018
|
+
}
|
|
3019
|
+
),
|
|
3020
|
+
/* @__PURE__ */ jsx18("defs", { children: /* @__PURE__ */ jsxs9(
|
|
3021
|
+
"linearGradient",
|
|
3022
|
+
{
|
|
3023
|
+
id: "paint_linear",
|
|
3024
|
+
x1: width / 2,
|
|
3025
|
+
y1: "0",
|
|
3026
|
+
x2: width / 2,
|
|
3027
|
+
y2: height,
|
|
3028
|
+
gradientUnits: "userSpaceOnUse",
|
|
3029
|
+
children: [
|
|
3030
|
+
/* @__PURE__ */ jsx18("stop", { stopOpacity: "0", stopColor: "currentColor" }),
|
|
3031
|
+
/* @__PURE__ */ jsx18("stop", { offset: "0.5", stopColor: "currentColor" }),
|
|
3032
|
+
/* @__PURE__ */ jsx18("stop", { offset: "1", stopColor: "currentColor", stopOpacity: "0" })
|
|
3033
|
+
]
|
|
3034
|
+
}
|
|
3035
|
+
) })
|
|
3036
|
+
]
|
|
3037
|
+
}
|
|
3038
|
+
) });
|
|
3039
|
+
};
|
|
3040
|
+
export {
|
|
3041
|
+
ASTNodeInterpreter,
|
|
3042
|
+
Carousel,
|
|
3043
|
+
CarouselSlide,
|
|
3044
|
+
Chip,
|
|
3045
|
+
ChipList,
|
|
3046
|
+
ChipUtil,
|
|
3047
|
+
DividerInserter,
|
|
3048
|
+
Expandable,
|
|
3049
|
+
ExpandableUncontrolled,
|
|
3050
|
+
ExpansionIcon,
|
|
3051
|
+
FAQSection,
|
|
3052
|
+
FloatingContainer,
|
|
3053
|
+
ListBox,
|
|
3054
|
+
ListBoxItem,
|
|
3055
|
+
ListBoxMultiple,
|
|
3056
|
+
ListBoxMultipleUncontrolled,
|
|
3057
|
+
ListBoxPrimitive,
|
|
3058
|
+
ListBoxUncontrolled,
|
|
3059
|
+
MarkdownInterpreter,
|
|
3060
|
+
ScrollArea2 as ScrollArea,
|
|
3061
|
+
TextImage,
|
|
3062
|
+
VerticalDivider
|
|
3063
|
+
};
|
|
3064
|
+
//# sourceMappingURL=index.mjs.map
|