@machinerd/js-module 0.5.3 → 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 +10 -10
- package/dist/ui/index.d.mts +21 -21
- package/dist/ui-client/index.cjs +1 -1
- package/dist/ui-client/index.d.cts +27 -20
- package/dist/ui-client/index.d.mts +27 -20
- 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,6 +1,6 @@
|
|
|
1
1
|
import * as react10 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 * as class_variance_authority_types2 from "class-variance-authority/types";
|
|
5
5
|
import { VariantProps } from "class-variance-authority";
|
|
6
6
|
|
|
@@ -18,12 +18,12 @@ 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?: "
|
|
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
|
-
px?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "
|
|
26
|
-
rounded?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "
|
|
25
|
+
px?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | null | undefined;
|
|
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';
|
|
@@ -74,8 +74,8 @@ declare function ConditionalWrapper({
|
|
|
74
74
|
//#endregion
|
|
75
75
|
//#region src/ui/input/input.d.ts
|
|
76
76
|
declare const classes$1: (props?: ({
|
|
77
|
-
size?: "
|
|
78
|
-
gap?: "none" | "
|
|
77
|
+
size?: "base" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | null | undefined;
|
|
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;
|
|
@@ -91,8 +91,8 @@ declare const Input: react10.ForwardRefExoticComponent<InputProps & react10.RefA
|
|
|
91
91
|
//#endregion
|
|
92
92
|
//#region src/ui/skeleton/skeleton.d.ts
|
|
93
93
|
declare const classes: (props?: ({
|
|
94
|
-
size?: "sm" | "md" | "lg" | "xl" | "2xl" | "
|
|
95
|
-
rounded?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "
|
|
94
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | "square" | null | undefined;
|
|
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;
|
|
@@ -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/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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
|
-
import * as
|
|
5
|
+
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
6
6
|
|
|
7
7
|
//#region src/ui/bottom-app-bar/bottom-app-bar.d.ts
|
|
8
8
|
interface BottomAppBarProps<T> extends React$1.HTMLAttributes<HTMLElement> {
|
|
@@ -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?: "
|
|
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
|
-
px?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "
|
|
26
|
-
rounded?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "
|
|
27
|
-
} &
|
|
25
|
+
px?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | null | undefined;
|
|
26
|
+
rounded?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | null | undefined;
|
|
27
|
+
} & class_variance_authority_types0.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: 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,15 +70,15 @@ 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?: "
|
|
78
|
-
gap?: "none" | "
|
|
77
|
+
size?: "base" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | null | undefined;
|
|
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_types0.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: 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?: "sm" | "md" | "lg" | "xl" | "2xl" | "
|
|
95
|
-
rounded?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "
|
|
96
|
-
} &
|
|
94
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | "square" | null | undefined;
|
|
95
|
+
rounded?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | null | undefined;
|
|
96
|
+
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
97
97
|
interface SkeletonProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof classes> {
|
|
98
98
|
width?: string | number;
|
|
99
99
|
height?: string | number;
|
|
@@ -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))})}function v({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 y=(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 b({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:`${y({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 x=(0,s.cva)(``,{variants:{fill:{true:`komc:w-full komc:h-full komc:absolute komc:inset-0`,false:``}},defaultVariants:{fill:!1}}),S=(0,a.forwardRef)(({...e},t)=>{let{ref:n,imageProps:i}=r.r({ref:t,...e});return(0,o.jsx)(`img`,{ref:n,...i})}),C=(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)(w,{className:l,children:c}):(0,o.jsx)(`div`,{"data-komc":!0,style:_,className:v,children:(0,o.jsx)(w,{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)(x({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})})]})}),w=({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 T=C;const E=(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`}}}),D=(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 O({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)(E({direction:n,className:l}),D({direction:n,size:s})),role:`dialog`,"aria-modal":`true`,children:c})]}):null}function k({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 A=(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}}),j=(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:A({portal:e,placement:r,className:n}),...i,children:t}));var M=j;const N=(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`}}),P=({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:N({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${s}`},...i})};var F=P;const I=24,L=2,R=180,z=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function B({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=z(a,`top`):o===`top`&&l<i.height&&u>=i.height&&(a=z(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)(M,{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)(F,{placement:f,offset:g})]}),document.body):null}const V=(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)(k,{setOpen:d,children:e}),(0,o.jsx)(B,{placement:c,className:s,open:u,content:t,hiddenRef:p,containerRef:f}),(0,o.jsx)(M,{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 H=V;exports.BaseImage=S,exports.Carousel=f,exports.CarouselDot=v,exports.CarouselDots=_,exports.CarouselItem=m,exports.CarouselNext=g,exports.CarouselPrevious=h,exports.CarouselWrapper=p,exports.Dialog=b,exports.EmptyNode=w,exports.Image=T,exports.Sheet=O,exports.Tooltip=H;
|
|
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,33 +44,40 @@ 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
82
|
//#region src/ui-client/carousel/carousel-dots.d.ts
|
|
76
83
|
declare function CarouselDots$1({
|
|
@@ -78,7 +85,7 @@ declare function CarouselDots$1({
|
|
|
78
85
|
...props
|
|
79
86
|
}: Omit<React$1.ComponentProps<'button'>, 'children'> & {
|
|
80
87
|
children?: (index: number) => React$1.ReactNode;
|
|
81
|
-
}):
|
|
88
|
+
}): react_jsx_runtime2.JSX.Element;
|
|
82
89
|
//#endregion
|
|
83
90
|
//#region src/ui-client/carousel/carousel-dot.d.ts
|
|
84
91
|
declare function CarouselDots({
|
|
@@ -87,13 +94,13 @@ declare function CarouselDots({
|
|
|
87
94
|
...props
|
|
88
95
|
}: React$1.ComponentProps<'button'> & {
|
|
89
96
|
index: number;
|
|
90
|
-
}):
|
|
97
|
+
}): react_jsx_runtime2.JSX.Element;
|
|
91
98
|
//#endregion
|
|
92
99
|
//#region src/ui-client/dialog/dialog.d.ts
|
|
93
100
|
declare const classes: (props?: ({
|
|
94
101
|
padding?: "none" | "sm" | "md" | "lg" | null | undefined;
|
|
95
102
|
maxWidth?: "sm" | "md" | "lg" | "xl" | "2xl" | "full" | null | undefined;
|
|
96
|
-
} &
|
|
103
|
+
} & class_variance_authority_types1.ClassProp) | undefined) => string;
|
|
97
104
|
interface DialogProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof classes> {
|
|
98
105
|
closeOnBackdropClick?: boolean;
|
|
99
106
|
isOpen: boolean;
|
|
@@ -111,7 +118,7 @@ declare function Dialog({
|
|
|
111
118
|
onClose,
|
|
112
119
|
children,
|
|
113
120
|
...rest
|
|
114
|
-
}: DialogProps):
|
|
121
|
+
}: DialogProps): react_jsx_runtime2.JSX.Element | null;
|
|
115
122
|
//#endregion
|
|
116
123
|
//#region src/ui-client/image/image.d.ts
|
|
117
124
|
type ImageSubsetProps = {
|
|
@@ -122,7 +129,7 @@ type ImageSubsetProps = {
|
|
|
122
129
|
skeletonClassName?: string;
|
|
123
130
|
};
|
|
124
131
|
type ImageProps = UseSubsetImageProps & ImageSubsetProps;
|
|
125
|
-
declare const BaseImage:
|
|
132
|
+
declare const BaseImage: react6.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
126
133
|
fill: true;
|
|
127
134
|
sizes: string;
|
|
128
135
|
width?: never;
|
|
@@ -132,8 +139,8 @@ declare const BaseImage: react1.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
|
132
139
|
sizes?: never;
|
|
133
140
|
width: number;
|
|
134
141
|
height: number;
|
|
135
|
-
}, "ref">) &
|
|
136
|
-
declare const Image:
|
|
142
|
+
}, "ref">) & react6.RefAttributes<HTMLImageElement>>;
|
|
143
|
+
declare const Image: react6.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
137
144
|
fill: true;
|
|
138
145
|
sizes: string;
|
|
139
146
|
width?: never;
|
|
@@ -143,7 +150,7 @@ declare const Image: react1.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
|
143
150
|
sizes?: never;
|
|
144
151
|
width: number;
|
|
145
152
|
height: number;
|
|
146
|
-
} & ImageSubsetProps, "ref">) &
|
|
153
|
+
} & ImageSubsetProps, "ref">) & react6.RefAttributes<HTMLImageElement>>;
|
|
147
154
|
interface EmptyNodeProps {
|
|
148
155
|
children: React.ReactNode;
|
|
149
156
|
className?: string;
|
|
@@ -151,7 +158,7 @@ interface EmptyNodeProps {
|
|
|
151
158
|
declare const EmptyNode: ({
|
|
152
159
|
children,
|
|
153
160
|
className
|
|
154
|
-
}: EmptyNodeProps) =>
|
|
161
|
+
}: EmptyNodeProps) => react_jsx_runtime2.JSX.Element;
|
|
155
162
|
//#endregion
|
|
156
163
|
//#region src/ui-client/sheet/sheet.d.ts
|
|
157
164
|
type Direction = 'top' | 'bottom' | 'left' | 'right';
|
|
@@ -175,7 +182,7 @@ declare function Sheet({
|
|
|
175
182
|
className,
|
|
176
183
|
closeOnBackdropClick,
|
|
177
184
|
zIndex
|
|
178
|
-
}: SheetProps):
|
|
185
|
+
}: SheetProps): react_jsx_runtime2.JSX.Element | null;
|
|
179
186
|
//#endregion
|
|
180
187
|
//#region src/ui-client/tooltip/tooltip-container.d.ts
|
|
181
188
|
type SubPlacement = 'start' | 'end';
|
|
@@ -187,6 +194,6 @@ interface TooltipContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
187
194
|
placement?: TooltipPlacement;
|
|
188
195
|
defaultOpen?: boolean;
|
|
189
196
|
}
|
|
190
|
-
declare const TooltipContainer:
|
|
197
|
+
declare const TooltipContainer: react6.ForwardRefExoticComponent<TooltipContainerProps & react6.RefAttributes<HTMLDivElement>>;
|
|
191
198
|
//#endregion
|
|
192
|
-
export { BaseImage, Carousel, type CarouselApi, type CarouselContextProps, CarouselDots as CarouselDot, CarouselDots$1 as CarouselDots, 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
|
-
import * as
|
|
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];
|
|
@@ -44,33 +44,40 @@ declare function Carousel({
|
|
|
44
44
|
className,
|
|
45
45
|
children,
|
|
46
46
|
...props
|
|
47
|
-
}: CarouselProps$1):
|
|
47
|
+
}: CarouselProps$1): react_jsx_runtime5.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_runtime5.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_runtime5.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_runtime5.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_runtime5.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_runtime5.JSX.Element;
|
|
74
81
|
//#endregion
|
|
75
82
|
//#region src/ui-client/carousel/carousel-dots.d.ts
|
|
76
83
|
declare function CarouselDots$1({
|
|
@@ -78,7 +85,7 @@ declare function CarouselDots$1({
|
|
|
78
85
|
...props
|
|
79
86
|
}: Omit<React$1.ComponentProps<'button'>, 'children'> & {
|
|
80
87
|
children?: (index: number) => React$1.ReactNode;
|
|
81
|
-
}):
|
|
88
|
+
}): react_jsx_runtime5.JSX.Element;
|
|
82
89
|
//#endregion
|
|
83
90
|
//#region src/ui-client/carousel/carousel-dot.d.ts
|
|
84
91
|
declare function CarouselDots({
|
|
@@ -87,13 +94,13 @@ declare function CarouselDots({
|
|
|
87
94
|
...props
|
|
88
95
|
}: React$1.ComponentProps<'button'> & {
|
|
89
96
|
index: number;
|
|
90
|
-
}):
|
|
97
|
+
}): react_jsx_runtime5.JSX.Element;
|
|
91
98
|
//#endregion
|
|
92
99
|
//#region src/ui-client/dialog/dialog.d.ts
|
|
93
100
|
declare const classes: (props?: ({
|
|
94
101
|
padding?: "none" | "sm" | "md" | "lg" | null | undefined;
|
|
95
102
|
maxWidth?: "sm" | "md" | "lg" | "xl" | "2xl" | "full" | null | undefined;
|
|
96
|
-
} &
|
|
103
|
+
} & class_variance_authority_types2.ClassProp) | undefined) => string;
|
|
97
104
|
interface DialogProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof classes> {
|
|
98
105
|
closeOnBackdropClick?: boolean;
|
|
99
106
|
isOpen: boolean;
|
|
@@ -111,7 +118,7 @@ declare function Dialog({
|
|
|
111
118
|
onClose,
|
|
112
119
|
children,
|
|
113
120
|
...rest
|
|
114
|
-
}: DialogProps):
|
|
121
|
+
}: DialogProps): react_jsx_runtime5.JSX.Element | null;
|
|
115
122
|
//#endregion
|
|
116
123
|
//#region src/ui-client/image/image.d.ts
|
|
117
124
|
type ImageSubsetProps = {
|
|
@@ -122,7 +129,7 @@ type ImageSubsetProps = {
|
|
|
122
129
|
skeletonClassName?: string;
|
|
123
130
|
};
|
|
124
131
|
type ImageProps = UseSubsetImageProps & ImageSubsetProps;
|
|
125
|
-
declare const BaseImage:
|
|
132
|
+
declare const BaseImage: react14.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
126
133
|
fill: true;
|
|
127
134
|
sizes: string;
|
|
128
135
|
width?: never;
|
|
@@ -132,8 +139,8 @@ declare const BaseImage: react3.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
|
132
139
|
sizes?: never;
|
|
133
140
|
width: number;
|
|
134
141
|
height: number;
|
|
135
|
-
}, "ref">) &
|
|
136
|
-
declare const Image:
|
|
142
|
+
}, "ref">) & react14.RefAttributes<HTMLImageElement>>;
|
|
143
|
+
declare const Image: react14.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
137
144
|
fill: true;
|
|
138
145
|
sizes: string;
|
|
139
146
|
width?: never;
|
|
@@ -143,7 +150,7 @@ declare const Image: react3.ForwardRefExoticComponent<(Omit<BaseProps & {
|
|
|
143
150
|
sizes?: never;
|
|
144
151
|
width: number;
|
|
145
152
|
height: number;
|
|
146
|
-
} & ImageSubsetProps, "ref">) &
|
|
153
|
+
} & ImageSubsetProps, "ref">) & react14.RefAttributes<HTMLImageElement>>;
|
|
147
154
|
interface EmptyNodeProps {
|
|
148
155
|
children: React.ReactNode;
|
|
149
156
|
className?: string;
|
|
@@ -151,7 +158,7 @@ interface EmptyNodeProps {
|
|
|
151
158
|
declare const EmptyNode: ({
|
|
152
159
|
children,
|
|
153
160
|
className
|
|
154
|
-
}: EmptyNodeProps) =>
|
|
161
|
+
}: EmptyNodeProps) => react_jsx_runtime5.JSX.Element;
|
|
155
162
|
//#endregion
|
|
156
163
|
//#region src/ui-client/sheet/sheet.d.ts
|
|
157
164
|
type Direction = 'top' | 'bottom' | 'left' | 'right';
|
|
@@ -175,7 +182,7 @@ declare function Sheet({
|
|
|
175
182
|
className,
|
|
176
183
|
closeOnBackdropClick,
|
|
177
184
|
zIndex
|
|
178
|
-
}: SheetProps):
|
|
185
|
+
}: SheetProps): react_jsx_runtime5.JSX.Element | null;
|
|
179
186
|
//#endregion
|
|
180
187
|
//#region src/ui-client/tooltip/tooltip-container.d.ts
|
|
181
188
|
type SubPlacement = 'start' | 'end';
|
|
@@ -187,6 +194,6 @@ interface TooltipContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
187
194
|
placement?: TooltipPlacement;
|
|
188
195
|
defaultOpen?: boolean;
|
|
189
196
|
}
|
|
190
|
-
declare const TooltipContainer:
|
|
197
|
+
declare const TooltipContainer: react14.ForwardRefExoticComponent<TooltipContainerProps & react14.RefAttributes<HTMLDivElement>>;
|
|
191
198
|
//#endregion
|
|
192
|
-
export { BaseImage, Carousel, type CarouselApi, type CarouselContextProps, CarouselDots as CarouselDot, CarouselDots$1 as CarouselDots, 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))})}function D({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 O=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 k({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:`${O({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 A=g(``,{variants:{fill:{true:`komc:w-full komc:h-full komc:absolute komc:inset-0`,false:``}},defaultVariants:{fill:!1}}),j=s(({...e},t)=>{let{ref:n,imageProps:r}=i({ref:t,...e});return m(`img`,{ref:n,...r})}),M=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(N,{className:c,children:s}):m(`div`,{"data-komc":!0,style:y,className:b,children:m(N,{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(A({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})})]})}),N=({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 P=M;const F=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`}}}),I=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 L({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(F({direction:r,className:s}),I({direction:r,size:i})),role:`dialog`,"aria-modal":`true`,children:o})]}):null}function R({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 z=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 B=s(({portal:e,children:t,className:n,placement:r,...i},a)=>m(`div`,{ref:a,"data-komc":!0,role:`tooltip`,className:z({portal:e,placement:r,className:n}),...i,children:t}));const V=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 H=({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:V({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${a}`},...i})};const U=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function W({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=U(s,`top`):c===`top`&&l<a.height&&u>=a.height&&(s=U(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(B,{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(H,{placement:d,offset:y})]}),document.body):null}var G=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(R,{setOpen:l,children:e}),m(W,{placement:o,className:i,open:c,content:t,hiddenRef:p,containerRef:u}),m(B,{ref:p,role:`presentation`,"aria-hidden":`true`,placement:o,className:a(`komc:opacity-0 komc:invisible`,i),children:m(`span`,{children:t})})]})});export{j as BaseImage,x as Carousel,D as CarouselDot,E as CarouselDots,C as CarouselItem,T as CarouselNext,w as CarouselPrevious,S as CarouselWrapper,k as Dialog,N as EmptyNode,P as Image,L as Sheet,G 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;
|