@flanksource/clicky-ui 0.3.71 → 0.3.73
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/dist/ai.cjs +5 -0
- package/dist/ai.js +3 -1
- package/dist/comment-anchoring.cjs +3 -0
- package/dist/comment-anchoring.js +2 -1
- package/dist/comments/CommentCapture.cjs +6 -8
- package/dist/comments/CommentCapture.cjs.map +1 -1
- package/dist/comments/CommentCapture.d.ts.map +1 -1
- package/dist/comments/CommentCapture.js +6 -8
- package/dist/comments/CommentCapture.js.map +1 -1
- package/dist/comments/CommentComposer.cjs +12 -8
- package/dist/comments/CommentComposer.cjs.map +1 -1
- package/dist/comments/CommentComposer.d.ts.map +1 -1
- package/dist/comments/CommentComposer.js +12 -8
- package/dist/comments/CommentComposer.js.map +1 -1
- package/dist/comments/CommentThread.cjs +2 -1
- package/dist/comments/CommentThread.cjs.map +1 -1
- package/dist/comments/CommentThread.d.ts +1 -1
- package/dist/comments/CommentThread.d.ts.map +1 -1
- package/dist/comments/CommentThread.js +2 -1
- package/dist/comments/CommentThread.js.map +1 -1
- package/dist/comments/CommentThreadList.cjs +5 -3
- package/dist/comments/CommentThreadList.cjs.map +1 -1
- package/dist/comments/CommentThreadList.d.ts +1 -1
- package/dist/comments/CommentThreadList.d.ts.map +1 -1
- package/dist/comments/CommentThreadList.js +5 -3
- package/dist/comments/CommentThreadList.js.map +1 -1
- package/dist/comments/anchoring/dom-anchor.cjs +32 -4
- package/dist/comments/anchoring/dom-anchor.cjs.map +1 -1
- package/dist/comments/anchoring/dom-anchor.d.ts +8 -4
- package/dist/comments/anchoring/dom-anchor.d.ts.map +1 -1
- package/dist/comments/anchoring/dom-anchor.js +31 -5
- package/dist/comments/anchoring/dom-anchor.js.map +1 -1
- package/dist/comments/anchoring/frame-anchor.cjs +74 -0
- package/dist/comments/anchoring/frame-anchor.cjs.map +1 -0
- package/dist/comments/anchoring/frame-anchor.d.ts +21 -0
- package/dist/comments/anchoring/frame-anchor.d.ts.map +1 -0
- package/dist/comments/anchoring/frame-anchor.js +70 -0
- package/dist/comments/anchoring/frame-anchor.js.map +1 -0
- package/dist/comments/comment-detail.d.ts +1 -0
- package/dist/comments/comment-detail.d.ts.map +1 -1
- package/dist/comments/comment-types.cjs.map +1 -1
- package/dist/comments/comment-types.d.ts +2 -0
- package/dist/comments/comment-types.d.ts.map +1 -1
- package/dist/comments/comment-types.js.map +1 -1
- package/dist/comments/gavel/CommentInbox.cjs +49 -59
- package/dist/comments/gavel/CommentInbox.cjs.map +1 -1
- package/dist/comments/gavel/CommentInbox.d.ts +12 -8
- package/dist/comments/gavel/CommentInbox.d.ts.map +1 -1
- package/dist/comments/gavel/CommentInbox.js +51 -61
- package/dist/comments/gavel/CommentInbox.js.map +1 -1
- package/dist/comments/gavel/CommentInboxThread.cjs.map +1 -1
- package/dist/comments/gavel/CommentInboxThread.d.ts +1 -3
- package/dist/comments/gavel/CommentInboxThread.d.ts.map +1 -1
- package/dist/comments/gavel/CommentInboxThread.js.map +1 -1
- package/dist/comments/gavel/comment-agent-assignment.cjs +41 -0
- package/dist/comments/gavel/comment-agent-assignment.cjs.map +1 -0
- package/dist/comments/gavel/comment-agent-assignment.d.ts +15 -0
- package/dist/comments/gavel/comment-agent-assignment.d.ts.map +1 -0
- package/dist/comments/gavel/comment-agent-assignment.js +39 -0
- package/dist/comments/gavel/comment-agent-assignment.js.map +1 -0
- package/dist/comments/gavel/gavel-projection.cjs +43 -13
- package/dist/comments/gavel/gavel-projection.cjs.map +1 -1
- package/dist/comments/gavel/gavel-projection.d.ts +3 -0
- package/dist/comments/gavel/gavel-projection.d.ts.map +1 -1
- package/dist/comments/gavel/gavel-projection.js +43 -14
- package/dist/comments/gavel/gavel-projection.js.map +1 -1
- package/dist/comments/gavel/inbox-model.cjs +3 -12
- package/dist/comments/gavel/inbox-model.cjs.map +1 -1
- package/dist/comments/gavel/inbox-model.d.ts +2 -2
- package/dist/comments/gavel/inbox-model.d.ts.map +1 -1
- package/dist/comments/gavel/inbox-model.js +4 -12
- package/dist/comments/gavel/inbox-model.js.map +1 -1
- package/dist/comments/gavel/inbox-prompt.cjs +1 -0
- package/dist/comments/gavel/inbox-prompt.cjs.map +1 -1
- package/dist/comments/gavel/inbox-prompt.d.ts.map +1 -1
- package/dist/comments/gavel/inbox-prompt.js +1 -0
- package/dist/comments/gavel/inbox-prompt.js.map +1 -1
- package/dist/comments/gavel/index.d.ts +1 -0
- package/dist/comments/gavel/index.d.ts.map +1 -1
- package/dist/comments-gavel.cjs +5 -1
- package/dist/comments-gavel.js +4 -3
- package/dist/comments.cjs +5 -0
- package/dist/comments.d.ts +1 -0
- package/dist/comments.d.ts.map +1 -1
- package/dist/comments.js +3 -1
- package/dist/components/AccordionList.cjs +2 -2
- package/dist/components/AccordionList.cjs.map +1 -1
- package/dist/components/AccordionList.js +2 -2
- package/dist/components/AccordionList.js.map +1 -1
- package/dist/components/examples/form-extensions/extension.d.ts +1 -1
- package/dist/components/examples/form-extensions/extension.d.ts.map +1 -1
- package/dist/components/json-schema-form-array-add-menu.cjs +44 -0
- package/dist/components/json-schema-form-array-add-menu.cjs.map +1 -0
- package/dist/components/json-schema-form-array-add-menu.d.ts +10 -0
- package/dist/components/json-schema-form-array-add-menu.d.ts.map +1 -0
- package/dist/components/json-schema-form-array-add-menu.js +44 -0
- package/dist/components/json-schema-form-array-add-menu.js.map +1 -0
- package/dist/components/json-schema-form-exclusive-key-select.cjs +28 -0
- package/dist/components/json-schema-form-exclusive-key-select.cjs.map +1 -0
- package/dist/components/json-schema-form-exclusive-key-select.d.ts +12 -0
- package/dist/components/json-schema-form-exclusive-key-select.d.ts.map +1 -0
- package/dist/components/json-schema-form-exclusive-key-select.js +28 -0
- package/dist/components/json-schema-form-exclusive-key-select.js.map +1 -0
- package/dist/components/json-schema-form-exclusive-keys.cjs +23 -0
- package/dist/components/json-schema-form-exclusive-keys.cjs.map +1 -0
- package/dist/components/json-schema-form-exclusive-keys.d.ts +8 -0
- package/dist/components/json-schema-form-exclusive-keys.d.ts.map +1 -0
- package/dist/components/json-schema-form-exclusive-keys.js +22 -0
- package/dist/components/json-schema-form-exclusive-keys.js.map +1 -0
- package/dist/components/json-schema-form-layout.cjs +18 -5
- package/dist/components/json-schema-form-layout.cjs.map +1 -1
- package/dist/components/json-schema-form-layout.d.ts +3 -1
- package/dist/components/json-schema-form-layout.d.ts.map +1 -1
- package/dist/components/json-schema-form-layout.js +19 -6
- package/dist/components/json-schema-form-layout.js.map +1 -1
- package/dist/components/json-schema-form-object-array-view.cjs +13 -7
- package/dist/components/json-schema-form-object-array-view.cjs.map +1 -1
- package/dist/components/json-schema-form-object-array-view.d.ts.map +1 -1
- package/dist/components/json-schema-form-object-array-view.js +13 -7
- package/dist/components/json-schema-form-object-array-view.js.map +1 -1
- package/dist/components/json-schema-form-object.cjs +6 -0
- package/dist/components/json-schema-form-object.cjs.map +1 -1
- package/dist/components/json-schema-form-object.d.ts.map +1 -1
- package/dist/components/json-schema-form-object.js +6 -0
- package/dist/components/json-schema-form-object.js.map +1 -1
- package/dist/components/json-schema-form-render.cjs +56 -35
- package/dist/components/json-schema-form-render.cjs.map +1 -1
- package/dist/components/json-schema-form-render.d.ts +1 -0
- package/dist/components/json-schema-form-render.d.ts.map +1 -1
- package/dist/components/json-schema-form-render.js +56 -35
- package/dist/components/json-schema-form-render.js.map +1 -1
- package/dist/components/json-schema-form-resolve.cjs +1 -0
- package/dist/components/json-schema-form-resolve.cjs.map +1 -1
- package/dist/components/json-schema-form-resolve.d.ts +2 -1
- package/dist/components/json-schema-form-resolve.d.ts.map +1 -1
- package/dist/components/json-schema-form-resolve.js +1 -1
- package/dist/components/json-schema-form-resolve.js.map +1 -1
- package/dist/components/json-schema-form-runtime-types.d.ts +8 -0
- package/dist/components/json-schema-form-runtime-types.d.ts.map +1 -1
- package/dist/components/json-schema-form-section-actions.cjs +12 -0
- package/dist/components/json-schema-form-section-actions.cjs.map +1 -0
- package/dist/components/json-schema-form-section-actions.d.ts +8 -0
- package/dist/components/json-schema-form-section-actions.d.ts.map +1 -0
- package/dist/components/json-schema-form-section-actions.js +11 -0
- package/dist/components/json-schema-form-section-actions.js.map +1 -0
- package/dist/components/json-schema-form-sibling-prefix.cjs +23 -0
- package/dist/components/json-schema-form-sibling-prefix.cjs.map +1 -0
- package/dist/components/json-schema-form-sibling-prefix.d.ts +9 -0
- package/dist/components/json-schema-form-sibling-prefix.d.ts.map +1 -0
- package/dist/components/json-schema-form-sibling-prefix.js +23 -0
- package/dist/components/json-schema-form-sibling-prefix.js.map +1 -0
- package/dist/components/json-schema-form-sibling-select.cjs +25 -0
- package/dist/components/json-schema-form-sibling-select.cjs.map +1 -0
- package/dist/components/json-schema-form-sibling-select.d.ts +9 -0
- package/dist/components/json-schema-form-sibling-select.d.ts.map +1 -0
- package/dist/components/json-schema-form-sibling-select.js +25 -0
- package/dist/components/json-schema-form-sibling-select.js.map +1 -0
- package/dist/components/json-schema-form-table-array.cjs +4 -3
- package/dist/components/json-schema-form-table-array.cjs.map +1 -1
- package/dist/components/json-schema-form-table-array.js +4 -3
- package/dist/components/json-schema-form-table-array.js.map +1 -1
- package/dist/components/json-schema-form-tags-combobox.cjs +54 -24
- package/dist/components/json-schema-form-tags-combobox.cjs.map +1 -1
- package/dist/components/json-schema-form-tags-combobox.d.ts.map +1 -1
- package/dist/components/json-schema-form-tags-combobox.js +55 -25
- package/dist/components/json-schema-form-tags-combobox.js.map +1 -1
- package/dist/components.cjs +2 -0
- package/dist/components.d.ts +2 -1
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +2 -1
- package/dist/data/LogViewer.cjs +90 -19
- package/dist/data/LogViewer.cjs.map +1 -1
- package/dist/data/LogViewer.d.ts +9 -5
- package/dist/data/LogViewer.d.ts.map +1 -1
- package/dist/data/LogViewer.js +91 -20
- package/dist/data/LogViewer.js.map +1 -1
- package/dist/data/TaskProgress.cjs +5 -5
- package/dist/data/TaskProgress.cjs.map +1 -1
- package/dist/data/TaskProgress.js +5 -5
- package/dist/data/TaskProgress.js.map +1 -1
- package/dist/data/ai/SessionChatComposer.cjs +44 -22
- package/dist/data/ai/SessionChatComposer.cjs.map +1 -1
- package/dist/data/ai/SessionChatComposer.d.ts.map +1 -1
- package/dist/data/ai/SessionChatComposer.js +44 -22
- package/dist/data/ai/SessionChatComposer.js.map +1 -1
- package/dist/data/ai/SessionInspector.cjs +1 -1
- package/dist/data/ai/SessionInspector.cjs.map +1 -1
- package/dist/data/ai/SessionInspector.d.ts.map +1 -1
- package/dist/data/ai/SessionInspector.host-tabs.cjs +12 -0
- package/dist/data/ai/SessionInspector.host-tabs.cjs.map +1 -1
- package/dist/data/ai/SessionInspector.host-tabs.d.ts +4 -1
- package/dist/data/ai/SessionInspector.host-tabs.d.ts.map +1 -1
- package/dist/data/ai/SessionInspector.host-tabs.js +12 -1
- package/dist/data/ai/SessionInspector.host-tabs.js.map +1 -1
- package/dist/data/ai/SessionInspector.js +2 -2
- package/dist/data/ai/SessionInspector.js.map +1 -1
- package/dist/data/ai/SessionInspector.legacy.cjs +1 -1
- package/dist/data/ai/SessionInspector.legacy.cjs.map +1 -1
- package/dist/data/ai/SessionInspector.legacy.d.ts.map +1 -1
- package/dist/data/ai/SessionInspector.legacy.js +2 -2
- package/dist/data/ai/SessionInspector.legacy.js.map +1 -1
- package/dist/data/ai/SessionInspector.transcript.cjs +5 -19
- package/dist/data/ai/SessionInspector.transcript.cjs.map +1 -1
- package/dist/data/ai/SessionInspector.transcript.d.ts.map +1 -1
- package/dist/data/ai/SessionInspector.transcript.js +6 -20
- package/dist/data/ai/SessionInspector.transcript.js.map +1 -1
- package/dist/data/ai/SessionPicker.cjs +159 -0
- package/dist/data/ai/SessionPicker.cjs.map +1 -0
- package/dist/data/ai/SessionPicker.d.ts +39 -0
- package/dist/data/ai/SessionPicker.d.ts.map +1 -0
- package/dist/data/ai/SessionPicker.js +159 -0
- package/dist/data/ai/SessionPicker.js.map +1 -0
- package/dist/data/ai/SessionPicker.model.cjs +21 -0
- package/dist/data/ai/SessionPicker.model.cjs.map +1 -0
- package/dist/data/ai/SessionPicker.model.d.ts +26 -0
- package/dist/data/ai/SessionPicker.model.d.ts.map +1 -0
- package/dist/data/ai/SessionPicker.model.js +20 -0
- package/dist/data/ai/SessionPicker.model.js.map +1 -0
- package/dist/data/ai/SessionTail.cjs +25 -15
- package/dist/data/ai/SessionTail.cjs.map +1 -1
- package/dist/data/ai/SessionTail.d.ts.map +1 -1
- package/dist/data/ai/SessionTail.js +25 -15
- package/dist/data/ai/SessionTail.js.map +1 -1
- package/dist/data/ai/SessionViewer.input.cjs +59 -1
- package/dist/data/ai/SessionViewer.input.cjs.map +1 -1
- package/dist/data/ai/SessionViewer.input.d.ts +22 -0
- package/dist/data/ai/SessionViewer.input.d.ts.map +1 -1
- package/dist/data/ai/SessionViewer.input.js +58 -2
- package/dist/data/ai/SessionViewer.input.js.map +1 -1
- package/dist/data/ai/SessionViewer.rows.cjs +10 -3
- package/dist/data/ai/SessionViewer.rows.cjs.map +1 -1
- package/dist/data/ai/SessionViewer.rows.d.ts.map +1 -1
- package/dist/data/ai/SessionViewer.rows.js +11 -4
- package/dist/data/ai/SessionViewer.rows.js.map +1 -1
- package/dist/data/ai/SessionViewer.tool-details.cjs +35 -0
- package/dist/data/ai/SessionViewer.tool-details.cjs.map +1 -1
- package/dist/data/ai/SessionViewer.tool-details.d.ts +10 -1
- package/dist/data/ai/SessionViewer.tool-details.d.ts.map +1 -1
- package/dist/data/ai/SessionViewer.tool-details.js +35 -1
- package/dist/data/ai/SessionViewer.tool-details.js.map +1 -1
- package/dist/data/ai/SessionViewer.tool-row.cjs +5 -1
- package/dist/data/ai/SessionViewer.tool-row.cjs.map +1 -1
- package/dist/data/ai/SessionViewer.tool-row.d.ts.map +1 -1
- package/dist/data/ai/SessionViewer.tool-row.js +7 -3
- package/dist/data/ai/SessionViewer.tool-row.js.map +1 -1
- package/dist/data/ai/index.d.ts +2 -0
- package/dist/data/ai/index.d.ts.map +1 -1
- package/dist/data/git/GitChangeList.cjs +40 -7
- package/dist/data/git/GitChangeList.cjs.map +1 -1
- package/dist/data/git/GitChangeList.d.ts +3 -0
- package/dist/data/git/GitChangeList.d.ts.map +1 -1
- package/dist/data/git/GitChangeList.js +40 -7
- package/dist/data/git/GitChangeList.js.map +1 -1
- package/dist/data/git/pickers/GitFilePicker.cjs +19 -7
- package/dist/data/git/pickers/GitFilePicker.cjs.map +1 -1
- package/dist/data/git/pickers/GitFilePicker.d.ts +4 -2
- package/dist/data/git/pickers/GitFilePicker.d.ts.map +1 -1
- package/dist/data/git/pickers/GitFilePicker.js +19 -7
- package/dist/data/git/pickers/GitFilePicker.js.map +1 -1
- package/dist/data/git/pickers/GitPickers.cjs +3 -3
- package/dist/data/git/pickers/GitPickers.cjs.map +1 -1
- package/dist/data/git/pickers/GitPickers.js +3 -3
- package/dist/data/git/pickers/GitPickers.js.map +1 -1
- package/dist/data/git/pickers/GitPickersDemo.d.ts.map +1 -1
- package/dist/data/git/pickers/GitSourcePicker.cjs +11 -4
- package/dist/data/git/pickers/GitSourcePicker.cjs.map +1 -1
- package/dist/data/git/pickers/GitSourcePicker.d.ts +4 -2
- package/dist/data/git/pickers/GitSourcePicker.d.ts.map +1 -1
- package/dist/data/git/pickers/GitSourcePicker.js +11 -4
- package/dist/data/git/pickers/GitSourcePicker.js.map +1 -1
- package/dist/data/git/pickers/ReferencePicker.cjs +27 -3
- package/dist/data/git/pickers/ReferencePicker.cjs.map +1 -1
- package/dist/data/git/pickers/ReferencePicker.d.ts.map +1 -1
- package/dist/data/git/pickers/ReferencePicker.js +27 -3
- package/dist/data/git/pickers/ReferencePicker.js.map +1 -1
- package/dist/data/git/pickers/RepositoryCatalogPicker.cjs +2 -1
- package/dist/data/git/pickers/RepositoryCatalogPicker.cjs.map +1 -1
- package/dist/data/git/pickers/RepositoryCatalogPicker.d.ts +3 -2
- package/dist/data/git/pickers/RepositoryCatalogPicker.d.ts.map +1 -1
- package/dist/data/git/pickers/RepositoryCatalogPicker.js +2 -1
- package/dist/data/git/pickers/RepositoryCatalogPicker.js.map +1 -1
- package/dist/data/git/pickers/types.d.ts +7 -0
- package/dist/data/git/pickers/types.d.ts.map +1 -1
- package/dist/data/lint/LintList.cjs +89 -89
- package/dist/data/lint/LintList.cjs.map +1 -1
- package/dist/data/lint/LintList.d.ts +3 -2
- package/dist/data/lint/LintList.d.ts.map +1 -1
- package/dist/data/lint/LintList.js +90 -90
- package/dist/data/lint/LintList.js.map +1 -1
- package/dist/data/log-sections.cjs +152 -21
- package/dist/data/log-sections.cjs.map +1 -1
- package/dist/data/log-sections.d.ts +31 -6
- package/dist/data/log-sections.d.ts.map +1 -1
- package/dist/data/log-sections.js +151 -22
- package/dist/data/log-sections.js.map +1 -1
- package/dist/data/test-runner/TestDetailPanel.cjs +1 -1
- package/dist/data/test-runner/TestDetailPanel.cjs.map +1 -1
- package/dist/data/test-runner/TestDetailPanel.js +1 -1
- package/dist/data/test-runner/TestDetailPanel.js.map +1 -1
- package/dist/data/test-runner/TestFailureDetail.cjs +10 -8
- package/dist/data/test-runner/TestFailureDetail.cjs.map +1 -1
- package/dist/data/test-runner/TestFailureDetail.d.ts +3 -2
- package/dist/data/test-runner/TestFailureDetail.d.ts.map +1 -1
- package/dist/data/test-runner/TestFailureDetail.js +10 -8
- package/dist/data/test-runner/TestFailureDetail.js.map +1 -1
- package/dist/data/test-runner/TestTreeNode.cjs +9 -4
- package/dist/data/test-runner/TestTreeNode.cjs.map +1 -1
- package/dist/data/test-runner/TestTreeNode.d.ts.map +1 -1
- package/dist/data/test-runner/TestTreeNode.js +9 -4
- package/dist/data/test-runner/TestTreeNode.js.map +1 -1
- package/dist/data/test-runner/attempts.cjs +2 -1
- package/dist/data/test-runner/attempts.cjs.map +1 -1
- package/dist/data/test-runner/attempts.d.ts.map +1 -1
- package/dist/data/test-runner/attempts.js +2 -1
- package/dist/data/test-runner/attempts.js.map +1 -1
- package/dist/data/test-runner/copy.cjs +1 -2
- package/dist/data/test-runner/copy.cjs.map +1 -1
- package/dist/data/test-runner/copy.d.ts.map +1 -1
- package/dist/data/test-runner/copy.js +1 -2
- package/dist/data/test-runner/copy.js.map +1 -1
- package/dist/data/test-runner/types.d.ts +3 -0
- package/dist/data/test-runner/types.d.ts.map +1 -1
- package/dist/data/traces/GoProfileView.cjs +10 -7
- package/dist/data/traces/GoProfileView.cjs.map +1 -1
- package/dist/data/traces/GoProfileView.d.ts.map +1 -1
- package/dist/data/traces/GoProfileView.js +10 -7
- package/dist/data/traces/GoProfileView.js.map +1 -1
- package/dist/data/traces/TraceEventStream.cjs +37 -7
- package/dist/data/traces/TraceEventStream.cjs.map +1 -1
- package/dist/data/traces/TraceEventStream.d.ts.map +1 -1
- package/dist/data/traces/TraceEventStream.js +37 -7
- package/dist/data/traces/TraceEventStream.js.map +1 -1
- package/dist/data/traces/TraceFeed.cjs +71 -106
- package/dist/data/traces/TraceFeed.cjs.map +1 -1
- package/dist/data/traces/TraceFeed.d.ts +3 -10
- package/dist/data/traces/TraceFeed.d.ts.map +1 -1
- package/dist/data/traces/TraceFeed.js +72 -107
- package/dist/data/traces/TraceFeed.js.map +1 -1
- package/dist/data/traces/trace-feed.cjs.map +1 -1
- package/dist/data/traces/trace-feed.d.ts +15 -0
- package/dist/data/traces/trace-feed.d.ts.map +1 -1
- package/dist/data/traces/trace-feed.js.map +1 -1
- package/dist/data/traces/use-trace-feed.cjs +100 -0
- package/dist/data/traces/use-trace-feed.cjs.map +1 -0
- package/dist/data/traces/use-trace-feed.d.ts +11 -0
- package/dist/data/traces/use-trace-feed.d.ts.map +1 -0
- package/dist/data/traces/use-trace-feed.js +100 -0
- package/dist/data/traces/use-trace-feed.js.map +1 -0
- package/dist/data/verification/adapters.cjs +1 -0
- package/dist/data/verification/adapters.cjs.map +1 -1
- package/dist/data/verification/adapters.d.ts.map +1 -1
- package/dist/data/verification/adapters.js +1 -0
- package/dist/data/verification/adapters.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/data.cjs +2 -2
- package/dist/data.d.ts +1 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +2 -2
- package/dist/hooks/event-hub.cjs +24 -2
- package/dist/hooks/event-hub.cjs.map +1 -1
- package/dist/hooks/event-hub.d.ts +2 -0
- package/dist/hooks/event-hub.d.ts.map +1 -1
- package/dist/hooks/event-hub.js +24 -2
- package/dist/hooks/event-hub.js.map +1 -1
- package/dist/hooks/event-stream.cjs +64 -0
- package/dist/hooks/event-stream.cjs.map +1 -0
- package/dist/hooks/event-stream.d.ts +13 -0
- package/dist/hooks/event-stream.d.ts.map +1 -0
- package/dist/hooks/event-stream.js +64 -0
- package/dist/hooks/event-stream.js.map +1 -0
- package/dist/hooks/log-tail-session.cjs +53 -0
- package/dist/hooks/log-tail-session.cjs.map +1 -0
- package/dist/hooks/log-tail-session.d.ts +31 -0
- package/dist/hooks/log-tail-session.d.ts.map +1 -0
- package/dist/hooks/log-tail-session.js +53 -0
- package/dist/hooks/log-tail-session.js.map +1 -0
- package/dist/hooks/tail-buffer.cjs +15 -0
- package/dist/hooks/tail-buffer.cjs.map +1 -0
- package/dist/hooks/tail-buffer.d.ts +11 -0
- package/dist/hooks/tail-buffer.d.ts.map +1 -0
- package/dist/hooks/tail-buffer.js +15 -0
- package/dist/hooks/tail-buffer.js.map +1 -0
- package/dist/hooks/use-live-snapshot.cjs +60 -0
- package/dist/hooks/use-live-snapshot.cjs.map +1 -0
- package/dist/hooks/use-live-snapshot.d.ts +9 -0
- package/dist/hooks/use-live-snapshot.d.ts.map +1 -0
- package/dist/hooks/use-live-snapshot.js +60 -0
- package/dist/hooks/use-live-snapshot.js.map +1 -0
- package/dist/hooks/use-log-tail.cjs +125 -112
- package/dist/hooks/use-log-tail.cjs.map +1 -1
- package/dist/hooks/use-log-tail.d.ts +2 -24
- package/dist/hooks/use-log-tail.d.ts.map +1 -1
- package/dist/hooks/use-log-tail.js +125 -112
- package/dist/hooks/use-log-tail.js.map +1 -1
- package/dist/hooks.cjs +6 -0
- package/dist/hooks.d.ts +3 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +4 -1
- package/dist/index.cjs +14 -1
- package/dist/index.js +8 -2
- package/dist/runtime/barrels.json +7017 -6986
- package/dist/runtime/importmap.json +2129 -2115
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/comments/gavel/CommentInboxReview.cjs +0 -169
- package/dist/comments/gavel/CommentInboxReview.cjs.map +0 -1
- package/dist/comments/gavel/CommentInboxReview.d.ts +0 -20
- package/dist/comments/gavel/CommentInboxReview.d.ts.map +0 -1
- package/dist/comments/gavel/CommentInboxReview.js +0 -169
- package/dist/comments/gavel/CommentInboxReview.js.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function ExclusiveKeySelect({ keys, value, fieldId, disabled, onChange }: {
|
|
2
|
+
keys: {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}[];
|
|
6
|
+
value: string;
|
|
7
|
+
/** The row control's input id. */
|
|
8
|
+
fieldId: string;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
onChange: (key: string) => void;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=json-schema-form-exclusive-key-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-exclusive-key-select.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-exclusive-key-select.tsx"],"names":[],"mappings":"AAKA,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;IAC/E,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,+BAgBA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Select } from "./select.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/components/json-schema-form-exclusive-key-select.tsx
|
|
4
|
+
function ExclusiveKeySelect({ keys, value, fieldId, disabled, onChange }) {
|
|
5
|
+
const chosen = keys.find((option) => option.key === value)?.label ?? value;
|
|
6
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7
|
+
className: "w-36 shrink-0",
|
|
8
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
9
|
+
htmlFor: fieldId,
|
|
10
|
+
className: "sr-only",
|
|
11
|
+
children: chosen
|
|
12
|
+
}), /* @__PURE__ */ jsx(Select, {
|
|
13
|
+
id: `${fieldId}-key`,
|
|
14
|
+
"aria-label": keys.map((option) => option.label).join(" / "),
|
|
15
|
+
value,
|
|
16
|
+
disabled,
|
|
17
|
+
options: keys.map((option) => ({
|
|
18
|
+
value: option.key,
|
|
19
|
+
label: option.label
|
|
20
|
+
})),
|
|
21
|
+
onChange: (event) => onChange(event.target.value),
|
|
22
|
+
className: "h-7 text-xs font-medium"
|
|
23
|
+
})]
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export { ExclusiveKeySelect };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=json-schema-form-exclusive-key-select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-exclusive-key-select.js","names":[],"sources":["../../src/components/json-schema-form-exclusive-key-select.tsx"],"sourcesContent":["import { Select } from \"./select\";\n\n// ExclusiveKeySelect is the row label of exclusive keys (see exclusiveKeys): a\n// dropdown of the keys by their titles, choosing the one the row's control\n// edits. The control keeps an accessible name through a visually hidden label.\nexport function ExclusiveKeySelect({ keys, value, fieldId, disabled, onChange }: {\n keys: { key: string; label: string }[];\n value: string;\n /** The row control's input id. */\n fieldId: string;\n disabled: boolean;\n onChange: (key: string) => void;\n}) {\n const chosen = keys.find((option) => option.key === value)?.label ?? value;\n return (\n <div className=\"w-36 shrink-0\">\n <label htmlFor={fieldId} className=\"sr-only\">{chosen}</label>\n <Select\n id={`${fieldId}-key`}\n aria-label={keys.map((option) => option.label).join(\" / \")}\n value={value}\n disabled={disabled}\n options={keys.map((option) => ({ value: option.key, label: option.label }))}\n onChange={(event) => onChange(event.target.value)}\n className=\"h-7 text-xs font-medium\"\n />\n </div>\n );\n}\n"],"mappings":";;;AAKA,SAAgB,mBAAmB,EAAE,MAAM,OAAO,SAAS,UAAU,YAOlE;CACD,MAAM,SAAS,KAAK,MAAM,WAAW,OAAO,QAAQ,KAAK,CAAC,EAAE,SAAS;CACrE,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,SAAD;GAAO,SAAS;GAAS,WAAU;GAAW,UAAA;EAAc,CAAA,GAC5D,oBAAC,QAAD;GACE,IAAI,GAAG,QAAQ;GACf,cAAY,KAAK,KAAK,WAAW,OAAO,KAAK,CAAC,CAAC,KAAK,KAAK;GAClD;GACG;GACV,SAAS,KAAK,KAAK,YAAY;IAAE,OAAO,OAAO;IAAK,OAAO,OAAO;GAAM,EAAE;GAC1E,WAAW,UAAU,SAAS,MAAM,OAAO,KAAK;GAChD,WAAU;EACX,CAAA,CACE;;AAET"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/components/json-schema-form-exclusive-keys.ts
|
|
2
|
+
function exclusiveKeys(schema) {
|
|
3
|
+
const branches = schema.oneOf;
|
|
4
|
+
if (!branches || branches.length < 2) return void 0;
|
|
5
|
+
const keys = branches.map((branch) => {
|
|
6
|
+
const required = branch.required;
|
|
7
|
+
return Object.keys(branch).length === 1 && Array.isArray(required) && required.length === 1 ? required[0] : void 0;
|
|
8
|
+
});
|
|
9
|
+
if (keys.some((key) => key === void 0 || !schema.properties?.[key])) return void 0;
|
|
10
|
+
return keys;
|
|
11
|
+
}
|
|
12
|
+
function switchExclusiveKey({ value, keys, next }) {
|
|
13
|
+
const current = keys.find((key) => value[key] !== void 0);
|
|
14
|
+
const rest = Object.fromEntries(Object.entries(value).filter(([key]) => !keys.includes(key)));
|
|
15
|
+
return current === void 0 ? rest : {
|
|
16
|
+
...rest,
|
|
17
|
+
[next]: value[current]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
exports.exclusiveKeys = exclusiveKeys;
|
|
21
|
+
exports.switchExclusiveKey = switchExclusiveKey;
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=json-schema-form-exclusive-keys.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-exclusive-keys.cjs","names":[],"sources":["../../src/components/json-schema-form-exclusive-keys.ts"],"sourcesContent":["import type { JsonSchemaObject } from \"./json-schema-form-types\";\n\n// Exclusive keys: an object whose `oneOf` branches each require exactly one\n// declared property and say nothing else (`oneOf: [{required: [A]}, {required:\n// [B]}]`) holds exactly one of those properties. The form draws them as one\n// row: a dropdown choosing the key (ExclusiveKeySelect), then the chosen key's\n// own control, instead of a row per key of which all but one must stay empty.\nexport function exclusiveKeys(schema: JsonSchemaObject): string[] | undefined {\n const branches = schema.oneOf;\n if (!branches || branches.length < 2) return undefined;\n const keys = branches.map((branch) => {\n const required = branch.required;\n return Object.keys(branch).length === 1 && Array.isArray(required) && required.length === 1 ? required[0] : undefined;\n });\n if (keys.some((key) => key === undefined || !schema.properties?.[key])) return undefined;\n return keys as string[];\n}\n\n// switchExclusiveKey moves the value held under any of `keys` to `next`,\n// leaving every other property as it was.\nexport function switchExclusiveKey({ value, keys, next }: { value: Record<string, unknown>; keys: string[]; next: string }): Record<string, unknown> {\n const current = keys.find((key) => value[key] !== undefined);\n const rest = Object.fromEntries(Object.entries(value).filter(([key]) => !keys.includes(key)));\n return current === undefined ? rest : { ...rest, [next]: value[current] };\n}\n"],"mappings":";AAOA,SAAgB,cAAc,QAAgD;CAC5E,MAAM,WAAW,OAAO;CACxB,IAAI,CAAC,YAAY,SAAS,SAAS,GAAG,OAAO,KAAA;CAC7C,MAAM,OAAO,SAAS,KAAK,WAAW;EACpC,MAAM,WAAW,OAAO;EACxB,OAAO,OAAO,KAAK,MAAM,CAAC,CAAC,WAAW,KAAK,MAAM,QAAQ,QAAQ,KAAK,SAAS,WAAW,IAAI,SAAS,KAAK,KAAA;CAC9G,CAAC;CACD,IAAI,KAAK,MAAM,QAAQ,QAAQ,KAAA,KAAa,CAAC,OAAO,aAAa,IAAI,GAAG,OAAO,KAAA;CAC/E,OAAO;AACT;AAIA,SAAgB,mBAAmB,EAAE,OAAO,MAAM,QAAmG;CACnJ,MAAM,UAAU,KAAK,MAAM,QAAQ,MAAM,SAAS,KAAA,CAAS;CAC3D,MAAM,OAAO,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,SAAS,GAAG,CAAC,CAAC;CAC5F,OAAO,YAAY,KAAA,IAAY,OAAO;EAAE,GAAG;GAAO,OAAO,MAAM;CAAS;AAC1E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JsonSchemaObject } from './json-schema-form-types.js';
|
|
2
|
+
export declare function exclusiveKeys(schema: JsonSchemaObject): string[] | undefined;
|
|
3
|
+
export declare function switchExclusiveKey({ value, keys, next }: {
|
|
4
|
+
value: Record<string, unknown>;
|
|
5
|
+
keys: string[];
|
|
6
|
+
next: string;
|
|
7
|
+
}): Record<string, unknown>;
|
|
8
|
+
//# sourceMappingURL=json-schema-form-exclusive-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-exclusive-keys.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-exclusive-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAOjE,wBAAgB,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,EAAE,GAAG,SAAS,CAS5E;AAID,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAInJ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/components/json-schema-form-exclusive-keys.ts
|
|
2
|
+
function exclusiveKeys(schema) {
|
|
3
|
+
const branches = schema.oneOf;
|
|
4
|
+
if (!branches || branches.length < 2) return void 0;
|
|
5
|
+
const keys = branches.map((branch) => {
|
|
6
|
+
const required = branch.required;
|
|
7
|
+
return Object.keys(branch).length === 1 && Array.isArray(required) && required.length === 1 ? required[0] : void 0;
|
|
8
|
+
});
|
|
9
|
+
if (keys.some((key) => key === void 0 || !schema.properties?.[key])) return void 0;
|
|
10
|
+
return keys;
|
|
11
|
+
}
|
|
12
|
+
function switchExclusiveKey({ value, keys, next }) {
|
|
13
|
+
const current = keys.find((key) => value[key] !== void 0);
|
|
14
|
+
const rest = Object.fromEntries(Object.entries(value).filter(([key]) => !keys.includes(key)));
|
|
15
|
+
return current === void 0 ? rest : {
|
|
16
|
+
...rest,
|
|
17
|
+
[next]: value[current]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export { exclusiveKeys, switchExclusiveKey };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=json-schema-form-exclusive-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-exclusive-keys.js","names":[],"sources":["../../src/components/json-schema-form-exclusive-keys.ts"],"sourcesContent":["import type { JsonSchemaObject } from \"./json-schema-form-types\";\n\n// Exclusive keys: an object whose `oneOf` branches each require exactly one\n// declared property and say nothing else (`oneOf: [{required: [A]}, {required:\n// [B]}]`) holds exactly one of those properties. The form draws them as one\n// row: a dropdown choosing the key (ExclusiveKeySelect), then the chosen key's\n// own control, instead of a row per key of which all but one must stay empty.\nexport function exclusiveKeys(schema: JsonSchemaObject): string[] | undefined {\n const branches = schema.oneOf;\n if (!branches || branches.length < 2) return undefined;\n const keys = branches.map((branch) => {\n const required = branch.required;\n return Object.keys(branch).length === 1 && Array.isArray(required) && required.length === 1 ? required[0] : undefined;\n });\n if (keys.some((key) => key === undefined || !schema.properties?.[key])) return undefined;\n return keys as string[];\n}\n\n// switchExclusiveKey moves the value held under any of `keys` to `next`,\n// leaving every other property as it was.\nexport function switchExclusiveKey({ value, keys, next }: { value: Record<string, unknown>; keys: string[]; next: string }): Record<string, unknown> {\n const current = keys.find((key) => value[key] !== undefined);\n const rest = Object.fromEntries(Object.entries(value).filter(([key]) => !keys.includes(key)));\n return current === undefined ? rest : { ...rest, [next]: value[current] };\n}\n"],"mappings":";AAOA,SAAgB,cAAc,QAAgD;CAC5E,MAAM,WAAW,OAAO;CACxB,IAAI,CAAC,YAAY,SAAS,SAAS,GAAG,OAAO,KAAA;CAC7C,MAAM,OAAO,SAAS,KAAK,WAAW;EACpC,MAAM,WAAW,OAAO;EACxB,OAAO,OAAO,KAAK,MAAM,CAAC,CAAC,WAAW,KAAK,MAAM,QAAQ,QAAQ,KAAK,SAAS,WAAW,IAAI,SAAS,KAAK,KAAA;CAC9G,CAAC;CACD,IAAI,KAAK,MAAM,QAAQ,QAAQ,KAAA,KAAa,CAAC,OAAO,aAAa,IAAI,GAAG,OAAO,KAAA;CAC/E,OAAO;AACT;AAIA,SAAgB,mBAAmB,EAAE,OAAO,MAAM,QAAmG;CACnJ,MAAM,UAAU,KAAK,MAAM,QAAQ,MAAM,SAAS,KAAA,CAAS;CAC3D,MAAM,OAAO,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,SAAS,GAAG,CAAC,CAAC;CAC5F,OAAO,YAAY,KAAA,IAAY,OAAO;EAAE,GAAG;GAAO,OAAO,MAAM;CAAS;AAC1E"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_json_schema_form_section_actions = require("./json-schema-form-section-actions.cjs");
|
|
1
2
|
const require_properties_context = require("../data/properties-context.cjs");
|
|
2
3
|
const require_utils = require("../lib/utils.cjs");
|
|
3
4
|
const require_Icon = require("../data/Icon.cjs");
|
|
@@ -169,24 +170,36 @@ function SectionHeading({ field, label = field.label, size, helpDisplay }) {
|
|
|
169
170
|
]
|
|
170
171
|
});
|
|
171
172
|
}
|
|
172
|
-
function ObjectSection({ heading, actions, size, helper, helpDisplay, children }) {
|
|
173
|
+
function ObjectSection({ heading, actions, actionsOwner, size, helper, helpDisplay, children }) {
|
|
173
174
|
const hoverHelp = helpDisplay === "hover" && !!helper;
|
|
175
|
+
const [slot, setSlot] = (0, react.useState)(null);
|
|
176
|
+
const body = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_json_schema_form_section_actions.SectionActionsContext.Provider, {
|
|
177
|
+
value: actionsOwner !== void 0 && slot ? {
|
|
178
|
+
owner: actionsOwner,
|
|
179
|
+
element: slot
|
|
180
|
+
} : null,
|
|
181
|
+
children
|
|
182
|
+
});
|
|
174
183
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
175
184
|
className: require_utils.cn("col-span-full flex min-w-0 max-w-full flex-col", require_json_schema_form_size.fieldInnerGapClass[size]),
|
|
176
185
|
children: [
|
|
177
186
|
heading != null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
178
187
|
"data-jsf-section-heading": true,
|
|
179
188
|
className: require_utils.cn("flex min-w-0 items-center gap-2 border-b border-border pb-1 font-semibold", require_json_schema_form_size.labelSizeClass[size]),
|
|
180
|
-
children: [heading, actions != null && /* @__PURE__ */ (0, react_jsx_runtime.
|
|
181
|
-
className: "ml-auto shrink-0 font-normal",
|
|
182
|
-
children: actions
|
|
189
|
+
children: [heading, (actions != null || actionsOwner !== void 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
190
|
+
className: "ml-auto flex shrink-0 items-center gap-1 font-normal",
|
|
191
|
+
children: [actions, actionsOwner !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
192
|
+
ref: setSlot,
|
|
193
|
+
"data-jsf-section-actions": true,
|
|
194
|
+
className: "flex items-center empty:hidden"
|
|
195
|
+
})]
|
|
183
196
|
})]
|
|
184
197
|
}),
|
|
185
198
|
helper && !hoverHelp && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
186
199
|
className: "min-w-0 break-words text-xs text-muted-foreground",
|
|
187
200
|
children: helper
|
|
188
201
|
}),
|
|
189
|
-
|
|
202
|
+
body
|
|
190
203
|
]
|
|
191
204
|
});
|
|
192
205
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-layout.cjs","names":["useContext","PropertiesContext","FormLayoutEnginesContext","isBuiltInFormLayout","cn","inlineRowGapClass","stackedRowGapClass","controlMinHeightClass","labelSizeClass","LabelIcon","hasFormHelp","FormHelp","HoverCard","Icon","UiQuestion","fieldInnerGapClass"],"sources":["../../src/components/json-schema-form-layout.tsx"],"sourcesContent":["import { useContext, type ReactNode } from \"react\";\nimport { PropertiesContext } from \"../data/properties-context\";\nimport { cn } from \"../lib/utils\";\nimport { Icon, LabelIcon } from \"../data/Icon\";\nimport { UiQuestion } from \"../icons\";\nimport { HoverCard } from \"../overlay/HoverCard\";\nimport type {\n FieldControl,\n FormLayout,\n GridColumns,\n HelpDisplay,\n} from \"./json-schema-form-types\";\nimport { DEFAULT_COLUMN_MIN_WIDTH } from \"./json-schema-form-utils\";\nimport { FormLayoutEnginesContext } from \"./form-layout-context\";\nimport { assertFormLayoutRegistered, isBuiltInFormLayout } from \"./json-schema-form-extension-api\";\nimport { FormHelp } from \"./json-schema-form-help-links\";\nimport { hasFormHelp } from \"./json-schema-form-help-model\";\nimport {\n controlMinHeightClass,\n fieldInnerGapClass,\n inlineRowGapClass,\n labelSizeClass,\n stackedRowGapClass,\n type FormSize,\n} from \"./json-schema-form-size\";\n\n// FieldsGrid is the container every group of field rows renders into — the\n// top-level form and each nested object/map. In inline mode it owns the single\n// 2-column track definition: `fit-content(labelMaxWidth)` for the label column,\n// `minmax(0, valueMaxWidth)` for the value column. Every field row is a\n// `subgrid` that inherits these tracks, so all labels share one column width and\n// every value lines up — a real form grid, not per-row independent grids.\n// (`fit-content()` is the only valid CSS for \"size to content, clamped to a max\"\n// — `min(w, max-content)` is rejected by the browser, which silently drops the\n// whole declaration and collapses every row to a stacked-looking column. The\n// template is an inline style because Tailwind can't interpolate runtime widths.)\n// Stacked mode is a plain single-column grid.\nexport interface FieldsGridProps {\n layout: FormLayout;\n size: FormSize;\n // Object-level `x-columns`: split a stacked object into N equal columns, or\n // \"auto\" to fit as many `columnMinWidth`-wide columns as the container allows.\n // Fields span one column unless they set `x-col-span`. Ignored in inline mode\n // (which owns its own 2-track label/value layout).\n columns?: GridColumns;\n // `x-columns: \"auto\"` only: the minmax() floor for one column, and an optional\n // cap on the whole grid so controls don't stretch edge to edge on a wide\n // screen. CSS lengths, applied inline — a runtime width can't be a Tailwind\n // arbitrary class, because the scanner never sees it.\n columnMinWidth?: string;\n columnsMaxWidth?: string;\n // Object-level `x-classes`: extra classes merged onto the grid container\n // (e.g. `gap-2`, padding). Applied last so a standard utility wins over the\n // defaults via tailwind-merge.\n className?: string;\n children: ReactNode;\n}\n\nexport function FieldsGrid(props: FieldsGridProps) {\n const { layout, size, columns, columnMinWidth, columnsMaxWidth, className, children } = props;\n const propertiesParent = useContext(PropertiesContext);\n const engines = useContext(FormLayoutEnginesContext);\n // A layout mode that is not built in is a registered engine; it owns the grid.\n if (!isBuiltInFormLayout(layout.mode)) {\n assertFormLayoutRegistered(layout.mode, engines);\n const { Grid } = engines.get(layout.mode)!;\n return <Grid {...props} />;\n }\n if (layout.mode === \"properties\") {\n return (\n <div\n className={cn(\n \"min-w-0 overflow-hidden rounded-md border border-border\",\n propertiesParent &&\n \"col-span-full grid grid-cols-subgrid rounded-none border-0\",\n className,\n )}\n >\n {children}\n </div>\n );\n }\n if (layout.mode === \"inline\") {\n const labelMaxWidth = layout.labelMaxWidth ?? \"40ch\";\n const valueMaxWidth = layout.valueMaxWidth ?? \"600px\";\n return (\n <div\n className={cn(\"grid\", inlineRowGapClass[size], className)}\n style={{\n gridTemplateColumns: `fit-content(${labelMaxWidth}) minmax(0, ${valueMaxWidth})`,\n }}\n >\n {children}\n </div>\n );\n }\n if (columns === \"auto\") {\n return (\n <div\n className={cn(\"grid gap-x-4\", stackedRowGapClass[size], className)}\n style={{\n gridTemplateColumns: `repeat(auto-fill, minmax(${columnMinWidth ?? DEFAULT_COLUMN_MIN_WIDTH}, 1fr))`,\n ...(columnsMaxWidth ? { maxWidth: columnsMaxWidth } : {}),\n }}\n >\n {children}\n </div>\n );\n }\n if (columns && columns > 1) {\n return (\n <div\n className={cn(\"grid gap-x-3\", stackedRowGapClass[size], className)}\n style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}\n >\n {children}\n </div>\n );\n }\n return (\n <div className={cn(\"grid\", stackedRowGapClass[size], className)}>\n {children}\n </div>\n );\n}\n\n// FieldWrapper lays out a single label + value (+ helper/error). In inline mode\n// it is a `subgrid` row spanning the parent FieldsGrid's two columns, so its\n// label and value snap to the shared label/value tracks (helper/error sit under\n// the value column). In stacked mode the label sits tight above its control as\n// one unit, capped at valueMaxWidth so controls don't stretch edge to edge.\nexport function FieldWrapper({\n label,\n value,\n helper,\n error,\n errorElement,\n layout,\n size,\n maxWidth,\n}: {\n label: ReactNode;\n value: ReactNode;\n helper?: ReactNode;\n error?: ReactNode;\n // A complete error element (a FieldError slot replacement), rendered as-is\n // instead of `error`'s <p>-wrapped text.\n errorElement?: ReactNode;\n layout: FormLayout;\n size: FormSize;\n // Overrides the stacked value-width cap. A field spanning the full row of a\n // multi-column grid passes \"none\", so it actually fills the row it was given\n // instead of stopping at the shared 600px cap.\n maxWidth?: string;\n}) {\n if (layout.mode === \"inline\") {\n return (\n <div className=\"col-span-2 grid grid-cols-subgrid items-start gap-x-3 gap-y-0.5\">\n <div\n className={cn(\n \"flex min-w-0 items-center\",\n controlMinHeightClass[size],\n )}\n >\n {label}\n </div>\n <div className=\"min-w-0\">{value}</div>\n {helper && (\n <p className=\"col-start-2 text-xs text-muted-foreground\">{helper}</p>\n )}\n {error && (\n <p className=\"col-start-2 text-xs text-destructive\">{error}</p>\n )}\n {errorElement && <div className=\"col-start-2\">{errorElement}</div>}\n </div>\n );\n }\n return (\n <div\n className=\"flex w-full flex-col gap-1\"\n style={{ maxWidth: maxWidth ?? layout.valueMaxWidth ?? \"600px\" }}\n >\n {label}\n {value}\n {helper && <p className=\"text-xs text-muted-foreground\">{helper}</p>}\n {error && <p className=\"text-xs text-destructive\">{error}</p>}\n {errorElement}\n </div>\n );\n}\n\nexport function FieldLabel({\n field,\n fieldId,\n size,\n helpDisplay,\n}: {\n field: FieldControl;\n fieldId: string;\n size: FormSize;\n // When \"hover\", the description rides on the label as a `?` instead of being\n // rendered as a paragraph under the control by FieldWrapper.\n helpDisplay?: HelpDisplay;\n}) {\n return (\n <label\n htmlFor={fieldId}\n className={cn(\n \"flex min-w-0 items-center gap-2 font-medium\",\n labelSizeClass[size],\n field.labelClassName,\n )}\n >\n <LabelIcon\n icon={field.labelIcon}\n className=\"shrink-0 text-[15px] text-muted-foreground\"\n />\n <span\n className=\"truncate\"\n title={field.label !== field.key ? field.key : undefined}\n >\n {field.label}\n </span>\n {field.required && <span className=\"shrink-0 text-destructive\">*</span>}\n {field.badge && (\n <span className=\"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground\">\n {field.badge}\n </span>\n )}\n {helpDisplay === \"hover\" && hasFormHelp(field) && (\n <HelpHint label={field.label} helper={<FormHelp field={field} />} />\n )}\n </label>\n );\n}\n\n// HelpHint is the `?` affordance that replaces a permanent description\n// paragraph. HoverCard opens on focus as well as hover, so the text stays\n// reachable from the keyboard rather than being mouse-only.\nexport function HelpHint({ label, helper }: { label: string; helper: ReactNode }) {\n return (\n <HoverCard\n placement=\"top\"\n trigger={\n <button\n type=\"button\"\n aria-label={`About ${label}`}\n className=\"shrink-0 cursor-help text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Icon icon={UiQuestion} className=\"text-sm\" />\n </button>\n }\n cardClassName=\"max-w-xs whitespace-normal text-left text-xs font-normal text-foreground\"\n >\n {helper}\n </HoverCard>\n );\n}\n\n// SectionHeading is the content of a section's header row: the label with its\n// icon, required marker, badge and hover help. It is the label node buildField\n// hands to post extensions for a field that renders as a section; a section\n// with an empty title has no heading at all (see ObjectSection).\nexport function SectionHeading({\n field,\n label = field.label,\n size,\n helpDisplay,\n}: {\n field: FieldControl;\n label?: string;\n size: FormSize;\n helpDisplay?: HelpDisplay;\n}) {\n const { required, badge, labelIcon } = field;\n return (\n <span className={cn(\"flex min-w-0 items-center gap-2\", labelSizeClass[size])}>\n <LabelIcon\n icon={labelIcon}\n className=\"shrink-0 text-[15px] text-muted-foreground\"\n />\n <span className=\"min-w-0 truncate\">{label}</span>\n {required && <span className=\"shrink-0 text-destructive\">*</span>}\n {badge && (\n <span className=\"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground\">\n {badge}\n </span>\n )}\n {helpDisplay === \"hover\" && hasFormHelp(field) && <HelpHint label={label} helper={<FormHelp field={field} />} />}\n </span>\n );\n}\n\n// ObjectSection renders a nested object as a labelled section: a header row\n// (the field label + required/badge) above its fields, which fill the full\n// width below. It replaces the inline label + bordered box so nested objects\n// read as flat, headed groups rather than indented sub-forms. `col-span-full`\n// makes it span both tracks of an inline FieldsGrid (full width, not crammed\n// into the value column); in a stacked single-column grid it is a no-op.\n//\n// A field whose schema gives it an EMPTY title renders with no header at all:\n// the host already titled it (a collapsible section of its own, a dialog), and\n// a headed section inside that one would say the same word twice. A missing\n// title is not this — it falls back to the humanised key, as every other\n// control does — so only an explicit `\"title\": \"\"` opts out.\n//\n// The header row is a separate SectionHeading node (null for no header), so\n// the post extensions that decorate every other field's label decorate a\n// section's header too.\nexport function ObjectSection({\n heading,\n actions,\n size,\n helper,\n helpDisplay,\n children,\n}: {\n heading: ReactNode;\n /** Right-aligned header-row actions, e.g. a nullable section's clear. */\n actions?: ReactNode;\n size: FormSize;\n helper?: ReactNode;\n helpDisplay?: HelpDisplay;\n children: ReactNode;\n}) {\n const hoverHelp = helpDisplay === \"hover\" && !!helper;\n return (\n <div\n className={cn(\n \"col-span-full flex min-w-0 max-w-full flex-col\",\n fieldInnerGapClass[size],\n )}\n >\n {heading != null && (\n // The header row owns the rule and weight, so whatever a post\n // extension puts beside the heading sits inline in the same row.\n <div\n data-jsf-section-heading\n className={cn(\n \"flex min-w-0 items-center gap-2 border-b border-border pb-1 font-semibold\",\n labelSizeClass[size],\n )}\n >\n {heading}\n {actions != null && <span className=\"ml-auto shrink-0 font-normal\">{actions}</span>}\n </div>\n )}\n {helper && !hoverHelp && (\n <p className=\"min-w-0 break-words text-xs text-muted-foreground\">\n {helper}\n </p>\n )}\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA0DA,SAAgB,WAAW,OAAwB;CACjD,MAAM,EAAE,QAAQ,MAAM,SAAS,gBAAgB,iBAAiB,WAAW,aAAa;CACxF,MAAM,oBAAA,GAAmBA,MAAAA,WAAAA,CAAWC,2BAAAA,iBAAiB;CACrD,MAAM,WAAA,GAAUD,MAAAA,WAAAA,CAAWE,4BAAAA,wBAAwB;CAEnD,IAAI,CAACC,uCAAAA,oBAAoB,OAAO,IAAI,GAAG;EACrC,uCAAA,2BAA2B,OAAO,MAAM,OAAO;EAC/C,MAAM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WAAU;IAA4B,UAAA;GAAO,CAAA;GAC/D,SACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAU;IACb,UAAA;GACG,CAAA;GAEP,gBAAgB,WAAWC,oCAAAA,YAAY,KAAK,KAAK,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;IAAiB;IAAO,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAACC,oCAAAA,UAAD,EAAiB,MAAQ,CAAA;GAAI,CAAA;EAC3G;;AAEV;AAkBA,SAAgB,cAAc,EAC5B,SACA,SACA,MACA,QACA,aACA,YASC;CACD,MAAM,YAAY,gBAAgB,WAAW,CAAC,CAAC;CAC/C,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EACE,WAAWP,cAAAA,GACT,kDACAW,8BAAAA,mBAAmB,KACrB;EAJF,UAAA;GAMG,WAAW,QAGV,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IACE,4BAAA;IACA,WAAWX,cAAAA,GACT,6EACAI,8BAAAA,eAAe,KACjB;IALF,UAAA,CAOG,SACA,WAAW,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;KAAM,WAAU;KAAgC,UAAA;IAAc,CAAA,CAC/E;;GAEN,UAAU,CAAC,aACV,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;IAAG,WAAU;IACV,UAAA;GACA,CAAA;GAEJ;EACE;;AAET"}
|
|
1
|
+
{"version":3,"file":"json-schema-form-layout.cjs","names":["useContext","PropertiesContext","FormLayoutEnginesContext","isBuiltInFormLayout","cn","inlineRowGapClass","stackedRowGapClass","controlMinHeightClass","labelSizeClass","LabelIcon","hasFormHelp","FormHelp","HoverCard","Icon","UiQuestion","useState","SectionActionsContext","fieldInnerGapClass"],"sources":["../../src/components/json-schema-form-layout.tsx"],"sourcesContent":["import { useContext, useState, type ReactNode } from \"react\";\nimport { SectionActionsContext } from \"./json-schema-form-section-actions\";\nimport { PropertiesContext } from \"../data/properties-context\";\nimport { cn } from \"../lib/utils\";\nimport { Icon, LabelIcon } from \"../data/Icon\";\nimport { UiQuestion } from \"../icons\";\nimport { HoverCard } from \"../overlay/HoverCard\";\nimport type {\n FieldControl,\n FormLayout,\n GridColumns,\n HelpDisplay,\n} from \"./json-schema-form-types\";\nimport { DEFAULT_COLUMN_MIN_WIDTH } from \"./json-schema-form-utils\";\nimport { FormLayoutEnginesContext } from \"./form-layout-context\";\nimport { assertFormLayoutRegistered, isBuiltInFormLayout } from \"./json-schema-form-extension-api\";\nimport { FormHelp } from \"./json-schema-form-help-links\";\nimport { hasFormHelp } from \"./json-schema-form-help-model\";\nimport {\n controlMinHeightClass,\n fieldInnerGapClass,\n inlineRowGapClass,\n labelSizeClass,\n stackedRowGapClass,\n type FormSize,\n} from \"./json-schema-form-size\";\n\n// FieldsGrid is the container every group of field rows renders into — the\n// top-level form and each nested object/map. In inline mode it owns the single\n// 2-column track definition: `fit-content(labelMaxWidth)` for the label column,\n// `minmax(0, valueMaxWidth)` for the value column. Every field row is a\n// `subgrid` that inherits these tracks, so all labels share one column width and\n// every value lines up — a real form grid, not per-row independent grids.\n// (`fit-content()` is the only valid CSS for \"size to content, clamped to a max\"\n// — `min(w, max-content)` is rejected by the browser, which silently drops the\n// whole declaration and collapses every row to a stacked-looking column. The\n// template is an inline style because Tailwind can't interpolate runtime widths.)\n// Stacked mode is a plain single-column grid.\nexport interface FieldsGridProps {\n layout: FormLayout;\n size: FormSize;\n // Object-level `x-columns`: split a stacked object into N equal columns, or\n // \"auto\" to fit as many `columnMinWidth`-wide columns as the container allows.\n // Fields span one column unless they set `x-col-span`. Ignored in inline mode\n // (which owns its own 2-track label/value layout).\n columns?: GridColumns;\n // `x-columns: \"auto\"` only: the minmax() floor for one column, and an optional\n // cap on the whole grid so controls don't stretch edge to edge on a wide\n // screen. CSS lengths, applied inline — a runtime width can't be a Tailwind\n // arbitrary class, because the scanner never sees it.\n columnMinWidth?: string;\n columnsMaxWidth?: string;\n // Object-level `x-classes`: extra classes merged onto the grid container\n // (e.g. `gap-2`, padding). Applied last so a standard utility wins over the\n // defaults via tailwind-merge.\n className?: string;\n children: ReactNode;\n}\n\nexport function FieldsGrid(props: FieldsGridProps) {\n const { layout, size, columns, columnMinWidth, columnsMaxWidth, className, children } = props;\n const propertiesParent = useContext(PropertiesContext);\n const engines = useContext(FormLayoutEnginesContext);\n // A layout mode that is not built in is a registered engine; it owns the grid.\n if (!isBuiltInFormLayout(layout.mode)) {\n assertFormLayoutRegistered(layout.mode, engines);\n const { Grid } = engines.get(layout.mode)!;\n return <Grid {...props} />;\n }\n if (layout.mode === \"properties\") {\n return (\n <div\n className={cn(\n \"min-w-0 overflow-hidden rounded-md border border-border\",\n propertiesParent &&\n \"col-span-full grid grid-cols-subgrid rounded-none border-0\",\n className,\n )}\n >\n {children}\n </div>\n );\n }\n if (layout.mode === \"inline\") {\n const labelMaxWidth = layout.labelMaxWidth ?? \"40ch\";\n const valueMaxWidth = layout.valueMaxWidth ?? \"600px\";\n return (\n <div\n className={cn(\"grid\", inlineRowGapClass[size], className)}\n style={{\n gridTemplateColumns: `fit-content(${labelMaxWidth}) minmax(0, ${valueMaxWidth})`,\n }}\n >\n {children}\n </div>\n );\n }\n if (columns === \"auto\") {\n return (\n <div\n className={cn(\"grid gap-x-4\", stackedRowGapClass[size], className)}\n style={{\n gridTemplateColumns: `repeat(auto-fill, minmax(${columnMinWidth ?? DEFAULT_COLUMN_MIN_WIDTH}, 1fr))`,\n ...(columnsMaxWidth ? { maxWidth: columnsMaxWidth } : {}),\n }}\n >\n {children}\n </div>\n );\n }\n if (columns && columns > 1) {\n return (\n <div\n className={cn(\"grid gap-x-3\", stackedRowGapClass[size], className)}\n style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}\n >\n {children}\n </div>\n );\n }\n return (\n <div className={cn(\"grid\", stackedRowGapClass[size], className)}>\n {children}\n </div>\n );\n}\n\n// FieldWrapper lays out a single label + value (+ helper/error). In inline mode\n// it is a `subgrid` row spanning the parent FieldsGrid's two columns, so its\n// label and value snap to the shared label/value tracks (helper/error sit under\n// the value column). In stacked mode the label sits tight above its control as\n// one unit, capped at valueMaxWidth so controls don't stretch edge to edge.\nexport function FieldWrapper({\n label,\n value,\n helper,\n error,\n errorElement,\n layout,\n size,\n maxWidth,\n}: {\n label: ReactNode;\n value: ReactNode;\n helper?: ReactNode;\n error?: ReactNode;\n // A complete error element (a FieldError slot replacement), rendered as-is\n // instead of `error`'s <p>-wrapped text.\n errorElement?: ReactNode;\n layout: FormLayout;\n size: FormSize;\n // Overrides the stacked value-width cap. A field spanning the full row of a\n // multi-column grid passes \"none\", so it actually fills the row it was given\n // instead of stopping at the shared 600px cap.\n maxWidth?: string;\n}) {\n if (layout.mode === \"inline\") {\n return (\n <div className=\"col-span-2 grid grid-cols-subgrid items-start gap-x-3 gap-y-0.5\">\n <div\n className={cn(\n \"flex min-w-0 items-center\",\n controlMinHeightClass[size],\n )}\n >\n {label}\n </div>\n <div className=\"min-w-0\">{value}</div>\n {helper && (\n <p className=\"col-start-2 text-xs text-muted-foreground\">{helper}</p>\n )}\n {error && (\n <p className=\"col-start-2 text-xs text-destructive\">{error}</p>\n )}\n {errorElement && <div className=\"col-start-2\">{errorElement}</div>}\n </div>\n );\n }\n return (\n <div\n className=\"flex w-full flex-col gap-1\"\n style={{ maxWidth: maxWidth ?? layout.valueMaxWidth ?? \"600px\" }}\n >\n {label}\n {value}\n {helper && <p className=\"text-xs text-muted-foreground\">{helper}</p>}\n {error && <p className=\"text-xs text-destructive\">{error}</p>}\n {errorElement}\n </div>\n );\n}\n\nexport function FieldLabel({\n field,\n fieldId,\n size,\n helpDisplay,\n}: {\n field: FieldControl;\n fieldId: string;\n size: FormSize;\n // When \"hover\", the description rides on the label as a `?` instead of being\n // rendered as a paragraph under the control by FieldWrapper.\n helpDisplay?: HelpDisplay;\n}) {\n return (\n <label\n htmlFor={fieldId}\n className={cn(\n \"flex min-w-0 items-center gap-2 font-medium\",\n labelSizeClass[size],\n field.labelClassName,\n )}\n >\n <LabelIcon\n icon={field.labelIcon}\n className=\"shrink-0 text-[15px] text-muted-foreground\"\n />\n <span\n className=\"truncate\"\n title={field.label !== field.key ? field.key : undefined}\n >\n {field.label}\n </span>\n {field.required && <span className=\"shrink-0 text-destructive\">*</span>}\n {field.badge && (\n <span className=\"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground\">\n {field.badge}\n </span>\n )}\n {helpDisplay === \"hover\" && hasFormHelp(field) && (\n <HelpHint label={field.label} helper={<FormHelp field={field} />} />\n )}\n </label>\n );\n}\n\n// HelpHint is the `?` affordance that replaces a permanent description\n// paragraph. HoverCard opens on focus as well as hover, so the text stays\n// reachable from the keyboard rather than being mouse-only.\nexport function HelpHint({ label, helper }: { label: string; helper: ReactNode }) {\n return (\n <HoverCard\n placement=\"top\"\n trigger={\n <button\n type=\"button\"\n aria-label={`About ${label}`}\n className=\"shrink-0 cursor-help text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Icon icon={UiQuestion} className=\"text-sm\" />\n </button>\n }\n cardClassName=\"max-w-xs whitespace-normal text-left text-xs font-normal text-foreground\"\n >\n {helper}\n </HoverCard>\n );\n}\n\n// SectionHeading is the content of a section's header row: the label with its\n// icon, required marker, badge and hover help. It is the label node buildField\n// hands to post extensions for a field that renders as a section; a section\n// with an empty title has no heading at all (see ObjectSection).\nexport function SectionHeading({\n field,\n label = field.label,\n size,\n helpDisplay,\n}: {\n field: FieldControl;\n label?: string;\n size: FormSize;\n helpDisplay?: HelpDisplay;\n}) {\n const { required, badge, labelIcon } = field;\n return (\n <span className={cn(\"flex min-w-0 items-center gap-2\", labelSizeClass[size])}>\n <LabelIcon\n icon={labelIcon}\n className=\"shrink-0 text-[15px] text-muted-foreground\"\n />\n <span className=\"min-w-0 truncate\">{label}</span>\n {required && <span className=\"shrink-0 text-destructive\">*</span>}\n {badge && (\n <span className=\"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground\">\n {badge}\n </span>\n )}\n {helpDisplay === \"hover\" && hasFormHelp(field) && <HelpHint label={label} helper={<FormHelp field={field} />} />}\n </span>\n );\n}\n\n// ObjectSection renders a nested object as a labelled section: a header row\n// (the field label + required/badge) above its fields, which fill the full\n// width below. It replaces the inline label + bordered box so nested objects\n// read as flat, headed groups rather than indented sub-forms. `col-span-full`\n// makes it span both tracks of an inline FieldsGrid (full width, not crammed\n// into the value column); in a stacked single-column grid it is a no-op.\n//\n// A field whose schema gives it an EMPTY title renders with no header at all:\n// the host already titled it (a collapsible section of its own, a dialog), and\n// a headed section inside that one would say the same word twice. A missing\n// title is not this — it falls back to the humanised key, as every other\n// control does — so only an explicit `\"title\": \"\"` opts out.\n//\n// The header row is a separate SectionHeading node (null for no header), so\n// the post extensions that decorate every other field's label decorate a\n// section's header too.\nexport function ObjectSection({\n heading,\n actions,\n actionsOwner,\n size,\n helper,\n helpDisplay,\n children,\n}: {\n heading: ReactNode;\n /** Right-aligned header-row actions, e.g. a nullable section's clear. */\n actions?: ReactNode;\n /** The instance path of the field this section heads; its control may portal actions into the header row (see SectionActionsContext). */\n actionsOwner?: string;\n size: FormSize;\n helper?: ReactNode;\n helpDisplay?: HelpDisplay;\n children: ReactNode;\n}) {\n const hoverHelp = helpDisplay === \"hover\" && !!helper;\n const [slot, setSlot] = useState<HTMLElement | null>(null);\n // Always provided (null without a slot), so the body keeps its identity when the slot mounts and a nested\n // section's body never sees an outer section's slot.\n const body = (\n <SectionActionsContext.Provider value={actionsOwner !== undefined && slot ? { owner: actionsOwner, element: slot } : null}>{children}</SectionActionsContext.Provider>\n );\n return (\n <div\n className={cn(\n \"col-span-full flex min-w-0 max-w-full flex-col\",\n fieldInnerGapClass[size],\n )}\n >\n {heading != null && (\n // The header row owns the rule and weight, so whatever a post\n // extension puts beside the heading sits inline in the same row.\n <div\n data-jsf-section-heading\n className={cn(\n \"flex min-w-0 items-center gap-2 border-b border-border pb-1 font-semibold\",\n labelSizeClass[size],\n )}\n >\n {heading}\n {(actions != null || actionsOwner !== undefined) && (\n <span className=\"ml-auto flex shrink-0 items-center gap-1 font-normal\">\n {actions}\n {actionsOwner !== undefined && <span ref={setSlot} data-jsf-section-actions className=\"flex items-center empty:hidden\" />}\n </span>\n )}\n </div>\n )}\n {helper && !hoverHelp && (\n <p className=\"min-w-0 break-words text-xs text-muted-foreground\">\n {helper}\n </p>\n )}\n {body}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA2DA,SAAgB,WAAW,OAAwB;CACjD,MAAM,EAAE,QAAQ,MAAM,SAAS,gBAAgB,iBAAiB,WAAW,aAAa;CACxF,MAAM,oBAAA,GAAmBA,MAAAA,WAAAA,CAAWC,2BAAAA,iBAAiB;CACrD,MAAM,WAAA,GAAUD,MAAAA,WAAAA,CAAWE,4BAAAA,wBAAwB;CAEnD,IAAI,CAACC,uCAAAA,oBAAoB,OAAO,IAAI,GAAG;EACrC,uCAAA,2BAA2B,OAAO,MAAM,OAAO;EAC/C,MAAM,EAAE,SAAS,QAAQ,IAAI,OAAO,IAAI;EACxC,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAM,GAAI,MAAQ,CAAA;CAC3B;CACA,IAAI,OAAO,SAAS,cAClB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,WAAWC,cAAAA,GACT,2DACA,oBACE,8DACF,SACF;EAEC;CACE,CAAA;CAGT,IAAI,OAAO,SAAS,UAAU;EAC5B,MAAM,gBAAgB,OAAO,iBAAiB;EAC9C,MAAM,gBAAgB,OAAO,iBAAiB;EAC9C,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GACE,WAAWA,cAAAA,GAAG,QAAQC,8BAAAA,kBAAkB,OAAO,SAAS;GACxD,OAAO,EACL,qBAAqB,eAAe,cAAc,cAAc,cAAc,GAChF;GAEC;E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CAACC,yCAAAA,sBAAsB,UAAvB;EAAgC,OAAO,iBAAiB,KAAA,KAAa,OAAO;GAAE,OAAO;GAAc,SAAS;EAAK,IAAI;EAAO;CAAyC,CAAA;CAEvK,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EACE,WAAWZ,cAAAA,GACT,kDACAa,8BAAAA,mBAAmB,KACrB;EAJF,UAAA;GAMG,WAAW,QAGV,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IACE,4BAAA;IACA,WAAWb,cAAAA,GACT,6EACAI,8BAAAA,eAAe,KACjB;IALF,UAAA,CAOG,UACC,WAAW,QAAQ,iBAAiB,KAAA,MACpC,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;KAAM,WAAU;KAAhB,UAAA,CACG,SACA,iBAAiB,KAAA,KAAa,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;MAAM,KAAK;MAAS,4BAAA;MAAyB,WAAU;KAAkC,CAAA,CACpH;IAEL,CAAA,CAAA;;GAEN,UAAU,CAAC,aACV,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;IAAG,WAAU;IACV,UAAA;GACA,CAAA;GAEJ;EACE;;AAET"}
|
|
@@ -37,10 +37,12 @@ export declare function SectionHeading({ field, label, size, helpDisplay, }: {
|
|
|
37
37
|
size: FormSize;
|
|
38
38
|
helpDisplay?: HelpDisplay;
|
|
39
39
|
}): import("react").JSX.Element;
|
|
40
|
-
export declare function ObjectSection({ heading, actions, size, helper, helpDisplay, children, }: {
|
|
40
|
+
export declare function ObjectSection({ heading, actions, actionsOwner, size, helper, helpDisplay, children, }: {
|
|
41
41
|
heading: ReactNode;
|
|
42
42
|
/** Right-aligned header-row actions, e.g. a nullable section's clear. */
|
|
43
43
|
actions?: ReactNode;
|
|
44
|
+
/** The instance path of the field this section heads; its control may portal actions into the header row (see SectionActionsContext). */
|
|
45
|
+
actionsOwner?: string;
|
|
44
46
|
size: FormSize;
|
|
45
47
|
helper?: ReactNode;
|
|
46
48
|
helpDisplay?: HelpDisplay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-layout.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"json-schema-form-layout.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAO7D,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAML,KAAK,QAAQ,EACd,MAAM,yBAAyB,CAAC;AAajC,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC;IAKf,OAAO,CAAC,EAAE,WAAW,CAAC;IAKtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IAIzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,+BAkEhD;AAOD,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,KAAK,EACL,MAAM,EACN,KAAK,EACL,YAAY,EACZ,MAAM,EACN,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAGlB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC;IAIf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,+BAmCA;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,OAAO,EACP,IAAI,EACJ,WAAW,GACZ,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,QAAQ,CAAC;IAGf,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,+BA+BA;AAKD,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,+BAkB/E;AAMD,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,KAAmB,EACnB,IAAI,EACJ,WAAW,GACZ,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,+BAkBA;AAkBD,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,MAAM,EACN,WAAW,EACX,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,yEAAyE;IACzE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,yIAAyI;IACzI,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB,+BA0CA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SectionActionsContext } from "./json-schema-form-section-actions.js";
|
|
1
2
|
import { PropertiesContext } from "../data/properties-context.js";
|
|
2
3
|
import { cn } from "../lib/utils.js";
|
|
3
4
|
import { Icon, LabelIcon } from "../data/Icon.js";
|
|
@@ -9,7 +10,7 @@ import { assertFormLayoutRegistered, isBuiltInFormLayout } from "./json-schema-f
|
|
|
9
10
|
import { FormHelp } from "./json-schema-form-help-links.js";
|
|
10
11
|
import { hasFormHelp } from "./json-schema-form-help-model.js";
|
|
11
12
|
import { controlMinHeightClass, fieldInnerGapClass, inlineRowGapClass, labelSizeClass, stackedRowGapClass } from "./json-schema-form-size.js";
|
|
12
|
-
import { useContext } from "react";
|
|
13
|
+
import { useContext, useState } from "react";
|
|
13
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
15
|
// src/components/json-schema-form-layout.tsx
|
|
15
16
|
function FieldsGrid(props) {
|
|
@@ -169,24 +170,36 @@ function SectionHeading({ field, label = field.label, size, helpDisplay }) {
|
|
|
169
170
|
]
|
|
170
171
|
});
|
|
171
172
|
}
|
|
172
|
-
function ObjectSection({ heading, actions, size, helper, helpDisplay, children }) {
|
|
173
|
+
function ObjectSection({ heading, actions, actionsOwner, size, helper, helpDisplay, children }) {
|
|
173
174
|
const hoverHelp = helpDisplay === "hover" && !!helper;
|
|
175
|
+
const [slot, setSlot] = useState(null);
|
|
176
|
+
const body = /* @__PURE__ */ jsx(SectionActionsContext.Provider, {
|
|
177
|
+
value: actionsOwner !== void 0 && slot ? {
|
|
178
|
+
owner: actionsOwner,
|
|
179
|
+
element: slot
|
|
180
|
+
} : null,
|
|
181
|
+
children
|
|
182
|
+
});
|
|
174
183
|
return /* @__PURE__ */ jsxs("div", {
|
|
175
184
|
className: cn("col-span-full flex min-w-0 max-w-full flex-col", fieldInnerGapClass[size]),
|
|
176
185
|
children: [
|
|
177
186
|
heading != null && /* @__PURE__ */ jsxs("div", {
|
|
178
187
|
"data-jsf-section-heading": true,
|
|
179
188
|
className: cn("flex min-w-0 items-center gap-2 border-b border-border pb-1 font-semibold", labelSizeClass[size]),
|
|
180
|
-
children: [heading, actions != null && /* @__PURE__ */
|
|
181
|
-
className: "ml-auto shrink-0 font-normal",
|
|
182
|
-
children: actions
|
|
189
|
+
children: [heading, (actions != null || actionsOwner !== void 0) && /* @__PURE__ */ jsxs("span", {
|
|
190
|
+
className: "ml-auto flex shrink-0 items-center gap-1 font-normal",
|
|
191
|
+
children: [actions, actionsOwner !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
192
|
+
ref: setSlot,
|
|
193
|
+
"data-jsf-section-actions": true,
|
|
194
|
+
className: "flex items-center empty:hidden"
|
|
195
|
+
})]
|
|
183
196
|
})]
|
|
184
197
|
}),
|
|
185
198
|
helper && !hoverHelp && /* @__PURE__ */ jsx("p", {
|
|
186
199
|
className: "min-w-0 break-words text-xs text-muted-foreground",
|
|
187
200
|
children: helper
|
|
188
201
|
}),
|
|
189
|
-
|
|
202
|
+
body
|
|
190
203
|
]
|
|
191
204
|
});
|
|
192
205
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-layout.js","names":[],"sources":["../../src/components/json-schema-form-layout.tsx"],"sourcesContent":["import { useContext, type ReactNode } from \"react\";\nimport { PropertiesContext } from \"../data/properties-context\";\nimport { cn } from \"../lib/utils\";\nimport { Icon, LabelIcon } from \"../data/Icon\";\nimport { UiQuestion } from \"../icons\";\nimport { HoverCard } from \"../overlay/HoverCard\";\nimport type {\n FieldControl,\n FormLayout,\n GridColumns,\n HelpDisplay,\n} from \"./json-schema-form-types\";\nimport { DEFAULT_COLUMN_MIN_WIDTH } from \"./json-schema-form-utils\";\nimport { FormLayoutEnginesContext } from \"./form-layout-context\";\nimport { assertFormLayoutRegistered, isBuiltInFormLayout } from \"./json-schema-form-extension-api\";\nimport { FormHelp } from \"./json-schema-form-help-links\";\nimport { hasFormHelp } from \"./json-schema-form-help-model\";\nimport {\n controlMinHeightClass,\n fieldInnerGapClass,\n inlineRowGapClass,\n labelSizeClass,\n stackedRowGapClass,\n type FormSize,\n} from \"./json-schema-form-size\";\n\n// FieldsGrid is the container every group of field rows renders into — the\n// top-level form and each nested object/map. In inline mode it owns the single\n// 2-column track definition: `fit-content(labelMaxWidth)` for the label column,\n// `minmax(0, valueMaxWidth)` for the value column. Every field row is a\n// `subgrid` that inherits these tracks, so all labels share one column width and\n// every value lines up — a real form grid, not per-row independent grids.\n// (`fit-content()` is the only valid CSS for \"size to content, clamped to a max\"\n// — `min(w, max-content)` is rejected by the browser, which silently drops the\n// whole declaration and collapses every row to a stacked-looking column. The\n// template is an inline style because Tailwind can't interpolate runtime widths.)\n// Stacked mode is a plain single-column grid.\nexport interface FieldsGridProps {\n layout: FormLayout;\n size: FormSize;\n // Object-level `x-columns`: split a stacked object into N equal columns, or\n // \"auto\" to fit as many `columnMinWidth`-wide columns as the container allows.\n // Fields span one column unless they set `x-col-span`. Ignored in inline mode\n // (which owns its own 2-track label/value layout).\n columns?: GridColumns;\n // `x-columns: \"auto\"` only: the minmax() floor for one column, and an optional\n // cap on the whole grid so controls don't stretch edge to edge on a wide\n // screen. CSS lengths, applied inline — a runtime width can't be a Tailwind\n // arbitrary class, because the scanner never sees it.\n columnMinWidth?: string;\n columnsMaxWidth?: string;\n // Object-level `x-classes`: extra classes merged onto the grid container\n // (e.g. `gap-2`, padding). Applied last so a standard utility wins over the\n // defaults via tailwind-merge.\n className?: string;\n children: ReactNode;\n}\n\nexport function FieldsGrid(props: FieldsGridProps) {\n const { layout, size, columns, columnMinWidth, columnsMaxWidth, className, children } = props;\n const propertiesParent = useContext(PropertiesContext);\n const engines = useContext(FormLayoutEnginesContext);\n // A layout mode that is not built in is a registered engine; it owns the grid.\n if (!isBuiltInFormLayout(layout.mode)) {\n assertFormLayoutRegistered(layout.mode, engines);\n const { Grid } = engines.get(layout.mode)!;\n return <Grid {...props} />;\n }\n if (layout.mode === \"properties\") {\n return (\n <div\n className={cn(\n \"min-w-0 overflow-hidden rounded-md border border-border\",\n propertiesParent &&\n \"col-span-full grid grid-cols-subgrid rounded-none border-0\",\n className,\n )}\n >\n {children}\n </div>\n );\n }\n if (layout.mode === \"inline\") {\n const labelMaxWidth = layout.labelMaxWidth ?? \"40ch\";\n const valueMaxWidth = layout.valueMaxWidth ?? \"600px\";\n return (\n <div\n className={cn(\"grid\", inlineRowGapClass[size], className)}\n style={{\n gridTemplateColumns: `fit-content(${labelMaxWidth}) minmax(0, ${valueMaxWidth})`,\n }}\n >\n {children}\n </div>\n );\n }\n if (columns === \"auto\") {\n return (\n <div\n className={cn(\"grid gap-x-4\", stackedRowGapClass[size], className)}\n style={{\n gridTemplateColumns: `repeat(auto-fill, minmax(${columnMinWidth ?? DEFAULT_COLUMN_MIN_WIDTH}, 1fr))`,\n ...(columnsMaxWidth ? { maxWidth: columnsMaxWidth } : {}),\n }}\n >\n {children}\n </div>\n );\n }\n if (columns && columns > 1) {\n return (\n <div\n className={cn(\"grid gap-x-3\", stackedRowGapClass[size], className)}\n style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}\n >\n {children}\n </div>\n );\n }\n return (\n <div className={cn(\"grid\", stackedRowGapClass[size], className)}>\n {children}\n </div>\n );\n}\n\n// FieldWrapper lays out a single label + value (+ helper/error). In inline mode\n// it is a `subgrid` row spanning the parent FieldsGrid's two columns, so its\n// label and value snap to the shared label/value tracks (helper/error sit under\n// the value column). In stacked mode the label sits tight above its control as\n// one unit, capped at valueMaxWidth so controls don't stretch edge to edge.\nexport function FieldWrapper({\n label,\n value,\n helper,\n error,\n errorElement,\n layout,\n size,\n maxWidth,\n}: {\n label: ReactNode;\n value: ReactNode;\n helper?: ReactNode;\n error?: ReactNode;\n // A complete error element (a FieldError slot replacement), rendered as-is\n // instead of `error`'s <p>-wrapped text.\n errorElement?: ReactNode;\n layout: FormLayout;\n size: FormSize;\n // Overrides the stacked value-width cap. A field spanning the full row of a\n // multi-column grid passes \"none\", so it actually fills the row it was given\n // instead of stopping at the shared 600px cap.\n maxWidth?: string;\n}) {\n if (layout.mode === \"inline\") {\n return (\n <div className=\"col-span-2 grid grid-cols-subgrid items-start gap-x-3 gap-y-0.5\">\n <div\n className={cn(\n \"flex min-w-0 items-center\",\n controlMinHeightClass[size],\n )}\n >\n {label}\n </div>\n <div className=\"min-w-0\">{value}</div>\n {helper && (\n <p className=\"col-start-2 text-xs text-muted-foreground\">{helper}</p>\n )}\n {error && (\n <p className=\"col-start-2 text-xs text-destructive\">{error}</p>\n )}\n {errorElement && <div className=\"col-start-2\">{errorElement}</div>}\n </div>\n );\n }\n return (\n <div\n className=\"flex w-full flex-col gap-1\"\n style={{ maxWidth: maxWidth ?? layout.valueMaxWidth ?? \"600px\" }}\n >\n {label}\n {value}\n {helper && <p className=\"text-xs text-muted-foreground\">{helper}</p>}\n {error && <p className=\"text-xs text-destructive\">{error}</p>}\n {errorElement}\n </div>\n );\n}\n\nexport function FieldLabel({\n field,\n fieldId,\n size,\n helpDisplay,\n}: {\n field: FieldControl;\n fieldId: string;\n size: FormSize;\n // When \"hover\", the description rides on the label as a `?` instead of being\n // rendered as a paragraph under the control by FieldWrapper.\n helpDisplay?: HelpDisplay;\n}) {\n return (\n <label\n htmlFor={fieldId}\n className={cn(\n \"flex min-w-0 items-center gap-2 font-medium\",\n labelSizeClass[size],\n field.labelClassName,\n )}\n >\n <LabelIcon\n icon={field.labelIcon}\n className=\"shrink-0 text-[15px] text-muted-foreground\"\n />\n <span\n className=\"truncate\"\n title={field.label !== field.key ? field.key : undefined}\n >\n {field.label}\n </span>\n {field.required && <span className=\"shrink-0 text-destructive\">*</span>}\n {field.badge && (\n <span className=\"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground\">\n {field.badge}\n </span>\n )}\n {helpDisplay === \"hover\" && hasFormHelp(field) && (\n <HelpHint label={field.label} helper={<FormHelp field={field} />} />\n )}\n </label>\n );\n}\n\n// HelpHint is the `?` affordance that replaces a permanent description\n// paragraph. HoverCard opens on focus as well as hover, so the text stays\n// reachable from the keyboard rather than being mouse-only.\nexport function HelpHint({ label, helper }: { label: string; helper: ReactNode }) {\n return (\n <HoverCard\n placement=\"top\"\n trigger={\n <button\n type=\"button\"\n aria-label={`About ${label}`}\n className=\"shrink-0 cursor-help text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Icon icon={UiQuestion} className=\"text-sm\" />\n </button>\n }\n cardClassName=\"max-w-xs whitespace-normal text-left text-xs font-normal text-foreground\"\n >\n {helper}\n </HoverCard>\n );\n}\n\n// SectionHeading is the content of a section's header row: the label with its\n// icon, required marker, badge and hover help. It is the label node buildField\n// hands to post extensions for a field that renders as a section; a section\n// with an empty title has no heading at all (see ObjectSection).\nexport function SectionHeading({\n field,\n label = field.label,\n size,\n helpDisplay,\n}: {\n field: FieldControl;\n label?: string;\n size: FormSize;\n helpDisplay?: HelpDisplay;\n}) {\n const { required, badge, labelIcon } = field;\n return (\n <span className={cn(\"flex min-w-0 items-center gap-2\", labelSizeClass[size])}>\n <LabelIcon\n icon={labelIcon}\n className=\"shrink-0 text-[15px] text-muted-foreground\"\n />\n <span className=\"min-w-0 truncate\">{label}</span>\n {required && <span className=\"shrink-0 text-destructive\">*</span>}\n {badge && (\n <span className=\"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground\">\n {badge}\n </span>\n )}\n {helpDisplay === \"hover\" && hasFormHelp(field) && <HelpHint label={label} helper={<FormHelp field={field} />} />}\n </span>\n );\n}\n\n// ObjectSection renders a nested object as a labelled section: a header row\n// (the field label + required/badge) above its fields, which fill the full\n// width below. It replaces the inline label + bordered box so nested objects\n// read as flat, headed groups rather than indented sub-forms. `col-span-full`\n// makes it span both tracks of an inline FieldsGrid (full width, not crammed\n// into the value column); in a stacked single-column grid it is a no-op.\n//\n// A field whose schema gives it an EMPTY title renders with no header at all:\n// the host already titled it (a collapsible section of its own, a dialog), and\n// a headed section inside that one would say the same word twice. A missing\n// title is not this — it falls back to the humanised key, as every other\n// control does — so only an explicit `\"title\": \"\"` opts out.\n//\n// The header row is a separate SectionHeading node (null for no header), so\n// the post extensions that decorate every other field's label decorate a\n// section's header too.\nexport function ObjectSection({\n heading,\n actions,\n size,\n helper,\n helpDisplay,\n children,\n}: {\n heading: ReactNode;\n /** Right-aligned header-row actions, e.g. a nullable section's clear. */\n actions?: ReactNode;\n size: FormSize;\n helper?: ReactNode;\n helpDisplay?: HelpDisplay;\n children: ReactNode;\n}) {\n const hoverHelp = helpDisplay === \"hover\" && !!helper;\n return (\n <div\n className={cn(\n \"col-span-full flex min-w-0 max-w-full flex-col\",\n fieldInnerGapClass[size],\n )}\n >\n {heading != null && (\n // The header row owns the rule and weight, so whatever a post\n // extension puts beside the heading sits inline in the same row.\n <div\n data-jsf-section-heading\n className={cn(\n \"flex min-w-0 items-center gap-2 border-b border-border pb-1 font-semibold\",\n labelSizeClass[size],\n )}\n >\n {heading}\n {actions != null && <span className=\"ml-auto shrink-0 font-normal\">{actions}</span>}\n </div>\n )}\n {helper && !hoverHelp && (\n <p className=\"min-w-0 break-words text-xs text-muted-foreground\">\n {helper}\n </p>\n )}\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA0DA,SAAgB,WAAW,OAAwB;CACjD,MAAM,EAAE,QAAQ,MAAM,SAAS,gBAAgB,iBAAiB,WAAW,aAAa;CACxF,MAAM,mBAAmB,WAAW,iBAAiB;CACrD,MAAM,UAAU,WAAW,wBAAwB;CAEnD,IAAI,CAAC,oBAAoB,OAAO,IAAI,GAAG;EACrC,2BAA2B,OAAO,MAAM,OAAO;EAC/C,MAAM,EAAE,SAAS,QAAQ,IAAI,OAAO,IAAI;EACxC,OAAO,oBAAC,MAAD,EAAM,GAAI,MAAQ,CAAA;CAC3B;CACA,IAAI,OAAO,SAAS,cAClB,OACE,oBAAC,OAAD;EACE,WAAW,GACT,2DACA,oBACE,8DACF,SACF;EAEC;CACE,CAAA;CAGT,IAAI,OAAO,SAAS,UAAU;EAC5B,MAAM,gBAAgB,OAAO,iBAAiB;EAC9C,MAAM,gBAAgB,OAAO,iBAAiB;EAC9C,OACE,oBAAC,OAAD;GACE,WAAW,GAAG,QAAQ,kBAAkB,OAAO,SAAS;GACxD,OAAO,EACL,qBAAqB,eAAe,cAAc,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AAgB,WAAW,YAAY,KAAK,KAAK,oBAAC,UAAD;IAAiB;IAAO,QAAQ,oBAAC,UAAD,EAAiB,MAAQ,CAAA;GAAI,CAAA;EAC3G;;AAEV;AAkBA,SAAgB,cAAc,EAC5B,SACA,SACA,MACA,QACA,aACA,YASC;CACD,MAAM,YAAY,gBAAgB,WAAW,CAAC,CAAC;CAC/C,OACE,qBAAC,OAAD;EACE,WAAW,GACT,kDACA,mBAAmB,KACrB;EAJF,UAAA;GAMG,WAAW,QAGV,qBAAC,OAAD;IACE,4BAAA;IACA,WAAW,GACT,6EACA,eAAe,KACjB;IALF,UAAA,CAOG,SACA,WAAW,QAAQ,oBAAC,QAAD;KAAM,WAAU;KAAgC,UAAA;IAAc,CAAA,CAC/E;;GAEN,UAAU,CAAC,aACV,oBAAC,KAAD;IAAG,WAAU;IACV,UAAA;GACA,CAAA;GAEJ;EACE;;AAET"}
|
|
1
|
+
{"version":3,"file":"json-schema-form-layout.js","names":[],"sources":["../../src/components/json-schema-form-layout.tsx"],"sourcesContent":["import { useContext, useState, type ReactNode } from \"react\";\nimport { SectionActionsContext } from \"./json-schema-form-section-actions\";\nimport { PropertiesContext } from \"../data/properties-context\";\nimport { cn } from \"../lib/utils\";\nimport { Icon, LabelIcon } from \"../data/Icon\";\nimport { UiQuestion } from \"../icons\";\nimport { HoverCard } from \"../overlay/HoverCard\";\nimport type {\n FieldControl,\n FormLayout,\n GridColumns,\n HelpDisplay,\n} from \"./json-schema-form-types\";\nimport { DEFAULT_COLUMN_MIN_WIDTH } from \"./json-schema-form-utils\";\nimport { FormLayoutEnginesContext } from \"./form-layout-context\";\nimport { assertFormLayoutRegistered, isBuiltInFormLayout } from \"./json-schema-form-extension-api\";\nimport { FormHelp } from \"./json-schema-form-help-links\";\nimport { hasFormHelp } from \"./json-schema-form-help-model\";\nimport {\n controlMinHeightClass,\n fieldInnerGapClass,\n inlineRowGapClass,\n labelSizeClass,\n stackedRowGapClass,\n type FormSize,\n} from \"./json-schema-form-size\";\n\n// FieldsGrid is the container every group of field rows renders into — the\n// top-level form and each nested object/map. In inline mode it owns the single\n// 2-column track definition: `fit-content(labelMaxWidth)` for the label column,\n// `minmax(0, valueMaxWidth)` for the value column. Every field row is a\n// `subgrid` that inherits these tracks, so all labels share one column width and\n// every value lines up — a real form grid, not per-row independent grids.\n// (`fit-content()` is the only valid CSS for \"size to content, clamped to a max\"\n// — `min(w, max-content)` is rejected by the browser, which silently drops the\n// whole declaration and collapses every row to a stacked-looking column. The\n// template is an inline style because Tailwind can't interpolate runtime widths.)\n// Stacked mode is a plain single-column grid.\nexport interface FieldsGridProps {\n layout: FormLayout;\n size: FormSize;\n // Object-level `x-columns`: split a stacked object into N equal columns, or\n // \"auto\" to fit as many `columnMinWidth`-wide columns as the container allows.\n // Fields span one column unless they set `x-col-span`. Ignored in inline mode\n // (which owns its own 2-track label/value layout).\n columns?: GridColumns;\n // `x-columns: \"auto\"` only: the minmax() floor for one column, and an optional\n // cap on the whole grid so controls don't stretch edge to edge on a wide\n // screen. CSS lengths, applied inline — a runtime width can't be a Tailwind\n // arbitrary class, because the scanner never sees it.\n columnMinWidth?: string;\n columnsMaxWidth?: string;\n // Object-level `x-classes`: extra classes merged onto the grid container\n // (e.g. `gap-2`, padding). Applied last so a standard utility wins over the\n // defaults via tailwind-merge.\n className?: string;\n children: ReactNode;\n}\n\nexport function FieldsGrid(props: FieldsGridProps) {\n const { layout, size, columns, columnMinWidth, columnsMaxWidth, className, children } = props;\n const propertiesParent = useContext(PropertiesContext);\n const engines = useContext(FormLayoutEnginesContext);\n // A layout mode that is not built in is a registered engine; it owns the grid.\n if (!isBuiltInFormLayout(layout.mode)) {\n assertFormLayoutRegistered(layout.mode, engines);\n const { Grid } = engines.get(layout.mode)!;\n return <Grid {...props} />;\n }\n if (layout.mode === \"properties\") {\n return (\n <div\n className={cn(\n \"min-w-0 overflow-hidden rounded-md border border-border\",\n propertiesParent &&\n \"col-span-full grid grid-cols-subgrid rounded-none border-0\",\n className,\n )}\n >\n {children}\n </div>\n );\n }\n if (layout.mode === \"inline\") {\n const labelMaxWidth = layout.labelMaxWidth ?? \"40ch\";\n const valueMaxWidth = layout.valueMaxWidth ?? \"600px\";\n return (\n <div\n className={cn(\"grid\", inlineRowGapClass[size], className)}\n style={{\n gridTemplateColumns: `fit-content(${labelMaxWidth}) minmax(0, ${valueMaxWidth})`,\n }}\n >\n {children}\n </div>\n );\n }\n if (columns === \"auto\") {\n return (\n <div\n className={cn(\"grid gap-x-4\", stackedRowGapClass[size], className)}\n style={{\n gridTemplateColumns: `repeat(auto-fill, minmax(${columnMinWidth ?? DEFAULT_COLUMN_MIN_WIDTH}, 1fr))`,\n ...(columnsMaxWidth ? { maxWidth: columnsMaxWidth } : {}),\n }}\n >\n {children}\n </div>\n );\n }\n if (columns && columns > 1) {\n return (\n <div\n className={cn(\"grid gap-x-3\", stackedRowGapClass[size], className)}\n style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}\n >\n {children}\n </div>\n );\n }\n return (\n <div className={cn(\"grid\", stackedRowGapClass[size], className)}>\n {children}\n </div>\n );\n}\n\n// FieldWrapper lays out a single label + value (+ helper/error). In inline mode\n// it is a `subgrid` row spanning the parent FieldsGrid's two columns, so its\n// label and value snap to the shared label/value tracks (helper/error sit under\n// the value column). In stacked mode the label sits tight above its control as\n// one unit, capped at valueMaxWidth so controls don't stretch edge to edge.\nexport function FieldWrapper({\n label,\n value,\n helper,\n error,\n errorElement,\n layout,\n size,\n maxWidth,\n}: {\n label: ReactNode;\n value: ReactNode;\n helper?: ReactNode;\n error?: ReactNode;\n // A complete error element (a FieldError slot replacement), rendered as-is\n // instead of `error`'s <p>-wrapped text.\n errorElement?: ReactNode;\n layout: FormLayout;\n size: FormSize;\n // Overrides the stacked value-width cap. A field spanning the full row of a\n // multi-column grid passes \"none\", so it actually fills the row it was given\n // instead of stopping at the shared 600px cap.\n maxWidth?: string;\n}) {\n if (layout.mode === \"inline\") {\n return (\n <div className=\"col-span-2 grid grid-cols-subgrid items-start gap-x-3 gap-y-0.5\">\n <div\n className={cn(\n \"flex min-w-0 items-center\",\n controlMinHeightClass[size],\n )}\n >\n {label}\n </div>\n <div className=\"min-w-0\">{value}</div>\n {helper && (\n <p className=\"col-start-2 text-xs text-muted-foreground\">{helper}</p>\n )}\n {error && (\n <p className=\"col-start-2 text-xs text-destructive\">{error}</p>\n )}\n {errorElement && <div className=\"col-start-2\">{errorElement}</div>}\n </div>\n );\n }\n return (\n <div\n className=\"flex w-full flex-col gap-1\"\n style={{ maxWidth: maxWidth ?? layout.valueMaxWidth ?? \"600px\" }}\n >\n {label}\n {value}\n {helper && <p className=\"text-xs text-muted-foreground\">{helper}</p>}\n {error && <p className=\"text-xs text-destructive\">{error}</p>}\n {errorElement}\n </div>\n );\n}\n\nexport function FieldLabel({\n field,\n fieldId,\n size,\n helpDisplay,\n}: {\n field: FieldControl;\n fieldId: string;\n size: FormSize;\n // When \"hover\", the description rides on the label as a `?` instead of being\n // rendered as a paragraph under the control by FieldWrapper.\n helpDisplay?: HelpDisplay;\n}) {\n return (\n <label\n htmlFor={fieldId}\n className={cn(\n \"flex min-w-0 items-center gap-2 font-medium\",\n labelSizeClass[size],\n field.labelClassName,\n )}\n >\n <LabelIcon\n icon={field.labelIcon}\n className=\"shrink-0 text-[15px] text-muted-foreground\"\n />\n <span\n className=\"truncate\"\n title={field.label !== field.key ? field.key : undefined}\n >\n {field.label}\n </span>\n {field.required && <span className=\"shrink-0 text-destructive\">*</span>}\n {field.badge && (\n <span className=\"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground\">\n {field.badge}\n </span>\n )}\n {helpDisplay === \"hover\" && hasFormHelp(field) && (\n <HelpHint label={field.label} helper={<FormHelp field={field} />} />\n )}\n </label>\n );\n}\n\n// HelpHint is the `?` affordance that replaces a permanent description\n// paragraph. HoverCard opens on focus as well as hover, so the text stays\n// reachable from the keyboard rather than being mouse-only.\nexport function HelpHint({ label, helper }: { label: string; helper: ReactNode }) {\n return (\n <HoverCard\n placement=\"top\"\n trigger={\n <button\n type=\"button\"\n aria-label={`About ${label}`}\n className=\"shrink-0 cursor-help text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Icon icon={UiQuestion} className=\"text-sm\" />\n </button>\n }\n cardClassName=\"max-w-xs whitespace-normal text-left text-xs font-normal text-foreground\"\n >\n {helper}\n </HoverCard>\n );\n}\n\n// SectionHeading is the content of a section's header row: the label with its\n// icon, required marker, badge and hover help. It is the label node buildField\n// hands to post extensions for a field that renders as a section; a section\n// with an empty title has no heading at all (see ObjectSection).\nexport function SectionHeading({\n field,\n label = field.label,\n size,\n helpDisplay,\n}: {\n field: FieldControl;\n label?: string;\n size: FormSize;\n helpDisplay?: HelpDisplay;\n}) {\n const { required, badge, labelIcon } = field;\n return (\n <span className={cn(\"flex min-w-0 items-center gap-2\", labelSizeClass[size])}>\n <LabelIcon\n icon={labelIcon}\n className=\"shrink-0 text-[15px] text-muted-foreground\"\n />\n <span className=\"min-w-0 truncate\">{label}</span>\n {required && <span className=\"shrink-0 text-destructive\">*</span>}\n {badge && (\n <span className=\"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground\">\n {badge}\n </span>\n )}\n {helpDisplay === \"hover\" && hasFormHelp(field) && <HelpHint label={label} helper={<FormHelp field={field} />} />}\n </span>\n );\n}\n\n// ObjectSection renders a nested object as a labelled section: a header row\n// (the field label + required/badge) above its fields, which fill the full\n// width below. It replaces the inline label + bordered box so nested objects\n// read as flat, headed groups rather than indented sub-forms. `col-span-full`\n// makes it span both tracks of an inline FieldsGrid (full width, not crammed\n// into the value column); in a stacked single-column grid it is a no-op.\n//\n// A field whose schema gives it an EMPTY title renders with no header at all:\n// the host already titled it (a collapsible section of its own, a dialog), and\n// a headed section inside that one would say the same word twice. A missing\n// title is not this — it falls back to the humanised key, as every other\n// control does — so only an explicit `\"title\": \"\"` opts out.\n//\n// The header row is a separate SectionHeading node (null for no header), so\n// the post extensions that decorate every other field's label decorate a\n// section's header too.\nexport function ObjectSection({\n heading,\n actions,\n actionsOwner,\n size,\n helper,\n helpDisplay,\n children,\n}: {\n heading: ReactNode;\n /** Right-aligned header-row actions, e.g. a nullable section's clear. */\n actions?: ReactNode;\n /** The instance path of the field this section heads; its control may portal actions into the header row (see SectionActionsContext). */\n actionsOwner?: string;\n size: FormSize;\n helper?: ReactNode;\n helpDisplay?: HelpDisplay;\n children: ReactNode;\n}) {\n const hoverHelp = helpDisplay === \"hover\" && !!helper;\n const [slot, setSlot] = useState<HTMLElement | null>(null);\n // Always provided (null without a slot), so the body keeps its identity when the slot mounts and a nested\n // section's body never sees an outer section's slot.\n const body = (\n <SectionActionsContext.Provider value={actionsOwner !== undefined && slot ? { owner: actionsOwner, element: slot } : null}>{children}</SectionActionsContext.Provider>\n );\n return (\n <div\n className={cn(\n \"col-span-full flex min-w-0 max-w-full flex-col\",\n fieldInnerGapClass[size],\n )}\n >\n {heading != null && (\n // The header row owns the rule and weight, so whatever a post\n // extension puts beside the heading sits inline in the same row.\n <div\n data-jsf-section-heading\n className={cn(\n \"flex min-w-0 items-center gap-2 border-b border-border pb-1 font-semibold\",\n labelSizeClass[size],\n )}\n >\n {heading}\n {(actions != null || actionsOwner !== undefined) && (\n <span className=\"ml-auto flex shrink-0 items-center gap-1 font-normal\">\n {actions}\n {actionsOwner !== undefined && <span ref={setSlot} data-jsf-section-actions className=\"flex items-center empty:hidden\" />}\n </span>\n )}\n </div>\n )}\n {helper && !hoverHelp && (\n <p className=\"min-w-0 break-words text-xs text-muted-foreground\">\n {helper}\n </p>\n )}\n {body}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA2DA,SAAgB,WAAW,OAAwB;CACjD,MAAM,EAAE,QAAQ,MAAM,SAAS,gBAAgB,iBAAiB,WAAW,aAAa;CACxF,MAAM,mBAAmB,WAAW,iBAAiB;CAC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,KAAK;MAAS,4BAAA;MAAyB,WAAU;KAAkC,CAAA,CACpH;IAEL,CAAA,CAAA;;GAEN,UAAU,CAAC,aACV,oBAAC,KAAD;IAAG,WAAU;IACV,UAAA;GACA,CAAA;GAEJ;EACE;;AAET"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_json_schema_form_section_actions = require("./json-schema-form-section-actions.cjs");
|
|
1
2
|
const require_UiCheck = require("../icons/components/UiCheck.cjs");
|
|
2
3
|
const require_UiDotsVertical = require("../icons/components/UiDotsVertical.cjs");
|
|
3
4
|
const require_DropdownMenu = require("../overlay/DropdownMenu.cjs");
|
|
@@ -6,6 +7,7 @@ const require_json_schema_form_array_view = require("./json-schema-form-array-vi
|
|
|
6
7
|
const require_json_schema_form_table_array = require("./json-schema-form-table-array.cjs");
|
|
7
8
|
let react = require("react");
|
|
8
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
let react_dom = require("react-dom");
|
|
9
11
|
// src/components/json-schema-form-object-array-view.tsx
|
|
10
12
|
var VIEW_LABELS = {
|
|
11
13
|
grid: "Grid",
|
|
@@ -19,17 +21,21 @@ var VIEWS = [
|
|
|
19
21
|
];
|
|
20
22
|
function ObjectArrayView({ field, ctx, readOnly }) {
|
|
21
23
|
const [view, setView] = (0, react.useState)(() => require_json_schema_form_array_view.defaultArrayView(field, require_json_schema_form_array_view.arrayViewOptions(field, ctx)));
|
|
22
|
-
const
|
|
24
|
+
const headerSlot = require_json_schema_form_section_actions.useSectionActionsSlot(ctx.instancePath ?? "");
|
|
25
|
+
const menu = ctx.presentation ? void 0 : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArrayViewMenu, {
|
|
23
26
|
label: field.label || field.key,
|
|
24
27
|
view,
|
|
25
28
|
onChange: setView
|
|
26
29
|
});
|
|
27
|
-
|
|
30
|
+
const toolbar = menu && headerSlot ? null : menu;
|
|
31
|
+
const portal = menu && headerSlot ? (0, react_dom.createPortal)(menu, headerSlot) : null;
|
|
32
|
+
const toolbarProp = toolbar === void 0 ? {} : { toolbar };
|
|
33
|
+
if (view === "grid") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [portal, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_json_schema_form_table_array.TableArray, {
|
|
28
34
|
field,
|
|
29
35
|
ctx,
|
|
30
36
|
readOnly,
|
|
31
|
-
...
|
|
32
|
-
});
|
|
37
|
+
...toolbarProp
|
|
38
|
+
})] });
|
|
33
39
|
const itemCtx = {
|
|
34
40
|
...ctx,
|
|
35
41
|
layout: {
|
|
@@ -37,12 +43,12 @@ function ObjectArrayView({ field, ctx, readOnly }) {
|
|
|
37
43
|
mode: view === "stack" ? "stacked" : "inline"
|
|
38
44
|
}
|
|
39
45
|
};
|
|
40
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_json_schema_form_accordion_array.AccordionArray, {
|
|
46
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [portal, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_json_schema_form_accordion_array.AccordionArray, {
|
|
41
47
|
field,
|
|
42
48
|
ctx: itemCtx,
|
|
43
49
|
readOnly,
|
|
44
|
-
...
|
|
45
|
-
});
|
|
50
|
+
...toolbarProp
|
|
51
|
+
})] });
|
|
46
52
|
}
|
|
47
53
|
function ArrayViewMenu({ label, view, onChange }) {
|
|
48
54
|
const title = `View options for ${label}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-object-array-view.cjs","names":["useState","defaultArrayView","arrayViewOptions","TableArray","AccordionArray","DropdownMenu","UiDotsVertical","
|
|
1
|
+
{"version":3,"file":"json-schema-form-object-array-view.cjs","names":["useState","defaultArrayView","arrayViewOptions","useSectionActionsSlot","createPortal","_Fragment","TableArray","AccordionArray","DropdownMenu","UiDotsVertical","UiCheck"],"sources":["../../src/components/json-schema-form-object-array-view.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useSectionActionsSlot } from \"./json-schema-form-section-actions\";\nimport { UiCheck, UiDotsVertical } from \"../icons\";\nimport { DropdownMenu } from \"../overlay/DropdownMenu\";\nimport { AccordionArray } from \"./json-schema-form-accordion-array\";\nimport { arrayViewOptions, defaultArrayView, type ArrayView } from \"./json-schema-form-array-view\";\nimport { TableArray } from \"./json-schema-form-table-array\";\nimport type { FieldControl, RenderContext } from \"./json-schema-form-types\";\n\nconst VIEW_LABELS: Record<ArrayView, string> = {\n grid: \"Grid\",\n stack: \"Stack form\",\n inline: \"Inline form\",\n};\n\nconst VIEWS: ArrayView[] = [\"grid\", \"stack\", \"inline\"];\n\n// ObjectArrayView renders an object-item array in the view it opens in (see\n// defaultArrayView) and lets the author switch it: the grid is TableArray, and\n// both item forms are AccordionArray, with each item's fields stacked under\n// their labels or labelled inline. The value is the array's own, so an edit\n// made in one view is there in the next. A presentation preview keeps the\n// default view and shows no menu: it is a read-only summary, not an editor.\nexport function ObjectArrayView({\n field,\n ctx,\n readOnly,\n}: {\n field: FieldControl;\n ctx: RenderContext;\n readOnly: boolean;\n}) {\n const [view, setView] = useState<ArrayView>(() => defaultArrayView(field, arrayViewOptions(field, ctx)));\n // The menu sits in the header row of the section this array heads; without one it stays on the summary line.\n const headerSlot = useSectionActionsSlot(ctx.instancePath ?? \"\");\n const menu = ctx.presentation ? undefined : (\n <ArrayViewMenu label={field.label || field.key} view={view} onChange={setView} />\n );\n // null keeps the summary line (and its item count) when the menu moved to the header row.\n const toolbar = menu && headerSlot ? null : menu;\n const portal = menu && headerSlot ? createPortal(menu, headerSlot) : null;\n const toolbarProp = toolbar === undefined ? {} : { toolbar };\n if (view === \"grid\") {\n return <>{portal}<TableArray field={field} ctx={ctx} readOnly={readOnly} {...toolbarProp} /></>;\n }\n const itemCtx: RenderContext = {\n ...ctx,\n layout: { ...ctx.layout, mode: view === \"stack\" ? \"stacked\" : \"inline\" },\n };\n return <>{portal}<AccordionArray field={field} ctx={itemCtx} readOnly={readOnly} {...toolbarProp} /></>;\n}\n\n// ArrayViewMenu is the ⋮ view switch on an object array's summary line.\nexport function ArrayViewMenu({\n label,\n view,\n onChange,\n}: {\n /** Names the array in the trigger's accessible label. */\n label: string;\n view: ArrayView;\n onChange: (next: ArrayView) => void;\n}) {\n const title = `View options for ${label}`;\n return (\n <DropdownMenu\n icon={UiDotsVertical}\n hideChevron\n variant=\"ghost\"\n size=\"icon\"\n align=\"right\"\n title={title}\n menuLabel={title}\n items={VIEWS.map((option) => ({\n label:\n option === view ? (\n <>\n {VIEW_LABELS[option]}\n <span className=\"sr-only\"> (current view)</span>\n </>\n ) : (\n VIEW_LABELS[option]\n ),\n onSelect: () => onChange(option),\n ...(option === view ? { icon: UiCheck } : {}),\n }))}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;AAUA,IAAM,cAAyC;CAC7C,MAAM;CACN,OAAO;CACP,QAAQ;AACV;AAEA,IAAM,QAAqB;CAAC;CAAQ;CAAS;AAAQ;AAQrD,SAAgB,gBAAgB,EAC9B,OACA,KACA,YAKC;CACD,MAAM,CAAC,MAAM,YAAA,GAAWA,MAAAA,SAAAA,OAA0BC,oCAAAA,iBAAiB,OAAOC,oCAAAA,iBAAiB,OAAO,GAAG,CAAC,CAAC;CAEvG,MAAM,aAAaC,yCAAAA,sBAAsB,IAAI,gBAAgB,EAAE;CAC/D,MAAM,OAAO,IAAI,eAAe,KAAA,IAC9B,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD;EAAe,OAAO,MAAM,SAAS,MAAM;EAAW;EAAM,UAAU;CAAU,CAAA;CAGlF,MAAM,UAAU,QAAQ,aAAa,OAAO;CAC5C,MAAM,SAAS,QAAQ,cAAA,GAAaC,UAAAA,aAAAA,CAAa,MAAM,UAAU,IAAI;CACrE,MAAM,cAAc,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ;CAC3D,IAAI,SAAS,QACX,OAAO,iBAAA,GAAA,kBAAA,KAAA,CAAAC,kBAAAA,UAAA,EAAA,UAAA,CAAG,QAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,qCAAAA,YAAD;EAAmB;EAAY;EAAe;EAAU,GAAI;CAAc,CAAA,CAAG,EAAA,CAAA;CAEhG,MAAM,UAAyB;EAC7B,GAAG;EACH,QAAQ;GAAE,GAAG,IAAI;GAAQ,MAAM,SAAS,UAAU,YAAY;EAAS;CACzE;CACA,OAAO,iBAAA,GAAA,kBAAA,KAAA,CAAAD,kBAAAA,UAAA,EAAA,UAAA,CAAG,QAAO,iBAAA,GAAA,kBAAA,IAAA,CAACE,yCAAAA,gBAAD;EAAuB;EAAO,KAAK;EAAmB;EAAU,GAAI;CAAc,CAAA,CAAG,EAAA,CAAA;AACxG;AAGA,SAAgB,cAAc,EAC5B,OACA,MACA,YAMC;CACD,MAAM,QAAQ,oBAAoB;CAClC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,cAAD;EACE,MAAMC,uBAAAA;EACN,aAAA;EACA,SAAQ;EACR,MAAK;EACL,OAAM;EACC;EACP,WAAW;EACX,OAAO,MAAM,KAAK,YAAY;GAC5B,OACE,WAAW,OACT,iBAAA,GAAA,kBAAA,KAAA,CAAAJ,kBAAAA,UAAA,EAAA,UAAA,CACG,YAAY,SACb,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAU;IAAU,UAAA;GAAqB,CAAA,CAC/C,EAAA,CAAA,IAEF,YAAY;GAEhB,gBAAgB,SAAS,MAAM;GAC/B,GAAI,WAAW,OAAO,EAAE,MAAMK,gBAAAA,QAAQ,IAAI,CAAC;EAC7C,EAAE;CACH,CAAA;AAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-object-array-view.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-object-array-view.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-schema-form-object-array-view.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-object-array-view.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAEnG,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAgB5E,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,GAAG,EACH,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,GAAG,EAAE,aAAa,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB,+BAmBA;AAGD,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACrC,+BA0BA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useSectionActionsSlot } from "./json-schema-form-section-actions.js";
|
|
1
2
|
import { UiCheck } from "../icons/components/UiCheck.js";
|
|
2
3
|
import { UiDotsVertical } from "../icons/components/UiDotsVertical.js";
|
|
3
4
|
import { DropdownMenu } from "../overlay/DropdownMenu.js";
|
|
@@ -6,6 +7,7 @@ import { arrayViewOptions, defaultArrayView } from "./json-schema-form-array-vie
|
|
|
6
7
|
import { TableArray } from "./json-schema-form-table-array.js";
|
|
7
8
|
import { useState } from "react";
|
|
8
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { createPortal } from "react-dom";
|
|
9
11
|
// src/components/json-schema-form-object-array-view.tsx
|
|
10
12
|
var VIEW_LABELS = {
|
|
11
13
|
grid: "Grid",
|
|
@@ -19,17 +21,21 @@ var VIEWS = [
|
|
|
19
21
|
];
|
|
20
22
|
function ObjectArrayView({ field, ctx, readOnly }) {
|
|
21
23
|
const [view, setView] = useState(() => defaultArrayView(field, arrayViewOptions(field, ctx)));
|
|
22
|
-
const
|
|
24
|
+
const headerSlot = useSectionActionsSlot(ctx.instancePath ?? "");
|
|
25
|
+
const menu = ctx.presentation ? void 0 : /* @__PURE__ */ jsx(ArrayViewMenu, {
|
|
23
26
|
label: field.label || field.key,
|
|
24
27
|
view,
|
|
25
28
|
onChange: setView
|
|
26
29
|
});
|
|
27
|
-
|
|
30
|
+
const toolbar = menu && headerSlot ? null : menu;
|
|
31
|
+
const portal = menu && headerSlot ? createPortal(menu, headerSlot) : null;
|
|
32
|
+
const toolbarProp = toolbar === void 0 ? {} : { toolbar };
|
|
33
|
+
if (view === "grid") return /* @__PURE__ */ jsxs(Fragment$1, { children: [portal, /* @__PURE__ */ jsx(TableArray, {
|
|
28
34
|
field,
|
|
29
35
|
ctx,
|
|
30
36
|
readOnly,
|
|
31
|
-
...
|
|
32
|
-
});
|
|
37
|
+
...toolbarProp
|
|
38
|
+
})] });
|
|
33
39
|
const itemCtx = {
|
|
34
40
|
...ctx,
|
|
35
41
|
layout: {
|
|
@@ -37,12 +43,12 @@ function ObjectArrayView({ field, ctx, readOnly }) {
|
|
|
37
43
|
mode: view === "stack" ? "stacked" : "inline"
|
|
38
44
|
}
|
|
39
45
|
};
|
|
40
|
-
return /* @__PURE__ */ jsx(AccordionArray, {
|
|
46
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [portal, /* @__PURE__ */ jsx(AccordionArray, {
|
|
41
47
|
field,
|
|
42
48
|
ctx: itemCtx,
|
|
43
49
|
readOnly,
|
|
44
|
-
...
|
|
45
|
-
});
|
|
50
|
+
...toolbarProp
|
|
51
|
+
})] });
|
|
46
52
|
}
|
|
47
53
|
function ArrayViewMenu({ label, view, onChange }) {
|
|
48
54
|
const title = `View options for ${label}`;
|