@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-runtime-types.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-runtime-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACf,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AACnH,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAMlC,MAAM,WAAW,gBAAgB;IAE/B,GAAG,EAAE,MAAM,CAAC;IAGZ,MAAM,EAAE,MAAM,CAAC;IAGf,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAGhB,KAAK,CAAC,EAAE,WAAW,CAAC;IAKpB,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAID,MAAM,WAAW,eAAe;IAG9B,UAAU,EAAE,MAAM,CAAC;CACpB;AAID,MAAM,WAAW,WAAW;IAE1B,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,MAAM,CAAC;IAGb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAE/B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAMD,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE;IACjC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;AAO7B,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,KAAK,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"json-schema-form-runtime-types.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-runtime-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACf,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,E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U,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,mBAAmB,EACjB,QAAQ,GACR,OAAO,GACP,UAAU,GACV,KAAK,GACL,MAAM,GACN,YAAY,GACZ,iBAAiB,GACjB,eAAe,GACf,qBAAqB,GACrB,cAAc,CACjB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
let react = require("react");
|
|
2
|
+
// src/components/json-schema-form-section-actions.tsx
|
|
3
|
+
var SectionActionsContext = (0, react.createContext)(null);
|
|
4
|
+
/** The header-row element of the section that heads the field at `instancePath`, if there is one. */
|
|
5
|
+
function useSectionActionsSlot(instancePath) {
|
|
6
|
+
const slot = (0, react.useContext)(SectionActionsContext);
|
|
7
|
+
return slot?.owner === instancePath ? slot.element : void 0;
|
|
8
|
+
}
|
|
9
|
+
exports.SectionActionsContext = SectionActionsContext;
|
|
10
|
+
exports.useSectionActionsSlot = useSectionActionsSlot;
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=json-schema-form-section-actions.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-section-actions.cjs","names":["createContext","useContext"],"sources":["../../src/components/json-schema-form-section-actions.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\n// A section's header row offers its own field's control a place for actions\n// (an object array's ⋮ view menu), so they sit beside the section's title\n// instead of on a row of their own below it. The slot names the instance path\n// of the field the section heads: a control nested deeper in the section's\n// body sees the slot but does not own it, and keeps its actions where it is.\nexport type SectionActionsSlot = { owner: string; element: HTMLElement };\n\nexport const SectionActionsContext = createContext<SectionActionsSlot | null>(null);\n\n/** The header-row element of the section that heads the field at `instancePath`, if there is one. */\nexport function useSectionActionsSlot(instancePath: string): HTMLElement | undefined {\n const slot = useContext(SectionActionsContext);\n return slot?.owner === instancePath ? slot.element : undefined;\n}\n"],"mappings":";;AASA,IAAa,yBAAA,GAAwBA,MAAAA,cAAAA,CAAyC,IAAI;;AAGlF,SAAgB,sBAAsB,cAA+C;CACnF,MAAM,QAAA,GAAOC,MAAAA,WAAAA,CAAW,qBAAqB;CAC7C,OAAO,MAAM,UAAU,eAAe,KAAK,UAAU,KAAA;AACvD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type SectionActionsSlot = {
|
|
2
|
+
owner: string;
|
|
3
|
+
element: HTMLElement;
|
|
4
|
+
};
|
|
5
|
+
export declare const SectionActionsContext: import('react').Context<SectionActionsSlot | null>;
|
|
6
|
+
/** The header-row element of the section that heads the field at `instancePath`, if there is one. */
|
|
7
|
+
export declare function useSectionActionsSlot(instancePath: string): HTMLElement | undefined;
|
|
8
|
+
//# sourceMappingURL=json-schema-form-section-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-section-actions.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-section-actions.tsx"],"names":[],"mappings":"AAOA,MAAM,MAAM,kBAAkB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC;AAEzE,eAAO,MAAM,qBAAqB,oDAAiD,CAAC;AAEpF,qGAAqG;AACrG,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAGnF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
// src/components/json-schema-form-section-actions.tsx
|
|
3
|
+
var SectionActionsContext = createContext(null);
|
|
4
|
+
/** The header-row element of the section that heads the field at `instancePath`, if there is one. */
|
|
5
|
+
function useSectionActionsSlot(instancePath) {
|
|
6
|
+
const slot = useContext(SectionActionsContext);
|
|
7
|
+
return slot?.owner === instancePath ? slot.element : void 0;
|
|
8
|
+
}
|
|
9
|
+
export { SectionActionsContext, useSectionActionsSlot };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=json-schema-form-section-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-section-actions.js","names":[],"sources":["../../src/components/json-schema-form-section-actions.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\n// A section's header row offers its own field's control a place for actions\n// (an object array's ⋮ view menu), so they sit beside the section's title\n// instead of on a row of their own below it. The slot names the instance path\n// of the field the section heads: a control nested deeper in the section's\n// body sees the slot but does not own it, and keeps its actions where it is.\nexport type SectionActionsSlot = { owner: string; element: HTMLElement };\n\nexport const SectionActionsContext = createContext<SectionActionsSlot | null>(null);\n\n/** The header-row element of the section that heads the field at `instancePath`, if there is one. */\nexport function useSectionActionsSlot(instancePath: string): HTMLElement | undefined {\n const slot = useContext(SectionActionsContext);\n return slot?.owner === instancePath ? slot.element : undefined;\n}\n"],"mappings":";;AASA,IAAa,wBAAwB,cAAyC,IAAI;;AAGlF,SAAgB,sBAAsB,cAA+C;CACnF,MAAM,OAAO,WAAW,qBAAqB;CAC7C,OAAO,MAAM,UAAU,eAAe,KAAK,UAAU,KAAA;AACvD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const require_json_schema_form_sibling_select = require("./json-schema-form-sibling-select.cjs");
|
|
2
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
3
|
+
// src/components/json-schema-form-sibling-prefix.tsx
|
|
4
|
+
function siblingPrefixPre({ key, from }) {
|
|
5
|
+
return (field, { parent }) => {
|
|
6
|
+
if (field.key !== key && field.key !== from) return field;
|
|
7
|
+
const properties = parent?.schema.properties;
|
|
8
|
+
if (!parent || !properties?.[key] || !properties[from]) return field;
|
|
9
|
+
if (field.key === from) return null;
|
|
10
|
+
return {
|
|
11
|
+
...field,
|
|
12
|
+
prefix: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_json_schema_form_sibling_select.SiblingSelect, {
|
|
13
|
+
field,
|
|
14
|
+
parent,
|
|
15
|
+
from,
|
|
16
|
+
prop: properties[from]
|
|
17
|
+
})
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
exports.siblingPrefixPre = siblingPrefixPre;
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=json-schema-form-sibling-prefix.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-sibling-prefix.cjs","names":["SiblingSelect"],"sources":["../../src/components/json-schema-form-sibling-prefix.tsx"],"sourcesContent":["import type { PreExtension } from \"./json-schema-form-runtime-types\";\nimport { SiblingSelect } from \"./json-schema-form-sibling-select\";\n\nexport interface SiblingPrefixOptions {\n /** The field whose input carries the dropdown. */\n key: string;\n /** The enum sibling the dropdown edits; its own row is dropped. */\n from: string;\n}\n\n// siblingPrefixPre builds a `pre` extension that draws an enum sibling (`from`)\n// as a dropdown at the start of another field's input (`key`), for a value that\n// only reads with that field (a route beside the system it reaches). It acts only\n// on objects holding both properties.\nexport function siblingPrefixPre({ key, from }: SiblingPrefixOptions): PreExtension {\n return (field, { parent }) => {\n if (field.key !== key && field.key !== from) return field;\n const properties = parent?.schema.properties;\n if (!parent || !properties?.[key] || !properties[from]) return field;\n if (field.key === from) return null;\n return { ...field, prefix: <SiblingSelect field={field} parent={parent} from={from} prop={properties[from]} /> };\n };\n}\n"],"mappings":";;;AAcA,SAAgB,iBAAiB,EAAE,KAAK,QAA4C;CAClF,QAAQ,OAAO,EAAE,aAAa;EAC5B,IAAI,MAAM,QAAQ,OAAO,MAAM,QAAQ,MAAM,OAAO;EACpD,MAAM,aAAa,QAAQ,OAAO;EAClC,IAAI,CAAC,UAAU,CAAC,aAAa,QAAQ,CAAC,WAAW,OAAO,OAAO;EAC/D,IAAI,MAAM,QAAQ,MAAM,OAAO;EAC/B,OAAO;GAAE,GAAG;GAAO,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAACA,wCAAAA,eAAD;IAAsB;IAAe;IAAc;IAAM,MAAM,WAAW;GAAQ,CAAA;EAAE;CACjH;AACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PreExtension } from './json-schema-form-runtime-types.js';
|
|
2
|
+
export interface SiblingPrefixOptions {
|
|
3
|
+
/** The field whose input carries the dropdown. */
|
|
4
|
+
key: string;
|
|
5
|
+
/** The enum sibling the dropdown edits; its own row is dropped. */
|
|
6
|
+
from: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function siblingPrefixPre({ key, from }: SiblingPrefixOptions): PreExtension;
|
|
9
|
+
//# sourceMappingURL=json-schema-form-sibling-prefix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-sibling-prefix.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-sibling-prefix.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGrE,MAAM,WAAW,oBAAoB;IACnC,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;CACd;AAMD,wBAAgB,gBAAgB,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,oBAAoB,GAAG,YAAY,CAQlF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SiblingSelect } from "./json-schema-form-sibling-select.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/json-schema-form-sibling-prefix.tsx
|
|
4
|
+
function siblingPrefixPre({ key, from }) {
|
|
5
|
+
return (field, { parent }) => {
|
|
6
|
+
if (field.key !== key && field.key !== from) return field;
|
|
7
|
+
const properties = parent?.schema.properties;
|
|
8
|
+
if (!parent || !properties?.[key] || !properties[from]) return field;
|
|
9
|
+
if (field.key === from) return null;
|
|
10
|
+
return {
|
|
11
|
+
...field,
|
|
12
|
+
prefix: /* @__PURE__ */ jsx(SiblingSelect, {
|
|
13
|
+
field,
|
|
14
|
+
parent,
|
|
15
|
+
from,
|
|
16
|
+
prop: properties[from]
|
|
17
|
+
})
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export { siblingPrefixPre };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=json-schema-form-sibling-prefix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-sibling-prefix.js","names":[],"sources":["../../src/components/json-schema-form-sibling-prefix.tsx"],"sourcesContent":["import type { PreExtension } from \"./json-schema-form-runtime-types\";\nimport { SiblingSelect } from \"./json-schema-form-sibling-select\";\n\nexport interface SiblingPrefixOptions {\n /** The field whose input carries the dropdown. */\n key: string;\n /** The enum sibling the dropdown edits; its own row is dropped. */\n from: string;\n}\n\n// siblingPrefixPre builds a `pre` extension that draws an enum sibling (`from`)\n// as a dropdown at the start of another field's input (`key`), for a value that\n// only reads with that field (a route beside the system it reaches). It acts only\n// on objects holding both properties.\nexport function siblingPrefixPre({ key, from }: SiblingPrefixOptions): PreExtension {\n return (field, { parent }) => {\n if (field.key !== key && field.key !== from) return field;\n const properties = parent?.schema.properties;\n if (!parent || !properties?.[key] || !properties[from]) return field;\n if (field.key === from) return null;\n return { ...field, prefix: <SiblingSelect field={field} parent={parent} from={from} prop={properties[from]} /> };\n };\n}\n"],"mappings":";;;AAcA,SAAgB,iBAAiB,EAAE,KAAK,QAA4C;CAClF,QAAQ,OAAO,EAAE,aAAa;EAC5B,IAAI,MAAM,QAAQ,OAAO,MAAM,QAAQ,MAAM,OAAO;EACpD,MAAM,aAAa,QAAQ,OAAO;EAClC,IAAI,CAAC,UAAU,CAAC,aAAa,QAAQ,CAAC,WAAW,OAAO,OAAO;EAC/D,IAAI,MAAM,QAAQ,MAAM,OAAO;EAC/B,OAAO;GAAE,GAAG;GAAO,QAAQ,oBAAC,eAAD;IAAsB;IAAe;IAAc;IAAM,MAAM,WAAW;GAAQ,CAAA;EAAE;CACjH;AACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const require_json_schema_form_resolve = require("./json-schema-form-resolve.cjs");
|
|
2
|
+
const require_select = require("./select.cjs");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
// src/components/json-schema-form-sibling-select.tsx
|
|
5
|
+
function SiblingSelect({ field, parent, from, prop }) {
|
|
6
|
+
const value = parent.value[from];
|
|
7
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_select.Select, {
|
|
8
|
+
"aria-label": prop.title || from,
|
|
9
|
+
value: value === void 0 ? "" : String(value),
|
|
10
|
+
disabled: field.readOnly === true,
|
|
11
|
+
options: require_json_schema_form_resolve.enumOptions(prop).map((option) => ({
|
|
12
|
+
value: option.value,
|
|
13
|
+
label: option.name ?? option.value
|
|
14
|
+
})),
|
|
15
|
+
...value === void 0 ? { placeholder: "" } : {},
|
|
16
|
+
onChange: (event) => parent.onChange({
|
|
17
|
+
...parent.value,
|
|
18
|
+
[from]: event.target.value
|
|
19
|
+
}),
|
|
20
|
+
className: "h-6 w-auto rounded-none border-0 border-r border-border bg-transparent pl-0 pr-6 text-xs font-medium focus-visible:ring-0 focus-visible:ring-offset-0"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.SiblingSelect = SiblingSelect;
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=json-schema-form-sibling-select.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-sibling-select.cjs","names":["Select","enumOptions"],"sources":["../../src/components/json-schema-form-sibling-select.tsx"],"sourcesContent":["import type { FieldControl, JsonSchemaProperty } from \"./json-schema-form-types\";\nimport type { FieldParent } from \"./json-schema-form-runtime-types\";\nimport { enumOptions } from \"./json-schema-form-resolve\";\nimport { Select } from \"./select\";\n\n// SiblingSelect is the in-input dropdown siblingPrefixPre draws: the options of\n// the enum sibling `from`, by their x-enum-labels, writing the chosen one back\n// into the parent object.\nexport function SiblingSelect({ field, parent, from, prop }: { field: FieldControl; parent: FieldParent; from: string; prop: JsonSchemaProperty }) {\n const value = parent.value[from];\n return (\n <Select\n aria-label={prop.title || from}\n value={value === undefined ? \"\" : String(value)}\n disabled={field.readOnly === true}\n options={enumOptions(prop).map((option) => ({ value: option.value, label: option.name ?? option.value }))}\n {...(value === undefined ? { placeholder: \"\" } : {})}\n onChange={(event) => parent.onChange({ ...parent.value, [from]: event.target.value })}\n className=\"h-6 w-auto rounded-none border-0 border-r border-border bg-transparent pl-0 pr-6 text-xs font-medium focus-visible:ring-0 focus-visible:ring-offset-0\"\n />\n );\n}\n"],"mappings":";;;;AAQA,SAAgB,cAAc,EAAE,OAAO,QAAQ,MAAM,QAA8F;CACjJ,MAAM,QAAQ,OAAO,MAAM;CAC3B,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,eAAAA,QAAD;EACE,cAAY,KAAK,SAAS;EAC1B,OAAO,UAAU,KAAA,IAAY,KAAK,OAAO,KAAK;EAC9C,UAAU,MAAM,aAAa;EAC7B,SAASC,iCAAAA,YAAY,IAAI,CAAC,CAAC,KAAK,YAAY;GAAE,OAAO,OAAO;GAAO,OAAO,OAAO,QAAQ,OAAO;EAAM,EAAE;EACxG,GAAK,UAAU,KAAA,IAAY,EAAE,aAAa,GAAG,IAAI,CAAC;EAClD,WAAW,UAAU,OAAO,SAAS;GAAE,GAAG,OAAO;IAAQ,OAAO,MAAM,OAAO;EAAM,CAAC;EACpF,WAAU;CACX,CAAA;AAEL"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FieldControl, JsonSchemaProperty } from './json-schema-form-types.js';
|
|
2
|
+
import { FieldParent } from './json-schema-form-runtime-types.js';
|
|
3
|
+
export declare function SiblingSelect({ field, parent, from, prop }: {
|
|
4
|
+
field: FieldControl;
|
|
5
|
+
parent: FieldParent;
|
|
6
|
+
from: string;
|
|
7
|
+
prop: JsonSchemaProperty;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=json-schema-form-sibling-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-sibling-select.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-sibling-select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAOpE,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,kBAAkB,CAAA;CAAE,+BAahJ"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { enumOptions } from "./json-schema-form-resolve.js";
|
|
2
|
+
import { Select } from "./select.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/json-schema-form-sibling-select.tsx
|
|
5
|
+
function SiblingSelect({ field, parent, from, prop }) {
|
|
6
|
+
const value = parent.value[from];
|
|
7
|
+
return /* @__PURE__ */ jsx(Select, {
|
|
8
|
+
"aria-label": prop.title || from,
|
|
9
|
+
value: value === void 0 ? "" : String(value),
|
|
10
|
+
disabled: field.readOnly === true,
|
|
11
|
+
options: enumOptions(prop).map((option) => ({
|
|
12
|
+
value: option.value,
|
|
13
|
+
label: option.name ?? option.value
|
|
14
|
+
})),
|
|
15
|
+
...value === void 0 ? { placeholder: "" } : {},
|
|
16
|
+
onChange: (event) => parent.onChange({
|
|
17
|
+
...parent.value,
|
|
18
|
+
[from]: event.target.value
|
|
19
|
+
}),
|
|
20
|
+
className: "h-6 w-auto rounded-none border-0 border-r border-border bg-transparent pl-0 pr-6 text-xs font-medium focus-visible:ring-0 focus-visible:ring-offset-0"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export { SiblingSelect };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=json-schema-form-sibling-select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-form-sibling-select.js","names":[],"sources":["../../src/components/json-schema-form-sibling-select.tsx"],"sourcesContent":["import type { FieldControl, JsonSchemaProperty } from \"./json-schema-form-types\";\nimport type { FieldParent } from \"./json-schema-form-runtime-types\";\nimport { enumOptions } from \"./json-schema-form-resolve\";\nimport { Select } from \"./select\";\n\n// SiblingSelect is the in-input dropdown siblingPrefixPre draws: the options of\n// the enum sibling `from`, by their x-enum-labels, writing the chosen one back\n// into the parent object.\nexport function SiblingSelect({ field, parent, from, prop }: { field: FieldControl; parent: FieldParent; from: string; prop: JsonSchemaProperty }) {\n const value = parent.value[from];\n return (\n <Select\n aria-label={prop.title || from}\n value={value === undefined ? \"\" : String(value)}\n disabled={field.readOnly === true}\n options={enumOptions(prop).map((option) => ({ value: option.value, label: option.name ?? option.value }))}\n {...(value === undefined ? { placeholder: \"\" } : {})}\n onChange={(event) => parent.onChange({ ...parent.value, [from]: event.target.value })}\n className=\"h-6 w-auto rounded-none border-0 border-r border-border bg-transparent pl-0 pr-6 text-xs font-medium focus-visible:ring-0 focus-visible:ring-offset-0\"\n />\n );\n}\n"],"mappings":";;;;AAQA,SAAgB,cAAc,EAAE,OAAO,QAAQ,MAAM,QAA8F;CACjJ,MAAM,QAAQ,OAAO,MAAM;CAC3B,OACE,oBAAC,QAAD;EACE,cAAY,KAAK,SAAS;EAC1B,OAAO,UAAU,KAAA,IAAY,KAAK,OAAO,KAAK;EAC9C,UAAU,MAAM,aAAa;EAC7B,SAAS,YAAY,IAAI,CAAC,CAAC,KAAK,YAAY;GAAE,OAAO,OAAO;GAAO,OAAO,OAAO,QAAQ,OAAO;EAAM,EAAE;EACxG,GAAK,UAAU,KAAA,IAAY,EAAE,aAAa,GAAG,IAAI,CAAC;EAClD,WAAW,UAAU,OAAO,SAAS;GAAE,GAAG,OAAO;IAAQ,OAAO,MAAM,OAAO;EAAM,CAAC;EACpF,WAAU;CACX,CAAA;AAEL"}
|
|
@@ -133,7 +133,8 @@ function TableArray({ field, ctx, readOnly, toolbar }) {
|
|
|
133
133
|
})]
|
|
134
134
|
});
|
|
135
135
|
if (toolbar === void 0) return table;
|
|
136
|
-
const
|
|
136
|
+
const countLine = require_json_schema_form_item_summary.itemCountLine(field.itemSpec ?? require_json_schema_form_item_summary.resolveItemSpec(field.schema, itemSchema), items.length);
|
|
137
|
+
if (toolbar === null && countLine === void 0) return table;
|
|
137
138
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
138
139
|
className: "flex flex-col gap-2",
|
|
139
140
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -141,8 +142,8 @@ function TableArray({ field, ctx, readOnly, toolbar }) {
|
|
|
141
142
|
className: "flex items-center justify-between gap-2",
|
|
142
143
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
143
144
|
className: require_utils.cn("text-muted-foreground", require_json_schema_form_size.labelSizeClass[ctx.size]),
|
|
144
|
-
children:
|
|
145
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
145
|
+
children: countLine
|
|
146
|
+
}), toolbar != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
146
147
|
className: "flex shrink-0 items-center",
|
|
147
148
|
children: toolbar
|
|
148
149
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-table-array.cjs","names":["tableColumnOptions","tableLayout","canRemoveItem","isPlainObject","setIndex","applyChangeEffects","appendInstancePath","cn","controlMinHeightClass","resolveControl","applyPostExtensions","controlHeightClass","removeIndex","Icon","UiTrash","canAddItem","Button","inputSizeClass","seedFromSchema","UiAdd","resolveItemSpec","labelSizeClass","itemCountLine","schemaHelper","HoverCard"],"sources":["../../src/components/json-schema-form-table-array.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport { isPlainObject, removeIndex, setIndex } from \"../lib/collections\";\nimport { cn } from \"../lib/utils\";\nimport { Icon } from \"../data/Icon\";\nimport { UiAdd, UiTrash } from \"../icons\";\nimport { HoverCard } from \"../overlay/HoverCard\";\nimport { Button } from \"./button\";\nimport {\n controlHeightClass,\n controlMinHeightClass,\n inputSizeClass,\n} from \"./json-schema-form-size\";\nimport { resolveControl, schemaHelper } from \"./json-schema-form-resolve\";\nimport { applyPostExtensions } from \"./json-schema-form-extensions\";\nimport { appendInstancePath } from \"./json-schema-form-errors\";\nimport { applyChangeEffects } from \"./json-schema-form-listeners\";\nimport { tableColumnOptions, tableLayout } from \"./json-schema-form-array-view\";\nimport { itemCountLine, resolveItemSpec } from \"./json-schema-form-item-summary\";\nimport { labelSizeClass } from \"./json-schema-form-size\";\nimport {\n canAddItem,\n canRemoveItem,\n seedFromSchema,\n} from \"./json-schema-form-utils\";\nimport type {\n FieldControl,\n JsonSchemaObject,\n JsonSchemaProperty,\n RenderContext,\n} from \"./json-schema-form-types\";\n\n// TableArray renders an object-item array as a table: a header row of the item's\n// property names and one row per item with value-only controls, plus per-row\n// remove and an add button. The grid view of an object array; see ObjectArrayView.\nexport function TableArray({\n field,\n ctx,\n readOnly,\n toolbar,\n}: {\n field: FieldControl;\n ctx: RenderContext;\n readOnly: boolean;\n /** List-level actions, right-aligned on a slim line above the table beside the row count. */\n toolbar?: ReactNode;\n}) {\n const items = Array.isArray(field.value) ? field.value : [];\n const itemSchema = field.itemSchema ?? { type: \"object\" };\n // A table read-only as a whole — a view (the form's `readOnly` prop or a\n // readOnly ancestor; see RenderContext.viewOnly) or the array's own\n // `readOnly` — renders every cell as its value, exactly as a column the\n // schema (or a listener patch) marks readOnly does: a readOnly field is value\n // text wherever it sits, and in a table the grid itself is the structure a\n // disabled control would otherwise keep visible. `x-disabled`, which only\n // reaches ctx.readOnly, keeps real controls, disabled.\n const options = tableColumnOptions(field, ctx);\n const valueCells = options.valueCells;\n // Columns are the union across rows of each row's effective item properties\n // under its own listener state — `allOf` members included, so a listener\n // path that patches one cell (appended as an allOf member) reaches it —\n // minus the cells no row would render: `x-hidden`, a readOnly cell under\n // hideReadOnlyFields, and a writeOnly cell in a read-only view. A cell its\n // own row hides renders as an empty placeholder in a column another row\n // shows. The item schema's explicit `x-order` is the authority for the keys\n // it names: per-property `x-clicky-order` sorts first, then `x-order` pulls\n // its listed columns to the front in its own sequence.\n const { columns, rows } = tableLayout(itemSchema, items, options);\n // hideReadOnlyFields already dropped the declared-readOnly columns; the\n // cells a read-only table marks readOnly itself must still render.\n const childCtx: RenderContext = {\n ...ctx,\n readOnly,\n depth: ctx.depth + 1,\n ...(valueCells ? { hideReadOnlyFields: false } : {}),\n };\n // The trash column disappears with the buttons that would have filled it, so\n // an array of a fixed length reads as a table rather than one with a blank\n // gutter down the side.\n const removable = !readOnly && canRemoveItem(field, items.length);\n\n // A cell renders its OWN row's property, so a listener's readOnly, enable or\n // patch reaches that row alone, and commits through the row's value\n // listeners exactly as an item of the list views does.\n function cell(item: unknown, rowIndex: number, col: string): ReactNode {\n const obj = isPlainObject(item) ? item : {};\n const prop = rows[rowIndex]?.[col];\n const nodes = prop\n ? ctx.render.renderFieldNodes(\n {\n key: `${field.key}[${rowIndex}].${col}`,\n prop: valueCells ? { ...prop, readOnly: true } : prop,\n required: false,\n value: obj[col],\n onChange: (next) =>\n field.onChange(\n setIndex(\n items,\n rowIndex,\n applyChangeEffects(itemSchema as JsonSchemaObject, {\n root: options.rootValue ?? obj,\n ...(options.evaluate ? { evaluate: options.evaluate } : {}),\n value: obj,\n key: col,\n next,\n }),\n ),\n ),\n instancePath: appendInstancePath(\n appendInstancePath(ctx.instancePath, rowIndex),\n col,\n ),\n },\n childCtx,\n )\n : null;\n if (!nodes) return <span data-jsf-cell-placeholder aria-hidden=\"true\" className={cn(\"block\", controlMinHeightClass[ctx.size])} />;\n return ctx.presentation ? (\n <div\n className={cn(\n \"flex min-w-0 items-center [overflow-wrap:anywhere] [&_span[data-jsf-readonly]]:h-auto [&_span[data-jsf-readonly]]:min-w-0\",\n controlMinHeightClass[ctx.size],\n )}\n >\n {nodes.value}\n </div>\n ) : (\n nodes.value\n );\n }\n\n // A column header is its column's label, so post extensions decorate it as\n // they decorate every field label, on the column's field (keyed by the\n // property name, after the pre-extensions). Only the returned label is used:\n // a header holds no value, and value adornments belong in the cells. A\n // column names no single value, so the context carries no instancePath.\n function columnHeader(col: string, prop: JsonSchemaProperty, header: ReactNode): ReactNode {\n const roots = {\n ...(ctx.rootValue ? { rootValue: ctx.rootValue } : {}),\n ...(ctx.onRootChange ? { onRootChange: ctx.onRootChange } : {}),\n };\n let column: FieldControl | null = resolveControl({ key: col, prop, required: false, value: undefined, onChange: () => {} });\n for (const ext of ctx.pre) {\n if (!column) break;\n column = ext(column, { key: col, prop, value: undefined, ...roots });\n }\n if (!column) return header;\n return applyPostExtensions(column, { label: header, value: null }, ctx.post, roots).label;\n }\n\n const table = (\n <div\n className={cn(\n \"overflow-x-auto\",\n !ctx.presentation && \"rounded-md border border-input\",\n )}\n >\n <table className=\"w-full text-sm\">\n <thead>\n <tr\n className={cn(\n \"border-b bg-muted/40 text-left\",\n ctx.presentation ? \"border-border\" : \"border-input\",\n )}\n >\n {columns.map(([col, prop]) => (\n <th\n key={col}\n className=\"px-2 py-1 text-xs font-medium text-muted-foreground [overflow-wrap:anywhere]\"\n >\n {columnHeader(\n col,\n prop,\n ctx.presentation ? prop.title || col : <TableColumnHeader name={col} schema={prop} />,\n )}\n </th>\n ))}\n {removable && <th className=\"w-10 px-2 py-1\" />}\n </tr>\n </thead>\n <tbody>\n {items.map((item, i) => (\n <tr\n key={i}\n className={cn(\n \"border-b last:border-b-0 align-top\",\n ctx.presentation ? \"border-border\" : \"border-input\",\n )}\n >\n {columns.map(([col]) => (\n <td key={col} className={cn(\"px-2 py-1\", !ctx.presentation && !readOnly && \"min-w-40\")}>\n {cell(item, i, col)}\n </td>\n ))}\n {removable && (\n <td className=\"px-2 py-1\">\n <button\n type=\"button\"\n aria-label={`Remove item ${i + 1}`}\n className={cn(\n \"inline-flex aspect-square items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground\",\n controlHeightClass[ctx.size],\n )}\n onClick={() => field.onChange(removeIndex(items, i))}\n >\n <Icon icon={UiTrash} className=\"text-sm\" />\n </button>\n </td>\n )}\n </tr>\n ))}\n </tbody>\n </table>\n {!readOnly && canAddItem(field, items.length) && (\n <div className=\"p-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n className={cn(\"gap-1.5\", inputSizeClass[ctx.size])}\n onClick={() =>\n field.onChange([...items, seedFromSchema(itemSchema)])\n }\n >\n <Icon icon={UiAdd} className=\"text-sm\" />\n Add item\n </Button>\n </div>\n )}\n </div>\n );\n if (toolbar === undefined) return table;\n // The same summary line the item list shows, so switching views keeps the\n // count and the toolbar where they were.\n const spec = field.itemSpec ?? resolveItemSpec(field.schema, itemSchema);\n return (\n <div className=\"flex flex-col gap-2\">\n <div data-jsf-array-summary className=\"flex items-center justify-between gap-2\">\n <p className={cn(\"text-muted-foreground\", labelSizeClass[ctx.size])}>\n {itemCountLine(spec, items.length)}\n </p>\n <div className=\"flex shrink-0 items-center\">{toolbar}</div>\n </div>\n {table}\n </div>\n );\n}\n\nfunction TableColumnHeader({\n name,\n schema,\n}: {\n name: string;\n schema: JsonSchemaProperty;\n}) {\n const label =\n typeof schema.title === \"string\" && schema.title ? schema.title : name;\n const helper = schemaHelper(schema);\n if (!helper) return label;\n\n return (\n <HoverCard\n placement=\"bottom\"\n trigger={\n <button\n type=\"button\"\n aria-label={`${label} help`}\n className=\"cursor-help border-b border-dotted border-current text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {label}\n </button>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ACE,WAAU;EACV,SACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;GACE,MAAK;GACL,cAAY,GAAG,MAAM;GACrB,WAAU;GAET,UAAA;EACK,CAAA;EAEV,eAAc;EAEb,UAAA;CACQ,CAAA;AAEf"}
|
|
1
|
+
{"version":3,"file":"json-schema-form-table-array.cjs","names":["tableColumnOptions","tableLayout","canRemoveItem","isPlainObject","setIndex","applyChangeEffects","appendInstancePath","cn","controlMinHeightClass","resolveControl","applyPostExtensions","controlHeightClass","removeIndex","Icon","UiTrash","canAddItem","Button","inputSizeClass","seedFromSchema","UiAdd","itemCountLine","resolveItemSpec","labelSizeClass","schemaHelper","HoverCard"],"sources":["../../src/components/json-schema-form-table-array.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport { isPlainObject, removeIndex, setIndex } from \"../lib/collections\";\nimport { cn } from \"../lib/utils\";\nimport { Icon } from \"../data/Icon\";\nimport { UiAdd, UiTrash } from \"../icons\";\nimport { HoverCard } from \"../overlay/HoverCard\";\nimport { Button } from \"./button\";\nimport {\n controlHeightClass,\n controlMinHeightClass,\n inputSizeClass,\n} from \"./json-schema-form-size\";\nimport { resolveControl, schemaHelper } from \"./json-schema-form-resolve\";\nimport { applyPostExtensions } from \"./json-schema-form-extensions\";\nimport { appendInstancePath } from \"./json-schema-form-errors\";\nimport { applyChangeEffects } from \"./json-schema-form-listeners\";\nimport { tableColumnOptions, tableLayout } from \"./json-schema-form-array-view\";\nimport { itemCountLine, resolveItemSpec } from \"./json-schema-form-item-summary\";\nimport { labelSizeClass } from \"./json-schema-form-size\";\nimport {\n canAddItem,\n canRemoveItem,\n seedFromSchema,\n} from \"./json-schema-form-utils\";\nimport type {\n FieldControl,\n JsonSchemaObject,\n JsonSchemaProperty,\n RenderContext,\n} from \"./json-schema-form-types\";\n\n// TableArray renders an object-item array as a table: a header row of the item's\n// property names and one row per item with value-only controls, plus per-row\n// remove and an add button. The grid view of an object array; see ObjectArrayView.\nexport function TableArray({\n field,\n ctx,\n readOnly,\n toolbar,\n}: {\n field: FieldControl;\n ctx: RenderContext;\n readOnly: boolean;\n /** List-level actions, right-aligned on a slim line above the table beside the row count. */\n toolbar?: ReactNode;\n}) {\n const items = Array.isArray(field.value) ? field.value : [];\n const itemSchema = field.itemSchema ?? { type: \"object\" };\n // A table read-only as a whole — a view (the form's `readOnly` prop or a\n // readOnly ancestor; see RenderContext.viewOnly) or the array's own\n // `readOnly` — renders every cell as its value, exactly as a column the\n // schema (or a listener patch) marks readOnly does: a readOnly field is value\n // text wherever it sits, and in a table the grid itself is the structure a\n // disabled control would otherwise keep visible. `x-disabled`, which only\n // reaches ctx.readOnly, keeps real controls, disabled.\n const options = tableColumnOptions(field, ctx);\n const valueCells = options.valueCells;\n // Columns are the union across rows of each row's effective item properties\n // under its own listener state — `allOf` members included, so a listener\n // path that patches one cell (appended as an allOf member) reaches it —\n // minus the cells no row would render: `x-hidden`, a readOnly cell under\n // hideReadOnlyFields, and a writeOnly cell in a read-only view. A cell its\n // own row hides renders as an empty placeholder in a column another row\n // shows. The item schema's explicit `x-order` is the authority for the keys\n // it names: per-property `x-clicky-order` sorts first, then `x-order` pulls\n // its listed columns to the front in its own sequence.\n const { columns, rows } = tableLayout(itemSchema, items, options);\n // hideReadOnlyFields already dropped the declared-readOnly columns; the\n // cells a read-only table marks readOnly itself must still render.\n const childCtx: RenderContext = {\n ...ctx,\n readOnly,\n depth: ctx.depth + 1,\n ...(valueCells ? { hideReadOnlyFields: false } : {}),\n };\n // The trash column disappears with the buttons that would have filled it, so\n // an array of a fixed length reads as a table rather than one with a blank\n // gutter down the side.\n const removable = !readOnly && canRemoveItem(field, items.length);\n\n // A cell renders its OWN row's property, so a listener's readOnly, enable or\n // patch reaches that row alone, and commits through the row's value\n // listeners exactly as an item of the list views does.\n function cell(item: unknown, rowIndex: number, col: string): ReactNode {\n const obj = isPlainObject(item) ? item : {};\n const prop = rows[rowIndex]?.[col];\n const nodes = prop\n ? ctx.render.renderFieldNodes(\n {\n key: `${field.key}[${rowIndex}].${col}`,\n prop: valueCells ? { ...prop, readOnly: true } : prop,\n required: false,\n value: obj[col],\n onChange: (next) =>\n field.onChange(\n setIndex(\n items,\n rowIndex,\n applyChangeEffects(itemSchema as JsonSchemaObject, {\n root: options.rootValue ?? obj,\n ...(options.evaluate ? { evaluate: options.evaluate } : {}),\n value: obj,\n key: col,\n next,\n }),\n ),\n ),\n instancePath: appendInstancePath(\n appendInstancePath(ctx.instancePath, rowIndex),\n col,\n ),\n },\n childCtx,\n )\n : null;\n if (!nodes) return <span data-jsf-cell-placeholder aria-hidden=\"true\" className={cn(\"block\", controlMinHeightClass[ctx.size])} />;\n return ctx.presentation ? (\n <div\n className={cn(\n \"flex min-w-0 items-center [overflow-wrap:anywhere] [&_span[data-jsf-readonly]]:h-auto [&_span[data-jsf-readonly]]:min-w-0\",\n controlMinHeightClass[ctx.size],\n )}\n >\n {nodes.value}\n </div>\n ) : (\n nodes.value\n );\n }\n\n // A column header is its column's label, so post extensions decorate it as\n // they decorate every field label, on the column's field (keyed by the\n // property name, after the pre-extensions). Only the returned label is used:\n // a header holds no value, and value adornments belong in the cells. A\n // column names no single value, so the context carries no instancePath.\n function columnHeader(col: string, prop: JsonSchemaProperty, header: ReactNode): ReactNode {\n const roots = {\n ...(ctx.rootValue ? { rootValue: ctx.rootValue } : {}),\n ...(ctx.onRootChange ? { onRootChange: ctx.onRootChange } : {}),\n };\n let column: FieldControl | null = resolveControl({ key: col, prop, required: false, value: undefined, onChange: () => {} });\n for (const ext of ctx.pre) {\n if (!column) break;\n column = ext(column, { key: col, prop, value: undefined, ...roots });\n }\n if (!column) return header;\n return applyPostExtensions(column, { label: header, value: null }, ctx.post, roots).label;\n }\n\n const table = (\n <div\n className={cn(\n \"overflow-x-auto\",\n !ctx.presentation && \"rounded-md border border-input\",\n )}\n >\n <table className=\"w-full text-sm\">\n <thead>\n <tr\n className={cn(\n \"border-b bg-muted/40 text-left\",\n ctx.presentation ? \"border-border\" : \"border-input\",\n )}\n >\n {columns.map(([col, prop]) => (\n <th\n key={col}\n className=\"px-2 py-1 text-xs font-medium text-muted-foreground [overflow-wrap:anywhere]\"\n >\n {columnHeader(\n col,\n prop,\n ctx.presentation ? prop.title || col : <TableColumnHeader name={col} schema={prop} />,\n )}\n </th>\n ))}\n {removable && <th className=\"w-10 px-2 py-1\" />}\n </tr>\n </thead>\n <tbody>\n {items.map((item, i) => (\n <tr\n key={i}\n className={cn(\n \"border-b last:border-b-0 align-top\",\n ctx.presentation ? \"border-border\" : \"border-input\",\n )}\n >\n {columns.map(([col]) => (\n <td key={col} className={cn(\"px-2 py-1\", !ctx.presentation && !readOnly && \"min-w-40\")}>\n {cell(item, i, col)}\n </td>\n ))}\n {removable && (\n <td className=\"px-2 py-1\">\n <button\n type=\"button\"\n aria-label={`Remove item ${i + 1}`}\n className={cn(\n \"inline-flex aspect-square items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground\",\n controlHeightClass[ctx.size],\n )}\n onClick={() => field.onChange(removeIndex(items, i))}\n >\n <Icon icon={UiTrash} className=\"text-sm\" />\n </button>\n </td>\n )}\n </tr>\n ))}\n </tbody>\n </table>\n {!readOnly && canAddItem(field, items.length) && (\n <div className=\"p-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n className={cn(\"gap-1.5\", inputSizeClass[ctx.size])}\n onClick={() =>\n field.onChange([...items, seedFromSchema(itemSchema)])\n }\n >\n <Icon icon={UiAdd} className=\"text-sm\" />\n Add item\n </Button>\n </div>\n )}\n </div>\n );\n if (toolbar === undefined) return table;\n // The same summary line the item list shows, so switching views keeps the\n // count and the toolbar where they were. A null toolbar (the menu moved to\n // the section header) with no count line (x-item count: false) has none.\n const countLine = itemCountLine(field.itemSpec ?? resolveItemSpec(field.schema, itemSchema), items.length);\n if (toolbar === null && countLine === undefined) return table;\n return (\n <div className=\"flex flex-col gap-2\">\n <div data-jsf-array-summary className=\"flex items-center justify-between gap-2\">\n <p className={cn(\"text-muted-foreground\", labelSizeClass[ctx.size])}>{countLine}</p>\n {toolbar != null && <div className=\"flex shrink-0 items-center\">{toolbar}</div>}\n </div>\n {table}\n </div>\n );\n}\n\nfunction TableColumnHeader({\n name,\n schema,\n}: {\n name: string;\n schema: JsonSchemaProperty;\n}) {\n const label =\n typeof schema.title === \"string\" && schema.title ? schema.title : name;\n const helper = schemaHelper(schema);\n if (!helper) return label;\n\n return (\n <HoverCard\n placement=\"bottom\"\n trigger={\n <button\n type=\"button\"\n aria-label={`${label} help`}\n className=\"cursor-help border-b border-dotted border-current text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {label}\n </button>\n }\n cardClassName=\"max-w-xs whitespace-normal text-left font-normal text-foreground\"\n >\n {helper}\n </HoverCard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,SAAgB,WAAW,EACzB,OACA,KACA,UACA,WAOC;CACD,MAAM,QAAQ,MAAM,QAAQ,MAAM,KAAK,IAAI,MAAM,QAAQ,CAAC;CAC1D,MAAM,aAAa,MAAM,cAAc,EAAE,MAAM,SAAS;CAQxD,MAAM,UAAUA,oCAAAA,mBAAmB,OAAO,GAAG;CAC7C,MAAM,aAAa,QAAQ;CAU3B,MAAM,EAAE,SAAS,SAASC,oCAAAA,YAAY,YAAY,OAAO,OAAO;CAGhE,MAAM,WAA0B;EAC9B,GAAG;EACH;EACA,OAAO,IAAI,QAAQ;EACnB,GAAI,aAAa,EAAE,oBAAoB,MAAM,IAAI,CAAC;CACpD;CAIA,MAAM,YAAY,CAAC,YAAYC,+BAAAA,cAAc,OAAO,MAAM,MAAM;CAKhE,SAAS,KAAK,MAAe,UAAkB,KAAwB;EACrE,MAAM,MAAMC,oBAAAA,cAAc,IAAI,IAAI,OAAO,CAAC;EAC1C,MAAM,OAAO,KAAK,SAAS,GAAG;EAC9B,MAAM,QAAQ,OACV,IAAI,OAAO,iBACT;GACE,KAAK,GAAG,MAAM,IAAI,GAAG,SAAS,IAAI;GAClC,M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A,CAAC,KAAD;IAAG,WAAWd,cAAAA,GAAG,yBAAyBe,8BAAAA,eAAe,IAAI,KAAK;IAAI,UAAA;GAAa,CAAA,GAClF,WAAW,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,WAAU;IAA8B,UAAA;GAAa,CAAA,CAC3E;EACJ,CAAA,GAAA,KACE;;AAET;AAEA,SAAS,kBAAkB,EACzB,MACA,UAIC;CACD,MAAM,QACJ,OAAO,OAAO,UAAU,YAAY,OAAO,QAAQ,OAAO,QAAQ;CACpE,MAAM,SAASC,iCAAAA,aAAa,MAAM;CAClC,IAAI,CAAC,QAAQ,OAAO;CAEpB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,kBAAAA,WAAD;EACE,WAAU;EACV,SACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;GACE,MAAK;GACL,cAAY,GAAG,MAAM;GACrB,WAAU;GAET,UAAA;EACK,CAAA;EAEV,eAAc;EAEb,UAAA;CACQ,CAAA;AAEf"}
|
|
@@ -133,7 +133,8 @@ function TableArray({ field, ctx, readOnly, toolbar }) {
|
|
|
133
133
|
})]
|
|
134
134
|
});
|
|
135
135
|
if (toolbar === void 0) return table;
|
|
136
|
-
const
|
|
136
|
+
const countLine = itemCountLine(field.itemSpec ?? resolveItemSpec(field.schema, itemSchema), items.length);
|
|
137
|
+
if (toolbar === null && countLine === void 0) return table;
|
|
137
138
|
return /* @__PURE__ */ jsxs("div", {
|
|
138
139
|
className: "flex flex-col gap-2",
|
|
139
140
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -141,8 +142,8 @@ function TableArray({ field, ctx, readOnly, toolbar }) {
|
|
|
141
142
|
className: "flex items-center justify-between gap-2",
|
|
142
143
|
children: [/* @__PURE__ */ jsx("p", {
|
|
143
144
|
className: cn("text-muted-foreground", labelSizeClass[ctx.size]),
|
|
144
|
-
children:
|
|
145
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
145
|
+
children: countLine
|
|
146
|
+
}), toolbar != null && /* @__PURE__ */ jsx("div", {
|
|
146
147
|
className: "flex shrink-0 items-center",
|
|
147
148
|
children: toolbar
|
|
148
149
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-table-array.js","names":[],"sources":["../../src/components/json-schema-form-table-array.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport { isPlainObject, removeIndex, setIndex } from \"../lib/collections\";\nimport { cn } from \"../lib/utils\";\nimport { Icon } from \"../data/Icon\";\nimport { UiAdd, UiTrash } from \"../icons\";\nimport { HoverCard } from \"../overlay/HoverCard\";\nimport { Button } from \"./button\";\nimport {\n controlHeightClass,\n controlMinHeightClass,\n inputSizeClass,\n} from \"./json-schema-form-size\";\nimport { resolveControl, schemaHelper } from \"./json-schema-form-resolve\";\nimport { applyPostExtensions } from \"./json-schema-form-extensions\";\nimport { appendInstancePath } from \"./json-schema-form-errors\";\nimport { applyChangeEffects } from \"./json-schema-form-listeners\";\nimport { tableColumnOptions, tableLayout } from \"./json-schema-form-array-view\";\nimport { itemCountLine, resolveItemSpec } from \"./json-schema-form-item-summary\";\nimport { labelSizeClass } from \"./json-schema-form-size\";\nimport {\n canAddItem,\n canRemoveItem,\n seedFromSchema,\n} from \"./json-schema-form-utils\";\nimport type {\n FieldControl,\n JsonSchemaObject,\n JsonSchemaProperty,\n RenderContext,\n} from \"./json-schema-form-types\";\n\n// TableArray renders an object-item array as a table: a header row of the item's\n// property names and one row per item with value-only controls, plus per-row\n// remove and an add button. The grid view of an object array; see ObjectArrayView.\nexport function TableArray({\n field,\n ctx,\n readOnly,\n toolbar,\n}: {\n field: FieldControl;\n ctx: RenderContext;\n readOnly: boolean;\n /** List-level actions, right-aligned on a slim line above the table beside the row count. */\n toolbar?: ReactNode;\n}) {\n const items = Array.isArray(field.value) ? field.value : [];\n const itemSchema = field.itemSchema ?? { type: \"object\" };\n // A table read-only as a whole — a view (the form's `readOnly` prop or a\n // readOnly ancestor; see RenderContext.viewOnly) or the array's own\n // `readOnly` — renders every cell as its value, exactly as a column the\n // schema (or a listener patch) marks readOnly does: a readOnly field is value\n // text wherever it sits, and in a table the grid itself is the structure a\n // disabled control would otherwise keep visible. `x-disabled`, which only\n // reaches ctx.readOnly, keeps real controls, disabled.\n const options = tableColumnOptions(field, ctx);\n const valueCells = options.valueCells;\n // Columns are the union across rows of each row's effective item properties\n // under its own listener state — `allOf` members included, so a listener\n // path that patches one cell (appended as an allOf member) reaches it —\n // minus the cells no row would render: `x-hidden`, a readOnly cell under\n // hideReadOnlyFields, and a writeOnly cell in a read-only view. A cell its\n // own row hides renders as an empty placeholder in a column another row\n // shows. The item schema's explicit `x-order` is the authority for the keys\n // it names: per-property `x-clicky-order` sorts first, then `x-order` pulls\n // its listed columns to the front in its own sequence.\n const { columns, rows } = tableLayout(itemSchema, items, options);\n // hideReadOnlyFields already dropped the declared-readOnly columns; the\n // cells a read-only table marks readOnly itself must still render.\n const childCtx: RenderContext = {\n ...ctx,\n readOnly,\n depth: ctx.depth + 1,\n ...(valueCells ? { hideReadOnlyFields: false } : {}),\n };\n // The trash column disappears with the buttons that would have filled it, so\n // an array of a fixed length reads as a table rather than one with a blank\n // gutter down the side.\n const removable = !readOnly && canRemoveItem(field, items.length);\n\n // A cell renders its OWN row's property, so a listener's readOnly, enable or\n // patch reaches that row alone, and commits through the row's value\n // listeners exactly as an item of the list views does.\n function cell(item: unknown, rowIndex: number, col: string): ReactNode {\n const obj = isPlainObject(item) ? item : {};\n const prop = rows[rowIndex]?.[col];\n const nodes = prop\n ? ctx.render.renderFieldNodes(\n {\n key: `${field.key}[${rowIndex}].${col}`,\n prop: valueCells ? { ...prop, readOnly: true } : prop,\n required: false,\n value: obj[col],\n onChange: (next) =>\n field.onChange(\n setIndex(\n items,\n rowIndex,\n applyChangeEffects(itemSchema as JsonSchemaObject, {\n root: options.rootValue ?? obj,\n ...(options.evaluate ? { evaluate: options.evaluate } : {}),\n value: obj,\n key: col,\n next,\n }),\n ),\n ),\n instancePath: appendInstancePath(\n appendInstancePath(ctx.instancePath, rowIndex),\n col,\n ),\n },\n childCtx,\n )\n : null;\n if (!nodes) return <span data-jsf-cell-placeholder aria-hidden=\"true\" className={cn(\"block\", controlMinHeightClass[ctx.size])} />;\n return ctx.presentation ? (\n <div\n className={cn(\n \"flex min-w-0 items-center [overflow-wrap:anywhere] [&_span[data-jsf-readonly]]:h-auto [&_span[data-jsf-readonly]]:min-w-0\",\n controlMinHeightClass[ctx.size],\n )}\n >\n {nodes.value}\n </div>\n ) : (\n nodes.value\n );\n }\n\n // A column header is its column's label, so post extensions decorate it as\n // they decorate every field label, on the column's field (keyed by the\n // property name, after the pre-extensions). Only the returned label is used:\n // a header holds no value, and value adornments belong in the cells. A\n // column names no single value, so the context carries no instancePath.\n function columnHeader(col: string, prop: JsonSchemaProperty, header: ReactNode): ReactNode {\n const roots = {\n ...(ctx.rootValue ? { rootValue: ctx.rootValue } : {}),\n ...(ctx.onRootChange ? { onRootChange: ctx.onRootChange } : {}),\n };\n let column: FieldControl | null = resolveControl({ key: col, prop, required: false, value: undefined, onChange: () => {} });\n for (const ext of ctx.pre) {\n if (!column) break;\n column = ext(column, { key: col, prop, value: undefined, ...roots });\n }\n if (!column) return header;\n return applyPostExtensions(column, { label: header, value: null }, ctx.post, roots).label;\n }\n\n const table = (\n <div\n className={cn(\n \"overflow-x-auto\",\n !ctx.presentation && \"rounded-md border border-input\",\n )}\n >\n <table className=\"w-full text-sm\">\n <thead>\n <tr\n className={cn(\n \"border-b bg-muted/40 text-left\",\n ctx.presentation ? \"border-border\" : \"border-input\",\n )}\n >\n {columns.map(([col, prop]) => (\n <th\n key={col}\n className=\"px-2 py-1 text-xs font-medium text-muted-foreground [overflow-wrap:anywhere]\"\n >\n {columnHeader(\n col,\n prop,\n ctx.presentation ? prop.title || col : <TableColumnHeader name={col} schema={prop} />,\n )}\n </th>\n ))}\n {removable && <th className=\"w-10 px-2 py-1\" />}\n </tr>\n </thead>\n <tbody>\n {items.map((item, i) => (\n <tr\n key={i}\n className={cn(\n \"border-b last:border-b-0 align-top\",\n ctx.presentation ? \"border-border\" : \"border-input\",\n )}\n >\n {columns.map(([col]) => (\n <td key={col} className={cn(\"px-2 py-1\", !ctx.presentation && !readOnly && \"min-w-40\")}>\n {cell(item, i, col)}\n </td>\n ))}\n {removable && (\n <td className=\"px-2 py-1\">\n <button\n type=\"button\"\n aria-label={`Remove item ${i + 1}`}\n className={cn(\n \"inline-flex aspect-square items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground\",\n controlHeightClass[ctx.size],\n )}\n onClick={() => field.onChange(removeIndex(items, i))}\n >\n <Icon icon={UiTrash} className=\"text-sm\" />\n </button>\n </td>\n )}\n </tr>\n ))}\n </tbody>\n </table>\n {!readOnly && canAddItem(field, items.length) && (\n <div className=\"p-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n className={cn(\"gap-1.5\", inputSizeClass[ctx.size])}\n onClick={() =>\n field.onChange([...items, seedFromSchema(itemSchema)])\n }\n >\n <Icon icon={UiAdd} className=\"text-sm\" />\n Add item\n </Button>\n </div>\n )}\n </div>\n );\n if (toolbar === undefined) return table;\n // The same summary line the item list shows, so switching views keeps the\n // count and the toolbar where they were.\n const spec = field.itemSpec ?? resolveItemSpec(field.schema, itemSchema);\n return (\n <div className=\"flex flex-col gap-2\">\n <div data-jsf-array-summary className=\"flex items-center justify-between gap-2\">\n <p className={cn(\"text-muted-foreground\", labelSizeClass[ctx.size])}>\n {itemCountLine(spec, items.length)}\n </p>\n <div className=\"flex shrink-0 items-center\">{toolbar}</div>\n </div>\n {table}\n </div>\n );\n}\n\nfunction TableColumnHeader({\n name,\n schema,\n}: {\n name: string;\n schema: JsonSchemaProperty;\n}) {\n const label =\n typeof schema.title === \"string\" && schema.title ? schema.title : name;\n const helper = schemaHelper(schema);\n if (!helper) return label;\n\n return (\n <HoverCard\n placement=\"bottom\"\n trigger={\n <button\n type=\"button\"\n aria-label={`${label} help`}\n className=\"cursor-help border-b border-dotted border-current text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {label}\n </button>\n }\n cardClassName=\"max-w-xs whitespace-normal text-left font-normal text-foreground\"\n >\n {helper}\n </HoverCard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,SAAgB,WAAW,EACzB,OACA,KACA,UACA,WAOC;CACD,MAAM,QAAQ,MAAM,QAAQ,MAAM,KAAK,IAAI,MAAM,QAAQ,CAAC;CAC1D,MAAM,aAAa,MAAM,cAAc,EAAE,MAAM,SAAS;CAQxD,MAAM,UAAU,mBAAmB,OAAO,GAAG;CAC7C,MAAM,aAAa,QAAQ;CAU3B,MAAM,EAAE,SAAS,SAAS,YAAY,YAAY,OAAO,OAAO;CAGhE,MAAM,WAA0B;EAC9B,GAAG;EACH;EACA,OAAO,IAAI,QAAQ;EACnB,GAAI,aAAa,EAAE,oBAAoB,MAAM,IAAI,CAAC;CACpD;CAIA,MAAM,YAAY,CAAC,YAAY,cAAc,OAAO,MAAM,MAAM;CAKhE,SAAS,KAAK,MAAe,UAAkB,KAAwB;EACrE,MAAM,MAAM,cAAc,IAAI,IAAI,OAAO,CAAC;EAC1C,MAAM,OAAO,KAAK,SAAS,GAAG;EAC9B,MAAM,QAAQ,OACV,IAAI,OAAO,iBACT;GACE,KAAK,GAAG,MAAM,IAAI,GAAG,SAAS,IAAI;GAClC,MAAM,aAAa;IAAE,GAAG;IAAM,UAAU;GAAK,IAAI;GACjD,UAAU;GACV,OAAO,IAAI;GACX,WAAW,SACT,MAAM,SACJ,SACE,OACA,UACA,mBAAmB,YAAgC;IACjD,MAAM,QAAQ,aAAa;IAC3B,GAAI,QAAQ,WAAW,EAAE,UAAU,QAAQ,SAAS,IAAI,CAAC;IACzD,OAAO;IACP,KAAK;IACL;GACF,CAAC,CACH,CACF;GACF,cAAc,mBACZ,mBAAmB,IAAI,cAAc,QAAQ,GAC7C,GACF;EACF,GACA,QACF,IACA;EACJ,IAA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,WAAU;GAAtC,UAAA,CACE,oBAAC,KAAD;IAAG,WAAW,GAAG,yBAAyB,eAAe,IAAI,KAAK;IAC/D,UAAA,cAAc,MAAM,MAAM,MAAM;GAChC,CAAA,GACH,oBAAC,OAAD;IAAK,WAAU;IAA8B,UAAA;GAAa,CAAA,CACvD;EACJ,CAAA,GAAA,KACE;;AAET;AAEA,SAAS,kBAAkB,EACzB,MACA,UAIC;CACD,MAAM,QACJ,OAAO,OAAO,UAAU,YAAY,OAAO,QAAQ,OAAO,QAAQ;CACpE,MAAM,SAAS,aAAa,MAAM;CAClC,IAAI,CAAC,QAAQ,OAAO;CAEpB,OACE,oBAAC,WAAD;EACE,WAAU;EACV,SACE,oBAAC,UAAD;GACE,MAAK;GACL,cAAY,GAAG,MAAM;GACrB,WAAU;GAET,UAAA;EACK,CAAA;EAEV,eAAc;EAEb,UAAA;CACQ,CAAA;AAEf"}
|
|
1
|
+
{"version":3,"file":"json-schema-form-table-array.js","names":[],"sources":["../../src/components/json-schema-form-table-array.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport { isPlainObject, removeIndex, setIndex } from \"../lib/collections\";\nimport { cn } from \"../lib/utils\";\nimport { Icon } from \"../data/Icon\";\nimport { UiAdd, UiTrash } from \"../icons\";\nimport { HoverCard } from \"../overlay/HoverCard\";\nimport { Button } from \"./button\";\nimport {\n controlHeightClass,\n controlMinHeightClass,\n inputSizeClass,\n} from \"./json-schema-form-size\";\nimport { resolveControl, schemaHelper } from \"./json-schema-form-resolve\";\nimport { applyPostExtensions } from \"./json-schema-form-extensions\";\nimport { appendInstancePath } from \"./json-schema-form-errors\";\nimport { applyChangeEffects } from \"./json-schema-form-listeners\";\nimport { tableColumnOptions, tableLayout } from \"./json-schema-form-array-view\";\nimport { itemCountLine, resolveItemSpec } from \"./json-schema-form-item-summary\";\nimport { labelSizeClass } from \"./json-schema-form-size\";\nimport {\n canAddItem,\n canRemoveItem,\n seedFromSchema,\n} from \"./json-schema-form-utils\";\nimport type {\n FieldControl,\n JsonSchemaObject,\n JsonSchemaProperty,\n RenderContext,\n} from \"./json-schema-form-types\";\n\n// TableArray renders an object-item array as a table: a header row of the item's\n// property names and one row per item with value-only controls, plus per-row\n// remove and an add button. The grid view of an object array; see ObjectArrayView.\nexport function TableArray({\n field,\n ctx,\n readOnly,\n toolbar,\n}: {\n field: FieldControl;\n ctx: RenderContext;\n readOnly: boolean;\n /** List-level actions, right-aligned on a slim line above the table beside the row count. */\n toolbar?: ReactNode;\n}) {\n const items = Array.isArray(field.value) ? field.value : [];\n const itemSchema = field.itemSchema ?? { type: \"object\" };\n // A table read-only as a whole — a view (the form's `readOnly` prop or a\n // readOnly ancestor; see RenderContext.viewOnly) or the array's own\n // `readOnly` — renders every cell as its value, exactly as a column the\n // schema (or a listener patch) marks readOnly does: a readOnly field is value\n // text wherever it sits, and in a table the grid itself is the structure a\n // disabled control would otherwise keep visible. `x-disabled`, which only\n // reaches ctx.readOnly, keeps real controls, disabled.\n const options = tableColumnOptions(field, ctx);\n const valueCells = options.valueCells;\n // Columns are the union across rows of each row's effective item properties\n // under its own listener state — `allOf` members included, so a listener\n // path that patches one cell (appended as an allOf member) reaches it —\n // minus the cells no row would render: `x-hidden`, a readOnly cell under\n // hideReadOnlyFields, and a writeOnly cell in a read-only view. A cell its\n // own row hides renders as an empty placeholder in a column another row\n // shows. The item schema's explicit `x-order` is the authority for the keys\n // it names: per-property `x-clicky-order` sorts first, then `x-order` pulls\n // its listed columns to the front in its own sequence.\n const { columns, rows } = tableLayout(itemSchema, items, options);\n // hideReadOnlyFields already dropped the declared-readOnly columns; the\n // cells a read-only table marks readOnly itself must still render.\n const childCtx: RenderContext = {\n ...ctx,\n readOnly,\n depth: ctx.depth + 1,\n ...(valueCells ? { hideReadOnlyFields: false } : {}),\n };\n // The trash column disappears with the buttons that would have filled it, so\n // an array of a fixed length reads as a table rather than one with a blank\n // gutter down the side.\n const removable = !readOnly && canRemoveItem(field, items.length);\n\n // A cell renders its OWN row's property, so a listener's readOnly, enable or\n // patch reaches that row alone, and commits through the row's value\n // listeners exactly as an item of the list views does.\n function cell(item: unknown, rowIndex: number, col: string): ReactNode {\n const obj = isPlainObject(item) ? item : {};\n const prop = rows[rowIndex]?.[col];\n const nodes = prop\n ? ctx.render.renderFieldNodes(\n {\n key: `${field.key}[${rowIndex}].${col}`,\n prop: valueCells ? { ...prop, readOnly: true } : prop,\n required: false,\n value: obj[col],\n onChange: (next) =>\n field.onChange(\n setIndex(\n items,\n rowIndex,\n applyChangeEffects(itemSchema as JsonSchemaObject, {\n root: options.rootValue ?? obj,\n ...(options.evaluate ? { evaluate: options.evaluate } : {}),\n value: obj,\n key: col,\n next,\n }),\n ),\n ),\n instancePath: appendInstancePath(\n appendInstancePath(ctx.instancePath, rowIndex),\n col,\n ),\n },\n childCtx,\n )\n : null;\n if (!nodes) return <span data-jsf-cell-placeholder aria-hidden=\"true\" className={cn(\"block\", controlMinHeightClass[ctx.size])} />;\n return ctx.presentation ? (\n <div\n className={cn(\n \"flex min-w-0 items-center [overflow-wrap:anywhere] [&_span[data-jsf-readonly]]:h-auto [&_span[data-jsf-readonly]]:min-w-0\",\n controlMinHeightClass[ctx.size],\n )}\n >\n {nodes.value}\n </div>\n ) : (\n nodes.value\n );\n }\n\n // A column header is its column's label, so post extensions decorate it as\n // they decorate every field label, on the column's field (keyed by the\n // property name, after the pre-extensions). Only the returned label is used:\n // a header holds no value, and value adornments belong in the cells. A\n // column names no single value, so the context carries no instancePath.\n function columnHeader(col: string, prop: JsonSchemaProperty, header: ReactNode): ReactNode {\n const roots = {\n ...(ctx.rootValue ? { rootValue: ctx.rootValue } : {}),\n ...(ctx.onRootChange ? { onRootChange: ctx.onRootChange } : {}),\n };\n let column: FieldControl | null = resolveControl({ key: col, prop, required: false, value: undefined, onChange: () => {} });\n for (const ext of ctx.pre) {\n if (!column) break;\n column = ext(column, { key: col, prop, value: undefined, ...roots });\n }\n if (!column) return header;\n return applyPostExtensions(column, { label: header, value: null }, ctx.post, roots).label;\n }\n\n const table = (\n <div\n className={cn(\n \"overflow-x-auto\",\n !ctx.presentation && \"rounded-md border border-input\",\n )}\n >\n <table className=\"w-full text-sm\">\n <thead>\n <tr\n className={cn(\n \"border-b bg-muted/40 text-left\",\n ctx.presentation ? \"border-border\" : \"border-input\",\n )}\n >\n {columns.map(([col, prop]) => (\n <th\n key={col}\n className=\"px-2 py-1 text-xs font-medium text-muted-foreground [overflow-wrap:anywhere]\"\n >\n {columnHeader(\n col,\n prop,\n ctx.presentation ? prop.title || col : <TableColumnHeader name={col} schema={prop} />,\n )}\n </th>\n ))}\n {removable && <th className=\"w-10 px-2 py-1\" />}\n </tr>\n </thead>\n <tbody>\n {items.map((item, i) => (\n <tr\n key={i}\n className={cn(\n \"border-b last:border-b-0 align-top\",\n ctx.presentation ? \"border-border\" : \"border-input\",\n )}\n >\n {columns.map(([col]) => (\n <td key={col} className={cn(\"px-2 py-1\", !ctx.presentation && !readOnly && \"min-w-40\")}>\n {cell(item, i, col)}\n </td>\n ))}\n {removable && (\n <td className=\"px-2 py-1\">\n <button\n type=\"button\"\n aria-label={`Remove item ${i + 1}`}\n className={cn(\n \"inline-flex aspect-square items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground\",\n controlHeightClass[ctx.size],\n )}\n onClick={() => field.onChange(removeIndex(items, i))}\n >\n <Icon icon={UiTrash} className=\"text-sm\" />\n </button>\n </td>\n )}\n </tr>\n ))}\n </tbody>\n </table>\n {!readOnly && canAddItem(field, items.length) && (\n <div className=\"p-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n className={cn(\"gap-1.5\", inputSizeClass[ctx.size])}\n onClick={() =>\n field.onChange([...items, seedFromSchema(itemSchema)])\n }\n >\n <Icon icon={UiAdd} className=\"text-sm\" />\n Add item\n </Button>\n </div>\n )}\n </div>\n );\n if (toolbar === undefined) return table;\n // The same summary line the item list shows, so switching views keeps the\n // count and the toolbar where they were. A null toolbar (the menu moved to\n // the section header) with no count line (x-item count: false) has none.\n const countLine = itemCountLine(field.itemSpec ?? resolveItemSpec(field.schema, itemSchema), items.length);\n if (toolbar === null && countLine === undefined) return table;\n return (\n <div className=\"flex flex-col gap-2\">\n <div data-jsf-array-summary className=\"flex items-center justify-between gap-2\">\n <p className={cn(\"text-muted-foreground\", labelSizeClass[ctx.size])}>{countLine}</p>\n {toolbar != null && <div className=\"flex shrink-0 items-center\">{toolbar}</div>}\n </div>\n {table}\n </div>\n );\n}\n\nfunction TableColumnHeader({\n name,\n schema,\n}: {\n name: string;\n schema: JsonSchemaProperty;\n}) {\n const label =\n typeof schema.title === \"string\" && schema.title ? schema.title : name;\n const helper = schemaHelper(schema);\n if (!helper) return label;\n\n return (\n <HoverCard\n placement=\"bottom\"\n trigger={\n <button\n type=\"button\"\n aria-label={`${label} help`}\n className=\"cursor-help border-b border-dotted border-current text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {label}\n </button>\n }\n cardClassName=\"max-w-xs whitespace-normal text-left font-normal text-foreground\"\n >\n {helper}\n </HoverCard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,SAAgB,WAAW,EACzB,OACA,KACA,UACA,WAOC;CACD,MAAM,QAAQ,MAAM,QAAQ,MAAM,KAAK,IAAI,MAAM,QAAQ,CAAC;CAC1D,MAAM,aAAa,MAAM,cAAc,EAAE,MAAM,SAAS;CAQxD,MAAM,UAAU,mBAAmB,OAAO,GAAG;CAC7C,MAAM,aAAa,QAAQ;CAU3B,MAAM,EAAE,SAAS,SAAS,YAAY,YAAY,OAAO,OAAO;CAGhE,MAAM,WAA0B;EAC9B,GAAG;EACH;EACA,OAAO,IAAI,QAAQ;EACnB,GAAI,aAAa,EAAE,oBAAoB,MAAM,IAAI,CAAC;CACpD;CAIA,MAAM,YAAY,CAAC,YAAY,cAAc,OAAO,MAAM,MAAM;CAKhE,SAAS,KAAK,MAAe,UAAkB,KAAwB;EACrE,MAAM,MAAM,cAAc,IAAI,IAAI,OAA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
|
3
3
|
const require_json_schema_form_utils = require("./json-schema-form-utils.cjs");
|
|
4
|
+
let react = require("react");
|
|
4
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
6
|
// src/components/json-schema-form-tags-combobox.tsx
|
|
6
7
|
function TagsComboboxControl({ field, fieldId, readOnly, size, options, itemType, separators, loading, onSearch }) {
|
|
7
8
|
const values = toTagValues(field.value);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
9
|
+
const [refusal, setRefusal] = (0, react.useState)();
|
|
10
|
+
const refusalId = `${fieldId}-refusal`;
|
|
11
|
+
const aria = require_json_schema_form_utils.comboboxAriaProps(field, fieldId);
|
|
12
|
+
const typed = itemType === "string" && field.itemSchema ? field.itemSchema : void 0;
|
|
13
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14
|
+
className: "w-full",
|
|
15
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Combobox.Combobox, {
|
|
16
|
+
multiple: true,
|
|
17
|
+
variant: "tags",
|
|
18
|
+
...field.nullable ? {
|
|
19
|
+
clearable: true,
|
|
20
|
+
clearLabel: `Clear ${field.label} to null`,
|
|
21
|
+
onClear: () => field.onChange(null)
|
|
22
|
+
} : {},
|
|
23
|
+
id: fieldId,
|
|
24
|
+
options: options.length === 0 ? [] : require_combobox_values.withSelectedComboboxOptions(options, values),
|
|
25
|
+
value: values,
|
|
26
|
+
onChange: (next) => field.onChange(next.map((v) => coerceScalarItem(v, itemType))),
|
|
27
|
+
disabled: readOnly,
|
|
28
|
+
...!readOnly ? { inputPlaceholder: require_json_schema_form_utils.defaultPlaceholder(field.schema) || (itemType === "integer" ? "Add integer…" : itemType === "number" ? "Add number…" : itemType === "string" ? "Add tag…" : "Choose values…") } : {},
|
|
29
|
+
size,
|
|
30
|
+
allowCustomValue: field.allowCustomValue ?? itemType !== void 0,
|
|
31
|
+
prefix: field.prefix,
|
|
32
|
+
suffix: field.suffix,
|
|
33
|
+
...separators ? { separators } : {},
|
|
34
|
+
...loading !== void 0 ? { loading } : {},
|
|
35
|
+
...onSearch ? { onSearch } : {},
|
|
36
|
+
...aria,
|
|
37
|
+
...refusal ? {
|
|
38
|
+
invalid: true,
|
|
39
|
+
describedBy: [aria.describedBy, refusalId].filter(Boolean).join(" ")
|
|
40
|
+
} : {},
|
|
41
|
+
...typed ? {
|
|
42
|
+
onCreate: (option) => {
|
|
43
|
+
const reason = tagRefusal(typed, option.value, field.label);
|
|
44
|
+
setRefusal(reason);
|
|
45
|
+
return reason ? null : option.value;
|
|
46
|
+
},
|
|
47
|
+
onInputValueChange: () => setRefusal(void 0)
|
|
48
|
+
} : {},
|
|
49
|
+
...field.inputClassName ? { className: field.inputClassName } : {},
|
|
50
|
+
...require_json_schema_form_utils.defaultPlaceholder(field.schema) ? { placeholder: require_json_schema_form_utils.defaultPlaceholder(field.schema) } : {}
|
|
51
|
+
}), refusal && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
52
|
+
id: refusalId,
|
|
53
|
+
role: "alert",
|
|
54
|
+
className: "mt-1 text-xs text-destructive",
|
|
55
|
+
children: refusal
|
|
56
|
+
})]
|
|
32
57
|
});
|
|
33
58
|
}
|
|
59
|
+
function tagRefusal(item, text, label) {
|
|
60
|
+
const { pattern, minLength, maxLength } = item;
|
|
61
|
+
if ((typeof pattern !== "string" || new RegExp(pattern, "u").test(text)) && (typeof minLength !== "number" || text.length >= minLength) && (typeof maxLength !== "number" || text.length <= maxLength)) return void 0;
|
|
62
|
+
return `“${text}” is not a valid ${item.title || label}${item.description ? `: ${item.description}` : typeof pattern === "string" ? `; it must match ${pattern}` : ""}`;
|
|
63
|
+
}
|
|
34
64
|
function toTagValues(value) {
|
|
35
65
|
if (!Array.isArray(value)) return [];
|
|
36
66
|
return value.filter((entry) => typeof entry === "string" || typeof entry === "number").map(String);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-tags-combobox.cjs","names":["Combobox","withSelectedComboboxOptions","defaultPlaceholder"
|
|
1
|
+
{"version":3,"file":"json-schema-form-tags-combobox.cjs","names":["useState","comboboxAriaProps","Combobox","withSelectedComboboxOptions","defaultPlaceholder"],"sources":["../../src/components/json-schema-form-tags-combobox.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { Combobox } from \"./Combobox\";\nimport type { ComboboxOption } from \"./combobox-types\";\nimport { withSelectedComboboxOptions } from \"../lib/combobox-values\";\nimport {\n comboboxAriaProps,\n defaultPlaceholder,\n} from \"./json-schema-form-utils\";\nimport type { FormSize } from \"./json-schema-form-size\";\nimport type {\n FieldControl,\n FieldOption,\n JsonSchemaProperty,\n ScalarItemType,\n} from \"./json-schema-form-types\";\n\n// TagsComboboxControl is the multi-value picker: one field whose committed\n// values are removable pills. It serves every array that holds a flat list of\n// values — an `enum` item schema (options in the schema), an `x-clicky-lookup`\n// with `multi: true` (options fetched, with server-side search), and a plain\n// list of scalars (no options at all, so typing IS how a value is added) — so\n// all three look and behave identically.\n//\n// The value it commits is ALWAYS an array. That is the difference from\n// EnumControl/LookupControl, which own the single-value case.\nexport function TagsComboboxControl({\n field,\n fieldId,\n readOnly,\n size,\n options,\n itemType,\n separators,\n loading,\n onSearch,\n}: {\n field: FieldControl;\n fieldId: string;\n readOnly: boolean;\n size: FormSize;\n options: FieldOption[];\n /** The scalar the items hold, when the list is free-form rather than a choice\n * set. Turns on free entry and converts numeric text on commit. */\n itemType?: ScalarItemType;\n /** Characters that commit the typed text, alongside Enter (see Combobox). */\n separators?: string[];\n loading?: boolean;\n onSearch?: (query: string) => void;\n}) {\n const values = toTagValues(field.value);\n const [refusal, setRefusal] = useState<string>();\n const refusalId = `${fieldId}-refusal`;\n const aria = comboboxAriaProps(field, fieldId);\n // A typed string list refuses a tag its item schema rejects, saying why, so a\n // bad value never reaches the committed array.\n const typed = itemType === \"string\" && field.itemSchema ? field.itemSchema : undefined;\n return (\n <div className=\"w-full\">\n <Combobox\n multiple\n variant=\"tags\"\n {...(field.nullable ? { clearable: true, clearLabel: `Clear ${field.label} to null`, onClear: () => field.onChange(null) } : {})}\n id={fieldId}\n // A choice list pins any committed value its options do not carry, so the\n // value stays visible and de-selectable in the menu (a lookup's head set is\n // a page, not the whole table). A free scalar list has no option set to pin\n // into, and a menu echoing the pills above it says nothing.\n options={\n options.length === 0 ? [] : withSelectedComboboxOptions(options, values)\n }\n value={values}\n onChange={(next) =>\n field.onChange(next.map((v) => coerceScalarItem(v, itemType)))\n }\n disabled={readOnly}\n {...(!readOnly ? { inputPlaceholder: defaultPlaceholder(field.schema) || (itemType === \"integer\" ? \"Add integer…\" : itemType === \"number\" ? \"Add number…\" : itemType === \"string\" ? \"Add tag…\" : \"Choose values…\") } : {})}\n size={size}\n // An enum (or a strict lookup) is a closed set: typed text matching no\n // option is discarded rather than committed. A free scalar list is the\n // opposite — there is nothing to match against. A pre-extension wins over\n // both.\n allowCustomValue={field.allowCustomValue ?? itemType !== undefined}\n prefix={field.prefix}\n suffix={field.suffix}\n {...(separators ? { separators } : {})}\n {...(loading !== undefined ? { loading } : {})}\n {...(onSearch ? { onSearch } : {})}\n {...aria}\n {...(refusal ? { invalid: true, describedBy: [aria.describedBy, refusalId].filter(Boolean).join(\" \") } : {})}\n {...(typed\n ? {\n onCreate: (option: ComboboxOption) => {\n const reason = tagRefusal(typed, option.value, field.label);\n setRefusal(reason);\n return reason ? null : option.value;\n },\n onInputValueChange: () => setRefusal(undefined),\n }\n : {})}\n {...(field.inputClassName ? { className: field.inputClassName } : {})}\n {...(defaultPlaceholder(field.schema)\n ? { placeholder: defaultPlaceholder(field.schema) }\n : {})}\n />\n {refusal && <p id={refusalId} role=\"alert\" className=\"mt-1 text-xs text-destructive\">{refusal}</p>}\n </div>\n );\n}\n\n// tagRefusal says why `text` is not a valid item of a string list — its pattern\n// or length bounds — or undefined when it is one.\nfunction tagRefusal(item: JsonSchemaProperty, text: string, label: string): string | undefined {\n const { pattern, minLength, maxLength } = item;\n const fits =\n (typeof pattern !== \"string\" || new RegExp(pattern, \"u\").test(text)) &&\n (typeof minLength !== \"number\" || text.length >= minLength) &&\n (typeof maxLength !== \"number\" || text.length <= maxLength);\n if (fits) return undefined;\n const what = item.title || label;\n return `“${text}” is not a valid ${what}${item.description ? `: ${item.description}` : typeof pattern === \"string\" ? `; it must match ${pattern}` : \"\"}`;\n}\n\n// The pills a committed value renders as. A numeric list holds numbers, and a\n// tag is text, so both scalars render as their own text — anything else (an\n// object mid-edit, a null) has no legible pill and is dropped.\nfunction toTagValues(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value\n .filter(\n (entry): entry is string | number =>\n typeof entry === \"string\" || typeof entry === \"number\",\n )\n .map(String);\n}\n\n// coerceScalarItem converts a pill's text back to the type the items declare.\n// Text that does not parse as a number stays a string even in a numeric list, so\n// a template token survives — the same allowance NumberControl makes. The\n// round-trip is stable: 80 renders as \"80\" and commits as 80.\nfunction coerceScalarItem(\n raw: string,\n itemType: ScalarItemType | undefined,\n): string | number {\n if (itemType !== \"integer\" && itemType !== \"number\") return raw;\n const trimmed = raw.trim();\n if (trimmed === \"\" || !Number.isFinite(Number(trimmed))) return raw;\n return Number(trimmed);\n}\n"],"mappings":";;;;;;AAyBA,SAAgB,oBAAoB,EAClC,OACA,SACA,UACA,MACA,SACA,UACA,YACA,SACA,YAcC;CACD,MAAM,SAAS,YAAY,MAAM,KAAK;CACtC,MAAM,CAAC,SAAS,eAAA,GAAcA,MAAAA,SAAAA,CAAiB;CAC/C,MAAM,YAAY,GAAG,QAAQ;CAC7B,MAAM,OAAOC,+BAAAA,kBAA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AChD,IACA,CAAC;GACL,GAAK,MAAM,iBAAiB,EAAE,WAAW,MAAM,eAAe,IAAI,CAAC;GACnE,GAAKA,+BAAAA,mBAAmB,MAAM,MAAM,IAChC,EAAE,aAAaA,+BAAAA,mBAAmB,MAAM,MAAM,EAAE,IAChD,CAAC;EACN,CAAA,GACA,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;GAAG,IAAI;GAAW,MAAK;GAAQ,WAAU;GAAiC,UAAA;EAAW,CAAA,CAC5F;;AAET;AAIA,SAAS,WAAW,MAA0B,MAAc,OAAmC;CAC7F,MAAM,EAAE,SAAS,WAAW,cAAc;CAK1C,KAHG,OAAO,YAAY,YAAY,IAAI,OAAO,SAAS,GAAG,CAAC,CAAC,KAAK,IAAI,OACjE,OAAO,cAAc,YAAY,KAAK,UAAU,eAChD,OAAO,cAAc,YAAY,KAAK,UAAU,YACzC,OAAO,KAAA;CAEjB,OAAO,IAAI,KAAK,mBADH,KAAK,SAAS,QACe,KAAK,cAAc,KAAK,KAAK,gBAAgB,OAAO,YAAY,WAAW,mBAAmB,YAAY;AACtJ;AAKA,SAAS,YAAY,OAA0B;CAC7C,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO,CAAC;CACnC,OAAO,MACJ,QACE,UACC,OAAO,UAAU,YAAY,OAAO,UAAU,QAClD,CAAC,CACA,IAAI,MAAM;AACf;AAMA,SAAS,iBACP,KACA,UACiB;CACjB,IAAI,aAAa,aAAa,aAAa,UAAU,OAAO;CAC5D,MAAM,UAAU,IAAI,KAAK;CACzB,IAAI,YAAY,MAAM,CAAC,OAAO,SAAS,OAAO,OAAO,CAAC,GAAG,OAAO;CAChE,OAAO,OAAO,OAAO;AACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-tags-combobox.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-tags-combobox.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-schema-form-tags-combobox.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-tags-combobox.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EAEX,cAAc,EACf,MAAM,0BAA0B,CAAC;AAWlC,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,UAAU,EACV,OAAO,EACP,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB;wEACoE;IACpE,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,+BA2DA"}
|