@exem-ui/react 0.3.2 → 0.3.3

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.
@@ -0,0 +1,684 @@
1
+ import { ChevronDown } from './chunk-LZWKMQJL.mjs';
2
+ import { cva, cn } from '@exem-ui/core/utils';
3
+ import * as TabsPrimitive from '@radix-ui/react-tabs';
4
+ import * as React from 'react';
5
+ import { createContext, forwardRef, useId, useContext, createElement, useRef, useState } from 'react';
6
+ import { jsx, jsxs } from 'react/jsx-runtime';
7
+ import * as SelectPrimitive from '@radix-ui/react-select';
8
+ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
9
+
10
+ var segmentListVariants = cva(
11
+ "inline-flex items-center overflow-hidden rounded-medium bg-elevation-elevation-2",
12
+ {
13
+ variants: {
14
+ size: {
15
+ small: "h-7 gap-0 p-0.5",
16
+ medium: "h-8 gap-0 p-0.5",
17
+ large: "h-10 gap-0 p-0.5"
18
+ }
19
+ },
20
+ defaultVariants: {
21
+ size: "medium"
22
+ }
23
+ }
24
+ );
25
+ var segmentItemVariants = cva(
26
+ [
27
+ "flex flex-1 items-center justify-center rounded-weak",
28
+ "focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-ring",
29
+ "disabled:cursor-not-allowed",
30
+ "data-[state=active]:bg-component-segmentedOption data-[state=active]:text-text-primary data-[state=active]:shadow-weak",
31
+ "data-[state=inactive]:text-text-tertiary data-[state=inactive]:disabled:text-text-disabled",
32
+ "transition-colors duration-200 ease-in-out"
33
+ ],
34
+ {
35
+ variants: {
36
+ size: {
37
+ small: "h-6 gap-0.5 text-body-3 font-medium",
38
+ medium: "h-7 gap-1 text-body-2 font-medium",
39
+ large: "h-9 gap-1.5 text-body-2 font-medium"
40
+ }
41
+ },
42
+ defaultVariants: {
43
+ size: "medium"
44
+ }
45
+ }
46
+ );
47
+ var segmentIconVariants = cva("flex items-center justify-center", {
48
+ variants: {
49
+ size: {
50
+ small: "size-4",
51
+ medium: "size-4",
52
+ large: "size-5"
53
+ }
54
+ },
55
+ defaultVariants: {
56
+ size: "medium"
57
+ }
58
+ });
59
+ var SegmentContext = createContext(void 0);
60
+ var useSegmentContext = () => {
61
+ const context = useContext(SegmentContext);
62
+ if (!context) {
63
+ throw new Error("Segment components must be used within a Segment");
64
+ }
65
+ return context;
66
+ };
67
+ var Segment = forwardRef(
68
+ ({ size = "medium", children, ...props }, ref) => /* @__PURE__ */ jsx(SegmentContext.Provider, { value: { size }, children: /* @__PURE__ */ jsx(TabsPrimitive.Root, { ref, ...props, children }) })
69
+ );
70
+ Segment.List = forwardRef(
71
+ ({ className, ...props }, ref) => {
72
+ const { size } = useSegmentContext();
73
+ return /* @__PURE__ */ jsx(
74
+ TabsPrimitive.List,
75
+ {
76
+ ref,
77
+ className: cn(segmentListVariants({ size }), className),
78
+ ...props
79
+ }
80
+ );
81
+ }
82
+ );
83
+ Segment.Item = forwardRef(
84
+ ({ className, leftIcon, children, ...props }, ref) => {
85
+ const { size } = useSegmentContext();
86
+ return /* @__PURE__ */ jsxs(
87
+ TabsPrimitive.Trigger,
88
+ {
89
+ ref,
90
+ className: cn(segmentItemVariants({ size }), className),
91
+ ...props,
92
+ children: [
93
+ leftIcon && /* @__PURE__ */ jsx("span", { className: cn(segmentIconVariants({ size })), children: leftIcon }),
94
+ /* @__PURE__ */ jsx("span", { className: "flex items-center", children })
95
+ ]
96
+ }
97
+ );
98
+ }
99
+ );
100
+ Segment.Content = forwardRef(
101
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
102
+ TabsPrimitive.Content,
103
+ {
104
+ ref,
105
+ className: cn(
106
+ "ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
107
+ className
108
+ ),
109
+ ...props
110
+ }
111
+ )
112
+ );
113
+ Segment.displayName = "Segment";
114
+ Segment.List.displayName = "Segment.List";
115
+ Segment.Content.displayName = "Segment.Content";
116
+ Segment.Item.displayName = "Segment.Item";
117
+ var FlatSegment = ({ items, disabled, className, ...props }) => /* @__PURE__ */ jsx(Segment, { ...props, children: /* @__PURE__ */ jsx(Segment.List, { className, children: items.map((item) => /* @__PURE__ */ createElement(Segment.Item, { ...item, key: item.value, disabled: disabled || item.disabled })) }) });
118
+ FlatSegment.displayName = "FlatSegment";
119
+ var commonInputVariants = {
120
+ // Container variants - 전체 컴포넌트 래퍼
121
+ container: cva("flex flex-col"),
122
+ // Label variants - 라벨 텍스트
123
+ label: cva("inline-block font-regular text-text-primary", {
124
+ variants: {
125
+ size: {
126
+ xsmall: "mb-[2px] text-body-3",
127
+ small: "mb-[4px] text-body-2",
128
+ medium: "mb-[4px] text-body-2",
129
+ large: "mb-[6px] text-body-1"
130
+ },
131
+ disabled: {
132
+ true: "text-text-disabled"
133
+ },
134
+ required: {
135
+ true: 'after:ml-0.5 after:text-text-critical after:content-["*"]'
136
+ }
137
+ },
138
+ compoundVariants: [
139
+ {
140
+ required: true,
141
+ disabled: true,
142
+ className: "after:text-text-disabled"
143
+ }
144
+ ],
145
+ defaultVariants: { size: "medium" }
146
+ }),
147
+ // Description variants - 설명 텍스트
148
+ description: cva("mt-0.5 inline-block text-text-tertiary", {
149
+ variants: {
150
+ size: {
151
+ xsmall: "text-caption",
152
+ small: "text-body-3",
153
+ medium: "text-body-3",
154
+ large: "text-body-2"
155
+ },
156
+ error: {
157
+ true: "text-text-critical"
158
+ },
159
+ disabled: {
160
+ true: "text-text-disabled"
161
+ }
162
+ },
163
+ compoundVariants: [
164
+ {
165
+ error: true,
166
+ disabled: true,
167
+ className: "text-text-disabled"
168
+ // disabled 우선 적용
169
+ }
170
+ ],
171
+ defaultVariants: { size: "medium" }
172
+ }),
173
+ // Icon variants - 아이콘 크기
174
+ icon: cva("shrink-0", {
175
+ variants: {
176
+ size: {
177
+ xsmall: "size-4",
178
+ small: "size-4",
179
+ medium: "size-4",
180
+ large: "size-5"
181
+ }
182
+ },
183
+ defaultVariants: { size: "medium" }
184
+ })
185
+ };
186
+
187
+ // src/input/selectVariants.ts
188
+ var selectVariants = {
189
+ container: commonInputVariants.container,
190
+ content: cn(
191
+ "relative border border-border-primary z-50 min-w-[8rem] overflow-hidden rounded-medium bg-background-overlay shadow-weak",
192
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
193
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1"
194
+ ),
195
+ description: commonInputVariants.description,
196
+ iconSize: commonInputVariants.icon,
197
+ item: cva(
198
+ "relative flex w-full cursor-pointer select-none items-center rounded-weak px-2 text-body-2 text-text-primary outline-none hover:bg-elevation-elevation-2 data-[disabled]:pointer-events-none data-[state=checked]:bg-elevation-accent data-[disabled]:text-text-disabled",
199
+ {
200
+ defaultVariants: { size: "medium" },
201
+ variants: {
202
+ size: {
203
+ xsmall: "h-6",
204
+ small: "h-7",
205
+ medium: "h-8",
206
+ large: "h-10"
207
+ }
208
+ }
209
+ }
210
+ ),
211
+ itemText: cva("truncate flex items-center flex-1 min-w-0", {
212
+ defaultVariants: { size: "medium" },
213
+ variants: {
214
+ size: {
215
+ xsmall: "h-6",
216
+ small: "h-7",
217
+ medium: "h-8",
218
+ large: "h-10"
219
+ }
220
+ }
221
+ }),
222
+ label: commonInputVariants.label,
223
+ trigger: cva(
224
+ "group flex w-full items-center justify-between rounded-medium outline-none disabled:cursor-not-allowed disabled:bg-elevation-elevation-2 disabled:text-text-disabled data-[state=open]:border data-[state=open]:border-border-focused [&>span]:line-clamp-1 [&[data-placeholder]]:text-text-tertiary [&_svg]:text-icon-primary",
225
+ {
226
+ compoundVariants: [
227
+ {
228
+ className: "border-border-accent text-tint-foreground-sky bg-elevation-accent [&[data-placeholder]]:text-tint-foreground-sky [&_svg]:text-tint-foreground-sky",
229
+ focus: true,
230
+ variant: "line"
231
+ },
232
+ // active + fill: 배경만 accent로 변경
233
+ {
234
+ className: "bg-elevation-accent text-tint-foreground-sky [&[data-placeholder]]:text-tint-foreground-sky [&_svg]:text-tint-foreground-sky",
235
+ active: true,
236
+ variant: "fill"
237
+ },
238
+ // active + line: 배경 accent + 테두리 accent
239
+ {
240
+ className: "bg-elevation-accent border-border-accent text-tint-foreground-sky [&[data-placeholder]]:text-tint-foreground-sky [&_svg]:text-tint-foreground-sky",
241
+ active: true,
242
+ variant: "line"
243
+ }
244
+ ],
245
+ defaultVariants: {
246
+ active: false,
247
+ error: false,
248
+ focus: false,
249
+ size: "medium",
250
+ variant: "fill"
251
+ },
252
+ variants: {
253
+ active: {
254
+ false: "",
255
+ true: ""
256
+ },
257
+ error: {
258
+ false: "",
259
+ true: "border !border-border-critical"
260
+ },
261
+ focus: {
262
+ false: "",
263
+ // 현재는 line 타입만 focus 가능
264
+ true: ""
265
+ },
266
+ size: {
267
+ xsmall: "h-6 px-[4px] text-body-3",
268
+ small: "h-7 px-[6px] text-body-2",
269
+ medium: "h-8 px-[8px] text-body-2",
270
+ large: "h-10 px-[10px] text-body-1"
271
+ },
272
+ variant: {
273
+ fill: "bg-elevation-elevation-2",
274
+ line: "border-border-primary border"
275
+ }
276
+ }
277
+ }
278
+ ),
279
+ triggerInner: cva("flex w-full items-center", {
280
+ defaultVariants: { size: "medium" },
281
+ variants: {
282
+ size: {
283
+ xsmall: "gap-0",
284
+ small: "gap-[2px]",
285
+ medium: "gap-[2px]",
286
+ large: "gap-[4px]"
287
+ }
288
+ }
289
+ }),
290
+ viewport: cn("flex flex-col gap-0.5 p-1")
291
+ };
292
+ var SelectContext = createContext(null);
293
+ var useSelectContext = () => {
294
+ const context = useContext(SelectContext);
295
+ if (!context) {
296
+ throw new Error("Select components must be used within a Select");
297
+ }
298
+ return context;
299
+ };
300
+ var SelectGroupContext = createContext(null);
301
+ var useSelectGroupContext = () => {
302
+ return useContext(SelectGroupContext);
303
+ };
304
+ var Select = forwardRef(
305
+ ({
306
+ children,
307
+ size = "medium",
308
+ variant = "fill",
309
+ error = false,
310
+ disabled = false,
311
+ focus = false,
312
+ active = false,
313
+ className,
314
+ ...selectProps
315
+ }, ref) => {
316
+ const uniqueId = useId();
317
+ const id = `select-${uniqueId}`;
318
+ return /* @__PURE__ */ jsx(SelectContext.Provider, { value: { active, disabled, error, focus, id, size, variant }, children: /* @__PURE__ */ jsx("div", { ref, className: cn(selectVariants.container(), className), children: /* @__PURE__ */ jsx(SelectPrimitive.Root, { disabled, ...selectProps, children }) }) });
319
+ }
320
+ );
321
+ Select.Value = forwardRef(({ className, children, ...props }, ref) => {
322
+ return /* @__PURE__ */ jsx(SelectPrimitive.Value, { ref, className, ...props, children });
323
+ });
324
+ Select.Trigger = forwardRef(
325
+ ({ className, children, leftIcon, ...props }, ref) => {
326
+ const { size, error, id, variant, focus, active } = useSelectContext();
327
+ const groupContext = useSelectGroupContext();
328
+ const groupClasses = groupContext ? cn("rounded-none border-0", {
329
+ "rounded-l-medium": groupContext.isFirstChild,
330
+ "rounded-r-medium": groupContext.isLastChild,
331
+ // line variant: group이 외곽 border를 제공하므로, open 시 border 대신 inset ring 사용
332
+ "data-[state=open]:border-0 data-[state=open]:ring-1 data-[state=open]:ring-inset data-[state=open]:ring-border-focused": variant === "line"
333
+ }) : void 0;
334
+ return /* @__PURE__ */ jsx(
335
+ SelectPrimitive.Trigger,
336
+ {
337
+ ref,
338
+ id,
339
+ "data-slot": "select-trigger",
340
+ className: cn(
341
+ selectVariants.trigger({ active, error, focus, size, variant }),
342
+ groupClasses,
343
+ className
344
+ ),
345
+ ...props,
346
+ children: /* @__PURE__ */ jsxs("div", { className: cn(selectVariants.triggerInner({ size })), children: [
347
+ leftIcon && /* @__PURE__ */ jsx(
348
+ "span",
349
+ {
350
+ className: cn(
351
+ selectVariants.iconSize({ size }),
352
+ "flex items-center justify-center group-disabled:text-icon-disabled"
353
+ ),
354
+ children: leftIcon
355
+ }
356
+ ),
357
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1 truncate text-left", children }),
358
+ /* @__PURE__ */ jsx(
359
+ ChevronDown,
360
+ {
361
+ type: "regular",
362
+ className: cn(
363
+ selectVariants.iconSize({ size }),
364
+ "transition-transform duration-200 group-data-[state=open]:rotate-180",
365
+ "group-disabled:text-icon-disabled"
366
+ )
367
+ }
368
+ )
369
+ ] })
370
+ }
371
+ );
372
+ }
373
+ );
374
+ Select.Box = forwardRef(
375
+ ({ placeholder, leftIcon, className, ...props }, ref) => {
376
+ return /* @__PURE__ */ jsx(Select.Trigger, { ref, leftIcon, className, ...props, children: /* @__PURE__ */ jsx(Select.Value, { placeholder }) });
377
+ }
378
+ );
379
+ Select.List = forwardRef(
380
+ ({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx(
381
+ SelectPrimitive.Content,
382
+ {
383
+ ref,
384
+ "data-slot": "select-content",
385
+ className: cn(selectVariants.content, "max-h-60 ", className),
386
+ position: "popper",
387
+ ...props,
388
+ children: /* @__PURE__ */ jsx(
389
+ SelectPrimitive.Viewport,
390
+ {
391
+ "data-slot": "select-viewport",
392
+ className: cn(
393
+ selectVariants.viewport,
394
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
395
+ ),
396
+ children
397
+ }
398
+ )
399
+ }
400
+ ) })
401
+ );
402
+ Select.Label = forwardRef(
403
+ ({ children, required = false, size: sizeProp, className }, ref) => {
404
+ const { size: contextSize, disabled, id } = useSelectContext();
405
+ const groupContext = useSelectGroupContext();
406
+ const size = sizeProp ?? groupContext?.size ?? contextSize;
407
+ return /* @__PURE__ */ jsx(
408
+ "label",
409
+ {
410
+ ref,
411
+ htmlFor: id,
412
+ className: cn(selectVariants.label({ disabled, required, size }), className),
413
+ children
414
+ }
415
+ );
416
+ }
417
+ );
418
+ Select.Item = forwardRef(
419
+ ({
420
+ className,
421
+ children,
422
+ leftIcon,
423
+ rightIcon,
424
+ leftIconSize,
425
+ rightIconSize,
426
+ size: sizeProp,
427
+ ...props
428
+ }, ref) => {
429
+ const { size: contextSize } = useSelectContext();
430
+ const groupContext = useSelectGroupContext();
431
+ const size = sizeProp ?? groupContext?.size ?? contextSize;
432
+ return /* @__PURE__ */ jsx(
433
+ SelectPrimitive.Item,
434
+ {
435
+ "data-slot": "select-item",
436
+ ref,
437
+ className: cn(selectVariants.item({ size }), className),
438
+ ...props,
439
+ children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
440
+ /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center gap-0.5", children: [
441
+ leftIcon && /* @__PURE__ */ jsx(
442
+ "span",
443
+ {
444
+ className: cn(
445
+ selectVariants.iconSize({ size: leftIconSize ?? size }),
446
+ "flex items-center justify-center text-icon-primary"
447
+ ),
448
+ children: leftIcon
449
+ }
450
+ ),
451
+ /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: cn(selectVariants.itemText({ size })), children }) })
452
+ ] }),
453
+ rightIcon && /* @__PURE__ */ jsx(
454
+ "span",
455
+ {
456
+ className: cn(
457
+ selectVariants.iconSize({ size: rightIconSize ?? size }),
458
+ "flex items-center justify-center text-icon-primary"
459
+ ),
460
+ children: rightIcon
461
+ }
462
+ )
463
+ ] })
464
+ }
465
+ );
466
+ }
467
+ );
468
+ Select.Empty = forwardRef(
469
+ ({ children = "No data", className }, ref) => {
470
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("flex min-h-8 items-center justify-center p-2", className), children: /* @__PURE__ */ jsx("p", { className: "text-body-2 text-text-disabled", children }) });
471
+ }
472
+ );
473
+ Select.Description = forwardRef(
474
+ ({ children, size: sizeProp, className }, ref) => {
475
+ const { size: contextSize, error, disabled } = useSelectContext();
476
+ const groupContext = useSelectGroupContext();
477
+ const size = sizeProp ?? groupContext?.size ?? contextSize;
478
+ if (!children) {
479
+ return null;
480
+ }
481
+ return /* @__PURE__ */ jsx(
482
+ "div",
483
+ {
484
+ ref,
485
+ "data-slot": "select-description",
486
+ className: cn(selectVariants.description({ disabled, error, size }), className),
487
+ children: /* @__PURE__ */ jsx("p", { children })
488
+ }
489
+ );
490
+ }
491
+ );
492
+ Select.Group = forwardRef(
493
+ ({ children, size = "medium", variant = "fill", hasBackground = false, className }, ref) => {
494
+ const childArray = React.Children.toArray(children);
495
+ return /* @__PURE__ */ jsx(
496
+ "div",
497
+ {
498
+ ref,
499
+ className: cn(
500
+ "flex w-fit flex-row items-stretch overflow-clip rounded-medium",
501
+ variant === "line" && "border border-border-primary",
502
+ hasBackground && "bg-elevation-elevation-0",
503
+ className
504
+ ),
505
+ children: childArray.map((child, index) => {
506
+ const isFirst = index === 0;
507
+ const isLast = index === childArray.length - 1;
508
+ return /* @__PURE__ */ jsxs(React.Fragment, { children: [
509
+ /* @__PURE__ */ jsx(
510
+ SelectGroupContext.Provider,
511
+ {
512
+ value: { isFirstChild: isFirst, isLastChild: isLast, size, variant },
513
+ children: child
514
+ }
515
+ ),
516
+ !isLast && /* @__PURE__ */ jsx("div", { className: "w-px self-stretch bg-border-primary" })
517
+ ] }, index);
518
+ })
519
+ }
520
+ );
521
+ }
522
+ );
523
+ Select.displayName = "Select";
524
+ Select.Label.displayName = "Select.Label";
525
+ Select.Trigger.displayName = "Select.Trigger";
526
+ Select.Box.displayName = "Select.Box";
527
+ Select.Value.displayName = "Select.Value";
528
+ Select.List.displayName = "Select.List";
529
+ Select.Item.displayName = "Select.Item";
530
+ Select.Empty.displayName = "Select.Empty";
531
+ Select.Description.displayName = "Select.Description";
532
+ Select.Group.displayName = "Select.Group";
533
+ function FlatSelect({
534
+ options,
535
+ placeholder,
536
+ onBlur,
537
+ onFocus,
538
+ onOpenChange,
539
+ label,
540
+ description,
541
+ required,
542
+ listClassName,
543
+ leftIcon,
544
+ ...props
545
+ }) {
546
+ const { className, ...selectProps } = props;
547
+ const selectRef = useRef(null);
548
+ const { handleBlur, handleFocus } = useFocusWithin(selectRef, {
549
+ onBlur,
550
+ onFocus
551
+ });
552
+ const handleOpenChange = (open) => {
553
+ if (open) {
554
+ handleFocus();
555
+ }
556
+ onOpenChange?.(open);
557
+ };
558
+ return /* @__PURE__ */ jsx("div", { ref: selectRef, className, children: /* @__PURE__ */ jsxs(Select, { ...selectProps, onOpenChange: handleOpenChange, children: [
559
+ label && /* @__PURE__ */ jsx(Select.Label, { required, children: label }),
560
+ /* @__PURE__ */ jsx(Select.Trigger, { onBlur: handleBlur, onFocus: handleFocus, leftIcon, children: /* @__PURE__ */ jsx(Select.Value, { placeholder, className: "truncate" }) }),
561
+ description && /* @__PURE__ */ jsx(Select.Description, { children: description }),
562
+ /* @__PURE__ */ jsxs(Select.List, { className: listClassName, children: [
563
+ options.length === 0 && /* @__PURE__ */ jsx(Select.Empty, { children: placeholder }),
564
+ options.map((option) => /* @__PURE__ */ jsxs(
565
+ Select.Item,
566
+ {
567
+ value: option.value,
568
+ disabled: option.disabled,
569
+ className: "flex max-w-full items-center justify-between",
570
+ children: [
571
+ /* @__PURE__ */ jsx("div", { className: "block flex-1 truncate", children: option.label }),
572
+ option.rightSlot
573
+ ]
574
+ },
575
+ option.value
576
+ ))
577
+ ] })
578
+ ] }) });
579
+ }
580
+ function useFocusWithin(containerRef, callbacks) {
581
+ const [isFocused, setIsFocused] = useState(false);
582
+ const handleBlur = (event) => {
583
+ if (containerRef.current?.contains(event.relatedTarget)) {
584
+ return;
585
+ }
586
+ setIsFocused(false);
587
+ callbacks?.onBlur?.();
588
+ };
589
+ const handleFocus = () => {
590
+ if (isFocused) {
591
+ return;
592
+ }
593
+ setIsFocused(true);
594
+ callbacks?.onFocus?.();
595
+ };
596
+ return { handleBlur, handleFocus, isFocused };
597
+ }
598
+ FlatSelect.displayName = "FlatSelect";
599
+ var tooltipContentVariants = cva(
600
+ [
601
+ // Base layout
602
+ "z-50 flex flex-col items-start overflow-hidden",
603
+ "rounded-medium",
604
+ "text-text-static-light",
605
+ "bg-component-tooltip border border-border-primary",
606
+ "shadow-medium",
607
+ "animate-in fade-in-0 zoom-in-95",
608
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
609
+ "data-[side=bottom]:slide-in-from-top-2",
610
+ "data-[side=left]:slide-in-from-right-2",
611
+ "data-[side=right]:slide-in-from-left-2",
612
+ "data-[side=top]:slide-in-from-bottom-2"
613
+ ],
614
+ {
615
+ variants: {
616
+ size: {
617
+ tiny: "px-2 py-1 text-body-3",
618
+ small: "w-[160px] gap-[8px] px-[12px] py-[10px]",
619
+ medium: "w-[240px] gap-[8px] px-[12px] py-[10px]",
620
+ large: "w-[320px] gap-[8px] px-[12px] py-[10px]",
621
+ xlarge: "w-[400px] gap-[8px] px-[12px] py-[10px]"
622
+ }
623
+ },
624
+ defaultVariants: { size: "small" }
625
+ }
626
+ );
627
+ var tooltipTitleVariants = cva([
628
+ "text-body-1 font-semibold text-text-static-light",
629
+ "group-data-[size=tiny]/tooltip-content:text-body-3"
630
+ ]);
631
+ var tooltipTextVariants = cva([
632
+ "text-body-2 font-regular text-text-static-light",
633
+ "group-data-[size=tiny]/tooltip-content:text-body-3"
634
+ ]);
635
+ var Tooltip = TooltipPrimitive.Root;
636
+ Tooltip.Provider = TooltipPrimitive.Provider;
637
+ Tooltip.Trigger = TooltipPrimitive.Trigger;
638
+ Tooltip.Content = forwardRef(({ className, sideOffset = 4, size, children, portalContainer, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx(
639
+ TooltipPrimitive.Content,
640
+ {
641
+ ref,
642
+ sideOffset,
643
+ "data-size": size,
644
+ className: cn("group/tooltip-content", tooltipContentVariants({ size }), className),
645
+ ...props,
646
+ children
647
+ }
648
+ ) }));
649
+ Tooltip.Title = forwardRef(
650
+ ({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn(tooltipTitleVariants(), className), ...props, children })
651
+ );
652
+ Tooltip.Description = forwardRef(
653
+ ({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn(tooltipTextVariants(), className), ...props, children })
654
+ );
655
+ Tooltip.displayName = "Tooltip";
656
+ Tooltip.Content.displayName = "Tooltip.Content";
657
+ Tooltip.Title.displayName = "Tooltip.Title";
658
+ Tooltip.Description.displayName = "Tooltip.Description";
659
+ Tooltip.Trigger.displayName = "Tooltip.Trigger";
660
+ Tooltip.Provider.displayName = "Tooltip.Provider";
661
+ var FlatTooltip = ({ children, title, size, description, ...props }) => {
662
+ return /* @__PURE__ */ jsx(Tooltip.Provider, { delayDuration: 0, skipDelayDuration: 0, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
663
+ /* @__PURE__ */ jsx(Tooltip.Trigger, { asChild: true, children }),
664
+ /* @__PURE__ */ jsxs(Tooltip.Content, { size, ...props, children: [
665
+ title && /* @__PURE__ */ jsx(Tooltip.Title, { children: title }),
666
+ description && /* @__PURE__ */ jsx(Tooltip.Description, { children: description })
667
+ ] })
668
+ ] }) });
669
+ };
670
+ function ConditionalTooltip({ children, tooltip }) {
671
+ if (typeof tooltip === "string") {
672
+ return /* @__PURE__ */ jsx(FlatTooltip, { size: "tiny", description: tooltip, children });
673
+ }
674
+ if (tooltip && typeof tooltip === "object" && "description" in tooltip && tooltip.use !== false) {
675
+ return /* @__PURE__ */ jsx(FlatTooltip, { size: tooltip.size || "tiny", ...tooltip, children });
676
+ }
677
+ return children;
678
+ }
679
+ FlatTooltip.displayName = "FlatTooltip";
680
+ ConditionalTooltip.displayName = "ConditionalTooltip";
681
+
682
+ export { ConditionalTooltip, FlatSegment, FlatSelect, FlatTooltip, Segment, Select, Tooltip, commonInputVariants };
683
+ //# sourceMappingURL=chunk-WSRLUKC4.mjs.map
684
+ //# sourceMappingURL=chunk-WSRLUKC4.mjs.map