@kerf-js/veneer 0.0.0-stage → 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 +16 -0
- package/README.md +1338 -2
- package/package.json +56 -3
- package/plugin.d.mts +187 -0
- package/plugin.mjs +399 -0
- package/src/Accordion.tsx +98 -0
- package/src/Alert.tsx +55 -0
- package/src/Badge.tsx +39 -0
- package/src/Button.tsx +175 -0
- package/src/Calendar-month.tsx +140 -0
- package/src/Calendar.tsx +335 -0
- package/src/Canvas.tsx +221 -0
- package/src/Card.tsx +85 -0
- package/src/Chart.tsx +278 -0
- package/src/Charts.tsx +158 -0
- package/src/Chip.tsx +61 -0
- package/src/Choice-checkbox.tsx +53 -0
- package/src/Choice-parts.tsx +7 -0
- package/src/Choice-radio.tsx +78 -0
- package/src/Choice-segmented.tsx +76 -0
- package/src/Choice-switch.tsx +51 -0
- package/src/Choice.tsx +4 -0
- package/src/CloseX.tsx +14 -0
- package/src/CodeBlock.tsx +81 -0
- package/src/CodeInput.tsx +256 -0
- package/src/Combobox.tsx +281 -0
- package/src/CommandPalette-controller.ts +314 -0
- package/src/CommandPalette-rows.tsx +137 -0
- package/src/CommandPalette.tsx +196 -0
- package/src/DataGrid-actions.ts +119 -0
- package/src/DataGrid-body.tsx +58 -0
- package/src/DataGrid-controller.ts +145 -0
- package/src/DataGrid-header.tsx +108 -0
- package/src/DataGrid-model.ts +248 -0
- package/src/DataGrid-pivot.tsx +108 -0
- package/src/DataGrid-rows.tsx +296 -0
- package/src/DataGrid-toolbar.tsx +127 -0
- package/src/DataGrid-tree.ts +149 -0
- package/src/DataGrid-viewport.tsx +37 -0
- package/src/DataGrid.tsx +145 -0
- package/src/DateField-presets.tsx +27 -0
- package/src/DateField-range.tsx +370 -0
- package/src/DateField.tsx +295 -0
- package/src/Dither.tsx +313 -0
- package/src/Drawer.tsx +123 -0
- package/src/DurationField.tsx +227 -0
- package/src/Feed.tsx +78 -0
- package/src/Field/view.tsx +147 -0
- package/src/Field.tsx +238 -0
- package/src/HamburgerMenu.tsx +119 -0
- package/src/Icon.tsx +15 -0
- package/src/Kbd.tsx +6 -0
- package/src/KeyValueEditor/actions.ts +75 -0
- package/src/KeyValueEditor/rows.tsx +104 -0
- package/src/KeyValueEditor.tsx +112 -0
- package/src/Layout.tsx +221 -0
- package/src/Markdown.tsx +127 -0
- package/src/MentionsInput/actions.ts +161 -0
- package/src/MentionsInput/end.tsx +82 -0
- package/src/MentionsInput.tsx +103 -0
- package/src/Menu.tsx +221 -0
- package/src/Modal.tsx +109 -0
- package/src/MonthPicker/month.tsx +117 -0
- package/src/MonthPicker/period.tsx +197 -0
- package/src/MonthPicker/shared.tsx +272 -0
- package/src/MonthPicker/week.tsx +103 -0
- package/src/MonthPicker.tsx +11 -0
- package/src/MultiSelect.tsx +139 -0
- package/src/Nav.tsx +36 -0
- package/src/NumberField.tsx +156 -0
- package/src/Pagination.tsx +335 -0
- package/src/PaymentCard.tsx +111 -0
- package/src/Picker.tsx +228 -0
- package/src/PlaceField.tsx +285 -0
- package/src/Popover.tsx +88 -0
- package/src/Presence.tsx +37 -0
- package/src/Progress.tsx +71 -0
- package/src/RecurrenceField.tsx +372 -0
- package/src/RichSelect/codes.tsx +94 -0
- package/src/RichSelect/list.tsx +380 -0
- package/src/RichSelect/phone-view.tsx +114 -0
- package/src/RichSelect/phone.tsx +305 -0
- package/src/RichSelect/search-keys.ts +28 -0
- package/src/RichSelect/timezone.tsx +53 -0
- package/src/RichSelect.tsx +13 -0
- package/src/RichTextEditor/controller.tsx +305 -0
- package/src/RichTextEditor/editor.tsx +61 -0
- package/src/RichTextEditor/tools.tsx +132 -0
- package/src/RichTextEditor/view.tsx +210 -0
- package/src/RichTextEditor.tsx +9 -0
- package/src/ScrollGrid/measure.ts +39 -0
- package/src/ScrollGrid/parts.tsx +112 -0
- package/src/ScrollGrid.tsx +375 -0
- package/src/ScrollRail.tsx +114 -0
- package/src/ScrollView.tsx +57 -0
- package/src/Segments/controller.tsx +148 -0
- package/src/Segments/events.ts +99 -0
- package/src/Segments/view.tsx +77 -0
- package/src/Segments.tsx +2 -0
- package/src/Select.tsx +343 -0
- package/src/Shape.tsx +41 -0
- package/src/Shell/branches.tsx +108 -0
- package/src/Shell/button.tsx +33 -0
- package/src/Shell/shared.tsx +220 -0
- package/src/Shell/shell.tsx +25 -0
- package/src/Shell/state.ts +138 -0
- package/src/Shell/view.tsx +280 -0
- package/src/Shell.tsx +17 -0
- package/src/SideNav/sections.tsx +50 -0
- package/src/SideNav/state.ts +140 -0
- package/src/SideNav.tsx +130 -0
- package/src/SideNavTitle.tsx +25 -0
- package/src/SignaturePad/state.ts +172 -0
- package/src/SignaturePad/view.tsx +69 -0
- package/src/SignaturePad.tsx +76 -0
- package/src/Skeleton.tsx +46 -0
- package/src/Slider.tsx +81 -0
- package/src/Spinner.tsx +21 -0
- package/src/Stage-director.ts +361 -0
- package/src/Stage-look.ts +75 -0
- package/src/Stage-poster.tsx +62 -0
- package/src/Stage-types.ts +206 -0
- package/src/Stage.tsx +147 -0
- package/src/TabBar.tsx +114 -0
- package/src/Table-actions.tsx +51 -0
- package/src/Table-base.ts +70 -0
- package/src/Table-body.tsx +84 -0
- package/src/Table-columns.tsx +58 -0
- package/src/Table-details.tsx +66 -0
- package/src/Table-editor.tsx +66 -0
- package/src/Table-head.tsx +52 -0
- package/src/Table-model.ts +82 -0
- package/src/Table-notice.ts +39 -0
- package/src/Table-paging.ts +50 -0
- package/src/Table-rows.tsx +308 -0
- package/src/Table-selection.ts +63 -0
- package/src/Table-sortbar.tsx +41 -0
- package/src/Table-source.ts +66 -0
- package/src/Table-toolbar.tsx +71 -0
- package/src/Table-types.ts +115 -0
- package/src/Table-view.tsx +87 -0
- package/src/Table.tsx +31 -0
- package/src/Tabs.tsx +129 -0
- package/src/Tag.tsx +40 -0
- package/src/Ticker.tsx +42 -0
- package/src/TimeField-date-model.ts +77 -0
- package/src/TimeField-date-view.tsx +152 -0
- package/src/TimeField-model.ts +80 -0
- package/src/TimeField-options.tsx +224 -0
- package/src/TimeField-slots.tsx +32 -0
- package/src/TimeField-types.ts +33 -0
- package/src/TimeField-view.tsx +124 -0
- package/src/TimeField.tsx +126 -0
- package/src/Toast.tsx +143 -0
- package/src/Toggle.tsx +75 -0
- package/src/Tooltip.tsx +69 -0
- package/src/Type.tsx +136 -0
- package/src/VirtualList-controls.ts +105 -0
- package/src/VirtualList-data.ts +43 -0
- package/src/VirtualList-measure.ts +169 -0
- package/src/VirtualList-metrics.ts +41 -0
- package/src/VirtualList-mount.ts +145 -0
- package/src/VirtualList-rows.tsx +91 -0
- package/src/VirtualList-types.ts +76 -0
- package/src/VirtualList-view.tsx +123 -0
- package/src/VirtualList.tsx +81 -0
- package/src/admin/ApiKeys-actions.ts +124 -0
- package/src/admin/ApiKeys-form.tsx +64 -0
- package/src/admin/ApiKeys-view.tsx +101 -0
- package/src/admin/ApiKeys.tsx +224 -0
- package/src/admin/Audit.tsx +246 -0
- package/src/admin/Billing.tsx +307 -0
- package/src/admin/Cart.tsx +177 -0
- package/src/admin/Checkout-address.tsx +125 -0
- package/src/admin/Checkout-cart.tsx +78 -0
- package/src/admin/Checkout-coupon.ts +34 -0
- package/src/admin/Checkout-done.tsx +31 -0
- package/src/admin/Checkout-model.ts +33 -0
- package/src/admin/Checkout-navigation.ts +76 -0
- package/src/admin/Checkout-payment-view.tsx +49 -0
- package/src/admin/Checkout-payment.ts +80 -0
- package/src/admin/Checkout-review.tsx +60 -0
- package/src/admin/Checkout-shipping.tsx +47 -0
- package/src/admin/Checkout-state.ts +122 -0
- package/src/admin/Checkout-steps.ts +10 -0
- package/src/admin/Checkout-summary.tsx +97 -0
- package/src/admin/Checkout-types.ts +60 -0
- package/src/admin/Checkout-view.tsx +51 -0
- package/src/admin/Checkout.tsx +72 -0
- package/src/admin/CsvImport-actions.ts +131 -0
- package/src/admin/CsvImport.tsx +379 -0
- package/src/admin/Danger.tsx +240 -0
- package/src/admin/Integrations/Card.tsx +82 -0
- package/src/admin/Integrations/Webhooks.tsx +341 -0
- package/src/admin/Integrations.tsx +169 -0
- package/src/admin/InviteDialog.tsx +153 -0
- package/src/admin/Members/columns.tsx +181 -0
- package/src/admin/Members.tsx +316 -0
- package/src/admin/Order.tsx +115 -0
- package/src/admin/PlainTable.tsx +34 -0
- package/src/admin/Plans.tsx +375 -0
- package/src/admin/SaveBar/actions.ts +86 -0
- package/src/admin/SaveBar.tsx +153 -0
- package/src/admin/Secret.tsx +74 -0
- package/src/admin/Settings.tsx +145 -0
- package/src/admin/StepBar.tsx +66 -0
- package/src/admin/TagsInput/actions.ts +60 -0
- package/src/admin/TagsInput.tsx +95 -0
- package/src/admin/atoms.tsx +73 -0
- package/src/admin/index.ts +67 -0
- package/src/agent/Actions/reasons.tsx +38 -0
- package/src/agent/Actions.tsx +166 -0
- package/src/agent/AgentPlan.tsx +86 -0
- package/src/agent/ArtifactPanel.tsx +299 -0
- package/src/agent/Assistant.tsx +168 -0
- package/src/agent/Checkpoint.tsx +19 -0
- package/src/agent/Cite.tsx +70 -0
- package/src/agent/ContextMeter.tsx +70 -0
- package/src/agent/Conversation.tsx +70 -0
- package/src/agent/Message.tsx +92 -0
- package/src/agent/ModelPicker.tsx +167 -0
- package/src/agent/Prompt-model.ts +118 -0
- package/src/agent/Prompt-view.tsx +246 -0
- package/src/agent/Prompt.tsx +128 -0
- package/src/agent/Prose.tsx +118 -0
- package/src/agent/Question.tsx +137 -0
- package/src/agent/Reasoning.tsx +31 -0
- package/src/agent/Shimmer.tsx +11 -0
- package/src/agent/Sources.tsx +23 -0
- package/src/agent/SpeechInput.tsx +243 -0
- package/src/agent/Suggestions.tsx +36 -0
- package/src/agent/ToolCall.tsx +219 -0
- package/src/agent/TraceViewer.tsx +96 -0
- package/src/agent/bits.tsx +88 -0
- package/src/agent/index.ts +38 -0
- package/src/bind.ts +57 -0
- package/src/collab/AutoTrack.tsx +91 -0
- package/src/collab/Comments.tsx +204 -0
- package/src/collab/Composer/state.ts +125 -0
- package/src/collab/Composer/view.tsx +155 -0
- package/src/collab/Composer.tsx +141 -0
- package/src/collab/ConversationList.tsx +120 -0
- package/src/collab/Cursors.tsx +71 -0
- package/src/collab/DataIntegrity.tsx +103 -0
- package/src/collab/Kanban-card.ts +74 -0
- package/src/collab/Kanban.tsx +368 -0
- package/src/collab/Lock.tsx +36 -0
- package/src/collab/PresenceStack.tsx +176 -0
- package/src/collab/ShareDialog.tsx +273 -0
- package/src/collab/Status.tsx +101 -0
- package/src/collab/SyncedForm.tsx +42 -0
- package/src/collab/Thread/Message.tsx +265 -0
- package/src/collab/Thread/rows.tsx +56 -0
- package/src/collab/Thread.tsx +323 -0
- package/src/collab/VersionHistory.tsx +173 -0
- package/src/collab/ViewportRail.tsx +73 -0
- package/src/collab/index.ts +37 -0
- package/src/collab/peer.tsx +42 -0
- package/src/fields.ts +5 -0
- package/src/flow/AuthScreen.tsx +81 -0
- package/src/flow/AuthSteps.tsx +296 -0
- package/src/flow/Checklist.tsx +211 -0
- package/src/flow/ConnBanner.tsx +304 -0
- package/src/flow/Flow.tsx +97 -0
- package/src/flow/MfaSetup.tsx +244 -0
- package/src/flow/Otp.tsx +243 -0
- package/src/flow/ReauthDialog.tsx +79 -0
- package/src/flow/ShortcutsOverlay.tsx +121 -0
- package/src/flow/SignGate.tsx +184 -0
- package/src/flow/SignIn.tsx +136 -0
- package/src/flow/SignUp.tsx +149 -0
- package/src/flow/Sso.tsx +96 -0
- package/src/flow/SystemPage/accounts.tsx +74 -0
- package/src/flow/SystemPage/art.tsx +113 -0
- package/src/flow/SystemPage.tsx +395 -0
- package/src/flow/Tour.tsx +207 -0
- package/src/flow/index.ts +29 -0
- package/src/flow/kit.tsx +334 -0
- package/src/index.ts +237 -0
- package/src/layout.css +4 -0
- package/src/links.css +4 -0
- package/src/live/ActivityFeed.tsx +88 -0
- package/src/live/Bell.tsx +108 -0
- package/src/live/Connection.tsx +113 -0
- package/src/live/Inbox.tsx +113 -0
- package/src/live/InboxFeed.tsx +67 -0
- package/src/live/InboxGestures.ts +41 -0
- package/src/live/InboxHandlers.ts +102 -0
- package/src/live/InboxHeader.tsx +81 -0
- package/src/live/InboxModel.ts +81 -0
- package/src/live/InboxRow.tsx +125 -0
- package/src/live/MeetingRoom.tsx +22 -0
- package/src/live/MeetingRoomControlBar.tsx +197 -0
- package/src/live/MeetingRoomHandlers.ts +53 -0
- package/src/live/MeetingRoomLayout.tsx +27 -0
- package/src/live/MeetingRoomModel.ts +49 -0
- package/src/live/MeetingRoomMount.ts +49 -0
- package/src/live/MeetingRoomParts.tsx +178 -0
- package/src/live/MeetingRoomPerson.tsx +21 -0
- package/src/live/MeetingRoomState.ts +88 -0
- package/src/live/MeetingRoomTile.tsx +84 -0
- package/src/live/MeetingRoomTypes.ts +68 -0
- package/src/live/MeetingRoomView.tsx +36 -0
- package/src/live/NotificationPreferences.tsx +99 -0
- package/src/live/NotificationPreferencesActions.ts +55 -0
- package/src/live/NotificationPreferencesCell.tsx +26 -0
- package/src/live/NotificationPreferencesCells.tsx +59 -0
- package/src/live/NotificationPreferencesGrid.tsx +129 -0
- package/src/live/NotificationPreferencesModel.tsx +91 -0
- package/src/live/NotificationPreferencesSave.ts +85 -0
- package/src/live/NotificationPreferencesWatch.ts +31 -0
- package/src/live/Prejoin.tsx +238 -0
- package/src/live/PrejoinMeter.tsx +26 -0
- package/src/live/PrejoinPreview.tsx +53 -0
- package/src/live/PushSoftAsk.tsx +63 -0
- package/src/live/TransportPicker.tsx +341 -0
- package/src/live/TransportPickerDetails.tsx +130 -0
- package/src/live/index.ts +31 -0
- package/src/live/notify.tsx +22 -0
- package/src/live/shared.tsx +110 -0
- package/src/parts.tsx +199 -0
- package/src/plugin/catalog.mjs +129 -0
- package/src/plugin/dtcg.mjs +79 -0
- package/src/plugin/icons.mjs +7 -0
- package/src/plugin/seed.mjs +40 -0
- package/src/plugin/theme-context.mjs +44 -0
- package/src/plugin/theme-css.mjs +143 -0
- package/src/plugin/theme-motion.mjs +43 -0
- package/src/plugin/theme-parts.d.mts +41 -0
- package/src/plugin/theme-parts.mjs +224 -0
- package/src/plugin/theme-text.mjs +93 -0
- package/src/plugin/theme-values.mjs +15 -0
- package/src/plugin/theme.d.mts +82 -0
- package/src/plugin/theme.mjs +316 -0
- package/src/schedule/Agenda.tsx +124 -0
- package/src/schedule/AgendaActions.ts +31 -0
- package/src/schedule/AgendaDay.tsx +124 -0
- package/src/schedule/AgendaGestures.ts +27 -0
- package/src/schedule/AgendaKeys.ts +52 -0
- package/src/schedule/AgendaModel.ts +82 -0
- package/src/schedule/AgendaNavigation.ts +38 -0
- package/src/schedule/AgendaPage.tsx +39 -0
- package/src/schedule/AgendaStrip.tsx +55 -0
- package/src/schedule/AvailabilityEditor-actions.ts +146 -0
- package/src/schedule/AvailabilityEditor-day.tsx +119 -0
- package/src/schedule/AvailabilityEditor-view.tsx +205 -0
- package/src/schedule/AvailabilityEditor.tsx +113 -0
- package/src/schedule/BookingCalendar.tsx +121 -0
- package/src/schedule/BookingCalendarActions.ts +85 -0
- package/src/schedule/BookingCalendarModel.ts +86 -0
- package/src/schedule/BookingCalendarParts.tsx +87 -0
- package/src/schedule/Calendar/AgendaView.tsx +45 -0
- package/src/schedule/Calendar/CalendarDialogs.tsx +105 -0
- package/src/schedule/Calendar/CalendarMain.tsx +47 -0
- package/src/schedule/Calendar/CalendarToolbar.tsx +106 -0
- package/src/schedule/Calendar/Column.tsx +129 -0
- package/src/schedule/Calendar/EventBlock.tsx +71 -0
- package/src/schedule/Calendar/MiniMonth.tsx +169 -0
- package/src/schedule/Calendar/MonthGrid.tsx +296 -0
- package/src/schedule/Calendar/TimeGrid.tsx +252 -0
- package/src/schedule/Calendar/Timeline.tsx +287 -0
- package/src/schedule/Calendar/ZoneChip.tsx +73 -0
- package/src/schedule/Calendar/calendar-shell.ts +160 -0
- package/src/schedule/Calendar/calendar-state.ts +30 -0
- package/src/schedule/Calendar/now-spans.tsx +33 -0
- package/src/schedule/Calendar/shared.ts +3 -0
- package/src/schedule/Calendar/state-actions.ts +189 -0
- package/src/schedule/Calendar/state-base.ts +143 -0
- package/src/schedule/Calendar/state-keys.ts +128 -0
- package/src/schedule/Calendar/time-fit.ts +84 -0
- package/src/schedule/Calendar.tsx +182 -0
- package/src/schedule/EventEditor.tsx +267 -0
- package/src/schedule/EventPopover.tsx +190 -0
- package/src/schedule/MeetingPlanner-model.ts +222 -0
- package/src/schedule/MeetingPlanner-view.tsx +310 -0
- package/src/schedule/MeetingPlanner.tsx +122 -0
- package/src/schedule/MoveSheet.tsx +168 -0
- package/src/schedule/YearView-model.ts +164 -0
- package/src/schedule/YearView-parts.tsx +147 -0
- package/src/schedule/YearView.tsx +100 -0
- package/src/schedule/bits.tsx +65 -0
- package/src/schedule/index.ts +25 -0
- package/src/skeleton-css.ts +4 -0
- package/src/styles.ts +13 -0
- package/src/type.css +15 -0
- package/src/ui.ts +41 -0
- package/src/use-ui.ts +10 -0
- package/tailwind.css +38 -0
- package/tokens/color.mjs +87 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { ClockIcon, RefreshIcon } from '@kerf-js/veneer-icons'
|
|
2
|
+
import { announce, copyText } from '@kerf-js/veneer-core'
|
|
3
|
+
import { derived, state, untrack, watch } from '@kerf-js/core'
|
|
4
|
+
import { Button, type ButtonProps } from '../Button'
|
|
5
|
+
import { Search, Textarea } from '../Field'
|
|
6
|
+
import { toast } from '../Toast'
|
|
7
|
+
import { Broken, Whole, Locked, Head, RequestId } from './SystemPage/art'
|
|
8
|
+
import { AccountMenu } from './SystemPage/accounts'
|
|
9
|
+
import '../styles'
|
|
10
|
+
import '@kerf-js/veneer-core/styles/flows/tokens.css'
|
|
11
|
+
import '@kerf-js/veneer-core/styles/flows/base.css'
|
|
12
|
+
import '@kerf-js/veneer-core/styles/app/tokens.css'
|
|
13
|
+
import '@kerf-js/veneer-core/styles/app/system-page.css'
|
|
14
|
+
import '@kerf-js/veneer-core/styles/flows/system-page.css'
|
|
15
|
+
|
|
16
|
+
/** An account to switch to from a no-access page. */
|
|
17
|
+
export interface SwitchAccount {
|
|
18
|
+
id: string
|
|
19
|
+
email: string
|
|
20
|
+
detail?: string
|
|
21
|
+
hasAccess?: boolean
|
|
22
|
+
current?: boolean | undefined
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** An access request, and how to send and withdraw it. */
|
|
26
|
+
export interface AccessRequest {
|
|
27
|
+
/** The workspace takes access requests (default true). */
|
|
28
|
+
allowed?: boolean
|
|
29
|
+
/** A request is out: from the server, or set here after `onSend`. */
|
|
30
|
+
pending?: boolean | undefined
|
|
31
|
+
/** Who answers: "Kofi and Ana". */
|
|
32
|
+
approvers?: string
|
|
33
|
+
onSend?: ((note: string) => unknown) | undefined
|
|
34
|
+
onWithdraw?: () => unknown
|
|
35
|
+
/** "Copy link for the owner". */
|
|
36
|
+
link?: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Props for SystemPage. */
|
|
40
|
+
export interface SystemPageProps {
|
|
41
|
+
kind: '404' | '403' | '500' | 'maintenance' | 'empty'
|
|
42
|
+
title?: unknown
|
|
43
|
+
description?: unknown
|
|
44
|
+
/** The eyebrow, when the default won't do. */
|
|
45
|
+
code?: unknown
|
|
46
|
+
/** The primary action's label and press (or `href`). */
|
|
47
|
+
primary?: {
|
|
48
|
+
label: unknown
|
|
49
|
+
onClick?: (() => void) | undefined
|
|
50
|
+
href?: string
|
|
51
|
+
loading?: boolean | undefined
|
|
52
|
+
}
|
|
53
|
+
secondary?: { label: unknown; onClick?: (() => void) | undefined; href?: string }
|
|
54
|
+
/** 404: the search field. */
|
|
55
|
+
onSearch?: (q: string) => void
|
|
56
|
+
/** The 404 search field's label. Default "Search". */
|
|
57
|
+
searchLabel?: string
|
|
58
|
+
/** 500: `retry` from `<Boundary>`. */
|
|
59
|
+
onRetry?: (() => void) | undefined
|
|
60
|
+
/** The error, for the Boundary form; its message is never shown. */
|
|
61
|
+
error?: unknown
|
|
62
|
+
/** The support line. */
|
|
63
|
+
requestId?: string
|
|
64
|
+
/** Extra support text: a path, an incident. */
|
|
65
|
+
meta?: unknown
|
|
66
|
+
/** Maintenance: "Back at 14:00 UTC", and the local-time line in `description`. */
|
|
67
|
+
backAt?: unknown
|
|
68
|
+
/** 403: what was asked for and by whom. */
|
|
69
|
+
object?: { title: string; owner?: string }
|
|
70
|
+
/** 403: the signed-in account, as in "You're signed in as ana@kerf.dev". */
|
|
71
|
+
account?: string
|
|
72
|
+
/** 403: the access request: who approves it, whether it is pending, and what sending or withdrawing does. */
|
|
73
|
+
request?: AccessRequest
|
|
74
|
+
/** 403: other signed-in accounts, offered in a Switch account menu. */
|
|
75
|
+
accounts?: SwitchAccount[]
|
|
76
|
+
/** Called with the account picked, or undefined to sign in as someone else. */
|
|
77
|
+
onSwitch?: (id: string | undefined) => void
|
|
78
|
+
/** 403: access came through: `children` is the object, loaded in place. */
|
|
79
|
+
granted?: boolean
|
|
80
|
+
as?: 'h2' | 'h3' | undefined
|
|
81
|
+
/** Focus the title on load, so the route change is heard (default: 403). */
|
|
82
|
+
autofocus?: boolean
|
|
83
|
+
children?: unknown
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const TITLES = {
|
|
87
|
+
404: "We can't find that page",
|
|
88
|
+
403: "You don't have access",
|
|
89
|
+
500: 'Something went wrong on our side',
|
|
90
|
+
maintenance: 'Back soon',
|
|
91
|
+
empty: 'Nothing here yet',
|
|
92
|
+
}
|
|
93
|
+
const CODES = {
|
|
94
|
+
404: '404 · Not found',
|
|
95
|
+
403: '403 · No access',
|
|
96
|
+
500: '500 · Server error',
|
|
97
|
+
maintenance: 'Scheduled maintenance',
|
|
98
|
+
empty: 'First run',
|
|
99
|
+
}
|
|
100
|
+
const COPY = {
|
|
101
|
+
404: 'The link may be old, or the page has moved. Search for it, or head back to your dashboard.',
|
|
102
|
+
403: 'Ask an admin for access, or switch to an account that has it.',
|
|
103
|
+
500: "Your work is saved. We've been alerted and are looking at it now.",
|
|
104
|
+
maintenance: 'Nothing is lost, and nothing you saved is affected.',
|
|
105
|
+
empty: undefined,
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function Act({
|
|
109
|
+
a,
|
|
110
|
+
emphasis,
|
|
111
|
+
tone,
|
|
112
|
+
}: {
|
|
113
|
+
a: {
|
|
114
|
+
label: unknown
|
|
115
|
+
onClick?: (() => void) | undefined
|
|
116
|
+
href?: string
|
|
117
|
+
loading?: boolean | undefined
|
|
118
|
+
}
|
|
119
|
+
emphasis?: ButtonProps['emphasis'] | undefined
|
|
120
|
+
tone?: ButtonProps['tone']
|
|
121
|
+
}) {
|
|
122
|
+
const href = derived(() => a.href)
|
|
123
|
+
return (
|
|
124
|
+
<Button
|
|
125
|
+
emphasis={emphasis}
|
|
126
|
+
tone={tone}
|
|
127
|
+
loading={a.loading}
|
|
128
|
+
role={href.value ? 'link' : undefined}
|
|
129
|
+
onClick={() => (href.value ? location.assign(href.value) : a.onClick?.())}
|
|
130
|
+
>
|
|
131
|
+
{a.label}
|
|
132
|
+
</Button>
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** 403's four states (07 §6.5): can request (then a note), pending, can't request, granted in place. */
|
|
137
|
+
function accountSwitch(p: SystemPageProps, accounts: ReturnType<typeof AccountMenu>) {
|
|
138
|
+
return () =>
|
|
139
|
+
p.accounts?.length ? (
|
|
140
|
+
<Button
|
|
141
|
+
emphasis="ghost"
|
|
142
|
+
tone="neutral"
|
|
143
|
+
data-switch=""
|
|
144
|
+
aria-haspopup="menu"
|
|
145
|
+
aria-expanded={accounts.open.value ? 'true' : 'false'}
|
|
146
|
+
aria-controls={accounts.id}
|
|
147
|
+
onClick={accounts.press}
|
|
148
|
+
>
|
|
149
|
+
Switch account
|
|
150
|
+
</Button>
|
|
151
|
+
) : p.onSwitch ? (
|
|
152
|
+
<Button emphasis="ghost" tone="neutral" onClick={() => p.onSwitch!(undefined)}>
|
|
153
|
+
Switch account
|
|
154
|
+
</Button>
|
|
155
|
+
) : null
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async function copyOwnerLink(p: SystemPageProps, approvers: ReturnType<typeof derived<string>>) {
|
|
159
|
+
await copyText(document, p.request?.link ?? location.href)
|
|
160
|
+
announce(document, `Link copied. Send it to ${approvers.value}.`)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function deniedState(p: SystemPageProps) {
|
|
164
|
+
const compose = state(false)
|
|
165
|
+
const sent = state(false)
|
|
166
|
+
const note = state('')
|
|
167
|
+
const busy = state(false)
|
|
168
|
+
const name = untrack(() => p.object?.title)
|
|
169
|
+
const titleOf = name ? `You don't have access to ${name}` : TITLES[403]
|
|
170
|
+
const approvers = derived(() => p.request?.approvers ?? p.object?.owner ?? 'the owner')
|
|
171
|
+
const pending = derived(() => !!((p.request?.pending as unknown) ?? sent.value))
|
|
172
|
+
const allowed = derived(() => p.request?.allowed !== false)
|
|
173
|
+
const view = derived(() =>
|
|
174
|
+
p.granted
|
|
175
|
+
? 'granted'
|
|
176
|
+
: pending.value
|
|
177
|
+
? 'pending'
|
|
178
|
+
: !allowed.value
|
|
179
|
+
? 'closed'
|
|
180
|
+
: compose.value
|
|
181
|
+
? 'compose'
|
|
182
|
+
: 'request',
|
|
183
|
+
)
|
|
184
|
+
let root: HTMLElement | undefined
|
|
185
|
+
const accounts = AccountMenu({
|
|
186
|
+
accounts: untrack(() => p.accounts ?? []),
|
|
187
|
+
onSwitch: (id) => p.onSwitch?.(id),
|
|
188
|
+
})
|
|
189
|
+
watch(
|
|
190
|
+
() => view.value,
|
|
191
|
+
(v, was) => {
|
|
192
|
+
if (was === undefined) return
|
|
193
|
+
queueMicrotask(() =>
|
|
194
|
+
root
|
|
195
|
+
?.querySelector<HTMLElement>(v === 'compose' ? 'textarea' : '[data-part="title"]')
|
|
196
|
+
?.focus({ preventScroll: true }),
|
|
197
|
+
)
|
|
198
|
+
if (v === 'granted')
|
|
199
|
+
toast.show({
|
|
200
|
+
title: `${p.object?.owner ?? 'The owner'} gave you access`,
|
|
201
|
+
description: `${name ?? 'It'} is open.`,
|
|
202
|
+
tone: 'positive',
|
|
203
|
+
})
|
|
204
|
+
},
|
|
205
|
+
)
|
|
206
|
+
const send = async () => {
|
|
207
|
+
busy.value = true
|
|
208
|
+
try {
|
|
209
|
+
await p.request?.onSend?.(note.value)
|
|
210
|
+
sent.value = true
|
|
211
|
+
compose.value = false
|
|
212
|
+
announce(document, `Request sent to ${approvers.value}. We'll email you when they answer.`)
|
|
213
|
+
} finally {
|
|
214
|
+
busy.value = false
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const withdraw = async () => {
|
|
218
|
+
await p.request?.onWithdraw?.()
|
|
219
|
+
sent.value = false
|
|
220
|
+
note.value = ''
|
|
221
|
+
announce(document, 'Request withdrawn')
|
|
222
|
+
}
|
|
223
|
+
const copyLink = () => copyOwnerLink(p, approvers)
|
|
224
|
+
const Switch = accountSwitch(p, accounts)
|
|
225
|
+
return {
|
|
226
|
+
view,
|
|
227
|
+
compose,
|
|
228
|
+
note,
|
|
229
|
+
busy,
|
|
230
|
+
approvers,
|
|
231
|
+
accounts,
|
|
232
|
+
send,
|
|
233
|
+
withdraw,
|
|
234
|
+
copyLink,
|
|
235
|
+
titleOf,
|
|
236
|
+
Switch,
|
|
237
|
+
setRoot: (n: HTMLElement) => {
|
|
238
|
+
root = n
|
|
239
|
+
},
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function deniedNote(note: ReturnType<typeof state<string>>) {
|
|
244
|
+
return (
|
|
245
|
+
<Textarea
|
|
246
|
+
label="Note (optional)"
|
|
247
|
+
hint="They'll see it with your request"
|
|
248
|
+
counter={280}
|
|
249
|
+
maxlength="280"
|
|
250
|
+
value={note.value}
|
|
251
|
+
onInput={(e) => (note.value = e.currentTarget.value)}
|
|
252
|
+
/>
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function deniedView(p: SystemPageProps, ctx: ReturnType<typeof deniedState>) {
|
|
257
|
+
return (
|
|
258
|
+
<>
|
|
259
|
+
{ctx.view.value === 'granted' ? (
|
|
260
|
+
p.children
|
|
261
|
+
) : (
|
|
262
|
+
<div ref={(n) => ctx.setRoot(n)} data-scope="system-page">
|
|
263
|
+
<div data-part="body">
|
|
264
|
+
<Head
|
|
265
|
+
art={<Locked />}
|
|
266
|
+
code={p.code ?? CODES[403]}
|
|
267
|
+
as={p.as}
|
|
268
|
+
focus={p.autofocus ?? true}
|
|
269
|
+
title={ctx.view.value === 'pending' ? 'Request sent' : (p.title ?? ctx.titleOf)}
|
|
270
|
+
/>
|
|
271
|
+
{ctx.view.value === 'request' && (
|
|
272
|
+
<p>
|
|
273
|
+
{p.description ?? (
|
|
274
|
+
<>
|
|
275
|
+
{p.account ? `You're signed in as ${p.account}. ` : ''}Ask the owner for access,
|
|
276
|
+
or switch to an account that has it.
|
|
277
|
+
</>
|
|
278
|
+
)}
|
|
279
|
+
</p>
|
|
280
|
+
)}
|
|
281
|
+
{ctx.view.value === 'compose' && (
|
|
282
|
+
<p>{ctx.approvers.value} can share it. Add a note if it helps them decide.</p>
|
|
283
|
+
)}
|
|
284
|
+
{ctx.view.value === 'closed' && (
|
|
285
|
+
<p>
|
|
286
|
+
This workspace doesn't take access requests. Ask {ctx.approvers.value} to share it
|
|
287
|
+
{p.account ? ` with ${p.account}` : ''}.
|
|
288
|
+
</p>
|
|
289
|
+
)}
|
|
290
|
+
{ctx.view.value === 'pending' && (
|
|
291
|
+
<span data-part="pending" role="status">
|
|
292
|
+
<ClockIcon /> Request sent to {ctx.approvers.value} · we'll email you when they
|
|
293
|
+
answer
|
|
294
|
+
</span>
|
|
295
|
+
)}
|
|
296
|
+
{ctx.view.value === 'compose' ? (
|
|
297
|
+
<div data-part="request">
|
|
298
|
+
{deniedNote(ctx.note)}
|
|
299
|
+
<div data-part="actions">
|
|
300
|
+
<Button
|
|
301
|
+
emphasis="ghost"
|
|
302
|
+
tone="neutral"
|
|
303
|
+
onClick={() => (ctx.compose.value = false)}
|
|
304
|
+
>
|
|
305
|
+
Cancel
|
|
306
|
+
</Button>
|
|
307
|
+
<Button loading={ctx.busy.value} onClick={ctx.send}>
|
|
308
|
+
Send request
|
|
309
|
+
</Button>
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
) : (
|
|
313
|
+
<div data-part="actions">
|
|
314
|
+
{ctx.view.value === 'request' && (
|
|
315
|
+
<Button onClick={() => (ctx.compose.value = true)}>Request access</Button>
|
|
316
|
+
)}
|
|
317
|
+
{ctx.view.value === 'pending' && (
|
|
318
|
+
<Button emphasis="outline" tone="neutral" onClick={ctx.withdraw}>
|
|
319
|
+
Withdraw request
|
|
320
|
+
</Button>
|
|
321
|
+
)}
|
|
322
|
+
{ctx.view.value === 'closed' && (
|
|
323
|
+
<Button onClick={ctx.copyLink}>Copy link for the owner</Button>
|
|
324
|
+
)}
|
|
325
|
+
<ctx.Switch />
|
|
326
|
+
</div>
|
|
327
|
+
)}
|
|
328
|
+
{ctx.accounts.menu()}
|
|
329
|
+
{p.requestId && <RequestId id={p.requestId} />}
|
|
330
|
+
</div>
|
|
331
|
+
</div>
|
|
332
|
+
)}
|
|
333
|
+
</>
|
|
334
|
+
)
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function Denied(p: SystemPageProps) {
|
|
338
|
+
const props = untrack(() => p)
|
|
339
|
+
const ctx = deniedState(props)
|
|
340
|
+
return deniedView(props, ctx)
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* A result page (09 §5.1): art, code, title, one sentence, one primary, one secondary, the support line. It sits inside
|
|
345
|
+
* the app shell, so navigation still works. `<Boundary error={(e, retry) => <SystemPage kind="500" error={e} onRetry={retry} />}>`
|
|
346
|
+
* at the route level; 403 is the sharing state of 07 §6.5, and never shown to outsiders (they get the 404).
|
|
347
|
+
*/
|
|
348
|
+
export function SystemPage(p: SystemPageProps) {
|
|
349
|
+
const kind = untrack(() => p.kind)
|
|
350
|
+
if (kind === '403') return <Denied {...p} />
|
|
351
|
+
const text = derived(() => p.description ?? COPY[kind])
|
|
352
|
+
const home = derived(() => p.secondary)
|
|
353
|
+
return (
|
|
354
|
+
<div data-scope="system-page">
|
|
355
|
+
<div data-part="body">
|
|
356
|
+
<Head
|
|
357
|
+
art={kind === 'empty' ? <Whole /> : <Broken />}
|
|
358
|
+
code={p.code ?? CODES[kind]}
|
|
359
|
+
as={p.as}
|
|
360
|
+
focus={p.autofocus}
|
|
361
|
+
title={
|
|
362
|
+
p.title ??
|
|
363
|
+
(kind === 'maintenance' && p.backAt ? `Back at ${p.backAt as string}` : TITLES[kind])
|
|
364
|
+
}
|
|
365
|
+
/>
|
|
366
|
+
{text.value !== undefined && <p>{text.value}</p>}
|
|
367
|
+
{kind === '404' && p.onSearch && (
|
|
368
|
+
<form
|
|
369
|
+
data-part="search"
|
|
370
|
+
novalidate
|
|
371
|
+
onSubmit={(e: SubmitEvent) => {
|
|
372
|
+
e.preventDefault()
|
|
373
|
+
p.onSearch!(new FormData(e.currentTarget as HTMLFormElement).get('q') as string)
|
|
374
|
+
}}
|
|
375
|
+
>
|
|
376
|
+
<Search label={p.searchLabel ?? 'Search'} name="q" />
|
|
377
|
+
</form>
|
|
378
|
+
)}
|
|
379
|
+
<div data-part="actions">
|
|
380
|
+
{kind === '500' && p.onRetry && (
|
|
381
|
+
<Button onClick={p.onRetry}>
|
|
382
|
+
<RefreshIcon />
|
|
383
|
+
Try again
|
|
384
|
+
</Button>
|
|
385
|
+
)}
|
|
386
|
+
{p.primary && <Act a={p.primary} />}
|
|
387
|
+
{home.value && <Act a={home.value} emphasis="frame" />}
|
|
388
|
+
</div>
|
|
389
|
+
{p.meta !== undefined && <span data-part="meta">{p.meta}</span>}
|
|
390
|
+
{p.requestId && <RequestId id={p.requestId} />}
|
|
391
|
+
{p.children}
|
|
392
|
+
</div>
|
|
393
|
+
</div>
|
|
394
|
+
)
|
|
395
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { announce, coachSpot, tourSpot, uid } from '@kerf-js/veneer-core'
|
|
2
|
+
import { derived, state, untrack, watch, type State } from '@kerf-js/core'
|
|
3
|
+
import { Button } from '../Button'
|
|
4
|
+
import { bindable } from '../Picker'
|
|
5
|
+
import { use } from '@kerf-js/veneer-core/kerf'
|
|
6
|
+
import '../styles'
|
|
7
|
+
import '@kerf-js/veneer-core/styles/flows/tokens.css'
|
|
8
|
+
import '@kerf-js/veneer-core/styles/flows/base.css'
|
|
9
|
+
import '@kerf-js/veneer-core/styles/components/tour.css'
|
|
10
|
+
import '@kerf-js/veneer-core/styles/flows/tour.css'
|
|
11
|
+
|
|
12
|
+
/** One stop of a tour. */
|
|
13
|
+
export interface TourStep {
|
|
14
|
+
/** A CSS selector: `[data-tour=new]`. */
|
|
15
|
+
target: string
|
|
16
|
+
title: unknown
|
|
17
|
+
body: unknown
|
|
18
|
+
/** The target stays pressable ("Try it: click New"). */
|
|
19
|
+
interactive?: boolean | undefined
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Props for Tour. */
|
|
23
|
+
export interface TourProps {
|
|
24
|
+
id?: string
|
|
25
|
+
steps: TourStep[]
|
|
26
|
+
open?: State<boolean> | boolean
|
|
27
|
+
/** Ran to the end. */
|
|
28
|
+
onDone?: () => void
|
|
29
|
+
/** Skip or Escape. */
|
|
30
|
+
onSkip?: () => void
|
|
31
|
+
onStepChange?: ((index: number) => void) | undefined
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function Running({
|
|
35
|
+
steps,
|
|
36
|
+
onEnd,
|
|
37
|
+
onStepChange,
|
|
38
|
+
}: {
|
|
39
|
+
steps: TourStep[]
|
|
40
|
+
onEnd: (done: boolean) => void
|
|
41
|
+
onStepChange?: ((i: number) => void) | undefined
|
|
42
|
+
}) {
|
|
43
|
+
const id = uid('tour')
|
|
44
|
+
const list = untrack(() => steps)
|
|
45
|
+
const at = state(0)
|
|
46
|
+
const way = state(1)
|
|
47
|
+
const step = derived(() => list[at.value])
|
|
48
|
+
const many = list.length > 1
|
|
49
|
+
const go = (i: number, dir = 1) => {
|
|
50
|
+
way.value = dir
|
|
51
|
+
if (i < 0) return
|
|
52
|
+
if (i >= list.length) return onEnd(true)
|
|
53
|
+
at.value = i
|
|
54
|
+
onStepChange?.(i)
|
|
55
|
+
}
|
|
56
|
+
watchTour(at, list, many)
|
|
57
|
+
let root: HTMLDivElement | undefined
|
|
58
|
+
use(
|
|
59
|
+
tourSpot,
|
|
60
|
+
() => root,
|
|
61
|
+
() => ({
|
|
62
|
+
target: step.value!.target,
|
|
63
|
+
step: at.value,
|
|
64
|
+
interactive: step.value!.interactive,
|
|
65
|
+
onNext: () => go(at.value + 1),
|
|
66
|
+
onPrev: () => go(at.value - 1, -1),
|
|
67
|
+
onClose: () => onEnd(false),
|
|
68
|
+
onMissing: () =>
|
|
69
|
+
way.value < 0 && at.value === 0 ? onEnd(false) : go(at.value + way.value, way.value),
|
|
70
|
+
onBlocked: () => onEnd(false),
|
|
71
|
+
}),
|
|
72
|
+
)
|
|
73
|
+
return (
|
|
74
|
+
<div ref={(n) => (root = n)} data-scope="tour">
|
|
75
|
+
<div data-part="spotlight" data-sweep="" data-hold="">
|
|
76
|
+
<span data-part="sweep-base" aria-hidden="true"></span>
|
|
77
|
+
<span data-part="sweep" aria-hidden="true"></span>
|
|
78
|
+
</div>
|
|
79
|
+
<div
|
|
80
|
+
data-part="card"
|
|
81
|
+
role="dialog"
|
|
82
|
+
aria-modal="false"
|
|
83
|
+
aria-labelledby={`${id}-t`}
|
|
84
|
+
aria-describedby={`${id}-d`}
|
|
85
|
+
>
|
|
86
|
+
<span data-part="step-count">
|
|
87
|
+
{many ? `Step ${at.value + 1} of ${list.length}` : 'Tip'}
|
|
88
|
+
</span>
|
|
89
|
+
<h4 id={`${id}-t`} tabindex="-1" aria-level="2">
|
|
90
|
+
{step.value!.title}
|
|
91
|
+
</h4>
|
|
92
|
+
<p id={`${id}-d`}>{step.value!.body}</p>
|
|
93
|
+
<footer>
|
|
94
|
+
<span data-part="pips" aria-hidden="true">
|
|
95
|
+
{many &&
|
|
96
|
+
list.map((s, i) => <i key={s.target} data-on={i === at.value ? '' : undefined}></i>)}
|
|
97
|
+
</span>
|
|
98
|
+
<Button emphasis="ghost" tone="neutral" size="sm" onClick={() => onEnd(false)}>
|
|
99
|
+
Skip tour
|
|
100
|
+
</Button>
|
|
101
|
+
{at.value > 0 && (
|
|
102
|
+
<Button emphasis="ghost" tone="neutral" size="sm" onClick={() => go(at.value - 1, -1)}>
|
|
103
|
+
Back
|
|
104
|
+
</Button>
|
|
105
|
+
)}
|
|
106
|
+
<Button size="sm" onClick={() => go(at.value + 1)}>
|
|
107
|
+
{at.value === list.length - 1 ? 'Done' : 'Next'}
|
|
108
|
+
</Button>
|
|
109
|
+
</footer>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The product tour (09 §3.2): a spotlight cut by the scrim, a ring that draws on arrival, a card beside the target
|
|
117
|
+
* (docked on a phone). A missing target skips its step; it starts only on request and never over another overlay; Esc
|
|
118
|
+
* ends it and focus returns to where it began.
|
|
119
|
+
*/
|
|
120
|
+
export function Tour({ steps, open, onDone, onSkip, onStepChange }: TourProps) {
|
|
121
|
+
const on = bindable<boolean>(
|
|
122
|
+
() => open,
|
|
123
|
+
() => false,
|
|
124
|
+
false,
|
|
125
|
+
)
|
|
126
|
+
const end = (done: boolean) => {
|
|
127
|
+
on.set(false)
|
|
128
|
+
;(done ? onDone : onSkip)?.()
|
|
129
|
+
}
|
|
130
|
+
return <>{on.value && <Running steps={steps} onEnd={end} onStepChange={onStepChange} />}</>
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** A coachmark (09 §3.2): one tip with no scrim: a beacon on the target, the card on a press. Persisting the dismissal is the app's (`onDismiss`). */
|
|
134
|
+
export function Coachmark({
|
|
135
|
+
target,
|
|
136
|
+
title,
|
|
137
|
+
body,
|
|
138
|
+
onDismiss,
|
|
139
|
+
}: {
|
|
140
|
+
target: string
|
|
141
|
+
title: unknown
|
|
142
|
+
body: unknown
|
|
143
|
+
onDismiss?: () => void
|
|
144
|
+
}) {
|
|
145
|
+
const id = uid('coach')
|
|
146
|
+
const open = state(false)
|
|
147
|
+
const gone = state(false)
|
|
148
|
+
let root: HTMLDivElement | undefined
|
|
149
|
+
use(
|
|
150
|
+
coachSpot,
|
|
151
|
+
() => root,
|
|
152
|
+
() => ({ target, open: open.value, onClose: () => (open.value = false) }),
|
|
153
|
+
)
|
|
154
|
+
return (
|
|
155
|
+
<div ref={(n) => (root = n)} data-scope="tour" hidden={gone.value || undefined}>
|
|
156
|
+
<button
|
|
157
|
+
type="button"
|
|
158
|
+
data-scope="button"
|
|
159
|
+
data-emphasis="ghost"
|
|
160
|
+
data-tone="neutral"
|
|
161
|
+
data-size="sm"
|
|
162
|
+
data-icon-only=""
|
|
163
|
+
data-beacon=""
|
|
164
|
+
aria-label="Show tip"
|
|
165
|
+
aria-expanded={open.value ? 'true' : 'false'}
|
|
166
|
+
onClick={() => (open.value = !open.value)}
|
|
167
|
+
>
|
|
168
|
+
<span data-part="beacon" aria-hidden="true"></span>
|
|
169
|
+
</button>
|
|
170
|
+
{open.value && (
|
|
171
|
+
<div data-part="card" role="dialog" aria-modal="false" aria-labelledby={`${id}-t`}>
|
|
172
|
+
<span data-part="step-count">Tip</span>
|
|
173
|
+
<h4 id={`${id}-t`} tabindex="-1" aria-level="2">
|
|
174
|
+
{title}
|
|
175
|
+
</h4>
|
|
176
|
+
<p>{body}</p>
|
|
177
|
+
<footer>
|
|
178
|
+
<span data-part="pips"></span>
|
|
179
|
+
<Button
|
|
180
|
+
size="sm"
|
|
181
|
+
onClick={() => {
|
|
182
|
+
open.value = false
|
|
183
|
+
gone.value = true
|
|
184
|
+
onDismiss?.()
|
|
185
|
+
}}
|
|
186
|
+
>
|
|
187
|
+
Got it
|
|
188
|
+
</Button>
|
|
189
|
+
</footer>
|
|
190
|
+
</div>
|
|
191
|
+
)}
|
|
192
|
+
</div>
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function watchTour(at: State<number>, list: TourStep[], many: boolean) {
|
|
197
|
+
watch(
|
|
198
|
+
() => at.value,
|
|
199
|
+
(i) => {
|
|
200
|
+
if (typeof document === 'object')
|
|
201
|
+
announce(
|
|
202
|
+
document,
|
|
203
|
+
`${many ? `Step ${i + 1} of ${list.length}. ` : ''}${typeof list[i]!.title === 'string' ? list[i]!.title : ''}`,
|
|
204
|
+
)
|
|
205
|
+
},
|
|
206
|
+
)
|
|
207
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// The flow pack: see docs/design/veneer. One file per component family; each imports only its own CSS.
|
|
2
|
+
export { Flow, type FlowProps, type FlowStep } from './Flow'
|
|
3
|
+
export { AuthScreen } from './AuthScreen'
|
|
4
|
+
export { SignIn, type SignInProps, type SignInValues } from './SignIn'
|
|
5
|
+
export { SignUp, PasswordMeter, type SignUpProps, type SignUpValues } from './SignUp'
|
|
6
|
+
export { OtpField, OtpStep, type OtpFieldProps, type OtpStepProps, type OtpValues } from './Otp'
|
|
7
|
+
export {
|
|
8
|
+
MagicLinkSent,
|
|
9
|
+
ResetPassword,
|
|
10
|
+
InviteAccept,
|
|
11
|
+
AuthDone,
|
|
12
|
+
type ResetPasswordProps,
|
|
13
|
+
type ResetValues,
|
|
14
|
+
} from './AuthSteps'
|
|
15
|
+
export { ReauthDialog, type ReauthProps } from './ReauthDialog'
|
|
16
|
+
export { PasskeyButton, SsoButtons, type SsoProvider } from './Sso'
|
|
17
|
+
export { MfaSetup, type MfaSetupProps } from './MfaSetup'
|
|
18
|
+
export { SignGate, SignGateBadge, type SignGateProps, type SignStatus } from './SignGate'
|
|
19
|
+
export { Checklist, type ChecklistProps, type ChecklistItem } from './Checklist'
|
|
20
|
+
export { Tour, Coachmark, type TourProps, type TourStep } from './Tour'
|
|
21
|
+
export {
|
|
22
|
+
SystemPage,
|
|
23
|
+
type SystemPageProps,
|
|
24
|
+
type AccessRequest,
|
|
25
|
+
type SwitchAccount,
|
|
26
|
+
} from './SystemPage'
|
|
27
|
+
export { ConnBanner, RateLimited, type ConnBannerProps, type RateLimitedProps } from './ConnBanner'
|
|
28
|
+
export { ShortcutsOverlay } from './ShortcutsOverlay'
|
|
29
|
+
export { useCooldown, type FlowForm, type FormLike } from './kit'
|