@helpwave/hightide 0.1.23 → 0.1.25
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/components/date/DatePicker.js +48 -53
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +58 -63
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs +4 -4
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/TimeDisplay.js.map +1 -1
- package/dist/components/date/TimeDisplay.mjs +2 -2
- package/dist/components/date/TimeDisplay.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +26 -29
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +31 -34
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.js +40 -43
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +48 -51
- package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.js +40 -43
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +40 -43
- package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.js +40 -43
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +46 -49
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.js +40 -43
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +50 -53
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.js +40 -43
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +50 -53
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.js +26 -29
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +30 -33
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.mjs +2 -2
- package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
- package/dist/components/loading-states/ErrorComponent.js.map +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs +2 -2
- package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs +2 -2
- package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
- package/dist/components/loading-states/LoadingButton.js +26 -29
- package/dist/components/loading-states/LoadingButton.js.map +1 -1
- package/dist/components/loading-states/LoadingButton.mjs +26 -29
- package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
- package/dist/components/modals/ConfirmModal.js +40 -43
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +48 -51
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.js +40 -43
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +48 -51
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.js +40 -43
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +48 -51
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +43 -49
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +67 -73
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +43 -49
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +68 -74
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +96 -75
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +98 -77
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +48 -53
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +50 -55
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.js +114 -93
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +135 -114
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +48 -53
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +50 -55
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +48 -53
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +50 -55
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.js +65 -73
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +86 -94
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +51 -56
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +57 -62
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/table/Table.js +88 -65
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +114 -91
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/TableFilterButton.js +40 -43
- package/dist/components/table/TableFilterButton.js.map +1 -1
- package/dist/components/table/TableFilterButton.mjs +44 -47
- package/dist/components/table/TableFilterButton.mjs.map +1 -1
- package/dist/components/table/TableSortButton.js +40 -43
- package/dist/components/table/TableSortButton.js.map +1 -1
- package/dist/components/table/TableSortButton.mjs +40 -43
- package/dist/components/table/TableSortButton.mjs.map +1 -1
- package/dist/components/user-action/Button.d.mts +3 -3
- package/dist/components/user-action/Button.d.ts +3 -3
- package/dist/components/user-action/Button.js +76 -84
- package/dist/components/user-action/Button.js.map +1 -1
- package/dist/components/user-action/Button.mjs +76 -84
- package/dist/components/user-action/Button.mjs.map +1 -1
- package/dist/components/user-action/Checkbox.js +48 -22
- package/dist/components/user-action/Checkbox.js.map +1 -1
- package/dist/components/user-action/Checkbox.mjs +48 -22
- package/dist/components/user-action/Checkbox.mjs.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.mjs +2 -2
- package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +48 -53
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +60 -65
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/MultiSelect.js +92 -69
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +114 -91
- package/dist/components/user-action/MultiSelect.mjs.map +1 -1
- package/dist/components/user-action/SearchBar.js +40 -43
- package/dist/components/user-action/SearchBar.js.map +1 -1
- package/dist/components/user-action/SearchBar.mjs +42 -45
- package/dist/components/user-action/SearchBar.mjs.map +1 -1
- package/dist/components/user-action/Select.js +43 -49
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +49 -55
- package/dist/components/user-action/Select.mjs.map +1 -1
- package/dist/components/user-action/Textarea.js +3 -3
- package/dist/components/user-action/Textarea.js.map +1 -1
- package/dist/components/user-action/Textarea.mjs +3 -3
- package/dist/components/user-action/Textarea.mjs.map +1 -1
- package/dist/css/globals.css +269 -136
- package/dist/css/uncompiled/theme/index.css +1 -2
- package/dist/hooks/useLocalStorage.js +1 -3
- package/dist/hooks/useLocalStorage.js.map +1 -1
- package/dist/hooks/useLocalStorage.mjs +3 -4
- package/dist/hooks/useLocalStorage.mjs.map +1 -1
- package/dist/index.js +141 -129
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +216 -204
- package/dist/index.mjs.map +1 -1
- package/dist/localization/LanguageProvider.js +0 -3
- package/dist/localization/LanguageProvider.js.map +1 -1
- package/dist/localization/LanguageProvider.mjs +5 -8
- package/dist/localization/LanguageProvider.mjs.map +1 -1
- package/dist/localization/useTranslation.js.map +1 -1
- package/dist/localization/useTranslation.mjs +2 -2
- package/dist/localization/useTranslation.mjs.map +1 -1
- package/dist/theming/useTheme.js +3 -6
- package/dist/theming/useTheme.js.map +1 -1
- package/dist/theming/useTheme.mjs +8 -11
- package/dist/theming/useTheme.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/css/uncompiled/theme/theme.css +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/layout-and-navigation/Carousel.tsx","../../../src/util/array.ts","../../../src/util/math.ts","../../../src/util/easeFunctions.ts","../../../src/util/loopingArray.ts","../../../src/components/user-action/Button.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport clsx from 'clsx'\nimport { ChevronLeft, ChevronRight } from 'lucide-react'\nimport { createLoopingListWithIndex, range } from '../../util/array'\nimport { clamp } from '../../util/math'\nimport { EaseFunctions } from '../../util/easeFunctions'\nimport type { Direction } from '../../util/loopingArray'\nimport { LoopingArrayCalculator } from '../../util/loopingArray'\nimport { IconButton } from '../user-action/Button'\n\n\nexport type CarouselProps = {\n children: ReactNode[],\n animationTime?: number,\n isLooping?: boolean,\n isAutoLooping?: boolean,\n autoLoopingTimeOut?: number,\n autoLoopAnimationTime?: number,\n hintNext?: boolean,\n arrows?: boolean,\n dots?: boolean,\n /**\n * Percentage that is allowed to be scrolled further\n */\n overScrollThreshold?: number,\n blurColor?: string,\n className?: string,\n heightClassName?: string,\n widthClassName?: string,\n}\n\ntype ItemType = {\n item: ReactNode,\n index: number,\n}\n\ntype CarouselAnimationState = {\n targetPosition: number,\n /**\n * Value of either 1 or -1, 1 is forwards -1 is backwards\n */\n direction: Direction,\n startPosition: number,\n startTime?: number,\n lastUpdateTime?: number,\n isAutoLooping: boolean,\n}\n\ntype DragState = {\n startX: number,\n startTime: number,\n lastX: number,\n startIndex: number,\n}\n\ntype CarouselInformation = {\n currentPosition: number,\n dragState?: DragState,\n animationState?: CarouselAnimationState,\n}\n\nexport const Carousel = ({\n children,\n animationTime = 200,\n isLooping = false,\n isAutoLooping = false,\n autoLoopingTimeOut = 5000,\n autoLoopAnimationTime = 500,\n hintNext = false,\n arrows = false,\n dots = true,\n overScrollThreshold = 0.1,\n blurColor = 'from-background',\n className = '',\n heightClassName = 'h-96',\n widthClassName = 'w-[70%] desktop:w-1/2',\n }: CarouselProps) => {\n if (isAutoLooping && !isLooping) {\n console.error('When isAutoLooping is true, isLooping should also be true')\n isLooping = true\n }\n\n const [{\n currentPosition,\n dragState,\n animationState,\n }, setCarouselInformation] = useState<CarouselInformation>({\n currentPosition: 0,\n })\n const animationId = useRef<number | undefined>(undefined)\n const timeOut = useRef<NodeJS.Timeout | undefined>(undefined)\n autoLoopingTimeOut = Math.max(0, autoLoopingTimeOut)\n\n const length = children.length\n const paddingItemCount = 3 // The number of items to append left and right of the list to allow for clean transition when looping\n\n const util = useMemo(() => new LoopingArrayCalculator(length, isLooping, overScrollThreshold), [length, isLooping, overScrollThreshold])\n const currentIndex = util.getCorrectedPosition(LoopingArrayCalculator.withoutOffset(currentPosition))\n animationTime = Math.max(200, animationTime) // in ms, must be > 0\n autoLoopAnimationTime = Math.max(200, autoLoopAnimationTime)\n\n const getStyleOffset = (index: number) => {\n const baseOffset = -50 + (index - currentPosition) * 100\n return `${baseOffset}%`\n }\n\n const animation = useCallback((time: number) => {\n let keepAnimating: boolean = true\n\n // Other calculation in the setState call to avoid updating the useCallback to often\n setCarouselInformation((state) => {\n const {\n animationState,\n dragState\n } = state\n if (animationState === undefined || dragState !== undefined) {\n keepAnimating = false\n return state\n }\n if (!animationState.startTime || !animationState.lastUpdateTime) {\n return {\n ...state,\n animationState: {\n ...animationState,\n startTime: time,\n lastUpdateTime: time\n }\n }\n }\n const useAnimationTime = animationState.isAutoLooping ? autoLoopAnimationTime : animationTime\n const progress = clamp((time - animationState.startTime) / useAnimationTime) // progress\n const easedProgress = EaseFunctions.easeInEaseOut(progress)\n const distance = util.getDistanceDirectional(animationState.startPosition, animationState.targetPosition, animationState.direction)\n const newPosition = util.getCorrectedPosition(easedProgress * distance * animationState.direction + animationState.startPosition)\n\n if (animationState.targetPosition === newPosition || progress === 1) {\n keepAnimating = false\n return ({\n currentPosition: LoopingArrayCalculator.withoutOffset(newPosition),\n animationState: undefined\n })\n }\n return ({\n currentPosition: newPosition,\n animationState: {\n ...animationState!,\n lastUpdateTime: time\n }\n })\n })\n if (keepAnimating) {\n animationId.current = requestAnimationFrame(time1 => animation(time1))\n }\n }, [animationTime, autoLoopAnimationTime, util])\n\n useEffect(() => {\n if (animationState) {\n animationId.current = requestAnimationFrame(animation)\n }\n return () => {\n if (animationId.current) {\n cancelAnimationFrame(animationId.current)\n animationId.current = 0\n }\n }\n }, [animationState]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const startAutoLoop = () => setCarouselInformation(prevState => ({\n ...prevState,\n dragState: prevState.dragState,\n animationState: prevState.animationState || prevState.dragState ? prevState.animationState : {\n startPosition: currentPosition,\n targetPosition: (currentPosition + 1) % length,\n direction: 1, // always move forward\n isAutoLooping: true\n }\n }))\n\n useEffect(() => {\n if (!animationId.current && !animationState && !dragState && !timeOut.current) {\n if (autoLoopingTimeOut > 0) {\n timeOut.current = setTimeout(() => {\n startAutoLoop()\n timeOut.current = undefined\n }, autoLoopingTimeOut)\n } else {\n startAutoLoop()\n }\n }\n }, [animationState, dragState, animationId.current, timeOut.current]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const startAnimation = (targetPosition?: number) => {\n if (targetPosition === undefined) {\n targetPosition = LoopingArrayCalculator.withoutOffset(currentPosition)\n }\n if (targetPosition === currentPosition) {\n return // we are exactly where we want to be\n }\n\n // find target index and fastest path to it\n const direction = util.getBestDirection(currentPosition, targetPosition)\n clearTimeout(timeOut.current)\n timeOut.current = undefined\n if (animationId.current) {\n cancelAnimationFrame(animationId.current)\n animationId.current = undefined\n }\n\n setCarouselInformation(prevState => ({\n ...prevState,\n dragState: undefined,\n animationState: {\n targetPosition: targetPosition!,\n direction,\n startPosition: currentPosition,\n isAutoLooping: false\n },\n timeOut: undefined\n }))\n }\n\n const canGoLeft = () => {\n return isLooping || currentPosition !== 0\n }\n\n const canGoRight = () => {\n return isLooping || currentPosition !== length - 1\n }\n\n const left = () => {\n if (canGoLeft()) {\n startAnimation(currentPosition === 0 ? length - 1 : LoopingArrayCalculator.withoutOffset(currentPosition - 1))\n }\n }\n\n const right = () => {\n if (canGoRight()) {\n startAnimation(LoopingArrayCalculator.withoutOffset((currentPosition + 1) % length))\n }\n }\n\n let items: ItemType[] = children.map((item, index) => ({\n index,\n item\n }))\n\n if (isLooping) {\n const before = createLoopingListWithIndex(children, length - 1, paddingItemCount, false).reverse().map(([index, item]) => ({\n index,\n item\n }))\n const after = createLoopingListWithIndex(children, 0, paddingItemCount).map(([index, item]) => ({\n index,\n item\n }))\n items = [\n ...before,\n ...items,\n ...after\n ]\n }\n\n const onDragStart = (x: number) => setCarouselInformation(prevState => ({\n ...prevState,\n dragState: {\n lastX: x,\n startX: x,\n startTime: Date.now(),\n startIndex: currentPosition,\n },\n animationState: undefined // cancel animation\n }))\n\n const onDrag = (x: number, width: number) => {\n // For some weird reason the clientX is 0 on the last dragUpdate before drag end causing issues\n if (!dragState || x === 0) {\n return\n }\n const offsetUpdate = (dragState.lastX - x) / width\n const newPosition = util.getCorrectedPosition(currentPosition + offsetUpdate)\n\n setCarouselInformation(prevState => ({\n ...prevState,\n currentPosition: newPosition,\n dragState: {\n ...dragState,\n lastX: x\n },\n }))\n }\n\n const onDragEnd = (x: number, width: number) => {\n if (!dragState) {\n return\n }\n const distance = dragState.startX - x\n const relativeDistance = distance / width\n const duration = (Date.now() - dragState.startTime) // in milliseconds\n const velocity = distance / (Date.now() - dragState.startTime)\n\n const isSlide = Math.abs(velocity) > 2 || (duration < 200 && (Math.abs(relativeDistance) > 0.2 || Math.abs(distance) > 50))\n if (isSlide) {\n if (distance > 0 && canGoRight()) {\n right()\n return\n } else if (distance < 0 && canGoLeft()) {\n left()\n return\n }\n }\n startAnimation()\n }\n\n const dragHandlers = {\n draggable: true,\n onDragStart: (event: React.DragEvent<HTMLDivElement>) => {\n onDragStart(event.clientX)\n event.dataTransfer.setDragImage(document.createElement('div'), 0, 0)\n },\n onDrag: (event: React.DragEvent<HTMLDivElement>) => onDrag(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onDragEnd: (event: React.DragEvent<HTMLDivElement>) => onDragEnd(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => onDragStart(event.touches[0]!.clientX),\n onTouchMove: (event: React.TouchEvent<HTMLDivElement>) => onDrag(event.touches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchEnd: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchCancel: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n }\n\n return (\n <div className=\"flex-col-2 items-center w-full\">\n <div className={clsx(`relative w-full overflow-hidden`, heightClassName, className)}>\n {arrows && (\n <>\n <IconButton\n color=\"neutral\"\n className={clsx('absolute z-10 left-0 top-1/2 -translate-y-1/2 shadow-md', { hidden: !canGoLeft() })}\n disabled={!canGoLeft()}\n onClick={() => left()}\n >\n <ChevronLeft size={24}/>\n </IconButton>\n <IconButton\n color=\"neutral\"\n className={clsx('absolute z-10 right-0 top-1/2 -translate-y-1/2 shadow-md', { hidden: !canGoRight() })}\n disabled={!canGoRight()}\n onClick={() => right()}\n >\n <ChevronRight size={24}/>\n </IconButton>\n </>\n )}\n {hintNext ? (\n <div className={clsx(`flex-row-2 relative h-full`, heightClassName)}>\n <div className=\"flex-row-2 relative h-full w-full px-2 overflow-hidden\">\n {items.map(({\n item,\n index\n }, listIndex) => (\n <div\n key={listIndex}\n className={clsx(`absolute left-[50%] h-full overflow-hidden`, widthClassName, { '!cursor-grabbing': !!dragState })}\n style={{ translate: getStyleOffset(listIndex - (isLooping ? paddingItemCount : 0)) }}\n {...dragHandlers}\n onClick={() => startAnimation(index)}\n >\n {item}\n </div>\n ))}\n </div>\n <div\n className={clsx(`hidden pointer-events-none desktop:block absolute left-0 h-full w-[20%] bg-gradient-to-r to-transparent`, blurColor)}\n />\n <div\n className={clsx(`hidden pointer-events-none desktop:block absolute right-0 h-full w-[20%] bg-gradient-to-l to-transparent`, blurColor)}\n />\n </div>\n ) : (\n <div className={clsx('px-16 h-full', { '!cursor-grabbing': !!dragState })} {...dragHandlers}>\n {children[currentIndex]}\n </div>\n )}\n </div>\n {dots && (\n <div\n className=\"flex-row-2 items-center justify-center w-full my-2\">\n {range(length).map(index => (\n <button\n key={index}\n className={clsx('w-8 min-w-8 h-3 min-h-3 first:rounded-l-md last:rounded-r-md', {\n 'bg-carousel-dot-disabled hover:bg-carousel-dot-active': currentIndex !== index,\n 'bg-carousel-dot-active hover:brightness-90': currentIndex === index\n })}\n onClick={() => startAnimation(index)}\n />\n ))}\n </div>\n )}\n </div>\n )\n}\n","export const equalSizeGroups = <T>(array: T[], groupSize: number): T[][] => {\n if (groupSize <= 0) {\n console.warn(`group size should be greater than 0: groupSize = ${groupSize}`)\n return [[...array]]\n }\n\n const groups = []\n for (let i = 0; i < array.length; i += groupSize) {\n groups.push(array.slice(i, Math.min(i + groupSize, array.length)))\n }\n return groups\n}\n\nexport type RangeOptions = {\n /** Whether the range can be defined empty via end < start without a warning */\n allowEmptyRange: boolean,\n stepSize: number,\n exclusiveStart: boolean,\n exclusiveEnd: boolean,\n}\n\nconst defaultRangeOptions: RangeOptions = {\n allowEmptyRange: false,\n stepSize: 1,\n exclusiveStart: false,\n exclusiveEnd: true,\n}\n\n/**\n * @param endOrRange The end value or a range [start, end], end is exclusive\n * @param options the options for defining the range\n */\nexport const range = (endOrRange: number | [number, number], options?: Partial<RangeOptions>): number[] => {\n const { allowEmptyRange, stepSize, exclusiveStart, exclusiveEnd } = { ...defaultRangeOptions, ...options }\n let start = 0\n let end: number\n if (typeof endOrRange === 'number') {\n end = endOrRange\n } else {\n start = endOrRange[0]\n end = endOrRange[1]\n }\n if (!exclusiveEnd) {\n end -= 1\n }\n if (exclusiveStart) {\n start += 1\n }\n\n if (end - 1 < start) {\n if (!allowEmptyRange) {\n console.warn(`range: end (${end}) < start (${start}) should be allowed explicitly, set options.allowEmptyRange to true`)\n }\n return []\n }\n return Array.from({ length: end - start }, (_, index) => index * stepSize + start)\n}\n\n/** Finds the closest match\n * @param list The list of all possible matches\n * @param firstCloser Return whether item1 is closer than item2\n */\nexport const closestMatch = <T>(list: T[], firstCloser: (item1: T, item2: T) => boolean) => {\n return list.reduce((item1, item2) => {\n return firstCloser(item1, item2) ? item1 : item2\n })\n}\n\n/**\n * returns the item in middle of a list and its neighbours before and after\n * e.g. [1,2,3,4,5,6] for item = 1 would return [5,6,1,2,3]\n */\nexport const getNeighbours = <T>(list: T[], item: T, neighbourDistance: number = 2) => {\n const index = list.indexOf(item)\n const totalItems = neighbourDistance * 2 + 1\n if (list.length < totalItems) {\n console.warn('List is to short')\n return list\n }\n\n if (index === -1) {\n console.error('item not found in list')\n return list.splice(0, totalItems)\n }\n\n let start = index - neighbourDistance\n if (start < 0) {\n start += list.length\n }\n const end = (index + neighbourDistance + 1) % list.length\n\n const result: T[] = []\n let ignoreOnce = list.length === totalItems\n for (let i = start; i !== end || ignoreOnce; i = (i + 1) % list.length) {\n result.push(list[i]!)\n if (end === i && ignoreOnce) {\n ignoreOnce = false\n }\n }\n return result\n}\n\nexport const createLoopingListWithIndex = <T>(list: T[], startIndex: number = 0, length: number = 0, forwards: boolean = true) => {\n if (length < 0) {\n console.warn(`createLoopingList: length must be >= 0, given ${length}`)\n } else if (length === 0) {\n length = list.length\n }\n\n const returnList: [number, T][] = []\n\n if (forwards) {\n for (let i = startIndex; returnList.length < length; i = (i + 1) % list.length) {\n returnList.push([i, list[i]!])\n }\n } else {\n for (let i = startIndex; returnList.length < length; i = i === 0 ? i = list.length - 1 : i - 1) {\n returnList.push([i, list[i]!])\n }\n }\n\n return returnList\n}\n\nexport const createLoopingList = <T>(list: T[], startIndex: number = 0, length: number = 0, forwards: boolean = true) => {\n return createLoopingListWithIndex(list, startIndex, length, forwards).map(([_, item]) => item)\n}\n\nexport const ArrayUtil = {\n unique: <T>(list: T[]): T[] => {\n const seen = new Set<T>()\n return list.filter((item) => {\n if (seen.has(item)) {\n return false\n }\n seen.add(item)\n return true\n })\n },\n\n difference: <T>(list: T[], removeList: T[]): T[] => {\n const remove = new Set<T>(removeList)\n return list.filter((item) => !remove.has(item))\n }\n}\n","export const clamp = (value: number, min: number = 0, max: number = 1): number => {\n return Math.min(Math.max(value, min), max)\n}\n","import { clamp } from './math'\n\nexport type EaseFunction = (t: number) => number\n\nexport class EaseFunctions {\n static cubicBezierGeneric(x1: number, y1: number, x2: number, y2: number): { x: EaseFunction, y: EaseFunction } {\n // Calculate the x and y coordinates using the cubic Bézier formula\n const cx = 3 * x1\n const bx = 3 * (x2 - x1) - cx\n const ax = 1 - cx - bx\n\n const cy = 3 * y1\n const by = 3 * (y2 - y1) - cy\n const ay = 1 - cy - by\n\n // Compute x and y values at parameter t\n const x = (t: number) => ((ax * t + bx) * t + cx) * t\n const y = (t: number) => ((ay * t + by) * t + cy) * t\n\n return {\n x,\n y\n }\n }\n\n static cubicBezier(x1: number, y1: number, x2: number, y2: number): EaseFunction {\n const { y } = EaseFunctions.cubicBezierGeneric(x1, y1, x2, y2)\n return (t: number) => {\n t = clamp(t)\n return y(t) // <= equal to x(t) * 0 + y(t) * 1\n }\n }\n\n static easeInEaseOut(t: number): number {\n return EaseFunctions.cubicBezier(0.65, 0, 0.35, 1)(t)\n };\n}\n","/**\n * 1 is forwards\n *\n * -1 is backwards\n */\nexport type Direction = 1 | -1\n\nexport class LoopingArrayCalculator {\n length: number\n isLooping: boolean\n allowedOverScroll: number\n\n constructor(length: number, isLooping: boolean = true, allowedOverScroll: number = 0.1) {\n if (allowedOverScroll < 0 || length < 1) {\n throw new Error('Invalid parameters: allowedOverScroll >= 0 and length >= 1 must be true')\n }\n\n this.length = length\n this.isLooping = isLooping\n this.allowedOverScroll = allowedOverScroll\n }\n\n getCorrectedPosition(position: number): number {\n if (!this.isLooping) {\n return Math.max(-this.allowedOverScroll, Math.min(this.allowedOverScroll + this.length - 1, position))\n }\n if (position >= this.length) {\n return position % this.length\n }\n if (position < 0) {\n return this.length - (Math.abs(position) % this.length)\n }\n return position\n }\n\n static withoutOffset(position: number): number {\n return position + LoopingArrayCalculator.getOffset(position)\n }\n\n static getOffset(position: number): number {\n return Math.round(position) - position // For example: 45.5 => 46 - 45.5 = 0.5\n }\n\n /**\n * @return absolute distance forwards or Infinity when the target cannot be reached (only possible when not isLooping)\n */\n getDistanceDirectional(position: number, target: number, direction: Direction): number {\n if (!this.isLooping && (position < -this.allowedOverScroll || position > this.allowedOverScroll + this.length - 1)) {\n throw new Error('Invalid parameters: position is out of bounds.')\n }\n\n const isForwardInvalid = (direction === 1 && position > target)\n const isBackwardInvalid = (direction === -1 && target < position)\n\n if (!this.isLooping && (isForwardInvalid || isBackwardInvalid)) {\n return Infinity\n }\n\n if (direction === -1) {\n return this.getDistanceDirectional(target, position, 1)\n }\n\n position = this.getCorrectedPosition(position)\n target = this.getCorrectedPosition(target)\n\n let distance = (target - position) * direction\n if (distance < 0) {\n distance = this.length - (Math.abs(position) % this.length) + target\n }\n\n return distance\n }\n\n getDistanceForward(position: number, target: number): number {\n return this.getDistanceDirectional(position, target, 1)\n }\n\n getDistanceBackward(position: number, target: number): number {\n return this.getDistanceDirectional(position, target, -1)\n }\n\n getDistance(position: number, target: number): number {\n const forwardDistance = this.getDistanceForward(position, target)\n const backwardDistance = this.getDistanceBackward(position, target)\n\n return Math.min(forwardDistance, backwardDistance)\n }\n\n getBestDirection(position: number, target: number): Direction {\n const forwardDistance = this.getDistanceForward(position, target)\n const backwardDistance = this.getDistanceBackward(position, target)\n return forwardDistance < backwardDistance ? 1 : -1\n }\n}\n","import type { ButtonHTMLAttributes, PropsWithChildren, ReactNode } from 'react'\nimport { forwardRef } from 'react'\nimport clsx from 'clsx'\n\n\nexport const ButtonColorUtil = {\n solid: ['primary', 'secondary', 'tertiary', 'positive', 'warning', 'negative', 'neutral'] as const,\n text: ['primary', 'negative', 'neutral'] as const,\n outline: ['primary'] as const,\n}\n\nexport const IconButtonUtil = {\n icon: [...ButtonColorUtil.solid, 'transparent'] as const,\n}\n\n\n/**\n * The allowed colors for the SolidButton and IconButton\n */\nexport type SolidButtonColor = typeof ButtonColorUtil.solid[number]\n/**\n * The allowed colors for the OutlineButton\n */\nexport type OutlineButtonColor = typeof ButtonColorUtil.outline[number]\n/**\n * The allowed colors for the TextButton\n */\nexport type TextButtonColor = typeof ButtonColorUtil.text[number]\n/**\n * The allowed colors for the IconButton\n */\nexport type IconButtonColor = typeof IconButtonUtil.icon[number]\n\n\n/**\n * The different sizes for a button\n */\ntype ButtonSizes = 'small' | 'medium' | 'large'\n\ntype IconButtonSize = 'tiny' | 'small' | 'medium' | 'large'\n\n/**\n * The shard properties between all button types\n */\nexport type ButtonProps = PropsWithChildren<{\n /**\n * @default 'medium'\n */\n size?: ButtonSizes,\n}> & ButtonHTMLAttributes<Element>\n\nconst paddingMapping: Record<ButtonSizes, string> = {\n small: 'btn-sm',\n medium: 'btn-md',\n large: 'btn-lg'\n}\n\nconst iconPaddingMapping: Record<IconButtonSize, string> = {\n tiny: 'icon-btn-xs',\n small: 'icon-btn-sm',\n medium: 'icon-btn-md',\n large: 'icon-btn-lg'\n}\n\nexport const ButtonUtil = {\n paddingMapping,\n iconPaddingMapping\n}\n\ntype ButtonWithIconsProps = ButtonProps & {\n startIcon?: ReactNode,\n endIcon?: ReactNode,\n}\n\nexport type SolidButtonProps = ButtonWithIconsProps & {\n color?: SolidButtonColor,\n}\n\nexport type OutlineButtonProps = ButtonWithIconsProps & {\n color?: OutlineButtonColor,\n}\n\nexport type TextButtonProps = ButtonWithIconsProps & {\n color?: TextButtonColor,\n coloredHoverBackground?: boolean,\n}\n\n/**\n * The shard properties between all button types\n */\nexport type IconButtonProps = PropsWithChildren<{\n /**\n * @default 'medium'\n */\n size?: IconButtonSize,\n color?: IconButtonColor,\n}> & ButtonHTMLAttributes<Element>\n\n/**\n * A button with a solid background and different sizes\n */\nconst SolidButton = forwardRef<HTMLButtonElement, SolidButtonProps>(function SolidButton({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }, ref) {\n const colorClasses = {\n primary: 'bg-button-solid-primary-background text-button-solid-primary-text',\n secondary: 'bg-button-solid-secondary-background text-button-solid-secondary-text',\n tertiary: 'bg-button-solid-tertiary-background text-button-solid-tertiary-text',\n positive: 'bg-button-solid-positive-background text-button-solid-positive-text',\n warning: 'bg-button-solid-warning-background text-button-solid-warning-text',\n negative: 'bg-button-solid-negative-background text-button-solid-negative-text',\n neutral: 'bg-button-solid-neutral-background text-button-solid-neutral-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-solid-primary-icon',\n secondary: 'text-button-solid-secondary-icon',\n tertiary: 'text-button-solid-tertiary-icon',\n positive: 'text-button-solid-positive-icon',\n warning: 'text-button-solid-warning-icon',\n negative: 'text-button-solid-negative-icon',\n neutral: 'text-button-solid-neutral-icon',\n }[color]\n\n return (\n <button\n ref={ref}\n onClick={onClick}\n disabled={disabled}\n className={clsx(\n 'font-semibold',\n {\n 'text-disabled-text bg-disabled-background cursor-not-allowed': disabled,\n [clsx(colorClasses, 'hover:brightness-90')]: !disabled\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n})\n\n/**\n * A button with an outline border and different sizes\n */\nconst OutlineButton = ({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }: OutlineButtonProps) => {\n const colorClasses = {\n primary: 'bg-transparent border-2 border-button-outline-primary-text text-button-outline-primary-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-outline-primary-icon',\n }[color]\n return (\n <button\n onClick={onClick}\n disabled={disabled}\n className={clsx(\n 'font-semibold',\n {\n 'text-disabled-text border-disabled-outline cursor-not-allowed': disabled,\n [clsx(colorClasses, 'hover:brightness-80')]: !disabled,\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n/**\n * A text that is a button that can have different sizes\n */\nconst TextButton = ({\n children,\n disabled = false,\n color = 'neutral',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n coloredHoverBackground = true,\n className,\n ...restProps\n }: TextButtonProps) => {\n const colorClasses = {\n primary: 'bg-transparent text-button-text-primary-text',\n negative: 'bg-transparent text-button-text-negative-text',\n neutral: 'bg-transparent text-button-text-neutral-text',\n }[color]\n\n const backgroundColor = {\n primary: 'hover:bg-button-text-primary-text/20',\n negative: 'hover:bg-button-text-negative-text/20',\n neutral: 'hover:bg-button-text-neutral-text/20',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-text-primary-icon',\n negative: 'text-button-text-negative-icon',\n neutral: 'text-button-text-neutral-icon',\n }[color]\n\n return (\n <button\n onClick={onClick}\n disabled={disabled}\n className={clsx(\n 'font-semibold',\n {\n 'text-disabled-text cursor-not-allowed': disabled,\n [colorClasses]: !disabled,\n [backgroundColor]: !disabled && coloredHoverBackground,\n 'hover:bg-button-text-hover-background': !disabled && !coloredHoverBackground,\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n\n/**\n * A button for icons with a solid background and different sizes\n */\nconst IconButton = ({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n className,\n ...restProps\n }: IconButtonProps) => {\n const colorClasses = {\n primary: 'bg-button-solid-primary-background text-button-solid-primary-text',\n secondary: 'bg-button-solid-secondary-background text-button-solid-secondary-text',\n tertiary: 'bg-button-solid-tertiary-background text-button-solid-tertiary-text',\n positive: 'bg-button-solid-positive-background text-button-solid-positive-text',\n warning: 'bg-button-solid-warning-background text-button-solid-warning-text',\n negative: 'bg-button-solid-negative-background text-button-solid-negative-text',\n neutral: 'bg-button-solid-neutral-background text-button-solid-neutral-text',\n transparent: 'bg-transparent',\n }[color]\n\n return (\n <button\n disabled={disabled}\n className={clsx(\n {\n 'text-disabled-text bg-disabled-background cursor-not-allowed': disabled && color !== 'transparent',\n 'text-disabled-text cursor-not-allowed opacity-70': disabled && color === 'transparent',\n 'hover:bg-button-text-hover-background': !disabled && color === 'transparent',\n [clsx(colorClasses, 'hover:brightness-90')]: !disabled,\n },\n ButtonUtil.iconPaddingMapping[size],\n className\n )}\n {...restProps}\n >\n {children}\n </button>\n )\n}\n\nexport { SolidButton, OutlineButton, TextButton, IconButton }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,gBAAyE;AACzE,IAAAC,eAAiB;AACjB,0BAA0C;;;ACkB1C,IAAM,sBAAoC;AAAA,EACxC,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,cAAc;AAChB;AAMO,IAAM,QAAQ,CAAC,YAAuC,YAA8C;AACzG,QAAM,EAAE,iBAAiB,UAAU,gBAAgB,aAAa,IAAI,EAAE,GAAG,qBAAqB,GAAG,QAAQ;AACzG,MAAI,QAAQ;AACZ,MAAI;AACJ,MAAI,OAAO,eAAe,UAAU;AAClC,UAAM;AAAA,EACR,OAAO;AACL,YAAQ,WAAW,CAAC;AACpB,UAAM,WAAW,CAAC;AAAA,EACpB;AACA,MAAI,CAAC,cAAc;AACjB,WAAO;AAAA,EACT;AACA,MAAI,gBAAgB;AAClB,aAAS;AAAA,EACX;AAEA,MAAI,MAAM,IAAI,OAAO;AACnB,QAAI,CAAC,iBAAiB;AACpB,cAAQ,KAAK,eAAe,GAAG,cAAc,KAAK,qEAAqE;AAAA,IACzH;AACA,WAAO,CAAC;AAAA,EACV;AACA,SAAO,MAAM,KAAK,EAAE,QAAQ,MAAM,MAAM,GAAG,CAAC,GAAG,UAAU,QAAQ,WAAW,KAAK;AACnF;AA8CO,IAAM,6BAA6B,CAAI,MAAW,aAAqB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8CAA8C,iBAAiB;AAAA,YACjE,CAAC;AAAA,YACD,SAAS,MAAM,eAAe,KAAK;AAAA;AAAA,UAL9B;AAAA,QAMP,CACD;AAAA;AAAA,IACH;AAAA,KAEJ;AAEJ;","names":["import_react","import_clsx","SolidButton","clsx","clsx","import_jsx_runtime","animationState","dragState","clsx"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/layout-and-navigation/Carousel.tsx","../../../src/util/array.ts","../../../src/util/math.ts","../../../src/util/easeFunctions.ts","../../../src/util/loopingArray.ts","../../../src/components/user-action/Button.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport clsx from 'clsx'\nimport { ChevronLeft, ChevronRight } from 'lucide-react'\nimport { createLoopingListWithIndex, range } from '../../util/array'\nimport { clamp } from '../../util/math'\nimport { EaseFunctions } from '../../util/easeFunctions'\nimport type { Direction } from '../../util/loopingArray'\nimport { LoopingArrayCalculator } from '../../util/loopingArray'\nimport { IconButton } from '../user-action/Button'\n\n\nexport type CarouselProps = {\n children: ReactNode[],\n animationTime?: number,\n isLooping?: boolean,\n isAutoLooping?: boolean,\n autoLoopingTimeOut?: number,\n autoLoopAnimationTime?: number,\n hintNext?: boolean,\n arrows?: boolean,\n dots?: boolean,\n /**\n * Percentage that is allowed to be scrolled further\n */\n overScrollThreshold?: number,\n blurColor?: string,\n className?: string,\n heightClassName?: string,\n widthClassName?: string,\n}\n\ntype ItemType = {\n item: ReactNode,\n index: number,\n}\n\ntype CarouselAnimationState = {\n targetPosition: number,\n /**\n * Value of either 1 or -1, 1 is forwards -1 is backwards\n */\n direction: Direction,\n startPosition: number,\n startTime?: number,\n lastUpdateTime?: number,\n isAutoLooping: boolean,\n}\n\ntype DragState = {\n startX: number,\n startTime: number,\n lastX: number,\n startIndex: number,\n}\n\ntype CarouselInformation = {\n currentPosition: number,\n dragState?: DragState,\n animationState?: CarouselAnimationState,\n}\n\nexport const Carousel = ({\n children,\n animationTime = 200,\n isLooping = false,\n isAutoLooping = false,\n autoLoopingTimeOut = 5000,\n autoLoopAnimationTime = 500,\n hintNext = false,\n arrows = false,\n dots = true,\n overScrollThreshold = 0.1,\n blurColor = 'from-background',\n className = '',\n heightClassName = 'h-96',\n widthClassName = 'w-[70%] desktop:w-1/2',\n }: CarouselProps) => {\n if (isAutoLooping && !isLooping) {\n console.error('When isAutoLooping is true, isLooping should also be true')\n isLooping = true\n }\n\n const [{\n currentPosition,\n dragState,\n animationState,\n }, setCarouselInformation] = useState<CarouselInformation>({\n currentPosition: 0,\n })\n const animationId = useRef<number | undefined>(undefined)\n const timeOut = useRef<NodeJS.Timeout | undefined>(undefined)\n autoLoopingTimeOut = Math.max(0, autoLoopingTimeOut)\n\n const length = children.length\n const paddingItemCount = 3 // The number of items to append left and right of the list to allow for clean transition when looping\n\n const util = useMemo(() => new LoopingArrayCalculator(length, isLooping, overScrollThreshold), [length, isLooping, overScrollThreshold])\n const currentIndex = util.getCorrectedPosition(LoopingArrayCalculator.withoutOffset(currentPosition))\n animationTime = Math.max(200, animationTime) // in ms, must be > 0\n autoLoopAnimationTime = Math.max(200, autoLoopAnimationTime)\n\n const getStyleOffset = (index: number) => {\n const baseOffset = -50 + (index - currentPosition) * 100\n return `${baseOffset}%`\n }\n\n const animation = useCallback((time: number) => {\n let keepAnimating: boolean = true\n\n // Other calculation in the setState call to avoid updating the useCallback to often\n setCarouselInformation((state) => {\n const {\n animationState,\n dragState\n } = state\n if (animationState === undefined || dragState !== undefined) {\n keepAnimating = false\n return state\n }\n if (!animationState.startTime || !animationState.lastUpdateTime) {\n return {\n ...state,\n animationState: {\n ...animationState,\n startTime: time,\n lastUpdateTime: time\n }\n }\n }\n const useAnimationTime = animationState.isAutoLooping ? autoLoopAnimationTime : animationTime\n const progress = clamp((time - animationState.startTime) / useAnimationTime) // progress\n const easedProgress = EaseFunctions.easeInEaseOut(progress)\n const distance = util.getDistanceDirectional(animationState.startPosition, animationState.targetPosition, animationState.direction)\n const newPosition = util.getCorrectedPosition(easedProgress * distance * animationState.direction + animationState.startPosition)\n\n if (animationState.targetPosition === newPosition || progress === 1) {\n keepAnimating = false\n return ({\n currentPosition: LoopingArrayCalculator.withoutOffset(newPosition),\n animationState: undefined\n })\n }\n return ({\n currentPosition: newPosition,\n animationState: {\n ...animationState!,\n lastUpdateTime: time\n }\n })\n })\n if (keepAnimating) {\n animationId.current = requestAnimationFrame(time1 => animation(time1))\n }\n }, [animationTime, autoLoopAnimationTime, util])\n\n useEffect(() => {\n if (animationState) {\n animationId.current = requestAnimationFrame(animation)\n }\n return () => {\n if (animationId.current) {\n cancelAnimationFrame(animationId.current)\n animationId.current = 0\n }\n }\n }, [animationState]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const startAutoLoop = () => setCarouselInformation(prevState => ({\n ...prevState,\n dragState: prevState.dragState,\n animationState: prevState.animationState || prevState.dragState ? prevState.animationState : {\n startPosition: currentPosition,\n targetPosition: (currentPosition + 1) % length,\n direction: 1, // always move forward\n isAutoLooping: true\n }\n }))\n\n useEffect(() => {\n if (!animationId.current && !animationState && !dragState && !timeOut.current) {\n if (autoLoopingTimeOut > 0) {\n timeOut.current = setTimeout(() => {\n startAutoLoop()\n timeOut.current = undefined\n }, autoLoopingTimeOut)\n } else {\n startAutoLoop()\n }\n }\n }, [animationState, dragState, animationId.current, timeOut.current]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const startAnimation = (targetPosition?: number) => {\n if (targetPosition === undefined) {\n targetPosition = LoopingArrayCalculator.withoutOffset(currentPosition)\n }\n if (targetPosition === currentPosition) {\n return // we are exactly where we want to be\n }\n\n // find target index and fastest path to it\n const direction = util.getBestDirection(currentPosition, targetPosition)\n clearTimeout(timeOut.current)\n timeOut.current = undefined\n if (animationId.current) {\n cancelAnimationFrame(animationId.current)\n animationId.current = undefined\n }\n\n setCarouselInformation(prevState => ({\n ...prevState,\n dragState: undefined,\n animationState: {\n targetPosition: targetPosition!,\n direction,\n startPosition: currentPosition,\n isAutoLooping: false\n },\n timeOut: undefined\n }))\n }\n\n const canGoLeft = () => {\n return isLooping || currentPosition !== 0\n }\n\n const canGoRight = () => {\n return isLooping || currentPosition !== length - 1\n }\n\n const left = () => {\n if (canGoLeft()) {\n startAnimation(currentPosition === 0 ? length - 1 : LoopingArrayCalculator.withoutOffset(currentPosition - 1))\n }\n }\n\n const right = () => {\n if (canGoRight()) {\n startAnimation(LoopingArrayCalculator.withoutOffset((currentPosition + 1) % length))\n }\n }\n\n let items: ItemType[] = children.map((item, index) => ({\n index,\n item\n }))\n\n if (isLooping) {\n const before = createLoopingListWithIndex(children, length - 1, paddingItemCount, false).reverse().map(([index, item]) => ({\n index,\n item\n }))\n const after = createLoopingListWithIndex(children, 0, paddingItemCount).map(([index, item]) => ({\n index,\n item\n }))\n items = [\n ...before,\n ...items,\n ...after\n ]\n }\n\n const onDragStart = (x: number) => setCarouselInformation(prevState => ({\n ...prevState,\n dragState: {\n lastX: x,\n startX: x,\n startTime: Date.now(),\n startIndex: currentPosition,\n },\n animationState: undefined // cancel animation\n }))\n\n const onDrag = (x: number, width: number) => {\n // For some weird reason the clientX is 0 on the last dragUpdate before drag end causing issues\n if (!dragState || x === 0) {\n return\n }\n const offsetUpdate = (dragState.lastX - x) / width\n const newPosition = util.getCorrectedPosition(currentPosition + offsetUpdate)\n\n setCarouselInformation(prevState => ({\n ...prevState,\n currentPosition: newPosition,\n dragState: {\n ...dragState,\n lastX: x\n },\n }))\n }\n\n const onDragEnd = (x: number, width: number) => {\n if (!dragState) {\n return\n }\n const distance = dragState.startX - x\n const relativeDistance = distance / width\n const duration = (Date.now() - dragState.startTime) // in milliseconds\n const velocity = distance / (Date.now() - dragState.startTime)\n\n const isSlide = Math.abs(velocity) > 2 || (duration < 200 && (Math.abs(relativeDistance) > 0.2 || Math.abs(distance) > 50))\n if (isSlide) {\n if (distance > 0 && canGoRight()) {\n right()\n return\n } else if (distance < 0 && canGoLeft()) {\n left()\n return\n }\n }\n startAnimation()\n }\n\n const dragHandlers = {\n draggable: true,\n onDragStart: (event: React.DragEvent<HTMLDivElement>) => {\n onDragStart(event.clientX)\n event.dataTransfer.setDragImage(document.createElement('div'), 0, 0)\n },\n onDrag: (event: React.DragEvent<HTMLDivElement>) => onDrag(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onDragEnd: (event: React.DragEvent<HTMLDivElement>) => onDragEnd(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => onDragStart(event.touches[0]!.clientX),\n onTouchMove: (event: React.TouchEvent<HTMLDivElement>) => onDrag(event.touches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchEnd: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchCancel: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n }\n\n return (\n <div className=\"flex-col-2 items-center w-full\">\n <div className={clsx(`relative w-full overflow-hidden`, heightClassName, className)}>\n {arrows && (\n <>\n <IconButton\n color=\"neutral\"\n className={clsx('absolute z-10 left-0 top-1/2 -translate-y-1/2 shadow-md', { hidden: !canGoLeft() })}\n disabled={!canGoLeft()}\n onClick={() => left()}\n >\n <ChevronLeft size={24}/>\n </IconButton>\n <IconButton\n color=\"neutral\"\n className={clsx('absolute z-10 right-0 top-1/2 -translate-y-1/2 shadow-md', { hidden: !canGoRight() })}\n disabled={!canGoRight()}\n onClick={() => right()}\n >\n <ChevronRight size={24}/>\n </IconButton>\n </>\n )}\n {hintNext ? (\n <div className={clsx(`flex-row-2 relative h-full`, heightClassName)}>\n <div className=\"flex-row-2 relative h-full w-full px-2 overflow-hidden\">\n {items.map(({\n item,\n index\n }, listIndex) => (\n <div\n key={listIndex}\n className={clsx(`absolute left-[50%] h-full overflow-hidden`, widthClassName, { '!cursor-grabbing': !!dragState })}\n style={{ translate: getStyleOffset(listIndex - (isLooping ? paddingItemCount : 0)) }}\n {...dragHandlers}\n onClick={() => startAnimation(index)}\n >\n {item}\n </div>\n ))}\n </div>\n <div\n className={clsx(`hidden pointer-events-none desktop:block absolute left-0 h-full w-[20%] bg-gradient-to-r to-transparent`, blurColor)}\n />\n <div\n className={clsx(`hidden pointer-events-none desktop:block absolute right-0 h-full w-[20%] bg-gradient-to-l to-transparent`, blurColor)}\n />\n </div>\n ) : (\n <div className={clsx('px-16 h-full', { '!cursor-grabbing': !!dragState })} {...dragHandlers}>\n {children[currentIndex]}\n </div>\n )}\n </div>\n {dots && (\n <div\n className=\"flex-row-2 items-center justify-center w-full my-2\">\n {range(length).map(index => (\n <button\n key={index}\n className={clsx('w-8 min-w-8 h-3 min-h-3 first:rounded-l-md last:rounded-r-md', {\n 'bg-carousel-dot-disabled hover:bg-carousel-dot-active': currentIndex !== index,\n 'bg-carousel-dot-active hover:brightness-90': currentIndex === index\n })}\n onClick={() => startAnimation(index)}\n />\n ))}\n </div>\n )}\n </div>\n )\n}\n","export const equalSizeGroups = <T>(array: T[], groupSize: number): T[][] => {\n if (groupSize <= 0) {\n console.warn(`group size should be greater than 0: groupSize = ${groupSize}`)\n return [[...array]]\n }\n\n const groups = []\n for (let i = 0; i < array.length; i += groupSize) {\n groups.push(array.slice(i, Math.min(i + groupSize, array.length)))\n }\n return groups\n}\n\nexport type RangeOptions = {\n /** Whether the range can be defined empty via end < start without a warning */\n allowEmptyRange: boolean,\n stepSize: number,\n exclusiveStart: boolean,\n exclusiveEnd: boolean,\n}\n\nconst defaultRangeOptions: RangeOptions = {\n allowEmptyRange: false,\n stepSize: 1,\n exclusiveStart: false,\n exclusiveEnd: true,\n}\n\n/**\n * @param endOrRange The end value or a range [start, end], end is exclusive\n * @param options the options for defining the range\n */\nexport const range = (endOrRange: number | [number, number], options?: Partial<RangeOptions>): number[] => {\n const { allowEmptyRange, stepSize, exclusiveStart, exclusiveEnd } = { ...defaultRangeOptions, ...options }\n let start = 0\n let end: number\n if (typeof endOrRange === 'number') {\n end = endOrRange\n } else {\n start = endOrRange[0]\n end = endOrRange[1]\n }\n if (!exclusiveEnd) {\n end -= 1\n }\n if (exclusiveStart) {\n start += 1\n }\n\n if (end - 1 < start) {\n if (!allowEmptyRange) {\n console.warn(`range: end (${end}) < start (${start}) should be allowed explicitly, set options.allowEmptyRange to true`)\n }\n return []\n }\n return Array.from({ length: end - start }, (_, index) => index * stepSize + start)\n}\n\n/** Finds the closest match\n * @param list The list of all possible matches\n * @param firstCloser Return whether item1 is closer than item2\n */\nexport const closestMatch = <T>(list: T[], firstCloser: (item1: T, item2: T) => boolean) => {\n return list.reduce((item1, item2) => {\n return firstCloser(item1, item2) ? item1 : item2\n })\n}\n\n/**\n * returns the item in middle of a list and its neighbours before and after\n * e.g. [1,2,3,4,5,6] for item = 1 would return [5,6,1,2,3]\n */\nexport const getNeighbours = <T>(list: T[], item: T, neighbourDistance: number = 2) => {\n const index = list.indexOf(item)\n const totalItems = neighbourDistance * 2 + 1\n if (list.length < totalItems) {\n console.warn('List is to short')\n return list\n }\n\n if (index === -1) {\n console.error('item not found in list')\n return list.splice(0, totalItems)\n }\n\n let start = index - neighbourDistance\n if (start < 0) {\n start += list.length\n }\n const end = (index + neighbourDistance + 1) % list.length\n\n const result: T[] = []\n let ignoreOnce = list.length === totalItems\n for (let i = start; i !== end || ignoreOnce; i = (i + 1) % list.length) {\n result.push(list[i]!)\n if (end === i && ignoreOnce) {\n ignoreOnce = false\n }\n }\n return result\n}\n\nexport const createLoopingListWithIndex = <T>(list: T[], startIndex: number = 0, length: number = 0, forwards: boolean = true) => {\n if (length < 0) {\n console.warn(`createLoopingList: length must be >= 0, given ${length}`)\n } else if (length === 0) {\n length = list.length\n }\n\n const returnList: [number, T][] = []\n\n if (forwards) {\n for (let i = startIndex; returnList.length < length; i = (i + 1) % list.length) {\n returnList.push([i, list[i]!])\n }\n } else {\n for (let i = startIndex; returnList.length < length; i = i === 0 ? i = list.length - 1 : i - 1) {\n returnList.push([i, list[i]!])\n }\n }\n\n return returnList\n}\n\nexport const createLoopingList = <T>(list: T[], startIndex: number = 0, length: number = 0, forwards: boolean = true) => {\n return createLoopingListWithIndex(list, startIndex, length, forwards).map(([_, item]) => item)\n}\n\nexport const ArrayUtil = {\n unique: <T>(list: T[]): T[] => {\n const seen = new Set<T>()\n return list.filter((item) => {\n if (seen.has(item)) {\n return false\n }\n seen.add(item)\n return true\n })\n },\n\n difference: <T>(list: T[], removeList: T[]): T[] => {\n const remove = new Set<T>(removeList)\n return list.filter((item) => !remove.has(item))\n }\n}\n","export const clamp = (value: number, min: number = 0, max: number = 1): number => {\n return Math.min(Math.max(value, min), max)\n}\n","import { clamp } from './math'\n\nexport type EaseFunction = (t: number) => number\n\nexport class EaseFunctions {\n static cubicBezierGeneric(x1: number, y1: number, x2: number, y2: number): { x: EaseFunction, y: EaseFunction } {\n // Calculate the x and y coordinates using the cubic Bézier formula\n const cx = 3 * x1\n const bx = 3 * (x2 - x1) - cx\n const ax = 1 - cx - bx\n\n const cy = 3 * y1\n const by = 3 * (y2 - y1) - cy\n const ay = 1 - cy - by\n\n // Compute x and y values at parameter t\n const x = (t: number) => ((ax * t + bx) * t + cx) * t\n const y = (t: number) => ((ay * t + by) * t + cy) * t\n\n return {\n x,\n y\n }\n }\n\n static cubicBezier(x1: number, y1: number, x2: number, y2: number): EaseFunction {\n const { y } = EaseFunctions.cubicBezierGeneric(x1, y1, x2, y2)\n return (t: number) => {\n t = clamp(t)\n return y(t) // <= equal to x(t) * 0 + y(t) * 1\n }\n }\n\n static easeInEaseOut(t: number): number {\n return EaseFunctions.cubicBezier(0.65, 0, 0.35, 1)(t)\n };\n}\n","/**\n * 1 is forwards\n *\n * -1 is backwards\n */\nexport type Direction = 1 | -1\n\nexport class LoopingArrayCalculator {\n length: number\n isLooping: boolean\n allowedOverScroll: number\n\n constructor(length: number, isLooping: boolean = true, allowedOverScroll: number = 0.1) {\n if (allowedOverScroll < 0 || length < 1) {\n throw new Error('Invalid parameters: allowedOverScroll >= 0 and length >= 1 must be true')\n }\n\n this.length = length\n this.isLooping = isLooping\n this.allowedOverScroll = allowedOverScroll\n }\n\n getCorrectedPosition(position: number): number {\n if (!this.isLooping) {\n return Math.max(-this.allowedOverScroll, Math.min(this.allowedOverScroll + this.length - 1, position))\n }\n if (position >= this.length) {\n return position % this.length\n }\n if (position < 0) {\n return this.length - (Math.abs(position) % this.length)\n }\n return position\n }\n\n static withoutOffset(position: number): number {\n return position + LoopingArrayCalculator.getOffset(position)\n }\n\n static getOffset(position: number): number {\n return Math.round(position) - position // For example: 45.5 => 46 - 45.5 = 0.5\n }\n\n /**\n * @return absolute distance forwards or Infinity when the target cannot be reached (only possible when not isLooping)\n */\n getDistanceDirectional(position: number, target: number, direction: Direction): number {\n if (!this.isLooping && (position < -this.allowedOverScroll || position > this.allowedOverScroll + this.length - 1)) {\n throw new Error('Invalid parameters: position is out of bounds.')\n }\n\n const isForwardInvalid = (direction === 1 && position > target)\n const isBackwardInvalid = (direction === -1 && target < position)\n\n if (!this.isLooping && (isForwardInvalid || isBackwardInvalid)) {\n return Infinity\n }\n\n if (direction === -1) {\n return this.getDistanceDirectional(target, position, 1)\n }\n\n position = this.getCorrectedPosition(position)\n target = this.getCorrectedPosition(target)\n\n let distance = (target - position) * direction\n if (distance < 0) {\n distance = this.length - (Math.abs(position) % this.length) + target\n }\n\n return distance\n }\n\n getDistanceForward(position: number, target: number): number {\n return this.getDistanceDirectional(position, target, 1)\n }\n\n getDistanceBackward(position: number, target: number): number {\n return this.getDistanceDirectional(position, target, -1)\n }\n\n getDistance(position: number, target: number): number {\n const forwardDistance = this.getDistanceForward(position, target)\n const backwardDistance = this.getDistanceBackward(position, target)\n\n return Math.min(forwardDistance, backwardDistance)\n }\n\n getBestDirection(position: number, target: number): Direction {\n const forwardDistance = this.getDistanceForward(position, target)\n const backwardDistance = this.getDistanceBackward(position, target)\n return forwardDistance < backwardDistance ? 1 : -1\n }\n}\n","import type { ButtonHTMLAttributes, PropsWithChildren, ReactNode } from 'react'\nimport { forwardRef } from 'react'\nimport clsx from 'clsx'\n\n\nexport const ButtonColorUtil = {\n solid: ['primary', 'secondary', 'tertiary', 'positive', 'warning', 'negative', 'neutral'] as const,\n text: ['primary', 'negative', 'neutral'] as const,\n outline: ['primary'] as const,\n}\n\nexport const IconButtonUtil = {\n icon: [...ButtonColorUtil.solid, 'transparent'] as const,\n}\n\n\n/**\n * The allowed colors for the SolidButton and IconButton\n */\nexport type SolidButtonColor = typeof ButtonColorUtil.solid[number]\n/**\n * The allowed colors for the OutlineButton\n */\nexport type OutlineButtonColor = typeof ButtonColorUtil.outline[number]\n/**\n * The allowed colors for the TextButton\n */\nexport type TextButtonColor = typeof ButtonColorUtil.text[number]\n/**\n * The allowed colors for the IconButton\n */\nexport type IconButtonColor = typeof IconButtonUtil.icon[number]\n\n\n/**\n * The different sizes for a button\n */\ntype ButtonSizes = 'small' | 'medium' | 'large'\n\ntype IconButtonSize = 'tiny' | 'small' | 'medium' | 'large'\n\n/**\n * The shard properties between all button types\n */\nexport type ButtonProps = PropsWithChildren<{\n /**\n * @default 'medium'\n */\n size?: ButtonSizes,\n}> & ButtonHTMLAttributes<Element>\n\nconst paddingMapping: Record<ButtonSizes, string> = {\n small: 'btn-sm',\n medium: 'btn-md',\n large: 'btn-lg'\n}\n\nconst iconPaddingMapping: Record<IconButtonSize, string> = {\n tiny: 'icon-btn-xs',\n small: 'icon-btn-sm',\n medium: 'icon-btn-md',\n large: 'icon-btn-lg'\n}\n\nexport const ButtonUtil = {\n paddingMapping,\n iconPaddingMapping\n}\n\ntype ButtonWithIconsProps = ButtonProps & {\n startIcon?: ReactNode,\n endIcon?: ReactNode,\n}\n\nexport type SolidButtonProps = ButtonWithIconsProps & {\n color?: SolidButtonColor,\n}\n\nexport type OutlineButtonProps = ButtonWithIconsProps & {\n color?: OutlineButtonColor,\n}\n\nexport type TextButtonProps = ButtonWithIconsProps & {\n color?: TextButtonColor,\n coloredHoverBackground?: boolean,\n}\n\n/**\n * The shard properties between all button types\n */\nexport type IconButtonProps = PropsWithChildren<{\n /**\n * @default 'medium'\n */\n size?: IconButtonSize,\n color?: IconButtonColor,\n}> & ButtonHTMLAttributes<Element>\n\n/**\n * A button with a solid background and different sizes\n */\nconst SolidButton = forwardRef<HTMLButtonElement, SolidButtonProps>(function SolidButton({\n children,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }, ref) {\n const colorClasses = {\n primary: 'not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text',\n secondary: 'not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text',\n tertiary: 'not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text',\n positive: 'not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text',\n warning: 'not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text',\n negative: 'not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text',\n neutral: 'not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'not-group-disabled:text-button-solid-primary-icon',\n secondary: 'not-group-disabled:text-button-solid-secondary-icon',\n tertiary: 'not-group-disabled:text-button-solid-tertiary-icon',\n positive: 'not-group-disabled:text-button-solid-positive-icon',\n warning: 'not-group-disabled:text-button-solid-warning-icon',\n negative: 'not-group-disabled:text-button-solid-negative-icon',\n neutral: 'not-group-disabled:text-button-solid-neutral-icon',\n }[color]\n\n return (\n <button\n ref={ref}\n onClick={onClick}\n className={clsx(\n 'group font-semibold',\n colorClasses,\n 'not-disabled:hover:brightness-90',\n 'disabled:text-disabled-text disabled:bg-disabled-background',\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx(\n iconColorClasses,\n 'group-disabled:text-disabled-icon'\n )}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx(\n iconColorClasses,\n 'group-disabled:text-disabled-icon'\n )}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n})\n\n/**\n * A button with an outline border and different sizes\n */\nconst OutlineButton = ({\n children,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }: OutlineButtonProps) => {\n const colorClasses = {\n primary: 'not-disabled:border-button-outline-primary-text not-disabled:text-button-outline-primary-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'not-group-disabled:text-button-outline-primary-icon',\n }[color]\n return (\n <button\n onClick={onClick}\n className={clsx(\n 'group font-semibold bg-transparent border-2 ',\n 'not-disabled:hover:brightness-80',\n colorClasses,\n 'disabled:text-disabled-text disabled:border-disabled-outline',\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx(\n iconColorClasses,\n 'group-disabled:text-disabled-icon'\n )}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx(\n iconColorClasses,\n 'group-disabled:text-disabled-icon'\n )}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n/**\n * A text that is a button that can have different sizes\n */\nconst TextButton = ({\n children,\n color = 'neutral',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n coloredHoverBackground = true,\n className,\n ...restProps\n }: TextButtonProps) => {\n const colorClasses = {\n primary: 'not-disabled:bg-transparent not-disabled:text-button-text-primary-text',\n negative: 'not-disabled:bg-transparent not-disabled:text-button-text-negative-text',\n neutral: 'not-disabled:bg-transparent not-disabled:text-button-text-neutral-text',\n }[color]\n\n const backgroundColor = {\n primary: 'not-disabled:hover:bg-button-text-primary-text/20',\n negative: 'not-disabled:hover:bg-button-text-negative-text/20',\n neutral: 'not-disabled:hover:bg-button-text-neutral-text/20',\n }[color]\n\n const iconColorClasses = {\n primary: 'not-group-disabled:text-button-text-primary-icon',\n negative: 'not-group-disabled:text-button-text-negative-icon',\n neutral: 'not-group-disabled:text-button-text-neutral-icon',\n }[color]\n\n return (\n <button\n onClick={onClick}\n className={clsx(\n 'group font-semibold',\n 'disabled:text-disabled-text',\n colorClasses,\n {\n [backgroundColor]: coloredHoverBackground,\n 'not-disabled:hover:bg-button-text-hover-background': !coloredHoverBackground,\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx(\n iconColorClasses,\n 'group-disabled:text-disabled-icon'\n )}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx(\n iconColorClasses,\n 'group-disabled:text-disabled-icon'\n )}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n\n/**\n * A button for icons with a solid background and different sizes\n */\nconst IconButton = ({\n children,\n color = 'primary',\n size = 'medium',\n className,\n ...restProps\n }: IconButtonProps) => {\n const colorClasses = {\n primary: 'not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text',\n secondary: 'not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text',\n tertiary: 'not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text',\n positive: 'not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text',\n warning: 'not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text',\n negative: 'not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text',\n neutral: 'not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text',\n transparent: 'not-disabled:bg-transparent',\n }[color]\n\n return (\n <button\n className={clsx(\n colorClasses,\n 'not-disabled:hover:brightness-90',\n 'disabled:text-disabled-text',\n {\n 'disabled:bg-disabled-background': color !== 'transparent',\n 'disabled:opacity-70': color === 'transparent',\n 'not-disabled:hover:bg-button-text-hover-background': color === 'transparent',\n },\n ButtonUtil.iconPaddingMapping[size],\n className\n )}\n {...restProps}\n >\n {children}\n </button>\n )\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G;AAAA,YACJ,SAAS,MAAM,eAAe,KAAK;AAAA,YAElC;AAAA;AAAA,UANI;AAAA,QAOP,CACD,GACH;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,aAAAA,SAAK,2GAA2G,SAAS;AAAA;AAAA,QACtI;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,aAAAA,SAAK,4GAA4G,SAAS;AAAA;AAAA,QACvI;AAAA,SACF,IAEA,6CAAC,SAAI,eAAW,aAAAA,SAAK,gBAAgB,EAAE,oBAAoB,CAAC,CAAC,UAAU,CAAC,GAAI,GAAG,cAC5E,mBAAS,YAAY,GACxB;AAAA,OAEJ;AAAA,IACC,QACC;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACT,gBAAM,MAAM,EAAE,IAAI,WACjB;AAAA,UAAC;AAAA;AAAA,YAEC,eAAW,aAAAA,SAAK,gEAAgE;AAAA,cAC9E,yDAAyD,iBAAiB;AAAA,cAC1E,8CAA8C,iBAAiB;AAAA,YACjE,CAAC;AAAA,YACD,SAAS,MAAM,eAAe,KAAK;AAAA;AAAA,UAL9B;AAAA,QAMP,CACD;AAAA;AAAA,IACH;AAAA,KAEJ;AAEJ;","names":["import_react","import_clsx","SolidButton","clsx","clsx","import_jsx_runtime","animationState","dragState","clsx"]}
|
|
@@ -184,7 +184,6 @@ var ButtonUtil = {
|
|
|
184
184
|
};
|
|
185
185
|
var SolidButton = forwardRef(function SolidButton2({
|
|
186
186
|
children,
|
|
187
|
-
disabled = false,
|
|
188
187
|
color = "primary",
|
|
189
188
|
size = "medium",
|
|
190
189
|
startIcon,
|
|
@@ -194,35 +193,33 @@ var SolidButton = forwardRef(function SolidButton2({
|
|
|
194
193
|
...restProps
|
|
195
194
|
}, ref) {
|
|
196
195
|
const colorClasses = {
|
|
197
|
-
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
198
|
-
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
199
|
-
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
200
|
-
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
201
|
-
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
202
|
-
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
203
|
-
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
196
|
+
primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
|
|
197
|
+
secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
|
|
198
|
+
tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
|
|
199
|
+
positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
|
|
200
|
+
warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
|
|
201
|
+
negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
|
|
202
|
+
neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text"
|
|
204
203
|
}[color];
|
|
205
204
|
const iconColorClasses = {
|
|
206
|
-
primary: "text-button-solid-primary-icon",
|
|
207
|
-
secondary: "text-button-solid-secondary-icon",
|
|
208
|
-
tertiary: "text-button-solid-tertiary-icon",
|
|
209
|
-
positive: "text-button-solid-positive-icon",
|
|
210
|
-
warning: "text-button-solid-warning-icon",
|
|
211
|
-
negative: "text-button-solid-negative-icon",
|
|
212
|
-
neutral: "text-button-solid-neutral-icon"
|
|
205
|
+
primary: "not-group-disabled:text-button-solid-primary-icon",
|
|
206
|
+
secondary: "not-group-disabled:text-button-solid-secondary-icon",
|
|
207
|
+
tertiary: "not-group-disabled:text-button-solid-tertiary-icon",
|
|
208
|
+
positive: "not-group-disabled:text-button-solid-positive-icon",
|
|
209
|
+
warning: "not-group-disabled:text-button-solid-warning-icon",
|
|
210
|
+
negative: "not-group-disabled:text-button-solid-negative-icon",
|
|
211
|
+
neutral: "not-group-disabled:text-button-solid-neutral-icon"
|
|
213
212
|
}[color];
|
|
214
213
|
return /* @__PURE__ */ jsxs(
|
|
215
214
|
"button",
|
|
216
215
|
{
|
|
217
216
|
ref,
|
|
218
217
|
onClick,
|
|
219
|
-
disabled,
|
|
220
218
|
className: clsx(
|
|
221
|
-
"font-semibold",
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
},
|
|
219
|
+
"group font-semibold",
|
|
220
|
+
colorClasses,
|
|
221
|
+
"not-disabled:hover:brightness-90",
|
|
222
|
+
"disabled:text-disabled-text disabled:bg-disabled-background",
|
|
226
223
|
ButtonUtil.paddingMapping[size],
|
|
227
224
|
className
|
|
228
225
|
),
|
|
@@ -231,10 +228,10 @@ var SolidButton = forwardRef(function SolidButton2({
|
|
|
231
228
|
startIcon && /* @__PURE__ */ jsx(
|
|
232
229
|
"span",
|
|
233
230
|
{
|
|
234
|
-
className: clsx(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
231
|
+
className: clsx(
|
|
232
|
+
iconColorClasses,
|
|
233
|
+
"group-disabled:text-disabled-icon"
|
|
234
|
+
),
|
|
238
235
|
children: startIcon
|
|
239
236
|
}
|
|
240
237
|
),
|
|
@@ -242,10 +239,10 @@ var SolidButton = forwardRef(function SolidButton2({
|
|
|
242
239
|
endIcon && /* @__PURE__ */ jsx(
|
|
243
240
|
"span",
|
|
244
241
|
{
|
|
245
|
-
className: clsx(
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
242
|
+
className: clsx(
|
|
243
|
+
iconColorClasses,
|
|
244
|
+
"group-disabled:text-disabled-icon"
|
|
245
|
+
),
|
|
249
246
|
children: endIcon
|
|
250
247
|
}
|
|
251
248
|
)
|
|
@@ -255,32 +252,32 @@ var SolidButton = forwardRef(function SolidButton2({
|
|
|
255
252
|
});
|
|
256
253
|
var IconButton = ({
|
|
257
254
|
children,
|
|
258
|
-
disabled = false,
|
|
259
255
|
color = "primary",
|
|
260
256
|
size = "medium",
|
|
261
257
|
className,
|
|
262
258
|
...restProps
|
|
263
259
|
}) => {
|
|
264
260
|
const colorClasses = {
|
|
265
|
-
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
266
|
-
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
267
|
-
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
268
|
-
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
269
|
-
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
270
|
-
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
271
|
-
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
272
|
-
transparent: "bg-transparent"
|
|
261
|
+
primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
|
|
262
|
+
secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
|
|
263
|
+
tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
|
|
264
|
+
positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
|
|
265
|
+
warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
|
|
266
|
+
negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
|
|
267
|
+
neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text",
|
|
268
|
+
transparent: "not-disabled:bg-transparent"
|
|
273
269
|
}[color];
|
|
274
270
|
return /* @__PURE__ */ jsx(
|
|
275
271
|
"button",
|
|
276
272
|
{
|
|
277
|
-
disabled,
|
|
278
273
|
className: clsx(
|
|
274
|
+
colorClasses,
|
|
275
|
+
"not-disabled:hover:brightness-90",
|
|
276
|
+
"disabled:text-disabled-text",
|
|
279
277
|
{
|
|
280
|
-
"
|
|
281
|
-
"
|
|
282
|
-
"hover:bg-button-text-hover-background":
|
|
283
|
-
[clsx(colorClasses, "hover:brightness-90")]: !disabled
|
|
278
|
+
"disabled:bg-disabled-background": color !== "transparent",
|
|
279
|
+
"disabled:opacity-70": color === "transparent",
|
|
280
|
+
"not-disabled:hover:bg-button-text-hover-background": color === "transparent"
|
|
284
281
|
},
|
|
285
282
|
ButtonUtil.iconPaddingMapping[size],
|
|
286
283
|
className
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/layout-and-navigation/Carousel.tsx","../../../src/util/array.ts","../../../src/util/math.ts","../../../src/util/easeFunctions.ts","../../../src/util/loopingArray.ts","../../../src/components/user-action/Button.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport clsx from 'clsx'\nimport { ChevronLeft, ChevronRight } from 'lucide-react'\nimport { createLoopingListWithIndex, range } from '../../util/array'\nimport { clamp } from '../../util/math'\nimport { EaseFunctions } from '../../util/easeFunctions'\nimport type { Direction } from '../../util/loopingArray'\nimport { LoopingArrayCalculator } from '../../util/loopingArray'\nimport { IconButton } from '../user-action/Button'\n\n\nexport type CarouselProps = {\n children: ReactNode[],\n animationTime?: number,\n isLooping?: boolean,\n isAutoLooping?: boolean,\n autoLoopingTimeOut?: number,\n autoLoopAnimationTime?: number,\n hintNext?: boolean,\n arrows?: boolean,\n dots?: boolean,\n /**\n * Percentage that is allowed to be scrolled further\n */\n overScrollThreshold?: number,\n blurColor?: string,\n className?: string,\n heightClassName?: string,\n widthClassName?: string,\n}\n\ntype ItemType = {\n item: ReactNode,\n index: number,\n}\n\ntype CarouselAnimationState = {\n targetPosition: number,\n /**\n * Value of either 1 or -1, 1 is forwards -1 is backwards\n */\n direction: Direction,\n startPosition: number,\n startTime?: number,\n lastUpdateTime?: number,\n isAutoLooping: boolean,\n}\n\ntype DragState = {\n startX: number,\n startTime: number,\n lastX: number,\n startIndex: number,\n}\n\ntype CarouselInformation = {\n currentPosition: number,\n dragState?: DragState,\n animationState?: CarouselAnimationState,\n}\n\nexport const Carousel = ({\n children,\n animationTime = 200,\n isLooping = false,\n isAutoLooping = false,\n autoLoopingTimeOut = 5000,\n autoLoopAnimationTime = 500,\n hintNext = false,\n arrows = false,\n dots = true,\n overScrollThreshold = 0.1,\n blurColor = 'from-background',\n className = '',\n heightClassName = 'h-96',\n widthClassName = 'w-[70%] desktop:w-1/2',\n }: CarouselProps) => {\n if (isAutoLooping && !isLooping) {\n console.error('When isAutoLooping is true, isLooping should also be true')\n isLooping = true\n }\n\n const [{\n currentPosition,\n dragState,\n animationState,\n }, setCarouselInformation] = useState<CarouselInformation>({\n currentPosition: 0,\n })\n const animationId = useRef<number | undefined>(undefined)\n const timeOut = useRef<NodeJS.Timeout | undefined>(undefined)\n autoLoopingTimeOut = Math.max(0, autoLoopingTimeOut)\n\n const length = children.length\n const paddingItemCount = 3 // The number of items to append left and right of the list to allow for clean transition when looping\n\n const util = useMemo(() => new LoopingArrayCalculator(length, isLooping, overScrollThreshold), [length, isLooping, overScrollThreshold])\n const currentIndex = util.getCorrectedPosition(LoopingArrayCalculator.withoutOffset(currentPosition))\n animationTime = Math.max(200, animationTime) // in ms, must be > 0\n autoLoopAnimationTime = Math.max(200, autoLoopAnimationTime)\n\n const getStyleOffset = (index: number) => {\n const baseOffset = -50 + (index - currentPosition) * 100\n return `${baseOffset}%`\n }\n\n const animation = useCallback((time: number) => {\n let keepAnimating: boolean = true\n\n // Other calculation in the setState call to avoid updating the useCallback to often\n setCarouselInformation((state) => {\n const {\n animationState,\n dragState\n } = state\n if (animationState === undefined || dragState !== undefined) {\n keepAnimating = false\n return state\n }\n if (!animationState.startTime || !animationState.lastUpdateTime) {\n return {\n ...state,\n animationState: {\n ...animationState,\n startTime: time,\n lastUpdateTime: time\n }\n }\n }\n const useAnimationTime = animationState.isAutoLooping ? autoLoopAnimationTime : animationTime\n const progress = clamp((time - animationState.startTime) / useAnimationTime) // progress\n const easedProgress = EaseFunctions.easeInEaseOut(progress)\n const distance = util.getDistanceDirectional(animationState.startPosition, animationState.targetPosition, animationState.direction)\n const newPosition = util.getCorrectedPosition(easedProgress * distance * animationState.direction + animationState.startPosition)\n\n if (animationState.targetPosition === newPosition || progress === 1) {\n keepAnimating = false\n return ({\n currentPosition: LoopingArrayCalculator.withoutOffset(newPosition),\n animationState: undefined\n })\n }\n return ({\n currentPosition: newPosition,\n animationState: {\n ...animationState!,\n lastUpdateTime: time\n }\n })\n })\n if (keepAnimating) {\n animationId.current = requestAnimationFrame(time1 => animation(time1))\n }\n }, [animationTime, autoLoopAnimationTime, util])\n\n useEffect(() => {\n if (animationState) {\n animationId.current = requestAnimationFrame(animation)\n }\n return () => {\n if (animationId.current) {\n cancelAnimationFrame(animationId.current)\n animationId.current = 0\n }\n }\n }, [animationState]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const startAutoLoop = () => setCarouselInformation(prevState => ({\n ...prevState,\n dragState: prevState.dragState,\n animationState: prevState.animationState || prevState.dragState ? prevState.animationState : {\n startPosition: currentPosition,\n targetPosition: (currentPosition + 1) % length,\n direction: 1, // always move forward\n isAutoLooping: true\n }\n }))\n\n useEffect(() => {\n if (!animationId.current && !animationState && !dragState && !timeOut.current) {\n if (autoLoopingTimeOut > 0) {\n timeOut.current = setTimeout(() => {\n startAutoLoop()\n timeOut.current = undefined\n }, autoLoopingTimeOut)\n } else {\n startAutoLoop()\n }\n }\n }, [animationState, dragState, animationId.current, timeOut.current]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const startAnimation = (targetPosition?: number) => {\n if (targetPosition === undefined) {\n targetPosition = LoopingArrayCalculator.withoutOffset(currentPosition)\n }\n if (targetPosition === currentPosition) {\n return // we are exactly where we want to be\n }\n\n // find target index and fastest path to it\n const direction = util.getBestDirection(currentPosition, targetPosition)\n clearTimeout(timeOut.current)\n timeOut.current = undefined\n if (animationId.current) {\n cancelAnimationFrame(animationId.current)\n animationId.current = undefined\n }\n\n setCarouselInformation(prevState => ({\n ...prevState,\n dragState: undefined,\n animationState: {\n targetPosition: targetPosition!,\n direction,\n startPosition: currentPosition,\n isAutoLooping: false\n },\n timeOut: undefined\n }))\n }\n\n const canGoLeft = () => {\n return isLooping || currentPosition !== 0\n }\n\n const canGoRight = () => {\n return isLooping || currentPosition !== length - 1\n }\n\n const left = () => {\n if (canGoLeft()) {\n startAnimation(currentPosition === 0 ? length - 1 : LoopingArrayCalculator.withoutOffset(currentPosition - 1))\n }\n }\n\n const right = () => {\n if (canGoRight()) {\n startAnimation(LoopingArrayCalculator.withoutOffset((currentPosition + 1) % length))\n }\n }\n\n let items: ItemType[] = children.map((item, index) => ({\n index,\n item\n }))\n\n if (isLooping) {\n const before = createLoopingListWithIndex(children, length - 1, paddingItemCount, false).reverse().map(([index, item]) => ({\n index,\n item\n }))\n const after = createLoopingListWithIndex(children, 0, paddingItemCount).map(([index, item]) => ({\n index,\n item\n }))\n items = [\n ...before,\n ...items,\n ...after\n ]\n }\n\n const onDragStart = (x: number) => setCarouselInformation(prevState => ({\n ...prevState,\n dragState: {\n lastX: x,\n startX: x,\n startTime: Date.now(),\n startIndex: currentPosition,\n },\n animationState: undefined // cancel animation\n }))\n\n const onDrag = (x: number, width: number) => {\n // For some weird reason the clientX is 0 on the last dragUpdate before drag end causing issues\n if (!dragState || x === 0) {\n return\n }\n const offsetUpdate = (dragState.lastX - x) / width\n const newPosition = util.getCorrectedPosition(currentPosition + offsetUpdate)\n\n setCarouselInformation(prevState => ({\n ...prevState,\n currentPosition: newPosition,\n dragState: {\n ...dragState,\n lastX: x\n },\n }))\n }\n\n const onDragEnd = (x: number, width: number) => {\n if (!dragState) {\n return\n }\n const distance = dragState.startX - x\n const relativeDistance = distance / width\n const duration = (Date.now() - dragState.startTime) // in milliseconds\n const velocity = distance / (Date.now() - dragState.startTime)\n\n const isSlide = Math.abs(velocity) > 2 || (duration < 200 && (Math.abs(relativeDistance) > 0.2 || Math.abs(distance) > 50))\n if (isSlide) {\n if (distance > 0 && canGoRight()) {\n right()\n return\n } else if (distance < 0 && canGoLeft()) {\n left()\n return\n }\n }\n startAnimation()\n }\n\n const dragHandlers = {\n draggable: true,\n onDragStart: (event: React.DragEvent<HTMLDivElement>) => {\n onDragStart(event.clientX)\n event.dataTransfer.setDragImage(document.createElement('div'), 0, 0)\n },\n onDrag: (event: React.DragEvent<HTMLDivElement>) => onDrag(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onDragEnd: (event: React.DragEvent<HTMLDivElement>) => onDragEnd(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => onDragStart(event.touches[0]!.clientX),\n onTouchMove: (event: React.TouchEvent<HTMLDivElement>) => onDrag(event.touches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchEnd: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchCancel: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n }\n\n return (\n <div className=\"flex-col-2 items-center w-full\">\n <div className={clsx(`relative w-full overflow-hidden`, heightClassName, className)}>\n {arrows && (\n <>\n <IconButton\n color=\"neutral\"\n className={clsx('absolute z-10 left-0 top-1/2 -translate-y-1/2 shadow-md', { hidden: !canGoLeft() })}\n disabled={!canGoLeft()}\n onClick={() => left()}\n >\n <ChevronLeft size={24}/>\n </IconButton>\n <IconButton\n color=\"neutral\"\n className={clsx('absolute z-10 right-0 top-1/2 -translate-y-1/2 shadow-md', { hidden: !canGoRight() })}\n disabled={!canGoRight()}\n onClick={() => right()}\n >\n <ChevronRight size={24}/>\n </IconButton>\n </>\n )}\n {hintNext ? (\n <div className={clsx(`flex-row-2 relative h-full`, heightClassName)}>\n <div className=\"flex-row-2 relative h-full w-full px-2 overflow-hidden\">\n {items.map(({\n item,\n index\n }, listIndex) => (\n <div\n key={listIndex}\n className={clsx(`absolute left-[50%] h-full overflow-hidden`, widthClassName, { '!cursor-grabbing': !!dragState })}\n style={{ translate: getStyleOffset(listIndex - (isLooping ? paddingItemCount : 0)) }}\n {...dragHandlers}\n onClick={() => startAnimation(index)}\n >\n {item}\n </div>\n ))}\n </div>\n <div\n className={clsx(`hidden pointer-events-none desktop:block absolute left-0 h-full w-[20%] bg-gradient-to-r to-transparent`, blurColor)}\n />\n <div\n className={clsx(`hidden pointer-events-none desktop:block absolute right-0 h-full w-[20%] bg-gradient-to-l to-transparent`, blurColor)}\n />\n </div>\n ) : (\n <div className={clsx('px-16 h-full', { '!cursor-grabbing': !!dragState })} {...dragHandlers}>\n {children[currentIndex]}\n </div>\n )}\n </div>\n {dots && (\n <div\n className=\"flex-row-2 items-center justify-center w-full my-2\">\n {range(length).map(index => (\n <button\n key={index}\n className={clsx('w-8 min-w-8 h-3 min-h-3 first:rounded-l-md last:rounded-r-md', {\n 'bg-carousel-dot-disabled hover:bg-carousel-dot-active': currentIndex !== index,\n 'bg-carousel-dot-active hover:brightness-90': currentIndex === index\n })}\n onClick={() => startAnimation(index)}\n />\n ))}\n </div>\n )}\n </div>\n )\n}\n","export const equalSizeGroups = <T>(array: T[], groupSize: number): T[][] => {\n if (groupSize <= 0) {\n console.warn(`group size should be greater than 0: groupSize = ${groupSize}`)\n return [[...array]]\n }\n\n const groups = []\n for (let i = 0; i < array.length; i += groupSize) {\n groups.push(array.slice(i, Math.min(i + groupSize, array.length)))\n }\n return groups\n}\n\nexport type RangeOptions = {\n /** Whether the range can be defined empty via end < start without a warning */\n allowEmptyRange: boolean,\n stepSize: number,\n exclusiveStart: boolean,\n exclusiveEnd: boolean,\n}\n\nconst defaultRangeOptions: RangeOptions = {\n allowEmptyRange: false,\n stepSize: 1,\n exclusiveStart: false,\n exclusiveEnd: true,\n}\n\n/**\n * @param endOrRange The end value or a range [start, end], end is exclusive\n * @param options the options for defining the range\n */\nexport const range = (endOrRange: number | [number, number], options?: Partial<RangeOptions>): number[] => {\n const { allowEmptyRange, stepSize, exclusiveStart, exclusiveEnd } = { ...defaultRangeOptions, ...options }\n let start = 0\n let end: number\n if (typeof endOrRange === 'number') {\n end = endOrRange\n } else {\n start = endOrRange[0]\n end = endOrRange[1]\n }\n if (!exclusiveEnd) {\n end -= 1\n }\n if (exclusiveStart) {\n start += 1\n }\n\n if (end - 1 < start) {\n if (!allowEmptyRange) {\n console.warn(`range: end (${end}) < start (${start}) should be allowed explicitly, set options.allowEmptyRange to true`)\n }\n return []\n }\n return Array.from({ length: end - start }, (_, index) => index * stepSize + start)\n}\n\n/** Finds the closest match\n * @param list The list of all possible matches\n * @param firstCloser Return whether item1 is closer than item2\n */\nexport const closestMatch = <T>(list: T[], firstCloser: (item1: T, item2: T) => boolean) => {\n return list.reduce((item1, item2) => {\n return firstCloser(item1, item2) ? item1 : item2\n })\n}\n\n/**\n * returns the item in middle of a list and its neighbours before and after\n * e.g. [1,2,3,4,5,6] for item = 1 would return [5,6,1,2,3]\n */\nexport const getNeighbours = <T>(list: T[], item: T, neighbourDistance: number = 2) => {\n const index = list.indexOf(item)\n const totalItems = neighbourDistance * 2 + 1\n if (list.length < totalItems) {\n console.warn('List is to short')\n return list\n }\n\n if (index === -1) {\n console.error('item not found in list')\n return list.splice(0, totalItems)\n }\n\n let start = index - neighbourDistance\n if (start < 0) {\n start += list.length\n }\n const end = (index + neighbourDistance + 1) % list.length\n\n const result: T[] = []\n let ignoreOnce = list.length === totalItems\n for (let i = start; i !== end || ignoreOnce; i = (i + 1) % list.length) {\n result.push(list[i]!)\n if (end === i && ignoreOnce) {\n ignoreOnce = false\n }\n }\n return result\n}\n\nexport const createLoopingListWithIndex = <T>(list: T[], startIndex: number = 0, length: number = 0, forwards: boolean = true) => {\n if (length < 0) {\n console.warn(`createLoopingList: length must be >= 0, given ${length}`)\n } else if (length === 0) {\n length = list.length\n }\n\n const returnList: [number, T][] = []\n\n if (forwards) {\n for (let i = startIndex; returnList.length < length; i = (i + 1) % list.length) {\n returnList.push([i, list[i]!])\n }\n } else {\n for (let i = startIndex; returnList.length < length; i = i === 0 ? i = list.length - 1 : i - 1) {\n returnList.push([i, list[i]!])\n }\n }\n\n return returnList\n}\n\nexport const createLoopingList = <T>(list: T[], startIndex: number = 0, length: number = 0, forwards: boolean = true) => {\n return createLoopingListWithIndex(list, startIndex, length, forwards).map(([_, item]) => item)\n}\n\nexport const ArrayUtil = {\n unique: <T>(list: T[]): T[] => {\n const seen = new Set<T>()\n return list.filter((item) => {\n if (seen.has(item)) {\n return false\n }\n seen.add(item)\n return true\n })\n },\n\n difference: <T>(list: T[], removeList: T[]): T[] => {\n const remove = new Set<T>(removeList)\n return list.filter((item) => !remove.has(item))\n }\n}\n","export const clamp = (value: number, min: number = 0, max: number = 1): number => {\n return Math.min(Math.max(value, min), max)\n}\n","import { clamp } from './math'\n\nexport type EaseFunction = (t: number) => number\n\nexport class EaseFunctions {\n static cubicBezierGeneric(x1: number, y1: number, x2: number, y2: number): { x: EaseFunction, y: EaseFunction } {\n // Calculate the x and y coordinates using the cubic Bézier formula\n const cx = 3 * x1\n const bx = 3 * (x2 - x1) - cx\n const ax = 1 - cx - bx\n\n const cy = 3 * y1\n const by = 3 * (y2 - y1) - cy\n const ay = 1 - cy - by\n\n // Compute x and y values at parameter t\n const x = (t: number) => ((ax * t + bx) * t + cx) * t\n const y = (t: number) => ((ay * t + by) * t + cy) * t\n\n return {\n x,\n y\n }\n }\n\n static cubicBezier(x1: number, y1: number, x2: number, y2: number): EaseFunction {\n const { y } = EaseFunctions.cubicBezierGeneric(x1, y1, x2, y2)\n return (t: number) => {\n t = clamp(t)\n return y(t) // <= equal to x(t) * 0 + y(t) * 1\n }\n }\n\n static easeInEaseOut(t: number): number {\n return EaseFunctions.cubicBezier(0.65, 0, 0.35, 1)(t)\n };\n}\n","/**\n * 1 is forwards\n *\n * -1 is backwards\n */\nexport type Direction = 1 | -1\n\nexport class LoopingArrayCalculator {\n length: number\n isLooping: boolean\n allowedOverScroll: number\n\n constructor(length: number, isLooping: boolean = true, allowedOverScroll: number = 0.1) {\n if (allowedOverScroll < 0 || length < 1) {\n throw new Error('Invalid parameters: allowedOverScroll >= 0 and length >= 1 must be true')\n }\n\n this.length = length\n this.isLooping = isLooping\n this.allowedOverScroll = allowedOverScroll\n }\n\n getCorrectedPosition(position: number): number {\n if (!this.isLooping) {\n return Math.max(-this.allowedOverScroll, Math.min(this.allowedOverScroll + this.length - 1, position))\n }\n if (position >= this.length) {\n return position % this.length\n }\n if (position < 0) {\n return this.length - (Math.abs(position) % this.length)\n }\n return position\n }\n\n static withoutOffset(position: number): number {\n return position + LoopingArrayCalculator.getOffset(position)\n }\n\n static getOffset(position: number): number {\n return Math.round(position) - position // For example: 45.5 => 46 - 45.5 = 0.5\n }\n\n /**\n * @return absolute distance forwards or Infinity when the target cannot be reached (only possible when not isLooping)\n */\n getDistanceDirectional(position: number, target: number, direction: Direction): number {\n if (!this.isLooping && (position < -this.allowedOverScroll || position > this.allowedOverScroll + this.length - 1)) {\n throw new Error('Invalid parameters: position is out of bounds.')\n }\n\n const isForwardInvalid = (direction === 1 && position > target)\n const isBackwardInvalid = (direction === -1 && target < position)\n\n if (!this.isLooping && (isForwardInvalid || isBackwardInvalid)) {\n return Infinity\n }\n\n if (direction === -1) {\n return this.getDistanceDirectional(target, position, 1)\n }\n\n position = this.getCorrectedPosition(position)\n target = this.getCorrectedPosition(target)\n\n let distance = (target - position) * direction\n if (distance < 0) {\n distance = this.length - (Math.abs(position) % this.length) + target\n }\n\n return distance\n }\n\n getDistanceForward(position: number, target: number): number {\n return this.getDistanceDirectional(position, target, 1)\n }\n\n getDistanceBackward(position: number, target: number): number {\n return this.getDistanceDirectional(position, target, -1)\n }\n\n getDistance(position: number, target: number): number {\n const forwardDistance = this.getDistanceForward(position, target)\n const backwardDistance = this.getDistanceBackward(position, target)\n\n return Math.min(forwardDistance, backwardDistance)\n }\n\n getBestDirection(position: number, target: number): Direction {\n const forwardDistance = this.getDistanceForward(position, target)\n const backwardDistance = this.getDistanceBackward(position, target)\n return forwardDistance < backwardDistance ? 1 : -1\n }\n}\n","import type { ButtonHTMLAttributes, PropsWithChildren, ReactNode } from 'react'\nimport { forwardRef } from 'react'\nimport clsx from 'clsx'\n\n\nexport const ButtonColorUtil = {\n solid: ['primary', 'secondary', 'tertiary', 'positive', 'warning', 'negative', 'neutral'] as const,\n text: ['primary', 'negative', 'neutral'] as const,\n outline: ['primary'] as const,\n}\n\nexport const IconButtonUtil = {\n icon: [...ButtonColorUtil.solid, 'transparent'] as const,\n}\n\n\n/**\n * The allowed colors for the SolidButton and IconButton\n */\nexport type SolidButtonColor = typeof ButtonColorUtil.solid[number]\n/**\n * The allowed colors for the OutlineButton\n */\nexport type OutlineButtonColor = typeof ButtonColorUtil.outline[number]\n/**\n * The allowed colors for the TextButton\n */\nexport type TextButtonColor = typeof ButtonColorUtil.text[number]\n/**\n * The allowed colors for the IconButton\n */\nexport type IconButtonColor = typeof IconButtonUtil.icon[number]\n\n\n/**\n * The different sizes for a button\n */\ntype ButtonSizes = 'small' | 'medium' | 'large'\n\ntype IconButtonSize = 'tiny' | 'small' | 'medium' | 'large'\n\n/**\n * The shard properties between all button types\n */\nexport type ButtonProps = PropsWithChildren<{\n /**\n * @default 'medium'\n */\n size?: ButtonSizes,\n}> & ButtonHTMLAttributes<Element>\n\nconst paddingMapping: Record<ButtonSizes, string> = {\n small: 'btn-sm',\n medium: 'btn-md',\n large: 'btn-lg'\n}\n\nconst iconPaddingMapping: Record<IconButtonSize, string> = {\n tiny: 'icon-btn-xs',\n small: 'icon-btn-sm',\n medium: 'icon-btn-md',\n large: 'icon-btn-lg'\n}\n\nexport const ButtonUtil = {\n paddingMapping,\n iconPaddingMapping\n}\n\ntype ButtonWithIconsProps = ButtonProps & {\n startIcon?: ReactNode,\n endIcon?: ReactNode,\n}\n\nexport type SolidButtonProps = ButtonWithIconsProps & {\n color?: SolidButtonColor,\n}\n\nexport type OutlineButtonProps = ButtonWithIconsProps & {\n color?: OutlineButtonColor,\n}\n\nexport type TextButtonProps = ButtonWithIconsProps & {\n color?: TextButtonColor,\n coloredHoverBackground?: boolean,\n}\n\n/**\n * The shard properties between all button types\n */\nexport type IconButtonProps = PropsWithChildren<{\n /**\n * @default 'medium'\n */\n size?: IconButtonSize,\n color?: IconButtonColor,\n}> & ButtonHTMLAttributes<Element>\n\n/**\n * A button with a solid background and different sizes\n */\nconst SolidButton = forwardRef<HTMLButtonElement, SolidButtonProps>(function SolidButton({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }, ref) {\n const colorClasses = {\n primary: 'bg-button-solid-primary-background text-button-solid-primary-text',\n secondary: 'bg-button-solid-secondary-background text-button-solid-secondary-text',\n tertiary: 'bg-button-solid-tertiary-background text-button-solid-tertiary-text',\n positive: 'bg-button-solid-positive-background text-button-solid-positive-text',\n warning: 'bg-button-solid-warning-background text-button-solid-warning-text',\n negative: 'bg-button-solid-negative-background text-button-solid-negative-text',\n neutral: 'bg-button-solid-neutral-background text-button-solid-neutral-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-solid-primary-icon',\n secondary: 'text-button-solid-secondary-icon',\n tertiary: 'text-button-solid-tertiary-icon',\n positive: 'text-button-solid-positive-icon',\n warning: 'text-button-solid-warning-icon',\n negative: 'text-button-solid-negative-icon',\n neutral: 'text-button-solid-neutral-icon',\n }[color]\n\n return (\n <button\n ref={ref}\n onClick={onClick}\n disabled={disabled}\n className={clsx(\n 'font-semibold',\n {\n 'text-disabled-text bg-disabled-background cursor-not-allowed': disabled,\n [clsx(colorClasses, 'hover:brightness-90')]: !disabled\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n})\n\n/**\n * A button with an outline border and different sizes\n */\nconst OutlineButton = ({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }: OutlineButtonProps) => {\n const colorClasses = {\n primary: 'bg-transparent border-2 border-button-outline-primary-text text-button-outline-primary-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-outline-primary-icon',\n }[color]\n return (\n <button\n onClick={onClick}\n disabled={disabled}\n className={clsx(\n 'font-semibold',\n {\n 'text-disabled-text border-disabled-outline cursor-not-allowed': disabled,\n [clsx(colorClasses, 'hover:brightness-80')]: !disabled,\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n/**\n * A text that is a button that can have different sizes\n */\nconst TextButton = ({\n children,\n disabled = false,\n color = 'neutral',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n coloredHoverBackground = true,\n className,\n ...restProps\n }: TextButtonProps) => {\n const colorClasses = {\n primary: 'bg-transparent text-button-text-primary-text',\n negative: 'bg-transparent text-button-text-negative-text',\n neutral: 'bg-transparent text-button-text-neutral-text',\n }[color]\n\n const backgroundColor = {\n primary: 'hover:bg-button-text-primary-text/20',\n negative: 'hover:bg-button-text-negative-text/20',\n neutral: 'hover:bg-button-text-neutral-text/20',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-text-primary-icon',\n negative: 'text-button-text-negative-icon',\n neutral: 'text-button-text-neutral-icon',\n }[color]\n\n return (\n <button\n onClick={onClick}\n disabled={disabled}\n className={clsx(\n 'font-semibold',\n {\n 'text-disabled-text cursor-not-allowed': disabled,\n [colorClasses]: !disabled,\n [backgroundColor]: !disabled && coloredHoverBackground,\n 'hover:bg-button-text-hover-background': !disabled && !coloredHoverBackground,\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n\n/**\n * A button for icons with a solid background and different sizes\n */\nconst IconButton = ({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n className,\n ...restProps\n }: IconButtonProps) => {\n const colorClasses = {\n primary: 'bg-button-solid-primary-background text-button-solid-primary-text',\n secondary: 'bg-button-solid-secondary-background text-button-solid-secondary-text',\n tertiary: 'bg-button-solid-tertiary-background text-button-solid-tertiary-text',\n positive: 'bg-button-solid-positive-background text-button-solid-positive-text',\n warning: 'bg-button-solid-warning-background text-button-solid-warning-text',\n negative: 'bg-button-solid-negative-background text-button-solid-negative-text',\n neutral: 'bg-button-solid-neutral-background text-button-solid-neutral-text',\n transparent: 'bg-transparent',\n }[color]\n\n return (\n <button\n disabled={disabled}\n className={clsx(\n {\n 'text-disabled-text bg-disabled-background cursor-not-allowed': disabled && color !== 'transparent',\n 'text-disabled-text cursor-not-allowed opacity-70': disabled && color === 'transparent',\n 'hover:bg-button-text-hover-background': !disabled && color === 'transparent',\n [clsx(colorClasses, 'hover:brightness-90')]: !disabled,\n },\n ButtonUtil.iconPaddingMapping[size],\n className\n )}\n {...restProps}\n >\n {children}\n </button>\n )\n}\n\nexport { SolidButton, OutlineButton, TextButton, IconButton }\n"],"mappings":";AACA,SAAgB,aAAa,WAAW,SAAS,QAAQ,gBAAgB;AACzE,OAAOA,WAAU;AACjB,SAAS,aAAa,oBAAo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AAAA;AAAA,UAAC;AAAA;AAAA,YAEC,WAAWI,MAAK,8CAA8C,gBAAgB,EAAE,oBAAoB,CAAC,CAAC,UAAU,CAAC;AAAA,YACjH,OAAO,EAAE,WAAW,eAAe,aAAa,YAAY,mBAAmB,EAAE,EAAE;AAAA,YAClF,GAAG;AAAA,YACJ,SAAS,MAAM,eAAe,KAAK;AAAA,YAElC;AAAA;AAAA,UANI;AAAA,QAOP,CACD,GACH;AAAA,QACA,gBAAAJ;AAAA,UAAC;AAAA;AAAA,YACC,WAAWI,MAAK,2GAA2G,SAAS;AAAA;AAAA,QACtI;AAAA,QACA,gBAAAJ;AAAA,UAAC;AAAA;AAAA,YACC,WAAWI,MAAK,4GAA4G,SAAS;AAAA;AAAA,QACvI;AAAA,SACF,IAEA,gBAAAJ,KAAC,SAAI,WAAWI,MAAK,gBAAgB,EAAE,oBAAoB,CAAC,CAAC,UAAU,CAAC,GAAI,GAAG,cAC5E,mBAAS,YAAY,GACxB;AAAA,OAEJ;AAAA,IACC,QACC,gBAAAJ;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACT,gBAAM,MAAM,EAAE,IAAI,WACjB,gBAAAA;AAAA,UAAC;AAAA;AAAA,YAEC,WAAWI,MAAK,gEAAgE;AAAA,cAC9E,yDAAyD,iBAAiB;AAAA,cAC1E,8CAA8C,iBAAiB;AAAA,YACjE,CAAC;AAAA,YACD,SAAS,MAAM,eAAe,KAAK;AAAA;AAAA,UAL9B;AAAA,QAMP,CACD;AAAA;AAAA,IACH;AAAA,KAEJ;AAEJ;","names":["clsx","SolidButton","jsx","jsxs","animationState","dragState","clsx"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/layout-and-navigation/Carousel.tsx","../../../src/util/array.ts","../../../src/util/math.ts","../../../src/util/easeFunctions.ts","../../../src/util/loopingArray.ts","../../../src/components/user-action/Button.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport clsx from 'clsx'\nimport { ChevronLeft, ChevronRight } from 'lucide-react'\nimport { createLoopingListWithIndex, range } from '../../util/array'\nimport { clamp } from '../../util/math'\nimport { EaseFunctions } from '../../util/easeFunctions'\nimport type { Direction } from '../../util/loopingArray'\nimport { LoopingArrayCalculator } from '../../util/loopingArray'\nimport { IconButton } from '../user-action/Button'\n\n\nexport type CarouselProps = {\n children: ReactNode[],\n animationTime?: number,\n isLooping?: boolean,\n isAutoLooping?: boolean,\n autoLoopingTimeOut?: number,\n autoLoopAnimationTime?: number,\n hintNext?: boolean,\n arrows?: boolean,\n dots?: boolean,\n /**\n * Percentage that is allowed to be scrolled further\n */\n overScrollThreshold?: number,\n blurColor?: string,\n className?: string,\n heightClassName?: string,\n widthClassName?: string,\n}\n\ntype ItemType = {\n item: ReactNode,\n index: number,\n}\n\ntype CarouselAnimationState = {\n targetPosition: number,\n /**\n * Value of either 1 or -1, 1 is forwards -1 is backwards\n */\n direction: Direction,\n startPosition: number,\n startTime?: number,\n lastUpdateTime?: number,\n isAutoLooping: boolean,\n}\n\ntype DragState = {\n startX: number,\n startTime: number,\n lastX: number,\n startIndex: number,\n}\n\ntype CarouselInformation = {\n currentPosition: number,\n dragState?: DragState,\n animationState?: CarouselAnimationState,\n}\n\nexport const Carousel = ({\n children,\n animationTime = 200,\n isLooping = false,\n isAutoLooping = false,\n autoLoopingTimeOut = 5000,\n autoLoopAnimationTime = 500,\n hintNext = false,\n arrows = false,\n dots = true,\n overScrollThreshold = 0.1,\n blurColor = 'from-background',\n className = '',\n heightClassName = 'h-96',\n widthClassName = 'w-[70%] desktop:w-1/2',\n }: CarouselProps) => {\n if (isAutoLooping && !isLooping) {\n console.error('When isAutoLooping is true, isLooping should also be true')\n isLooping = true\n }\n\n const [{\n currentPosition,\n dragState,\n animationState,\n }, setCarouselInformation] = useState<CarouselInformation>({\n currentPosition: 0,\n })\n const animationId = useRef<number | undefined>(undefined)\n const timeOut = useRef<NodeJS.Timeout | undefined>(undefined)\n autoLoopingTimeOut = Math.max(0, autoLoopingTimeOut)\n\n const length = children.length\n const paddingItemCount = 3 // The number of items to append left and right of the list to allow for clean transition when looping\n\n const util = useMemo(() => new LoopingArrayCalculator(length, isLooping, overScrollThreshold), [length, isLooping, overScrollThreshold])\n const currentIndex = util.getCorrectedPosition(LoopingArrayCalculator.withoutOffset(currentPosition))\n animationTime = Math.max(200, animationTime) // in ms, must be > 0\n autoLoopAnimationTime = Math.max(200, autoLoopAnimationTime)\n\n const getStyleOffset = (index: number) => {\n const baseOffset = -50 + (index - currentPosition) * 100\n return `${baseOffset}%`\n }\n\n const animation = useCallback((time: number) => {\n let keepAnimating: boolean = true\n\n // Other calculation in the setState call to avoid updating the useCallback to often\n setCarouselInformation((state) => {\n const {\n animationState,\n dragState\n } = state\n if (animationState === undefined || dragState !== undefined) {\n keepAnimating = false\n return state\n }\n if (!animationState.startTime || !animationState.lastUpdateTime) {\n return {\n ...state,\n animationState: {\n ...animationState,\n startTime: time,\n lastUpdateTime: time\n }\n }\n }\n const useAnimationTime = animationState.isAutoLooping ? autoLoopAnimationTime : animationTime\n const progress = clamp((time - animationState.startTime) / useAnimationTime) // progress\n const easedProgress = EaseFunctions.easeInEaseOut(progress)\n const distance = util.getDistanceDirectional(animationState.startPosition, animationState.targetPosition, animationState.direction)\n const newPosition = util.getCorrectedPosition(easedProgress * distance * animationState.direction + animationState.startPosition)\n\n if (animationState.targetPosition === newPosition || progress === 1) {\n keepAnimating = false\n return ({\n currentPosition: LoopingArrayCalculator.withoutOffset(newPosition),\n animationState: undefined\n })\n }\n return ({\n currentPosition: newPosition,\n animationState: {\n ...animationState!,\n lastUpdateTime: time\n }\n })\n })\n if (keepAnimating) {\n animationId.current = requestAnimationFrame(time1 => animation(time1))\n }\n }, [animationTime, autoLoopAnimationTime, util])\n\n useEffect(() => {\n if (animationState) {\n animationId.current = requestAnimationFrame(animation)\n }\n return () => {\n if (animationId.current) {\n cancelAnimationFrame(animationId.current)\n animationId.current = 0\n }\n }\n }, [animationState]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const startAutoLoop = () => setCarouselInformation(prevState => ({\n ...prevState,\n dragState: prevState.dragState,\n animationState: prevState.animationState || prevState.dragState ? prevState.animationState : {\n startPosition: currentPosition,\n targetPosition: (currentPosition + 1) % length,\n direction: 1, // always move forward\n isAutoLooping: true\n }\n }))\n\n useEffect(() => {\n if (!animationId.current && !animationState && !dragState && !timeOut.current) {\n if (autoLoopingTimeOut > 0) {\n timeOut.current = setTimeout(() => {\n startAutoLoop()\n timeOut.current = undefined\n }, autoLoopingTimeOut)\n } else {\n startAutoLoop()\n }\n }\n }, [animationState, dragState, animationId.current, timeOut.current]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const startAnimation = (targetPosition?: number) => {\n if (targetPosition === undefined) {\n targetPosition = LoopingArrayCalculator.withoutOffset(currentPosition)\n }\n if (targetPosition === currentPosition) {\n return // we are exactly where we want to be\n }\n\n // find target index and fastest path to it\n const direction = util.getBestDirection(currentPosition, targetPosition)\n clearTimeout(timeOut.current)\n timeOut.current = undefined\n if (animationId.current) {\n cancelAnimationFrame(animationId.current)\n animationId.current = undefined\n }\n\n setCarouselInformation(prevState => ({\n ...prevState,\n dragState: undefined,\n animationState: {\n targetPosition: targetPosition!,\n direction,\n startPosition: currentPosition,\n isAutoLooping: false\n },\n timeOut: undefined\n }))\n }\n\n const canGoLeft = () => {\n return isLooping || currentPosition !== 0\n }\n\n const canGoRight = () => {\n return isLooping || currentPosition !== length - 1\n }\n\n const left = () => {\n if (canGoLeft()) {\n startAnimation(currentPosition === 0 ? length - 1 : LoopingArrayCalculator.withoutOffset(currentPosition - 1))\n }\n }\n\n const right = () => {\n if (canGoRight()) {\n startAnimation(LoopingArrayCalculator.withoutOffset((currentPosition + 1) % length))\n }\n }\n\n let items: ItemType[] = children.map((item, index) => ({\n index,\n item\n }))\n\n if (isLooping) {\n const before = createLoopingListWithIndex(children, length - 1, paddingItemCount, false).reverse().map(([index, item]) => ({\n index,\n item\n }))\n const after = createLoopingListWithIndex(children, 0, paddingItemCount).map(([index, item]) => ({\n index,\n item\n }))\n items = [\n ...before,\n ...items,\n ...after\n ]\n }\n\n const onDragStart = (x: number) => setCarouselInformation(prevState => ({\n ...prevState,\n dragState: {\n lastX: x,\n startX: x,\n startTime: Date.now(),\n startIndex: currentPosition,\n },\n animationState: undefined // cancel animation\n }))\n\n const onDrag = (x: number, width: number) => {\n // For some weird reason the clientX is 0 on the last dragUpdate before drag end causing issues\n if (!dragState || x === 0) {\n return\n }\n const offsetUpdate = (dragState.lastX - x) / width\n const newPosition = util.getCorrectedPosition(currentPosition + offsetUpdate)\n\n setCarouselInformation(prevState => ({\n ...prevState,\n currentPosition: newPosition,\n dragState: {\n ...dragState,\n lastX: x\n },\n }))\n }\n\n const onDragEnd = (x: number, width: number) => {\n if (!dragState) {\n return\n }\n const distance = dragState.startX - x\n const relativeDistance = distance / width\n const duration = (Date.now() - dragState.startTime) // in milliseconds\n const velocity = distance / (Date.now() - dragState.startTime)\n\n const isSlide = Math.abs(velocity) > 2 || (duration < 200 && (Math.abs(relativeDistance) > 0.2 || Math.abs(distance) > 50))\n if (isSlide) {\n if (distance > 0 && canGoRight()) {\n right()\n return\n } else if (distance < 0 && canGoLeft()) {\n left()\n return\n }\n }\n startAnimation()\n }\n\n const dragHandlers = {\n draggable: true,\n onDragStart: (event: React.DragEvent<HTMLDivElement>) => {\n onDragStart(event.clientX)\n event.dataTransfer.setDragImage(document.createElement('div'), 0, 0)\n },\n onDrag: (event: React.DragEvent<HTMLDivElement>) => onDrag(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onDragEnd: (event: React.DragEvent<HTMLDivElement>) => onDragEnd(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => onDragStart(event.touches[0]!.clientX),\n onTouchMove: (event: React.TouchEvent<HTMLDivElement>) => onDrag(event.touches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchEnd: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchCancel: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n }\n\n return (\n <div className=\"flex-col-2 items-center w-full\">\n <div className={clsx(`relative w-full overflow-hidden`, heightClassName, className)}>\n {arrows && (\n <>\n <IconButton\n color=\"neutral\"\n className={clsx('absolute z-10 left-0 top-1/2 -translate-y-1/2 shadow-md', { hidden: !canGoLeft() })}\n disabled={!canGoLeft()}\n onClick={() => left()}\n >\n <ChevronLeft size={24}/>\n </IconButton>\n <IconButton\n color=\"neutral\"\n className={clsx('absolute z-10 right-0 top-1/2 -translate-y-1/2 shadow-md', { hidden: !canGoRight() })}\n disabled={!canGoRight()}\n onClick={() => right()}\n >\n <ChevronRight size={24}/>\n </IconButton>\n </>\n )}\n {hintNext ? (\n <div className={clsx(`flex-row-2 relative h-full`, heightClassName)}>\n <div className=\"flex-row-2 relative h-full w-full px-2 overflow-hidden\">\n {items.map(({\n item,\n index\n }, listIndex) => (\n <div\n key={listIndex}\n className={clsx(`absolute left-[50%] h-full overflow-hidden`, widthClassName, { '!cursor-grabbing': !!dragState })}\n style={{ translate: getStyleOffset(listIndex - (isLooping ? paddingItemCount : 0)) }}\n {...dragHandlers}\n onClick={() => startAnimation(index)}\n >\n {item}\n </div>\n ))}\n </div>\n <div\n className={clsx(`hidden pointer-events-none desktop:block absolute left-0 h-full w-[20%] bg-gradient-to-r to-transparent`, blurColor)}\n />\n <div\n className={clsx(`hidden pointer-events-none desktop:block absolute right-0 h-full w-[20%] bg-gradient-to-l to-transparent`, blurColor)}\n />\n </div>\n ) : (\n <div className={clsx('px-16 h-full', { '!cursor-grabbing': !!dragState })} {...dragHandlers}>\n {children[currentIndex]}\n </div>\n )}\n </div>\n {dots && (\n <div\n className=\"flex-row-2 items-center justify-center w-full my-2\">\n {range(length).map(index => (\n <button\n key={index}\n className={clsx('w-8 min-w-8 h-3 min-h-3 first:rounded-l-md last:rounded-r-md', {\n 'bg-carousel-dot-disabled hover:bg-carousel-dot-active': currentIndex !== index,\n 'bg-carousel-dot-active hover:brightness-90': currentIndex === index\n })}\n onClick={() => startAnimation(index)}\n />\n ))}\n </div>\n )}\n </div>\n )\n}\n","export const equalSizeGroups = <T>(array: T[], groupSize: number): T[][] => {\n if (groupSize <= 0) {\n console.warn(`group size should be greater than 0: groupSize = ${groupSize}`)\n return [[...array]]\n }\n\n const groups = []\n for (let i = 0; i < array.length; i += groupSize) {\n groups.push(array.slice(i, Math.min(i + groupSize, array.length)))\n }\n return groups\n}\n\nexport type RangeOptions = {\n /** Whether the range can be defined empty via end < start without a warning */\n allowEmptyRange: boolean,\n stepSize: number,\n exclusiveStart: boolean,\n exclusiveEnd: boolean,\n}\n\nconst defaultRangeOptions: RangeOptions = {\n allowEmptyRange: false,\n stepSize: 1,\n exclusiveStart: false,\n exclusiveEnd: true,\n}\n\n/**\n * @param endOrRange The end value or a range [start, end], end is exclusive\n * @param options the options for defining the range\n */\nexport const range = (endOrRange: number | [number, number], options?: Partial<RangeOptions>): number[] => {\n const { allowEmptyRange, stepSize, exclusiveStart, exclusiveEnd } = { ...defaultRangeOptions, ...options }\n let start = 0\n let end: number\n if (typeof endOrRange === 'number') {\n end = endOrRange\n } else {\n start = endOrRange[0]\n end = endOrRange[1]\n }\n if (!exclusiveEnd) {\n end -= 1\n }\n if (exclusiveStart) {\n start += 1\n }\n\n if (end - 1 < start) {\n if (!allowEmptyRange) {\n console.warn(`range: end (${end}) < start (${start}) should be allowed explicitly, set options.allowEmptyRange to true`)\n }\n return []\n }\n return Array.from({ length: end - start }, (_, index) => index * stepSize + start)\n}\n\n/** Finds the closest match\n * @param list The list of all possible matches\n * @param firstCloser Return whether item1 is closer than item2\n */\nexport const closestMatch = <T>(list: T[], firstCloser: (item1: T, item2: T) => boolean) => {\n return list.reduce((item1, item2) => {\n return firstCloser(item1, item2) ? item1 : item2\n })\n}\n\n/**\n * returns the item in middle of a list and its neighbours before and after\n * e.g. [1,2,3,4,5,6] for item = 1 would return [5,6,1,2,3]\n */\nexport const getNeighbours = <T>(list: T[], item: T, neighbourDistance: number = 2) => {\n const index = list.indexOf(item)\n const totalItems = neighbourDistance * 2 + 1\n if (list.length < totalItems) {\n console.warn('List is to short')\n return list\n }\n\n if (index === -1) {\n console.error('item not found in list')\n return list.splice(0, totalItems)\n }\n\n let start = index - neighbourDistance\n if (start < 0) {\n start += list.length\n }\n const end = (index + neighbourDistance + 1) % list.length\n\n const result: T[] = []\n let ignoreOnce = list.length === totalItems\n for (let i = start; i !== end || ignoreOnce; i = (i + 1) % list.length) {\n result.push(list[i]!)\n if (end === i && ignoreOnce) {\n ignoreOnce = false\n }\n }\n return result\n}\n\nexport const createLoopingListWithIndex = <T>(list: T[], startIndex: number = 0, length: number = 0, forwards: boolean = true) => {\n if (length < 0) {\n console.warn(`createLoopingList: length must be >= 0, given ${length}`)\n } else if (length === 0) {\n length = list.length\n }\n\n const returnList: [number, T][] = []\n\n if (forwards) {\n for (let i = startIndex; returnList.length < length; i = (i + 1) % list.length) {\n returnList.push([i, list[i]!])\n }\n } else {\n for (let i = startIndex; returnList.length < length; i = i === 0 ? i = list.length - 1 : i - 1) {\n returnList.push([i, list[i]!])\n }\n }\n\n return returnList\n}\n\nexport const createLoopingList = <T>(list: T[], startIndex: number = 0, length: number = 0, forwards: boolean = true) => {\n return createLoopingListWithIndex(list, startIndex, length, forwards).map(([_, item]) => item)\n}\n\nexport const ArrayUtil = {\n unique: <T>(list: T[]): T[] => {\n const seen = new Set<T>()\n return list.filter((item) => {\n if (seen.has(item)) {\n return false\n }\n seen.add(item)\n return true\n })\n },\n\n difference: <T>(list: T[], removeList: T[]): T[] => {\n const remove = new Set<T>(removeList)\n return list.filter((item) => !remove.has(item))\n }\n}\n","export const clamp = (value: number, min: number = 0, max: number = 1): number => {\n return Math.min(Math.max(value, min), max)\n}\n","import { clamp } from './math'\n\nexport type EaseFunction = (t: number) => number\n\nexport class EaseFunctions {\n static cubicBezierGeneric(x1: number, y1: number, x2: number, y2: number): { x: EaseFunction, y: EaseFunction } {\n // Calculate the x and y coordinates using the cubic Bézier formula\n const cx = 3 * x1\n const bx = 3 * (x2 - x1) - cx\n const ax = 1 - cx - bx\n\n const cy = 3 * y1\n const by = 3 * (y2 - y1) - cy\n const ay = 1 - cy - by\n\n // Compute x and y values at parameter t\n const x = (t: number) => ((ax * t + bx) * t + cx) * t\n const y = (t: number) => ((ay * t + by) * t + cy) * t\n\n return {\n x,\n y\n }\n }\n\n static cubicBezier(x1: number, y1: number, x2: number, y2: number): EaseFunction {\n const { y } = EaseFunctions.cubicBezierGeneric(x1, y1, x2, y2)\n return (t: number) => {\n t = clamp(t)\n return y(t) // <= equal to x(t) * 0 + y(t) * 1\n }\n }\n\n static easeInEaseOut(t: number): number {\n return EaseFunctions.cubicBezier(0.65, 0, 0.35, 1)(t)\n };\n}\n","/**\n * 1 is forwards\n *\n * -1 is backwards\n */\nexport type Direction = 1 | -1\n\nexport class LoopingArrayCalculator {\n length: number\n isLooping: boolean\n allowedOverScroll: number\n\n constructor(length: number, isLooping: boolean = true, allowedOverScroll: number = 0.1) {\n if (allowedOverScroll < 0 || length < 1) {\n throw new Error('Invalid parameters: allowedOverScroll >= 0 and length >= 1 must be true')\n }\n\n this.length = length\n this.isLooping = isLooping\n this.allowedOverScroll = allowedOverScroll\n }\n\n getCorrectedPosition(position: number): number {\n if (!this.isLooping) {\n return Math.max(-this.allowedOverScroll, Math.min(this.allowedOverScroll + this.length - 1, position))\n }\n if (position >= this.length) {\n return position % this.length\n }\n if (position < 0) {\n return this.length - (Math.abs(position) % this.length)\n }\n return position\n }\n\n static withoutOffset(position: number): number {\n return position + LoopingArrayCalculator.getOffset(position)\n }\n\n static getOffset(position: number): number {\n return Math.round(position) - position // For example: 45.5 => 46 - 45.5 = 0.5\n }\n\n /**\n * @return absolute distance forwards or Infinity when the target cannot be reached (only possible when not isLooping)\n */\n getDistanceDirectional(position: number, target: number, direction: Direction): number {\n if (!this.isLooping && (position < -this.allowedOverScroll || position > this.allowedOverScroll + this.length - 1)) {\n throw new Error('Invalid parameters: position is out of bounds.')\n }\n\n const isForwardInvalid = (direction === 1 && position > target)\n const isBackwardInvalid = (direction === -1 && target < position)\n\n if (!this.isLooping && (isForwardInvalid || isBackwardInvalid)) {\n return Infinity\n }\n\n if (direction === -1) {\n return this.getDistanceDirectional(target, position, 1)\n }\n\n position = this.getCorrectedPosition(position)\n target = this.getCorrectedPosition(target)\n\n let distance = (target - position) * direction\n if (distance < 0) {\n distance = this.length - (Math.abs(position) % this.length) + target\n }\n\n return distance\n }\n\n getDistanceForward(position: number, target: number): number {\n return this.getDistanceDirectional(position, target, 1)\n }\n\n getDistanceBackward(position: number, target: number): number {\n return this.getDistanceDirectional(position, target, -1)\n }\n\n getDistance(position: number, target: number): number {\n const forwardDistance = this.getDistanceForward(position, target)\n const backwardDistance = this.getDistanceBackward(position, target)\n\n return Math.min(forwardDistance, backwardDistance)\n }\n\n getBestDirection(position: number, target: number): Direction {\n const forwardDistance = this.getDistanceForward(position, target)\n const backwardDistance = this.getDistanceBackward(position, target)\n return forwardDistance < backwardDistance ? 1 : -1\n }\n}\n","import type { ButtonHTMLAttributes, PropsWithChildren, ReactNode } from 'react'\nimport { forwardRef } from 'react'\nimport clsx from 'clsx'\n\n\nexport const ButtonColorUtil = {\n solid: ['primary', 'secondary', 'tertiary', 'positive', 'warning', 'negative', 'neutral'] as const,\n text: ['primary', 'negative', 'neutral'] as const,\n outline: ['primary'] as const,\n}\n\nexport const IconButtonUtil = {\n icon: [...ButtonColorUtil.solid, 'transparent'] as const,\n}\n\n\n/**\n * The allowed colors for the SolidButton and IconButton\n */\nexport type SolidButtonColor = typeof ButtonColorUtil.solid[number]\n/**\n * The allowed colors for the OutlineButton\n */\nexport type OutlineButtonColor = typeof ButtonColorUtil.outline[number]\n/**\n * The allowed colors for the TextButton\n */\nexport type TextButtonColor = typeof ButtonColorUtil.text[number]\n/**\n * The allowed colors for the IconButton\n */\nexport type IconButtonColor = typeof IconButtonUtil.icon[number]\n\n\n/**\n * The different sizes for a button\n */\ntype ButtonSizes = 'small' | 'medium' | 'large'\n\ntype IconButtonSize = 'tiny' | 'small' | 'medium' | 'large'\n\n/**\n * The shard properties between all button types\n */\nexport type ButtonProps = PropsWithChildren<{\n /**\n * @default 'medium'\n */\n size?: ButtonSizes,\n}> & ButtonHTMLAttributes<Element>\n\nconst paddingMapping: Record<ButtonSizes, string> = {\n small: 'btn-sm',\n medium: 'btn-md',\n large: 'btn-lg'\n}\n\nconst iconPaddingMapping: Record<IconButtonSize, string> = {\n tiny: 'icon-btn-xs',\n small: 'icon-btn-sm',\n medium: 'icon-btn-md',\n large: 'icon-btn-lg'\n}\n\nexport const ButtonUtil = {\n paddingMapping,\n iconPaddingMapping\n}\n\ntype ButtonWithIconsProps = ButtonProps & {\n startIcon?: ReactNode,\n endIcon?: ReactNode,\n}\n\nexport type SolidButtonProps = ButtonWithIconsProps & {\n color?: SolidButtonColor,\n}\n\nexport type OutlineButtonProps = ButtonWithIconsProps & {\n color?: OutlineButtonColor,\n}\n\nexport type TextButtonProps = ButtonWithIconsProps & {\n color?: TextButtonColor,\n coloredHoverBackground?: boolean,\n}\n\n/**\n * The shard properties between all button types\n */\nexport type IconButtonProps = PropsWithChildren<{\n /**\n * @default 'medium'\n */\n size?: IconButtonSize,\n color?: IconButtonColor,\n}> & ButtonHTMLAttributes<Element>\n\n/**\n * A button with a solid background and different sizes\n */\nconst SolidButton = forwardRef<HTMLButtonElement, SolidButtonProps>(function SolidButton({\n children,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }, ref) {\n const colorClasses = {\n primary: 'not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text',\n secondary: 'not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text',\n tertiary: 'not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text',\n positive: 'not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text',\n warning: 'not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text',\n negative: 'not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text',\n neutral: 'not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'not-group-disabled:text-button-solid-primary-icon',\n secondary: 'not-group-disabled:text-button-solid-secondary-icon',\n tertiary: 'not-group-disabled:text-button-solid-tertiary-icon',\n positive: 'not-group-disabled:text-button-solid-positive-icon',\n warning: 'not-group-disabled:text-button-solid-warning-icon',\n negative: 'not-group-disabled:text-button-solid-negative-icon',\n neutral: 'not-group-disabled:text-button-solid-neutral-icon',\n }[color]\n\n return (\n <button\n ref={ref}\n onClick={onClick}\n className={clsx(\n 'group font-semibold',\n colorClasses,\n 'not-disabled:hover:brightness-90',\n 'disabled:text-disabled-text disabled:bg-disabled-background',\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx(\n iconColorClasses,\n 'group-disabled:text-disabled-icon'\n )}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx(\n iconColorClasses,\n 'group-disabled:text-disabled-icon'\n )}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n})\n\n/**\n * A button with an outline border and different sizes\n */\nconst OutlineButton = ({\n children,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }: OutlineButtonProps) => {\n const colorClasses = {\n primary: 'not-disabled:border-button-outline-primary-text not-disabled:text-button-outline-primary-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'not-group-disabled:text-button-outline-primary-icon',\n }[color]\n return (\n <button\n onClick={onClick}\n className={clsx(\n 'group font-semibold bg-transparent border-2 ',\n 'not-disabled:hover:brightness-80',\n colorClasses,\n 'disabled:text-disabled-text disabled:border-disabled-outline',\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx(\n iconColorClasses,\n 'group-disabled:text-disabled-icon'\n )}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx(\n iconColorClasses,\n 'group-disabled:text-disabled-icon'\n )}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n/**\n * A text that is a button that can have different sizes\n */\nconst TextButton = ({\n children,\n color = 'neutral',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n coloredHoverBackground = true,\n className,\n ...restProps\n }: TextButtonProps) => {\n const colorClasses = {\n primary: 'not-disabled:bg-transparent not-disabled:text-button-text-primary-text',\n negative: 'not-disabled:bg-transparent not-disabled:text-button-text-negative-text',\n neutral: 'not-disabled:bg-transparent not-disabled:text-button-text-neutral-text',\n }[color]\n\n const backgroundColor = {\n primary: 'not-disabled:hover:bg-button-text-primary-text/20',\n negative: 'not-disabled:hover:bg-button-text-negative-text/20',\n neutral: 'not-disabled:hover:bg-button-text-neutral-text/20',\n }[color]\n\n const iconColorClasses = {\n primary: 'not-group-disabled:text-button-text-primary-icon',\n negative: 'not-group-disabled:text-button-text-negative-icon',\n neutral: 'not-group-disabled:text-button-text-neutral-icon',\n }[color]\n\n return (\n <button\n onClick={onClick}\n className={clsx(\n 'group font-semibold',\n 'disabled:text-disabled-text',\n colorClasses,\n {\n [backgroundColor]: coloredHoverBackground,\n 'not-disabled:hover:bg-button-text-hover-background': !coloredHoverBackground,\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx(\n iconColorClasses,\n 'group-disabled:text-disabled-icon'\n )}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx(\n iconColorClasses,\n 'group-disabled:text-disabled-icon'\n )}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n\n/**\n * A button for icons with a solid background and different sizes\n */\nconst IconButton = ({\n children,\n color = 'primary',\n size = 'medium',\n className,\n ...restProps\n }: IconButtonProps) => {\n const colorClasses = {\n primary: 'not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text',\n secondary: 'not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text',\n tertiary: 'not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text',\n positive: 'not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text',\n warning: 'not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text',\n negative: 'not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text',\n neutral: 'not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text',\n transparent: 'not-disabled:bg-transparent',\n }[color]\n\n return (\n <button\n className={clsx(\n colorClasses,\n 'not-disabled:hover:brightness-90',\n 'disabled:text-disabled-text',\n {\n 'disabled:bg-disabled-background': color !== 'transparent',\n 'disabled:opacity-70': color === 'transparent',\n 'not-disabled:hover:bg-button-text-hover-background': color === 'transparent',\n },\n ButtonUtil.iconPaddingMapping[size],\n className\n )}\n {...restProps}\n >\n {children}\n </button>\n )\n}\n\nexport { SolidButton, OutlineButton, TextButton, IconButton }\n"],"mappings":";AACA,SAAgB,aAAa,WAAW,SAAS,QAAQ,gBAAgB;AACzE,OAAOA,WAAU;AACjB,SAAS,aAAa,oBAAoB;;;ACkB1C,IAAM,sBAAoC;AAAA,EACxC,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,cAAc;AAChB;AAMO,IAAM,QAAQ,CAAC,YAAuC,YAA8C;AACzG,QAAM,EAAE,iBAAiB,UAAU,gBAAgB,aAAa,IAAI,EAAE,GAAG,qBAAqB,GAAG,QAAQ;AACzG,MAAI,QAAQ;AACZ,MAAI;AACJ,MAAI,OAAO,e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