@max-ts/kit 1.3.2 → 1.4.1
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/lib/components/Carousel/Buttons/Buttons.d.ts +1 -1
- package/lib/components/Carousel/Buttons/Buttons.d.ts.map +1 -1
- package/lib/components/Carousel/Buttons/styles.css.d.ts +3 -3
- package/lib/components/Carousel/Buttons/styles.css.d.ts.map +1 -1
- package/lib/components/Carousel/Carousel.d.ts +14 -16
- package/lib/components/Carousel/Carousel.d.ts.map +1 -1
- package/lib/components/Carousel/CarouselContext.d.ts +3 -5
- package/lib/components/Carousel/CarouselContext.d.ts.map +1 -1
- package/lib/components/Carousel/Content/Content.d.ts +2 -1
- package/lib/components/Carousel/Content/Content.d.ts.map +1 -1
- package/lib/components/Carousel/Content/styles.css.d.ts +1 -1
- package/lib/components/Carousel/Content/styles.css.d.ts.map +1 -1
- package/lib/components/Carousel/Dots/Dots.d.ts +2 -5
- package/lib/components/Carousel/Dots/Dots.d.ts.map +1 -1
- package/lib/components/Carousel/Dots/useLogic/useLogic.d.ts.map +1 -1
- package/lib/components/Carousel/Item/Item.d.ts +2 -1
- package/lib/components/Carousel/Item/Item.d.ts.map +1 -1
- package/lib/components/Carousel/Item/styles.css.d.ts +1 -0
- package/lib/components/Carousel/Item/styles.css.d.ts.map +1 -1
- package/lib/components/Carousel/types.d.ts +16 -6
- package/lib/components/Carousel/types.d.ts.map +1 -1
- package/lib/components/Carousel/useLogic/useLogic.d.ts +13 -13
- package/lib/components/Carousel/useLogic/useLogic.d.ts.map +1 -1
- package/lib/index.mjs +273 -106
- package/lib/stories/Carousel.stories.d.ts +1 -0
- package/lib/stories/Carousel.stories.d.ts.map +1 -1
- package/lib/styles.css +77 -24
- package/package.json +1 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function Arrows({ className, ...props }: ComponentProps<'button'>): import("react").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=Buttons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Buttons.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Buttons/Buttons.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Buttons.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Buttons/Buttons.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C,wBAAgB,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,+BAwCvE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
1
|
+
export declare const iconWrapper: string;
|
|
2
|
+
export declare const buttonNext: Record<"horizontal" | "vertical", string>;
|
|
3
|
+
export declare const buttonPrev: Record<"horizontal" | "vertical", string>;
|
|
4
4
|
//# sourceMappingURL=styles.css.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Buttons/styles.css.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Buttons/styles.css.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,WAAW,QActB,CAAC;AAOH,eAAO,MAAM,UAAU,2CAmBrB,CAAC;AAEH,eAAO,MAAM,UAAU,2CAmBrB,CAAC"}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export type CarouselProps<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
setApi?: (api: CarouselApi) => void;
|
|
8
|
-
className?: string;
|
|
9
|
-
width?: CSSProperties['width'];
|
|
10
|
-
height?: CSSProperties['height'];
|
|
11
|
-
data: TData[];
|
|
12
|
-
keyId: keyof TData;
|
|
13
|
-
showDots?: boolean;
|
|
14
|
-
showArrows?: boolean;
|
|
15
|
-
renderItem: (item: TData) => React.ReactNode;
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import type { CarouselAlign, CarouselApi, CarouselOrientation } from './types';
|
|
3
|
+
export type CarouselProps = ComponentProps<'section'> & {
|
|
4
|
+
align?: CarouselAlign;
|
|
5
|
+
orientation?: CarouselOrientation;
|
|
6
|
+
setApi?: (api: CarouselApi | undefined) => void;
|
|
16
7
|
};
|
|
17
|
-
|
|
8
|
+
declare function Carousel({ align, children, className, orientation: orientationProp, setApi, ...props }: CarouselProps): import("react").JSX.Element;
|
|
9
|
+
declare namespace Carousel {
|
|
10
|
+
var Content: typeof import("./Content").Content;
|
|
11
|
+
var Item: typeof import("./Item").Item;
|
|
12
|
+
var Arrows: typeof import("./Buttons").Arrows;
|
|
13
|
+
var Dots: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
14
|
+
}
|
|
15
|
+
export { Carousel };
|
|
18
16
|
//# sourceMappingURL=Carousel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../../src/components/Carousel/Carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../../src/components/Carousel/Carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAO5C,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAG/E,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,SAAS,CAAC,GAAG;IACvD,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,iBAAS,QAAQ,CAAC,EACjB,KAAK,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EAAE,eAAe,EAC5B,MAAM,EACN,GAAG,KAAK,EACR,EAAE,aAAa,+BAkCf;kBAzCQ,QAAQ;;;;;;AAgDjB,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type { EmblaViewportRefType } from 'embla-carousel-react';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import type { CarouselApi,
|
|
2
|
+
import type { CarouselApi, CarouselOrientation } from './types';
|
|
4
3
|
type CarouselContextProps = {
|
|
5
|
-
carouselRef:
|
|
4
|
+
carouselRef: (node: HTMLDivElement | null) => void;
|
|
6
5
|
api: CarouselApi;
|
|
7
|
-
|
|
8
|
-
orientation: 'horizontal' | 'vertical';
|
|
6
|
+
orientation: CarouselOrientation;
|
|
9
7
|
scrollPrev: () => void;
|
|
10
8
|
scrollNext: () => void;
|
|
11
9
|
canScrollPrev: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselContext.d.ts","sourceRoot":"","sources":["../../../src/components/Carousel/CarouselContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"CarouselContext.d.ts","sourceRoot":"","sources":["../../../src/components/Carousel/CarouselContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEhE,KAAK,oBAAoB,GAAG;IAC3B,WAAW,EAAE,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IACnD,GAAG,EAAE,WAAW,CAAC;IACjB,WAAW,EAAE,mBAAmB,CAAC;IACjC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,eAAe,4CAE3B,CAAC;AAEF,wBAAgB,WAAW,yBAQ1B"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
export declare function Content({ className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
2
3
|
//# sourceMappingURL=Content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Content/Content.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Content/Content.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C,wBAAgB,OAAO,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAgBrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Content/styles.css.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Content/styles.css.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,QAalB,CAAC;AAEH,eAAO,MAAM,YAAY,2CAmBvB,CAAC"}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const Dots: ({
|
|
3
|
-
api: CarouselApi;
|
|
4
|
-
orientation: "horizontal" | "vertical";
|
|
5
|
-
}) => import("react").JSX.Element;
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
export declare const Dots: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
6
3
|
//# sourceMappingURL=Dots.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dots.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Dots/Dots.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Dots.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Dots/Dots.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAK5C,eAAO,MAAM,IAAI,GAAI,yBAAyB,cAAc,CAAC,KAAK,CAAC,gCAkBlE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLogic.d.ts","sourceRoot":"","sources":["../../../../../src/components/Carousel/Dots/useLogic/useLogic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,QAAQ,GAAI,KAAK,WAAW;;;8BAK/B,MAAM;
|
|
1
|
+
{"version":3,"file":"useLogic.d.ts","sourceRoot":"","sources":["../../../../../src/components/Carousel/Dots/useLogic/useLogic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,QAAQ,GAAI,KAAK,WAAW;;;8BAK/B,MAAM;CA6Bf,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
export declare function Item({ className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
2
3
|
//# sourceMappingURL=Item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Item/Item.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Item/Item.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C,wBAAgB,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAclE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Item/styles.css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,QAKf,CAAC"}
|
|
1
|
+
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Item/styles.css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,QAKf,CAAC;AAEH,eAAO,MAAM,YAAY,2CASvB,CAAC"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
6
|
-
|
|
1
|
+
export type CarouselAlign = 'start' | 'center' | 'end';
|
|
2
|
+
export type CarouselOrientation = 'horizontal' | 'vertical';
|
|
3
|
+
export type CarouselEventName = 'reInit' | 'select';
|
|
4
|
+
export type CarouselEventCallback = (api: CarouselApi) => void;
|
|
5
|
+
export type CarouselApi = {
|
|
6
|
+
scrollPrev: () => void;
|
|
7
|
+
scrollNext: () => void;
|
|
8
|
+
scrollTo: (index: number, jump?: boolean) => void;
|
|
9
|
+
canScrollNext: () => boolean;
|
|
10
|
+
canScrollPrev: () => boolean;
|
|
11
|
+
selectedScrollSnap: () => number;
|
|
12
|
+
scrollSnapList: () => number[];
|
|
13
|
+
on: (event: CarouselEventName, callback: CarouselEventCallback) => CarouselApi;
|
|
14
|
+
off: (event: CarouselEventName, callback: CarouselEventCallback) => CarouselApi;
|
|
15
|
+
reInit: () => void;
|
|
16
|
+
};
|
|
7
17
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Carousel/types.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Carousel/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AACvD,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE5D,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACpD,MAAM,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAC;AAE/D,MAAM,MAAM,WAAW,GAAG;IACzB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,aAAa,EAAE,MAAM,OAAO,CAAC;IAC7B,aAAa,EAAE,MAAM,OAAO,CAAC;IAC7B,kBAAkB,EAAE,MAAM,MAAM,CAAC;IACjC,cAAc,EAAE,MAAM,MAAM,EAAE,CAAC;IAC/B,EAAE,EAAE,CACH,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,qBAAqB,KAC3B,WAAW,CAAC;IACjB,GAAG,EAAE,CACJ,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,qBAAqB,KAC3B,WAAW,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { CarouselApi,
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { type KeyboardEvent } from 'react';
|
|
2
|
+
import type { CarouselAlign, CarouselApi, CarouselOrientation } from '../types';
|
|
3
|
+
type UseLogicProps = {
|
|
4
|
+
align?: CarouselAlign;
|
|
5
|
+
orientation?: CarouselOrientation;
|
|
6
|
+
setApi?: (api: CarouselApi | undefined) => void;
|
|
7
|
+
};
|
|
8
|
+
type UseLogicReturn = {
|
|
9
|
+
carouselRef: (node: HTMLDivElement | null) => void;
|
|
10
|
+
api: CarouselApi;
|
|
6
11
|
scrollPrev: () => void;
|
|
7
12
|
scrollNext: () => void;
|
|
8
13
|
canScrollPrev: boolean;
|
|
9
14
|
canScrollNext: boolean;
|
|
10
|
-
handleKeyDown: (event:
|
|
11
|
-
|
|
12
|
-
orientation: 'horizontal' | 'vertical';
|
|
13
|
-
onDotButtonClick: (index: number) => void;
|
|
14
|
-
isShowButtons: boolean;
|
|
15
|
-
isShowDots: boolean;
|
|
16
|
-
data: TData[];
|
|
15
|
+
handleKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;
|
|
16
|
+
orientation: CarouselOrientation;
|
|
17
17
|
};
|
|
18
|
-
export declare const useLogic:
|
|
18
|
+
export declare const useLogic: ({ orientation, align, setApi, }: UseLogicProps) => UseLogicReturn;
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=useLogic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLogic.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/useLogic/useLogic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLogic.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/useLogic/useLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,aAAa,EAMlB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACX,aAAa,EACb,WAAW,EAGX,mBAAmB,EACnB,MAAM,UAAU,CAAC;AAElB,KAAK,aAAa,GAAG;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,KAAK,cAAc,GAAG;IACrB,WAAW,EAAE,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IACnD,GAAG,EAAE,WAAW,CAAC;IACjB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC9D,WAAW,EAAE,mBAAmB,CAAC;CACjC,CAAC;AAIF,eAAO,MAAM,QAAQ,GAAI,iCAItB,aAAa,KAAG,cAuQlB,CAAC"}
|
package/lib/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Accordion, Checkbox } from "@base-ui/react";
|
|
3
3
|
import clsx_0, { clsx } from "clsx";
|
|
4
|
-
import { ArrowDownNarrowWide, ArrowDownUp, ArrowDownWideNarrow, Calendar1, Check, CheckIcon, ChevronDown, ChevronDownIcon, ChevronLeft, ChevronRight, ChevronRightIcon, ChevronUp, CircleCheck, CircleIcon, Copy, Ellipsis as external_lucide_react_Ellipsis, EllipsisVertical, Info, MoreHorizontalIcon, OctagonAlert, PanelLeftIcon, TriangleAlert, XIcon } from "lucide-react";
|
|
4
|
+
import { ArrowDownNarrowWide, ArrowDownUp, ArrowDownWideNarrow, ArrowLeft, ArrowRight, Calendar1, Check, CheckIcon, ChevronDown, ChevronDownIcon, ChevronLeft, ChevronRight, ChevronRightIcon, ChevronUp, CircleCheck, CircleIcon, Copy, Ellipsis as external_lucide_react_Ellipsis, EllipsisVertical, Info, MoreHorizontalIcon, OctagonAlert, PanelLeftIcon, TriangleAlert, XIcon } from "lucide-react";
|
|
5
5
|
import { AlertDialog } from "@base-ui/react/alert-dialog";
|
|
6
6
|
import { Button } from "@base-ui/react/button";
|
|
7
7
|
import react, { createContext, createElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
@@ -12,7 +12,6 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
12
12
|
import { Separator as separator_Separator } from "@base-ui/react/separator";
|
|
13
13
|
import { DayPicker } from "react-day-picker";
|
|
14
14
|
import { ru } from "react-day-picker/locale";
|
|
15
|
-
import embla_carousel_react from "embla-carousel-react";
|
|
16
15
|
import { Collapsible } from "@base-ui/react/collapsible";
|
|
17
16
|
import { Popover } from "@base-ui/react/popover";
|
|
18
17
|
import { Tooltip } from "@base-ui/react/tooltip";
|
|
@@ -1209,52 +1208,62 @@ function useCarousel() {
|
|
|
1209
1208
|
if (!context) throw new Error('useCarousel must be used within a <Carousel />');
|
|
1210
1209
|
return context;
|
|
1211
1210
|
}
|
|
1212
|
-
var
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1211
|
+
var buttonNext = {
|
|
1212
|
+
horizontal: 'horizontal__2d6ocq2 style__2d6ocq0',
|
|
1213
|
+
vertical: 'vertical__2d6ocq3 style__2d6ocq0'
|
|
1214
|
+
};
|
|
1215
|
+
var buttonPrev = {
|
|
1216
|
+
horizontal: 'horizontal__2d6ocq4 style__2d6ocq0',
|
|
1217
|
+
vertical: 'vertical__2d6ocq5 style__2d6ocq0'
|
|
1216
1218
|
};
|
|
1217
|
-
var
|
|
1218
|
-
function
|
|
1219
|
+
var iconWrapper = 'style__2d6ocq1';
|
|
1220
|
+
function Arrows({ className, ...props }) {
|
|
1219
1221
|
const { orientation = 'horizontal', canScrollNext, scrollNext, canScrollPrev, scrollPrev } = useCarousel();
|
|
1220
1222
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
1221
1223
|
children: [
|
|
1222
1224
|
/*#__PURE__*/ jsx("button", {
|
|
1223
|
-
className: clsx(
|
|
1225
|
+
className: clsx(buttonPrev[orientation], className),
|
|
1224
1226
|
type: "button",
|
|
1225
|
-
"data-slot": "carousel-
|
|
1226
|
-
|
|
1227
|
-
|
|
1227
|
+
"data-slot": "carousel-previous",
|
|
1228
|
+
"aria-label": "Previous slide",
|
|
1229
|
+
disabled: !canScrollPrev,
|
|
1230
|
+
onClick: scrollPrev,
|
|
1228
1231
|
...props,
|
|
1229
|
-
children:
|
|
1232
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
1233
|
+
className: iconWrapper,
|
|
1234
|
+
children: /*#__PURE__*/ jsx(ArrowLeft, {})
|
|
1235
|
+
})
|
|
1230
1236
|
}),
|
|
1231
1237
|
/*#__PURE__*/ jsx("button", {
|
|
1232
1238
|
type: "button",
|
|
1233
|
-
className: clsx(
|
|
1234
|
-
"data-slot": "carousel-
|
|
1235
|
-
|
|
1236
|
-
|
|
1239
|
+
className: clsx(buttonNext[orientation], className),
|
|
1240
|
+
"data-slot": "carousel-next",
|
|
1241
|
+
"aria-label": "Next slide",
|
|
1242
|
+
"aria-disabled": !canScrollNext,
|
|
1243
|
+
disabled: !canScrollNext,
|
|
1244
|
+
onClick: scrollNext,
|
|
1237
1245
|
...props,
|
|
1238
|
-
children:
|
|
1246
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
1247
|
+
className: iconWrapper,
|
|
1248
|
+
children: /*#__PURE__*/ jsx(ArrowRight, {})
|
|
1249
|
+
})
|
|
1239
1250
|
})
|
|
1240
1251
|
]
|
|
1241
1252
|
});
|
|
1242
1253
|
}
|
|
1243
|
-
var
|
|
1254
|
+
var Content_styles_css_content = 'style__i1lems0';
|
|
1255
|
+
var orientations = {
|
|
1244
1256
|
horizontal: 'horizontal__i1lems1',
|
|
1245
1257
|
vertical: 'vertical__i1lems2'
|
|
1246
1258
|
};
|
|
1247
|
-
|
|
1248
|
-
function Content_Content(props) {
|
|
1259
|
+
function Content_Content({ className, ...props }) {
|
|
1249
1260
|
const { carouselRef, orientation = 'horizontal' } = useCarousel();
|
|
1250
1261
|
return /*#__PURE__*/ jsx("div", {
|
|
1251
|
-
className:
|
|
1262
|
+
className: clsx(Content_styles_css_content, orientations[orientation], className),
|
|
1252
1263
|
ref: carouselRef,
|
|
1253
1264
|
"data-slot": "carousel-content",
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
...props
|
|
1257
|
-
})
|
|
1265
|
+
"data-orientation": orientation,
|
|
1266
|
+
...props
|
|
1258
1267
|
});
|
|
1259
1268
|
}
|
|
1260
1269
|
var dotButton = {
|
|
@@ -1262,7 +1271,7 @@ var dotButton = {
|
|
|
1262
1271
|
vertical: 'vertical__e2zpp65 style__e2zpp63'
|
|
1263
1272
|
};
|
|
1264
1273
|
var styles_css_selected = 'style__e2zpp66';
|
|
1265
|
-
var
|
|
1274
|
+
var wrapper = {
|
|
1266
1275
|
horizontal: 'horizontal__e2zpp61 style__e2zpp60',
|
|
1267
1276
|
vertical: 'vertical__e2zpp62 style__e2zpp60'
|
|
1268
1277
|
};
|
|
@@ -1270,24 +1279,23 @@ const useLogic = (api)=>{
|
|
|
1270
1279
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
1271
1280
|
const [scrollSnaps, setScrollSnaps] = useState([]);
|
|
1272
1281
|
const onDotButtonClick = useCallback((index)=>{
|
|
1273
|
-
if (!api) return;
|
|
1274
1282
|
api.scrollTo(index);
|
|
1275
1283
|
}, [
|
|
1276
1284
|
api
|
|
1277
1285
|
]);
|
|
1278
1286
|
const onInit = useCallback((api)=>{
|
|
1279
|
-
if (!api) return;
|
|
1280
1287
|
setScrollSnaps(api.scrollSnapList());
|
|
1281
1288
|
}, []);
|
|
1282
1289
|
const onSelect = useCallback((api)=>{
|
|
1283
|
-
if (!api) return;
|
|
1284
1290
|
setSelectedIndex(api.selectedScrollSnap());
|
|
1285
1291
|
}, []);
|
|
1286
1292
|
useEffect(()=>{
|
|
1287
|
-
if (!api) return;
|
|
1288
1293
|
onInit(api);
|
|
1289
1294
|
onSelect(api);
|
|
1290
1295
|
api.on('reInit', onInit).on('reInit', onSelect).on('select', onSelect);
|
|
1296
|
+
return ()=>{
|
|
1297
|
+
api.off('reInit', onInit).off('reInit', onSelect).off('select', onSelect);
|
|
1298
|
+
};
|
|
1291
1299
|
}, [
|
|
1292
1300
|
api,
|
|
1293
1301
|
onInit,
|
|
@@ -1299,12 +1307,15 @@ const useLogic = (api)=>{
|
|
|
1299
1307
|
onDotButtonClick
|
|
1300
1308
|
};
|
|
1301
1309
|
};
|
|
1302
|
-
const Dots = ({
|
|
1310
|
+
const Dots = ({ className, ...props })=>{
|
|
1311
|
+
const { api, orientation } = useCarousel();
|
|
1303
1312
|
const { selectedIndex, scrollSnaps, onDotButtonClick } = useLogic(api);
|
|
1304
1313
|
return /*#__PURE__*/ jsx("div", {
|
|
1305
|
-
className:
|
|
1314
|
+
className: clsx(wrapper[orientation], className),
|
|
1315
|
+
...props,
|
|
1306
1316
|
children: scrollSnaps.map((number, index)=>/*#__PURE__*/ jsx("button", {
|
|
1307
1317
|
type: "button",
|
|
1318
|
+
"aria-label": "Carousel Dots",
|
|
1308
1319
|
className: clsx(dotButton[orientation], {
|
|
1309
1320
|
[styles_css_selected]: index === selectedIndex
|
|
1310
1321
|
}),
|
|
@@ -1313,51 +1324,221 @@ const Dots = ({ api, orientation })=>{
|
|
|
1313
1324
|
});
|
|
1314
1325
|
};
|
|
1315
1326
|
var Item_styles_css_item = 'style__1gif6yr0';
|
|
1316
|
-
|
|
1327
|
+
var styles_css_orientations = {
|
|
1328
|
+
horizontal: 'horizontal__1gif6yr1',
|
|
1329
|
+
vertical: 'vertical__1gif6yr2'
|
|
1330
|
+
};
|
|
1331
|
+
function Item_Item({ className, ...props }) {
|
|
1332
|
+
const { orientation = 'horizontal' } = useCarousel();
|
|
1317
1333
|
return /*#__PURE__*/ jsx("div", {
|
|
1318
|
-
className: Item_styles_css_item,
|
|
1319
|
-
role: "
|
|
1334
|
+
className: clsx(Item_styles_css_item, styles_css_orientations[orientation], className),
|
|
1335
|
+
role: "group",
|
|
1320
1336
|
"aria-roledescription": "slide",
|
|
1337
|
+
"data-orientation": orientation,
|
|
1321
1338
|
"data-slot": "carousel-item",
|
|
1322
1339
|
...props
|
|
1323
1340
|
});
|
|
1324
1341
|
}
|
|
1325
1342
|
var styles_css_rootClass = 'Carousel__1jbydv50';
|
|
1326
|
-
const useLogic_useLogic = ({ orientation = 'horizontal',
|
|
1327
|
-
const
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1343
|
+
const useLogic_useLogic = ({ orientation = 'horizontal', align = 'center', setApi })=>{
|
|
1344
|
+
const resolvedOrientation = orientation;
|
|
1345
|
+
const resolvedAlign = align;
|
|
1346
|
+
const viewportRef = useRef(null);
|
|
1347
|
+
const resizeObserverRef = useRef(null);
|
|
1348
|
+
const mutationObserverRef = useRef(null);
|
|
1349
|
+
const observedSlidesRef = useRef([]);
|
|
1350
|
+
const orientationRef = useRef(resolvedOrientation);
|
|
1351
|
+
const alignRef = useRef(resolvedAlign);
|
|
1352
|
+
const selectedIndexRef = useRef(0);
|
|
1353
|
+
const canScrollPrevRef = useRef(false);
|
|
1354
|
+
const canScrollNextRef = useRef(false);
|
|
1355
|
+
const scrollSnapsRef = useRef([]);
|
|
1356
|
+
const listenersRef = useRef({
|
|
1357
|
+
reInit: new Set(),
|
|
1358
|
+
select: new Set()
|
|
1359
|
+
});
|
|
1331
1360
|
const [canScrollPrev, setCanScrollPrev] = useState(false);
|
|
1332
1361
|
const [canScrollNext, setCanScrollNext] = useState(false);
|
|
1333
|
-
const
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
if (!api) return;
|
|
1337
|
-
setCanScrollPrev(api.canScrollPrev());
|
|
1338
|
-
setCanScrollNext(api.canScrollNext());
|
|
1362
|
+
const getSlides = useCallback(()=>{
|
|
1363
|
+
if (!viewportRef.current) return [];
|
|
1364
|
+
return Array.from(viewportRef.current.querySelectorAll('[data-slot="carousel-item"]'));
|
|
1339
1365
|
}, []);
|
|
1340
|
-
const
|
|
1341
|
-
|
|
1342
|
-
|
|
1366
|
+
const getTargetFor = useCallback((index)=>{
|
|
1367
|
+
const viewport = viewportRef.current;
|
|
1368
|
+
if (!viewport) return 0;
|
|
1369
|
+
const slide = getSlides()[index];
|
|
1370
|
+
if (!slide) return 0;
|
|
1371
|
+
const isHorizontal = 'horizontal' === orientationRef.current;
|
|
1372
|
+
const viewportSize = isHorizontal ? viewport.clientWidth : viewport.clientHeight;
|
|
1373
|
+
const slideSize = isHorizontal ? slide.offsetWidth : slide.offsetHeight;
|
|
1374
|
+
const slideStart = isHorizontal ? slide.offsetLeft : slide.offsetTop;
|
|
1375
|
+
let target = slideStart;
|
|
1376
|
+
if ('center' === alignRef.current) target = slideStart - (viewportSize - slideSize) / 2;
|
|
1377
|
+
else if ('end' === alignRef.current) target = slideStart - (viewportSize - slideSize);
|
|
1378
|
+
const max = isHorizontal ? viewport.scrollWidth - viewport.clientWidth : viewport.scrollHeight - viewport.clientHeight;
|
|
1379
|
+
return Math.max(0, Math.min(target, Math.max(0, max)));
|
|
1343
1380
|
}, [
|
|
1344
|
-
|
|
1381
|
+
getSlides
|
|
1382
|
+
]);
|
|
1383
|
+
const emit = useCallback((event, api)=>{
|
|
1384
|
+
for (const callback of listenersRef.current[event])callback(api);
|
|
1385
|
+
}, []);
|
|
1386
|
+
const rebindSlideObservers = useCallback(()=>{
|
|
1387
|
+
const resizeObserver = resizeObserverRef.current;
|
|
1388
|
+
if (!resizeObserver) return;
|
|
1389
|
+
for (const slide of observedSlidesRef.current)resizeObserver.unobserve(slide);
|
|
1390
|
+
observedSlidesRef.current = getSlides();
|
|
1391
|
+
for (const slide of observedSlidesRef.current)resizeObserver.observe(slide);
|
|
1392
|
+
}, [
|
|
1393
|
+
getSlides
|
|
1394
|
+
]);
|
|
1395
|
+
const api = useMemo(()=>{
|
|
1396
|
+
const carouselApi = {
|
|
1397
|
+
scrollPrev: ()=>{
|
|
1398
|
+
carouselApi.scrollTo(Math.max(0, selectedIndexRef.current - 1));
|
|
1399
|
+
},
|
|
1400
|
+
scrollNext: ()=>{
|
|
1401
|
+
const lastIndex = getSlides().length - 1;
|
|
1402
|
+
if (lastIndex < 0) return;
|
|
1403
|
+
carouselApi.scrollTo(Math.min(lastIndex, selectedIndexRef.current + 1));
|
|
1404
|
+
},
|
|
1405
|
+
scrollTo: (index, jump = false)=>{
|
|
1406
|
+
const viewport = viewportRef.current;
|
|
1407
|
+
if (!viewport) return;
|
|
1408
|
+
const target = getTargetFor(index);
|
|
1409
|
+
viewport.scrollTo('horizontal' === orientationRef.current ? {
|
|
1410
|
+
left: target,
|
|
1411
|
+
behavior: jump ? 'auto' : 'smooth'
|
|
1412
|
+
} : {
|
|
1413
|
+
top: target,
|
|
1414
|
+
behavior: jump ? 'auto' : 'smooth'
|
|
1415
|
+
});
|
|
1416
|
+
},
|
|
1417
|
+
canScrollNext: ()=>canScrollNextRef.current,
|
|
1418
|
+
canScrollPrev: ()=>canScrollPrevRef.current,
|
|
1419
|
+
selectedScrollSnap: ()=>selectedIndexRef.current,
|
|
1420
|
+
scrollSnapList: ()=>scrollSnapsRef.current,
|
|
1421
|
+
on: (event, callback)=>{
|
|
1422
|
+
listenersRef.current[event].add(callback);
|
|
1423
|
+
return carouselApi;
|
|
1424
|
+
},
|
|
1425
|
+
off: (event, callback)=>{
|
|
1426
|
+
listenersRef.current[event].delete(callback);
|
|
1427
|
+
return carouselApi;
|
|
1428
|
+
},
|
|
1429
|
+
reInit: ()=>{
|
|
1430
|
+
rebindSlideObservers();
|
|
1431
|
+
const slides = getSlides();
|
|
1432
|
+
scrollSnapsRef.current = slides.map((_, index)=>getTargetFor(index));
|
|
1433
|
+
emit('reInit', carouselApi);
|
|
1434
|
+
emit('select', carouselApi);
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
return carouselApi;
|
|
1438
|
+
}, [
|
|
1439
|
+
emit,
|
|
1440
|
+
getSlides,
|
|
1441
|
+
getTargetFor,
|
|
1442
|
+
rebindSlideObservers
|
|
1443
|
+
]);
|
|
1444
|
+
const refresh = useCallback(()=>{
|
|
1445
|
+
const viewport = viewportRef.current;
|
|
1446
|
+
const slides = getSlides();
|
|
1447
|
+
const scrollSnaps = slides.map((_, index)=>getTargetFor(index));
|
|
1448
|
+
scrollSnapsRef.current = scrollSnaps;
|
|
1449
|
+
if (!viewport || 0 === slides.length) {
|
|
1450
|
+
selectedIndexRef.current = 0;
|
|
1451
|
+
canScrollPrevRef.current = false;
|
|
1452
|
+
canScrollNextRef.current = false;
|
|
1453
|
+
setCanScrollPrev(false);
|
|
1454
|
+
setCanScrollNext(false);
|
|
1455
|
+
emit('select', api);
|
|
1456
|
+
return;
|
|
1457
|
+
}
|
|
1458
|
+
const scrollPosition = 'horizontal' === orientationRef.current ? viewport.scrollLeft : viewport.scrollTop;
|
|
1459
|
+
let nearestIndex = 0;
|
|
1460
|
+
let nearestDistance = 1 / 0;
|
|
1461
|
+
for(let index = 0; index < scrollSnaps.length; index += 1){
|
|
1462
|
+
const distance = Math.abs(scrollSnaps[index] - scrollPosition);
|
|
1463
|
+
if (distance < nearestDistance) {
|
|
1464
|
+
nearestDistance = distance;
|
|
1465
|
+
nearestIndex = index;
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
selectedIndexRef.current = nearestIndex;
|
|
1469
|
+
canScrollPrevRef.current = nearestIndex > 0;
|
|
1470
|
+
canScrollNextRef.current = nearestIndex < slides.length - 1;
|
|
1471
|
+
setCanScrollPrev(canScrollPrevRef.current);
|
|
1472
|
+
setCanScrollNext(canScrollNextRef.current);
|
|
1473
|
+
emit('select', api);
|
|
1474
|
+
}, [
|
|
1475
|
+
api,
|
|
1476
|
+
emit,
|
|
1477
|
+
getSlides,
|
|
1478
|
+
getTargetFor
|
|
1479
|
+
]);
|
|
1480
|
+
const handleScroll = useCallback(()=>{
|
|
1481
|
+
refresh();
|
|
1482
|
+
}, [
|
|
1483
|
+
refresh
|
|
1484
|
+
]);
|
|
1485
|
+
const detachViewport = useCallback(()=>{
|
|
1486
|
+
if (viewportRef.current) viewportRef.current.removeEventListener('scroll', handleScroll);
|
|
1487
|
+
resizeObserverRef.current?.disconnect();
|
|
1488
|
+
mutationObserverRef.current?.disconnect();
|
|
1489
|
+
resizeObserverRef.current = null;
|
|
1490
|
+
mutationObserverRef.current = null;
|
|
1491
|
+
observedSlidesRef.current = [];
|
|
1492
|
+
}, [
|
|
1493
|
+
handleScroll
|
|
1494
|
+
]);
|
|
1495
|
+
const carouselRef = useCallback((node)=>{
|
|
1496
|
+
if (viewportRef.current === node) return;
|
|
1497
|
+
detachViewport();
|
|
1498
|
+
viewportRef.current = node;
|
|
1499
|
+
if (!node) return void refresh();
|
|
1500
|
+
node.addEventListener('scroll', handleScroll, {
|
|
1501
|
+
passive: true
|
|
1502
|
+
});
|
|
1503
|
+
if ("u" > typeof ResizeObserver) {
|
|
1504
|
+
resizeObserverRef.current = new ResizeObserver(refresh);
|
|
1505
|
+
resizeObserverRef.current.observe(node);
|
|
1506
|
+
}
|
|
1507
|
+
if ("u" > typeof MutationObserver) {
|
|
1508
|
+
mutationObserverRef.current = new MutationObserver(()=>{
|
|
1509
|
+
rebindSlideObservers();
|
|
1510
|
+
refresh();
|
|
1511
|
+
api.reInit();
|
|
1512
|
+
});
|
|
1513
|
+
mutationObserverRef.current.observe(node, {
|
|
1514
|
+
childList: true,
|
|
1515
|
+
subtree: false
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
rebindSlideObservers();
|
|
1519
|
+
refresh();
|
|
1520
|
+
}, [
|
|
1521
|
+
api,
|
|
1522
|
+
detachViewport,
|
|
1523
|
+
handleScroll,
|
|
1524
|
+
rebindSlideObservers,
|
|
1525
|
+
refresh
|
|
1345
1526
|
]);
|
|
1346
1527
|
const scrollPrev = useCallback(()=>{
|
|
1347
|
-
api
|
|
1528
|
+
api.scrollPrev();
|
|
1348
1529
|
}, [
|
|
1349
1530
|
api
|
|
1350
1531
|
]);
|
|
1351
1532
|
const scrollNext = useCallback(()=>{
|
|
1352
|
-
api
|
|
1533
|
+
api.scrollNext();
|
|
1353
1534
|
}, [
|
|
1354
1535
|
api
|
|
1355
1536
|
]);
|
|
1356
1537
|
const handleKeyDown = useCallback((event)=>{
|
|
1357
|
-
if ('ArrowLeft' === event.key) {
|
|
1538
|
+
if ('ArrowLeft' === event.key || 'ArrowUp' === event.key) {
|
|
1358
1539
|
event.preventDefault();
|
|
1359
1540
|
scrollPrev();
|
|
1360
|
-
} else if ('ArrowRight' === event.key) {
|
|
1541
|
+
} else if ('ArrowRight' === event.key || 'ArrowDown' === event.key) {
|
|
1361
1542
|
event.preventDefault();
|
|
1362
1543
|
scrollNext();
|
|
1363
1544
|
}
|
|
@@ -1366,23 +1547,25 @@ const useLogic_useLogic = ({ orientation = 'horizontal', opts, setApi, plugins,
|
|
|
1366
1547
|
scrollNext
|
|
1367
1548
|
]);
|
|
1368
1549
|
useEffect(()=>{
|
|
1369
|
-
|
|
1370
|
-
|
|
1550
|
+
orientationRef.current = resolvedOrientation;
|
|
1551
|
+
alignRef.current = resolvedAlign;
|
|
1552
|
+
refresh();
|
|
1553
|
+
api.reInit();
|
|
1371
1554
|
}, [
|
|
1372
1555
|
api,
|
|
1373
|
-
|
|
1556
|
+
refresh,
|
|
1557
|
+
resolvedAlign,
|
|
1558
|
+
resolvedOrientation
|
|
1374
1559
|
]);
|
|
1375
1560
|
useEffect(()=>{
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
api.on('reInit', onSelect);
|
|
1379
|
-
api.on('select', onSelect);
|
|
1380
|
-
return ()=>{
|
|
1381
|
-
api?.off('select', onSelect);
|
|
1382
|
-
};
|
|
1561
|
+
setApi?.(api);
|
|
1562
|
+
return ()=>setApi?.(void 0);
|
|
1383
1563
|
}, [
|
|
1384
1564
|
api,
|
|
1385
|
-
|
|
1565
|
+
setApi
|
|
1566
|
+
]);
|
|
1567
|
+
useEffect(()=>()=>detachViewport(), [
|
|
1568
|
+
detachViewport
|
|
1386
1569
|
]);
|
|
1387
1570
|
return {
|
|
1388
1571
|
carouselRef,
|
|
@@ -1392,54 +1575,38 @@ const useLogic_useLogic = ({ orientation = 'horizontal', opts, setApi, plugins,
|
|
|
1392
1575
|
canScrollPrev,
|
|
1393
1576
|
canScrollNext,
|
|
1394
1577
|
handleKeyDown,
|
|
1395
|
-
|
|
1396
|
-
orientation,
|
|
1397
|
-
onDotButtonClick,
|
|
1398
|
-
isShowButtons,
|
|
1399
|
-
isShowDots,
|
|
1400
|
-
data
|
|
1578
|
+
orientation
|
|
1401
1579
|
};
|
|
1402
1580
|
};
|
|
1403
|
-
function Carousel({
|
|
1404
|
-
const { canScrollNext, canScrollPrev, scrollNext, scrollPrev, api,
|
|
1581
|
+
function Carousel({ align, children, className, orientation: orientationProp, setApi, ...props }) {
|
|
1582
|
+
const { canScrollNext, canScrollPrev, scrollNext, scrollPrev, api, orientation, carouselRef, handleKeyDown } = useLogic_useLogic({
|
|
1583
|
+
align,
|
|
1584
|
+
orientation: orientationProp,
|
|
1585
|
+
setApi
|
|
1586
|
+
});
|
|
1405
1587
|
return /*#__PURE__*/ jsx(CarouselContext.Provider, {
|
|
1406
1588
|
value: {
|
|
1407
1589
|
carouselRef,
|
|
1408
1590
|
api,
|
|
1409
|
-
|
|
1410
|
-
orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),
|
|
1591
|
+
orientation,
|
|
1411
1592
|
scrollPrev,
|
|
1412
1593
|
scrollNext,
|
|
1413
1594
|
canScrollPrev,
|
|
1414
1595
|
canScrollNext
|
|
1415
1596
|
},
|
|
1416
|
-
children: /*#__PURE__*/
|
|
1597
|
+
children: /*#__PURE__*/ jsx("section", {
|
|
1417
1598
|
onKeyDownCapture: handleKeyDown,
|
|
1418
|
-
className: clsx(styles_css_rootClass,
|
|
1599
|
+
className: clsx(styles_css_rootClass, className),
|
|
1419
1600
|
"data-slot": "carousel",
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
height
|
|
1423
|
-
},
|
|
1424
|
-
children: [
|
|
1425
|
-
/*#__PURE__*/ jsx(Content_Content, {
|
|
1426
|
-
style: {
|
|
1427
|
-
width,
|
|
1428
|
-
height
|
|
1429
|
-
},
|
|
1430
|
-
children: data.map((item)=>/*#__PURE__*/ jsx(Item_Item, {
|
|
1431
|
-
children: props.renderItem(item)
|
|
1432
|
-
}, `${item[props.keyId]}`))
|
|
1433
|
-
}),
|
|
1434
|
-
isShowButtons && /*#__PURE__*/ jsx(Buttons, {}),
|
|
1435
|
-
isShowDots && /*#__PURE__*/ jsx(Dots, {
|
|
1436
|
-
api: api,
|
|
1437
|
-
orientation: orientation
|
|
1438
|
-
})
|
|
1439
|
-
]
|
|
1601
|
+
...props,
|
|
1602
|
+
children: children
|
|
1440
1603
|
})
|
|
1441
1604
|
});
|
|
1442
1605
|
}
|
|
1606
|
+
Carousel.Content = Content_Content;
|
|
1607
|
+
Carousel.Item = Item_Item;
|
|
1608
|
+
Carousel.Arrows = Arrows;
|
|
1609
|
+
Carousel.Dots = Dots;
|
|
1443
1610
|
var checkbox_css_icon = 'style__b7yo4k2';
|
|
1444
1611
|
var indicator = 'style__b7yo4k1';
|
|
1445
1612
|
var checkbox_css_root = 'style__b7yo4k0';
|
|
@@ -1587,11 +1754,11 @@ var sizes = {
|
|
|
1587
1754
|
medium: 'medium__1o97kvm2',
|
|
1588
1755
|
large: 'large__1o97kvm3'
|
|
1589
1756
|
};
|
|
1590
|
-
var
|
|
1757
|
+
var styles_css_wrapper = 'style__1o97kvm0';
|
|
1591
1758
|
const Image_Image = (props)=>/*#__PURE__*/ jsx("img", {
|
|
1592
1759
|
alt: props.alt,
|
|
1593
1760
|
src: props.src,
|
|
1594
|
-
className: clsx_0(
|
|
1761
|
+
className: clsx_0(styles_css_wrapper, sizes[props.size || 'medium'], props.className),
|
|
1595
1762
|
width: props.width,
|
|
1596
1763
|
height: props.height
|
|
1597
1764
|
});
|
|
@@ -3021,7 +3188,7 @@ var Drawer_styles_css_footer = 'style__ccss508';
|
|
|
3021
3188
|
var Drawer_styles_css_header = 'style__ccss507';
|
|
3022
3189
|
var Drawer_styles_css_overlay = 'style__ccss502';
|
|
3023
3190
|
var Drawer_styles_css_title = 'style__ccss509';
|
|
3024
|
-
var
|
|
3191
|
+
var styles_css_viewport = 'style__ccss503';
|
|
3025
3192
|
const Drawer_Drawer = ({ children, trigger, className, title, description = '', footer, closeButton, swipeDirection = 'down', ...props })=>/*#__PURE__*/ jsxs(Drawer.Root, {
|
|
3026
3193
|
swipeDirection: swipeDirection,
|
|
3027
3194
|
...props,
|
|
@@ -3038,7 +3205,7 @@ const Drawer_Drawer = ({ children, trigger, className, title, description = '',
|
|
|
3038
3205
|
className: Drawer_styles_css_overlay
|
|
3039
3206
|
}),
|
|
3040
3207
|
/*#__PURE__*/ jsx(Drawer.Viewport, {
|
|
3041
|
-
className:
|
|
3208
|
+
className: styles_css_viewport,
|
|
3042
3209
|
children: /*#__PURE__*/ jsx(Drawer.Popup, {
|
|
3043
3210
|
"data-slot": "drawer-content",
|
|
3044
3211
|
className: clsx('group/drawer-content', Drawer_styles_css_content, className),
|
|
@@ -3150,7 +3317,7 @@ var carouselInner = 'style__a5l83v1';
|
|
|
3150
3317
|
var ImageCarousel_styles_css_image = 'style__a5l83v3';
|
|
3151
3318
|
var styles_css_indicator = 'style__a5l83v8';
|
|
3152
3319
|
var indicators = 'style__a5l83v7';
|
|
3153
|
-
var
|
|
3320
|
+
var styles_css_slide = 'style__a5l83v2';
|
|
3154
3321
|
const ImageCarousel = ({ images = [], autoPlay = false, interval = 5000 })=>{
|
|
3155
3322
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
3156
3323
|
const goToPrevious = ()=>{
|
|
@@ -3186,7 +3353,7 @@ const ImageCarousel = ({ images = [], autoPlay = false, interval = 5000 })=>{
|
|
|
3186
3353
|
transform: `translateX(-${100 * currentIndex}%)`
|
|
3187
3354
|
},
|
|
3188
3355
|
children: images.map((image, index)=>/*#__PURE__*/ jsx("div", {
|
|
3189
|
-
className:
|
|
3356
|
+
className: styles_css_slide,
|
|
3190
3357
|
children: /*#__PURE__*/ jsx("img", {
|
|
3191
3358
|
src: image.src,
|
|
3192
3359
|
alt: image.alt || `Slide ${index + 1}`,
|
|
@@ -4122,7 +4289,7 @@ var Select_styles_css_sizes = {
|
|
|
4122
4289
|
large: 'large__5ilg7o5'
|
|
4123
4290
|
};
|
|
4124
4291
|
var Select_styles_css_trigger = 'style__5ilg7o2';
|
|
4125
|
-
var
|
|
4292
|
+
var Select_styles_css_viewport = 'style__5ilg7o9';
|
|
4126
4293
|
const Select_Select = ({ onValueChange, ...props })=>/*#__PURE__*/ jsx(Select.Root, {
|
|
4127
4294
|
...props,
|
|
4128
4295
|
onValueChange: (value, eventDetails)=>{
|
|
@@ -4175,7 +4342,7 @@ const SelectContent = ({ className, children, side = 'bottom', sideOffset = 4, a
|
|
|
4175
4342
|
children: [
|
|
4176
4343
|
/*#__PURE__*/ jsx(SelectScrollUpButton, {}),
|
|
4177
4344
|
/*#__PURE__*/ jsx(Select.List, {
|
|
4178
|
-
className:
|
|
4345
|
+
className: Select_styles_css_viewport,
|
|
4179
4346
|
children: children
|
|
4180
4347
|
}),
|
|
4181
4348
|
/*#__PURE__*/ jsx(SelectScrollDownButton, {})
|
|
@@ -9,5 +9,6 @@ declare const _default: {
|
|
|
9
9
|
};
|
|
10
10
|
export default _default;
|
|
11
11
|
export declare function Demo(): import("react").JSX.Element;
|
|
12
|
+
export declare function StartAligned(): import("react").JSX.Element;
|
|
12
13
|
export declare function Vertical(): import("react").JSX.Element;
|
|
13
14
|
//# sourceMappingURL=Carousel.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.stories.d.ts","sourceRoot":"","sources":["../../src/stories/Carousel.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;;;;;;;;;AAE9C,wBAOkC;AAElC,wBAAgB,IAAI,
|
|
1
|
+
{"version":3,"file":"Carousel.stories.d.ts","sourceRoot":"","sources":["../../src/stories/Carousel.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;;;;;;;;;AAE9C,wBAOkC;AAElC,wBAAgB,IAAI,gCAkDnB;AAED,wBAAgB,YAAY,gCAkD3B;AAED,wBAAgB,QAAQ,gCAoDvB"}
|
package/lib/styles.css
CHANGED
|
@@ -1916,61 +1916,104 @@ a.outline__1af895x4:hover {
|
|
|
1916
1916
|
}
|
|
1917
1917
|
|
|
1918
1918
|
.style__2d6ocq0 {
|
|
1919
|
-
|
|
1920
|
-
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
transition: opacity .2s linear;
|
|
1926
|
-
display: grid;
|
|
1919
|
+
cursor: pointer;
|
|
1920
|
+
background-color: #0000;
|
|
1921
|
+
border: none;
|
|
1922
|
+
justify-content: center;
|
|
1923
|
+
align-items: center;
|
|
1924
|
+
display: flex;
|
|
1927
1925
|
position: absolute;
|
|
1928
1926
|
}
|
|
1929
1927
|
|
|
1930
1928
|
.style__2d6ocq0:disabled {
|
|
1931
|
-
|
|
1932
|
-
|
|
1929
|
+
-webkit-user-select: none;
|
|
1930
|
+
user-select: none;
|
|
1931
|
+
cursor: default;
|
|
1932
|
+
opacity: .5;
|
|
1933
1933
|
}
|
|
1934
1934
|
|
|
1935
|
-
.
|
|
1936
|
-
|
|
1935
|
+
.style__2d6ocq1 {
|
|
1936
|
+
width: var(--spacing-8);
|
|
1937
|
+
height: var(--spacing-8);
|
|
1938
|
+
background-color: var(--colors-background-paper);
|
|
1939
|
+
border-radius: 9999px;
|
|
1940
|
+
justify-content: center;
|
|
1941
|
+
align-items: center;
|
|
1942
|
+
transition: transform .2s;
|
|
1943
|
+
display: flex;
|
|
1937
1944
|
}
|
|
1938
1945
|
|
|
1939
|
-
.style__2d6ocq1 {
|
|
1940
|
-
|
|
1941
|
-
right: 0;
|
|
1946
|
+
.style__2d6ocq0:not(:disabled):hover .style__2d6ocq1 {
|
|
1947
|
+
transform: scale(1.1);
|
|
1942
1948
|
}
|
|
1943
1949
|
|
|
1944
|
-
.
|
|
1950
|
+
.style__2d6ocq1 svg {
|
|
1951
|
+
width: var(--spacing-5);
|
|
1952
|
+
height: var(--spacing-5);
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
.horizontal__2d6ocq2 {
|
|
1956
|
+
width: clamp(2.5rem, 4vw, 4rem);
|
|
1957
|
+
height: 100%;
|
|
1945
1958
|
top: 0;
|
|
1959
|
+
right: 0;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
.vertical__2d6ocq3 {
|
|
1963
|
+
width: 100%;
|
|
1964
|
+
height: clamp(2.5rem, 4vw, 4rem);
|
|
1965
|
+
bottom: 0;
|
|
1946
1966
|
left: 0;
|
|
1947
1967
|
}
|
|
1948
1968
|
|
|
1949
|
-
.
|
|
1950
|
-
width: clamp(
|
|
1969
|
+
.horizontal__2d6ocq4 {
|
|
1970
|
+
width: clamp(2.5rem, 4vw, 4rem);
|
|
1951
1971
|
height: 100%;
|
|
1972
|
+
top: 0;
|
|
1973
|
+
left: 0;
|
|
1952
1974
|
}
|
|
1953
1975
|
|
|
1954
|
-
.
|
|
1976
|
+
.vertical__2d6ocq5 {
|
|
1955
1977
|
width: 100%;
|
|
1956
|
-
height: clamp(
|
|
1978
|
+
height: clamp(2.5rem, 4vw, 4rem);
|
|
1979
|
+
top: 0;
|
|
1980
|
+
right: 0;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
.vertical__2d6ocq3 svg, .vertical__2d6ocq5 svg {
|
|
1984
|
+
transform: rotate(90deg);
|
|
1957
1985
|
}
|
|
1958
1986
|
|
|
1959
1987
|
.style__i1lems0 {
|
|
1988
|
+
scroll-behavior: smooth;
|
|
1989
|
+
scrollbar-width: none;
|
|
1990
|
+
-webkit-overflow-scrolling: touch;
|
|
1960
1991
|
width: 100%;
|
|
1961
1992
|
height: 100%;
|
|
1993
|
+
display: flex;
|
|
1962
1994
|
overflow: hidden;
|
|
1963
1995
|
}
|
|
1964
1996
|
|
|
1997
|
+
.style__i1lems0::-webkit-scrollbar {
|
|
1998
|
+
display: none;
|
|
1999
|
+
}
|
|
2000
|
+
|
|
1965
2001
|
.horizontal__i1lems1 {
|
|
1966
|
-
|
|
1967
|
-
|
|
2002
|
+
scroll-snap-type: x mandatory;
|
|
2003
|
+
overscroll-behavior-x: contain;
|
|
2004
|
+
overscroll-behavior-y: auto;
|
|
2005
|
+
column-gap: var(--spacing-4);
|
|
2006
|
+
flex-direction: row;
|
|
2007
|
+
overflow: auto hidden;
|
|
1968
2008
|
}
|
|
1969
2009
|
|
|
1970
2010
|
.vertical__i1lems2 {
|
|
1971
|
-
|
|
2011
|
+
scroll-snap-type: y mandatory;
|
|
2012
|
+
overscroll-behavior-y: contain;
|
|
2013
|
+
overscroll-behavior-x: auto;
|
|
2014
|
+
row-gap: var(--spacing-4);
|
|
1972
2015
|
flex-direction: column;
|
|
1973
|
-
|
|
2016
|
+
overflow: hidden auto;
|
|
1974
2017
|
}
|
|
1975
2018
|
|
|
1976
2019
|
.style__e2zpp60 {
|
|
@@ -2043,6 +2086,16 @@ a.outline__1af895x4:hover {
|
|
|
2043
2086
|
min-width: 0;
|
|
2044
2087
|
}
|
|
2045
2088
|
|
|
2089
|
+
.horizontal__1gif6yr1 {
|
|
2090
|
+
scroll-snap-align: center;
|
|
2091
|
+
scroll-snap-stop: always;
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
.vertical__1gif6yr2 {
|
|
2095
|
+
scroll-snap-align: start;
|
|
2096
|
+
scroll-snap-stop: always;
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2046
2099
|
.Carousel__1jbydv50 {
|
|
2047
2100
|
position: relative;
|
|
2048
2101
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@max-ts/kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./lib/index.mjs",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"@base-ui/react": "^1.5.0",
|
|
19
19
|
"@react-input/mask": "^2.0.4",
|
|
20
20
|
"clsx": "^2.1.1",
|
|
21
|
-
"embla-carousel-react": "^8.6.0",
|
|
22
21
|
"input-otp": "^1.4.2",
|
|
23
22
|
"lucide-react": "^1.17.0",
|
|
24
23
|
"react-day-picker": "^10.0.1",
|