@karakuri-ui/react 0.2.3 → 0.3.0
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/README.md +0 -1
- package/dist/components/ui/accordion.d.mts +40 -0
- package/dist/components/ui/accordion.d.ts +40 -0
- package/dist/components/ui/accordion.js +215 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/accordion.mjs +176 -0
- package/dist/components/ui/accordion.mjs.map +1 -0
- package/dist/components/ui/alert.d.mts +38 -0
- package/dist/components/ui/alert.d.ts +38 -0
- package/dist/components/ui/alert.js +217 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/alert.mjs +180 -0
- package/dist/components/ui/alert.mjs.map +1 -0
- package/dist/components/ui/avatar.d.mts +223 -0
- package/dist/components/ui/avatar.d.ts +223 -0
- package/dist/components/ui/avatar.js +245 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/avatar.mjs +204 -0
- package/dist/components/ui/avatar.mjs.map +1 -0
- package/dist/components/ui/badge.d.mts +31 -0
- package/dist/components/ui/badge.d.ts +31 -0
- package/dist/components/ui/badge.js +205 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/badge.mjs +170 -0
- package/dist/components/ui/badge.mjs.map +1 -0
- package/dist/components/ui/breadcrumb.d.mts +46 -0
- package/dist/components/ui/breadcrumb.d.ts +46 -0
- package/dist/components/ui/breadcrumb.js +201 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/breadcrumb.mjs +160 -0
- package/dist/components/ui/breadcrumb.mjs.map +1 -0
- package/dist/components/ui/button-group.d.mts +22 -0
- package/dist/components/ui/button-group.d.ts +22 -0
- package/dist/components/ui/button-group.js +107 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button-group.mjs +72 -0
- package/dist/components/ui/button-group.mjs.map +1 -0
- package/dist/components/ui/button.d.mts +31 -0
- package/dist/components/ui/button.d.ts +31 -0
- package/dist/components/ui/button.js +176 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/button.mjs +141 -0
- package/dist/components/ui/button.mjs.map +1 -0
- package/dist/components/ui/card.d.mts +60 -0
- package/dist/components/ui/card.d.ts +60 -0
- package/dist/components/ui/card.js +361 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/card.mjs +319 -0
- package/dist/components/ui/card.mjs.map +1 -0
- package/dist/{chart.d.mts → components/ui/chart.d.mts} +2 -18
- package/dist/{chart.d.ts → components/ui/chart.d.ts} +2 -18
- package/dist/{chart.js → components/ui/chart.js} +30 -55
- package/dist/components/ui/chart.js.map +1 -0
- package/dist/{chart.mjs → components/ui/chart.mjs} +22 -46
- package/dist/components/ui/chart.mjs.map +1 -0
- package/dist/components/ui/checkbox.d.mts +24 -0
- package/dist/components/ui/checkbox.d.ts +24 -0
- package/dist/components/ui/checkbox.js +173 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/checkbox.mjs +138 -0
- package/dist/components/ui/checkbox.mjs.map +1 -0
- package/dist/components/ui/divider.d.mts +27 -0
- package/dist/components/ui/divider.d.ts +27 -0
- package/dist/components/ui/divider.js +147 -0
- package/dist/components/ui/divider.js.map +1 -0
- package/dist/components/ui/divider.mjs +112 -0
- package/dist/components/ui/divider.mjs.map +1 -0
- package/dist/components/ui/drawer.d.mts +36 -0
- package/dist/components/ui/drawer.d.ts +36 -0
- package/dist/components/ui/drawer.js +211 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/drawer.mjs +165 -0
- package/dist/components/ui/drawer.mjs.map +1 -0
- package/dist/components/ui/dropdown.d.mts +34 -0
- package/dist/components/ui/dropdown.d.ts +34 -0
- package/dist/components/ui/dropdown.js +295 -0
- package/dist/components/ui/dropdown.js.map +1 -0
- package/dist/components/ui/dropdown.mjs +248 -0
- package/dist/components/ui/dropdown.mjs.map +1 -0
- package/dist/components/ui/field.d.mts +26 -0
- package/dist/components/ui/field.d.ts +26 -0
- package/dist/components/ui/field.js +141 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/field.mjs +103 -0
- package/dist/components/ui/field.mjs.map +1 -0
- package/dist/components/ui/icon-button.d.mts +20 -0
- package/dist/components/ui/icon-button.d.ts +20 -0
- package/dist/components/ui/icon-button.js +147 -0
- package/dist/components/ui/icon-button.js.map +1 -0
- package/dist/components/ui/icon-button.mjs +112 -0
- package/dist/components/ui/icon-button.mjs.map +1 -0
- package/dist/components/ui/index.d.mts +55 -0
- package/dist/components/ui/index.d.ts +55 -0
- package/dist/components/ui/index.js +468 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/components/ui/index.mjs +242 -0
- package/dist/components/ui/index.mjs.map +1 -0
- package/dist/components/ui/input.d.mts +20 -0
- package/dist/components/ui/input.d.ts +20 -0
- package/dist/components/ui/input.js +250 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/input.mjs +215 -0
- package/dist/components/ui/input.mjs.map +1 -0
- package/dist/components/ui/metric-card.d.mts +38 -0
- package/dist/components/ui/metric-card.d.ts +38 -0
- package/dist/components/ui/metric-card.js +250 -0
- package/dist/components/ui/metric-card.js.map +1 -0
- package/dist/components/ui/metric-card.mjs +209 -0
- package/dist/components/ui/metric-card.mjs.map +1 -0
- package/dist/components/ui/modal.d.mts +47 -0
- package/dist/components/ui/modal.d.ts +47 -0
- package/dist/components/ui/modal.js +371 -0
- package/dist/components/ui/modal.js.map +1 -0
- package/dist/components/ui/modal.mjs +313 -0
- package/dist/components/ui/modal.mjs.map +1 -0
- package/dist/components/ui/navigation-menu.d.mts +120 -0
- package/dist/components/ui/navigation-menu.d.ts +120 -0
- package/dist/components/ui/navigation-menu.js +521 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/navigation-menu.mjs +478 -0
- package/dist/components/ui/navigation-menu.mjs.map +1 -0
- package/dist/components/ui/pagination.d.mts +113 -0
- package/dist/components/ui/pagination.d.ts +113 -0
- package/dist/components/ui/pagination.js +484 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/pagination.mjs +438 -0
- package/dist/components/ui/pagination.mjs.map +1 -0
- package/dist/components/ui/popover.d.mts +29 -0
- package/dist/components/ui/popover.d.ts +29 -0
- package/dist/components/ui/popover.js +165 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/popover.mjs +124 -0
- package/dist/components/ui/popover.mjs.map +1 -0
- package/dist/components/ui/progress.d.mts +35 -0
- package/dist/components/ui/progress.d.ts +35 -0
- package/dist/components/ui/progress.js +194 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/progress.mjs +159 -0
- package/dist/components/ui/progress.mjs.map +1 -0
- package/dist/components/ui/radio-group.d.mts +35 -0
- package/dist/components/ui/radio-group.d.ts +35 -0
- package/dist/components/ui/radio-group.js +174 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/radio-group.mjs +137 -0
- package/dist/components/ui/radio-group.mjs.map +1 -0
- package/dist/components/ui/segmented.d.mts +25 -0
- package/dist/components/ui/segmented.d.ts +25 -0
- package/dist/components/ui/segmented.js +238 -0
- package/dist/components/ui/segmented.js.map +1 -0
- package/dist/components/ui/segmented.mjs +201 -0
- package/dist/components/ui/segmented.mjs.map +1 -0
- package/dist/components/ui/select.d.mts +20 -0
- package/dist/components/ui/select.d.ts +20 -0
- package/dist/components/ui/select.js +308 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/select.mjs +267 -0
- package/dist/components/ui/select.mjs.map +1 -0
- package/dist/components/ui/skeleton.d.mts +26 -0
- package/dist/components/ui/skeleton.d.ts +26 -0
- package/dist/components/ui/skeleton.js +144 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/skeleton.mjs +109 -0
- package/dist/components/ui/skeleton.mjs.map +1 -0
- package/dist/components/ui/slider.d.mts +38 -0
- package/dist/components/ui/slider.d.ts +38 -0
- package/dist/components/ui/slider.js +180 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/slider.mjs +145 -0
- package/dist/components/ui/slider.mjs.map +1 -0
- package/dist/components/ui/spinner.d.mts +23 -0
- package/dist/components/ui/spinner.d.ts +23 -0
- package/dist/components/ui/spinner.js +471 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/spinner.mjs +436 -0
- package/dist/components/ui/spinner.mjs.map +1 -0
- package/dist/components/ui/switch.d.mts +22 -0
- package/dist/components/ui/switch.d.ts +22 -0
- package/dist/components/ui/switch.js +173 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/switch.mjs +138 -0
- package/dist/components/ui/switch.mjs.map +1 -0
- package/dist/components/ui/table.d.mts +60 -0
- package/dist/components/ui/table.d.ts +60 -0
- package/dist/components/ui/table.js +231 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/table.mjs +190 -0
- package/dist/components/ui/table.mjs.map +1 -0
- package/dist/components/ui/tabs.d.mts +31 -0
- package/dist/components/ui/tabs.d.ts +31 -0
- package/dist/components/ui/tabs.js +233 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/tabs.mjs +194 -0
- package/dist/components/ui/tabs.mjs.map +1 -0
- package/dist/components/ui/textarea.d.mts +19 -0
- package/dist/components/ui/textarea.d.ts +19 -0
- package/dist/components/ui/textarea.js +181 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/textarea.mjs +146 -0
- package/dist/components/ui/textarea.mjs.map +1 -0
- package/dist/components/ui/toast.d.mts +93 -0
- package/dist/components/ui/toast.d.ts +93 -0
- package/dist/components/ui/toast.js +429 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toast.mjs +393 -0
- package/dist/components/ui/toast.mjs.map +1 -0
- package/dist/components/ui/toggle-group.d.mts +42 -0
- package/dist/components/ui/toggle-group.d.ts +42 -0
- package/dist/components/ui/toggle-group.js +183 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle-group.mjs +146 -0
- package/dist/components/ui/toggle-group.mjs.map +1 -0
- package/dist/components/ui/toggle.d.mts +19 -0
- package/dist/components/ui/toggle.d.ts +19 -0
- package/dist/components/ui/toggle.js +194 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/toggle.mjs +159 -0
- package/dist/components/ui/toggle.mjs.map +1 -0
- package/dist/components/ui/tooltip.d.mts +26 -0
- package/dist/components/ui/tooltip.d.ts +26 -0
- package/dist/components/ui/tooltip.js +128 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/tooltip.mjs +88 -0
- package/dist/components/ui/tooltip.mjs.map +1 -0
- package/dist/lib/code-generator.d.mts +60 -0
- package/dist/lib/code-generator.d.ts +60 -0
- package/dist/lib/code-generator.js +224 -0
- package/dist/lib/code-generator.js.map +1 -0
- package/dist/lib/code-generator.mjs +159 -0
- package/dist/lib/code-generator.mjs.map +1 -0
- package/dist/lib/utils.d.mts +10 -0
- package/dist/lib/utils.d.ts +10 -0
- package/dist/lib/utils.js +33 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.mjs +9 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/package.json +11 -11
- package/dist/chart.js.map +0 -1
- package/dist/chart.mjs.map +0 -1
- package/dist/index.d.mts +0 -1636
- package/dist/index.d.ts +0 -1636
- package/dist/index.js +0 -7291
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -7048
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare const avatarVariants: (props?: ({
|
|
7
|
+
size?: "default" | "sm" | "lg" | "xl" | "2xl" | "xs" | null | undefined;
|
|
8
|
+
shape?: "circle" | "square" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
declare const avatarColors: readonly [{
|
|
11
|
+
readonly vivid: {
|
|
12
|
+
readonly bg: "bg-[#DC2626]";
|
|
13
|
+
readonly text: "text-white";
|
|
14
|
+
};
|
|
15
|
+
readonly soft: {
|
|
16
|
+
readonly bg: "bg-[#FEE2E2]";
|
|
17
|
+
readonly text: "text-[#DC2626]";
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
readonly vivid: {
|
|
21
|
+
readonly bg: "bg-[#EA580C]";
|
|
22
|
+
readonly text: "text-white";
|
|
23
|
+
};
|
|
24
|
+
readonly soft: {
|
|
25
|
+
readonly bg: "bg-[#FFEDD5]";
|
|
26
|
+
readonly text: "text-[#EA580C]";
|
|
27
|
+
};
|
|
28
|
+
}, {
|
|
29
|
+
readonly vivid: {
|
|
30
|
+
readonly bg: "bg-[#D97706]";
|
|
31
|
+
readonly text: "text-white";
|
|
32
|
+
};
|
|
33
|
+
readonly soft: {
|
|
34
|
+
readonly bg: "bg-[#FEF3C7]";
|
|
35
|
+
readonly text: "text-[#B45309]";
|
|
36
|
+
};
|
|
37
|
+
}, {
|
|
38
|
+
readonly vivid: {
|
|
39
|
+
readonly bg: "bg-[#CA8A04]";
|
|
40
|
+
readonly text: "text-white";
|
|
41
|
+
};
|
|
42
|
+
readonly soft: {
|
|
43
|
+
readonly bg: "bg-[#FEF9C3]";
|
|
44
|
+
readonly text: "text-[#A16207]";
|
|
45
|
+
};
|
|
46
|
+
}, {
|
|
47
|
+
readonly vivid: {
|
|
48
|
+
readonly bg: "bg-[#059669]";
|
|
49
|
+
readonly text: "text-white";
|
|
50
|
+
};
|
|
51
|
+
readonly soft: {
|
|
52
|
+
readonly bg: "bg-[#D1FAE5]";
|
|
53
|
+
readonly text: "text-[#047857]";
|
|
54
|
+
};
|
|
55
|
+
}, {
|
|
56
|
+
readonly vivid: {
|
|
57
|
+
readonly bg: "bg-[#0D9488]";
|
|
58
|
+
readonly text: "text-white";
|
|
59
|
+
};
|
|
60
|
+
readonly soft: {
|
|
61
|
+
readonly bg: "bg-[#CCFBF1]";
|
|
62
|
+
readonly text: "text-[#0F766E]";
|
|
63
|
+
};
|
|
64
|
+
}, {
|
|
65
|
+
readonly vivid: {
|
|
66
|
+
readonly bg: "bg-[#0891B2]";
|
|
67
|
+
readonly text: "text-white";
|
|
68
|
+
};
|
|
69
|
+
readonly soft: {
|
|
70
|
+
readonly bg: "bg-[#CFFAFE]";
|
|
71
|
+
readonly text: "text-[#0E7490]";
|
|
72
|
+
};
|
|
73
|
+
}, {
|
|
74
|
+
readonly vivid: {
|
|
75
|
+
readonly bg: "bg-[#2563EB]";
|
|
76
|
+
readonly text: "text-white";
|
|
77
|
+
};
|
|
78
|
+
readonly soft: {
|
|
79
|
+
readonly bg: "bg-[#DBEAFE]";
|
|
80
|
+
readonly text: "text-[#1D4ED8]";
|
|
81
|
+
};
|
|
82
|
+
}, {
|
|
83
|
+
readonly vivid: {
|
|
84
|
+
readonly bg: "bg-[#4F46E5]";
|
|
85
|
+
readonly text: "text-white";
|
|
86
|
+
};
|
|
87
|
+
readonly soft: {
|
|
88
|
+
readonly bg: "bg-[#E0E7FF]";
|
|
89
|
+
readonly text: "text-[#4338CA]";
|
|
90
|
+
};
|
|
91
|
+
}, {
|
|
92
|
+
readonly vivid: {
|
|
93
|
+
readonly bg: "bg-[#7C3AED]";
|
|
94
|
+
readonly text: "text-white";
|
|
95
|
+
};
|
|
96
|
+
readonly soft: {
|
|
97
|
+
readonly bg: "bg-[#EDE9FE]";
|
|
98
|
+
readonly text: "text-[#6D28D9]";
|
|
99
|
+
};
|
|
100
|
+
}, {
|
|
101
|
+
readonly vivid: {
|
|
102
|
+
readonly bg: "bg-[#9333EA]";
|
|
103
|
+
readonly text: "text-white";
|
|
104
|
+
};
|
|
105
|
+
readonly soft: {
|
|
106
|
+
readonly bg: "bg-[#F3E8FF]";
|
|
107
|
+
readonly text: "text-[#7E22CE]";
|
|
108
|
+
};
|
|
109
|
+
}, {
|
|
110
|
+
readonly vivid: {
|
|
111
|
+
readonly bg: "bg-[#DB2777]";
|
|
112
|
+
readonly text: "text-white";
|
|
113
|
+
};
|
|
114
|
+
readonly soft: {
|
|
115
|
+
readonly bg: "bg-[#FCE7F3]";
|
|
116
|
+
readonly text: "text-[#BE185D]";
|
|
117
|
+
};
|
|
118
|
+
}];
|
|
119
|
+
type AvatarColorVariant = 'vivid' | 'soft';
|
|
120
|
+
/** Extract initials from a name string (e.g. "John Doe" → "JD", "김민수" → "김민") */
|
|
121
|
+
declare function getAvatarInitials(name: string, maxChars?: number): string;
|
|
122
|
+
/** Hash a name string to a deterministic avatar color pair (djb2 xor variant) */
|
|
123
|
+
declare function getAvatarColor(name: string, variant?: AvatarColorVariant): {
|
|
124
|
+
readonly bg: "bg-[#DC2626]";
|
|
125
|
+
readonly text: "text-white";
|
|
126
|
+
} | {
|
|
127
|
+
readonly bg: "bg-[#FEE2E2]";
|
|
128
|
+
readonly text: "text-[#DC2626]";
|
|
129
|
+
} | {
|
|
130
|
+
readonly bg: "bg-[#EA580C]";
|
|
131
|
+
readonly text: "text-white";
|
|
132
|
+
} | {
|
|
133
|
+
readonly bg: "bg-[#FFEDD5]";
|
|
134
|
+
readonly text: "text-[#EA580C]";
|
|
135
|
+
} | {
|
|
136
|
+
readonly bg: "bg-[#D97706]";
|
|
137
|
+
readonly text: "text-white";
|
|
138
|
+
} | {
|
|
139
|
+
readonly bg: "bg-[#FEF3C7]";
|
|
140
|
+
readonly text: "text-[#B45309]";
|
|
141
|
+
} | {
|
|
142
|
+
readonly bg: "bg-[#CA8A04]";
|
|
143
|
+
readonly text: "text-white";
|
|
144
|
+
} | {
|
|
145
|
+
readonly bg: "bg-[#FEF9C3]";
|
|
146
|
+
readonly text: "text-[#A16207]";
|
|
147
|
+
} | {
|
|
148
|
+
readonly bg: "bg-[#059669]";
|
|
149
|
+
readonly text: "text-white";
|
|
150
|
+
} | {
|
|
151
|
+
readonly bg: "bg-[#D1FAE5]";
|
|
152
|
+
readonly text: "text-[#047857]";
|
|
153
|
+
} | {
|
|
154
|
+
readonly bg: "bg-[#0D9488]";
|
|
155
|
+
readonly text: "text-white";
|
|
156
|
+
} | {
|
|
157
|
+
readonly bg: "bg-[#CCFBF1]";
|
|
158
|
+
readonly text: "text-[#0F766E]";
|
|
159
|
+
} | {
|
|
160
|
+
readonly bg: "bg-[#0891B2]";
|
|
161
|
+
readonly text: "text-white";
|
|
162
|
+
} | {
|
|
163
|
+
readonly bg: "bg-[#CFFAFE]";
|
|
164
|
+
readonly text: "text-[#0E7490]";
|
|
165
|
+
} | {
|
|
166
|
+
readonly bg: "bg-[#2563EB]";
|
|
167
|
+
readonly text: "text-white";
|
|
168
|
+
} | {
|
|
169
|
+
readonly bg: "bg-[#DBEAFE]";
|
|
170
|
+
readonly text: "text-[#1D4ED8]";
|
|
171
|
+
} | {
|
|
172
|
+
readonly bg: "bg-[#4F46E5]";
|
|
173
|
+
readonly text: "text-white";
|
|
174
|
+
} | {
|
|
175
|
+
readonly bg: "bg-[#E0E7FF]";
|
|
176
|
+
readonly text: "text-[#4338CA]";
|
|
177
|
+
} | {
|
|
178
|
+
readonly bg: "bg-[#7C3AED]";
|
|
179
|
+
readonly text: "text-white";
|
|
180
|
+
} | {
|
|
181
|
+
readonly bg: "bg-[#EDE9FE]";
|
|
182
|
+
readonly text: "text-[#6D28D9]";
|
|
183
|
+
} | {
|
|
184
|
+
readonly bg: "bg-[#9333EA]";
|
|
185
|
+
readonly text: "text-white";
|
|
186
|
+
} | {
|
|
187
|
+
readonly bg: "bg-[#F3E8FF]";
|
|
188
|
+
readonly text: "text-[#7E22CE]";
|
|
189
|
+
} | {
|
|
190
|
+
readonly bg: "bg-[#DB2777]";
|
|
191
|
+
readonly text: "text-white";
|
|
192
|
+
} | {
|
|
193
|
+
readonly bg: "bg-[#FCE7F3]";
|
|
194
|
+
readonly text: "text-[#BE185D]";
|
|
195
|
+
};
|
|
196
|
+
type AvatarSize = 'xs' | 'sm' | 'default' | 'lg' | 'xl' | '2xl';
|
|
197
|
+
type AvatarShape = 'circle' | 'square';
|
|
198
|
+
type AvatarStatus = 'online' | 'offline' | 'busy' | 'away';
|
|
199
|
+
interface AvatarProps extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>, VariantProps<typeof avatarVariants> {
|
|
200
|
+
status?: AvatarStatus;
|
|
201
|
+
}
|
|
202
|
+
declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
|
|
203
|
+
interface AvatarImageProps extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image> {
|
|
204
|
+
}
|
|
205
|
+
declare const AvatarImage: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
|
|
206
|
+
interface AvatarFallbackProps extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback> {
|
|
207
|
+
size?: AvatarSize;
|
|
208
|
+
/** Shorthand: auto-generates initials + color from a name. Children override auto-initials. */
|
|
209
|
+
name?: string;
|
|
210
|
+
/** Pass a name/key to enable colorized mode. The string is hashed to pick a deterministic color. */
|
|
211
|
+
colorized?: string;
|
|
212
|
+
/** Color style: "vivid" (strong bg + white text) or "soft" (pastel bg + dark text). Default: "vivid" */
|
|
213
|
+
colorVariant?: AvatarColorVariant;
|
|
214
|
+
}
|
|
215
|
+
declare const AvatarFallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
|
|
216
|
+
interface AvatarGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
217
|
+
max?: number;
|
|
218
|
+
size?: AvatarSize;
|
|
219
|
+
shape?: AvatarShape;
|
|
220
|
+
}
|
|
221
|
+
declare const AvatarGroup: React.ForwardRefExoticComponent<AvatarGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
222
|
+
|
|
223
|
+
export { Avatar, type AvatarColorVariant, AvatarFallback, type AvatarFallbackProps, AvatarGroup, type AvatarGroupProps, AvatarImage, type AvatarImageProps, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, avatarColors, avatarVariants, getAvatarColor, getAvatarInitials };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare const avatarVariants: (props?: ({
|
|
7
|
+
size?: "default" | "sm" | "lg" | "xl" | "2xl" | "xs" | null | undefined;
|
|
8
|
+
shape?: "circle" | "square" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
declare const avatarColors: readonly [{
|
|
11
|
+
readonly vivid: {
|
|
12
|
+
readonly bg: "bg-[#DC2626]";
|
|
13
|
+
readonly text: "text-white";
|
|
14
|
+
};
|
|
15
|
+
readonly soft: {
|
|
16
|
+
readonly bg: "bg-[#FEE2E2]";
|
|
17
|
+
readonly text: "text-[#DC2626]";
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
readonly vivid: {
|
|
21
|
+
readonly bg: "bg-[#EA580C]";
|
|
22
|
+
readonly text: "text-white";
|
|
23
|
+
};
|
|
24
|
+
readonly soft: {
|
|
25
|
+
readonly bg: "bg-[#FFEDD5]";
|
|
26
|
+
readonly text: "text-[#EA580C]";
|
|
27
|
+
};
|
|
28
|
+
}, {
|
|
29
|
+
readonly vivid: {
|
|
30
|
+
readonly bg: "bg-[#D97706]";
|
|
31
|
+
readonly text: "text-white";
|
|
32
|
+
};
|
|
33
|
+
readonly soft: {
|
|
34
|
+
readonly bg: "bg-[#FEF3C7]";
|
|
35
|
+
readonly text: "text-[#B45309]";
|
|
36
|
+
};
|
|
37
|
+
}, {
|
|
38
|
+
readonly vivid: {
|
|
39
|
+
readonly bg: "bg-[#CA8A04]";
|
|
40
|
+
readonly text: "text-white";
|
|
41
|
+
};
|
|
42
|
+
readonly soft: {
|
|
43
|
+
readonly bg: "bg-[#FEF9C3]";
|
|
44
|
+
readonly text: "text-[#A16207]";
|
|
45
|
+
};
|
|
46
|
+
}, {
|
|
47
|
+
readonly vivid: {
|
|
48
|
+
readonly bg: "bg-[#059669]";
|
|
49
|
+
readonly text: "text-white";
|
|
50
|
+
};
|
|
51
|
+
readonly soft: {
|
|
52
|
+
readonly bg: "bg-[#D1FAE5]";
|
|
53
|
+
readonly text: "text-[#047857]";
|
|
54
|
+
};
|
|
55
|
+
}, {
|
|
56
|
+
readonly vivid: {
|
|
57
|
+
readonly bg: "bg-[#0D9488]";
|
|
58
|
+
readonly text: "text-white";
|
|
59
|
+
};
|
|
60
|
+
readonly soft: {
|
|
61
|
+
readonly bg: "bg-[#CCFBF1]";
|
|
62
|
+
readonly text: "text-[#0F766E]";
|
|
63
|
+
};
|
|
64
|
+
}, {
|
|
65
|
+
readonly vivid: {
|
|
66
|
+
readonly bg: "bg-[#0891B2]";
|
|
67
|
+
readonly text: "text-white";
|
|
68
|
+
};
|
|
69
|
+
readonly soft: {
|
|
70
|
+
readonly bg: "bg-[#CFFAFE]";
|
|
71
|
+
readonly text: "text-[#0E7490]";
|
|
72
|
+
};
|
|
73
|
+
}, {
|
|
74
|
+
readonly vivid: {
|
|
75
|
+
readonly bg: "bg-[#2563EB]";
|
|
76
|
+
readonly text: "text-white";
|
|
77
|
+
};
|
|
78
|
+
readonly soft: {
|
|
79
|
+
readonly bg: "bg-[#DBEAFE]";
|
|
80
|
+
readonly text: "text-[#1D4ED8]";
|
|
81
|
+
};
|
|
82
|
+
}, {
|
|
83
|
+
readonly vivid: {
|
|
84
|
+
readonly bg: "bg-[#4F46E5]";
|
|
85
|
+
readonly text: "text-white";
|
|
86
|
+
};
|
|
87
|
+
readonly soft: {
|
|
88
|
+
readonly bg: "bg-[#E0E7FF]";
|
|
89
|
+
readonly text: "text-[#4338CA]";
|
|
90
|
+
};
|
|
91
|
+
}, {
|
|
92
|
+
readonly vivid: {
|
|
93
|
+
readonly bg: "bg-[#7C3AED]";
|
|
94
|
+
readonly text: "text-white";
|
|
95
|
+
};
|
|
96
|
+
readonly soft: {
|
|
97
|
+
readonly bg: "bg-[#EDE9FE]";
|
|
98
|
+
readonly text: "text-[#6D28D9]";
|
|
99
|
+
};
|
|
100
|
+
}, {
|
|
101
|
+
readonly vivid: {
|
|
102
|
+
readonly bg: "bg-[#9333EA]";
|
|
103
|
+
readonly text: "text-white";
|
|
104
|
+
};
|
|
105
|
+
readonly soft: {
|
|
106
|
+
readonly bg: "bg-[#F3E8FF]";
|
|
107
|
+
readonly text: "text-[#7E22CE]";
|
|
108
|
+
};
|
|
109
|
+
}, {
|
|
110
|
+
readonly vivid: {
|
|
111
|
+
readonly bg: "bg-[#DB2777]";
|
|
112
|
+
readonly text: "text-white";
|
|
113
|
+
};
|
|
114
|
+
readonly soft: {
|
|
115
|
+
readonly bg: "bg-[#FCE7F3]";
|
|
116
|
+
readonly text: "text-[#BE185D]";
|
|
117
|
+
};
|
|
118
|
+
}];
|
|
119
|
+
type AvatarColorVariant = 'vivid' | 'soft';
|
|
120
|
+
/** Extract initials from a name string (e.g. "John Doe" → "JD", "김민수" → "김민") */
|
|
121
|
+
declare function getAvatarInitials(name: string, maxChars?: number): string;
|
|
122
|
+
/** Hash a name string to a deterministic avatar color pair (djb2 xor variant) */
|
|
123
|
+
declare function getAvatarColor(name: string, variant?: AvatarColorVariant): {
|
|
124
|
+
readonly bg: "bg-[#DC2626]";
|
|
125
|
+
readonly text: "text-white";
|
|
126
|
+
} | {
|
|
127
|
+
readonly bg: "bg-[#FEE2E2]";
|
|
128
|
+
readonly text: "text-[#DC2626]";
|
|
129
|
+
} | {
|
|
130
|
+
readonly bg: "bg-[#EA580C]";
|
|
131
|
+
readonly text: "text-white";
|
|
132
|
+
} | {
|
|
133
|
+
readonly bg: "bg-[#FFEDD5]";
|
|
134
|
+
readonly text: "text-[#EA580C]";
|
|
135
|
+
} | {
|
|
136
|
+
readonly bg: "bg-[#D97706]";
|
|
137
|
+
readonly text: "text-white";
|
|
138
|
+
} | {
|
|
139
|
+
readonly bg: "bg-[#FEF3C7]";
|
|
140
|
+
readonly text: "text-[#B45309]";
|
|
141
|
+
} | {
|
|
142
|
+
readonly bg: "bg-[#CA8A04]";
|
|
143
|
+
readonly text: "text-white";
|
|
144
|
+
} | {
|
|
145
|
+
readonly bg: "bg-[#FEF9C3]";
|
|
146
|
+
readonly text: "text-[#A16207]";
|
|
147
|
+
} | {
|
|
148
|
+
readonly bg: "bg-[#059669]";
|
|
149
|
+
readonly text: "text-white";
|
|
150
|
+
} | {
|
|
151
|
+
readonly bg: "bg-[#D1FAE5]";
|
|
152
|
+
readonly text: "text-[#047857]";
|
|
153
|
+
} | {
|
|
154
|
+
readonly bg: "bg-[#0D9488]";
|
|
155
|
+
readonly text: "text-white";
|
|
156
|
+
} | {
|
|
157
|
+
readonly bg: "bg-[#CCFBF1]";
|
|
158
|
+
readonly text: "text-[#0F766E]";
|
|
159
|
+
} | {
|
|
160
|
+
readonly bg: "bg-[#0891B2]";
|
|
161
|
+
readonly text: "text-white";
|
|
162
|
+
} | {
|
|
163
|
+
readonly bg: "bg-[#CFFAFE]";
|
|
164
|
+
readonly text: "text-[#0E7490]";
|
|
165
|
+
} | {
|
|
166
|
+
readonly bg: "bg-[#2563EB]";
|
|
167
|
+
readonly text: "text-white";
|
|
168
|
+
} | {
|
|
169
|
+
readonly bg: "bg-[#DBEAFE]";
|
|
170
|
+
readonly text: "text-[#1D4ED8]";
|
|
171
|
+
} | {
|
|
172
|
+
readonly bg: "bg-[#4F46E5]";
|
|
173
|
+
readonly text: "text-white";
|
|
174
|
+
} | {
|
|
175
|
+
readonly bg: "bg-[#E0E7FF]";
|
|
176
|
+
readonly text: "text-[#4338CA]";
|
|
177
|
+
} | {
|
|
178
|
+
readonly bg: "bg-[#7C3AED]";
|
|
179
|
+
readonly text: "text-white";
|
|
180
|
+
} | {
|
|
181
|
+
readonly bg: "bg-[#EDE9FE]";
|
|
182
|
+
readonly text: "text-[#6D28D9]";
|
|
183
|
+
} | {
|
|
184
|
+
readonly bg: "bg-[#9333EA]";
|
|
185
|
+
readonly text: "text-white";
|
|
186
|
+
} | {
|
|
187
|
+
readonly bg: "bg-[#F3E8FF]";
|
|
188
|
+
readonly text: "text-[#7E22CE]";
|
|
189
|
+
} | {
|
|
190
|
+
readonly bg: "bg-[#DB2777]";
|
|
191
|
+
readonly text: "text-white";
|
|
192
|
+
} | {
|
|
193
|
+
readonly bg: "bg-[#FCE7F3]";
|
|
194
|
+
readonly text: "text-[#BE185D]";
|
|
195
|
+
};
|
|
196
|
+
type AvatarSize = 'xs' | 'sm' | 'default' | 'lg' | 'xl' | '2xl';
|
|
197
|
+
type AvatarShape = 'circle' | 'square';
|
|
198
|
+
type AvatarStatus = 'online' | 'offline' | 'busy' | 'away';
|
|
199
|
+
interface AvatarProps extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>, VariantProps<typeof avatarVariants> {
|
|
200
|
+
status?: AvatarStatus;
|
|
201
|
+
}
|
|
202
|
+
declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
|
|
203
|
+
interface AvatarImageProps extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image> {
|
|
204
|
+
}
|
|
205
|
+
declare const AvatarImage: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
|
|
206
|
+
interface AvatarFallbackProps extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback> {
|
|
207
|
+
size?: AvatarSize;
|
|
208
|
+
/** Shorthand: auto-generates initials + color from a name. Children override auto-initials. */
|
|
209
|
+
name?: string;
|
|
210
|
+
/** Pass a name/key to enable colorized mode. The string is hashed to pick a deterministic color. */
|
|
211
|
+
colorized?: string;
|
|
212
|
+
/** Color style: "vivid" (strong bg + white text) or "soft" (pastel bg + dark text). Default: "vivid" */
|
|
213
|
+
colorVariant?: AvatarColorVariant;
|
|
214
|
+
}
|
|
215
|
+
declare const AvatarFallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
|
|
216
|
+
interface AvatarGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
217
|
+
max?: number;
|
|
218
|
+
size?: AvatarSize;
|
|
219
|
+
shape?: AvatarShape;
|
|
220
|
+
}
|
|
221
|
+
declare const AvatarGroup: React.ForwardRefExoticComponent<AvatarGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
222
|
+
|
|
223
|
+
export { Avatar, type AvatarColorVariant, AvatarFallback, type AvatarFallbackProps, AvatarGroup, type AvatarGroupProps, AvatarImage, type AvatarImageProps, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, avatarColors, avatarVariants, getAvatarColor, getAvatarInitials };
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var avatar_exports = {};
|
|
31
|
+
__export(avatar_exports, {
|
|
32
|
+
Avatar: () => Avatar,
|
|
33
|
+
AvatarFallback: () => AvatarFallback,
|
|
34
|
+
AvatarGroup: () => AvatarGroup,
|
|
35
|
+
AvatarImage: () => AvatarImage,
|
|
36
|
+
avatarColors: () => avatarColors,
|
|
37
|
+
avatarVariants: () => avatarVariants,
|
|
38
|
+
getAvatarColor: () => getAvatarColor,
|
|
39
|
+
getAvatarInitials: () => getAvatarInitials
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(avatar_exports);
|
|
42
|
+
var React = __toESM(require("react"));
|
|
43
|
+
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
44
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
45
|
+
var import_utils = require("../../lib/utils");
|
|
46
|
+
const avatarVariants = (0, import_class_variance_authority.cva)(
|
|
47
|
+
"relative inline-flex items-center justify-center overflow-hidden bg-background-muted select-none",
|
|
48
|
+
{
|
|
49
|
+
variants: {
|
|
50
|
+
size: {
|
|
51
|
+
xs: "w-6 h-6",
|
|
52
|
+
// 24px
|
|
53
|
+
sm: "w-8 h-8",
|
|
54
|
+
// 32px
|
|
55
|
+
default: "w-10 h-10",
|
|
56
|
+
// 40px
|
|
57
|
+
lg: "w-12 h-12",
|
|
58
|
+
// 48px
|
|
59
|
+
xl: "w-16 h-16",
|
|
60
|
+
// 64px
|
|
61
|
+
"2xl": "w-20 h-20"
|
|
62
|
+
// 80px
|
|
63
|
+
},
|
|
64
|
+
shape: {
|
|
65
|
+
circle: "rounded-full",
|
|
66
|
+
square: "rounded-xl"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
defaultVariants: { size: "default", shape: "circle" }
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
const statusDotSizes = {
|
|
73
|
+
xs: "w-1.5 h-1.5",
|
|
74
|
+
sm: "w-2 h-2",
|
|
75
|
+
default: "w-2.5 h-2.5",
|
|
76
|
+
lg: "w-3 h-3",
|
|
77
|
+
xl: "w-3.5 h-3.5",
|
|
78
|
+
"2xl": "w-4 h-4"
|
|
79
|
+
};
|
|
80
|
+
const statusColors = {
|
|
81
|
+
online: "bg-success",
|
|
82
|
+
offline: "bg-text-muted",
|
|
83
|
+
busy: "bg-error",
|
|
84
|
+
away: "bg-warning"
|
|
85
|
+
};
|
|
86
|
+
const fallbackFontSizes = {
|
|
87
|
+
xs: "text-2xs",
|
|
88
|
+
sm: "text-xs",
|
|
89
|
+
default: "text-sm",
|
|
90
|
+
lg: "text-base",
|
|
91
|
+
xl: "text-xl",
|
|
92
|
+
"2xl": "text-2xl"
|
|
93
|
+
};
|
|
94
|
+
const groupNegativeMargins = {
|
|
95
|
+
xs: "-space-x-1.5",
|
|
96
|
+
sm: "-space-x-2",
|
|
97
|
+
default: "-space-x-2.5",
|
|
98
|
+
lg: "-space-x-3",
|
|
99
|
+
xl: "-space-x-4",
|
|
100
|
+
"2xl": "-space-x-5"
|
|
101
|
+
};
|
|
102
|
+
const avatarColors = [
|
|
103
|
+
{ vivid: { bg: "bg-[#DC2626]", text: "text-white" }, soft: { bg: "bg-[#FEE2E2]", text: "text-[#DC2626]" } },
|
|
104
|
+
// red
|
|
105
|
+
{ vivid: { bg: "bg-[#EA580C]", text: "text-white" }, soft: { bg: "bg-[#FFEDD5]", text: "text-[#EA580C]" } },
|
|
106
|
+
// orange
|
|
107
|
+
{ vivid: { bg: "bg-[#D97706]", text: "text-white" }, soft: { bg: "bg-[#FEF3C7]", text: "text-[#B45309]" } },
|
|
108
|
+
// amber
|
|
109
|
+
{ vivid: { bg: "bg-[#CA8A04]", text: "text-white" }, soft: { bg: "bg-[#FEF9C3]", text: "text-[#A16207]" } },
|
|
110
|
+
// yellow
|
|
111
|
+
{ vivid: { bg: "bg-[#059669]", text: "text-white" }, soft: { bg: "bg-[#D1FAE5]", text: "text-[#047857]" } },
|
|
112
|
+
// emerald
|
|
113
|
+
{ vivid: { bg: "bg-[#0D9488]", text: "text-white" }, soft: { bg: "bg-[#CCFBF1]", text: "text-[#0F766E]" } },
|
|
114
|
+
// teal
|
|
115
|
+
{ vivid: { bg: "bg-[#0891B2]", text: "text-white" }, soft: { bg: "bg-[#CFFAFE]", text: "text-[#0E7490]" } },
|
|
116
|
+
// cyan
|
|
117
|
+
{ vivid: { bg: "bg-[#2563EB]", text: "text-white" }, soft: { bg: "bg-[#DBEAFE]", text: "text-[#1D4ED8]" } },
|
|
118
|
+
// blue
|
|
119
|
+
{ vivid: { bg: "bg-[#4F46E5]", text: "text-white" }, soft: { bg: "bg-[#E0E7FF]", text: "text-[#4338CA]" } },
|
|
120
|
+
// indigo
|
|
121
|
+
{ vivid: { bg: "bg-[#7C3AED]", text: "text-white" }, soft: { bg: "bg-[#EDE9FE]", text: "text-[#6D28D9]" } },
|
|
122
|
+
// violet
|
|
123
|
+
{ vivid: { bg: "bg-[#9333EA]", text: "text-white" }, soft: { bg: "bg-[#F3E8FF]", text: "text-[#7E22CE]" } },
|
|
124
|
+
// purple
|
|
125
|
+
{ vivid: { bg: "bg-[#DB2777]", text: "text-white" }, soft: { bg: "bg-[#FCE7F3]", text: "text-[#BE185D]" } }
|
|
126
|
+
// pink
|
|
127
|
+
];
|
|
128
|
+
function getAvatarInitials(name, maxChars = 2) {
|
|
129
|
+
const trimmed = name.trim();
|
|
130
|
+
if (!trimmed) return "";
|
|
131
|
+
const cjkRegex = /[\u3000-\u9fff\uac00-\ud7af\uff00-\uffef]/;
|
|
132
|
+
if (cjkRegex.test(trimmed.charAt(0))) {
|
|
133
|
+
return trimmed.slice(0, maxChars);
|
|
134
|
+
}
|
|
135
|
+
const parts = trimmed.split(/[\s\-_.]+/).filter(Boolean);
|
|
136
|
+
if (parts.length === 1) {
|
|
137
|
+
return parts[0].charAt(0).toUpperCase();
|
|
138
|
+
}
|
|
139
|
+
return (parts[0].charAt(0) + parts[parts.length - 1].charAt(0)).toUpperCase().slice(0, maxChars);
|
|
140
|
+
}
|
|
141
|
+
function getAvatarColor(name, variant = "vivid") {
|
|
142
|
+
let hash = 5381;
|
|
143
|
+
for (let i = 0; i < name.length; i++) {
|
|
144
|
+
hash = (hash << 5) + hash ^ name.charCodeAt(i);
|
|
145
|
+
}
|
|
146
|
+
return avatarColors[(hash >>> 0) % avatarColors.length][variant];
|
|
147
|
+
}
|
|
148
|
+
const Avatar = React.forwardRef(({ className, size, shape, status, children, ...props }, ref) => {
|
|
149
|
+
const resolvedSize = size || "default";
|
|
150
|
+
if (!status) {
|
|
151
|
+
return /* @__PURE__ */ React.createElement(
|
|
152
|
+
AvatarPrimitive.Root,
|
|
153
|
+
{
|
|
154
|
+
ref,
|
|
155
|
+
className: (0, import_utils.cn)(avatarVariants({ size, shape }), className),
|
|
156
|
+
...props
|
|
157
|
+
},
|
|
158
|
+
children
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
return /* @__PURE__ */ React.createElement("span", { className: "relative inline-flex" }, /* @__PURE__ */ React.createElement(
|
|
162
|
+
AvatarPrimitive.Root,
|
|
163
|
+
{
|
|
164
|
+
ref,
|
|
165
|
+
className: (0, import_utils.cn)(avatarVariants({ size, shape }), className),
|
|
166
|
+
...props
|
|
167
|
+
},
|
|
168
|
+
children
|
|
169
|
+
), /* @__PURE__ */ React.createElement(
|
|
170
|
+
"span",
|
|
171
|
+
{
|
|
172
|
+
className: (0, import_utils.cn)(
|
|
173
|
+
"absolute bottom-0 right-0 rounded-full ring-2 ring-background",
|
|
174
|
+
statusDotSizes[resolvedSize],
|
|
175
|
+
statusColors[status]
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
));
|
|
179
|
+
});
|
|
180
|
+
Avatar.displayName = "Avatar";
|
|
181
|
+
const AvatarImage = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
182
|
+
AvatarPrimitive.Image,
|
|
183
|
+
{
|
|
184
|
+
ref,
|
|
185
|
+
className: (0, import_utils.cn)("object-cover w-full h-full", className),
|
|
186
|
+
...props
|
|
187
|
+
}
|
|
188
|
+
));
|
|
189
|
+
AvatarImage.displayName = "AvatarImage";
|
|
190
|
+
const AvatarFallback = React.forwardRef(({ className, size, name, colorized, colorVariant = "vivid", children, ...props }, ref) => {
|
|
191
|
+
const resolvedSize = size || "default";
|
|
192
|
+
const colorKey = name || colorized;
|
|
193
|
+
const color = colorKey ? getAvatarColor(colorKey, colorVariant) : null;
|
|
194
|
+
const resolvedChildren = children ?? (name ? getAvatarInitials(name) : void 0);
|
|
195
|
+
return /* @__PURE__ */ React.createElement(
|
|
196
|
+
AvatarPrimitive.Fallback,
|
|
197
|
+
{
|
|
198
|
+
ref,
|
|
199
|
+
className: (0, import_utils.cn)(
|
|
200
|
+
"flex items-center justify-center w-full h-full font-semibold",
|
|
201
|
+
color ? [color.bg, color.text] : "bg-background-muted text-text-muted",
|
|
202
|
+
fallbackFontSizes[resolvedSize],
|
|
203
|
+
className
|
|
204
|
+
),
|
|
205
|
+
...props
|
|
206
|
+
},
|
|
207
|
+
resolvedChildren
|
|
208
|
+
);
|
|
209
|
+
});
|
|
210
|
+
AvatarFallback.displayName = "AvatarFallback";
|
|
211
|
+
const AvatarGroup = React.forwardRef(
|
|
212
|
+
({ className, max, size = "default", shape = "circle", children, ...props }, ref) => {
|
|
213
|
+
const childArray = React.Children.toArray(children);
|
|
214
|
+
const visibleChildren = max ? childArray.slice(0, max) : childArray;
|
|
215
|
+
const overflowCount = max ? childArray.length - max : 0;
|
|
216
|
+
return /* @__PURE__ */ React.createElement(
|
|
217
|
+
"div",
|
|
218
|
+
{
|
|
219
|
+
ref,
|
|
220
|
+
className: (0, import_utils.cn)(
|
|
221
|
+
"flex items-center",
|
|
222
|
+
groupNegativeMargins[size],
|
|
223
|
+
"[&>*]:ring-2 [&>*]:ring-background",
|
|
224
|
+
className
|
|
225
|
+
),
|
|
226
|
+
...props
|
|
227
|
+
},
|
|
228
|
+
visibleChildren,
|
|
229
|
+
overflowCount > 0 && /* @__PURE__ */ React.createElement(Avatar, { size, shape }, /* @__PURE__ */ React.createElement(AvatarFallback, { size }, "+", overflowCount))
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
AvatarGroup.displayName = "AvatarGroup";
|
|
234
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
235
|
+
0 && (module.exports = {
|
|
236
|
+
Avatar,
|
|
237
|
+
AvatarFallback,
|
|
238
|
+
AvatarGroup,
|
|
239
|
+
AvatarImage,
|
|
240
|
+
avatarColors,
|
|
241
|
+
avatarVariants,
|
|
242
|
+
getAvatarColor,
|
|
243
|
+
getAvatarInitials
|
|
244
|
+
});
|
|
245
|
+
//# sourceMappingURL=avatar.js.map
|