@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.
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
- import { X, MoreHorizontal, ChevronDown, Minus, Check, Person, Warning, Info, Error as Error$1, ChevronLeft, ChevronRight } from './chunk-LZWKMQJL.mjs';
1
+ import { ConditionalTooltip, commonInputVariants } from './chunk-WSRLUKC4.mjs';
2
+ export { Segment, Select, Tooltip } from './chunk-WSRLUKC4.mjs';
3
+ import { X, MoreHorizontal, Minus, Check, Person, Warning, Info, Error as Error$1, ChevronLeft, ChevronRight } from './chunk-LZWKMQJL.mjs';
2
4
  import { cva, cn } from '@exem-ui/core/utils';
3
- import * as React2 from 'react';
5
+ import * as React from 'react';
4
6
  import { forwardRef, Fragment, createContext, cloneElement, useId, useContext, useState } from 'react';
5
7
  import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
6
8
  import { Slot } from '@radix-ui/react-slot';
7
9
  import * as TabsPrimitive from '@radix-ui/react-tabs';
8
- import * as SelectPrimitive from '@radix-ui/react-select';
9
- import * as TooltipPrimitive from '@radix-ui/react-tooltip';
10
10
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
11
11
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
12
12
  import * as SwitchPrimitives from '@radix-ui/react-switch';
@@ -695,609 +695,6 @@ var Button = forwardRef(
695
695
  }
696
696
  );
697
697
  Button.displayName = "Button";
698
- var segmentListVariants = cva(
699
- "inline-flex items-center overflow-hidden rounded-medium bg-elevation-elevation-2",
700
- {
701
- variants: {
702
- size: {
703
- small: "h-7 gap-0 p-0.5",
704
- medium: "h-8 gap-0 p-0.5",
705
- large: "h-10 gap-0 p-0.5"
706
- }
707
- },
708
- defaultVariants: {
709
- size: "medium"
710
- }
711
- }
712
- );
713
- var segmentItemVariants = cva(
714
- [
715
- "flex flex-1 items-center justify-center rounded-weak",
716
- "focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-ring",
717
- "disabled:cursor-not-allowed",
718
- "data-[state=active]:bg-component-segmentedOption data-[state=active]:text-text-primary data-[state=active]:shadow-weak",
719
- "data-[state=inactive]:text-text-tertiary data-[state=inactive]:disabled:text-text-disabled",
720
- "transition-colors duration-200 ease-in-out"
721
- ],
722
- {
723
- variants: {
724
- size: {
725
- small: "h-6 gap-0.5 text-body-3 font-medium",
726
- medium: "h-7 gap-1 text-body-2 font-medium",
727
- large: "h-9 gap-1.5 text-body-2 font-medium"
728
- }
729
- },
730
- defaultVariants: {
731
- size: "medium"
732
- }
733
- }
734
- );
735
- var segmentIconVariants = cva("flex items-center justify-center", {
736
- variants: {
737
- size: {
738
- small: "size-4",
739
- medium: "size-4",
740
- large: "size-5"
741
- }
742
- },
743
- defaultVariants: {
744
- size: "medium"
745
- }
746
- });
747
- var SegmentContext = createContext(void 0);
748
- var useSegmentContext = () => {
749
- const context = useContext(SegmentContext);
750
- if (!context) {
751
- throw new Error("Segment components must be used within a Segment");
752
- }
753
- return context;
754
- };
755
- var Segment = forwardRef(
756
- ({ size = "medium", children, ...props }, ref) => /* @__PURE__ */ jsx(SegmentContext.Provider, { value: { size }, children: /* @__PURE__ */ jsx(TabsPrimitive.Root, { ref, ...props, children }) })
757
- );
758
- Segment.List = forwardRef(
759
- ({ className, ...props }, ref) => {
760
- const { size } = useSegmentContext();
761
- return /* @__PURE__ */ jsx(
762
- TabsPrimitive.List,
763
- {
764
- ref,
765
- className: cn(segmentListVariants({ size }), className),
766
- ...props
767
- }
768
- );
769
- }
770
- );
771
- Segment.Item = forwardRef(
772
- ({ className, leftIcon, children, ...props }, ref) => {
773
- const { size } = useSegmentContext();
774
- return /* @__PURE__ */ jsxs(
775
- TabsPrimitive.Trigger,
776
- {
777
- ref,
778
- className: cn(segmentItemVariants({ size }), className),
779
- ...props,
780
- children: [
781
- leftIcon && /* @__PURE__ */ jsx("span", { className: cn(segmentIconVariants({ size })), children: leftIcon }),
782
- /* @__PURE__ */ jsx("span", { className: "flex items-center", children })
783
- ]
784
- }
785
- );
786
- }
787
- );
788
- Segment.Content = forwardRef(
789
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
790
- TabsPrimitive.Content,
791
- {
792
- ref,
793
- className: cn(
794
- "ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
795
- className
796
- ),
797
- ...props
798
- }
799
- )
800
- );
801
- Segment.displayName = "Segment";
802
- Segment.List.displayName = "Segment.List";
803
- Segment.Content.displayName = "Segment.Content";
804
- Segment.Item.displayName = "Segment.Item";
805
- var commonInputVariants = {
806
- // Container variants - 전체 컴포넌트 래퍼
807
- container: cva("flex flex-col"),
808
- // Label variants - 라벨 텍스트
809
- label: cva("inline-block font-regular text-text-primary", {
810
- variants: {
811
- size: {
812
- xsmall: "mb-[2px] text-body-3",
813
- small: "mb-[4px] text-body-2",
814
- medium: "mb-[4px] text-body-2",
815
- large: "mb-[6px] text-body-1"
816
- },
817
- disabled: {
818
- true: "text-text-disabled"
819
- },
820
- required: {
821
- true: 'after:ml-0.5 after:text-text-critical after:content-["*"]'
822
- }
823
- },
824
- compoundVariants: [
825
- {
826
- required: true,
827
- disabled: true,
828
- className: "after:text-text-disabled"
829
- }
830
- ],
831
- defaultVariants: { size: "medium" }
832
- }),
833
- // Description variants - 설명 텍스트
834
- description: cva("mt-0.5 inline-block text-text-tertiary", {
835
- variants: {
836
- size: {
837
- xsmall: "text-caption",
838
- small: "text-body-3",
839
- medium: "text-body-3",
840
- large: "text-body-2"
841
- },
842
- error: {
843
- true: "text-text-critical"
844
- },
845
- disabled: {
846
- true: "text-text-disabled"
847
- }
848
- },
849
- compoundVariants: [
850
- {
851
- error: true,
852
- disabled: true,
853
- className: "text-text-disabled"
854
- // disabled 우선 적용
855
- }
856
- ],
857
- defaultVariants: { size: "medium" }
858
- }),
859
- // Icon variants - 아이콘 크기
860
- icon: cva("shrink-0", {
861
- variants: {
862
- size: {
863
- xsmall: "size-4",
864
- small: "size-4",
865
- medium: "size-4",
866
- large: "size-5"
867
- }
868
- },
869
- defaultVariants: { size: "medium" }
870
- })
871
- };
872
-
873
- // src/input/selectVariants.ts
874
- var selectVariants = {
875
- container: commonInputVariants.container,
876
- content: cn(
877
- "relative border border-border-primary z-50 min-w-[8rem] overflow-hidden rounded-medium bg-background-overlay shadow-weak",
878
- "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",
879
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1"
880
- ),
881
- description: commonInputVariants.description,
882
- iconSize: commonInputVariants.icon,
883
- item: cva(
884
- "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",
885
- {
886
- defaultVariants: { size: "medium" },
887
- variants: {
888
- size: {
889
- xsmall: "h-6",
890
- small: "h-7",
891
- medium: "h-8",
892
- large: "h-10"
893
- }
894
- }
895
- }
896
- ),
897
- itemText: cva("truncate flex items-center flex-1 min-w-0", {
898
- defaultVariants: { size: "medium" },
899
- variants: {
900
- size: {
901
- xsmall: "h-6",
902
- small: "h-7",
903
- medium: "h-8",
904
- large: "h-10"
905
- }
906
- }
907
- }),
908
- label: commonInputVariants.label,
909
- trigger: cva(
910
- "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",
911
- {
912
- compoundVariants: [
913
- {
914
- className: "border-border-accent text-tint-foreground-sky bg-elevation-accent [&[data-placeholder]]:text-tint-foreground-sky [&_svg]:text-tint-foreground-sky",
915
- focus: true,
916
- variant: "line"
917
- },
918
- // active + fill: 배경만 accent로 변경
919
- {
920
- className: "bg-elevation-accent text-tint-foreground-sky [&[data-placeholder]]:text-tint-foreground-sky [&_svg]:text-tint-foreground-sky",
921
- active: true,
922
- variant: "fill"
923
- },
924
- // active + line: 배경 accent + 테두리 accent
925
- {
926
- className: "bg-elevation-accent border-border-accent text-tint-foreground-sky [&[data-placeholder]]:text-tint-foreground-sky [&_svg]:text-tint-foreground-sky",
927
- active: true,
928
- variant: "line"
929
- }
930
- ],
931
- defaultVariants: {
932
- active: false,
933
- error: false,
934
- focus: false,
935
- size: "medium",
936
- variant: "fill"
937
- },
938
- variants: {
939
- active: {
940
- false: "",
941
- true: ""
942
- },
943
- error: {
944
- false: "",
945
- true: "border !border-border-critical"
946
- },
947
- focus: {
948
- false: "",
949
- // 현재는 line 타입만 focus 가능
950
- true: ""
951
- },
952
- size: {
953
- xsmall: "h-6 px-[4px] text-body-3",
954
- small: "h-7 px-[6px] text-body-2",
955
- medium: "h-8 px-[8px] text-body-2",
956
- large: "h-10 px-[10px] text-body-1"
957
- },
958
- variant: {
959
- fill: "bg-elevation-elevation-2",
960
- line: "border-border-primary border"
961
- }
962
- }
963
- }
964
- ),
965
- triggerInner: cva("flex w-full items-center", {
966
- defaultVariants: { size: "medium" },
967
- variants: {
968
- size: {
969
- xsmall: "gap-0",
970
- small: "gap-[2px]",
971
- medium: "gap-[2px]",
972
- large: "gap-[4px]"
973
- }
974
- }
975
- }),
976
- viewport: cn("flex flex-col gap-0.5 p-1")
977
- };
978
- var SelectContext = createContext(null);
979
- var useSelectContext = () => {
980
- const context = useContext(SelectContext);
981
- if (!context) {
982
- throw new Error("Select components must be used within a Select");
983
- }
984
- return context;
985
- };
986
- var SelectGroupContext = createContext(null);
987
- var useSelectGroupContext = () => {
988
- return useContext(SelectGroupContext);
989
- };
990
- var Select = forwardRef(
991
- ({
992
- children,
993
- size = "medium",
994
- variant = "fill",
995
- error = false,
996
- disabled = false,
997
- focus = false,
998
- active = false,
999
- className,
1000
- ...selectProps
1001
- }, ref) => {
1002
- const uniqueId = useId();
1003
- const id = `select-${uniqueId}`;
1004
- 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 }) }) });
1005
- }
1006
- );
1007
- Select.Value = forwardRef(({ className, children, ...props }, ref) => {
1008
- return /* @__PURE__ */ jsx(SelectPrimitive.Value, { ref, className, ...props, children });
1009
- });
1010
- Select.Trigger = forwardRef(
1011
- ({ className, children, leftIcon, ...props }, ref) => {
1012
- const { size, error, id, variant, focus, active } = useSelectContext();
1013
- const groupContext = useSelectGroupContext();
1014
- const groupClasses = groupContext ? cn("rounded-none border-0", {
1015
- "rounded-l-medium": groupContext.isFirstChild,
1016
- "rounded-r-medium": groupContext.isLastChild,
1017
- // line variant: group이 외곽 border를 제공하므로, open 시 border 대신 inset ring 사용
1018
- "data-[state=open]:border-0 data-[state=open]:ring-1 data-[state=open]:ring-inset data-[state=open]:ring-border-focused": variant === "line"
1019
- }) : void 0;
1020
- return /* @__PURE__ */ jsx(
1021
- SelectPrimitive.Trigger,
1022
- {
1023
- ref,
1024
- id,
1025
- "data-slot": "select-trigger",
1026
- className: cn(
1027
- selectVariants.trigger({ active, error, focus, size, variant }),
1028
- groupClasses,
1029
- className
1030
- ),
1031
- ...props,
1032
- children: /* @__PURE__ */ jsxs("div", { className: cn(selectVariants.triggerInner({ size })), children: [
1033
- leftIcon && /* @__PURE__ */ jsx(
1034
- "span",
1035
- {
1036
- className: cn(
1037
- selectVariants.iconSize({ size }),
1038
- "flex items-center justify-center group-disabled:text-icon-disabled"
1039
- ),
1040
- children: leftIcon
1041
- }
1042
- ),
1043
- /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1 truncate text-left", children }),
1044
- /* @__PURE__ */ jsx(
1045
- ChevronDown,
1046
- {
1047
- type: "regular",
1048
- className: cn(
1049
- selectVariants.iconSize({ size }),
1050
- "transition-transform duration-200 group-data-[state=open]:rotate-180",
1051
- "group-disabled:text-icon-disabled"
1052
- )
1053
- }
1054
- )
1055
- ] })
1056
- }
1057
- );
1058
- }
1059
- );
1060
- Select.Box = forwardRef(
1061
- ({ placeholder, leftIcon, className, ...props }, ref) => {
1062
- return /* @__PURE__ */ jsx(Select.Trigger, { ref, leftIcon, className, ...props, children: /* @__PURE__ */ jsx(Select.Value, { placeholder }) });
1063
- }
1064
- );
1065
- Select.List = forwardRef(
1066
- ({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1067
- SelectPrimitive.Content,
1068
- {
1069
- ref,
1070
- "data-slot": "select-content",
1071
- className: cn(selectVariants.content, "max-h-60 ", className),
1072
- position: "popper",
1073
- ...props,
1074
- children: /* @__PURE__ */ jsx(
1075
- SelectPrimitive.Viewport,
1076
- {
1077
- "data-slot": "select-viewport",
1078
- className: cn(
1079
- selectVariants.viewport,
1080
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
1081
- ),
1082
- children
1083
- }
1084
- )
1085
- }
1086
- ) })
1087
- );
1088
- Select.Label = forwardRef(
1089
- ({ children, required = false, size: sizeProp, className }, ref) => {
1090
- const { size: contextSize, disabled, id } = useSelectContext();
1091
- const groupContext = useSelectGroupContext();
1092
- const size = sizeProp ?? groupContext?.size ?? contextSize;
1093
- return /* @__PURE__ */ jsx(
1094
- "label",
1095
- {
1096
- ref,
1097
- htmlFor: id,
1098
- className: cn(selectVariants.label({ disabled, required, size }), className),
1099
- children
1100
- }
1101
- );
1102
- }
1103
- );
1104
- Select.Item = forwardRef(
1105
- ({
1106
- className,
1107
- children,
1108
- leftIcon,
1109
- rightIcon,
1110
- leftIconSize,
1111
- rightIconSize,
1112
- size: sizeProp,
1113
- ...props
1114
- }, ref) => {
1115
- const { size: contextSize } = useSelectContext();
1116
- const groupContext = useSelectGroupContext();
1117
- const size = sizeProp ?? groupContext?.size ?? contextSize;
1118
- return /* @__PURE__ */ jsx(
1119
- SelectPrimitive.Item,
1120
- {
1121
- "data-slot": "select-item",
1122
- ref,
1123
- className: cn(selectVariants.item({ size }), className),
1124
- ...props,
1125
- children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
1126
- /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center gap-0.5", children: [
1127
- leftIcon && /* @__PURE__ */ jsx(
1128
- "span",
1129
- {
1130
- className: cn(
1131
- selectVariants.iconSize({ size: leftIconSize ?? size }),
1132
- "flex items-center justify-center text-icon-primary"
1133
- ),
1134
- children: leftIcon
1135
- }
1136
- ),
1137
- /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: cn(selectVariants.itemText({ size })), children }) })
1138
- ] }),
1139
- rightIcon && /* @__PURE__ */ jsx(
1140
- "span",
1141
- {
1142
- className: cn(
1143
- selectVariants.iconSize({ size: rightIconSize ?? size }),
1144
- "flex items-center justify-center text-icon-primary"
1145
- ),
1146
- children: rightIcon
1147
- }
1148
- )
1149
- ] })
1150
- }
1151
- );
1152
- }
1153
- );
1154
- Select.Empty = forwardRef(
1155
- ({ children = "No data", className }, ref) => {
1156
- 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 }) });
1157
- }
1158
- );
1159
- Select.Description = forwardRef(
1160
- ({ children, size: sizeProp, className }, ref) => {
1161
- const { size: contextSize, error, disabled } = useSelectContext();
1162
- const groupContext = useSelectGroupContext();
1163
- const size = sizeProp ?? groupContext?.size ?? contextSize;
1164
- if (!children) {
1165
- return null;
1166
- }
1167
- return /* @__PURE__ */ jsx(
1168
- "div",
1169
- {
1170
- ref,
1171
- "data-slot": "select-description",
1172
- className: cn(selectVariants.description({ disabled, error, size }), className),
1173
- children: /* @__PURE__ */ jsx("p", { children })
1174
- }
1175
- );
1176
- }
1177
- );
1178
- Select.Group = forwardRef(
1179
- ({ children, size = "medium", variant = "fill", hasBackground = false, className }, ref) => {
1180
- const childArray = React2.Children.toArray(children);
1181
- return /* @__PURE__ */ jsx(
1182
- "div",
1183
- {
1184
- ref,
1185
- className: cn(
1186
- "flex w-fit flex-row items-stretch overflow-clip rounded-medium",
1187
- variant === "line" && "border border-border-primary",
1188
- hasBackground && "bg-elevation-elevation-0",
1189
- className
1190
- ),
1191
- children: childArray.map((child, index) => {
1192
- const isFirst = index === 0;
1193
- const isLast = index === childArray.length - 1;
1194
- return /* @__PURE__ */ jsxs(React2.Fragment, { children: [
1195
- /* @__PURE__ */ jsx(
1196
- SelectGroupContext.Provider,
1197
- {
1198
- value: { isFirstChild: isFirst, isLastChild: isLast, size, variant },
1199
- children: child
1200
- }
1201
- ),
1202
- !isLast && /* @__PURE__ */ jsx("div", { className: "w-px self-stretch bg-border-primary" })
1203
- ] }, index);
1204
- })
1205
- }
1206
- );
1207
- }
1208
- );
1209
- Select.displayName = "Select";
1210
- Select.Label.displayName = "Select.Label";
1211
- Select.Trigger.displayName = "Select.Trigger";
1212
- Select.Box.displayName = "Select.Box";
1213
- Select.Value.displayName = "Select.Value";
1214
- Select.List.displayName = "Select.List";
1215
- Select.Item.displayName = "Select.Item";
1216
- Select.Empty.displayName = "Select.Empty";
1217
- Select.Description.displayName = "Select.Description";
1218
- Select.Group.displayName = "Select.Group";
1219
- var tooltipContentVariants = cva(
1220
- [
1221
- // Base layout
1222
- "z-50 flex flex-col items-start overflow-hidden",
1223
- "rounded-medium",
1224
- "text-text-static-light",
1225
- "bg-component-tooltip border border-border-primary",
1226
- "shadow-medium",
1227
- "animate-in fade-in-0 zoom-in-95",
1228
- "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
1229
- "data-[side=bottom]:slide-in-from-top-2",
1230
- "data-[side=left]:slide-in-from-right-2",
1231
- "data-[side=right]:slide-in-from-left-2",
1232
- "data-[side=top]:slide-in-from-bottom-2"
1233
- ],
1234
- {
1235
- variants: {
1236
- size: {
1237
- tiny: "px-2 py-1 text-body-3",
1238
- small: "w-[160px] gap-[8px] px-[12px] py-[10px]",
1239
- medium: "w-[240px] gap-[8px] px-[12px] py-[10px]",
1240
- large: "w-[320px] gap-[8px] px-[12px] py-[10px]",
1241
- xlarge: "w-[400px] gap-[8px] px-[12px] py-[10px]"
1242
- }
1243
- },
1244
- defaultVariants: { size: "small" }
1245
- }
1246
- );
1247
- var tooltipTitleVariants = cva([
1248
- "text-body-1 font-semibold text-text-static-light",
1249
- "group-data-[size=tiny]/tooltip-content:text-body-3"
1250
- ]);
1251
- var tooltipTextVariants = cva([
1252
- "text-body-2 font-regular text-text-static-light",
1253
- "group-data-[size=tiny]/tooltip-content:text-body-3"
1254
- ]);
1255
- var Tooltip = TooltipPrimitive.Root;
1256
- Tooltip.Provider = TooltipPrimitive.Provider;
1257
- Tooltip.Trigger = TooltipPrimitive.Trigger;
1258
- Tooltip.Content = forwardRef(({ className, sideOffset = 4, size, children, portalContainer, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx(
1259
- TooltipPrimitive.Content,
1260
- {
1261
- ref,
1262
- sideOffset,
1263
- "data-size": size,
1264
- className: cn("group/tooltip-content", tooltipContentVariants({ size }), className),
1265
- ...props,
1266
- children
1267
- }
1268
- ) }));
1269
- Tooltip.Title = forwardRef(
1270
- ({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn(tooltipTitleVariants(), className), ...props, children })
1271
- );
1272
- Tooltip.Description = forwardRef(
1273
- ({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn(tooltipTextVariants(), className), ...props, children })
1274
- );
1275
- Tooltip.displayName = "Tooltip";
1276
- Tooltip.Content.displayName = "Tooltip.Content";
1277
- Tooltip.Title.displayName = "Tooltip.Title";
1278
- Tooltip.Description.displayName = "Tooltip.Description";
1279
- Tooltip.Trigger.displayName = "Tooltip.Trigger";
1280
- Tooltip.Provider.displayName = "Tooltip.Provider";
1281
- var FlatTooltip = ({ children, title, size, description, ...props }) => {
1282
- return /* @__PURE__ */ jsx(Tooltip.Provider, { delayDuration: 0, skipDelayDuration: 0, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
1283
- /* @__PURE__ */ jsx(Tooltip.Trigger, { asChild: true, children }),
1284
- /* @__PURE__ */ jsxs(Tooltip.Content, { size, ...props, children: [
1285
- title && /* @__PURE__ */ jsx(Tooltip.Title, { children: title }),
1286
- description && /* @__PURE__ */ jsx(Tooltip.Description, { children: description })
1287
- ] })
1288
- ] }) });
1289
- };
1290
- function ConditionalTooltip({ children, tooltip }) {
1291
- if (typeof tooltip === "string") {
1292
- return /* @__PURE__ */ jsx(FlatTooltip, { size: "tiny", description: tooltip, children });
1293
- }
1294
- if (tooltip && typeof tooltip === "object" && "description" in tooltip && tooltip.use !== false) {
1295
- return /* @__PURE__ */ jsx(FlatTooltip, { size: tooltip.size || "tiny", ...tooltip, children });
1296
- }
1297
- return children;
1298
- }
1299
- FlatTooltip.displayName = "FlatTooltip";
1300
- ConditionalTooltip.displayName = "ConditionalTooltip";
1301
698
  var iconButtonSizeClasses = {
1302
699
  xsmall: "size-6",
1303
700
  small: "size-7",
@@ -1853,7 +1250,7 @@ var textAreaVariants = {
1853
1250
  defaultVariants: { disabled: false }
1854
1251
  })
1855
1252
  };
1856
- var TextArea = React2.forwardRef(
1253
+ var TextArea = React.forwardRef(
1857
1254
  ({
1858
1255
  children,
1859
1256
  variant = "fill",
@@ -1877,7 +1274,7 @@ var TextArea = React2.forwardRef(
1877
1274
  );
1878
1275
  }
1879
1276
  );
1880
- TextArea.Label = React2.forwardRef(
1277
+ TextArea.Label = React.forwardRef(
1881
1278
  ({ children, required = false, className }, ref) => {
1882
1279
  const { size, disabled, id } = useTextAreaContext();
1883
1280
  return /* @__PURE__ */ jsx(
@@ -1891,7 +1288,7 @@ TextArea.Label = React2.forwardRef(
1891
1288
  );
1892
1289
  }
1893
1290
  );
1894
- TextArea.Field = React2.forwardRef(
1291
+ TextArea.Field = React.forwardRef(
1895
1292
  ({ className, onFocus, onBlur, ...props }, ref) => {
1896
1293
  const {
1897
1294
  variant,
@@ -1903,7 +1300,7 @@ TextArea.Field = React2.forwardRef(
1903
1300
  value: contextValue,
1904
1301
  onChange: contextOnChange
1905
1302
  } = useTextAreaContext();
1906
- const [focused, setFocused] = React2.useState(false);
1303
+ const [focused, setFocused] = React.useState(false);
1907
1304
  const handleFocus = (e) => {
1908
1305
  setFocused(true);
1909
1306
  onFocus?.(e);
@@ -1933,7 +1330,7 @@ TextArea.Field = React2.forwardRef(
1933
1330
  );
1934
1331
  }
1935
1332
  );
1936
- TextArea.Description = React2.forwardRef(
1333
+ TextArea.Description = React.forwardRef(
1937
1334
  ({ children, showCounter = true, className }, ref) => {
1938
1335
  const { size, error, disabled, value = "", maxLength } = useTextAreaContext();
1939
1336
  if (!children && (!showCounter || !maxLength)) {
@@ -2731,7 +2128,7 @@ var Toaster = ({ ...props }) => {
2731
2128
  )
2732
2129
  ] });
2733
2130
  };
2734
- Toaster.Container = React2.forwardRef(
2131
+ Toaster.Container = React.forwardRef(
2735
2132
  ({ className, children, ...props }, ref) => {
2736
2133
  return /* @__PURE__ */ jsx(
2737
2134
  "div",
@@ -2748,7 +2145,7 @@ Toaster.Container = React2.forwardRef(
2748
2145
  );
2749
2146
  }
2750
2147
  );
2751
- Toaster.Icon = React2.forwardRef(
2148
+ Toaster.Icon = React.forwardRef(
2752
2149
  ({ className, children, ...props }, ref) => {
2753
2150
  return /* @__PURE__ */ jsx(
2754
2151
  "div",
@@ -2761,7 +2158,7 @@ Toaster.Icon = React2.forwardRef(
2761
2158
  );
2762
2159
  }
2763
2160
  );
2764
- Toaster.Title = React2.forwardRef(
2161
+ Toaster.Title = React.forwardRef(
2765
2162
  ({ className, children, ...props }, ref) => {
2766
2163
  return /* @__PURE__ */ jsx(
2767
2164
  "div",
@@ -2777,7 +2174,7 @@ Toaster.Title = React2.forwardRef(
2777
2174
  );
2778
2175
  }
2779
2176
  );
2780
- Toaster.Description = React2.forwardRef(
2177
+ Toaster.Description = React.forwardRef(
2781
2178
  ({ className, children, ...props }, ref) => {
2782
2179
  return /* @__PURE__ */ jsx(
2783
2180
  "div",
@@ -2794,7 +2191,7 @@ Toaster.Description = React2.forwardRef(
2794
2191
  );
2795
2192
  }
2796
2193
  );
2797
- Toaster.Action = React2.forwardRef(
2194
+ Toaster.Action = React.forwardRef(
2798
2195
  ({ className, children, altText, ...props }, ref) => {
2799
2196
  return /* @__PURE__ */ jsx(
2800
2197
  "button",
@@ -3013,6 +2410,19 @@ function useToast() {
3013
2410
  };
3014
2411
  }
3015
2412
 
3016
- export { Avatar, Badge, Breadcrumb, Button, ButtonGroup, Checkbox, DatePicker, DoubleTag, IconButton, Loading, MessageBox, Modal, Progress, Radio, ScrollArea, ScrollBar, Segment, Select, Star, Switch, Tabs, Tag, TextArea, TextField, ToastProvider, Toaster, Tooltip, toast, useToast };
2413
+ // src/utils.ts
2414
+ var buttonize = (fn) => {
2415
+ return {
2416
+ role: "button",
2417
+ onClick: fn,
2418
+ onKeyDown: (event) => {
2419
+ if (event.key === "Enter") {
2420
+ fn(event);
2421
+ }
2422
+ }
2423
+ };
2424
+ };
2425
+
2426
+ export { Avatar, Badge, Breadcrumb, Button, ButtonGroup, Checkbox, DatePicker, DoubleTag, IconButton, Loading, MessageBox, Modal, Progress, Radio, ScrollArea, ScrollBar, Star, Switch, Tabs, Tag, TextArea, TextField, ToastProvider, Toaster, buttonize, toast, useToast };
3017
2427
  //# sourceMappingURL=index.mjs.map
3018
2428
  //# sourceMappingURL=index.mjs.map