gantri-components 2.230.0 → 2.232.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/button/button.types.d.ts +1 -1
- package/dist/components/carousel/carousel.d.ts +3 -0
- package/dist/components/carousel/carousel.presets.d.ts +2 -0
- package/dist/components/carousel/carousel.styles.d.ts +8 -0
- package/dist/components/carousel/carousel.types.d.ts +52 -0
- package/dist/components/carousel/hooks/use-carousel-metrics.d.ts +27 -0
- package/dist/components/carousel/hooks/use-carousel-state.d.ts +26 -0
- package/dist/components/carousel/hooks/use-swipe.d.ts +19 -0
- package/dist/components/carousel/index.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/styles/theme.d.ts +10 -4
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { Property } from 'csstype';
|
|
|
3
3
|
import { BaseProps } from '../box/box.types';
|
|
4
4
|
import { TextVariant } from '../typography';
|
|
5
5
|
import { ResolutionAwareProp } from '../../types/resolution-aware-prop.type';
|
|
6
|
-
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'tertiary' | 'primaryAlert' | 'primaryContrast' | 'secondaryContrast' | 'ghostContrast';
|
|
6
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'tertiary' | 'primaryAlert' | 'primaryWarning' | 'primaryContrast' | 'secondaryContrast' | 'ghostContrast';
|
|
7
7
|
export type ButtonWidth = 'sm' | 'md' | 'lg' | string;
|
|
8
8
|
/**
|
|
9
9
|
* large = desktop on figma design
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StyledCarouselArrowProps, StyledCarouselDotProps, StyledCarouselTrackProps, StyledCarouselWrapperProps } from './carousel.types';
|
|
3
|
+
export declare const StyledCarouselWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledCarouselWrapperProps>> & string;
|
|
4
|
+
export declare const StyledCarouselTrack: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledCarouselTrackProps>> & string;
|
|
5
|
+
export declare const StyledCarouselItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
|
+
export declare const StyledCarouselArrow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, StyledCarouselArrowProps>> & string;
|
|
7
|
+
export declare const StyledCarouselDotsContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
8
|
+
export declare const StyledCarouselDot: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, StyledCarouselDotProps>> & string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { ResolutionAwareProp } from '../../types/resolution-aware-prop.type';
|
|
3
|
+
import { BoxDimension } from '../box/box.types';
|
|
4
|
+
export interface CarouselProps {
|
|
5
|
+
activePage?: number;
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
defaultActivePage?: number;
|
|
10
|
+
gap?: ResolutionAwareProp<BoxDimension>;
|
|
11
|
+
infinite?: boolean;
|
|
12
|
+
itemsPerPage?: ResolutionAwareProp<number>;
|
|
13
|
+
leftPadding?: ResolutionAwareProp<BoxDimension>;
|
|
14
|
+
onPageChange?: (page: number) => void;
|
|
15
|
+
pageStep?: number;
|
|
16
|
+
rightPadding?: ResolutionAwareProp<BoxDimension>;
|
|
17
|
+
showArrows?: boolean;
|
|
18
|
+
showDots?: boolean;
|
|
19
|
+
sidePadding?: ResolutionAwareProp<BoxDimension>;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
swipeThreshold?: number;
|
|
22
|
+
swipeable?: boolean;
|
|
23
|
+
transitionDuration?: number;
|
|
24
|
+
transitionEasing?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface CarouselRef {
|
|
27
|
+
getActivePage: () => number;
|
|
28
|
+
getTotalPages: () => number;
|
|
29
|
+
goTo: (page: number, opts?: {
|
|
30
|
+
animated?: boolean;
|
|
31
|
+
}) => void;
|
|
32
|
+
next: () => void;
|
|
33
|
+
prev: () => void;
|
|
34
|
+
}
|
|
35
|
+
export interface StyledCarouselWrapperProps {
|
|
36
|
+
$showDots?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface StyledCarouselTrackProps {
|
|
39
|
+
$isAnimated: boolean;
|
|
40
|
+
$transitionDuration: number;
|
|
41
|
+
$transitionEasing: string;
|
|
42
|
+
}
|
|
43
|
+
export interface StyledCarouselItemProps {
|
|
44
|
+
$widthPx: number;
|
|
45
|
+
}
|
|
46
|
+
export interface StyledCarouselArrowProps {
|
|
47
|
+
$disabled?: boolean;
|
|
48
|
+
$position: 'left' | 'right';
|
|
49
|
+
}
|
|
50
|
+
export interface StyledCarouselDotProps {
|
|
51
|
+
$active: boolean;
|
|
52
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AppSize, ResolutionAwareProp } from '../../../types/resolution-aware-prop.type';
|
|
2
|
+
import { BoxDimension } from '../../box/box.types';
|
|
3
|
+
interface UseCarouselMetricsParams {
|
|
4
|
+
gap?: ResolutionAwareProp<BoxDimension>;
|
|
5
|
+
infinite: boolean;
|
|
6
|
+
itemCount: number;
|
|
7
|
+
itemsPerPage?: ResolutionAwareProp<number>;
|
|
8
|
+
leftPadding?: ResolutionAwareProp<BoxDimension>;
|
|
9
|
+
pageStep?: number;
|
|
10
|
+
rightPadding?: ResolutionAwareProp<BoxDimension>;
|
|
11
|
+
sidePadding?: ResolutionAwareProp<BoxDimension>;
|
|
12
|
+
}
|
|
13
|
+
export interface CarouselMetrics {
|
|
14
|
+
/** Resolved items-per-page for the current breakpoint (accepts decimals). */
|
|
15
|
+
currentItemsPerPage: number;
|
|
16
|
+
gapPx: number;
|
|
17
|
+
leftPaddingPx: number;
|
|
18
|
+
/** Effective step, defaulting to floor(itemsPerPage) when not provided. */
|
|
19
|
+
pageStep: number;
|
|
20
|
+
rightPaddingPx: number;
|
|
21
|
+
/** Current breakpoint bucket. */
|
|
22
|
+
size: AppSize;
|
|
23
|
+
/** Logical page count for the current breakpoint. */
|
|
24
|
+
totalPages: number;
|
|
25
|
+
}
|
|
26
|
+
export declare const useCarouselMetrics: ({ gap, infinite, itemCount, itemsPerPage, leftPadding, pageStep, rightPadding, sidePadding, }: UseCarouselMetricsParams) => CarouselMetrics;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface UseCarouselStateParams {
|
|
2
|
+
activePage?: number;
|
|
3
|
+
defaultActivePage: number;
|
|
4
|
+
infinite: boolean;
|
|
5
|
+
onPageChange?: (page: number) => void;
|
|
6
|
+
totalPages: number;
|
|
7
|
+
}
|
|
8
|
+
interface UseCarouselStateResult {
|
|
9
|
+
/**
|
|
10
|
+
* Visual page index. Can transiently hold values outside [0, totalPages-1] in
|
|
11
|
+
* infinite mode while the carousel animates past the last/first page into a
|
|
12
|
+
* clone, before the silent snap-back.
|
|
13
|
+
*/
|
|
14
|
+
displayPage: number;
|
|
15
|
+
goTo: (target: number) => void;
|
|
16
|
+
goToWithoutAnimation: (target: number) => void;
|
|
17
|
+
/**
|
|
18
|
+
* The canonical page — always in [0, totalPages-1]. This is the value
|
|
19
|
+
* reported via `onPageChange`.
|
|
20
|
+
*/
|
|
21
|
+
logicalPage: number;
|
|
22
|
+
setDisplayPage: (page: number) => void;
|
|
23
|
+
suppressTransition: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare const useCarouselState: ({ activePage, defaultActivePage, infinite, onPageChange, totalPages, }: UseCarouselStateParams) => UseCarouselStateResult;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PointerEvent } from 'react';
|
|
2
|
+
interface UseSwipeParams {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
onSwipeLeft: () => void;
|
|
5
|
+
onSwipeRight: () => void;
|
|
6
|
+
threshold: number;
|
|
7
|
+
}
|
|
8
|
+
interface UseSwipeResult {
|
|
9
|
+
deltaX: number;
|
|
10
|
+
handlers: {
|
|
11
|
+
onPointerCancel: (e: PointerEvent<HTMLElement>) => void;
|
|
12
|
+
onPointerDown: (e: PointerEvent<HTMLElement>) => void;
|
|
13
|
+
onPointerMove: (e: PointerEvent<HTMLElement>) => void;
|
|
14
|
+
onPointerUp: (e: PointerEvent<HTMLElement>) => void;
|
|
15
|
+
};
|
|
16
|
+
isDragging: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const useSwipe: ({ enabled, onSwipeLeft, onSwipeRight, threshold, }: UseSwipeParams) => UseSwipeResult;
|
|
19
|
+
export {};
|