@signalcore/ui 0.1.0 → 1.0.0-beta.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.
- package/README.md +896 -513
- package/dist/AgentAbout.d.ts +186 -0
- package/dist/AgentAbout.js +1020 -0
- package/dist/AgentAbout.js.map +1 -0
- package/dist/AgentCard.d.ts +49 -0
- package/dist/AgentCard.js +77 -0
- package/dist/AgentCard.js.map +1 -0
- package/dist/AgentChat.d.ts +233 -0
- package/dist/AgentChat.js +1127 -0
- package/dist/AgentChat.js.map +1 -0
- package/dist/AgentSpace.d.ts +112 -0
- package/dist/AgentSpace.js +339 -0
- package/dist/AgentSpace.js.map +1 -0
- package/dist/AgentTasks.d.ts +48 -0
- package/dist/AgentTasks.js +120 -0
- package/dist/AgentTasks.js.map +1 -0
- package/dist/BrowserView.d.ts +52 -0
- package/dist/BrowserView.js +328 -0
- package/dist/BrowserView.js.map +1 -0
- package/dist/FileView.d.ts +63 -0
- package/dist/FileView.js +449 -0
- package/dist/FileView.js.map +1 -0
- package/dist/Modes.d.ts +13 -0
- package/dist/Modes.js +75 -0
- package/dist/Modes.js.map +1 -0
- package/dist/VoiceCall.d.ts +91 -0
- package/dist/VoiceCall.js +302 -0
- package/dist/VoiceCall.js.map +1 -0
- package/dist/about.d.ts +212 -0
- package/dist/about.js +136 -0
- package/dist/about.js.map +1 -0
- package/dist/agentIcons.d.ts +33 -0
- package/dist/agentIcons.js +36 -0
- package/dist/agentIcons.js.map +1 -0
- package/dist/automation/Automation.d.ts +35 -0
- package/dist/automation/Automation.js +268 -0
- package/dist/automation/Automation.js.map +1 -0
- package/dist/automation/RunView.d.ts +25 -0
- package/dist/automation/RunView.js +187 -0
- package/dist/automation/RunView.js.map +1 -0
- package/dist/automation/cron.d.ts +41 -0
- package/dist/automation/cron.js +169 -0
- package/dist/automation/cron.js.map +1 -0
- package/dist/automation/marks.js +121 -0
- package/dist/automation/marks.js.map +1 -0
- package/dist/automation/messages.d.ts +113 -0
- package/dist/automation/messages.js +113 -0
- package/dist/automation/messages.js.map +1 -0
- package/dist/automation/record.d.ts +47 -0
- package/dist/automation/record.js +177 -0
- package/dist/automation/record.js.map +1 -0
- package/dist/automation/types.d.ts +143 -0
- package/dist/automation/when.d.ts +36 -0
- package/dist/automation/when.js +168 -0
- package/dist/automation/when.js.map +1 -0
- package/dist/blocks.d.ts +185 -0
- package/dist/browser.js +292 -0
- package/dist/browser.js.map +1 -0
- package/dist/call.d.ts +89 -0
- package/dist/call.js +218 -0
- package/dist/call.js.map +1 -0
- package/dist/channelParts.js +26 -0
- package/dist/channelParts.js.map +1 -0
- package/dist/classes.js +8 -3
- package/dist/classes.js.map +1 -0
- package/dist/client.d.ts +146 -54
- package/dist/client.js +204 -1
- package/dist/client.js.map +1 -0
- package/dist/conversationFiles.js +46 -0
- package/dist/conversationFiles.js.map +1 -0
- package/dist/credentials.d.ts +45 -0
- package/dist/credentials.js +98 -0
- package/dist/credentials.js.map +1 -0
- package/dist/dev.js +17 -0
- package/dist/dev.js.map +1 -0
- package/dist/es.d.ts +17 -0
- package/dist/es.js +382 -0
- package/dist/es.js.map +1 -0
- package/dist/files.d.ts +21 -0
- package/dist/files.js +214 -0
- package/dist/files.js.map +1 -0
- package/dist/frames.d.ts +115 -0
- package/dist/frames.js +219 -0
- package/dist/frames.js.map +1 -0
- package/dist/icons.js +29 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +63 -60
- package/dist/index.js +59 -45
- package/dist/kit/AudioPlayer.d.ts +20 -0
- package/dist/kit/AudioPlayer.js +116 -0
- package/dist/kit/AudioPlayer.js.map +1 -0
- package/dist/kit/Button.d.ts +29 -0
- package/dist/kit/Button.js +59 -0
- package/dist/kit/Button.js.map +1 -0
- package/dist/kit/Card.d.ts +16 -0
- package/dist/kit/Card.js +36 -0
- package/dist/kit/Card.js.map +1 -0
- package/dist/kit/Chart.js +152 -0
- package/dist/kit/Chart.js.map +1 -0
- package/dist/kit/Choices.d.ts +21 -0
- package/dist/kit/Choices.js +99 -0
- package/dist/kit/Choices.js.map +1 -0
- package/dist/kit/Combobox.d.ts +26 -0
- package/dist/kit/Combobox.js +190 -0
- package/dist/kit/Combobox.js.map +1 -0
- package/dist/kit/DateField.d.ts +17 -0
- package/dist/kit/DateField.js +133 -0
- package/dist/kit/DateField.js.map +1 -0
- package/dist/kit/Field.d.ts +40 -0
- package/dist/kit/Field.js +98 -0
- package/dist/kit/Field.js.map +1 -0
- package/dist/kit/FileField.d.ts +113 -0
- package/dist/kit/FileField.js +341 -0
- package/dist/kit/FileField.js.map +1 -0
- package/dist/kit/FileMark.d.ts +15 -0
- package/dist/kit/FileMark.js +39 -0
- package/dist/kit/FileMark.js.map +1 -0
- package/dist/kit/Inputs.d.ts +59 -0
- package/dist/kit/Inputs.js +205 -0
- package/dist/kit/Inputs.js.map +1 -0
- package/dist/kit/List.d.ts +47 -0
- package/dist/kit/List.js +85 -0
- package/dist/kit/List.js.map +1 -0
- package/dist/kit/Mark.d.ts +30 -0
- package/dist/kit/Mark.js +27 -0
- package/dist/kit/Mark.js.map +1 -0
- package/dist/kit/MarkStack.d.ts +15 -0
- package/dist/kit/MarkStack.js +26 -0
- package/dist/kit/MarkStack.js.map +1 -0
- package/dist/kit/Note.d.ts +11 -0
- package/dist/kit/Note.js +31 -0
- package/dist/kit/Note.js.map +1 -0
- package/dist/kit/Popover.js +90 -0
- package/dist/kit/Popover.js.map +1 -0
- package/dist/kit/RangeField.d.ts +14 -0
- package/dist/kit/RangeField.js +47 -0
- package/dist/kit/RangeField.js.map +1 -0
- package/dist/kit/RatingField.d.ts +14 -0
- package/dist/kit/RatingField.js +50 -0
- package/dist/kit/RatingField.js.map +1 -0
- package/dist/kit/Stat.d.ts +26 -0
- package/dist/kit/Stat.js +46 -0
- package/dist/kit/Stat.js.map +1 -0
- package/dist/kit/Switch.d.ts +14 -0
- package/dist/kit/Switch.js +21 -0
- package/dist/kit/Switch.js.map +1 -0
- package/dist/kit/Tag.d.ts +16 -0
- package/dist/kit/Tag.js +20 -0
- package/dist/kit/Tag.js.map +1 -0
- package/dist/kit/Tile.d.ts +34 -0
- package/dist/kit/Tile.js +52 -0
- package/dist/kit/Tile.js.map +1 -0
- package/dist/kit/TimeField.d.ts +31 -0
- package/dist/kit/TimeField.js +109 -0
- package/dist/kit/TimeField.js.map +1 -0
- package/dist/kit/context.d.ts +22 -0
- package/dist/kit/context.js +46 -0
- package/dist/kit/context.js.map +1 -0
- package/dist/kit/dates.d.ts +14 -0
- package/dist/kit/dates.js +129 -0
- package/dist/kit/dates.js.map +1 -0
- package/dist/kit/messages.d.ts +99 -0
- package/dist/kit/messages.js +66 -0
- package/dist/kit/messages.js.map +1 -0
- package/dist/kit/numbers.d.ts +12 -0
- package/dist/kit/numbers.js +40 -0
- package/dist/kit/numbers.js.map +1 -0
- package/dist/kit/options.d.ts +10 -0
- package/dist/kit/options.js +23 -0
- package/dist/kit/options.js.map +1 -0
- package/dist/kit/uploads.d.ts +42 -0
- package/dist/kit/uploads.js +165 -0
- package/dist/kit/uploads.js.map +1 -0
- package/dist/kit/waveform.js +76 -0
- package/dist/kit/waveform.js.map +1 -0
- package/dist/locale.d.ts +1 -0
- package/dist/locale.js +1 -0
- package/dist/markdown.js +84 -0
- package/dist/markdown.js.map +1 -0
- package/dist/marks.js +217 -0
- package/dist/marks.js.map +1 -0
- package/dist/reveal.js +48 -0
- package/dist/reveal.js.map +1 -0
- package/dist/stepGlyphs.js +62 -0
- package/dist/stepGlyphs.js.map +1 -0
- package/dist/surface/Form.js +264 -0
- package/dist/surface/Form.js.map +1 -0
- package/dist/surface/Markdown.js +42 -0
- package/dist/surface/Markdown.js.map +1 -0
- package/dist/surface/Surface.d.ts +31 -17
- package/dist/surface/Surface.js +480 -57
- package/dist/surface/Surface.js.map +1 -0
- package/dist/surface/scope.d.ts +32 -0
- package/dist/surface/scope.js +23 -0
- package/dist/surface/scope.js.map +1 -0
- package/dist/surface/values.d.ts +44 -0
- package/dist/surface/values.js +237 -0
- package/dist/surface/values.js.map +1 -0
- package/dist/tint.d.ts +10 -0
- package/dist/tint.js +19 -0
- package/dist/tint.js.map +1 -0
- package/dist/types.d.ts +541 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/dist/useAgentFace.d.ts +18 -0
- package/dist/useAgentFace.js +45 -0
- package/dist/useAgentFace.js.map +1 -0
- package/dist/useCall.d.ts +39 -0
- package/dist/useCall.js +273 -0
- package/dist/useCall.js.map +1 -0
- package/dist/useConversation.d.ts +77 -0
- package/dist/useConversation.js +523 -0
- package/dist/useConversation.js.map +1 -0
- package/dist/useDictation.d.ts +17 -0
- package/dist/useDictation.js +68 -0
- package/dist/useDictation.js.map +1 -0
- package/dist/useLive.d.ts +26 -0
- package/dist/useLive.js +88 -0
- package/dist/useLive.js.map +1 -0
- package/dist/usePolled.js +68 -0
- package/dist/usePolled.js.map +1 -0
- package/dist/voice/Orb.d.ts +10 -9
- package/dist/voice/Orb.js +43 -39
- package/dist/voice/Orb.js.map +1 -0
- package/dist/voice/StillOrb.js +33 -0
- package/dist/voice/StillOrb.js.map +1 -0
- package/dist/voice/WebGLOrb.js +98 -0
- package/dist/voice/WebGLOrb.js.map +1 -0
- package/dist/voice/fluidDots.js +161 -0
- package/dist/voice/fluidDots.js.map +1 -0
- package/dist/voice/motion.js +84 -0
- package/dist/voice/motion.js.map +1 -0
- package/dist/voice/orbs.d.ts +32 -0
- package/dist/voice/orbs.js +16 -0
- package/dist/voice/orbs.js.map +1 -0
- package/dist/voice/useReducedMotion.js +16 -16
- package/dist/voice/useReducedMotion.js.map +1 -0
- package/dist/voice/wave.js +116 -0
- package/dist/voice/wave.js.map +1 -0
- package/dist/voice/webgl.js +177 -0
- package/dist/voice/webgl.js.map +1 -0
- package/dist/widget.js +284 -8
- package/package.json +49 -39
- package/src/AgentAbout.tsx +1621 -0
- package/src/AgentCard.tsx +123 -0
- package/src/AgentChat.tsx +1812 -0
- package/src/AgentSpace.tsx +540 -0
- package/src/AgentTasks.tsx +163 -0
- package/src/BrowserView.tsx +442 -0
- package/src/FileView.tsx +620 -0
- package/src/Modes.tsx +112 -0
- package/src/VoiceCall.tsx +411 -0
- package/src/about.ts +355 -0
- package/src/agentIcons.ts +56 -0
- package/src/automation/Automation.tsx +308 -0
- package/src/automation/RunView.tsx +213 -0
- package/src/automation/cron.ts +196 -0
- package/src/automation/marks.tsx +144 -0
- package/src/automation/messages.ts +231 -0
- package/src/automation/record.ts +206 -0
- package/src/automation/types.ts +146 -0
- package/src/automation/when.ts +195 -0
- package/src/blocks.ts +249 -0
- package/src/browser.ts +334 -0
- package/src/call.ts +300 -0
- package/src/channelParts.ts +17 -0
- package/src/classes.ts +10 -0
- package/src/client.ts +397 -0
- package/src/conversationFiles.ts +54 -0
- package/src/credentials.ts +158 -0
- package/src/dev.ts +20 -0
- package/src/es.ts +423 -0
- package/src/files.ts +238 -0
- package/src/frames.ts +291 -0
- package/src/icons.tsx +49 -0
- package/src/index.ts +271 -0
- package/src/kit/AudioPlayer.tsx +129 -0
- package/src/kit/Button.tsx +97 -0
- package/src/kit/Card.tsx +47 -0
- package/src/kit/Chart.tsx +129 -0
- package/src/kit/Choices.tsx +131 -0
- package/src/kit/Combobox.tsx +247 -0
- package/src/kit/DateField.tsx +156 -0
- package/src/kit/Field.tsx +137 -0
- package/src/kit/FileField.tsx +492 -0
- package/src/kit/FileMark.tsx +56 -0
- package/src/kit/Inputs.tsx +250 -0
- package/src/kit/List.tsx +135 -0
- package/src/kit/Mark.tsx +64 -0
- package/src/kit/MarkStack.tsx +29 -0
- package/src/kit/Note.tsx +42 -0
- package/src/kit/Popover.tsx +121 -0
- package/src/kit/RangeField.tsx +53 -0
- package/src/kit/RatingField.tsx +62 -0
- package/src/kit/Stat.tsx +60 -0
- package/src/kit/Switch.tsx +28 -0
- package/src/kit/Tag.tsx +32 -0
- package/src/kit/Tile.tsx +74 -0
- package/src/kit/TimeField.tsx +157 -0
- package/src/kit/context.tsx +246 -0
- package/src/kit/dates.ts +150 -0
- package/src/kit/messages.ts +160 -0
- package/src/kit/numbers.ts +44 -0
- package/src/kit/options.ts +30 -0
- package/src/kit/uploads.ts +244 -0
- package/src/kit/waveform.ts +84 -0
- package/src/locale.ts +6 -0
- package/src/markdown.ts +69 -0
- package/src/marks.tsx +328 -0
- package/src/reveal.ts +52 -0
- package/src/stepGlyphs.ts +83 -0
- package/src/styles.css +6970 -0
- package/src/surface/Form.tsx +299 -0
- package/src/surface/Markdown.tsx +55 -0
- package/src/surface/Surface.tsx +605 -0
- package/src/surface/scope.ts +82 -0
- package/src/surface/values.ts +361 -0
- package/src/tint.ts +14 -0
- package/src/types.ts +604 -0
- package/src/useAgentFace.ts +47 -0
- package/src/useCall.ts +292 -0
- package/src/useConversation.ts +627 -0
- package/src/useDictation.ts +83 -0
- package/src/useLive.ts +115 -0
- package/src/usePolled.ts +60 -0
- package/src/voice/Orb.tsx +45 -0
- package/src/voice/StillOrb.tsx +29 -0
- package/src/voice/WebGLOrb.tsx +98 -0
- package/src/voice/fluidDots.tsx +171 -0
- package/src/voice/motion.ts +112 -0
- package/src/voice/orbs.ts +39 -0
- package/src/voice/useReducedMotion.ts +24 -0
- package/src/voice/wave.tsx +129 -0
- package/src/voice/webgl.ts +209 -0
- package/src/widget/css.d.ts +5 -0
- package/src/widget/element.tsx +535 -0
- package/src/widget/index.ts +10 -0
- package/src/widget/mount.ts +27 -0
- package/src/widget/widget.css +253 -0
- package/dist/SignalcoreProvider.d.ts +0 -113
- package/dist/SignalcoreProvider.js +0 -84
- package/dist/automations/AppMarks.d.ts +0 -11
- package/dist/automations/AppMarks.js +0 -18
- package/dist/automations/AutomationCard.d.ts +0 -27
- package/dist/automations/AutomationCard.js +0 -53
- package/dist/automations/AutomationsWindow.d.ts +0 -38
- package/dist/automations/AutomationsWindow.js +0 -57
- package/dist/automations/Card.d.ts +0 -46
- package/dist/automations/Card.js +0 -45
- package/dist/automations/ScheduleMarks.d.ts +0 -13
- package/dist/automations/ScheduleMarks.js +0 -24
- package/dist/automations/presentationIcons.d.ts +0 -7
- package/dist/automations/presentationIcons.js +0 -67
- package/dist/automations/schedule.d.ts +0 -25
- package/dist/automations/schedule.js +0 -59
- package/dist/automations/time.d.ts +0 -3
- package/dist/automations/time.js +0 -25
- package/dist/browser/BrowserView.d.ts +0 -43
- package/dist/browser/BrowserView.js +0 -94
- package/dist/browser/room.d.ts +0 -21
- package/dist/browser/room.js +0 -33
- package/dist/browser/useBrowserSession.d.ts +0 -17
- package/dist/browser/useBrowserSession.js +0 -67
- package/dist/builder/BuilderChat.d.ts +0 -32
- package/dist/builder/BuilderChat.js +0 -41
- package/dist/builder/BuilderTranscript.d.ts +0 -49
- package/dist/builder/BuilderTranscript.js +0 -62
- package/dist/builder/StatusLine.d.ts +0 -8
- package/dist/builder/StatusLine.js +0 -17
- package/dist/builder/answer.d.ts +0 -7
- package/dist/builder/answer.js +0 -8
- package/dist/builder/blocks.d.ts +0 -31
- package/dist/builder/blocks.js +0 -74
- package/dist/builder/items.d.ts +0 -15
- package/dist/builder/items.js +0 -21
- package/dist/builder/steps.d.ts +0 -20
- package/dist/builder/steps.js +0 -120
- package/dist/builder/time.d.ts +0 -4
- package/dist/builder/time.js +0 -24
- package/dist/builder/useBuildSession.d.ts +0 -36
- package/dist/builder/useBuildSession.js +0 -130
- package/dist/builder/workingOn.d.ts +0 -7
- package/dist/builder/workingOn.js +0 -15
- package/dist/chat/AgentChat.d.ts +0 -37
- package/dist/chat/AgentChat.js +0 -21
- package/dist/chat/ChatView.d.ts +0 -25
- package/dist/chat/ChatView.js +0 -34
- package/dist/chat/Composer.d.ts +0 -20
- package/dist/chat/Composer.js +0 -22
- package/dist/chat/MessageRow.d.ts +0 -22
- package/dist/chat/MessageRow.js +0 -32
- package/dist/chat/arrival.d.ts +0 -15
- package/dist/chat/arrival.js +0 -25
- package/dist/chat/history.d.ts +0 -24
- package/dist/chat/history.js +0 -45
- package/dist/chat/moments.d.ts +0 -25
- package/dist/chat/moments.js +0 -72
- package/dist/chat/types.d.ts +0 -12
- package/dist/chat/types.js +0 -1
- package/dist/chat/useComposer.d.ts +0 -46
- package/dist/chat/useComposer.js +0 -62
- package/dist/chat/useConversation.d.ts +0 -35
- package/dist/chat/useConversation.js +0 -71
- package/dist/chat/useStickToBottom.d.ts +0 -9
- package/dist/chat/useStickToBottom.js +0 -33
- package/dist/chat/useTurns.d.ts +0 -49
- package/dist/chat/useTurns.js +0 -111
- package/dist/classes.d.ts +0 -2
- package/dist/development.d.ts +0 -5
- package/dist/development.js +0 -8
- package/dist/flow/FlowWindow.d.ts +0 -42
- package/dist/flow/FlowWindow.js +0 -126
- package/dist/flow/index.d.ts +0 -16
- package/dist/flow/index.js +0 -16
- package/dist/flow/kinds.d.ts +0 -23
- package/dist/flow/kinds.js +0 -48
- package/dist/flow/map.d.ts +0 -44
- package/dist/flow/map.js +0 -225
- package/dist/flow/nodePaths.d.ts +0 -7
- package/dist/flow/nodePaths.js +0 -17
- package/dist/flow/relations.d.ts +0 -42
- package/dist/flow/relations.js +0 -174
- package/dist/host.d.ts +0 -124
- package/dist/host.js +0 -1
- package/dist/live/LiveView.d.ts +0 -28
- package/dist/live/LiveView.js +0 -55
- package/dist/live/capture.d.ts +0 -20
- package/dist/live/capture.js +0 -100
- package/dist/live/follow.d.ts +0 -26
- package/dist/live/follow.js +0 -72
- package/dist/live/paint.d.ts +0 -13
- package/dist/live/paint.js +0 -77
- package/dist/live/useLiveStream.d.ts +0 -16
- package/dist/live/useLiveStream.js +0 -57
- package/dist/look.d.ts +0 -33
- package/dist/look.js +0 -241
- package/dist/messages/en.d.ts +0 -3
- package/dist/messages/en.js +0 -251
- package/dist/messages/es.d.ts +0 -3
- package/dist/messages/es.js +0 -251
- package/dist/messages/index.d.ts +0 -16
- package/dist/messages/index.js +0 -33
- package/dist/messages/types.d.ts +0 -246
- package/dist/messages/types.js +0 -1
- package/dist/parts/Button.d.ts +0 -18
- package/dist/parts/Button.js +0 -17
- package/dist/parts/Icon.d.ts +0 -39
- package/dist/parts/Icon.js +0 -37
- package/dist/parts/Input.d.ts +0 -6
- package/dist/parts/Input.js +0 -11
- package/dist/parts/Spinner.d.ts +0 -2
- package/dist/parts/Spinner.js +0 -7
- package/dist/patterns.d.ts +0 -15
- package/dist/patterns.js +0 -5
- package/dist/presets.d.ts +0 -82
- package/dist/presets.js +0 -81
- package/dist/primitives.d.ts +0 -22
- package/dist/primitives.js +0 -58
- package/dist/request/RequestCard.d.ts +0 -34
- package/dist/request/RequestCard.js +0 -101
- package/dist/request/approval/ApprovalPreview.d.ts +0 -5
- package/dist/request/approval/ApprovalPreview.js +0 -27
- package/dist/request/approval/shapes.d.ts +0 -32
- package/dist/request/approval/shapes.js +0 -68
- package/dist/request/apps.d.ts +0 -11
- package/dist/request/apps.js +0 -27
- package/dist/request/cards.d.ts +0 -12
- package/dist/request/cards.js +0 -24
- package/dist/request/deliver.d.ts +0 -12
- package/dist/request/deliver.js +0 -21
- package/dist/request/handOver.d.ts +0 -18
- package/dist/request/handOver.js +0 -33
- package/dist/request/kinds/Approval.d.ts +0 -3
- package/dist/request/kinds/Approval.js +0 -9
- package/dist/request/kinds/Choice.d.ts +0 -3
- package/dist/request/kinds/Choice.js +0 -8
- package/dist/request/kinds/Connect.d.ts +0 -9
- package/dist/request/kinds/Connect.js +0 -119
- package/dist/request/kinds/FreeText.d.ts +0 -3
- package/dist/request/kinds/FreeText.js +0 -20
- package/dist/request/kinds/HandOver.d.ts +0 -13
- package/dist/request/kinds/HandOver.js +0 -20
- package/dist/request/kinds/Secret.d.ts +0 -7
- package/dist/request/kinds/Secret.js +0 -49
- package/dist/request/kinds/Upload.d.ts +0 -6
- package/dist/request/kinds/Upload.js +0 -47
- package/dist/request/types.d.ts +0 -83
- package/dist/request/types.js +0 -1
- package/dist/safeUrl.d.ts +0 -6
- package/dist/safeUrl.js +0 -8
- package/dist/stream/builder.d.ts +0 -176
- package/dist/stream/builder.js +0 -202
- package/dist/stream/reduce.d.ts +0 -51
- package/dist/stream/reduce.js +0 -58
- package/dist/stream/untilAborted.d.ts +0 -7
- package/dist/stream/untilAborted.js +0 -32
- package/dist/stream/useRunStream.d.ts +0 -26
- package/dist/stream/useRunStream.js +0 -137
- package/dist/styles.css +0 -2318
- package/dist/surface/HostNode.d.ts +0 -14
- package/dist/surface/HostNode.js +0 -30
- package/dist/surface/Node.d.ts +0 -7
- package/dist/surface/Node.js +0 -49
- package/dist/surface/SurfaceBoundary.d.ts +0 -26
- package/dist/surface/SurfaceBoundary.js +0 -20
- package/dist/surface/bindings.d.ts +0 -14
- package/dist/surface/bindings.js +0 -37
- package/dist/surface/check.d.ts +0 -27
- package/dist/surface/check.js +0 -102
- package/dist/surface/format.d.ts +0 -10
- package/dist/surface/format.js +0 -32
- package/dist/surface/hosts.d.ts +0 -6
- package/dist/surface/hosts.js +0 -11
- package/dist/surface/scene.d.ts +0 -21
- package/dist/surface/scene.js +0 -8
- package/dist/surface/templates/Browser.d.ts +0 -6
- package/dist/surface/templates/Browser.js +0 -11
- package/dist/surface/templates/Chart.d.ts +0 -6
- package/dist/surface/templates/Chart.js +0 -13
- package/dist/surface/templates/Choices.d.ts +0 -3
- package/dist/surface/templates/Choices.js +0 -12
- package/dist/surface/templates/Form.d.ts +0 -3
- package/dist/surface/templates/Form.js +0 -44
- package/dist/surface/templates/KeyValue.d.ts +0 -3
- package/dist/surface/templates/KeyValue.js +0 -7
- package/dist/surface/templates/Layout.d.ts +0 -5
- package/dist/surface/templates/Layout.js +0 -16
- package/dist/surface/templates/Live.d.ts +0 -6
- package/dist/surface/templates/Live.js +0 -9
- package/dist/surface/templates/Media.d.ts +0 -5
- package/dist/surface/templates/Media.js +0 -13
- package/dist/surface/templates/Slots.d.ts +0 -3
- package/dist/surface/templates/Slots.js +0 -19
- package/dist/surface/templates/Table.d.ts +0 -3
- package/dist/surface/templates/Table.js +0 -12
- package/dist/surface/templates/Text.d.ts +0 -4
- package/dist/surface/templates/Text.js +0 -15
- package/dist/surface/templates/index.d.ts +0 -7
- package/dist/surface/templates/index.js +0 -32
- package/dist/surface/types.d.ts +0 -68
- package/dist/surface/types.js +0 -6
- package/dist/theme.d.ts +0 -62
- package/dist/theme.js +0 -9
- package/dist/useTokens.d.ts +0 -7
- package/dist/useTokens.js +0 -41
- package/dist/voice/VoiceWindow.d.ts +0 -18
- package/dist/voice/VoiceWindow.js +0 -35
- package/dist/voice/index.d.ts +0 -13
- package/dist/voice/index.js +0 -12
- package/dist/voice/meter.d.ts +0 -16
- package/dist/voice/meter.js +0 -52
- package/dist/voice/orbColors.d.ts +0 -16
- package/dist/voice/orbColors.js +0 -75
- package/dist/voice/pushable.d.ts +0 -16
- package/dist/voice/pushable.js +0 -56
- package/dist/voice/useDictation.d.ts +0 -24
- package/dist/voice/useDictation.js +0 -60
- package/dist/voice/useReducedMotion.d.ts +0 -5
- package/dist/voice/useVoice.d.ts +0 -70
- package/dist/voice/useVoice.js +0 -197
- package/dist/voice/useVoicePrimitives.d.ts +0 -7
- package/dist/voice/useVoicePrimitives.js +0 -11
- package/dist/voice/voice.d.ts +0 -55
- package/dist/voice/voice.js +0 -9
- package/dist/voice/webSpeech.d.ts +0 -33
- package/dist/voice/webSpeech.js +0 -258
- package/dist/widget.js.map +0 -1
- package/dist/windows/AgentSpace.d.ts +0 -78
- package/dist/windows/AgentSpace.js +0 -135
- package/dist/windows/Captions.d.ts +0 -13
- package/dist/windows/Captions.js +0 -22
- package/dist/windows/Dock.d.ts +0 -37
- package/dist/windows/Dock.js +0 -22
- package/dist/windows/Journal.d.ts +0 -15
- package/dist/windows/Journal.js +0 -19
- package/dist/windows/KindMark.d.ts +0 -7
- package/dist/windows/KindMark.js +0 -31
- package/dist/windows/Pending.d.ts +0 -8
- package/dist/windows/Pending.js +0 -17
- package/dist/windows/Stage.d.ts +0 -18
- package/dist/windows/Stage.js +0 -21
- package/dist/windows/StatusLabel.d.ts +0 -9
- package/dist/windows/StatusLabel.js +0 -7
- package/dist/windows/Strip.d.ts +0 -17
- package/dist/windows/Strip.js +0 -42
- package/dist/windows/SurfaceWindow.d.ts +0 -20
- package/dist/windows/SurfaceWindow.js +0 -12
- package/dist/windows/WindowFrame.d.ts +0 -23
- package/dist/windows/WindowFrame.js +0 -22
- package/dist/windows/hearing.d.ts +0 -11
- package/dist/windows/hearing.js +0 -26
- package/dist/windows/kinds.d.ts +0 -47
- package/dist/windows/kinds.js +0 -28
- package/dist/windows/reduce.d.ts +0 -98
- package/dist/windows/reduce.js +0 -151
- package/dist/windows/registry.d.ts +0 -18
- package/dist/windows/registry.js +0 -61
- package/dist/windows/reveal.d.ts +0 -9
- package/dist/windows/reveal.js +0 -6
- package/dist/windows/space.d.ts +0 -21
- package/dist/windows/space.js +0 -6
- package/dist/windows/status.d.ts +0 -11
- package/dist/windows/status.js +0 -30
- package/dist/windows/types.d.ts +0 -15
- package/dist/windows/types.js +0 -1
- package/dist/windows/useLoaded.d.ts +0 -44
- package/dist/windows/useLoaded.js +0 -58
- package/dist/windows/useUnread.d.ts +0 -7
- package/dist/windows/useUnread.js +0 -21
- package/dist/windows/useWindows.d.ts +0 -70
- package/dist/windows/useWindows.js +0 -60
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CheckIcon,
|
|
3
|
+
EnvelopeSimpleIcon,
|
|
4
|
+
EyeIcon,
|
|
5
|
+
EyeSlashIcon,
|
|
6
|
+
GlobeSimpleIcon,
|
|
7
|
+
LockSimpleIcon,
|
|
8
|
+
MinusIcon,
|
|
9
|
+
PhoneIcon,
|
|
10
|
+
PlusIcon,
|
|
11
|
+
} from "@phosphor-icons/react";
|
|
12
|
+
import { useLayoutEffect, useRef, useState, type ReactNode } from "react";
|
|
13
|
+
|
|
14
|
+
import { useKit, useParts } from "./context";
|
|
15
|
+
import { ariaOf, Box, type ControlBase } from "./Field";
|
|
16
|
+
import { stepped, type NumberBounds } from "./numbers";
|
|
17
|
+
|
|
18
|
+
interface WordsProps extends ControlBase {
|
|
19
|
+
value: string;
|
|
20
|
+
onChange: (value: string) => void;
|
|
21
|
+
placeholder?: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const SHAPES = {
|
|
25
|
+
text: { type: "text", inputMode: "text", autoComplete: undefined, icon: undefined },
|
|
26
|
+
email: { type: "email", inputMode: "email", autoComplete: "email", icon: EnvelopeSimpleIcon },
|
|
27
|
+
phone: { type: "tel", inputMode: "tel", autoComplete: "tel", icon: PhoneIcon },
|
|
28
|
+
url: { type: "url", inputMode: "url", autoComplete: "url", icon: GlobeSimpleIcon },
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
/** Words on one line; an email, a phone or an address with its icon and the right keyboard. */
|
|
32
|
+
export function TextInput({
|
|
33
|
+
kind = "text",
|
|
34
|
+
value,
|
|
35
|
+
onChange,
|
|
36
|
+
placeholder,
|
|
37
|
+
...control
|
|
38
|
+
}: WordsProps & { kind?: keyof typeof SHAPES | undefined }) {
|
|
39
|
+
const part = useParts();
|
|
40
|
+
const shape = SHAPES[kind];
|
|
41
|
+
return (
|
|
42
|
+
<Box icon={shape.icon} invalid={control.invalid}>
|
|
43
|
+
<input
|
|
44
|
+
id={control.id}
|
|
45
|
+
type={shape.type}
|
|
46
|
+
inputMode={shape.inputMode}
|
|
47
|
+
autoComplete={shape.autoComplete}
|
|
48
|
+
spellCheck={kind === "text" ? undefined : false}
|
|
49
|
+
placeholder={placeholder}
|
|
50
|
+
value={value}
|
|
51
|
+
disabled={control.disabled}
|
|
52
|
+
onChange={(event) => onChange(event.target.value)}
|
|
53
|
+
className={part("sc-control__input")}
|
|
54
|
+
{...ariaOf(control)}
|
|
55
|
+
/>
|
|
56
|
+
</Box>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Words over a few lines: the box grows with them up to a height, then scrolls. */
|
|
61
|
+
export function TextArea({ value, onChange, placeholder, ...control }: WordsProps) {
|
|
62
|
+
const part = useParts();
|
|
63
|
+
const box = useRef<HTMLTextAreaElement>(null);
|
|
64
|
+
useLayoutEffect(() => {
|
|
65
|
+
const element = box.current;
|
|
66
|
+
if (!element) return;
|
|
67
|
+
element.style.height = "auto";
|
|
68
|
+
element.style.height = `${element.scrollHeight}px`;
|
|
69
|
+
}, [value]);
|
|
70
|
+
return (
|
|
71
|
+
<Box invalid={control.invalid}>
|
|
72
|
+
<textarea
|
|
73
|
+
ref={box}
|
|
74
|
+
id={control.id}
|
|
75
|
+
rows={3}
|
|
76
|
+
placeholder={placeholder}
|
|
77
|
+
value={value}
|
|
78
|
+
disabled={control.disabled}
|
|
79
|
+
onChange={(event) => onChange(event.target.value)}
|
|
80
|
+
className={part("sc-control__input")}
|
|
81
|
+
{...ariaOf(control)}
|
|
82
|
+
/>
|
|
83
|
+
</Box>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** A number: typed, or a step at a time with − and + (or the arrows), its unit after it. */
|
|
88
|
+
export function NumberInput({
|
|
89
|
+
value,
|
|
90
|
+
onChange,
|
|
91
|
+
placeholder,
|
|
92
|
+
min,
|
|
93
|
+
max,
|
|
94
|
+
step,
|
|
95
|
+
unit,
|
|
96
|
+
...control
|
|
97
|
+
}: ControlBase &
|
|
98
|
+
NumberBounds & {
|
|
99
|
+
value: number | null;
|
|
100
|
+
onChange: (value: number | null) => void;
|
|
101
|
+
placeholder?: string | undefined;
|
|
102
|
+
unit?: string | undefined;
|
|
103
|
+
}) {
|
|
104
|
+
const { messages } = useKit();
|
|
105
|
+
const part = useParts();
|
|
106
|
+
const move = (direction: 1 | -1) => onChange(stepped({ min, max, step }, value, direction));
|
|
107
|
+
const atLeast = value !== null && min !== undefined && value <= min;
|
|
108
|
+
const atMost = value !== null && max !== undefined && value >= max;
|
|
109
|
+
return (
|
|
110
|
+
<Box
|
|
111
|
+
invalid={control.invalid}
|
|
112
|
+
end={
|
|
113
|
+
<>
|
|
114
|
+
{unit !== undefined && (
|
|
115
|
+
<span aria-hidden className={part("sc-control__unit")}>
|
|
116
|
+
{unit}
|
|
117
|
+
</span>
|
|
118
|
+
)}
|
|
119
|
+
<span className={part("sc-control__steppers")}>
|
|
120
|
+
<Stepper
|
|
121
|
+
label={messages.decrease}
|
|
122
|
+
off={control.disabled || atLeast}
|
|
123
|
+
onPress={() => move(-1)}
|
|
124
|
+
>
|
|
125
|
+
<MinusIcon aria-hidden />
|
|
126
|
+
</Stepper>
|
|
127
|
+
<Stepper
|
|
128
|
+
label={messages.increase}
|
|
129
|
+
off={control.disabled || atMost}
|
|
130
|
+
onPress={() => move(1)}
|
|
131
|
+
>
|
|
132
|
+
<PlusIcon aria-hidden />
|
|
133
|
+
</Stepper>
|
|
134
|
+
</span>
|
|
135
|
+
</>
|
|
136
|
+
}
|
|
137
|
+
>
|
|
138
|
+
<input
|
|
139
|
+
id={control.id}
|
|
140
|
+
type="number"
|
|
141
|
+
inputMode="decimal"
|
|
142
|
+
min={min}
|
|
143
|
+
max={max}
|
|
144
|
+
step={step ?? "any"}
|
|
145
|
+
placeholder={placeholder}
|
|
146
|
+
value={value ?? ""}
|
|
147
|
+
disabled={control.disabled}
|
|
148
|
+
onChange={(event) => {
|
|
149
|
+
const typed = event.target.value;
|
|
150
|
+
onChange(typed === "" ? null : Number(typed));
|
|
151
|
+
}}
|
|
152
|
+
onKeyDown={(event) => {
|
|
153
|
+
// The arrows step as the buttons do: within the bounds, on the step's decimals.
|
|
154
|
+
if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
|
|
155
|
+
event.preventDefault();
|
|
156
|
+
move(event.key === "ArrowUp" ? 1 : -1);
|
|
157
|
+
}}
|
|
158
|
+
className={part("sc-control__input")}
|
|
159
|
+
{...ariaOf(control)}
|
|
160
|
+
/>
|
|
161
|
+
</Box>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** A stepper is for the pointer; the keyboard has the arrows, so it takes no tab stop. */
|
|
166
|
+
function Stepper({
|
|
167
|
+
label,
|
|
168
|
+
off,
|
|
169
|
+
onPress,
|
|
170
|
+
children,
|
|
171
|
+
}: {
|
|
172
|
+
label: string;
|
|
173
|
+
off: boolean | undefined;
|
|
174
|
+
onPress: () => void;
|
|
175
|
+
children: ReactNode;
|
|
176
|
+
}) {
|
|
177
|
+
return (
|
|
178
|
+
<button type="button" tabIndex={-1} aria-label={label} disabled={off} onClick={onPress}>
|
|
179
|
+
{children}
|
|
180
|
+
</button>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** A value typed once and never shown again: hidden as it is typed, unless the person asks. */
|
|
185
|
+
export function SecretInput({ value, onChange, placeholder, ...control }: WordsProps) {
|
|
186
|
+
const { messages } = useKit();
|
|
187
|
+
const part = useParts();
|
|
188
|
+
const [shown, setShown] = useState(false);
|
|
189
|
+
return (
|
|
190
|
+
<Box
|
|
191
|
+
icon={LockSimpleIcon}
|
|
192
|
+
invalid={control.invalid}
|
|
193
|
+
end={
|
|
194
|
+
<button
|
|
195
|
+
type="button"
|
|
196
|
+
aria-label={shown ? messages.hide : messages.show}
|
|
197
|
+
aria-pressed={shown}
|
|
198
|
+
aria-controls={control.id}
|
|
199
|
+
disabled={control.disabled}
|
|
200
|
+
onClick={() => setShown((now) => !now)}
|
|
201
|
+
className={part("sc-control__reveal")}
|
|
202
|
+
>
|
|
203
|
+
{shown ? <EyeSlashIcon aria-hidden /> : <EyeIcon aria-hidden />}
|
|
204
|
+
</button>
|
|
205
|
+
}
|
|
206
|
+
>
|
|
207
|
+
<input
|
|
208
|
+
id={control.id}
|
|
209
|
+
type={shown ? "text" : "password"}
|
|
210
|
+
autoComplete="off"
|
|
211
|
+
autoCapitalize="off"
|
|
212
|
+
spellCheck={false}
|
|
213
|
+
placeholder={placeholder}
|
|
214
|
+
value={value}
|
|
215
|
+
disabled={control.disabled}
|
|
216
|
+
onChange={(event) => onChange(event.target.value)}
|
|
217
|
+
className={part("sc-control__input")}
|
|
218
|
+
{...ariaOf(control)}
|
|
219
|
+
/>
|
|
220
|
+
</Box>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** A box to tick, the sentence beside it its label; drawn in the accent once ticked. */
|
|
225
|
+
export function Checkbox({
|
|
226
|
+
value,
|
|
227
|
+
onChange,
|
|
228
|
+
children,
|
|
229
|
+
...control
|
|
230
|
+
}: Omit<ControlBase, "labelledBy" | "label"> & {
|
|
231
|
+
value: boolean;
|
|
232
|
+
onChange: (value: boolean) => void;
|
|
233
|
+
children: ReactNode;
|
|
234
|
+
}) {
|
|
235
|
+
const part = useParts();
|
|
236
|
+
return (
|
|
237
|
+
<label className={part("sc-check")}>
|
|
238
|
+
<input
|
|
239
|
+
id={control.id}
|
|
240
|
+
type="checkbox"
|
|
241
|
+
checked={value}
|
|
242
|
+
disabled={control.disabled}
|
|
243
|
+
onChange={(event) => onChange(event.target.checked)}
|
|
244
|
+
{...ariaOf(control)}
|
|
245
|
+
/>
|
|
246
|
+
<CheckIcon aria-hidden weight="bold" />
|
|
247
|
+
<span>{children}</span>
|
|
248
|
+
</label>
|
|
249
|
+
);
|
|
250
|
+
}
|
package/src/kit/List.tsx
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { CaretRightIcon, CheckIcon } from "@phosphor-icons/react";
|
|
2
|
+
import type { MouseEvent, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
import { joined, useParts } from "./context";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Rows in one hairline box, a hairline between each, like a group of settings: a list of
|
|
8
|
+
* things, of automations, of an agent's files.
|
|
9
|
+
*/
|
|
10
|
+
export function List({
|
|
11
|
+
label,
|
|
12
|
+
className,
|
|
13
|
+
children,
|
|
14
|
+
}: {
|
|
15
|
+
/** The list's name, for screen readers, when no heading above it says it. */
|
|
16
|
+
label?: string | undefined;
|
|
17
|
+
className?: string | undefined;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}) {
|
|
20
|
+
const part = useParts();
|
|
21
|
+
return (
|
|
22
|
+
<ul aria-label={label} part="list" className={joined(part("sc-list"), className)}>
|
|
23
|
+
{children}
|
|
24
|
+
</ul>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface RowProps {
|
|
29
|
+
/** At its start, usually a `Mark`: what kind of thing it is. */
|
|
30
|
+
mark?: ReactNode;
|
|
31
|
+
/** What it is, up to two lines. */
|
|
32
|
+
title: ReactNode;
|
|
33
|
+
/** A quieter line under it: when it runs, a detail. */
|
|
34
|
+
subtitle?: ReactNode;
|
|
35
|
+
/** What went wrong with it, under the rest in the danger tone: why a run failed. */
|
|
36
|
+
error?: ReactNode;
|
|
37
|
+
/** At its right, quiet, in figures that line up: a price, a time, a count. */
|
|
38
|
+
meta?: ReactNode;
|
|
39
|
+
/** The host's controls at its end, apart from the row's own press: a switch, a ⋯ menu. */
|
|
40
|
+
trailing?: ReactNode;
|
|
41
|
+
/** Pressing the row: it lights under the pointer and carries a caret. */
|
|
42
|
+
onPress?: (() => void) | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Where the row goes: it is a link to that page, which can be opened apart too. With
|
|
45
|
+
* `onPress`, a plain click calls it instead, so the host's router takes it there.
|
|
46
|
+
*/
|
|
47
|
+
href?: string | undefined;
|
|
48
|
+
/** It is the one picked: a check in the caret's place, on a breath of the accent. */
|
|
49
|
+
pressed?: boolean | undefined;
|
|
50
|
+
disabled?: boolean | undefined;
|
|
51
|
+
/** Kept in its place, quieter: something paused. */
|
|
52
|
+
quiet?: boolean | undefined;
|
|
53
|
+
className?: string | undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** A click that means "go here", not "open it apart" (a modifier, another button). */
|
|
57
|
+
const plain = (event: MouseEvent): boolean =>
|
|
58
|
+
!event.defaultPrevented &&
|
|
59
|
+
event.button === 0 &&
|
|
60
|
+
!(event.metaKey || event.ctrlKey || event.shiftKey || event.altKey);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* One row of a `List`: its mark, its title over a quieter line (and what went wrong, when
|
|
64
|
+
* something did), a detail at the right, the host's controls at its end. With `href` the row
|
|
65
|
+
* (but not its controls) is a link; with only `onPress`, a button.
|
|
66
|
+
*/
|
|
67
|
+
export function Row({
|
|
68
|
+
mark,
|
|
69
|
+
title,
|
|
70
|
+
subtitle,
|
|
71
|
+
error,
|
|
72
|
+
meta,
|
|
73
|
+
trailing,
|
|
74
|
+
onPress,
|
|
75
|
+
href,
|
|
76
|
+
pressed,
|
|
77
|
+
disabled,
|
|
78
|
+
quiet,
|
|
79
|
+
className,
|
|
80
|
+
}: RowProps) {
|
|
81
|
+
const part = useParts();
|
|
82
|
+
const body = (
|
|
83
|
+
<>
|
|
84
|
+
{mark}
|
|
85
|
+
<span className={part("sc-row__text")}>
|
|
86
|
+
<span className={part("sc-row__title")}>{title}</span>
|
|
87
|
+
{subtitle !== undefined && <span className={part("sc-row__subtitle")}>{subtitle}</span>}
|
|
88
|
+
{error !== undefined && <span className={part("sc-row__error")}>{error}</span>}
|
|
89
|
+
</span>
|
|
90
|
+
{meta !== undefined && <span className={part("sc-row__meta")}>{meta}</span>}
|
|
91
|
+
</>
|
|
92
|
+
);
|
|
93
|
+
return (
|
|
94
|
+
<li
|
|
95
|
+
part="row"
|
|
96
|
+
className={joined(
|
|
97
|
+
part(
|
|
98
|
+
"sc-row",
|
|
99
|
+
...(quiet ? (["sc-row--quiet"] as const) : []),
|
|
100
|
+
...(pressed ? (["sc-row--pressed"] as const) : []),
|
|
101
|
+
),
|
|
102
|
+
className,
|
|
103
|
+
)}
|
|
104
|
+
>
|
|
105
|
+
{href !== undefined ? (
|
|
106
|
+
<a
|
|
107
|
+
href={href}
|
|
108
|
+
onClick={(event) => {
|
|
109
|
+
if (!onPress || !plain(event)) return;
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
onPress();
|
|
112
|
+
}}
|
|
113
|
+
className={part("sc-row__main")}
|
|
114
|
+
>
|
|
115
|
+
{body}
|
|
116
|
+
<CaretRightIcon aria-hidden />
|
|
117
|
+
</a>
|
|
118
|
+
) : onPress ? (
|
|
119
|
+
<button
|
|
120
|
+
type="button"
|
|
121
|
+
disabled={disabled}
|
|
122
|
+
aria-pressed={pressed || undefined}
|
|
123
|
+
onClick={onPress}
|
|
124
|
+
className={part("sc-row__main")}
|
|
125
|
+
>
|
|
126
|
+
{body}
|
|
127
|
+
{pressed ? <CheckIcon aria-hidden weight="bold" /> : <CaretRightIcon aria-hidden />}
|
|
128
|
+
</button>
|
|
129
|
+
) : (
|
|
130
|
+
<div className={part("sc-row__main")}>{body}</div>
|
|
131
|
+
)}
|
|
132
|
+
{trailing !== undefined && <div className={part("sc-row__trailing")}>{trailing}</div>}
|
|
133
|
+
</li>
|
|
134
|
+
);
|
|
135
|
+
}
|
package/src/kit/Mark.tsx
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Icon } from "@phosphor-icons/react";
|
|
2
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
import { joined, useParts } from "./context";
|
|
5
|
+
|
|
6
|
+
export interface MarkProps {
|
|
7
|
+
/** A glyph, alone, in the muted ink: what kind of thing it is. */
|
|
8
|
+
icon?: Icon | undefined;
|
|
9
|
+
/** A picture instead: an app's logo, as it comes (a square one with its own ground, its corners
|
|
10
|
+
* softened). */
|
|
11
|
+
src?: string | undefined;
|
|
12
|
+
/** The picture is a photo that fills the mark, not a logo inside it. */
|
|
13
|
+
photo?: boolean | undefined;
|
|
14
|
+
/** What it holds is a logo (drawn by the host, as `children`): a picture in it is sized and
|
|
15
|
+
* cornered as `src`'s. */
|
|
16
|
+
logo?: boolean | undefined;
|
|
17
|
+
/** It stands for a person: their photo round, where a thing's is square. */
|
|
18
|
+
round?: boolean | undefined;
|
|
19
|
+
/** The host's own drawing, in place of `icon` or `src`: a glyph, a logo, an initial. */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
/** The side it keeps in its row, in pixels: 28 by default. */
|
|
22
|
+
size?: number | undefined;
|
|
23
|
+
className?: string | undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* What kind of thing a row is, at its start, bare: a glyph in the muted ink, an app's logo as it
|
|
28
|
+
* comes, an initial, or a photo (round for a person). Nothing is drawn behind it; it keeps its
|
|
29
|
+
* square so rows line up. It only shows, so it is hidden from screen readers.
|
|
30
|
+
*/
|
|
31
|
+
export function Mark({
|
|
32
|
+
icon: Glyph,
|
|
33
|
+
src,
|
|
34
|
+
photo,
|
|
35
|
+
logo,
|
|
36
|
+
round,
|
|
37
|
+
size = 28,
|
|
38
|
+
className,
|
|
39
|
+
children,
|
|
40
|
+
}: MarkProps) {
|
|
41
|
+
const part = useParts();
|
|
42
|
+
const kind = [
|
|
43
|
+
...(src === undefined && !logo
|
|
44
|
+
? []
|
|
45
|
+
: photo
|
|
46
|
+
? (["sc-mark--photo"] as const)
|
|
47
|
+
: (["sc-mark--logo"] as const)),
|
|
48
|
+
...(round ? (["sc-mark--round"] as const) : []),
|
|
49
|
+
];
|
|
50
|
+
return (
|
|
51
|
+
<span
|
|
52
|
+
aria-hidden
|
|
53
|
+
style={{ "--_mark": `${size}px` } as CSSProperties}
|
|
54
|
+
className={joined(part("sc-mark", ...kind), className)}
|
|
55
|
+
>
|
|
56
|
+
{children ??
|
|
57
|
+
(src !== undefined ? (
|
|
58
|
+
<img src={src} alt="" loading="lazy" referrerPolicy="no-referrer" />
|
|
59
|
+
) : (
|
|
60
|
+
Glyph && <Glyph weight="regular" />
|
|
61
|
+
))}
|
|
62
|
+
</span>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Children, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
import { joined, useParts } from "./context";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A few marks side by side, a little apart, and how many more after them: an agent's apps, its
|
|
7
|
+
* channels' kinds. Like a mark, it only shows, so screen readers skip it.
|
|
8
|
+
*/
|
|
9
|
+
export function MarkStack({
|
|
10
|
+
more = 0,
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
}: {
|
|
14
|
+
/** How many are not drawn: "+3" after the last. */
|
|
15
|
+
more?: number | undefined;
|
|
16
|
+
className?: string | undefined;
|
|
17
|
+
/** The marks, usually small `Mark`s or a host's logos. */
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}) {
|
|
20
|
+
const part = useParts();
|
|
21
|
+
return (
|
|
22
|
+
<span aria-hidden className={joined(part("sc-stack"), className)}>
|
|
23
|
+
{Children.map(children, (mark) => (
|
|
24
|
+
<span className={part("sc-stack__item")}>{mark}</span>
|
|
25
|
+
))}
|
|
26
|
+
{more > 0 && <span className={part("sc-stack__more")}>+{more}</span>}
|
|
27
|
+
</span>
|
|
28
|
+
);
|
|
29
|
+
}
|
package/src/kit/Note.tsx
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CheckCircleIcon,
|
|
3
|
+
InfoIcon,
|
|
4
|
+
WarningCircleIcon,
|
|
5
|
+
WarningIcon,
|
|
6
|
+
type Icon,
|
|
7
|
+
} from "@phosphor-icons/react";
|
|
8
|
+
import type { ReactNode } from "react";
|
|
9
|
+
|
|
10
|
+
import { joined, useParts } from "./context";
|
|
11
|
+
import type { Tone } from "./Stat";
|
|
12
|
+
|
|
13
|
+
const MARKS: Readonly<Record<Tone, Icon>> = {
|
|
14
|
+
info: InfoIcon,
|
|
15
|
+
success: CheckCircleIcon,
|
|
16
|
+
warning: WarningIcon,
|
|
17
|
+
danger: WarningCircleIcon,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** A line that stands out: its tone's mark and the words on a wash of it, edged by it. */
|
|
21
|
+
export function Note({
|
|
22
|
+
tone,
|
|
23
|
+
className,
|
|
24
|
+
children,
|
|
25
|
+
}: {
|
|
26
|
+
tone: Tone;
|
|
27
|
+
className?: string | undefined;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}) {
|
|
30
|
+
const part = useParts();
|
|
31
|
+
const Mark = MARKS[tone];
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
role="note"
|
|
35
|
+
part={`note note-${tone}`}
|
|
36
|
+
className={joined(part("sc-note", `sc-note--${tone}`), className)}
|
|
37
|
+
>
|
|
38
|
+
<Mark aria-hidden weight="fill" />
|
|
39
|
+
<div className={part("sc-note__body")}>{children}</div>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {
|
|
2
|
+
autoUpdate,
|
|
3
|
+
flip,
|
|
4
|
+
FloatingFocusManager,
|
|
5
|
+
FloatingPortal,
|
|
6
|
+
offset,
|
|
7
|
+
shift,
|
|
8
|
+
size,
|
|
9
|
+
useDismiss,
|
|
10
|
+
useFloating,
|
|
11
|
+
useInteractions,
|
|
12
|
+
useRole,
|
|
13
|
+
} from "@floating-ui/react";
|
|
14
|
+
import type { ReactNode } from "react";
|
|
15
|
+
|
|
16
|
+
import { useParts } from "./context";
|
|
17
|
+
|
|
18
|
+
/** The least height a panel keeps, flipping above its trigger before it shrinks under this. */
|
|
19
|
+
const LEAST = 180;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A panel that floats by its trigger: under it, flipped above when there is no room, kept in the
|
|
23
|
+
* window, as tall as fits; Escape or a press outside closes it. `width` "trigger" makes it as
|
|
24
|
+
* wide as its trigger (a list), "own" leaves it its own (a calendar). `role` is the panel's for
|
|
25
|
+
* a dialog; a combobox words its own.
|
|
26
|
+
*/
|
|
27
|
+
export function usePopover(
|
|
28
|
+
open: boolean,
|
|
29
|
+
setOpen: (open: boolean) => void,
|
|
30
|
+
{ width, role }: { width: "trigger" | "own"; role?: "dialog" },
|
|
31
|
+
) {
|
|
32
|
+
const floating = useFloating({
|
|
33
|
+
open,
|
|
34
|
+
onOpenChange: setOpen,
|
|
35
|
+
placement: "bottom-start",
|
|
36
|
+
// Placed by its offsets, so its opening can move it with a transform of its own.
|
|
37
|
+
transform: false,
|
|
38
|
+
whileElementsMounted: autoUpdate,
|
|
39
|
+
middleware: [
|
|
40
|
+
offset(6),
|
|
41
|
+
flip({ padding: 8, fallbackStrategy: "initialPlacement" }),
|
|
42
|
+
shift({ padding: 8 }),
|
|
43
|
+
size({
|
|
44
|
+
padding: 8,
|
|
45
|
+
apply({ rects, availableHeight, elements }) {
|
|
46
|
+
elements.floating.style.maxHeight = `${Math.max(LEAST, availableHeight)}px`;
|
|
47
|
+
if (width === "trigger") elements.floating.style.width = `${rects.reference.width}px`;
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
],
|
|
51
|
+
});
|
|
52
|
+
const dismiss = useDismiss(floating.context);
|
|
53
|
+
const dialog = useRole(floating.context, { role: "dialog", enabled: role === "dialog" });
|
|
54
|
+
const interactions = useInteractions([dismiss, dialog]);
|
|
55
|
+
return { ...floating, ...interactions };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type PopoverState = ReturnType<typeof usePopover>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Where the panel goes instead of the page's end: the host's dialog the trigger sits in (a modal
|
|
62
|
+
* one keeps the pointer and the focus inside itself), or the element the host marked
|
|
63
|
+
* `data-sc-portal` around it (a shadow root's, whose styles stop at its edge: the widget's).
|
|
64
|
+
* None is `undefined`, the page's end: floating-ui reads a `null` root as one still to come, and
|
|
65
|
+
* draws nothing until it does.
|
|
66
|
+
*/
|
|
67
|
+
const layerOf = (trigger: Element | null): HTMLElement | undefined =>
|
|
68
|
+
trigger?.closest<HTMLElement>(
|
|
69
|
+
'[role="dialog"], [role="alertdialog"], dialog, [data-sc-portal]',
|
|
70
|
+
) ?? undefined;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The panel itself, in a portal at the page's end so nothing clips it (inside the host's dialog
|
|
74
|
+
* or `data-sc-portal`, when the trigger is in one); it carries `sc`, so the host's tokens reach
|
|
75
|
+
* it there. With `focus` it takes the focus while open (a calendar, which puts it on a day) and
|
|
76
|
+
* gives it back to the trigger on close; tabbing out closes it. Without, focus stays where it is
|
|
77
|
+
* (a combobox's box).
|
|
78
|
+
*/
|
|
79
|
+
export function Popover({
|
|
80
|
+
popover,
|
|
81
|
+
focus,
|
|
82
|
+
label,
|
|
83
|
+
children,
|
|
84
|
+
}: {
|
|
85
|
+
popover: PopoverState;
|
|
86
|
+
focus: boolean;
|
|
87
|
+
label?: string | undefined;
|
|
88
|
+
children: ReactNode;
|
|
89
|
+
}) {
|
|
90
|
+
const part = useParts();
|
|
91
|
+
const panel = (
|
|
92
|
+
<div
|
|
93
|
+
ref={popover.refs.setFloating}
|
|
94
|
+
style={popover.floatingStyles}
|
|
95
|
+
aria-label={label}
|
|
96
|
+
{...popover.getFloatingProps({
|
|
97
|
+
// Escape closes the panel and goes no further: not the page's own Escape, not the chat's.
|
|
98
|
+
onKeyDown: (event) => {
|
|
99
|
+
if (event.key !== "Escape") return;
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
event.stopPropagation();
|
|
102
|
+
popover.context.onOpenChange(false);
|
|
103
|
+
},
|
|
104
|
+
})}
|
|
105
|
+
className={`sc ${part("sc-popover")}`}
|
|
106
|
+
>
|
|
107
|
+
{children}
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
return (
|
|
111
|
+
<FloatingPortal root={layerOf(popover.refs.domReference.current)}>
|
|
112
|
+
{focus ? (
|
|
113
|
+
<FloatingFocusManager context={popover.context} initialFocus={-1} modal={false}>
|
|
114
|
+
{panel}
|
|
115
|
+
</FloatingFocusManager>
|
|
116
|
+
) : (
|
|
117
|
+
panel
|
|
118
|
+
)}
|
|
119
|
+
</FloatingPortal>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
|
|
3
|
+
import { useKit, useParts } from "./context";
|
|
4
|
+
import { ariaOf, type ControlBase } from "./Field";
|
|
5
|
+
import { formatNumber, withUnit, type NumberBounds } from "./numbers";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A number on a slider between its least and its most: the value rides over the thumb in a
|
|
9
|
+
* bubble, with its unit, and the two ends sit under the track.
|
|
10
|
+
*/
|
|
11
|
+
export function RangeField({
|
|
12
|
+
value,
|
|
13
|
+
onChange,
|
|
14
|
+
min = 0,
|
|
15
|
+
max = 100,
|
|
16
|
+
step,
|
|
17
|
+
unit,
|
|
18
|
+
...control
|
|
19
|
+
}: ControlBase &
|
|
20
|
+
NumberBounds & {
|
|
21
|
+
value: number;
|
|
22
|
+
onChange: (value: number) => void;
|
|
23
|
+
unit?: string | undefined;
|
|
24
|
+
}) {
|
|
25
|
+
const { code } = useKit();
|
|
26
|
+
const part = useParts();
|
|
27
|
+
const share = max > min ? (Math.min(max, Math.max(min, value)) - min) / (max - min) : 0;
|
|
28
|
+
const said = withUnit(formatNumber(value, code), unit);
|
|
29
|
+
return (
|
|
30
|
+
<div className={part("sc-range")} style={{ "--_share": share } as CSSProperties}>
|
|
31
|
+
<output htmlFor={control.id} aria-hidden>
|
|
32
|
+
{said}
|
|
33
|
+
</output>
|
|
34
|
+
<input
|
|
35
|
+
id={control.id}
|
|
36
|
+
type="range"
|
|
37
|
+
min={min}
|
|
38
|
+
max={max}
|
|
39
|
+
step={step ?? 1}
|
|
40
|
+
value={value}
|
|
41
|
+
disabled={control.disabled}
|
|
42
|
+
onChange={(event) => onChange(Number(event.target.value))}
|
|
43
|
+
aria-valuetext={said}
|
|
44
|
+
{...ariaOf(control)}
|
|
45
|
+
aria-required={undefined}
|
|
46
|
+
/>
|
|
47
|
+
<span aria-hidden>
|
|
48
|
+
<span>{withUnit(formatNumber(min, code), unit)}</span>
|
|
49
|
+
<span>{withUnit(formatNumber(max, code), unit)}</span>
|
|
50
|
+
</span>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|