@signalcore/ui 0.1.0 → 1.0.0-beta.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/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 +1119 -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 +534 -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 +1795 -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 +270 -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 +6961 -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 +596 -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,205 @@
|
|
|
1
|
+
import { stepped } from "./numbers.js";
|
|
2
|
+
import { useKit, useParts } from "./context.js";
|
|
3
|
+
import { Box, ariaOf } from "./Field.js";
|
|
4
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
5
|
+
import { CheckIcon, EnvelopeSimpleIcon, EyeIcon, EyeSlashIcon, GlobeSimpleIcon, LockSimpleIcon, MinusIcon, PhoneIcon, PlusIcon } from "@phosphor-icons/react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/kit/Inputs.tsx
|
|
8
|
+
const SHAPES = {
|
|
9
|
+
text: {
|
|
10
|
+
type: "text",
|
|
11
|
+
inputMode: "text",
|
|
12
|
+
autoComplete: void 0,
|
|
13
|
+
icon: void 0
|
|
14
|
+
},
|
|
15
|
+
email: {
|
|
16
|
+
type: "email",
|
|
17
|
+
inputMode: "email",
|
|
18
|
+
autoComplete: "email",
|
|
19
|
+
icon: EnvelopeSimpleIcon
|
|
20
|
+
},
|
|
21
|
+
phone: {
|
|
22
|
+
type: "tel",
|
|
23
|
+
inputMode: "tel",
|
|
24
|
+
autoComplete: "tel",
|
|
25
|
+
icon: PhoneIcon
|
|
26
|
+
},
|
|
27
|
+
url: {
|
|
28
|
+
type: "url",
|
|
29
|
+
inputMode: "url",
|
|
30
|
+
autoComplete: "url",
|
|
31
|
+
icon: GlobeSimpleIcon
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/** Words on one line; an email, a phone or an address with its icon and the right keyboard. */
|
|
35
|
+
function TextInput({ kind = "text", value, onChange, placeholder, ...control }) {
|
|
36
|
+
const part = useParts();
|
|
37
|
+
const shape = SHAPES[kind];
|
|
38
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
39
|
+
icon: shape.icon,
|
|
40
|
+
invalid: control.invalid,
|
|
41
|
+
children: /* @__PURE__ */ jsx("input", {
|
|
42
|
+
id: control.id,
|
|
43
|
+
type: shape.type,
|
|
44
|
+
inputMode: shape.inputMode,
|
|
45
|
+
autoComplete: shape.autoComplete,
|
|
46
|
+
spellCheck: kind === "text" ? void 0 : false,
|
|
47
|
+
placeholder,
|
|
48
|
+
value,
|
|
49
|
+
disabled: control.disabled,
|
|
50
|
+
onChange: (event) => onChange(event.target.value),
|
|
51
|
+
className: part("sc-control__input"),
|
|
52
|
+
...ariaOf(control)
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/** Words over a few lines: the box grows with them up to a height, then scrolls. */
|
|
57
|
+
function TextArea({ value, onChange, placeholder, ...control }) {
|
|
58
|
+
const part = useParts();
|
|
59
|
+
const box = useRef(null);
|
|
60
|
+
useLayoutEffect(() => {
|
|
61
|
+
const element = box.current;
|
|
62
|
+
if (!element) return;
|
|
63
|
+
element.style.height = "auto";
|
|
64
|
+
element.style.height = `${element.scrollHeight}px`;
|
|
65
|
+
}, [value]);
|
|
66
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
67
|
+
invalid: control.invalid,
|
|
68
|
+
children: /* @__PURE__ */ jsx("textarea", {
|
|
69
|
+
ref: box,
|
|
70
|
+
id: control.id,
|
|
71
|
+
rows: 3,
|
|
72
|
+
placeholder,
|
|
73
|
+
value,
|
|
74
|
+
disabled: control.disabled,
|
|
75
|
+
onChange: (event) => onChange(event.target.value),
|
|
76
|
+
className: part("sc-control__input"),
|
|
77
|
+
...ariaOf(control)
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/** A number: typed, or a step at a time with − and + (or the arrows), its unit after it. */
|
|
82
|
+
function NumberInput({ value, onChange, placeholder, min, max, step, unit, ...control }) {
|
|
83
|
+
const { messages } = useKit();
|
|
84
|
+
const part = useParts();
|
|
85
|
+
const move = (direction) => onChange(stepped({
|
|
86
|
+
min,
|
|
87
|
+
max,
|
|
88
|
+
step
|
|
89
|
+
}, value, direction));
|
|
90
|
+
const atLeast = value !== null && min !== void 0 && value <= min;
|
|
91
|
+
const atMost = value !== null && max !== void 0 && value >= max;
|
|
92
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
93
|
+
invalid: control.invalid,
|
|
94
|
+
end: /* @__PURE__ */ jsxs(Fragment$1, { children: [unit !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
95
|
+
"aria-hidden": true,
|
|
96
|
+
className: part("sc-control__unit"),
|
|
97
|
+
children: unit
|
|
98
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
99
|
+
className: part("sc-control__steppers"),
|
|
100
|
+
children: [/* @__PURE__ */ jsx(Stepper, {
|
|
101
|
+
label: messages.decrease,
|
|
102
|
+
off: control.disabled || atLeast,
|
|
103
|
+
onPress: () => move(-1),
|
|
104
|
+
children: /* @__PURE__ */ jsx(MinusIcon, { "aria-hidden": true })
|
|
105
|
+
}), /* @__PURE__ */ jsx(Stepper, {
|
|
106
|
+
label: messages.increase,
|
|
107
|
+
off: control.disabled || atMost,
|
|
108
|
+
onPress: () => move(1),
|
|
109
|
+
children: /* @__PURE__ */ jsx(PlusIcon, { "aria-hidden": true })
|
|
110
|
+
})]
|
|
111
|
+
})] }),
|
|
112
|
+
children: /* @__PURE__ */ jsx("input", {
|
|
113
|
+
id: control.id,
|
|
114
|
+
type: "number",
|
|
115
|
+
inputMode: "decimal",
|
|
116
|
+
min,
|
|
117
|
+
max,
|
|
118
|
+
step: step ?? "any",
|
|
119
|
+
placeholder,
|
|
120
|
+
value: value ?? "",
|
|
121
|
+
disabled: control.disabled,
|
|
122
|
+
onChange: (event) => {
|
|
123
|
+
const typed = event.target.value;
|
|
124
|
+
onChange(typed === "" ? null : Number(typed));
|
|
125
|
+
},
|
|
126
|
+
onKeyDown: (event) => {
|
|
127
|
+
if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
move(event.key === "ArrowUp" ? 1 : -1);
|
|
130
|
+
},
|
|
131
|
+
className: part("sc-control__input"),
|
|
132
|
+
...ariaOf(control)
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/** A stepper is for the pointer; the keyboard has the arrows, so it takes no tab stop. */
|
|
137
|
+
function Stepper({ label, off, onPress, children }) {
|
|
138
|
+
return /* @__PURE__ */ jsx("button", {
|
|
139
|
+
type: "button",
|
|
140
|
+
tabIndex: -1,
|
|
141
|
+
"aria-label": label,
|
|
142
|
+
disabled: off,
|
|
143
|
+
onClick: onPress,
|
|
144
|
+
children
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/** A value typed once and never shown again: hidden as it is typed, unless the person asks. */
|
|
148
|
+
function SecretInput({ value, onChange, placeholder, ...control }) {
|
|
149
|
+
const { messages } = useKit();
|
|
150
|
+
const part = useParts();
|
|
151
|
+
const [shown, setShown] = useState(false);
|
|
152
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
153
|
+
icon: LockSimpleIcon,
|
|
154
|
+
invalid: control.invalid,
|
|
155
|
+
end: /* @__PURE__ */ jsx("button", {
|
|
156
|
+
type: "button",
|
|
157
|
+
"aria-label": shown ? messages.hide : messages.show,
|
|
158
|
+
"aria-pressed": shown,
|
|
159
|
+
"aria-controls": control.id,
|
|
160
|
+
disabled: control.disabled,
|
|
161
|
+
onClick: () => setShown((now) => !now),
|
|
162
|
+
className: part("sc-control__reveal"),
|
|
163
|
+
children: shown ? /* @__PURE__ */ jsx(EyeSlashIcon, { "aria-hidden": true }) : /* @__PURE__ */ jsx(EyeIcon, { "aria-hidden": true })
|
|
164
|
+
}),
|
|
165
|
+
children: /* @__PURE__ */ jsx("input", {
|
|
166
|
+
id: control.id,
|
|
167
|
+
type: shown ? "text" : "password",
|
|
168
|
+
autoComplete: "off",
|
|
169
|
+
autoCapitalize: "off",
|
|
170
|
+
spellCheck: false,
|
|
171
|
+
placeholder,
|
|
172
|
+
value,
|
|
173
|
+
disabled: control.disabled,
|
|
174
|
+
onChange: (event) => onChange(event.target.value),
|
|
175
|
+
className: part("sc-control__input"),
|
|
176
|
+
...ariaOf(control)
|
|
177
|
+
})
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/** A box to tick, the sentence beside it its label; drawn in the accent once ticked. */
|
|
181
|
+
function Checkbox({ value, onChange, children, ...control }) {
|
|
182
|
+
const part = useParts();
|
|
183
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
184
|
+
className: part("sc-check"),
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ jsx("input", {
|
|
187
|
+
id: control.id,
|
|
188
|
+
type: "checkbox",
|
|
189
|
+
checked: value,
|
|
190
|
+
disabled: control.disabled,
|
|
191
|
+
onChange: (event) => onChange(event.target.checked),
|
|
192
|
+
...ariaOf(control)
|
|
193
|
+
}),
|
|
194
|
+
/* @__PURE__ */ jsx(CheckIcon, {
|
|
195
|
+
"aria-hidden": true,
|
|
196
|
+
weight: "bold"
|
|
197
|
+
}),
|
|
198
|
+
/* @__PURE__ */ jsx("span", { children })
|
|
199
|
+
]
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
//#endregion
|
|
203
|
+
export { Checkbox, NumberInput, SecretInput, TextArea, TextInput };
|
|
204
|
+
|
|
205
|
+
//# sourceMappingURL=Inputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Inputs.js","names":[],"sources":["../../src/kit/Inputs.tsx"],"sourcesContent":["import {\n CheckIcon,\n EnvelopeSimpleIcon,\n EyeIcon,\n EyeSlashIcon,\n GlobeSimpleIcon,\n LockSimpleIcon,\n MinusIcon,\n PhoneIcon,\n PlusIcon,\n} from \"@phosphor-icons/react\";\nimport { useLayoutEffect, useRef, useState, type ReactNode } from \"react\";\n\nimport { useKit, useParts } from \"./context\";\nimport { ariaOf, Box, type ControlBase } from \"./Field\";\nimport { stepped, type NumberBounds } from \"./numbers\";\n\ninterface WordsProps extends ControlBase {\n value: string;\n onChange: (value: string) => void;\n placeholder?: string | undefined;\n}\n\nconst SHAPES = {\n text: { type: \"text\", inputMode: \"text\", autoComplete: undefined, icon: undefined },\n email: { type: \"email\", inputMode: \"email\", autoComplete: \"email\", icon: EnvelopeSimpleIcon },\n phone: { type: \"tel\", inputMode: \"tel\", autoComplete: \"tel\", icon: PhoneIcon },\n url: { type: \"url\", inputMode: \"url\", autoComplete: \"url\", icon: GlobeSimpleIcon },\n} as const;\n\n/** Words on one line; an email, a phone or an address with its icon and the right keyboard. */\nexport function TextInput({\n kind = \"text\",\n value,\n onChange,\n placeholder,\n ...control\n}: WordsProps & { kind?: keyof typeof SHAPES | undefined }) {\n const part = useParts();\n const shape = SHAPES[kind];\n return (\n <Box icon={shape.icon} invalid={control.invalid}>\n <input\n id={control.id}\n type={shape.type}\n inputMode={shape.inputMode}\n autoComplete={shape.autoComplete}\n spellCheck={kind === \"text\" ? undefined : false}\n placeholder={placeholder}\n value={value}\n disabled={control.disabled}\n onChange={(event) => onChange(event.target.value)}\n className={part(\"sc-control__input\")}\n {...ariaOf(control)}\n />\n </Box>\n );\n}\n\n/** Words over a few lines: the box grows with them up to a height, then scrolls. */\nexport function TextArea({ value, onChange, placeholder, ...control }: WordsProps) {\n const part = useParts();\n const box = useRef<HTMLTextAreaElement>(null);\n useLayoutEffect(() => {\n const element = box.current;\n if (!element) return;\n element.style.height = \"auto\";\n element.style.height = `${element.scrollHeight}px`;\n }, [value]);\n return (\n <Box invalid={control.invalid}>\n <textarea\n ref={box}\n id={control.id}\n rows={3}\n placeholder={placeholder}\n value={value}\n disabled={control.disabled}\n onChange={(event) => onChange(event.target.value)}\n className={part(\"sc-control__input\")}\n {...ariaOf(control)}\n />\n </Box>\n );\n}\n\n/** A number: typed, or a step at a time with − and + (or the arrows), its unit after it. */\nexport function NumberInput({\n value,\n onChange,\n placeholder,\n min,\n max,\n step,\n unit,\n ...control\n}: ControlBase &\n NumberBounds & {\n value: number | null;\n onChange: (value: number | null) => void;\n placeholder?: string | undefined;\n unit?: string | undefined;\n }) {\n const { messages } = useKit();\n const part = useParts();\n const move = (direction: 1 | -1) => onChange(stepped({ min, max, step }, value, direction));\n const atLeast = value !== null && min !== undefined && value <= min;\n const atMost = value !== null && max !== undefined && value >= max;\n return (\n <Box\n invalid={control.invalid}\n end={\n <>\n {unit !== undefined && (\n <span aria-hidden className={part(\"sc-control__unit\")}>\n {unit}\n </span>\n )}\n <span className={part(\"sc-control__steppers\")}>\n <Stepper\n label={messages.decrease}\n off={control.disabled || atLeast}\n onPress={() => move(-1)}\n >\n <MinusIcon aria-hidden />\n </Stepper>\n <Stepper\n label={messages.increase}\n off={control.disabled || atMost}\n onPress={() => move(1)}\n >\n <PlusIcon aria-hidden />\n </Stepper>\n </span>\n </>\n }\n >\n <input\n id={control.id}\n type=\"number\"\n inputMode=\"decimal\"\n min={min}\n max={max}\n step={step ?? \"any\"}\n placeholder={placeholder}\n value={value ?? \"\"}\n disabled={control.disabled}\n onChange={(event) => {\n const typed = event.target.value;\n onChange(typed === \"\" ? null : Number(typed));\n }}\n onKeyDown={(event) => {\n // The arrows step as the buttons do: within the bounds, on the step's decimals.\n if (event.key !== \"ArrowUp\" && event.key !== \"ArrowDown\") return;\n event.preventDefault();\n move(event.key === \"ArrowUp\" ? 1 : -1);\n }}\n className={part(\"sc-control__input\")}\n {...ariaOf(control)}\n />\n </Box>\n );\n}\n\n/** A stepper is for the pointer; the keyboard has the arrows, so it takes no tab stop. */\nfunction Stepper({\n label,\n off,\n onPress,\n children,\n}: {\n label: string;\n off: boolean | undefined;\n onPress: () => void;\n children: ReactNode;\n}) {\n return (\n <button type=\"button\" tabIndex={-1} aria-label={label} disabled={off} onClick={onPress}>\n {children}\n </button>\n );\n}\n\n/** A value typed once and never shown again: hidden as it is typed, unless the person asks. */\nexport function SecretInput({ value, onChange, placeholder, ...control }: WordsProps) {\n const { messages } = useKit();\n const part = useParts();\n const [shown, setShown] = useState(false);\n return (\n <Box\n icon={LockSimpleIcon}\n invalid={control.invalid}\n end={\n <button\n type=\"button\"\n aria-label={shown ? messages.hide : messages.show}\n aria-pressed={shown}\n aria-controls={control.id}\n disabled={control.disabled}\n onClick={() => setShown((now) => !now)}\n className={part(\"sc-control__reveal\")}\n >\n {shown ? <EyeSlashIcon aria-hidden /> : <EyeIcon aria-hidden />}\n </button>\n }\n >\n <input\n id={control.id}\n type={shown ? \"text\" : \"password\"}\n autoComplete=\"off\"\n autoCapitalize=\"off\"\n spellCheck={false}\n placeholder={placeholder}\n value={value}\n disabled={control.disabled}\n onChange={(event) => onChange(event.target.value)}\n className={part(\"sc-control__input\")}\n {...ariaOf(control)}\n />\n </Box>\n );\n}\n\n/** A box to tick, the sentence beside it its label; drawn in the accent once ticked. */\nexport function Checkbox({\n value,\n onChange,\n children,\n ...control\n}: Omit<ControlBase, \"labelledBy\" | \"label\"> & {\n value: boolean;\n onChange: (value: boolean) => void;\n children: ReactNode;\n}) {\n const part = useParts();\n return (\n <label className={part(\"sc-check\")}>\n <input\n id={control.id}\n type=\"checkbox\"\n checked={value}\n disabled={control.disabled}\n onChange={(event) => onChange(event.target.checked)}\n {...ariaOf(control)}\n />\n <CheckIcon aria-hidden weight=\"bold\" />\n <span>{children}</span>\n </label>\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/kit/List.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Rows in one hairline box, a hairline between each, like a group of settings: a list of
|
|
5
|
+
* things, of automations, of an agent's files.
|
|
6
|
+
*/
|
|
7
|
+
export declare function List({ label, className, children }: {
|
|
8
|
+
/** The list's name, for screen readers, when no heading above it says it. */
|
|
9
|
+
label?: string | undefined;
|
|
10
|
+
className?: string | undefined;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
export interface RowProps {
|
|
14
|
+
/** At its start, usually a `Mark`: what kind of thing it is. */
|
|
15
|
+
mark?: ReactNode;
|
|
16
|
+
/** What it is, up to two lines. */
|
|
17
|
+
title: ReactNode;
|
|
18
|
+
/** A quieter line under it: when it runs, a detail. */
|
|
19
|
+
subtitle?: ReactNode;
|
|
20
|
+
/** What went wrong with it, under the rest in the danger tone: why a run failed. */
|
|
21
|
+
error?: ReactNode;
|
|
22
|
+
/** At its right, quiet, in figures that line up: a price, a time, a count. */
|
|
23
|
+
meta?: ReactNode;
|
|
24
|
+
/** The host's controls at its end, apart from the row's own press: a switch, a ⋯ menu. */
|
|
25
|
+
trailing?: ReactNode;
|
|
26
|
+
/** Pressing the row: it lights under the pointer and carries a caret. */
|
|
27
|
+
onPress?: (() => void) | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Where the row goes: it is a link to that page, which can be opened apart too. With
|
|
30
|
+
* `onPress`, a plain click calls it instead, so the host's router takes it there.
|
|
31
|
+
*/
|
|
32
|
+
href?: string | undefined;
|
|
33
|
+
/** It is the one picked: a check in the caret's place, on a breath of the accent. */
|
|
34
|
+
pressed?: boolean | undefined;
|
|
35
|
+
disabled?: boolean | undefined;
|
|
36
|
+
/** Kept in its place, quieter: something paused. */
|
|
37
|
+
quiet?: boolean | undefined;
|
|
38
|
+
className?: string | undefined;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* One row of a `List`: its mark, its title over a quieter line (and what went wrong, when
|
|
42
|
+
* something did), a detail at the right, the host's controls at its end. With `href` the row
|
|
43
|
+
* (but not its controls) is a link; with only `onPress`, a button.
|
|
44
|
+
*/
|
|
45
|
+
export declare function Row({ mark, title, subtitle, error, meta, trailing, onPress, href, pressed, disabled, quiet, className }: RowProps): import("react").JSX.Element;
|
|
46
|
+
//#endregion
|
|
47
|
+
//# sourceMappingURL=List.d.ts.map
|
package/dist/kit/List.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { joined, useParts } from "./context.js";
|
|
2
|
+
import { CaretRightIcon, CheckIcon } from "@phosphor-icons/react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/kit/List.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Rows in one hairline box, a hairline between each, like a group of settings: a list of
|
|
7
|
+
* things, of automations, of an agent's files.
|
|
8
|
+
*/
|
|
9
|
+
function List({ label, className, children }) {
|
|
10
|
+
const part = useParts();
|
|
11
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
12
|
+
"aria-label": label,
|
|
13
|
+
part: "list",
|
|
14
|
+
className: joined(part("sc-list"), className),
|
|
15
|
+
children
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/** A click that means "go here", not "open it apart" (a modifier, another button). */
|
|
19
|
+
const plain = (event) => !event.defaultPrevented && event.button === 0 && !(event.metaKey || event.ctrlKey || event.shiftKey || event.altKey);
|
|
20
|
+
/**
|
|
21
|
+
* One row of a `List`: its mark, its title over a quieter line (and what went wrong, when
|
|
22
|
+
* something did), a detail at the right, the host's controls at its end. With `href` the row
|
|
23
|
+
* (but not its controls) is a link; with only `onPress`, a button.
|
|
24
|
+
*/
|
|
25
|
+
function Row({ mark, title, subtitle, error, meta, trailing, onPress, href, pressed, disabled, quiet, className }) {
|
|
26
|
+
const part = useParts();
|
|
27
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
28
|
+
mark,
|
|
29
|
+
/* @__PURE__ */ jsxs("span", {
|
|
30
|
+
className: part("sc-row__text"),
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: part("sc-row__title"),
|
|
34
|
+
children: title
|
|
35
|
+
}),
|
|
36
|
+
subtitle !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
37
|
+
className: part("sc-row__subtitle"),
|
|
38
|
+
children: subtitle
|
|
39
|
+
}),
|
|
40
|
+
error !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
41
|
+
className: part("sc-row__error"),
|
|
42
|
+
children: error
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
}),
|
|
46
|
+
meta !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
47
|
+
className: part("sc-row__meta"),
|
|
48
|
+
children: meta
|
|
49
|
+
})
|
|
50
|
+
] });
|
|
51
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
52
|
+
part: "row",
|
|
53
|
+
className: joined(part("sc-row", ...quiet ? ["sc-row--quiet"] : [], ...pressed ? ["sc-row--pressed"] : []), className),
|
|
54
|
+
children: [href !== void 0 ? /* @__PURE__ */ jsxs("a", {
|
|
55
|
+
href,
|
|
56
|
+
onClick: (event) => {
|
|
57
|
+
if (!onPress || !plain(event)) return;
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
onPress();
|
|
60
|
+
},
|
|
61
|
+
className: part("sc-row__main"),
|
|
62
|
+
children: [body, /* @__PURE__ */ jsx(CaretRightIcon, { "aria-hidden": true })]
|
|
63
|
+
}) : onPress ? /* @__PURE__ */ jsxs("button", {
|
|
64
|
+
type: "button",
|
|
65
|
+
disabled,
|
|
66
|
+
"aria-pressed": pressed || void 0,
|
|
67
|
+
onClick: onPress,
|
|
68
|
+
className: part("sc-row__main"),
|
|
69
|
+
children: [body, pressed ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
70
|
+
"aria-hidden": true,
|
|
71
|
+
weight: "bold"
|
|
72
|
+
}) : /* @__PURE__ */ jsx(CaretRightIcon, { "aria-hidden": true })]
|
|
73
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
74
|
+
className: part("sc-row__main"),
|
|
75
|
+
children: body
|
|
76
|
+
}), trailing !== void 0 && /* @__PURE__ */ jsx("div", {
|
|
77
|
+
className: part("sc-row__trailing"),
|
|
78
|
+
children: trailing
|
|
79
|
+
})]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { List, Row };
|
|
84
|
+
|
|
85
|
+
//# sourceMappingURL=List.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.js","names":[],"sources":["../../src/kit/List.tsx"],"sourcesContent":["import { CaretRightIcon, CheckIcon } from \"@phosphor-icons/react\";\nimport type { MouseEvent, ReactNode } from \"react\";\n\nimport { joined, useParts } from \"./context\";\n\n/**\n * Rows in one hairline box, a hairline between each, like a group of settings: a list of\n * things, of automations, of an agent's files.\n */\nexport function List({\n label,\n className,\n children,\n}: {\n /** The list's name, for screen readers, when no heading above it says it. */\n label?: string | undefined;\n className?: string | undefined;\n children: ReactNode;\n}) {\n const part = useParts();\n return (\n <ul aria-label={label} part=\"list\" className={joined(part(\"sc-list\"), className)}>\n {children}\n </ul>\n );\n}\n\nexport interface RowProps {\n /** At its start, usually a `Mark`: what kind of thing it is. */\n mark?: ReactNode;\n /** What it is, up to two lines. */\n title: ReactNode;\n /** A quieter line under it: when it runs, a detail. */\n subtitle?: ReactNode;\n /** What went wrong with it, under the rest in the danger tone: why a run failed. */\n error?: ReactNode;\n /** At its right, quiet, in figures that line up: a price, a time, a count. */\n meta?: ReactNode;\n /** The host's controls at its end, apart from the row's own press: a switch, a ⋯ menu. */\n trailing?: ReactNode;\n /** Pressing the row: it lights under the pointer and carries a caret. */\n onPress?: (() => void) | undefined;\n /**\n * Where the row goes: it is a link to that page, which can be opened apart too. With\n * `onPress`, a plain click calls it instead, so the host's router takes it there.\n */\n href?: string | undefined;\n /** It is the one picked: a check in the caret's place, on a breath of the accent. */\n pressed?: boolean | undefined;\n disabled?: boolean | undefined;\n /** Kept in its place, quieter: something paused. */\n quiet?: boolean | undefined;\n className?: string | undefined;\n}\n\n/** A click that means \"go here\", not \"open it apart\" (a modifier, another button). */\nconst plain = (event: MouseEvent): boolean =>\n !event.defaultPrevented &&\n event.button === 0 &&\n !(event.metaKey || event.ctrlKey || event.shiftKey || event.altKey);\n\n/**\n * One row of a `List`: its mark, its title over a quieter line (and what went wrong, when\n * something did), a detail at the right, the host's controls at its end. With `href` the row\n * (but not its controls) is a link; with only `onPress`, a button.\n */\nexport function Row({\n mark,\n title,\n subtitle,\n error,\n meta,\n trailing,\n onPress,\n href,\n pressed,\n disabled,\n quiet,\n className,\n}: RowProps) {\n const part = useParts();\n const body = (\n <>\n {mark}\n <span className={part(\"sc-row__text\")}>\n <span className={part(\"sc-row__title\")}>{title}</span>\n {subtitle !== undefined && <span className={part(\"sc-row__subtitle\")}>{subtitle}</span>}\n {error !== undefined && <span className={part(\"sc-row__error\")}>{error}</span>}\n </span>\n {meta !== undefined && <span className={part(\"sc-row__meta\")}>{meta}</span>}\n </>\n );\n return (\n <li\n part=\"row\"\n className={joined(\n part(\n \"sc-row\",\n ...(quiet ? ([\"sc-row--quiet\"] as const) : []),\n ...(pressed ? ([\"sc-row--pressed\"] as const) : []),\n ),\n className,\n )}\n >\n {href !== undefined ? (\n <a\n href={href}\n onClick={(event) => {\n if (!onPress || !plain(event)) return;\n event.preventDefault();\n onPress();\n }}\n className={part(\"sc-row__main\")}\n >\n {body}\n <CaretRightIcon aria-hidden />\n </a>\n ) : onPress ? (\n <button\n type=\"button\"\n disabled={disabled}\n aria-pressed={pressed || undefined}\n onClick={onPress}\n className={part(\"sc-row__main\")}\n >\n {body}\n {pressed ? <CheckIcon aria-hidden weight=\"bold\" /> : <CaretRightIcon aria-hidden />}\n </button>\n ) : (\n <div className={part(\"sc-row__main\")}>{body}</div>\n )}\n {trailing !== undefined && <div className={part(\"sc-row__trailing\")}>{trailing}</div>}\n </li>\n );\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,KAAK,EACnB,OACA,WACA,YAMC;CACD,MAAM,OAAO,SAAS;CACtB,OACE,oBAAC,MAAD;EAAI,cAAY;EAAO,MAAK;EAAO,WAAW,OAAO,KAAK,SAAS,GAAG,SAAS;EAC5E;CACC,CAAA;AAER;;AA+BA,MAAM,SAAS,UACb,CAAC,MAAM,oBACP,MAAM,WAAW,KACjB,EAAE,MAAM,WAAW,MAAM,WAAW,MAAM,YAAY,MAAM;;;;;;AAO9D,SAAgB,IAAI,EAClB,MACA,OACA,UACA,OACA,MACA,UACA,SACA,MACA,SACA,UACA,OACA,aACW;CACX,MAAM,OAAO,SAAS;CACtB,MAAM,OACJ,qBAAA,UAAA,EAAA,UAAA;EACG;EACD,qBAAC,QAAD;GAAM,WAAW,KAAK,cAAc;GAApC,UAAA;IACE,oBAAC,QAAD;KAAM,WAAW,KAAK,eAAe;KAAI,UAAA;IAAY,CAAA;IACpD,aAAa,KAAA,KAAa,oBAAC,QAAD;KAAM,WAAW,KAAK,kBAAkB;KAAI,UAAA;IAAe,CAAA;IACrF,UAAU,KAAA,KAAa,oBAAC,QAAD;KAAM,WAAW,KAAK,eAAe;KAAI,UAAA;IAAY,CAAA;GACzE;;EACL,SAAS,KAAA,KAAa,oBAAC,QAAD;GAAM,WAAW,KAAK,cAAc;GAAI,UAAA;EAAW,CAAA;CAC1E,EAAA,CAAA;CAEJ,OACE,qBAAC,MAAD;EACE,MAAK;EACL,WAAW,OACT,KACE,UACA,GAAI,QAAS,CAAC,eAAe,IAAc,CAAC,GAC5C,GAAI,UAAW,CAAC,iBAAiB,IAAc,CAAC,CAClD,GACA,SACF;EATF,UAAA,CAWG,SAAS,KAAA,IACR,qBAAC,KAAD;GACQ;GACN,UAAU,UAAU;IAClB,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,GAAG;IAC/B,MAAM,eAAe;IACrB,QAAQ;GACV;GACA,WAAW,KAAK,cAAc;GAPhC,UAAA,CASG,MACD,oBAAC,gBAAD,EAAgB,eAAA,KAAa,CAAA,CAC5B;EACD,CAAA,IAAA,UACF,qBAAC,UAAD;GACE,MAAK;GACK;GACV,gBAAc,WAAW,KAAA;GACzB,SAAS;GACT,WAAW,KAAK,cAAc;GALhC,UAAA,CAOG,MACA,UAAU,oBAAC,WAAD;IAAW,eAAA;IAAY,QAAO;GAAQ,CAAA,IAAI,oBAAC,gBAAD,EAAgB,eAAA,KAAa,CAAA,CAC5E;EAER,CAAA,IAAA,oBAAC,OAAD;GAAK,WAAW,KAAK,cAAc;GAAI,UAAA;EAAU,CAAA,GAElD,aAAa,KAAA,KAAa,oBAAC,OAAD;GAAK,WAAW,KAAK,kBAAkB;GAAI,UAAA;EAAc,CAAA,CAClF;;AAER"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Icon } from "@phosphor-icons/react";
|
|
3
|
+
//#region src/kit/Mark.d.ts
|
|
4
|
+
export interface MarkProps {
|
|
5
|
+
/** A glyph, alone, in the muted ink: what kind of thing it is. */
|
|
6
|
+
icon?: Icon | undefined;
|
|
7
|
+
/** A picture instead: an app's logo, as it comes (a square one with its own ground, its corners
|
|
8
|
+
* softened). */
|
|
9
|
+
src?: string | undefined;
|
|
10
|
+
/** The picture is a photo that fills the mark, not a logo inside it. */
|
|
11
|
+
photo?: boolean | undefined;
|
|
12
|
+
/** What it holds is a logo (drawn by the host, as `children`): a picture in it is sized and
|
|
13
|
+
* cornered as `src`'s. */
|
|
14
|
+
logo?: boolean | undefined;
|
|
15
|
+
/** It stands for a person: their photo round, where a thing's is square. */
|
|
16
|
+
round?: boolean | undefined;
|
|
17
|
+
/** The host's own drawing, in place of `icon` or `src`: a glyph, a logo, an initial. */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
/** The side it keeps in its row, in pixels: 28 by default. */
|
|
20
|
+
size?: number | undefined;
|
|
21
|
+
className?: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What kind of thing a row is, at its start, bare: a glyph in the muted ink, an app's logo as it
|
|
25
|
+
* comes, an initial, or a photo (round for a person). Nothing is drawn behind it; it keeps its
|
|
26
|
+
* square so rows line up. It only shows, so it is hidden from screen readers.
|
|
27
|
+
*/
|
|
28
|
+
export declare function Mark({ icon: Glyph, src, photo, logo, round, size, className, children }: MarkProps): import("react").JSX.Element;
|
|
29
|
+
//#endregion
|
|
30
|
+
//# sourceMappingURL=Mark.d.ts.map
|
package/dist/kit/Mark.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { joined, useParts } from "./context.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/kit/Mark.tsx
|
|
4
|
+
/**
|
|
5
|
+
* What kind of thing a row is, at its start, bare: a glyph in the muted ink, an app's logo as it
|
|
6
|
+
* comes, an initial, or a photo (round for a person). Nothing is drawn behind it; it keeps its
|
|
7
|
+
* square so rows line up. It only shows, so it is hidden from screen readers.
|
|
8
|
+
*/
|
|
9
|
+
function Mark({ icon: Glyph, src, photo, logo, round, size = 28, className, children }) {
|
|
10
|
+
const part = useParts();
|
|
11
|
+
const kind = [...src === void 0 && !logo ? [] : photo ? ["sc-mark--photo"] : ["sc-mark--logo"], ...round ? ["sc-mark--round"] : []];
|
|
12
|
+
return /* @__PURE__ */ jsx("span", {
|
|
13
|
+
"aria-hidden": true,
|
|
14
|
+
style: { "--_mark": `${size}px` },
|
|
15
|
+
className: joined(part("sc-mark", ...kind), className),
|
|
16
|
+
children: children ?? (src !== void 0 ? /* @__PURE__ */ jsx("img", {
|
|
17
|
+
src,
|
|
18
|
+
alt: "",
|
|
19
|
+
loading: "lazy",
|
|
20
|
+
referrerPolicy: "no-referrer"
|
|
21
|
+
}) : Glyph && /* @__PURE__ */ jsx(Glyph, { weight: "regular" }))
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { Mark };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=Mark.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mark.js","names":[],"sources":["../../src/kit/Mark.tsx"],"sourcesContent":["import type { Icon } from \"@phosphor-icons/react\";\nimport type { CSSProperties, ReactNode } from \"react\";\n\nimport { joined, useParts } from \"./context\";\n\nexport interface MarkProps {\n /** A glyph, alone, in the muted ink: what kind of thing it is. */\n icon?: Icon | undefined;\n /** A picture instead: an app's logo, as it comes (a square one with its own ground, its corners\n * softened). */\n src?: string | undefined;\n /** The picture is a photo that fills the mark, not a logo inside it. */\n photo?: boolean | undefined;\n /** What it holds is a logo (drawn by the host, as `children`): a picture in it is sized and\n * cornered as `src`'s. */\n logo?: boolean | undefined;\n /** It stands for a person: their photo round, where a thing's is square. */\n round?: boolean | undefined;\n /** The host's own drawing, in place of `icon` or `src`: a glyph, a logo, an initial. */\n children?: ReactNode;\n /** The side it keeps in its row, in pixels: 28 by default. */\n size?: number | undefined;\n className?: string | undefined;\n}\n\n/**\n * What kind of thing a row is, at its start, bare: a glyph in the muted ink, an app's logo as it\n * comes, an initial, or a photo (round for a person). Nothing is drawn behind it; it keeps its\n * square so rows line up. It only shows, so it is hidden from screen readers.\n */\nexport function Mark({\n icon: Glyph,\n src,\n photo,\n logo,\n round,\n size = 28,\n className,\n children,\n}: MarkProps) {\n const part = useParts();\n const kind = [\n ...(src === undefined && !logo\n ? []\n : photo\n ? ([\"sc-mark--photo\"] as const)\n : ([\"sc-mark--logo\"] as const)),\n ...(round ? ([\"sc-mark--round\"] as const) : []),\n ];\n return (\n <span\n aria-hidden\n style={{ \"--_mark\": `${size}px` } as CSSProperties}\n className={joined(part(\"sc-mark\", ...kind), className)}\n >\n {children ??\n (src !== undefined ? (\n <img src={src} alt=\"\" loading=\"lazy\" referrerPolicy=\"no-referrer\" />\n ) : (\n Glyph && <Glyph weight=\"regular\" />\n ))}\n </span>\n );\n}\n"],"mappings":";;;;;;;;AA8BA,SAAgB,KAAK,EACnB,MAAM,OACN,KACA,OACA,MACA,OACA,OAAO,IACP,WACA,YACY;CACZ,MAAM,OAAO,SAAS;CACtB,MAAM,OAAO,CACX,GAAI,QAAQ,KAAA,KAAa,CAAC,OACtB,CAAC,IACD,QACG,CAAC,gBAAgB,IACjB,CAAC,eAAe,GACvB,GAAI,QAAS,CAAC,gBAAgB,IAAc,CAAC,CAC/C;CACA,OACE,oBAAC,QAAD;EACE,eAAA;EACA,OAAO,EAAE,WAAW,GAAG,KAAK,IAAI;EAChC,WAAW,OAAO,KAAK,WAAW,GAAG,IAAI,GAAG,SAAS;EAEpD,UAAA,aACE,QAAQ,KAAA,IACP,oBAAC,OAAD;GAAU;GAAK,KAAI;GAAG,SAAQ;GAAO,gBAAe;EAAe,CAAA,IAEnE,SAAS,oBAAC,OAAD,EAAO,QAAO,UAAW,CAAA;CAElC,CAAA;AAEV"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/kit/MarkStack.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* A few marks side by side, a little apart, and how many more after them: an agent's apps, its
|
|
5
|
+
* channels' kinds. Like a mark, it only shows, so screen readers skip it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function MarkStack({ more, className, children }: {
|
|
8
|
+
/** How many are not drawn: "+3" after the last. */
|
|
9
|
+
more?: number | undefined;
|
|
10
|
+
className?: string | undefined;
|
|
11
|
+
/** The marks, usually small `Mark`s or a host's logos. */
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
//# sourceMappingURL=MarkStack.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { joined, useParts } from "./context.js";
|
|
2
|
+
import { Children } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/kit/MarkStack.tsx
|
|
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
|
+
function MarkStack({ more = 0, className, children }) {
|
|
10
|
+
const part = useParts();
|
|
11
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
12
|
+
"aria-hidden": true,
|
|
13
|
+
className: joined(part("sc-stack"), className),
|
|
14
|
+
children: [Children.map(children, (mark) => /* @__PURE__ */ jsx("span", {
|
|
15
|
+
className: part("sc-stack__item"),
|
|
16
|
+
children: mark
|
|
17
|
+
})), more > 0 && /* @__PURE__ */ jsxs("span", {
|
|
18
|
+
className: part("sc-stack__more"),
|
|
19
|
+
children: ["+", more]
|
|
20
|
+
})]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { MarkStack };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=MarkStack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkStack.js","names":[],"sources":["../../src/kit/MarkStack.tsx"],"sourcesContent":["import { Children, type ReactNode } from \"react\";\n\nimport { joined, useParts } from \"./context\";\n\n/**\n * A few marks side by side, a little apart, and how many more after them: an agent's apps, its\n * channels' kinds. Like a mark, it only shows, so screen readers skip it.\n */\nexport function MarkStack({\n more = 0,\n className,\n children,\n}: {\n /** How many are not drawn: \"+3\" after the last. */\n more?: number | undefined;\n className?: string | undefined;\n /** The marks, usually small `Mark`s or a host's logos. */\n children: ReactNode;\n}) {\n const part = useParts();\n return (\n <span aria-hidden className={joined(part(\"sc-stack\"), className)}>\n {Children.map(children, (mark) => (\n <span className={part(\"sc-stack__item\")}>{mark}</span>\n ))}\n {more > 0 && <span className={part(\"sc-stack__more\")}>+{more}</span>}\n </span>\n );\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,UAAU,EACxB,OAAO,GACP,WACA,YAOC;CACD,MAAM,OAAO,SAAS;CACtB,OACE,qBAAC,QAAD;EAAM,eAAA;EAAY,WAAW,OAAO,KAAK,UAAU,GAAG,SAAS;EAA/D,UAAA,CACG,SAAS,IAAI,WAAW,SACvB,oBAAC,QAAD;GAAM,WAAW,KAAK,gBAAgB;GAAI,UAAA;EAAW,CAAA,CACtD,GACA,OAAO,KAAK,qBAAC,QAAD;GAAM,WAAW,KAAK,gBAAgB;GAAtC,UAAA,CAAyC,KAAE,IAAW;EAC/D,CAAA,CAAA;;AAEV"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tone } from "./Stat.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/kit/Note.d.ts
|
|
4
|
+
/** A line that stands out: its tone's mark and the words on a wash of it, edged by it. */
|
|
5
|
+
export declare function Note({ tone, className, children }: {
|
|
6
|
+
tone: Tone;
|
|
7
|
+
className?: string | undefined;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
|
+
//#endregion
|
|
11
|
+
//# sourceMappingURL=Note.d.ts.map
|
package/dist/kit/Note.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { joined, useParts } from "./context.js";
|
|
2
|
+
import { CheckCircleIcon, InfoIcon, WarningCircleIcon, WarningIcon } from "@phosphor-icons/react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/kit/Note.tsx
|
|
5
|
+
const MARKS = {
|
|
6
|
+
info: InfoIcon,
|
|
7
|
+
success: CheckCircleIcon,
|
|
8
|
+
warning: WarningIcon,
|
|
9
|
+
danger: WarningCircleIcon
|
|
10
|
+
};
|
|
11
|
+
/** A line that stands out: its tone's mark and the words on a wash of it, edged by it. */
|
|
12
|
+
function Note({ tone, className, children }) {
|
|
13
|
+
const part = useParts();
|
|
14
|
+
const Mark = MARKS[tone];
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
16
|
+
role: "note",
|
|
17
|
+
part: `note note-${tone}`,
|
|
18
|
+
className: joined(part("sc-note", `sc-note--${tone}`), className),
|
|
19
|
+
children: [/* @__PURE__ */ jsx(Mark, {
|
|
20
|
+
"aria-hidden": true,
|
|
21
|
+
weight: "fill"
|
|
22
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
23
|
+
className: part("sc-note__body"),
|
|
24
|
+
children
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Note };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=Note.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Note.js","names":[],"sources":["../../src/kit/Note.tsx"],"sourcesContent":["import {\n CheckCircleIcon,\n InfoIcon,\n WarningCircleIcon,\n WarningIcon,\n type Icon,\n} from \"@phosphor-icons/react\";\nimport type { ReactNode } from \"react\";\n\nimport { joined, useParts } from \"./context\";\nimport type { Tone } from \"./Stat\";\n\nconst MARKS: Readonly<Record<Tone, Icon>> = {\n info: InfoIcon,\n success: CheckCircleIcon,\n warning: WarningIcon,\n danger: WarningCircleIcon,\n};\n\n/** A line that stands out: its tone's mark and the words on a wash of it, edged by it. */\nexport function Note({\n tone,\n className,\n children,\n}: {\n tone: Tone;\n className?: string | undefined;\n children: ReactNode;\n}) {\n const part = useParts();\n const Mark = MARKS[tone];\n return (\n <div\n role=\"note\"\n part={`note note-${tone}`}\n className={joined(part(\"sc-note\", `sc-note--${tone}`), className)}\n >\n <Mark aria-hidden weight=\"fill\" />\n <div className={part(\"sc-note__body\")}>{children}</div>\n </div>\n );\n}\n"],"mappings":";;;;AAYA,MAAM,QAAsC;CAC1C,MAAM;CACN,SAAS;CACT,SAAS;CACT,QAAQ;AACV;;AAGA,SAAgB,KAAK,EACnB,MACA,WACA,YAKC;CACD,MAAM,OAAO,SAAS;CACtB,MAAM,OAAO,MAAM;CACnB,OACE,qBAAC,OAAD;EACE,MAAK;EACL,MAAM,aAAa;EACnB,WAAW,OAAO,KAAK,WAAW,YAAY,MAAM,GAAG,SAAS;EAHlE,UAAA,CAKE,oBAAC,MAAD;GAAM,eAAA;GAAY,QAAO;EAAQ,CAAA,GACjC,oBAAC,OAAD;GAAK,WAAW,KAAK,eAAe;GAAI;EAAc,CAAA,CACnD;;AAET"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { useParts } from "./context.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { FloatingFocusManager, FloatingPortal, autoUpdate, flip, offset, shift, size, useDismiss, useFloating, useInteractions, useRole } from "@floating-ui/react";
|
|
4
|
+
//#region src/kit/Popover.tsx
|
|
5
|
+
/** The least height a panel keeps, flipping above its trigger before it shrinks under this. */
|
|
6
|
+
const LEAST = 180;
|
|
7
|
+
/**
|
|
8
|
+
* A panel that floats by its trigger: under it, flipped above when there is no room, kept in the
|
|
9
|
+
* window, as tall as fits; Escape or a press outside closes it. `width` "trigger" makes it as
|
|
10
|
+
* wide as its trigger (a list), "own" leaves it its own (a calendar). `role` is the panel's for
|
|
11
|
+
* a dialog; a combobox words its own.
|
|
12
|
+
*/
|
|
13
|
+
function usePopover(open, setOpen, { width, role }) {
|
|
14
|
+
const floating = useFloating({
|
|
15
|
+
open,
|
|
16
|
+
onOpenChange: setOpen,
|
|
17
|
+
placement: "bottom-start",
|
|
18
|
+
transform: false,
|
|
19
|
+
whileElementsMounted: autoUpdate,
|
|
20
|
+
middleware: [
|
|
21
|
+
offset(6),
|
|
22
|
+
flip({
|
|
23
|
+
padding: 8,
|
|
24
|
+
fallbackStrategy: "initialPlacement"
|
|
25
|
+
}),
|
|
26
|
+
shift({ padding: 8 }),
|
|
27
|
+
size({
|
|
28
|
+
padding: 8,
|
|
29
|
+
apply({ rects, availableHeight, elements }) {
|
|
30
|
+
elements.floating.style.maxHeight = `${Math.max(LEAST, availableHeight)}px`;
|
|
31
|
+
if (width === "trigger") elements.floating.style.width = `${rects.reference.width}px`;
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
const dismiss = useDismiss(floating.context);
|
|
37
|
+
const dialog = useRole(floating.context, {
|
|
38
|
+
role: "dialog",
|
|
39
|
+
enabled: role === "dialog"
|
|
40
|
+
});
|
|
41
|
+
const interactions = useInteractions([dismiss, dialog]);
|
|
42
|
+
return {
|
|
43
|
+
...floating,
|
|
44
|
+
...interactions
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Where the panel goes instead of the page's end: the host's dialog the trigger sits in (a modal
|
|
49
|
+
* one keeps the pointer and the focus inside itself), or the element the host marked
|
|
50
|
+
* `data-sc-portal` around it (a shadow root's, whose styles stop at its edge: the widget's).
|
|
51
|
+
* None is `undefined`, the page's end: floating-ui reads a `null` root as one still to come, and
|
|
52
|
+
* draws nothing until it does.
|
|
53
|
+
*/
|
|
54
|
+
const layerOf = (trigger) => trigger?.closest("[role=\"dialog\"], [role=\"alertdialog\"], dialog, [data-sc-portal]") ?? void 0;
|
|
55
|
+
/**
|
|
56
|
+
* The panel itself, in a portal at the page's end so nothing clips it (inside the host's dialog
|
|
57
|
+
* or `data-sc-portal`, when the trigger is in one); it carries `sc`, so the host's tokens reach
|
|
58
|
+
* it there. With `focus` it takes the focus while open (a calendar, which puts it on a day) and
|
|
59
|
+
* gives it back to the trigger on close; tabbing out closes it. Without, focus stays where it is
|
|
60
|
+
* (a combobox's box).
|
|
61
|
+
*/
|
|
62
|
+
function Popover({ popover, focus, label, children }) {
|
|
63
|
+
const part = useParts();
|
|
64
|
+
const panel = /* @__PURE__ */ jsx("div", {
|
|
65
|
+
ref: popover.refs.setFloating,
|
|
66
|
+
style: popover.floatingStyles,
|
|
67
|
+
"aria-label": label,
|
|
68
|
+
...popover.getFloatingProps({ onKeyDown: (event) => {
|
|
69
|
+
if (event.key !== "Escape") return;
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
popover.context.onOpenChange(false);
|
|
73
|
+
} }),
|
|
74
|
+
className: `sc ${part("sc-popover")}`,
|
|
75
|
+
children
|
|
76
|
+
});
|
|
77
|
+
return /* @__PURE__ */ jsx(FloatingPortal, {
|
|
78
|
+
root: layerOf(popover.refs.domReference.current),
|
|
79
|
+
children: focus ? /* @__PURE__ */ jsx(FloatingFocusManager, {
|
|
80
|
+
context: popover.context,
|
|
81
|
+
initialFocus: -1,
|
|
82
|
+
modal: false,
|
|
83
|
+
children: panel
|
|
84
|
+
}) : panel
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { Popover, usePopover };
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=Popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popover.js","names":[],"sources":["../../src/kit/Popover.tsx"],"sourcesContent":["import {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingPortal,\n offset,\n shift,\n size,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from \"@floating-ui/react\";\nimport type { ReactNode } from \"react\";\n\nimport { useParts } from \"./context\";\n\n/** The least height a panel keeps, flipping above its trigger before it shrinks under this. */\nconst LEAST = 180;\n\n/**\n * A panel that floats by its trigger: under it, flipped above when there is no room, kept in the\n * window, as tall as fits; Escape or a press outside closes it. `width` \"trigger\" makes it as\n * wide as its trigger (a list), \"own\" leaves it its own (a calendar). `role` is the panel's for\n * a dialog; a combobox words its own.\n */\nexport function usePopover(\n open: boolean,\n setOpen: (open: boolean) => void,\n { width, role }: { width: \"trigger\" | \"own\"; role?: \"dialog\" },\n) {\n const floating = useFloating({\n open,\n onOpenChange: setOpen,\n placement: \"bottom-start\",\n // Placed by its offsets, so its opening can move it with a transform of its own.\n transform: false,\n whileElementsMounted: autoUpdate,\n middleware: [\n offset(6),\n flip({ padding: 8, fallbackStrategy: \"initialPlacement\" }),\n shift({ padding: 8 }),\n size({\n padding: 8,\n apply({ rects, availableHeight, elements }) {\n elements.floating.style.maxHeight = `${Math.max(LEAST, availableHeight)}px`;\n if (width === \"trigger\") elements.floating.style.width = `${rects.reference.width}px`;\n },\n }),\n ],\n });\n const dismiss = useDismiss(floating.context);\n const dialog = useRole(floating.context, { role: \"dialog\", enabled: role === \"dialog\" });\n const interactions = useInteractions([dismiss, dialog]);\n return { ...floating, ...interactions };\n}\n\nexport type PopoverState = ReturnType<typeof usePopover>;\n\n/**\n * Where the panel goes instead of the page's end: the host's dialog the trigger sits in (a modal\n * one keeps the pointer and the focus inside itself), or the element the host marked\n * `data-sc-portal` around it (a shadow root's, whose styles stop at its edge: the widget's).\n * None is `undefined`, the page's end: floating-ui reads a `null` root as one still to come, and\n * draws nothing until it does.\n */\nconst layerOf = (trigger: Element | null): HTMLElement | undefined =>\n trigger?.closest<HTMLElement>(\n '[role=\"dialog\"], [role=\"alertdialog\"], dialog, [data-sc-portal]',\n ) ?? undefined;\n\n/**\n * The panel itself, in a portal at the page's end so nothing clips it (inside the host's dialog\n * or `data-sc-portal`, when the trigger is in one); it carries `sc`, so the host's tokens reach\n * it there. With `focus` it takes the focus while open (a calendar, which puts it on a day) and\n * gives it back to the trigger on close; tabbing out closes it. Without, focus stays where it is\n * (a combobox's box).\n */\nexport function Popover({\n popover,\n focus,\n label,\n children,\n}: {\n popover: PopoverState;\n focus: boolean;\n label?: string | undefined;\n children: ReactNode;\n}) {\n const part = useParts();\n const panel = (\n <div\n ref={popover.refs.setFloating}\n style={popover.floatingStyles}\n aria-label={label}\n {...popover.getFloatingProps({\n // Escape closes the panel and goes no further: not the page's own Escape, not the chat's.\n onKeyDown: (event) => {\n if (event.key !== \"Escape\") return;\n event.preventDefault();\n event.stopPropagation();\n popover.context.onOpenChange(false);\n },\n })}\n className={`sc ${part(\"sc-popover\")}`}\n >\n {children}\n </div>\n );\n return (\n <FloatingPortal root={layerOf(popover.refs.domReference.current)}>\n {focus ? (\n <FloatingFocusManager context={popover.context} initialFocus={-1} modal={false}>\n {panel}\n </FloatingFocusManager>\n ) : (\n panel\n )}\n </FloatingPortal>\n );\n}\n"],"mappings":";;;;;AAkBA,MAAM,QAAQ;;;;;;;AAQd,SAAgB,WACd,MACA,SACA,EAAE,OAAO,QACT;CACA,MAAM,WAAW,YAAY;EAC3B;EACA,cAAc;EACd,WAAW;EAEX,WAAW;EACX,sBAAsB;EACtB,YAAY;GACV,OAAO,CAAC;GACR,KAAK;IAAE,SAAS;IAAG,kBAAkB;GAAmB,CAAC;GACzD,MAAM,EAAE,SAAS,EAAE,CAAC;GACpB,KAAK;IACH,SAAS;IACT,MAAM,EAAE,OAAO,iBAAiB,YAAY;KAC1C,SAAS,SAAS,MAAM,YAAY,GAAG,KAAK,IAAI,OAAO,eAAe,EAAE;KACxE,IAAI,UAAU,WAAW,SAAS,SAAS,MAAM,QAAQ,GAAG,MAAM,UAAU,MAAM;IACpF;GACF,CAAC;EACH;CACF,CAAC;CACD,MAAM,UAAU,WAAW,SAAS,OAAO;CAC3C,MAAM,SAAS,QAAQ,SAAS,SAAS;EAAE,MAAM;EAAU,SAAS,SAAS;CAAS,CAAC;CACvF,MAAM,eAAe,gBAAgB,CAAC,SAAS,MAAM,CAAC;CACtD,OAAO;EAAE,GAAG;EAAU,GAAG;CAAa;AACxC;;;;;;;;AAWA,MAAM,WAAW,YACf,SAAS,QACP,qEACF,KAAK,KAAA;;;;;;;;AASP,SAAgB,QAAQ,EACtB,SACA,OACA,OACA,YAMC;CACD,MAAM,OAAO,SAAS;CACtB,MAAM,QACJ,oBAAC,OAAD;EACE,KAAK,QAAQ,KAAK;EAClB,OAAO,QAAQ;EACf,cAAY;EACZ,GAAI,QAAQ,iBAAiB,EAE3B,YAAY,UAAU;GACpB,IAAI,MAAM,QAAQ,UAAU;GAC5B,MAAM,eAAe;GACrB,MAAM,gBAAgB;GACtB,QAAQ,QAAQ,aAAa,KAAK;EACpC,EACF,CAAC;EACD,WAAW,MAAM,KAAK,YAAY;EAEjC;CACE,CAAA;CAEP,OACE,oBAAC,gBAAD;EAAgB,MAAM,QAAQ,QAAQ,KAAK,aAAa,OAAO;EAC5D,UAAA,QACC,oBAAC,sBAAD;GAAsB,SAAS,QAAQ;GAAS,cAAc;GAAI,OAAO;GACtE,UAAA;EACmB,CAAA,IAEtB;CAEY,CAAA;AAEpB"}
|