@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,139 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native'
|
|
3
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
4
|
+
import { resolveFrameShadow } from '../style/resolveDisplayHintStyle'
|
|
5
|
+
|
|
6
|
+
interface HeaderColumn {
|
|
7
|
+
[key: string]: string | number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface TableRow {
|
|
11
|
+
[key: string]: string | number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const parseOrder = (order: string | number | undefined): number => {
|
|
15
|
+
if (order === undefined) return 0
|
|
16
|
+
if (typeof order === 'number') return order
|
|
17
|
+
return parseInt(order, 10) || 0
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const DEFAULT_HEADER: HeaderColumn[] = [
|
|
21
|
+
{ column1: 'Label', order: 0 },
|
|
22
|
+
{ column1: 'Label', order: 1 },
|
|
23
|
+
{ column1: 'Label', order: 2 },
|
|
24
|
+
]
|
|
25
|
+
const DEFAULT_ROWS: TableRow[] = [
|
|
26
|
+
{ col1: 'Value', col2: 'Value', col3: 'Value' },
|
|
27
|
+
{ col1: 'Value', col2: 'Value', col3: 'Value' },
|
|
28
|
+
{ col1: 'Value', col2: 'Value', col3: 'Value' },
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
const TABLE_BG = '#1C1C1E'
|
|
32
|
+
const HEADER_BG = '#0A0A0A'
|
|
33
|
+
const BORDER = 'rgba(255,255,255,0.14)'
|
|
34
|
+
const CELL_PAD = 12
|
|
35
|
+
|
|
36
|
+
const BasicTableContent: React.FC<ContentProps> = ({ item, styles, colors }) => {
|
|
37
|
+
const rawHeader: HeaderColumn[] = item.header || []
|
|
38
|
+
const rawRows: TableRow[] = item.rows || []
|
|
39
|
+
const header = rawHeader.length > 0 ? rawHeader : DEFAULT_HEADER
|
|
40
|
+
const rows = rawRows.length > 0 ? rawRows : DEFAULT_ROWS
|
|
41
|
+
const showBorder = item.border !== false && item.border !== 'false'
|
|
42
|
+
const borderColor = typeof item.borderColor === 'string' && item.borderColor.trim() ? item.borderColor : BORDER
|
|
43
|
+
const radius = typeof item.borderRadius === 'number' && Number.isFinite(item.borderRadius) ? item.borderRadius : 12
|
|
44
|
+
const tableBg = typeof item.bgColor === 'string' && item.bgColor.trim() ? item.bgColor : TABLE_BG
|
|
45
|
+
const headerBg = typeof item.headerBgColor === 'string' && item.headerBgColor.trim() ? item.headerBgColor : HEADER_BG
|
|
46
|
+
const rowBg = typeof item.rowBgColor === 'string' && item.rowBgColor.trim() ? item.rowBgColor : tableBg
|
|
47
|
+
|
|
48
|
+
const sortedHeader = [...header].sort((a, b) => parseOrder(a.order) - parseOrder(b.order))
|
|
49
|
+
const columnKeys = rows.length > 0 ? Object.keys(rows[0]).sort() : []
|
|
50
|
+
const headerLabels = sortedHeader.map((h) => h.column1 || '')
|
|
51
|
+
const colCount = Math.max(headerLabels.length, columnKeys.length, 1)
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<View style={[styles.fieldContainer, { backgroundColor: 'transparent', marginBottom: 0 }]}>
|
|
55
|
+
{item.title ? (
|
|
56
|
+
<Text style={[styles.formLabel, { color: colors.text, marginBottom: 12, flexShrink: 1, fontWeight: '700' }]}>
|
|
57
|
+
{item.title}
|
|
58
|
+
</Text>
|
|
59
|
+
) : null}
|
|
60
|
+
|
|
61
|
+
<View
|
|
62
|
+
style={[
|
|
63
|
+
{
|
|
64
|
+
overflow: 'hidden',
|
|
65
|
+
borderRadius: radius,
|
|
66
|
+
backgroundColor: tableBg,
|
|
67
|
+
},
|
|
68
|
+
showBorder
|
|
69
|
+
? {
|
|
70
|
+
borderWidth: 1,
|
|
71
|
+
borderColor,
|
|
72
|
+
}
|
|
73
|
+
: null,
|
|
74
|
+
resolveFrameShadow(item.shadow ?? true),
|
|
75
|
+
]}
|
|
76
|
+
>
|
|
77
|
+
<View style={{ flexDirection: 'row', backgroundColor: headerBg }}>
|
|
78
|
+
{Array.from({ length: colCount }).map((_, index) => (
|
|
79
|
+
<View
|
|
80
|
+
key={`h-${index}`}
|
|
81
|
+
style={[
|
|
82
|
+
{
|
|
83
|
+
flex: 1,
|
|
84
|
+
padding: CELL_PAD,
|
|
85
|
+
minWidth: 0,
|
|
86
|
+
},
|
|
87
|
+
showBorder && index > 0
|
|
88
|
+
? { borderLeftWidth: StyleSheet.hairlineWidth, borderLeftColor: borderColor }
|
|
89
|
+
: null,
|
|
90
|
+
]}
|
|
91
|
+
>
|
|
92
|
+
<Text style={{ color: '#FFFFFF', fontSize: 13, fontWeight: '600', flexShrink: 1 }}>
|
|
93
|
+
{headerLabels[index] || 'Label'}
|
|
94
|
+
</Text>
|
|
95
|
+
</View>
|
|
96
|
+
))}
|
|
97
|
+
</View>
|
|
98
|
+
|
|
99
|
+
{rows.map((row, rowIndex) => (
|
|
100
|
+
<View
|
|
101
|
+
key={`r-${rowIndex}`}
|
|
102
|
+
style={[
|
|
103
|
+
{ flexDirection: 'row', backgroundColor: rowBg },
|
|
104
|
+
showBorder ? { borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: borderColor } : null,
|
|
105
|
+
]}
|
|
106
|
+
>
|
|
107
|
+
{Array.from({ length: colCount }).map((_, colIndex) => {
|
|
108
|
+
const key = columnKeys[colIndex]
|
|
109
|
+
const value = key ? row[key] : ''
|
|
110
|
+
return (
|
|
111
|
+
<View
|
|
112
|
+
key={`c-${rowIndex}-${colIndex}`}
|
|
113
|
+
style={[
|
|
114
|
+
{
|
|
115
|
+
flex: 1,
|
|
116
|
+
padding: CELL_PAD,
|
|
117
|
+
minWidth: 0,
|
|
118
|
+
},
|
|
119
|
+
showBorder && colIndex > 0
|
|
120
|
+
? { borderLeftWidth: StyleSheet.hairlineWidth, borderLeftColor: borderColor }
|
|
121
|
+
: null,
|
|
122
|
+
]}
|
|
123
|
+
>
|
|
124
|
+
<Text style={{ color: 'rgba(255,255,255,0.92)', fontSize: 13, flexShrink: 1 }}>
|
|
125
|
+
{value || 'Value'}
|
|
126
|
+
</Text>
|
|
127
|
+
</View>
|
|
128
|
+
)
|
|
129
|
+
})}
|
|
130
|
+
</View>
|
|
131
|
+
))}
|
|
132
|
+
</View>
|
|
133
|
+
</View>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
ContentRegistry.register('basic-table', BasicTableContent)
|
|
138
|
+
|
|
139
|
+
export default BasicTableContent
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import WorkflowButtonLabel from '../components/WorkflowButtonLabel'
|
|
4
|
+
import WorkflowCalendarIcon, { resolveCalendarIconKind } from '../components/WorkflowCalendarIcon'
|
|
5
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
6
|
+
import { useResponsive } from '../responsive'
|
|
7
|
+
import {
|
|
8
|
+
resolveButtonFillStyle,
|
|
9
|
+
resolveFilledControlShadow,
|
|
10
|
+
resolveSurfaceBackground,
|
|
11
|
+
} from '../style/resolveDisplayHintStyle'
|
|
12
|
+
import { testIdWithKey } from '../utils/testable'
|
|
13
|
+
|
|
14
|
+
const ButtonContent: React.FC<ContentProps> = ({
|
|
15
|
+
item,
|
|
16
|
+
onAction,
|
|
17
|
+
buttonVariant = 'workflow',
|
|
18
|
+
fillContainer,
|
|
19
|
+
groupFontScale = 1,
|
|
20
|
+
disabled,
|
|
21
|
+
}) => {
|
|
22
|
+
const { s, ms, isSmall } = useResponsive()
|
|
23
|
+
|
|
24
|
+
// actionID, falling back to event (the wallet's former top-level renderer
|
|
25
|
+
// did the same; an event-only button used to do nothing when nested).
|
|
26
|
+
const actionId = (item.actionID as string | undefined) || (item.event as string | undefined)
|
|
27
|
+
const handlePress = () => {
|
|
28
|
+
if (actionId && !disabled) {
|
|
29
|
+
onAction(actionId, item.invitationLink || undefined)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const fill = resolveSurfaceBackground(
|
|
34
|
+
(typeof item.bgColor === 'string' && item.bgColor) ||
|
|
35
|
+
(typeof item.background === 'string' && item.background) ||
|
|
36
|
+
(typeof item.backgroundColor === 'string' && item.backgroundColor) ||
|
|
37
|
+
undefined
|
|
38
|
+
)
|
|
39
|
+
const isTransparent = fill === 'transparent' || fill.toLowerCase() === 'transparent'
|
|
40
|
+
const labelColor = typeof item.color === 'string' && item.color.trim() ? item.color.trim() : '#FFFFFF'
|
|
41
|
+
const outlineColor =
|
|
42
|
+
typeof item.borderColor === 'string' && item.borderColor.trim() ? item.borderColor.trim() : '#FFFFFF'
|
|
43
|
+
const minHeight = s(isSmall ? 44 : 52)
|
|
44
|
+
const label = String(item.label || 'Button')
|
|
45
|
+
const iconRaw = item.icon != null ? String(item.icon) : ''
|
|
46
|
+
const calendarKind = resolveCalendarIconKind(iconRaw)
|
|
47
|
+
const iconAtEnd = String(item.iconPosition || '').toLowerCase() === 'end'
|
|
48
|
+
const iconSize = s(isSmall ? 16 : 18)
|
|
49
|
+
const gap = s(8)
|
|
50
|
+
|
|
51
|
+
const iconNode = calendarKind ? (
|
|
52
|
+
<WorkflowCalendarIcon kind={calendarKind} size={iconSize} color={labelColor} />
|
|
53
|
+
) : iconRaw ? (
|
|
54
|
+
<WorkflowButtonLabel
|
|
55
|
+
style={[sBase.pillText, { color: labelColor, fontSize: ms(isSmall ? 13 : 15) }]}
|
|
56
|
+
groupFontScale={groupFontScale}
|
|
57
|
+
>
|
|
58
|
+
{iconRaw}
|
|
59
|
+
</WorkflowButtonLabel>
|
|
60
|
+
) : null
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<TouchableOpacity
|
|
64
|
+
style={[
|
|
65
|
+
sBase.pill,
|
|
66
|
+
{
|
|
67
|
+
minHeight,
|
|
68
|
+
borderRadius: minHeight / 2,
|
|
69
|
+
paddingVertical: s(isSmall ? 10 : 14),
|
|
70
|
+
paddingHorizontal: s(isSmall ? 12 : 16),
|
|
71
|
+
marginTop: fillContainer ? 0 : s(8),
|
|
72
|
+
gap,
|
|
73
|
+
},
|
|
74
|
+
fillContainer ? { flex: 1, alignSelf: 'stretch', height: '100%', maxWidth: '100%' } : null,
|
|
75
|
+
resolveButtonFillStyle(item as any, { includePadding: false }),
|
|
76
|
+
isTransparent ? { backgroundColor: 'transparent' } : fill !== 'transparent' ? { backgroundColor: fill } : null,
|
|
77
|
+
resolveFilledControlShadow(isTransparent ? 'transparent' : (item.bgColor as string | undefined)),
|
|
78
|
+
isTransparent
|
|
79
|
+
? {
|
|
80
|
+
borderWidth: typeof item.borderWidth === 'number' ? item.borderWidth : 1.5,
|
|
81
|
+
borderColor: outlineColor,
|
|
82
|
+
}
|
|
83
|
+
: null,
|
|
84
|
+
disabled ? sBase.disabled : null,
|
|
85
|
+
]}
|
|
86
|
+
onPress={handlePress}
|
|
87
|
+
disabled={disabled}
|
|
88
|
+
accessibilityState={{ disabled: !!disabled }}
|
|
89
|
+
activeOpacity={0.85}
|
|
90
|
+
testID={buttonVariant === 'primary' ? testIdWithKey(`WorkflowButton-${actionId ?? 'display'}`) : undefined}
|
|
91
|
+
>
|
|
92
|
+
{!iconAtEnd && iconNode ? <View style={sBase.iconSlot}>{iconNode}</View> : null}
|
|
93
|
+
<WorkflowButtonLabel
|
|
94
|
+
style={[
|
|
95
|
+
sBase.pillText,
|
|
96
|
+
{ color: labelColor, fontSize: ms(isSmall ? 13 : 15) },
|
|
97
|
+
iconNode ? { width: undefined } : null,
|
|
98
|
+
]}
|
|
99
|
+
groupFontScale={groupFontScale}
|
|
100
|
+
>
|
|
101
|
+
{label}
|
|
102
|
+
</WorkflowButtonLabel>
|
|
103
|
+
{iconAtEnd && iconNode ? <View style={sBase.iconSlot}>{iconNode}</View> : null}
|
|
104
|
+
</TouchableOpacity>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const sBase = StyleSheet.create({
|
|
109
|
+
pill: {
|
|
110
|
+
flexDirection: 'row',
|
|
111
|
+
width: '100%',
|
|
112
|
+
alignItems: 'center',
|
|
113
|
+
justifyContent: 'center',
|
|
114
|
+
flexShrink: 1,
|
|
115
|
+
minWidth: 0,
|
|
116
|
+
},
|
|
117
|
+
pillText: { fontWeight: '700', textAlign: 'center', flexShrink: 1 },
|
|
118
|
+
iconSlot: { flexShrink: 0, alignItems: 'center', justifyContent: 'center' },
|
|
119
|
+
disabled: { opacity: 0.5 },
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
ContentRegistry.register('button', ButtonContent)
|
|
123
|
+
|
|
124
|
+
export default ButtonContent
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import { useWalletAdapter } from '../adapter/WalletAdapter'
|
|
4
|
+
import WorkflowButtonLabel from '../components/WorkflowButtonLabel'
|
|
5
|
+
import WorkflowCalendarIcon from '../components/WorkflowCalendarIcon'
|
|
6
|
+
import { useWorkflowT } from '../i18n/WorkflowI18n'
|
|
7
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
8
|
+
import {
|
|
9
|
+
resolveFilledControlShadow,
|
|
10
|
+
resolveItemBackgroundColor,
|
|
11
|
+
resolveSurfaceBackground,
|
|
12
|
+
} from '../style/resolveDisplayHintStyle'
|
|
13
|
+
import { testIdWithKey } from '../utils/testable'
|
|
14
|
+
import { SimulatedHint } from './SimulatedHint'
|
|
15
|
+
|
|
16
|
+
const WHITE = '#FFFFFF'
|
|
17
|
+
const ACTION_PILL = '#8484DC'
|
|
18
|
+
|
|
19
|
+
const isDateOnlyString = (value: string): boolean =>
|
|
20
|
+
/^\d{4}-\d{2}-\d{2}$/.test(value) || /^\d{1,2}[-/]\d{1,2}[-/]\d{4}$/.test(value)
|
|
21
|
+
|
|
22
|
+
const parseLocalDateParts = (dateStr: string): Date | null => {
|
|
23
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2})(?::(\d{2}))?)?/.exec(dateStr)
|
|
24
|
+
if (!match) return null
|
|
25
|
+
const date = new Date(
|
|
26
|
+
Number(match[1]),
|
|
27
|
+
Number(match[2]) - 1,
|
|
28
|
+
Number(match[3]),
|
|
29
|
+
Number(match[4] ?? '0'),
|
|
30
|
+
Number(match[5] ?? '0'),
|
|
31
|
+
Number(match[6] ?? '0')
|
|
32
|
+
)
|
|
33
|
+
return Number.isNaN(date.getTime()) ? null : date
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const parseDate = (dateStr: string): Date | null => {
|
|
37
|
+
if (!dateStr) return null
|
|
38
|
+
if (dateStr.includes('-')) return parseLocalDateParts(dateStr)
|
|
39
|
+
// Compact form: YYYYMMDDHHmm
|
|
40
|
+
if (dateStr.length < 12) return null
|
|
41
|
+
const parts = [0, 4, 6, 8, 10].map((start, i) => Number(dateStr.slice(start, i === 0 ? 4 : start + 2)))
|
|
42
|
+
if (parts.some(Number.isNaN)) return null
|
|
43
|
+
return new Date(parts[0], parts[1] - 1, parts[2], parts[3], parts[4])
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Start and end of the event from `start` / `end` (or a date in `title` /
|
|
48
|
+
* `label`). A date-only start is an all-day event; a timed start without an
|
|
49
|
+
* end lasts one hour.
|
|
50
|
+
*/
|
|
51
|
+
export function resolveEventRange(item: ContentProps['item']): { start: Date; end: Date; allDay: boolean } | null {
|
|
52
|
+
const looksLikeDate = (v: unknown) => typeof v === 'string' && (isDateOnlyString(v) || v.includes('-'))
|
|
53
|
+
const startSource = String(
|
|
54
|
+
item.start || (looksLikeDate(item.title) ? item.title : '') || (looksLikeDate(item.label) ? item.label : '') || ''
|
|
55
|
+
)
|
|
56
|
+
const start = parseDate(startSource)
|
|
57
|
+
if (!start) return null
|
|
58
|
+
const allDay = isDateOnlyString(startSource)
|
|
59
|
+
if (item.end) {
|
|
60
|
+
const end = parseDate(String(item.end))
|
|
61
|
+
return end ? { start, end, allDay } : null
|
|
62
|
+
}
|
|
63
|
+
const end = new Date(start)
|
|
64
|
+
if (allDay) end.setHours(23, 59, 59, 0)
|
|
65
|
+
else end.setHours(end.getHours() + 1)
|
|
66
|
+
return { start, end, allDay }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Event summary with an "Add to Calendar" pill. Writing to the device calendar
|
|
71
|
+
* is the app's (`adapter.addCalendarEvent`); the designer simulates it.
|
|
72
|
+
*/
|
|
73
|
+
const CalendarContent: React.FC<ContentProps> = ({ item, styles, colors, groupFontScale = 1, disabled }) => {
|
|
74
|
+
const t = useWorkflowT()
|
|
75
|
+
const adapter = useWalletAdapter()
|
|
76
|
+
|
|
77
|
+
const handleAddToCalendar = async () => {
|
|
78
|
+
if (disabled) return
|
|
79
|
+
const range = resolveEventRange(item)
|
|
80
|
+
if (!range) {
|
|
81
|
+
adapter.alert(t('WorkflowUi.InvalidDate'), t('WorkflowUi.InvalidDateMessage'))
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
const title =
|
|
85
|
+
(item.title && !isDateOnlyString(String(item.title)) ? String(item.title) : undefined) ||
|
|
86
|
+
(item.text && !isDateOnlyString(String(item.text)) ? String(item.text) : undefined) ||
|
|
87
|
+
t('WorkflowUi.Event')
|
|
88
|
+
try {
|
|
89
|
+
const added = await adapter.addCalendarEvent({
|
|
90
|
+
title,
|
|
91
|
+
start: range.start,
|
|
92
|
+
end: range.end,
|
|
93
|
+
allDay: range.allDay,
|
|
94
|
+
location: item.location ? String(item.location) : undefined,
|
|
95
|
+
notes: item.notes ? String(item.notes) : undefined,
|
|
96
|
+
url: item.url ? String(item.url) : undefined,
|
|
97
|
+
})
|
|
98
|
+
if (added) adapter.alert(t('WorkflowUi.Done'), t('WorkflowUi.CalendarAdded'))
|
|
99
|
+
} catch {
|
|
100
|
+
adapter.alert(t('WorkflowUi.Error'), t('WorkflowUi.CalendarFailed'))
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const titleText = item.title && !isDateOnlyString(String(item.title)) ? String(item.title) : null
|
|
105
|
+
const label = String(item.label || t('WorkflowUi.AddToCalendar'))
|
|
106
|
+
const fill = resolveItemBackgroundColor(item) || ACTION_PILL
|
|
107
|
+
const isTransparent = resolveSurfaceBackground(fill) === 'transparent'
|
|
108
|
+
const iconKind =
|
|
109
|
+
String(item.icon || '')
|
|
110
|
+
.toLowerCase()
|
|
111
|
+
.includes('check') || /check-?in/i.test(label)
|
|
112
|
+
? 'check'
|
|
113
|
+
: 'plus'
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<View style={styles.fieldContainer}>
|
|
117
|
+
{titleText || item.location || item.notes ? (
|
|
118
|
+
<View style={{ marginBottom: 12 }}>
|
|
119
|
+
{titleText ? (
|
|
120
|
+
<Text style={[styles.formLabel, { color: colors.text, marginBottom: 4 }]}>{titleText}</Text>
|
|
121
|
+
) : null}
|
|
122
|
+
{item.location ? (
|
|
123
|
+
<Text style={[styles.description, { color: colors.text, fontSize: 13, marginBottom: 4 }]}>
|
|
124
|
+
{String(item.location)}
|
|
125
|
+
</Text>
|
|
126
|
+
) : null}
|
|
127
|
+
{item.notes ? (
|
|
128
|
+
<Text style={[styles.description, { color: colors.text, fontSize: 13, marginBottom: 0 }]}>
|
|
129
|
+
{String(item.notes)}
|
|
130
|
+
</Text>
|
|
131
|
+
) : null}
|
|
132
|
+
</View>
|
|
133
|
+
) : null}
|
|
134
|
+
<TouchableOpacity
|
|
135
|
+
testID={testIdWithKey('WorkflowAddToCalendar')}
|
|
136
|
+
accessibilityLabel={label}
|
|
137
|
+
accessibilityRole="button"
|
|
138
|
+
style={[
|
|
139
|
+
cal.pill,
|
|
140
|
+
{
|
|
141
|
+
backgroundColor: isTransparent ? 'transparent' : fill,
|
|
142
|
+
borderColor: isTransparent ? colors.border || WHITE : fill,
|
|
143
|
+
borderWidth: isTransparent ? 1.5 : 0,
|
|
144
|
+
},
|
|
145
|
+
resolveFilledControlShadow(isTransparent ? undefined : fill),
|
|
146
|
+
disabled ? { opacity: 0.5 } : null,
|
|
147
|
+
]}
|
|
148
|
+
onPress={handleAddToCalendar}
|
|
149
|
+
disabled={disabled}
|
|
150
|
+
activeOpacity={0.8}
|
|
151
|
+
>
|
|
152
|
+
<WorkflowCalendarIcon kind={iconKind} size={18} color={WHITE} />
|
|
153
|
+
<WorkflowButtonLabel style={[styles.buttonText, { color: WHITE, flex: 0 }]} groupFontScale={groupFontScale}>
|
|
154
|
+
{label}
|
|
155
|
+
</WorkflowButtonLabel>
|
|
156
|
+
</TouchableOpacity>
|
|
157
|
+
{adapter.simulated ? <SimulatedHint /> : null}
|
|
158
|
+
</View>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const cal = StyleSheet.create({
|
|
163
|
+
pill: {
|
|
164
|
+
flexDirection: 'row',
|
|
165
|
+
alignItems: 'center',
|
|
166
|
+
justifyContent: 'center',
|
|
167
|
+
width: '100%',
|
|
168
|
+
minHeight: 52,
|
|
169
|
+
paddingVertical: 14,
|
|
170
|
+
paddingHorizontal: 18,
|
|
171
|
+
borderRadius: 26,
|
|
172
|
+
gap: 8,
|
|
173
|
+
},
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
ContentRegistry.register('calendar', CalendarContent)
|
|
177
|
+
|
|
178
|
+
export default CalendarContent
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Platform, View } from 'react-native'
|
|
3
|
+
import WorkflowText from '../components/WorkflowText'
|
|
4
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
5
|
+
import { resolveFrameShadow, resolveItemBackgroundColor } from '../style/resolveDisplayHintStyle'
|
|
6
|
+
|
|
7
|
+
const MEDIA_CHILD_TYPES = new Set(['image', 'video', 'photo'])
|
|
8
|
+
const SURFACE_FALLBACK = '#25272A'
|
|
9
|
+
|
|
10
|
+
const CardContent: React.FC<ContentProps> = ({
|
|
11
|
+
item,
|
|
12
|
+
styles,
|
|
13
|
+
colors,
|
|
14
|
+
onAction,
|
|
15
|
+
formData,
|
|
16
|
+
onFieldChange,
|
|
17
|
+
buttonVariant,
|
|
18
|
+
mediaFrame,
|
|
19
|
+
fillContainer,
|
|
20
|
+
disabled,
|
|
21
|
+
}) => {
|
|
22
|
+
const children = (item.children as ContentProps['item'][] | undefined) ?? undefined
|
|
23
|
+
const padding = (item.padding as number | undefined) ?? 16
|
|
24
|
+
const bg = resolveItemBackgroundColor(item) ?? colors.background
|
|
25
|
+
const radius = typeof item.borderRadius === 'number' && Number.isFinite(item.borderRadius) ? item.borderRadius : 8
|
|
26
|
+
const borderWidth = typeof item.borderWidth === 'number' && Number.isFinite(item.borderWidth) ? item.borderWidth : 1
|
|
27
|
+
const borderColor =
|
|
28
|
+
typeof item.borderColor === 'string' && item.borderColor.trim().length > 0 ? item.borderColor : colors.border
|
|
29
|
+
const shadowOn = resolveFrameShadow(item.shadow as boolean | string | number | undefined)
|
|
30
|
+
const hasShadow = Object.keys(shadowOn).length > 0
|
|
31
|
+
const surface =
|
|
32
|
+
hasShadow && (!bg || bg === 'transparent')
|
|
33
|
+
? SURFACE_FALLBACK
|
|
34
|
+
: bg && bg !== 'transparent'
|
|
35
|
+
? bg
|
|
36
|
+
: hasShadow
|
|
37
|
+
? SURFACE_FALLBACK
|
|
38
|
+
: bg
|
|
39
|
+
const frameShadow = shadowOn
|
|
40
|
+
const fixedHeight = typeof item.height === 'number' && Number.isFinite(item.height) ? item.height : undefined
|
|
41
|
+
const fixedMinHeight =
|
|
42
|
+
typeof item.minHeight === 'number' && Number.isFinite(item.minHeight) ? item.minHeight : undefined
|
|
43
|
+
const fixedMaxHeight =
|
|
44
|
+
typeof item.maxHeight === 'number' && Number.isFinite(item.maxHeight) ? item.maxHeight : undefined
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<View
|
|
48
|
+
style={[
|
|
49
|
+
styles.fieldContainer,
|
|
50
|
+
{
|
|
51
|
+
minWidth: 0,
|
|
52
|
+
width: '100%',
|
|
53
|
+
marginBottom: 0,
|
|
54
|
+
borderRadius: radius,
|
|
55
|
+
backgroundColor: surface,
|
|
56
|
+
height: fixedHeight,
|
|
57
|
+
minHeight: fixedMinHeight,
|
|
58
|
+
maxHeight: fixedMaxHeight,
|
|
59
|
+
},
|
|
60
|
+
fillContainer ? { flex: 1, height: '100%' } : null,
|
|
61
|
+
frameShadow,
|
|
62
|
+
hasShadow && Platform.OS === 'android' ? { elevation: 18, shadowColor: '#000000' } : null,
|
|
63
|
+
]}
|
|
64
|
+
>
|
|
65
|
+
<View
|
|
66
|
+
style={[
|
|
67
|
+
{
|
|
68
|
+
padding,
|
|
69
|
+
borderRadius: radius,
|
|
70
|
+
borderWidth,
|
|
71
|
+
borderColor,
|
|
72
|
+
overflow: 'hidden',
|
|
73
|
+
gap: (item.gap as number | undefined) ?? 8,
|
|
74
|
+
minWidth: 0,
|
|
75
|
+
width: '100%',
|
|
76
|
+
backgroundColor: surface,
|
|
77
|
+
height: fillContainer || fixedHeight != null ? '100%' : undefined,
|
|
78
|
+
minHeight: fixedMinHeight,
|
|
79
|
+
maxHeight: fixedMaxHeight,
|
|
80
|
+
},
|
|
81
|
+
fillContainer
|
|
82
|
+
? {
|
|
83
|
+
flex: 1,
|
|
84
|
+
justifyContent: 'space-between',
|
|
85
|
+
}
|
|
86
|
+
: null,
|
|
87
|
+
]}
|
|
88
|
+
>
|
|
89
|
+
{item.title ? (
|
|
90
|
+
<WorkflowText
|
|
91
|
+
variant="title"
|
|
92
|
+
numberOfLines={1}
|
|
93
|
+
style={{ color: colors.text, marginBottom: 4, width: '100%' }}
|
|
94
|
+
>
|
|
95
|
+
{String(item.title)}
|
|
96
|
+
</WorkflowText>
|
|
97
|
+
) : null}
|
|
98
|
+
{item.text ? (
|
|
99
|
+
<WorkflowText variant="body" style={{ color: colors.text }}>
|
|
100
|
+
{String(item.text)}
|
|
101
|
+
</WorkflowText>
|
|
102
|
+
) : null}
|
|
103
|
+
{children?.map((child, i) => {
|
|
104
|
+
if (!ContentRegistry.has(child.type)) return null
|
|
105
|
+
const childMediaFrame = MEDIA_CHILD_TYPES.has(String(child.type)) ? mediaFrame : undefined
|
|
106
|
+
const isMedia = MEDIA_CHILD_TYPES.has(String(child.type))
|
|
107
|
+
return (
|
|
108
|
+
<View
|
|
109
|
+
key={`card-child-${i}`}
|
|
110
|
+
style={{
|
|
111
|
+
minWidth: 0,
|
|
112
|
+
width: '100%',
|
|
113
|
+
flexGrow: fillContainer && isMedia ? 0 : undefined,
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
{ContentRegistry.render(child.type, {
|
|
117
|
+
item: child,
|
|
118
|
+
onAction,
|
|
119
|
+
styles,
|
|
120
|
+
colors,
|
|
121
|
+
formData,
|
|
122
|
+
onFieldChange,
|
|
123
|
+
buttonVariant,
|
|
124
|
+
disabled,
|
|
125
|
+
mediaFrame: childMediaFrame,
|
|
126
|
+
})}
|
|
127
|
+
</View>
|
|
128
|
+
)
|
|
129
|
+
})}
|
|
130
|
+
</View>
|
|
131
|
+
</View>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
ContentRegistry.register('card', CardContent)
|
|
136
|
+
|
|
137
|
+
export default CardContent
|