@astra-kit/ui 0.0.0-stage → 0.0.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/CHANGELOG.md +15 -0
- package/LICENSE.md +21 -0
- package/README.md +384 -2
- package/THIRD_PARTY_NOTICES.md +31 -0
- package/assets/fonts/geist-LICENSE.txt +93 -0
- package/assets/fonts/geist-latin-variable.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-400.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-500.woff2 +0 -0
- package/assets/fonts/ibmplexmono-LICENSE.txt +93 -0
- package/assets/fonts/inter-LICENSE.txt +93 -0
- package/assets/fonts/inter-latin-variable.woff2 +0 -0
- package/dist/adapters/unpic-image.d.ts +3 -0
- package/dist/adapters/unpic-image.js +98 -0
- package/dist/components/account-menu.d.ts +67 -0
- package/dist/components/account-menu.js +440 -0
- package/dist/components/action-button.d.ts +25 -0
- package/dist/components/action-button.js +264 -0
- package/dist/components/alert.d.ts +31 -0
- package/dist/components/alert.js +503 -0
- package/dist/components/animated-collapse.d.ts +19 -0
- package/dist/components/animated-collapse.js +170 -0
- package/dist/components/animated-count.d.ts +13 -0
- package/dist/components/animated-count.js +105 -0
- package/dist/components/animated-list-item.d.ts +25 -0
- package/dist/components/animated-list-item.js +134 -0
- package/dist/components/animated-theme-toggler.d.ts +12 -0
- package/dist/components/animated-theme-toggler.js +200 -0
- package/dist/components/avatar.d.ts +65 -0
- package/dist/components/avatar.js +463 -0
- package/dist/components/badge.d.ts +21 -0
- package/dist/components/badge.js +297 -0
- package/dist/components/button-interaction.d.ts +23 -0
- package/dist/components/button-interaction.js +22 -0
- package/dist/components/button-label.d.ts +8 -0
- package/dist/components/button-label.js +203 -0
- package/dist/components/button.d.ts +23 -0
- package/dist/components/button.js +145 -0
- package/dist/components/calendar.d.ts +47 -0
- package/dist/components/calendar.js +155 -0
- package/dist/components/card.d.ts +38 -0
- package/dist/components/card.js +904 -0
- package/dist/components/carousel.d.ts +71 -0
- package/dist/components/carousel.js +585 -0
- package/dist/components/checkbox.d.ts +15 -0
- package/dist/components/checkbox.js +324 -0
- package/dist/components/control-button.d.ts +16 -0
- package/dist/components/control-button.js +215 -0
- package/dist/components/data-table.d.ts +118 -0
- package/dist/components/data-table.js +895 -0
- package/dist/components/dialog-surface.d.ts +49 -0
- package/dist/components/dialog-surface.js +220 -0
- package/dist/components/dialog.d.ts +92 -0
- package/dist/components/dialog.js +320 -0
- package/dist/components/dropdown-menu.d.ts +57 -0
- package/dist/components/dropdown-menu.js +107 -0
- package/dist/components/field.d.ts +53 -0
- package/dist/components/field.js +710 -0
- package/dist/components/file-upload.d.ts +88 -0
- package/dist/components/file-upload.js +776 -0
- package/dist/components/filter-presets-bar.d.ts +73 -0
- package/dist/components/filter-presets-bar.js +510 -0
- package/dist/components/filter-query-bar.d.ts +21 -0
- package/dist/components/filter-query-bar.js +881 -0
- package/dist/components/filter-query-grammar.d.ts +188 -0
- package/dist/components/filter-query-grammar.js +875 -0
- package/dist/components/form.d.ts +29 -0
- package/dist/components/form.js +330 -0
- package/dist/components/highlighter.d.ts +15 -0
- package/dist/components/highlighter.js +152 -0
- package/dist/components/hover-card.d.ts +50 -0
- package/dist/components/hover-card.js +80 -0
- package/dist/components/input-group.d.ts +16 -0
- package/dist/components/input-group.js +277 -0
- package/dist/components/input.d.ts +17 -0
- package/dist/components/input.js +120 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.js +43 -0
- package/dist/components/link.d.ts +9 -0
- package/dist/components/link.js +43 -0
- package/dist/components/morph-text.d.ts +14 -0
- package/dist/components/morph-text.js +210 -0
- package/dist/components/pagination.d.ts +59 -0
- package/dist/components/pagination.js +190 -0
- package/dist/components/popover.d.ts +17 -0
- package/dist/components/popover.js +40 -0
- package/dist/components/presence-swap.d.ts +22 -0
- package/dist/components/presence-swap.js +209 -0
- package/dist/components/primitives/alert-dialog.d.ts +68 -0
- package/dist/components/primitives/alert-dialog.js +629 -0
- package/dist/components/primitives/avatar.d.ts +46 -0
- package/dist/components/primitives/avatar.js +265 -0
- package/dist/components/primitives/calendar.d.ts +37 -0
- package/dist/components/primitives/calendar.js +1250 -0
- package/dist/components/primitives/carousel.d.ts +106 -0
- package/dist/components/primitives/carousel.js +928 -0
- package/dist/components/primitives/dialog.d.ts +62 -0
- package/dist/components/primitives/dialog.js +490 -0
- package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
- package/dist/components/primitives/dropdown-menu-items.js +265 -0
- package/dist/components/primitives/dropdown-menu.d.ts +64 -0
- package/dist/components/primitives/dropdown-menu.js +560 -0
- package/dist/components/primitives/hover-card.d.ts +50 -0
- package/dist/components/primitives/hover-card.js +507 -0
- package/dist/components/primitives/pagination.d.ts +65 -0
- package/dist/components/primitives/pagination.js +373 -0
- package/dist/components/primitives/popover.d.ts +22 -0
- package/dist/components/primitives/popover.js +213 -0
- package/dist/components/primitives/select.d.ts +37 -0
- package/dist/components/primitives/select.js +428 -0
- package/dist/components/primitives/tooltip.d.ts +30 -0
- package/dist/components/primitives/tooltip.js +277 -0
- package/dist/components/progress-ring.d.ts +20 -0
- package/dist/components/progress-ring.js +53 -0
- package/dist/components/radio-group.d.ts +34 -0
- package/dist/components/radio-group.js +392 -0
- package/dist/components/reaction-button.d.ts +30 -0
- package/dist/components/reaction-button.js +189 -0
- package/dist/components/rich-link-editor.d.ts +25 -0
- package/dist/components/rich-link-editor.js +320 -0
- package/dist/components/rich-markdown-content.d.ts +10 -0
- package/dist/components/rich-markdown-content.js +56 -0
- package/dist/components/rich-text-content.d.ts +19 -0
- package/dist/components/rich-text-content.js +26 -0
- package/dist/components/select.d.ts +55 -0
- package/dist/components/select.js +188 -0
- package/dist/components/separator.d.ts +3 -0
- package/dist/components/separator.js +48 -0
- package/dist/components/sheet.d.ts +19 -0
- package/dist/components/sheet.js +420 -0
- package/dist/components/sidebar-panel-context.d.ts +17 -0
- package/dist/components/sidebar-panel-context.js +14 -0
- package/dist/components/sidebar.d.ts +195 -0
- package/dist/components/sidebar.js +2041 -0
- package/dist/components/skeleton.d.ts +23 -0
- package/dist/components/skeleton.js +334 -0
- package/dist/components/split-button.d.ts +36 -0
- package/dist/components/split-button.js +306 -0
- package/dist/components/svgs/whatsappIcon.d.ts +3 -0
- package/dist/components/svgs/whatsappIcon.js +14 -0
- package/dist/components/switch.d.ts +13 -0
- package/dist/components/switch.js +444 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.js +298 -0
- package/dist/components/tabs.d.ts +36 -0
- package/dist/components/tabs.js +636 -0
- package/dist/components/textarea.d.ts +16 -0
- package/dist/components/textarea.js +111 -0
- package/dist/components/themed-toaster.d.ts +7 -0
- package/dist/components/themed-toaster.js +86 -0
- package/dist/components/toaster.d.ts +12 -0
- package/dist/components/toaster.js +62 -0
- package/dist/components/tooltip.d.ts +43 -0
- package/dist/components/tooltip.js +65 -0
- package/dist/components/typing-animation.d.ts +34 -0
- package/dist/components/typing-animation.js +389 -0
- package/dist/constants/action-button.d.ts +20 -0
- package/dist/constants/action-button.js +17 -0
- package/dist/constants/alert.d.ts +16 -0
- package/dist/constants/alert.js +13 -0
- package/dist/constants/avatar.d.ts +38 -0
- package/dist/constants/avatar.js +32 -0
- package/dist/constants/badge.d.ts +6 -0
- package/dist/constants/badge.js +6 -0
- package/dist/constants/button.d.ts +16 -0
- package/dist/constants/button.js +16 -0
- package/dist/constants/calendar.d.ts +36 -0
- package/dist/constants/calendar.js +34 -0
- package/dist/constants/card.d.ts +23 -0
- package/dist/constants/card.js +20 -0
- package/dist/constants/carousel.d.ts +55 -0
- package/dist/constants/carousel.js +74 -0
- package/dist/constants/checkbox.d.ts +17 -0
- package/dist/constants/checkbox.js +17 -0
- package/dist/constants/dialog.d.ts +11 -0
- package/dist/constants/dialog.js +10 -0
- package/dist/constants/dropdown-menu.d.ts +10 -0
- package/dist/constants/dropdown-menu.js +37 -0
- package/dist/constants/field.d.ts +24 -0
- package/dist/constants/field.js +24 -0
- package/dist/constants/hover-card.d.ts +37 -0
- package/dist/constants/hover-card.js +85 -0
- package/dist/constants/morph-text.d.ts +13 -0
- package/dist/constants/morph-text.js +13 -0
- package/dist/constants/motion.d.ts +12 -0
- package/dist/constants/motion.js +12 -0
- package/dist/constants/pagination.d.ts +20 -0
- package/dist/constants/pagination.js +20 -0
- package/dist/constants/popover.d.ts +7 -0
- package/dist/constants/popover.js +33 -0
- package/dist/constants/radio-group.d.ts +10 -0
- package/dist/constants/radio-group.js +10 -0
- package/dist/constants/select.d.ts +7 -0
- package/dist/constants/select.js +34 -0
- package/dist/constants/sidebar.d.ts +9 -0
- package/dist/constants/sidebar.js +17 -0
- package/dist/constants/skeleton.d.ts +17 -0
- package/dist/constants/skeleton.js +17 -0
- package/dist/constants/split-button.d.ts +7 -0
- package/dist/constants/split-button.js +5 -0
- package/dist/constants/switch.d.ts +33 -0
- package/dist/constants/switch.js +41 -0
- package/dist/constants/tabs.d.ts +17 -0
- package/dist/constants/tabs.js +17 -0
- package/dist/constants/toast.d.ts +3 -0
- package/dist/constants/toast.js +3 -0
- package/dist/constants/tooltip.d.ts +13 -0
- package/dist/constants/tooltip.js +52 -0
- package/dist/hooks/use-horizontal-swipe.d.ts +23 -0
- package/dist/hooks/use-horizontal-swipe.js +80 -0
- package/dist/hooks/use-is-hydrated.d.ts +6 -0
- package/dist/hooks/use-is-hydrated.js +20 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +19 -0
- package/dist/hooks/use-prefers-reduced-motion.d.ts +2 -0
- package/dist/hooks/use-prefers-reduced-motion.js +27 -0
- package/dist/hooks/use-rich-link-editor.d.ts +55 -0
- package/dist/hooks/use-rich-link-editor.js +515 -0
- package/dist/hooks/use-sidebar-persistence.d.ts +6 -0
- package/dist/hooks/use-sidebar-persistence.js +52 -0
- package/dist/hooks/use-today.d.ts +7 -0
- package/dist/hooks/use-today.js +50 -0
- package/dist/hooks/use-viewer-time-zone.d.ts +6 -0
- package/dist/hooks/use-viewer-time-zone.js +20 -0
- package/dist/hooks.d.ts +11 -0
- package/dist/hooks.js +11 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +69 -0
- package/dist/lib/browser-clipboard.d.ts +13 -0
- package/dist/lib/browser-clipboard.js +48 -0
- package/dist/lib/column-filter-value.d.ts +12 -0
- package/dist/lib/column-filter-value.js +52 -0
- package/dist/lib/file-acceptance.d.ts +43 -0
- package/dist/lib/file-acceptance.js +107 -0
- package/dist/lib/format-file-size.d.ts +16 -0
- package/dist/lib/format-file-size.js +34 -0
- package/dist/lib/fuzzy-search.d.ts +17 -0
- package/dist/lib/fuzzy-search.js +183 -0
- package/dist/lib/horizontal-swipe.d.ts +23 -0
- package/dist/lib/horizontal-swipe.js +29 -0
- package/dist/lib/image-dimensions.d.ts +2 -0
- package/dist/lib/image-dimensions.js +7 -0
- package/dist/lib/name-initials.d.ts +7 -0
- package/dist/lib/name-initials.js +11 -0
- package/dist/lib/rich-text/link-markdown-constants.d.ts +147 -0
- package/dist/lib/rich-text/link-markdown-constants.js +458 -0
- package/dist/lib/rich-text/link-markdown-types.d.ts +53 -0
- package/dist/lib/rich-text/link-markdown-types.js +1 -0
- package/dist/lib/rich-text/link-markdown.d.ts +193 -0
- package/dist/lib/rich-text/link-markdown.js +592 -0
- package/dist/lib/rich-text/rich-markdown.d.ts +41 -0
- package/dist/lib/rich-text/rich-markdown.js +105 -0
- package/dist/lib/rich-text/rich-text-editor-dom.d.ts +26 -0
- package/dist/lib/rich-text/rich-text-editor-dom.js +79 -0
- package/dist/lib/toast-layer.d.ts +24 -0
- package/dist/lib/toast-layer.js +76 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +2 -0
- package/dist/lib/year-month-filter.d.ts +16 -0
- package/dist/lib/year-month-filter.js +46 -0
- package/dist/motion/arc-floating-slot.d.ts +40 -0
- package/dist/motion/arc-floating-slot.js +177 -0
- package/dist/motion/arc-press.d.ts +6 -0
- package/dist/motion/arc-press.js +59 -0
- package/dist/motion/arc-swap.d.ts +22 -0
- package/dist/motion/arc-swap.js +49 -0
- package/dist/motion/arc-tokens.d.ts +53 -0
- package/dist/motion/arc-tokens.js +73 -0
- package/dist/motion/glide-indicator.d.ts +69 -0
- package/dist/motion/glide-indicator.js +309 -0
- package/dist/motion/glide-slot.d.ts +9 -0
- package/dist/motion/glide-slot.js +71 -0
- package/dist/motion/motion-slot.d.ts +12 -0
- package/dist/motion/motion-slot.js +376 -0
- package/dist/motion/overlay-warmth.d.ts +24 -0
- package/dist/motion/overlay-warmth.js +70 -0
- package/dist/motion/presence.d.ts +40 -0
- package/dist/motion/presence.js +101 -0
- package/dist/motion/surface-keyframes.d.ts +24 -0
- package/dist/motion/surface-keyframes.js +141 -0
- package/dist/motion/tokens.d.ts +81 -0
- package/dist/motion/tokens.js +67 -0
- package/dist/motion/use-attached-element.d.ts +7 -0
- package/dist/motion/use-attached-element.js +22 -0
- package/dist/motion/use-morph-width.d.ts +13 -0
- package/dist/motion/use-morph-width.js +59 -0
- package/dist/next.d.ts +14 -0
- package/dist/next.js +79 -0
- package/dist/providers/astra-ui-provider.d.ts +27 -0
- package/dist/providers/astra-ui-provider.js +100 -0
- package/dist/providers/native-provider.d.ts +4 -0
- package/dist/providers/native-provider.js +45 -0
- package/dist/sonner.d.ts +7 -0
- package/dist/sonner.js +8 -0
- package/dist/styles.css +2 -0
- package/dist/tanstack.d.ts +11 -0
- package/dist/tanstack.js +50 -0
- package/dist/theme.d.ts +3 -0
- package/dist/theme.js +1 -0
- package/dist/types/data-table.d.ts +27 -0
- package/dist/types/data-table.js +1 -0
- package/fonts.css +5 -0
- package/package.json +450 -4
- package/styles.css +4 -0
- package/theme.css +248 -0
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
import { ChevronDownIcon, LogInIcon, LogOutIcon, PlusIcon } from "lucide-react";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import { getNameInitials } from "../lib/name-initials.js";
|
|
6
|
+
import { AvatarBadge, AvatarFallback, AvatarImage, AvatarRoot } from "./primitives/avatar.js";
|
|
7
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "./primitives/dropdown-menu.js";
|
|
8
|
+
import { DropdownMenuItems } from "./primitives/dropdown-menu-items.js";
|
|
9
|
+
import { Link } from "./link.js";
|
|
10
|
+
import { useOptionalSidebarPanel } from "./sidebar-panel-context.js";
|
|
11
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "./primitives/tooltip.js";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
const ACCOUNT_MENU_DEFAULT_LABELS = {
|
|
14
|
+
signIn: "Iniciar sesión",
|
|
15
|
+
signOut: "Cerrar sesión",
|
|
16
|
+
trigger: "Menú de cuenta"
|
|
17
|
+
};
|
|
18
|
+
/** Shown when the name yields no initials, so the avatar never renders empty. */
|
|
19
|
+
const DEFAULT_AVATAR_FALLBACK = "?";
|
|
20
|
+
/**
|
|
21
|
+
* Renders the account avatar with an optional status badge.
|
|
22
|
+
* @param props - Identity, status and class names.
|
|
23
|
+
* @returns The avatar.
|
|
24
|
+
*/
|
|
25
|
+
function AccountAvatar(t0) {
|
|
26
|
+
const $ = _c(21);
|
|
27
|
+
const { name, image, fallback, status, showStatusBadge, isDecorative: t1, className, classNames } = t0;
|
|
28
|
+
const isDecorative = t1 === undefined ? false : t1;
|
|
29
|
+
const isAuthenticated = status === "authenticated";
|
|
30
|
+
const t2 = showStatusBadge && !isAuthenticated && "grayscale";
|
|
31
|
+
let t3;
|
|
32
|
+
if ($[0] !== className || $[1] !== t2) {
|
|
33
|
+
t3 = cn(t2, className);
|
|
34
|
+
$[0] = className;
|
|
35
|
+
$[1] = t2;
|
|
36
|
+
$[2] = t3;
|
|
37
|
+
} else {
|
|
38
|
+
t3 = $[2];
|
|
39
|
+
}
|
|
40
|
+
let t4;
|
|
41
|
+
if ($[3] !== image || $[4] !== isDecorative || $[5] !== name) {
|
|
42
|
+
t4 = image ? /* @__PURE__ */ _jsx(AvatarImage, {
|
|
43
|
+
alt: isDecorative ? "" : name,
|
|
44
|
+
loading: "eager",
|
|
45
|
+
src: image
|
|
46
|
+
}) : null;
|
|
47
|
+
$[3] = image;
|
|
48
|
+
$[4] = isDecorative;
|
|
49
|
+
$[5] = name;
|
|
50
|
+
$[6] = t4;
|
|
51
|
+
} else {
|
|
52
|
+
t4 = $[6];
|
|
53
|
+
}
|
|
54
|
+
const t5 = isDecorative || undefined;
|
|
55
|
+
let t6;
|
|
56
|
+
if ($[7] !== fallback || $[8] !== t5) {
|
|
57
|
+
t6 = /* @__PURE__ */ _jsx(AvatarFallback, {
|
|
58
|
+
"aria-hidden": t5,
|
|
59
|
+
children: fallback
|
|
60
|
+
});
|
|
61
|
+
$[7] = fallback;
|
|
62
|
+
$[8] = t5;
|
|
63
|
+
$[9] = t6;
|
|
64
|
+
} else {
|
|
65
|
+
t6 = $[9];
|
|
66
|
+
}
|
|
67
|
+
let t7;
|
|
68
|
+
if ($[10] !== classNames?.connectedBadge || $[11] !== classNames?.disconnectedBadge || $[12] !== isAuthenticated || $[13] !== showStatusBadge || $[14] !== status) {
|
|
69
|
+
t7 = showStatusBadge ? /* @__PURE__ */ _jsx(AvatarBadge, {
|
|
70
|
+
"data-status": status,
|
|
71
|
+
className: cn(isAuthenticated ? "bg-green-600 dark:bg-green-800" : undefined, isAuthenticated ? classNames?.connectedBadge : classNames?.disconnectedBadge),
|
|
72
|
+
children: isAuthenticated ? null : /* @__PURE__ */ _jsx(PlusIcon, { "aria-hidden": "true" })
|
|
73
|
+
}) : null;
|
|
74
|
+
$[10] = classNames?.connectedBadge;
|
|
75
|
+
$[11] = classNames?.disconnectedBadge;
|
|
76
|
+
$[12] = isAuthenticated;
|
|
77
|
+
$[13] = showStatusBadge;
|
|
78
|
+
$[14] = status;
|
|
79
|
+
$[15] = t7;
|
|
80
|
+
} else {
|
|
81
|
+
t7 = $[15];
|
|
82
|
+
}
|
|
83
|
+
let t8;
|
|
84
|
+
if ($[16] !== t3 || $[17] !== t4 || $[18] !== t6 || $[19] !== t7) {
|
|
85
|
+
t8 = /* @__PURE__ */ _jsxs(AvatarRoot, {
|
|
86
|
+
className: t3,
|
|
87
|
+
children: [
|
|
88
|
+
t4,
|
|
89
|
+
t6,
|
|
90
|
+
t7
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
$[16] = t3;
|
|
94
|
+
$[17] = t4;
|
|
95
|
+
$[18] = t6;
|
|
96
|
+
$[19] = t7;
|
|
97
|
+
$[20] = t8;
|
|
98
|
+
} else {
|
|
99
|
+
t8 = $[20];
|
|
100
|
+
}
|
|
101
|
+
return t8;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Presentational account menu: the session and its side effects stay with the caller. Signed in,
|
|
105
|
+
* the menu offers sign-out; signed out, it offers sign-in as a link (`signInHref`) or a callback.
|
|
106
|
+
* @param props - Identity, session status, callbacks, copy and layout.
|
|
107
|
+
* @returns The trigger and its menu.
|
|
108
|
+
*/
|
|
109
|
+
export function AccountMenu(t0) {
|
|
110
|
+
const $ = _c(82);
|
|
111
|
+
const { name, email, status, image: t1, avatarFallback, onSignOut, signOutDisabled: t2, onSignIn, signInHref, triggerVariant: t3, showStatusBadge: t4, tooltipLabel, labels, classNames, align: t5, side: t6, sideOffset: t7, items } = t0;
|
|
112
|
+
const image = t1 === undefined ? null : t1;
|
|
113
|
+
const signOutDisabled = t2 === undefined ? false : t2;
|
|
114
|
+
const triggerVariant = t3 === undefined ? "avatar" : t3;
|
|
115
|
+
const showStatusBadge = t4 === undefined ? false : t4;
|
|
116
|
+
const align = t5 === undefined ? "end" : t5;
|
|
117
|
+
const side = t6 === undefined ? "bottom" : t6;
|
|
118
|
+
const sideOffset = t7 === undefined ? 4 : t7;
|
|
119
|
+
let t8;
|
|
120
|
+
if ($[0] !== labels) {
|
|
121
|
+
t8 = {
|
|
122
|
+
...ACCOUNT_MENU_DEFAULT_LABELS,
|
|
123
|
+
...labels
|
|
124
|
+
};
|
|
125
|
+
$[0] = labels;
|
|
126
|
+
$[1] = t8;
|
|
127
|
+
} else {
|
|
128
|
+
t8 = $[1];
|
|
129
|
+
}
|
|
130
|
+
const resolvedLabels = t8;
|
|
131
|
+
const isAuthenticated = status === "authenticated";
|
|
132
|
+
let t9;
|
|
133
|
+
if ($[2] !== avatarFallback || $[3] !== name) {
|
|
134
|
+
t9 = avatarFallback ?? (getNameInitials(name) || DEFAULT_AVATAR_FALLBACK);
|
|
135
|
+
$[2] = avatarFallback;
|
|
136
|
+
$[3] = name;
|
|
137
|
+
$[4] = t9;
|
|
138
|
+
} else {
|
|
139
|
+
t9 = $[4];
|
|
140
|
+
}
|
|
141
|
+
const fallback = t9;
|
|
142
|
+
let t10;
|
|
143
|
+
if ($[5] !== classNames || $[6] !== fallback || $[7] !== image || $[8] !== name || $[9] !== showStatusBadge || $[10] !== status) {
|
|
144
|
+
t10 = {
|
|
145
|
+
name,
|
|
146
|
+
image,
|
|
147
|
+
fallback,
|
|
148
|
+
status,
|
|
149
|
+
showStatusBadge,
|
|
150
|
+
classNames
|
|
151
|
+
};
|
|
152
|
+
$[5] = classNames;
|
|
153
|
+
$[6] = fallback;
|
|
154
|
+
$[7] = image;
|
|
155
|
+
$[8] = name;
|
|
156
|
+
$[9] = showStatusBadge;
|
|
157
|
+
$[10] = status;
|
|
158
|
+
$[11] = t10;
|
|
159
|
+
} else {
|
|
160
|
+
t10 = $[11];
|
|
161
|
+
}
|
|
162
|
+
const avatarProps = t10;
|
|
163
|
+
const sidebarPanel = useOptionalSidebarPanel();
|
|
164
|
+
const showsSidebarIdentity = triggerVariant === "sidebar" && !sidebarPanel?.collapsed;
|
|
165
|
+
const t11 = resolvedLabels.trigger;
|
|
166
|
+
const t12 = triggerVariant === "sidebar" && "w-full min-w-0 gap-2.5 rounded-lg p-1.5 text-left";
|
|
167
|
+
const t13 = triggerVariant === "sidebar" && !showsSidebarIdentity && "justify-center gap-0";
|
|
168
|
+
const t14 = classNames?.trigger;
|
|
169
|
+
let t15;
|
|
170
|
+
if ($[12] !== t12 || $[13] !== t13 || $[14] !== t14) {
|
|
171
|
+
t15 = cn("inline-flex items-center rounded-full outline-none [-webkit-tap-highlight-color:transparent] transition-[box-shadow,opacity] hover:opacity-90 focus-visible:shadow-[0_0_0_2px_var(--background),0_0_0_4px_var(--ring)] data-[state=open]:shadow-[0_0_0_2px_var(--background),0_0_0_4px_var(--ring)]", t12, t13, t14);
|
|
172
|
+
$[12] = t12;
|
|
173
|
+
$[13] = t13;
|
|
174
|
+
$[14] = t14;
|
|
175
|
+
$[15] = t15;
|
|
176
|
+
} else {
|
|
177
|
+
t15 = $[15];
|
|
178
|
+
}
|
|
179
|
+
const t16 = classNames?.triggerAvatar;
|
|
180
|
+
let t17;
|
|
181
|
+
if ($[16] !== avatarProps || $[17] !== t16) {
|
|
182
|
+
t17 = /* @__PURE__ */ _jsx(AccountAvatar, {
|
|
183
|
+
...avatarProps,
|
|
184
|
+
className: t16
|
|
185
|
+
});
|
|
186
|
+
$[16] = avatarProps;
|
|
187
|
+
$[17] = t16;
|
|
188
|
+
$[18] = t17;
|
|
189
|
+
} else {
|
|
190
|
+
t17 = $[18];
|
|
191
|
+
}
|
|
192
|
+
let t18;
|
|
193
|
+
if ($[19] !== classNames?.triggerChevron || $[20] !== classNames?.triggerEmail || $[21] !== classNames?.triggerName || $[22] !== classNames?.triggerText || $[23] !== email || $[24] !== name || $[25] !== showsSidebarIdentity) {
|
|
194
|
+
t18 = showsSidebarIdentity ? /* @__PURE__ */ _jsxs(_Fragment, { children: [/* @__PURE__ */ _jsxs("span", {
|
|
195
|
+
className: cn("grid min-w-0 flex-1", classNames?.triggerText),
|
|
196
|
+
children: [/* @__PURE__ */ _jsx("span", {
|
|
197
|
+
className: cn("truncate text-sm font-medium", classNames?.triggerName),
|
|
198
|
+
children: name
|
|
199
|
+
}), /* @__PURE__ */ _jsx("span", {
|
|
200
|
+
className: cn("truncate text-xs text-muted-foreground", classNames?.triggerEmail),
|
|
201
|
+
children: email
|
|
202
|
+
})]
|
|
203
|
+
}), /* @__PURE__ */ _jsx(ChevronDownIcon, {
|
|
204
|
+
"aria-hidden": "true",
|
|
205
|
+
className: cn("size-4 shrink-0 text-muted-foreground", classNames?.triggerChevron)
|
|
206
|
+
})] }) : null;
|
|
207
|
+
$[19] = classNames?.triggerChevron;
|
|
208
|
+
$[20] = classNames?.triggerEmail;
|
|
209
|
+
$[21] = classNames?.triggerName;
|
|
210
|
+
$[22] = classNames?.triggerText;
|
|
211
|
+
$[23] = email;
|
|
212
|
+
$[24] = name;
|
|
213
|
+
$[25] = showsSidebarIdentity;
|
|
214
|
+
$[26] = t18;
|
|
215
|
+
} else {
|
|
216
|
+
t18 = $[26];
|
|
217
|
+
}
|
|
218
|
+
let t19;
|
|
219
|
+
if ($[27] !== resolvedLabels.trigger || $[28] !== t15 || $[29] !== t17 || $[30] !== t18 || $[31] !== triggerVariant) {
|
|
220
|
+
const triggerButton = /* @__PURE__ */ _jsxs("button", {
|
|
221
|
+
"data-slot": "account-menu-trigger",
|
|
222
|
+
"data-variant": triggerVariant,
|
|
223
|
+
"aria-label": t11,
|
|
224
|
+
type: "button",
|
|
225
|
+
className: t15,
|
|
226
|
+
children: [t17, t18]
|
|
227
|
+
});
|
|
228
|
+
t19 = /* @__PURE__ */ _jsx(DropdownMenuTrigger, {
|
|
229
|
+
asChild: true,
|
|
230
|
+
children: triggerButton
|
|
231
|
+
});
|
|
232
|
+
$[27] = resolvedLabels.trigger;
|
|
233
|
+
$[28] = t15;
|
|
234
|
+
$[29] = t17;
|
|
235
|
+
$[30] = t18;
|
|
236
|
+
$[31] = triggerVariant;
|
|
237
|
+
$[32] = t19;
|
|
238
|
+
} else {
|
|
239
|
+
t19 = $[32];
|
|
240
|
+
}
|
|
241
|
+
const trigger = t19;
|
|
242
|
+
let t20;
|
|
243
|
+
if ($[33] !== tooltipLabel || $[34] !== trigger) {
|
|
244
|
+
t20 = tooltipLabel ? /* @__PURE__ */ _jsx(TooltipTrigger, {
|
|
245
|
+
asChild: true,
|
|
246
|
+
children: trigger
|
|
247
|
+
}) : trigger;
|
|
248
|
+
$[33] = tooltipLabel;
|
|
249
|
+
$[34] = trigger;
|
|
250
|
+
$[35] = t20;
|
|
251
|
+
} else {
|
|
252
|
+
t20 = $[35];
|
|
253
|
+
}
|
|
254
|
+
const t21 = classNames?.content;
|
|
255
|
+
let t22;
|
|
256
|
+
if ($[36] !== t21) {
|
|
257
|
+
t22 = cn("min-w-56", t21);
|
|
258
|
+
$[36] = t21;
|
|
259
|
+
$[37] = t22;
|
|
260
|
+
} else {
|
|
261
|
+
t22 = $[37];
|
|
262
|
+
}
|
|
263
|
+
const t23 = classNames?.header;
|
|
264
|
+
let t24;
|
|
265
|
+
if ($[38] !== t23) {
|
|
266
|
+
t24 = cn("grid grid-cols-[auto_minmax(0,1fr)] items-center gap-2.5 px-2 py-1.5", t23);
|
|
267
|
+
$[38] = t23;
|
|
268
|
+
$[39] = t24;
|
|
269
|
+
} else {
|
|
270
|
+
t24 = $[39];
|
|
271
|
+
}
|
|
272
|
+
const t25 = classNames?.headerAvatar;
|
|
273
|
+
let t26;
|
|
274
|
+
if ($[40] !== avatarProps || $[41] !== t25) {
|
|
275
|
+
t26 = /* @__PURE__ */ _jsx(AccountAvatar, {
|
|
276
|
+
...avatarProps,
|
|
277
|
+
isDecorative: true,
|
|
278
|
+
className: t25
|
|
279
|
+
});
|
|
280
|
+
$[40] = avatarProps;
|
|
281
|
+
$[41] = t25;
|
|
282
|
+
$[42] = t26;
|
|
283
|
+
} else {
|
|
284
|
+
t26 = $[42];
|
|
285
|
+
}
|
|
286
|
+
let t27;
|
|
287
|
+
if ($[43] !== name) {
|
|
288
|
+
t27 = /* @__PURE__ */ _jsx("span", {
|
|
289
|
+
className: "truncate text-sm leading-tight font-medium",
|
|
290
|
+
children: name
|
|
291
|
+
});
|
|
292
|
+
$[43] = name;
|
|
293
|
+
$[44] = t27;
|
|
294
|
+
} else {
|
|
295
|
+
t27 = $[44];
|
|
296
|
+
}
|
|
297
|
+
let t28;
|
|
298
|
+
if ($[45] !== email) {
|
|
299
|
+
t28 = /* @__PURE__ */ _jsx("span", {
|
|
300
|
+
className: "truncate text-xs leading-tight text-muted-foreground",
|
|
301
|
+
children: email
|
|
302
|
+
});
|
|
303
|
+
$[45] = email;
|
|
304
|
+
$[46] = t28;
|
|
305
|
+
} else {
|
|
306
|
+
t28 = $[46];
|
|
307
|
+
}
|
|
308
|
+
let t29;
|
|
309
|
+
if ($[47] !== t27 || $[48] !== t28) {
|
|
310
|
+
t29 = /* @__PURE__ */ _jsxs("span", {
|
|
311
|
+
className: "grid min-w-0 gap-px",
|
|
312
|
+
children: [t27, t28]
|
|
313
|
+
});
|
|
314
|
+
$[47] = t27;
|
|
315
|
+
$[48] = t28;
|
|
316
|
+
$[49] = t29;
|
|
317
|
+
} else {
|
|
318
|
+
t29 = $[49];
|
|
319
|
+
}
|
|
320
|
+
let t30;
|
|
321
|
+
if ($[50] !== t24 || $[51] !== t26 || $[52] !== t29) {
|
|
322
|
+
t30 = /* @__PURE__ */ _jsxs("div", {
|
|
323
|
+
className: t24,
|
|
324
|
+
children: [t26, t29]
|
|
325
|
+
});
|
|
326
|
+
$[50] = t24;
|
|
327
|
+
$[51] = t26;
|
|
328
|
+
$[52] = t29;
|
|
329
|
+
$[53] = t30;
|
|
330
|
+
} else {
|
|
331
|
+
t30 = $[53];
|
|
332
|
+
}
|
|
333
|
+
let t31;
|
|
334
|
+
if ($[54] === Symbol.for("react.memo_cache_sentinel")) {
|
|
335
|
+
t31 = /* @__PURE__ */ _jsx(DropdownMenuSeparator, {});
|
|
336
|
+
$[54] = t31;
|
|
337
|
+
} else {
|
|
338
|
+
t31 = $[54];
|
|
339
|
+
}
|
|
340
|
+
let t32;
|
|
341
|
+
if ($[55] !== items) {
|
|
342
|
+
t32 = items ? /* @__PURE__ */ _jsx(DropdownMenuItems, { items }) : null;
|
|
343
|
+
$[55] = items;
|
|
344
|
+
$[56] = t32;
|
|
345
|
+
} else {
|
|
346
|
+
t32 = $[56];
|
|
347
|
+
}
|
|
348
|
+
let t33;
|
|
349
|
+
if ($[57] !== classNames?.item || $[58] !== isAuthenticated || $[59] !== onSignIn || $[60] !== onSignOut || $[61] !== resolvedLabels.signIn || $[62] !== resolvedLabels.signOut || $[63] !== signInHref || $[64] !== signOutDisabled) {
|
|
350
|
+
t33 = isAuthenticated ? /* @__PURE__ */ _jsxs(DropdownMenuItem, {
|
|
351
|
+
className: classNames?.item,
|
|
352
|
+
disabled: signOutDisabled,
|
|
353
|
+
onSelect: () => void onSignOut(),
|
|
354
|
+
children: [/* @__PURE__ */ _jsx(LogOutIcon, { "aria-hidden": "true" }), resolvedLabels.signOut]
|
|
355
|
+
}) : signInHref ? /* @__PURE__ */ _jsx(DropdownMenuItem, {
|
|
356
|
+
asChild: true,
|
|
357
|
+
className: classNames?.item,
|
|
358
|
+
children: /* @__PURE__ */ _jsxs(Link, {
|
|
359
|
+
href: signInHref,
|
|
360
|
+
children: [/* @__PURE__ */ _jsx(LogInIcon, { "aria-hidden": "true" }), resolvedLabels.signIn]
|
|
361
|
+
})
|
|
362
|
+
}) : /* @__PURE__ */ _jsxs(DropdownMenuItem, {
|
|
363
|
+
className: classNames?.item,
|
|
364
|
+
onSelect: () => onSignIn?.(),
|
|
365
|
+
children: [/* @__PURE__ */ _jsx(LogInIcon, { "aria-hidden": "true" }), resolvedLabels.signIn]
|
|
366
|
+
});
|
|
367
|
+
$[57] = classNames?.item;
|
|
368
|
+
$[58] = isAuthenticated;
|
|
369
|
+
$[59] = onSignIn;
|
|
370
|
+
$[60] = onSignOut;
|
|
371
|
+
$[61] = resolvedLabels.signIn;
|
|
372
|
+
$[62] = resolvedLabels.signOut;
|
|
373
|
+
$[63] = signInHref;
|
|
374
|
+
$[64] = signOutDisabled;
|
|
375
|
+
$[65] = t33;
|
|
376
|
+
} else {
|
|
377
|
+
t33 = $[65];
|
|
378
|
+
}
|
|
379
|
+
let t34;
|
|
380
|
+
if ($[66] !== align || $[67] !== side || $[68] !== sideOffset || $[69] !== t22 || $[70] !== t30 || $[71] !== t32 || $[72] !== t33) {
|
|
381
|
+
t34 = /* @__PURE__ */ _jsxs(DropdownMenuContent, {
|
|
382
|
+
"data-slot": "account-menu-content",
|
|
383
|
+
align,
|
|
384
|
+
side,
|
|
385
|
+
sideOffset,
|
|
386
|
+
className: t22,
|
|
387
|
+
children: [
|
|
388
|
+
t30,
|
|
389
|
+
t31,
|
|
390
|
+
t32,
|
|
391
|
+
t33
|
|
392
|
+
]
|
|
393
|
+
});
|
|
394
|
+
$[66] = align;
|
|
395
|
+
$[67] = side;
|
|
396
|
+
$[68] = sideOffset;
|
|
397
|
+
$[69] = t22;
|
|
398
|
+
$[70] = t30;
|
|
399
|
+
$[71] = t32;
|
|
400
|
+
$[72] = t33;
|
|
401
|
+
$[73] = t34;
|
|
402
|
+
} else {
|
|
403
|
+
t34 = $[73];
|
|
404
|
+
}
|
|
405
|
+
let t35;
|
|
406
|
+
if ($[74] !== t20 || $[75] !== t34) {
|
|
407
|
+
t35 = /* @__PURE__ */ _jsxs(DropdownMenu, { children: [t20, t34] });
|
|
408
|
+
$[74] = t20;
|
|
409
|
+
$[75] = t34;
|
|
410
|
+
$[76] = t35;
|
|
411
|
+
} else {
|
|
412
|
+
t35 = $[76];
|
|
413
|
+
}
|
|
414
|
+
const menu = t35;
|
|
415
|
+
if (!tooltipLabel) {
|
|
416
|
+
return menu;
|
|
417
|
+
}
|
|
418
|
+
let t36;
|
|
419
|
+
if ($[77] !== tooltipLabel) {
|
|
420
|
+
t36 = /* @__PURE__ */ _jsx(TooltipContent, {
|
|
421
|
+
side: "bottom",
|
|
422
|
+
sideOffset: 8,
|
|
423
|
+
children: tooltipLabel
|
|
424
|
+
});
|
|
425
|
+
$[77] = tooltipLabel;
|
|
426
|
+
$[78] = t36;
|
|
427
|
+
} else {
|
|
428
|
+
t36 = $[78];
|
|
429
|
+
}
|
|
430
|
+
let t37;
|
|
431
|
+
if ($[79] !== menu || $[80] !== t36) {
|
|
432
|
+
t37 = /* @__PURE__ */ _jsxs(Tooltip, { children: [menu, t36] });
|
|
433
|
+
$[79] = menu;
|
|
434
|
+
$[80] = t36;
|
|
435
|
+
$[81] = t37;
|
|
436
|
+
} else {
|
|
437
|
+
t37 = $[81];
|
|
438
|
+
}
|
|
439
|
+
return t37;
|
|
440
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ButtonProps } from "./button.js";
|
|
2
|
+
export type ActionButtonProps = Omit<ButtonProps, "children" | "loading" | "onClick"> & {
|
|
3
|
+
/** Idle label and the button's accessible name. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Runs on press; the pending state lasts until its promise settles. */
|
|
6
|
+
onAction: () => void | Promise<void>;
|
|
7
|
+
/** Label while `onAction` runs. */
|
|
8
|
+
pendingLabel?: string;
|
|
9
|
+
/** Label after `onAction` resolves. */
|
|
10
|
+
successLabel?: string;
|
|
11
|
+
/** Delay before returning to idle after success; `0` keeps the success state. */
|
|
12
|
+
resetAfterMs?: number;
|
|
13
|
+
/** Called when `onAction` rejects; the button returns to idle. Without it, the error is logged to the console. */
|
|
14
|
+
onActionError?: (error: unknown) => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A single async commit, such as Save, Publish or Submit, whose result shows on the button itself. While the
|
|
18
|
+
* action runs the button stays focusable (`aria-disabled` and `aria-busy` instead of `disabled`) and ignores new
|
|
19
|
+
* presses; a polite status region announces the pending and success labels. For a plain form submit without a
|
|
20
|
+
* success state, use `Button` with `loading`.
|
|
21
|
+
* @param props - Labels, the action, its error handler, the reset delay and `Button` props except `onClick`.
|
|
22
|
+
* @returns The button followed by its visually hidden status region.
|
|
23
|
+
*/
|
|
24
|
+
declare function ActionButton({ label, onAction, pendingLabel, successLabel, resetAfterMs, onActionError, ...props }: ActionButtonProps): import("react").JSX.Element;
|
|
25
|
+
export { ActionButton };
|