@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,145 @@
|
|
|
1
|
+
import { untrack } from '@kerf-js/core'
|
|
2
|
+
import { uid } from '@kerf-js/veneer-core'
|
|
3
|
+
import { Glyph } from '../parts'
|
|
4
|
+
import '../styles'
|
|
5
|
+
import '@kerf-js/veneer-core/styles/flows/tokens.css'
|
|
6
|
+
import '@kerf-js/veneer-core/styles/flows/base.css'
|
|
7
|
+
import '@kerf-js/veneer-core/styles/rich/helpers.css'
|
|
8
|
+
import '@kerf-js/veneer-core/styles/layout/tokens.css'
|
|
9
|
+
import '@kerf-js/veneer-core/styles/layout/row.css'
|
|
10
|
+
import '@kerf-js/veneer-core/styles/layout/stack.css'
|
|
11
|
+
import '@kerf-js/veneer-core/styles/flows/settings.css'
|
|
12
|
+
import '@kerf-js/veneer-core/styles/flows/settings-section.css'
|
|
13
|
+
import '@kerf-js/veneer-core/styles/flows/setting-row.css'
|
|
14
|
+
|
|
15
|
+
/** One link of the settings nav. */
|
|
16
|
+
export type SettingsNavItem = {
|
|
17
|
+
id: string
|
|
18
|
+
label: string
|
|
19
|
+
glyph?: string
|
|
20
|
+
tone?: 'critical' | undefined
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The settings frame (09 §4.1): a TabNav-like strip that becomes a sticky column at 760px of its own width, and a form
|
|
25
|
+
* holding the sections. A nav press scrolls to the section and moves focus to its heading.
|
|
26
|
+
*/
|
|
27
|
+
export function SettingsLayout({
|
|
28
|
+
label = 'Settings sections',
|
|
29
|
+
sections,
|
|
30
|
+
current,
|
|
31
|
+
onNavigate,
|
|
32
|
+
children,
|
|
33
|
+
}: {
|
|
34
|
+
label?: string | undefined
|
|
35
|
+
sections: SettingsNavItem[]
|
|
36
|
+
current: string
|
|
37
|
+
onNavigate?: (id: string) => void
|
|
38
|
+
children: unknown
|
|
39
|
+
}) {
|
|
40
|
+
const go = (e: MouseEvent, id: string) => {
|
|
41
|
+
e.preventDefault()
|
|
42
|
+
onNavigate?.(id)
|
|
43
|
+
const doc = (e.currentTarget as Element).ownerDocument
|
|
44
|
+
const sec = doc.getElementById(id)
|
|
45
|
+
const reduce = doc.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches
|
|
46
|
+
sec?.scrollIntoView?.({ behavior: reduce ? 'auto' : 'smooth', block: 'start' })
|
|
47
|
+
sec?.querySelector<HTMLElement>('header :is(h3, h4)')?.focus({ preventScroll: true })
|
|
48
|
+
}
|
|
49
|
+
return (
|
|
50
|
+
<div data-scope="settings">
|
|
51
|
+
<div data-part="layout">
|
|
52
|
+
<nav data-part="nav" aria-label={label}>
|
|
53
|
+
{sections.map((s) => (
|
|
54
|
+
<a
|
|
55
|
+
key={s.id}
|
|
56
|
+
href={`#${s.id}`}
|
|
57
|
+
data-tone={s.tone}
|
|
58
|
+
aria-current={s.id === current ? 'true' : undefined}
|
|
59
|
+
onClick={(e: MouseEvent) => go(e, s.id)}
|
|
60
|
+
>
|
|
61
|
+
{s.glyph && <Glyph d={s.glyph} />}
|
|
62
|
+
{s.label}
|
|
63
|
+
</a>
|
|
64
|
+
))}
|
|
65
|
+
</nav>
|
|
66
|
+
<form data-part="content" novalidate>
|
|
67
|
+
{children}
|
|
68
|
+
</form>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** A heading, one line, then one bordered group of rows (09 §4.1). `tone="critical"` is the danger zone's border. */
|
|
75
|
+
export function SettingsSection({
|
|
76
|
+
id,
|
|
77
|
+
title,
|
|
78
|
+
description,
|
|
79
|
+
tone,
|
|
80
|
+
as: heading = 'h3',
|
|
81
|
+
children,
|
|
82
|
+
}: {
|
|
83
|
+
id: string
|
|
84
|
+
title: unknown
|
|
85
|
+
description?: unknown
|
|
86
|
+
tone?: 'critical' | undefined
|
|
87
|
+
as?: 'h3' | 'h4' | undefined
|
|
88
|
+
children: unknown
|
|
89
|
+
}) {
|
|
90
|
+
return (
|
|
91
|
+
<section data-scope="settings-section" id={id} data-tone={tone} aria-labelledby={`${id}-h`}>
|
|
92
|
+
<header>
|
|
93
|
+
{heading === 'h4' ? (
|
|
94
|
+
<h4 id={`${id}-h`} tabindex="-1">
|
|
95
|
+
{title}
|
|
96
|
+
</h4>
|
|
97
|
+
) : (
|
|
98
|
+
<h3 id={`${id}-h`} tabindex="-1">
|
|
99
|
+
{title}
|
|
100
|
+
</h3>
|
|
101
|
+
)}
|
|
102
|
+
{description !== undefined && <p>{description}</p>}
|
|
103
|
+
</header>
|
|
104
|
+
<div data-part="group">{children}</div>
|
|
105
|
+
</section>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Label and help at the inline-start, the control at the inline-end, stacking under 520px (09 §4.1). `children` may be
|
|
111
|
+
* a function of the label's and help's ids, so a Switch can be labelled by them instead of repeating the words.
|
|
112
|
+
*/
|
|
113
|
+
export function SettingRow({
|
|
114
|
+
title,
|
|
115
|
+
description,
|
|
116
|
+
layout,
|
|
117
|
+
children,
|
|
118
|
+
}: {
|
|
119
|
+
title?: unknown
|
|
120
|
+
description?: unknown
|
|
121
|
+
layout?: 'stack'
|
|
122
|
+
children: unknown
|
|
123
|
+
}) {
|
|
124
|
+
const id = uid('row')
|
|
125
|
+
const body = () =>
|
|
126
|
+
typeof children === 'function'
|
|
127
|
+
? children({ label: `${id}-l`, description: `${id}-d` })
|
|
128
|
+
: children
|
|
129
|
+
const stacked = untrack(() => title === undefined)
|
|
130
|
+
if (stacked)
|
|
131
|
+
return (
|
|
132
|
+
<div data-scope="setting-row" data-layout={layout}>
|
|
133
|
+
{body()}
|
|
134
|
+
</div>
|
|
135
|
+
)
|
|
136
|
+
return (
|
|
137
|
+
<div data-scope="setting-row" data-layout={layout}>
|
|
138
|
+
<div>
|
|
139
|
+
<b id={`${id}-l`}>{title}</b>
|
|
140
|
+
<p id={`${id}-d`}>{description}</p>
|
|
141
|
+
</div>
|
|
142
|
+
<div data-part="control">{body()}</div>
|
|
143
|
+
</div>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { CheckIcon } from '@kerf-js/veneer-icons'
|
|
2
|
+
import { derived } from '@kerf-js/core'
|
|
3
|
+
import '../parts'
|
|
4
|
+
import '@kerf-js/veneer-core/styles/rich/helpers.css'
|
|
5
|
+
import '@kerf-js/veneer-core/styles/layout/tokens.css'
|
|
6
|
+
import '@kerf-js/veneer-core/styles/layout/row.css'
|
|
7
|
+
import '@kerf-js/veneer-core/styles/layout/stack.css'
|
|
8
|
+
import '@kerf-js/veneer-core/styles/components/progress.css'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Steps (05 §4) with the compact form 09 §6.2 asks for: steps.css hides the list under 520px and shows
|
|
12
|
+
* `[data-part="compact"]`, "Payment, step 4 of 5" over a bar, which parts' Steps doesn't render.
|
|
13
|
+
*/
|
|
14
|
+
export function StepBar({
|
|
15
|
+
label,
|
|
16
|
+
steps,
|
|
17
|
+
current,
|
|
18
|
+
error,
|
|
19
|
+
}: {
|
|
20
|
+
label: string
|
|
21
|
+
steps: { id: string; title: string }[]
|
|
22
|
+
current: number
|
|
23
|
+
error?: number
|
|
24
|
+
}) {
|
|
25
|
+
const at = derived(() => Math.min(current, steps.length - 1))
|
|
26
|
+
return (
|
|
27
|
+
<nav data-scope="steps" aria-label={label}>
|
|
28
|
+
<ol>
|
|
29
|
+
{steps.map((s, i) => (
|
|
30
|
+
<li
|
|
31
|
+
key={s.id}
|
|
32
|
+
data-part="item"
|
|
33
|
+
data-state={
|
|
34
|
+
i === error
|
|
35
|
+
? 'error'
|
|
36
|
+
: i < current
|
|
37
|
+
? 'complete'
|
|
38
|
+
: i === current
|
|
39
|
+
? 'current'
|
|
40
|
+
: undefined
|
|
41
|
+
}
|
|
42
|
+
aria-current={i === current ? 'step' : undefined}
|
|
43
|
+
>
|
|
44
|
+
<span data-part="indicator">
|
|
45
|
+
<CheckIcon />
|
|
46
|
+
</span>
|
|
47
|
+
<span data-part="title">{s.title}</span>
|
|
48
|
+
</li>
|
|
49
|
+
))}
|
|
50
|
+
</ol>
|
|
51
|
+
<div data-part="compact">
|
|
52
|
+
<div data-scope="row" data-justify="between">
|
|
53
|
+
<b data-part="compact-title">{steps[at.value]!.title}</b>
|
|
54
|
+
<span class="muted">
|
|
55
|
+
Step {at.value + 1} of {steps.length}
|
|
56
|
+
</span>
|
|
57
|
+
</div>
|
|
58
|
+
<div data-scope="progress" data-part="root" style={`--_v:${(at.value + 1) / steps.length}`}>
|
|
59
|
+
<div data-part="track">
|
|
60
|
+
<div data-part="range"></div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</nav>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { addTags, announce } from '@kerf-js/veneer-core'
|
|
2
|
+
import type { State } from '@kerf-js/core'
|
|
3
|
+
import { afterFlush } from '../atoms'
|
|
4
|
+
|
|
5
|
+
export function tagActions({
|
|
6
|
+
value,
|
|
7
|
+
draft,
|
|
8
|
+
armed,
|
|
9
|
+
refs,
|
|
10
|
+
onEdit,
|
|
11
|
+
onSubmit,
|
|
12
|
+
}: {
|
|
13
|
+
value: () => State<string[]>
|
|
14
|
+
draft: State<string>
|
|
15
|
+
armed: State<boolean>
|
|
16
|
+
refs: { host?: HTMLElement | undefined }
|
|
17
|
+
onEdit: () => void
|
|
18
|
+
onSubmit: () => void
|
|
19
|
+
}) {
|
|
20
|
+
const say = (text: string) => {
|
|
21
|
+
if (refs.host) announce(refs.host.ownerDocument, text)
|
|
22
|
+
}
|
|
23
|
+
const add = (raw: string) => {
|
|
24
|
+
const { list, added } = addTags(value().value, raw)
|
|
25
|
+
draft.value = ''
|
|
26
|
+
if (!added.length) return
|
|
27
|
+
value().value = list
|
|
28
|
+
armed.value = false
|
|
29
|
+
say(`Added ${added.join(', ')}. ${list.length} in total.`)
|
|
30
|
+
onEdit()
|
|
31
|
+
}
|
|
32
|
+
const drop = (tag: string) => {
|
|
33
|
+
value().value = value().value.filter((t) => t !== tag)
|
|
34
|
+
armed.value = false
|
|
35
|
+
say(`Removed ${tag}.`)
|
|
36
|
+
onEdit()
|
|
37
|
+
afterFlush(() => refs.host?.focus())
|
|
38
|
+
}
|
|
39
|
+
const key = (e: KeyboardEvent) => {
|
|
40
|
+
const text = draft.value.trim()
|
|
41
|
+
if ((e.key === 'Enter' || e.key === ',') && text) {
|
|
42
|
+
e.preventDefault()
|
|
43
|
+
add(text)
|
|
44
|
+
} else if (e.key === 'Enter') {
|
|
45
|
+
e.preventDefault()
|
|
46
|
+
onSubmit()
|
|
47
|
+
} else if (e.key === 'Backspace' && !draft.value && value().value.length) {
|
|
48
|
+
if (armed.value) drop(value().value[value().value.length - 1]!)
|
|
49
|
+
else armed.value = true
|
|
50
|
+
} else if (e.key !== 'Backspace') armed.value = false
|
|
51
|
+
}
|
|
52
|
+
const paste = (e: ClipboardEvent) => {
|
|
53
|
+
const t = e.clipboardData?.getData('text') ?? ''
|
|
54
|
+
if (/[\s,;]/.test(t.trim())) {
|
|
55
|
+
e.preventDefault()
|
|
56
|
+
add(`${draft.value} ${t}`)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return { add, drop, key, paste }
|
|
60
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { derived, state, type State } from '@kerf-js/core'
|
|
2
|
+
import { Field } from '../Field'
|
|
3
|
+
import { Tag } from '../Tag'
|
|
4
|
+
import { tagActions } from './TagsInput/actions'
|
|
5
|
+
import '@kerf-js/veneer-core/styles/inputs/choice.css'
|
|
6
|
+
|
|
7
|
+
/** Props for TagsInput. */
|
|
8
|
+
export interface TagsInputProps {
|
|
9
|
+
label: string
|
|
10
|
+
hint?: unknown
|
|
11
|
+
error?: unknown
|
|
12
|
+
value: State<string[]>
|
|
13
|
+
/** A false tag stays, critical: the field's error says why, once for all of them. */
|
|
14
|
+
valid?: (tag: string) => boolean
|
|
15
|
+
/** Called when the tags change, to clear a stale error. */
|
|
16
|
+
onEdit?: (() => void) | undefined
|
|
17
|
+
/** Enter with nothing typed: the form's submit. */
|
|
18
|
+
onSubmit?: () => void
|
|
19
|
+
/** Focuses the field when it mounts. */
|
|
20
|
+
autofocus?: boolean
|
|
21
|
+
[attr: string]: unknown
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* TagsInput (09 §4.2): Enter, comma or a pasted list adds tags; an invalid one stays as a critical tag; Backspace
|
|
26
|
+
* highlights the last tag, then removes it. Veneer had none, so it lives here. Changes are announced politely.
|
|
27
|
+
*/
|
|
28
|
+
export function TagsInput({
|
|
29
|
+
label,
|
|
30
|
+
hint,
|
|
31
|
+
error,
|
|
32
|
+
value,
|
|
33
|
+
valid,
|
|
34
|
+
onEdit,
|
|
35
|
+
onSubmit,
|
|
36
|
+
...rest
|
|
37
|
+
}: TagsInputProps) {
|
|
38
|
+
const draft = state('')
|
|
39
|
+
const armed = state(false)
|
|
40
|
+
const refs: { host?: HTMLElement | undefined } = {}
|
|
41
|
+
const { add, drop, key, paste } = tagActions({
|
|
42
|
+
value: () => value,
|
|
43
|
+
draft,
|
|
44
|
+
armed,
|
|
45
|
+
refs,
|
|
46
|
+
onEdit: () => onEdit?.(),
|
|
47
|
+
onSubmit: () => onSubmit?.(),
|
|
48
|
+
})
|
|
49
|
+
const last = derived(() => value.value[value.value.length - 1])
|
|
50
|
+
return (
|
|
51
|
+
<Field
|
|
52
|
+
wrap
|
|
53
|
+
label={label}
|
|
54
|
+
hint={hint}
|
|
55
|
+
error={error ?? ''}
|
|
56
|
+
filled={value.value.length > 0 || !!draft.value}
|
|
57
|
+
control={(p) => (
|
|
58
|
+
<>
|
|
59
|
+
{value.value.map((t) => (
|
|
60
|
+
<Tag
|
|
61
|
+
key={t}
|
|
62
|
+
label={t}
|
|
63
|
+
tone={valid && !valid(t) ? 'critical' : undefined}
|
|
64
|
+
data-highlighted={armed.value && t === last.value ? '' : undefined}
|
|
65
|
+
onRemove={() => drop(t)}
|
|
66
|
+
>
|
|
67
|
+
{t}
|
|
68
|
+
</Tag>
|
|
69
|
+
))}
|
|
70
|
+
<input
|
|
71
|
+
ref={(n) => (refs.host = n)}
|
|
72
|
+
data-part="input"
|
|
73
|
+
id={p.id}
|
|
74
|
+
placeholder=" "
|
|
75
|
+
autocomplete="off"
|
|
76
|
+
enterkeyhint="enter"
|
|
77
|
+
aria-describedby={p.describedby}
|
|
78
|
+
aria-invalid={p.invalid ? 'true' : undefined}
|
|
79
|
+
value={draft.value}
|
|
80
|
+
onInput={(e: Event) => {
|
|
81
|
+
draft.value = (e.currentTarget as HTMLInputElement).value
|
|
82
|
+
armed.value = false
|
|
83
|
+
}}
|
|
84
|
+
onKeyDown={key}
|
|
85
|
+
onPaste={paste}
|
|
86
|
+
onBlur={() => {
|
|
87
|
+
if (draft.value.trim()) add(draft.value)
|
|
88
|
+
}}
|
|
89
|
+
{...rest}
|
|
90
|
+
/>
|
|
91
|
+
</>
|
|
92
|
+
)}
|
|
93
|
+
/>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Small pieces the admin pack shares. Internal: not exported from the barrel.
|
|
2
|
+
import { flush, type State, state, untrack, watch } from '@kerf-js/core'
|
|
3
|
+
import { CompactSelect } from '../Select'
|
|
4
|
+
import '../fields'
|
|
5
|
+
import '@kerf-js/veneer-core/styles/inputs/choice.css'
|
|
6
|
+
import '@kerf-js/veneer-core/styles/inputs/text.css'
|
|
7
|
+
|
|
8
|
+
/** A value given plainly or as a State box. */
|
|
9
|
+
export const read = <T,>(v: T | State<T>): T =>
|
|
10
|
+
v !== null && typeof v === 'object' && !Array.isArray(v) && 'value' in (v as object)
|
|
11
|
+
? (v as State<T>).value
|
|
12
|
+
: (v as T)
|
|
13
|
+
|
|
14
|
+
/** The sweep's two spans, in every swept host. */
|
|
15
|
+
export const Sweep = () => (
|
|
16
|
+
<>
|
|
17
|
+
<span data-part="sweep-base" aria-hidden="true"></span>
|
|
18
|
+
<span data-part="sweep" aria-hidden="true"></span>
|
|
19
|
+
</>
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
/** Runs after the DOM has caught up: a focus move onto something this handler just rendered. */
|
|
23
|
+
export const afterFlush = (fn: () => void) =>
|
|
24
|
+
queueMicrotask(() => {
|
|
25
|
+
flush()
|
|
26
|
+
fn()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
/** Goes true with `open` and stays: a closed overlay carries nothing until first opened, and keeps its close animation. */
|
|
30
|
+
export function latch(open: State<boolean>) {
|
|
31
|
+
const on = state(untrack(() => open.value))
|
|
32
|
+
watch(
|
|
33
|
+
() => open.value,
|
|
34
|
+
(v) => {
|
|
35
|
+
if (v) on.value = true
|
|
36
|
+
},
|
|
37
|
+
)
|
|
38
|
+
return on
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** A close that can refuse, for dialogs that mustn't go yet. Modal only reads and writes `.value`. */
|
|
42
|
+
export const guarded = (open: State<boolean>, may: () => boolean) =>
|
|
43
|
+
({
|
|
44
|
+
get value() {
|
|
45
|
+
return open.value
|
|
46
|
+
},
|
|
47
|
+
set value(v: boolean) {
|
|
48
|
+
if (v || may()) open.value = v
|
|
49
|
+
},
|
|
50
|
+
}) as State<boolean>
|
|
51
|
+
|
|
52
|
+
/** The compact select in a table cell (specimen `roleSel`). */
|
|
53
|
+
export const InlineSelect = ({
|
|
54
|
+
label,
|
|
55
|
+
value,
|
|
56
|
+
options,
|
|
57
|
+
describedby,
|
|
58
|
+
onValueChange,
|
|
59
|
+
}: {
|
|
60
|
+
label: string
|
|
61
|
+
value: string
|
|
62
|
+
options: { value: string; label: string }[]
|
|
63
|
+
describedby?: string | undefined
|
|
64
|
+
onValueChange: (value: string) => void
|
|
65
|
+
}) => (
|
|
66
|
+
<CompactSelect
|
|
67
|
+
label={label}
|
|
68
|
+
value={value}
|
|
69
|
+
options={options}
|
|
70
|
+
describedby={describedby}
|
|
71
|
+
onValueChange={onValueChange}
|
|
72
|
+
/>
|
|
73
|
+
)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// The admin pack: see docs/design/veneer. One file per component family; each imports only its own CSS.
|
|
2
|
+
export { SettingsLayout, SettingsSection, SettingRow, type SettingsNavItem } from './Settings'
|
|
3
|
+
export { SaveBar, type SaveBarProps, type FieldErrors } from './SaveBar'
|
|
4
|
+
export {
|
|
5
|
+
DangerZone,
|
|
6
|
+
ConfirmDialog,
|
|
7
|
+
TypeToConfirm,
|
|
8
|
+
type ConfirmDialogProps,
|
|
9
|
+
type TypeToConfirmProps,
|
|
10
|
+
} from './Danger'
|
|
11
|
+
export {
|
|
12
|
+
MembersTable,
|
|
13
|
+
SeatsMeter,
|
|
14
|
+
RolesMatrix,
|
|
15
|
+
type Member,
|
|
16
|
+
type Invite,
|
|
17
|
+
type Role,
|
|
18
|
+
type Permission,
|
|
19
|
+
type MembersTableProps,
|
|
20
|
+
} from './Members'
|
|
21
|
+
export { InviteDialog, type InviteDialogProps } from './InviteDialog'
|
|
22
|
+
export { TagsInput, type TagsInputProps } from './TagsInput'
|
|
23
|
+
export { ApiKeys, type ApiKey, type KeyDraft, type ApiKeysProps } from './ApiKeys'
|
|
24
|
+
export {
|
|
25
|
+
PlanPicker,
|
|
26
|
+
UsageMeter,
|
|
27
|
+
UsageMeters,
|
|
28
|
+
type BillingPlan,
|
|
29
|
+
type PlanPickerProps,
|
|
30
|
+
type UsageMeterProps,
|
|
31
|
+
} from './Plans'
|
|
32
|
+
export {
|
|
33
|
+
Invoices,
|
|
34
|
+
PaymentMethods,
|
|
35
|
+
PayFrame,
|
|
36
|
+
type Invoice,
|
|
37
|
+
type InvoiceStatus,
|
|
38
|
+
type PaymentMethod,
|
|
39
|
+
type PayFrameProps,
|
|
40
|
+
} from './Billing'
|
|
41
|
+
export { AuditLog, type AuditEvent, type AuditLogProps } from './Audit'
|
|
42
|
+
export {
|
|
43
|
+
IntegrationsGrid,
|
|
44
|
+
Webhooks,
|
|
45
|
+
type Integration,
|
|
46
|
+
type IntegrationState,
|
|
47
|
+
type IntegrationsGridProps,
|
|
48
|
+
type Webhook,
|
|
49
|
+
type WebhooksProps,
|
|
50
|
+
} from './Integrations'
|
|
51
|
+
export { CsvImport, type CsvImportProps } from './CsvImport'
|
|
52
|
+
export { CartDrawer, CartButton, LineItem, type CartDrawerProps } from './Cart'
|
|
53
|
+
export {
|
|
54
|
+
Checkout,
|
|
55
|
+
type CheckoutProps,
|
|
56
|
+
type CheckoutStep,
|
|
57
|
+
type ShippingOption,
|
|
58
|
+
type Coupon,
|
|
59
|
+
type OrderDraft,
|
|
60
|
+
type PlaceOrderResult,
|
|
61
|
+
} from './Checkout'
|
|
62
|
+
export {
|
|
63
|
+
OrderConfirmation,
|
|
64
|
+
OrderTracker,
|
|
65
|
+
type OrderConfirmationProps,
|
|
66
|
+
type OrderStage,
|
|
67
|
+
} from './Order'
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Button } from '../../Button'
|
|
2
|
+
|
|
3
|
+
export function FeedbackReasonPanel({
|
|
4
|
+
reasons,
|
|
5
|
+
because,
|
|
6
|
+
setPanel,
|
|
7
|
+
}: {
|
|
8
|
+
reasons: string[]
|
|
9
|
+
because: (e: Event, reason: string) => void
|
|
10
|
+
setPanel: (n: HTMLDivElement) => void
|
|
11
|
+
}) {
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
ref={setPanel}
|
|
15
|
+
data-scope="popover"
|
|
16
|
+
data-part="content"
|
|
17
|
+
role="dialog"
|
|
18
|
+
popover="manual"
|
|
19
|
+
aria-label="What went wrong?"
|
|
20
|
+
>
|
|
21
|
+
<p data-part="title">What went wrong?</p>
|
|
22
|
+
<div>
|
|
23
|
+
{reasons.map((r) => (
|
|
24
|
+
<Button
|
|
25
|
+
key={r}
|
|
26
|
+
emphasis="ghost"
|
|
27
|
+
tone="neutral"
|
|
28
|
+
size="sm"
|
|
29
|
+
data-close-popover=""
|
|
30
|
+
onClick={(e: Event) => because(e, r)}
|
|
31
|
+
>
|
|
32
|
+
{r}
|
|
33
|
+
</Button>
|
|
34
|
+
))}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|