@veridid/workflow-ui 0.0.0-stage → 0.1.1
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 +217 -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 +121 -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/VectorIcon.js +23 -0
- package/build/module/icons/VectorIcon.js.map +1 -0
- package/build/module/icons/VectorIcon.web.js +62 -0
- package/build/module/icons/VectorIcon.web.js.map +1 -0
- package/build/module/icons/WorkflowIcon.js +36 -0
- package/build/module/icons/WorkflowIcon.js.map +1 -0
- package/build/module/icons/types.js +4 -0
- package/build/module/icons/types.js.map +1 -0
- package/build/module/imageUriCache.js +25 -0
- package/build/module/imageUriCache.js.map +1 -0
- package/build/module/index.js +50 -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/VectorIcon.d.ts +4 -0
- package/build/typescript/icons/VectorIcon.d.ts.map +1 -0
- package/build/typescript/icons/VectorIcon.web.d.ts +16 -0
- package/build/typescript/icons/VectorIcon.web.d.ts.map +1 -0
- package/build/typescript/icons/WorkflowIcon.d.ts +19 -0
- package/build/typescript/icons/WorkflowIcon.d.ts.map +1 -0
- package/build/typescript/icons/types.d.ts +12 -0
- package/build/typescript/icons/types.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 +48 -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 +104 -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/VectorIcon.tsx +10 -0
- package/src/icons/VectorIcon.web.tsx +55 -0
- package/src/icons/WorkflowIcon.tsx +30 -0
- package/src/icons/types.ts +13 -0
- package/src/imageUriCache.ts +27 -0
- package/src/index.ts +97 -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,627 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react'
|
|
2
|
+
import { type LayoutChangeEvent, Platform, ScrollView, View } from 'react-native'
|
|
3
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
4
|
+
import { FormFieldRegistry } from '../registries/FormFieldRegistry'
|
|
5
|
+
import { deriveNode } from '../render/nodes'
|
|
6
|
+
import { useResponsive } from '../responsive'
|
|
7
|
+
import { resolveFrameShadow, resolveItemBackgroundColor, resolveSurfacePadding } from '../style/resolveDisplayHintStyle'
|
|
8
|
+
import { coerceToChipRowItem } from './ChipRowContent'
|
|
9
|
+
|
|
10
|
+
const GRID_COLUMNS = 12
|
|
11
|
+
const MIN_BUTTON_COL = 3
|
|
12
|
+
|
|
13
|
+
const mapTypeToRegistryType = (type: string): string => {
|
|
14
|
+
const typeMap: { [key: string]: string } = {
|
|
15
|
+
'text-field': 'text',
|
|
16
|
+
'text-input': 'text',
|
|
17
|
+
'check-box': 'checkbox',
|
|
18
|
+
'drop-down': 'dropdown',
|
|
19
|
+
'submit-button': 'submit-button',
|
|
20
|
+
'text-area': 'text-area',
|
|
21
|
+
'radio-button': 'radio',
|
|
22
|
+
mcq: 'mcq',
|
|
23
|
+
'multiple-choice': 'mcq',
|
|
24
|
+
'date-field': 'date',
|
|
25
|
+
'slider-field': 'slider',
|
|
26
|
+
}
|
|
27
|
+
return typeMap[type] || type
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const CHIP_TYPES = new Set(['chip', 'badge'])
|
|
31
|
+
const BUTTON_TYPES = new Set(['button', 'submit-button', 'web-link', 'location', 'share-entry', 'dial'])
|
|
32
|
+
const TITLE_TYPES = new Set(['title', 'text'])
|
|
33
|
+
const SCROLL_HEAVY_TYPES = new Set(['card', 'tile', 'section', 'image', 'video', 'photo'])
|
|
34
|
+
const MEDIA_TYPES = new Set(['image', 'video', 'photo'])
|
|
35
|
+
const TRAIL_TYPES = new Set(['chip', 'badge', 'spacer', 'text', 'title'])
|
|
36
|
+
|
|
37
|
+
const isChevronText = (child: ContentProps['item']): boolean => {
|
|
38
|
+
const t = String(child.type)
|
|
39
|
+
return (t === 'text' || t === 'title') && /^[›>]$/.test(String(child.text || '').trim())
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const isCompactTrailRow = (kids: ContentProps['item'][]): boolean => {
|
|
43
|
+
if (kids.length === 0 || kids.length > 3) return false
|
|
44
|
+
const chipCount = kids.filter((c) => CHIP_TYPES.has(String(c.type))).length
|
|
45
|
+
if (chipCount >= 3) return false
|
|
46
|
+
return kids.every((c) => {
|
|
47
|
+
const t = String(c.type)
|
|
48
|
+
return TRAIL_TYPES.has(t) || isChevronText(c)
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const isProductListRow = (kids: ContentProps['item'][]): boolean => {
|
|
53
|
+
if (kids.length < 2) return false
|
|
54
|
+
const hasImage = kids.some((c) => String(c.type) === 'image')
|
|
55
|
+
const hasTextBlock = kids.some((c) => {
|
|
56
|
+
const t = String(c.type)
|
|
57
|
+
return t === 'section' || t === 'title' || t === 'text'
|
|
58
|
+
})
|
|
59
|
+
const hasTrail = kids.some((c) => {
|
|
60
|
+
const t = String(c.type)
|
|
61
|
+
if (CHIP_TYPES.has(t) || t === 'badge') return true
|
|
62
|
+
if (isChevronText(c)) return true
|
|
63
|
+
if (t === 'row' && Array.isArray(c.children)) {
|
|
64
|
+
return isCompactTrailRow(c.children as ContentProps['item'][])
|
|
65
|
+
}
|
|
66
|
+
return false
|
|
67
|
+
})
|
|
68
|
+
return hasImage && hasTextBlock && (hasTrail || kids.length >= 2)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const resolveJustify = (value: unknown): 'flex-start' | 'center' | 'flex-end' | 'space-between' | undefined => {
|
|
72
|
+
const v = String(value || '').toLowerCase()
|
|
73
|
+
if (v === 'center') return 'center'
|
|
74
|
+
if (v === 'end' || v === 'flex-end' || v === 'right') return 'flex-end'
|
|
75
|
+
if (v === 'start' || v === 'flex-start' || v === 'left') return 'flex-start'
|
|
76
|
+
if (v === 'space-between' || v === 'between') return 'space-between'
|
|
77
|
+
return undefined
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const isColumnDirection = (value: ContentProps['item']): boolean => {
|
|
81
|
+
const raw = String(value.direction || value.layout || value.flexDirection || '').toLowerCase()
|
|
82
|
+
return raw === 'column' || raw === 'vertical' || raw === 'col'
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const parseCol = (value: unknown): number | undefined => {
|
|
86
|
+
if (value === undefined || value === null || value === '') return undefined
|
|
87
|
+
const n = Number(value)
|
|
88
|
+
if (!Number.isFinite(n) || n <= 0) return undefined
|
|
89
|
+
return Math.max(1, Math.min(Math.floor(n), GRID_COLUMNS))
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const resolveButtonSpan = (child: ContentProps['item'], equalFlex: number, hasExplicitCols: boolean): number => {
|
|
93
|
+
const explicit = parseCol(child.col)
|
|
94
|
+
if (explicit != null) {
|
|
95
|
+
return Math.max(explicit, MIN_BUTTON_COL)
|
|
96
|
+
}
|
|
97
|
+
if (hasExplicitCols) {
|
|
98
|
+
return MIN_BUTTON_COL
|
|
99
|
+
}
|
|
100
|
+
return equalFlex
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const RowContent: React.FC<ContentProps> = ({
|
|
104
|
+
item,
|
|
105
|
+
onAction,
|
|
106
|
+
onOutcome,
|
|
107
|
+
styles,
|
|
108
|
+
colors,
|
|
109
|
+
formData,
|
|
110
|
+
onFieldChange,
|
|
111
|
+
buttonVariant,
|
|
112
|
+
disabled,
|
|
113
|
+
}) => {
|
|
114
|
+
const { s, ms, isSmall, isTablet } = useResponsive()
|
|
115
|
+
const children = item.children as ContentProps['item'][] | undefined
|
|
116
|
+
const [viewportWidth, setViewportWidth] = useState(0)
|
|
117
|
+
|
|
118
|
+
const onLayout = useCallback((event: LayoutChangeEvent) => {
|
|
119
|
+
const next = Math.floor(event.nativeEvent.layout.width)
|
|
120
|
+
if (next > 0) {
|
|
121
|
+
setViewportWidth((prev) => (Math.abs(prev - next) > 1 ? next : prev))
|
|
122
|
+
}
|
|
123
|
+
}, [])
|
|
124
|
+
|
|
125
|
+
const gap = s(typeof item.gap === 'number' ? item.gap : 8)
|
|
126
|
+
const rowBg = resolveItemBackgroundColor(item)
|
|
127
|
+
const rowPad = resolveSurfacePadding(item.padding as number | string | undefined)
|
|
128
|
+
const rowRadius = typeof item.borderRadius === 'number' ? s(item.borderRadius) : undefined
|
|
129
|
+
|
|
130
|
+
const scrollChildWidth = useMemo(() => {
|
|
131
|
+
const ratio = isTablet ? 0.48 : isSmall ? 0.88 : 0.82
|
|
132
|
+
const minW = s(isSmall ? 200 : 240)
|
|
133
|
+
if (viewportWidth <= 0) return minW
|
|
134
|
+
return Math.max(minW, Math.floor(viewportWidth * ratio))
|
|
135
|
+
}, [viewportWidth, isTablet, isSmall, s])
|
|
136
|
+
|
|
137
|
+
const productTitleSize = 15
|
|
138
|
+
const productSubSize = 13
|
|
139
|
+
const productThumbPx = 60
|
|
140
|
+
const productTextGap = 2
|
|
141
|
+
|
|
142
|
+
if (!children || children.length === 0) return null
|
|
143
|
+
|
|
144
|
+
const chipRowItem = coerceToChipRowItem(item)
|
|
145
|
+
if (chipRowItem && ContentRegistry.has('chip-row')) {
|
|
146
|
+
return ContentRegistry.render('chip-row', {
|
|
147
|
+
item: { ...chipRowItem, scroll: true, wrap: false },
|
|
148
|
+
onAction,
|
|
149
|
+
onOutcome,
|
|
150
|
+
styles,
|
|
151
|
+
colors,
|
|
152
|
+
formData,
|
|
153
|
+
onFieldChange,
|
|
154
|
+
buttonVariant,
|
|
155
|
+
disabled,
|
|
156
|
+
}) as React.ReactElement
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const equalFlex = Math.max(1, Math.floor(GRID_COLUMNS / children.length))
|
|
160
|
+
const buttonChildren = children.filter((child) => BUTTON_TYPES.has(String(child.type)))
|
|
161
|
+
const isButtonRow = buttonChildren.length >= 2 && buttonChildren.length === children.length
|
|
162
|
+
const hasExplicitButtonCols = buttonChildren.some((child) => parseCol(child.col) != null)
|
|
163
|
+
const isProductRow = !isButtonRow && isProductListRow(children)
|
|
164
|
+
const isTrailCompact = !isProductRow && isCompactTrailRow(children)
|
|
165
|
+
const isColumn = isColumnDirection(item)
|
|
166
|
+
const isChipScrollRow =
|
|
167
|
+
!isProductRow && children.length >= 3 && children.every((child) => CHIP_TYPES.has(String(child.type)))
|
|
168
|
+
|
|
169
|
+
if (isChipScrollRow && ContentRegistry.has('chip-row')) {
|
|
170
|
+
return ContentRegistry.render('chip-row', {
|
|
171
|
+
item: {
|
|
172
|
+
...item,
|
|
173
|
+
type: 'chip-row',
|
|
174
|
+
scroll: true,
|
|
175
|
+
wrap: false,
|
|
176
|
+
children: children.slice(0, 5),
|
|
177
|
+
},
|
|
178
|
+
onAction,
|
|
179
|
+
onOutcome,
|
|
180
|
+
styles,
|
|
181
|
+
colors,
|
|
182
|
+
formData,
|
|
183
|
+
onFieldChange,
|
|
184
|
+
buttonVariant,
|
|
185
|
+
disabled,
|
|
186
|
+
}) as React.ReactElement
|
|
187
|
+
}
|
|
188
|
+
const rowJustify = resolveJustify(item.justify ?? item.align)
|
|
189
|
+
const columnAlign =
|
|
190
|
+
item.align === 'center' || item.align === 'middle'
|
|
191
|
+
? ('center' as const)
|
|
192
|
+
: item.align === 'end' || item.align === 'right' || item.align === 'flex-end'
|
|
193
|
+
? ('flex-end' as const)
|
|
194
|
+
: ('flex-start' as const)
|
|
195
|
+
const isTitleChipRow =
|
|
196
|
+
!isProductRow &&
|
|
197
|
+
!isTrailCompact &&
|
|
198
|
+
!isChipScrollRow &&
|
|
199
|
+
children.some((child) => TITLE_TYPES.has(String(child.type))) &&
|
|
200
|
+
children.some((child) => CHIP_TYPES.has(String(child.type))) &&
|
|
201
|
+
!children.some((child) => SCROLL_HEAVY_TYPES.has(String(child.type)))
|
|
202
|
+
const scrollableCardCount = children.filter((child) => {
|
|
203
|
+
const t = String(child.type)
|
|
204
|
+
if (t === 'tile') return true
|
|
205
|
+
if (t !== 'card') return false
|
|
206
|
+
const kids = child.children as ContentProps['item'][] | undefined
|
|
207
|
+
return Array.isArray(kids) && kids.some((k) => MEDIA_TYPES.has(String(k.type)))
|
|
208
|
+
}).length
|
|
209
|
+
const needsHorizontalScroll =
|
|
210
|
+
!isButtonRow &&
|
|
211
|
+
!isProductRow &&
|
|
212
|
+
(isChipScrollRow || item.scroll === true || scrollableCardCount >= 2) &&
|
|
213
|
+
!(isTrailCompact && !isChipScrollRow && item.scroll !== true && scrollableCardCount < 2)
|
|
214
|
+
|
|
215
|
+
const renderChild = (child: ContentProps['item'], index: number, opts?: { fixedWidth?: number; fill?: boolean }) => {
|
|
216
|
+
const registryType = mapTypeToRegistryType(child.type)
|
|
217
|
+
const isFormField = child['form-id'] !== undefined && FormFieldRegistry.has(registryType)
|
|
218
|
+
const isPricePill =
|
|
219
|
+
(String(child.type) === 'badge' || String(child.type) === 'chip' || String(child.type) === 'card') &&
|
|
220
|
+
(String(child.bgColor || child.background || '').toLowerCase() === '#0d7377' ||
|
|
221
|
+
typeof child.minWidth === 'number')
|
|
222
|
+
const isChip = CHIP_TYPES.has(String(child.type)) || isPricePill
|
|
223
|
+
const isButton = BUTTON_TYPES.has(String(child.type))
|
|
224
|
+
const isTitle = TITLE_TYPES.has(String(child.type))
|
|
225
|
+
const isImage = String(child.type) === 'image'
|
|
226
|
+
const isChevron = isChevronText(child)
|
|
227
|
+
const isSpacer = String(child.type) === 'spacer'
|
|
228
|
+
const isTrailRow = String(child.type) === 'row'
|
|
229
|
+
const isSection = String(child.type) === 'section'
|
|
230
|
+
const childPaintsOwnSurface = SCROLL_HEAVY_TYPES.has(String(child.type)) && String(child.type) !== 'badge'
|
|
231
|
+
const span =
|
|
232
|
+
isButtonRow && isButton
|
|
233
|
+
? resolveButtonSpan(child, equalFlex, hasExplicitButtonCols)
|
|
234
|
+
: (parseCol(child.col) ?? equalFlex)
|
|
235
|
+
const childPadding = resolveSurfacePadding(child.padding as number | string | undefined)
|
|
236
|
+
|
|
237
|
+
if (isProductRow && isSpacer) {
|
|
238
|
+
return null
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
let productChild: ContentProps['item'] = child
|
|
242
|
+
if (isProductRow && isImage) {
|
|
243
|
+
productChild = deriveNode(child, {
|
|
244
|
+
width: productThumbPx,
|
|
245
|
+
height: productThumbPx,
|
|
246
|
+
minHeight: productThumbPx,
|
|
247
|
+
maxHeight: productThumbPx,
|
|
248
|
+
borderRadius: typeof child.borderRadius === 'number' ? child.borderRadius : 8,
|
|
249
|
+
aspectRatio: 1,
|
|
250
|
+
fixedPx: true,
|
|
251
|
+
})
|
|
252
|
+
} else if (isProductRow && isSection) {
|
|
253
|
+
const sectionKids = Array.isArray(child.children) ? (child.children as ContentProps['item'][]) : []
|
|
254
|
+
productChild = deriveNode(child, {
|
|
255
|
+
gap: productTextGap,
|
|
256
|
+
padding: 0,
|
|
257
|
+
justify: 'center',
|
|
258
|
+
children: sectionKids.map((kid) => {
|
|
259
|
+
if (String(kid.type) !== 'text' && String(kid.type) !== 'title') return kid
|
|
260
|
+
return deriveNode(kid, {
|
|
261
|
+
padding: 0,
|
|
262
|
+
numberOfLines: 1,
|
|
263
|
+
lineHeight:
|
|
264
|
+
typeof kid.size === 'number'
|
|
265
|
+
? Math.round(ms(Number(kid.size)) * 1.15)
|
|
266
|
+
: typeof kid.fontSize === 'number'
|
|
267
|
+
? Math.round(ms(Number(kid.fontSize)) * 1.15)
|
|
268
|
+
: String(kid.text || '').includes('Textbook') || kid.fontWeight === '600'
|
|
269
|
+
? Math.round(ms(productTitleSize) * 1.15)
|
|
270
|
+
: Math.round(ms(productSubSize) * 1.15),
|
|
271
|
+
})
|
|
272
|
+
}),
|
|
273
|
+
})
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const cellStyle = opts?.fixedWidth
|
|
277
|
+
? {
|
|
278
|
+
width: opts.fixedWidth,
|
|
279
|
+
flexGrow: 0,
|
|
280
|
+
flexShrink: 0,
|
|
281
|
+
alignSelf: 'stretch' as const,
|
|
282
|
+
}
|
|
283
|
+
: isChipScrollRow && isChip
|
|
284
|
+
? {
|
|
285
|
+
flexGrow: 0,
|
|
286
|
+
flexShrink: 0,
|
|
287
|
+
flexBasis: 'auto' as const,
|
|
288
|
+
alignSelf: 'center' as const,
|
|
289
|
+
}
|
|
290
|
+
: isTrailCompact
|
|
291
|
+
? {
|
|
292
|
+
flexGrow: 0,
|
|
293
|
+
flexShrink: 0,
|
|
294
|
+
flexBasis: 'auto' as const,
|
|
295
|
+
alignSelf: isColumn ? ('auto' as const) : ('center' as const),
|
|
296
|
+
}
|
|
297
|
+
: isProductRow && isImage
|
|
298
|
+
? {
|
|
299
|
+
flexGrow: 0,
|
|
300
|
+
flexShrink: 0,
|
|
301
|
+
width: productThumbPx,
|
|
302
|
+
height: productThumbPx,
|
|
303
|
+
maxWidth: productThumbPx,
|
|
304
|
+
alignSelf: 'center' as const,
|
|
305
|
+
}
|
|
306
|
+
: isProductRow && isChip
|
|
307
|
+
? {
|
|
308
|
+
flexGrow: 0,
|
|
309
|
+
flexShrink: 0,
|
|
310
|
+
flexBasis: 'auto' as const,
|
|
311
|
+
alignSelf: 'flex-end' as const,
|
|
312
|
+
alignItems: 'flex-end' as const,
|
|
313
|
+
}
|
|
314
|
+
: isProductRow && isChevron
|
|
315
|
+
? {
|
|
316
|
+
flexGrow: 0,
|
|
317
|
+
flexShrink: 0,
|
|
318
|
+
alignSelf: 'flex-end' as const,
|
|
319
|
+
alignItems: 'flex-end' as const,
|
|
320
|
+
justifyContent: 'center' as const,
|
|
321
|
+
}
|
|
322
|
+
: isProductRow && isTrailRow
|
|
323
|
+
? {
|
|
324
|
+
flexGrow: 0,
|
|
325
|
+
flexShrink: 0,
|
|
326
|
+
flexBasis: 'auto' as const,
|
|
327
|
+
alignSelf: 'flex-end' as const,
|
|
328
|
+
marginLeft: 'auto' as const,
|
|
329
|
+
}
|
|
330
|
+
: isProductRow
|
|
331
|
+
? {
|
|
332
|
+
flexGrow: 1,
|
|
333
|
+
flexShrink: 1,
|
|
334
|
+
flexBasis: 0,
|
|
335
|
+
minWidth: 0,
|
|
336
|
+
justifyContent: 'center' as const,
|
|
337
|
+
alignSelf: 'center' as const,
|
|
338
|
+
}
|
|
339
|
+
: isChip && isTitleChipRow
|
|
340
|
+
? {
|
|
341
|
+
flexGrow: 0,
|
|
342
|
+
flexShrink: 1,
|
|
343
|
+
flexBasis: 'auto' as const,
|
|
344
|
+
maxWidth: isSmall ? ('70%' as const) : ('55%' as const),
|
|
345
|
+
minWidth: 0,
|
|
346
|
+
alignSelf: 'center' as const,
|
|
347
|
+
}
|
|
348
|
+
: isChip
|
|
349
|
+
? {
|
|
350
|
+
flexGrow: 0,
|
|
351
|
+
flexShrink: 0,
|
|
352
|
+
flexBasis: 'auto' as const,
|
|
353
|
+
alignSelf:
|
|
354
|
+
child.align === 'center'
|
|
355
|
+
? ('center' as const)
|
|
356
|
+
: child.align === 'end' || child.align === 'right'
|
|
357
|
+
? ('flex-end' as const)
|
|
358
|
+
: ('flex-start' as const),
|
|
359
|
+
}
|
|
360
|
+
: isButtonRow && isButton
|
|
361
|
+
? {
|
|
362
|
+
flexGrow: span,
|
|
363
|
+
flexShrink: 1,
|
|
364
|
+
flexBasis: 0,
|
|
365
|
+
minWidth: 0,
|
|
366
|
+
maxWidth: '100%' as const,
|
|
367
|
+
}
|
|
368
|
+
: isTitleChipRow && isTitle
|
|
369
|
+
? {
|
|
370
|
+
flexGrow: 1,
|
|
371
|
+
flexShrink: 1,
|
|
372
|
+
flexBasis: 0,
|
|
373
|
+
minWidth: 0,
|
|
374
|
+
justifyContent: 'center' as const,
|
|
375
|
+
}
|
|
376
|
+
: {
|
|
377
|
+
flexGrow: span,
|
|
378
|
+
flexShrink: 1,
|
|
379
|
+
flexBasis: 0,
|
|
380
|
+
minWidth: 0,
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
return (
|
|
384
|
+
<View
|
|
385
|
+
key={`row-child-${index}`}
|
|
386
|
+
style={{
|
|
387
|
+
...cellStyle,
|
|
388
|
+
backgroundColor: childPaintsOwnSurface || isChip || isButton ? undefined : resolveItemBackgroundColor(child),
|
|
389
|
+
...(isProductRow && isChip
|
|
390
|
+
? {
|
|
391
|
+
borderRadius: 999,
|
|
392
|
+
overflow: 'hidden' as const,
|
|
393
|
+
backgroundColor: undefined,
|
|
394
|
+
}
|
|
395
|
+
: null),
|
|
396
|
+
padding:
|
|
397
|
+
isButton || isChip || childPaintsOwnSurface || isProductRow
|
|
398
|
+
? undefined
|
|
399
|
+
: childPadding != null
|
|
400
|
+
? s(childPadding)
|
|
401
|
+
: undefined,
|
|
402
|
+
alignItems: child.align === 'center' ? 'center' : child.align === 'end' ? 'flex-end' : 'stretch',
|
|
403
|
+
justifyContent: 'flex-start',
|
|
404
|
+
minWidth:
|
|
405
|
+
isChipScrollRow && isChip
|
|
406
|
+
? undefined
|
|
407
|
+
: 'minWidth' in cellStyle && cellStyle.minWidth != null
|
|
408
|
+
? cellStyle.minWidth
|
|
409
|
+
: 0,
|
|
410
|
+
}}
|
|
411
|
+
>
|
|
412
|
+
{isFormField
|
|
413
|
+
? FormFieldRegistry.render(registryType, {
|
|
414
|
+
field: {
|
|
415
|
+
name: child['form-id'] || '',
|
|
416
|
+
label: child.label || '',
|
|
417
|
+
placeholder: child.placeholder,
|
|
418
|
+
options: child.values || child.options || [],
|
|
419
|
+
required: child.required,
|
|
420
|
+
type: registryType,
|
|
421
|
+
min: child.min ? Number(child.min) : undefined,
|
|
422
|
+
max: child.max ? Number(child.max) : undefined,
|
|
423
|
+
},
|
|
424
|
+
value: formData?.[child['form-id'] || ''],
|
|
425
|
+
onChange: (value: unknown) => {
|
|
426
|
+
if (child.type === 'submit-button' && child.actionID) {
|
|
427
|
+
onAction(child.actionID, formData)
|
|
428
|
+
} else if (child['form-id']) {
|
|
429
|
+
onFieldChange?.(child['form-id'], value)
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
styles,
|
|
433
|
+
colors,
|
|
434
|
+
})
|
|
435
|
+
: ContentRegistry.render(child.type, {
|
|
436
|
+
item: isProductRow ? productChild : child,
|
|
437
|
+
onAction,
|
|
438
|
+
styles,
|
|
439
|
+
colors,
|
|
440
|
+
formData,
|
|
441
|
+
onFieldChange,
|
|
442
|
+
FormFieldRegistry,
|
|
443
|
+
buttonVariant,
|
|
444
|
+
fillContainer: opts?.fill || (isButtonRow && isButton) || (isTitleChipRow && isTitle),
|
|
445
|
+
disabled,
|
|
446
|
+
})}
|
|
447
|
+
</View>
|
|
448
|
+
)
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
const frameShadow = resolveFrameShadow(item.shadow as boolean | string | number | undefined)
|
|
452
|
+
const productSurface = rowBg && rowBg !== 'transparent' ? rowBg : '#25272A'
|
|
453
|
+
const productRadius = rowRadius ?? s(14)
|
|
454
|
+
const productShadow = resolveFrameShadow(item.shadow as boolean | string | number | undefined)
|
|
455
|
+
const shellStyle = {
|
|
456
|
+
width: '100%' as const,
|
|
457
|
+
maxWidth: '100%' as const,
|
|
458
|
+
backgroundColor: rowBg,
|
|
459
|
+
borderRadius: rowRadius,
|
|
460
|
+
overflow:
|
|
461
|
+
rowRadius != null && !isProductRow && Object.keys(frameShadow).length === 0 ? ('hidden' as const) : undefined,
|
|
462
|
+
padding: rowPad != null ? s(rowPad) : undefined,
|
|
463
|
+
...frameShadow,
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (needsHorizontalScroll) {
|
|
467
|
+
return (
|
|
468
|
+
<View onLayout={onLayout} style={shellStyle}>
|
|
469
|
+
<ScrollView
|
|
470
|
+
horizontal
|
|
471
|
+
nestedScrollEnabled
|
|
472
|
+
showsHorizontalScrollIndicator={false}
|
|
473
|
+
showsVerticalScrollIndicator={false}
|
|
474
|
+
decelerationRate="fast"
|
|
475
|
+
style={{ width: '100%', flexGrow: 0 }}
|
|
476
|
+
contentContainerStyle={{
|
|
477
|
+
flexDirection: 'row',
|
|
478
|
+
flexWrap: 'nowrap',
|
|
479
|
+
alignItems: isChipScrollRow ? 'center' : 'stretch',
|
|
480
|
+
gap,
|
|
481
|
+
paddingVertical: s(2),
|
|
482
|
+
paddingRight: s(8),
|
|
483
|
+
}}
|
|
484
|
+
>
|
|
485
|
+
{children.map((child, index) =>
|
|
486
|
+
renderChild(child, index, isChipScrollRow ? undefined : { fixedWidth: scrollChildWidth, fill: true })
|
|
487
|
+
)}
|
|
488
|
+
</ScrollView>
|
|
489
|
+
</View>
|
|
490
|
+
)
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
if (isProductRow) {
|
|
494
|
+
const leading: { child: ContentProps['item']; index: number }[] = []
|
|
495
|
+
const trailChips: { child: ContentProps['item']; index: number }[] = []
|
|
496
|
+
const trailChevrons: { child: ContentProps['item']; index: number }[] = []
|
|
497
|
+
|
|
498
|
+
const pushTrailItem = (child: ContentProps['item'], index: number) => {
|
|
499
|
+
const t = String(child.type)
|
|
500
|
+
const bg = String(child.bgColor || child.background || child.backgroundColor || '').toLowerCase()
|
|
501
|
+
const pricePill = (t === 'chip' || t === 'badge') && (bg === '#0d7377' || CHIP_TYPES.has(t))
|
|
502
|
+
if (pricePill || CHIP_TYPES.has(t)) {
|
|
503
|
+
trailChips.push({ child, index })
|
|
504
|
+
return
|
|
505
|
+
}
|
|
506
|
+
if (isChevronText(child)) {
|
|
507
|
+
trailChevrons.push({ child, index })
|
|
508
|
+
return
|
|
509
|
+
}
|
|
510
|
+
trailChevrons.push({ child, index })
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
children.forEach((child, index) => {
|
|
514
|
+
const t = String(child.type)
|
|
515
|
+
if (t === 'spacer') return
|
|
516
|
+
if (t === 'row' && Array.isArray(child.children)) {
|
|
517
|
+
;(child.children as ContentProps['item'][]).forEach((kid, kidIndex) => {
|
|
518
|
+
pushTrailItem(kid, index * 100 + kidIndex)
|
|
519
|
+
})
|
|
520
|
+
return
|
|
521
|
+
}
|
|
522
|
+
if (CHIP_TYPES.has(t) || isChevronText(child)) {
|
|
523
|
+
pushTrailItem(child, index)
|
|
524
|
+
return
|
|
525
|
+
}
|
|
526
|
+
leading.push({ child, index })
|
|
527
|
+
})
|
|
528
|
+
|
|
529
|
+
return (
|
|
530
|
+
<View
|
|
531
|
+
onLayout={onLayout}
|
|
532
|
+
style={{
|
|
533
|
+
width: '100%',
|
|
534
|
+
maxWidth: '100%',
|
|
535
|
+
borderRadius: productRadius,
|
|
536
|
+
backgroundColor: productSurface,
|
|
537
|
+
marginBottom: 0,
|
|
538
|
+
...productShadow,
|
|
539
|
+
...(Object.keys(productShadow).length > 0 && Platform.OS === 'android'
|
|
540
|
+
? {
|
|
541
|
+
elevation: 18,
|
|
542
|
+
shadowColor: '#000000',
|
|
543
|
+
}
|
|
544
|
+
: null),
|
|
545
|
+
}}
|
|
546
|
+
>
|
|
547
|
+
<View
|
|
548
|
+
style={{
|
|
549
|
+
flexDirection: 'row',
|
|
550
|
+
flexWrap: 'nowrap',
|
|
551
|
+
alignItems: 'center',
|
|
552
|
+
justifyContent: 'flex-start',
|
|
553
|
+
gap,
|
|
554
|
+
paddingVertical: rowPad != null ? s(rowPad) : s(12),
|
|
555
|
+
paddingHorizontal: rowPad != null ? s(rowPad) : s(12),
|
|
556
|
+
borderRadius: productRadius,
|
|
557
|
+
backgroundColor: productSurface,
|
|
558
|
+
}}
|
|
559
|
+
>
|
|
560
|
+
{leading.map(({ child, index }) => renderChild(child, index))}
|
|
561
|
+
{trailChips.length > 0 || trailChevrons.length > 0 ? (
|
|
562
|
+
<View
|
|
563
|
+
style={{
|
|
564
|
+
marginLeft: 'auto',
|
|
565
|
+
flexDirection: 'column',
|
|
566
|
+
flexWrap: 'nowrap',
|
|
567
|
+
alignItems: 'flex-end',
|
|
568
|
+
justifyContent: 'center',
|
|
569
|
+
alignSelf: 'center',
|
|
570
|
+
gap: s(2),
|
|
571
|
+
flexGrow: 0,
|
|
572
|
+
flexShrink: 0,
|
|
573
|
+
}}
|
|
574
|
+
>
|
|
575
|
+
{trailChips.map(({ child, index }) => (
|
|
576
|
+
<View
|
|
577
|
+
key={`product-chip-${index}`}
|
|
578
|
+
style={{ flexGrow: 0, flexShrink: 0, alignSelf: 'flex-end', alignItems: 'flex-end' }}
|
|
579
|
+
>
|
|
580
|
+
{renderChild(deriveNode(child, { align: 'end' }), index)}
|
|
581
|
+
</View>
|
|
582
|
+
))}
|
|
583
|
+
{trailChevrons.map(({ child, index }) => (
|
|
584
|
+
<View
|
|
585
|
+
key={`product-chevron-${index}`}
|
|
586
|
+
style={{
|
|
587
|
+
flexGrow: 0,
|
|
588
|
+
flexShrink: 0,
|
|
589
|
+
alignSelf: 'flex-end',
|
|
590
|
+
alignItems: 'flex-end',
|
|
591
|
+
minWidth: s(14),
|
|
592
|
+
}}
|
|
593
|
+
>
|
|
594
|
+
{renderChild(deriveNode(child, { align: 'end', textAlign: 'right' }), index)}
|
|
595
|
+
</View>
|
|
596
|
+
))}
|
|
597
|
+
</View>
|
|
598
|
+
) : null}
|
|
599
|
+
</View>
|
|
600
|
+
</View>
|
|
601
|
+
)
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
return (
|
|
605
|
+
<View
|
|
606
|
+
onLayout={onLayout}
|
|
607
|
+
style={{
|
|
608
|
+
...shellStyle,
|
|
609
|
+
flexDirection: isColumn ? 'column' : 'row',
|
|
610
|
+
flexWrap: 'nowrap',
|
|
611
|
+
alignItems: isColumn ? columnAlign : isTitleChipRow || isTrailCompact ? 'center' : 'stretch',
|
|
612
|
+
justifyContent: isColumn
|
|
613
|
+
? rowJustify || 'flex-start'
|
|
614
|
+
: isTrailCompact
|
|
615
|
+
? rowJustify || 'flex-end'
|
|
616
|
+
: rowJustify || 'flex-start',
|
|
617
|
+
gap,
|
|
618
|
+
}}
|
|
619
|
+
>
|
|
620
|
+
{children.map((child, index) => renderChild(child, index))}
|
|
621
|
+
</View>
|
|
622
|
+
)
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
ContentRegistry.register('row', RowContent)
|
|
626
|
+
|
|
627
|
+
export default RowContent
|