@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,225 @@
|
|
|
1
|
+
import { type ComponentType, createContext, type ReactNode, useContext, useSyncExternalStore } from 'react'
|
|
2
|
+
import { Linking, Platform, type StyleProp, type ViewStyle } from 'react-native'
|
|
3
|
+
|
|
4
|
+
export type ExchangeKind = 'credential' | 'proof'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Where a credential or proof exchange stands, from the holder's side.
|
|
8
|
+
* Credential: offer received → `pending`; credential received / done →
|
|
9
|
+
* `success`. Proof: request received → `pending`; presentation sent / done →
|
|
10
|
+
* `success`. Declined → `declined`; abandoned / problem report → `failed`.
|
|
11
|
+
*/
|
|
12
|
+
export type ExchangeStatus = 'pending' | 'success' | 'declined' | 'failed'
|
|
13
|
+
|
|
14
|
+
export type ExchangeAttribute = { name: string; value?: string }
|
|
15
|
+
|
|
16
|
+
export type ExchangeRecord = {
|
|
17
|
+
id: string
|
|
18
|
+
connectionId?: string
|
|
19
|
+
/** Milliseconds since epoch. */
|
|
20
|
+
createdAt: number
|
|
21
|
+
status: ExchangeStatus
|
|
22
|
+
/** Credential attributes once known (values offered or issued). */
|
|
23
|
+
attributes?: ExchangeAttribute[]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type Coordinates = { latitude: number; longitude: number }
|
|
27
|
+
|
|
28
|
+
export type ShareRequest = { title?: string; subject?: string; message?: string; url?: string; type?: string }
|
|
29
|
+
|
|
30
|
+
export type CalendarEvent = {
|
|
31
|
+
title: string
|
|
32
|
+
start: Date
|
|
33
|
+
end: Date
|
|
34
|
+
allDay: boolean
|
|
35
|
+
location?: string
|
|
36
|
+
notes?: string
|
|
37
|
+
url?: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type CredentialCardRequest = {
|
|
41
|
+
credDefId?: string
|
|
42
|
+
attributes: ExchangeAttribute[]
|
|
43
|
+
record?: ExchangeRecord
|
|
44
|
+
width: number
|
|
45
|
+
onPress?: () => void
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type VideoPlayerProps = {
|
|
49
|
+
uri: string
|
|
50
|
+
autoPlay: boolean
|
|
51
|
+
style?: StyleProp<ViewStyle>
|
|
52
|
+
onError?: () => void
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Everything a workflow control needs from the app around it: device features,
|
|
57
|
+
* links, messages and DIDComm exchanges. The wallet implements it with its
|
|
58
|
+
* native modules, credo agent and navigation; the designer uses
|
|
59
|
+
* {@link createSimulatedWalletAdapter}. Shared controls never import a native
|
|
60
|
+
* module or credo directly.
|
|
61
|
+
*
|
|
62
|
+
* Members named `use…` are React hooks. Keep the adapter object stable (create
|
|
63
|
+
* it once) so they are called in the same order on every render.
|
|
64
|
+
*/
|
|
65
|
+
export interface WalletAdapter {
|
|
66
|
+
/** True for the designer's stand-in; controls show a small "simulated" hint. */
|
|
67
|
+
readonly simulated: boolean
|
|
68
|
+
|
|
69
|
+
openUrl(url: string): Promise<void>
|
|
70
|
+
alert(title: string, message?: string): void
|
|
71
|
+
|
|
72
|
+
/** Opens the camera. `null` when the user cancels or denies the permission. */
|
|
73
|
+
capturePhoto(): Promise<{ uri: string } | null>
|
|
74
|
+
/** Opens the code scanner. `null` when cancelled or when the scan is handled elsewhere. */
|
|
75
|
+
scanBarcode(): Promise<string | null>
|
|
76
|
+
/** Current position; `null` when the permission is denied. Throws when GPS is unavailable. */
|
|
77
|
+
getLocation(): Promise<Coordinates | null>
|
|
78
|
+
/** Opens the share sheet. Resolves when the user cancels too. */
|
|
79
|
+
share(request: ShareRequest): Promise<void>
|
|
80
|
+
/** Renders HTML to a PDF file. */
|
|
81
|
+
exportPdf(request: { html: string; fileName: string }): Promise<{ uri: string } | null>
|
|
82
|
+
/** Adds an event to the device calendar; `false` when the permission is denied. */
|
|
83
|
+
addCalendarEvent(event: CalendarEvent): Promise<boolean>
|
|
84
|
+
/** Native video player (the wallet's expo-video view). Without it a poster with a play button shows. */
|
|
85
|
+
VideoPlayer?: ComponentType<VideoPlayerProps>
|
|
86
|
+
|
|
87
|
+
/** Hook: this wallet's exchanges of one kind (all connections). */
|
|
88
|
+
useExchanges(kind: ExchangeKind): ExchangeRecord[]
|
|
89
|
+
acceptExchange(kind: ExchangeKind, id: string): Promise<void>
|
|
90
|
+
declineExchange(kind: ExchangeKind, id: string): Promise<void>
|
|
91
|
+
/** Values in a credential offer before it is issued (credo format data). */
|
|
92
|
+
getOfferedAttributes?(id: string): Promise<ExchangeAttribute[]>
|
|
93
|
+
/** Hook: the designed credential card (OCA, parsed transcript, …), or `null` to show the attribute list. */
|
|
94
|
+
useCredentialCard?(request: CredentialCardRequest): { element: ReactNode | null; resolving: boolean }
|
|
95
|
+
/** Opens the stored credential (wallet: credential details screen). */
|
|
96
|
+
openCredential?(id: string): void
|
|
97
|
+
/**
|
|
98
|
+
* Called when a control starts waiting for an exchange to arrive. The
|
|
99
|
+
* simulated adapter creates one; the wallet leaves it out (the agent
|
|
100
|
+
* receives the real one).
|
|
101
|
+
*/
|
|
102
|
+
expectExchange?(kind: ExchangeKind, connectionId?: string): void
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type SimulatedWalletOptions = {
|
|
106
|
+
/** Every simulated device call, for a designer log or toast. */
|
|
107
|
+
onEvent?: (event: { action: string; detail?: unknown }) => void
|
|
108
|
+
/** Simulated alerts (default: `onEvent` with action `alert`). */
|
|
109
|
+
onAlert?: (title: string, message?: string) => void
|
|
110
|
+
photoUri?: string
|
|
111
|
+
barcode?: string
|
|
112
|
+
location?: Coordinates
|
|
113
|
+
/** Delay before a simulated exchange arrives or completes (ms). Default 400. */
|
|
114
|
+
exchangeDelayMs?: number
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** A small grey image with a camera outline, used as the simulated photo. */
|
|
118
|
+
export const SIMULATED_PHOTO_URI =
|
|
119
|
+
'data:image/svg+xml;utf8,' +
|
|
120
|
+
encodeURIComponent(
|
|
121
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="320" height="200" viewBox="0 0 320 200"><rect width="320" height="200" fill="#3A4A48"/><rect x="120" y="70" width="80" height="60" rx="8" fill="none" stroke="#C9D6D4" stroke-width="5"/><circle cx="160" cy="100" r="16" fill="none" stroke="#C9D6D4" stroke-width="5"/></svg>'
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
/** Wilmington, NC: the wallet's map fallback. */
|
|
125
|
+
export const SIMULATED_LOCATION: Coordinates = { latitude: 34.240546, longitude: -77.948781 }
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Stand-in adapter for the designer (and for any host that renders without
|
|
129
|
+
* one). Device calls resolve with sample data; an exchange the control waits
|
|
130
|
+
* for arrives after a short delay and completes when accepted.
|
|
131
|
+
*/
|
|
132
|
+
export function createSimulatedWalletAdapter(options: SimulatedWalletOptions = {}): WalletAdapter {
|
|
133
|
+
const delay = options.exchangeDelayMs ?? 400
|
|
134
|
+
const log = (action: string, detail?: unknown) => options.onEvent?.({ action, detail })
|
|
135
|
+
const records: Record<ExchangeKind, ExchangeRecord[]> = { credential: [], proof: [] }
|
|
136
|
+
const listeners = new Set<() => void>()
|
|
137
|
+
let counter = 0
|
|
138
|
+
|
|
139
|
+
const update = (kind: ExchangeKind, id: string, status: ExchangeStatus) => {
|
|
140
|
+
records[kind] = records[kind].map((r) => (r.id === id ? { ...r, status } : r))
|
|
141
|
+
for (const l of listeners) l()
|
|
142
|
+
}
|
|
143
|
+
const subscribe = (listener: () => void) => {
|
|
144
|
+
listeners.add(listener)
|
|
145
|
+
return () => listeners.delete(listener)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return {
|
|
149
|
+
simulated: true,
|
|
150
|
+
openUrl: async (url) => {
|
|
151
|
+
log('openUrl', url)
|
|
152
|
+
await Linking.openURL(url)
|
|
153
|
+
},
|
|
154
|
+
alert: (title, message) => (options.onAlert ? options.onAlert(title, message) : log('alert', { title, message })),
|
|
155
|
+
capturePhoto: async () => {
|
|
156
|
+
log('capturePhoto')
|
|
157
|
+
return { uri: options.photoUri ?? SIMULATED_PHOTO_URI }
|
|
158
|
+
},
|
|
159
|
+
scanBarcode: async () => {
|
|
160
|
+
log('scanBarcode')
|
|
161
|
+
return options.barcode ?? 'SIMULATED-QR-CODE'
|
|
162
|
+
},
|
|
163
|
+
getLocation: async () => {
|
|
164
|
+
log('getLocation')
|
|
165
|
+
return options.location ?? SIMULATED_LOCATION
|
|
166
|
+
},
|
|
167
|
+
share: async (request) => log('share', request),
|
|
168
|
+
exportPdf: async (request) => {
|
|
169
|
+
log('exportPdf', { fileName: request.fileName })
|
|
170
|
+
return { uri: `simulated://${request.fileName}.pdf` }
|
|
171
|
+
},
|
|
172
|
+
addCalendarEvent: async (event) => {
|
|
173
|
+
log('addCalendarEvent', event)
|
|
174
|
+
return true
|
|
175
|
+
},
|
|
176
|
+
useExchanges: (kind) =>
|
|
177
|
+
useSyncExternalStore(
|
|
178
|
+
subscribe,
|
|
179
|
+
() => records[kind],
|
|
180
|
+
() => records[kind]
|
|
181
|
+
),
|
|
182
|
+
acceptExchange: async (kind, id) => {
|
|
183
|
+
log('acceptExchange', { kind, id })
|
|
184
|
+
setTimeout(() => update(kind, id, 'success'), delay)
|
|
185
|
+
},
|
|
186
|
+
declineExchange: async (kind, id) => {
|
|
187
|
+
log('declineExchange', { kind, id })
|
|
188
|
+
update(kind, id, 'declined')
|
|
189
|
+
},
|
|
190
|
+
expectExchange: (kind, connectionId) => {
|
|
191
|
+
setTimeout(() => {
|
|
192
|
+
counter += 1
|
|
193
|
+
records[kind] = [
|
|
194
|
+
...records[kind],
|
|
195
|
+
{ id: `simulated-${kind}-${counter}`, connectionId, createdAt: Date.now(), status: 'pending' },
|
|
196
|
+
]
|
|
197
|
+
for (const l of listeners) l()
|
|
198
|
+
}, delay)
|
|
199
|
+
},
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const defaultAdapter = createSimulatedWalletAdapter()
|
|
204
|
+
let warnedNoAdapter = false
|
|
205
|
+
|
|
206
|
+
const WalletAdapterContext = createContext<WalletAdapter | null>(null)
|
|
207
|
+
|
|
208
|
+
export type WalletAdapterProviderProps = { adapter: WalletAdapter; children?: ReactNode }
|
|
209
|
+
|
|
210
|
+
/** The app's adapter for every control below it. Create the adapter once (stable identity). */
|
|
211
|
+
export function WalletAdapterProvider({ adapter, children }: WalletAdapterProviderProps) {
|
|
212
|
+
return <WalletAdapterContext.Provider value={adapter}>{children}</WalletAdapterContext.Provider>
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** The nearest adapter; the simulated one when the host provides none. */
|
|
216
|
+
export function useWalletAdapter(): WalletAdapter {
|
|
217
|
+
const adapter = useContext(WalletAdapterContext)
|
|
218
|
+
if (adapter) return adapter
|
|
219
|
+
if (Platform.OS !== 'web' && !warnedNoAdapter && typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
220
|
+
warnedNoAdapter = true
|
|
221
|
+
// biome-ignore lint/suspicious/noConsole: developer warning — device controls are simulated without the app's adapter
|
|
222
|
+
console.warn('[workflow-ui] No WalletAdapterProvider: device and credential controls are simulated.')
|
|
223
|
+
}
|
|
224
|
+
return defaultAdapter
|
|
225
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { VideoPlayerProps } from '../adapter/WalletAdapter'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Native has no built-in player: the wallet passes its expo-video view as
|
|
5
|
+
* `adapter.VideoPlayer`. Without one the control keeps showing the poster.
|
|
6
|
+
*/
|
|
7
|
+
export default function FallbackVideoPlayer(_props: VideoPlayerProps): null {
|
|
8
|
+
return null
|
|
9
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, View } from 'react-native'
|
|
3
|
+
import type { VideoPlayerProps } from '../adapter/WalletAdapter'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Web video when the adapter has no `VideoPlayer`: the browser's own
|
|
7
|
+
* `<video>` element with native controls (expo-video has no web build that
|
|
8
|
+
* works outside Expo; see the COM-1 spike).
|
|
9
|
+
*/
|
|
10
|
+
export default function FallbackVideoPlayer({ uri, autoPlay, style, onError }: VideoPlayerProps) {
|
|
11
|
+
return (
|
|
12
|
+
<View style={[StyleSheet.absoluteFill, style]}>
|
|
13
|
+
{React.createElement('video', {
|
|
14
|
+
src: uri,
|
|
15
|
+
controls: true,
|
|
16
|
+
autoPlay: true,
|
|
17
|
+
muted: autoPlay,
|
|
18
|
+
playsInline: true,
|
|
19
|
+
onError,
|
|
20
|
+
style: { width: '100%', height: '100%', objectFit: 'contain', backgroundColor: '#000' },
|
|
21
|
+
})}
|
|
22
|
+
</View>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { type StyleProp, StyleSheet, Text, type TextStyle } from 'react-native'
|
|
3
|
+
|
|
4
|
+
interface WorkflowButtonLabelProps {
|
|
5
|
+
children: string
|
|
6
|
+
style?: StyleProp<TextStyle>
|
|
7
|
+
minimumFontScale?: number
|
|
8
|
+
// Shared font scale (0-1) computed across all sibling buttons in the same
|
|
9
|
+
// workflow group, so a long label doesn't shrink on its own while a short
|
|
10
|
+
// sibling stays at full size. See estimateGroupButtonScale.
|
|
11
|
+
groupFontScale?: number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const WorkflowButtonLabel: React.FC<WorkflowButtonLabelProps> = ({
|
|
15
|
+
children,
|
|
16
|
+
style,
|
|
17
|
+
minimumFontScale = 0.85,
|
|
18
|
+
groupFontScale = 1,
|
|
19
|
+
}) => {
|
|
20
|
+
const flattened = StyleSheet.flatten(style) as TextStyle | undefined
|
|
21
|
+
const scaledFontSize =
|
|
22
|
+
typeof flattened?.fontSize === 'number' && groupFontScale !== 1 ? flattened.fontSize * groupFontScale : undefined
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Text
|
|
26
|
+
style={[style, styles.base, scaledFontSize != null ? { fontSize: scaledFontSize } : null]}
|
|
27
|
+
numberOfLines={1}
|
|
28
|
+
adjustsFontSizeToFit
|
|
29
|
+
minimumFontScale={minimumFontScale}
|
|
30
|
+
ellipsizeMode="tail"
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</Text>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const styles = StyleSheet.create({
|
|
38
|
+
base: { flexShrink: 1, textTransform: 'uppercase' },
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
export default WorkflowButtonLabel
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Svg, { Line, Path, Rect } from 'react-native-svg'
|
|
3
|
+
|
|
4
|
+
export type WorkflowCalendarIconKind = 'plus' | 'check'
|
|
5
|
+
|
|
6
|
+
interface WorkflowCalendarIconProps {
|
|
7
|
+
kind: WorkflowCalendarIconKind
|
|
8
|
+
size?: number
|
|
9
|
+
color?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const WorkflowCalendarIcon: React.FC<WorkflowCalendarIconProps> = ({ kind, size = 18, color = '#FFFFFF' }) => {
|
|
13
|
+
return (
|
|
14
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
15
|
+
<Rect x="3.5" y="5" width="17" height="15.5" rx="2.5" stroke={color} strokeWidth={1.6} />
|
|
16
|
+
<Line x1="3.5" y1="9.25" x2="20.5" y2="9.25" stroke={color} strokeWidth={1.6} />
|
|
17
|
+
<Line x1="8" y1="3.5" x2="8" y2="6.5" stroke={color} strokeWidth={1.6} strokeLinecap="round" />
|
|
18
|
+
<Line x1="16" y1="3.5" x2="16" y2="6.5" stroke={color} strokeWidth={1.6} strokeLinecap="round" />
|
|
19
|
+
{kind === 'plus' ? (
|
|
20
|
+
<Path d="M16.2 14.2h2.6M17.5 12.9v2.6" stroke={color} strokeWidth={1.7} strokeLinecap="round" />
|
|
21
|
+
) : (
|
|
22
|
+
<Path
|
|
23
|
+
d="M14.8 15.1l1.35 1.35 2.55-2.7"
|
|
24
|
+
stroke={color}
|
|
25
|
+
strokeWidth={1.7}
|
|
26
|
+
strokeLinecap="round"
|
|
27
|
+
strokeLinejoin="round"
|
|
28
|
+
/>
|
|
29
|
+
)}
|
|
30
|
+
</Svg>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function resolveCalendarIconKind(icon?: string): WorkflowCalendarIconKind | null {
|
|
35
|
+
if (!icon) return null
|
|
36
|
+
const key = icon.trim().toLowerCase()
|
|
37
|
+
if (key === 'calendar-plus' || key === 'calendar_plus' || key === 'calendar+' || key === '📅+' || key === '📅') {
|
|
38
|
+
return 'plus'
|
|
39
|
+
}
|
|
40
|
+
if (
|
|
41
|
+
key === 'calendar-check' ||
|
|
42
|
+
key === 'calendar_check' ||
|
|
43
|
+
key === 'calendar-checkin' ||
|
|
44
|
+
key === '✓' ||
|
|
45
|
+
key === '📅✓'
|
|
46
|
+
) {
|
|
47
|
+
return 'check'
|
|
48
|
+
}
|
|
49
|
+
return null
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default WorkflowCalendarIcon
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react'
|
|
2
|
+
import { type LayoutChangeEvent, type StyleProp, StyleSheet, Text, type TextProps, type TextStyle } from 'react-native'
|
|
3
|
+
|
|
4
|
+
import { useResponsive } from '../responsive'
|
|
5
|
+
import { estimateGroupButtonScale } from '../responsive/responsive'
|
|
6
|
+
import { useRegisterTitleGroupScale, useWorkflowTitleScale } from '../WorkflowFontScaleContext'
|
|
7
|
+
|
|
8
|
+
type WorkflowTextVariant = 'heading' | 'title' | 'subtitle' | 'body' | 'label' | 'caption' | 'badge'
|
|
9
|
+
|
|
10
|
+
export interface WorkflowTextProps extends TextProps {
|
|
11
|
+
variant?: WorkflowTextVariant
|
|
12
|
+
size?: number
|
|
13
|
+
minimumFontScale?: number
|
|
14
|
+
style?: StyleProp<TextStyle>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const WORKFLOW_TEXT_BASE_SIZES: Record<WorkflowTextVariant, number> = {
|
|
18
|
+
heading: 18,
|
|
19
|
+
title: 15,
|
|
20
|
+
subtitle: 12,
|
|
21
|
+
body: 15,
|
|
22
|
+
label: 14,
|
|
23
|
+
caption: 12,
|
|
24
|
+
badge: 11,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const FONT_WEIGHTS: Record<WorkflowTextVariant, TextStyle['fontWeight']> = {
|
|
28
|
+
heading: '700',
|
|
29
|
+
title: '600',
|
|
30
|
+
subtitle: '400',
|
|
31
|
+
body: '400',
|
|
32
|
+
label: '600',
|
|
33
|
+
caption: '400',
|
|
34
|
+
badge: '600',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const BODY_VARIANTS = new Set<WorkflowTextVariant>(['subtitle', 'body', 'label', 'caption'])
|
|
38
|
+
|
|
39
|
+
// Variants that sync to one shared size across the whole screen, regardless
|
|
40
|
+
// of which component (card, tile, standalone title block...) renders them.
|
|
41
|
+
// Every instance measures its own rendered width and reports the scale IT
|
|
42
|
+
// needs to fit on one line; the registry then broadcasts the smallest of all
|
|
43
|
+
// of them back out, so e.g. every 'title' on screen always matches.
|
|
44
|
+
const SYNCED_VARIANTS = new Set<WorkflowTextVariant>(['title'])
|
|
45
|
+
|
|
46
|
+
const WorkflowText: React.FC<WorkflowTextProps> = ({
|
|
47
|
+
variant = 'body',
|
|
48
|
+
size,
|
|
49
|
+
style,
|
|
50
|
+
children,
|
|
51
|
+
numberOfLines,
|
|
52
|
+
minimumFontScale,
|
|
53
|
+
onLayout,
|
|
54
|
+
...rest
|
|
55
|
+
}) => {
|
|
56
|
+
const { ms } = useResponsive()
|
|
57
|
+
const screenTitleScale = useWorkflowTitleScale()
|
|
58
|
+
const fitOneLine = numberOfLines === 1
|
|
59
|
+
const isSynced = SYNCED_VARIANTS.has(variant) && fitOneLine
|
|
60
|
+
const resolvedMinScale = minimumFontScale ?? (BODY_VARIANTS.has(variant) ? 0.65 : 0.85)
|
|
61
|
+
const instanceIdRef = useRef(`wtxt-${Math.random().toString(36).slice(2)}`)
|
|
62
|
+
const [containerWidth, setContainerWidth] = useState(0)
|
|
63
|
+
|
|
64
|
+
const baseFontSize = useMemo(() => {
|
|
65
|
+
const flattened = StyleSheet.flatten(style)
|
|
66
|
+
const styleSize =
|
|
67
|
+
flattened && typeof flattened.fontSize === 'number' && Number.isFinite(flattened.fontSize)
|
|
68
|
+
? flattened.fontSize
|
|
69
|
+
: undefined
|
|
70
|
+
if (size != null) return ms(size)
|
|
71
|
+
if (styleSize != null) return styleSize
|
|
72
|
+
return ms(WORKFLOW_TEXT_BASE_SIZES[variant])
|
|
73
|
+
}, [ms, size, style, variant])
|
|
74
|
+
|
|
75
|
+
const text = typeof children === 'string' ? children : String(children ?? '')
|
|
76
|
+
|
|
77
|
+
const requiredScale = useMemo(() => {
|
|
78
|
+
if (!isSynced || containerWidth <= 0 || text.length === 0) return 1
|
|
79
|
+
return estimateGroupButtonScale([text], containerWidth, baseFontSize)
|
|
80
|
+
}, [isSynced, containerWidth, text, baseFontSize])
|
|
81
|
+
|
|
82
|
+
useRegisterTitleGroupScale(instanceIdRef.current, isSynced ? requiredScale : 1)
|
|
83
|
+
|
|
84
|
+
const handleLayout = useCallback(
|
|
85
|
+
(event: LayoutChangeEvent) => {
|
|
86
|
+
if (isSynced) {
|
|
87
|
+
const next = event.nativeEvent.layout.width
|
|
88
|
+
setContainerWidth((prev) => (Math.abs(prev - next) > 1 ? next : prev))
|
|
89
|
+
}
|
|
90
|
+
onLayout?.(event)
|
|
91
|
+
},
|
|
92
|
+
[isSynced, onLayout]
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
const fontSize = baseFontSize * (isSynced ? screenTitleScale : 1)
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<Text
|
|
99
|
+
{...rest}
|
|
100
|
+
onLayout={handleLayout}
|
|
101
|
+
numberOfLines={numberOfLines}
|
|
102
|
+
adjustsFontSizeToFit={fitOneLine}
|
|
103
|
+
minimumFontScale={fitOneLine ? resolvedMinScale : undefined}
|
|
104
|
+
ellipsizeMode={fitOneLine ? 'tail' : undefined}
|
|
105
|
+
style={[
|
|
106
|
+
{
|
|
107
|
+
fontWeight: FONT_WEIGHTS[variant],
|
|
108
|
+
flexShrink: 1,
|
|
109
|
+
},
|
|
110
|
+
style,
|
|
111
|
+
{
|
|
112
|
+
fontSize,
|
|
113
|
+
},
|
|
114
|
+
]}
|
|
115
|
+
>
|
|
116
|
+
{children}
|
|
117
|
+
</Text>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default WorkflowText
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View } from 'react-native'
|
|
3
|
+
import WorkflowText from '../components/WorkflowText'
|
|
4
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
5
|
+
import { useResponsive } from '../responsive'
|
|
6
|
+
import { resolveSurfaceBackground } from '../style/resolveDisplayHintStyle'
|
|
7
|
+
|
|
8
|
+
const TONES: Record<string, { bg: string; fg: string }> = {
|
|
9
|
+
default: { bg: '#e5e7eb', fg: '#1f2937' },
|
|
10
|
+
green: { bg: '#dcfce7', fg: '#166534' },
|
|
11
|
+
red: { bg: '#fee2e2', fg: '#991b1b' },
|
|
12
|
+
amber: { bg: '#fef3c7', fg: '#92400e' },
|
|
13
|
+
blue: { bg: '#dbeafe', fg: '#1e3a8a' },
|
|
14
|
+
purple: { bg: '#ede9fe', fg: '#5b21b6' },
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const BadgeContent: React.FC<ContentProps> = ({ item }) => {
|
|
18
|
+
const { s } = useResponsive()
|
|
19
|
+
const label = (item.label as string | undefined) ?? (item.text as string | undefined) ?? ''
|
|
20
|
+
const tone = (item.tone as string | undefined) ?? 'default'
|
|
21
|
+
const palette = TONES[tone] ?? TONES.default
|
|
22
|
+
const customBg = resolveSurfaceBackground(item.bgColor as string | undefined)
|
|
23
|
+
const hasCustomBg = customBg !== 'transparent'
|
|
24
|
+
const customFg =
|
|
25
|
+
typeof item.color === 'string' && item.color.trim() ? item.color.trim() : hasCustomBg ? '#FFFFFF' : palette.fg
|
|
26
|
+
const radius = typeof item.borderRadius === 'number' && Number.isFinite(item.borderRadius) ? item.borderRadius : s(6)
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<View
|
|
30
|
+
style={[
|
|
31
|
+
{
|
|
32
|
+
alignSelf:
|
|
33
|
+
item.align === 'center'
|
|
34
|
+
? 'center'
|
|
35
|
+
: item.align === 'end' || item.align === 'right'
|
|
36
|
+
? 'flex-end'
|
|
37
|
+
: 'flex-start',
|
|
38
|
+
maxWidth: '100%',
|
|
39
|
+
flexShrink: 0,
|
|
40
|
+
minWidth: typeof item.minWidth === 'number' ? item.minWidth : undefined,
|
|
41
|
+
borderRadius: radius,
|
|
42
|
+
backgroundColor: hasCustomBg ? customBg : palette.bg,
|
|
43
|
+
paddingHorizontal: s(12),
|
|
44
|
+
paddingVertical: s(5),
|
|
45
|
+
},
|
|
46
|
+
]}
|
|
47
|
+
>
|
|
48
|
+
<WorkflowText variant="badge" numberOfLines={1} style={{ color: customFg, fontWeight: '700' }}>
|
|
49
|
+
{label}
|
|
50
|
+
</WorkflowText>
|
|
51
|
+
</View>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
ContentRegistry.register('badge', BadgeContent)
|
|
56
|
+
|
|
57
|
+
export default BadgeContent
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// packages/core/src/modules/workflow/ui-elements/content/BarChartContent.tsx
|
|
2
|
+
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { Text, View } from 'react-native'
|
|
5
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
6
|
+
import { resolveItemSurfaceStyle } from '../style/resolveDisplayHintStyle'
|
|
7
|
+
|
|
8
|
+
interface BarItem {
|
|
9
|
+
label: string
|
|
10
|
+
count: number | string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const parseCount = (count: number | string): number => {
|
|
14
|
+
if (typeof count === 'number') return count
|
|
15
|
+
return parseFloat(count) || 0
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const DEFAULT_BARS: BarItem[] = [
|
|
19
|
+
{ label: 'Category A', count: 75 },
|
|
20
|
+
{ label: 'Category B', count: 50 },
|
|
21
|
+
{ label: 'Category C', count: 90 },
|
|
22
|
+
{ label: 'Category D', count: 35 },
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
const BarChartContent: React.FC<ContentProps> = ({ item, styles, colors }) => {
|
|
26
|
+
const rawBars: BarItem[] = item.bars || []
|
|
27
|
+
const bars = rawBars.length > 0 ? rawBars : DEFAULT_BARS
|
|
28
|
+
|
|
29
|
+
const parsedMax = item.max != null ? parseCount(item.max) : 0
|
|
30
|
+
const maxCount = parsedMax > 0 ? parsedMax : Math.max(...bars.map((b) => parseCount(b.count)), 1)
|
|
31
|
+
|
|
32
|
+
// Use the same colors as PieChart for consistency
|
|
33
|
+
const barColors = ['#FF6384', '#36A2EB', '#FFCE56', '#4BC0C0', '#9966FF', '#FF9F40']
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<View style={[styles.fieldContainer, resolveItemSurfaceStyle(item)]}>
|
|
37
|
+
{item.title && <Text style={[styles.formLabel, { color: colors.text, marginBottom: 12 }]}>{item.title}</Text>}
|
|
38
|
+
|
|
39
|
+
{bars.map((bar, index) => {
|
|
40
|
+
const count = parseCount(bar.count)
|
|
41
|
+
const percentage = Math.max(0, Math.min((count / maxCount) * 100, 100))
|
|
42
|
+
const barColor = barColors[index % barColors.length]
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<View key={index} style={{ marginBottom: 12 }}>
|
|
46
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 4 }}>
|
|
47
|
+
<Text style={[styles.description, { color: colors.text, fontSize: 13 }]}>{bar.label}</Text>
|
|
48
|
+
<Text style={[styles.description, { color: colors.text, fontSize: 13, fontWeight: '600' }]}>{count}</Text>
|
|
49
|
+
</View>
|
|
50
|
+
|
|
51
|
+
<View
|
|
52
|
+
style={{
|
|
53
|
+
height: 24,
|
|
54
|
+
backgroundColor: `${barColor}20`, // Light background with 20% opacity
|
|
55
|
+
borderRadius: 4,
|
|
56
|
+
overflow: 'hidden',
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
<View
|
|
60
|
+
style={{
|
|
61
|
+
height: '100%',
|
|
62
|
+
width: `${percentage}%`,
|
|
63
|
+
backgroundColor: barColor, // Solid color for the bar
|
|
64
|
+
}}
|
|
65
|
+
/>
|
|
66
|
+
</View>
|
|
67
|
+
</View>
|
|
68
|
+
)
|
|
69
|
+
})}
|
|
70
|
+
</View>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
ContentRegistry.register('bar-chart', BarChartContent)
|
|
75
|
+
|
|
76
|
+
export default BarChartContent
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Text, TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import { useWalletAdapter } from '../adapter/WalletAdapter'
|
|
4
|
+
import { useWorkflowT } from '../i18n/WorkflowI18n'
|
|
5
|
+
import { WorkflowIcon } from '../icons/WorkflowIcon'
|
|
6
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
7
|
+
import { resolveItemSurfaceStyle } from '../style/resolveDisplayHintStyle'
|
|
8
|
+
import { testIdWithKey } from '../utils/testable'
|
|
9
|
+
import { local } from './PhotoContent'
|
|
10
|
+
import { SimulatedHint } from './SimulatedHint'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* QR / barcode scan button. Scanning is the app's (`adapter.scanBarcode()`):
|
|
14
|
+
* the wallet opens its scanner screen (which handles the code itself and
|
|
15
|
+
* resolves `null`); the designer returns a sample code. A returned code goes
|
|
16
|
+
* to `form-id` and to `actionID` / `event` as `{ code }`.
|
|
17
|
+
*/
|
|
18
|
+
const BarcodeContent: React.FC<ContentProps> = ({ item, styles, colors, onAction, onFieldChange, disabled }) => {
|
|
19
|
+
const t = useWorkflowT()
|
|
20
|
+
const adapter = useWalletAdapter()
|
|
21
|
+
const label = (typeof item.label === 'string' && item.label) || t('WorkflowUi.ScanCode')
|
|
22
|
+
const formId = item['form-id'] as string | undefined
|
|
23
|
+
const actionId = (item.actionID as string | undefined) || (item.event as string | undefined)
|
|
24
|
+
|
|
25
|
+
const handlePress = async () => {
|
|
26
|
+
if (disabled) return
|
|
27
|
+
try {
|
|
28
|
+
const code = await adapter.scanBarcode()
|
|
29
|
+
if (!code) return
|
|
30
|
+
if (formId) onFieldChange?.(formId, code)
|
|
31
|
+
if (actionId) onAction(actionId, { code })
|
|
32
|
+
} catch {
|
|
33
|
+
// the scanner reports its own errors
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<View style={[styles.fieldContainer, resolveItemSurfaceStyle(item as any)]}>
|
|
39
|
+
{item.label ? <Text style={[styles.label, { color: colors.text }]}>{label}</Text> : null}
|
|
40
|
+
<TouchableOpacity
|
|
41
|
+
testID={testIdWithKey('WorkflowScanCode')}
|
|
42
|
+
accessibilityLabel={label}
|
|
43
|
+
accessibilityRole="button"
|
|
44
|
+
onPress={handlePress}
|
|
45
|
+
activeOpacity={0.8}
|
|
46
|
+
style={[local.dashedButton, { borderColor: colors.border }, disabled ? local.disabled : null]}
|
|
47
|
+
>
|
|
48
|
+
<WorkflowIcon set="material-community" name="qrcode-scan" size={32} color="#FFFFFF" />
|
|
49
|
+
<Text style={local.dashedLabel}>{label}</Text>
|
|
50
|
+
</TouchableOpacity>
|
|
51
|
+
{adapter.simulated ? <SimulatedHint /> : null}
|
|
52
|
+
</View>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
ContentRegistry.register('barcode', BarcodeContent)
|
|
57
|
+
ContentRegistry.register('qr-code', BarcodeContent)
|
|
58
|
+
|
|
59
|
+
export default BarcodeContent
|