@machinerd/js-module 0.5.2 → 0.5.4
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/styles/index.css +5 -24
- package/dist/ui/index.d.cts +14 -14
- package/dist/ui/index.d.mts +13 -13
- package/dist/ui-client/index.cjs +1 -1
- package/dist/ui-client/index.d.cts +38 -22
- package/dist/ui-client/index.d.mts +28 -12
- package/dist/ui-client/index.mjs +1 -1
- package/dist/util/index.d.cts +1 -1
- package/dist/util/index.d.mts +1 -1
- package/package.json +1 -1
package/dist/styles/index.css
CHANGED
|
@@ -139,9 +139,6 @@
|
|
|
139
139
|
.komc\:-mt-4 {
|
|
140
140
|
margin-top: calc(var(--komc-spacing) * -4);
|
|
141
141
|
}
|
|
142
|
-
.komc\:mt-2 {
|
|
143
|
-
margin-top: calc(var(--komc-spacing) * 2);
|
|
144
|
-
}
|
|
145
142
|
.komc\:mt-3 {
|
|
146
143
|
margin-top: calc(var(--komc-spacing) * 3);
|
|
147
144
|
}
|
|
@@ -223,8 +220,8 @@
|
|
|
223
220
|
.komc\:h-40 {
|
|
224
221
|
height: calc(var(--komc-spacing) * 40);
|
|
225
222
|
}
|
|
226
|
-
.komc\:h-
|
|
227
|
-
height: calc(var(--komc-spacing) *
|
|
223
|
+
.komc\:h-72 {
|
|
224
|
+
height: calc(var(--komc-spacing) * 72);
|
|
228
225
|
}
|
|
229
226
|
.komc\:h-\[50dvh\] {
|
|
230
227
|
height: 50dvh;
|
|
@@ -274,9 +271,6 @@
|
|
|
274
271
|
.komc\:w-2 {
|
|
275
272
|
width: calc(var(--komc-spacing) * 2);
|
|
276
273
|
}
|
|
277
|
-
.komc\:w-4 {
|
|
278
|
-
width: calc(var(--komc-spacing) * 4);
|
|
279
|
-
}
|
|
280
274
|
.komc\:w-\[50dvw\] {
|
|
281
275
|
width: 50dvw;
|
|
282
276
|
}
|
|
@@ -389,6 +383,9 @@
|
|
|
389
383
|
.komc\:flex-col {
|
|
390
384
|
flex-direction: column;
|
|
391
385
|
}
|
|
386
|
+
.komc\:flex-row {
|
|
387
|
+
flex-direction: row;
|
|
388
|
+
}
|
|
392
389
|
.komc\:flex-wrap {
|
|
393
390
|
flex-wrap: wrap;
|
|
394
391
|
}
|
|
@@ -416,9 +413,6 @@
|
|
|
416
413
|
.komc\:gap-1 {
|
|
417
414
|
gap: calc(var(--komc-spacing) * 1);
|
|
418
415
|
}
|
|
419
|
-
.komc\:gap-1\.5 {
|
|
420
|
-
gap: calc(var(--komc-spacing) * 1.5);
|
|
421
|
-
}
|
|
422
416
|
.komc\:gap-2 {
|
|
423
417
|
gap: calc(var(--komc-spacing) * 2);
|
|
424
418
|
}
|
|
@@ -586,9 +580,6 @@
|
|
|
586
580
|
background-color: color-mix(in oklab, var(--komc-color-neutral-100) 95%, transparent);
|
|
587
581
|
}
|
|
588
582
|
}
|
|
589
|
-
.komc\:bg-neutral-300 {
|
|
590
|
-
background-color: var(--komc-color-neutral-300);
|
|
591
|
-
}
|
|
592
583
|
.komc\:bg-night-700 {
|
|
593
584
|
background-color: var(--komc-color-night-700);
|
|
594
585
|
}
|
|
@@ -1156,16 +1147,6 @@
|
|
|
1156
1147
|
color: var(--komc-color-gray-800);
|
|
1157
1148
|
}
|
|
1158
1149
|
}
|
|
1159
|
-
.komc\:data-\[selected\=true\]\:bg-blue-500 {
|
|
1160
|
-
&[data-selected="true"] {
|
|
1161
|
-
background-color: var(--komc-color-blue-500);
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
.komc\:data-\[selected\=true\]\:text-white {
|
|
1165
|
-
&[data-selected="true"] {
|
|
1166
|
-
color: var(--komc-color-white);
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
1150
|
.komc\:data-\[state\=closed\]\:scale-95 {
|
|
1170
1151
|
&[data-state="closed"] {
|
|
1171
1152
|
--tw-scale-x: 95%;
|
package/dist/ui/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react10 from "react";
|
|
2
2
|
import React$1, { ComponentProps, HTMLAttributes } from "react";
|
|
3
3
|
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
4
|
-
import * as
|
|
4
|
+
import * as class_variance_authority_types2 from "class-variance-authority/types";
|
|
5
5
|
import { VariantProps } from "class-variance-authority";
|
|
6
6
|
|
|
7
7
|
//#region src/ui/bottom-app-bar/bottom-app-bar.d.ts
|
|
@@ -18,13 +18,13 @@ declare function BottomAppBar<T>({
|
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/ui/button/button.d.ts
|
|
20
20
|
declare const classes$2: (props?: ({
|
|
21
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "
|
|
21
|
+
size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | null | undefined;
|
|
22
22
|
shadow?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | null | undefined;
|
|
23
23
|
outline?: "line" | "solid" | "clear" | null | undefined;
|
|
24
24
|
variant?: "blue" | "duo" | "white" | "gray" | "neutral" | "night" | "black" | "sky" | "sky-blue" | "indigo" | null | undefined;
|
|
25
25
|
px?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | null | undefined;
|
|
26
26
|
rounded?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | null | undefined;
|
|
27
|
-
} &
|
|
27
|
+
} & class_variance_authority_types2.ClassProp) | undefined) => string;
|
|
28
28
|
interface VariantMap {
|
|
29
29
|
line: 'blue' | 'duo' | 'white' | 'gray' | 'neutral' | 'sky' | 'sky-blue';
|
|
30
30
|
solid: 'white' | 'gray' | 'blue' | 'night' | 'black' | 'sky' | 'sky-blue' | 'indigo';
|
|
@@ -43,22 +43,22 @@ type ButtonProps = ComponentProps<'button'> & BaseProps & ({
|
|
|
43
43
|
}) & {
|
|
44
44
|
asChild?: boolean;
|
|
45
45
|
};
|
|
46
|
-
declare const Button:
|
|
46
|
+
declare const Button: react10.ForwardRefExoticComponent<(Omit<react10.ClassAttributes<HTMLButtonElement> & react10.ButtonHTMLAttributes<HTMLButtonElement> & BaseProps & {
|
|
47
47
|
outline?: "line";
|
|
48
48
|
variant?: VariantMap["line"];
|
|
49
49
|
} & {
|
|
50
50
|
asChild?: boolean;
|
|
51
|
-
}, "ref"> | Omit<
|
|
51
|
+
}, "ref"> | Omit<react10.ClassAttributes<HTMLButtonElement> & react10.ButtonHTMLAttributes<HTMLButtonElement> & BaseProps & {
|
|
52
52
|
outline: "solid";
|
|
53
53
|
variant?: VariantMap["solid"];
|
|
54
54
|
} & {
|
|
55
55
|
asChild?: boolean;
|
|
56
|
-
}, "ref"> | Omit<
|
|
56
|
+
}, "ref"> | Omit<react10.ClassAttributes<HTMLButtonElement> & react10.ButtonHTMLAttributes<HTMLButtonElement> & BaseProps & {
|
|
57
57
|
outline: "clear";
|
|
58
58
|
variant?: VariantMap["clear"];
|
|
59
59
|
} & {
|
|
60
60
|
asChild?: boolean;
|
|
61
|
-
}, "ref">) &
|
|
61
|
+
}, "ref">) & react10.RefAttributes<HTMLButtonElement>>;
|
|
62
62
|
//#endregion
|
|
63
63
|
//#region src/ui/conditional-wrapper/conditional-wrapper.d.ts
|
|
64
64
|
interface ConditionalWrapperProps {
|
|
@@ -70,15 +70,15 @@ declare function ConditionalWrapper({
|
|
|
70
70
|
condition,
|
|
71
71
|
wrapper,
|
|
72
72
|
children
|
|
73
|
-
}: ConditionalWrapperProps):
|
|
73
|
+
}: ConditionalWrapperProps): react10.ReactNode;
|
|
74
74
|
//#endregion
|
|
75
75
|
//#region src/ui/input/input.d.ts
|
|
76
76
|
declare const classes$1: (props?: ({
|
|
77
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" |
|
|
77
|
+
size?: "base" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | null | undefined;
|
|
78
78
|
gap?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
79
79
|
outline?: "line" | "solid" | "clear" | "dashed" | "dotted" | null | undefined;
|
|
80
80
|
rounded?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | null | undefined;
|
|
81
|
-
} &
|
|
81
|
+
} & class_variance_authority_types2.ClassProp) | undefined) => string;
|
|
82
82
|
interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'prefix' | 'surffix' | 'size'>, VariantProps<typeof classes$1> {
|
|
83
83
|
size?: VariantProps<typeof classes$1>['size'];
|
|
84
84
|
gap?: VariantProps<typeof classes$1>['gap'];
|
|
@@ -87,13 +87,13 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, '
|
|
|
87
87
|
prefix?: React.ReactNode;
|
|
88
88
|
surffix?: React.ReactNode;
|
|
89
89
|
}
|
|
90
|
-
declare const Input:
|
|
90
|
+
declare const Input: react10.ForwardRefExoticComponent<InputProps & react10.RefAttributes<HTMLInputElement>>;
|
|
91
91
|
//#endregion
|
|
92
92
|
//#region src/ui/skeleton/skeleton.d.ts
|
|
93
93
|
declare const classes: (props?: ({
|
|
94
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "
|
|
94
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | "square" | null | undefined;
|
|
95
95
|
rounded?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | null | undefined;
|
|
96
|
-
} &
|
|
96
|
+
} & class_variance_authority_types2.ClassProp) | undefined) => string;
|
|
97
97
|
interface SkeletonProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof classes> {
|
|
98
98
|
width?: string | number;
|
|
99
99
|
height?: string | number;
|
package/dist/ui/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react1 from "react";
|
|
2
2
|
import React$1, { ComponentProps, HTMLAttributes } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
4
4
|
import { VariantProps } from "class-variance-authority";
|
|
5
5
|
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ declare function BottomAppBar<T>({
|
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/ui/button/button.d.ts
|
|
20
20
|
declare const classes$2: (props?: ({
|
|
21
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "
|
|
21
|
+
size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | null | undefined;
|
|
22
22
|
shadow?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | null | undefined;
|
|
23
23
|
outline?: "line" | "solid" | "clear" | null | undefined;
|
|
24
24
|
variant?: "blue" | "duo" | "white" | "gray" | "neutral" | "night" | "black" | "sky" | "sky-blue" | "indigo" | null | undefined;
|
|
@@ -43,22 +43,22 @@ type ButtonProps = ComponentProps<'button'> & BaseProps & ({
|
|
|
43
43
|
}) & {
|
|
44
44
|
asChild?: boolean;
|
|
45
45
|
};
|
|
46
|
-
declare const Button:
|
|
46
|
+
declare const Button: react1.ForwardRefExoticComponent<(Omit<react1.ClassAttributes<HTMLButtonElement> & react1.ButtonHTMLAttributes<HTMLButtonElement> & BaseProps & {
|
|
47
47
|
outline?: "line";
|
|
48
48
|
variant?: VariantMap["line"];
|
|
49
49
|
} & {
|
|
50
50
|
asChild?: boolean;
|
|
51
|
-
}, "ref"> | Omit<
|
|
51
|
+
}, "ref"> | Omit<react1.ClassAttributes<HTMLButtonElement> & react1.ButtonHTMLAttributes<HTMLButtonElement> & BaseProps & {
|
|
52
52
|
outline: "solid";
|
|
53
53
|
variant?: VariantMap["solid"];
|
|
54
54
|
} & {
|
|
55
55
|
asChild?: boolean;
|
|
56
|
-
}, "ref"> | Omit<
|
|
56
|
+
}, "ref"> | Omit<react1.ClassAttributes<HTMLButtonElement> & react1.ButtonHTMLAttributes<HTMLButtonElement> & BaseProps & {
|
|
57
57
|
outline: "clear";
|
|
58
58
|
variant?: VariantMap["clear"];
|
|
59
59
|
} & {
|
|
60
60
|
asChild?: boolean;
|
|
61
|
-
}, "ref">) &
|
|
61
|
+
}, "ref">) & react1.RefAttributes<HTMLButtonElement>>;
|
|
62
62
|
//#endregion
|
|
63
63
|
//#region src/ui/conditional-wrapper/conditional-wrapper.d.ts
|
|
64
64
|
interface ConditionalWrapperProps {
|
|
@@ -70,11 +70,11 @@ declare function ConditionalWrapper({
|
|
|
70
70
|
condition,
|
|
71
71
|
wrapper,
|
|
72
72
|
children
|
|
73
|
-
}: ConditionalWrapperProps):
|
|
73
|
+
}: ConditionalWrapperProps): react1.ReactNode;
|
|
74
74
|
//#endregion
|
|
75
75
|
//#region src/ui/input/input.d.ts
|
|
76
76
|
declare const classes$1: (props?: ({
|
|
77
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" |
|
|
77
|
+
size?: "base" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | null | undefined;
|
|
78
78
|
gap?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
79
79
|
outline?: "line" | "solid" | "clear" | "dashed" | "dotted" | null | undefined;
|
|
80
80
|
rounded?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | null | undefined;
|
|
@@ -87,11 +87,11 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, '
|
|
|
87
87
|
prefix?: React.ReactNode;
|
|
88
88
|
surffix?: React.ReactNode;
|
|
89
89
|
}
|
|
90
|
-
declare const Input:
|
|
90
|
+
declare const Input: react1.ForwardRefExoticComponent<InputProps & react1.RefAttributes<HTMLInputElement>>;
|
|
91
91
|
//#endregion
|
|
92
92
|
//#region src/ui/skeleton/skeleton.d.ts
|
|
93
93
|
declare const classes: (props?: ({
|
|
94
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "
|
|
94
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | "square" | null | undefined;
|
|
95
95
|
rounded?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | null | undefined;
|
|
96
96
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
97
97
|
interface SkeletonProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof classes> {
|
|
@@ -107,7 +107,7 @@ declare function Skeleton({
|
|
|
107
107
|
height,
|
|
108
108
|
className,
|
|
109
109
|
...props
|
|
110
|
-
}: SkeletonProps):
|
|
110
|
+
}: SkeletonProps): react_jsx_runtime1.JSX.Element;
|
|
111
111
|
//#endregion
|
|
112
112
|
//#region src/ui/stable-text/stable-text.d.ts
|
|
113
113
|
declare function StableText({
|
|
@@ -116,6 +116,6 @@ declare function StableText({
|
|
|
116
116
|
...props
|
|
117
117
|
}: Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {
|
|
118
118
|
children: string | number;
|
|
119
|
-
}):
|
|
119
|
+
}): react_jsx_runtime1.JSX.Element;
|
|
120
120
|
//#endregion
|
|
121
121
|
export { BottomAppBar, type BottomAppBarProps, Button, type ButtonProps, ConditionalWrapper, type ConditionalWrapperProps, Input, type InputProps, Skeleton, type SkeletonProps, StableText };
|
package/dist/ui-client/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../chunk-Bmb41Sf3.cjs`);require(`../src-CjpmdVyv.cjs`);const t=require(`../util-o7fjt7iK.cjs`),n=require(`../skeleton-g6yXh6D9.cjs`),r=require(`../hooks-DqgWx1Fa.cjs`);require(`../providers-BNK8Fisc.cjs`);let i=require(`clsx`);i=e.t(i);let a=require(`react`);a=e.t(a);let o=require(`react/jsx-runtime`),s=require(`class-variance-authority`),c=require(`embla-carousel-react`);c=e.t(c);let l=require(`react-dom`);const u=a.default.createContext(null);function d(){let e=a.default.useContext(u);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}function f({orientation:e=`horizontal`,options:n,setApi:r,plugins:i,className:s,children:l,...d}){let[f,p]=(0,c.default)({...n,axis:e===`horizontal`?`x`:`y`},i),[m,h]=(0,a.useState)(!1),[g,_]=(0,a.useState)(!1),[v,y]=(0,a.useState)(0),[b,x]=(0,a.useState)(0),S=(0,a.useCallback)(e=>{e&&(h(e.canScrollPrev()),_(e.canScrollNext()),x(e.selectedScrollSnap()))},[]),C=(0,a.useCallback)(()=>{p?.scrollPrev()},[p]),w=(0,a.useCallback)(()=>{p?.scrollNext()},[p]),T=(0,a.useCallback)(e=>{p?.scrollTo(e)},[p]),E=(0,a.useCallback)(()=>{y(p?.scrollSnapList().length||0)},[p]),D=(0,a.useCallback)(t=>{e===`horizontal`?t.key===`ArrowLeft`?(t.preventDefault(),C()):t.key===`ArrowRight`&&(t.preventDefault(),w()):t.key===`ArrowUp`?(t.preventDefault(),C()):t.key===`ArrowDown`&&(t.preventDefault(),w())},[C,w,e]);return(0,a.useEffect)(()=>{!p||!r||r(p)},[p,r]),(0,a.useEffect)(()=>{if(p)return S(p),E(),p.on(`reInit`,E),p.on(`reInit`,S),p.on(`select`,S),()=>{p?.off(`select`,S)}},[p,S]),(0,o.jsx)(u.Provider,{value:{carouselRef:f,api:p,options:n,orientation:e||(n?.axis===`y`?`vertical`:`horizontal`),scrollPrev:C,scrollNext:w,canScrollPrev:m,canScrollNext:g,scrollTo:T,dots:v,selectedScrollSnap:b},children:(0,o.jsx)(`div`,{"data-komc":!0,role:`region`,"aria-label":`carousel`,"aria-roledescription":`carousel`,tabIndex:0,onKeyDownCapture:D,className:t.y(`komc:relative`,s),...d,children:l})})}function p({className:e,...n}){let{carouselRef:r,orientation:i}=d();return(0,o.jsx)(`div`,{ref:r,"data-komc":!0,className:`komc:h-full komc:overflow-hidden`,children:(0,o.jsx)(`div`,{className:t.y(`komc:flex komc:h-full`,i===`horizontal`?`komc:-ml-4`:`komc:-mt-4 komc:flex-col`,e),...n})})}function m({className:e,...n}){let{orientation:r}=d();return(0,o.jsx)(`div`,{"data-komc":!0,className:t.y(`komc:min-w-0 komc:shrink-0 komc:grow-0 komc:basis-full`,r===`horizontal`?`komc:pl-4`:`komc:pt-4`,e),...n})}function h({children:e,className:t,...n}){let{scrollPrev:r,canScrollPrev:a}=d();return(0,o.jsx)(`button`,{type:`button`,"data-komc":!0,disabled:!a,"aria-label":`previous slide`,className:(0,i.default)(`komc:w-full`,t),onClick:r,...n,children:e})}function g({children:e,className:t,...n}){let{scrollNext:r,canScrollNext:a}=d();return(0,o.jsx)(`button`,{type:`button`,"data-komc":!0,disabled:!a,"aria-label":`next slide`,className:(0,i.default)(`komc:w-full`,t),onClick:r,...n,children:e})}function _({children:e,...t}){let{dots:n,selectedScrollSnap:r,scrollTo:i}=d();return(0,o.jsx)(o.Fragment,{children:Array.from({length:n}).map((n,a)=>(0,o.jsx)(`button`,{type:`button`,"data-komc":!0,"data-selected":r===a,"aria-label":`go to slide ${a+1}`,onClick:()=>i(a),...t,children:e(a)},a))})}const v=(0,s.cva)(`komc:relative komc:z-10 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden komc:w-full komc:max-h-full komc:min-w-0 komc:transition-all komc:duration-300 komc:ease-in-out`,{variants:{padding:{sm:`komc:p-2`,md:`komc:p-4`,lg:`komc:p-6`,none:`komc:p-0`},maxWidth:{sm:`komc:max-w-sm`,md:`komc:max-w-md`,lg:`komc:max-w-lg`,xl:`komc:max-w-xl`,"2xl":`komc:max-w-2xl`,full:`komc:max-w-full`}},defaultVariants:{padding:`sm`,maxWidth:`md`}});function y({closeOnBackdropClick:e=!0,isOpen:t,zIndex:n=1e4,padding:i,maxWidth:s,className:c,onClose:l,children:u,...d}){let f=r.c(t,300),[p,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(t&&f){let e=setTimeout(()=>m(!0),10);return()=>clearTimeout(e)}else t||m(!1)},[t,f]);let h=(0,a.useCallback)(e=>{e.key===`Escape`&&l()},[l]),g=(0,a.useCallback)(()=>{e&&l()},[e,l]);return(0,a.useEffect)(()=>(t?(document.addEventListener(`keydown`,h),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,h),document.body.style.overflow=`unset`}),[t,h]),f?(0,o.jsx)(`div`,{"data-komc":!0,className:`komc:fixed komc:inset-0 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden`,style:{zIndex:n},children:(0,o.jsxs)(`div`,{className:`komc:relative komc:flex komc:min-h-0 komc:flex-1 komc:w-full komc:items-center komc:justify-center`,children:[(0,o.jsx)(`button`,{type:`button`,"data-state":p?`open`:`closed`,className:`komc:fixed komc:inset-0 komc:z-0 komc:cursor-default komc:bg-black/50 komc:transition-opacity komc:duration-300 komc:ease-in-out komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100`,onClick:g,"aria-label":`close dialog`}),(0,o.jsx)(`div`,{"data-state":p?`open`:`closed`,className:`${v({padding:i,maxWidth:s,className:c})} komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100 komc:data-[state=closed]:scale-95 komc:data-[state=open]:scale-100`,role:`dialog`,"aria-modal":`true`,...d,children:u})]})}):null}const b=(0,s.cva)(``,{variants:{fill:{true:`komc:w-full komc:h-full komc:absolute komc:inset-0`,false:``}},defaultVariants:{fill:!1}}),x=(0,a.forwardRef)(({...e},t)=>{let{ref:n,imageProps:i}=r.r({ref:t,...e});return(0,o.jsx)(`img`,{ref:n,...i})}),S=(0,a.forwardRef)(({skeleton:e=!0,layout:t=`stretch`,fallbackSrc:a,className:s,emptyNode:c,emptyNodeClassName:l,skeletonClassName:u,...d},f)=>{let{ref:p,isLoad:m,isError:h,imageProps:g}=r.r({ref:f,fallbackSrc:a,forceLoad:!e,...d}),_=!d.fill&&t===`intrinsic`?{width:`${d.width}px`,height:`${d.height}px`}:void 0,v=(0,i.default)(`komc:flex komc:justify-center komc:items-center komc:relative komc:min-h-0`,!d.fill&&t===`stretch`&&`komc:w-full komc:h-full`);return!a&&h&&c?d.fill?(0,o.jsx)(C,{className:l,children:c}):(0,o.jsx)(`div`,{"data-komc":!0,style:_,className:v,children:(0,o.jsx)(C,{className:l,children:c})}):d.fill?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`img`,{ref:p,...g,className:(0,i.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:invisible`:`komc:visible`,s)}),(0,o.jsx)(`div`,{"data-komc":!0,className:(0,i.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:block`:`komc:hidden`),children:(0,o.jsx)(n.t,{size:`full`,className:u})})]}):(0,o.jsxs)(`div`,{"data-komc":!0,style:_,className:v,children:[(0,o.jsx)(`img`,{ref:p,...g,className:(0,i.default)(b({fill:d.fill,className:s}),e&&!m?`komc:invisible`:`komc:visible`)}),(0,o.jsx)(`div`,{className:(0,i.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:block`:`komc:hidden`),children:(0,o.jsx)(n.t,{size:`full`,className:u})})]})}),C=({children:e,className:t})=>(0,o.jsx)(`div`,{"data-komc":!0,role:`alert`,className:(0,i.default)(`komc:flex komc:justify-center komc:items-center komc:w-full komc:h-full komc:bg-gray-100 komc:absolute komc:inset-0 komc:p-1`,t),children:e});var w=S;const T=(0,s.cva)((0,i.default)(`komc:absolute komc:bg-white komc:flex komc:flex-col komc:shadow-2xl`,`komc:transition-transform komc:duration-300 komc:ease-in-out`),{variants:{direction:{top:`komc:top-0 komc:left-0 komc:right-0 komc:-translate-y-full komc:data-[state=open]:translate-y-0`,bottom:`komc:bottom-0 komc:left-0 komc:right-0 komc:translate-y-full komc:data-[state=open]:translate-y-0`,left:`komc:top-0 komc:bottom-0 komc:left-0 komc:-translate-x-full komc:data-[state=open]:translate-x-0`,right:`komc:top-0 komc:bottom-0 komc:right-0 komc:translate-x-full komc:data-[state=open]:translate-x-0`}}}),E=(0,s.cva)(``,{variants:{size:{full:``,half:``,auto:``},direction:{top:``,bottom:``,left:``,right:``}},compoundVariants:[{size:`full`,direction:`top`,className:`komc:h-full`},{size:`full`,direction:`bottom`,className:`komc:h-full`},{size:`full`,direction:`left`,className:`komc:w-full`},{size:`full`,direction:`right`,className:`komc:w-full`},{size:`half`,direction:`top`,className:`komc:h-[50dvh]`},{size:`half`,direction:`bottom`,className:`komc:h-[50dvh]`},{size:`half`,direction:`left`,className:`komc:w-[50dvw]`},{size:`half`,direction:`right`,className:`komc:w-[50dvw]`},{size:`auto`,direction:`top`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`bottom`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`left`,className:`komc:w-auto komc:max-w-[90dvw]`},{size:`auto`,direction:`right`,className:`komc:w-auto komc:max-w-[90dvw]`}]});function D({isOpen:e,onClose:t,direction:n=`bottom`,size:s=`full`,children:c,className:l,closeOnBackdropClick:u=!0,zIndex:d=1001}){let f=r.c(e,300),[p,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(e&&f){let e=setTimeout(()=>m(!0),10);return()=>clearTimeout(e)}else e||m(!1)},[e,f]);let h=(0,a.useCallback)(e=>{e.key===`Escape`&&t()},[t]),g=(0,a.useCallback)(()=>{u&&t()},[u,t]);return(0,a.useEffect)(()=>(e?(document.addEventListener(`keydown`,h),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,h),document.body.style.overflow=`unset`}),[e,h]),f?(0,o.jsxs)(`div`,{className:`komc:fixed komc:inset-0 komc:flex komc:justify-center komc:items-center`,style:{zIndex:d},children:[(0,o.jsx)(`button`,{type:`button`,"data-state":p?`open`:`closed`,className:(0,i.default)(`komc:absolute komc:inset-0 komc:w-full komc:h-full komc:bg-black/40 komc:cursor-default`,`komc:transition-opacity komc:duration-300 komc:ease-in-out`,`komc:opacity-0 komc:data-[state=open]:opacity-100`),onClick:g,"aria-label":`close sheet`}),(0,o.jsx)(`div`,{"data-state":p?`open`:`closed`,className:(0,i.default)(T({direction:n,className:l}),E({direction:n,size:s})),role:`dialog`,"aria-modal":`true`,children:c})]}):null}function O({children:e,setOpen:t}){return(0,o.jsx)(`div`,{"data-komc":!0,className:(0,i.default)(`komc:inline-flex komc:shrink-0 komc:justify-center`,`komc:items-center komc:outline-none`),onMouseLeave:()=>t(!1),onMouseOver:()=>t(!0),onFocus:()=>t(!0),onBlur:()=>t(!1),onClick:()=>t(!0),children:e})}const k=(0,s.cva)(t.y(`komc:z-99 komc:w-max komc:max-w-70 komc:p-2 komc:rounded-md`,`komc:break-all komc:transition-opacity komc:duration-300 komc:bg-white`,`komc:drop-shadow-[0px_0.5px_3px_rgba(0,0,0,0.2)] komc:text-xs`),{variants:{portal:{true:`komc:fixed`,false:`komc:absolute`},placement:{top:``,bottom:``,"top-start":``,"top-end":``,"bottom-start":``,"bottom-end":``}},compoundVariants:[{portal:!0,placement:`top`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom`,className:`komc:translate-y-2`},{portal:!0,placement:`top-start`,className:`komc:-translate-y-2`},{portal:!0,placement:`top-end`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom-start`,className:`komc:translate-y-2`},{portal:!0,placement:`bottom-end`,className:`komc:translate-y-2`},{portal:!1,placement:`top`,className:`komc:bottom-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`bottom`,className:`komc:top-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`top-start`,className:`komc:bottom-full komc:left-0`},{portal:!1,placement:`top-end`,className:`komc:bottom-full komc:right-0`},{portal:!1,placement:`bottom-start`,className:`komc:top-full komc:left-0`},{portal:!1,placement:`bottom-end`,className:`komc:top-full komc:right-0`}],defaultVariants:{placement:`top`,portal:!1}}),A=(0,a.forwardRef)(({portal:e,children:t,className:n,placement:r,...i},a)=>(0,o.jsx)(`div`,{ref:a,"data-komc":!0,role:`tooltip`,className:k({portal:e,placement:r,className:n}),...i,children:t}));var j=A;const M=(0,s.cva)(t.y(`komc:absolute komc:w-2 komc:h-2 komc:bg-inherit`,`komc:transition-opacity komc:duration-300`),{variants:{placement:{top:t.y(`komc:top-full komc:-mt-1 komc:left-1/2`),bottom:t.y(`komc:bottom-full komc:-mb-1 komc:left-1/2`),"top-start":t.y(`komc:top-full komc:-mt-1 komc:left-5`),"top-end":t.y(`komc:top-full komc:-mt-1 komc:right-5`),"bottom-start":t.y(`komc:bottom-full komc:-mb-1 komc:left-5`),"bottom-end":t.y(`komc:bottom-full komc:-mb-1 komc:right-5`)}},defaultVariants:{placement:`top`}}),N=({placement:e,className:t,offset:n,style:r,...i})=>{let s=(0,a.useMemo)(()=>{switch(e){case`top`:case`top-start`:case`top-end`:return`rotate(45deg)`;case`bottom`:case`bottom-start`:case`bottom-end`:return`rotate(225deg)`;default:return`rotate(45deg)`}},[e]);return(0,o.jsx)(`div`,{className:M({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${s}`},...i})};var P=N;const F=24,I=2,L=180,R=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function z({placement:e,className:t,content:n,open:r,hiddenRef:s,containerRef:c}){let[u,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(e),[m,h]=(0,a.useState)({top:0,left:0}),[g,_]=(0,a.useState)({x:0,y:0});(0,a.useEffect)(()=>{d(!0)},[]);let v=(0,a.useCallback)(()=>{let t=c.current,n=s.current;if(!t||!n)return;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=e,[o]=a.split(`-`),l=r.top,u=window.innerHeight-r.bottom;o===`bottom`&&u<i.height&&l>=i.height?a=R(a,`top`):o===`top`&&l<i.height&&u>=i.height&&(a=R(a,`bottom`)),p(a);let[d,f]=a.split(`-`),m=r.top,g=r.left+r.width/2-i.width/2;switch(d){case`top`:m-=i.height;break;case`bottom`:m+=r.height;break}switch(f){case`start`:g+=i.width/2-24;break;case`end`:g-=i.width/2-24;break}let v=g,y=window.innerWidth;v+i.width>y-4&&(v=y-i.width-4),v<4&&(v=4),h({top:m,left:v}),_({x:g-v,y:0})},[e,c,s]);return(0,a.useEffect)(()=>{if(!u||!r)return;console.log(`updateLayout`);let e=!1,t=0,n=0,i=!1;v();let a=()=>{i||=(t=requestAnimationFrame(()=>{e||v(),i=!1}),!0)};window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a);let o=0,s=0,l=``,d=()=>{if(e||o>=180)return;let t=c.current;if(t){let e=t.getBoundingClientRect(),n=`${e.top.toFixed(4)},${e.left.toFixed(4)},${e.width.toFixed(4)},${e.height.toFixed(4)}`;n===l?s+=1:(s=0,l=n,v())}s<2&&(o+=1,n=requestAnimationFrame(d))};return n=requestAnimationFrame(d),()=>{e=!0,cancelAnimationFrame(t),cancelAnimationFrame(n),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a)}},[u,r,v,c]),u?(0,l.createPortal)((0,o.jsxs)(j,{portal:!0,"data-komc":!0,placement:f,className:(0,i.default)(t,r?`komc:visible komc:opacity-100`:`komc:opacity-0 komc:invisible`),style:{...m},children:[(0,o.jsx)(`span`,{children:n}),(0,o.jsx)(P,{placement:f,offset:g})]}),document.body):null}const B=(0,a.forwardRef)(({children:e,content:t,defaultOpen:n=!1,className:s,placement:c=`top`},l)=>{let[u,d]=(0,a.useState)(n),f=(0,a.useRef)(null),p=(0,a.useRef)(null);return r.o({ref:f,setOpen:d}),(0,o.jsxs)(`div`,{ref:f,"data-komc":!0,className:`komc:flex komc:shrink-0 komc:relative komc:overflow-hidden komc:w-fit komc:h-fit`,children:[(0,o.jsx)(O,{setOpen:d,children:e}),(0,o.jsx)(z,{placement:c,className:s,open:u,content:t,hiddenRef:p,containerRef:f}),(0,o.jsx)(j,{ref:p,role:`presentation`,"aria-hidden":`true`,placement:c,className:(0,i.default)(`komc:opacity-0 komc:invisible`,s),children:(0,o.jsx)(`span`,{children:t})})]})});var V=B;exports.BaseImage=x,exports.Carousel=f,exports.CarouselDot=_,exports.CarouselItem=m,exports.CarouselNext=g,exports.CarouselPrevious=h,exports.CarouselWrapper=p,exports.Dialog=y,exports.EmptyNode=C,exports.Image=w,exports.Sheet=D,exports.Tooltip=V;
|
|
1
|
+
const e=require(`../chunk-Bmb41Sf3.cjs`);require(`../src-CjpmdVyv.cjs`);const t=require(`../util-o7fjt7iK.cjs`),n=require(`../skeleton-g6yXh6D9.cjs`),r=require(`../hooks-DqgWx1Fa.cjs`);require(`../providers-BNK8Fisc.cjs`);let i=require(`clsx`);i=e.t(i);let a=require(`react`);a=e.t(a);let o=require(`react/jsx-runtime`),s=require(`class-variance-authority`),c=require(`embla-carousel-react`);c=e.t(c);let l=require(`react-dom`);const u=a.default.createContext(null);function d(){let e=a.default.useContext(u);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}function f({orientation:e=`horizontal`,options:n,setApi:r,plugins:i,className:s,children:l,...d}){let[f,p]=(0,c.default)({...n,axis:e===`horizontal`?`x`:`y`},i),[m,h]=(0,a.useState)(!1),[g,_]=(0,a.useState)(!1),[v,y]=(0,a.useState)(0),[b,x]=(0,a.useState)(0),S=(0,a.useCallback)(e=>{e&&(h(e.canScrollPrev()),_(e.canScrollNext()),x(e.selectedScrollSnap()))},[]),C=(0,a.useCallback)(()=>{p?.scrollPrev()},[p]),w=(0,a.useCallback)(()=>{p?.scrollNext()},[p]),T=(0,a.useCallback)(e=>{p?.scrollTo(e)},[p]),E=(0,a.useCallback)(()=>{y(p?.scrollSnapList().length||0)},[p]),D=(0,a.useCallback)(t=>{e===`horizontal`?t.key===`ArrowLeft`?(t.preventDefault(),C()):t.key===`ArrowRight`&&(t.preventDefault(),w()):t.key===`ArrowUp`?(t.preventDefault(),C()):t.key===`ArrowDown`&&(t.preventDefault(),w())},[C,w,e]);return(0,a.useEffect)(()=>{!p||!r||r(p)},[p,r]),(0,a.useEffect)(()=>{if(p)return S(p),E(),p.on(`reInit`,E),p.on(`reInit`,S),p.on(`select`,S),()=>{p?.off(`select`,S)}},[p,S]),(0,o.jsx)(u.Provider,{value:{carouselRef:f,api:p,options:n,orientation:e||(n?.axis===`y`?`vertical`:`horizontal`),scrollPrev:C,scrollNext:w,canScrollPrev:m,canScrollNext:g,scrollTo:T,dots:v,selectedScrollSnap:b},children:(0,o.jsx)(`div`,{"data-komc":!0,role:`region`,"aria-label":`carousel`,"aria-roledescription":`carousel`,tabIndex:0,onKeyDownCapture:D,className:t.y(`komc:relative`,s),...d,children:l})})}function p({children:e,className:n,...r}){let{carouselRef:i}=d();return(0,o.jsx)(`div`,{ref:i,"data-komc":!0,className:t.y(`komc:h-full komc:overflow-hidden`,n),...r,children:e})}function m({className:e,...n}){let{orientation:r}=d();return(0,o.jsx)(`div`,{className:t.y(`komc:flex komc:h-full`,r===`horizontal`?`komc:-ml-4`:`komc:-mt-4 komc:flex-col`,e),...n})}function h({className:e,...n}){let{orientation:r}=d();return(0,o.jsx)(`div`,{"data-komc":!0,className:t.y(`komc:min-w-0 komc:shrink-0 komc:grow-0 komc:basis-full`,r===`horizontal`?`komc:pl-4`:`komc:pt-4`,e),...n})}function g({children:e,className:t,...n}){let{scrollPrev:r,canScrollPrev:a}=d();return(0,o.jsx)(`button`,{type:`button`,"data-komc":!0,disabled:!a,"aria-label":`previous slide`,className:(0,i.default)(`komc:w-full`,t),onClick:r,...n,children:e})}function _({children:e,className:t,...n}){let{scrollNext:r,canScrollNext:a}=d();return(0,o.jsx)(`button`,{type:`button`,"data-komc":!0,disabled:!a,"aria-label":`next slide`,className:(0,i.default)(`komc:w-full`,t),onClick:r,...n,children:e})}function v({children:e,...t}){let{dots:n,selectedScrollSnap:r,scrollTo:i}=d();return(0,o.jsx)(o.Fragment,{children:Array.from({length:n}).map((n,a)=>(0,o.jsx)(`button`,{type:`button`,"data-komc":!0,"data-selected":r===a,"aria-label":`go to slide ${a+1}`,onClick:()=>i(a),...t,children:e?.(a)},a))})}function y({index:e,children:t,...n}){let{selectedScrollSnap:r,scrollTo:i}=d();return(0,o.jsx)(`button`,{type:`button`,"data-komc":!0,"data-selected":r===e,"aria-label":`go to slide ${e+1}`,onClick:()=>i(e),...n,children:t})}const b=(0,s.cva)(`komc:relative komc:z-10 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden komc:w-full komc:max-h-full komc:min-w-0 komc:transition-all komc:duration-300 komc:ease-in-out`,{variants:{padding:{sm:`komc:p-2`,md:`komc:p-4`,lg:`komc:p-6`,none:`komc:p-0`},maxWidth:{sm:`komc:max-w-sm`,md:`komc:max-w-md`,lg:`komc:max-w-lg`,xl:`komc:max-w-xl`,"2xl":`komc:max-w-2xl`,full:`komc:max-w-full`}},defaultVariants:{padding:`sm`,maxWidth:`md`}});function x({closeOnBackdropClick:e=!0,isOpen:t,zIndex:n=1e4,padding:i,maxWidth:s,className:c,onClose:l,children:u,...d}){let f=r.c(t,300),[p,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(t&&f){let e=setTimeout(()=>m(!0),10);return()=>clearTimeout(e)}else t||m(!1)},[t,f]);let h=(0,a.useCallback)(e=>{e.key===`Escape`&&l()},[l]),g=(0,a.useCallback)(()=>{e&&l()},[e,l]);return(0,a.useEffect)(()=>(t?(document.addEventListener(`keydown`,h),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,h),document.body.style.overflow=`unset`}),[t,h]),f?(0,o.jsx)(`div`,{"data-komc":!0,className:`komc:fixed komc:inset-0 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden`,style:{zIndex:n},children:(0,o.jsxs)(`div`,{className:`komc:relative komc:flex komc:min-h-0 komc:flex-1 komc:w-full komc:items-center komc:justify-center`,children:[(0,o.jsx)(`button`,{type:`button`,"data-state":p?`open`:`closed`,className:`komc:fixed komc:inset-0 komc:z-0 komc:cursor-default komc:bg-black/50 komc:transition-opacity komc:duration-300 komc:ease-in-out komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100`,onClick:g,"aria-label":`close dialog`}),(0,o.jsx)(`div`,{"data-state":p?`open`:`closed`,className:`${b({padding:i,maxWidth:s,className:c})} komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100 komc:data-[state=closed]:scale-95 komc:data-[state=open]:scale-100`,role:`dialog`,"aria-modal":`true`,...d,children:u})]})}):null}const S=(0,s.cva)(``,{variants:{fill:{true:`komc:w-full komc:h-full komc:absolute komc:inset-0`,false:``}},defaultVariants:{fill:!1}}),C=(0,a.forwardRef)(({...e},t)=>{let{ref:n,imageProps:i}=r.r({ref:t,...e});return(0,o.jsx)(`img`,{ref:n,...i})}),w=(0,a.forwardRef)(({skeleton:e=!0,layout:t=`stretch`,fallbackSrc:a,className:s,emptyNode:c,emptyNodeClassName:l,skeletonClassName:u,...d},f)=>{let{ref:p,isLoad:m,isError:h,imageProps:g}=r.r({ref:f,fallbackSrc:a,forceLoad:!e,...d}),_=!d.fill&&t===`intrinsic`?{width:`${d.width}px`,height:`${d.height}px`}:void 0,v=(0,i.default)(`komc:flex komc:justify-center komc:items-center komc:relative komc:min-h-0`,!d.fill&&t===`stretch`&&`komc:w-full komc:h-full`);return!a&&h&&c?d.fill?(0,o.jsx)(T,{className:l,children:c}):(0,o.jsx)(`div`,{"data-komc":!0,style:_,className:v,children:(0,o.jsx)(T,{className:l,children:c})}):d.fill?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`img`,{ref:p,...g,className:(0,i.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:invisible`:`komc:visible`,s)}),(0,o.jsx)(`div`,{"data-komc":!0,className:(0,i.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:block`:`komc:hidden`),children:(0,o.jsx)(n.t,{size:`full`,className:u})})]}):(0,o.jsxs)(`div`,{"data-komc":!0,style:_,className:v,children:[(0,o.jsx)(`img`,{ref:p,...g,className:(0,i.default)(S({fill:d.fill,className:s}),e&&!m?`komc:invisible`:`komc:visible`)}),(0,o.jsx)(`div`,{className:(0,i.default)(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!m?`komc:block`:`komc:hidden`),children:(0,o.jsx)(n.t,{size:`full`,className:u})})]})}),T=({children:e,className:t})=>(0,o.jsx)(`div`,{"data-komc":!0,role:`alert`,className:(0,i.default)(`komc:flex komc:justify-center komc:items-center komc:w-full komc:h-full komc:bg-gray-100 komc:absolute komc:inset-0 komc:p-1`,t),children:e});var E=w;const D=(0,s.cva)((0,i.default)(`komc:absolute komc:bg-white komc:flex komc:flex-col komc:shadow-2xl`,`komc:transition-transform komc:duration-300 komc:ease-in-out`),{variants:{direction:{top:`komc:top-0 komc:left-0 komc:right-0 komc:-translate-y-full komc:data-[state=open]:translate-y-0`,bottom:`komc:bottom-0 komc:left-0 komc:right-0 komc:translate-y-full komc:data-[state=open]:translate-y-0`,left:`komc:top-0 komc:bottom-0 komc:left-0 komc:-translate-x-full komc:data-[state=open]:translate-x-0`,right:`komc:top-0 komc:bottom-0 komc:right-0 komc:translate-x-full komc:data-[state=open]:translate-x-0`}}}),O=(0,s.cva)(``,{variants:{size:{full:``,half:``,auto:``},direction:{top:``,bottom:``,left:``,right:``}},compoundVariants:[{size:`full`,direction:`top`,className:`komc:h-full`},{size:`full`,direction:`bottom`,className:`komc:h-full`},{size:`full`,direction:`left`,className:`komc:w-full`},{size:`full`,direction:`right`,className:`komc:w-full`},{size:`half`,direction:`top`,className:`komc:h-[50dvh]`},{size:`half`,direction:`bottom`,className:`komc:h-[50dvh]`},{size:`half`,direction:`left`,className:`komc:w-[50dvw]`},{size:`half`,direction:`right`,className:`komc:w-[50dvw]`},{size:`auto`,direction:`top`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`bottom`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`left`,className:`komc:w-auto komc:max-w-[90dvw]`},{size:`auto`,direction:`right`,className:`komc:w-auto komc:max-w-[90dvw]`}]});function k({isOpen:e,onClose:t,direction:n=`bottom`,size:s=`full`,children:c,className:l,closeOnBackdropClick:u=!0,zIndex:d=1001}){let f=r.c(e,300),[p,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(e&&f){let e=setTimeout(()=>m(!0),10);return()=>clearTimeout(e)}else e||m(!1)},[e,f]);let h=(0,a.useCallback)(e=>{e.key===`Escape`&&t()},[t]),g=(0,a.useCallback)(()=>{u&&t()},[u,t]);return(0,a.useEffect)(()=>(e?(document.addEventListener(`keydown`,h),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,h),document.body.style.overflow=`unset`}),[e,h]),f?(0,o.jsxs)(`div`,{className:`komc:fixed komc:inset-0 komc:flex komc:justify-center komc:items-center`,style:{zIndex:d},children:[(0,o.jsx)(`button`,{type:`button`,"data-state":p?`open`:`closed`,className:(0,i.default)(`komc:absolute komc:inset-0 komc:w-full komc:h-full komc:bg-black/40 komc:cursor-default`,`komc:transition-opacity komc:duration-300 komc:ease-in-out`,`komc:opacity-0 komc:data-[state=open]:opacity-100`),onClick:g,"aria-label":`close sheet`}),(0,o.jsx)(`div`,{"data-state":p?`open`:`closed`,className:(0,i.default)(D({direction:n,className:l}),O({direction:n,size:s})),role:`dialog`,"aria-modal":`true`,children:c})]}):null}function A({children:e,setOpen:t}){return(0,o.jsx)(`div`,{"data-komc":!0,className:(0,i.default)(`komc:inline-flex komc:shrink-0 komc:justify-center`,`komc:items-center komc:outline-none`),onMouseLeave:()=>t(!1),onMouseOver:()=>t(!0),onFocus:()=>t(!0),onBlur:()=>t(!1),onClick:()=>t(!0),children:e})}const j=(0,s.cva)(t.y(`komc:z-99 komc:w-max komc:max-w-70 komc:p-2 komc:rounded-md`,`komc:break-all komc:transition-opacity komc:duration-300 komc:bg-white`,`komc:drop-shadow-[0px_0.5px_3px_rgba(0,0,0,0.2)] komc:text-xs`),{variants:{portal:{true:`komc:fixed`,false:`komc:absolute`},placement:{top:``,bottom:``,"top-start":``,"top-end":``,"bottom-start":``,"bottom-end":``}},compoundVariants:[{portal:!0,placement:`top`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom`,className:`komc:translate-y-2`},{portal:!0,placement:`top-start`,className:`komc:-translate-y-2`},{portal:!0,placement:`top-end`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom-start`,className:`komc:translate-y-2`},{portal:!0,placement:`bottom-end`,className:`komc:translate-y-2`},{portal:!1,placement:`top`,className:`komc:bottom-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`bottom`,className:`komc:top-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`top-start`,className:`komc:bottom-full komc:left-0`},{portal:!1,placement:`top-end`,className:`komc:bottom-full komc:right-0`},{portal:!1,placement:`bottom-start`,className:`komc:top-full komc:left-0`},{portal:!1,placement:`bottom-end`,className:`komc:top-full komc:right-0`}],defaultVariants:{placement:`top`,portal:!1}}),M=(0,a.forwardRef)(({portal:e,children:t,className:n,placement:r,...i},a)=>(0,o.jsx)(`div`,{ref:a,"data-komc":!0,role:`tooltip`,className:j({portal:e,placement:r,className:n}),...i,children:t}));var N=M;const P=(0,s.cva)(t.y(`komc:absolute komc:w-2 komc:h-2 komc:bg-inherit`,`komc:transition-opacity komc:duration-300`),{variants:{placement:{top:t.y(`komc:top-full komc:-mt-1 komc:left-1/2`),bottom:t.y(`komc:bottom-full komc:-mb-1 komc:left-1/2`),"top-start":t.y(`komc:top-full komc:-mt-1 komc:left-5`),"top-end":t.y(`komc:top-full komc:-mt-1 komc:right-5`),"bottom-start":t.y(`komc:bottom-full komc:-mb-1 komc:left-5`),"bottom-end":t.y(`komc:bottom-full komc:-mb-1 komc:right-5`)}},defaultVariants:{placement:`top`}}),F=({placement:e,className:t,offset:n,style:r,...i})=>{let s=(0,a.useMemo)(()=>{switch(e){case`top`:case`top-start`:case`top-end`:return`rotate(45deg)`;case`bottom`:case`bottom-start`:case`bottom-end`:return`rotate(225deg)`;default:return`rotate(45deg)`}},[e]);return(0,o.jsx)(`div`,{className:P({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${s}`},...i})};var I=F;const L=24,R=2,z=180,B=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function V({placement:e,className:t,content:n,open:r,hiddenRef:s,containerRef:c}){let[u,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(e),[m,h]=(0,a.useState)({top:0,left:0}),[g,_]=(0,a.useState)({x:0,y:0});(0,a.useEffect)(()=>{d(!0)},[]);let v=(0,a.useCallback)(()=>{let t=c.current,n=s.current;if(!t||!n)return;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=e,[o]=a.split(`-`),l=r.top,u=window.innerHeight-r.bottom;o===`bottom`&&u<i.height&&l>=i.height?a=B(a,`top`):o===`top`&&l<i.height&&u>=i.height&&(a=B(a,`bottom`)),p(a);let[d,f]=a.split(`-`),m=r.top,g=r.left+r.width/2-i.width/2;switch(d){case`top`:m-=i.height;break;case`bottom`:m+=r.height;break}switch(f){case`start`:g+=i.width/2-24;break;case`end`:g-=i.width/2-24;break}let v=g,y=window.innerWidth;v+i.width>y-4&&(v=y-i.width-4),v<4&&(v=4),h({top:m,left:v}),_({x:g-v,y:0})},[e,c,s]);return(0,a.useEffect)(()=>{if(!u||!r)return;console.log(`updateLayout`);let e=!1,t=0,n=0,i=!1;v();let a=()=>{i||=(t=requestAnimationFrame(()=>{e||v(),i=!1}),!0)};window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a);let o=0,s=0,l=``,d=()=>{if(e||o>=180)return;let t=c.current;if(t){let e=t.getBoundingClientRect(),n=`${e.top.toFixed(4)},${e.left.toFixed(4)},${e.width.toFixed(4)},${e.height.toFixed(4)}`;n===l?s+=1:(s=0,l=n,v())}s<2&&(o+=1,n=requestAnimationFrame(d))};return n=requestAnimationFrame(d),()=>{e=!0,cancelAnimationFrame(t),cancelAnimationFrame(n),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a)}},[u,r,v,c]),u?(0,l.createPortal)((0,o.jsxs)(N,{portal:!0,"data-komc":!0,placement:f,className:(0,i.default)(t,r?`komc:visible komc:opacity-100`:`komc:opacity-0 komc:invisible`),style:{...m},children:[(0,o.jsx)(`span`,{children:n}),(0,o.jsx)(I,{placement:f,offset:g})]}),document.body):null}const H=(0,a.forwardRef)(({children:e,content:t,defaultOpen:n=!1,className:s,placement:c=`top`},l)=>{let[u,d]=(0,a.useState)(n),f=(0,a.useRef)(null),p=(0,a.useRef)(null);return r.o({ref:f,setOpen:d}),(0,o.jsxs)(`div`,{ref:f,"data-komc":!0,className:`komc:flex komc:shrink-0 komc:relative komc:overflow-hidden komc:w-fit komc:h-fit`,children:[(0,o.jsx)(A,{setOpen:d,children:e}),(0,o.jsx)(V,{placement:c,className:s,open:u,content:t,hiddenRef:p,containerRef:f}),(0,o.jsx)(N,{ref:p,role:`presentation`,"aria-hidden":`true`,placement:c,className:(0,i.default)(`komc:opacity-0 komc:invisible`,s),children:(0,o.jsx)(`span`,{children:t})})]})});var U=H;exports.BaseImage=C,exports.Carousel=f,exports.CarouselDot=y,exports.CarouselDots=v,exports.CarouselItem=h,exports.CarouselNext=_,exports.CarouselPrevious=g,exports.CarouselViewport=p,exports.CarouselWrapper=m,exports.Dialog=x,exports.EmptyNode=T,exports.Image=E,exports.Sheet=k,exports.Tooltip=U;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as UseSubsetImageProps, n as BaseProps } from "../index-ComhjQ-q.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react6 from "react";
|
|
3
3
|
import React$1, { ComponentProps, HTMLAttributes, ReactNode } from "react";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
5
5
|
import useEmblaCarousel, { UseEmblaCarouselType } from "embla-carousel-react";
|
|
6
|
-
import * as
|
|
6
|
+
import * as class_variance_authority_types1 from "class-variance-authority/types";
|
|
7
7
|
import { VariantProps } from "class-variance-authority";
|
|
8
8
|
|
|
9
9
|
//#region src/ui-client/carousel/carousel-context.d.ts
|
|
@@ -44,47 +44,63 @@ declare function Carousel({
|
|
|
44
44
|
className,
|
|
45
45
|
children,
|
|
46
46
|
...props
|
|
47
|
-
}: CarouselProps$1):
|
|
47
|
+
}: CarouselProps$1): react_jsx_runtime2.JSX.Element;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/ui-client/carousel/carousel-viewport.d.ts
|
|
50
|
+
declare function CarouselViewport({
|
|
51
|
+
children,
|
|
52
|
+
className,
|
|
53
|
+
...props
|
|
54
|
+
}: React$1.ComponentProps<'div'>): react_jsx_runtime2.JSX.Element;
|
|
48
55
|
//#endregion
|
|
49
56
|
//#region src/ui-client/carousel/carousel-wrapper.d.ts
|
|
50
57
|
declare function CarouselWrapper({
|
|
51
58
|
className,
|
|
52
59
|
...props
|
|
53
|
-
}: React$1.ComponentProps<'div'>):
|
|
60
|
+
}: React$1.ComponentProps<'div'>): react_jsx_runtime2.JSX.Element;
|
|
54
61
|
//#endregion
|
|
55
62
|
//#region src/ui-client/carousel/carousel-item.d.ts
|
|
56
63
|
declare function CarouselItem({
|
|
57
64
|
className,
|
|
58
65
|
...props
|
|
59
|
-
}: React$1.ComponentProps<'div'>):
|
|
66
|
+
}: React$1.ComponentProps<'div'>): react_jsx_runtime2.JSX.Element;
|
|
60
67
|
//#endregion
|
|
61
68
|
//#region src/ui-client/carousel/carousel-previous.d.ts
|
|
62
69
|
declare function CarouselPrevious({
|
|
63
70
|
children,
|
|
64
71
|
className,
|
|
65
72
|
...props
|
|
66
|
-
}: React$1.ComponentProps<'button'>):
|
|
73
|
+
}: React$1.ComponentProps<'button'>): react_jsx_runtime2.JSX.Element;
|
|
67
74
|
//#endregion
|
|
68
75
|
//#region src/ui-client/carousel/carousel-next.d.ts
|
|
69
76
|
declare function CarouselNext({
|
|
70
77
|
children,
|
|
71
78
|
className,
|
|
72
79
|
...props
|
|
73
|
-
}: React$1.ComponentProps<'button'>):
|
|
80
|
+
}: React$1.ComponentProps<'button'>): react_jsx_runtime2.JSX.Element;
|
|
74
81
|
//#endregion
|
|
75
|
-
//#region src/ui-client/carousel/carousel-
|
|
76
|
-
declare function
|
|
82
|
+
//#region src/ui-client/carousel/carousel-dots.d.ts
|
|
83
|
+
declare function CarouselDots$1({
|
|
77
84
|
children,
|
|
78
85
|
...props
|
|
79
86
|
}: Omit<React$1.ComponentProps<'button'>, 'children'> & {
|
|
80
|
-
children
|
|
81
|
-
}):
|
|
87
|
+
children?: (index: number) => React$1.ReactNode;
|
|
88
|
+
}): react_jsx_runtime2.JSX.Element;
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/ui-client/carousel/carousel-dot.d.ts
|
|
91
|
+
declare function CarouselDots({
|
|
92
|
+
index,
|
|
93
|
+
children,
|
|
94
|
+
...props
|
|
95
|
+
}: React$1.ComponentProps<'button'> & {
|
|
96
|
+
index: number;
|
|
97
|
+
}): react_jsx_runtime2.JSX.Element;
|
|
82
98
|
//#endregion
|
|
83
99
|
//#region src/ui-client/dialog/dialog.d.ts
|
|
84
100
|
declare const classes: (props?: ({
|
|
85
101
|
padding?: "none" | "sm" | "md" | "lg" | null | undefined;
|
|
86
102
|
maxWidth?: "sm" | "md" | "lg" | "xl" | "2xl" | "full" | null | undefined;
|
|
87
|
-
} &
|
|
103
|
+
} & class_variance_authority_types1.ClassProp) | undefined) => string;
|
|
88
104
|
interface DialogProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof classes> {
|
|
89
105
|
closeOnBackdropClick?: boolean;
|
|
90
106
|
isOpen: boolean;
|
|
@@ -102,7 +118,7 @@ declare function Dialog({
|
|
|
102
118
|
onClose,
|
|
103
119
|
children,
|
|
104
120
|
...rest
|
|
105
|
-
}: DialogProps):
|
|
121
|
+
}: DialogProps): react_jsx_runtime2.JSX.Element | null;
|
|
106
122
|
//#endregion
|
|
107
123
|
//#region src/ui-client/image/image.d.ts
|
|
108
124
|
type ImageSubsetProps = {
|
|
@@ -113,7 +129,7 @@ type ImageSubsetProps = {
|
|
|
113
129
|
skeletonClassName?: string;
|
|
114
130
|
};
|
|
115
131
|
type ImageProps = UseSubsetImageProps & ImageSubsetProps;
|
|
116
|
-
declare const BaseImage:
|
|
132
|
+
declare const BaseImage: react6.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
117
133
|
fill: true;
|
|
118
134
|
sizes: string;
|
|
119
135
|
width?: never;
|
|
@@ -123,8 +139,8 @@ declare const BaseImage: react14.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
|
123
139
|
sizes?: never;
|
|
124
140
|
width: number;
|
|
125
141
|
height: number;
|
|
126
|
-
}, "ref">) &
|
|
127
|
-
declare const Image:
|
|
142
|
+
}, "ref">) & react6.RefAttributes<HTMLImageElement>>;
|
|
143
|
+
declare const Image: react6.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
128
144
|
fill: true;
|
|
129
145
|
sizes: string;
|
|
130
146
|
width?: never;
|
|
@@ -134,7 +150,7 @@ declare const Image: react14.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
|
134
150
|
sizes?: never;
|
|
135
151
|
width: number;
|
|
136
152
|
height: number;
|
|
137
|
-
} & ImageSubsetProps, "ref">) &
|
|
153
|
+
} & ImageSubsetProps, "ref">) & react6.RefAttributes<HTMLImageElement>>;
|
|
138
154
|
interface EmptyNodeProps {
|
|
139
155
|
children: React.ReactNode;
|
|
140
156
|
className?: string;
|
|
@@ -142,7 +158,7 @@ interface EmptyNodeProps {
|
|
|
142
158
|
declare const EmptyNode: ({
|
|
143
159
|
children,
|
|
144
160
|
className
|
|
145
|
-
}: EmptyNodeProps) =>
|
|
161
|
+
}: EmptyNodeProps) => react_jsx_runtime2.JSX.Element;
|
|
146
162
|
//#endregion
|
|
147
163
|
//#region src/ui-client/sheet/sheet.d.ts
|
|
148
164
|
type Direction = 'top' | 'bottom' | 'left' | 'right';
|
|
@@ -166,7 +182,7 @@ declare function Sheet({
|
|
|
166
182
|
className,
|
|
167
183
|
closeOnBackdropClick,
|
|
168
184
|
zIndex
|
|
169
|
-
}: SheetProps):
|
|
185
|
+
}: SheetProps): react_jsx_runtime2.JSX.Element | null;
|
|
170
186
|
//#endregion
|
|
171
187
|
//#region src/ui-client/tooltip/tooltip-container.d.ts
|
|
172
188
|
type SubPlacement = 'start' | 'end';
|
|
@@ -178,6 +194,6 @@ interface TooltipContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
178
194
|
placement?: TooltipPlacement;
|
|
179
195
|
defaultOpen?: boolean;
|
|
180
196
|
}
|
|
181
|
-
declare const TooltipContainer:
|
|
197
|
+
declare const TooltipContainer: react6.ForwardRefExoticComponent<TooltipContainerProps & react6.RefAttributes<HTMLDivElement>>;
|
|
182
198
|
//#endregion
|
|
183
|
-
export { BaseImage, Carousel, type CarouselApi, type CarouselContextProps, CarouselDot, CarouselItem, CarouselNext, type CarouselOptions, type CarouselPlugin, CarouselPrevious, type CarouselProps, CarouselWrapper, Dialog, type DialogProps, EmptyNode, type EmptyNodeProps, Image, type ImageProps, type ImageSubsetProps, Sheet, type SheetProps, TooltipContainer as Tooltip, type TooltipContainerProps as TooltipProps };
|
|
199
|
+
export { BaseImage, Carousel, type CarouselApi, type CarouselContextProps, CarouselDots as CarouselDot, CarouselDots$1 as CarouselDots, CarouselItem, CarouselNext, type CarouselOptions, type CarouselPlugin, CarouselPrevious, type CarouselProps, CarouselViewport, CarouselWrapper, Dialog, type DialogProps, EmptyNode, type EmptyNodeProps, Image, type ImageProps, type ImageSubsetProps, Sheet, type SheetProps, TooltipContainer as Tooltip, type TooltipContainerProps as TooltipProps };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as UseSubsetImageProps, n as BaseProps } from "../index-ByfkW7VU.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react14 from "react";
|
|
3
3
|
import React$1, { ComponentProps, HTMLAttributes, ReactNode } from "react";
|
|
4
4
|
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
5
5
|
import { VariantProps } from "class-variance-authority";
|
|
6
6
|
import useEmblaCarousel, { UseEmblaCarouselType } from "embla-carousel-react";
|
|
7
|
-
import * as
|
|
7
|
+
import * as class_variance_authority_types2 from "class-variance-authority/types";
|
|
8
8
|
|
|
9
9
|
//#region src/ui-client/carousel/carousel-context.d.ts
|
|
10
10
|
type CarouselApi = UseEmblaCarouselType[1];
|
|
@@ -46,6 +46,13 @@ declare function Carousel({
|
|
|
46
46
|
...props
|
|
47
47
|
}: CarouselProps$1): react_jsx_runtime5.JSX.Element;
|
|
48
48
|
//#endregion
|
|
49
|
+
//#region src/ui-client/carousel/carousel-viewport.d.ts
|
|
50
|
+
declare function CarouselViewport({
|
|
51
|
+
children,
|
|
52
|
+
className,
|
|
53
|
+
...props
|
|
54
|
+
}: React$1.ComponentProps<'div'>): react_jsx_runtime5.JSX.Element;
|
|
55
|
+
//#endregion
|
|
49
56
|
//#region src/ui-client/carousel/carousel-wrapper.d.ts
|
|
50
57
|
declare function CarouselWrapper({
|
|
51
58
|
className,
|
|
@@ -72,19 +79,28 @@ declare function CarouselNext({
|
|
|
72
79
|
...props
|
|
73
80
|
}: React$1.ComponentProps<'button'>): react_jsx_runtime5.JSX.Element;
|
|
74
81
|
//#endregion
|
|
75
|
-
//#region src/ui-client/carousel/carousel-
|
|
76
|
-
declare function
|
|
82
|
+
//#region src/ui-client/carousel/carousel-dots.d.ts
|
|
83
|
+
declare function CarouselDots$1({
|
|
77
84
|
children,
|
|
78
85
|
...props
|
|
79
86
|
}: Omit<React$1.ComponentProps<'button'>, 'children'> & {
|
|
80
|
-
children
|
|
87
|
+
children?: (index: number) => React$1.ReactNode;
|
|
88
|
+
}): react_jsx_runtime5.JSX.Element;
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/ui-client/carousel/carousel-dot.d.ts
|
|
91
|
+
declare function CarouselDots({
|
|
92
|
+
index,
|
|
93
|
+
children,
|
|
94
|
+
...props
|
|
95
|
+
}: React$1.ComponentProps<'button'> & {
|
|
96
|
+
index: number;
|
|
81
97
|
}): react_jsx_runtime5.JSX.Element;
|
|
82
98
|
//#endregion
|
|
83
99
|
//#region src/ui-client/dialog/dialog.d.ts
|
|
84
100
|
declare const classes: (props?: ({
|
|
85
101
|
padding?: "none" | "sm" | "md" | "lg" | null | undefined;
|
|
86
102
|
maxWidth?: "sm" | "md" | "lg" | "xl" | "2xl" | "full" | null | undefined;
|
|
87
|
-
} &
|
|
103
|
+
} & class_variance_authority_types2.ClassProp) | undefined) => string;
|
|
88
104
|
interface DialogProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof classes> {
|
|
89
105
|
closeOnBackdropClick?: boolean;
|
|
90
106
|
isOpen: boolean;
|
|
@@ -113,7 +129,7 @@ type ImageSubsetProps = {
|
|
|
113
129
|
skeletonClassName?: string;
|
|
114
130
|
};
|
|
115
131
|
type ImageProps = UseSubsetImageProps & ImageSubsetProps;
|
|
116
|
-
declare const BaseImage:
|
|
132
|
+
declare const BaseImage: react14.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
117
133
|
fill: true;
|
|
118
134
|
sizes: string;
|
|
119
135
|
width?: never;
|
|
@@ -123,8 +139,8 @@ declare const BaseImage: react1.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
|
123
139
|
sizes?: never;
|
|
124
140
|
width: number;
|
|
125
141
|
height: number;
|
|
126
|
-
}, "ref">) &
|
|
127
|
-
declare const Image:
|
|
142
|
+
}, "ref">) & react14.RefAttributes<HTMLImageElement>>;
|
|
143
|
+
declare const Image: react14.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
128
144
|
fill: true;
|
|
129
145
|
sizes: string;
|
|
130
146
|
width?: never;
|
|
@@ -134,7 +150,7 @@ declare const Image: react1.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
|
134
150
|
sizes?: never;
|
|
135
151
|
width: number;
|
|
136
152
|
height: number;
|
|
137
|
-
} & ImageSubsetProps, "ref">) &
|
|
153
|
+
} & ImageSubsetProps, "ref">) & react14.RefAttributes<HTMLImageElement>>;
|
|
138
154
|
interface EmptyNodeProps {
|
|
139
155
|
children: React.ReactNode;
|
|
140
156
|
className?: string;
|
|
@@ -178,6 +194,6 @@ interface TooltipContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
178
194
|
placement?: TooltipPlacement;
|
|
179
195
|
defaultOpen?: boolean;
|
|
180
196
|
}
|
|
181
|
-
declare const TooltipContainer:
|
|
197
|
+
declare const TooltipContainer: react14.ForwardRefExoticComponent<TooltipContainerProps & react14.RefAttributes<HTMLDivElement>>;
|
|
182
198
|
//#endregion
|
|
183
|
-
export { BaseImage, Carousel, type CarouselApi, type CarouselContextProps, CarouselDot, CarouselItem, CarouselNext, type CarouselOptions, type CarouselPlugin, CarouselPrevious, type CarouselProps, CarouselWrapper, Dialog, type DialogProps, EmptyNode, type EmptyNodeProps, Image, type ImageProps, type ImageSubsetProps, Sheet, type SheetProps, TooltipContainer as Tooltip, type TooltipContainerProps as TooltipProps };
|
|
199
|
+
export { BaseImage, Carousel, type CarouselApi, type CarouselContextProps, CarouselDots as CarouselDot, CarouselDots$1 as CarouselDots, CarouselItem, CarouselNext, type CarouselOptions, type CarouselPlugin, CarouselPrevious, type CarouselProps, CarouselViewport, CarouselWrapper, Dialog, type DialogProps, EmptyNode, type EmptyNodeProps, Image, type ImageProps, type ImageSubsetProps, Sheet, type SheetProps, TooltipContainer as Tooltip, type TooltipContainerProps as TooltipProps };
|
package/dist/ui-client/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../src-C_FmOyer.mjs";import{y as e}from"../util-zXJA6Gnc.mjs";import{t}from"../skeleton-S6S1ZnCy.mjs";import{c as n,o as r,r as i}from"../hooks-DBo6LQrH.mjs";import"../providers-5JCPezAS.mjs";import a from"clsx";import o,{forwardRef as s,useCallback as c,useEffect as l,useMemo as u,useRef as d,useState as f}from"react";import{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";import{cva as g}from"class-variance-authority";import _ from"embla-carousel-react";import{createPortal as v}from"react-dom";const y=o.createContext(null);function b(){let e=o.useContext(y);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}function x({orientation:t=`horizontal`,options:n,setApi:r,plugins:i,className:a,children:o,...s}){let[u,d]=_({...n,axis:t===`horizontal`?`x`:`y`},i),[p,h]=f(!1),[g,v]=f(!1),[b,x]=f(0),[S,C]=f(0),w=c(e=>{e&&(h(e.canScrollPrev()),v(e.canScrollNext()),C(e.selectedScrollSnap()))},[]),T=c(()=>{d?.scrollPrev()},[d]),E=c(()=>{d?.scrollNext()},[d]),D=c(e=>{d?.scrollTo(e)},[d]),O=c(()=>{x(d?.scrollSnapList().length||0)},[d]),k=c(e=>{t===`horizontal`?e.key===`ArrowLeft`?(e.preventDefault(),T()):e.key===`ArrowRight`&&(e.preventDefault(),E()):e.key===`ArrowUp`?(e.preventDefault(),T()):e.key===`ArrowDown`&&(e.preventDefault(),E())},[T,E,t]);return l(()=>{!d||!r||r(d)},[d,r]),l(()=>{if(d)return w(d),O(),d.on(`reInit`,O),d.on(`reInit`,w),d.on(`select`,w),()=>{d?.off(`select`,w)}},[d,w]),m(y.Provider,{value:{carouselRef:u,api:d,options:n,orientation:t||(n?.axis===`y`?`vertical`:`horizontal`),scrollPrev:T,scrollNext:E,canScrollPrev:p,canScrollNext:g,scrollTo:D,dots:b,selectedScrollSnap:S},children:m(`div`,{"data-komc":!0,role:`region`,"aria-label":`carousel`,"aria-roledescription":`carousel`,tabIndex:0,onKeyDownCapture:k,className:e(`komc:relative`,a),...s,children:o})})}function S({className:t,...n}){let{carouselRef:r,orientation:i}=b();return m(`div`,{ref:r,"data-komc":!0,className:`komc:h-full komc:overflow-hidden`,children:m(`div`,{className:e(`komc:flex komc:h-full`,i===`horizontal`?`komc:-ml-4`:`komc:-mt-4 komc:flex-col`,t),...n})})}function C({className:t,...n}){let{orientation:r}=b();return m(`div`,{"data-komc":!0,className:e(`komc:min-w-0 komc:shrink-0 komc:grow-0 komc:basis-full`,r===`horizontal`?`komc:pl-4`:`komc:pt-4`,t),...n})}function w({children:e,className:t,...n}){let{scrollPrev:r,canScrollPrev:i}=b();return m(`button`,{type:`button`,"data-komc":!0,disabled:!i,"aria-label":`previous slide`,className:a(`komc:w-full`,t),onClick:r,...n,children:e})}function T({children:e,className:t,...n}){let{scrollNext:r,canScrollNext:i}=b();return m(`button`,{type:`button`,"data-komc":!0,disabled:!i,"aria-label":`next slide`,className:a(`komc:w-full`,t),onClick:r,...n,children:e})}function E({children:e,...t}){let{dots:n,selectedScrollSnap:r,scrollTo:i}=b();return m(p,{children:Array.from({length:n}).map((n,a)=>m(`button`,{type:`button`,"data-komc":!0,"data-selected":r===a,"aria-label":`go to slide ${a+1}`,onClick:()=>i(a),...t,children:e(a)},a))})}const D=g(`komc:relative komc:z-10 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden komc:w-full komc:max-h-full komc:min-w-0 komc:transition-all komc:duration-300 komc:ease-in-out`,{variants:{padding:{sm:`komc:p-2`,md:`komc:p-4`,lg:`komc:p-6`,none:`komc:p-0`},maxWidth:{sm:`komc:max-w-sm`,md:`komc:max-w-md`,lg:`komc:max-w-lg`,xl:`komc:max-w-xl`,"2xl":`komc:max-w-2xl`,full:`komc:max-w-full`}},defaultVariants:{padding:`sm`,maxWidth:`md`}});function O({closeOnBackdropClick:e=!0,isOpen:t,zIndex:r=1e4,padding:i,maxWidth:a,className:o,onClose:s,children:u,...d}){let p=n(t,300),[g,_]=f(!1);l(()=>{if(t&&p){let e=setTimeout(()=>_(!0),10);return()=>clearTimeout(e)}else t||_(!1)},[t,p]);let v=c(e=>{e.key===`Escape`&&s()},[s]),y=c(()=>{e&&s()},[e,s]);return l(()=>(t?(document.addEventListener(`keydown`,v),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,v),document.body.style.overflow=`unset`}),[t,v]),p?m(`div`,{"data-komc":!0,className:`komc:fixed komc:inset-0 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden`,style:{zIndex:r},children:h(`div`,{className:`komc:relative komc:flex komc:min-h-0 komc:flex-1 komc:w-full komc:items-center komc:justify-center`,children:[m(`button`,{type:`button`,"data-state":g?`open`:`closed`,className:`komc:fixed komc:inset-0 komc:z-0 komc:cursor-default komc:bg-black/50 komc:transition-opacity komc:duration-300 komc:ease-in-out komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100`,onClick:y,"aria-label":`close dialog`}),m(`div`,{"data-state":g?`open`:`closed`,className:`${D({padding:i,maxWidth:a,className:o})} komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100 komc:data-[state=closed]:scale-95 komc:data-[state=open]:scale-100`,role:`dialog`,"aria-modal":`true`,...d,children:u})]})}):null}const k=g(``,{variants:{fill:{true:`komc:w-full komc:h-full komc:absolute komc:inset-0`,false:``}},defaultVariants:{fill:!1}}),A=s(({...e},t)=>{let{ref:n,imageProps:r}=i({ref:t,...e});return m(`img`,{ref:n,...r})}),j=s(({skeleton:e=!0,layout:n=`stretch`,fallbackSrc:r,className:o,emptyNode:s,emptyNodeClassName:c,skeletonClassName:l,...u},d)=>{let{ref:f,isLoad:g,isError:_,imageProps:v}=i({ref:d,fallbackSrc:r,forceLoad:!e,...u}),y=!u.fill&&n===`intrinsic`?{width:`${u.width}px`,height:`${u.height}px`}:void 0,b=a(`komc:flex komc:justify-center komc:items-center komc:relative komc:min-h-0`,!u.fill&&n===`stretch`&&`komc:w-full komc:h-full`);return!r&&_&&s?u.fill?m(M,{className:c,children:s}):m(`div`,{"data-komc":!0,style:y,className:b,children:m(M,{className:c,children:s})}):u.fill?h(p,{children:[m(`img`,{ref:f,...v,className:a(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!g?`komc:invisible`:`komc:visible`,o)}),m(`div`,{"data-komc":!0,className:a(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!g?`komc:block`:`komc:hidden`),children:m(t,{size:`full`,className:l})})]}):h(`div`,{"data-komc":!0,style:y,className:b,children:[m(`img`,{ref:f,...v,className:a(k({fill:u.fill,className:o}),e&&!g?`komc:invisible`:`komc:visible`)}),m(`div`,{className:a(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!g?`komc:block`:`komc:hidden`),children:m(t,{size:`full`,className:l})})]})}),M=({children:e,className:t})=>m(`div`,{"data-komc":!0,role:`alert`,className:a(`komc:flex komc:justify-center komc:items-center komc:w-full komc:h-full komc:bg-gray-100 komc:absolute komc:inset-0 komc:p-1`,t),children:e});var N=j;const P=g(a(`komc:absolute komc:bg-white komc:flex komc:flex-col komc:shadow-2xl`,`komc:transition-transform komc:duration-300 komc:ease-in-out`),{variants:{direction:{top:`komc:top-0 komc:left-0 komc:right-0 komc:-translate-y-full komc:data-[state=open]:translate-y-0`,bottom:`komc:bottom-0 komc:left-0 komc:right-0 komc:translate-y-full komc:data-[state=open]:translate-y-0`,left:`komc:top-0 komc:bottom-0 komc:left-0 komc:-translate-x-full komc:data-[state=open]:translate-x-0`,right:`komc:top-0 komc:bottom-0 komc:right-0 komc:translate-x-full komc:data-[state=open]:translate-x-0`}}}),F=g(``,{variants:{size:{full:``,half:``,auto:``},direction:{top:``,bottom:``,left:``,right:``}},compoundVariants:[{size:`full`,direction:`top`,className:`komc:h-full`},{size:`full`,direction:`bottom`,className:`komc:h-full`},{size:`full`,direction:`left`,className:`komc:w-full`},{size:`full`,direction:`right`,className:`komc:w-full`},{size:`half`,direction:`top`,className:`komc:h-[50dvh]`},{size:`half`,direction:`bottom`,className:`komc:h-[50dvh]`},{size:`half`,direction:`left`,className:`komc:w-[50dvw]`},{size:`half`,direction:`right`,className:`komc:w-[50dvw]`},{size:`auto`,direction:`top`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`bottom`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`left`,className:`komc:w-auto komc:max-w-[90dvw]`},{size:`auto`,direction:`right`,className:`komc:w-auto komc:max-w-[90dvw]`}]});function I({isOpen:e,onClose:t,direction:r=`bottom`,size:i=`full`,children:o,className:s,closeOnBackdropClick:u=!0,zIndex:d=1001}){let p=n(e,300),[g,_]=f(!1);l(()=>{if(e&&p){let e=setTimeout(()=>_(!0),10);return()=>clearTimeout(e)}else e||_(!1)},[e,p]);let v=c(e=>{e.key===`Escape`&&t()},[t]),y=c(()=>{u&&t()},[u,t]);return l(()=>(e?(document.addEventListener(`keydown`,v),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,v),document.body.style.overflow=`unset`}),[e,v]),p?h(`div`,{className:`komc:fixed komc:inset-0 komc:flex komc:justify-center komc:items-center`,style:{zIndex:d},children:[m(`button`,{type:`button`,"data-state":g?`open`:`closed`,className:a(`komc:absolute komc:inset-0 komc:w-full komc:h-full komc:bg-black/40 komc:cursor-default`,`komc:transition-opacity komc:duration-300 komc:ease-in-out`,`komc:opacity-0 komc:data-[state=open]:opacity-100`),onClick:y,"aria-label":`close sheet`}),m(`div`,{"data-state":g?`open`:`closed`,className:a(P({direction:r,className:s}),F({direction:r,size:i})),role:`dialog`,"aria-modal":`true`,children:o})]}):null}function L({children:e,setOpen:t}){return m(`div`,{"data-komc":!0,className:a(`komc:inline-flex komc:shrink-0 komc:justify-center`,`komc:items-center komc:outline-none`),onMouseLeave:()=>t(!1),onMouseOver:()=>t(!0),onFocus:()=>t(!0),onBlur:()=>t(!1),onClick:()=>t(!0),children:e})}const R=g(e(`komc:z-99 komc:w-max komc:max-w-70 komc:p-2 komc:rounded-md`,`komc:break-all komc:transition-opacity komc:duration-300 komc:bg-white`,`komc:drop-shadow-[0px_0.5px_3px_rgba(0,0,0,0.2)] komc:text-xs`),{variants:{portal:{true:`komc:fixed`,false:`komc:absolute`},placement:{top:``,bottom:``,"top-start":``,"top-end":``,"bottom-start":``,"bottom-end":``}},compoundVariants:[{portal:!0,placement:`top`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom`,className:`komc:translate-y-2`},{portal:!0,placement:`top-start`,className:`komc:-translate-y-2`},{portal:!0,placement:`top-end`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom-start`,className:`komc:translate-y-2`},{portal:!0,placement:`bottom-end`,className:`komc:translate-y-2`},{portal:!1,placement:`top`,className:`komc:bottom-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`bottom`,className:`komc:top-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`top-start`,className:`komc:bottom-full komc:left-0`},{portal:!1,placement:`top-end`,className:`komc:bottom-full komc:right-0`},{portal:!1,placement:`bottom-start`,className:`komc:top-full komc:left-0`},{portal:!1,placement:`bottom-end`,className:`komc:top-full komc:right-0`}],defaultVariants:{placement:`top`,portal:!1}});var z=s(({portal:e,children:t,className:n,placement:r,...i},a)=>m(`div`,{ref:a,"data-komc":!0,role:`tooltip`,className:R({portal:e,placement:r,className:n}),...i,children:t}));const B=g(e(`komc:absolute komc:w-2 komc:h-2 komc:bg-inherit`,`komc:transition-opacity komc:duration-300`),{variants:{placement:{top:e(`komc:top-full komc:-mt-1 komc:left-1/2`),bottom:e(`komc:bottom-full komc:-mb-1 komc:left-1/2`),"top-start":e(`komc:top-full komc:-mt-1 komc:left-5`),"top-end":e(`komc:top-full komc:-mt-1 komc:right-5`),"bottom-start":e(`komc:bottom-full komc:-mb-1 komc:left-5`),"bottom-end":e(`komc:bottom-full komc:-mb-1 komc:right-5`)}},defaultVariants:{placement:`top`}});var V=({placement:e,className:t,offset:n,style:r,...i})=>{let a=u(()=>{switch(e){case`top`:case`top-start`:case`top-end`:return`rotate(45deg)`;case`bottom`:case`bottom-start`:case`bottom-end`:return`rotate(225deg)`;default:return`rotate(45deg)`}},[e]);return m(`div`,{className:B({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${a}`},...i})};const H=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function U({placement:e,className:t,content:n,open:r,hiddenRef:i,containerRef:o}){let[s,u]=f(!1),[d,p]=f(e),[g,_]=f({top:0,left:0}),[y,b]=f({x:0,y:0});l(()=>{u(!0)},[]);let x=c(()=>{let t=o.current,n=i.current;if(!t||!n)return;let r=t.getBoundingClientRect(),a=n.getBoundingClientRect(),s=e,[c]=s.split(`-`),l=r.top,u=window.innerHeight-r.bottom;c===`bottom`&&u<a.height&&l>=a.height?s=H(s,`top`):c===`top`&&l<a.height&&u>=a.height&&(s=H(s,`bottom`)),p(s);let[d,f]=s.split(`-`),m=r.top,h=r.left+r.width/2-a.width/2;switch(d){case`top`:m-=a.height;break;case`bottom`:m+=r.height;break}switch(f){case`start`:h+=a.width/2-24;break;case`end`:h-=a.width/2-24;break}let g=h,v=window.innerWidth;g+a.width>v-4&&(g=v-a.width-4),g<4&&(g=4),_({top:m,left:g}),b({x:h-g,y:0})},[e,o,i]);return l(()=>{if(!s||!r)return;console.log(`updateLayout`);let e=!1,t=0,n=0,i=!1;x();let a=()=>{i||=(t=requestAnimationFrame(()=>{e||x(),i=!1}),!0)};window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a);let c=0,l=0,u=``,d=()=>{if(e||c>=180)return;let t=o.current;if(t){let e=t.getBoundingClientRect(),n=`${e.top.toFixed(4)},${e.left.toFixed(4)},${e.width.toFixed(4)},${e.height.toFixed(4)}`;n===u?l+=1:(l=0,u=n,x())}l<2&&(c+=1,n=requestAnimationFrame(d))};return n=requestAnimationFrame(d),()=>{e=!0,cancelAnimationFrame(t),cancelAnimationFrame(n),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a)}},[s,r,x,o]),s?v(h(z,{portal:!0,"data-komc":!0,placement:d,className:a(t,r?`komc:visible komc:opacity-100`:`komc:opacity-0 komc:invisible`),style:{...g},children:[m(`span`,{children:n}),m(V,{placement:d,offset:y})]}),document.body):null}var W=s(({children:e,content:t,defaultOpen:n=!1,className:i,placement:o=`top`},s)=>{let[c,l]=f(n),u=d(null),p=d(null);return r({ref:u,setOpen:l}),h(`div`,{ref:u,"data-komc":!0,className:`komc:flex komc:shrink-0 komc:relative komc:overflow-hidden komc:w-fit komc:h-fit`,children:[m(L,{setOpen:l,children:e}),m(U,{placement:o,className:i,open:c,content:t,hiddenRef:p,containerRef:u}),m(z,{ref:p,role:`presentation`,"aria-hidden":`true`,placement:o,className:a(`komc:opacity-0 komc:invisible`,i),children:m(`span`,{children:t})})]})});export{A as BaseImage,x as Carousel,E as CarouselDot,C as CarouselItem,T as CarouselNext,w as CarouselPrevious,S as CarouselWrapper,O as Dialog,M as EmptyNode,N as Image,I as Sheet,W as Tooltip};
|
|
1
|
+
import"../src-C_FmOyer.mjs";import{y as e}from"../util-zXJA6Gnc.mjs";import{t}from"../skeleton-S6S1ZnCy.mjs";import{c as n,o as r,r as i}from"../hooks-DBo6LQrH.mjs";import"../providers-5JCPezAS.mjs";import a from"clsx";import o,{forwardRef as s,useCallback as c,useEffect as l,useMemo as u,useRef as d,useState as f}from"react";import{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";import{cva as g}from"class-variance-authority";import _ from"embla-carousel-react";import{createPortal as v}from"react-dom";const y=o.createContext(null);function b(){let e=o.useContext(y);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}function x({orientation:t=`horizontal`,options:n,setApi:r,plugins:i,className:a,children:o,...s}){let[u,d]=_({...n,axis:t===`horizontal`?`x`:`y`},i),[p,h]=f(!1),[g,v]=f(!1),[b,x]=f(0),[S,C]=f(0),w=c(e=>{e&&(h(e.canScrollPrev()),v(e.canScrollNext()),C(e.selectedScrollSnap()))},[]),T=c(()=>{d?.scrollPrev()},[d]),E=c(()=>{d?.scrollNext()},[d]),D=c(e=>{d?.scrollTo(e)},[d]),O=c(()=>{x(d?.scrollSnapList().length||0)},[d]),k=c(e=>{t===`horizontal`?e.key===`ArrowLeft`?(e.preventDefault(),T()):e.key===`ArrowRight`&&(e.preventDefault(),E()):e.key===`ArrowUp`?(e.preventDefault(),T()):e.key===`ArrowDown`&&(e.preventDefault(),E())},[T,E,t]);return l(()=>{!d||!r||r(d)},[d,r]),l(()=>{if(d)return w(d),O(),d.on(`reInit`,O),d.on(`reInit`,w),d.on(`select`,w),()=>{d?.off(`select`,w)}},[d,w]),m(y.Provider,{value:{carouselRef:u,api:d,options:n,orientation:t||(n?.axis===`y`?`vertical`:`horizontal`),scrollPrev:T,scrollNext:E,canScrollPrev:p,canScrollNext:g,scrollTo:D,dots:b,selectedScrollSnap:S},children:m(`div`,{"data-komc":!0,role:`region`,"aria-label":`carousel`,"aria-roledescription":`carousel`,tabIndex:0,onKeyDownCapture:k,className:e(`komc:relative`,a),...s,children:o})})}function S({children:t,className:n,...r}){let{carouselRef:i}=b();return m(`div`,{ref:i,"data-komc":!0,className:e(`komc:h-full komc:overflow-hidden`,n),...r,children:t})}function C({className:t,...n}){let{orientation:r}=b();return m(`div`,{className:e(`komc:flex komc:h-full`,r===`horizontal`?`komc:-ml-4`:`komc:-mt-4 komc:flex-col`,t),...n})}function w({className:t,...n}){let{orientation:r}=b();return m(`div`,{"data-komc":!0,className:e(`komc:min-w-0 komc:shrink-0 komc:grow-0 komc:basis-full`,r===`horizontal`?`komc:pl-4`:`komc:pt-4`,t),...n})}function T({children:e,className:t,...n}){let{scrollPrev:r,canScrollPrev:i}=b();return m(`button`,{type:`button`,"data-komc":!0,disabled:!i,"aria-label":`previous slide`,className:a(`komc:w-full`,t),onClick:r,...n,children:e})}function E({children:e,className:t,...n}){let{scrollNext:r,canScrollNext:i}=b();return m(`button`,{type:`button`,"data-komc":!0,disabled:!i,"aria-label":`next slide`,className:a(`komc:w-full`,t),onClick:r,...n,children:e})}function D({children:e,...t}){let{dots:n,selectedScrollSnap:r,scrollTo:i}=b();return m(p,{children:Array.from({length:n}).map((n,a)=>m(`button`,{type:`button`,"data-komc":!0,"data-selected":r===a,"aria-label":`go to slide ${a+1}`,onClick:()=>i(a),...t,children:e?.(a)},a))})}function O({index:e,children:t,...n}){let{selectedScrollSnap:r,scrollTo:i}=b();return m(`button`,{type:`button`,"data-komc":!0,"data-selected":r===e,"aria-label":`go to slide ${e+1}`,onClick:()=>i(e),...n,children:t})}const k=g(`komc:relative komc:z-10 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden komc:w-full komc:max-h-full komc:min-w-0 komc:transition-all komc:duration-300 komc:ease-in-out`,{variants:{padding:{sm:`komc:p-2`,md:`komc:p-4`,lg:`komc:p-6`,none:`komc:p-0`},maxWidth:{sm:`komc:max-w-sm`,md:`komc:max-w-md`,lg:`komc:max-w-lg`,xl:`komc:max-w-xl`,"2xl":`komc:max-w-2xl`,full:`komc:max-w-full`}},defaultVariants:{padding:`sm`,maxWidth:`md`}});function A({closeOnBackdropClick:e=!0,isOpen:t,zIndex:r=1e4,padding:i,maxWidth:a,className:o,onClose:s,children:u,...d}){let p=n(t,300),[g,_]=f(!1);l(()=>{if(t&&p){let e=setTimeout(()=>_(!0),10);return()=>clearTimeout(e)}else t||_(!1)},[t,p]);let v=c(e=>{e.key===`Escape`&&s()},[s]),y=c(()=>{e&&s()},[e,s]);return l(()=>(t?(document.addEventListener(`keydown`,v),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,v),document.body.style.overflow=`unset`}),[t,v]),p?m(`div`,{"data-komc":!0,className:`komc:fixed komc:inset-0 komc:flex komc:min-h-0 komc:flex-col komc:overflow-hidden`,style:{zIndex:r},children:h(`div`,{className:`komc:relative komc:flex komc:min-h-0 komc:flex-1 komc:w-full komc:items-center komc:justify-center`,children:[m(`button`,{type:`button`,"data-state":g?`open`:`closed`,className:`komc:fixed komc:inset-0 komc:z-0 komc:cursor-default komc:bg-black/50 komc:transition-opacity komc:duration-300 komc:ease-in-out komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100`,onClick:y,"aria-label":`close dialog`}),m(`div`,{"data-state":g?`open`:`closed`,className:`${k({padding:i,maxWidth:a,className:o})} komc:data-[state=closed]:opacity-0 komc:data-[state=open]:opacity-100 komc:data-[state=closed]:scale-95 komc:data-[state=open]:scale-100`,role:`dialog`,"aria-modal":`true`,...d,children:u})]})}):null}const j=g(``,{variants:{fill:{true:`komc:w-full komc:h-full komc:absolute komc:inset-0`,false:``}},defaultVariants:{fill:!1}}),M=s(({...e},t)=>{let{ref:n,imageProps:r}=i({ref:t,...e});return m(`img`,{ref:n,...r})}),N=s(({skeleton:e=!0,layout:n=`stretch`,fallbackSrc:r,className:o,emptyNode:s,emptyNodeClassName:c,skeletonClassName:l,...u},d)=>{let{ref:f,isLoad:g,isError:_,imageProps:v}=i({ref:d,fallbackSrc:r,forceLoad:!e,...u}),y=!u.fill&&n===`intrinsic`?{width:`${u.width}px`,height:`${u.height}px`}:void 0,b=a(`komc:flex komc:justify-center komc:items-center komc:relative komc:min-h-0`,!u.fill&&n===`stretch`&&`komc:w-full komc:h-full`);return!r&&_&&s?u.fill?m(P,{className:c,children:s}):m(`div`,{"data-komc":!0,style:y,className:b,children:m(P,{className:c,children:s})}):u.fill?h(p,{children:[m(`img`,{ref:f,...v,className:a(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!g?`komc:invisible`:`komc:visible`,o)}),m(`div`,{"data-komc":!0,className:a(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!g?`komc:block`:`komc:hidden`),children:m(t,{size:`full`,className:l})})]}):h(`div`,{"data-komc":!0,style:y,className:b,children:[m(`img`,{ref:f,...v,className:a(j({fill:u.fill,className:o}),e&&!g?`komc:invisible`:`komc:visible`)}),m(`div`,{className:a(`komc:w-full komc:h-full komc:absolute komc:inset-0`,e&&!g?`komc:block`:`komc:hidden`),children:m(t,{size:`full`,className:l})})]})}),P=({children:e,className:t})=>m(`div`,{"data-komc":!0,role:`alert`,className:a(`komc:flex komc:justify-center komc:items-center komc:w-full komc:h-full komc:bg-gray-100 komc:absolute komc:inset-0 komc:p-1`,t),children:e});var F=N;const I=g(a(`komc:absolute komc:bg-white komc:flex komc:flex-col komc:shadow-2xl`,`komc:transition-transform komc:duration-300 komc:ease-in-out`),{variants:{direction:{top:`komc:top-0 komc:left-0 komc:right-0 komc:-translate-y-full komc:data-[state=open]:translate-y-0`,bottom:`komc:bottom-0 komc:left-0 komc:right-0 komc:translate-y-full komc:data-[state=open]:translate-y-0`,left:`komc:top-0 komc:bottom-0 komc:left-0 komc:-translate-x-full komc:data-[state=open]:translate-x-0`,right:`komc:top-0 komc:bottom-0 komc:right-0 komc:translate-x-full komc:data-[state=open]:translate-x-0`}}}),L=g(``,{variants:{size:{full:``,half:``,auto:``},direction:{top:``,bottom:``,left:``,right:``}},compoundVariants:[{size:`full`,direction:`top`,className:`komc:h-full`},{size:`full`,direction:`bottom`,className:`komc:h-full`},{size:`full`,direction:`left`,className:`komc:w-full`},{size:`full`,direction:`right`,className:`komc:w-full`},{size:`half`,direction:`top`,className:`komc:h-[50dvh]`},{size:`half`,direction:`bottom`,className:`komc:h-[50dvh]`},{size:`half`,direction:`left`,className:`komc:w-[50dvw]`},{size:`half`,direction:`right`,className:`komc:w-[50dvw]`},{size:`auto`,direction:`top`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`bottom`,className:`komc:h-auto komc:max-h-[90dvh]`},{size:`auto`,direction:`left`,className:`komc:w-auto komc:max-w-[90dvw]`},{size:`auto`,direction:`right`,className:`komc:w-auto komc:max-w-[90dvw]`}]});function R({isOpen:e,onClose:t,direction:r=`bottom`,size:i=`full`,children:o,className:s,closeOnBackdropClick:u=!0,zIndex:d=1001}){let p=n(e,300),[g,_]=f(!1);l(()=>{if(e&&p){let e=setTimeout(()=>_(!0),10);return()=>clearTimeout(e)}else e||_(!1)},[e,p]);let v=c(e=>{e.key===`Escape`&&t()},[t]),y=c(()=>{u&&t()},[u,t]);return l(()=>(e?(document.addEventListener(`keydown`,v),document.body.style.overflow=`hidden`):document.body.style.overflow=`unset`,()=>{document.removeEventListener(`keydown`,v),document.body.style.overflow=`unset`}),[e,v]),p?h(`div`,{className:`komc:fixed komc:inset-0 komc:flex komc:justify-center komc:items-center`,style:{zIndex:d},children:[m(`button`,{type:`button`,"data-state":g?`open`:`closed`,className:a(`komc:absolute komc:inset-0 komc:w-full komc:h-full komc:bg-black/40 komc:cursor-default`,`komc:transition-opacity komc:duration-300 komc:ease-in-out`,`komc:opacity-0 komc:data-[state=open]:opacity-100`),onClick:y,"aria-label":`close sheet`}),m(`div`,{"data-state":g?`open`:`closed`,className:a(I({direction:r,className:s}),L({direction:r,size:i})),role:`dialog`,"aria-modal":`true`,children:o})]}):null}function z({children:e,setOpen:t}){return m(`div`,{"data-komc":!0,className:a(`komc:inline-flex komc:shrink-0 komc:justify-center`,`komc:items-center komc:outline-none`),onMouseLeave:()=>t(!1),onMouseOver:()=>t(!0),onFocus:()=>t(!0),onBlur:()=>t(!1),onClick:()=>t(!0),children:e})}const B=g(e(`komc:z-99 komc:w-max komc:max-w-70 komc:p-2 komc:rounded-md`,`komc:break-all komc:transition-opacity komc:duration-300 komc:bg-white`,`komc:drop-shadow-[0px_0.5px_3px_rgba(0,0,0,0.2)] komc:text-xs`),{variants:{portal:{true:`komc:fixed`,false:`komc:absolute`},placement:{top:``,bottom:``,"top-start":``,"top-end":``,"bottom-start":``,"bottom-end":``}},compoundVariants:[{portal:!0,placement:`top`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom`,className:`komc:translate-y-2`},{portal:!0,placement:`top-start`,className:`komc:-translate-y-2`},{portal:!0,placement:`top-end`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom-start`,className:`komc:translate-y-2`},{portal:!0,placement:`bottom-end`,className:`komc:translate-y-2`},{portal:!1,placement:`top`,className:`komc:bottom-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`bottom`,className:`komc:top-full komc:left-1/2 komc:-translate-x-1/2`},{portal:!1,placement:`top-start`,className:`komc:bottom-full komc:left-0`},{portal:!1,placement:`top-end`,className:`komc:bottom-full komc:right-0`},{portal:!1,placement:`bottom-start`,className:`komc:top-full komc:left-0`},{portal:!1,placement:`bottom-end`,className:`komc:top-full komc:right-0`}],defaultVariants:{placement:`top`,portal:!1}});var V=s(({portal:e,children:t,className:n,placement:r,...i},a)=>m(`div`,{ref:a,"data-komc":!0,role:`tooltip`,className:B({portal:e,placement:r,className:n}),...i,children:t}));const H=g(e(`komc:absolute komc:w-2 komc:h-2 komc:bg-inherit`,`komc:transition-opacity komc:duration-300`),{variants:{placement:{top:e(`komc:top-full komc:-mt-1 komc:left-1/2`),bottom:e(`komc:bottom-full komc:-mb-1 komc:left-1/2`),"top-start":e(`komc:top-full komc:-mt-1 komc:left-5`),"top-end":e(`komc:top-full komc:-mt-1 komc:right-5`),"bottom-start":e(`komc:bottom-full komc:-mb-1 komc:left-5`),"bottom-end":e(`komc:bottom-full komc:-mb-1 komc:right-5`)}},defaultVariants:{placement:`top`}});var U=({placement:e,className:t,offset:n,style:r,...i})=>{let a=u(()=>{switch(e){case`top`:case`top-start`:case`top-end`:return`rotate(45deg)`;case`bottom`:case`bottom-start`:case`bottom-end`:return`rotate(225deg)`;default:return`rotate(45deg)`}},[e]);return m(`div`,{className:H({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${a}`},...i})};const W=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function G({placement:e,className:t,content:n,open:r,hiddenRef:i,containerRef:o}){let[s,u]=f(!1),[d,p]=f(e),[g,_]=f({top:0,left:0}),[y,b]=f({x:0,y:0});l(()=>{u(!0)},[]);let x=c(()=>{let t=o.current,n=i.current;if(!t||!n)return;let r=t.getBoundingClientRect(),a=n.getBoundingClientRect(),s=e,[c]=s.split(`-`),l=r.top,u=window.innerHeight-r.bottom;c===`bottom`&&u<a.height&&l>=a.height?s=W(s,`top`):c===`top`&&l<a.height&&u>=a.height&&(s=W(s,`bottom`)),p(s);let[d,f]=s.split(`-`),m=r.top,h=r.left+r.width/2-a.width/2;switch(d){case`top`:m-=a.height;break;case`bottom`:m+=r.height;break}switch(f){case`start`:h+=a.width/2-24;break;case`end`:h-=a.width/2-24;break}let g=h,v=window.innerWidth;g+a.width>v-4&&(g=v-a.width-4),g<4&&(g=4),_({top:m,left:g}),b({x:h-g,y:0})},[e,o,i]);return l(()=>{if(!s||!r)return;console.log(`updateLayout`);let e=!1,t=0,n=0,i=!1;x();let a=()=>{i||=(t=requestAnimationFrame(()=>{e||x(),i=!1}),!0)};window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a);let c=0,l=0,u=``,d=()=>{if(e||c>=180)return;let t=o.current;if(t){let e=t.getBoundingClientRect(),n=`${e.top.toFixed(4)},${e.left.toFixed(4)},${e.width.toFixed(4)},${e.height.toFixed(4)}`;n===u?l+=1:(l=0,u=n,x())}l<2&&(c+=1,n=requestAnimationFrame(d))};return n=requestAnimationFrame(d),()=>{e=!0,cancelAnimationFrame(t),cancelAnimationFrame(n),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a)}},[s,r,x,o]),s?v(h(V,{portal:!0,"data-komc":!0,placement:d,className:a(t,r?`komc:visible komc:opacity-100`:`komc:opacity-0 komc:invisible`),style:{...g},children:[m(`span`,{children:n}),m(U,{placement:d,offset:y})]}),document.body):null}var K=s(({children:e,content:t,defaultOpen:n=!1,className:i,placement:o=`top`},s)=>{let[c,l]=f(n),u=d(null),p=d(null);return r({ref:u,setOpen:l}),h(`div`,{ref:u,"data-komc":!0,className:`komc:flex komc:shrink-0 komc:relative komc:overflow-hidden komc:w-fit komc:h-fit`,children:[m(z,{setOpen:l,children:e}),m(G,{placement:o,className:i,open:c,content:t,hiddenRef:p,containerRef:u}),m(V,{ref:p,role:`presentation`,"aria-hidden":`true`,placement:o,className:a(`komc:opacity-0 komc:invisible`,i),children:m(`span`,{children:t})})]})});export{M as BaseImage,x as Carousel,O as CarouselDot,D as CarouselDots,w as CarouselItem,E as CarouselNext,T as CarouselPrevious,S as CarouselViewport,C as CarouselWrapper,A as Dialog,P as EmptyNode,F as Image,R as Sheet,K as Tooltip};
|
package/dist/util/index.d.cts
CHANGED
|
@@ -48,7 +48,7 @@ declare const getI18nValue: <T extends {
|
|
|
48
48
|
}>(locale?: string, values?: T[], key?: keyof T) => string;
|
|
49
49
|
declare const comparePriorityAsc: <T extends {
|
|
50
50
|
priority: number;
|
|
51
|
-
}>(a: T, b: T) =>
|
|
51
|
+
}>(a: T, b: T) => 1 | 0 | -1;
|
|
52
52
|
declare const parseQuery: <T, F = T>(q: string | string[] | undefined | null, conv: (v: string) => T, fallback: F) => T | F;
|
|
53
53
|
declare const withoutProperty: <T, K extends keyof T>(obj: T, property: K) => Omit<T, K>;
|
|
54
54
|
declare const withoutProperties: <T extends Record<string, unknown>>(obj: T, properties: Array<keyof T>) => T;
|
package/dist/util/index.d.mts
CHANGED
|
@@ -49,7 +49,7 @@ declare const getI18nValue: <T extends {
|
|
|
49
49
|
}>(locale?: string, values?: T[], key?: keyof T) => string;
|
|
50
50
|
declare const comparePriorityAsc: <T extends {
|
|
51
51
|
priority: number;
|
|
52
|
-
}>(a: T, b: T) =>
|
|
52
|
+
}>(a: T, b: T) => 1 | 0 | -1;
|
|
53
53
|
declare const parseQuery: <T, F = T>(q: string | string[] | undefined | null, conv: (v: string) => T, fallback: F) => T | F;
|
|
54
54
|
declare const withoutProperty: <T, K extends keyof T>(obj: T, property: K) => Omit<T, K>;
|
|
55
55
|
declare const withoutProperties: <T extends Record<string, unknown>>(obj: T, properties: Array<keyof T>) => T;
|