@vetta-org/theme-ui 0.1.2 → 0.2.1

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.
Files changed (111) hide show
  1. package/package.json +8 -16
  2. package/src/action-approval/StorageCleanListView.test.tsx +36 -0
  3. package/src/action-approval/StorageCleanListView.tsx +52 -0
  4. package/src/action-approval/index.ts +2 -0
  5. package/src/activity/ActivityPanel.tsx +7 -1
  6. package/src/activity/ActivityPanelFrame.tsx +1 -1
  7. package/src/activity/BackgroundTasksTabPanelView.tsx +18 -2
  8. package/src/activity/BrowserPanelView.tsx +15 -1
  9. package/src/activity/BrowserSelectionView.tsx +199 -0
  10. package/src/activity/CodePreview.tsx +15 -1
  11. package/src/activity/MarkdownPreviewView.test.tsx +53 -0
  12. package/src/activity/MarkdownPreviewView.tsx +86 -10
  13. package/src/activity/index.ts +1 -0
  14. package/src/chat/ContextRingView.test.tsx +81 -0
  15. package/src/chat/ContextRingView.tsx +78 -62
  16. package/src/chat/EditDiffView.tsx +4 -4
  17. package/src/chat/HeaderActionBarView.tsx +135 -48
  18. package/src/chat/HeaderActionOverflowMenu.tsx +11 -20
  19. package/src/chat/MessageFeedLayoutView.tsx +6 -5
  20. package/src/chat/MessageInputView.tsx +5 -1
  21. package/src/chat/index.ts +2 -1
  22. package/src/chat/message-feed-fade.css +80 -0
  23. package/src/chat/message-feed-fade.test.tsx +75 -0
  24. package/src/chat/streaming-reveal.test.ts +1 -74
  25. package/src/chat/streaming-reveal.ts +0 -3
  26. package/src/file-preview/FilePreviewDialogView.tsx +2 -1
  27. package/src/file-preview/ReadonlyCodeView.tsx +46 -0
  28. package/src/file-preview/syntax-tokens.css +1 -1
  29. package/src/image-assets.d.ts +4 -0
  30. package/src/layout/ResizeHandle.tsx +4 -1
  31. package/src/layout/resize-handle-reset.test.tsx +50 -0
  32. package/src/markdown/FileLinkBadge.tsx +77 -0
  33. package/src/markdown/MarkdownContent.tsx +61 -31
  34. package/src/markdown/MarkdownImage.tsx +6 -16
  35. package/src/markdown/MermaidBlock.tsx +50 -11
  36. package/src/markdown/UrlLinkBadge.tsx +84 -0
  37. package/src/markdown/image-actions.ts +29 -0
  38. package/src/markdown/index.ts +2 -0
  39. package/src/markdown/nodes.ts +6 -1
  40. package/src/markdown/preview-policy.test.ts +31 -0
  41. package/src/markdown/preview-policy.ts +33 -0
  42. package/src/markdown/progressive-chunks.test.ts +43 -0
  43. package/src/markdown/progressive-chunks.ts +58 -0
  44. package/src/markdown/rich-labels.ts +9 -0
  45. package/src/markdown/streaming-fade.test.ts +83 -0
  46. package/src/markdown/streaming-fade.tsx +141 -0
  47. package/src/markdown/streaming-reveal.ts +0 -67
  48. package/src/markdown/streaming.ts +64 -131
  49. package/src/overlays/CommandMenuRow.tsx +47 -26
  50. package/src/overlays/CommandMenuView.tsx +107 -15
  51. package/src/overlays/DiagnosticsExportDialogView.tsx +236 -0
  52. package/src/overlays/MagpieHandoverDialogView.tsx +217 -0
  53. package/src/overlays/ReleaseNoteImage.test.tsx +105 -0
  54. package/src/overlays/ReleaseNoteMarkdown.test.tsx +49 -0
  55. package/src/overlays/ReleaseNoteMarkdown.tsx +120 -7
  56. package/src/overlays/SplashPanel.tsx +4 -4
  57. package/src/overlays/SplashParts.tsx +6 -2
  58. package/src/overlays/UpdateCheckerView.tsx +17 -15
  59. package/src/overlays/UpdateRestartDialogView.tsx +76 -2
  60. package/src/overlays/assets/diagnostics-banner.webp +0 -0
  61. package/src/overlays/command-menu-types.ts +15 -1
  62. package/src/overlays/index.ts +13 -0
  63. package/src/plugin-ui/index.ts +4 -0
  64. package/src/project/DefaultConversationSectionView.tsx +17 -22
  65. package/src/project/DefaultSessionRowView.tsx +8 -0
  66. package/src/project/ManageSessionsSplashView.tsx +0 -2
  67. package/src/settings/ArchivedProjectsSettingsView.tsx +122 -1
  68. package/src/settings/GeneralSettingsView.tsx +21 -5
  69. package/src/settings/LauncherSettingsView.test.tsx +95 -0
  70. package/src/settings/LauncherSettingsView.tsx +272 -0
  71. package/src/settings/PetActionGalleryView.test.tsx +163 -0
  72. package/src/settings/PetActionGalleryView.tsx +216 -0
  73. package/src/settings/PetSettingsView.test.tsx +117 -0
  74. package/src/settings/PetSettingsView.tsx +86 -22
  75. package/src/settings/PresetProviderRowView.tsx +37 -98
  76. package/src/settings/ShortcutsSettingsView.tsx +0 -4
  77. package/src/settings/SpaceEditorDialogView.tsx +94 -56
  78. package/src/settings/SpacesSettingsView.tsx +53 -8
  79. package/src/settings/StorageBar.tsx +70 -0
  80. package/src/settings/StorageExplorer.tsx +488 -0
  81. package/src/settings/StorageReadout.tsx +64 -0
  82. package/src/settings/StorageSettingsView.test.tsx +181 -0
  83. package/src/settings/StorageSettingsView.tsx +458 -0
  84. package/src/settings/assets/space-editor-illustration.webp +0 -0
  85. package/src/settings/index.ts +28 -39
  86. package/src/settings/storage-treemap-layout.test.ts +32 -0
  87. package/src/settings/storage-treemap-layout.ts +55 -0
  88. package/src/shared/SegmentedControl.test.tsx +68 -0
  89. package/src/shared/SegmentedControl.tsx +18 -11
  90. package/src/shared/StageDialogContent.test.tsx +61 -0
  91. package/src/shared/StageDialogContent.tsx +80 -0
  92. package/src/shared/TabBar.tsx +2 -2
  93. package/src/shared/VettaKbd.tsx +20 -1
  94. package/src/shared/index.ts +4 -1
  95. package/src/shared/platform.ts +9 -0
  96. package/src/sidebar/AddProjectMenuTriggerView.tsx +13 -12
  97. package/src/sidebar/SettingsMenuTriggerView.tsx +2 -1
  98. package/src/sidebar/SidebarSectionActionButton.test.tsx +91 -0
  99. package/src/sidebar/SidebarSectionActionButton.tsx +52 -0
  100. package/src/styles.css +7 -0
  101. package/src/markdown/streaming.test.ts +0 -57
  102. package/src/settings/AchievementNavigationButtonView.tsx +0 -90
  103. package/src/settings/AchievementPromotionDialogView.tsx +0 -91
  104. package/src/settings/AchievementSettingsView.tsx +0 -43
  105. package/src/settings/PetBubbleStylePreviewView.tsx +0 -44
  106. package/src/settings/QuickPanelSettingsSectionView.tsx +0 -64
  107. package/src/settings/achievements/AchievementCurtains.tsx +0 -50
  108. package/src/settings/achievements/AchievementPromotionBadge3D.tsx +0 -350
  109. package/src/settings/achievements/AchievementPromotionConfetti.tsx +0 -71
  110. package/src/settings/achievements/AchievementTitle.tsx +0 -52
  111. package/src/settings/achievements/index.ts +0 -13
@@ -0,0 +1,91 @@
1
+ // @vitest-environment jsdom
2
+
3
+ import { act, createRef, type JSX } from "react";
4
+ import { createRoot, type Root } from "react-dom/client";
5
+ import { afterEach, describe, expect, it } from "vitest";
6
+ import { SidebarSectionActionButton } from "./SidebarSectionActionButton";
7
+
8
+ Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
9
+
10
+ const mounted: Array<{ root: Root; container: HTMLDivElement }> = [];
11
+
12
+ afterEach(() => {
13
+ for (const { root, container } of mounted.splice(0)) {
14
+ act(() => root.unmount());
15
+ container.remove();
16
+ }
17
+ });
18
+
19
+ function mount(element: JSX.Element): HTMLButtonElement {
20
+ const container = document.createElement("div");
21
+ document.body.append(container);
22
+ const root = createRoot(container);
23
+ mounted.push({ root, container });
24
+ act(() => root.render(element));
25
+ return container.querySelector("button") as HTMLButtonElement;
26
+ }
27
+
28
+ describe("SidebarSectionActionButton", () => {
29
+ it("is a named, non-submitting button that forwards its ref and host attributes", () => {
30
+ const ref = createRef<HTMLButtonElement>();
31
+ const button = mount(
32
+ <SidebarSectionActionButton
33
+ ref={ref}
34
+ aria-haspopup="menu"
35
+ className="shrink-0"
36
+ iconClassName="icon-[solar--menu-dots-bold]"
37
+ label="View options"
38
+ />,
39
+ );
40
+
41
+ expect(ref.current).toBe(button);
42
+ expect(button.type).toBe("button");
43
+ expect(button.getAttribute("aria-label")).toBe("View options");
44
+ expect(button.getAttribute("aria-haspopup")).toBe("menu");
45
+ expect(button.classList.contains("shrink-0")).toBe(true);
46
+ });
47
+
48
+ it("exposes the open state to assistive technology only when it triggers a menu", () => {
49
+ const menuTrigger = (expanded: boolean) =>
50
+ mount(
51
+ <SidebarSectionActionButton
52
+ aria-haspopup="menu"
53
+ expanded={expanded}
54
+ iconClassName="icon-[solar--menu-dots-bold]"
55
+ label="View options"
56
+ />,
57
+ );
58
+ expect(menuTrigger(false).getAttribute("aria-expanded")).toBe("false");
59
+ expect(menuTrigger(true).getAttribute("aria-expanded")).toBe("true");
60
+ expect(
61
+ mount(<SidebarSectionActionButton expanded iconClassName="icon-[solar--add-linear]" label="Add" />).hasAttribute(
62
+ "aria-expanded",
63
+ ),
64
+ ).toBe(false);
65
+ });
66
+
67
+ it("stays hidden until its row is hovered or it takes keyboard focus, unless it is always shown", () => {
68
+ const hover = mount(<SidebarSectionActionButton iconClassName="icon-[solar--add-linear]" label="Add" />);
69
+ expect(hover.dataset.reveal).toBe("hover");
70
+ expect(hover.classList).toContain("opacity-0");
71
+ expect(hover.classList).toContain("group-hover:opacity-60");
72
+ expect(hover.classList).toContain("focus-visible:opacity-100");
73
+
74
+ const always = mount(<SidebarSectionActionButton iconClassName="icon-[solar--add-linear]" label="Add" reveal="always" />);
75
+ expect(always.dataset.reveal).toBe("always");
76
+ expect(always.classList).not.toContain("opacity-0");
77
+
78
+ const open = mount(<SidebarSectionActionButton expanded iconClassName="icon-[solar--add-linear]" label="Add" />);
79
+ expect(open.classList).toContain("opacity-100");
80
+ expect(open.classList).not.toContain("opacity-0");
81
+ });
82
+
83
+ it("reports whether its menu is open", () => {
84
+ expect(
85
+ mount(<SidebarSectionActionButton iconClassName="icon-[solar--add-linear]" label="Add" />).dataset.state,
86
+ ).toBe("closed");
87
+ expect(
88
+ mount(<SidebarSectionActionButton expanded iconClassName="icon-[solar--add-linear]" label="Add" />).dataset.state,
89
+ ).toBe("open");
90
+ });
91
+ });
@@ -0,0 +1,52 @@
1
+ import { cn } from "@vetta-org/ui/utils";
2
+ import { forwardRef, type ComponentPropsWithoutRef, type JSX } from "react";
3
+
4
+ export interface SidebarSectionActionButtonProps extends Omit<ComponentPropsWithoutRef<"button">, "children"> {
5
+ /** iconify class,例如 `icon-[solar--add-linear]`。 */
6
+ iconClassName: string;
7
+ /** 可访问名称,同时作为悬停提示。 */
8
+ label: string;
9
+ /**
10
+ * `hover`:只在所在 `group` 被悬停时出现;`always`:常驻显示。
11
+ * 两者都在自身悬停时提到全亮。
12
+ */
13
+ reveal?: "hover" | "always";
14
+ /** 关联的菜单或弹层正打开,保持全亮;作为菜单触发器(`aria-haspopup="menu"`)时同步为 `aria-expanded`。 */
15
+ expanded?: boolean;
16
+ }
17
+
18
+ /**
19
+ * 侧栏分区标题行(项目、对话)右侧的图标按钮。
20
+ * 需要作为 Popover/Dropdown 的 `asChild` 触发器时会被注入 ref 与事件,故原样转发。
21
+ */
22
+ export const SidebarSectionActionButton = forwardRef<HTMLButtonElement, SidebarSectionActionButtonProps>(
23
+ function SidebarSectionActionButton(
24
+ { className, expanded = false, iconClassName, label, reveal = "hover", type = "button", ...props },
25
+ ref,
26
+ ): JSX.Element {
27
+ return (
28
+ <button
29
+ ref={ref}
30
+ type={type}
31
+ title={label}
32
+ aria-label={label}
33
+ aria-expanded={props["aria-haspopup"] === "menu" ? expanded : undefined}
34
+ data-state={expanded ? "open" : "closed"}
35
+ data-reveal={reveal}
36
+ className={cn(
37
+ // 键盘聚焦时也要可见,不能只靠悬停才露出。
38
+ "flex items-center justify-center rounded-md p-1.5 text-foreground transition-opacity hover:bg-accent focus-visible:opacity-100",
39
+ expanded
40
+ ? "opacity-100"
41
+ : reveal === "always"
42
+ ? "opacity-60 hover:opacity-100"
43
+ : "opacity-0 group-hover:opacity-60 group-hover:hover:opacity-100",
44
+ className,
45
+ )}
46
+ {...props}
47
+ >
48
+ <span aria-hidden="true" className={cn(iconClassName, "h-4 w-4")} />
49
+ </button>
50
+ );
51
+ },
52
+ );
package/src/styles.css CHANGED
@@ -5,6 +5,8 @@
5
5
  @import "./file-preview/syntax-tokens.css";
6
6
  /* Command Menu 的一次性装饰动效(组件侧也会 side-effect import)。 */
7
7
  @import "./overlays/command-menu.css";
8
+ /* 会话消息流的上下渐隐:两层 mask 把滚动条槽位排除在渐隐之外。 */
9
+ @import "./chat/message-feed-fade.css";
8
10
 
9
11
  @keyframes pulse {
10
12
  0%,
@@ -64,6 +66,11 @@ textarea::placeholder {
64
66
  opacity: 0.5;
65
67
  }
66
68
 
69
+ /* Capture markers must stay vivid over guest pages, independently of the app theme. */
70
+ @theme {
71
+ --color-browser-selection: #008cff;
72
+ }
73
+
67
74
  @theme inline {
68
75
  --color-accent: var(--accent);
69
76
  --color-accent-foreground: var(--accent-foreground);
@@ -1,57 +0,0 @@
1
- import { describe, expect, test } from "vitest";
2
- import type { HastElement, HastRoot, HastText } from "./nodes";
3
- import { rehypeStreamingChunks } from "./streaming";
4
-
5
- function text(value: string): HastText {
6
- return { type: "text", value } as HastText;
7
- }
8
-
9
- function paragraph(...children: Array<HastText | HastElement>): HastElement {
10
- return { type: "element", tagName: "p", properties: {}, children } as HastElement;
11
- }
12
-
13
- function chunkClasses(root: HastRoot): string[][] {
14
- const out: string[][] = [];
15
- const walk = (node: HastRoot | HastElement): void => {
16
- for (const child of node.children) {
17
- if (child.type !== "element") continue;
18
- const className = (child.properties?.className as string[] | undefined) ?? [];
19
- if (className.includes("streaming-chunk")) out.push(className);
20
- walk(child);
21
- }
22
- };
23
- walk(root);
24
- return out;
25
- }
26
-
27
- describe("rehypeStreamingChunks", () => {
28
- test("marks only the newest two phrases so brightness follows the reveal cadence without animation", () => {
29
- const tree = { type: "root", children: [paragraph(text("One, two, three, four."))] } as HastRoot;
30
- rehypeStreamingChunks()(tree);
31
- expect(chunkClasses(tree)).toEqual([
32
- ["streaming-chunk"],
33
- ["streaming-chunk"],
34
- ["streaming-chunk", "streaming-chunk-recent"],
35
- ["streaming-chunk", "streaming-chunk-latest"],
36
- ]);
37
- });
38
-
39
- test("a single phrase is the latest one and there is no recent phrase", () => {
40
- const tree = { type: "root", children: [paragraph(text("Hello."))] } as HastRoot;
41
- rehypeStreamingChunks()(tree);
42
- expect(chunkClasses(tree)).toEqual([["streaming-chunk", "streaming-chunk-latest"]]);
43
- });
44
-
45
- test("the newest phrase is found across block boundaries", () => {
46
- const tree = {
47
- type: "root",
48
- children: [paragraph(text("First, second.")), paragraph(text("Third."))],
49
- } as HastRoot;
50
- rehypeStreamingChunks()(tree);
51
- expect(chunkClasses(tree)).toEqual([
52
- ["streaming-chunk"],
53
- ["streaming-chunk", "streaming-chunk-recent"],
54
- ["streaming-chunk", "streaming-chunk-latest"],
55
- ]);
56
- });
57
- });
@@ -1,90 +0,0 @@
1
- import type { JSX } from "react";
2
- import { Button } from "@vetta-org/ui";
3
- import { cn } from "@vetta-org/ui";
4
-
5
- export interface AchievementNavigationAssets {
6
- readonly activeBackground: string;
7
- readonly disabledBackground: string;
8
- readonly activeArrow: string;
9
- readonly disabledArrow: string;
10
- }
11
-
12
- export interface AchievementNavigationButtonViewProps {
13
- readonly disabled: boolean;
14
- readonly direction: "previous" | "next";
15
- readonly label: string;
16
- readonly onClick: () => void;
17
- readonly assets: AchievementNavigationAssets;
18
- }
19
-
20
- export function AchievementNavigationButtonView({
21
- disabled,
22
- direction,
23
- label,
24
- onClick,
25
- assets,
26
- }: AchievementNavigationButtonViewProps): JSX.Element {
27
- const previous = direction === "previous";
28
-
29
- return (
30
- <Button
31
- variant="ghost"
32
- disabled={disabled}
33
- aria-label={label}
34
- title={label}
35
- className={cn(
36
- "absolute top-1/2 z-30 h-[120px] w-[60px] rounded-none border-0 bg-transparent p-0 hover:bg-transparent disabled:opacity-100",
37
- previous ? "left-16" : "right-16",
38
- )}
39
- style={{
40
- transform: "translateY(-50%)",
41
- pointerEvents: "auto",
42
- cursor: disabled ? "default" : "pointer",
43
- }}
44
- onClick={onClick}
45
- >
46
- <img
47
- aria-hidden="true"
48
- alt=""
49
- draggable={false}
50
- src={assets.activeBackground}
51
- className={cn(
52
- "pointer-events-none absolute inset-0 h-full w-full object-contain transition-opacity duration-150",
53
- disabled ? "opacity-0" : "opacity-100",
54
- )}
55
- />
56
- <img
57
- aria-hidden="true"
58
- alt=""
59
- draggable={false}
60
- src={assets.disabledBackground}
61
- className={cn(
62
- "pointer-events-none absolute inset-0 h-full w-full object-contain transition-opacity duration-150",
63
- disabled ? "opacity-100" : "opacity-0",
64
- )}
65
- />
66
- <img
67
- aria-hidden="true"
68
- alt=""
69
- draggable={false}
70
- src={assets.activeArrow}
71
- className={cn(
72
- "pointer-events-none relative z-10 w-10 object-contain transition-opacity duration-150",
73
- previous && "rotate-180",
74
- disabled ? "opacity-0" : "opacity-100",
75
- )}
76
- />
77
- <img
78
- aria-hidden="true"
79
- alt=""
80
- draggable={false}
81
- src={assets.disabledArrow}
82
- className={cn(
83
- "pointer-events-none absolute left-1/2 top-1/2 z-10 w-10 -translate-x-1/2 -translate-y-1/2 object-contain transition-opacity duration-150",
84
- previous && "rotate-180",
85
- disabled ? "opacity-100" : "opacity-0",
86
- )}
87
- />
88
- </Button>
89
- );
90
- }
@@ -1,91 +0,0 @@
1
- import { useCallback, useRef, useState, type JSX, type ReactNode } from "react";
2
- import { Dialog, DialogContent, DialogDescription, DialogTitle } from "@vetta-org/ui";
3
-
4
- export interface AchievementPromotionDialogViewLabels {
5
- readonly title: string;
6
- readonly stageName: string;
7
- }
8
-
9
- export interface AchievementPromotionDialogViewProps {
10
- readonly onComplete: () => void;
11
- readonly labels: AchievementPromotionDialogViewLabels;
12
- /** 3D badge + confetti stay host-provided (or theme achievements slots). */
13
- readonly renderBadge: (handlers: {
14
- onCelebrate: () => void;
15
- onComplete: () => void;
16
- onHideText: () => void;
17
- onRevealText: () => void;
18
- }) => ReactNode;
19
- readonly renderConfetti: (triggerToken: number) => ReactNode;
20
- }
21
-
22
- export function AchievementPromotionDialogView({
23
- onComplete,
24
- labels,
25
- renderBadge,
26
- renderConfetti,
27
- }: AchievementPromotionDialogViewProps): JSX.Element {
28
- const [confettiTriggerToken, setConfettiTriggerToken] = useState(0);
29
- const [textVisible, setTextVisible] = useState(false);
30
- const textRef = useRef<HTMLDivElement>(null);
31
-
32
- const revealText = useCallback(() => {
33
- textRef.current?.animate(
34
- [
35
- { opacity: 0, transform: "translateY(16px)" },
36
- { opacity: 1, transform: "translateY(0)" },
37
- ],
38
- {
39
- duration: 500,
40
- easing: "cubic-bezier(0.22, 1, 0.36, 1)",
41
- },
42
- );
43
- setTextVisible(true);
44
- }, []);
45
- const hideText = useCallback(() => {
46
- setTextVisible(false);
47
- }, []);
48
- const celebrate = useCallback(() => {
49
- setConfettiTriggerToken((token) => token + 1);
50
- }, []);
51
-
52
- return (
53
- <Dialog open onOpenChange={(open) => !open && onComplete()}>
54
- <DialogContent
55
- className="h-[min(680px,calc(100vh-2rem))] overflow-visible border-transparent bg-transparent p-0 sm:max-w-[760px]"
56
- overlayClassName="bg-transparent supports-backdrop-filter:backdrop-blur-none"
57
- showCloseButton={false}
58
- onEscapeKeyDown={(event) => event.preventDefault()}
59
- onPointerDownOutside={(event) => event.preventDefault()}
60
- >
61
- <div
62
- ref={textRef}
63
- className={`pointer-events-none absolute inset-x-0 bottom-12 z-20 text-center transition-opacity ease-out ${
64
- textVisible ? "opacity-100" : "opacity-0"
65
- }`}
66
- style={{
67
- WebkitTextStroke: "2px var(--background)",
68
- paintOrder: "stroke fill",
69
- transitionDuration: textVisible ? "500ms" : "950ms",
70
- }}
71
- >
72
- <DialogTitle className="text-[20px] font-semibold text-primary">{labels.title}</DialogTitle>
73
- <DialogDescription className="mt-2 text-[15px] text-foreground">
74
- {labels.stageName}
75
- </DialogDescription>
76
- </div>
77
- <div className="relative z-10 h-full w-full">
78
- {renderBadge({
79
- onCelebrate: celebrate,
80
- onComplete,
81
- onHideText: hideText,
82
- onRevealText: revealText,
83
- })}
84
- </div>
85
- <div className="pointer-events-none absolute inset-0 z-15">
86
- {renderConfetti(confettiTriggerToken)}
87
- </div>
88
- </DialogContent>
89
- </Dialog>
90
- );
91
- }
@@ -1,43 +0,0 @@
1
- import type { JSX, ReactNode } from "react";
2
- import { MotionSelect } from "./MotionSelect";
3
-
4
- export interface AchievementSetOptionView {
5
- readonly id: string;
6
- readonly label: string;
7
- }
8
-
9
- export interface AchievementSettingsViewProps {
10
- readonly setSelectorLabel: string;
11
- readonly selectedSetId: string;
12
- readonly setOptions: readonly AchievementSetOptionView[];
13
- readonly onSelectSetId: (id: string) => void;
14
- readonly carousel: ReactNode;
15
- readonly promotionDialog: ReactNode;
16
- }
17
-
18
- export function AchievementSettingsView({
19
- setSelectorLabel,
20
- selectedSetId,
21
- setOptions,
22
- onSelectSetId,
23
- carousel,
24
- promotionDialog,
25
- }: AchievementSettingsViewProps): JSX.Element {
26
- return (
27
- <>
28
- <div className="mx-auto w-full max-w-[920px] px-8 pb-28 pt-4">
29
- <div className="mb-4 flex items-center justify-end gap-2">
30
- <span className="text-[12px] text-muted-foreground">{setSelectorLabel}</span>
31
- <MotionSelect
32
- value={selectedSetId}
33
- onValueChange={onSelectSetId}
34
- options={setOptions.map((set) => ({ value: set.id, label: set.label }))}
35
- aria-label={setSelectorLabel}
36
- />
37
- </div>
38
- {carousel}
39
- </div>
40
- {promotionDialog}
41
- </>
42
- );
43
- }
@@ -1,44 +0,0 @@
1
- import type { JSX, ReactNode } from "react";
2
- import { cn } from "@vetta-org/ui";
3
-
4
- export interface PetBubbleStylePreviewViewProps {
5
- readonly description: string;
6
- readonly disabled: boolean;
7
- readonly label: string;
8
- readonly onSelect: () => void;
9
- readonly preview: ReactNode;
10
- readonly selected: boolean;
11
- }
12
-
13
- export function PetBubbleStylePreviewView({
14
- description,
15
- disabled,
16
- label,
17
- onSelect,
18
- preview,
19
- selected,
20
- }: PetBubbleStylePreviewViewProps): JSX.Element {
21
- return (
22
- <button
23
- aria-label={label}
24
- aria-pressed={selected}
25
- className={cn(
26
- "overflow-hidden rounded-lg border border-border bg-card text-left transition-colors",
27
- "hover:border-primary/40 hover:bg-accent/40 focus-visible:outline-none focus-visible:border-ring",
28
- "disabled:cursor-not-allowed disabled:opacity-60",
29
- selected && "border-primary/40 bg-primary/10 ring-1 ring-inset ring-primary/30",
30
- )}
31
- disabled={disabled}
32
- onClick={onSelect}
33
- type="button"
34
- >
35
- <div className="flex min-h-32 items-center justify-center overflow-hidden bg-muted px-8 py-10">
36
- {preview}
37
- </div>
38
- <div className="border-t border-border px-3 py-2">
39
- <div className="truncate text-[12px] font-medium text-foreground">{label}</div>
40
- <div className="mt-0.5 line-clamp-2 text-[11px] text-muted-foreground">{description}</div>
41
- </div>
42
- </button>
43
- );
44
- }
@@ -1,64 +0,0 @@
1
- import type { JSX } from "react";
2
- import { cn } from "@vetta-org/ui";
3
- import { MotionSelect } from "./MotionSelect";
4
- import { SettingRow, SettingSection, type SettingSectionMeta } from "./SettingChrome";
5
-
6
- export interface QuickPanelOptionView {
7
- readonly value: string;
8
- readonly label: string;
9
- }
10
-
11
- export interface QuickPanelSettingsSectionViewProps {
12
- readonly section: SettingSectionMeta;
13
- readonly sectionTitle?: string;
14
- readonly triggerTitle: string;
15
- readonly triggerDescription: string;
16
- readonly trigger: string;
17
- readonly triggerOptions: readonly QuickPanelOptionView[];
18
- readonly onTriggerChange: (value: string) => void;
19
- readonly behaviorTitle: string;
20
- readonly behaviorDescription: string;
21
- readonly behavior: string;
22
- readonly behaviorOptions: readonly QuickPanelOptionView[];
23
- readonly onBehaviorChange: (value: string) => void;
24
- readonly behaviorDisabled: boolean;
25
- }
26
-
27
- export function QuickPanelSettingsSectionView({
28
- section,
29
- sectionTitle,
30
- triggerTitle,
31
- triggerDescription,
32
- trigger,
33
- triggerOptions,
34
- onTriggerChange,
35
- behaviorTitle,
36
- behaviorDescription,
37
- behavior,
38
- behaviorOptions,
39
- onBehaviorChange,
40
- behaviorDisabled,
41
- }: QuickPanelSettingsSectionViewProps): JSX.Element {
42
- return (
43
- <SettingSection section={section} title={sectionTitle}>
44
- <SettingRow title={triggerTitle} description={triggerDescription}>
45
- <MotionSelect
46
- value={trigger}
47
- onValueChange={onTriggerChange}
48
- options={triggerOptions}
49
- />
50
- </SettingRow>
51
-
52
- <SettingRow title={behaviorTitle} description={behaviorDescription} border={false}>
53
- <div className={cn("transition-opacity", behaviorDisabled && "pointer-events-none opacity-40")}>
54
- <MotionSelect
55
- value={behavior}
56
- onValueChange={onBehaviorChange}
57
- options={behaviorOptions}
58
- disabled={behaviorDisabled}
59
- />
60
- </div>
61
- </SettingRow>
62
- </SettingSection>
63
- );
64
- }
@@ -1,50 +0,0 @@
1
- import type { CSSProperties, JSX } from "react";
2
-
3
- export interface AchievementCurtainSideLayout {
4
- top: number;
5
- left?: number;
6
- right?: number;
7
- }
8
-
9
- export interface AchievementCurtainsLayout {
10
- height: number;
11
- aspectRatio: string;
12
- left: AchievementCurtainSideLayout;
13
- right: AchievementCurtainSideLayout;
14
- }
15
-
16
- export interface AchievementCurtainsAssets {
17
- left: string;
18
- right: string;
19
- }
20
-
21
- export interface AchievementCurtainsProps {
22
- layout: AchievementCurtainsLayout;
23
- assets: AchievementCurtainsAssets;
24
- }
25
-
26
- export function AchievementCurtains({ layout, assets }: AchievementCurtainsProps): JSX.Element {
27
- const leftStyle: CSSProperties = {
28
- ...layout.left,
29
- height: layout.height,
30
- aspectRatio: layout.aspectRatio,
31
- backgroundImage: `url("${assets.left}")`,
32
- backgroundPosition: "center",
33
- backgroundSize: "contain",
34
- };
35
- const rightStyle: CSSProperties = {
36
- ...layout.right,
37
- height: layout.height,
38
- aspectRatio: layout.aspectRatio,
39
- backgroundImage: `url("${assets.right}")`,
40
- backgroundPosition: "center",
41
- backgroundSize: "contain",
42
- };
43
-
44
- return (
45
- <div aria-hidden="true" className="pointer-events-none absolute inset-0 z-20 select-none">
46
- <span className="absolute bg-no-repeat" style={leftStyle} />
47
- <span className="absolute bg-no-repeat" style={rightStyle} />
48
- </div>
49
- );
50
- }