@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,133 @@
|
|
|
1
|
+
import { useKit, useParts } from "./context.js";
|
|
2
|
+
import { ariaOf } from "./Field.js";
|
|
3
|
+
import { Popover, usePopover } from "./Popover.js";
|
|
4
|
+
import { dayAllowed, dayOf, daySpan, formatDay, isoDay, openingDay } from "./dates.js";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { CalendarBlankIcon, CaretDownIcon, CaretLeftIcon, CaretRightIcon } from "@phosphor-icons/react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { DayPicker } from "react-day-picker";
|
|
9
|
+
//#region src/kit/DateField.tsx
|
|
10
|
+
/** The calendar's parts, under the kit's names: the host's look reaches them by token. */
|
|
11
|
+
const CALENDAR = {
|
|
12
|
+
months: "sc-calendar__months",
|
|
13
|
+
month: "sc-calendar__month",
|
|
14
|
+
month_caption: "sc-calendar__caption",
|
|
15
|
+
caption_label: "sc-calendar__title",
|
|
16
|
+
nav: "sc-calendar__nav",
|
|
17
|
+
button_previous: "sc-calendar__step",
|
|
18
|
+
button_next: "sc-calendar__step",
|
|
19
|
+
chevron: "sc-calendar__chevron",
|
|
20
|
+
month_grid: "sc-calendar__grid",
|
|
21
|
+
weekdays: "sc-calendar__weekdays",
|
|
22
|
+
weekday: "sc-calendar__weekday",
|
|
23
|
+
weeks: "sc-calendar__weeks",
|
|
24
|
+
week: "sc-calendar__week",
|
|
25
|
+
day: "sc-calendar__day",
|
|
26
|
+
day_button: "sc-calendar__button",
|
|
27
|
+
selected: "sc-calendar__day--selected",
|
|
28
|
+
today: "sc-calendar__day--today",
|
|
29
|
+
disabled: "sc-calendar__day--disabled",
|
|
30
|
+
outside: "sc-calendar__day--outside",
|
|
31
|
+
hidden: "sc-calendar__day--hidden",
|
|
32
|
+
focused: "sc-calendar__day--focused"
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A day: a button that reads the day picked in the host's language and opens a calendar under
|
|
36
|
+
* it. Only the days offered can be picked (`dates`, between `earliest` and `latest`), and when
|
|
37
|
+
* they are bounded, those stand out. Picking one closes it and gives the focus back.
|
|
38
|
+
*/
|
|
39
|
+
function DateField({ value, onChange, placeholder, dates, earliest, latest, ...control }) {
|
|
40
|
+
const { code, messages } = useKit();
|
|
41
|
+
const part = useParts();
|
|
42
|
+
const [open, setOpen] = useState(false);
|
|
43
|
+
const popover = usePopover(open, setOpen, {
|
|
44
|
+
width: "own",
|
|
45
|
+
role: "dialog"
|
|
46
|
+
});
|
|
47
|
+
const picked = value !== null && dayOf(value) ? value : null;
|
|
48
|
+
const { id, labelledBy } = control;
|
|
49
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
|
|
50
|
+
ref: popover.refs.setReference,
|
|
51
|
+
id,
|
|
52
|
+
type: "button",
|
|
53
|
+
disabled: control.disabled,
|
|
54
|
+
"data-invalid": control.invalid || void 0,
|
|
55
|
+
"data-empty": picked === null || void 0,
|
|
56
|
+
...popover.getReferenceProps({ onClick: () => setOpen(!open) }),
|
|
57
|
+
...ariaOf(control),
|
|
58
|
+
"aria-labelledby": labelledBy === void 0 || id === void 0 ? labelledBy : `${labelledBy} ${id}`,
|
|
59
|
+
"aria-required": void 0,
|
|
60
|
+
part: "control",
|
|
61
|
+
className: part("sc-control", "sc-control--trigger"),
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ jsx(CalendarBlankIcon, { "aria-hidden": true }),
|
|
64
|
+
/* @__PURE__ */ jsx("span", { children: picked ? formatDay(picked, code) : placeholder ?? messages.chooseDate }),
|
|
65
|
+
/* @__PURE__ */ jsx(CaretDownIcon, { "aria-hidden": true })
|
|
66
|
+
]
|
|
67
|
+
}), open && /* @__PURE__ */ jsx(Popover, {
|
|
68
|
+
popover,
|
|
69
|
+
focus: true,
|
|
70
|
+
label: messages.chooseDate,
|
|
71
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
72
|
+
bounds: {
|
|
73
|
+
dates,
|
|
74
|
+
earliest,
|
|
75
|
+
latest
|
|
76
|
+
},
|
|
77
|
+
picked,
|
|
78
|
+
onPick: (day) => {
|
|
79
|
+
onChange(day);
|
|
80
|
+
setOpen(false);
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
})] });
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The month grid, react-day-picker in the kit's look: it opens on the day picked, else the
|
|
87
|
+
* first offered; it goes no further than the bounds; the arrows walk the days, Page Up and Down
|
|
88
|
+
* the months.
|
|
89
|
+
*/
|
|
90
|
+
function Calendar({ bounds, picked, onPick }) {
|
|
91
|
+
const { locale } = useKit();
|
|
92
|
+
const part = useParts();
|
|
93
|
+
const today = /* @__PURE__ */ new Date();
|
|
94
|
+
const { first, last } = daySpan(bounds);
|
|
95
|
+
const start = first !== void 0 ? dayOf(first) : null;
|
|
96
|
+
const end = last !== void 0 ? dayOf(last) : null;
|
|
97
|
+
const offered = (date) => dayAllowed(bounds, isoDay(date));
|
|
98
|
+
return /* @__PURE__ */ jsx(DayPicker, {
|
|
99
|
+
mode: "single",
|
|
100
|
+
selected: picked && dayOf(picked) || void 0,
|
|
101
|
+
onSelect: (date) => {
|
|
102
|
+
if (date) onPick(isoDay(date));
|
|
103
|
+
},
|
|
104
|
+
defaultMonth: dayOf(openingDay(bounds, picked, today)) ?? today,
|
|
105
|
+
...start && { startMonth: start },
|
|
106
|
+
...end && { endMonth: end },
|
|
107
|
+
disabled: (date) => !offered(date),
|
|
108
|
+
modifiers: start !== null || end !== null ? { offered } : {},
|
|
109
|
+
modifiersClassNames: { offered: "sc-calendar__day--offered" },
|
|
110
|
+
...locale && { locale },
|
|
111
|
+
navLayout: "after",
|
|
112
|
+
showOutsideDays: true,
|
|
113
|
+
autoFocus: true,
|
|
114
|
+
classNames: {
|
|
115
|
+
...CALENDAR,
|
|
116
|
+
root: part("sc-calendar")
|
|
117
|
+
},
|
|
118
|
+
components: { Chevron }
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function Chevron({ orientation }) {
|
|
122
|
+
return orientation === "left" ? /* @__PURE__ */ jsx(CaretLeftIcon, {
|
|
123
|
+
"aria-hidden": true,
|
|
124
|
+
weight: "bold"
|
|
125
|
+
}) : /* @__PURE__ */ jsx(CaretRightIcon, {
|
|
126
|
+
"aria-hidden": true,
|
|
127
|
+
weight: "bold"
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
export { DateField };
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=DateField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateField.js","names":[],"sources":["../../src/kit/DateField.tsx"],"sourcesContent":["import {\n CalendarBlankIcon,\n CaretDownIcon,\n CaretLeftIcon,\n CaretRightIcon,\n} from \"@phosphor-icons/react\";\nimport { useState } from \"react\";\nimport { DayPicker, type ChevronProps, type ClassNames } from \"react-day-picker\";\n\nimport { useKit, useParts } from \"./context\";\nimport { dayAllowed, dayOf, daySpan, formatDay, isoDay, openingDay, type DayBounds } from \"./dates\";\nimport { ariaOf, type ControlBase } from \"./Field\";\nimport { Popover, usePopover } from \"./Popover\";\n\n/** The calendar's parts, under the kit's names: the host's look reaches them by token. */\nconst CALENDAR: Partial<ClassNames> = {\n months: \"sc-calendar__months\",\n month: \"sc-calendar__month\",\n month_caption: \"sc-calendar__caption\",\n caption_label: \"sc-calendar__title\",\n nav: \"sc-calendar__nav\",\n button_previous: \"sc-calendar__step\",\n button_next: \"sc-calendar__step\",\n chevron: \"sc-calendar__chevron\",\n month_grid: \"sc-calendar__grid\",\n weekdays: \"sc-calendar__weekdays\",\n weekday: \"sc-calendar__weekday\",\n weeks: \"sc-calendar__weeks\",\n week: \"sc-calendar__week\",\n day: \"sc-calendar__day\",\n day_button: \"sc-calendar__button\",\n selected: \"sc-calendar__day--selected\",\n today: \"sc-calendar__day--today\",\n disabled: \"sc-calendar__day--disabled\",\n outside: \"sc-calendar__day--outside\",\n hidden: \"sc-calendar__day--hidden\",\n focused: \"sc-calendar__day--focused\",\n};\n\nexport interface DateFieldProps extends ControlBase, DayBounds {\n /** The day picked, \"YYYY-MM-DD\", or none. */\n value: string | null;\n onChange: (day: string) => void;\n placeholder?: string | undefined;\n}\n\n/**\n * A day: a button that reads the day picked in the host's language and opens a calendar under\n * it. Only the days offered can be picked (`dates`, between `earliest` and `latest`), and when\n * they are bounded, those stand out. Picking one closes it and gives the focus back.\n */\nexport function DateField({\n value,\n onChange,\n placeholder,\n dates,\n earliest,\n latest,\n ...control\n}: DateFieldProps) {\n const { code, messages } = useKit();\n const part = useParts();\n const [open, setOpen] = useState(false);\n const popover = usePopover(open, setOpen, { width: \"own\", role: \"dialog\" });\n const picked = value !== null && dayOf(value) ? value : null;\n const { id, labelledBy } = control;\n return (\n <>\n <button\n ref={popover.refs.setReference}\n id={id}\n type=\"button\"\n disabled={control.disabled}\n data-invalid={control.invalid || undefined}\n data-empty={picked === null || undefined}\n {...popover.getReferenceProps({ onClick: () => setOpen(!open) })}\n {...ariaOf(control)}\n // Its name is its label and the day it reads.\n aria-labelledby={\n labelledBy === undefined || id === undefined ? labelledBy : `${labelledBy} ${id}`\n }\n aria-required={undefined}\n part=\"control\"\n className={part(\"sc-control\", \"sc-control--trigger\")}\n >\n <CalendarBlankIcon aria-hidden />\n <span>{picked ? formatDay(picked, code) : (placeholder ?? messages.chooseDate)}</span>\n <CaretDownIcon aria-hidden />\n </button>\n {open && (\n <Popover popover={popover} focus label={messages.chooseDate}>\n <Calendar\n bounds={{ dates, earliest, latest }}\n picked={picked}\n onPick={(day) => {\n onChange(day);\n setOpen(false);\n }}\n />\n </Popover>\n )}\n </>\n );\n}\n\n/**\n * The month grid, react-day-picker in the kit's look: it opens on the day picked, else the\n * first offered; it goes no further than the bounds; the arrows walk the days, Page Up and Down\n * the months.\n */\nfunction Calendar({\n bounds,\n picked,\n onPick,\n}: {\n bounds: DayBounds;\n picked: string | null;\n onPick: (day: string) => void;\n}) {\n const { locale } = useKit();\n const part = useParts();\n const today = new Date();\n const { first, last } = daySpan(bounds);\n const start = first !== undefined ? dayOf(first) : null;\n const end = last !== undefined ? dayOf(last) : null;\n const offered = (date: Date) => dayAllowed(bounds, isoDay(date));\n return (\n <DayPicker\n mode=\"single\"\n selected={(picked && dayOf(picked)) || undefined}\n onSelect={(date) => {\n if (date) onPick(isoDay(date));\n }}\n defaultMonth={dayOf(openingDay(bounds, picked, today)) ?? today}\n {...(start && { startMonth: start })}\n {...(end && { endMonth: end })}\n disabled={(date) => !offered(date)}\n modifiers={start !== null || end !== null ? { offered } : {}}\n modifiersClassNames={{ offered: \"sc-calendar__day--offered\" }}\n {...(locale && { locale })}\n navLayout=\"after\"\n showOutsideDays\n autoFocus\n classNames={{ ...CALENDAR, root: part(\"sc-calendar\") }}\n components={{ Chevron }}\n />\n );\n}\n\nfunction Chevron({ orientation }: ChevronProps) {\n return orientation === \"left\" ? (\n <CaretLeftIcon aria-hidden weight=\"bold\" />\n ) : (\n <CaretRightIcon aria-hidden weight=\"bold\" />\n );\n}\n"],"mappings":";;;;;;;;;;AAeA,MAAM,WAAgC;CACpC,QAAQ;CACR,OAAO;CACP,eAAe;CACf,eAAe;CACf,KAAK;CACL,iBAAiB;CACjB,aAAa;CACb,SAAS;CACT,YAAY;CACZ,UAAU;CACV,SAAS;CACT,OAAO;CACP,MAAM;CACN,KAAK;CACL,YAAY;CACZ,UAAU;CACV,OAAO;CACP,UAAU;CACV,SAAS;CACT,QAAQ;CACR,SAAS;AACX;;;;;;AAcA,SAAgB,UAAU,EACxB,OACA,UACA,aACA,OACA,UACA,QACA,GAAG,WACc;CACjB,MAAM,EAAE,MAAM,aAAa,OAAO;CAClC,MAAM,OAAO,SAAS;CACtB,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CACtC,MAAM,UAAU,WAAW,MAAM,SAAS;EAAE,OAAO;EAAO,MAAM;CAAS,CAAC;CAC1E,MAAM,SAAS,UAAU,QAAQ,MAAM,KAAK,IAAI,QAAQ;CACxD,MAAM,EAAE,IAAI,eAAe;CAC3B,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,qBAAC,UAAD;EACE,KAAK,QAAQ,KAAK;EACd;EACJ,MAAK;EACL,UAAU,QAAQ;EAClB,gBAAc,QAAQ,WAAW,KAAA;EACjC,cAAY,WAAW,QAAQ,KAAA;EAC/B,GAAI,QAAQ,kBAAkB,EAAE,eAAe,QAAQ,CAAC,IAAI,EAAE,CAAC;EAC/D,GAAI,OAAO,OAAO;EAElB,mBACE,eAAe,KAAA,KAAa,OAAO,KAAA,IAAY,aAAa,GAAG,WAAW,GAAG;EAE/E,iBAAe,KAAA;EACf,MAAK;EACL,WAAW,KAAK,cAAc,qBAAqB;EAfrD,UAAA;GAiBE,oBAAC,mBAAD,EAAmB,eAAA,KAAa,CAAA;GAChC,oBAAC,QAAD,EAAA,UAAO,SAAS,UAAU,QAAQ,IAAI,IAAK,eAAe,SAAS,WAAkB,CAAA;GACrF,oBAAC,eAAD,EAAe,eAAA,KAAa,CAAA;EACtB;CACP,CAAA,GAAA,QACC,oBAAC,SAAD;EAAkB;EAAS,OAAA;EAAM,OAAO,SAAS;EAC/C,UAAA,oBAAC,UAAD;GACE,QAAQ;IAAE;IAAO;IAAU;GAAO;GAC1B;GACR,SAAS,QAAQ;IACf,SAAS,GAAG;IACZ,QAAQ,KAAK;GACf;EACD,CAAA;CACM,CAAA,CAEX,EAAA,CAAA;AAEN;;;;;;AAOA,SAAS,SAAS,EAChB,QACA,QACA,UAKC;CACD,MAAM,EAAE,WAAW,OAAO;CAC1B,MAAM,OAAO,SAAS;CACtB,MAAM,wBAAQ,IAAI,KAAK;CACvB,MAAM,EAAE,OAAO,SAAS,QAAQ,MAAM;CACtC,MAAM,QAAQ,UAAU,KAAA,IAAY,MAAM,KAAK,IAAI;CACnD,MAAM,MAAM,SAAS,KAAA,IAAY,MAAM,IAAI,IAAI;CAC/C,MAAM,WAAW,SAAe,WAAW,QAAQ,OAAO,IAAI,CAAC;CAC/D,OACE,oBAAC,WAAD;EACE,MAAK;EACL,UAAW,UAAU,MAAM,MAAM,KAAM,KAAA;EACvC,WAAW,SAAS;GAClB,IAAI,MAAM,OAAO,OAAO,IAAI,CAAC;EAC/B;EACA,cAAc,MAAM,WAAW,QAAQ,QAAQ,KAAK,CAAC,KAAK;EAC1D,GAAK,SAAS,EAAE,YAAY,MAAM;EAClC,GAAK,OAAO,EAAE,UAAU,IAAI;EAC5B,WAAW,SAAS,CAAC,QAAQ,IAAI;EACjC,WAAW,UAAU,QAAQ,QAAQ,OAAO,EAAE,QAAQ,IAAI,CAAC;EAC3D,qBAAqB,EAAE,SAAS,4BAA4B;EAC5D,GAAK,UAAU,EAAE,OAAO;EACxB,WAAU;EACV,iBAAA;EACA,WAAA;EACA,YAAY;GAAE,GAAG;GAAU,MAAM,KAAK,aAAa;EAAE;EACrD,YAAY,EAAE,QAAQ;CACvB,CAAA;AAEL;AAEA,SAAS,QAAQ,EAAE,eAA6B;CAC9C,OAAO,gBAAgB,SACrB,oBAAC,eAAD;EAAe,eAAA;EAAY,QAAO;CAAQ,CAAA,IAE1C,oBAAC,gBAAD;EAAgB,eAAA;EAAY,QAAO;CAAQ,CAAA;AAE/C"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Icon } from "@phosphor-icons/react";
|
|
3
|
+
//#region src/kit/Field.d.ts
|
|
4
|
+
/** What names a control and ties it to its field: the ids its label, help and error carry. */
|
|
5
|
+
export interface ControlBase {
|
|
6
|
+
id?: string | undefined;
|
|
7
|
+
/** Its label's id; without one, `label` names it. */
|
|
8
|
+
labelledBy?: string | undefined;
|
|
9
|
+
label?: string | undefined;
|
|
10
|
+
/** Its help's and its error's ids. */
|
|
11
|
+
describedBy?: string | undefined;
|
|
12
|
+
invalid?: boolean | undefined;
|
|
13
|
+
required?: boolean | undefined;
|
|
14
|
+
disabled?: boolean | undefined;
|
|
15
|
+
}
|
|
16
|
+
/** What a field hands its control: its id, and the ids that name it and describe it. */
|
|
17
|
+
export interface FieldIds {
|
|
18
|
+
id: string;
|
|
19
|
+
labelledBy: string | undefined;
|
|
20
|
+
describedBy: string | undefined;
|
|
21
|
+
invalid: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* One thing to fill: its label (a quiet word beside it when it may stay empty), the control,
|
|
25
|
+
* then a line of help and what is wrong, both read with the control. `group` is for a control
|
|
26
|
+
* made of buttons (cards, chips, stars), which no <label> can point at: the label names it.
|
|
27
|
+
*/
|
|
28
|
+
export declare function Field({ label, optional, help, error, group, name, className, children }: {
|
|
29
|
+
label?: ReactNode;
|
|
30
|
+
optional?: boolean | undefined;
|
|
31
|
+
help?: ReactNode;
|
|
32
|
+
error?: string | undefined;
|
|
33
|
+
group?: boolean | undefined;
|
|
34
|
+
/** Marks the field (`data-field`), so a form can find it to focus. */
|
|
35
|
+
name?: string | undefined;
|
|
36
|
+
className?: string | undefined;
|
|
37
|
+
children: (ids: FieldIds) => ReactNode;
|
|
38
|
+
}): import("react").JSX.Element;
|
|
39
|
+
//#endregion
|
|
40
|
+
//# sourceMappingURL=Field.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { joined, useKit, useParts } from "./context.js";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { WarningCircleIcon } from "@phosphor-icons/react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/kit/Field.tsx
|
|
6
|
+
/** The ARIA a control carries, from what names it and what is wrong with it. */
|
|
7
|
+
function ariaOf(control) {
|
|
8
|
+
return {
|
|
9
|
+
"aria-labelledby": control.labelledBy,
|
|
10
|
+
"aria-label": control.labelledBy === void 0 ? control.label : void 0,
|
|
11
|
+
"aria-describedby": control.describedBy,
|
|
12
|
+
"aria-invalid": control.invalid || void 0,
|
|
13
|
+
"aria-required": control.required || void 0
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A label without the word that says it may stay empty, written into it ("Notas (opcional)"):
|
|
18
|
+
* the quiet word beside it says so once.
|
|
19
|
+
*/
|
|
20
|
+
function withoutOptional(label, word) {
|
|
21
|
+
if (typeof label !== "string") return label;
|
|
22
|
+
const said = label.replace(/\s*\(([^)]*)\)\s*$/u, (whole, inside) => inside.trim().toLowerCase() === word.toLowerCase() ? "" : whole);
|
|
23
|
+
return said === "" ? label : said;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* One thing to fill: its label (a quiet word beside it when it may stay empty), the control,
|
|
27
|
+
* then a line of help and what is wrong, both read with the control. `group` is for a control
|
|
28
|
+
* made of buttons (cards, chips, stars), which no <label> can point at: the label names it.
|
|
29
|
+
*/
|
|
30
|
+
function Field({ label, optional, help, error, group, name, className, children }) {
|
|
31
|
+
const { messages } = useKit();
|
|
32
|
+
const part = useParts();
|
|
33
|
+
const base = useId();
|
|
34
|
+
const ids = {
|
|
35
|
+
control: `${base}c`,
|
|
36
|
+
label: `${base}l`,
|
|
37
|
+
help: `${base}h`,
|
|
38
|
+
error: `${base}e`
|
|
39
|
+
};
|
|
40
|
+
const described = [help !== void 0 && ids.help, error !== void 0 && ids.error];
|
|
41
|
+
const Label = group ? "span" : "label";
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
43
|
+
"data-field": name,
|
|
44
|
+
part: "field",
|
|
45
|
+
className: joined(part("sc-field"), className),
|
|
46
|
+
children: [
|
|
47
|
+
label !== void 0 && /* @__PURE__ */ jsxs(Label, {
|
|
48
|
+
id: ids.label,
|
|
49
|
+
...!group && { htmlFor: ids.control },
|
|
50
|
+
className: part("sc-field__label"),
|
|
51
|
+
children: [optional ? withoutOptional(label, messages.optional) : label, optional && /* @__PURE__ */ jsx("small", {
|
|
52
|
+
className: part("sc-field__optional"),
|
|
53
|
+
children: messages.optional
|
|
54
|
+
})]
|
|
55
|
+
}),
|
|
56
|
+
children({
|
|
57
|
+
id: ids.control,
|
|
58
|
+
labelledBy: label !== void 0 ? ids.label : void 0,
|
|
59
|
+
describedBy: described.filter(Boolean).join(" ") || void 0,
|
|
60
|
+
invalid: error !== void 0
|
|
61
|
+
}),
|
|
62
|
+
help !== void 0 && /* @__PURE__ */ jsx("p", {
|
|
63
|
+
id: ids.help,
|
|
64
|
+
className: part("sc-field__help"),
|
|
65
|
+
children: help
|
|
66
|
+
}),
|
|
67
|
+
error !== void 0 && /* @__PURE__ */ jsxs("p", {
|
|
68
|
+
id: ids.error,
|
|
69
|
+
className: part("sc-field__error"),
|
|
70
|
+
children: [/* @__PURE__ */ jsx(WarningCircleIcon, {
|
|
71
|
+
"aria-hidden": true,
|
|
72
|
+
weight: "fill"
|
|
73
|
+
}), error]
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The box a control sits in: a hairline at the inner corners, an icon at its start, more at its
|
|
80
|
+
* end; the accent and its ring while anything in it has focus, the danger tone while it is wrong.
|
|
81
|
+
*/
|
|
82
|
+
function Box({ icon: Leading, invalid, end, children }) {
|
|
83
|
+
const part = useParts();
|
|
84
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
85
|
+
part: "control",
|
|
86
|
+
className: part("sc-control"),
|
|
87
|
+
"data-invalid": invalid || void 0,
|
|
88
|
+
children: [
|
|
89
|
+
Leading && /* @__PURE__ */ jsx(Leading, { "aria-hidden": true }),
|
|
90
|
+
children,
|
|
91
|
+
end
|
|
92
|
+
]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
export { Box, Field, ariaOf, withoutOptional };
|
|
97
|
+
|
|
98
|
+
//# sourceMappingURL=Field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.js","names":[],"sources":["../../src/kit/Field.tsx"],"sourcesContent":["import { WarningCircleIcon, type Icon } from \"@phosphor-icons/react\";\nimport { useId, type ReactNode } from \"react\";\n\nimport { joined, useKit, useParts } from \"./context\";\n\n/** What names a control and ties it to its field: the ids its label, help and error carry. */\nexport interface ControlBase {\n id?: string | undefined;\n /** Its label's id; without one, `label` names it. */\n labelledBy?: string | undefined;\n label?: string | undefined;\n /** Its help's and its error's ids. */\n describedBy?: string | undefined;\n invalid?: boolean | undefined;\n required?: boolean | undefined;\n disabled?: boolean | undefined;\n}\n\n/** The ARIA a control carries, from what names it and what is wrong with it. */\nexport function ariaOf(control: ControlBase) {\n return {\n \"aria-labelledby\": control.labelledBy,\n \"aria-label\": control.labelledBy === undefined ? control.label : undefined,\n \"aria-describedby\": control.describedBy,\n \"aria-invalid\": control.invalid || undefined,\n \"aria-required\": control.required || undefined,\n };\n}\n\n/** What a field hands its control: its id, and the ids that name it and describe it. */\nexport interface FieldIds {\n id: string;\n labelledBy: string | undefined;\n describedBy: string | undefined;\n invalid: boolean;\n}\n\n/**\n * A label without the word that says it may stay empty, written into it (\"Notas (opcional)\"):\n * the quiet word beside it says so once.\n */\nexport function withoutOptional(label: ReactNode, word: string): ReactNode {\n if (typeof label !== \"string\") return label;\n const said = label.replace(/\\s*\\(([^)]*)\\)\\s*$/u, (whole, inside: string) =>\n inside.trim().toLowerCase() === word.toLowerCase() ? \"\" : whole,\n );\n return said === \"\" ? label : said;\n}\n\n/**\n * One thing to fill: its label (a quiet word beside it when it may stay empty), the control,\n * then a line of help and what is wrong, both read with the control. `group` is for a control\n * made of buttons (cards, chips, stars), which no <label> can point at: the label names it.\n */\nexport function Field({\n label,\n optional,\n help,\n error,\n group,\n name,\n className,\n children,\n}: {\n label?: ReactNode;\n optional?: boolean | undefined;\n help?: ReactNode;\n error?: string | undefined;\n group?: boolean | undefined;\n /** Marks the field (`data-field`), so a form can find it to focus. */\n name?: string | undefined;\n className?: string | undefined;\n children: (ids: FieldIds) => ReactNode;\n}) {\n const { messages } = useKit();\n const part = useParts();\n const base = useId();\n const ids = { control: `${base}c`, label: `${base}l`, help: `${base}h`, error: `${base}e` };\n const described = [help !== undefined && ids.help, error !== undefined && ids.error];\n const Label = group ? \"span\" : \"label\";\n return (\n <div data-field={name} part=\"field\" className={joined(part(\"sc-field\"), className)}>\n {label !== undefined && (\n <Label\n id={ids.label}\n {...(!group && { htmlFor: ids.control })}\n className={part(\"sc-field__label\")}\n >\n {optional ? withoutOptional(label, messages.optional) : label}\n {optional && <small className={part(\"sc-field__optional\")}>{messages.optional}</small>}\n </Label>\n )}\n {children({\n id: ids.control,\n labelledBy: label !== undefined ? ids.label : undefined,\n describedBy: described.filter(Boolean).join(\" \") || undefined,\n invalid: error !== undefined,\n })}\n {help !== undefined && (\n <p id={ids.help} className={part(\"sc-field__help\")}>\n {help}\n </p>\n )}\n {error !== undefined && (\n <p id={ids.error} className={part(\"sc-field__error\")}>\n <WarningCircleIcon aria-hidden weight=\"fill\" />\n {error}\n </p>\n )}\n </div>\n );\n}\n\n/**\n * The box a control sits in: a hairline at the inner corners, an icon at its start, more at its\n * end; the accent and its ring while anything in it has focus, the danger tone while it is wrong.\n */\nexport function Box({\n icon: Leading,\n invalid,\n end,\n children,\n}: {\n icon?: Icon | undefined;\n invalid?: boolean | undefined;\n end?: ReactNode;\n children: ReactNode;\n}) {\n const part = useParts();\n return (\n <div part=\"control\" className={part(\"sc-control\")} data-invalid={invalid || undefined}>\n {Leading && <Leading aria-hidden />}\n {children}\n {end}\n </div>\n );\n}\n"],"mappings":";;;;;;AAmBA,SAAgB,OAAO,SAAsB;CAC3C,OAAO;EACL,mBAAmB,QAAQ;EAC3B,cAAc,QAAQ,eAAe,KAAA,IAAY,QAAQ,QAAQ,KAAA;EACjE,oBAAoB,QAAQ;EAC5B,gBAAgB,QAAQ,WAAW,KAAA;EACnC,iBAAiB,QAAQ,YAAY,KAAA;CACvC;AACF;;;;;AAcA,SAAgB,gBAAgB,OAAkB,MAAyB;CACzE,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,MAAM,OAAO,MAAM,QAAQ,wBAAwB,OAAO,WACxD,OAAO,KAAK,CAAC,CAAC,YAAY,MAAM,KAAK,YAAY,IAAI,KAAK,KAC5D;CACA,OAAO,SAAS,KAAK,QAAQ;AAC/B;;;;;;AAOA,SAAgB,MAAM,EACpB,OACA,UACA,MACA,OACA,OACA,MACA,WACA,YAWC;CACD,MAAM,EAAE,aAAa,OAAO;CAC5B,MAAM,OAAO,SAAS;CACtB,MAAM,OAAO,MAAM;CACnB,MAAM,MAAM;EAAE,SAAS,GAAG,KAAK;EAAI,OAAO,GAAG,KAAK;EAAI,MAAM,GAAG,KAAK;EAAI,OAAO,GAAG,KAAK;CAAG;CAC1F,MAAM,YAAY,CAAC,SAAS,KAAA,KAAa,IAAI,MAAM,UAAU,KAAA,KAAa,IAAI,KAAK;CACnF,MAAM,QAAQ,QAAQ,SAAS;CAC/B,OACE,qBAAC,OAAD;EAAK,cAAY;EAAM,MAAK;EAAQ,WAAW,OAAO,KAAK,UAAU,GAAG,SAAS;EAAjF,UAAA;GACG,UAAU,KAAA,KACT,qBAAC,OAAD;IACE,IAAI,IAAI;IACR,GAAK,CAAC,SAAS,EAAE,SAAS,IAAI,QAAQ;IACtC,WAAW,KAAK,iBAAiB;IAHnC,UAAA,CAKG,WAAW,gBAAgB,OAAO,SAAS,QAAQ,IAAI,OACvD,YAAY,oBAAC,SAAD;KAAO,WAAW,KAAK,oBAAoB;KAAI,UAAA,SAAS;IAAgB,CAAA,CAChF;;GAER,SAAS;IACR,IAAI,IAAI;IACR,YAAY,UAAU,KAAA,IAAY,IAAI,QAAQ,KAAA;IAC9C,aAAa,UAAU,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;IACpD,SAAS,UAAU,KAAA;GACrB,CAAC;GACA,SAAS,KAAA,KACR,oBAAC,KAAD;IAAG,IAAI,IAAI;IAAM,WAAW,KAAK,gBAAgB;IAC9C,UAAA;GACA,CAAA;GAEJ,UAAU,KAAA,KACT,qBAAC,KAAD;IAAG,IAAI,IAAI;IAAO,WAAW,KAAK,iBAAiB;IAAnD,UAAA,CACE,oBAAC,mBAAD;KAAmB,eAAA;KAAY,QAAO;IAAQ,CAAA,GAC7C,KACA;;EAEF;;AAET;;;;;AAMA,SAAgB,IAAI,EAClB,MAAM,SACN,SACA,KACA,YAMC;CACD,MAAM,OAAO,SAAS;CACtB,OACE,qBAAC,OAAD;EAAK,MAAK;EAAU,WAAW,KAAK,YAAY;EAAG,gBAAc,WAAW,KAAA;EAA5E,UAAA;GACG,WAAW,oBAAC,SAAD,EAAS,eAAA,KAAa,CAAA;GACjC;GACA;EACE;;AAET"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Attachment } from "../types.js";
|
|
2
|
+
import { FileHost } from "./uploads.js";
|
|
3
|
+
import { ControlBase } from "./Field.js";
|
|
4
|
+
import "react";
|
|
5
|
+
//#region src/kit/FileField.d.ts
|
|
6
|
+
export interface FileChipProps {
|
|
7
|
+
name: string;
|
|
8
|
+
/** Its weight in bytes; none while it is not known. */
|
|
9
|
+
size?: number | undefined;
|
|
10
|
+
/** Its type, for its glyph when its name has no extension. */
|
|
11
|
+
type?: string | undefined;
|
|
12
|
+
/** On its way: how much of it has gone, from 0 to 1. */
|
|
13
|
+
progress?: number | undefined;
|
|
14
|
+
/** What went wrong with it, in place of its size. */
|
|
15
|
+
problem?: string | null | undefined;
|
|
16
|
+
/** Opens it: the chip is a button. */
|
|
17
|
+
onOpen?: (() => void) | undefined;
|
|
18
|
+
onRetry?: (() => void) | undefined;
|
|
19
|
+
onRemove?: (() => void) | undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A file as a chip: the glyph of its family, its name, and under it its size, how much has gone while it uploads (a line filling at its foot), or what went wrong in the danger
|
|
23
|
+
* tone; at its end, trying it again and taking it away. With `onOpen` it opens on a click.
|
|
24
|
+
*/
|
|
25
|
+
export declare function FileChip({ name, size, type, progress, problem, onOpen, onRetry, onRemove }: FileChipProps): import("react").JSX.Element;
|
|
26
|
+
/** Files already sent, as chips in a row that wraps; with `onOpen`, each opens on a click. */
|
|
27
|
+
export declare function FileChips({ files, onOpen }: {
|
|
28
|
+
files: readonly Attachment[];
|
|
29
|
+
onOpen?: ((file: Attachment) => void) | undefined;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
/** A file picked here, on its way or in: what its chip draws. */
|
|
32
|
+
export interface Upload {
|
|
33
|
+
/** Tells it from the others here. */
|
|
34
|
+
key: number;
|
|
35
|
+
name: string;
|
|
36
|
+
size: number | undefined;
|
|
37
|
+
type: string;
|
|
38
|
+
/**
|
|
39
|
+
* uploading: on its way (`progress`, 0 to 1); done: stored as `id`; failed: its upload failed,
|
|
40
|
+
* to be tried again; refused: never sent, a kind not taken or too heavy (`problem` says which).
|
|
41
|
+
*/
|
|
42
|
+
state: "uploading" | "done" | "failed" | "refused";
|
|
43
|
+
progress: number;
|
|
44
|
+
id: string | null;
|
|
45
|
+
problem: string | null;
|
|
46
|
+
/** The bytes, kept to try again. */
|
|
47
|
+
file: File | null;
|
|
48
|
+
}
|
|
49
|
+
/** What files may be picked: their kinds, their most in MB, one or many, how many at most. */
|
|
50
|
+
export interface UploadRules {
|
|
51
|
+
accept?: readonly string[] | undefined;
|
|
52
|
+
maxMb?: number | undefined;
|
|
53
|
+
/** False: one file, a new pick replacing it. */
|
|
54
|
+
multiple?: boolean | undefined;
|
|
55
|
+
max?: number | undefined;
|
|
56
|
+
}
|
|
57
|
+
/** Files picked and how each goes, and what can be done with them. */
|
|
58
|
+
export interface Uploads {
|
|
59
|
+
items: readonly Upload[];
|
|
60
|
+
/** The ids of the files in, in the order they were picked. */
|
|
61
|
+
ids: string[];
|
|
62
|
+
/** What the files still wait on: one on its way, or one that failed or was refused; null once all are in. */
|
|
63
|
+
waiting: "uploading" | "failed" | null;
|
|
64
|
+
add: (files: readonly File[]) => void;
|
|
65
|
+
remove: (key: number) => void;
|
|
66
|
+
retry: (key: number) => void;
|
|
67
|
+
/** Takes them all away, letting go of any on its way. */
|
|
68
|
+
clear: () => void;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Files picked and sent at once through `host`: each is refused before it goes when it is not a
|
|
72
|
+
* kind taken, is too heavy, or is one too many; then it is on its way, then in (its id) or failed
|
|
73
|
+
* (to be tried again). With `multiple` false a new pick replaces what was there. Whatever is on
|
|
74
|
+
* its way when its file goes (taken away, cleared, the component gone) is let go.
|
|
75
|
+
*/
|
|
76
|
+
export declare function useUploads(host: FileHost | undefined, { accept, maxMb, multiple, max }: UploadRules, start?: () => Upload[]): Uploads;
|
|
77
|
+
/**
|
|
78
|
+
* The files picked, as chips: each with how it goes; taken away while they can be, the failed
|
|
79
|
+
* tried again; once in, a name not known here is read from the host's files, and opens there.
|
|
80
|
+
*/
|
|
81
|
+
export declare function UploadChips({ uploads, host, closed }: {
|
|
82
|
+
uploads: Uploads;
|
|
83
|
+
host: FileHost | undefined;
|
|
84
|
+
closed?: boolean | undefined;
|
|
85
|
+
}): import("react").JSX.Element;
|
|
86
|
+
export interface FileFieldProps extends ControlBase {
|
|
87
|
+
/** The ids of the files in. */
|
|
88
|
+
value: string[];
|
|
89
|
+
onChange: (ids: string[]) => void;
|
|
90
|
+
/** Where its files go and are found; none: it takes none (closed). */
|
|
91
|
+
files?: FileHost | undefined;
|
|
92
|
+
/** The kinds it takes: types, families ("image/*"), extensions (".xlsx"); none: any. */
|
|
93
|
+
accept?: readonly string[] | undefined;
|
|
94
|
+
multiple?: boolean | undefined;
|
|
95
|
+
/** The most a file may weigh, in MB (50 at most). */
|
|
96
|
+
maxMb?: number | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Hears what the field still waits on before its form may go, in words (a file on its way,
|
|
99
|
+
* one that failed), and null once nothing.
|
|
100
|
+
*/
|
|
101
|
+
onWait?: ((problem: string | null) => void) | undefined;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Files to give: a zone to drop them on or press to choose them, saying what it takes; each file
|
|
105
|
+
* uploads at once (a line fills under it), then sits as a chip to take away; what is wrong with
|
|
106
|
+
* one (too heavy, a kind not taken, an upload that failed, to try again) says so on its chip.
|
|
107
|
+
* The value is the ids of the files in. One file unless `multiple`: once it is in, the zone
|
|
108
|
+
* steps aside until it is taken away. Closed, the chips are read, and open where the host shows
|
|
109
|
+
* files.
|
|
110
|
+
*/
|
|
111
|
+
export declare function FileField({ value, onChange, files, accept, multiple, maxMb, onWait, ...control }: FileFieldProps): import("react").JSX.Element;
|
|
112
|
+
//#endregion
|
|
113
|
+
//# sourceMappingURL=FileField.d.ts.map
|