@chobantonov/jsonforms-react-renderer-common 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +79 -2
- package/lib/cells/CellSummary.cjs.js +2 -0
- package/lib/cells/CellSummary.cjs.js.map +1 -0
- package/lib/cells/CellSummary.d.ts +14 -0
- package/lib/cells/CellSummary.esm.js +29 -0
- package/lib/cells/CellSummary.esm.js.map +1 -0
- package/lib/cells/cellMode.cjs.js +2 -0
- package/lib/cells/cellMode.cjs.js.map +1 -0
- package/lib/cells/cellMode.d.ts +14 -0
- package/lib/cells/cellMode.esm.js +6 -0
- package/lib/cells/cellMode.esm.js.map +1 -0
- package/lib/cells/compositeActions.cjs.js +2 -0
- package/lib/cells/compositeActions.cjs.js.map +1 -0
- package/lib/cells/compositeActions.d.ts +7 -0
- package/lib/cells/compositeActions.esm.js +14 -0
- package/lib/cells/compositeActions.esm.js.map +1 -0
- package/lib/cells/compositeCellTester.cjs.js +2 -0
- package/lib/cells/compositeCellTester.cjs.js.map +1 -0
- package/lib/cells/compositeCellTester.d.ts +2 -0
- package/lib/cells/compositeCellTester.esm.js +12 -0
- package/lib/cells/compositeCellTester.esm.js.map +1 -0
- package/lib/cells/compositeSummary.cjs.js +2 -0
- package/lib/cells/compositeSummary.cjs.js.map +1 -0
- package/lib/cells/compositeSummary.d.ts +10 -0
- package/lib/cells/compositeSummary.esm.js +44 -0
- package/lib/cells/compositeSummary.esm.js.map +1 -0
- package/lib/cells/useCompositeCellPresentation.cjs.js +2 -0
- package/lib/cells/useCompositeCellPresentation.cjs.js.map +1 -0
- package/lib/cells/useCompositeCellPresentation.d.ts +7 -0
- package/lib/cells/useCompositeCellPresentation.esm.js +18 -0
- package/lib/cells/useCompositeCellPresentation.esm.js.map +1 -0
- package/lib/cells/useCompositeDraft.cjs.js +2 -0
- package/lib/cells/useCompositeDraft.cjs.js.map +1 -0
- package/lib/cells/useCompositeDraft.d.ts +52 -0
- package/lib/cells/useCompositeDraft.esm.js +95 -0
- package/lib/cells/useCompositeDraft.esm.js.map +1 -0
- package/lib/collections/CollectionErrorNavigation.cjs.js +2 -0
- package/lib/collections/CollectionErrorNavigation.cjs.js.map +1 -0
- package/lib/collections/CollectionErrorNavigation.d.ts +12 -0
- package/lib/collections/CollectionErrorNavigation.esm.js +68 -0
- package/lib/collections/CollectionErrorNavigation.esm.js.map +1 -0
- package/lib/collections/arrayChoices.cjs.js +2 -0
- package/lib/collections/arrayChoices.cjs.js.map +1 -0
- package/lib/collections/arrayChoices.d.ts +85 -0
- package/lib/collections/arrayChoices.esm.js +54 -0
- package/lib/collections/arrayChoices.esm.js.map +1 -0
- package/lib/collections/collectionPagination.cjs.js +2 -0
- package/lib/collections/collectionPagination.cjs.js.map +1 -0
- package/lib/collections/collectionPagination.d.ts +22 -0
- package/lib/collections/collectionPagination.esm.js +51 -0
- package/lib/collections/collectionPagination.esm.js.map +1 -0
- package/lib/collections/columnResize.cjs.js +2 -0
- package/lib/collections/columnResize.cjs.js.map +1 -0
- package/lib/collections/columnResize.d.ts +16 -0
- package/lib/collections/columnResize.esm.js +85 -0
- package/lib/collections/columnResize.esm.js.map +1 -0
- package/lib/collections/rowDetail.cjs.js +2 -0
- package/lib/collections/rowDetail.cjs.js.map +1 -0
- package/lib/collections/rowDetail.d.ts +34 -0
- package/lib/collections/rowDetail.esm.js +106 -0
- package/lib/collections/rowDetail.esm.js.map +1 -0
- package/lib/collections/tableColumns.cjs.js +2 -0
- package/lib/collections/tableColumns.cjs.js.map +1 -0
- package/lib/collections/tableColumns.d.ts +13 -0
- package/lib/collections/tableColumns.esm.js +16 -0
- package/lib/collections/tableColumns.esm.js.map +1 -0
- package/lib/collections/useArrayPanelState.cjs.js +2 -0
- package/lib/collections/useArrayPanelState.cjs.js.map +1 -0
- package/lib/collections/useArrayPanelState.d.ts +7 -0
- package/lib/collections/useArrayPanelState.esm.js +18 -0
- package/lib/collections/useArrayPanelState.esm.js.map +1 -0
- package/lib/collections/useCollectionDelete.cjs.js +2 -0
- package/lib/collections/useCollectionDelete.cjs.js.map +1 -0
- package/lib/collections/useCollectionDelete.d.ts +17 -0
- package/lib/collections/useCollectionDelete.esm.js +38 -0
- package/lib/collections/useCollectionDelete.esm.js.map +1 -0
- package/lib/collections/useTableSelection.cjs.js +2 -0
- package/lib/collections/useTableSelection.cjs.js.map +1 -0
- package/lib/collections/useTableSelection.d.ts +11 -0
- package/lib/collections/useTableSelection.esm.js +41 -0
- package/lib/collections/useTableSelection.esm.js.map +1 -0
- package/lib/composition/AllOfRenderer.cjs.js +2 -0
- package/lib/composition/AllOfRenderer.cjs.js.map +1 -0
- package/lib/composition/AllOfRenderer.d.ts +5 -0
- package/lib/composition/AllOfRenderer.esm.js +33 -0
- package/lib/composition/AllOfRenderer.esm.js.map +1 -0
- package/lib/composition/CombinatorBranch.cjs.js +2 -0
- package/lib/composition/CombinatorBranch.cjs.js.map +1 -0
- package/lib/composition/CombinatorBranch.d.ts +17 -0
- package/lib/composition/CombinatorBranch.esm.js +54 -0
- package/lib/composition/CombinatorBranch.esm.js.map +1 -0
- package/lib/composition/CombinatorProperties.cjs.js +2 -0
- package/lib/composition/CombinatorProperties.cjs.js.map +1 -0
- package/lib/composition/CombinatorProperties.d.ts +12 -0
- package/lib/composition/CombinatorProperties.esm.js +20 -0
- package/lib/composition/CombinatorProperties.esm.js.map +1 -0
- package/lib/composition/ScalarCompositionControl.cjs.js +2 -0
- package/lib/composition/ScalarCompositionControl.cjs.js.map +1 -0
- package/lib/composition/ScalarCompositionControl.d.ts +6 -0
- package/lib/composition/ScalarCompositionControl.esm.js +22 -0
- package/lib/composition/ScalarCompositionControl.esm.js.map +1 -0
- package/lib/composition/choiceCards.cjs.js +2 -0
- package/lib/composition/choiceCards.cjs.js.map +1 -0
- package/lib/composition/choiceCards.d.ts +36 -0
- package/lib/composition/choiceCards.esm.js +162 -0
- package/lib/composition/choiceCards.esm.js.map +1 -0
- package/lib/composition/combinators.cjs.js +2 -0
- package/lib/composition/combinators.cjs.js.map +1 -0
- package/lib/composition/combinators.d.ts +40 -0
- package/lib/composition/combinators.esm.js +26 -0
- package/lib/composition/combinators.esm.js.map +1 -0
- package/lib/composition/discriminatorBranch.cjs.js +2 -0
- package/lib/composition/discriminatorBranch.cjs.js.map +1 -0
- package/lib/composition/discriminatorBranch.d.ts +6 -0
- package/lib/composition/discriminatorBranch.esm.js +41 -0
- package/lib/composition/discriminatorBranch.esm.js.map +1 -0
- package/lib/composition/scalarComposition.cjs.js +2 -0
- package/lib/composition/scalarComposition.cjs.js.map +1 -0
- package/lib/composition/scalarComposition.d.ts +27 -0
- package/lib/composition/scalarComposition.esm.js +76 -0
- package/lib/composition/scalarComposition.esm.js.map +1 -0
- package/lib/composition/useCombinatorSelection.cjs.js +2 -0
- package/lib/composition/useCombinatorSelection.cjs.js.map +1 -0
- package/lib/composition/useCombinatorSelection.d.ts +6 -0
- package/lib/composition/useCombinatorSelection.esm.js +22 -0
- package/lib/composition/useCombinatorSelection.esm.js.map +1 -0
- package/lib/composition/useScalarComposition.cjs.js +2 -0
- package/lib/composition/useScalarComposition.cjs.js.map +1 -0
- package/lib/composition/useScalarComposition.d.ts +18 -0
- package/lib/composition/useScalarComposition.esm.js +24 -0
- package/lib/composition/useScalarComposition.esm.js.map +1 -0
- package/lib/controls/FileArrayInput.cjs.js +2 -0
- package/lib/controls/FileArrayInput.cjs.js.map +1 -0
- package/lib/controls/FileArrayInput.d.ts +19 -0
- package/lib/controls/FileArrayInput.esm.js +232 -0
- package/lib/controls/FileArrayInput.esm.js.map +1 -0
- package/lib/controls/controlHelp.cjs.js +2 -0
- package/lib/controls/controlHelp.cjs.js.map +1 -0
- package/lib/controls/controlHelp.d.ts +15 -0
- package/lib/controls/controlHelp.esm.js +9 -0
- package/lib/controls/controlHelp.esm.js.map +1 -0
- package/lib/controls/inputAdornments.cjs.js +2 -0
- package/lib/controls/inputAdornments.cjs.js.map +1 -0
- package/lib/controls/inputAdornments.d.ts +32 -0
- package/lib/controls/inputAdornments.esm.js +192 -0
- package/lib/controls/inputAdornments.esm.js.map +1 -0
- package/lib/controls/numeric.cjs.js +2 -0
- package/lib/controls/numeric.cjs.js.map +1 -0
- package/lib/controls/numeric.d.ts +36 -0
- package/lib/controls/numeric.esm.js +9 -0
- package/lib/controls/numeric.esm.js.map +1 -0
- package/lib/controls/useClearAffordance.cjs.js +2 -0
- package/lib/controls/useClearAffordance.cjs.js.map +1 -0
- package/lib/controls/useClearAffordance.d.ts +15 -0
- package/lib/controls/useClearAffordance.esm.js +17 -0
- package/lib/controls/useClearAffordance.esm.js.map +1 -0
- package/lib/controls/useDebouncedChange.cjs.js +2 -0
- package/lib/controls/useDebouncedChange.cjs.js.map +1 -0
- package/lib/controls/useDebouncedChange.d.ts +37 -0
- package/lib/controls/useDebouncedChange.esm.js +40 -0
- package/lib/controls/useDebouncedChange.esm.js.map +1 -0
- package/lib/controls/useFocus.cjs.js +2 -0
- package/lib/controls/useFocus.cjs.js.map +1 -0
- package/lib/controls/useFocus.d.ts +1 -0
- package/lib/controls/useFocus.esm.js +13 -0
- package/lib/controls/useFocus.esm.js.map +1 -0
- package/lib/core/configNamespaces.cjs.js +2 -0
- package/lib/core/configNamespaces.cjs.js.map +1 -0
- package/lib/core/configNamespaces.d.ts +32 -0
- package/lib/core/configNamespaces.esm.js +15 -0
- package/lib/core/configNamespaces.esm.js.map +1 -0
- package/lib/core/dataPointer.cjs.js +2 -0
- package/lib/core/dataPointer.cjs.js.map +1 -0
- package/lib/core/dataPointer.d.ts +1 -0
- package/lib/core/dataPointer.esm.js +5 -0
- package/lib/core/dataPointer.esm.js.map +1 -0
- package/lib/core/detailUiSchema.cjs.js +2 -0
- package/lib/core/detailUiSchema.cjs.js.map +1 -0
- package/lib/core/detailUiSchema.d.ts +7 -0
- package/lib/core/detailUiSchema.esm.js +23 -0
- package/lib/core/detailUiSchema.esm.js.map +1 -0
- package/lib/core/plainRecord.cjs.js +2 -0
- package/lib/core/plainRecord.cjs.js.map +1 -0
- package/lib/core/plainRecord.d.ts +1 -0
- package/lib/core/plainRecord.esm.js +5 -0
- package/lib/core/plainRecord.esm.js.map +1 -0
- package/lib/core/uiSchemaCycle.cjs.js +2 -0
- package/lib/core/uiSchemaCycle.cjs.js.map +1 -0
- package/lib/core/uiSchemaCycle.d.ts +18 -0
- package/lib/core/uiSchemaCycle.esm.js +27 -0
- package/lib/core/uiSchemaCycle.esm.js.map +1 -0
- package/lib/dynamic/DynamicUiProvider.cjs.js +4 -0
- package/lib/dynamic/DynamicUiProvider.cjs.js.map +1 -0
- package/lib/dynamic/DynamicUiProvider.d.ts +35 -0
- package/lib/dynamic/DynamicUiProvider.esm.js +182 -0
- package/lib/dynamic/DynamicUiProvider.esm.js.map +1 -0
- package/lib/dynamic/dynamicCel.cjs.js +2 -0
- package/lib/dynamic/dynamicCel.cjs.js.map +1 -0
- package/lib/dynamic/dynamicCel.d.ts +1 -0
- package/lib/dynamic/dynamicCel.esm.js +43 -0
- package/lib/dynamic/dynamicCel.esm.js.map +1 -0
- package/lib/dynamic/dynamicConfig.cjs.js +2 -0
- package/lib/dynamic/dynamicConfig.cjs.js.map +1 -0
- package/lib/dynamic/dynamicConfig.d.ts +7 -0
- package/lib/dynamic/dynamicConfig.esm.js +13 -0
- package/lib/dynamic/dynamicConfig.esm.js.map +1 -0
- package/lib/dynamic/dynamicRuntime.cjs.js +2 -0
- package/lib/dynamic/dynamicRuntime.cjs.js.map +1 -0
- package/lib/dynamic/dynamicRuntime.d.ts +4 -0
- package/lib/dynamic/dynamicRuntime.esm.js +16 -0
- package/lib/dynamic/dynamicRuntime.esm.js.map +1 -0
- package/lib/dynamic/dynamicScope.cjs.js +2 -0
- package/lib/dynamic/dynamicScope.cjs.js.map +1 -0
- package/lib/dynamic/dynamicScope.d.ts +2 -0
- package/lib/dynamic/dynamicScope.esm.js +17 -0
- package/lib/dynamic/dynamicScope.esm.js.map +1 -0
- package/lib/dynamic/dynamicTree.cjs.js +2 -0
- package/lib/dynamic/dynamicTree.cjs.js.map +1 -0
- package/lib/dynamic/dynamicTree.d.ts +12 -0
- package/lib/dynamic/dynamicTree.esm.js +57 -0
- package/lib/dynamic/dynamicTree.esm.js.map +1 -0
- package/lib/dynamic/dynamicUi.cjs.js +2 -0
- package/lib/dynamic/dynamicUi.cjs.js.map +1 -0
- package/lib/dynamic/dynamicUi.d.ts +39 -0
- package/lib/dynamic/dynamicUi.esm.js +397 -0
- package/lib/dynamic/dynamicUi.esm.js.map +1 -0
- package/lib/formats/colorFormat.cjs.js +2 -0
- package/lib/formats/colorFormat.cjs.js.map +1 -0
- package/lib/formats/colorFormat.d.ts +127 -0
- package/lib/formats/colorFormat.esm.js +139 -0
- package/lib/formats/colorFormat.esm.js.map +1 -0
- package/lib/formats/dateValues.cjs.js +2 -0
- package/lib/formats/dateValues.cjs.js.map +1 -0
- package/lib/formats/dateValues.d.ts +3 -0
- package/lib/formats/dateValues.esm.js +21 -0
- package/lib/formats/dateValues.esm.js.map +1 -0
- package/lib/formats/duration.cjs.js +2 -0
- package/lib/formats/duration.cjs.js.map +1 -0
- package/lib/formats/duration.d.ts +13 -0
- package/lib/formats/duration.esm.js +28 -0
- package/lib/formats/duration.esm.js.map +1 -0
- package/lib/formats/maskControls.cjs.js +2 -0
- package/lib/formats/maskControls.cjs.js.map +1 -0
- package/lib/formats/maskControls.d.ts +32 -0
- package/lib/formats/maskControls.esm.js +16 -0
- package/lib/formats/maskControls.esm.js.map +1 -0
- package/lib/formats/maskFormat.cjs.js +2 -0
- package/lib/formats/maskFormat.cjs.js.map +1 -0
- package/lib/formats/maskFormat.d.ts +198 -0
- package/lib/formats/maskFormat.esm.js +79 -0
- package/lib/formats/maskFormat.esm.js.map +1 -0
- package/lib/formats/temporalBounds.cjs.js +2 -0
- package/lib/formats/temporalBounds.cjs.js.map +1 -0
- package/lib/formats/temporalBounds.d.ts +82 -0
- package/lib/formats/temporalBounds.esm.js +76 -0
- package/lib/formats/temporalBounds.esm.js.map +1 -0
- package/lib/formats/temporalFormats.cjs.js +2 -0
- package/lib/formats/temporalFormats.cjs.js.map +1 -0
- package/lib/formats/temporalFormats.d.ts +62 -0
- package/lib/formats/temporalFormats.esm.js +18 -0
- package/lib/formats/temporalFormats.esm.js.map +1 -0
- package/lib/formats/useMaskedInput.cjs.js +2 -0
- package/lib/formats/useMaskedInput.cjs.js.map +1 -0
- package/lib/formats/useMaskedInput.d.ts +11 -0
- package/lib/formats/useMaskedInput.esm.js +80 -0
- package/lib/formats/useMaskedInput.esm.js.map +1 -0
- package/lib/index.cjs.js +1 -0
- package/lib/index.d.ts +42 -0
- package/lib/index.esm.js +44 -0
- package/lib/interaction/confirmation.cjs.js +2 -0
- package/lib/interaction/confirmation.cjs.js.map +1 -0
- package/lib/interaction/confirmation.d.ts +112 -0
- package/lib/interaction/confirmation.esm.js +18 -0
- package/lib/interaction/confirmation.esm.js.map +1 -0
- package/lib/interaction/createDeleteConfirmation.cjs.js +2 -0
- package/lib/interaction/createDeleteConfirmation.cjs.js.map +1 -0
- package/lib/interaction/createDeleteConfirmation.d.ts +10 -0
- package/lib/interaction/createDeleteConfirmation.esm.js +17 -0
- package/lib/interaction/createDeleteConfirmation.esm.js.map +1 -0
- package/lib/interaction/detailDialog.cjs.js +2 -0
- package/lib/interaction/detailDialog.cjs.js.map +1 -0
- package/lib/interaction/detailDialog.d.ts +30 -0
- package/lib/interaction/detailDialog.esm.js +89 -0
- package/lib/interaction/detailDialog.esm.js.map +1 -0
- package/lib/interaction/pendingChanges.cjs.js +2 -0
- package/lib/interaction/pendingChanges.cjs.js.map +1 -0
- package/lib/interaction/pendingChanges.d.ts +19 -0
- package/lib/interaction/pendingChanges.esm.js +17 -0
- package/lib/interaction/pendingChanges.esm.js.map +1 -0
- package/lib/interaction/useConfirmationState.cjs.js +2 -0
- package/lib/interaction/useConfirmationState.cjs.js.map +1 -0
- package/lib/interaction/useConfirmationState.d.ts +11 -0
- package/lib/interaction/useConfirmationState.esm.js +39 -0
- package/lib/interaction/useConfirmationState.esm.js.map +1 -0
- package/lib/interaction/visuallyHidden.cjs.js +2 -0
- package/lib/interaction/visuallyHidden.cjs.js.map +1 -0
- package/lib/interaction/visuallyHidden.d.ts +9 -0
- package/lib/interaction/visuallyHidden.esm.js +14 -0
- package/lib/interaction/visuallyHidden.esm.js.map +1 -0
- package/lib/layout/categoryState.cjs.js +2 -0
- package/lib/layout/categoryState.cjs.js.map +1 -0
- package/lib/layout/categoryState.d.ts +66 -0
- package/lib/layout/categoryState.esm.js +42 -0
- package/lib/layout/categoryState.esm.js.map +1 -0
- package/lib/layout/groupState.cjs.js +2 -0
- package/lib/layout/groupState.cjs.js.map +1 -0
- package/lib/layout/groupState.d.ts +34 -0
- package/lib/layout/groupState.esm.js +63 -0
- package/lib/layout/groupState.esm.js.map +1 -0
- package/lib/layout/layoutContext.cjs.js +2 -0
- package/lib/layout/layoutContext.cjs.js.map +1 -0
- package/lib/layout/layoutContext.d.ts +16 -0
- package/lib/layout/layoutContext.esm.js +26 -0
- package/lib/layout/layoutContext.esm.js.map +1 -0
- package/lib/layout/layoutSizing.cjs.js +2 -0
- package/lib/layout/layoutSizing.cjs.js.map +1 -0
- package/lib/layout/layoutSizing.d.ts +104 -0
- package/lib/layout/layoutSizing.esm.js +69 -0
- package/lib/layout/layoutSizing.esm.js.map +1 -0
- package/lib/locale/bg.cjs.js +2 -0
- package/lib/locale/bg.cjs.js.map +1 -0
- package/lib/locale/bg.d.ts +279 -0
- package/lib/locale/bg.esm.js +271 -0
- package/lib/locale/bg.esm.js.map +1 -0
- package/lib/locale/calendar.cjs.js +2 -0
- package/lib/locale/calendar.cjs.js.map +1 -0
- package/lib/locale/calendar.d.ts +23 -0
- package/lib/locale/calendar.esm.js +57 -0
- package/lib/locale/calendar.esm.js.map +1 -0
- package/lib/locale/en.cjs.js +2 -0
- package/lib/locale/en.cjs.js.map +1 -0
- package/lib/locale/en.d.ts +275 -0
- package/lib/locale/en.esm.js +271 -0
- package/lib/locale/en.esm.js.map +1 -0
- package/lib/locale/index.cjs.js +1 -0
- package/lib/locale/index.d.ts +3 -0
- package/lib/locale/index.esm.js +3 -0
- package/lib/locale/intl.cjs.js +2 -0
- package/lib/locale/intl.cjs.js.map +1 -0
- package/lib/locale/intl.d.ts +2 -0
- package/lib/locale/intl.esm.js +11 -0
- package/lib/locale/intl.esm.js.map +1 -0
- package/lib/locale/rendererLocale.cjs.js +2 -0
- package/lib/locale/rendererLocale.cjs.js.map +1 -0
- package/lib/locale/rendererLocale.d.ts +40 -0
- package/lib/locale/rendererLocale.esm.js +24 -0
- package/lib/locale/rendererLocale.esm.js.map +1 -0
- package/lib/locale/translate.cjs.js +2 -0
- package/lib/locale/translate.cjs.js.map +1 -0
- package/lib/locale/translate.d.ts +43 -0
- package/lib/locale/translate.esm.js +25 -0
- package/lib/locale/translate.esm.js.map +1 -0
- package/lib/mixed/MixedDetailControl.cjs.js +2 -0
- package/lib/mixed/MixedDetailControl.cjs.js.map +1 -0
- package/lib/mixed/MixedDetailControl.d.ts +20 -0
- package/lib/mixed/MixedDetailControl.esm.js +73 -0
- package/lib/mixed/MixedDetailControl.esm.js.map +1 -0
- package/lib/mixed/RecursiveTreeRenderer.cjs.js +2 -0
- package/lib/mixed/RecursiveTreeRenderer.cjs.js.map +1 -0
- package/lib/mixed/RecursiveTreeRenderer.d.ts +35 -0
- package/lib/mixed/RecursiveTreeRenderer.esm.js +206 -0
- package/lib/mixed/RecursiveTreeRenderer.esm.js.map +1 -0
- package/lib/mixed/createMixedTypeChangeHandler.cjs.js +2 -0
- package/lib/mixed/createMixedTypeChangeHandler.cjs.js.map +1 -0
- package/lib/mixed/createMixedTypeChangeHandler.d.ts +16 -0
- package/lib/mixed/createMixedTypeChangeHandler.esm.js +34 -0
- package/lib/mixed/createMixedTypeChangeHandler.esm.js.map +1 -0
- package/lib/mixed/mixedComposition.cjs.js +2 -0
- package/lib/mixed/mixedComposition.cjs.js.map +1 -0
- package/lib/mixed/mixedComposition.d.ts +7 -0
- package/lib/mixed/mixedComposition.esm.js +37 -0
- package/lib/mixed/mixedComposition.esm.js.map +1 -0
- package/lib/mixed/mixedNodeEditor.cjs.js +2 -0
- package/lib/mixed/mixedNodeEditor.cjs.js.map +1 -0
- package/lib/mixed/mixedNodeEditor.d.ts +12 -0
- package/lib/mixed/mixedNodeEditor.esm.js +20 -0
- package/lib/mixed/mixedNodeEditor.esm.js.map +1 -0
- package/lib/mixed/mixedScalar.cjs.js +2 -0
- package/lib/mixed/mixedScalar.cjs.js.map +1 -0
- package/lib/mixed/mixedScalar.d.ts +4 -0
- package/lib/mixed/mixedScalar.esm.js +6 -0
- package/lib/mixed/mixedScalar.esm.js.map +1 -0
- package/lib/mixed/mixedSchema.cjs.js +2 -0
- package/lib/mixed/mixedSchema.cjs.js.map +1 -0
- package/lib/mixed/mixedSchema.d.ts +22 -0
- package/lib/mixed/mixedSchema.esm.js +88 -0
- package/lib/mixed/mixedSchema.esm.js.map +1 -0
- package/lib/mixed/mixedTree.cjs.js +2 -0
- package/lib/mixed/mixedTree.cjs.js.map +1 -0
- package/lib/mixed/mixedTree.d.ts +19 -0
- package/lib/mixed/mixedTree.esm.js +78 -0
- package/lib/mixed/mixedTree.esm.js.map +1 -0
- package/lib/mixed/mixedTreeActions.cjs.js +2 -0
- package/lib/mixed/mixedTreeActions.cjs.js.map +1 -0
- package/lib/mixed/mixedTreeActions.d.ts +6 -0
- package/lib/mixed/mixedTreeActions.esm.js +17 -0
- package/lib/mixed/mixedTreeActions.esm.js.map +1 -0
- package/lib/mixed/recursiveTree.cjs.js +2 -0
- package/lib/mixed/recursiveTree.cjs.js.map +1 -0
- package/lib/mixed/recursiveTree.d.ts +9 -0
- package/lib/mixed/recursiveTree.esm.js +49 -0
- package/lib/mixed/recursiveTree.esm.js.map +1 -0
- package/lib/mixed/useMixedNavigation.cjs.js +2 -0
- package/lib/mixed/useMixedNavigation.cjs.js.map +1 -0
- package/lib/mixed/useMixedNavigation.d.ts +6 -0
- package/lib/mixed/useMixedNavigation.esm.js +21 -0
- package/lib/mixed/useMixedNavigation.esm.js.map +1 -0
- package/lib/mixed/useMixedRenderer.cjs.js +2 -0
- package/lib/mixed/useMixedRenderer.cjs.js.map +1 -0
- package/lib/mixed/useMixedRenderer.d.ts +61 -0
- package/lib/mixed/useMixedRenderer.esm.js +185 -0
- package/lib/mixed/useMixedRenderer.esm.js.map +1 -0
- package/lib/mixed/useMixedType.cjs.js +2 -0
- package/lib/mixed/useMixedType.cjs.js.map +1 -0
- package/lib/mixed/useMixedType.d.ts +6 -0
- package/lib/mixed/useMixedType.esm.js +23 -0
- package/lib/mixed/useMixedType.esm.js.map +1 -0
- package/lib/objects/IsolatedPropertyEditor.cjs.js +2 -0
- package/lib/objects/IsolatedPropertyEditor.cjs.js.map +1 -0
- package/lib/objects/IsolatedPropertyEditor.d.ts +35 -0
- package/lib/objects/IsolatedPropertyEditor.esm.js +27 -0
- package/lib/objects/IsolatedPropertyEditor.esm.js.map +1 -0
- package/lib/objects/ObjectDetail.cjs.js +2 -0
- package/lib/objects/ObjectDetail.cjs.js.map +1 -0
- package/lib/objects/ObjectDetail.d.ts +42 -0
- package/lib/objects/ObjectDetail.esm.js +103 -0
- package/lib/objects/ObjectDetail.esm.js.map +1 -0
- package/lib/objects/additionalProperties.cjs.js +2 -0
- package/lib/objects/additionalProperties.cjs.js.map +1 -0
- package/lib/objects/additionalProperties.d.ts +14 -0
- package/lib/objects/additionalProperties.esm.js +41 -0
- package/lib/objects/additionalProperties.esm.js.map +1 -0
- package/lib/objects/additionalPropertyName.cjs.js +2 -0
- package/lib/objects/additionalPropertyName.cjs.js.map +1 -0
- package/lib/objects/additionalPropertyName.d.ts +63 -0
- package/lib/objects/additionalPropertyName.esm.js +46 -0
- package/lib/objects/additionalPropertyName.esm.js.map +1 -0
- package/lib/objects/conditionalFields.cjs.js +2 -0
- package/lib/objects/conditionalFields.cjs.js.map +1 -0
- package/lib/objects/conditionalFields.d.ts +18 -0
- package/lib/objects/conditionalFields.esm.js +105 -0
- package/lib/objects/conditionalFields.esm.js.map +1 -0
- package/lib/objects/dynamicProperties.cjs.js +2 -0
- package/lib/objects/dynamicProperties.cjs.js.map +1 -0
- package/lib/objects/dynamicProperties.d.ts +10 -0
- package/lib/objects/dynamicProperties.esm.js +33 -0
- package/lib/objects/dynamicProperties.esm.js.map +1 -0
- package/lib/objects/literalPropertySchema.cjs.js +2 -0
- package/lib/objects/literalPropertySchema.cjs.js.map +1 -0
- package/lib/objects/literalPropertySchema.d.ts +2 -0
- package/lib/objects/literalPropertySchema.esm.js +38 -0
- package/lib/objects/literalPropertySchema.esm.js.map +1 -0
- package/lib/objects/useAdditionalPropertyEntries.cjs.js +2 -0
- package/lib/objects/useAdditionalPropertyEntries.cjs.js.map +1 -0
- package/lib/objects/useAdditionalPropertyEntries.d.ts +72 -0
- package/lib/objects/useAdditionalPropertyEntries.esm.js +71 -0
- package/lib/objects/useAdditionalPropertyEntries.esm.js.map +1 -0
- package/lib/rolldown-runtime-BocRIvOZ.js +1 -0
- package/lib/tuple/TupleControlContent.cjs.js +2 -0
- package/lib/tuple/TupleControlContent.cjs.js.map +1 -0
- package/lib/tuple/TupleControlContent.d.ts +17 -0
- package/lib/tuple/TupleControlContent.esm.js +74 -0
- package/lib/tuple/TupleControlContent.esm.js.map +1 -0
- package/lib/tuple/TupleField.cjs.js +2 -0
- package/lib/tuple/TupleField.cjs.js.map +1 -0
- package/lib/tuple/TupleField.d.ts +15 -0
- package/lib/tuple/TupleField.esm.js +72 -0
- package/lib/tuple/TupleField.esm.js.map +1 -0
- package/lib/tuple/tupleSchema.cjs.js +2 -0
- package/lib/tuple/tupleSchema.cjs.js.map +1 -0
- package/lib/tuple/tupleSchema.d.ts +93 -0
- package/lib/tuple/tupleSchema.esm.js +63 -0
- package/lib/tuple/tupleSchema.esm.js.map +1 -0
- package/lib/tuple/useTupleAdditionalItems.cjs.js +2 -0
- package/lib/tuple/useTupleAdditionalItems.cjs.js.map +1 -0
- package/lib/tuple/useTupleAdditionalItems.d.ts +45 -0
- package/lib/tuple/useTupleAdditionalItems.esm.js +47 -0
- package/lib/tuple/useTupleAdditionalItems.esm.js.map +1 -0
- package/lib/tuple/useTupleControl.cjs.js +3 -0
- package/lib/tuple/useTupleControl.cjs.js.map +1 -0
- package/lib/tuple/useTupleControl.d.ts +26 -0
- package/lib/tuple/useTupleControl.esm.js +84 -0
- package/lib/tuple/useTupleControl.esm.js.map +1 -0
- package/lib/tuple/useTupleField.cjs.js +2 -0
- package/lib/tuple/useTupleField.cjs.js.map +1 -0
- package/lib/tuple/useTupleField.d.ts +38 -0
- package/lib/tuple/useTupleField.esm.js +80 -0
- package/lib/tuple/useTupleField.esm.js.map +1 -0
- package/lib/validation/ItemValidationIndicator.cjs.js +2 -0
- package/lib/validation/ItemValidationIndicator.cjs.js.map +1 -0
- package/lib/validation/ItemValidationIndicator.d.ts +9 -0
- package/lib/validation/ItemValidationIndicator.esm.js +14 -0
- package/lib/validation/ItemValidationIndicator.esm.js.map +1 -0
- package/lib/validation/errorSummary.cjs.js +9 -0
- package/lib/validation/errorSummary.cjs.js.map +1 -0
- package/lib/validation/errorSummary.d.ts +44 -0
- package/lib/validation/errorSummary.esm.js +194 -0
- package/lib/validation/errorSummary.esm.js.map +1 -0
- package/lib/validation/preTouchErrors.cjs.js +2 -0
- package/lib/validation/preTouchErrors.cjs.js.map +1 -0
- package/lib/validation/preTouchErrors.d.ts +77 -0
- package/lib/validation/preTouchErrors.esm.js +42 -0
- package/lib/validation/preTouchErrors.esm.js.map +1 -0
- package/lib/validation/validationIndicator.cjs.js +2 -0
- package/lib/validation/validationIndicator.cjs.js.map +1 -0
- package/lib/validation/validationIndicator.d.ts +72 -0
- package/lib/validation/validationIndicator.esm.js +66 -0
- package/lib/validation/validationIndicator.esm.js.map +1 -0
- package/lib/webcomponent/element.cjs.js +2 -0
- package/lib/webcomponent/element.cjs.js.map +1 -0
- package/lib/webcomponent/element.d.ts +48 -0
- package/lib/webcomponent/element.esm.js +85 -0
- package/lib/webcomponent/element.esm.js.map +1 -0
- package/lib/webcomponent/input.cjs.js +2 -0
- package/lib/webcomponent/input.cjs.js.map +1 -0
- package/lib/webcomponent/input.d.ts +6 -0
- package/lib/webcomponent/input.esm.js +25 -0
- package/lib/webcomponent/input.esm.js.map +1 -0
- package/package.json +86 -3
- package/src/cells/CellSummary.tsx +59 -0
- package/src/cells/cellMode.tsx +21 -0
- package/src/cells/compositeActions.ts +21 -0
- package/src/cells/compositeCellTester.ts +15 -0
- package/src/cells/compositeSummary.ts +149 -0
- package/src/cells/useCompositeCellPresentation.ts +37 -0
- package/src/cells/useCompositeDraft.ts +199 -0
- package/src/collections/CollectionErrorNavigation.tsx +123 -0
- package/src/collections/arrayChoices.ts +235 -0
- package/src/collections/collectionPagination.ts +95 -0
- package/src/collections/columnResize.tsx +151 -0
- package/src/collections/rowDetail.tsx +208 -0
- package/src/collections/tableColumns.ts +39 -0
- package/src/collections/useArrayPanelState.ts +25 -0
- package/src/collections/useCollectionDelete.ts +62 -0
- package/src/collections/useTableSelection.ts +77 -0
- package/src/composition/AllOfRenderer.tsx +79 -0
- package/src/composition/CombinatorBranch.tsx +93 -0
- package/src/composition/CombinatorProperties.tsx +56 -0
- package/src/composition/ScalarCompositionControl.tsx +34 -0
- package/src/composition/choiceCards.tsx +389 -0
- package/src/composition/combinators.ts +131 -0
- package/src/composition/discriminatorBranch.ts +82 -0
- package/src/composition/scalarComposition.ts +193 -0
- package/src/composition/useCombinatorSelection.ts +53 -0
- package/src/composition/useScalarComposition.ts +67 -0
- package/src/controls/FileArrayInput.tsx +407 -0
- package/src/controls/controlHelp.ts +28 -0
- package/src/controls/inputAdornments.tsx +337 -0
- package/src/controls/numeric.ts +43 -0
- package/src/controls/useClearAffordance.ts +22 -0
- package/src/controls/useDebouncedChange.ts +138 -0
- package/src/controls/useFocus.ts +32 -0
- package/src/core/configNamespaces.ts +67 -0
- package/src/core/dataPointer.ts +8 -0
- package/src/core/detailUiSchema.ts +88 -0
- package/src/core/plainRecord.ts +8 -0
- package/src/core/uiSchemaCycle.tsx +122 -0
- package/src/dynamic/DynamicUiProvider.tsx +414 -0
- package/src/dynamic/dynamicCel.ts +68 -0
- package/src/dynamic/dynamicConfig.ts +26 -0
- package/src/dynamic/dynamicRuntime.ts +25 -0
- package/src/dynamic/dynamicScope.ts +22 -0
- package/src/dynamic/dynamicTree.ts +128 -0
- package/src/dynamic/dynamicUi.ts +711 -0
- package/src/formats/colorFormat.ts +390 -0
- package/src/formats/dateValues.ts +45 -0
- package/src/formats/duration.ts +60 -0
- package/src/formats/maskControls.ts +88 -0
- package/src/formats/maskFormat.ts +375 -0
- package/src/formats/temporalBounds.ts +219 -0
- package/src/formats/temporalFormats.ts +128 -0
- package/src/formats/useMaskedInput.ts +194 -0
- package/src/index.ts +42 -0
- package/src/interaction/confirmation.ts +211 -0
- package/src/interaction/createDeleteConfirmation.ts +23 -0
- package/src/interaction/detailDialog.ts +138 -0
- package/src/interaction/pendingChanges.tsx +55 -0
- package/src/interaction/useConfirmationState.ts +55 -0
- package/src/interaction/visuallyHidden.ts +19 -0
- package/src/layout/categoryState.ts +189 -0
- package/src/layout/groupState.ts +201 -0
- package/src/layout/layoutContext.tsx +49 -0
- package/src/layout/layoutSizing.ts +369 -0
- package/src/locale/bg.ts +309 -0
- package/src/locale/calendar.ts +57 -0
- package/src/locale/en.ts +375 -0
- package/src/locale/index.ts +5 -0
- package/src/locale/intl.ts +10 -0
- package/src/locale/rendererLocale.ts +74 -0
- package/src/locale/translate.ts +98 -0
- package/src/mixed/MixedDetailControl.tsx +182 -0
- package/src/mixed/RecursiveTreeRenderer.tsx +388 -0
- package/src/mixed/createMixedTypeChangeHandler.ts +77 -0
- package/src/mixed/mixedComposition.ts +76 -0
- package/src/mixed/mixedNodeEditor.ts +47 -0
- package/src/mixed/mixedScalar.ts +7 -0
- package/src/mixed/mixedSchema.ts +283 -0
- package/src/mixed/mixedTree.ts +199 -0
- package/src/mixed/mixedTreeActions.ts +60 -0
- package/src/mixed/recursiveTree.ts +105 -0
- package/src/mixed/useMixedNavigation.ts +36 -0
- package/src/mixed/useMixedRenderer.ts +300 -0
- package/src/mixed/useMixedType.ts +45 -0
- package/src/objects/IsolatedPropertyEditor.tsx +86 -0
- package/src/objects/ObjectDetail.tsx +232 -0
- package/src/objects/additionalProperties.ts +151 -0
- package/src/objects/additionalPropertyName.ts +185 -0
- package/src/objects/conditionalFields.ts +173 -0
- package/src/objects/dynamicProperties.tsx +68 -0
- package/src/objects/literalPropertySchema.ts +100 -0
- package/src/objects/useAdditionalPropertyEntries.ts +204 -0
- package/src/tuple/TupleControlContent.tsx +152 -0
- package/src/tuple/TupleField.tsx +150 -0
- package/src/tuple/tupleSchema.ts +245 -0
- package/src/tuple/useTupleAdditionalItems.ts +131 -0
- package/src/tuple/useTupleControl.tsx +173 -0
- package/src/tuple/useTupleField.ts +164 -0
- package/src/validation/ItemValidationIndicator.tsx +21 -0
- package/src/validation/errorSummary.tsx +489 -0
- package/src/validation/preTouchErrors.ts +185 -0
- package/src/validation/validationIndicator.ts +202 -0
- package/src/webcomponent/element.ts +107 -0
- package/src/webcomponent/input.ts +56 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation.esm.js","names":["POLICIES","asPolicy","value","fallbackConfirmationPolicy","catalogId","operation","namespaceOf","extended","config","\"jsonformsExtended\"","confirmation","\"confirmation\"","resolveConfirmationPolicy","_renderers$catalogId","element","options","fromElement","namespace","renderers","isDiscardableValue","isComplexValue","confirmationRequired","policy","discarded","shouldConfirm","resolve"],"sources":["../../src/interaction/confirmation.ts"],"sourcesContent":["/**\n * The shared destructive-change confirmation policy, with no React in it.\n *\n * Section 14 defines one policy for every renderer that discards data, so this\n * module owns the whole of it: which policy applies, and whether that policy\n * prompts for the values actually being discarded. The renderers only supply\n * the values and act on the answer.\n *\n * Confirmation is **separate from permission**. It never bypasses `restrict`,\n * readonly, disabled state or schema constraints, and it is not a second\n * chance to do something the form already forbids.\n */\n\nexport type ConfirmationPolicy = 'always' | 'never' | 'complex';\n\n/**\n * The operations the policy covers. Ordinary typing, navigation, adding a\n * value and re-selecting the current type or branch are not among them.\n */\nexport type ConfirmationOperation = 'typeChange' | 'branchChange' | 'delete';\n\n/**\n * The built-in catalog ids used by the base renderer families.\n *\n * Stable semantic identifiers, \"not library component names\" - so a host's\n * configuration survives a renderer being rewritten or renamed.\n *\n * For an action hosted inside another renderer, the id is **the owner of the\n * action**: a dynamic property's Delete is `additionalProperties` even though\n * an object renderer draws it, and the mixed workspace's tree Delete is\n * `mixed`.\n */\nexport type BaseConfirmationCatalogId =\n | 'compositeCell'\n | 'mixed'\n | 'oneOf'\n | 'arrayTable'\n | 'arrayLayout'\n | 'listWithDetail'\n | 'additionalProperties'\n | 'additionalItems';\n\n/**\n * Any stable catalog id, including those contributed by optional extensions.\n *\n * Section 14's list also names `agGrid`, which is **not** enumerated here: that\n * renderer lives in the extended package, and this one must not know about\n * anything downstream of it. The extended set passes its own id as a plain\n * string; the `string & {}` keeps editor completion for the base ids listed\n * above while leaving the vocabulary open.\n */\n// oxlint-disable-next-line @typescript-eslint/ban-types\nexport type ConfirmationCatalogId = BaseConfirmationCatalogId | (string & {});\n\nconst POLICIES: ConfirmationPolicy[] = ['always', 'never', 'complex'];\n\nconst asPolicy = (value: unknown): ConfirmationPolicy | undefined =>\n POLICIES.includes(value as ConfirmationPolicy)\n ? (value as ConfirmationPolicy)\n : undefined;\n\n/**\n * The documented fallback, used when nothing configures the operation.\n *\n * Mixed type changes and all deletions fall back to `complex`; other operations fall back to\n * `always`. Section 14 spells out the consequence: \"the default configuration\n * example deliberately opts into always globally while restoring complex for\n * mixed type changes; without that exception a global always also applies to\n * mixed type changes\" - so a configured `default` really does replace this,\n * rather than being merged with it.\n */\nexport const fallbackConfirmationPolicy = (\n catalogId: ConfirmationCatalogId,\n operation: ConfirmationOperation,\n): ConfirmationPolicy =>\n (catalogId === 'mixed' && operation === 'typeChange') ||\n operation === 'delete'\n ? 'complex'\n : 'always';\n\nconst namespaceOf = (config: unknown): Record<string, unknown> | undefined => {\n const extended = (config as Record<string, unknown> | undefined)?.[\n 'jsonformsExtended'\n ];\n const confirmation = (extended as Record<string, unknown> | undefined)?.[\n 'confirmation'\n ];\n return confirmation && typeof confirmation === 'object'\n ? (confirmation as Record<string, unknown>)\n : undefined;\n};\n\nexport interface ResolveConfirmationOptions {\n /** The element's `uischema.options`. */\n options?: Record<string, unknown>;\n /** The global JSON Forms `config`. */\n config?: unknown;\n catalogId: ConfirmationCatalogId;\n operation: ConfirmationOperation;\n}\n\n/**\n * Section 14's resolution order, exactly:\n *\n * 1. `options.confirmation[operation]`\n * 2. `config.jsonformsExtended.confirmation.renderers[catalogId][operation]`\n * 3. `config.jsonformsExtended.confirmation.default`\n * 4. the documented fallback\n *\n * Unrecognized values are ignored rather than treated as `never`, so a typo\n * cannot silently switch confirmation off.\n */\nexport const resolveConfirmationPolicy = ({\n options,\n config,\n catalogId,\n operation,\n}: ResolveConfirmationOptions): ConfirmationPolicy => {\n const element = options?.confirmation as Record<string, unknown> | undefined;\n const fromElement = asPolicy(element?.[operation]);\n if (fromElement) {\n return fromElement;\n }\n\n const namespace = namespaceOf(config);\n const renderers = namespace?.renderers as\n | Record<string, Record<string, unknown>>\n | undefined;\n const fromRenderer = asPolicy(renderers?.[catalogId]?.[operation]);\n if (fromRenderer) {\n return fromRenderer;\n }\n\n const fromDefault = asPolicy(namespace?.default);\n if (fromDefault) {\n return fromDefault;\n }\n\n return fallbackConfirmationPolicy(catalogId, operation);\n};\n\n/**\n * Whether a value counts as something there is to discard.\n *\n * Section 14: \"no prompt when there is no value to discard. False, zero, empty\n * strings, and empty containers are existing values.\" Only absence is nothing -\n * `null` is a value a user chose, and so is `{}`.\n */\nexport const isDiscardableValue = (value: unknown): boolean =>\n value !== undefined;\n\n/**\n * Whether a value is the \"complex\" kind: a **nonempty** object or array.\n *\n * \"A nonempty object has at least one own key; a nonempty array has at least\n * one item, independently of whether its nested values are empty\" - so\n * `{ a: {} }` qualifies and `{}` does not.\n */\nexport const isComplexValue = (value: unknown): boolean => {\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n return (\n typeof value === 'object' &&\n value !== null &&\n Object.keys(value as object).length > 0\n );\n};\n\n/**\n * Whether the policy prompts for the values being discarded.\n *\n * Takes a list because \"for batches, one confirmation covers the operation;\n * complex applies if any discarded value qualifies\" - so a multi-row delete\n * asks once, and asks at all if any one row holds something complex.\n *\n * `complex` deliberately inspects **the old value, not the destination type**:\n * changing a populated object into a string prompts, and changing a string into\n * an object does not.\n */\nexport const confirmationRequired = (\n policy: ConfirmationPolicy,\n discarded: unknown[],\n): boolean => {\n if (policy === 'never') {\n return false;\n }\n if (policy === 'complex') {\n return discarded.some(isComplexValue);\n }\n return discarded.some(isDiscardableValue);\n};\n\n/**\n * The whole decision in one call, for a renderer that has a value in hand.\n */\nexport const shouldConfirm = (\n resolve: ResolveConfirmationOptions,\n discarded: unknown[],\n): boolean =>\n confirmationRequired(resolveConfirmationPolicy(resolve), discarded);\n\nexport interface ConfirmationRequest {\n operation: ConfirmationOperation;\n catalogId: ConfirmationCatalogId;\n discarded: unknown[];\n options?: Record<string, unknown>;\n config?: unknown;\n /** Rechecks current mutation guards when the user confirms. */\n perform: () => void;\n}\n"],"mappings":";AAsDA,IAAMA,IAAiC;CAAC;CAAU;CAAS;AAAS,GAE9DC,KAAY,MAChBD,EAAS,SAASE,CAA2B,IACxCA,IACD,KAAA,GAYOC,KACX,GACA,MAECC,MAAc,WAAWC,MAAc,gBACxCA,MAAc,WACV,YACA,UAEAC,KAAe,MAAyD;CAC5E,IAAMC,IAAAC,KAAA,OAAA,KAAA,IAAYA,EAChBC,mBAEIC,IAAAH,KAAA,OAAA,KAAA,IAAgBA,EACpBI;CAEF,OAAOD,KAAgB,OAAOA,KAAiB,WAC1CA,IACD,KAAA;AACN,GAsBaE,KAA6B,EACxC,YACA,WACA,cACA,mBACoD;;CACpD,IAAME,IAAAC,KAAA,OAAA,KAAA,IAAUA,EAAS,cACnBC,IAAcf,EAAAa,KAAA,OAAA,KAAA,IAASA,EAAUT,EAAU;CACjD,IAAIW,GACF,OAAOA;CAGT,IAAMC,IAAYX,EAAYE,CAAM,GAC9BU,IAAAD,KAAA,OAAA,KAAA,IAAYA,EAAW;CAa7B,OAVqBhB,EAAAiB,KAAA,SAAA,IAASA,EAAYd,OAAA,OAAA,KAAA,IAAAS,EAAaR,EACnD,KAIgBJ,EAAAgB,KAAA,OAAA,KAAA,IAASA,EAAW,OACpC,KAIGd,EAA2BC,GAAWC,CAAS;AACxD,GASac,KAAsB,MACjCjB,MAAU,KAAA,GASCkB,KAAkB,MACzB,MAAM,QAAQlB,CAAK,IACdA,EAAM,SAAS,IAGtB,OAAOA,KAAU,cACjBA,KACA,OAAO,KAAKA,CAAe,CAAC,CAAC,SAAS,GAe7BmB,KACX,GACA,MAEIC,MAAW,UACN,KAELA,MAAW,YACNC,EAAU,KAAKH,CAAc,IAE/BG,EAAU,KAAKJ,CAAkB,GAM7BK,KACX,GACA,MAEAH,EAAqBT,EAA0Ba,CAAO,GAAGF,CAAS"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e,t){return function(){let n=e();return{request:e=>n.request({...e,operation:`delete`,catalogId:t}),dialog:n.dialog}}}exports.createDeleteConfirmation=e;
|
|
2
|
+
//# sourceMappingURL=createDeleteConfirmation.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDeleteConfirmation.cjs.js","names":["createDeleteConfirmation","confirmation","useConfirmation","input"],"sources":["../../src/interaction/createDeleteConfirmation.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type {\n ConfirmationCatalogId,\n ConfirmationRequest,\n} from './confirmation';\n\n/** Bind a collection's catalog identity to its native confirmation hook. */\nexport function createDeleteConfirmation(\n useConfirmation: () => {\n request: (input: ConfirmationRequest) => void;\n dialog: ReactNode;\n },\n catalogId: ConfirmationCatalogId,\n) {\n return function useDeleteConfirmation() {\n const confirmation = useConfirmation();\n return {\n request: (input: Omit<ConfirmationRequest, 'operation' | 'catalogId'>) =>\n confirmation.request({ ...input, operation: 'delete', catalogId }),\n dialog: confirmation.dialog,\n };\n };\n}\n"],"mappings":"A,mEAOA,SAAgBA,EACd,EAIA,EACA,CACA,OAAO,UAAiC,CACtC,IAAMC,EAAeC,EAAgB,EACrC,MAAO,CACL,QAAU,GACRD,EAAa,QAAQ,CAAE,GAAGE,EAAO,UAAW,SAAU,WAAU,CAAC,EACnE,OAAQF,EAAa,MACvB,CACF,CACF,C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ConfirmationCatalogId, ConfirmationRequest } from './confirmation';
|
|
3
|
+
/** Bind a collection's catalog identity to its native confirmation hook. */
|
|
4
|
+
export declare function createDeleteConfirmation(useConfirmation: () => {
|
|
5
|
+
request: (input: ConfirmationRequest) => void;
|
|
6
|
+
dialog: ReactNode;
|
|
7
|
+
}, catalogId: ConfirmationCatalogId): () => {
|
|
8
|
+
request: (input: Omit<ConfirmationRequest, "operation" | "catalogId">) => void;
|
|
9
|
+
dialog: ReactNode;
|
|
10
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/interaction/createDeleteConfirmation.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
return function() {
|
|
4
|
+
let n = e();
|
|
5
|
+
return {
|
|
6
|
+
request: (e) => n.request({
|
|
7
|
+
...e,
|
|
8
|
+
operation: "delete",
|
|
9
|
+
catalogId: t
|
|
10
|
+
}),
|
|
11
|
+
dialog: n.dialog
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export { e as createDeleteConfirmation };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=createDeleteConfirmation.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDeleteConfirmation.esm.js","names":["createDeleteConfirmation","confirmation","useConfirmation","input"],"sources":["../../src/interaction/createDeleteConfirmation.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type {\n ConfirmationCatalogId,\n ConfirmationRequest,\n} from './confirmation';\n\n/** Bind a collection's catalog identity to its native confirmation hook. */\nexport function createDeleteConfirmation(\n useConfirmation: () => {\n request: (input: ConfirmationRequest) => void;\n dialog: ReactNode;\n },\n catalogId: ConfirmationCatalogId,\n) {\n return function useDeleteConfirmation() {\n const confirmation = useConfirmation();\n return {\n request: (input: Omit<ConfirmationRequest, 'operation' | 'catalogId'>) =>\n confirmation.request({ ...input, operation: 'delete', catalogId }),\n dialog: confirmation.dialog,\n };\n };\n}\n"],"mappings":";AAOA,SAAgBA,EACd,GAIA,GACA;CACA,OAAO,WAAiC;EACtC,IAAMC,IAAeC,EAAgB;EACrC,OAAO;GACL,UAAU,MACRD,EAAa,QAAQ;IAAE,GAAGE;IAAO,WAAW;IAAU;GAAU,CAAC;GACnE,QAAQF,EAAa;EACvB;CACF;AACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BocRIvOZ.js");let t=require("react");t=e.t(t);let n=require("@jsonforms/react");var r=(e,r={},i)=>{var a;let o=(0,n.useJsonForms)().config;r={...o==null||(a=o.jsonformsExtended)==null?void 0:a.dialog,...r};let[s,c]=(0,t.useState)(!1),[l,u]=(0,t.useState)({x:0,y:0}),[d,f]=(0,t.useState)(e);d!==e&&(f(e),e||(c(!1),u({x:0,y:0})));let p=t.default.useRef(),m=t.default.useRef(),h=()=>{p.current!==void 0&&cancelAnimationFrame(p.current),p.current=void 0,m.current&&u(m.current),m.current=void 0};(0,t.useEffect)(()=>()=>{p.current!==void 0&&cancelAnimationFrame(p.current)},[]);let g=t.default.useRef();return{options:r,offset:s?{x:0,y:0}:l,maximized:s,toggle:()=>c(e=>!e),style:{width:s?`calc(100vw - 32px)`:r.width,height:s?`calc(100dvh - 32px)`:r.height,minWidth:280,minHeight:160,maxWidth:`calc(100vw - 32px)`,maxHeight:`calc(100dvh - 32px)`,translate:s?void 0:`${l.x}px ${l.y}px`,resize:r.resizable&&!s?`both`:void 0,overflow:`auto`},dragProps:{style:{cursor:r.draggable&&!s?`move`:void 0,touchAction:`none`},onPointerDown:e=>{if(!r.draggable||s||e.button!==0||e.target.closest(`button`))return;e.preventDefault();let t=(i==null?void 0:i())??e.currentTarget.closest(`[role="dialog"]`);if(!t)return;let n=t.getBoundingClientRect();g.current={x:e.clientX,y:e.clientY,left:l.x,top:l.y,bounds:{left:l.x-n.left,top:l.y-n.top,right:l.x+Math.max(0,window.innerWidth-n.width)-n.left,bottom:l.y+Math.max(0,window.innerHeight-n.height)-n.top}},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{g.current&&(m.current={x:Math.max(g.current.bounds.left,Math.min(g.current.bounds.right,g.current.left+e.clientX-g.current.x)),y:Math.max(g.current.bounds.top,Math.min(g.current.bounds.bottom,g.current.top+e.clientY-g.current.y))},p.current===void 0&&(p.current=requestAnimationFrame(h)))},onPointerUp:()=>{h(),g.current=void 0},onPointerCancel:()=>{h(),g.current=void 0},onLostPointerCapture:()=>{h(),g.current=void 0}}}};exports.useDetailDialog=r;
|
|
2
|
+
//# sourceMappingURL=detailDialog.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detailDialog.cjs.js","names":["useJsonForms","useState","React","require_rolldown_runtime","react","_jsonforms_react","useDetailDialog","_config$jsonformsExte","config","options","maximized","setMaximized","offset","setOffset","wasOpen","setWasOpen","open","frame","nextOffset","flushOffset","drag","value","event","surface","getSurface","rect"],"sources":["../../src/interaction/detailDialog.ts"],"sourcesContent":["import { useJsonForms } from '@jsonforms/react';\nimport React, { useEffect, useState } from 'react';\n\nexport type DetailDialogOptions = {\n width?: number | string;\n height?: number | string;\n maximizable?: boolean;\n draggable?: boolean;\n resizable?: boolean;\n};\n\n/** Geometry only; each renderer supplies its own dialog and controls. */\nexport const useDetailDialog = (\n open: boolean,\n options: DetailDialogOptions = {},\n getSurface?: () => HTMLElement | null | undefined,\n) => {\n const config = useJsonForms().config;\n options = { ...config?.jsonformsExtended?.dialog, ...options };\n const [maximized, setMaximized] = useState(false);\n const [offset, setOffset] = useState({ x: 0, y: 0 });\n const [wasOpen, setWasOpen] = useState(open);\n if (wasOpen !== open) {\n setWasOpen(open);\n if (!open) {\n setMaximized(false);\n setOffset({ x: 0, y: 0 });\n }\n }\n const frame = React.useRef<number>();\n const nextOffset = React.useRef<{ x: number; y: number }>();\n const flushOffset = () => {\n if (frame.current !== undefined) cancelAnimationFrame(frame.current);\n frame.current = undefined;\n if (nextOffset.current) setOffset(nextOffset.current);\n nextOffset.current = undefined;\n };\n useEffect(\n () => () => {\n if (frame.current !== undefined) cancelAnimationFrame(frame.current);\n },\n [],\n );\n const drag = React.useRef<{\n x: number;\n y: number;\n left: number;\n top: number;\n bounds: { left: number; top: number; right: number; bottom: number };\n }>();\n const onPointerDown: React.PointerEventHandler<HTMLElement> = (event) => {\n if (\n !options.draggable ||\n maximized ||\n event.button !== 0 ||\n (event.target as HTMLElement).closest('button')\n )\n return;\n event.preventDefault();\n const surface =\n getSurface?.() ??\n event.currentTarget.closest<HTMLElement>('[role=\"dialog\"]');\n if (!surface) return;\n const rect = surface.getBoundingClientRect();\n drag.current = {\n x: event.clientX,\n y: event.clientY,\n left: offset.x,\n top: offset.y,\n bounds: {\n left: offset.x - rect.left,\n top: offset.y - rect.top,\n right:\n offset.x + Math.max(0, window.innerWidth - rect.width) - rect.left,\n bottom:\n offset.y + Math.max(0, window.innerHeight - rect.height) - rect.top,\n },\n };\n event.currentTarget.setPointerCapture(event.pointerId);\n };\n return {\n options,\n offset: maximized ? { x: 0, y: 0 } : offset,\n maximized,\n toggle: () => setMaximized((value) => !value),\n style: {\n width: maximized ? 'calc(100vw - 32px)' : options.width,\n height: maximized ? 'calc(100dvh - 32px)' : options.height,\n minWidth: 280,\n minHeight: 160,\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n translate: maximized ? undefined : `${offset.x}px ${offset.y}px`,\n resize: options.resizable && !maximized ? 'both' : undefined,\n overflow: 'auto',\n } as React.CSSProperties,\n dragProps: {\n style: {\n cursor: options.draggable && !maximized ? 'move' : undefined,\n touchAction: 'none',\n },\n onPointerDown,\n onPointerMove: (event: React.PointerEvent<HTMLElement>) => {\n if (!drag.current) return;\n nextOffset.current = {\n x: Math.max(\n drag.current.bounds.left,\n Math.min(\n drag.current.bounds.right,\n drag.current.left + event.clientX - drag.current.x,\n ),\n ),\n y: Math.max(\n drag.current.bounds.top,\n Math.min(\n drag.current.bounds.bottom,\n drag.current.top + event.clientY - drag.current.y,\n ),\n ),\n };\n if (frame.current === undefined)\n frame.current = requestAnimationFrame(flushOffset);\n },\n onPointerUp: () => {\n flushOffset();\n drag.current = undefined;\n },\n onPointerCancel: () => {\n flushOffset();\n drag.current = undefined;\n },\n onLostPointerCapture: () => {\n flushOffset();\n drag.current = undefined;\n },\n },\n };\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type DetailDialogOptions = {
|
|
3
|
+
width?: number | string;
|
|
4
|
+
height?: number | string;
|
|
5
|
+
maximizable?: boolean;
|
|
6
|
+
draggable?: boolean;
|
|
7
|
+
resizable?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/** Geometry only; each renderer supplies its own dialog and controls. */
|
|
10
|
+
export declare const useDetailDialog: (open: boolean, options?: DetailDialogOptions, getSurface?: () => HTMLElement | null | undefined) => {
|
|
11
|
+
options: DetailDialogOptions;
|
|
12
|
+
offset: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
maximized: boolean;
|
|
17
|
+
toggle: () => void;
|
|
18
|
+
style: React.CSSProperties;
|
|
19
|
+
dragProps: {
|
|
20
|
+
style: {
|
|
21
|
+
cursor: string | undefined;
|
|
22
|
+
touchAction: string;
|
|
23
|
+
};
|
|
24
|
+
onPointerDown: React.PointerEventHandler<HTMLElement>;
|
|
25
|
+
onPointerMove: (event: React.PointerEvent<HTMLElement>) => void;
|
|
26
|
+
onPointerUp: () => void;
|
|
27
|
+
onPointerCancel: () => void;
|
|
28
|
+
onLostPointerCapture: () => void;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import e, { useEffect as t, useState as n } from "react";
|
|
2
|
+
import { useJsonForms as r } from "@jsonforms/react";
|
|
3
|
+
// src/interaction/detailDialog.ts
|
|
4
|
+
var i = (i, a = {}, o) => {
|
|
5
|
+
var s;
|
|
6
|
+
let c = r().config;
|
|
7
|
+
a = {
|
|
8
|
+
...c == null || (s = c.jsonformsExtended) == null ? void 0 : s.dialog,
|
|
9
|
+
...a
|
|
10
|
+
};
|
|
11
|
+
let [l, u] = n(!1), [d, f] = n({
|
|
12
|
+
x: 0,
|
|
13
|
+
y: 0
|
|
14
|
+
}), [p, m] = n(i);
|
|
15
|
+
p !== i && (m(i), i || (u(!1), f({
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0
|
|
18
|
+
})));
|
|
19
|
+
let h = e.useRef(), g = e.useRef(), _ = () => {
|
|
20
|
+
h.current !== void 0 && cancelAnimationFrame(h.current), h.current = void 0, g.current && f(g.current), g.current = void 0;
|
|
21
|
+
};
|
|
22
|
+
t(() => () => {
|
|
23
|
+
h.current !== void 0 && cancelAnimationFrame(h.current);
|
|
24
|
+
}, []);
|
|
25
|
+
let v = e.useRef();
|
|
26
|
+
return {
|
|
27
|
+
options: a,
|
|
28
|
+
offset: l ? {
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0
|
|
31
|
+
} : d,
|
|
32
|
+
maximized: l,
|
|
33
|
+
toggle: () => u((e) => !e),
|
|
34
|
+
style: {
|
|
35
|
+
width: l ? "calc(100vw - 32px)" : a.width,
|
|
36
|
+
height: l ? "calc(100dvh - 32px)" : a.height,
|
|
37
|
+
minWidth: 280,
|
|
38
|
+
minHeight: 160,
|
|
39
|
+
maxWidth: "calc(100vw - 32px)",
|
|
40
|
+
maxHeight: "calc(100dvh - 32px)",
|
|
41
|
+
translate: l ? void 0 : `${d.x}px ${d.y}px`,
|
|
42
|
+
resize: a.resizable && !l ? "both" : void 0,
|
|
43
|
+
overflow: "auto"
|
|
44
|
+
},
|
|
45
|
+
dragProps: {
|
|
46
|
+
style: {
|
|
47
|
+
cursor: a.draggable && !l ? "move" : void 0,
|
|
48
|
+
touchAction: "none"
|
|
49
|
+
},
|
|
50
|
+
onPointerDown: (e) => {
|
|
51
|
+
if (!a.draggable || l || e.button !== 0 || e.target.closest("button")) return;
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
let t = (o == null ? void 0 : o()) ?? e.currentTarget.closest("[role=\"dialog\"]");
|
|
54
|
+
if (!t) return;
|
|
55
|
+
let n = t.getBoundingClientRect();
|
|
56
|
+
v.current = {
|
|
57
|
+
x: e.clientX,
|
|
58
|
+
y: e.clientY,
|
|
59
|
+
left: d.x,
|
|
60
|
+
top: d.y,
|
|
61
|
+
bounds: {
|
|
62
|
+
left: d.x - n.left,
|
|
63
|
+
top: d.y - n.top,
|
|
64
|
+
right: d.x + Math.max(0, window.innerWidth - n.width) - n.left,
|
|
65
|
+
bottom: d.y + Math.max(0, window.innerHeight - n.height) - n.top
|
|
66
|
+
}
|
|
67
|
+
}, e.currentTarget.setPointerCapture(e.pointerId);
|
|
68
|
+
},
|
|
69
|
+
onPointerMove: (e) => {
|
|
70
|
+
v.current && (g.current = {
|
|
71
|
+
x: Math.max(v.current.bounds.left, Math.min(v.current.bounds.right, v.current.left + e.clientX - v.current.x)),
|
|
72
|
+
y: Math.max(v.current.bounds.top, Math.min(v.current.bounds.bottom, v.current.top + e.clientY - v.current.y))
|
|
73
|
+
}, h.current === void 0 && (h.current = requestAnimationFrame(_)));
|
|
74
|
+
},
|
|
75
|
+
onPointerUp: () => {
|
|
76
|
+
_(), v.current = void 0;
|
|
77
|
+
},
|
|
78
|
+
onPointerCancel: () => {
|
|
79
|
+
_(), v.current = void 0;
|
|
80
|
+
},
|
|
81
|
+
onLostPointerCapture: () => {
|
|
82
|
+
_(), v.current = void 0;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export { i as useDetailDialog };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=detailDialog.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detailDialog.esm.js","names":["React","useDetailDialog","_config$jsonformsExte","config","useJsonForms","options","maximized","setMaximized","useState","offset","setOffset","wasOpen","setWasOpen","open","frame","nextOffset","flushOffset","drag","value","event","surface","getSurface","rect"],"sources":["../../src/interaction/detailDialog.ts"],"sourcesContent":["import { useJsonForms } from '@jsonforms/react';\nimport React, { useEffect, useState } from 'react';\n\nexport type DetailDialogOptions = {\n width?: number | string;\n height?: number | string;\n maximizable?: boolean;\n draggable?: boolean;\n resizable?: boolean;\n};\n\n/** Geometry only; each renderer supplies its own dialog and controls. */\nexport const useDetailDialog = (\n open: boolean,\n options: DetailDialogOptions = {},\n getSurface?: () => HTMLElement | null | undefined,\n) => {\n const config = useJsonForms().config;\n options = { ...config?.jsonformsExtended?.dialog, ...options };\n const [maximized, setMaximized] = useState(false);\n const [offset, setOffset] = useState({ x: 0, y: 0 });\n const [wasOpen, setWasOpen] = useState(open);\n if (wasOpen !== open) {\n setWasOpen(open);\n if (!open) {\n setMaximized(false);\n setOffset({ x: 0, y: 0 });\n }\n }\n const frame = React.useRef<number>();\n const nextOffset = React.useRef<{ x: number; y: number }>();\n const flushOffset = () => {\n if (frame.current !== undefined) cancelAnimationFrame(frame.current);\n frame.current = undefined;\n if (nextOffset.current) setOffset(nextOffset.current);\n nextOffset.current = undefined;\n };\n useEffect(\n () => () => {\n if (frame.current !== undefined) cancelAnimationFrame(frame.current);\n },\n [],\n );\n const drag = React.useRef<{\n x: number;\n y: number;\n left: number;\n top: number;\n bounds: { left: number; top: number; right: number; bottom: number };\n }>();\n const onPointerDown: React.PointerEventHandler<HTMLElement> = (event) => {\n if (\n !options.draggable ||\n maximized ||\n event.button !== 0 ||\n (event.target as HTMLElement).closest('button')\n )\n return;\n event.preventDefault();\n const surface =\n getSurface?.() ??\n event.currentTarget.closest<HTMLElement>('[role=\"dialog\"]');\n if (!surface) return;\n const rect = surface.getBoundingClientRect();\n drag.current = {\n x: event.clientX,\n y: event.clientY,\n left: offset.x,\n top: offset.y,\n bounds: {\n left: offset.x - rect.left,\n top: offset.y - rect.top,\n right:\n offset.x + Math.max(0, window.innerWidth - rect.width) - rect.left,\n bottom:\n offset.y + Math.max(0, window.innerHeight - rect.height) - rect.top,\n },\n };\n event.currentTarget.setPointerCapture(event.pointerId);\n };\n return {\n options,\n offset: maximized ? { x: 0, y: 0 } : offset,\n maximized,\n toggle: () => setMaximized((value) => !value),\n style: {\n width: maximized ? 'calc(100vw - 32px)' : options.width,\n height: maximized ? 'calc(100dvh - 32px)' : options.height,\n minWidth: 280,\n minHeight: 160,\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n translate: maximized ? undefined : `${offset.x}px ${offset.y}px`,\n resize: options.resizable && !maximized ? 'both' : undefined,\n overflow: 'auto',\n } as React.CSSProperties,\n dragProps: {\n style: {\n cursor: options.draggable && !maximized ? 'move' : undefined,\n touchAction: 'none',\n },\n onPointerDown,\n onPointerMove: (event: React.PointerEvent<HTMLElement>) => {\n if (!drag.current) return;\n nextOffset.current = {\n x: Math.max(\n drag.current.bounds.left,\n Math.min(\n drag.current.bounds.right,\n drag.current.left + event.clientX - drag.current.x,\n ),\n ),\n y: Math.max(\n drag.current.bounds.top,\n Math.min(\n drag.current.bounds.bottom,\n drag.current.top + event.clientY - drag.current.y,\n ),\n ),\n };\n if (frame.current === undefined)\n frame.current = requestAnimationFrame(flushOffset);\n },\n onPointerUp: () => {\n flushOffset();\n drag.current = undefined;\n },\n onPointerCancel: () => {\n flushOffset();\n drag.current = undefined;\n },\n onLostPointerCapture: () => {\n flushOffset();\n drag.current = undefined;\n },\n },\n };\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BocRIvOZ.js");let t=require("react");t=e.t(t);var n=(0,t.createContext)(void 0),r=({changes:e,children:r})=>t.default.createElement(n.Provider,{value:e},r),i=e=>{let r=(0,t.useContext)(n),i=(0,t.useMemo)(()=>({flush:()=>i.current.flush(),cancel:()=>i.current.cancel(),current:e}),[]);i.current=e,(0,t.useEffect)(()=>{if(r)return r.add(i),()=>{i.cancel(),r.delete(i)}},[r,i])};exports.PendingChangesProvider=r,exports.useRegisterPendingChange=i;
|
|
2
|
+
//# sourceMappingURL=pendingChanges.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pendingChanges.cjs.js","names":["createContext","useContext","useMemo","require_rolldown_runtime","react","PendingChangesContext","PendingChangesProvider","changes","children","useRegisterPendingChange","pending","entry","change"],"sources":["../../src/interaction/pendingChanges.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect, useMemo } from 'react';\n\nexport type PendingChange = {\n /** Apply the outstanding value now. */\n flush: () => void;\n /** Drop the outstanding value. */\n cancel: () => void;\n};\n\nconst PendingChangesContext = createContext<Set<PendingChange> | undefined>(\n undefined,\n);\n\n/**\n * Text controls debounce their writes, so a value the user has typed may not\n * have reached the form data yet when a dialog's Apply is pressed. Controls\n * register their pending write here; the dialog flushes them all before it\n * reads the draft, and cancels them when it is dismissed.\n *\n * Outside a provider this is inert, which is what an ordinary form wants.\n */\nexport const PendingChangesProvider = ({\n changes,\n children,\n}: React.PropsWithChildren<{ changes: Set<PendingChange> }>) => (\n <PendingChangesContext.Provider value={changes}>\n {children}\n </PendingChangesContext.Provider>\n);\n\nexport const useRegisterPendingChange = (change: PendingChange) => {\n const pending = useContext(PendingChangesContext);\n // The registered entry has to stay stable, or every render would leave a\n // stale one behind in the set.\n const entry = useMemo<PendingChange>(\n () => ({\n flush: () => entry.current.flush(),\n cancel: () => entry.current.cancel(),\n current: change,\n }),\n // oxlint-disable-next-line react-hooks/exhaustive-deps\n [],\n ) as PendingChange & { current: PendingChange };\n entry.current = change;\n useEffect(() => {\n if (!pending) return undefined;\n pending.add(entry);\n return () => {\n // Unmounting while a write is outstanding must not let it land after\n // the dialog that owned it has gone.\n entry.cancel();\n pending.delete(entry);\n };\n }, [pending, entry]);\n};\n"],"mappings":"A,sJASA,IAAMK,GAAA,EAAwBL,EAAAA,cAAAA,CAC5B,IAAA,EACF,EAUaM,GAA0B,CACrC,UACA,cAEAF,EAAA,QAAA,cAACC,EAAsB,SAAvB,CAAgC,MAAOE,CAEP,EAD7BC,CAC6B,EAGrBC,EAA4B,GAA0B,CACjE,IAAMC,GAAA,EAAUT,EAAAA,WAAAA,CAAWI,CAAqB,EAG1CM,GAAA,EAAQT,EAAAA,QAAAA,MACL,CACL,UAAaS,EAAM,QAAQ,MAAM,EACjC,WAAcA,EAAM,QAAQ,OAAO,EACnC,QAASC,CACX,GAEA,CAAC,CACH,EACA,EAAM,QAAUA,GAChB,EAAAR,EAAA,UAAA,KAAgB,CACd,GAAKM,EAEL,OADAA,EAAQ,IAAIC,CAAK,MACJ,CAGXA,EAAM,OAAO,EACbD,EAAQ,OAAOC,CAAK,CACtB,CACF,EAAG,CAACD,EAASC,CAAK,CAAC,CACrB,E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type PendingChange = {
|
|
3
|
+
/** Apply the outstanding value now. */
|
|
4
|
+
flush: () => void;
|
|
5
|
+
/** Drop the outstanding value. */
|
|
6
|
+
cancel: () => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Text controls debounce their writes, so a value the user has typed may not
|
|
10
|
+
* have reached the form data yet when a dialog's Apply is pressed. Controls
|
|
11
|
+
* register their pending write here; the dialog flushes them all before it
|
|
12
|
+
* reads the draft, and cancels them when it is dismissed.
|
|
13
|
+
*
|
|
14
|
+
* Outside a provider this is inert, which is what an ordinary form wants.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PendingChangesProvider: ({ changes, children, }: React.PropsWithChildren<{
|
|
17
|
+
changes: Set<PendingChange>;
|
|
18
|
+
}>) => React.JSX.Element;
|
|
19
|
+
export declare const useRegisterPendingChange: (change: PendingChange) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import e, { createContext as t, useContext as n, useEffect as r, useMemo as i } from "react";
|
|
2
|
+
// src/interaction/pendingChanges.tsx
|
|
3
|
+
var a = t(void 0), o = ({ changes: t, children: n }) => /* @__PURE__ */ e.createElement(a.Provider, { value: t }, n), s = (e) => {
|
|
4
|
+
let t = n(a), o = i(() => ({
|
|
5
|
+
flush: () => o.current.flush(),
|
|
6
|
+
cancel: () => o.current.cancel(),
|
|
7
|
+
current: e
|
|
8
|
+
}), []);
|
|
9
|
+
o.current = e, r(() => {
|
|
10
|
+
if (t) return t.add(o), () => {
|
|
11
|
+
o.cancel(), t.delete(o);
|
|
12
|
+
};
|
|
13
|
+
}, [t, o]);
|
|
14
|
+
};
|
|
15
|
+
export { o as PendingChangesProvider, s as useRegisterPendingChange };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=pendingChanges.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pendingChanges.esm.js","names":["React","PendingChangesContext","createContext","PendingChangesProvider","changes","children","useRegisterPendingChange","pending","useContext","entry","useMemo","change","useEffect"],"sources":["../../src/interaction/pendingChanges.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect, useMemo } from 'react';\n\nexport type PendingChange = {\n /** Apply the outstanding value now. */\n flush: () => void;\n /** Drop the outstanding value. */\n cancel: () => void;\n};\n\nconst PendingChangesContext = createContext<Set<PendingChange> | undefined>(\n undefined,\n);\n\n/**\n * Text controls debounce their writes, so a value the user has typed may not\n * have reached the form data yet when a dialog's Apply is pressed. Controls\n * register their pending write here; the dialog flushes them all before it\n * reads the draft, and cancels them when it is dismissed.\n *\n * Outside a provider this is inert, which is what an ordinary form wants.\n */\nexport const PendingChangesProvider = ({\n changes,\n children,\n}: React.PropsWithChildren<{ changes: Set<PendingChange> }>) => (\n <PendingChangesContext.Provider value={changes}>\n {children}\n </PendingChangesContext.Provider>\n);\n\nexport const useRegisterPendingChange = (change: PendingChange) => {\n const pending = useContext(PendingChangesContext);\n // The registered entry has to stay stable, or every render would leave a\n // stale one behind in the set.\n const entry = useMemo<PendingChange>(\n () => ({\n flush: () => entry.current.flush(),\n cancel: () => entry.current.cancel(),\n current: change,\n }),\n // oxlint-disable-next-line react-hooks/exhaustive-deps\n [],\n ) as PendingChange & { current: PendingChange };\n entry.current = change;\n useEffect(() => {\n if (!pending) return undefined;\n pending.add(entry);\n return () => {\n // Unmounting while a write is outstanding must not let it land after\n // the dialog that owned it has gone.\n entry.cancel();\n pending.delete(entry);\n };\n }, [pending, entry]);\n};\n"],"mappings":";;AASA,IAAMC,IAAwBC,EAC5B,KAAA,CACF,GAUaC,KAA0B,EACrC,YACA,kBAEA,kBAAA,cAACF,EAAsB,UAAvB,EAAgC,OAAOG,EAEP,GAD7BC,CAC6B,GAGrBC,KAA4B,MAA0B;CACjE,IAAMC,IAAUC,EAAWP,CAAqB,GAG1CQ,IAAQC,SACL;EACL,aAAaD,EAAM,QAAQ,MAAM;EACjC,cAAcA,EAAM,QAAQ,OAAO;EACnC,SAASE;CACX,IAEA,CAAC,CACH;CAEA,AADA,EAAM,UAAUA,GAChBC,QAAgB;EACd,IAAKL,GAEL,OADAA,EAAQ,IAAIE,CAAK,SACJ;GAIX,AADAA,EAAM,OAAO,GACbF,EAAQ,OAAOE,CAAK;EACtB;CACF,GAAG,CAACF,GAASE,CAAK,CAAC;AACrB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../locale/translate.cjs.js"),t=require("./confirmation.cjs.js");let n=require("react");var r={delete:`confirm.delete.title`,typeChange:`confirm.typeChange.title`,branchChange:`confirm.branchChange.title`},i={delete:`confirm.delete.message`,typeChange:`confirm.typeChange.message`,branchChange:`confirm.branchChange.message`},a=()=>{let a=e.useI18n(),[o,s]=(0,n.useState)(),c=(0,n.useRef)(),l=(0,n.useCallback)(e=>{t.confirmationRequired(t.resolveConfirmationPolicy({options:e.options,config:e.config,catalogId:e.catalogId,operation:e.operation}),e.discarded)?(c.current=e,s(e)):e.perform()},[]),u=(0,n.useCallback)(()=>{c.current=void 0,s(void 0)},[]);return{t:a,pending:o,request:l,close:u,confirm:(0,n.useCallback)(()=>{let e=c.current;u(),e==null||e.perform()},[u]),title:o?a(r[o.operation]):void 0,message:o?a(i[o.operation]):void 0}};exports.useConfirmationState=a;
|
|
2
|
+
//# sourceMappingURL=useConfirmationState.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConfirmationState.cjs.js","names":["useI18n","useState","useRef","useCallback","confirmationRequired","resolveConfirmationPolicy","require_locale_translate","require_interaction_confirmation","react","TITLES","MESSAGES","useConfirmationState","t","pending","setPending","pendingRef","request","next","close","action"],"sources":["../../src/interaction/useConfirmationState.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react';\nimport { useI18n } from '../locale/translate';\nimport {\n confirmationRequired,\n resolveConfirmationPolicy,\n type ConfirmationRequest,\n} from './confirmation';\n\nconst TITLES = {\n delete: 'confirm.delete.title',\n typeChange: 'confirm.typeChange.title',\n branchChange: 'confirm.branchChange.title',\n} as const;\n\nconst MESSAGES = {\n delete: 'confirm.delete.message',\n typeChange: 'confirm.typeChange.message',\n branchChange: 'confirm.branchChange.message',\n} as const;\n\n/** Confirmation policy and pending action; UI packages provide only the dialog. */\nexport const useConfirmationState = () => {\n const t = useI18n();\n const [pending, setPending] = useState<ConfirmationRequest>();\n const pendingRef = useRef<ConfirmationRequest>();\n const request = useCallback((next: ConfirmationRequest) => {\n const prompts = confirmationRequired(\n resolveConfirmationPolicy({\n options: next.options,\n config: next.config,\n catalogId: next.catalogId,\n operation: next.operation,\n }),\n next.discarded,\n );\n if (!prompts) {\n next.perform();\n return;\n }\n pendingRef.current = next;\n setPending(next);\n }, []);\n const close = useCallback(() => {\n pendingRef.current = undefined;\n setPending(undefined);\n }, []);\n const confirm = useCallback(() => {\n const action = pendingRef.current;\n close();\n action?.perform();\n }, [close]);\n const title = pending ? t(TITLES[pending.operation]) : undefined;\n const message = pending ? t(MESSAGES[pending.operation]) : undefined;\n return { t, pending, request, close, confirm, title, message };\n};\n"],"mappings":"A,2KAQA,IAAMS,EAAS,CACb,OAAQ,uBACR,WAAY,2BACZ,aAAc,4BAChB,EAEMC,EAAW,CACf,OAAQ,yBACR,WAAY,6BACZ,aAAc,8BAChB,EAGaC,MAA6B,CACxC,IAAMC,EAAIZ,EAAAA,QAAQ,EACZ,CAACa,EAASC,IAAA,EAAcb,EAAAA,SAAAA,CAA8B,EACtDc,GAAA,EAAab,EAAAA,OAAAA,CAA4B,EACzCc,GAAA,EAAUb,EAAAA,YAAAA,CAAa,GAA8B,CACzCC,EAAAA,qBACdC,EAAAA,0BAA0B,CACxB,QAASY,EAAK,QACd,OAAQA,EAAK,OACb,UAAWA,EAAK,UAChB,UAAWA,EAAK,SAClB,CAAC,EACDA,EAAK,SAEF,GAIL,EAAW,QAAUA,EACrBH,EAAWG,CAAI,GAJbA,EAAK,QAAQ,CAKjB,EAAG,CAAC,CAAC,EACCC,GAAA,EAAQf,EAAAA,YAAAA,KAAkB,CAC9B,EAAW,QAAU,IAAA,GACrBW,EAAW,IAAA,EAAS,CACtB,EAAG,CAAC,CAAC,EAQL,MAAO,CAAE,IAAG,UAAS,UAAS,QAAO,SAAA,EAPrBX,EAAAA,YAAAA,KAAkB,CAChC,IAAMgB,EAASJ,EAAW,QAC1BG,EAAM,EACNC,GAAA,MAAAA,EAAQ,QAAQ,CAClB,EAAG,CAACD,CAAK,CAG4B,EAAS,MAFhCL,EAAUD,EAAEH,EAAOI,EAAQ,UAAU,EAAI,IAAA,GAEF,QADrCA,EAAUD,EAAEF,EAASG,EAAQ,UAAU,EAAI,IAAA,EACE,CAC/D,E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ConfirmationRequest } from './confirmation';
|
|
2
|
+
/** Confirmation policy and pending action; UI packages provide only the dialog. */
|
|
3
|
+
export declare const useConfirmationState: () => {
|
|
4
|
+
t: (key: import("..").I18nKey, values?: Record<string, unknown>) => string;
|
|
5
|
+
pending: ConfirmationRequest | undefined;
|
|
6
|
+
request: (next: ConfirmationRequest) => void;
|
|
7
|
+
close: () => void;
|
|
8
|
+
confirm: () => void;
|
|
9
|
+
title: string | undefined;
|
|
10
|
+
message: string | undefined;
|
|
11
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useI18n as e } from "../locale/translate.esm.js";
|
|
2
|
+
import { confirmationRequired as t, resolveConfirmationPolicy as n } from "./confirmation.esm.js";
|
|
3
|
+
import { useCallback as r, useRef as i, useState as a } from "react";
|
|
4
|
+
// src/interaction/useConfirmationState.ts
|
|
5
|
+
var o = {
|
|
6
|
+
delete: "confirm.delete.title",
|
|
7
|
+
typeChange: "confirm.typeChange.title",
|
|
8
|
+
branchChange: "confirm.branchChange.title"
|
|
9
|
+
}, s = {
|
|
10
|
+
delete: "confirm.delete.message",
|
|
11
|
+
typeChange: "confirm.typeChange.message",
|
|
12
|
+
branchChange: "confirm.branchChange.message"
|
|
13
|
+
}, c = () => {
|
|
14
|
+
let c = e(), [l, u] = a(), d = i(), f = r((e) => {
|
|
15
|
+
t(n({
|
|
16
|
+
options: e.options,
|
|
17
|
+
config: e.config,
|
|
18
|
+
catalogId: e.catalogId,
|
|
19
|
+
operation: e.operation
|
|
20
|
+
}), e.discarded) ? (d.current = e, u(e)) : e.perform();
|
|
21
|
+
}, []), p = r(() => {
|
|
22
|
+
d.current = void 0, u(void 0);
|
|
23
|
+
}, []);
|
|
24
|
+
return {
|
|
25
|
+
t: c,
|
|
26
|
+
pending: l,
|
|
27
|
+
request: f,
|
|
28
|
+
close: p,
|
|
29
|
+
confirm: r(() => {
|
|
30
|
+
let e = d.current;
|
|
31
|
+
p(), e == null || e.perform();
|
|
32
|
+
}, [p]),
|
|
33
|
+
title: l ? c(o[l.operation]) : void 0,
|
|
34
|
+
message: l ? c(s[l.operation]) : void 0
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export { c as useConfirmationState };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=useConfirmationState.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConfirmationState.esm.js","names":["TITLES","MESSAGES","useConfirmationState","t","useI18n","pending","setPending","useState","pendingRef","useRef","request","useCallback","confirmationRequired","resolveConfirmationPolicy","next","close","action"],"sources":["../../src/interaction/useConfirmationState.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react';\nimport { useI18n } from '../locale/translate';\nimport {\n confirmationRequired,\n resolveConfirmationPolicy,\n type ConfirmationRequest,\n} from './confirmation';\n\nconst TITLES = {\n delete: 'confirm.delete.title',\n typeChange: 'confirm.typeChange.title',\n branchChange: 'confirm.branchChange.title',\n} as const;\n\nconst MESSAGES = {\n delete: 'confirm.delete.message',\n typeChange: 'confirm.typeChange.message',\n branchChange: 'confirm.branchChange.message',\n} as const;\n\n/** Confirmation policy and pending action; UI packages provide only the dialog. */\nexport const useConfirmationState = () => {\n const t = useI18n();\n const [pending, setPending] = useState<ConfirmationRequest>();\n const pendingRef = useRef<ConfirmationRequest>();\n const request = useCallback((next: ConfirmationRequest) => {\n const prompts = confirmationRequired(\n resolveConfirmationPolicy({\n options: next.options,\n config: next.config,\n catalogId: next.catalogId,\n operation: next.operation,\n }),\n next.discarded,\n );\n if (!prompts) {\n next.perform();\n return;\n }\n pendingRef.current = next;\n setPending(next);\n }, []);\n const close = useCallback(() => {\n pendingRef.current = undefined;\n setPending(undefined);\n }, []);\n const confirm = useCallback(() => {\n const action = pendingRef.current;\n close();\n action?.perform();\n }, [close]);\n const title = pending ? t(TITLES[pending.operation]) : undefined;\n const message = pending ? t(MESSAGES[pending.operation]) : undefined;\n return { t, pending, request, close, confirm, title, message };\n};\n"],"mappings":";;;;AAQA,IAAMA,IAAS;CACb,QAAQ;CACR,YAAY;CACZ,cAAc;AAChB,GAEMC,IAAW;CACf,QAAQ;CACR,YAAY;CACZ,cAAc;AAChB,GAGaC,UAA6B;CACxC,IAAMC,IAAIC,EAAQ,GACZ,CAACC,GAASC,KAAcC,EAA8B,GACtDC,IAAaC,EAA4B,GACzCC,IAAUC,GAAa,MAA8B;EAUzD,AATgBC,EACdC,EAA0B;GACxB,SAASC,EAAK;GACd,QAAQA,EAAK;GACb,WAAWA,EAAK;GAChB,WAAWA,EAAK;EAClB,CAAC,GACDA,EAAK,SAEF,KAIL,EAAW,UAAUA,GACrBR,EAAWQ,CAAI,KAJbA,EAAK,QAAQ;CAKjB,GAAG,CAAC,CAAC,GACCC,IAAQJ,QAAkB;EAE9B,AADA,EAAW,UAAU,KAAA,GACrBL,EAAW,KAAA,CAAS;CACtB,GAAG,CAAC,CAAC;CAQL,OAAO;EAAE;EAAG;EAAS;EAAS;EAAO,SAPrBK,QAAkB;GAChC,IAAMK,IAASR,EAAW;GAE1B,AADAO,EAAM,GACNC,KAAA,QAAAA,EAAQ,QAAQ;EAClB,GAAG,CAACD,CAAK,CAG4B;EAAS,OAFhCV,IAAUF,EAAEH,EAAOK,EAAQ,UAAU,IAAI,KAAA;EAEF,SADrCA,IAAUF,EAAEF,EAASI,EAAQ,UAAU,IAAI,KAAA;CACE;AAC/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visuallyHidden.cjs.js","names":["visuallyHidden"],"sources":["../../src/interaction/visuallyHidden.ts"],"sourcesContent":["import { CSSProperties } from 'react';\n\n/**\n * Hides content visually while leaving it available to assistive technology.\n *\n * Inline rather than a `sr-only` class: that class is defined in the demo\n * application's stylesheet, not in this package, so a renderer relying on it\n * shows the text to everyone in any other host.\n */\nexport const visuallyHidden: CSSProperties = {\n border: 0,\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: 1,\n overflow: 'hidden',\n position: 'absolute',\n whiteSpace: 'nowrap',\n width: 1,\n};\n"],"mappings":"A,mEASA,IAAaA,EAAgC,CAC3C,OAAQ,EACR,KAAM,gBACN,SAAU,aACV,OAAQ,EACR,SAAU,SACV,SAAU,WACV,WAAY,SACZ,MAAO,CACT,E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Hides content visually while leaving it available to assistive technology.
|
|
4
|
+
*
|
|
5
|
+
* Inline rather than a `sr-only` class: that class is defined in the demo
|
|
6
|
+
* application's stylesheet, not in this package, so a renderer relying on it
|
|
7
|
+
* shows the text to everyone in any other host.
|
|
8
|
+
*/
|
|
9
|
+
export declare const visuallyHidden: CSSProperties;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/interaction/visuallyHidden.ts
|
|
2
|
+
var e = {
|
|
3
|
+
border: 0,
|
|
4
|
+
clip: "rect(0 0 0 0)",
|
|
5
|
+
clipPath: "inset(50%)",
|
|
6
|
+
height: 1,
|
|
7
|
+
overflow: "hidden",
|
|
8
|
+
position: "absolute",
|
|
9
|
+
whiteSpace: "nowrap",
|
|
10
|
+
width: 1
|
|
11
|
+
};
|
|
12
|
+
export { e as visuallyHidden };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=visuallyHidden.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visuallyHidden.esm.js","names":["visuallyHidden"],"sources":["../../src/interaction/visuallyHidden.ts"],"sourcesContent":["import { CSSProperties } from 'react';\n\n/**\n * Hides content visually while leaving it available to assistive technology.\n *\n * Inline rather than a `sr-only` class: that class is defined in the demo\n * application's stylesheet, not in this package, so a renderer relying on it\n * shows the text to everyone in any other host.\n */\nexport const visuallyHidden: CSSProperties = {\n border: 0,\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: 1,\n overflow: 'hidden',\n position: 'absolute',\n whiteSpace: 'nowrap',\n width: 1,\n};\n"],"mappings":";AASA,IAAaA,IAAgC;CAC3C,QAAQ;CACR,MAAM;CACN,UAAU;CACV,QAAQ;CACR,UAAU;CACV,UAAU;CACV,YAAY;CACZ,OAAO;AACT"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../dynamic/DynamicUiProvider.cjs.js"),t=require("./groupState.cjs.js");let n=require("react"),r=require("@jsonforms/core");var i=(t,n)=>{let r=e.dynamicAuthoredElement(t).name;return typeof r==`string`&&r.length>0?`name:${r}`:`index:${n}`},a=new WeakSet,o=(e,t)=>{var n;let r=(n=t.options)==null?void 0:n.initial;if(typeof r!=`string`||r.length===0)return 0;let i=e.findIndex(e=>e.name===r);return i>=0?i:(a.has(t)||(a.add(t),console.warn(`Categorization: options.initial "${r}" matches no visible category; opening the first one instead.`)),0)},s=-1,c=(a,s,c,l,u,d=!1,f=``)=>{let p=e.useDynamicElements(a.elements??[],f),m=(0,n.useMemo)(()=>p.filter(e=>(0,r.isVisible)(e,s,f,c,l)),[p,s,c,l,f]),h=t.resolveCollapsed(a.options,l,`accordion`),[g,_]=(0,n.useState)(()=>{var e;return u===void 0?d&&h&&!((e=a.options)!=null&&e.initial)?null:void 0:i((a.elements??[])[u],u)}),[v,y]=(0,n.useState)(h);v!==h&&(y(h),d&&_(h?null:void 0));let b=typeof g==`string`?m.findIndex((e,t)=>i(e,t)===g):-1;return{categories:m,active:m.length===0||g===null?-1:b>=0?b:o(m,a),select:e=>{let t=m[e];t&&_(i(t,e))},close:()=>{d&&_(null)}}};exports.NO_CATEGORY=s,exports.categoryKey=i,exports.resolveInitialIndex=o,exports.useCategorySelection=c;
|
|
2
|
+
//# sourceMappingURL=categoryState.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categoryState.cjs.js","names":["dynamicAuthoredElement","useDynamicElements","useMemo","isVisible","resolveCollapsed","useState","require_dynamic_DynamicUiProvider","require_layout_groupState","react","_jsonforms_core","categoryKey","name","category","index","warned","resolveInitialIndex","_categorization$optio","initial","categorization","found","categories","NO_CATEGORY","useCategorySelection","effectiveCategories","path","data","ajv","config","initiallyCollapsed","selectedKey","setSelectedKey","_categorization$optio2","initiallySelected","closable","previousCollapsed","setPreviousCollapsed","fromKey"],"sources":["../../src/layout/categoryState.ts"],"sourcesContent":["import {\n useDynamicElements,\n dynamicAuthoredElement,\n} from '../dynamic/DynamicUiProvider';\nimport { resolveCollapsed } from './groupState';\nimport { Categorization, Category, isVisible } from '@jsonforms/core';\nimport { useMemo, useState } from 'react';\n\n/**\n * A category's stable identity, for keeping the selection across a reorder.\n *\n * The specification says to \"preserve the selected category's identity across\n * reordering\" and that sibling `name`s SHOULD be unique, so the name is the\n * identity when there is one. Without a name there is nothing to preserve -\n * position is all a category has - so the index stands in, and moving an\n * unnamed category moves the selection with the slot rather than the content.\n * Prefixed so a category named `2` cannot collide with the third unnamed one.\n */\nexport const categoryKey = (category: Category, index: number): string => {\n const name = (\n dynamicAuthoredElement(category) as Category & { name?: unknown }\n ).name;\n return typeof name === 'string' && name.length > 0\n ? `name:${name}`\n : `index:${index}`;\n};\n\n/** Warned-about elements, so an authoring mistake is reported once, not per render. */\nconst warned = new WeakSet<Categorization>();\n\n/**\n * The index `options.initial` asks for, or `0`.\n *\n * \"Missing target falls back to first visible category with diagnostic.\"\n * The diagnostic is a console warning rather than something rendered: a name\n * that does not match any category is a mistake in the UI schema, which the\n * author can fix and the person filling in the form can do nothing about.\n * That is why the specification's `categorization.initialNotFound` key has no\n * entry in our catalogue - nothing user-facing uses it. See Adjustment 10.\n */\nexport const resolveInitialIndex = (\n categories: Category[],\n categorization: Categorization,\n): number => {\n const initial = (\n categorization.options as Record<string, unknown> | undefined\n )?.initial;\n if (typeof initial !== 'string' || initial.length === 0) {\n return 0;\n }\n const found = categories.findIndex(\n (category) => (category as Category & { name?: unknown }).name === initial,\n );\n if (found >= 0) {\n return found;\n }\n if (!warned.has(categorization)) {\n warned.add(categorization);\n // oxlint-disable-next-line no-console\n console.warn(\n `Categorization: options.initial \"${initial}\" matches no visible category; opening the first one instead.`,\n );\n }\n return 0;\n};\n\n/** Nothing open: no visible categories, or the accordion was closed. */\nexport const NO_CATEGORY = -1;\n\nexport interface CategorySelection {\n /** The visible categories, in UI schema order. */\n categories: Category[];\n /** Index into {@link categories}, or {@link NO_CATEGORY}. */\n active: number;\n /** Selects by index into {@link categories}. */\n select: (index: number) => void;\n /**\n * Closes the open category, where the presentation permits it.\n *\n * Ignored unless the caller passed `closable` - a tab strip or a stepper\n * with nothing selected has no meaning. See Adjustment 10.2.\n */\n close: () => void;\n}\n\n/**\n * The navigation contract shared by the tabs, stepper and accordion\n * presentations of a Categorization.\n *\n * All three answer the same questions - which categories are visible, which\n * one is current, what happens when the current one disappears - and section 8\n * specifies the answers once, for all of them:\n *\n * - Visibility is the category's own rule. A visible category with no visible\n * children stays selectable; there is no `hideWhenEmpty`.\n * - \"When the selected category becomes hidden, select an available visible\n * category\": the selection is resolved from identity on every render, so a\n * category that disappears falls back to the initial one rather than leaving\n * a stale index pointing at a different category's content.\n * - With nothing visible there is \"no active category or stale active panel\",\n * which is what {@link NO_CATEGORY} means here.\n *\n * `closable` adds the one place this project **differs** from section 8: an\n * accordion may be closed entirely, so an explicit close is remembered and is\n * not undone by the fallback above. A tab strip and a stepper are not\n * closable - there is no such thing as a tab strip with no current tab - so\n * they leave it off and behave exactly as specified. See Adjustment 10.2.\n *\n * Selection is runtime UI state: it never writes form data or the UI schema.\n */\nexport const useCategorySelection = (\n categorization: Categorization,\n data: unknown,\n ajv: unknown,\n config: unknown,\n initiallySelected?: number,\n closable = false,\n path = '',\n): CategorySelection => {\n const effectiveCategories = useDynamicElements(\n categorization.elements ?? [],\n path,\n );\n const categories = useMemo(\n () =>\n effectiveCategories.filter((category) =>\n isVisible(category, data, path, ajv as never, config as never),\n ) as Category[],\n [effectiveCategories, data, ajv, config, path],\n );\n /*\n `undefined` means untouched, so `options.initial` decides. `null` means\n the user closed the accordion, which is a state they chose and which a\n later visibility change must not quietly undo - so it is a third value\n rather than a second meaning for `undefined`.\n */\n const initiallyCollapsed = resolveCollapsed(\n categorization.options,\n config,\n 'accordion',\n );\n const [selectedKey, setSelectedKey] = useState<string | null | undefined>(\n () =>\n initiallySelected === undefined\n ? closable && initiallyCollapsed && !categorization.options?.initial\n ? null\n : undefined\n : categoryKey(\n (categorization.elements ?? [])[initiallySelected] as Category,\n initiallySelected,\n ),\n );\n\n const [previousCollapsed, setPreviousCollapsed] =\n useState(initiallyCollapsed);\n if (previousCollapsed !== initiallyCollapsed) {\n setPreviousCollapsed(initiallyCollapsed);\n if (closable) setSelectedKey(initiallyCollapsed ? null : undefined);\n }\n\n const fromKey =\n typeof selectedKey !== 'string'\n ? NO_CATEGORY\n : categories.findIndex(\n (category, index) => categoryKey(category, index) === selectedKey,\n );\n const active =\n categories.length === 0 || selectedKey === null\n ? NO_CATEGORY\n : fromKey >= 0\n ? fromKey\n : resolveInitialIndex(categories, categorization);\n\n return {\n categories,\n active,\n select: (index: number) => {\n const category = categories[index];\n if (category) {\n setSelectedKey(categoryKey(category, index));\n }\n },\n close: () => {\n if (closable) {\n setSelectedKey(null);\n }\n },\n };\n};\n"],"mappings":"A,+MAkBA,IAAaU,GAAe,EAAoB,IAA0B,CACxE,IAAMC,EACJX,EAAAA,uBAAuBY,CAAQ,CAAC,CAChC,KACF,OAAO,OAAOD,GAAS,UAAYA,EAAK,OAAS,EAC7C,QAAQA,IACR,SAASE,GACf,EAGMC,EAAS,IAAI,QAYNC,GACX,EACA,IACW,C,MACX,IAAME,GAAA,EACJC,EAAe,UAAA,KAAA,IAAA,GAAAF,EACd,QACH,GAAI,OAAOC,GAAY,UAAYA,EAAQ,SAAW,EACpD,MAAO,GAET,IAAME,EAAQC,EAAW,UACtB,GAAcR,EAA2C,OAASK,CACrE,EAWA,OAVIE,GAAS,EACJA,GAEJL,EAAO,IAAII,CAAc,IAC5BJ,EAAO,IAAII,CAAc,EAEzB,QAAQ,KACN,oCAAoCD,EAAQ,8DAC9C,GAEK,EACT,EAGaI,EAAc,GA2CdC,GACX,EACA,EACA,EACA,EACA,EACA,EAAW,GACX,EAAO,KACe,CACtB,IAAMC,EAAsBtB,EAAAA,mBAC1BiB,EAAe,UAAY,CAAC,EAC5BM,CACF,EACMJ,GAAA,EAAalB,EAAAA,QAAAA,KAEfqB,EAAoB,OAAQ,IAAA,EAC1BpB,EAAAA,UAAAA,CAAUS,EAAUa,EAAMD,EAAME,EAAcC,CAAe,CAC/D,EACF,CAACJ,EAAqBE,EAAMC,EAAKC,EAAQH,CAAI,CAC/C,EAOMI,EAAqBxB,EAAAA,iBACzBc,EAAe,QACfS,EACA,WACF,EACM,CAACE,EAAaC,IAAA,EAAkBzB,EAAAA,SAAAA,KAElC,C,MAAsB,OAAA2B,IAAA,IAAA,GAClBC,GAAYL,GAAsB,GAAA,EAACV,EAAe,UAAA,MAAAa,EAAS,SACzD,KACA,IAAA,GACFrB,GACGQ,EAAe,UAAY,CAAC,EAAA,CAAGc,GAChCA,CACF,CACR,CAAA,EAEM,CAACE,EAAmBC,IAAA,EACxB9B,EAAAA,SAAAA,CAASuB,CAAkB,EACzBM,IAAsBN,IACxBO,EAAqBP,CAAkB,EACnCK,GAAUH,EAAeF,EAAqB,KAAO,IAAA,EAAS,GAGpE,IAAMQ,EACJ,OAAOP,GAAgB,SAEnBT,EAAW,WACR,EAAU,IAAUV,EAAYE,EAAUC,CAAK,IAAMgB,CACxD,EAJmB,GAYzB,MAAO,CACL,aACA,OARAT,EAAW,SAAW,GAAKS,IAAgB,KAAA,GAEvCO,GAAW,EACTA,EACArB,EAAoBK,EAAYF,CAAc,EAKpD,OAAS,GAAkB,CACzB,IAAMN,EAAWQ,EAAWP,GACxBD,GACFkB,EAAepB,EAAYE,EAAUC,CAAK,CAAC,CAE/C,EACA,UAAa,CACPoB,GACFH,EAAe,IAAI,CAEvB,CACF,CACF,E"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Categorization, Category } from '@jsonforms/core';
|
|
2
|
+
/**
|
|
3
|
+
* A category's stable identity, for keeping the selection across a reorder.
|
|
4
|
+
*
|
|
5
|
+
* The specification says to "preserve the selected category's identity across
|
|
6
|
+
* reordering" and that sibling `name`s SHOULD be unique, so the name is the
|
|
7
|
+
* identity when there is one. Without a name there is nothing to preserve -
|
|
8
|
+
* position is all a category has - so the index stands in, and moving an
|
|
9
|
+
* unnamed category moves the selection with the slot rather than the content.
|
|
10
|
+
* Prefixed so a category named `2` cannot collide with the third unnamed one.
|
|
11
|
+
*/
|
|
12
|
+
export declare const categoryKey: (category: Category, index: number) => string;
|
|
13
|
+
/**
|
|
14
|
+
* The index `options.initial` asks for, or `0`.
|
|
15
|
+
*
|
|
16
|
+
* "Missing target falls back to first visible category with diagnostic."
|
|
17
|
+
* The diagnostic is a console warning rather than something rendered: a name
|
|
18
|
+
* that does not match any category is a mistake in the UI schema, which the
|
|
19
|
+
* author can fix and the person filling in the form can do nothing about.
|
|
20
|
+
* That is why the specification's `categorization.initialNotFound` key has no
|
|
21
|
+
* entry in our catalogue - nothing user-facing uses it. See Adjustment 10.
|
|
22
|
+
*/
|
|
23
|
+
export declare const resolveInitialIndex: (categories: Category[], categorization: Categorization) => number;
|
|
24
|
+
/** Nothing open: no visible categories, or the accordion was closed. */
|
|
25
|
+
export declare const NO_CATEGORY = -1;
|
|
26
|
+
export interface CategorySelection {
|
|
27
|
+
/** The visible categories, in UI schema order. */
|
|
28
|
+
categories: Category[];
|
|
29
|
+
/** Index into {@link categories}, or {@link NO_CATEGORY}. */
|
|
30
|
+
active: number;
|
|
31
|
+
/** Selects by index into {@link categories}. */
|
|
32
|
+
select: (index: number) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Closes the open category, where the presentation permits it.
|
|
35
|
+
*
|
|
36
|
+
* Ignored unless the caller passed `closable` - a tab strip or a stepper
|
|
37
|
+
* with nothing selected has no meaning. See Adjustment 10.2.
|
|
38
|
+
*/
|
|
39
|
+
close: () => void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The navigation contract shared by the tabs, stepper and accordion
|
|
43
|
+
* presentations of a Categorization.
|
|
44
|
+
*
|
|
45
|
+
* All three answer the same questions - which categories are visible, which
|
|
46
|
+
* one is current, what happens when the current one disappears - and section 8
|
|
47
|
+
* specifies the answers once, for all of them:
|
|
48
|
+
*
|
|
49
|
+
* - Visibility is the category's own rule. A visible category with no visible
|
|
50
|
+
* children stays selectable; there is no `hideWhenEmpty`.
|
|
51
|
+
* - "When the selected category becomes hidden, select an available visible
|
|
52
|
+
* category": the selection is resolved from identity on every render, so a
|
|
53
|
+
* category that disappears falls back to the initial one rather than leaving
|
|
54
|
+
* a stale index pointing at a different category's content.
|
|
55
|
+
* - With nothing visible there is "no active category or stale active panel",
|
|
56
|
+
* which is what {@link NO_CATEGORY} means here.
|
|
57
|
+
*
|
|
58
|
+
* `closable` adds the one place this project **differs** from section 8: an
|
|
59
|
+
* accordion may be closed entirely, so an explicit close is remembered and is
|
|
60
|
+
* not undone by the fallback above. A tab strip and a stepper are not
|
|
61
|
+
* closable - there is no such thing as a tab strip with no current tab - so
|
|
62
|
+
* they leave it off and behave exactly as specified. See Adjustment 10.2.
|
|
63
|
+
*
|
|
64
|
+
* Selection is runtime UI state: it never writes form data or the UI schema.
|
|
65
|
+
*/
|
|
66
|
+
export declare const useCategorySelection: (categorization: Categorization, data: unknown, ajv: unknown, config: unknown, initiallySelected?: number, closable?: boolean, path?: string) => CategorySelection;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { dynamicAuthoredElement as e, useDynamicElements as t } from "../dynamic/DynamicUiProvider.esm.js";
|
|
2
|
+
import { resolveCollapsed as n } from "./groupState.esm.js";
|
|
3
|
+
import { useMemo as r, useState as i } from "react";
|
|
4
|
+
import { isVisible as a } from "@jsonforms/core";
|
|
5
|
+
// src/layout/categoryState.ts
|
|
6
|
+
var o = (t, n) => {
|
|
7
|
+
let r = e(t).name;
|
|
8
|
+
return typeof r == "string" && r.length > 0 ? `name:${r}` : `index:${n}`;
|
|
9
|
+
}, s = /* @__PURE__ */ new WeakSet(), c = (e, t) => {
|
|
10
|
+
var n;
|
|
11
|
+
let r = (n = t.options) == null ? void 0 : n.initial;
|
|
12
|
+
if (typeof r != "string" || r.length === 0) return 0;
|
|
13
|
+
let i = e.findIndex((e) => e.name === r);
|
|
14
|
+
return i >= 0 ? i : (s.has(t) || (s.add(t), console.warn(`Categorization: options.initial "${r}" matches no visible category; opening the first one instead.`)), 0);
|
|
15
|
+
}, l = -1, u = (e, s, l, u, d, f = !1, p = "") => {
|
|
16
|
+
let m = t(e.elements ?? [], p), h = r(() => m.filter((e) => a(e, s, p, l, u)), [
|
|
17
|
+
m,
|
|
18
|
+
s,
|
|
19
|
+
l,
|
|
20
|
+
u,
|
|
21
|
+
p
|
|
22
|
+
]), g = n(e.options, u, "accordion"), [_, v] = i(() => {
|
|
23
|
+
var t;
|
|
24
|
+
return d === void 0 ? f && g && !((t = e.options) != null && t.initial) ? null : void 0 : o((e.elements ?? [])[d], d);
|
|
25
|
+
}), [y, b] = i(g);
|
|
26
|
+
y !== g && (b(g), f && v(g ? null : void 0));
|
|
27
|
+
let x = typeof _ == "string" ? h.findIndex((e, t) => o(e, t) === _) : -1;
|
|
28
|
+
return {
|
|
29
|
+
categories: h,
|
|
30
|
+
active: h.length === 0 || _ === null ? -1 : x >= 0 ? x : c(h, e),
|
|
31
|
+
select: (e) => {
|
|
32
|
+
let t = h[e];
|
|
33
|
+
t && v(o(t, e));
|
|
34
|
+
},
|
|
35
|
+
close: () => {
|
|
36
|
+
f && v(null);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export { l as NO_CATEGORY, o as categoryKey, c as resolveInitialIndex, u as useCategorySelection };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=categoryState.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categoryState.esm.js","names":["categoryKey","name","dynamicAuthoredElement","category","index","warned","resolveInitialIndex","_categorization$optio","initial","categorization","found","categories","NO_CATEGORY","useCategorySelection","effectiveCategories","useDynamicElements","path","useMemo","isVisible","data","ajv","config","initiallyCollapsed","resolveCollapsed","selectedKey","setSelectedKey","useState","_categorization$optio2","initiallySelected","closable","previousCollapsed","setPreviousCollapsed","fromKey"],"sources":["../../src/layout/categoryState.ts"],"sourcesContent":["import {\n useDynamicElements,\n dynamicAuthoredElement,\n} from '../dynamic/DynamicUiProvider';\nimport { resolveCollapsed } from './groupState';\nimport { Categorization, Category, isVisible } from '@jsonforms/core';\nimport { useMemo, useState } from 'react';\n\n/**\n * A category's stable identity, for keeping the selection across a reorder.\n *\n * The specification says to \"preserve the selected category's identity across\n * reordering\" and that sibling `name`s SHOULD be unique, so the name is the\n * identity when there is one. Without a name there is nothing to preserve -\n * position is all a category has - so the index stands in, and moving an\n * unnamed category moves the selection with the slot rather than the content.\n * Prefixed so a category named `2` cannot collide with the third unnamed one.\n */\nexport const categoryKey = (category: Category, index: number): string => {\n const name = (\n dynamicAuthoredElement(category) as Category & { name?: unknown }\n ).name;\n return typeof name === 'string' && name.length > 0\n ? `name:${name}`\n : `index:${index}`;\n};\n\n/** Warned-about elements, so an authoring mistake is reported once, not per render. */\nconst warned = new WeakSet<Categorization>();\n\n/**\n * The index `options.initial` asks for, or `0`.\n *\n * \"Missing target falls back to first visible category with diagnostic.\"\n * The diagnostic is a console warning rather than something rendered: a name\n * that does not match any category is a mistake in the UI schema, which the\n * author can fix and the person filling in the form can do nothing about.\n * That is why the specification's `categorization.initialNotFound` key has no\n * entry in our catalogue - nothing user-facing uses it. See Adjustment 10.\n */\nexport const resolveInitialIndex = (\n categories: Category[],\n categorization: Categorization,\n): number => {\n const initial = (\n categorization.options as Record<string, unknown> | undefined\n )?.initial;\n if (typeof initial !== 'string' || initial.length === 0) {\n return 0;\n }\n const found = categories.findIndex(\n (category) => (category as Category & { name?: unknown }).name === initial,\n );\n if (found >= 0) {\n return found;\n }\n if (!warned.has(categorization)) {\n warned.add(categorization);\n // oxlint-disable-next-line no-console\n console.warn(\n `Categorization: options.initial \"${initial}\" matches no visible category; opening the first one instead.`,\n );\n }\n return 0;\n};\n\n/** Nothing open: no visible categories, or the accordion was closed. */\nexport const NO_CATEGORY = -1;\n\nexport interface CategorySelection {\n /** The visible categories, in UI schema order. */\n categories: Category[];\n /** Index into {@link categories}, or {@link NO_CATEGORY}. */\n active: number;\n /** Selects by index into {@link categories}. */\n select: (index: number) => void;\n /**\n * Closes the open category, where the presentation permits it.\n *\n * Ignored unless the caller passed `closable` - a tab strip or a stepper\n * with nothing selected has no meaning. See Adjustment 10.2.\n */\n close: () => void;\n}\n\n/**\n * The navigation contract shared by the tabs, stepper and accordion\n * presentations of a Categorization.\n *\n * All three answer the same questions - which categories are visible, which\n * one is current, what happens when the current one disappears - and section 8\n * specifies the answers once, for all of them:\n *\n * - Visibility is the category's own rule. A visible category with no visible\n * children stays selectable; there is no `hideWhenEmpty`.\n * - \"When the selected category becomes hidden, select an available visible\n * category\": the selection is resolved from identity on every render, so a\n * category that disappears falls back to the initial one rather than leaving\n * a stale index pointing at a different category's content.\n * - With nothing visible there is \"no active category or stale active panel\",\n * which is what {@link NO_CATEGORY} means here.\n *\n * `closable` adds the one place this project **differs** from section 8: an\n * accordion may be closed entirely, so an explicit close is remembered and is\n * not undone by the fallback above. A tab strip and a stepper are not\n * closable - there is no such thing as a tab strip with no current tab - so\n * they leave it off and behave exactly as specified. See Adjustment 10.2.\n *\n * Selection is runtime UI state: it never writes form data or the UI schema.\n */\nexport const useCategorySelection = (\n categorization: Categorization,\n data: unknown,\n ajv: unknown,\n config: unknown,\n initiallySelected?: number,\n closable = false,\n path = '',\n): CategorySelection => {\n const effectiveCategories = useDynamicElements(\n categorization.elements ?? [],\n path,\n );\n const categories = useMemo(\n () =>\n effectiveCategories.filter((category) =>\n isVisible(category, data, path, ajv as never, config as never),\n ) as Category[],\n [effectiveCategories, data, ajv, config, path],\n );\n /*\n `undefined` means untouched, so `options.initial` decides. `null` means\n the user closed the accordion, which is a state they chose and which a\n later visibility change must not quietly undo - so it is a third value\n rather than a second meaning for `undefined`.\n */\n const initiallyCollapsed = resolveCollapsed(\n categorization.options,\n config,\n 'accordion',\n );\n const [selectedKey, setSelectedKey] = useState<string | null | undefined>(\n () =>\n initiallySelected === undefined\n ? closable && initiallyCollapsed && !categorization.options?.initial\n ? null\n : undefined\n : categoryKey(\n (categorization.elements ?? [])[initiallySelected] as Category,\n initiallySelected,\n ),\n );\n\n const [previousCollapsed, setPreviousCollapsed] =\n useState(initiallyCollapsed);\n if (previousCollapsed !== initiallyCollapsed) {\n setPreviousCollapsed(initiallyCollapsed);\n if (closable) setSelectedKey(initiallyCollapsed ? null : undefined);\n }\n\n const fromKey =\n typeof selectedKey !== 'string'\n ? NO_CATEGORY\n : categories.findIndex(\n (category, index) => categoryKey(category, index) === selectedKey,\n );\n const active =\n categories.length === 0 || selectedKey === null\n ? NO_CATEGORY\n : fromKey >= 0\n ? fromKey\n : resolveInitialIndex(categories, categorization);\n\n return {\n categories,\n active,\n select: (index: number) => {\n const category = categories[index];\n if (category) {\n setSelectedKey(categoryKey(category, index));\n }\n },\n close: () => {\n if (closable) {\n setSelectedKey(null);\n }\n },\n };\n};\n"],"mappings":";;;;;AAkBA,IAAaA,KAAe,GAAoB,MAA0B;CACxE,IAAMC,IACJC,EAAuBC,CAAQ,CAAC,CAChC;CACF,OAAO,OAAOF,KAAS,YAAYA,EAAK,SAAS,IAC7C,QAAQA,MACR,SAASG;AACf,GAGMC,oBAAS,IAAI,QAAwB,GAY9BC,KACX,GACA,MACW;;CACX,IAAME,KAAA,IACJC,EAAe,YAAA,OAAA,KAAA,IAAAF,EACd;CACH,IAAI,OAAOC,KAAY,YAAYA,EAAQ,WAAW,GACpD,OAAO;CAET,IAAME,IAAQC,EAAW,WACtB,MAAcR,EAA2C,SAASK,CACrE;CAWA,OAVIE,KAAS,IACJA,KAEJL,EAAO,IAAII,CAAc,MAC5BJ,EAAO,IAAII,CAAc,GAEzB,QAAQ,KACN,oCAAoCD,EAAQ,8DAC9C,IAEK;AACT,GAGaI,IAAc,IA2CdC,KACX,GACA,GACA,GACA,GACA,GACA,IAAW,IACX,IAAO,OACe;CACtB,IAAMC,IAAsBC,EAC1BN,EAAe,YAAY,CAAC,GAC5BO,CACF,GACML,IAAaM,QAEfH,EAAoB,QAAQ,MAC1BI,EAAUf,GAAUgB,GAAMH,GAAMI,GAAcC,CAAe,CAC/D,GACF;EAACP;EAAqBK;EAAMC;EAAKC;EAAQL;CAAI,CAC/C,GAOMM,IAAqBC,EACzBd,EAAe,SACfY,GACA,WACF,GACM,CAACG,GAAaC,KAAkBC,QAElC;;EAAsB,OAAAE,MAAA,KAAA,IAClBC,KAAYP,KAAsB,GAAA,IAACb,EAAe,YAAA,QAAAkB,EAAS,WACzD,OACA,KAAA,IACF3B,GACGS,EAAe,YAAY,CAAC,EAAA,CAAGmB,IAChCA,CACF;CACR,CAAA,GAEM,CAACE,GAAmBC,KACxBL,EAASJ,CAAkB;CAC7B,AAAIQ,MAAsBR,MACxBS,EAAqBT,CAAkB,GACnCO,KAAUJ,EAAeH,IAAqB,OAAO,KAAA,CAAS;CAGpE,IAAMU,IACJ,OAAOR,KAAgB,WAEnBb,EAAW,WACR,GAAU,MAAUX,EAAYG,GAAUC,CAAK,MAAMoB,CACxD,IAJmB;CAYzB,OAAO;EACL;EACA,QARAb,EAAW,WAAW,KAAKa,MAAgB,OAAA,KAEvCQ,KAAW,IACTA,IACA1B,EAAoBK,GAAYF,CAAc;EAKpD,SAAS,MAAkB;GACzB,IAAMN,IAAWQ,EAAWP;GAC5B,AAAID,KACFsB,EAAezB,EAAYG,GAAUC,CAAK,CAAC;EAE/C;EACA,aAAa;GACX,AAAIyB,KACFJ,EAAe,IAAI;EAEvB;CACF;AACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../locale/translate.cjs.js"),t=require("../dynamic/DynamicUiProvider.cjs.js"),n=require("../core/configNamespaces.cjs.js");let r=require("react"),i=require("@jsonforms/core"),a=require("@jsonforms/react");var o=e=>e==null?!1:typeof e==`string`?e.trim().length>0:Array.isArray(e)?e.some(o):typeof e!=`object`||Object.values(e).some(o),s=new WeakMap,c=e=>{let t=s.get(e);if(t)return t;let n=[],r=e=>{var t;let a=e;if((a.type===`Control`||a.type===`ListWithDetail`)&&typeof a.scope==`string`){let e=(0,i.toDataPathSegments)(a.scope);n.push({segments:e,relative:e.join(`.`)})}(t=a.elements)==null||t.forEach(r)};return r(e),s.set(e,n),n},l=(e,t=``)=>c(e).map(({relative:e})=>[t,e].filter(Boolean).join(`.`)),u=(e,t)=>t.reduce((e,t)=>typeof e==`object`&&e?e[t]:void 0,e),d=(e,t,n=``)=>{let r=n?i.Resolve.data(t,n):t;return c(e).some(({segments:e})=>o(u(r,e)))},f=(e,n,i)=>{var o;let s=(0,a.useJsonForms)(),c=t.useDynamicTreeResolver(n)(e),{collapsible:l,collapsed:u,setExpanded:f}=m(c,i),h=p(c,i,`showDataIndicator`)===!0,g=(o=s.core)==null?void 0:o.data,_=(0,r.useId)(),v=(0,r.useMemo)(()=>h&&d(c,g,n),[h,c,g,n]);return{contentId:_,collapsible:l,collapsed:l&&u,hasData:v,toggle:()=>f(u)}},p=(e,t,r)=>{var i;let a=t==null?void 0:t[n.JSONFORMS_EXTENDED_CONFIG_KEY];return((i=e.options)==null?void 0:i[r])??(a==null?void 0:a[r])},m=(e,t,n=!1,i=`group`)=>{let a=(p(e,t,`collapsible`)??n)===!0,o=h(e.options,t,i),[s,c]=(0,r.useState)(o),[l,u]=(0,r.useState)(o);return l!==o&&(u(o),c(o)),{collapsible:a,collapsed:a&&s,setExpanded:(0,r.useCallback)(e=>c(!e),[])}},h=(e,t,n)=>{var r,i;return((e==null?void 0:e.collapsed)??(t==null||(r=t.jsonformsExtended)==null||(r=r[n])==null?void 0:r.collapsed)??(t==null||(i=t.jsonformsExtended)==null?void 0:i.collapsed)??!1)===!0};function g(n,r){let i=e.useTranslator(),a=t.useDynamicTreeResolver(n),o=r==null?void 0:r.map(a).find(e=>e.type===`Label`);return o!=null&&o.i18n?i(`${o.i18n}.text`,o.text||``):o==null?void 0:o.text}exports.boundDataPaths=l,exports.collectBoundPaths=c,exports.groupHasData=d,exports.hasGroupValue=o,exports.resolveCollapsed=h,exports.useGroupExpansion=m,exports.useGroupHeaderTitle=g,exports.useGroupState=f;
|
|
2
|
+
//# sourceMappingURL=groupState.cjs.js.map
|