@machinerd/js-module 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/index.mjs +1 -1
- package/dist/styles/index.css +170 -26
- package/dist/ui/client-only/index.cjs +1 -0
- package/dist/ui/client-only/index.d.cts +136 -0
- package/dist/ui/client-only/index.d.mts +136 -0
- package/dist/ui/client-only/index.mjs +1 -0
- package/dist/ui/index.cjs +1 -1
- package/dist/ui/index.d.cts +152 -77
- package/dist/ui/index.d.mts +153 -78
- package/dist/ui/index.mjs +1 -1
- package/dist/util/index.d.cts +1 -1
- package/dist/util/index.d.mts +1 -1
- package/dist/util/index.mjs +1 -1
- package/package.json +7 -1
- /package/dist/{hooks-5I2NBtcY.mjs → hooks-C9M3V-Pb.mjs} +0 -0
- /package/dist/{util-DCPr_-5a.mjs → util-BrmjOcya.mjs} +0 -0
package/dist/hooks/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"../hooks-
|
|
1
|
+
import{n as e,t}from"../hooks-C9M3V-Pb.mjs";export{t as useOutsideClick,e as useWindowSize};
|
package/dist/styles/index.css
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
@layer theme, base, components, utilities;
|
|
4
4
|
@layer theme {
|
|
5
5
|
:root, :host {
|
|
6
|
+
--komc-color-red-500: oklch(63.7% 0.237 25.331);
|
|
6
7
|
--komc-color-blue-500: oklch(62.3% 0.214 259.815);
|
|
7
8
|
--komc-color-blue-600: oklch(54.6% 0.245 262.881);
|
|
8
9
|
--komc-color-gray-100: oklch(96.7% 0.003 264.542);
|
|
@@ -11,10 +12,22 @@
|
|
|
11
12
|
--komc-color-neutral-100: oklch(97% 0 0);
|
|
12
13
|
--komc-color-neutral-200: oklch(92.2% 0 0);
|
|
13
14
|
--komc-color-neutral-300: oklch(87% 0 0);
|
|
15
|
+
--komc-color-neutral-400: oklch(70.8% 0 0);
|
|
14
16
|
--komc-color-neutral-900: oklch(20.5% 0 0);
|
|
15
17
|
--komc-color-black: #000;
|
|
16
18
|
--komc-color-white: #fff;
|
|
17
19
|
--komc-spacing: 0.25rem;
|
|
20
|
+
--komc-container-xs: 20rem;
|
|
21
|
+
--komc-container-sm: 24rem;
|
|
22
|
+
--komc-container-md: 28rem;
|
|
23
|
+
--komc-container-lg: 32rem;
|
|
24
|
+
--komc-container-xl: 36rem;
|
|
25
|
+
--komc-container-2xl: 42rem;
|
|
26
|
+
--komc-container-3xl: 48rem;
|
|
27
|
+
--komc-container-4xl: 56rem;
|
|
28
|
+
--komc-container-5xl: 64rem;
|
|
29
|
+
--komc-container-6xl: 72rem;
|
|
30
|
+
--komc-container-7xl: 80rem;
|
|
18
31
|
--komc-text-xs: 0.75rem;
|
|
19
32
|
--komc-text-xs--line-height: calc(1 / 0.75);
|
|
20
33
|
--komc-radius-sm: 0.25rem;
|
|
@@ -44,6 +57,9 @@
|
|
|
44
57
|
.komc\:relative {
|
|
45
58
|
position: relative;
|
|
46
59
|
}
|
|
60
|
+
.komc\:sticky {
|
|
61
|
+
position: sticky;
|
|
62
|
+
}
|
|
47
63
|
.komc\:top-0 {
|
|
48
64
|
top: calc(var(--komc-spacing) * 0);
|
|
49
65
|
}
|
|
@@ -92,12 +108,24 @@
|
|
|
92
108
|
.komc\:z-99 {
|
|
93
109
|
z-index: 99;
|
|
94
110
|
}
|
|
95
|
-
.komc\:
|
|
96
|
-
|
|
111
|
+
.komc\:z-1000 {
|
|
112
|
+
z-index: 1000;
|
|
113
|
+
}
|
|
114
|
+
.komc\:mx-auto {
|
|
115
|
+
margin-inline: auto;
|
|
116
|
+
}
|
|
117
|
+
.komc\:my-0 {
|
|
118
|
+
margin-block: calc(var(--komc-spacing) * 0);
|
|
97
119
|
}
|
|
98
120
|
.komc\:-mt-1 {
|
|
99
121
|
margin-top: calc(var(--komc-spacing) * -1);
|
|
100
122
|
}
|
|
123
|
+
.komc\:-mt-4 {
|
|
124
|
+
margin-top: calc(var(--komc-spacing) * -4);
|
|
125
|
+
}
|
|
126
|
+
.komc\:mt-1 {
|
|
127
|
+
margin-top: calc(var(--komc-spacing) * 1);
|
|
128
|
+
}
|
|
101
129
|
.komc\:-mr-1 {
|
|
102
130
|
margin-right: calc(var(--komc-spacing) * -1);
|
|
103
131
|
}
|
|
@@ -107,8 +135,11 @@
|
|
|
107
135
|
.komc\:-ml-1 {
|
|
108
136
|
margin-left: calc(var(--komc-spacing) * -1);
|
|
109
137
|
}
|
|
110
|
-
.komc
|
|
111
|
-
|
|
138
|
+
.komc\:-ml-4 {
|
|
139
|
+
margin-left: calc(var(--komc-spacing) * -4);
|
|
140
|
+
}
|
|
141
|
+
.komc\:block {
|
|
142
|
+
display: block;
|
|
112
143
|
}
|
|
113
144
|
.komc\:flex {
|
|
114
145
|
display: flex;
|
|
@@ -155,15 +186,33 @@
|
|
|
155
186
|
.komc\:h-16 {
|
|
156
187
|
height: calc(var(--komc-spacing) * 16);
|
|
157
188
|
}
|
|
189
|
+
.komc\:h-18 {
|
|
190
|
+
height: calc(var(--komc-spacing) * 18);
|
|
191
|
+
}
|
|
158
192
|
.komc\:h-20 {
|
|
159
193
|
height: calc(var(--komc-spacing) * 20);
|
|
160
194
|
}
|
|
195
|
+
.komc\:h-22 {
|
|
196
|
+
height: calc(var(--komc-spacing) * 22);
|
|
197
|
+
}
|
|
198
|
+
.komc\:h-22\.5 {
|
|
199
|
+
height: calc(var(--komc-spacing) * 22.5);
|
|
200
|
+
}
|
|
161
201
|
.komc\:h-24 {
|
|
162
202
|
height: calc(var(--komc-spacing) * 24);
|
|
163
203
|
}
|
|
204
|
+
.komc\:h-26 {
|
|
205
|
+
height: calc(var(--komc-spacing) * 26);
|
|
206
|
+
}
|
|
164
207
|
.komc\:h-28 {
|
|
165
208
|
height: calc(var(--komc-spacing) * 28);
|
|
166
209
|
}
|
|
210
|
+
.komc\:h-30 {
|
|
211
|
+
height: calc(var(--komc-spacing) * 30);
|
|
212
|
+
}
|
|
213
|
+
.komc\:h-50 {
|
|
214
|
+
height: calc(var(--komc-spacing) * 50);
|
|
215
|
+
}
|
|
167
216
|
.komc\:h-400 {
|
|
168
217
|
height: calc(var(--komc-spacing) * 400);
|
|
169
218
|
}
|
|
@@ -176,6 +225,12 @@
|
|
|
176
225
|
.komc\:h-full {
|
|
177
226
|
height: 100%;
|
|
178
227
|
}
|
|
228
|
+
.komc\:h-screen {
|
|
229
|
+
height: 100vh;
|
|
230
|
+
}
|
|
231
|
+
.komc\:min-h-10 {
|
|
232
|
+
min-height: calc(var(--komc-spacing) * 10);
|
|
233
|
+
}
|
|
179
234
|
.komc\:min-h-15 {
|
|
180
235
|
min-height: calc(var(--komc-spacing) * 15);
|
|
181
236
|
}
|
|
@@ -191,12 +246,63 @@
|
|
|
191
246
|
.komc\:w-max {
|
|
192
247
|
width: max-content;
|
|
193
248
|
}
|
|
249
|
+
.komc\:max-w-2xl {
|
|
250
|
+
max-width: var(--komc-container-2xl);
|
|
251
|
+
}
|
|
252
|
+
.komc\:max-w-3xl {
|
|
253
|
+
max-width: var(--komc-container-3xl);
|
|
254
|
+
}
|
|
255
|
+
.komc\:max-w-4xl {
|
|
256
|
+
max-width: var(--komc-container-4xl);
|
|
257
|
+
}
|
|
258
|
+
.komc\:max-w-5xl {
|
|
259
|
+
max-width: var(--komc-container-5xl);
|
|
260
|
+
}
|
|
261
|
+
.komc\:max-w-6xl {
|
|
262
|
+
max-width: var(--komc-container-6xl);
|
|
263
|
+
}
|
|
264
|
+
.komc\:max-w-7xl {
|
|
265
|
+
max-width: var(--komc-container-7xl);
|
|
266
|
+
}
|
|
194
267
|
.komc\:max-w-70 {
|
|
195
268
|
max-width: calc(var(--komc-spacing) * 70);
|
|
196
269
|
}
|
|
270
|
+
.komc\:max-w-330 {
|
|
271
|
+
max-width: calc(var(--komc-spacing) * 330);
|
|
272
|
+
}
|
|
273
|
+
.komc\:max-w-full {
|
|
274
|
+
max-width: 100%;
|
|
275
|
+
}
|
|
276
|
+
.komc\:max-w-lg {
|
|
277
|
+
max-width: var(--komc-container-lg);
|
|
278
|
+
}
|
|
279
|
+
.komc\:max-w-md {
|
|
280
|
+
max-width: var(--komc-container-md);
|
|
281
|
+
}
|
|
282
|
+
.komc\:max-w-sm {
|
|
283
|
+
max-width: var(--komc-container-sm);
|
|
284
|
+
}
|
|
285
|
+
.komc\:max-w-xl {
|
|
286
|
+
max-width: var(--komc-container-xl);
|
|
287
|
+
}
|
|
288
|
+
.komc\:max-w-xs {
|
|
289
|
+
max-width: var(--komc-container-xs);
|
|
290
|
+
}
|
|
291
|
+
.komc\:min-w-0 {
|
|
292
|
+
min-width: calc(var(--komc-spacing) * 0);
|
|
293
|
+
}
|
|
197
294
|
.komc\:shrink-0 {
|
|
198
295
|
flex-shrink: 0;
|
|
199
296
|
}
|
|
297
|
+
.komc\:grow {
|
|
298
|
+
flex-grow: 1;
|
|
299
|
+
}
|
|
300
|
+
.komc\:grow-0 {
|
|
301
|
+
flex-grow: 0;
|
|
302
|
+
}
|
|
303
|
+
.komc\:basis-full {
|
|
304
|
+
flex-basis: 100%;
|
|
305
|
+
}
|
|
200
306
|
.komc\:-translate-x-1\/2 {
|
|
201
307
|
--tw-translate-x: calc(calc(1/2 * 100%) * -1);
|
|
202
308
|
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
@@ -230,9 +336,15 @@
|
|
|
230
336
|
.komc\:grid-cols-4 {
|
|
231
337
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
232
338
|
}
|
|
339
|
+
.komc\:flex-col {
|
|
340
|
+
flex-direction: column;
|
|
341
|
+
}
|
|
233
342
|
.komc\:items-center {
|
|
234
343
|
align-items: center;
|
|
235
344
|
}
|
|
345
|
+
.komc\:justify-between {
|
|
346
|
+
justify-content: space-between;
|
|
347
|
+
}
|
|
236
348
|
.komc\:justify-center {
|
|
237
349
|
justify-content: center;
|
|
238
350
|
}
|
|
@@ -304,9 +416,15 @@
|
|
|
304
416
|
--tw-border-style: none;
|
|
305
417
|
border-style: none;
|
|
306
418
|
}
|
|
419
|
+
.komc\:border-black {
|
|
420
|
+
border-color: var(--komc-color-black);
|
|
421
|
+
}
|
|
307
422
|
.komc\:border-neutral-200 {
|
|
308
423
|
border-color: var(--komc-color-neutral-200);
|
|
309
424
|
}
|
|
425
|
+
.komc\:border-red-500 {
|
|
426
|
+
border-color: var(--komc-color-red-500);
|
|
427
|
+
}
|
|
310
428
|
.komc\:border-transparent {
|
|
311
429
|
border-color: transparent;
|
|
312
430
|
}
|
|
@@ -328,9 +446,6 @@
|
|
|
328
446
|
.komc\:bg-\[rgb\(95\,95\,96\)\] {
|
|
329
447
|
background-color: rgb(95,95,96);
|
|
330
448
|
}
|
|
331
|
-
.komc\:bg-black\! {
|
|
332
|
-
background-color: var(--komc-color-black) !important;
|
|
333
|
-
}
|
|
334
449
|
.komc\:bg-blue-500 {
|
|
335
450
|
background-color: var(--komc-color-blue-500);
|
|
336
451
|
}
|
|
@@ -346,15 +461,21 @@
|
|
|
346
461
|
.komc\:bg-neutral-100 {
|
|
347
462
|
background-color: var(--komc-color-neutral-100);
|
|
348
463
|
}
|
|
464
|
+
.komc\:bg-neutral-200 {
|
|
465
|
+
background-color: var(--komc-color-neutral-200);
|
|
466
|
+
}
|
|
467
|
+
.komc\:bg-neutral-300 {
|
|
468
|
+
background-color: var(--komc-color-neutral-300);
|
|
469
|
+
}
|
|
470
|
+
.komc\:bg-neutral-400\! {
|
|
471
|
+
background-color: var(--komc-color-neutral-400) !important;
|
|
472
|
+
}
|
|
349
473
|
.komc\:bg-transparent {
|
|
350
474
|
background-color: transparent;
|
|
351
475
|
}
|
|
352
476
|
.komc\:bg-white {
|
|
353
477
|
background-color: var(--komc-color-white);
|
|
354
478
|
}
|
|
355
|
-
.komc\:p-0 {
|
|
356
|
-
padding: calc(var(--komc-spacing) * 0);
|
|
357
|
-
}
|
|
358
479
|
.komc\:p-1 {
|
|
359
480
|
padding: calc(var(--komc-spacing) * 1);
|
|
360
481
|
}
|
|
@@ -367,6 +488,12 @@
|
|
|
367
488
|
.komc\:px-2 {
|
|
368
489
|
padding-inline: calc(var(--komc-spacing) * 2);
|
|
369
490
|
}
|
|
491
|
+
.komc\:pt-4 {
|
|
492
|
+
padding-top: calc(var(--komc-spacing) * 4);
|
|
493
|
+
}
|
|
494
|
+
.komc\:pl-4 {
|
|
495
|
+
padding-left: calc(var(--komc-spacing) * 4);
|
|
496
|
+
}
|
|
370
497
|
.komc\:text-xs {
|
|
371
498
|
font-size: var(--komc-text-xs);
|
|
372
499
|
line-height: var(--tw-leading, var(--komc-text-xs--line-height));
|
|
@@ -397,6 +524,11 @@
|
|
|
397
524
|
--tw-drop-shadow: var(--tw-drop-shadow-size);
|
|
398
525
|
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
|
399
526
|
}
|
|
527
|
+
.komc\:transition-all {
|
|
528
|
+
transition-property: all;
|
|
529
|
+
transition-timing-function: var(--tw-ease, var(--komc-default-transition-timing-function));
|
|
530
|
+
transition-duration: var(--tw-duration, var(--komc-default-transition-duration));
|
|
531
|
+
}
|
|
400
532
|
.komc\:transition-colors {
|
|
401
533
|
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
402
534
|
transition-timing-function: var(--tw-ease, var(--komc-default-transition-timing-function));
|
|
@@ -495,6 +627,13 @@
|
|
|
495
627
|
}
|
|
496
628
|
}
|
|
497
629
|
}
|
|
630
|
+
.komc\:hover\:bg-neutral-200 {
|
|
631
|
+
&:hover {
|
|
632
|
+
@media (hover: hover) {
|
|
633
|
+
background-color: var(--komc-color-neutral-200);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
498
637
|
.komc\:focus\:border-neutral-300 {
|
|
499
638
|
&:focus {
|
|
500
639
|
border-color: var(--komc-color-neutral-300);
|
|
@@ -520,14 +659,14 @@
|
|
|
520
659
|
opacity: 50%;
|
|
521
660
|
}
|
|
522
661
|
}
|
|
523
|
-
.komc\:xl\:
|
|
662
|
+
.komc\:xl\:max-w-full {
|
|
524
663
|
@media (width >= 80rem) {
|
|
525
|
-
|
|
664
|
+
max-width: 100%;
|
|
526
665
|
}
|
|
527
666
|
}
|
|
528
|
-
.komc
|
|
529
|
-
|
|
530
|
-
|
|
667
|
+
.komc\:xl\:p-10 {
|
|
668
|
+
@media (width >= 80rem) {
|
|
669
|
+
padding: calc(var(--komc-spacing) * 10);
|
|
531
670
|
}
|
|
532
671
|
}
|
|
533
672
|
.komc\:\[\&\>input\]\:h-full {
|
|
@@ -540,17 +679,6 @@
|
|
|
540
679
|
width: 100%;
|
|
541
680
|
}
|
|
542
681
|
}
|
|
543
|
-
.komc\:\[\&\>input\]\:border-none {
|
|
544
|
-
&>input {
|
|
545
|
-
--tw-border-style: none;
|
|
546
|
-
border-style: none;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
.komc\:\[\&\>input\]\:p-0 {
|
|
550
|
-
&>input {
|
|
551
|
-
padding: calc(var(--komc-spacing) * 0);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
682
|
.komc\:\[\&\>input\]\:outline-none {
|
|
555
683
|
&>input {
|
|
556
684
|
--tw-outline-style: none;
|
|
@@ -574,6 +702,22 @@
|
|
|
574
702
|
}
|
|
575
703
|
}
|
|
576
704
|
}
|
|
705
|
+
@layer base {
|
|
706
|
+
[data-komc], [data-komc] *, [data-komc] *::before, [data-komc] *::after {
|
|
707
|
+
margin: 0;
|
|
708
|
+
padding: 0;
|
|
709
|
+
border: 0 solid;
|
|
710
|
+
background-color: transparent;
|
|
711
|
+
box-sizing: border-box;
|
|
712
|
+
line-height: 1.5;
|
|
713
|
+
}
|
|
714
|
+
button[data-komc] {
|
|
715
|
+
cursor: pointer;
|
|
716
|
+
opacity: 1;
|
|
717
|
+
color: inherit;
|
|
718
|
+
border-radius: 0;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
577
721
|
@property --tw-translate-x {
|
|
578
722
|
syntax: "*";
|
|
579
723
|
inherits: false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../../chunk-Bmb41Sf3.cjs`),t=require(`../../util-CDkao6z3.cjs`),n=require(`../../hooks-DPYIex_y.cjs`);let r=require(`lodash-es`),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=(0,a.useCallback)(e=>{e&&(h(e.canScrollPrev()),_(e.canScrollNext()))},[]),y=(0,a.useCallback)(()=>{p?.scrollPrev()},[p]),b=(0,a.useCallback)(()=>{p?.scrollNext()},[p]),x=(0,a.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),y()):e.key===`ArrowRight`&&(e.preventDefault(),b())},[y,b]);return(0,a.useEffect)(()=>{!p||!r||r(p)},[p,r]),(0,a.useEffect)(()=>{if(p)return v(p),p.on(`reInit`,v),p.on(`select`,v),()=>{p?.off(`select`,v)}},[p,v]),(0,o.jsx)(u.Provider,{value:{carouselRef:f,api:p,options:n,orientation:e||(n?.axis===`y`?`vertical`:`horizontal`),scrollPrev:y,scrollNext:b,canScrollPrev:m,canScrollNext:g},children:(0,o.jsx)(`div`,{"data-komc":!0,onKeyDownCapture:x,className:t.f(`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.f(`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.f(`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,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,className:(0,i.default)(`komc:w-full`,t),onClick:r,...n,children:e})}function _({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 v=(0,s.cva)(t.f(`komc:absolute 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:``,false:``},placement:{top:``,bottom:``,left:``,right:``,"top-start":``,"top-end":``,"bottom-start":``,"bottom-end":``,"left-start":``,"left-end":``,"right-start":``,"right-end":``}},compoundVariants:[{portal:!0,placement:`top`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom`,className:`komc:translate-y-2`},{portal:!0,placement:`left`,className:`komc:-translate-x-2`},{portal:!0,placement:`right`,className:`komc:translate-x-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:!0,placement:`left-start`,className:`komc:-translate-x-2`},{portal:!0,placement:`left-end`,className:`komc:-translate-x-2`},{portal:!0,placement:`right-start`,className:`komc:translate-x-2`},{portal:!0,placement:`right-end`,className:`komc:translate-x-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:`left`,className:`komc:right-full komc:top-1/2 komc:-translate-y-1/2`},{portal:!1,placement:`right`,className:`komc:left-full komc:top-1/2 komc:-translate-y-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`},{portal:!1,placement:`left-start`,className:`komc:right-full komc:top-0`},{portal:!1,placement:`left-end`,className:`komc:right-full komc:bottom-0`},{portal:!1,placement:`right-start`,className:`komc:left-full komc:top-0`},{portal:!1,placement:`right-end`,className:`komc:left-full komc:bottom-0`}],defaultVariants:{placement:`top`,portal:!1}}),y=(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:v({portal:e,placement:r,className:n}),...i,children:t}));var b=y;const x=(0,s.cva)(t.f(`komc:absolute komc:w-2 komc:h-2 komc:bg-inherit`,`komc:transition-opacity komc:duration-300`),{variants:{placement:{top:t.f(`komc:top-full komc:-mt-1 komc:left-1/2`),bottom:t.f(`komc:bottom-full komc:-mb-1 komc:left-1/2`),left:t.f(`komc:left-full komc:-ml-1 komc:top-1/2`),right:t.f(`komc:right-full komc:-mr-1 komc:top-1/2`),"top-start":t.f(`komc:top-full komc:-mt-1 komc:left-5`),"top-end":t.f(`komc:top-full komc:-mt-1 komc:right-5`),"bottom-start":t.f(`komc:bottom-full komc:-mb-1 komc:left-5`),"bottom-end":t.f(`komc:bottom-full komc:-mb-1 komc:right-5`),"left-start":t.f(`komc:left-full komc:-ml-1 komc:top-3`),"left-end":t.f(`komc:left-full komc:-ml-1 komc:bottom-3`),"right-start":t.f(`komc:right-full komc:-mr-1 komc:top-3`),"right-end":t.f(`komc:right-full komc:-mr-1 komc:bottom-3`)}},defaultVariants:{placement:`top`}}),S=({placement:e,className:t,offset:n,style:r,...i})=>{let s=(0,a.useMemo)(()=>{switch(e){case`top`:return`rotate(45deg)`;case`bottom`:return`rotate(225deg)`;case`left`:return`rotate(-45deg)`;case`right`:return`rotate(135deg)`;case`top-start`:return`rotate(45deg)`;case`top-end`:return`rotate(45deg)`;case`bottom-start`:return`rotate(225deg)`;case`bottom-end`:return`rotate(225deg)`;case`left-start`:return`rotate(-45deg)`;case`left-end`:return`rotate(-45deg)`;case`right-start`:return`rotate(135deg)`;case`right-end`:return`rotate(135deg)`;default:return`rotate(45deg)`}},[e]);return(0,o.jsx)(`div`,{className:x({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${s}`},...i})};var C=S;const w=24,T=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function E({placement:e,className:t,content:n,open:s,hiddenRef:c,containerRef:u}){let[d,f]=(0,a.useState)(!1),p=(0,a.useRef)(null),[m,h]=(0,a.useState)(e),[g,_]=(0,a.useState)({top:0,left:0}),[v,y]=(0,a.useState)({x:0,y:0}),x=(0,a.useCallback)((0,r.debounce)(()=>{let e=u?.current,t=c.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=window.scrollY||document.documentElement.scrollTop,a=window.scrollX||document.documentElement.scrollLeft,[o,s]=m.split(`-`),l=i+n.top,d=a+n.left+n.width/2-r.width/2;switch(o){case`top`:l-=r.height;break;case`bottom`:l+=n.height;break;case`left`:l+=n.height/2-r.height/2,d-=r.width/2+n.width/2;break;case`right`:l+=n.height/2-r.height/2,d+=r.width/2+n.width/2;break}if([`top`,`bottom`].includes(o))switch(s){case`start`:d+=r.width/2-24;break;case`end`:d-=r.width/2-24;break}if([`left`,`right`].includes(o))switch(s){case`start`:l+=r.height/2+n.height/2-24;break;case`end`:l-=r.height/2+n.height/2-24;break}let f=d,p=window.innerWidth;f+r.width>p-4&&(f=p-r.width-4),f<4&&(f=4),_({top:l,left:f}),y({x:d-f,y:0})},50),[m]),S=(0,a.useCallback)((0,r.debounce)(()=>{if(!c.current)return;let{top:t,height:n}=c.current.getBoundingClientRect();h(r=>{let i=e;return t+n>=window.innerHeight?i=T(r,`top`):t<0&&(i=T(r,`bottom`)),i})},50),[e]);return(0,a.useEffect)(()=>(f(!0),S(),window.addEventListener(`scroll`,x,{passive:!0}),window.addEventListener(`resize`,x),window.addEventListener(`scroll`,S,{passive:!0}),window.addEventListener(`resize`,S),()=>{window.removeEventListener(`scroll`,x),window.removeEventListener(`resize`,x),window.removeEventListener(`scroll`,S),window.removeEventListener(`resize`,S)}),[x,S]),(0,a.useEffect)(()=>{d&&x()},[d,x]),d?(0,l.createPortal)((0,o.jsxs)(b,{ref:p,portal:!0,"data-komc":!0,placement:m,className:(0,i.default)(t,s?`komc:visible komc:opacity-100`:`komc:opacity-0 komc:invisible`),style:{...g},children:[(0,o.jsx)(`span`,{children:n}),(0,o.jsx)(C,{placement:m,offset:v})]}),document.body):null}const D=(0,a.forwardRef)(({children:e,content:t,defaultOpen:r=!1,className:s,placement:c=`top`},l)=>{let[u,d]=(0,a.useState)(r),f=(0,a.useRef)(null),p=(0,a.useRef)(null);return n.t({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)(_,{setOpen:d,children:e}),(0,o.jsx)(E,{placement:c,className:s,open:u,content:t,hiddenRef:p,containerRef:f}),(0,o.jsx)(b,{ref:p,role:`presentation`,placement:c,className:(0,i.default)(`komc:opacity-0 komc:invisible`,s),children:(0,o.jsx)(`span`,{children:t})})]})});var O=D;exports.Carousel=f,exports.CarouselItem=m,exports.CarouselNext=g,exports.CarouselPrevious=h,exports.CarouselWrapper=p,exports.Tooltip=O;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import * as react4 from "react";
|
|
2
|
+
import React$1, { ComponentProps, HTMLAttributes } from "react";
|
|
3
|
+
import useEmblaCarousel, { UseEmblaCarouselType } from "embla-carousel-react";
|
|
4
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/ui/client-only/carousel/carousel-context.d.ts
|
|
7
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
|
8
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
9
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
10
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
11
|
+
interface CarouselProps {
|
|
12
|
+
options?: CarouselOptions;
|
|
13
|
+
plugins?: CarouselPlugin;
|
|
14
|
+
orientation?: 'horizontal' | 'vertical';
|
|
15
|
+
setApi?: (api: CarouselApi) => void;
|
|
16
|
+
}
|
|
17
|
+
type CarouselContextProps = {
|
|
18
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
19
|
+
api: ReturnType<typeof useEmblaCarousel>[1];
|
|
20
|
+
scrollPrev: () => void;
|
|
21
|
+
scrollNext: () => void;
|
|
22
|
+
canScrollPrev: boolean;
|
|
23
|
+
canScrollNext: boolean;
|
|
24
|
+
} & CarouselProps;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/ui/client-only/carousel/carousel.d.ts
|
|
27
|
+
interface CarouselProps$1 extends ComponentProps<'div'>, CarouselProps {
|
|
28
|
+
/**
|
|
29
|
+
* @param orientation - Orientation of the carousel
|
|
30
|
+
* @default horizontal
|
|
31
|
+
* @property
|
|
32
|
+
* - horizontal
|
|
33
|
+
* - vertical
|
|
34
|
+
*/
|
|
35
|
+
orientation?: 'horizontal' | 'vertical';
|
|
36
|
+
/**
|
|
37
|
+
* @param options - Options of the carousel
|
|
38
|
+
* @default {}
|
|
39
|
+
*/
|
|
40
|
+
options?: CarouselProps['options'];
|
|
41
|
+
/**
|
|
42
|
+
* @param setApi - Set the API of the carousel
|
|
43
|
+
* @default undefined
|
|
44
|
+
*/
|
|
45
|
+
setApi?: CarouselProps['setApi'];
|
|
46
|
+
/**
|
|
47
|
+
* @param plugins - Plugins of the carousel
|
|
48
|
+
* @default []
|
|
49
|
+
*/
|
|
50
|
+
plugins?: CarouselProps['plugins'];
|
|
51
|
+
}
|
|
52
|
+
declare function Carousel({
|
|
53
|
+
orientation,
|
|
54
|
+
options,
|
|
55
|
+
setApi,
|
|
56
|
+
plugins,
|
|
57
|
+
className,
|
|
58
|
+
children,
|
|
59
|
+
...props
|
|
60
|
+
}: CarouselProps$1): react_jsx_runtime4.JSX.Element;
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/ui/client-only/carousel/carousel-wrapper.d.ts
|
|
63
|
+
declare function CarouselWrapper({
|
|
64
|
+
className,
|
|
65
|
+
...props
|
|
66
|
+
}: React$1.ComponentProps<'div'>): react_jsx_runtime4.JSX.Element;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/ui/client-only/carousel/carousel-item.d.ts
|
|
69
|
+
declare function CarouselItem({
|
|
70
|
+
className,
|
|
71
|
+
...props
|
|
72
|
+
}: React$1.ComponentProps<'div'>): react_jsx_runtime4.JSX.Element;
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/ui/client-only/carousel/carousel-previous.d.ts
|
|
75
|
+
declare function CarouselPrevious({
|
|
76
|
+
children,
|
|
77
|
+
className,
|
|
78
|
+
...props
|
|
79
|
+
}: React$1.ComponentProps<'button'>): react_jsx_runtime4.JSX.Element;
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/ui/client-only/carousel/carousel-next.d.ts
|
|
82
|
+
declare function CarouselNext({
|
|
83
|
+
children,
|
|
84
|
+
className,
|
|
85
|
+
...props
|
|
86
|
+
}: React$1.ComponentProps<'button'>): react_jsx_runtime4.JSX.Element;
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/ui/client-only/tooltip/tooltip-container.d.ts
|
|
89
|
+
type SubPlacement = 'start' | 'end';
|
|
90
|
+
type MainPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
91
|
+
type TooltipPlacement = MainPlacement | `${MainPlacement}-${SubPlacement}`;
|
|
92
|
+
interface TooltipContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
93
|
+
/**
|
|
94
|
+
* @param children - Trigger element
|
|
95
|
+
*/
|
|
96
|
+
children: React.ReactNode;
|
|
97
|
+
/**
|
|
98
|
+
* @param content - Tooltip content
|
|
99
|
+
*/
|
|
100
|
+
content: string;
|
|
101
|
+
/**
|
|
102
|
+
* @param placement - Placement of the tooltip
|
|
103
|
+
* @default top
|
|
104
|
+
* @property
|
|
105
|
+
* - top
|
|
106
|
+
* - bottom
|
|
107
|
+
* - left
|
|
108
|
+
* - right
|
|
109
|
+
* - top-start
|
|
110
|
+
* - top-end
|
|
111
|
+
* - bottom-start
|
|
112
|
+
* - bottom-end
|
|
113
|
+
* - left-start
|
|
114
|
+
* - left-end
|
|
115
|
+
* - right-start
|
|
116
|
+
* - right-end
|
|
117
|
+
*/
|
|
118
|
+
placement?: TooltipPlacement;
|
|
119
|
+
/**
|
|
120
|
+
* @param defaultOpen - Default open state of the tooltip
|
|
121
|
+
* @default false
|
|
122
|
+
* @property
|
|
123
|
+
* - true: Open the tooltip
|
|
124
|
+
* - false: Close the tooltip
|
|
125
|
+
*/
|
|
126
|
+
defaultOpen?: boolean;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* @param children - Trigger element
|
|
130
|
+
* @param content - Tooltip content
|
|
131
|
+
* @param defaultOpen - Default open state of the tooltip
|
|
132
|
+
* @param placement - Placement of the tooltip
|
|
133
|
+
*/
|
|
134
|
+
declare const TooltipContainer: react4.ForwardRefExoticComponent<TooltipContainerProps & react4.RefAttributes<HTMLDivElement>>;
|
|
135
|
+
//#endregion
|
|
136
|
+
export { Carousel, type CarouselApi, type CarouselContextProps, CarouselItem, CarouselNext, type CarouselOptions, type CarouselPlugin, CarouselPrevious, type CarouselProps, CarouselWrapper, TooltipContainer as Tooltip, type TooltipContainerProps as TooltipProps };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import * as react0 from "react";
|
|
2
|
+
import React$1, { ComponentProps, HTMLAttributes } from "react";
|
|
3
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
4
|
+
import useEmblaCarousel, { UseEmblaCarouselType } from "embla-carousel-react";
|
|
5
|
+
|
|
6
|
+
//#region src/ui/client-only/carousel/carousel-context.d.ts
|
|
7
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
|
8
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
9
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
10
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
11
|
+
interface CarouselProps {
|
|
12
|
+
options?: CarouselOptions;
|
|
13
|
+
plugins?: CarouselPlugin;
|
|
14
|
+
orientation?: 'horizontal' | 'vertical';
|
|
15
|
+
setApi?: (api: CarouselApi) => void;
|
|
16
|
+
}
|
|
17
|
+
type CarouselContextProps = {
|
|
18
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
19
|
+
api: ReturnType<typeof useEmblaCarousel>[1];
|
|
20
|
+
scrollPrev: () => void;
|
|
21
|
+
scrollNext: () => void;
|
|
22
|
+
canScrollPrev: boolean;
|
|
23
|
+
canScrollNext: boolean;
|
|
24
|
+
} & CarouselProps;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/ui/client-only/carousel/carousel.d.ts
|
|
27
|
+
interface CarouselProps$1 extends ComponentProps<'div'>, CarouselProps {
|
|
28
|
+
/**
|
|
29
|
+
* @param orientation - Orientation of the carousel
|
|
30
|
+
* @default horizontal
|
|
31
|
+
* @property
|
|
32
|
+
* - horizontal
|
|
33
|
+
* - vertical
|
|
34
|
+
*/
|
|
35
|
+
orientation?: 'horizontal' | 'vertical';
|
|
36
|
+
/**
|
|
37
|
+
* @param options - Options of the carousel
|
|
38
|
+
* @default {}
|
|
39
|
+
*/
|
|
40
|
+
options?: CarouselProps['options'];
|
|
41
|
+
/**
|
|
42
|
+
* @param setApi - Set the API of the carousel
|
|
43
|
+
* @default undefined
|
|
44
|
+
*/
|
|
45
|
+
setApi?: CarouselProps['setApi'];
|
|
46
|
+
/**
|
|
47
|
+
* @param plugins - Plugins of the carousel
|
|
48
|
+
* @default []
|
|
49
|
+
*/
|
|
50
|
+
plugins?: CarouselProps['plugins'];
|
|
51
|
+
}
|
|
52
|
+
declare function Carousel({
|
|
53
|
+
orientation,
|
|
54
|
+
options,
|
|
55
|
+
setApi,
|
|
56
|
+
plugins,
|
|
57
|
+
className,
|
|
58
|
+
children,
|
|
59
|
+
...props
|
|
60
|
+
}: CarouselProps$1): react_jsx_runtime3.JSX.Element;
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/ui/client-only/carousel/carousel-wrapper.d.ts
|
|
63
|
+
declare function CarouselWrapper({
|
|
64
|
+
className,
|
|
65
|
+
...props
|
|
66
|
+
}: React$1.ComponentProps<'div'>): react_jsx_runtime3.JSX.Element;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/ui/client-only/carousel/carousel-item.d.ts
|
|
69
|
+
declare function CarouselItem({
|
|
70
|
+
className,
|
|
71
|
+
...props
|
|
72
|
+
}: React$1.ComponentProps<'div'>): react_jsx_runtime3.JSX.Element;
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/ui/client-only/carousel/carousel-previous.d.ts
|
|
75
|
+
declare function CarouselPrevious({
|
|
76
|
+
children,
|
|
77
|
+
className,
|
|
78
|
+
...props
|
|
79
|
+
}: React$1.ComponentProps<'button'>): react_jsx_runtime3.JSX.Element;
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/ui/client-only/carousel/carousel-next.d.ts
|
|
82
|
+
declare function CarouselNext({
|
|
83
|
+
children,
|
|
84
|
+
className,
|
|
85
|
+
...props
|
|
86
|
+
}: React$1.ComponentProps<'button'>): react_jsx_runtime3.JSX.Element;
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/ui/client-only/tooltip/tooltip-container.d.ts
|
|
89
|
+
type SubPlacement = 'start' | 'end';
|
|
90
|
+
type MainPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
91
|
+
type TooltipPlacement = MainPlacement | `${MainPlacement}-${SubPlacement}`;
|
|
92
|
+
interface TooltipContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
93
|
+
/**
|
|
94
|
+
* @param children - Trigger element
|
|
95
|
+
*/
|
|
96
|
+
children: React.ReactNode;
|
|
97
|
+
/**
|
|
98
|
+
* @param content - Tooltip content
|
|
99
|
+
*/
|
|
100
|
+
content: string;
|
|
101
|
+
/**
|
|
102
|
+
* @param placement - Placement of the tooltip
|
|
103
|
+
* @default top
|
|
104
|
+
* @property
|
|
105
|
+
* - top
|
|
106
|
+
* - bottom
|
|
107
|
+
* - left
|
|
108
|
+
* - right
|
|
109
|
+
* - top-start
|
|
110
|
+
* - top-end
|
|
111
|
+
* - bottom-start
|
|
112
|
+
* - bottom-end
|
|
113
|
+
* - left-start
|
|
114
|
+
* - left-end
|
|
115
|
+
* - right-start
|
|
116
|
+
* - right-end
|
|
117
|
+
*/
|
|
118
|
+
placement?: TooltipPlacement;
|
|
119
|
+
/**
|
|
120
|
+
* @param defaultOpen - Default open state of the tooltip
|
|
121
|
+
* @default false
|
|
122
|
+
* @property
|
|
123
|
+
* - true: Open the tooltip
|
|
124
|
+
* - false: Close the tooltip
|
|
125
|
+
*/
|
|
126
|
+
defaultOpen?: boolean;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* @param children - Trigger element
|
|
130
|
+
* @param content - Tooltip content
|
|
131
|
+
* @param defaultOpen - Default open state of the tooltip
|
|
132
|
+
* @param placement - Placement of the tooltip
|
|
133
|
+
*/
|
|
134
|
+
declare const TooltipContainer: react0.ForwardRefExoticComponent<TooltipContainerProps & react0.RefAttributes<HTMLDivElement>>;
|
|
135
|
+
//#endregion
|
|
136
|
+
export { Carousel, type CarouselApi, type CarouselContextProps, CarouselItem, CarouselNext, type CarouselOptions, type CarouselPlugin, CarouselPrevious, type CarouselProps, CarouselWrapper, TooltipContainer as Tooltip, type TooltipContainerProps as TooltipProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as e}from"../../util-BrmjOcya.mjs";import{t}from"../../hooks-C9M3V-Pb.mjs";import{debounce as n}from"lodash-es";import r from"clsx";import i,{forwardRef as a,useCallback as o,useEffect as s,useMemo as c,useRef as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{cva as p}from"class-variance-authority";import m from"embla-carousel-react";import{createPortal as h}from"react-dom";const g=i.createContext(null);function _(){let e=i.useContext(g);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}function v({orientation:t=`horizontal`,options:n,setApi:r,plugins:i,className:a,children:c,...l}){let[f,p]=m({...n,axis:t===`horizontal`?`x`:`y`},i),[h,_]=u(!1),[v,y]=u(!1),b=o(e=>{e&&(_(e.canScrollPrev()),y(e.canScrollNext()))},[]),x=o(()=>{p?.scrollPrev()},[p]),S=o(()=>{p?.scrollNext()},[p]),C=o(e=>{e.key===`ArrowLeft`?(e.preventDefault(),x()):e.key===`ArrowRight`&&(e.preventDefault(),S())},[x,S]);return s(()=>{!p||!r||r(p)},[p,r]),s(()=>{if(p)return b(p),p.on(`reInit`,b),p.on(`select`,b),()=>{p?.off(`select`,b)}},[p,b]),d(g.Provider,{value:{carouselRef:f,api:p,options:n,orientation:t||(n?.axis===`y`?`vertical`:`horizontal`),scrollPrev:x,scrollNext:S,canScrollPrev:h,canScrollNext:v},children:d(`div`,{"data-komc":!0,onKeyDownCapture:C,className:e(`komc:relative`,a),...l,children:c})})}function y({className:t,...n}){let{carouselRef:r,orientation:i}=_();return d(`div`,{ref:r,"data-komc":!0,className:`komc:h-full komc:overflow-hidden`,children:d(`div`,{className:e(`komc:flex komc:h-full`,i===`horizontal`?`komc:-ml-4`:`komc:-mt-4 komc:flex-col`,t),...n})})}function b({className:t,...n}){let{orientation:r}=_();return d(`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 x({children:e,className:t,...n}){let{scrollPrev:i,canScrollPrev:a}=_();return d(`button`,{type:`button`,"data-komc":!0,disabled:!a,className:r(`komc:w-full`,t),onClick:i,...n,children:e})}function S({children:e,className:t,...n}){let{scrollNext:i,canScrollNext:a}=_();return d(`button`,{type:`button`,"data-komc":!0,disabled:!a,className:r(`komc:w-full`,t),onClick:i,...n,children:e})}function C({children:e,setOpen:t}){return d(`div`,{"data-komc":!0,className:r(`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 w=p(e(`komc:absolute 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:``,false:``},placement:{top:``,bottom:``,left:``,right:``,"top-start":``,"top-end":``,"bottom-start":``,"bottom-end":``,"left-start":``,"left-end":``,"right-start":``,"right-end":``}},compoundVariants:[{portal:!0,placement:`top`,className:`komc:-translate-y-2`},{portal:!0,placement:`bottom`,className:`komc:translate-y-2`},{portal:!0,placement:`left`,className:`komc:-translate-x-2`},{portal:!0,placement:`right`,className:`komc:translate-x-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:!0,placement:`left-start`,className:`komc:-translate-x-2`},{portal:!0,placement:`left-end`,className:`komc:-translate-x-2`},{portal:!0,placement:`right-start`,className:`komc:translate-x-2`},{portal:!0,placement:`right-end`,className:`komc:translate-x-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:`left`,className:`komc:right-full komc:top-1/2 komc:-translate-y-1/2`},{portal:!1,placement:`right`,className:`komc:left-full komc:top-1/2 komc:-translate-y-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`},{portal:!1,placement:`left-start`,className:`komc:right-full komc:top-0`},{portal:!1,placement:`left-end`,className:`komc:right-full komc:bottom-0`},{portal:!1,placement:`right-start`,className:`komc:left-full komc:top-0`},{portal:!1,placement:`right-end`,className:`komc:left-full komc:bottom-0`}],defaultVariants:{placement:`top`,portal:!1}});var T=a(({portal:e,children:t,className:n,placement:r,...i},a)=>d(`div`,{ref:a,"data-komc":!0,role:`tooltip`,className:w({portal:e,placement:r,className:n}),...i,children:t}));const E=p(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`),left:e(`komc:left-full komc:-ml-1 komc:top-1/2`),right:e(`komc:right-full komc:-mr-1 komc:top-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`),"left-start":e(`komc:left-full komc:-ml-1 komc:top-3`),"left-end":e(`komc:left-full komc:-ml-1 komc:bottom-3`),"right-start":e(`komc:right-full komc:-mr-1 komc:top-3`),"right-end":e(`komc:right-full komc:-mr-1 komc:bottom-3`)}},defaultVariants:{placement:`top`}});var D=({placement:e,className:t,offset:n,style:r,...i})=>{let a=c(()=>{switch(e){case`top`:return`rotate(45deg)`;case`bottom`:return`rotate(225deg)`;case`left`:return`rotate(-45deg)`;case`right`:return`rotate(135deg)`;case`top-start`:return`rotate(45deg)`;case`top-end`:return`rotate(45deg)`;case`bottom-start`:return`rotate(225deg)`;case`bottom-end`:return`rotate(225deg)`;case`left-start`:return`rotate(-45deg)`;case`left-end`:return`rotate(-45deg)`;case`right-start`:return`rotate(135deg)`;case`right-end`:return`rotate(135deg)`;default:return`rotate(45deg)`}},[e]);return d(`div`,{className:E({placement:e,className:t}),style:{transform:`translate(${n?.x}px, ${n?.y}px) ${a}`},...i})};const O=(e,t)=>{let[,n]=e.split(`-`);return n?`${t}-${n}`:t};function k({placement:e,className:t,content:i,open:a,hiddenRef:c,containerRef:p}){let[m,g]=u(!1),_=l(null),[v,y]=u(e),[b,x]=u({top:0,left:0}),[S,C]=u({x:0,y:0}),w=o(n(()=>{let e=p?.current,t=c.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=window.scrollY||document.documentElement.scrollTop,a=window.scrollX||document.documentElement.scrollLeft,[o,s]=v.split(`-`),l=i+n.top,u=a+n.left+n.width/2-r.width/2;switch(o){case`top`:l-=r.height;break;case`bottom`:l+=n.height;break;case`left`:l+=n.height/2-r.height/2,u-=r.width/2+n.width/2;break;case`right`:l+=n.height/2-r.height/2,u+=r.width/2+n.width/2;break}if([`top`,`bottom`].includes(o))switch(s){case`start`:u+=r.width/2-24;break;case`end`:u-=r.width/2-24;break}if([`left`,`right`].includes(o))switch(s){case`start`:l+=r.height/2+n.height/2-24;break;case`end`:l-=r.height/2+n.height/2-24;break}let d=u,f=window.innerWidth;d+r.width>f-4&&(d=f-r.width-4),d<4&&(d=4),x({top:l,left:d}),C({x:u-d,y:0})},50),[v]),E=o(n(()=>{if(!c.current)return;let{top:t,height:n}=c.current.getBoundingClientRect();y(r=>{let i=e;return t+n>=window.innerHeight?i=O(r,`top`):t<0&&(i=O(r,`bottom`)),i})},50),[e]);return s(()=>(g(!0),E(),window.addEventListener(`scroll`,w,{passive:!0}),window.addEventListener(`resize`,w),window.addEventListener(`scroll`,E,{passive:!0}),window.addEventListener(`resize`,E),()=>{window.removeEventListener(`scroll`,w),window.removeEventListener(`resize`,w),window.removeEventListener(`scroll`,E),window.removeEventListener(`resize`,E)}),[w,E]),s(()=>{m&&w()},[m,w]),m?h(f(T,{ref:_,portal:!0,"data-komc":!0,placement:v,className:r(t,a?`komc:visible komc:opacity-100`:`komc:opacity-0 komc:invisible`),style:{...b},children:[d(`span`,{children:i}),d(D,{placement:v,offset:S})]}),document.body):null}var A=a(({children:e,content:n,defaultOpen:i=!1,className:a,placement:o=`top`},s)=>{let[c,p]=u(i),m=l(null),h=l(null);return t({ref:m,setOpen:p}),f(`div`,{ref:m,"data-komc":!0,className:`komc:flex komc:shrink-0 komc:relative komc:overflow-hidden komc:w-fit komc:h-fit`,children:[d(C,{setOpen:p,children:e}),d(k,{placement:o,className:a,open:c,content:n,hiddenRef:h,containerRef:m}),d(T,{ref:h,role:`presentation`,placement:o,className:r(`komc:opacity-0 komc:invisible`,a),children:d(`span`,{children:n})})]})});export{v as Carousel,b as CarouselItem,S as CarouselNext,x as CarouselPrevious,y as CarouselWrapper,A as Tooltip};
|