jenosize-ui 0.1.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/LICENSE +28 -0
- package/README.md +100 -0
- package/THIRD-PARTY-NOTICES.md +163 -0
- package/dist/Button-Bt7pzM4R.d.ts +82 -0
- package/dist/PaymentInput-CKPIPNWH.d.ts +141 -0
- package/dist/Select-CVbEQ2Ep.d.ts +118 -0
- package/dist/TagInput-CTJYOB4J.d.ts +90 -0
- package/dist/avatar.d.ts +161 -0
- package/dist/avatar.js +11 -0
- package/dist/badge.d.ts +109 -0
- package/dist/badge.js +10 -0
- package/dist/breadcrumb.d.ts +58 -0
- package/dist/breadcrumb.js +7 -0
- package/dist/button.d.ts +54 -0
- package/dist/button.js +14 -0
- package/dist/calendar.d.ts +368 -0
- package/dist/calendar.js +21 -0
- package/dist/callout.d.ts +70 -0
- package/dist/callout.js +16 -0
- package/dist/card-nWicloNi.d.ts +80 -0
- package/dist/card.d.ts +2 -0
- package/dist/card.js +7 -0
- package/dist/checkbox.d.ts +133 -0
- package/dist/checkbox.js +11 -0
- package/dist/chunk-24TO7E32.js +42 -0
- package/dist/chunk-3Y5X7B5C.js +146 -0
- package/dist/chunk-4OLULPQG.js +202 -0
- package/dist/chunk-4P2NBLBW.js +103 -0
- package/dist/chunk-52IFGFTL.js +11 -0
- package/dist/chunk-5FATN5YD.js +115 -0
- package/dist/chunk-5NOBSXJN.js +297 -0
- package/dist/chunk-5RAPA22E.js +106 -0
- package/dist/chunk-7EUAMHMU.js +16 -0
- package/dist/chunk-7EWQKTNQ.js +1336 -0
- package/dist/chunk-7HOIZ3UO.js +110 -0
- package/dist/chunk-7IU5TMFL.js +452 -0
- package/dist/chunk-7JBNLEJ7.js +29 -0
- package/dist/chunk-7S2TBALK.js +23 -0
- package/dist/chunk-BJUZVYQC.js +188 -0
- package/dist/chunk-BVJWBYIG.js +66 -0
- package/dist/chunk-CME4DIML.js +65 -0
- package/dist/chunk-CYPPEUX5.js +73 -0
- package/dist/chunk-D5BTFSL7.js +71 -0
- package/dist/chunk-D6TPWNRK.js +387 -0
- package/dist/chunk-DJSXIAFH.js +66 -0
- package/dist/chunk-DRZCJCBO.js +46 -0
- package/dist/chunk-DWKILXHE.js +17 -0
- package/dist/chunk-E7ZSWBAK.js +70 -0
- package/dist/chunk-EDSK6FEH.js +8 -0
- package/dist/chunk-F2K7VJUV.js +114 -0
- package/dist/chunk-F6NLE6XJ.js +40 -0
- package/dist/chunk-FHHAPGCR.js +32 -0
- package/dist/chunk-FXIBGTS5.js +14 -0
- package/dist/chunk-GCVA3OIV.js +72 -0
- package/dist/chunk-GFOAJVW5.js +336 -0
- package/dist/chunk-GRLSUQQE.js +136 -0
- package/dist/chunk-GTHJWR3Q.js +77 -0
- package/dist/chunk-HMUZE6EK.js +67 -0
- package/dist/chunk-I7WU4GTY.js +503 -0
- package/dist/chunk-J2BCKBHC.js +151 -0
- package/dist/chunk-J36M3KRX.js +1315 -0
- package/dist/chunk-J7ZQQFPT.js +113 -0
- package/dist/chunk-JP26LPCY.js +234 -0
- package/dist/chunk-JTNFJLIY.js +1046 -0
- package/dist/chunk-JVJRHBTD.js +50 -0
- package/dist/chunk-JYGR44ZC.js +133 -0
- package/dist/chunk-KDLPXXD2.js +173 -0
- package/dist/chunk-KMSYEE23.js +224 -0
- package/dist/chunk-KNYKWUYX.js +52 -0
- package/dist/chunk-LME57Z6J.js +138 -0
- package/dist/chunk-MFJP5FA7.js +20 -0
- package/dist/chunk-MKC5HNA7.js +1692 -0
- package/dist/chunk-MQGD2OUF.js +39 -0
- package/dist/chunk-MUFHLP4S.js +566 -0
- package/dist/chunk-O2LG3PNI.js +74 -0
- package/dist/chunk-O4GRKO3I.js +66 -0
- package/dist/chunk-OHUFNYGN.js +791 -0
- package/dist/chunk-PWKWNDBS.js +243 -0
- package/dist/chunk-QA74ITR4.js +103 -0
- package/dist/chunk-R6RGJF4L.js +170 -0
- package/dist/chunk-S7NNXWIN.js +7 -0
- package/dist/chunk-SV56BSUQ.js +162 -0
- package/dist/chunk-T7FCG7XV.js +435 -0
- package/dist/chunk-THC2ISYP.js +57 -0
- package/dist/chunk-VWC72TR3.js +115 -0
- package/dist/chunk-W46K56XU.js +216 -0
- package/dist/chunk-W5GGOUUI.js +75 -0
- package/dist/chunk-WEUJYDCV.js +269 -0
- package/dist/chunk-WFY7DKQD.js +279 -0
- package/dist/chunk-WZQFC7ZN.js +448 -0
- package/dist/chunk-Z3ETJN5G.js +136 -0
- package/dist/chunk-ZOOX3TUB.js +192 -0
- package/dist/chunk-ZSNJ6UA3.js +42 -0
- package/dist/chunk-ZZA2LUTL.js +130 -0
- package/dist/chunk-ZZT2E5VT.js +24 -0
- package/dist/color-CtSxc1Rh.d.ts +6 -0
- package/dist/combobox.d.ts +184 -0
- package/dist/combobox.js +21 -0
- package/dist/date-input.d.ts +83 -0
- package/dist/date-input.js +16 -0
- package/dist/date-picker.d.ts +249 -0
- package/dist/date-picker.js +29 -0
- package/dist/date-utils-7hTFTXNK.d.ts +34 -0
- package/dist/date-vMJBKAFK.d.ts +22 -0
- package/dist/dialog.d.ts +86 -0
- package/dist/dialog.js +15 -0
- package/dist/drawer.d.ts +77 -0
- package/dist/drawer.js +14 -0
- package/dist/dropdown-menu.d.ts +218 -0
- package/dist/dropdown-menu.js +10 -0
- package/dist/file-trigger.d.ts +42 -0
- package/dist/file-trigger.js +3 -0
- package/dist/form.d.ts +487 -0
- package/dist/form.js +1179 -0
- package/dist/header-navigation.d.ts +74 -0
- package/dist/header-navigation.js +23 -0
- package/dist/icons/app.d.ts +48 -0
- package/dist/icons/app.js +282 -0
- package/dist/icons/flag.d.ts +817 -0
- package/dist/icons/flag.js +58336 -0
- package/dist/icons/integration.d.ts +36 -0
- package/dist/icons/integration.js +531 -0
- package/dist/icons/payment.d.ts +116 -0
- package/dist/icons/payment.js +2418 -0
- package/dist/icons.d.ts +2013 -0
- package/dist/icons.js +2012 -0
- package/dist/illustration.d.ts +48 -0
- package/dist/illustration.js +4 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +73 -0
- package/dist/indicator.d.ts +51 -0
- package/dist/indicator.js +7 -0
- package/dist/input.d.ts +66 -0
- package/dist/input.js +15 -0
- package/dist/multi-value-CJb_tnvi.d.ts +8 -0
- package/dist/nav-Bla0o_-1.d.ts +98 -0
- package/dist/number-input.d.ts +80 -0
- package/dist/number-input.js +15 -0
- package/dist/options-CPEIgjtd.d.ts +68 -0
- package/dist/overflow-Df0h42Oi.d.ts +29 -0
- package/dist/pagination.d.ts +77 -0
- package/dist/pagination.js +17 -0
- package/dist/payment-input.d.ts +7 -0
- package/dist/payment-input.js +15 -0
- package/dist/popover.d.ts +60 -0
- package/dist/popover.js +14 -0
- package/dist/progress.d.ts +87 -0
- package/dist/progress.js +5 -0
- package/dist/radio.d.ts +77 -0
- package/dist/radio.js +12 -0
- package/dist/select.d.ts +68 -0
- package/dist/select.js +24 -0
- package/dist/shared-BNXAdgh2.d.ts +9 -0
- package/dist/shared-BYXJPnsN.d.ts +11 -0
- package/dist/shared-Dc-GgA16.d.ts +42 -0
- package/dist/sidebar-navigation.d.ts +129 -0
- package/dist/sidebar-navigation.js +15 -0
- package/dist/styles.css +2 -0
- package/dist/switch.d.ts +23 -0
- package/dist/switch.js +7 -0
- package/dist/table.d.ts +692 -0
- package/dist/table.js +44 -0
- package/dist/tabs.d.ts +111 -0
- package/dist/tabs.js +8 -0
- package/dist/tag-input.d.ts +12 -0
- package/dist/tag-input.js +19 -0
- package/dist/tag.d.ts +98 -0
- package/dist/tag.js +9 -0
- package/dist/textarea.d.ts +40 -0
- package/dist/textarea.js +12 -0
- package/dist/theme-script.d.ts +29 -0
- package/dist/theme-script.js +15 -0
- package/dist/theme.css +929 -0
- package/dist/theme.d.ts +71 -0
- package/dist/theme.js +15 -0
- package/dist/toast.d.ts +242 -0
- package/dist/toast.js +15 -0
- package/dist/tooltip.d.ts +70 -0
- package/dist/tooltip.js +6 -0
- package/dist/tree.d.ts +308 -0
- package/dist/tree.js +11 -0
- package/package.json +352 -0
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import { Indicator } from './chunk-5FATN5YD.js';
|
|
2
|
+
import { PlusIcon, UserIcon, CheckIcon } from './chunk-24TO7E32.js';
|
|
3
|
+
import { TooltipExport } from './chunk-ZZA2LUTL.js';
|
|
4
|
+
import { POPUP_MOTION } from './chunk-O4GRKO3I.js';
|
|
5
|
+
import { warnExclusive, devWarn } from './chunk-GCVA3OIV.js';
|
|
6
|
+
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
7
|
+
import * as React4 from 'react';
|
|
8
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
|
+
import { Avatar as Avatar$1 } from '@base-ui/react/avatar';
|
|
10
|
+
import { Popover } from '@base-ui/react/popover';
|
|
11
|
+
|
|
12
|
+
var ADD_SIZE = {
|
|
13
|
+
xs: { root: "size-6", icon: "size-4" },
|
|
14
|
+
sm: { root: "size-8", icon: "size-4" },
|
|
15
|
+
md: { root: "size-10", icon: "size-5" }
|
|
16
|
+
};
|
|
17
|
+
function AvatarAddButton(props) {
|
|
18
|
+
const { size = "md", title = "Add user", className, type = "button", ...rest } = props;
|
|
19
|
+
return /* @__PURE__ */ jsx(TooltipExport, { content: title, children: /* @__PURE__ */ jsx(
|
|
20
|
+
"button",
|
|
21
|
+
{
|
|
22
|
+
...rest,
|
|
23
|
+
type,
|
|
24
|
+
"aria-label": title,
|
|
25
|
+
className: cn(
|
|
26
|
+
// UUI: border-dashed border-primary bg-primary text-fg-quaternary →
|
|
27
|
+
// gray-300 dashed ring-slot border on the page surface, resting-icon gray.
|
|
28
|
+
"flex shrink-0 cursor-pointer items-center justify-center rounded-full border border-dashed border-primary bg-primary text-fg-quaternary",
|
|
29
|
+
"transition duration-100 ease-linear hover:bg-secondary hover:text-fg-quaternary_hover",
|
|
30
|
+
// OUTSET focus convention: CSS outline, 2px ring + 2px transparent gap.
|
|
31
|
+
"outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
32
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
33
|
+
ADD_SIZE[size].root,
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
children: /* @__PURE__ */ jsx(PlusIcon, { className: ADD_SIZE[size].icon })
|
|
37
|
+
}
|
|
38
|
+
) });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/components/avatar/shared.ts
|
|
42
|
+
var AVATAR_SIZE = {
|
|
43
|
+
xxs: { box: "size-4", text: "text-xs", icon: "size-2.5", dot: "size-1" },
|
|
44
|
+
xs: { box: "size-6", text: "text-xs", icon: "size-4", dot: "size-1.5" },
|
|
45
|
+
sm: { box: "size-8", text: "text-sm", icon: "size-5", dot: "size-2" },
|
|
46
|
+
md: { box: "size-10", text: "text-md", icon: "size-6", dot: "size-2.5" },
|
|
47
|
+
lg: { box: "size-12", text: "text-lg", icon: "size-7", dot: "size-3" },
|
|
48
|
+
xl: { box: "size-14", text: "text-xl", icon: "size-8", dot: "size-3.5" },
|
|
49
|
+
"2xl": { box: "size-16", text: "text-display-xs", icon: "size-8", dot: "size-4" }
|
|
50
|
+
};
|
|
51
|
+
var AVATAR_SHAPE = {
|
|
52
|
+
circle: "rounded-full",
|
|
53
|
+
// The non-rounded avatar takes the 6px corner, `rounded-md`.
|
|
54
|
+
square: "rounded-md"
|
|
55
|
+
};
|
|
56
|
+
var BORDER_PAD = {
|
|
57
|
+
xxs: "p-px",
|
|
58
|
+
xs: "p-px",
|
|
59
|
+
sm: "p-px",
|
|
60
|
+
md: "p-px",
|
|
61
|
+
lg: "p-[1.5px]",
|
|
62
|
+
xl: "p-0.5",
|
|
63
|
+
"2xl": "p-0.5"
|
|
64
|
+
};
|
|
65
|
+
var STATUS = {
|
|
66
|
+
// Untitled UI online dot = success-500 (the dedicated --color-fg-success-secondary role,
|
|
67
|
+
// one step brighter than the success-600 solid fill).
|
|
68
|
+
online: { dot: "bg-fg-success-secondary", label: "Online" },
|
|
69
|
+
// Light neutral dot (≈ gray-300) — a touch lighter than `fg-subtle`/gray-500.
|
|
70
|
+
offline: { dot: "bg-border-primary", label: "Offline" }
|
|
71
|
+
};
|
|
72
|
+
var INDICATOR_BOX = {
|
|
73
|
+
xxs: "size-2",
|
|
74
|
+
xs: "size-2.5",
|
|
75
|
+
sm: "size-3",
|
|
76
|
+
md: "size-3.5",
|
|
77
|
+
lg: "size-4",
|
|
78
|
+
xl: "size-4.5",
|
|
79
|
+
"2xl": "size-5"
|
|
80
|
+
};
|
|
81
|
+
function getInitials(name) {
|
|
82
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
83
|
+
if (parts.length === 0) return "";
|
|
84
|
+
if (parts.length === 1) return parts[0].charAt(0).toUpperCase();
|
|
85
|
+
return (parts[0].charAt(0) + parts.at(-1).charAt(0)).toUpperCase();
|
|
86
|
+
}
|
|
87
|
+
var GLOSS_MASK = "linear-gradient(to bottom, black 0%, transparent 25%, transparent 75%, black 100%)";
|
|
88
|
+
function ContrastBorder({
|
|
89
|
+
radius,
|
|
90
|
+
gloss = false,
|
|
91
|
+
hairline = "0.5",
|
|
92
|
+
glossWidth = "1"
|
|
93
|
+
}) {
|
|
94
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
"span",
|
|
97
|
+
{
|
|
98
|
+
"aria-hidden": "true",
|
|
99
|
+
className: cn(
|
|
100
|
+
"pointer-events-none absolute inset-0 outline outline-black/16",
|
|
101
|
+
hairline === "0.75" ? "outline-[0.75px] -outline-offset-[0.75px]" : "outline-[0.5px] -outline-offset-[0.5px]",
|
|
102
|
+
radius
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
gloss ? /* @__PURE__ */ jsx(
|
|
107
|
+
"span",
|
|
108
|
+
{
|
|
109
|
+
"aria-hidden": "true",
|
|
110
|
+
style: { maskImage: GLOSS_MASK, WebkitMaskImage: GLOSS_MASK },
|
|
111
|
+
className: cn("pointer-events-none absolute inset-0 border-white/32", glossWidth === "1.5" ? "border-[1.5px]" : "border", radius)
|
|
112
|
+
}
|
|
113
|
+
) : null
|
|
114
|
+
] });
|
|
115
|
+
}
|
|
116
|
+
function AvatarIndicator({ badge, verified, status, count, boxClass, dotClass, positionClass = "right-0 bottom-0" }) {
|
|
117
|
+
const pos = cn("absolute", positionClass);
|
|
118
|
+
if (badge != null) return /* @__PURE__ */ jsx(Indicator, { icon: badge, color: "brand", bordered: true, className: cn(pos, boxClass) });
|
|
119
|
+
if (verified) return /* @__PURE__ */ jsx(Indicator, { shape: "scalloped", color: "info", icon: /* @__PURE__ */ jsx(CheckIcon, {}), label: "Verified", className: cn(pos, boxClass) });
|
|
120
|
+
if (status != null) {
|
|
121
|
+
return /* @__PURE__ */ jsx(Indicator, { raised: true, bordered: true, color: status === "online" ? "success" : "neutral", label: STATUS[status].label, className: cn(pos, dotClass) });
|
|
122
|
+
}
|
|
123
|
+
if (count != null) return /* @__PURE__ */ jsx(Indicator, { count, bordered: true, className: cn(pos, boxClass) });
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
var FALLBACK_DELAY = 600;
|
|
127
|
+
function Avatar(props) {
|
|
128
|
+
const {
|
|
129
|
+
src,
|
|
130
|
+
alt,
|
|
131
|
+
name,
|
|
132
|
+
size = "md",
|
|
133
|
+
shape = "circle",
|
|
134
|
+
border = false,
|
|
135
|
+
status,
|
|
136
|
+
verified = false,
|
|
137
|
+
count,
|
|
138
|
+
placeholderIcon,
|
|
139
|
+
placeholder,
|
|
140
|
+
badge,
|
|
141
|
+
focusable = false,
|
|
142
|
+
imageProps,
|
|
143
|
+
className
|
|
144
|
+
} = props;
|
|
145
|
+
warnExclusive("Avatar", "indicator slot", [
|
|
146
|
+
["badge", badge != null],
|
|
147
|
+
["verified", verified],
|
|
148
|
+
["status", status != null],
|
|
149
|
+
["count", count != null]
|
|
150
|
+
]);
|
|
151
|
+
const [imageLoaded, setImageLoaded] = React4.useState(false);
|
|
152
|
+
const hasName = typeof name === "string" && name.trim().length > 0;
|
|
153
|
+
const useInitials = hasName && size !== "xxs";
|
|
154
|
+
const initials = hasName ? getInitials(name) : "";
|
|
155
|
+
const sizing = AVATAR_SIZE[size];
|
|
156
|
+
const radius = AVATAR_SHAPE[shape];
|
|
157
|
+
const indicatorPosition = badge != null || count != null ? "-right-0.5 -bottom-0.5" : verified && (size === "xxs" || size === "xs") ? "-right-px -bottom-px" : void 0;
|
|
158
|
+
return /* @__PURE__ */ jsxs(
|
|
159
|
+
Avatar$1.Root,
|
|
160
|
+
{
|
|
161
|
+
role: hasName ? "img" : void 0,
|
|
162
|
+
"aria-label": hasName ? name : void 0,
|
|
163
|
+
className: cn(
|
|
164
|
+
"relative inline-flex shrink-0 align-middle select-none",
|
|
165
|
+
sizing.box,
|
|
166
|
+
radius,
|
|
167
|
+
// UUI `focusable`: group-scoped CSS outline for link/button-wrapped avatars
|
|
168
|
+
// (transparent 2px gap, never clipped — the OUTSET focus convention).
|
|
169
|
+
focusable && "outline-transparent group-focus-visible:outline-2 group-focus-visible:outline-offset-2 group-focus-visible:outline-focus-ring",
|
|
170
|
+
// UUI `border`: outer hairline frame + per-size inner padding.
|
|
171
|
+
border && "ring-1 ring-secondary_alt",
|
|
172
|
+
border && BORDER_PAD[size],
|
|
173
|
+
className
|
|
174
|
+
),
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ jsxs("span", { className: cn("relative inline-flex size-full items-center justify-center overflow-hidden", radius), children: [
|
|
177
|
+
src ? /* @__PURE__ */ jsx(
|
|
178
|
+
Avatar$1.Image,
|
|
179
|
+
{
|
|
180
|
+
...imageProps,
|
|
181
|
+
src,
|
|
182
|
+
alt: alt ?? name ?? "",
|
|
183
|
+
onLoadingStatusChange: (imageStatus) => setImageLoaded(imageStatus === "loaded"),
|
|
184
|
+
className: cn("absolute inset-0 size-full object-cover", radius, imageProps?.className)
|
|
185
|
+
}
|
|
186
|
+
) : null,
|
|
187
|
+
/* @__PURE__ */ jsx(
|
|
188
|
+
Avatar$1.Fallback,
|
|
189
|
+
{
|
|
190
|
+
delay: src ? FALLBACK_DELAY : void 0,
|
|
191
|
+
className: cn("absolute inset-0 flex items-center justify-center overflow-hidden", "bg-tertiary font-semibold text-quaternary", sizing.text, radius),
|
|
192
|
+
children: useInitials ? initials : placeholderIcon != null ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("inline-flex items-center justify-center text-fg-quaternary [&_svg]:size-full", sizing.icon), children: placeholderIcon }) : placeholder ?? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("inline-flex items-center justify-center text-fg-quaternary [&_svg]:size-full", sizing.icon), children: /* @__PURE__ */ jsx(UserIcon, {}) })
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
/* @__PURE__ */ jsx(ContrastBorder, { radius, gloss: src != null && imageLoaded && size !== "xxs" && size !== "xs" })
|
|
196
|
+
] }),
|
|
197
|
+
/* @__PURE__ */ jsx(
|
|
198
|
+
AvatarIndicator,
|
|
199
|
+
{
|
|
200
|
+
badge,
|
|
201
|
+
verified,
|
|
202
|
+
status,
|
|
203
|
+
count,
|
|
204
|
+
boxClass: INDICATOR_BOX[size],
|
|
205
|
+
dotClass: sizing.dot,
|
|
206
|
+
positionClass: indicatorPosition
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
var OVERLAP = {
|
|
214
|
+
xxs: { normal: "-ml-1", tight: "-ml-1.5" },
|
|
215
|
+
xs: { normal: "-ml-1.5", tight: "-ml-2" },
|
|
216
|
+
sm: { normal: "-ml-2", tight: "-ml-3" },
|
|
217
|
+
md: { normal: "-ml-2.5", tight: "-ml-4" },
|
|
218
|
+
lg: { normal: "-ml-3", tight: "-ml-5" },
|
|
219
|
+
xl: { normal: "-ml-3.5", tight: "-ml-6" },
|
|
220
|
+
"2xl": { normal: "-ml-4", tight: "-ml-7" }
|
|
221
|
+
};
|
|
222
|
+
function AvatarGroup(props) {
|
|
223
|
+
const { max, total, size = "md", shape = "circle", spacing = "normal", "aria-label": ariaLabel, onReveal, revealing = false, children, className } = props;
|
|
224
|
+
if (!ariaLabel) devWarn("<AvatarGroup> should have an `aria-label` to name the list of avatars.");
|
|
225
|
+
const items = React4.Children.toArray(children).filter(React4.isValidElement);
|
|
226
|
+
const limit = max != null ? Math.max(0, max) : items.length;
|
|
227
|
+
const visible = items.slice(0, limit);
|
|
228
|
+
const hidden = items.slice(limit);
|
|
229
|
+
const stated = total != null ? total : items.length;
|
|
230
|
+
const overflow = Math.max(hidden.length, stated - visible.length);
|
|
231
|
+
if (total != null && total < items.length) {
|
|
232
|
+
devWarn(
|
|
233
|
+
`<AvatarGroup> \`total\` is ${total} but ${items.length} avatars were passed \u2014 \`total\` counts the WHOLE group, so it can never be below the children. Showing +${overflow} so none is dropped.`
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
const canReveal = hidden.length > 0 || onReveal != null;
|
|
237
|
+
const pendingRows = Math.min(overflow, 6);
|
|
238
|
+
const radius = AVATAR_SHAPE[shape];
|
|
239
|
+
const overlap = OVERLAP[size][spacing];
|
|
240
|
+
const sizing = AVATAR_SIZE[size];
|
|
241
|
+
const tile = cn("inline-flex items-center justify-center bg-tertiary font-semibold text-quaternary select-none", sizing.box, sizing.text, radius);
|
|
242
|
+
return /* @__PURE__ */ jsxs("ul", { role: "list", "aria-label": ariaLabel, className: cn("flex items-center", className), children: [
|
|
243
|
+
visible.map((child, i) => /* @__PURE__ */ jsx(
|
|
244
|
+
"li",
|
|
245
|
+
{
|
|
246
|
+
style: { zIndex: items.length - i },
|
|
247
|
+
className: cn(
|
|
248
|
+
"relative inline-flex ring-[1.5px] ring-bg-primary transition-transform duration-100 ease-linear focus-within:z-10 hover:z-10",
|
|
249
|
+
radius,
|
|
250
|
+
i > 0 && overlap
|
|
251
|
+
),
|
|
252
|
+
children: React4.cloneElement(child, { size, shape })
|
|
253
|
+
},
|
|
254
|
+
i
|
|
255
|
+
)),
|
|
256
|
+
overflow > 0 ? /* @__PURE__ */ jsx("li", { style: { zIndex: 0 }, className: cn("relative inline-flex ring-[1.5px] ring-bg-primary", radius, visible.length > 0 && overlap), children: canReveal ? /* @__PURE__ */ jsxs(Popover.Root, { onOpenChange: (open) => open && onReveal?.(), children: [
|
|
257
|
+
/* @__PURE__ */ jsxs(
|
|
258
|
+
Popover.Trigger,
|
|
259
|
+
{
|
|
260
|
+
"aria-label": `Show ${overflow} more`,
|
|
261
|
+
className: cn(
|
|
262
|
+
tile,
|
|
263
|
+
"cursor-pointer transition-colors duration-100 ease-linear outline-none hover:bg-quaternary focus-visible:ring-2 focus-visible:ring-focus-ring"
|
|
264
|
+
),
|
|
265
|
+
children: [
|
|
266
|
+
"+",
|
|
267
|
+
overflow
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
),
|
|
271
|
+
/* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, { side: "top", sideOffset: 8, className: "z-50 outline-none", children: /* @__PURE__ */ jsx(
|
|
272
|
+
Popover.Popup,
|
|
273
|
+
{
|
|
274
|
+
className: cn(
|
|
275
|
+
"max-h-72 min-w-48 overflow-auto rounded-lg bg-primary p-1 text-sm text-primary shadow-lg ring-1 ring-secondary_alt ring-inset",
|
|
276
|
+
POPUP_MOTION
|
|
277
|
+
),
|
|
278
|
+
children: /* @__PURE__ */ jsx("ul", { role: "list", "aria-busy": revealing || void 0, className: "flex flex-col gap-0.5", children: revealing ? Array.from({ length: pendingRows }, (_, i) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2 rounded-md px-2 py-1.5", children: [
|
|
279
|
+
/* @__PURE__ */ jsx("span", { className: cn("animate-pulse bg-tertiary", AVATAR_SIZE.sm.box, radius) }),
|
|
280
|
+
/* @__PURE__ */ jsx("span", { className: "h-3 w-24 animate-pulse rounded-full bg-tertiary" })
|
|
281
|
+
] }, i)) : hidden.length > 0 ? hidden.map((child, i) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2 rounded-md px-2 py-1.5", children: [
|
|
282
|
+
React4.cloneElement(child, { size: "sm", shape }),
|
|
283
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-secondary", children: child.props.name ?? "Unknown" })
|
|
284
|
+
] }, i)) : /* @__PURE__ */ jsx("li", { className: "px-2 py-1.5 text-tertiary", children: "No one to show" }) })
|
|
285
|
+
}
|
|
286
|
+
) }) })
|
|
287
|
+
] }) : /* @__PURE__ */ jsxs("span", { role: "img", "aria-label": `${overflow} more`, className: tile, children: [
|
|
288
|
+
"+",
|
|
289
|
+
overflow
|
|
290
|
+
] }) }) : null
|
|
291
|
+
] });
|
|
292
|
+
}
|
|
293
|
+
var LABEL_TEXT = {
|
|
294
|
+
sm: { title: "text-sm", subtitle: "text-xs" },
|
|
295
|
+
md: { title: "text-sm", subtitle: "text-sm" },
|
|
296
|
+
lg: { title: "text-md", subtitle: "text-md" }
|
|
297
|
+
};
|
|
298
|
+
var LABEL_GAP = {
|
|
299
|
+
sm: "gap-2",
|
|
300
|
+
md: "gap-2",
|
|
301
|
+
lg: "gap-2"
|
|
302
|
+
};
|
|
303
|
+
function AvatarLabelGroup(props) {
|
|
304
|
+
const { src, alt, title, subtitle, size = "md", shape = "circle", status, verified, placeholderIcon, imageProps, className } = props;
|
|
305
|
+
const text = LABEL_TEXT[size];
|
|
306
|
+
const name = typeof title === "string" ? title : void 0;
|
|
307
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("inline-flex items-center", LABEL_GAP[size], className), children: [
|
|
308
|
+
/* @__PURE__ */ jsx(
|
|
309
|
+
Avatar,
|
|
310
|
+
{
|
|
311
|
+
src,
|
|
312
|
+
alt: alt ?? name,
|
|
313
|
+
name,
|
|
314
|
+
size,
|
|
315
|
+
shape,
|
|
316
|
+
border: true,
|
|
317
|
+
status,
|
|
318
|
+
verified,
|
|
319
|
+
placeholderIcon,
|
|
320
|
+
imageProps
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
|
|
324
|
+
/* @__PURE__ */ jsx("span", { className: cn("font-semibold text-primary", text.title), children: title }),
|
|
325
|
+
subtitle != null ? /* @__PURE__ */ jsx("span", { className: cn("truncate font-normal text-tertiary", text.subtitle), children: subtitle }) : null
|
|
326
|
+
] })
|
|
327
|
+
] });
|
|
328
|
+
}
|
|
329
|
+
var FALLBACK_DELAY2 = 600;
|
|
330
|
+
var PROFILE = {
|
|
331
|
+
sm: {
|
|
332
|
+
box: "size-18",
|
|
333
|
+
pad: "p-[3px]",
|
|
334
|
+
padPlaceholder: "p-1",
|
|
335
|
+
icon: "size-9",
|
|
336
|
+
// display-sm (30/38).
|
|
337
|
+
text: "text-display-sm",
|
|
338
|
+
badge: "size-5",
|
|
339
|
+
dot: "size-4",
|
|
340
|
+
pos: "right-0.5 bottom-0.5",
|
|
341
|
+
// Untitled UI: sm profile photo carries no elevation.
|
|
342
|
+
shadow: "",
|
|
343
|
+
hairline: "0.5",
|
|
344
|
+
glossWidth: "1"
|
|
345
|
+
},
|
|
346
|
+
md: {
|
|
347
|
+
box: "size-24",
|
|
348
|
+
pad: "p-1",
|
|
349
|
+
padPlaceholder: "p-[5px]",
|
|
350
|
+
icon: "size-12",
|
|
351
|
+
// display-md (36/44, -0.02em) — the first step that carries tracking.
|
|
352
|
+
text: "text-display-md",
|
|
353
|
+
badge: "size-6",
|
|
354
|
+
dot: "size-[1.125rem]",
|
|
355
|
+
pos: "right-1 bottom-1",
|
|
356
|
+
shadow: "shadow-xl",
|
|
357
|
+
hairline: "0.75",
|
|
358
|
+
glossWidth: "1.5"
|
|
359
|
+
},
|
|
360
|
+
lg: {
|
|
361
|
+
box: "size-40",
|
|
362
|
+
pad: "p-1.5",
|
|
363
|
+
padPlaceholder: "p-[7px]",
|
|
364
|
+
icon: "size-20",
|
|
365
|
+
// display-xl (60/72, -0.02em).
|
|
366
|
+
text: "text-display-xl",
|
|
367
|
+
badge: "size-8",
|
|
368
|
+
dot: "size-5",
|
|
369
|
+
pos: "right-2 bottom-2",
|
|
370
|
+
shadow: "shadow-2xl",
|
|
371
|
+
hairline: "0.75",
|
|
372
|
+
glossWidth: "1.5"
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
var SHAPE = {
|
|
376
|
+
circle: "rounded-full",
|
|
377
|
+
// House extension — UUI profile photos are circle-only.
|
|
378
|
+
square: "rounded-2xl"
|
|
379
|
+
};
|
|
380
|
+
function AvatarProfilePhoto(props) {
|
|
381
|
+
const { src, alt, name, size = "md", shape = "circle", status, verified = false, placeholderIcon, placeholder, badge, imageProps, className } = props;
|
|
382
|
+
const [imageLoaded, setImageLoaded] = React4.useState(false);
|
|
383
|
+
const showImage = src != null && imageLoaded;
|
|
384
|
+
const hasName = typeof name === "string" && name.trim().length > 0;
|
|
385
|
+
const initials = hasName ? getInitials(name) : "";
|
|
386
|
+
const sizing = PROFILE[size];
|
|
387
|
+
const radius = SHAPE[shape];
|
|
388
|
+
warnExclusive("AvatarProfilePhoto", "indicator slot", [
|
|
389
|
+
["badge", badge != null],
|
|
390
|
+
["verified", verified],
|
|
391
|
+
["status", status != null]
|
|
392
|
+
]);
|
|
393
|
+
return /* @__PURE__ */ jsxs(
|
|
394
|
+
Avatar$1.Root,
|
|
395
|
+
{
|
|
396
|
+
role: hasName ? "img" : void 0,
|
|
397
|
+
"aria-label": hasName ? name : void 0,
|
|
398
|
+
className: cn(
|
|
399
|
+
// UUI frame: bg-primary + ring-1 ring-secondary_alt + per-size padding
|
|
400
|
+
// (wider when showing the placeholder).
|
|
401
|
+
"relative flex shrink-0 items-center justify-center bg-primary ring-1 ring-secondary_alt select-none",
|
|
402
|
+
sizing.box,
|
|
403
|
+
showImage ? sizing.pad : sizing.padPlaceholder,
|
|
404
|
+
radius,
|
|
405
|
+
className
|
|
406
|
+
),
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ jsxs(
|
|
409
|
+
"span",
|
|
410
|
+
{
|
|
411
|
+
className: cn(
|
|
412
|
+
"relative flex size-full items-center justify-center overflow-hidden",
|
|
413
|
+
radius,
|
|
414
|
+
sizing.shadow,
|
|
415
|
+
!showImage && "bg-tertiary ring-1 ring-secondary_alt"
|
|
416
|
+
),
|
|
417
|
+
children: [
|
|
418
|
+
src ? /* @__PURE__ */ jsx(
|
|
419
|
+
Avatar$1.Image,
|
|
420
|
+
{
|
|
421
|
+
...imageProps,
|
|
422
|
+
src,
|
|
423
|
+
alt: alt ?? name ?? "",
|
|
424
|
+
onLoadingStatusChange: (imageStatus) => setImageLoaded(imageStatus === "loaded"),
|
|
425
|
+
className: cn("absolute inset-0 size-full object-cover", radius, imageProps?.className)
|
|
426
|
+
}
|
|
427
|
+
) : null,
|
|
428
|
+
/* @__PURE__ */ jsx(
|
|
429
|
+
Avatar$1.Fallback,
|
|
430
|
+
{
|
|
431
|
+
delay: src ? FALLBACK_DELAY2 : void 0,
|
|
432
|
+
className: cn("absolute inset-0 flex items-center justify-center overflow-hidden font-semibold text-quaternary", sizing.text, radius),
|
|
433
|
+
children: initials ? initials : placeholderIcon != null ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("inline-flex items-center justify-center text-fg-quaternary [&_svg]:size-full", sizing.icon), children: placeholderIcon }) : placeholder ?? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("inline-flex items-center justify-center text-fg-quaternary [&_svg]:size-full", sizing.icon), children: /* @__PURE__ */ jsx(UserIcon, {}) })
|
|
434
|
+
}
|
|
435
|
+
),
|
|
436
|
+
showImage ? /* @__PURE__ */ jsx(ContrastBorder, { radius, gloss: true, hairline: sizing.hairline, glossWidth: sizing.glossWidth }) : null
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
),
|
|
440
|
+
/* @__PURE__ */ jsx(AvatarIndicator, { badge, verified, status, boxClass: sizing.badge, dotClass: sizing.dot, positionClass: sizing.pos })
|
|
441
|
+
]
|
|
442
|
+
}
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export { Avatar, AvatarAddButton, AvatarGroup, AvatarLabelGroup, AvatarProfilePhoto };
|
|
447
|
+
//# sourceMappingURL=chunk-WZQFC7ZN.js.map
|
|
448
|
+
//# sourceMappingURL=chunk-WZQFC7ZN.js.map
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { useControllableOpen } from './chunk-CYPPEUX5.js';
|
|
2
|
+
import { PanelChrome } from './chunk-J7ZQQFPT.js';
|
|
3
|
+
import { CloseButton } from './chunk-MQGD2OUF.js';
|
|
4
|
+
import { EXPLICIT_CLOSE } from './chunk-S7NNXWIN.js';
|
|
5
|
+
import { useScrollFade } from './chunk-O2LG3PNI.js';
|
|
6
|
+
import { DRAWER_BACKDROP_MOTION, DRAWER_POPUP_MOTION, DRAWER_SLIDE } from './chunk-O4GRKO3I.js';
|
|
7
|
+
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
8
|
+
import { Drawer as Drawer$1 } from '@base-ui/react/drawer';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
|
+
|
|
12
|
+
var SIZE_INLINE = {
|
|
13
|
+
sm: "w-full max-w-80",
|
|
14
|
+
md: "w-full max-w-100",
|
|
15
|
+
lg: "w-full max-w-128",
|
|
16
|
+
fit: "w-auto max-w-full"
|
|
17
|
+
};
|
|
18
|
+
var SIZE_BLOCK = {
|
|
19
|
+
sm: "h-full max-h-80",
|
|
20
|
+
md: "h-full max-h-100",
|
|
21
|
+
lg: "h-full max-h-128",
|
|
22
|
+
fit: "h-auto max-h-full"
|
|
23
|
+
};
|
|
24
|
+
var SIDE_POSITION = {
|
|
25
|
+
left: "inset-y-0 left-0 h-full",
|
|
26
|
+
right: "inset-y-0 right-0 h-full",
|
|
27
|
+
top: "inset-x-0 top-0 w-full",
|
|
28
|
+
bottom: "inset-x-0 bottom-0 w-full"
|
|
29
|
+
};
|
|
30
|
+
var SIDE_EDGE = {
|
|
31
|
+
left: "border-r",
|
|
32
|
+
right: "border-l",
|
|
33
|
+
top: "border-b",
|
|
34
|
+
bottom: "border-t"
|
|
35
|
+
};
|
|
36
|
+
var SIDE_SWIPE = {
|
|
37
|
+
left: "left",
|
|
38
|
+
right: "right",
|
|
39
|
+
top: "up",
|
|
40
|
+
bottom: "down"
|
|
41
|
+
};
|
|
42
|
+
var isHorizontal = (side) => side === "left" || side === "right";
|
|
43
|
+
function Drawer(props) {
|
|
44
|
+
const {
|
|
45
|
+
trigger,
|
|
46
|
+
open,
|
|
47
|
+
defaultOpen = false,
|
|
48
|
+
onOpenChange,
|
|
49
|
+
side = "right",
|
|
50
|
+
size = "md",
|
|
51
|
+
showClose = true,
|
|
52
|
+
dividers = true,
|
|
53
|
+
keepMounted = false,
|
|
54
|
+
dismissible = true,
|
|
55
|
+
container,
|
|
56
|
+
title,
|
|
57
|
+
description,
|
|
58
|
+
leading,
|
|
59
|
+
trailing,
|
|
60
|
+
footer,
|
|
61
|
+
className,
|
|
62
|
+
children
|
|
63
|
+
} = props;
|
|
64
|
+
const ariaLabel = props["aria-label"];
|
|
65
|
+
const [value, setOpen] = useControllableOpen(open, defaultOpen, onOpenChange);
|
|
66
|
+
const close = React.useCallback(() => setOpen(false), [setOpen]);
|
|
67
|
+
const bodyRef = React.useRef(null);
|
|
68
|
+
const { maskImage } = useScrollFade(bodyRef, { axis: "vertical" });
|
|
69
|
+
const horizontal = isHorizontal(side);
|
|
70
|
+
const contained = container != null;
|
|
71
|
+
const anchor = contained ? "absolute" : "fixed";
|
|
72
|
+
return /* @__PURE__ */ jsxs(
|
|
73
|
+
Drawer$1.Root,
|
|
74
|
+
{
|
|
75
|
+
modal: contained ? "trap-focus" : true,
|
|
76
|
+
open: value,
|
|
77
|
+
swipeDirection: SIDE_SWIPE[side],
|
|
78
|
+
disablePointerDismissal: !dismissible,
|
|
79
|
+
onOpenChange: (nextOpen, details) => {
|
|
80
|
+
if (!dismissible && nextOpen === false && !EXPLICIT_CLOSE.has(details.reason)) {
|
|
81
|
+
details.cancel();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
setOpen(nextOpen);
|
|
85
|
+
},
|
|
86
|
+
children: [
|
|
87
|
+
trigger ? /* @__PURE__ */ jsx(Drawer$1.Trigger, { render: trigger }) : null,
|
|
88
|
+
/* @__PURE__ */ jsxs(Drawer$1.Portal, { keepMounted, container, children: [
|
|
89
|
+
/* @__PURE__ */ jsx(Drawer$1.Backdrop, { className: cn(anchor, "inset-0 z-50 bg-overlay", DRAWER_BACKDROP_MOTION) }),
|
|
90
|
+
/* @__PURE__ */ jsx(Drawer$1.Viewport, { className: cn("pointer-events-none z-50", anchor, "inset-0"), children: /* @__PURE__ */ jsx(
|
|
91
|
+
PanelChrome,
|
|
92
|
+
{
|
|
93
|
+
render: /* @__PURE__ */ jsx(Drawer$1.Popup, { "aria-label": ariaLabel }),
|
|
94
|
+
className: cn(
|
|
95
|
+
"pointer-events-auto absolute outline-none",
|
|
96
|
+
// Floating-surface edge: an alpha hairline (border-alt) on the ONE side
|
|
97
|
+
// facing the page (`SIDE_EDGE`) — the other three are flush to the viewport,
|
|
98
|
+
// so a ring there draws a stray rule along the screen edge. No radius, same reason.
|
|
99
|
+
"border-secondary_alt bg-primary shadow-xl",
|
|
100
|
+
"text-primary",
|
|
101
|
+
SIDE_POSITION[side],
|
|
102
|
+
SIDE_EDGE[side],
|
|
103
|
+
horizontal ? SIZE_INLINE[size] : SIZE_BLOCK[size],
|
|
104
|
+
DRAWER_POPUP_MOTION,
|
|
105
|
+
DRAWER_SLIDE[side],
|
|
106
|
+
className
|
|
107
|
+
),
|
|
108
|
+
padding: "md",
|
|
109
|
+
paddingMd: "lg",
|
|
110
|
+
titleScale: "lg",
|
|
111
|
+
footerAlign: "end",
|
|
112
|
+
scrollBody: true,
|
|
113
|
+
bodyRef,
|
|
114
|
+
bodyMask: maskImage,
|
|
115
|
+
dividers,
|
|
116
|
+
title,
|
|
117
|
+
description,
|
|
118
|
+
leading,
|
|
119
|
+
trailing,
|
|
120
|
+
footer: footer != null ? typeof footer === "function" ? footer(close) : footer : null,
|
|
121
|
+
renderTitle: (p) => /* @__PURE__ */ jsx(Drawer$1.Title, { ...p }),
|
|
122
|
+
renderDescription: (p) => /* @__PURE__ */ jsx(Drawer$1.Description, { ...p }),
|
|
123
|
+
closeSlot: showClose ? (cls) => /* @__PURE__ */ jsx(Drawer$1.Close, { render: /* @__PURE__ */ jsx(CloseButton, { size: "sm" }), className: cls }) : void 0,
|
|
124
|
+
children
|
|
125
|
+
}
|
|
126
|
+
) })
|
|
127
|
+
] })
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
Drawer.displayName = "Drawer";
|
|
133
|
+
|
|
134
|
+
export { Drawer };
|
|
135
|
+
//# sourceMappingURL=chunk-Z3ETJN5G.js.map
|
|
136
|
+
//# sourceMappingURL=chunk-Z3ETJN5G.js.map
|