@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,87 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, TouchableOpacity } from 'react-native'
|
|
3
|
+
import { useWalletAdapter } from '../adapter/WalletAdapter'
|
|
4
|
+
import WorkflowButtonLabel from '../components/WorkflowButtonLabel'
|
|
5
|
+
import { useWorkflowT } from '../i18n/WorkflowI18n'
|
|
6
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
7
|
+
import { useResponsive } from '../responsive'
|
|
8
|
+
import { resolveAlignSelf, resolveButtonFillStyle, resolveSurfaceBackground } from '../style/resolveDisplayHintStyle'
|
|
9
|
+
|
|
10
|
+
const WebLinkContent: React.FC<ContentProps> = ({ item, fillContainer, groupFontScale = 1 }) => {
|
|
11
|
+
const { s, ms, isSmall } = useResponsive()
|
|
12
|
+
const adapter = useWalletAdapter()
|
|
13
|
+
const t = useWorkflowT()
|
|
14
|
+
const url = (item.url as string | undefined) || (item.link as string | undefined)
|
|
15
|
+
if (!url) {
|
|
16
|
+
return null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const handlePress = () => {
|
|
20
|
+
if (!/^https?:\/\//i.test(url)) {
|
|
21
|
+
adapter.alert(t('WorkflowUi.InvalidLink'), t('WorkflowUi.InvalidLinkMessage'))
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
adapter.openUrl(url).catch(() => {
|
|
25
|
+
adapter.alert(t('WorkflowUi.LinkFailed'))
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const fill = resolveSurfaceBackground(item.bgColor as string | undefined)
|
|
30
|
+
const isTransparent = fill === 'transparent'
|
|
31
|
+
const labelColor = '#FFFFFF'
|
|
32
|
+
const minHeight = s(isSmall ? 44 : 52)
|
|
33
|
+
const label = String(item.label || url)
|
|
34
|
+
const icon = item.icon != null ? String(item.icon) : ''
|
|
35
|
+
const displayLabel = icon ? `${icon} ${label}` : label
|
|
36
|
+
const alignSelf = resolveAlignSelf(item.align as string | undefined)
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<TouchableOpacity
|
|
40
|
+
style={[
|
|
41
|
+
local.pill,
|
|
42
|
+
{
|
|
43
|
+
minHeight,
|
|
44
|
+
borderRadius: minHeight / 2,
|
|
45
|
+
paddingVertical: s(isSmall ? 10 : 14),
|
|
46
|
+
paddingHorizontal: s(isSmall ? 12 : 16),
|
|
47
|
+
marginTop: fillContainer ? 0 : s(8),
|
|
48
|
+
},
|
|
49
|
+
fillContainer ? { flex: 1, alignSelf: 'stretch', height: '100%', maxWidth: '100%' } : null,
|
|
50
|
+
!fillContainer && alignSelf ? { alignSelf } : null,
|
|
51
|
+
resolveButtonFillStyle(item, { includePadding: false }),
|
|
52
|
+
isTransparent
|
|
53
|
+
? {
|
|
54
|
+
backgroundColor: 'transparent',
|
|
55
|
+
borderWidth: 1.5,
|
|
56
|
+
borderColor: '#FFFFFF',
|
|
57
|
+
}
|
|
58
|
+
: null,
|
|
59
|
+
]}
|
|
60
|
+
onPress={handlePress}
|
|
61
|
+
activeOpacity={0.85}
|
|
62
|
+
>
|
|
63
|
+
<WorkflowButtonLabel
|
|
64
|
+
style={[local.pillText, { color: labelColor, fontSize: ms(isSmall ? 13 : 15) }]}
|
|
65
|
+
groupFontScale={groupFontScale}
|
|
66
|
+
>
|
|
67
|
+
{displayLabel}
|
|
68
|
+
</WorkflowButtonLabel>
|
|
69
|
+
</TouchableOpacity>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const local = StyleSheet.create({
|
|
74
|
+
pill: {
|
|
75
|
+
flexDirection: 'row',
|
|
76
|
+
width: '100%',
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
justifyContent: 'center',
|
|
79
|
+
flexShrink: 1,
|
|
80
|
+
minWidth: 0,
|
|
81
|
+
},
|
|
82
|
+
pillText: { fontWeight: '700', textAlign: 'center', flexShrink: 1 },
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
ContentRegistry.register('web-link', WebLinkContent)
|
|
86
|
+
|
|
87
|
+
export default WebLinkContent
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers the layout, text, data, form and action components with ContentRegistry.
|
|
3
|
+
* Imported for its side effects by the package entry point.
|
|
4
|
+
*/
|
|
5
|
+
import './TitleContent'
|
|
6
|
+
import './TextContent'
|
|
7
|
+
import './DividerContent'
|
|
8
|
+
import './SpacerContent'
|
|
9
|
+
import './BadgeContent'
|
|
10
|
+
import './ChipContent'
|
|
11
|
+
import './ChipRowContent'
|
|
12
|
+
import './ImageContent'
|
|
13
|
+
import './RowContent'
|
|
14
|
+
import './SectionContent'
|
|
15
|
+
import './CardContent'
|
|
16
|
+
import './GridLayoutContent'
|
|
17
|
+
import './ListContent'
|
|
18
|
+
import './CarouselContent'
|
|
19
|
+
import './TileContent'
|
|
20
|
+
import './BasicTableContent'
|
|
21
|
+
import './TimelineContent'
|
|
22
|
+
import './BarChartContent'
|
|
23
|
+
import './PieChartContent'
|
|
24
|
+
import './DonutChartContent'
|
|
25
|
+
import './GaugeContent'
|
|
26
|
+
import './DialContent'
|
|
27
|
+
import './FormContent'
|
|
28
|
+
import './FormFieldBridge'
|
|
29
|
+
import './MultipleChoiceContent'
|
|
30
|
+
import './RadioButtonContent'
|
|
31
|
+
import './SliderContent'
|
|
32
|
+
import './SubmitButtonContent'
|
|
33
|
+
import './ButtonContent'
|
|
34
|
+
import './SpinnerContent'
|
|
35
|
+
import './WebLinkContent'
|
|
36
|
+
import './OpenBadgePreviewContent'
|
|
37
|
+
import './CredentialOfferContent'
|
|
38
|
+
import './ProofPresentationContent'
|
|
39
|
+
import './ShareEntryContent'
|
|
40
|
+
import './PhotoContent'
|
|
41
|
+
import './BarcodeContent'
|
|
42
|
+
import './LocationContent'
|
|
43
|
+
import './MapContent'
|
|
44
|
+
import './VideoContent'
|
|
45
|
+
import './CalendarContent'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import WorkflowText from '../components/WorkflowText'
|
|
4
|
+
import { WorkflowIcon } from '../icons/WorkflowIcon'
|
|
5
|
+
import { type FormFieldProps, FormFieldRegistry } from '../registries/FormFieldRegistry'
|
|
6
|
+
|
|
7
|
+
const CheckboxField: React.FC<FormFieldProps> = ({ field, value, onChange, styles, colors }) => {
|
|
8
|
+
const isChecked = value === true || value === 'true'
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<View style={styles.fieldContainer}>
|
|
12
|
+
<TouchableOpacity style={styles.checkboxRow} onPress={() => onChange(!isChecked)}>
|
|
13
|
+
<View
|
|
14
|
+
style={[styles.checkbox, { borderColor: colors.primary }, isChecked && { backgroundColor: colors.primary }]}
|
|
15
|
+
>
|
|
16
|
+
{isChecked && <WorkflowIcon name="check" size={16} color="#fff" />}
|
|
17
|
+
</View>
|
|
18
|
+
<WorkflowText variant="body" style={[styles.checkboxLabel, { color: colors.text, flex: 1 }]}>
|
|
19
|
+
{field.label}
|
|
20
|
+
</WorkflowText>
|
|
21
|
+
</TouchableOpacity>
|
|
22
|
+
</View>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
FormFieldRegistry.register('checkbox', CheckboxField)
|
|
27
|
+
FormFieldRegistry.register('check-box', CheckboxField)
|
|
28
|
+
|
|
29
|
+
export default CheckboxField
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import DateTimePicker, { type DateTimePickerEvent } from '@react-native-community/datetimepicker'
|
|
2
|
+
import React, { useState } from 'react'
|
|
3
|
+
import { Platform, Pressable, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
|
|
4
|
+
import { useWorkflowT } from '../i18n/WorkflowI18n'
|
|
5
|
+
import { WorkflowModal } from '../modal/WorkflowModal'
|
|
6
|
+
import { type FormFieldProps, FormFieldRegistry } from '../registries/FormFieldRegistry'
|
|
7
|
+
import { testIdWithKey } from '../utils/testable'
|
|
8
|
+
|
|
9
|
+
const DateField: React.FC<FormFieldProps> = ({ field, value, onChange, styles, colors }) => {
|
|
10
|
+
const [showPicker, setShowPicker] = useState(false)
|
|
11
|
+
|
|
12
|
+
const parseLocalDate = (val: string): Date => {
|
|
13
|
+
const parts = val.split('-').map(Number)
|
|
14
|
+
if (parts.length === 3 && parts.every(Boolean)) {
|
|
15
|
+
return new Date(parts[0], parts[1] - 1, parts[2])
|
|
16
|
+
}
|
|
17
|
+
return new Date(val)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const dateValue = value ? parseLocalDate(value) : new Date()
|
|
21
|
+
|
|
22
|
+
const t = useWorkflowT()
|
|
23
|
+
const formatDate = (date: Date) => date.toLocaleDateString()
|
|
24
|
+
|
|
25
|
+
const handleChange = (event: DateTimePickerEvent, date?: Date) => {
|
|
26
|
+
if (Platform.OS === 'android') {
|
|
27
|
+
setShowPicker(false)
|
|
28
|
+
}
|
|
29
|
+
if (date) {
|
|
30
|
+
const y = date.getFullYear()
|
|
31
|
+
const m = String(date.getMonth() + 1).padStart(2, '0')
|
|
32
|
+
const d = String(date.getDate()).padStart(2, '0')
|
|
33
|
+
onChange(`${y}-${m}-${d}`)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<View style={styles.fieldContainer}>
|
|
39
|
+
<Text style={[styles.label, { color: colors.text }]}>{field.label}</Text>
|
|
40
|
+
<TouchableOpacity
|
|
41
|
+
testID={testIdWithKey('WorkflowDatePicker')}
|
|
42
|
+
accessibilityLabel={field.label || t('WorkflowUi.SelectDate')}
|
|
43
|
+
accessibilityRole="button"
|
|
44
|
+
style={[styles.dateButton, { borderColor: colors.border || colors.primary, borderWidth: 1.5 }]}
|
|
45
|
+
onPress={() => setShowPicker(true)}
|
|
46
|
+
>
|
|
47
|
+
<Text style={{ color: colors.text }}>{value ? formatDate(dateValue) : t('WorkflowUi.SelectDate')}</Text>
|
|
48
|
+
</TouchableOpacity>
|
|
49
|
+
|
|
50
|
+
{Platform.OS === 'ios' ? (
|
|
51
|
+
<WorkflowModal
|
|
52
|
+
visible={showPicker}
|
|
53
|
+
transparent
|
|
54
|
+
animationType="fade"
|
|
55
|
+
onRequestClose={() => setShowPicker(false)}
|
|
56
|
+
>
|
|
57
|
+
<Pressable style={s.backdrop} onPress={() => setShowPicker(false)}>
|
|
58
|
+
<Pressable style={s.sheet}>
|
|
59
|
+
<View style={s.handle} />
|
|
60
|
+
<DateTimePicker
|
|
61
|
+
value={dateValue}
|
|
62
|
+
mode="date"
|
|
63
|
+
display="inline"
|
|
64
|
+
onChange={handleChange}
|
|
65
|
+
style={s.picker}
|
|
66
|
+
themeVariant="light"
|
|
67
|
+
/>
|
|
68
|
+
<TouchableOpacity
|
|
69
|
+
style={[s.doneButton, { backgroundColor: colors.primary }]}
|
|
70
|
+
onPress={() => setShowPicker(false)}
|
|
71
|
+
>
|
|
72
|
+
<Text style={[s.doneText, { color: colors.buttonText || '#fff' }]}>Done</Text>
|
|
73
|
+
</TouchableOpacity>
|
|
74
|
+
</Pressable>
|
|
75
|
+
</Pressable>
|
|
76
|
+
</WorkflowModal>
|
|
77
|
+
) : (
|
|
78
|
+
showPicker && <DateTimePicker value={dateValue} mode="date" display="default" onChange={handleChange} />
|
|
79
|
+
)}
|
|
80
|
+
</View>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const s = StyleSheet.create({
|
|
85
|
+
backdrop: {
|
|
86
|
+
flex: 1,
|
|
87
|
+
backgroundColor: 'rgba(0,0,0,0.4)',
|
|
88
|
+
justifyContent: 'center',
|
|
89
|
+
alignItems: 'center',
|
|
90
|
+
paddingHorizontal: 24,
|
|
91
|
+
},
|
|
92
|
+
sheet: {
|
|
93
|
+
backgroundColor: '#fff',
|
|
94
|
+
borderRadius: 20,
|
|
95
|
+
paddingTop: 16,
|
|
96
|
+
paddingBottom: 20,
|
|
97
|
+
paddingHorizontal: 16,
|
|
98
|
+
alignItems: 'center',
|
|
99
|
+
width: '100%',
|
|
100
|
+
},
|
|
101
|
+
handle: {
|
|
102
|
+
width: 0,
|
|
103
|
+
height: 0,
|
|
104
|
+
},
|
|
105
|
+
picker: {
|
|
106
|
+
width: '100%',
|
|
107
|
+
},
|
|
108
|
+
doneButton: {
|
|
109
|
+
marginTop: 12,
|
|
110
|
+
paddingVertical: 14,
|
|
111
|
+
borderRadius: 14,
|
|
112
|
+
width: '100%',
|
|
113
|
+
alignItems: 'center',
|
|
114
|
+
},
|
|
115
|
+
doneText: {
|
|
116
|
+
fontSize: 16,
|
|
117
|
+
fontWeight: '600',
|
|
118
|
+
},
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
FormFieldRegistry.register('date', DateField)
|
|
122
|
+
|
|
123
|
+
export default DateField
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Text, TextInput, View } from 'react-native'
|
|
3
|
+
import { useWorkflowT } from '../i18n/WorkflowI18n'
|
|
4
|
+
import { type FormFieldProps, FormFieldRegistry } from '../registries/FormFieldRegistry'
|
|
5
|
+
import { testIdWithKey } from '../utils/testable'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Web version of the date field (the native picker has no web build).
|
|
9
|
+
* Accepts and emits `YYYY-MM-DD`, like the native field.
|
|
10
|
+
*/
|
|
11
|
+
const DateField: React.FC<FormFieldProps> = ({ field, value, onChange, styles, colors }) => {
|
|
12
|
+
const t = useWorkflowT()
|
|
13
|
+
return (
|
|
14
|
+
<View style={styles.fieldContainer}>
|
|
15
|
+
<Text style={[styles.label, { color: colors.text }]}>{field.label}</Text>
|
|
16
|
+
<TextInput
|
|
17
|
+
testID={testIdWithKey('WorkflowDatePicker')}
|
|
18
|
+
accessibilityLabel={field.label || t('WorkflowUi.SelectDate')}
|
|
19
|
+
style={[
|
|
20
|
+
styles.dateButton,
|
|
21
|
+
{ borderColor: colors.border || colors.primary, borderWidth: 1.5, color: colors.text },
|
|
22
|
+
]}
|
|
23
|
+
value={typeof value === 'string' ? value : ''}
|
|
24
|
+
placeholder="YYYY-MM-DD"
|
|
25
|
+
onChangeText={(text) => onChange(text)}
|
|
26
|
+
/>
|
|
27
|
+
</View>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
FormFieldRegistry.register('date', DateField)
|
|
32
|
+
export default DateField
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React, { useMemo, useRef, useState } from 'react'
|
|
2
|
+
import { FlatList, Pressable, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import { useWorkflowT } from '../i18n/WorkflowI18n'
|
|
4
|
+
import { useModalPosition, WorkflowModal } from '../modal/WorkflowModal'
|
|
5
|
+
import { type FormFieldProps, FormFieldRegistry } from '../registries/FormFieldRegistry'
|
|
6
|
+
|
|
7
|
+
type Anchor = { x: number; y: number; width: number; height: number } | null
|
|
8
|
+
|
|
9
|
+
const DropdownField: React.FC<FormFieldProps> = ({ field, value, onChange, styles, colors }) => {
|
|
10
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
11
|
+
const [anchor, setAnchor] = useState<Anchor>(null)
|
|
12
|
+
const triggerRef = useRef<View>(null)
|
|
13
|
+
const t = useWorkflowT()
|
|
14
|
+
const toModalPosition = useModalPosition()
|
|
15
|
+
|
|
16
|
+
const options = useMemo(() => field.options || [], [field.options])
|
|
17
|
+
|
|
18
|
+
const open = () => {
|
|
19
|
+
// ref.measureInWindow works on native and react-native-web; findNodeHandle
|
|
20
|
+
// + UIManager.measureInWindow throws on web, so the list never opened there.
|
|
21
|
+
const node = triggerRef.current
|
|
22
|
+
if (!node) {
|
|
23
|
+
setIsOpen(true)
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Window coordinates, converted to the popup layer's (the designer's phone
|
|
28
|
+
// frame when a WorkflowModalHost is present).
|
|
29
|
+
node.measureInWindow((x, y, width, height) => {
|
|
30
|
+
toModalPosition({ x, y }, (local) => {
|
|
31
|
+
setAnchor({ x: local.x, y: local.y, width, height })
|
|
32
|
+
setIsOpen(true)
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const close = () => setIsOpen(false)
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<View style={styles.fieldContainer}>
|
|
41
|
+
<Text style={[styles.label, { color: colors.text }]}>{field.label}</Text>
|
|
42
|
+
|
|
43
|
+
{/* Trigger */}
|
|
44
|
+
<View ref={triggerRef} collapsable={false}>
|
|
45
|
+
<TouchableOpacity
|
|
46
|
+
style={[styles.dropdown, { borderColor: colors.border, backgroundColor: colors.background }]}
|
|
47
|
+
onPress={open}
|
|
48
|
+
>
|
|
49
|
+
<Text
|
|
50
|
+
style={{ color: value ? colors.text : colors.border, flex: 1, flexShrink: 1, paddingRight: 24 }}
|
|
51
|
+
numberOfLines={2}
|
|
52
|
+
>
|
|
53
|
+
{value || t('WorkflowUi.Select')}
|
|
54
|
+
</Text>
|
|
55
|
+
<Text style={{ position: 'absolute', right: 12, color: colors.text }}>▼</Text>
|
|
56
|
+
</TouchableOpacity>
|
|
57
|
+
</View>
|
|
58
|
+
|
|
59
|
+
{/* Modal dropdown */}
|
|
60
|
+
<WorkflowModal visible={isOpen} transparent animationType="fade" onRequestClose={close}>
|
|
61
|
+
<Pressable style={modalStyles.backdrop} onPress={close}>
|
|
62
|
+
<Pressable
|
|
63
|
+
// prevent closing when tapping inside menu
|
|
64
|
+
onPress={() => {}}
|
|
65
|
+
style={[
|
|
66
|
+
modalStyles.menu,
|
|
67
|
+
{
|
|
68
|
+
backgroundColor: colors.background,
|
|
69
|
+
borderColor: colors.border,
|
|
70
|
+
left: anchor?.x ?? 16,
|
|
71
|
+
top: (anchor?.y ?? 0) + (anchor?.height ?? 0) + 8,
|
|
72
|
+
width: anchor?.width ?? undefined,
|
|
73
|
+
},
|
|
74
|
+
]}
|
|
75
|
+
>
|
|
76
|
+
<FlatList
|
|
77
|
+
data={options}
|
|
78
|
+
keyExtractor={(item, idx) => `${item}-${idx}`}
|
|
79
|
+
renderItem={({ item, index }) => (
|
|
80
|
+
<TouchableOpacity
|
|
81
|
+
style={[
|
|
82
|
+
modalStyles.item,
|
|
83
|
+
{ borderBottomColor: colors.border },
|
|
84
|
+
index === options.length - 1 && modalStyles.lastItem,
|
|
85
|
+
]}
|
|
86
|
+
onPress={() => {
|
|
87
|
+
onChange(item)
|
|
88
|
+
close()
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
<Text style={{ color: colors.text, fontSize: 16, flex: 1, flexShrink: 1, paddingRight: 8 }}>
|
|
92
|
+
{item}
|
|
93
|
+
</Text>
|
|
94
|
+
{value === item && <Text style={{ color: colors.primary }}>✓</Text>}
|
|
95
|
+
</TouchableOpacity>
|
|
96
|
+
)}
|
|
97
|
+
/>
|
|
98
|
+
</Pressable>
|
|
99
|
+
</Pressable>
|
|
100
|
+
</WorkflowModal>
|
|
101
|
+
</View>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const modalStyles = StyleSheet.create({
|
|
106
|
+
backdrop: {
|
|
107
|
+
flex: 1,
|
|
108
|
+
},
|
|
109
|
+
menu: {
|
|
110
|
+
position: 'absolute',
|
|
111
|
+
borderWidth: 1,
|
|
112
|
+
borderRadius: 8,
|
|
113
|
+
maxHeight: 240,
|
|
114
|
+
// Android
|
|
115
|
+
elevation: 10,
|
|
116
|
+
// iOS
|
|
117
|
+
shadowColor: '#000',
|
|
118
|
+
shadowOffset: { width: 0, height: 6 },
|
|
119
|
+
shadowOpacity: 0.2,
|
|
120
|
+
shadowRadius: 12,
|
|
121
|
+
},
|
|
122
|
+
item: {
|
|
123
|
+
padding: 16,
|
|
124
|
+
borderBottomWidth: 1,
|
|
125
|
+
flexDirection: 'row',
|
|
126
|
+
justifyContent: 'space-between',
|
|
127
|
+
alignItems: 'center',
|
|
128
|
+
},
|
|
129
|
+
lastItem: {
|
|
130
|
+
borderBottomWidth: 0,
|
|
131
|
+
},
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
FormFieldRegistry.register('dropdown', DropdownField)
|
|
135
|
+
FormFieldRegistry.register('drop-down', DropdownField)
|
|
136
|
+
|
|
137
|
+
export default DropdownField
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import { type FormFieldProps, FormFieldRegistry } from '../registries/FormFieldRegistry'
|
|
4
|
+
|
|
5
|
+
const MCQField: React.FC<FormFieldProps> = ({ field, value, onChange, colors }) => {
|
|
6
|
+
const selected: string[] = Array.isArray(value) ? value : (value || '').split(',').filter(Boolean)
|
|
7
|
+
|
|
8
|
+
const toggleOption = (option: string) => {
|
|
9
|
+
const newSelected = selected.includes(option) ? selected.filter((o) => o !== option) : [...selected, option]
|
|
10
|
+
onChange(newSelected)
|
|
11
|
+
}
|
|
12
|
+
const options = field.options || []
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<View style={s.wrap}>
|
|
16
|
+
{!!field.label && <Text style={[s.label, { color: colors.text }]}>{field.label}</Text>}
|
|
17
|
+
{options.map((option: string, index: number) => {
|
|
18
|
+
const isSelected = selected.includes(option)
|
|
19
|
+
return (
|
|
20
|
+
<TouchableOpacity
|
|
21
|
+
key={index}
|
|
22
|
+
style={[s.row, isSelected && { borderColor: colors.primary }]}
|
|
23
|
+
onPress={() => toggleOption(option)}
|
|
24
|
+
activeOpacity={0.7}
|
|
25
|
+
>
|
|
26
|
+
<View style={[s.box, { borderColor: colors.primary }, isSelected && { backgroundColor: colors.primary }]}>
|
|
27
|
+
{isSelected && <Text style={[s.check, { color: colors.buttonText || '#062826' }]}>✓</Text>}
|
|
28
|
+
</View>
|
|
29
|
+
<Text style={[s.optLabel, { color: colors.text }]}>{option}</Text>
|
|
30
|
+
</TouchableOpacity>
|
|
31
|
+
)
|
|
32
|
+
})}
|
|
33
|
+
</View>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const s = StyleSheet.create({
|
|
38
|
+
wrap: { marginBottom: 8 },
|
|
39
|
+
label: { fontSize: 14, fontWeight: '600', marginBottom: 8, flexShrink: 1 },
|
|
40
|
+
row: {
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
alignItems: 'flex-start',
|
|
43
|
+
paddingVertical: 10,
|
|
44
|
+
paddingHorizontal: 12,
|
|
45
|
+
borderRadius: 12,
|
|
46
|
+
borderWidth: 1,
|
|
47
|
+
borderColor: 'rgba(255,255,255,0.12)',
|
|
48
|
+
marginBottom: 8,
|
|
49
|
+
minWidth: 0,
|
|
50
|
+
},
|
|
51
|
+
box: {
|
|
52
|
+
width: 22,
|
|
53
|
+
height: 22,
|
|
54
|
+
borderRadius: 6,
|
|
55
|
+
borderWidth: 2,
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
marginRight: 12,
|
|
59
|
+
marginTop: 2,
|
|
60
|
+
},
|
|
61
|
+
check: { fontSize: 13, fontWeight: '800' },
|
|
62
|
+
optLabel: { fontSize: 15, flex: 1, flexShrink: 1 },
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
FormFieldRegistry.register('mcq', MCQField)
|
|
66
|
+
FormFieldRegistry.register('multiple-choice', MCQField)
|
|
67
|
+
|
|
68
|
+
export default MCQField
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import WorkflowText from '../components/WorkflowText'
|
|
4
|
+
import { type FormFieldProps, FormFieldRegistry } from '../registries/FormFieldRegistry'
|
|
5
|
+
|
|
6
|
+
interface RadioOption {
|
|
7
|
+
label: string
|
|
8
|
+
value: string
|
|
9
|
+
default?: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const RadioField: React.FC<FormFieldProps> = ({ field, value, onChange, styles, colors }) => {
|
|
13
|
+
const options = field.options || []
|
|
14
|
+
|
|
15
|
+
const renderRadioOption = (option: unknown, index: number) => {
|
|
16
|
+
const isObjectOption = typeof option === 'object' && option !== null
|
|
17
|
+
const optionLabel = isObjectOption ? (option as RadioOption).label : (option as string)
|
|
18
|
+
const optionValue = isObjectOption ? (option as RadioOption).value : (option as string)
|
|
19
|
+
const isSelected = value === optionValue
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<TouchableOpacity key={index} style={styles.radioRow} onPress={() => onChange(optionValue)}>
|
|
23
|
+
<View
|
|
24
|
+
style={[
|
|
25
|
+
styles.radioOuter,
|
|
26
|
+
{ borderColor: colors.primary },
|
|
27
|
+
isSelected && { backgroundColor: colors.primary },
|
|
28
|
+
]}
|
|
29
|
+
>
|
|
30
|
+
{isSelected && <View style={styles.radioInner} />}
|
|
31
|
+
</View>
|
|
32
|
+
<WorkflowText variant="body" style={[styles.radioLabel, { color: colors.text, flex: 1 }]}>
|
|
33
|
+
{optionLabel}
|
|
34
|
+
</WorkflowText>
|
|
35
|
+
</TouchableOpacity>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<View style={styles.fieldContainer}>
|
|
41
|
+
{field.label ? (
|
|
42
|
+
<WorkflowText variant="label" style={[styles.label, { color: colors.text }]}>
|
|
43
|
+
{field.label}
|
|
44
|
+
</WorkflowText>
|
|
45
|
+
) : null}
|
|
46
|
+
{options.map(renderRadioOption)}
|
|
47
|
+
</View>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
FormFieldRegistry.register('radio', RadioField)
|
|
52
|
+
|
|
53
|
+
export default RadioField
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Slider from '@react-native-community/slider'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { StyleSheet, Text, View } from 'react-native'
|
|
4
|
+
import { type FormFieldProps, FormFieldRegistry } from '../registries/FormFieldRegistry'
|
|
5
|
+
|
|
6
|
+
const SliderField: React.FC<FormFieldProps> = ({ field, value, onChange, colors }) => {
|
|
7
|
+
const min = field.min ?? 0
|
|
8
|
+
const max = field.max ?? 100
|
|
9
|
+
|
|
10
|
+
const toNum = (v: any): number => {
|
|
11
|
+
const n = typeof v === 'string' ? parseFloat(v) : v
|
|
12
|
+
return Number.isFinite(n) ? n : min
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Local state so the label updates live while dragging (onValueChange),
|
|
16
|
+
// while onSlidingComplete commits the final value to the form.
|
|
17
|
+
const [display, setDisplay] = React.useState<number>(toNum(value))
|
|
18
|
+
|
|
19
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: sync the live label only when the committed value changes
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
setDisplay(toNum(value))
|
|
22
|
+
}, [value])
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<View style={s.wrap}>
|
|
26
|
+
{!!field.label && <Text style={[s.label, { color: colors.text }]}>{field.label}</Text>}
|
|
27
|
+
<Slider
|
|
28
|
+
style={s.slider}
|
|
29
|
+
value={display}
|
|
30
|
+
onValueChange={(val) => setDisplay(val)}
|
|
31
|
+
onSlidingComplete={(val) => onChange(Math.round(val).toString())}
|
|
32
|
+
minimumValue={min}
|
|
33
|
+
maximumValue={max}
|
|
34
|
+
step={1}
|
|
35
|
+
minimumTrackTintColor={colors.primary}
|
|
36
|
+
maximumTrackTintColor={colors.border}
|
|
37
|
+
thumbTintColor={colors.primary}
|
|
38
|
+
/>
|
|
39
|
+
<Text style={[s.value, { color: colors.primary }]}>{Math.round(display)}</Text>
|
|
40
|
+
</View>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const s = StyleSheet.create({
|
|
45
|
+
wrap: { marginBottom: 8 },
|
|
46
|
+
label: { fontSize: 14, fontWeight: '600', marginBottom: 4 },
|
|
47
|
+
slider: { width: '100%', height: 40 },
|
|
48
|
+
value: { fontSize: 16, fontWeight: '700', textAlign: 'center', marginTop: 2 },
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
FormFieldRegistry.register('slider', SliderField)
|
|
52
|
+
|
|
53
|
+
export default SliderField
|