@flanksource/clicky-ui 0.3.19 → 0.3.21
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/components/ErrorWrapper.cjs +1 -1
- package/dist/components/ErrorWrapper.cjs.map +1 -1
- package/dist/components/ErrorWrapper.js +1 -1
- package/dist/components/ErrorWrapper.js.map +1 -1
- package/dist/components/UnitStepControls.cjs +55 -0
- package/dist/components/UnitStepControls.cjs.map +1 -0
- package/dist/components/UnitStepControls.d.ts +10 -0
- package/dist/components/UnitStepControls.d.ts.map +1 -0
- package/dist/components/UnitStepControls.js +55 -0
- package/dist/components/UnitStepControls.js.map +1 -0
- package/dist/components/json-schema-form-accordion-array.cjs +5 -73
- package/dist/components/json-schema-form-accordion-array.cjs.map +1 -1
- package/dist/components/json-schema-form-accordion-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-accordion-array.js +3 -71
- package/dist/components/json-schema-form-accordion-array.js.map +1 -1
- package/dist/components/json-schema-form-array.cjs +6 -1
- package/dist/components/json-schema-form-array.cjs.map +1 -1
- package/dist/components/json-schema-form-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-array.js +6 -1
- package/dist/components/json-schema-form-array.js.map +1 -1
- package/dist/components/json-schema-form-cards-array.cjs +96 -0
- package/dist/components/json-schema-form-cards-array.cjs.map +1 -0
- package/dist/components/json-schema-form-cards-array.d.ts +7 -0
- package/dist/components/json-schema-form-cards-array.d.ts.map +1 -0
- package/dist/components/json-schema-form-cards-array.js +96 -0
- package/dist/components/json-schema-form-cards-array.js.map +1 -0
- package/dist/components/json-schema-form-item-row.cjs +81 -0
- package/dist/components/json-schema-form-item-row.cjs.map +1 -0
- package/dist/components/json-schema-form-item-row.d.ts +19 -0
- package/dist/components/json-schema-form-item-row.d.ts.map +1 -0
- package/dist/components/json-schema-form-item-row.js +81 -0
- package/dist/components/json-schema-form-item-row.js.map +1 -0
- package/dist/components/json-schema-form-render.cjs +2 -2
- package/dist/components/json-schema-form-render.cjs.map +1 -1
- package/dist/components/json-schema-form-render.d.ts.map +1 -1
- package/dist/components/json-schema-form-render.js +2 -2
- package/dist/components/json-schema-form-render.js.map +1 -1
- package/dist/components/json-schema-form-resolve.cjs +1 -1
- package/dist/components/json-schema-form-resolve.cjs.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-tone.cjs +12 -0
- package/dist/components/json-schema-form-tone.cjs.map +1 -1
- package/dist/components/json-schema-form-tone.js +12 -0
- package/dist/components/json-schema-form-tone.js.map +1 -1
- package/dist/components/json-schema-form-types.d.ts +1 -1
- package/dist/components/json-schema-form-types.d.ts.map +1 -1
- package/dist/components/unit-form-extension.cjs +126 -0
- package/dist/components/unit-form-extension.cjs.map +1 -0
- package/dist/components/unit-form-extension.d.ts +8 -0
- package/dist/components/unit-form-extension.d.ts.map +1 -0
- package/dist/components/unit-form-extension.js +126 -0
- package/dist/components/unit-form-extension.js.map +1 -0
- package/dist/components.cjs +4 -0
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.ts +1 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +4 -0
- package/dist/components.js.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.cjs +61 -8
- package/dist/data/diagnostics/ErrorDetails.cjs.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.d.ts.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.js +61 -8
- package/dist/data/diagnostics/ErrorDetails.js.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.cjs +10 -4
- package/dist/data/diagnostics/error-diagnostics.cjs.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.d.ts.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.js +10 -4
- package/dist/data/diagnostics/error-diagnostics.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.cjs +12 -6
- package/dist/data/query-browser/QueryBrowser.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.js +12 -6
- package/dist/data/query-browser/QueryBrowser.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.cjs +2 -1
- package/dist/data/query-browser/QueryBrowser.types.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.d.ts +16 -14
- package/dist/data/query-browser/QueryBrowser.types.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.js +2 -1
- package/dist/data/query-browser/QueryBrowser.types.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/string.cjs +8 -0
- package/dist/lib/string.cjs.map +1 -1
- package/dist/lib/string.d.ts +1 -0
- package/dist/lib/string.d.ts.map +1 -1
- package/dist/lib/string.js +8 -0
- package/dist/lib/string.js.map +1 -1
- package/dist/profiles/catalogTree.cjs +133 -0
- package/dist/profiles/catalogTree.cjs.map +1 -0
- package/dist/profiles/catalogTree.d.ts +11 -0
- package/dist/profiles/catalogTree.d.ts.map +1 -0
- package/dist/profiles/catalogTree.js +133 -0
- package/dist/profiles/catalogTree.js.map +1 -0
- package/dist/profiles/connectionBrowserModel.cjs +185 -0
- package/dist/profiles/connectionBrowserModel.cjs.map +1 -0
- package/dist/profiles/connectionBrowserModel.d.ts +169 -0
- package/dist/profiles/connectionBrowserModel.d.ts.map +1 -0
- package/dist/profiles/connectionBrowserModel.js +185 -0
- package/dist/profiles/connectionBrowserModel.js.map +1 -0
- package/dist/profiles/connectionQueryWorkspace.cjs +185 -0
- package/dist/profiles/connectionQueryWorkspace.cjs.map +1 -0
- package/dist/profiles/connectionQueryWorkspace.d.ts +63 -0
- package/dist/profiles/connectionQueryWorkspace.d.ts.map +1 -0
- package/dist/profiles/connectionQueryWorkspace.js +185 -0
- package/dist/profiles/connectionQueryWorkspace.js.map +1 -0
- package/dist/profiles/connectionQueryWorkspaceModel.cjs +28 -0
- package/dist/profiles/connectionQueryWorkspaceModel.cjs.map +1 -0
- package/dist/profiles/connectionQueryWorkspaceModel.d.ts +38 -0
- package/dist/profiles/connectionQueryWorkspaceModel.d.ts.map +1 -0
- package/dist/profiles/connectionQueryWorkspaceModel.js +28 -0
- package/dist/profiles/connectionQueryWorkspaceModel.js.map +1 -0
- package/dist/profiles/esFieldValues.cjs +64 -0
- package/dist/profiles/esFieldValues.cjs.map +1 -0
- package/dist/profiles/esFieldValues.d.ts +48 -0
- package/dist/profiles/esFieldValues.d.ts.map +1 -0
- package/dist/profiles/esFieldValues.js +64 -0
- package/dist/profiles/esFieldValues.js.map +1 -0
- package/dist/profiles/esParamMappingModel.cjs +301 -0
- package/dist/profiles/esParamMappingModel.cjs.map +1 -0
- package/dist/profiles/esParamMappingModel.d.ts +37 -0
- package/dist/profiles/esParamMappingModel.d.ts.map +1 -0
- package/dist/profiles/esParamMappingModel.js +301 -0
- package/dist/profiles/esParamMappingModel.js.map +1 -0
- package/dist/profiles/esParamMappingPill.cjs +24 -0
- package/dist/profiles/esParamMappingPill.cjs.map +1 -0
- package/dist/profiles/esParamMappingPill.d.ts +13 -0
- package/dist/profiles/esParamMappingPill.d.ts.map +1 -0
- package/dist/profiles/esParamMappingPill.js +24 -0
- package/dist/profiles/esParamMappingPill.js.map +1 -0
- package/dist/profiles/esParamOperandExtension.cjs +75 -0
- package/dist/profiles/esParamOperandExtension.cjs.map +1 -0
- package/dist/profiles/esParamOperandExtension.d.ts +11 -0
- package/dist/profiles/esParamOperandExtension.d.ts.map +1 -0
- package/dist/profiles/esParamOperandExtension.js +75 -0
- package/dist/profiles/esParamOperandExtension.js.map +1 -0
- package/dist/profiles/esQueryBuilder.cjs +205 -0
- package/dist/profiles/esQueryBuilder.cjs.map +1 -0
- package/dist/profiles/esQueryBuilder.d.ts +35 -0
- package/dist/profiles/esQueryBuilder.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilder.js +205 -0
- package/dist/profiles/esQueryBuilder.js.map +1 -0
- package/dist/profiles/esQueryBuilderExtension.cjs +23 -0
- package/dist/profiles/esQueryBuilderExtension.cjs.map +1 -0
- package/dist/profiles/esQueryBuilderExtension.d.ts +5 -0
- package/dist/profiles/esQueryBuilderExtension.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilderExtension.js +23 -0
- package/dist/profiles/esQueryBuilderExtension.js.map +1 -0
- package/dist/profiles/esQueryBuilderForm.cjs +26 -0
- package/dist/profiles/esQueryBuilderForm.cjs.map +1 -0
- package/dist/profiles/esQueryBuilderForm.d.ts +18 -0
- package/dist/profiles/esQueryBuilderForm.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilderForm.js +26 -0
- package/dist/profiles/esQueryBuilderForm.js.map +1 -0
- package/dist/profiles/esQueryBuilderModel.cjs +131 -0
- package/dist/profiles/esQueryBuilderModel.cjs.map +1 -0
- package/dist/profiles/esQueryBuilderModel.d.ts +108 -0
- package/dist/profiles/esQueryBuilderModel.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilderModel.js +131 -0
- package/dist/profiles/esQueryBuilderModel.js.map +1 -0
- package/dist/profiles/esQueryClauseGroup.cjs +144 -0
- package/dist/profiles/esQueryClauseGroup.cjs.map +1 -0
- package/dist/profiles/esQueryClauseGroup.d.ts +10 -0
- package/dist/profiles/esQueryClauseGroup.d.ts.map +1 -0
- package/dist/profiles/esQueryClauseGroup.js +144 -0
- package/dist/profiles/esQueryClauseGroup.js.map +1 -0
- package/dist/profiles/esQueryCompile.cjs +47 -0
- package/dist/profiles/esQueryCompile.cjs.map +1 -0
- package/dist/profiles/esQueryCompile.d.ts +39 -0
- package/dist/profiles/esQueryCompile.d.ts.map +1 -0
- package/dist/profiles/esQueryCompile.js +47 -0
- package/dist/profiles/esQueryCompile.js.map +1 -0
- package/dist/profiles/esQueryConditionRow.cjs +168 -0
- package/dist/profiles/esQueryConditionRow.cjs.map +1 -0
- package/dist/profiles/esQueryConditionRow.d.ts +37 -0
- package/dist/profiles/esQueryConditionRow.d.ts.map +1 -0
- package/dist/profiles/esQueryConditionRow.js +168 -0
- package/dist/profiles/esQueryConditionRow.js.map +1 -0
- package/dist/profiles/esQueryGroupModel.cjs +12 -0
- package/dist/profiles/esQueryGroupModel.cjs.map +1 -0
- package/dist/profiles/esQueryGroupModel.d.ts +9 -0
- package/dist/profiles/esQueryGroupModel.d.ts.map +1 -0
- package/dist/profiles/esQueryGroupModel.js +12 -0
- package/dist/profiles/esQueryGroupModel.js.map +1 -0
- package/dist/profiles/esQueryOccur.cjs +16 -0
- package/dist/profiles/esQueryOccur.cjs.map +1 -0
- package/dist/profiles/esQueryOccur.d.ts +11 -0
- package/dist/profiles/esQueryOccur.d.ts.map +1 -0
- package/dist/profiles/esQueryOccur.js +16 -0
- package/dist/profiles/esQueryOccur.js.map +1 -0
- package/dist/profiles/esQueryOperandEditors.cjs +279 -0
- package/dist/profiles/esQueryOperandEditors.cjs.map +1 -0
- package/dist/profiles/esQueryOperandEditors.d.ts +24 -0
- package/dist/profiles/esQueryOperandEditors.d.ts.map +1 -0
- package/dist/profiles/esQueryOperandEditors.js +279 -0
- package/dist/profiles/esQueryOperandEditors.js.map +1 -0
- package/dist/profiles/esQueryOperandModel.cjs +28 -0
- package/dist/profiles/esQueryOperandModel.cjs.map +1 -0
- package/dist/profiles/esQueryOperandModel.d.ts +17 -0
- package/dist/profiles/esQueryOperandModel.d.ts.map +1 -0
- package/dist/profiles/esQueryOperandModel.js +28 -0
- package/dist/profiles/esQueryOperandModel.js.map +1 -0
- package/dist/profiles/esQueryOperators.cjs +165 -0
- package/dist/profiles/esQueryOperators.cjs.map +1 -0
- package/dist/profiles/esQueryOperators.d.ts +83 -0
- package/dist/profiles/esQueryOperators.d.ts.map +1 -0
- package/dist/profiles/esQueryOperators.js +165 -0
- package/dist/profiles/esQueryOperators.js.map +1 -0
- package/dist/profiles/esQueryOutputEditor.cjs +138 -0
- package/dist/profiles/esQueryOutputEditor.cjs.map +1 -0
- package/dist/profiles/esQueryOutputEditor.d.ts +7 -0
- package/dist/profiles/esQueryOutputEditor.d.ts.map +1 -0
- package/dist/profiles/esQueryOutputEditor.js +138 -0
- package/dist/profiles/esQueryOutputEditor.js.map +1 -0
- package/dist/profiles/esQueryOutputModel.cjs +16 -0
- package/dist/profiles/esQueryOutputModel.cjs.map +1 -0
- package/dist/profiles/esQueryOutputModel.d.ts +14 -0
- package/dist/profiles/esQueryOutputModel.d.ts.map +1 -0
- package/dist/profiles/esQueryOutputModel.js +16 -0
- package/dist/profiles/esQueryOutputModel.js.map +1 -0
- package/dist/profiles/esQueryPreview.cjs +30 -0
- package/dist/profiles/esQueryPreview.cjs.map +1 -0
- package/dist/profiles/esQueryPreview.d.ts +6 -0
- package/dist/profiles/esQueryPreview.d.ts.map +1 -0
- package/dist/profiles/esQueryPreview.js +30 -0
- package/dist/profiles/esQueryPreview.js.map +1 -0
- package/dist/profiles/esQuerySortEditor.cjs +143 -0
- package/dist/profiles/esQuerySortEditor.cjs.map +1 -0
- package/dist/profiles/esQuerySortEditor.d.ts +9 -0
- package/dist/profiles/esQuerySortEditor.d.ts.map +1 -0
- package/dist/profiles/esQuerySortEditor.js +143 -0
- package/dist/profiles/esQuerySortEditor.js.map +1 -0
- package/dist/profiles/esQuerySortModel.cjs +13 -0
- package/dist/profiles/esQuerySortModel.cjs.map +1 -0
- package/dist/profiles/esQuerySortModel.d.ts +4 -0
- package/dist/profiles/esQuerySortModel.d.ts.map +1 -0
- package/dist/profiles/esQuerySortModel.js +13 -0
- package/dist/profiles/esQuerySortModel.js.map +1 -0
- package/dist/profiles/esValueCombobox.cjs +86 -0
- package/dist/profiles/esValueCombobox.cjs.map +1 -0
- package/dist/profiles/esValueCombobox.d.ts +15 -0
- package/dist/profiles/esValueCombobox.d.ts.map +1 -0
- package/dist/profiles/esValueCombobox.js +86 -0
- package/dist/profiles/esValueCombobox.js.map +1 -0
- package/dist/profiles/jsonPathSample.cjs +75 -0
- package/dist/profiles/jsonPathSample.cjs.map +1 -0
- package/dist/profiles/jsonPathSample.d.ts +27 -0
- package/dist/profiles/jsonPathSample.d.ts.map +1 -0
- package/dist/profiles/jsonPathSample.js +75 -0
- package/dist/profiles/jsonPathSample.js.map +1 -0
- package/dist/profiles/jsonPathSampleRow.cjs +14 -0
- package/dist/profiles/jsonPathSampleRow.cjs.map +1 -0
- package/dist/profiles/jsonPathSampleRow.d.ts +6 -0
- package/dist/profiles/jsonPathSampleRow.d.ts.map +1 -0
- package/dist/profiles/jsonPathSampleRow.js +14 -0
- package/dist/profiles/jsonPathSampleRow.js.map +1 -0
- package/dist/profiles/profileApi.cjs +37 -0
- package/dist/profiles/profileApi.cjs.map +1 -0
- package/dist/profiles/profileApi.d.ts +32 -0
- package/dist/profiles/profileApi.d.ts.map +1 -0
- package/dist/profiles/profileApi.js +37 -0
- package/dist/profiles/profileApi.js.map +1 -0
- package/dist/profiles/profileBuilder.cjs +65 -0
- package/dist/profiles/profileBuilder.cjs.map +1 -0
- package/dist/profiles/profileBuilder.d.ts +11 -0
- package/dist/profiles/profileBuilder.d.ts.map +1 -0
- package/dist/profiles/profileBuilder.js +65 -0
- package/dist/profiles/profileBuilder.js.map +1 -0
- package/dist/profiles/profileBuilderExtension.cjs +25 -0
- package/dist/profiles/profileBuilderExtension.cjs.map +1 -0
- package/dist/profiles/profileBuilderExtension.d.ts +5 -0
- package/dist/profiles/profileBuilderExtension.d.ts.map +1 -0
- package/dist/profiles/profileBuilderExtension.js +25 -0
- package/dist/profiles/profileBuilderExtension.js.map +1 -0
- package/dist/profiles/profileBuilderWorkspace.cjs +368 -0
- package/dist/profiles/profileBuilderWorkspace.cjs.map +1 -0
- package/dist/profiles/profileBuilderWorkspace.d.ts +21 -0
- package/dist/profiles/profileBuilderWorkspace.d.ts.map +1 -0
- package/dist/profiles/profileBuilderWorkspace.js +368 -0
- package/dist/profiles/profileBuilderWorkspace.js.map +1 -0
- package/dist/profiles/profileColumnModel.cjs +23 -0
- package/dist/profiles/profileColumnModel.cjs.map +1 -0
- package/dist/profiles/profileColumnModel.d.ts +8 -0
- package/dist/profiles/profileColumnModel.d.ts.map +1 -0
- package/dist/profiles/profileColumnModel.js +23 -0
- package/dist/profiles/profileColumnModel.js.map +1 -0
- package/dist/profiles/profileColumnPicker.cjs +68 -0
- package/dist/profiles/profileColumnPicker.cjs.map +1 -0
- package/dist/profiles/profileColumnPicker.d.ts +11 -0
- package/dist/profiles/profileColumnPicker.d.ts.map +1 -0
- package/dist/profiles/profileColumnPicker.js +68 -0
- package/dist/profiles/profileColumnPicker.js.map +1 -0
- package/dist/profiles/profileEditor.cjs +386 -0
- package/dist/profiles/profileEditor.cjs.map +1 -0
- package/dist/profiles/profileEditor.d.ts +19 -0
- package/dist/profiles/profileEditor.d.ts.map +1 -0
- package/dist/profiles/profileEditor.js +386 -0
- package/dist/profiles/profileEditor.js.map +1 -0
- package/dist/profiles/profileEditorModel.cjs +181 -0
- package/dist/profiles/profileEditorModel.cjs.map +1 -0
- package/dist/profiles/profileEditorModel.d.ts +74 -0
- package/dist/profiles/profileEditorModel.d.ts.map +1 -0
- package/dist/profiles/profileEditorModel.js +181 -0
- package/dist/profiles/profileEditorModel.js.map +1 -0
- package/dist/profiles/profileEditorPreview.cjs +38 -0
- package/dist/profiles/profileEditorPreview.cjs.map +1 -0
- package/dist/profiles/profileEditorPreview.d.ts +12 -0
- package/dist/profiles/profileEditorPreview.d.ts.map +1 -0
- package/dist/profiles/profileEditorPreview.js +38 -0
- package/dist/profiles/profileEditorPreview.js.map +1 -0
- package/dist/profiles/profileEditorRail.cjs +46 -0
- package/dist/profiles/profileEditorRail.cjs.map +1 -0
- package/dist/profiles/profileEditorRail.d.ts +8 -0
- package/dist/profiles/profileEditorRail.d.ts.map +1 -0
- package/dist/profiles/profileEditorRail.js +46 -0
- package/dist/profiles/profileEditorRail.js.map +1 -0
- package/dist/profiles/profileEditorRaw.cjs +118 -0
- package/dist/profiles/profileEditorRaw.cjs.map +1 -0
- package/dist/profiles/profileEditorRaw.d.ts +7 -0
- package/dist/profiles/profileEditorRaw.d.ts.map +1 -0
- package/dist/profiles/profileEditorRaw.js +118 -0
- package/dist/profiles/profileEditorRaw.js.map +1 -0
- package/dist/profiles/profileEditorRoutes.cjs +7 -0
- package/dist/profiles/profileEditorRoutes.cjs.map +1 -0
- package/dist/profiles/profileEditorRoutes.d.ts +2 -0
- package/dist/profiles/profileEditorRoutes.d.ts.map +1 -0
- package/dist/profiles/profileEditorRoutes.js +7 -0
- package/dist/profiles/profileEditorRoutes.js.map +1 -0
- package/dist/profiles/profileEditorSections.cjs +213 -0
- package/dist/profiles/profileEditorSections.cjs.map +1 -0
- package/dist/profiles/profileEditorSections.d.ts +23 -0
- package/dist/profiles/profileEditorSections.d.ts.map +1 -0
- package/dist/profiles/profileEditorSections.js +213 -0
- package/dist/profiles/profileEditorSections.js.map +1 -0
- package/dist/profiles/profileFieldEditor.cjs +200 -0
- package/dist/profiles/profileFieldEditor.cjs.map +1 -0
- package/dist/profiles/profileFieldEditor.d.ts +34 -0
- package/dist/profiles/profileFieldEditor.d.ts.map +1 -0
- package/dist/profiles/profileFieldEditor.js +200 -0
- package/dist/profiles/profileFieldEditor.js.map +1 -0
- package/dist/profiles/profileFieldGrid.cjs +250 -0
- package/dist/profiles/profileFieldGrid.cjs.map +1 -0
- package/dist/profiles/profileFieldGrid.d.ts +20 -0
- package/dist/profiles/profileFieldGrid.d.ts.map +1 -0
- package/dist/profiles/profileFieldGrid.js +250 -0
- package/dist/profiles/profileFieldGrid.js.map +1 -0
- package/dist/profiles/profileFieldManager.cjs +103 -0
- package/dist/profiles/profileFieldManager.cjs.map +1 -0
- package/dist/profiles/profileFieldManager.d.ts +9 -0
- package/dist/profiles/profileFieldManager.d.ts.map +1 -0
- package/dist/profiles/profileFieldManager.js +103 -0
- package/dist/profiles/profileFieldManager.js.map +1 -0
- package/dist/profiles/profileFieldState.cjs +136 -0
- package/dist/profiles/profileFieldState.cjs.map +1 -0
- package/dist/profiles/profileFieldState.d.ts +41 -0
- package/dist/profiles/profileFieldState.d.ts.map +1 -0
- package/dist/profiles/profileFieldState.js +136 -0
- package/dist/profiles/profileFieldState.js.map +1 -0
- package/dist/profiles/profileFieldTypes.cjs +17 -0
- package/dist/profiles/profileFieldTypes.cjs.map +1 -0
- package/dist/profiles/profileFieldTypes.d.ts +8 -0
- package/dist/profiles/profileFieldTypes.d.ts.map +1 -0
- package/dist/profiles/profileFieldTypes.js +17 -0
- package/dist/profiles/profileFieldTypes.js.map +1 -0
- package/dist/profiles/profileParamModel.cjs +78 -0
- package/dist/profiles/profileParamModel.cjs.map +1 -0
- package/dist/profiles/profileParamModel.d.ts +3 -0
- package/dist/profiles/profileParamModel.d.ts.map +1 -0
- package/dist/profiles/profileParamModel.js +78 -0
- package/dist/profiles/profileParamModel.js.map +1 -0
- package/dist/profiles/profileSamplePayload.cjs +15 -0
- package/dist/profiles/profileSamplePayload.cjs.map +1 -0
- package/dist/profiles/profileSamplePayload.d.ts +13 -0
- package/dist/profiles/profileSamplePayload.d.ts.map +1 -0
- package/dist/profiles/profileSamplePayload.js +15 -0
- package/dist/profiles/profileSamplePayload.js.map +1 -0
- package/dist/profiles/profileWizard.cjs +257 -0
- package/dist/profiles/profileWizard.cjs.map +1 -0
- package/dist/profiles/profileWizard.d.ts +12 -0
- package/dist/profiles/profileWizard.d.ts.map +1 -0
- package/dist/profiles/profileWizard.js +257 -0
- package/dist/profiles/profileWizard.js.map +1 -0
- package/dist/profiles/profileWizardHelp.cjs +10 -0
- package/dist/profiles/profileWizardHelp.cjs.map +1 -0
- package/dist/profiles/profileWizardHelp.d.ts +13 -0
- package/dist/profiles/profileWizardHelp.d.ts.map +1 -0
- package/dist/profiles/profileWizardHelp.js +10 -0
- package/dist/profiles/profileWizardHelp.js.map +1 -0
- package/dist/profiles/profileWizardModel.cjs +198 -0
- package/dist/profiles/profileWizardModel.cjs.map +1 -0
- package/dist/profiles/profileWizardModel.d.ts +255 -0
- package/dist/profiles/profileWizardModel.d.ts.map +1 -0
- package/dist/profiles/profileWizardModel.js +198 -0
- package/dist/profiles/profileWizardModel.js.map +1 -0
- package/dist/profiles/profileWizardQueryStep.cjs +215 -0
- package/dist/profiles/profileWizardQueryStep.cjs.map +1 -0
- package/dist/profiles/profileWizardQueryStep.d.ts +18 -0
- package/dist/profiles/profileWizardQueryStep.d.ts.map +1 -0
- package/dist/profiles/profileWizardQueryStep.js +215 -0
- package/dist/profiles/profileWizardQueryStep.js.map +1 -0
- package/dist/profiles/profileWizardSteps.cjs +214 -0
- package/dist/profiles/profileWizardSteps.cjs.map +1 -0
- package/dist/profiles/profileWizardSteps.d.ts +35 -0
- package/dist/profiles/profileWizardSteps.d.ts.map +1 -0
- package/dist/profiles/profileWizardSteps.js +214 -0
- package/dist/profiles/profileWizardSteps.js.map +1 -0
- package/dist/profiles/profileYaml.cjs +19 -0
- package/dist/profiles/profileYaml.cjs.map +1 -0
- package/dist/profiles/profileYaml.d.ts +4 -0
- package/dist/profiles/profileYaml.d.ts.map +1 -0
- package/dist/profiles/profileYaml.js +19 -0
- package/dist/profiles/profileYaml.js.map +1 -0
- package/dist/profiles/prometheusResults.cjs +60 -0
- package/dist/profiles/prometheusResults.cjs.map +1 -0
- package/dist/profiles/prometheusResults.d.ts +7 -0
- package/dist/profiles/prometheusResults.d.ts.map +1 -0
- package/dist/profiles/prometheusResults.js +60 -0
- package/dist/profiles/prometheusResults.js.map +1 -0
- package/dist/profiles/queryRowLimits.cjs +82 -0
- package/dist/profiles/queryRowLimits.cjs.map +1 -0
- package/dist/profiles/queryRowLimits.d.ts +9 -0
- package/dist/profiles/queryRowLimits.d.ts.map +1 -0
- package/dist/profiles/queryRowLimits.js +82 -0
- package/dist/profiles/queryRowLimits.js.map +1 -0
- package/dist/profiles/queryRowLimitsModel.cjs +10 -0
- package/dist/profiles/queryRowLimitsModel.cjs.map +1 -0
- package/dist/profiles/queryRowLimitsModel.d.ts +9 -0
- package/dist/profiles/queryRowLimitsModel.d.ts.map +1 -0
- package/dist/profiles/queryRowLimitsModel.js +10 -0
- package/dist/profiles/queryRowLimitsModel.js.map +1 -0
- package/dist/profiles/queryTargetPicker.cjs +42 -0
- package/dist/profiles/queryTargetPicker.cjs.map +1 -0
- package/dist/profiles/queryTargetPicker.d.ts +8 -0
- package/dist/profiles/queryTargetPicker.d.ts.map +1 -0
- package/dist/profiles/queryTargetPicker.js +42 -0
- package/dist/profiles/queryTargetPicker.js.map +1 -0
- package/dist/profiles/testSchema.d.ts +3 -0
- package/dist/profiles/testSchema.d.ts.map +1 -0
- package/dist/profiles.cjs +223 -0
- package/dist/profiles.cjs.map +1 -0
- package/dist/profiles.d.ts +68 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +223 -0
- package/dist/profiles.js.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +6 -1
|
@@ -103,7 +103,7 @@ function ErrorFallback({
|
|
|
103
103
|
onClick: () => void copyDetails(),
|
|
104
104
|
children: [
|
|
105
105
|
/* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { icon: copyState === "copied" ? UiCheck.UiCheck : UiCopy.UiCopy }),
|
|
106
|
-
copyState === "copied" ? "Copied" : "Copy error
|
|
106
|
+
copyState === "copied" ? "Copied" : "Copy error report"
|
|
107
107
|
]
|
|
108
108
|
}
|
|
109
109
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorWrapper.cjs","sources":["../../src/components/ErrorWrapper.tsx"],"sourcesContent":["import {\n Component,\n useMemo,\n useState,\n type ErrorInfo,\n type ReactNode,\n} from \"react\";\nimport { ErrorDetails } from \"../data/diagnostics/ErrorDetails\";\nimport {\n normalizeErrorDiagnostics,\n type ErrorDiagnostics,\n} from \"../data/diagnostics/error-diagnostics\";\nimport { Icon } from \"../data/Icon\";\nimport { UiCheck, UiCopy, UiWarningTriangle } from \"../icons\";\nimport { cn } from \"../lib/utils\";\nimport { Button } from \"./button\";\n\nexport type ErrorWrapperProps = {\n children: ReactNode;\n onError?: (error: Error, errorInfo: ErrorInfo) => void;\n};\n\ntype ErrorWrapperState = {\n error: Error | null;\n componentStack: string | null;\n};\n\nexport class ErrorWrapper extends Component<\n ErrorWrapperProps,\n ErrorWrapperState\n> {\n override state: ErrorWrapperState = {\n error: null,\n componentStack: null,\n };\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n this.setState({ componentStack: errorInfo.componentStack ?? null });\n this.props.onError?.(error, errorInfo);\n }\n\n override render() {\n if (this.state.error) {\n return (\n <ErrorFallback\n error={this.state.error}\n componentStack={this.state.componentStack}\n />\n );\n }\n return this.props.children;\n }\n}\n\ntype CopyState = \"idle\" | \"copied\" | \"failed\";\n\nfunction copyStatusMessage(copyState: CopyState): string {\n if (copyState === \"copied\") return \"Error details copied to clipboard.\";\n if (copyState === \"failed\") {\n return \"Clipboard access failed. Expand the error details to copy individual values.\";\n }\n return \"\";\n}\n\nfunction ErrorFallback({\n error,\n componentStack,\n}: {\n error: Error;\n componentStack: string | null;\n}) {\n const [copyState, setCopyState] = useState<CopyState>(\"idle\");\n const diagnostics = useMemo(\n () => errorDiagnostics(error, componentStack),\n [componentStack, error],\n );\n\n const copyDetails = async () => {\n if (!navigator.clipboard?.writeText) {\n setCopyState(\"failed\");\n return;\n }\n try {\n await navigator.clipboard.writeText(errorReport(error, componentStack));\n setCopyState(\"copied\");\n } catch {\n setCopyState(\"failed\");\n }\n };\n\n return (\n <main\n data-slot=\"error-wrapper\"\n role=\"alert\"\n aria-labelledby=\"error-wrapper-title\"\n className=\"flex min-h-dvh w-full items-center justify-center bg-background p-density-6 text-foreground\"\n >\n <div className=\"w-full max-w-3xl\">\n <div className=\"mb-density-4 flex items-start gap-density-3\">\n <span className=\"grid size-12 shrink-0 place-items-center rounded-full bg-destructive/10 text-destructive\">\n <Icon icon={UiWarningTriangle} className=\"size-6\" />\n </span>\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-xs font-semibold uppercase tracking-wide text-destructive\">\n Unexpected application error\n </p>\n <h1\n id=\"error-wrapper-title\"\n className=\"mt-density-1 text-2xl font-semibold tracking-tight\"\n >\n Something went wrong\n </h1>\n <p className=\"mt-density-2 break-words text-sm text-muted-foreground\">\n {diagnostics.message}\n </p>\n </div>\n </div>\n\n <div className=\"mb-density-3 flex items-center gap-density-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => void copyDetails()}\n >\n <Icon icon={copyState === \"copied\" ? UiCheck : UiCopy} />\n {copyState === \"copied\" ? \"Copied\" : \"Copy error
|
|
1
|
+
{"version":3,"file":"ErrorWrapper.cjs","sources":["../../src/components/ErrorWrapper.tsx"],"sourcesContent":["import {\n Component,\n useMemo,\n useState,\n type ErrorInfo,\n type ReactNode,\n} from \"react\";\nimport { ErrorDetails } from \"../data/diagnostics/ErrorDetails\";\nimport {\n normalizeErrorDiagnostics,\n type ErrorDiagnostics,\n} from \"../data/diagnostics/error-diagnostics\";\nimport { Icon } from \"../data/Icon\";\nimport { UiCheck, UiCopy, UiWarningTriangle } from \"../icons\";\nimport { cn } from \"../lib/utils\";\nimport { Button } from \"./button\";\n\nexport type ErrorWrapperProps = {\n children: ReactNode;\n onError?: (error: Error, errorInfo: ErrorInfo) => void;\n};\n\ntype ErrorWrapperState = {\n error: Error | null;\n componentStack: string | null;\n};\n\nexport class ErrorWrapper extends Component<\n ErrorWrapperProps,\n ErrorWrapperState\n> {\n override state: ErrorWrapperState = {\n error: null,\n componentStack: null,\n };\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n this.setState({ componentStack: errorInfo.componentStack ?? null });\n this.props.onError?.(error, errorInfo);\n }\n\n override render() {\n if (this.state.error) {\n return (\n <ErrorFallback\n error={this.state.error}\n componentStack={this.state.componentStack}\n />\n );\n }\n return this.props.children;\n }\n}\n\ntype CopyState = \"idle\" | \"copied\" | \"failed\";\n\nfunction copyStatusMessage(copyState: CopyState): string {\n if (copyState === \"copied\") return \"Error details copied to clipboard.\";\n if (copyState === \"failed\") {\n return \"Clipboard access failed. Expand the error details to copy individual values.\";\n }\n return \"\";\n}\n\nfunction ErrorFallback({\n error,\n componentStack,\n}: {\n error: Error;\n componentStack: string | null;\n}) {\n const [copyState, setCopyState] = useState<CopyState>(\"idle\");\n const diagnostics = useMemo(\n () => errorDiagnostics(error, componentStack),\n [componentStack, error],\n );\n\n const copyDetails = async () => {\n if (!navigator.clipboard?.writeText) {\n setCopyState(\"failed\");\n return;\n }\n try {\n await navigator.clipboard.writeText(errorReport(error, componentStack));\n setCopyState(\"copied\");\n } catch {\n setCopyState(\"failed\");\n }\n };\n\n return (\n <main\n data-slot=\"error-wrapper\"\n role=\"alert\"\n aria-labelledby=\"error-wrapper-title\"\n className=\"flex min-h-dvh w-full items-center justify-center bg-background p-density-6 text-foreground\"\n >\n <div className=\"w-full max-w-3xl\">\n <div className=\"mb-density-4 flex items-start gap-density-3\">\n <span className=\"grid size-12 shrink-0 place-items-center rounded-full bg-destructive/10 text-destructive\">\n <Icon icon={UiWarningTriangle} className=\"size-6\" />\n </span>\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-xs font-semibold uppercase tracking-wide text-destructive\">\n Unexpected application error\n </p>\n <h1\n id=\"error-wrapper-title\"\n className=\"mt-density-1 text-2xl font-semibold tracking-tight\"\n >\n Something went wrong\n </h1>\n <p className=\"mt-density-2 break-words text-sm text-muted-foreground\">\n {diagnostics.message}\n </p>\n </div>\n </div>\n\n <div className=\"mb-density-3 flex items-center gap-density-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => void copyDetails()}\n >\n <Icon icon={copyState === \"copied\" ? UiCheck : UiCopy} />\n {/* Distinct from ErrorDetails' own \"Copy error details\" control\n below: this copies the page-level report (URL, user agent,\n React component stack), and two identically named buttons in\n one view are ambiguous to assistive tech. */}\n {copyState === \"copied\" ? \"Copied\" : \"Copy error report\"}\n </Button>\n <span\n aria-live=\"polite\"\n className={cn(\n \"text-xs\",\n copyState === \"failed\"\n ? \"text-destructive\"\n : \"text-muted-foreground\",\n )}\n >\n {copyStatusMessage(copyState)}\n </span>\n </div>\n\n <ErrorDetails diagnostics={diagnostics} />\n </div>\n </main>\n );\n}\n\nfunction errorDiagnostics(\n error: Error,\n componentStack: string | null,\n): ErrorDiagnostics {\n const diagnostics = normalizeErrorDiagnostics(\n error,\n \"An unexpected error was thrown without a message.\",\n );\n if (!diagnostics) {\n throw new Error(\"ErrorWrapper could not normalize the captured error\");\n }\n\n const cause =\n error.cause === undefined\n ? []\n : [[\"cause\", String(error.cause)] as [string, string]];\n const reactStack = componentStack?.trim();\n return {\n ...diagnostics,\n context: [...diagnostics.context, ...cause],\n ...(reactStack\n ? {\n stacktrace: [\n diagnostics.stacktrace,\n \"React component stack:\",\n reactStack,\n ]\n .filter(Boolean)\n .join(\"\\n\\n\"),\n }\n : {}),\n };\n}\n\nfunction errorReport(error: Error, componentStack: string | null) {\n const lines = [\n `Error: ${error.message || \"An unexpected error was thrown without a message.\"}`,\n ];\n if (error.name !== \"Error\") lines.push(`Type: ${error.name}`);\n if (error.cause !== undefined) lines.push(`Cause: ${String(error.cause)}`);\n if (typeof window !== \"undefined\")\n lines.push(`Page: ${window.location.href}`);\n if (typeof navigator !== \"undefined\" && navigator.userAgent) {\n lines.push(`User agent: ${navigator.userAgent}`);\n }\n lines.push(`Time: ${new Date().toISOString()}`);\n if (error.stack) lines.push(\"\", \"Stack trace:\", error.stack);\n if (componentStack?.trim()) {\n lines.push(\"\", \"React component stack:\", componentStack.trim());\n }\n return lines.join(\"\\n\");\n}\n"],"names":["Component","jsx","useState","useMemo","jsxs","Icon","UiWarningTriangle","Button","UiCheck","UiCopy","cn","ErrorDetails","normalizeErrorDiagnostics"],"mappings":";;;;;;;;;;;;;;;AA2BO,MAAM,qBAAqBA,MAAAA,UAGhC;AAAA,EAHK;AAAA;AAII,iCAA2B;AAAA,MAClC,O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|
|
@@ -101,7 +101,7 @@ function ErrorFallback({
|
|
|
101
101
|
onClick: () => void copyDetails(),
|
|
102
102
|
children: [
|
|
103
103
|
/* @__PURE__ */ jsx(Icon, { icon: copyState === "copied" ? UiCheck : UiCopy }),
|
|
104
|
-
copyState === "copied" ? "Copied" : "Copy error
|
|
104
|
+
copyState === "copied" ? "Copied" : "Copy error report"
|
|
105
105
|
]
|
|
106
106
|
}
|
|
107
107
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorWrapper.js","sources":["../../src/components/ErrorWrapper.tsx"],"sourcesContent":["import {\n Component,\n useMemo,\n useState,\n type ErrorInfo,\n type ReactNode,\n} from \"react\";\nimport { ErrorDetails } from \"../data/diagnostics/ErrorDetails\";\nimport {\n normalizeErrorDiagnostics,\n type ErrorDiagnostics,\n} from \"../data/diagnostics/error-diagnostics\";\nimport { Icon } from \"../data/Icon\";\nimport { UiCheck, UiCopy, UiWarningTriangle } from \"../icons\";\nimport { cn } from \"../lib/utils\";\nimport { Button } from \"./button\";\n\nexport type ErrorWrapperProps = {\n children: ReactNode;\n onError?: (error: Error, errorInfo: ErrorInfo) => void;\n};\n\ntype ErrorWrapperState = {\n error: Error | null;\n componentStack: string | null;\n};\n\nexport class ErrorWrapper extends Component<\n ErrorWrapperProps,\n ErrorWrapperState\n> {\n override state: ErrorWrapperState = {\n error: null,\n componentStack: null,\n };\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n this.setState({ componentStack: errorInfo.componentStack ?? null });\n this.props.onError?.(error, errorInfo);\n }\n\n override render() {\n if (this.state.error) {\n return (\n <ErrorFallback\n error={this.state.error}\n componentStack={this.state.componentStack}\n />\n );\n }\n return this.props.children;\n }\n}\n\ntype CopyState = \"idle\" | \"copied\" | \"failed\";\n\nfunction copyStatusMessage(copyState: CopyState): string {\n if (copyState === \"copied\") return \"Error details copied to clipboard.\";\n if (copyState === \"failed\") {\n return \"Clipboard access failed. Expand the error details to copy individual values.\";\n }\n return \"\";\n}\n\nfunction ErrorFallback({\n error,\n componentStack,\n}: {\n error: Error;\n componentStack: string | null;\n}) {\n const [copyState, setCopyState] = useState<CopyState>(\"idle\");\n const diagnostics = useMemo(\n () => errorDiagnostics(error, componentStack),\n [componentStack, error],\n );\n\n const copyDetails = async () => {\n if (!navigator.clipboard?.writeText) {\n setCopyState(\"failed\");\n return;\n }\n try {\n await navigator.clipboard.writeText(errorReport(error, componentStack));\n setCopyState(\"copied\");\n } catch {\n setCopyState(\"failed\");\n }\n };\n\n return (\n <main\n data-slot=\"error-wrapper\"\n role=\"alert\"\n aria-labelledby=\"error-wrapper-title\"\n className=\"flex min-h-dvh w-full items-center justify-center bg-background p-density-6 text-foreground\"\n >\n <div className=\"w-full max-w-3xl\">\n <div className=\"mb-density-4 flex items-start gap-density-3\">\n <span className=\"grid size-12 shrink-0 place-items-center rounded-full bg-destructive/10 text-destructive\">\n <Icon icon={UiWarningTriangle} className=\"size-6\" />\n </span>\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-xs font-semibold uppercase tracking-wide text-destructive\">\n Unexpected application error\n </p>\n <h1\n id=\"error-wrapper-title\"\n className=\"mt-density-1 text-2xl font-semibold tracking-tight\"\n >\n Something went wrong\n </h1>\n <p className=\"mt-density-2 break-words text-sm text-muted-foreground\">\n {diagnostics.message}\n </p>\n </div>\n </div>\n\n <div className=\"mb-density-3 flex items-center gap-density-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => void copyDetails()}\n >\n <Icon icon={copyState === \"copied\" ? UiCheck : UiCopy} />\n {copyState === \"copied\" ? \"Copied\" : \"Copy error
|
|
1
|
+
{"version":3,"file":"ErrorWrapper.js","sources":["../../src/components/ErrorWrapper.tsx"],"sourcesContent":["import {\n Component,\n useMemo,\n useState,\n type ErrorInfo,\n type ReactNode,\n} from \"react\";\nimport { ErrorDetails } from \"../data/diagnostics/ErrorDetails\";\nimport {\n normalizeErrorDiagnostics,\n type ErrorDiagnostics,\n} from \"../data/diagnostics/error-diagnostics\";\nimport { Icon } from \"../data/Icon\";\nimport { UiCheck, UiCopy, UiWarningTriangle } from \"../icons\";\nimport { cn } from \"../lib/utils\";\nimport { Button } from \"./button\";\n\nexport type ErrorWrapperProps = {\n children: ReactNode;\n onError?: (error: Error, errorInfo: ErrorInfo) => void;\n};\n\ntype ErrorWrapperState = {\n error: Error | null;\n componentStack: string | null;\n};\n\nexport class ErrorWrapper extends Component<\n ErrorWrapperProps,\n ErrorWrapperState\n> {\n override state: ErrorWrapperState = {\n error: null,\n componentStack: null,\n };\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n this.setState({ componentStack: errorInfo.componentStack ?? null });\n this.props.onError?.(error, errorInfo);\n }\n\n override render() {\n if (this.state.error) {\n return (\n <ErrorFallback\n error={this.state.error}\n componentStack={this.state.componentStack}\n />\n );\n }\n return this.props.children;\n }\n}\n\ntype CopyState = \"idle\" | \"copied\" | \"failed\";\n\nfunction copyStatusMessage(copyState: CopyState): string {\n if (copyState === \"copied\") return \"Error details copied to clipboard.\";\n if (copyState === \"failed\") {\n return \"Clipboard access failed. Expand the error details to copy individual values.\";\n }\n return \"\";\n}\n\nfunction ErrorFallback({\n error,\n componentStack,\n}: {\n error: Error;\n componentStack: string | null;\n}) {\n const [copyState, setCopyState] = useState<CopyState>(\"idle\");\n const diagnostics = useMemo(\n () => errorDiagnostics(error, componentStack),\n [componentStack, error],\n );\n\n const copyDetails = async () => {\n if (!navigator.clipboard?.writeText) {\n setCopyState(\"failed\");\n return;\n }\n try {\n await navigator.clipboard.writeText(errorReport(error, componentStack));\n setCopyState(\"copied\");\n } catch {\n setCopyState(\"failed\");\n }\n };\n\n return (\n <main\n data-slot=\"error-wrapper\"\n role=\"alert\"\n aria-labelledby=\"error-wrapper-title\"\n className=\"flex min-h-dvh w-full items-center justify-center bg-background p-density-6 text-foreground\"\n >\n <div className=\"w-full max-w-3xl\">\n <div className=\"mb-density-4 flex items-start gap-density-3\">\n <span className=\"grid size-12 shrink-0 place-items-center rounded-full bg-destructive/10 text-destructive\">\n <Icon icon={UiWarningTriangle} className=\"size-6\" />\n </span>\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-xs font-semibold uppercase tracking-wide text-destructive\">\n Unexpected application error\n </p>\n <h1\n id=\"error-wrapper-title\"\n className=\"mt-density-1 text-2xl font-semibold tracking-tight\"\n >\n Something went wrong\n </h1>\n <p className=\"mt-density-2 break-words text-sm text-muted-foreground\">\n {diagnostics.message}\n </p>\n </div>\n </div>\n\n <div className=\"mb-density-3 flex items-center gap-density-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => void copyDetails()}\n >\n <Icon icon={copyState === \"copied\" ? UiCheck : UiCopy} />\n {/* Distinct from ErrorDetails' own \"Copy error details\" control\n below: this copies the page-level report (URL, user agent,\n React component stack), and two identically named buttons in\n one view are ambiguous to assistive tech. */}\n {copyState === \"copied\" ? \"Copied\" : \"Copy error report\"}\n </Button>\n <span\n aria-live=\"polite\"\n className={cn(\n \"text-xs\",\n copyState === \"failed\"\n ? \"text-destructive\"\n : \"text-muted-foreground\",\n )}\n >\n {copyStatusMessage(copyState)}\n </span>\n </div>\n\n <ErrorDetails diagnostics={diagnostics} />\n </div>\n </main>\n );\n}\n\nfunction errorDiagnostics(\n error: Error,\n componentStack: string | null,\n): ErrorDiagnostics {\n const diagnostics = normalizeErrorDiagnostics(\n error,\n \"An unexpected error was thrown without a message.\",\n );\n if (!diagnostics) {\n throw new Error(\"ErrorWrapper could not normalize the captured error\");\n }\n\n const cause =\n error.cause === undefined\n ? []\n : [[\"cause\", String(error.cause)] as [string, string]];\n const reactStack = componentStack?.trim();\n return {\n ...diagnostics,\n context: [...diagnostics.context, ...cause],\n ...(reactStack\n ? {\n stacktrace: [\n diagnostics.stacktrace,\n \"React component stack:\",\n reactStack,\n ]\n .filter(Boolean)\n .join(\"\\n\\n\"),\n }\n : {}),\n };\n}\n\nfunction errorReport(error: Error, componentStack: string | null) {\n const lines = [\n `Error: ${error.message || \"An unexpected error was thrown without a message.\"}`,\n ];\n if (error.name !== \"Error\") lines.push(`Type: ${error.name}`);\n if (error.cause !== undefined) lines.push(`Cause: ${String(error.cause)}`);\n if (typeof window !== \"undefined\")\n lines.push(`Page: ${window.location.href}`);\n if (typeof navigator !== \"undefined\" && navigator.userAgent) {\n lines.push(`User agent: ${navigator.userAgent}`);\n }\n lines.push(`Time: ${new Date().toISOString()}`);\n if (error.stack) lines.push(\"\", \"Stack trace:\", error.stack);\n if (componentStack?.trim()) {\n lines.push(\"\", \"React component stack:\", componentStack.trim());\n }\n return lines.join(\"\\n\");\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AA2BO,MAAM,qBAAqB,UAGhC;AAAA,EAHK;AAAA;AAII,iCAA2B;AAAA,MAClC,OAAO;AAAA,MACP,gBAAgB;AAAA,IAAA;AAAA;AAAA,EAGlB,OAAO,yBAAyB,OAAc;AAC5C,WAAO,EAAE,MAAA;AAAA,EACX;AAAA,EAES,kBAAkB,OAAc,WAAsB;;AAC7D,SAAK,SAAS,EAAE,gBAAgB,UAAU,kBAAkB,MAAM;AAClE,qBAAK,OAAM,YAAX,4BAAqB,OAAO;AAAA,EAC9B;AAAA,EAES,SAAS;AAChB,QAAI,KAAK,MAAM,OAAO;AACpB,aACE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,OAAO,KAAK,MAAM;AAAA,UAClB,gBAAgB,KAAK,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAGjC;AACA,WAAO,KAAK,MAAM;AAAA,EACpB;AACF;AAIA,SAAS,kBAAkB,WAA8B;AACvD,MAAI,cAAc,SAAU,QAAO;AACnC,MAAI,cAAc,UAAU;AAC1B,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,SAAS,cAAc;AAAA,EACrB;AAAA,EACA;AACF,GAGG;AACD,QAAM,CAAC,WAAW,Y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AAC5C,MAAI,OAAO,cAAc,eAAe,UAAU,WAAW;AAC3D,UAAM,KAAK,eAAe,UAAU,SAAS,EAAE;AAAA,EACjD;AACA,QAAM,KAAK,UAAS,oBAAI,QAAO,YAAA,CAAa,EAAE;AAC9C,MAAI,MAAM,MAAO,OAAM,KAAK,IAAI,gBAAgB,MAAM,KAAK;AAC3D,MAAI,iDAAgB,QAAQ;AAC1B,UAAM,KAAK,IAAI,0BAA0B,eAAe,MAAM;AAAA,EAChE;AACA,SAAO,MAAM,KAAK,IAAI;AACxB;"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const react = require("react");
|
|
5
|
+
const IconButton = require("./IconButton.cjs");
|
|
6
|
+
const UiRemove = require("../icons/components/UiRemove.cjs");
|
|
7
|
+
const UiAdd = require("../icons/components/UiAdd.cjs");
|
|
8
|
+
function UnitStepControls({
|
|
9
|
+
label,
|
|
10
|
+
suffix,
|
|
11
|
+
decrease,
|
|
12
|
+
increase,
|
|
13
|
+
schemaReadOnly,
|
|
14
|
+
onChange
|
|
15
|
+
}) {
|
|
16
|
+
const controlsRef = react.useRef(null);
|
|
17
|
+
const [readOnly, setReadOnly] = react.useState(schemaReadOnly);
|
|
18
|
+
react.useLayoutEffect(() => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
const input = (_b = (_a = controlsRef.current) == null ? void 0 : _a.closest("[data-jsf-control]")) == null ? void 0 : _b.querySelector("input[data-jsf-input]");
|
|
21
|
+
setReadOnly(schemaReadOnly || (input == null ? void 0 : input.disabled) === true);
|
|
22
|
+
});
|
|
23
|
+
if (readOnly) {
|
|
24
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { ref: controlsRef, children: suffix });
|
|
25
|
+
}
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { ref: controlsRef, className: "flex items-center gap-1", children: [
|
|
27
|
+
suffix,
|
|
28
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29
|
+
IconButton.IconButton,
|
|
30
|
+
{
|
|
31
|
+
icon: UiRemove.UiRemove,
|
|
32
|
+
label: `Decrease ${label}`,
|
|
33
|
+
className: "size-7",
|
|
34
|
+
iconClassName: "text-base",
|
|
35
|
+
disabled: decrease === null,
|
|
36
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
37
|
+
...decrease !== null ? { onClick: () => onChange(decrease) } : {}
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
41
|
+
IconButton.IconButton,
|
|
42
|
+
{
|
|
43
|
+
icon: UiAdd.UiAdd,
|
|
44
|
+
label: `Increase ${label}`,
|
|
45
|
+
className: "size-7",
|
|
46
|
+
iconClassName: "text-base",
|
|
47
|
+
disabled: increase === null,
|
|
48
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
49
|
+
...increase !== null ? { onClick: () => onChange(increase) } : {}
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
exports.UnitStepControls = UnitStepControls;
|
|
55
|
+
//# sourceMappingURL=UnitStepControls.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnitStepControls.cjs","sources":["../../src/components/UnitStepControls.tsx"],"sourcesContent":["import { useLayoutEffect, useRef, useState, type ReactNode } from \"react\";\nimport { UiAdd, UiRemove } from \"../icons\";\nimport { IconButton } from \"./IconButton\";\n\nexport function UnitStepControls({\n label,\n suffix,\n decrease,\n increase,\n schemaReadOnly,\n onChange,\n}: {\n label: string;\n suffix: ReactNode;\n decrease: string | null;\n increase: string | null;\n schemaReadOnly: boolean;\n onChange: (next: string) => void;\n}) {\n const controlsRef = useRef<HTMLSpanElement>(null);\n const [readOnly, setReadOnly] = useState(schemaReadOnly);\n useLayoutEffect(() => {\n const input = controlsRef.current\n ?.closest(\"[data-jsf-control]\")\n ?.querySelector<HTMLInputElement>(\"input[data-jsf-input]\");\n setReadOnly(schemaReadOnly || input?.disabled === true);\n });\n\n if (readOnly) {\n return <span ref={controlsRef}>{suffix}</span>;\n }\n return (\n <span ref={controlsRef} className=\"flex items-center gap-1\">\n {suffix}\n <IconButton\n icon={UiRemove}\n label={`Decrease ${label}`}\n className=\"size-7\"\n iconClassName=\"text-base\"\n disabled={decrease === null}\n onMouseDown={(event) => event.preventDefault()}\n {...(decrease !== null ? { onClick: () => onChange(decrease) } : {})}\n />\n <IconButton\n icon={UiAdd}\n label={`Increase ${label}`}\n className=\"size-7\"\n iconClassName=\"text-base\"\n disabled={increase === null}\n onMouseDown={(event) => event.preventDefault()}\n {...(increase !== null ? { onClick: () => onChange(increase) } : {})}\n />\n </span>\n );\n}\n"],"names":["useRef","useState","useLayoutEffect","jsx","jsxs","IconButton","UiRemove","UiAdd"],"mappings":";;;;;;;AAIO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAOG;AACD,QAAM,cAAcA,MAAAA,OAAwB,IAAI;AAChD,QAAM,CAAC,UAAU,WAAW,IAAIC,MAAAA,SAAS,cAAc;AACvDC,QAAAA,gBAAgB,MAAM;;AACpB,UAAM,SAAQ,uBAAY,YAAZ,mBACV,QAAQ,0BADE,mBAEV,cAAgC;AACpC,gBAAY,mBAAkB,+BAAO,cAAa,IAAI;AAAA,EACxD,CAAC;AAED,MAAI,UAAU;AACZ,WAAOC,2BAAAA,IAAC,QAAA,EAAK,KAAK,aAAc,UAAA,QAAO;AAAA,EACzC;AACA,SACEC,2BAAAA,KAAC,QAAA,EAAK,KAAK,aAAa,WAAU,2BAC/B,UAAA;AAAA,IAAA;AAAA,IACDD,2BAAAA;AAAAA,MAACE,WAAAA;AAAAA,MAAA;AAAA,QACC,MAAMC,SAAAA;AAAAA,QACN,OAAO,YAAY,KAAK;AAAA,QACxB,WAAU;AAAA,QACV,eAAc;AAAA,QACd,UAAU,aAAa;AAAA,QACvB,aAAa,CAAC,UAAU,MAAM,eAAA;AAAA,QAC7B,GAAI,aAAa,OAAO,EAAE,SAAS,MAAM,SAAS,QAAQ,MAAM,CAAA;AAAA,MAAC;AAAA,IAAA;AAAA,IAEpEH,2BAAAA;AAAAA,MAACE,WAAAA;AAAAA,MAAA;AAAA,QACC,MAAME,MAAAA;AAAAA,QACN,OAAO,YAAY,KAAK;AAAA,QACxB,WAAU;AAAA,QACV,eAAc;AAAA,QACd,UAAU,aAAa;AAAA,QACvB,aAAa,CAAC,UAAU,MAAM,eAAA;AAAA,QAC7B,GAAI,aAAa,OAAO,EAAE,SAAS,MAAM,SAAS,QAAQ,MAAM,CAAA;AAAA,MAAC;AAAA,IAAA;AAAA,EACpE,GACF;AAEJ;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare function UnitStepControls({ label, suffix, decrease, increase, schemaReadOnly, onChange, }: {
|
|
3
|
+
label: string;
|
|
4
|
+
suffix: ReactNode;
|
|
5
|
+
decrease: string | null;
|
|
6
|
+
increase: string | null;
|
|
7
|
+
schemaReadOnly: boolean;
|
|
8
|
+
onChange: (next: string) => void;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=UnitStepControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnitStepControls.d.ts","sourceRoot":"","sources":["../../src/components/UnitStepControls.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI1E,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,2CAoCA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState, useLayoutEffect } from "react";
|
|
3
|
+
import { IconButton } from "./IconButton.js";
|
|
4
|
+
import { UiRemove } from "../icons/components/UiRemove.js";
|
|
5
|
+
import { UiAdd } from "../icons/components/UiAdd.js";
|
|
6
|
+
function UnitStepControls({
|
|
7
|
+
label,
|
|
8
|
+
suffix,
|
|
9
|
+
decrease,
|
|
10
|
+
increase,
|
|
11
|
+
schemaReadOnly,
|
|
12
|
+
onChange
|
|
13
|
+
}) {
|
|
14
|
+
const controlsRef = useRef(null);
|
|
15
|
+
const [readOnly, setReadOnly] = useState(schemaReadOnly);
|
|
16
|
+
useLayoutEffect(() => {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
const input = (_b = (_a = controlsRef.current) == null ? void 0 : _a.closest("[data-jsf-control]")) == null ? void 0 : _b.querySelector("input[data-jsf-input]");
|
|
19
|
+
setReadOnly(schemaReadOnly || (input == null ? void 0 : input.disabled) === true);
|
|
20
|
+
});
|
|
21
|
+
if (readOnly) {
|
|
22
|
+
return /* @__PURE__ */ jsx("span", { ref: controlsRef, children: suffix });
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ jsxs("span", { ref: controlsRef, className: "flex items-center gap-1", children: [
|
|
25
|
+
suffix,
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
IconButton,
|
|
28
|
+
{
|
|
29
|
+
icon: UiRemove,
|
|
30
|
+
label: `Decrease ${label}`,
|
|
31
|
+
className: "size-7",
|
|
32
|
+
iconClassName: "text-base",
|
|
33
|
+
disabled: decrease === null,
|
|
34
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
35
|
+
...decrease !== null ? { onClick: () => onChange(decrease) } : {}
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
IconButton,
|
|
40
|
+
{
|
|
41
|
+
icon: UiAdd,
|
|
42
|
+
label: `Increase ${label}`,
|
|
43
|
+
className: "size-7",
|
|
44
|
+
iconClassName: "text-base",
|
|
45
|
+
disabled: increase === null,
|
|
46
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
47
|
+
...increase !== null ? { onClick: () => onChange(increase) } : {}
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
UnitStepControls
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=UnitStepControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnitStepControls.js","sources":["../../src/components/UnitStepControls.tsx"],"sourcesContent":["import { useLayoutEffect, useRef, useState, type ReactNode } from \"react\";\nimport { UiAdd, UiRemove } from \"../icons\";\nimport { IconButton } from \"./IconButton\";\n\nexport function UnitStepControls({\n label,\n suffix,\n decrease,\n increase,\n schemaReadOnly,\n onChange,\n}: {\n label: string;\n suffix: ReactNode;\n decrease: string | null;\n increase: string | null;\n schemaReadOnly: boolean;\n onChange: (next: string) => void;\n}) {\n const controlsRef = useRef<HTMLSpanElement>(null);\n const [readOnly, setReadOnly] = useState(schemaReadOnly);\n useLayoutEffect(() => {\n const input = controlsRef.current\n ?.closest(\"[data-jsf-control]\")\n ?.querySelector<HTMLInputElement>(\"input[data-jsf-input]\");\n setReadOnly(schemaReadOnly || input?.disabled === true);\n });\n\n if (readOnly) {\n return <span ref={controlsRef}>{suffix}</span>;\n }\n return (\n <span ref={controlsRef} className=\"flex items-center gap-1\">\n {suffix}\n <IconButton\n icon={UiRemove}\n label={`Decrease ${label}`}\n className=\"size-7\"\n iconClassName=\"text-base\"\n disabled={decrease === null}\n onMouseDown={(event) => event.preventDefault()}\n {...(decrease !== null ? { onClick: () => onChange(decrease) } : {})}\n />\n <IconButton\n icon={UiAdd}\n label={`Increase ${label}`}\n className=\"size-7\"\n iconClassName=\"text-base\"\n disabled={increase === null}\n onMouseDown={(event) => event.preventDefault()}\n {...(increase !== null ? { onClick: () => onChange(increase) } : {})}\n />\n </span>\n );\n}\n"],"names":[],"mappings":";;;;;AAIO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAOG;AACD,QAAM,cAAc,OAAwB,IAAI;AAChD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,cAAc;AACvD,kBAAgB,MAAM;;AACpB,UAAM,SAAQ,uBAAY,YAAZ,mBACV,QAAQ,0BADE,mBAEV,cAAgC;AACpC,gBAAY,mBAAkB,+BAAO,cAAa,IAAI;AAAA,EACxD,CAAC;AAED,MAAI,UAAU;AACZ,WAAO,oBAAC,QAAA,EAAK,KAAK,aAAc,UAAA,QAAO;AAAA,EACzC;AACA,SACE,qBAAC,QAAA,EAAK,KAAK,aAAa,WAAU,2BAC/B,UAAA;AAAA,IAAA;AAAA,IACD;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN,OAAO,YAAY,KAAK;AAAA,QACxB,WAAU;AAAA,QACV,eAAc;AAAA,QACd,UAAU,aAAa;AAAA,QACvB,aAAa,CAAC,UAAU,MAAM,eAAA;AAAA,QAC7B,GAAI,aAAa,OAAO,EAAE,SAAS,MAAM,SAAS,QAAQ,MAAM,CAAA;AAAA,MAAC;AAAA,IAAA;AAAA,IAEpE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN,OAAO,YAAY,KAAK;AAAA,QACxB,WAAU;AAAA,QACV,eAAc;AAAA,QACd,UAAU,aAAa;AAAA,QACvB,aAAa,CAAC,UAAU,MAAM,eAAA;AAAA,QAC7B,GAAI,aAAa,OAAO,EAAE,SAAS,MAAM,SAAS,QAAQ,MAAM,CAAA;AAAA,MAAC;AAAA,IAAA;AAAA,EACpE,GACF;AAEJ;"}
|
|
@@ -5,16 +5,12 @@ const react = require("react");
|
|
|
5
5
|
const utils = require("../lib/utils.cjs");
|
|
6
6
|
const Icon = require("../data/Icon.cjs");
|
|
7
7
|
const jsonSchemaFormErrors = require("./json-schema-form-errors.cjs");
|
|
8
|
+
const jsonSchemaFormItemRow = require("./json-schema-form-item-row.cjs");
|
|
8
9
|
const jsonSchemaFormItemSummary = require("./json-schema-form-item-summary.cjs");
|
|
9
10
|
const jsonSchemaFormSize = require("./json-schema-form-size.cjs");
|
|
10
|
-
const jsonSchemaFormTone = require("./json-schema-form-tone.cjs");
|
|
11
11
|
const jsonSchemaFormUtils = require("./json-schema-form-utils.cjs");
|
|
12
12
|
const UiChevronDown = require("../icons/components/UiChevronDown.cjs");
|
|
13
13
|
const UiChevronRight = require("../icons/components/UiChevronRight.cjs");
|
|
14
|
-
const UiAsterisk = require("../icons/components/UiAsterisk.cjs");
|
|
15
|
-
const UiChevronUp = require("../icons/components/UiChevronUp.cjs");
|
|
16
|
-
const UiCopy = require("../icons/components/UiCopy.cjs");
|
|
17
|
-
const UiTrash = require("../icons/components/UiTrash.cjs");
|
|
18
14
|
const UiAdd = require("../icons/components/UiAdd.cjs");
|
|
19
15
|
function AccordionArray({
|
|
20
16
|
field,
|
|
@@ -131,16 +127,16 @@ function AccordionArray({
|
|
|
131
127
|
className: "shrink-0 text-sm text-muted-foreground"
|
|
132
128
|
}
|
|
133
129
|
),
|
|
134
|
-
/* @__PURE__ */ jsxRuntime.jsx(ItemGlyph, { glyph: summary.glyph }),
|
|
130
|
+
/* @__PURE__ */ jsxRuntime.jsx(jsonSchemaFormItemRow.ItemGlyph, { glyph: summary.glyph }),
|
|
135
131
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-sm font-medium", children: summary.title }),
|
|
136
|
-
/* @__PURE__ */ jsxRuntime.jsx(ItemBadge, { badge: summary.badge }),
|
|
137
|
-
summary.flagged && /* @__PURE__ */ jsxRuntime.jsx(RequiredMark, {}),
|
|
132
|
+
/* @__PURE__ */ jsxRuntime.jsx(jsonSchemaFormItemRow.ItemBadge, { badge: summary.badge }),
|
|
133
|
+
summary.flagged && /* @__PURE__ */ jsxRuntime.jsx(jsonSchemaFormItemRow.RequiredMark, {}),
|
|
138
134
|
summary.summary && /* @__PURE__ */ jsxRuntime.jsx("code", { className: "truncate font-mono text-xs text-muted-foreground", children: summary.summary })
|
|
139
135
|
]
|
|
140
136
|
}
|
|
141
137
|
),
|
|
142
138
|
!readOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
143
|
-
ItemRowActions,
|
|
139
|
+
jsonSchemaFormItemRow.ItemRowActions,
|
|
144
140
|
{
|
|
145
141
|
index: i,
|
|
146
142
|
title: summary.title,
|
|
@@ -222,69 +218,5 @@ function AddItemRow({
|
|
|
222
218
|
}
|
|
223
219
|
);
|
|
224
220
|
}
|
|
225
|
-
function ItemGlyph({ glyph }) {
|
|
226
|
-
if (!glyph) return null;
|
|
227
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
228
|
-
"span",
|
|
229
|
-
{
|
|
230
|
-
title: glyph.label,
|
|
231
|
-
className: utils.cn(
|
|
232
|
-
"inline-flex size-6 shrink-0 items-center justify-center rounded-md ring-1 ring-inset",
|
|
233
|
-
jsonSchemaFormTone.TONE_GLYPH_CLASS[glyph.tone]
|
|
234
|
-
),
|
|
235
|
-
children: glyph.icon != null && /* @__PURE__ */ jsxRuntime.jsx(Icon.LabelIcon, { icon: glyph.icon, className: "text-[13px]" })
|
|
236
|
-
}
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
function ItemBadge({ badge }) {
|
|
240
|
-
if (!badge) return null;
|
|
241
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full border border-border px-2 py-0.5 text-[11px] text-muted-foreground", children: [
|
|
242
|
-
badge.icon != null && /* @__PURE__ */ jsxRuntime.jsx(Icon.LabelIcon, { icon: badge.icon, className: "text-[13px]" }),
|
|
243
|
-
badge.label
|
|
244
|
-
] });
|
|
245
|
-
}
|
|
246
|
-
function RequiredMark() {
|
|
247
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { title: "Required", className: "inline-flex shrink-0 items-center text-destructive", children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { icon: UiAsterisk.UiAsterisk, className: "text-[11px]" }) });
|
|
248
|
-
}
|
|
249
|
-
function ItemRowActions({
|
|
250
|
-
index,
|
|
251
|
-
title,
|
|
252
|
-
size,
|
|
253
|
-
onUp,
|
|
254
|
-
onDown,
|
|
255
|
-
onDuplicate,
|
|
256
|
-
onRemove
|
|
257
|
-
}) {
|
|
258
|
-
const action = utils.cn(
|
|
259
|
-
"inline-flex aspect-square items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-30",
|
|
260
|
-
jsonSchemaFormSize.controlHeightClass[size]
|
|
261
|
-
);
|
|
262
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100", children: [
|
|
263
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": `Move ${title} up`, disabled: !onUp, className: action, onClick: onUp, children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { icon: UiChevronUp.UiChevronUp, className: "text-sm" }) }),
|
|
264
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
265
|
-
"button",
|
|
266
|
-
{
|
|
267
|
-
type: "button",
|
|
268
|
-
"aria-label": `Move ${title} down`,
|
|
269
|
-
disabled: !onDown,
|
|
270
|
-
className: action,
|
|
271
|
-
onClick: onDown,
|
|
272
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { icon: UiChevronDown.UiChevronDown, className: "text-sm" })
|
|
273
|
-
}
|
|
274
|
-
),
|
|
275
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": `Duplicate ${title}`, className: action, onClick: onDuplicate, children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { icon: UiCopy.UiCopy, className: "text-sm" }) }),
|
|
276
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
277
|
-
"button",
|
|
278
|
-
{
|
|
279
|
-
type: "button",
|
|
280
|
-
"aria-label": `Remove ${title}`,
|
|
281
|
-
className: utils.cn(action, "hover:bg-destructive/10 hover:text-destructive"),
|
|
282
|
-
onClick: onRemove,
|
|
283
|
-
"data-item-index": index,
|
|
284
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { icon: UiTrash.UiTrash, className: "text-sm" })
|
|
285
|
-
}
|
|
286
|
-
)
|
|
287
|
-
] });
|
|
288
|
-
}
|
|
289
221
|
exports.AccordionArray = AccordionArray;
|
|
290
222
|
//# sourceMappingURL=json-schema-form-accordion-array.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-accordion-array.cjs","sources":["../../src/components/json-schema-form-accordion-array.tsx"],"sourcesContent":["import {\n useEffect,\n useRef,\n useState,\n type KeyboardEvent,\n type MutableRefObject,\n} from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { Icon, LabelIcon } from \"../data/Icon\";\nimport {\n UiAdd,\n UiAsterisk,\n UiChevronDown,\n UiChevronRight,\n UiChevronUp,\n UiCopy,\n UiTrash,\n} from \"../icons\";\nimport { appendInstancePath } from \"./json-schema-form-errors\";\nimport {\n addItemLabel,\n emptyItemsCopy,\n itemCountLabel,\n itemSummaryFor,\n noItemsLabel,\n resolveItemSpec,\n} from \"./json-schema-form-item-summary\";\nimport { controlHeightClass, labelSizeClass, type FormSize } from \"./json-schema-form-size\";\nimport { TONE_GLYPH_CLASS } from \"./json-schema-form-tone\";\nimport {\n duplicateIndex,\n fieldInputId,\n moveItem,\n removeIndex,\n seedFromSchema,\n setIndex,\n} from \"./json-schema-form-utils\";\nimport type {\n ArrayItemSummary,\n FieldControl,\n RenderContext,\n} from \"./json-schema-form-types\";\n\n// AccordionArray renders an object-item array as a list of one-line summary\n// rows, expanding one at a time into the item's own sub-form. It exists because\n// a ten-property item stacked in full costs ~700px of screen each, and a list of\n// them says nothing about which item is which.\n//\n// \"Add\" is the list's own last row rather than a button beside it: the\n// affordance sits exactly where the next item will appear, and at zero items\n// that same row IS the empty state — one control, no separate screen.\nexport function AccordionArray({\n field,\n ctx,\n readOnly,\n}: {\n field: FieldControl;\n ctx: RenderContext;\n readOnly: boolean;\n}) {\n const items = Array.isArray(field.value) ? field.value : [];\n const itemSchema = field.itemSchema ?? { type: \"object\" };\n const spec = field.itemSpec ?? resolveItemSpec(field.schema, itemSchema);\n const emptyCopy = emptyItemsCopy(spec, field.schema);\n // The array's help mode governs its whole subtree. Without this the fields\n // inside an expanded row keep the form-level default, so an accordion that\n // resolved to \"hover\" would still stack a two-line paragraph under every\n // control — the exact height the summary rows exist to reclaim.\n const childCtx: RenderContext = {\n ...ctx,\n readOnly,\n depth: ctx.depth + 1,\n ...(field.helpDisplay\n ? { layout: { ...ctx.layout, help: field.helpDisplay } }\n : {}),\n };\n\n // Which row is open is transient view state, like the form's field filter —\n // it is deliberately local and never persisted. The INDEX is the key, not the\n // item: every keystroke replaces the item object (setIndex returns a fresh\n // one), so any identity-based map would die on the first character typed.\n // That makes it the mutators' job to keep this pointing at the same row.\n const [expanded, setExpanded] = useState<number | null>(null);\n const rowRefs = useRef<Array<HTMLButtonElement | null>>([]);\n const addRef = useRef<HTMLButtonElement | null>(null);\n const pendingFocus = useRef<{ kind: \"panel\" | \"row\" | \"add\"; index: number } | null>(null);\n\n useEffect(() => {\n const pending = pendingFocus.current;\n if (!pending) return;\n pendingFocus.current = null;\n if (pending.kind === \"add\") {\n addRef.current?.focus();\n return;\n }\n const row = rowRefs.current[pending.index];\n if (pending.kind === \"row\") {\n row?.focus();\n return;\n }\n // Land in the new item's first editable control, so adding an item leaves\n // the caret where the author is about to type.\n const panel = document.getElementById(panelId(pending.index));\n const input = panel?.querySelector<HTMLElement>(\"[data-jsf-input]\");\n (input ?? row)?.focus();\n });\n\n function panelId(index: number): string {\n return `${fieldInputId(appendInstancePath(ctx.instancePath, index), ctx.idPrefix)}-panel`;\n }\n function headerId(index: number): string {\n return `${fieldInputId(appendInstancePath(ctx.instancePath, index), ctx.idPrefix)}-header`;\n }\n\n function commit(next: unknown[]) {\n field.onChange(next);\n }\n\n function add() {\n pendingFocus.current = { kind: \"panel\", index: items.length };\n setExpanded(items.length);\n commit([...items, seedFromSchema(itemSchema)]);\n }\n\n function remove(index: number) {\n setExpanded((open) => (open === index ? null : open !== null && open > index ? open - 1 : open));\n pendingFocus.current =\n items.length === 1 ? { kind: \"add\", index: 0 } : { kind: \"row\", index: Math.max(index - 1, 0) };\n commit(removeIndex(items, index));\n }\n\n function duplicate(index: number) {\n setExpanded((open) => (open !== null && open > index ? open + 1 : open));\n pendingFocus.current = { kind: \"row\", index: index + 1 };\n commit(duplicateIndex(items, index));\n }\n\n function move(index: number, to: number) {\n // Follow the item, not the slot — otherwise moving an open row silently\n // expands whichever row took its place.\n setExpanded((open) => (open === index ? to : open === to ? index : open));\n pendingFocus.current = { kind: \"row\", index: to };\n commit(moveItem(items, index, to));\n }\n\n // Roving focus across the headers, with the add row as the final stop.\n function handleKeyDown(e: KeyboardEvent<HTMLButtonElement>, index: number) {\n const stops = rowRefs.current.length;\n const focusAt = (i: number) => {\n e.preventDefault();\n (i >= stops ? addRef.current : rowRefs.current[i])?.focus();\n };\n if (e.key === \"ArrowDown\") focusAt(Math.min(index + 1, stops));\n else if (e.key === \"ArrowUp\" && index > 0) focusAt(index - 1);\n else if (e.key === \"Home\") focusAt(0);\n else if (e.key === \"End\") focusAt(stops);\n }\n\n return (\n <div className=\"flex flex-col gap-2\">\n <p className={cn(\"text-muted-foreground\", labelSizeClass[ctx.size])}>\n {items.length === 0 ? noItemsLabel(spec) : itemCountLabel(spec, items.length)}\n </p>\n <div className=\"divide-y divide-border rounded-lg border border-border\">\n {items.map((item, i) => {\n const open = expanded === i;\n const summary =\n field.itemSummary?.({ item, index: i }) ??\n itemSummaryFor({ item, index: i, spec, itemSchema });\n return (\n <div key={i} className=\"group\">\n {/* The row is a plain element, NOT a button: the actions beside it\n are buttons, and nesting interactive content is invalid DOM\n with undefined click targeting. Only the disclosure toggles. */}\n <div\n className={cn(\n \"flex w-full items-center gap-2 px-3 py-2 hover:bg-accent/40\",\n open && \"bg-accent/30\",\n )}\n >\n <button\n type=\"button\"\n id={headerId(i)}\n aria-expanded={open}\n aria-controls={panelId(i)}\n ref={(el) => {\n rowRefs.current[i] = el;\n }}\n onKeyDown={(e) => handleKeyDown(e, i)}\n onClick={() => setExpanded(open ? null : i)}\n className=\"flex min-w-0 flex-1 items-center gap-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Icon\n icon={open ? UiChevronDown : UiChevronRight}\n className=\"shrink-0 text-sm text-muted-foreground\"\n />\n <ItemGlyph glyph={summary.glyph} />\n <span className=\"shrink-0 text-sm font-medium\">{summary.title}</span>\n <ItemBadge badge={summary.badge} />\n {summary.flagged && <RequiredMark />}\n {summary.summary && (\n <code className=\"truncate font-mono text-xs text-muted-foreground\">\n {summary.summary}\n </code>\n )}\n </button>\n {!readOnly && (\n <ItemRowActions\n index={i}\n title={summary.title}\n size={ctx.size}\n {...(i > 0 ? { onUp: () => move(i, i - 1) } : {})}\n {...(i < items.length - 1 ? { onDown: () => move(i, i + 1) } : {})}\n onDuplicate={() => duplicate(i)}\n onRemove={() => remove(i)}\n />\n )}\n </div>\n {open && (\n <div\n id={panelId(i)}\n role=\"region\"\n aria-labelledby={headerId(i)}\n className=\"border-t border-border bg-muted/20 p-3\"\n >\n {/* Recurse through the shared pipeline so consumer pre/post\n extensions still apply to the item and its properties. */}\n {ctx.render.renderFieldNodes(\n {\n key: `${field.key}[${i}]`,\n prop: itemSchema,\n required: false,\n value: item,\n onChange: (next) => commit(setIndex(items, i, next)),\n instancePath: appendInstancePath(ctx.instancePath, i),\n },\n childCtx,\n )?.value ?? null}\n </div>\n )}\n </div>\n );\n })}\n {!readOnly && (\n <AddItemRow\n buttonRef={addRef}\n label={addItemLabel(spec)}\n empty={items.length === 0}\n onAdd={add}\n onKeyDown={(e) => handleKeyDown(e, items.length)}\n {...(emptyCopy ? { copy: emptyCopy } : {})}\n />\n )}\n </div>\n </div>\n );\n}\n\n// AddItemRow is the list's own final row. At zero items it grows to carry the\n// schema's explanation of what an item is — so the empty state is the same\n// control the author will use, not a separate screen they have to leave.\nfunction AddItemRow({\n label,\n copy,\n empty,\n onAdd,\n onKeyDown,\n buttonRef,\n}: {\n label: string;\n copy?: string;\n empty: boolean;\n onAdd: () => void;\n onKeyDown: (e: KeyboardEvent<HTMLButtonElement>) => void;\n buttonRef: MutableRefObject<HTMLButtonElement | null>;\n}) {\n return (\n <button\n type=\"button\"\n ref={(el) => {\n buttonRef.current = el;\n }}\n onClick={onAdd}\n onKeyDown={onKeyDown}\n className={cn(\n \"group/add flex w-full items-center gap-2 px-3 py-2 text-left text-muted-foreground hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\",\n empty && \"items-start py-5\",\n )}\n >\n {/* Holds the chevron column, so this row lines up with the ones above it. */}\n <Icon icon={UiChevronRight} className=\"shrink-0 text-sm opacity-0\" />\n <span className=\"inline-flex size-6 shrink-0 items-center justify-center rounded-md border border-dashed border-border text-foreground/60 group-hover/add:border-primary group-hover/add:text-primary\">\n <Icon icon={UiAdd} className=\"text-[13px]\" />\n </span>\n <span className=\"flex min-w-0 flex-col gap-0.5\">\n <span className=\"text-sm font-medium text-foreground\">{label}</span>\n {copy && (\n <span className={cn(\"text-xs\", empty ? \"max-w-xl leading-snug\" : \"truncate\")}>{copy}</span>\n )}\n </span>\n </button>\n );\n}\n\nfunction ItemGlyph({ glyph }: { glyph?: ArrayItemSummary[\"glyph\"] }) {\n if (!glyph) return null;\n return (\n <span\n title={glyph.label}\n className={cn(\n \"inline-flex size-6 shrink-0 items-center justify-center rounded-md ring-1 ring-inset\",\n TONE_GLYPH_CLASS[glyph.tone],\n )}\n >\n {glyph.icon != null && <LabelIcon icon={glyph.icon} className=\"text-[13px]\" />}\n </span>\n );\n}\n\nfunction ItemBadge({ badge }: { badge?: ArrayItemSummary[\"badge\"] }) {\n if (!badge) return null;\n return (\n <span className=\"inline-flex shrink-0 items-center gap-1 rounded-full border border-border px-2 py-0.5 text-[11px] text-muted-foreground\">\n {badge.icon != null && <LabelIcon icon={badge.icon} className=\"text-[13px]\" />}\n {badge.label}\n </span>\n );\n}\n\nfunction RequiredMark() {\n return (\n <span title=\"Required\" className=\"inline-flex shrink-0 items-center text-destructive\">\n <Icon icon={UiAsterisk} className=\"text-[11px]\" />\n </span>\n );\n}\n\nfunction ItemRowActions({\n index,\n title,\n size,\n onUp,\n onDown,\n onDuplicate,\n onRemove,\n}: {\n index: number;\n title: string;\n size: FormSize;\n onUp?: () => void;\n onDown?: () => void;\n onDuplicate: () => void;\n onRemove: () => void;\n}) {\n // Hidden until the row is hovered or something inside it takes focus, so a\n // long list is not a wall of permanently dim icons — but keyboard users see\n // them the moment they arrive.\n const action = cn(\n \"inline-flex aspect-square items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-30\",\n controlHeightClass[size],\n );\n return (\n <div className=\"ml-auto flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100\">\n <button type=\"button\" aria-label={`Move ${title} up`} disabled={!onUp} className={action} onClick={onUp}>\n <Icon icon={UiChevronUp} className=\"text-sm\" />\n </button>\n <button\n type=\"button\"\n aria-label={`Move ${title} down`}\n disabled={!onDown}\n className={action}\n onClick={onDown}\n >\n <Icon icon={UiChevronDown} className=\"text-sm\" />\n </button>\n <button type=\"button\" aria-label={`Duplicate ${title}`} className={action} onClick={onDuplicate}>\n <Icon icon={UiCopy} className=\"text-sm\" />\n </button>\n <button\n type=\"button\"\n aria-label={`Remove ${title}`}\n className={cn(action, \"hover:bg-destructive/10 hover:text-destructive\")}\n onClick={onRemove}\n data-item-index={index}\n >\n <Icon icon={UiTrash} className=\"text-sm\" />\n </button>\n </div>\n );\n}\n"],"names":["resolveItemSpec","emptyItemsCopy","useState","useRef","useEffect","fieldInputId","appendInstancePath","seedFromSchema","removeIndex","duplicateIndex","moveItem","jsxs","jsx","cn","labelSizeClass","noItemsLabel","itemCountLabel","itemSummaryFor","Icon","UiChevronDown","UiChevronRight","setIndex","addItemLabel","UiAdd","TONE_GLYPH_CLASS","LabelIcon","UiAsterisk","controlHeightClass","UiChevronUp","UiCopy","UiTrash"],"mappings":";;;;;;;;;;;;;;;;;;AAmDO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,QAAM,QAAQ,MAAM,QAAQ,MAAM,KAAK,IAAI,MAAM,QAAQ,CAAA;AACzD,QAAM,aAAa,MAAM,cAAc,EAAE,MAAM,SAAA;AAC/C,QAAM,OAAO,MAAM,YAAYA,0BAAAA,gBAAgB,MAAM,QAAQ,UAAU;AACvE,QAAM,YAAYC,0BAAAA,eAAe,MAAM,MAAM,MAAM;AAKnD,QAAM,WAA0B;AAAA,IAC9B,GAAG;AAAA,IACH;AAAA,IACA,OAAO,IAAI,QAAQ;AAAA,IACnB,GAAI,MAAM,cACN,EAAE,QAAQ,EAAE,GAAG,IAAI,QAAQ,MAAM,MAAM,YAAA,EAAY,IACnD,CAAA;AAAA,EAAC;AAQP,QAAM,CAAC,UAAU,WAAW,IAAIC,MAAAA,SAAwB,IAAI;AAC5D,QAAM,UAAUC,MAAAA,OAAwC,EAAE;AAC1D,QAAM,SAASA,MAAAA,OAAiC,IAAI;AACpD,QAAM,eAAeA,MAAAA,OAAgE,IAAI;AAEzFC,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K,UAAS,cAAY,aAAa,KAAK,IAAI,WAAW,QAAQ,SAAS,aAClF,UAAAP,2BAAAA,IAACM,WAAA,EAAK,MAAMW,OAAAA,QAAQ,WAAU,WAAU,GAC1C;AAAA,IACAjB,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,cAAY,UAAU,KAAK;AAAA,QAC3B,WAAWC,MAAAA,GAAG,QAAQ,gDAAgD;AAAA,QACtE,SAAS;AAAA,QACT,mBAAiB;AAAA,QAEjB,UAAAD,2BAAAA,IAACM,WAAA,EAAK,MAAMY,QAAAA,SAAS,WAAU,UAAA,CAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAC3C,GACF;AAEJ;;"}
|
|
1
|
+
{"version":3,"file":"json-schema-form-accordion-array.cjs","sources":["../../src/components/json-schema-form-accordion-array.tsx"],"sourcesContent":["import {\n useEffect,\n useRef,\n useState,\n type KeyboardEvent,\n type MutableRefObject,\n} from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { Icon } from \"../data/Icon\";\nimport { UiAdd, UiChevronDown, UiChevronRight } from \"../icons\";\nimport { appendInstancePath } from \"./json-schema-form-errors\";\nimport {\n ItemBadge,\n ItemGlyph,\n ItemRowActions,\n RequiredMark,\n} from \"./json-schema-form-item-row\";\nimport {\n addItemLabel,\n emptyItemsCopy,\n itemCountLabel,\n itemSummaryFor,\n noItemsLabel,\n resolveItemSpec,\n} from \"./json-schema-form-item-summary\";\nimport { labelSizeClass } from \"./json-schema-form-size\";\nimport {\n duplicateIndex,\n fieldInputId,\n moveItem,\n removeIndex,\n seedFromSchema,\n setIndex,\n} from \"./json-schema-form-utils\";\nimport type { FieldControl, RenderContext } from \"./json-schema-form-types\";\n\n// AccordionArray renders an object-item array as a list of one-line summary\n// rows, expanding one at a time into the item's own sub-form. It exists because\n// a ten-property item stacked in full costs ~700px of screen each, and a list of\n// them says nothing about which item is which.\n//\n// \"Add\" is the list's own last row rather than a button beside it: the\n// affordance sits exactly where the next item will appear, and at zero items\n// that same row IS the empty state — one control, no separate screen.\nexport function AccordionArray({\n field,\n ctx,\n readOnly,\n}: {\n field: FieldControl;\n ctx: RenderContext;\n readOnly: boolean;\n}) {\n const items = Array.isArray(field.value) ? field.value : [];\n const itemSchema = field.itemSchema ?? { type: \"object\" };\n const spec = field.itemSpec ?? resolveItemSpec(field.schema, itemSchema);\n const emptyCopy = emptyItemsCopy(spec, field.schema);\n // The array's help mode governs its whole subtree. Without this the fields\n // inside an expanded row keep the form-level default, so an accordion that\n // resolved to \"hover\" would still stack a two-line paragraph under every\n // control — the exact height the summary rows exist to reclaim.\n const childCtx: RenderContext = {\n ...ctx,\n readOnly,\n depth: ctx.depth + 1,\n ...(field.helpDisplay\n ? { layout: { ...ctx.layout, help: field.helpDisplay } }\n : {}),\n };\n\n // Which row is open is transient view state, like the form's field filter —\n // it is deliberately local and never persisted. The INDEX is the key, not the\n // item: every keystroke replaces the item object (setIndex returns a fresh\n // one), so any identity-based map would die on the first character typed.\n // That makes it the mutators' job to keep this pointing at the same row.\n const [expanded, setExpanded] = useState<number | null>(null);\n const rowRefs = useRef<Array<HTMLButtonElement | null>>([]);\n const addRef = useRef<HTMLButtonElement | null>(null);\n const pendingFocus = useRef<{ kind: \"panel\" | \"row\" | \"add\"; index: number } | null>(null);\n\n useEffect(() => {\n const pending = pendingFocus.current;\n if (!pending) return;\n pendingFocus.current = null;\n if (pending.kind === \"add\") {\n addRef.current?.focus();\n return;\n }\n const row = rowRefs.current[pending.index];\n if (pending.kind === \"row\") {\n row?.focus();\n return;\n }\n // Land in the new item's first editable control, so adding an item leaves\n // the caret where the author is about to type.\n const panel = document.getElementById(panelId(pending.index));\n const input = panel?.querySelector<HTMLElement>(\"[data-jsf-input]\");\n (input ?? row)?.focus();\n });\n\n function panelId(index: number): string {\n return `${fieldInputId(appendInstancePath(ctx.instancePath, index), ctx.idPrefix)}-panel`;\n }\n function headerId(index: number): string {\n return `${fieldInputId(appendInstancePath(ctx.instancePath, index), ctx.idPrefix)}-header`;\n }\n\n function commit(next: unknown[]) {\n field.onChange(next);\n }\n\n function add() {\n pendingFocus.current = { kind: \"panel\", index: items.length };\n setExpanded(items.length);\n commit([...items, seedFromSchema(itemSchema)]);\n }\n\n function remove(index: number) {\n setExpanded((open) => (open === index ? null : open !== null && open > index ? open - 1 : open));\n pendingFocus.current =\n items.length === 1 ? { kind: \"add\", index: 0 } : { kind: \"row\", index: Math.max(index - 1, 0) };\n commit(removeIndex(items, index));\n }\n\n function duplicate(index: number) {\n setExpanded((open) => (open !== null && open > index ? open + 1 : open));\n pendingFocus.current = { kind: \"row\", index: index + 1 };\n commit(duplicateIndex(items, index));\n }\n\n function move(index: number, to: number) {\n // Follow the item, not the slot — otherwise moving an open row silently\n // expands whichever row took its place.\n setExpanded((open) => (open === index ? to : open === to ? index : open));\n pendingFocus.current = { kind: \"row\", index: to };\n commit(moveItem(items, index, to));\n }\n\n // Roving focus across the headers, with the add row as the final stop.\n function handleKeyDown(e: KeyboardEvent<HTMLButtonElement>, index: number) {\n const stops = rowRefs.current.length;\n const focusAt = (i: number) => {\n e.preventDefault();\n (i >= stops ? addRef.current : rowRefs.current[i])?.focus();\n };\n if (e.key === \"ArrowDown\") focusAt(Math.min(index + 1, stops));\n else if (e.key === \"ArrowUp\" && index > 0) focusAt(index - 1);\n else if (e.key === \"Home\") focusAt(0);\n else if (e.key === \"End\") focusAt(stops);\n }\n\n return (\n <div className=\"flex flex-col gap-2\">\n <p className={cn(\"text-muted-foreground\", labelSizeClass[ctx.size])}>\n {items.length === 0 ? noItemsLabel(spec) : itemCountLabel(spec, items.length)}\n </p>\n <div className=\"divide-y divide-border rounded-lg border border-border\">\n {items.map((item, i) => {\n const open = expanded === i;\n const summary =\n field.itemSummary?.({ item, index: i }) ??\n itemSummaryFor({ item, index: i, spec, itemSchema });\n return (\n <div key={i} className=\"group\">\n {/* The row is a plain element, NOT a button: the actions beside it\n are buttons, and nesting interactive content is invalid DOM\n with undefined click targeting. Only the disclosure toggles. */}\n <div\n className={cn(\n \"flex w-full items-center gap-2 px-3 py-2 hover:bg-accent/40\",\n open && \"bg-accent/30\",\n )}\n >\n <button\n type=\"button\"\n id={headerId(i)}\n aria-expanded={open}\n aria-controls={panelId(i)}\n ref={(el) => {\n rowRefs.current[i] = el;\n }}\n onKeyDown={(e) => handleKeyDown(e, i)}\n onClick={() => setExpanded(open ? null : i)}\n className=\"flex min-w-0 flex-1 items-center gap-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Icon\n icon={open ? UiChevronDown : UiChevronRight}\n className=\"shrink-0 text-sm text-muted-foreground\"\n />\n <ItemGlyph glyph={summary.glyph} />\n <span className=\"shrink-0 text-sm font-medium\">{summary.title}</span>\n <ItemBadge badge={summary.badge} />\n {summary.flagged && <RequiredMark />}\n {summary.summary && (\n <code className=\"truncate font-mono text-xs text-muted-foreground\">\n {summary.summary}\n </code>\n )}\n </button>\n {!readOnly && (\n <ItemRowActions\n index={i}\n title={summary.title}\n size={ctx.size}\n {...(i > 0 ? { onUp: () => move(i, i - 1) } : {})}\n {...(i < items.length - 1 ? { onDown: () => move(i, i + 1) } : {})}\n onDuplicate={() => duplicate(i)}\n onRemove={() => remove(i)}\n />\n )}\n </div>\n {open && (\n <div\n id={panelId(i)}\n role=\"region\"\n aria-labelledby={headerId(i)}\n className=\"border-t border-border bg-muted/20 p-3\"\n >\n {/* Recurse through the shared pipeline so consumer pre/post\n extensions still apply to the item and its properties. */}\n {ctx.render.renderFieldNodes(\n {\n key: `${field.key}[${i}]`,\n prop: itemSchema,\n required: false,\n value: item,\n onChange: (next) => commit(setIndex(items, i, next)),\n instancePath: appendInstancePath(ctx.instancePath, i),\n },\n childCtx,\n )?.value ?? null}\n </div>\n )}\n </div>\n );\n })}\n {!readOnly && (\n <AddItemRow\n buttonRef={addRef}\n label={addItemLabel(spec)}\n empty={items.length === 0}\n onAdd={add}\n onKeyDown={(e) => handleKeyDown(e, items.length)}\n {...(emptyCopy ? { copy: emptyCopy } : {})}\n />\n )}\n </div>\n </div>\n );\n}\n\n// AddItemRow is the list's own final row. At zero items it grows to carry the\n// schema's explanation of what an item is — so the empty state is the same\n// control the author will use, not a separate screen they have to leave.\nfunction AddItemRow({\n label,\n copy,\n empty,\n onAdd,\n onKeyDown,\n buttonRef,\n}: {\n label: string;\n copy?: string;\n empty: boolean;\n onAdd: () => void;\n onKeyDown: (e: KeyboardEvent<HTMLButtonElement>) => void;\n buttonRef: MutableRefObject<HTMLButtonElement | null>;\n}) {\n return (\n <button\n type=\"button\"\n ref={(el) => {\n buttonRef.current = el;\n }}\n onClick={onAdd}\n onKeyDown={onKeyDown}\n className={cn(\n \"group/add flex w-full items-center gap-2 px-3 py-2 text-left text-muted-foreground hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\",\n empty && \"items-start py-5\",\n )}\n >\n {/* Holds the chevron column, so this row lines up with the ones above it. */}\n <Icon icon={UiChevronRight} className=\"shrink-0 text-sm opacity-0\" />\n <span className=\"inline-flex size-6 shrink-0 items-center justify-center rounded-md border border-dashed border-border text-foreground/60 group-hover/add:border-primary group-hover/add:text-primary\">\n <Icon icon={UiAdd} className=\"text-[13px]\" />\n </span>\n <span className=\"flex min-w-0 flex-col gap-0.5\">\n <span className=\"text-sm font-medium text-foreground\">{label}</span>\n {copy && (\n <span className={cn(\"text-xs\", empty ? \"max-w-xl leading-snug\" : \"truncate\")}>{copy}</span>\n )}\n </span>\n </button>\n );\n}\n"],"names":["resolveItemSpec","emptyItemsCopy","useState","useRef","useEffect","fieldInputId","appendInstancePath","seedFromSchema","removeIndex","duplicateIndex","moveItem","jsxs","jsx","cn","labelSizeClass","noItemsLabel","itemCountLabel","itemSummaryFor","Icon","UiChevronDown","UiChevronRight","ItemGlyph","ItemBadge","RequiredMark","ItemRowActions","setIndex","addItemLabel","UiAdd"],"mappings":";;;;;;;;;;;;;;AA4CO,SAAS,eAAe;AAAA,EAC7B;A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,2BAAAA,IAACM,aAAK,MAAMS,MAAAA,OAAO,WAAU,cAAA,CAAc,EAAA,CAC7C;AAAA,QACAhB,2BAAAA,KAAC,QAAA,EAAK,WAAU,iCACd,UAAA;AAAA,UAAAC,2BAAAA,IAAC,QAAA,EAAK,WAAU,uCAAuC,UAAA,OAAM;AAAA,UAC5D,QACCA,2BAAAA,IAAC,QAAA,EAAK,WAAWC,MAAAA,GAAG,WAAW,QAAQ,0BAA0B,UAAU,GAAI,UAAA,KAAA,CAAK;AAAA,QAAA,EAAA,CAExF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-accordion-array.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-accordion-array.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-schema-form-accordion-array.d.ts","sourceRoot":"","sources":["../../src/components/json-schema-form-accordion-array.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAU5E,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,GAAG,EACH,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,GAAG,EAAE,aAAa,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB,2CAqMA"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useEffect } from "react";
|
|
3
3
|
import { cn } from "../lib/utils.js";
|
|
4
|
-
import { Icon
|
|
4
|
+
import { Icon } from "../data/Icon.js";
|
|
5
5
|
import { appendInstancePath } from "./json-schema-form-errors.js";
|
|
6
|
+
import { ItemGlyph, ItemBadge, RequiredMark, ItemRowActions } from "./json-schema-form-item-row.js";
|
|
6
7
|
import { resolveItemSpec, emptyItemsCopy, noItemsLabel, itemCountLabel, itemSummaryFor, addItemLabel } from "./json-schema-form-item-summary.js";
|
|
7
|
-
import { labelSizeClass
|
|
8
|
-
import { TONE_GLYPH_CLASS } from "./json-schema-form-tone.js";
|
|
8
|
+
import { labelSizeClass } from "./json-schema-form-size.js";
|
|
9
9
|
import { fieldInputId, setIndex, removeIndex, duplicateIndex, moveItem, seedFromSchema } from "./json-schema-form-utils.js";
|
|
10
10
|
import { UiChevronDown } from "../icons/components/UiChevronDown.js";
|
|
11
11
|
import { UiChevronRight } from "../icons/components/UiChevronRight.js";
|
|
12
|
-
import { UiAsterisk } from "../icons/components/UiAsterisk.js";
|
|
13
|
-
import { UiChevronUp } from "../icons/components/UiChevronUp.js";
|
|
14
|
-
import { UiCopy } from "../icons/components/UiCopy.js";
|
|
15
|
-
import { UiTrash } from "../icons/components/UiTrash.js";
|
|
16
12
|
import { UiAdd } from "../icons/components/UiAdd.js";
|
|
17
13
|
function AccordionArray({
|
|
18
14
|
field,
|
|
@@ -220,70 +216,6 @@ function AddItemRow({
|
|
|
220
216
|
}
|
|
221
217
|
);
|
|
222
218
|
}
|
|
223
|
-
function ItemGlyph({ glyph }) {
|
|
224
|
-
if (!glyph) return null;
|
|
225
|
-
return /* @__PURE__ */ jsx(
|
|
226
|
-
"span",
|
|
227
|
-
{
|
|
228
|
-
title: glyph.label,
|
|
229
|
-
className: cn(
|
|
230
|
-
"inline-flex size-6 shrink-0 items-center justify-center rounded-md ring-1 ring-inset",
|
|
231
|
-
TONE_GLYPH_CLASS[glyph.tone]
|
|
232
|
-
),
|
|
233
|
-
children: glyph.icon != null && /* @__PURE__ */ jsx(LabelIcon, { icon: glyph.icon, className: "text-[13px]" })
|
|
234
|
-
}
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
function ItemBadge({ badge }) {
|
|
238
|
-
if (!badge) return null;
|
|
239
|
-
return /* @__PURE__ */ jsxs("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full border border-border px-2 py-0.5 text-[11px] text-muted-foreground", children: [
|
|
240
|
-
badge.icon != null && /* @__PURE__ */ jsx(LabelIcon, { icon: badge.icon, className: "text-[13px]" }),
|
|
241
|
-
badge.label
|
|
242
|
-
] });
|
|
243
|
-
}
|
|
244
|
-
function RequiredMark() {
|
|
245
|
-
return /* @__PURE__ */ jsx("span", { title: "Required", className: "inline-flex shrink-0 items-center text-destructive", children: /* @__PURE__ */ jsx(Icon, { icon: UiAsterisk, className: "text-[11px]" }) });
|
|
246
|
-
}
|
|
247
|
-
function ItemRowActions({
|
|
248
|
-
index,
|
|
249
|
-
title,
|
|
250
|
-
size,
|
|
251
|
-
onUp,
|
|
252
|
-
onDown,
|
|
253
|
-
onDuplicate,
|
|
254
|
-
onRemove
|
|
255
|
-
}) {
|
|
256
|
-
const action = cn(
|
|
257
|
-
"inline-flex aspect-square items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-30",
|
|
258
|
-
controlHeightClass[size]
|
|
259
|
-
);
|
|
260
|
-
return /* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100", children: [
|
|
261
|
-
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": `Move ${title} up`, disabled: !onUp, className: action, onClick: onUp, children: /* @__PURE__ */ jsx(Icon, { icon: UiChevronUp, className: "text-sm" }) }),
|
|
262
|
-
/* @__PURE__ */ jsx(
|
|
263
|
-
"button",
|
|
264
|
-
{
|
|
265
|
-
type: "button",
|
|
266
|
-
"aria-label": `Move ${title} down`,
|
|
267
|
-
disabled: !onDown,
|
|
268
|
-
className: action,
|
|
269
|
-
onClick: onDown,
|
|
270
|
-
children: /* @__PURE__ */ jsx(Icon, { icon: UiChevronDown, className: "text-sm" })
|
|
271
|
-
}
|
|
272
|
-
),
|
|
273
|
-
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": `Duplicate ${title}`, className: action, onClick: onDuplicate, children: /* @__PURE__ */ jsx(Icon, { icon: UiCopy, className: "text-sm" }) }),
|
|
274
|
-
/* @__PURE__ */ jsx(
|
|
275
|
-
"button",
|
|
276
|
-
{
|
|
277
|
-
type: "button",
|
|
278
|
-
"aria-label": `Remove ${title}`,
|
|
279
|
-
className: cn(action, "hover:bg-destructive/10 hover:text-destructive"),
|
|
280
|
-
onClick: onRemove,
|
|
281
|
-
"data-item-index": index,
|
|
282
|
-
children: /* @__PURE__ */ jsx(Icon, { icon: UiTrash, className: "text-sm" })
|
|
283
|
-
}
|
|
284
|
-
)
|
|
285
|
-
] });
|
|
286
|
-
}
|
|
287
219
|
export {
|
|
288
220
|
AccordionArray
|
|
289
221
|
};
|