@veridid/workflow-ui 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 +202 -0
- package/README.md +202 -2
- package/build/module/WorkflowFontScaleContext.js +67 -0
- package/build/module/WorkflowFontScaleContext.js.map +1 -0
- package/build/module/adapter/WalletAdapter.js +152 -0
- package/build/module/adapter/WalletAdapter.js.map +1 -0
- package/build/module/components/FallbackVideoPlayer.js +8 -0
- package/build/module/components/FallbackVideoPlayer.js.map +1 -0
- package/build/module/components/FallbackVideoPlayer.native.js +10 -0
- package/build/module/components/FallbackVideoPlayer.native.js.map +1 -0
- package/build/module/components/FallbackVideoPlayer.web.js +35 -0
- package/build/module/components/FallbackVideoPlayer.web.js.map +1 -0
- package/build/module/components/WorkflowButtonLabel.js +32 -0
- package/build/module/components/WorkflowButtonLabel.js.map +1 -0
- package/build/module/components/WorkflowCalendarIcon.js +73 -0
- package/build/module/components/WorkflowCalendarIcon.js.map +1 -0
- package/build/module/components/WorkflowText.js +92 -0
- package/build/module/components/WorkflowText.js.map +1 -0
- package/build/module/content/BadgeContent.js +73 -0
- package/build/module/content/BadgeContent.js.map +1 -0
- package/build/module/content/BarChartContent.js +97 -0
- package/build/module/content/BarChartContent.js.map +1 -0
- package/build/module/content/BarcodeContent.js +78 -0
- package/build/module/content/BarcodeContent.js.map +1 -0
- package/build/module/content/BasicTableContent.js +145 -0
- package/build/module/content/BasicTableContent.js.map +1 -0
- package/build/module/content/ButtonContent.js +130 -0
- package/build/module/content/ButtonContent.js.map +1 -0
- package/build/module/content/CalendarContent.js +173 -0
- package/build/module/content/CalendarContent.js.map +1 -0
- package/build/module/content/CardContent.js +114 -0
- package/build/module/content/CardContent.js.map +1 -0
- package/build/module/content/CarouselContent.js +173 -0
- package/build/module/content/CarouselContent.js.map +1 -0
- package/build/module/content/ChipContent.js +214 -0
- package/build/module/content/ChipContent.js.map +1 -0
- package/build/module/content/ChipRowContent.js +127 -0
- package/build/module/content/ChipRowContent.js.map +1 -0
- package/build/module/content/CredentialOfferContent.js +312 -0
- package/build/module/content/CredentialOfferContent.js.map +1 -0
- package/build/module/content/DialContent.js +101 -0
- package/build/module/content/DialContent.js.map +1 -0
- package/build/module/content/DividerContent.js +26 -0
- package/build/module/content/DividerContent.js.map +1 -0
- package/build/module/content/DonutChartContent.js +118 -0
- package/build/module/content/DonutChartContent.js.map +1 -0
- package/build/module/content/FormContent.js +141 -0
- package/build/module/content/FormContent.js.map +1 -0
- package/build/module/content/FormFieldBridge.js +157 -0
- package/build/module/content/FormFieldBridge.js.map +1 -0
- package/build/module/content/GaugeContent.js +77 -0
- package/build/module/content/GaugeContent.js.map +1 -0
- package/build/module/content/GridLayoutContent.js +227 -0
- package/build/module/content/GridLayoutContent.js.map +1 -0
- package/build/module/content/ImageContent.js +190 -0
- package/build/module/content/ImageContent.js.map +1 -0
- package/build/module/content/ListContent.js +107 -0
- package/build/module/content/ListContent.js.map +1 -0
- package/build/module/content/LocationContent.js +148 -0
- package/build/module/content/LocationContent.js.map +1 -0
- package/build/module/content/MapContent.js +213 -0
- package/build/module/content/MapContent.js.map +1 -0
- package/build/module/content/MultipleChoiceContent.js +91 -0
- package/build/module/content/MultipleChoiceContent.js.map +1 -0
- package/build/module/content/OpenBadgePreviewContent.js +141 -0
- package/build/module/content/OpenBadgePreviewContent.js.map +1 -0
- package/build/module/content/PhotoContent.js +154 -0
- package/build/module/content/PhotoContent.js.map +1 -0
- package/build/module/content/PieChartContent.js +129 -0
- package/build/module/content/PieChartContent.js.map +1 -0
- package/build/module/content/ProofPresentationContent.js +154 -0
- package/build/module/content/ProofPresentationContent.js.map +1 -0
- package/build/module/content/RadioButtonContent.js +136 -0
- package/build/module/content/RadioButtonContent.js.map +1 -0
- package/build/module/content/RowContent.js +539 -0
- package/build/module/content/RowContent.js.map +1 -0
- package/build/module/content/SectionContent.js +123 -0
- package/build/module/content/SectionContent.js.map +1 -0
- package/build/module/content/ShareEntryContent.js +111 -0
- package/build/module/content/ShareEntryContent.js.map +1 -0
- package/build/module/content/SimulatedHint.js +33 -0
- package/build/module/content/SimulatedHint.js.map +1 -0
- package/build/module/content/SliderContent.js +46 -0
- package/build/module/content/SliderContent.js.map +1 -0
- package/build/module/content/SpacerContent.js +21 -0
- package/build/module/content/SpacerContent.js.map +1 -0
- package/build/module/content/SpinnerContent.js +33 -0
- package/build/module/content/SpinnerContent.js.map +1 -0
- package/build/module/content/SubmitButtonContent.js +281 -0
- package/build/module/content/SubmitButtonContent.js.map +1 -0
- package/build/module/content/TextContent.js +127 -0
- package/build/module/content/TextContent.js.map +1 -0
- package/build/module/content/TileContent.js +237 -0
- package/build/module/content/TileContent.js.map +1 -0
- package/build/module/content/TimelineContent.js +120 -0
- package/build/module/content/TimelineContent.js.map +1 -0
- package/build/module/content/TitleContent.js +55 -0
- package/build/module/content/TitleContent.js.map +1 -0
- package/build/module/content/VideoContent.js +142 -0
- package/build/module/content/VideoContent.js.map +1 -0
- package/build/module/content/WebLinkContent.js +95 -0
- package/build/module/content/WebLinkContent.js.map +1 -0
- package/build/module/content/index.js +48 -0
- package/build/module/content/index.js.map +1 -0
- package/build/module/form-fields/CheckboxField.js +47 -0
- package/build/module/form-fields/CheckboxField.js.map +1 -0
- package/build/module/form-fields/DateField.js +8 -0
- package/build/module/form-fields/DateField.js.map +1 -0
- package/build/module/form-fields/DateField.native.js +141 -0
- package/build/module/form-fields/DateField.native.js.map +1 -0
- package/build/module/form-fields/DateField.web.js +45 -0
- package/build/module/form-fields/DateField.web.js.map +1 -0
- package/build/module/form-fields/DropdownField.js +172 -0
- package/build/module/form-fields/DropdownField.js.map +1 -0
- package/build/module/form-fields/MCQField.js +100 -0
- package/build/module/form-fields/MCQField.js.map +1 -0
- package/build/module/form-fields/RadioField.js +56 -0
- package/build/module/form-fields/RadioField.js.map +1 -0
- package/build/module/form-fields/SliderField.js +8 -0
- package/build/module/form-fields/SliderField.js.map +1 -0
- package/build/module/form-fields/SliderField.native.js +77 -0
- package/build/module/form-fields/SliderField.native.js.map +1 -0
- package/build/module/form-fields/SliderField.web.js +82 -0
- package/build/module/form-fields/SliderField.web.js.map +1 -0
- package/build/module/form-fields/SubmitButtonField.js +42 -0
- package/build/module/form-fields/SubmitButtonField.js.map +1 -0
- package/build/module/form-fields/TextField.js +56 -0
- package/build/module/form-fields/TextField.js.map +1 -0
- package/build/module/form-fields/index.js +15 -0
- package/build/module/form-fields/index.js.map +1 -0
- package/build/module/i18n/WorkflowI18n.js +94 -0
- package/build/module/i18n/WorkflowI18n.js.map +1 -0
- package/build/module/icons/WorkflowIcon.js +50 -0
- package/build/module/icons/WorkflowIcon.js.map +1 -0
- package/build/module/imageUriCache.js +25 -0
- package/build/module/imageUriCache.js.map +1 -0
- package/build/module/index.js +49 -0
- package/build/module/index.js.map +1 -0
- package/build/module/modal/WorkflowModal.js +115 -0
- package/build/module/modal/WorkflowModal.js.map +1 -0
- package/build/module/package.json +1 -0
- package/build/module/platform/platformName.js +10 -0
- package/build/module/platform/platformName.js.map +1 -0
- package/build/module/platform/platformName.web.js +5 -0
- package/build/module/platform/platformName.web.js.map +1 -0
- package/build/module/protocol/controlSnapshotStore.js +19 -0
- package/build/module/protocol/controlSnapshotStore.js.map +1 -0
- package/build/module/protocol/useProtocolExchange.js +168 -0
- package/build/module/protocol/useProtocolExchange.js.map +1 -0
- package/build/module/registries/ContentRegistry.js +53 -0
- package/build/module/registries/ContentRegistry.js.map +1 -0
- package/build/module/registries/FormFieldRegistry.js +56 -0
- package/build/module/registries/FormFieldRegistry.js.map +1 -0
- package/build/module/render/NodeBoundary.js +73 -0
- package/build/module/render/NodeBoundary.js.map +1 -0
- package/build/module/render/RenderTree.js +52 -0
- package/build/module/render/RenderTree.js.map +1 -0
- package/build/module/render/WorkflowRenderContext.js +34 -0
- package/build/module/render/WorkflowRenderContext.js.map +1 -0
- package/build/module/render/nodes.js +103 -0
- package/build/module/render/nodes.js.map +1 -0
- package/build/module/responsive/ResponsiveProvider.js +63 -0
- package/build/module/responsive/ResponsiveProvider.js.map +1 -0
- package/build/module/responsive/index.js +4 -0
- package/build/module/responsive/index.js.map +1 -0
- package/build/module/responsive/responsive.js +56 -0
- package/build/module/responsive/responsive.js.map +1 -0
- package/build/module/style/resolveDisplayHintStyle.js +145 -0
- package/build/module/style/resolveDisplayHintStyle.js.map +1 -0
- package/build/module/theme/WorkflowTheme.js +200 -0
- package/build/module/theme/WorkflowTheme.js.map +1 -0
- package/build/module/utils/testable.js +12 -0
- package/build/module/utils/testable.js.map +1 -0
- package/build/typescript/WorkflowFontScaleContext.d.ts +7 -0
- package/build/typescript/WorkflowFontScaleContext.d.ts.map +1 -0
- package/build/typescript/adapter/WalletAdapter.d.ts +145 -0
- package/build/typescript/adapter/WalletAdapter.d.ts.map +1 -0
- package/build/typescript/components/FallbackVideoPlayer.d.ts +6 -0
- package/build/typescript/components/FallbackVideoPlayer.d.ts.map +1 -0
- package/build/typescript/components/FallbackVideoPlayer.native.d.ts +7 -0
- package/build/typescript/components/FallbackVideoPlayer.native.d.ts.map +1 -0
- package/build/typescript/components/FallbackVideoPlayer.web.d.ts +9 -0
- package/build/typescript/components/FallbackVideoPlayer.web.d.ts.map +1 -0
- package/build/typescript/components/WorkflowButtonLabel.d.ts +11 -0
- package/build/typescript/components/WorkflowButtonLabel.d.ts.map +1 -0
- package/build/typescript/components/WorkflowCalendarIcon.d.ts +11 -0
- package/build/typescript/components/WorkflowCalendarIcon.d.ts.map +1 -0
- package/build/typescript/components/WorkflowText.d.ts +13 -0
- package/build/typescript/components/WorkflowText.d.ts.map +1 -0
- package/build/typescript/content/BadgeContent.d.ts +5 -0
- package/build/typescript/content/BadgeContent.d.ts.map +1 -0
- package/build/typescript/content/BarChartContent.d.ts +5 -0
- package/build/typescript/content/BarChartContent.d.ts.map +1 -0
- package/build/typescript/content/BarcodeContent.d.ts +11 -0
- package/build/typescript/content/BarcodeContent.d.ts.map +1 -0
- package/build/typescript/content/BasicTableContent.d.ts +5 -0
- package/build/typescript/content/BasicTableContent.d.ts.map +1 -0
- package/build/typescript/content/ButtonContent.d.ts +5 -0
- package/build/typescript/content/ButtonContent.d.ts.map +1 -0
- package/build/typescript/content/CalendarContent.d.ts +19 -0
- package/build/typescript/content/CalendarContent.d.ts.map +1 -0
- package/build/typescript/content/CardContent.d.ts +5 -0
- package/build/typescript/content/CardContent.d.ts.map +1 -0
- package/build/typescript/content/CarouselContent.d.ts +5 -0
- package/build/typescript/content/CarouselContent.d.ts.map +1 -0
- package/build/typescript/content/ChipContent.d.ts +5 -0
- package/build/typescript/content/ChipContent.d.ts.map +1 -0
- package/build/typescript/content/ChipRowContent.d.ts +8 -0
- package/build/typescript/content/ChipRowContent.d.ts.map +1 -0
- package/build/typescript/content/CredentialOfferContent.d.ts +98 -0
- package/build/typescript/content/CredentialOfferContent.d.ts.map +1 -0
- package/build/typescript/content/DialContent.d.ts +5 -0
- package/build/typescript/content/DialContent.d.ts.map +1 -0
- package/build/typescript/content/DividerContent.d.ts +5 -0
- package/build/typescript/content/DividerContent.d.ts.map +1 -0
- package/build/typescript/content/DonutChartContent.d.ts +5 -0
- package/build/typescript/content/DonutChartContent.d.ts.map +1 -0
- package/build/typescript/content/FormContent.d.ts +19 -0
- package/build/typescript/content/FormContent.d.ts.map +1 -0
- package/build/typescript/content/FormFieldBridge.d.ts +2 -0
- package/build/typescript/content/FormFieldBridge.d.ts.map +1 -0
- package/build/typescript/content/GaugeContent.d.ts +5 -0
- package/build/typescript/content/GaugeContent.d.ts.map +1 -0
- package/build/typescript/content/GridLayoutContent.d.ts +5 -0
- package/build/typescript/content/GridLayoutContent.d.ts.map +1 -0
- package/build/typescript/content/ImageContent.d.ts +5 -0
- package/build/typescript/content/ImageContent.d.ts.map +1 -0
- package/build/typescript/content/ListContent.d.ts +5 -0
- package/build/typescript/content/ListContent.d.ts.map +1 -0
- package/build/typescript/content/LocationContent.d.ts +32 -0
- package/build/typescript/content/LocationContent.d.ts.map +1 -0
- package/build/typescript/content/MapContent.d.ts +11 -0
- package/build/typescript/content/MapContent.d.ts.map +1 -0
- package/build/typescript/content/MultipleChoiceContent.d.ts +5 -0
- package/build/typescript/content/MultipleChoiceContent.d.ts.map +1 -0
- package/build/typescript/content/OpenBadgePreviewContent.d.ts +14 -0
- package/build/typescript/content/OpenBadgePreviewContent.d.ts.map +1 -0
- package/build/typescript/content/PhotoContent.d.ts +57 -0
- package/build/typescript/content/PhotoContent.d.ts.map +1 -0
- package/build/typescript/content/PieChartContent.d.ts +5 -0
- package/build/typescript/content/PieChartContent.d.ts.map +1 -0
- package/build/typescript/content/ProofPresentationContent.d.ts +14 -0
- package/build/typescript/content/ProofPresentationContent.d.ts.map +1 -0
- package/build/typescript/content/RadioButtonContent.d.ts +5 -0
- package/build/typescript/content/RadioButtonContent.d.ts.map +1 -0
- package/build/typescript/content/RowContent.d.ts +5 -0
- package/build/typescript/content/RowContent.d.ts.map +1 -0
- package/build/typescript/content/SectionContent.d.ts +5 -0
- package/build/typescript/content/SectionContent.d.ts.map +1 -0
- package/build/typescript/content/ShareEntryContent.d.ts +15 -0
- package/build/typescript/content/ShareEntryContent.d.ts.map +1 -0
- package/build/typescript/content/SimulatedHint.d.ts +9 -0
- package/build/typescript/content/SimulatedHint.d.ts.map +1 -0
- package/build/typescript/content/SliderContent.d.ts +10 -0
- package/build/typescript/content/SliderContent.d.ts.map +1 -0
- package/build/typescript/content/SpacerContent.d.ts +5 -0
- package/build/typescript/content/SpacerContent.d.ts.map +1 -0
- package/build/typescript/content/SpinnerContent.d.ts +5 -0
- package/build/typescript/content/SpinnerContent.d.ts.map +1 -0
- package/build/typescript/content/SubmitButtonContent.d.ts +9 -0
- package/build/typescript/content/SubmitButtonContent.d.ts.map +1 -0
- package/build/typescript/content/TextContent.d.ts +5 -0
- package/build/typescript/content/TextContent.d.ts.map +1 -0
- package/build/typescript/content/TileContent.d.ts +5 -0
- package/build/typescript/content/TileContent.d.ts.map +1 -0
- package/build/typescript/content/TimelineContent.d.ts +5 -0
- package/build/typescript/content/TimelineContent.d.ts.map +1 -0
- package/build/typescript/content/TitleContent.d.ts +5 -0
- package/build/typescript/content/TitleContent.d.ts.map +1 -0
- package/build/typescript/content/VideoContent.d.ts +10 -0
- package/build/typescript/content/VideoContent.d.ts.map +1 -0
- package/build/typescript/content/WebLinkContent.d.ts +5 -0
- package/build/typescript/content/WebLinkContent.d.ts.map +1 -0
- package/build/typescript/content/index.d.ts +46 -0
- package/build/typescript/content/index.d.ts.map +1 -0
- package/build/typescript/form-fields/CheckboxField.d.ts +5 -0
- package/build/typescript/form-fields/CheckboxField.d.ts.map +1 -0
- package/build/typescript/form-fields/DateField.d.ts +6 -0
- package/build/typescript/form-fields/DateField.d.ts.map +1 -0
- package/build/typescript/form-fields/DateField.native.d.ts +5 -0
- package/build/typescript/form-fields/DateField.native.d.ts.map +1 -0
- package/build/typescript/form-fields/DateField.web.d.ts +9 -0
- package/build/typescript/form-fields/DateField.web.d.ts.map +1 -0
- package/build/typescript/form-fields/DropdownField.d.ts +5 -0
- package/build/typescript/form-fields/DropdownField.d.ts.map +1 -0
- package/build/typescript/form-fields/MCQField.d.ts +5 -0
- package/build/typescript/form-fields/MCQField.d.ts.map +1 -0
- package/build/typescript/form-fields/RadioField.d.ts +5 -0
- package/build/typescript/form-fields/RadioField.d.ts.map +1 -0
- package/build/typescript/form-fields/SliderField.d.ts +6 -0
- package/build/typescript/form-fields/SliderField.d.ts.map +1 -0
- package/build/typescript/form-fields/SliderField.native.d.ts +5 -0
- package/build/typescript/form-fields/SliderField.native.d.ts.map +1 -0
- package/build/typescript/form-fields/SliderField.web.d.ts +11 -0
- package/build/typescript/form-fields/SliderField.web.d.ts.map +1 -0
- package/build/typescript/form-fields/SubmitButtonField.d.ts +5 -0
- package/build/typescript/form-fields/SubmitButtonField.d.ts.map +1 -0
- package/build/typescript/form-fields/TextField.d.ts +5 -0
- package/build/typescript/form-fields/TextField.d.ts.map +1 -0
- package/build/typescript/form-fields/index.d.ts +13 -0
- package/build/typescript/form-fields/index.d.ts.map +1 -0
- package/build/typescript/i18n/WorkflowI18n.d.ts +75 -0
- package/build/typescript/i18n/WorkflowI18n.d.ts.map +1 -0
- package/build/typescript/icons/WorkflowIcon.d.ts +27 -0
- package/build/typescript/icons/WorkflowIcon.d.ts.map +1 -0
- package/build/typescript/imageUriCache.d.ts +7 -0
- package/build/typescript/imageUriCache.d.ts.map +1 -0
- package/build/typescript/index.d.ts +47 -0
- package/build/typescript/index.d.ts.map +1 -0
- package/build/typescript/modal/WorkflowModal.d.ts +33 -0
- package/build/typescript/modal/WorkflowModal.d.ts.map +1 -0
- package/build/typescript/package.json +1 -0
- package/build/typescript/platform/platformName.d.ts +8 -0
- package/build/typescript/platform/platformName.d.ts.map +1 -0
- package/build/typescript/platform/platformName.web.d.ts +3 -0
- package/build/typescript/platform/platformName.web.d.ts.map +1 -0
- package/build/typescript/protocol/controlSnapshotStore.d.ts +12 -0
- package/build/typescript/protocol/controlSnapshotStore.d.ts.map +1 -0
- package/build/typescript/protocol/useProtocolExchange.d.ts +40 -0
- package/build/typescript/protocol/useProtocolExchange.d.ts.map +1 -0
- package/build/typescript/registries/ContentRegistry.d.ts +57 -0
- package/build/typescript/registries/ContentRegistry.d.ts.map +1 -0
- package/build/typescript/registries/FormFieldRegistry.d.ts +37 -0
- package/build/typescript/registries/FormFieldRegistry.d.ts.map +1 -0
- package/build/typescript/render/NodeBoundary.d.ts +25 -0
- package/build/typescript/render/NodeBoundary.d.ts.map +1 -0
- package/build/typescript/render/RenderTree.d.ts +23 -0
- package/build/typescript/render/RenderTree.d.ts.map +1 -0
- package/build/typescript/render/WorkflowRenderContext.d.ts +57 -0
- package/build/typescript/render/WorkflowRenderContext.d.ts.map +1 -0
- package/build/typescript/render/nodes.d.ts +49 -0
- package/build/typescript/render/nodes.d.ts.map +1 -0
- package/build/typescript/responsive/ResponsiveProvider.d.ts +39 -0
- package/build/typescript/responsive/ResponsiveProvider.d.ts.map +1 -0
- package/build/typescript/responsive/index.d.ts +3 -0
- package/build/typescript/responsive/index.d.ts.map +1 -0
- package/build/typescript/responsive/responsive.d.ts +24 -0
- package/build/typescript/responsive/responsive.d.ts.map +1 -0
- package/build/typescript/style/resolveDisplayHintStyle.d.ts +23 -0
- package/build/typescript/style/resolveDisplayHintStyle.d.ts.map +1 -0
- package/build/typescript/theme/WorkflowTheme.d.ts +177 -0
- package/build/typescript/theme/WorkflowTheme.d.ts.map +1 -0
- package/build/typescript/utils/testable.d.ts +8 -0
- package/build/typescript/utils/testable.d.ts.map +1 -0
- package/package.json +101 -3
- package/src/WorkflowFontScaleContext.tsx +74 -0
- package/src/adapter/WalletAdapter.tsx +225 -0
- package/src/components/FallbackVideoPlayer.native.tsx +9 -0
- package/src/components/FallbackVideoPlayer.tsx +5 -0
- package/src/components/FallbackVideoPlayer.web.tsx +24 -0
- package/src/components/WorkflowButtonLabel.tsx +41 -0
- package/src/components/WorkflowCalendarIcon.tsx +52 -0
- package/src/components/WorkflowText.tsx +121 -0
- package/src/content/BadgeContent.tsx +57 -0
- package/src/content/BarChartContent.tsx +76 -0
- package/src/content/BarcodeContent.tsx +59 -0
- package/src/content/BasicTableContent.tsx +139 -0
- package/src/content/ButtonContent.tsx +124 -0
- package/src/content/CalendarContent.tsx +178 -0
- package/src/content/CardContent.tsx +137 -0
- package/src/content/CarouselContent.tsx +197 -0
- package/src/content/ChipContent.tsx +209 -0
- package/src/content/ChipRowContent.tsx +133 -0
- package/src/content/CredentialOfferContent.tsx +229 -0
- package/src/content/DialContent.tsx +96 -0
- package/src/content/DividerContent.tsx +33 -0
- package/src/content/DonutChartContent.tsx +110 -0
- package/src/content/FormContent.tsx +158 -0
- package/src/content/FormFieldBridge.tsx +144 -0
- package/src/content/GaugeContent.tsx +66 -0
- package/src/content/GridLayoutContent.tsx +285 -0
- package/src/content/ImageContent.tsx +222 -0
- package/src/content/ListContent.tsx +98 -0
- package/src/content/LocationContent.tsx +135 -0
- package/src/content/MapContent.tsx +232 -0
- package/src/content/MultipleChoiceContent.tsx +74 -0
- package/src/content/OpenBadgePreviewContent.tsx +93 -0
- package/src/content/PhotoContent.tsx +110 -0
- package/src/content/PieChartContent.tsx +121 -0
- package/src/content/ProofPresentationContent.tsx +127 -0
- package/src/content/RadioButtonContent.tsx +129 -0
- package/src/content/RowContent.tsx +627 -0
- package/src/content/SectionContent.tsx +133 -0
- package/src/content/ShareEntryContent.tsx +109 -0
- package/src/content/SimulatedHint.tsx +20 -0
- package/src/content/SliderContent.tsx +56 -0
- package/src/content/SpacerContent.tsx +15 -0
- package/src/content/SpinnerContent.tsx +24 -0
- package/src/content/SubmitButtonContent.tsx +256 -0
- package/src/content/TextContent.tsx +140 -0
- package/src/content/TileContent.tsx +216 -0
- package/src/content/TimelineContent.tsx +91 -0
- package/src/content/TitleContent.tsx +49 -0
- package/src/content/VideoContent.tsx +131 -0
- package/src/content/WebLinkContent.tsx +87 -0
- package/src/content/index.ts +45 -0
- package/src/form-fields/CheckboxField.tsx +29 -0
- package/src/form-fields/DateField.native.tsx +123 -0
- package/src/form-fields/DateField.tsx +5 -0
- package/src/form-fields/DateField.web.tsx +32 -0
- package/src/form-fields/DropdownField.tsx +137 -0
- package/src/form-fields/MCQField.tsx +68 -0
- package/src/form-fields/RadioField.tsx +53 -0
- package/src/form-fields/SliderField.native.tsx +53 -0
- package/src/form-fields/SliderField.tsx +5 -0
- package/src/form-fields/SliderField.web.tsx +58 -0
- package/src/form-fields/SubmitButtonField.tsx +33 -0
- package/src/form-fields/TextField.tsx +49 -0
- package/src/form-fields/index.ts +12 -0
- package/src/i18n/WorkflowI18n.tsx +100 -0
- package/src/icons/WorkflowIcon.tsx +43 -0
- package/src/imageUriCache.ts +27 -0
- package/src/index.ts +96 -0
- package/src/modal/WorkflowModal.tsx +119 -0
- package/src/platform/platformName.ts +7 -0
- package/src/platform/platformName.web.ts +2 -0
- package/src/protocol/controlSnapshotStore.ts +25 -0
- package/src/protocol/useProtocolExchange.ts +185 -0
- package/src/registries/ContentRegistry.tsx +130 -0
- package/src/registries/FormFieldRegistry.tsx +83 -0
- package/src/render/NodeBoundary.tsx +69 -0
- package/src/render/RenderTree.tsx +63 -0
- package/src/render/WorkflowRenderContext.tsx +71 -0
- package/src/render/nodes.ts +104 -0
- package/src/responsive/ResponsiveProvider.tsx +103 -0
- package/src/responsive/index.ts +7 -0
- package/src/responsive/responsive.ts +67 -0
- package/src/style/resolveDisplayHintStyle.ts +153 -0
- package/src/theme/WorkflowTheme.tsx +162 -0
- package/src/utils/testable.ts +10 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native'
|
|
3
|
+
import { type FormFieldProps, FormFieldRegistry } from '../registries/FormFieldRegistry'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Web version of the slider: the browser's own range input. The community
|
|
7
|
+
* slider ships CommonJS that pulls a second copy of react-native-web into web
|
|
8
|
+
* bundles (~400 kB). Same behaviour as the native field: the label follows the
|
|
9
|
+
* thumb live, and the value is committed when the user lets go.
|
|
10
|
+
*/
|
|
11
|
+
const SliderField: React.FC<FormFieldProps> = ({ field, value, onChange, colors }) => {
|
|
12
|
+
const min = field.min ?? 0
|
|
13
|
+
const max = field.max ?? 100
|
|
14
|
+
|
|
15
|
+
const toNum = (v: unknown): number => {
|
|
16
|
+
const n = typeof v === 'string' ? Number.parseFloat(v) : (v as number)
|
|
17
|
+
return Number.isFinite(n) ? n : min
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const [display, setDisplay] = React.useState<number>(toNum(value))
|
|
21
|
+
|
|
22
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: sync the live label only when the committed value changes
|
|
23
|
+
React.useEffect(() => {
|
|
24
|
+
setDisplay(toNum(value))
|
|
25
|
+
}, [value])
|
|
26
|
+
|
|
27
|
+
const commit = () => onChange(Math.round(display).toString())
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<View style={s.wrap}>
|
|
31
|
+
{!!field.label && <Text style={[s.label, { color: colors.text }]}>{field.label}</Text>}
|
|
32
|
+
{React.createElement('input', {
|
|
33
|
+
type: 'range',
|
|
34
|
+
min,
|
|
35
|
+
max,
|
|
36
|
+
step: 1,
|
|
37
|
+
value: display,
|
|
38
|
+
'aria-label': field.label || 'Slider',
|
|
39
|
+
style: { width: '100%', height: 40, accentColor: colors.primary },
|
|
40
|
+
onChange: (event: { target: { value: string } }) => setDisplay(Number(event.target.value)),
|
|
41
|
+
onPointerUp: commit,
|
|
42
|
+
onKeyUp: commit,
|
|
43
|
+
onBlur: commit,
|
|
44
|
+
})}
|
|
45
|
+
<Text style={[s.value, { color: colors.primary }]}>{Math.round(display)}</Text>
|
|
46
|
+
</View>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const s = StyleSheet.create({
|
|
51
|
+
wrap: { marginBottom: 8 },
|
|
52
|
+
label: { fontSize: 14, fontWeight: '600', marginBottom: 4 },
|
|
53
|
+
value: { fontSize: 16, fontWeight: '700', textAlign: 'center', marginTop: 2 },
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
FormFieldRegistry.register('slider', SliderField)
|
|
57
|
+
|
|
58
|
+
export default SliderField
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { TouchableOpacity } from 'react-native'
|
|
5
|
+
import WorkflowButtonLabel from '../components/WorkflowButtonLabel'
|
|
6
|
+
import { useWorkflowT } from '../i18n/WorkflowI18n'
|
|
7
|
+
import { type FormFieldProps, FormFieldRegistry } from '../registries/FormFieldRegistry'
|
|
8
|
+
|
|
9
|
+
const SubmitButtonField: React.FC<FormFieldProps> = ({ field, onChange, styles, colors, groupFontScale = 1 }) => {
|
|
10
|
+
const t = useWorkflowT()
|
|
11
|
+
const handlePress = () => {
|
|
12
|
+
// Trigger onChange which will be caught by ActionMenuBubble
|
|
13
|
+
if (onChange) {
|
|
14
|
+
onChange('submit')
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<TouchableOpacity
|
|
20
|
+
style={[styles.button, { backgroundColor: colors.primary, borderColor: colors.primary, marginTop: 8 }]}
|
|
21
|
+
onPress={handlePress}
|
|
22
|
+
activeOpacity={0.8}
|
|
23
|
+
>
|
|
24
|
+
<WorkflowButtonLabel style={styles.buttonText} groupFontScale={groupFontScale}>
|
|
25
|
+
{field.label || t('WorkflowUi.Submit')}
|
|
26
|
+
</WorkflowButtonLabel>
|
|
27
|
+
</TouchableOpacity>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
FormFieldRegistry.register('submit-button', SubmitButtonField)
|
|
32
|
+
|
|
33
|
+
export default SubmitButtonField
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { TextInput, View } from 'react-native'
|
|
3
|
+
import WorkflowText from '../components/WorkflowText'
|
|
4
|
+
import { type FormFieldProps, FormFieldRegistry } from '../registries/FormFieldRegistry'
|
|
5
|
+
import { testIdWithKey } from '../utils/testable'
|
|
6
|
+
|
|
7
|
+
const TextField: React.FC<FormFieldProps> = ({ field, value, onChange, styles, colors }) => {
|
|
8
|
+
const isMultiline = field.type === 'text-area' || field.type === 'textarea'
|
|
9
|
+
const borderColor = colors.border || colors.primary || '#7EB8B8'
|
|
10
|
+
const backgroundColor = colors.background || 'rgba(255,255,255,0.08)'
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<View style={styles.fieldContainer}>
|
|
14
|
+
<WorkflowText variant="label" style={[styles.label, { color: colors.text }]}>
|
|
15
|
+
{field.label}
|
|
16
|
+
</WorkflowText>
|
|
17
|
+
<TextInput
|
|
18
|
+
testID={testIdWithKey(`WorkflowTextInput-${field.name || 'field'}`)}
|
|
19
|
+
accessibilityLabel={field.label || 'Text input'}
|
|
20
|
+
style={[
|
|
21
|
+
styles.input,
|
|
22
|
+
{
|
|
23
|
+
borderWidth: 1.5,
|
|
24
|
+
borderColor,
|
|
25
|
+
color: colors.text,
|
|
26
|
+
backgroundColor,
|
|
27
|
+
},
|
|
28
|
+
isMultiline ? { minHeight: 80, textAlignVertical: 'top' } : null,
|
|
29
|
+
]}
|
|
30
|
+
value={value || ''}
|
|
31
|
+
onChangeText={onChange}
|
|
32
|
+
placeholder={field.placeholder}
|
|
33
|
+
placeholderTextColor={colors.border || '#9AA0A6'}
|
|
34
|
+
multiline={isMultiline}
|
|
35
|
+
numberOfLines={isMultiline ? 3 : undefined}
|
|
36
|
+
editable={field.disabled !== true}
|
|
37
|
+
underlineColorAndroid="transparent"
|
|
38
|
+
/>
|
|
39
|
+
</View>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
FormFieldRegistry.register('text', TextField)
|
|
44
|
+
FormFieldRegistry.register('text-field', TextField)
|
|
45
|
+
FormFieldRegistry.register('text-input', TextField)
|
|
46
|
+
FormFieldRegistry.register('textarea', TextField)
|
|
47
|
+
FormFieldRegistry.register('text-area', TextField)
|
|
48
|
+
|
|
49
|
+
export default TextField
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers the form-field renderers with FormFieldRegistry.
|
|
3
|
+
* Imported for its side effects by the package entry point.
|
|
4
|
+
*/
|
|
5
|
+
import './TextField'
|
|
6
|
+
import './CheckboxField'
|
|
7
|
+
import './RadioField'
|
|
8
|
+
import './MCQField'
|
|
9
|
+
import './DateField'
|
|
10
|
+
import './SliderField'
|
|
11
|
+
import './DropdownField'
|
|
12
|
+
import './SubmitButtonField'
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { createContext, type ReactNode, useCallback, useContext } from 'react'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* English text for every string the workflow controls show. Keys match the
|
|
5
|
+
* wallet's i18n keys (`Workflow.*`, `Global.*`), so the wallet can pass its own
|
|
6
|
+
* translate function straight through; new keys use the `WorkflowUi.*` prefix.
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_WORKFLOW_STRINGS = {
|
|
9
|
+
'Global.Decline': 'Decline',
|
|
10
|
+
'Workflow.CredentialOffer': 'Credential offer',
|
|
11
|
+
'Workflow.ProofRequest': 'Proof request',
|
|
12
|
+
'Workflow.AcceptCredential': 'Accept credential',
|
|
13
|
+
'Workflow.PresentProof': 'Present proof',
|
|
14
|
+
'Workflow.WaitingForOffer': 'Waiting for the credential offer…',
|
|
15
|
+
'Workflow.ReceivingCredential': 'Receiving credential…',
|
|
16
|
+
'Workflow.CredentialReceived': 'Credential received',
|
|
17
|
+
'Workflow.OfferDeclined': 'Offer declined',
|
|
18
|
+
'Workflow.OfferFailed': 'Something went wrong receiving the credential',
|
|
19
|
+
'Workflow.WaitingForProofRequest': 'Waiting for the proof request…',
|
|
20
|
+
'Workflow.PresentingProof': 'Presenting proof…',
|
|
21
|
+
'Workflow.ProofPresented': 'Proof presented',
|
|
22
|
+
'Workflow.ProofDeclined': 'Proof request declined',
|
|
23
|
+
'Workflow.ProofFailed': 'Something went wrong presenting the proof',
|
|
24
|
+
'WorkflowUi.Select': 'Select...',
|
|
25
|
+
'WorkflowUi.SelectDate': 'Select date...',
|
|
26
|
+
'WorkflowUi.Submit': 'Submit',
|
|
27
|
+
'WorkflowUi.Done': 'Done',
|
|
28
|
+
'WorkflowUi.Error': 'Error',
|
|
29
|
+
'WorkflowUi.InvalidLink': 'Invalid link',
|
|
30
|
+
'WorkflowUi.InvalidLinkMessage': 'Only http(s) links are supported.',
|
|
31
|
+
'WorkflowUi.LinkFailed': 'Unable to open link',
|
|
32
|
+
'WorkflowUi.TakePhoto': 'Take a photo',
|
|
33
|
+
'WorkflowUi.Retake': 'Retake',
|
|
34
|
+
'WorkflowUi.PhotoFailed': 'Failed to take photo. Please try again.',
|
|
35
|
+
'WorkflowUi.ScanCode': 'Scan QR code',
|
|
36
|
+
'WorkflowUi.ShareLocation': 'Share location',
|
|
37
|
+
'WorkflowUi.LocationUnavailable': 'Location unavailable',
|
|
38
|
+
'WorkflowUi.LocationUnavailableMessage':
|
|
39
|
+
'Could not get your current GPS position. Turn on Location / GPS and try again.',
|
|
40
|
+
'WorkflowUi.MyLocation': 'My location coordinates:',
|
|
41
|
+
'WorkflowUi.Share': 'Share',
|
|
42
|
+
'WorkflowUi.ShareFailed': 'Failed to share content',
|
|
43
|
+
'WorkflowUi.ReportTitle': 'DigiCred Wallet Report',
|
|
44
|
+
'WorkflowUi.Responses': 'Responses:',
|
|
45
|
+
'WorkflowUi.NoData': 'No data entered yet.',
|
|
46
|
+
'WorkflowUi.AddToCalendar': 'Add to Calendar',
|
|
47
|
+
'WorkflowUi.InvalidDate': 'Invalid date',
|
|
48
|
+
'WorkflowUi.InvalidDateMessage': 'This event is missing a valid start or end time.',
|
|
49
|
+
'WorkflowUi.CalendarAdded': 'Event added to your calendar!',
|
|
50
|
+
'WorkflowUi.CalendarFailed': 'Failed to add event to calendar.',
|
|
51
|
+
'WorkflowUi.Event': 'Event',
|
|
52
|
+
'WorkflowUi.Location': 'Location',
|
|
53
|
+
'WorkflowUi.OpenInMaps': 'Tap to open in Maps',
|
|
54
|
+
'WorkflowUi.VideoFailed': 'Failed to load video',
|
|
55
|
+
'WorkflowUi.Simulated': 'Simulated on the web',
|
|
56
|
+
'WorkflowUi.OpenBadge': 'Open badge',
|
|
57
|
+
'WorkflowUi.OpenBadgeDescription':
|
|
58
|
+
'Preview of the badge signed onto this artifact. Tap {{label}} to accept and store it.',
|
|
59
|
+
'WorkflowUi.AddToWallet': 'Add to Wallet',
|
|
60
|
+
} as const
|
|
61
|
+
|
|
62
|
+
export type WorkflowStringKey = keyof typeof DEFAULT_WORKFLOW_STRINGS
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Returns the text for `key`. `defaultValue` is the English text; `params`
|
|
66
|
+
* fill `{{name}}` placeholders. Same shape as i18next's `t(key, { defaultValue, ...params })`.
|
|
67
|
+
*/
|
|
68
|
+
export type WorkflowTranslate = (key: string, defaultValue: string, params?: Record<string, string | number>) => string
|
|
69
|
+
|
|
70
|
+
const fill = (text: string, params?: Record<string, string | number>) =>
|
|
71
|
+
params
|
|
72
|
+
? text.replace(/\{\{\s*(\w+)\s*\}\}/g, (match, name: string) => (name in params ? String(params[name]) : match))
|
|
73
|
+
: text
|
|
74
|
+
|
|
75
|
+
const englishTranslate: WorkflowTranslate = (_key, defaultValue, params) => fill(defaultValue, params)
|
|
76
|
+
|
|
77
|
+
const WorkflowI18nContext = createContext<WorkflowTranslate>(englishTranslate)
|
|
78
|
+
|
|
79
|
+
export type WorkflowI18nProviderProps = { translate: WorkflowTranslate; children?: ReactNode }
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Supplies translations for the workflow controls. Without it they show
|
|
83
|
+
* English. Wallet: `translate={(key, defaultValue, params) => t(key, { defaultValue, ...params })}`.
|
|
84
|
+
*/
|
|
85
|
+
export function WorkflowI18nProvider({ translate, children }: WorkflowI18nProviderProps) {
|
|
86
|
+
return <WorkflowI18nContext.Provider value={translate}>{children}</WorkflowI18nContext.Provider>
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** `t('Global.Decline')` returns the translated text, falling back to English. */
|
|
90
|
+
export function useWorkflowT(): (key: WorkflowStringKey, params?: Record<string, string | number>) => string {
|
|
91
|
+
const translate = useContext(WorkflowI18nContext)
|
|
92
|
+
return useCallback(
|
|
93
|
+
(key: WorkflowStringKey, params?: Record<string, string | number>) => {
|
|
94
|
+
const text = translate(key, DEFAULT_WORKFLOW_STRINGS[key], params)
|
|
95
|
+
// A translate function that does not know the key may return the key itself.
|
|
96
|
+
return text && text !== key ? fill(text, params) : fill(DEFAULT_WORKFLOW_STRINGS[key], params)
|
|
97
|
+
},
|
|
98
|
+
[translate]
|
|
99
|
+
)
|
|
100
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createContext, type ReactNode, useContext } from 'react'
|
|
2
|
+
import type { StyleProp, TextStyle } from 'react-native'
|
|
3
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
4
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
5
|
+
|
|
6
|
+
/** Icon families the controls use (names are the vector-icons names). */
|
|
7
|
+
export type WorkflowIconSet = 'material' | 'material-community'
|
|
8
|
+
|
|
9
|
+
export type WorkflowIconProps = {
|
|
10
|
+
name: string
|
|
11
|
+
/** Default `material`. */
|
|
12
|
+
set?: WorkflowIconSet
|
|
13
|
+
size: number
|
|
14
|
+
color: string
|
|
15
|
+
style?: StyleProp<TextStyle>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Draws one icon. Return `null` to fall back to the built-in vector icons. */
|
|
19
|
+
export type WorkflowIconRenderer = (props: WorkflowIconProps) => ReactNode | null
|
|
20
|
+
|
|
21
|
+
const WorkflowIconContext = createContext<WorkflowIconRenderer | null>(null)
|
|
22
|
+
|
|
23
|
+
export type WorkflowIconProviderProps = { renderIcon: WorkflowIconRenderer; children?: ReactNode }
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Replaces the icons every control draws (e.g. the designer can use its own
|
|
27
|
+
* icon set instead of loading the vector-icon fonts). Without it, controls use
|
|
28
|
+
* `react-native-vector-icons`, like the wallet.
|
|
29
|
+
*/
|
|
30
|
+
export function WorkflowIconProvider({ renderIcon, children }: WorkflowIconProviderProps) {
|
|
31
|
+
return <WorkflowIconContext.Provider value={renderIcon}>{children}</WorkflowIconContext.Provider>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The one place controls draw icons. */
|
|
35
|
+
export function WorkflowIcon(props: WorkflowIconProps) {
|
|
36
|
+
const renderIcon = useContext(WorkflowIconContext)
|
|
37
|
+
const custom = renderIcon?.(props)
|
|
38
|
+
if (custom != null) return <>{custom}</>
|
|
39
|
+
const { set = 'material', name, size, color, style } = props
|
|
40
|
+
const Family = set === 'material-community' ? MaterialCommunityIcons : MaterialIcons
|
|
41
|
+
// vector-icons' typings use the old @types/react-native StyleProp; same runtime shape.
|
|
42
|
+
return <Family name={name} size={size} color={color} style={style as never} />
|
|
43
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deduped Image.prefetch for workflow tile/card URLs.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Image } from 'react-native'
|
|
6
|
+
|
|
7
|
+
const prefetched = new Set<string>()
|
|
8
|
+
const inflight = new Set<string>()
|
|
9
|
+
|
|
10
|
+
export function prefetchImageUri(uri: string | undefined): void {
|
|
11
|
+
const trimmed = uri?.trim()
|
|
12
|
+
if (!trimmed || !trimmed.startsWith('http')) return
|
|
13
|
+
if (prefetched.has(trimmed) || inflight.has(trimmed)) return
|
|
14
|
+
inflight.add(trimmed)
|
|
15
|
+
void Image.prefetch(trimmed)
|
|
16
|
+
.then(() => {
|
|
17
|
+
prefetched.add(trimmed)
|
|
18
|
+
})
|
|
19
|
+
.catch(() => {})
|
|
20
|
+
.finally(() => inflight.delete(trimmed))
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Test-only. */
|
|
24
|
+
export function clearImageUriCache(): void {
|
|
25
|
+
prefetched.clear()
|
|
26
|
+
inflight.clear()
|
|
27
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @veridid/workflow-ui
|
|
3
|
+
*
|
|
4
|
+
* React Native components for workflow display hints. Written once with React
|
|
5
|
+
* Native primitives:
|
|
6
|
+
* - the DigiCred wallet renders them natively (Metro)
|
|
7
|
+
* - the CrMS designer renders them through react-native-web (Vite)
|
|
8
|
+
*
|
|
9
|
+
* The wallet is the reference renderer. Device-only controls (camera, barcode,
|
|
10
|
+
* location, …) get a `.web.tsx` placeholder and talk to the device through an
|
|
11
|
+
* adapter, never through a native module imported directly.
|
|
12
|
+
*/
|
|
13
|
+
export { CONTRACT_VERSION } from '@veridid/workflow-core'
|
|
14
|
+
// App providers: theme, translations, icons, device and credential access, popups
|
|
15
|
+
export type {
|
|
16
|
+
CalendarEvent,
|
|
17
|
+
Coordinates,
|
|
18
|
+
CredentialCardRequest,
|
|
19
|
+
ExchangeAttribute,
|
|
20
|
+
ExchangeKind,
|
|
21
|
+
ExchangeRecord,
|
|
22
|
+
ExchangeStatus,
|
|
23
|
+
ShareRequest,
|
|
24
|
+
SimulatedWalletOptions,
|
|
25
|
+
VideoPlayerProps,
|
|
26
|
+
WalletAdapter,
|
|
27
|
+
WalletAdapterProviderProps,
|
|
28
|
+
} from './adapter/WalletAdapter'
|
|
29
|
+
export {
|
|
30
|
+
createSimulatedWalletAdapter,
|
|
31
|
+
SIMULATED_LOCATION,
|
|
32
|
+
SIMULATED_PHOTO_URI,
|
|
33
|
+
useWalletAdapter,
|
|
34
|
+
WalletAdapterProvider,
|
|
35
|
+
} from './adapter/WalletAdapter'
|
|
36
|
+
export { default as WorkflowButtonLabel } from './components/WorkflowButtonLabel'
|
|
37
|
+
// Building blocks for host-rendered controls
|
|
38
|
+
export type { WorkflowTextProps } from './components/WorkflowText'
|
|
39
|
+
export { default as WorkflowText, WORKFLOW_TEXT_BASE_SIZES } from './components/WorkflowText'
|
|
40
|
+
export { isFormFieldChild } from './content/FormContent'
|
|
41
|
+
export type { WorkflowI18nProviderProps, WorkflowStringKey, WorkflowTranslate } from './i18n/WorkflowI18n'
|
|
42
|
+
export { DEFAULT_WORKFLOW_STRINGS, useWorkflowT, WorkflowI18nProvider } from './i18n/WorkflowI18n'
|
|
43
|
+
export type {
|
|
44
|
+
WorkflowIconProps,
|
|
45
|
+
WorkflowIconProviderProps,
|
|
46
|
+
WorkflowIconRenderer,
|
|
47
|
+
WorkflowIconSet,
|
|
48
|
+
} from './icons/WorkflowIcon'
|
|
49
|
+
export { WorkflowIcon, WorkflowIconProvider } from './icons/WorkflowIcon'
|
|
50
|
+
export { clearImageUriCache, prefetchImageUri } from './imageUriCache'
|
|
51
|
+
export type { WorkflowModalHostProps, WorkflowModalProps } from './modal/WorkflowModal'
|
|
52
|
+
export { useModalPosition, WorkflowModal, WorkflowModalHost } from './modal/WorkflowModal'
|
|
53
|
+
export { platformName } from './platform/platformName'
|
|
54
|
+
export { clearControlSnapshots } from './protocol/controlSnapshotStore'
|
|
55
|
+
// Registries: map a display-hint `type` to its renderer
|
|
56
|
+
export type { ContentProps, ContentRenderer } from './registries/ContentRegistry'
|
|
57
|
+
export { ContentRegistry } from './registries/ContentRegistry'
|
|
58
|
+
export type { FormFieldProps, FormFieldRenderer } from './registries/FormFieldRegistry'
|
|
59
|
+
export { FormFieldRegistry } from './registries/FormFieldRegistry'
|
|
60
|
+
// Rendering a screen: RenderTree + optional provider for expressions and designer hooks
|
|
61
|
+
export type { WorkflowNode, WorkflowNodePath } from './render/nodes'
|
|
62
|
+
export { deriveNode, resolveNode } from './render/nodes'
|
|
63
|
+
export type { RenderTreeProps } from './render/RenderTree'
|
|
64
|
+
export { RenderTree } from './render/RenderTree'
|
|
65
|
+
export type {
|
|
66
|
+
WorkflowNodeInfo,
|
|
67
|
+
WorkflowRenderOptions,
|
|
68
|
+
WorkflowRenderProviderProps,
|
|
69
|
+
} from './render/WorkflowRenderContext'
|
|
70
|
+
export { WorkflowRenderProvider } from './render/WorkflowRenderContext'
|
|
71
|
+
// Providers the host app wraps the workflow screen in
|
|
72
|
+
export type { ResponsiveContext, ResponsiveProviderProps, ScreenSize } from './responsive'
|
|
73
|
+
export { ResponsiveProvider, ResponsiveRule, useDigiCredStyles, useResponsive } from './responsive'
|
|
74
|
+
export * from './style/resolveDisplayHintStyle'
|
|
75
|
+
export type {
|
|
76
|
+
WorkflowCardColors,
|
|
77
|
+
WorkflowColors,
|
|
78
|
+
WorkflowTheme,
|
|
79
|
+
WorkflowThemeOverrides,
|
|
80
|
+
WorkflowThemeProviderProps,
|
|
81
|
+
} from './theme/WorkflowTheme'
|
|
82
|
+
export {
|
|
83
|
+
DEFAULT_WORKFLOW_THEME,
|
|
84
|
+
mergeWorkflowTheme,
|
|
85
|
+
useWorkflowTheme,
|
|
86
|
+
WorkflowThemeProvider,
|
|
87
|
+
} from './theme/WorkflowTheme'
|
|
88
|
+
export {
|
|
89
|
+
useRegisterTitleGroupScale,
|
|
90
|
+
useWorkflowTitleScale,
|
|
91
|
+
WorkflowFontScaleProvider,
|
|
92
|
+
} from './WorkflowFontScaleContext'
|
|
93
|
+
|
|
94
|
+
// Side effects: register the built-in form fields and content components.
|
|
95
|
+
import './form-fields'
|
|
96
|
+
import './content'
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
type ReactNode,
|
|
4
|
+
useCallback,
|
|
5
|
+
useContext,
|
|
6
|
+
useEffect,
|
|
7
|
+
useId,
|
|
8
|
+
useMemo,
|
|
9
|
+
useRef,
|
|
10
|
+
useState,
|
|
11
|
+
} from 'react'
|
|
12
|
+
import { Modal, type ModalProps, type StyleProp, StyleSheet, View, type ViewStyle } from 'react-native'
|
|
13
|
+
|
|
14
|
+
type Origin = { x: number; y: number }
|
|
15
|
+
|
|
16
|
+
type ModalHostApi = {
|
|
17
|
+
show(id: string, node: ReactNode): void
|
|
18
|
+
hide(id: string): void
|
|
19
|
+
/** Window position of the host, so popups can convert window coordinates. */
|
|
20
|
+
measureOrigin(callback: (origin: Origin) => void): void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const ModalHostContext = createContext<ModalHostApi | null>(null)
|
|
24
|
+
|
|
25
|
+
export type WorkflowModalHostProps = { children?: ReactNode; style?: StyleProp<ViewStyle> }
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Optional. Popups (dropdown list, date sheet) of the controls inside open
|
|
29
|
+
* over this view instead of over the whole window. The designer wraps its
|
|
30
|
+
* phone frame in it, so a dropdown stays inside the phone and the rest of
|
|
31
|
+
* the designer remains usable. Put it outside any ScrollView.
|
|
32
|
+
*/
|
|
33
|
+
export function WorkflowModalHost({ children, style }: WorkflowModalHostProps) {
|
|
34
|
+
const [entries, setEntries] = useState<Array<{ id: string; node: ReactNode }>>([])
|
|
35
|
+
const ref = useRef<View>(null)
|
|
36
|
+
|
|
37
|
+
const api = useMemo<ModalHostApi>(
|
|
38
|
+
() => ({
|
|
39
|
+
show: (id, node) =>
|
|
40
|
+
setEntries((prev) => {
|
|
41
|
+
const index = prev.findIndex((e) => e.id === id)
|
|
42
|
+
if (index === -1) return [...prev, { id, node }]
|
|
43
|
+
const next = prev.slice()
|
|
44
|
+
next[index] = { id, node }
|
|
45
|
+
return next
|
|
46
|
+
}),
|
|
47
|
+
hide: (id) => setEntries((prev) => prev.filter((e) => e.id !== id)),
|
|
48
|
+
measureOrigin: (callback) => {
|
|
49
|
+
const node = ref.current
|
|
50
|
+
if (!node) return callback({ x: 0, y: 0 })
|
|
51
|
+
node.measureInWindow((x, y) => callback({ x, y }))
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
[]
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<ModalHostContext.Provider value={api}>
|
|
59
|
+
<View ref={ref} collapsable={false} style={[host.root, style]}>
|
|
60
|
+
{children}
|
|
61
|
+
{entries.map((entry) => (
|
|
62
|
+
<View key={entry.id} style={StyleSheet.absoluteFill} pointerEvents="box-none">
|
|
63
|
+
{entry.node}
|
|
64
|
+
</View>
|
|
65
|
+
))}
|
|
66
|
+
</View>
|
|
67
|
+
</ModalHostContext.Provider>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type WorkflowModalProps = Pick<ModalProps, 'visible' | 'transparent' | 'animationType' | 'onRequestClose'> & {
|
|
72
|
+
children?: ReactNode
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* React Native's `Modal`, or a layer in the nearest {@link WorkflowModalHost}
|
|
77
|
+
* when there is one. Same props as the subset of `Modal` the controls use.
|
|
78
|
+
*/
|
|
79
|
+
export function WorkflowModal({ visible, transparent, animationType, onRequestClose, children }: WorkflowModalProps) {
|
|
80
|
+
const hostApi = useContext(ModalHostContext)
|
|
81
|
+
const id = useId()
|
|
82
|
+
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (!hostApi) return
|
|
85
|
+
if (visible)
|
|
86
|
+
hostApi.show(id, <View style={[StyleSheet.absoluteFill, transparent ? null : host.opaque]}>{children}</View>)
|
|
87
|
+
else hostApi.hide(id)
|
|
88
|
+
}, [hostApi, id, visible, transparent, children])
|
|
89
|
+
|
|
90
|
+
useEffect(() => () => hostApi?.hide(id), [hostApi, id])
|
|
91
|
+
|
|
92
|
+
if (hostApi) return null
|
|
93
|
+
return (
|
|
94
|
+
<Modal visible={visible} transparent={transparent} animationType={animationType} onRequestClose={onRequestClose}>
|
|
95
|
+
{children}
|
|
96
|
+
</Modal>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Converts a window position (from `measureInWindow`) into the coordinate
|
|
102
|
+
* space popups are drawn in: the host's when there is one, the window's
|
|
103
|
+
* otherwise.
|
|
104
|
+
*/
|
|
105
|
+
export function useModalPosition(): (window: Origin, callback: (local: Origin) => void) => void {
|
|
106
|
+
const hostApi = useContext(ModalHostContext)
|
|
107
|
+
return useCallback(
|
|
108
|
+
(window, callback) => {
|
|
109
|
+
if (!hostApi) return callback(window)
|
|
110
|
+
hostApi.measureOrigin((origin) => callback({ x: window.x - origin.x, y: window.y - origin.y }))
|
|
111
|
+
},
|
|
112
|
+
[hostApi]
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const host = StyleSheet.create({
|
|
117
|
+
root: { position: 'relative', overflow: 'hidden' },
|
|
118
|
+
opaque: { backgroundColor: '#000000' },
|
|
119
|
+
})
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native implementation (wallet). The web build ships `platformName.web.ts`
|
|
3
|
+
* next to this file; Metro picks this one, Vite (with `.web.*` extensions
|
|
4
|
+
* first) picks the web one. Device-only controls use the same pattern so web
|
|
5
|
+
* placeholders never import native modules.
|
|
6
|
+
*/
|
|
7
|
+
export const platformName: 'native' | 'web' = 'native'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Module-level store so a protocol-aware control's phase survives the
|
|
2
|
+
// component being unmounted and remounted (leaving and re-entering the
|
|
3
|
+
// workflow screen). Without this, a remount resets the control to its initial
|
|
4
|
+
// phase and resurrects the action buttons — a second tap then re-fires the
|
|
5
|
+
// workflow event, and templates with self-loop transitions duplicate real
|
|
6
|
+
// protocol work (e.g. a second credential offer for the same instance).
|
|
7
|
+
// v1: in-memory only — an app restart falls back to the initial phase.
|
|
8
|
+
export interface ControlSnapshot {
|
|
9
|
+
phase: string
|
|
10
|
+
recordId: string | null
|
|
11
|
+
armedAt: number | null
|
|
12
|
+
handledIds: string[]
|
|
13
|
+
outcomeSent: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const snapshots = new Map<string, ControlSnapshot>()
|
|
17
|
+
|
|
18
|
+
export const getControlSnapshot = (key?: string): ControlSnapshot | undefined => (key ? snapshots.get(key) : undefined)
|
|
19
|
+
|
|
20
|
+
export const saveControlSnapshot = (key: string | undefined, snapshot: ControlSnapshot): void => {
|
|
21
|
+
if (key) snapshots.set(key, snapshot)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Forget every saved phase (tests, or a host resetting a preview). */
|
|
25
|
+
export const clearControlSnapshots = (): void => snapshots.clear()
|