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