An open-source, self-hosted system for apps built with web technologies.
Use standard buttons across the taskbar
zohayrslilehb80e7983ddf5
diff --git a/scripts/contracts/panel.tsx b/scripts/contracts/panel.tsxindex 1757cbd..abc8c8b 100644--- a/scripts/contracts/panel.tsx+++ b/scripts/contracts/panel.tsx@@ -47,7 +47,7 @@ assert.match(authentication, /name="password"/)assert.match(authentication, /type="submit"/)const launcher = markup(<Launcher label="Example System" trigger="Open">{(_close, labelId) => <StartMenuPanel labelId={labelId} name="Example System" version="1.2.3" left={<button>Programs</button>} right={<p>Processes</p>} footer={<input type="search" aria-label="Search Programs and Processes" />} />}</Launcher>)-assert.equal(launcher.match(/data-surface-material=""/g)?.length, 3)+assert.equal(launcher.match(/data-surface-material=""/g)?.length, 4)assert.match(launcher, /grid-cols-2/)assert.match(launcher, /grid-template-rows:auto minmax\(0, 1fr\);min-height:0/)assert.match(launcher, /grid-template-rows:minmax\(0, 1fr\) auto;gap:8px;padding:8px;padding-top:0/)@@ -66,4 +66,3 @@ assert.match(popover, /overflow-visible/)// Popovers and native dialogs share a non-clipping host for independently owned outer effects.assert(taskbarSurfaceClassName.split(" ").includes("overflow-visible"))assert.doesNotMatch(popover, /style=/)-assert.match(launcher, /popovertarget=/i)diff --git a/source/client/view/structure/desktop/taskbar/launcher/launcher.tsx b/source/client/view/structure/desktop/taskbar/launcher/launcher.tsxindex e072f01..485223c 100644--- a/source/client/view/structure/desktop/taskbar/launcher/launcher.tsx+++ b/source/client/view/structure/desktop/taskbar/launcher/launcher.tsx@@ -26,6 +26,18 @@ export default function ({ label, trigger, children, className, ...props }: Laun}, [])+ const toggle = useCallback(function () {++ const element = surface.current++ if (!element) return++ if (element.matches(":popover-open")) element.hidePopover()++ else element.showPopover()++ }, [])+useEffect(function () {// A Program frame is a separate document, so its pointer events cannot@@ -57,9 +69,7 @@ export default function ({ label, trigger, children, className, ...props }: Launaria-label={label}- title={label}-- popoverTarget={id}+ onPress={toggle}>diff --git a/source/client/view/structure/desktop/taskbar/programs/overflow-row.tsx b/source/client/view/structure/desktop/taskbar/programs/overflow-row.tsxindex 8930105..8aeadaf 100644--- a/source/client/view/structure/desktop/taskbar/programs/overflow-row.tsx+++ b/source/client/view/structure/desktop/taskbar/programs/overflow-row.tsx@@ -1,5 +1,6 @@import { ComponentProps, useId, useLayoutEffect, useRef, useState } from "react"import { useReducedMotion } from "@libs/react-motion"+import { Button } from "@phreshos/react-ui"/** A horizontal row that reveals its own overflow without owning its items. */export default function OverflowRow({ children, backwardLabel = "Scroll backward", forwardLabel = "Scroll forward", className, ...props }: OverflowRowProps) {@@ -81,7 +82,7 @@ export default function OverflowRow({ children, backwardLabel = "Scroll backwardreturn <div ref={container} role="group" className={`flex min-w-0 items-center gap-1 ${className ?? ""}`} {...props}>- {edges.overflowing && <ScrollButton label={backwardLabel} controls={viewportId} direction="backward" disabled={edges.start} reducedMotion={reducedMotion} onClick={() => scroll(-1)} />}+ {edges.overflowing && <ScrollButton label={backwardLabel} controls={viewportId} direction="backward" disabled={edges.start} onClick={() => scroll(-1)} />}<div id={viewportId} ref={viewport} className="-m-2 min-w-0 flex-1 overflow-x-auto p-2">@@ -93,26 +94,21 @@ export default function OverflowRow({ children, backwardLabel = "Scroll backward</div>- {edges.overflowing && <ScrollButton label={forwardLabel} controls={viewportId} direction="forward" disabled={edges.end} reducedMotion={reducedMotion} onClick={() => scroll(1)} />}+ {edges.overflowing && <ScrollButton label={forwardLabel} controls={viewportId} direction="forward" disabled={edges.end} onClick={() => scroll(1)} />}</div>}-function ScrollButton({ label, controls, direction, disabled, reducedMotion, onClick }: ScrollButtonProps) {-- return <button-- type="button"+function ScrollButton({ label, controls, direction, disabled, onClick }: ScrollButtonProps) {+ return <Buttonaria-label={label}-aria-controls={controls}-disabled={disabled}-- onClick={onClick}-- className={`grid size-7 shrink-0 place-items-center rounded-lg border border-white/45 bg-white/55 shadow-sm outline-none focus-visible:ring-2 focus-visible:ring-white disabled:opacity-35 ${reducedMotion ? "" : "transition-colors hover:bg-white/80 active:scale-95"}`}+ onPress={onClick}+ size="xsmall"+ className="shrink-0"+ style={{ inlineSize: 28, paddingInline: 0 }}>@@ -122,7 +118,7 @@ function ScrollButton({ label, controls, direction, disabled, reducedMotion, onC</svg>- </button>+ </Button>}interface OverflowRowProps extends ComponentProps<"div"> {@@ -142,7 +138,5 @@ interface ScrollButtonProps {disabled: boolean- reducedMotion: boolean-onClick: () => void}diff --git a/source/client/view/structure/desktop/taskbar/programs/taskbar-item.tsx b/source/client/view/structure/desktop/taskbar/programs/taskbar-item.tsxindex 68900c6..2b23aa3 100644--- a/source/client/view/structure/desktop/taskbar/programs/taskbar-item.tsx+++ b/source/client/view/structure/desktop/taskbar/programs/taskbar-item.tsx@@ -1,42 +1,36 @@-import { ComponentProps } from "react"-import { useReducedMotion } from "@libs/react-motion"+import { Button, type ButtonProps } from "@phreshos/react-ui"+import { forwardRef, type ReactNode } from "react"/*** A pressable item with a raised state. What "raised" means is the caller's.*/-export default function ({ active = false, icon, children, className, ...props }: TaskbarItemProps) {+export default forwardRef<HTMLButtonElement, TaskbarItemProps>(function TaskbarItem({ active = false, icon, children, className, ...props }, ref) {- const reducedMotion = useReducedMotion()-- const surface = active-- ? "border-white/75 bg-gradient-to-b from-white/70 to-white/40 shadow-taskbar-item-active"-- : "border-white/35 bg-white/20 shadow-taskbar-item hover:border-white/55 hover:bg-white/40"-- return <button+ return <Button+ ref={ref}aria-pressed={active}-- className={`relative flex h-8 max-w-40 shrink-0 scroll-mx-8 cursor-pointer select-none items-center gap-1.5 overflow-hidden rounded-lg border px-2.5 text-xs font-medium outline-none focus-visible:ring-2 focus-visible:ring-white/80 ${reducedMotion ? "" : "transition-colors duration-100 active:scale-95"} ${surface} ${className ?? ""}`}-+ size="small"+ className={`relative max-w-40 scroll-mx-8 overflow-hidden ${className ?? ""}`}{...props}><img src={icon} alt="" draggable={false} className="size-4 shrink-0 rounded-sm object-contain" />- <span className={`truncate ${active ? "" : "opacity-80"}`}>{children}</span>+ <span className="truncate">{children}</span>{active && <span aria-hidden="true" className="absolute inset-x-3 bottom-0 h-0.5 rounded-full bg-sky-500 shadow-taskbar-indicator" />}- </button>-}+ </Button>+})-export interface TaskbarItemProps extends ComponentProps<"button"> {+export interface TaskbarItemProps extends Omit<ButtonProps, "children"> {active?: boolean// Every system entry has either its Program icon or the system default.icon: string++ children?: ReactNode}diff --git a/source/client/view/structure/desktop/taskbar/programs/window-taskbar-item.tsx b/source/client/view/structure/desktop/taskbar/programs/window-taskbar-item.tsxindex a420ccb..3874021 100644--- a/source/client/view/structure/desktop/taskbar/programs/window-taskbar-item.tsx+++ b/source/client/view/structure/desktop/taskbar/programs/window-taskbar-item.tsx@@ -15,7 +15,7 @@ export default memo(function ({ record, title, icon, active, onElement, onMinimiconst source = useCallback((element: HTMLButtonElement | null) => onElement(record, element), [onElement, record])- return <TaskbarItem ref={source} active={active} icon={icon} onClick={press}>+ return <TaskbarItem ref={source} active={active} icon={icon} onPress={press}>{title}diff --git a/source/client/view/structure/desktop/taskbar/system/sign-out.tsx b/source/client/view/structure/desktop/taskbar/system/sign-out.tsxindex ed3f23b..c5eef2d 100644--- a/source/client/view/structure/desktop/taskbar/system/sign-out.tsx+++ b/source/client/view/structure/desktop/taskbar/system/sign-out.tsx@@ -10,9 +10,7 @@ export default memo(function (props: ComponentProps<typeof TaskbarButton>) {aria-label="Sign out"- title="Sign out"-- onClick={authorization.remove}+ onPress={authorization.remove}{...props}diff --git a/source/client/view/structure/desktop/taskbar/system/system-dialogs.tsx b/source/client/view/structure/desktop/taskbar/system/system-dialogs.tsxindex 0ad2be1..1102a7e 100644--- a/source/client/view/structure/desktop/taskbar/system/system-dialogs.tsx+++ b/source/client/view/structure/desktop/taskbar/system/system-dialogs.tsx@@ -106,11 +106,11 @@ function PermissionRequest({ dialog, description, decide }: PermissionRequestPro<div className="col-span-full flex flex-wrap justify-end gap-2">- <TaskbarButton small disabled={decision.isPending} onClick={() => decision.safeExecute(false)}>Deny</TaskbarButton>+ <TaskbarButton small disabled={decision.isPending} onPress={() => decision.safeExecute(false)}>Deny</TaskbarButton>- <TaskbarButton small autoFocus disabled={decision.isPending} onClick={() => decision.safeExecute(null)}>Later</TaskbarButton>+ <TaskbarButton small autoFocus disabled={decision.isPending} onPress={() => decision.safeExecute(null)}>Later</TaskbarButton>- <TaskbarButton small disabled={decision.isPending} onClick={() => decision.safeExecute(true)}>Allow for this Program</TaskbarButton>+ <TaskbarButton small disabled={decision.isPending} onPress={() => decision.safeExecute(true)}>Allow for this Program</TaskbarButton></div>@@ -143,7 +143,7 @@ function CrashReport({ dialog, description, acknowledge }: CrashReportProps) {disabled={acknowledgment.isPending}- onClick={() => acknowledgment.safeExecute()}+ onPress={() => acknowledgment.safeExecute()}className="col-span-full justify-self-end font-medium"diff --git a/source/client/view/structure/desktop/taskbar/taskbar-button.tsx b/source/client/view/structure/desktop/taskbar/taskbar-button.tsxindex eb411b7..4b8fd3b 100644--- a/source/client/view/structure/desktop/taskbar/taskbar-button.tsx+++ b/source/client/view/structure/desktop/taskbar/taskbar-button.tsx@@ -1,23 +1,12 @@-import { useReducedMotion } from "@libs/react-motion"-import { ComponentProps } from "react"+import { Button, type ButtonProps } from "@phreshos/react-ui"/** A compact taskbar control whose contents define its meaning. */-export default function TaskbarButton({ small = false, className, ...props }: TaskbarButtonProps) {+export default function TaskbarButton({ small = false, ...props }: TaskbarButtonProps) {- const reducedMotion = useReducedMotion()-- return <button-- type="button"-- className={`grid shrink-0 cursor-pointer select-none grid-flow-col auto-cols-max place-items-center rounded-lg border border-white/45 bg-white/30 shadow-taskbar-control outline-none hover:bg-white/50 focus-visible:ring-2 focus-visible:ring-white/85 ${small ? "h-7 gap-1 px-2 text-xs" : "h-8 gap-1.5 px-2"} ${reducedMotion ? "" : "transition-colors duration-100 active:scale-95"} ${className ?? ""}`}-- {...props}-- />+ return <Button size={small ? "xsmall" : "small"} {...props} />}-interface TaskbarButtonProps extends ComponentProps<"button"> {+interface TaskbarButtonProps extends ButtonProps {small?: boolean}