@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,197 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
type LayoutChangeEvent,
|
|
4
|
+
type NativeScrollEvent,
|
|
5
|
+
type NativeSyntheticEvent,
|
|
6
|
+
ScrollView,
|
|
7
|
+
View,
|
|
8
|
+
} from 'react-native'
|
|
9
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
10
|
+
|
|
11
|
+
const MEDIA_SLIDE_TYPES = new Set(['image', 'video', 'photo'])
|
|
12
|
+
const AUTO_ADVANCE_MS = 3000
|
|
13
|
+
const NEXT_PEEK = 40
|
|
14
|
+
const DEFAULT_GAP = 12
|
|
15
|
+
const EMPTY_SLIDES: ContentProps['item'][] = []
|
|
16
|
+
|
|
17
|
+
const CarouselContent: React.FC<ContentProps> = ({
|
|
18
|
+
item,
|
|
19
|
+
colors,
|
|
20
|
+
onAction,
|
|
21
|
+
styles,
|
|
22
|
+
formData,
|
|
23
|
+
onFieldChange,
|
|
24
|
+
buttonVariant,
|
|
25
|
+
disabled,
|
|
26
|
+
}) => {
|
|
27
|
+
const rawChildren = item.children as ContentProps['item'][] | undefined
|
|
28
|
+
const slides = useMemo(() => {
|
|
29
|
+
const list = rawChildren ?? EMPTY_SLIDES
|
|
30
|
+
return list.filter((child) => ContentRegistry.has(child.type))
|
|
31
|
+
}, [rawChildren])
|
|
32
|
+
const gap = (item.gap as number | undefined) ?? DEFAULT_GAP
|
|
33
|
+
const snap = item.snap !== false && item.snap !== 'false'
|
|
34
|
+
// 'carousel' auto-advances by default, 'h-scroll' is plain
|
|
35
|
+
// user-driven scrolling with no timer — the same distinction the two
|
|
36
|
+
// registered type names already imply, previously lost when both
|
|
37
|
+
// pointed at identical behavior. Either can override via an explicit
|
|
38
|
+
// `autoAdvance` hint on the item itself.
|
|
39
|
+
const autoAdvance = typeof item.autoAdvance === 'boolean' ? item.autoAdvance : item.type !== 'h-scroll'
|
|
40
|
+
const scrollRef = useRef<ScrollView>(null)
|
|
41
|
+
const indexRef = useRef(0)
|
|
42
|
+
const [viewportWidth, setViewportWidth] = useState(0)
|
|
43
|
+
const ready = viewportWidth > 0
|
|
44
|
+
const slideWidth = ready ? Math.max(viewportWidth - NEXT_PEEK, 1) : 0
|
|
45
|
+
const stride = slideWidth + gap
|
|
46
|
+
const mediaSlideHeight = Math.round(Math.max(slideWidth, 1) * (9 / 16))
|
|
47
|
+
const nestedImageHeight = Math.round(Math.max(slideWidth, 1) * 0.42)
|
|
48
|
+
|
|
49
|
+
const snapOffsets = useMemo(() => slides.map((_, index) => index * stride), [slides, stride])
|
|
50
|
+
|
|
51
|
+
const handleViewportLayout = useCallback((event: LayoutChangeEvent) => {
|
|
52
|
+
const next = Math.floor(event.nativeEvent.layout.width)
|
|
53
|
+
if (next <= 0) return
|
|
54
|
+
setViewportWidth((prev) => (Math.abs(prev - next) > 1 ? next : prev))
|
|
55
|
+
}, [])
|
|
56
|
+
|
|
57
|
+
const didSettleRef = useRef(false)
|
|
58
|
+
|
|
59
|
+
const settleToFirstSlide = useCallback(() => {
|
|
60
|
+
indexRef.current = 0
|
|
61
|
+
scrollRef.current?.scrollTo({ x: 0, animated: false })
|
|
62
|
+
}, [])
|
|
63
|
+
|
|
64
|
+
const settleOnce = useCallback(() => {
|
|
65
|
+
if (didSettleRef.current) return
|
|
66
|
+
didSettleRef.current = true
|
|
67
|
+
settleToFirstSlide()
|
|
68
|
+
}, [settleToFirstSlide])
|
|
69
|
+
|
|
70
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: slides.length and stride are intentional triggers to re-settle on the first slide when the content changes
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
didSettleRef.current = false
|
|
73
|
+
if (!ready) return
|
|
74
|
+
const frame = requestAnimationFrame(settleOnce)
|
|
75
|
+
const timeout = setTimeout(settleOnce, 80)
|
|
76
|
+
return () => {
|
|
77
|
+
cancelAnimationFrame(frame)
|
|
78
|
+
clearTimeout(timeout)
|
|
79
|
+
}
|
|
80
|
+
}, [ready, slides.length, stride, settleOnce])
|
|
81
|
+
|
|
82
|
+
const intervalRef = useRef<ReturnType<typeof setInterval> | undefined>(undefined)
|
|
83
|
+
|
|
84
|
+
const scrollToIndex = useCallback(
|
|
85
|
+
(next: number, animated = true) => {
|
|
86
|
+
if (!ready || slides.length === 0 || stride <= 0) return
|
|
87
|
+
const clamped = ((next % slides.length) + slides.length) % slides.length
|
|
88
|
+
indexRef.current = clamped
|
|
89
|
+
scrollRef.current?.scrollTo({ x: clamped * stride, animated })
|
|
90
|
+
},
|
|
91
|
+
[ready, slides.length, stride]
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
const startAutoAdvance = useCallback(() => {
|
|
95
|
+
if (!autoAdvance || !ready || slides.length <= 1) return
|
|
96
|
+
if (intervalRef.current) clearInterval(intervalRef.current)
|
|
97
|
+
intervalRef.current = setInterval(() => {
|
|
98
|
+
scrollToIndex(indexRef.current + 1, true)
|
|
99
|
+
}, AUTO_ADVANCE_MS)
|
|
100
|
+
}, [autoAdvance, ready, slides.length, scrollToIndex])
|
|
101
|
+
|
|
102
|
+
const stopAutoAdvance = useCallback(() => {
|
|
103
|
+
if (intervalRef.current) {
|
|
104
|
+
clearInterval(intervalRef.current)
|
|
105
|
+
intervalRef.current = undefined
|
|
106
|
+
}
|
|
107
|
+
}, [])
|
|
108
|
+
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (!autoAdvance || !ready || slides.length <= 1) return
|
|
111
|
+
startAutoAdvance()
|
|
112
|
+
return stopAutoAdvance
|
|
113
|
+
}, [autoAdvance, ready, slides.length, startAutoAdvance, stopAutoAdvance])
|
|
114
|
+
|
|
115
|
+
const handleScrollBeginDrag = useCallback(() => {
|
|
116
|
+
stopAutoAdvance()
|
|
117
|
+
}, [stopAutoAdvance])
|
|
118
|
+
|
|
119
|
+
const handleMomentumScrollEnd = useCallback(
|
|
120
|
+
(event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
121
|
+
if (!ready || stride <= 0 || slides.length === 0) return
|
|
122
|
+
const next = Math.round(event.nativeEvent.contentOffset.x / stride)
|
|
123
|
+
indexRef.current = Math.max(0, Math.min(next, slides.length - 1))
|
|
124
|
+
startAutoAdvance()
|
|
125
|
+
},
|
|
126
|
+
[ready, slides.length, stride, startAutoAdvance]
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<View onLayout={handleViewportLayout} style={{ width: '100%', minHeight: ready ? mediaSlideHeight : 160 }}>
|
|
131
|
+
{ready ? (
|
|
132
|
+
<ScrollView
|
|
133
|
+
ref={scrollRef}
|
|
134
|
+
horizontal
|
|
135
|
+
showsHorizontalScrollIndicator={false}
|
|
136
|
+
pagingEnabled={false}
|
|
137
|
+
snapToOffsets={snap ? snapOffsets : undefined}
|
|
138
|
+
snapToAlignment="start"
|
|
139
|
+
disableIntervalMomentum={snap}
|
|
140
|
+
decelerationRate={snap ? 'fast' : 'normal'}
|
|
141
|
+
onScrollBeginDrag={handleScrollBeginDrag}
|
|
142
|
+
onMomentumScrollEnd={handleMomentumScrollEnd}
|
|
143
|
+
onContentSizeChange={settleOnce}
|
|
144
|
+
contentContainerStyle={{
|
|
145
|
+
flexDirection: 'row',
|
|
146
|
+
alignItems: 'stretch',
|
|
147
|
+
paddingVertical: 6,
|
|
148
|
+
paddingLeft: 0,
|
|
149
|
+
paddingRight: 0,
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
{slides.map((child, i) => {
|
|
153
|
+
const isMediaSlide = MEDIA_SLIDE_TYPES.has(String(child.type))
|
|
154
|
+
const isLast = i === slides.length - 1
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<View
|
|
158
|
+
key={`carousel-${i}-${String(child.type)}`}
|
|
159
|
+
style={{
|
|
160
|
+
width: slideWidth,
|
|
161
|
+
marginRight: isLast ? 0 : gap,
|
|
162
|
+
height: isMediaSlide ? mediaSlideHeight : undefined,
|
|
163
|
+
minHeight: isMediaSlide ? mediaSlideHeight : nestedImageHeight,
|
|
164
|
+
borderRadius: 8,
|
|
165
|
+
overflow: 'hidden',
|
|
166
|
+
backgroundColor: 'transparent',
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
169
|
+
{ContentRegistry.render(child.type, {
|
|
170
|
+
item: child,
|
|
171
|
+
onAction,
|
|
172
|
+
styles,
|
|
173
|
+
colors,
|
|
174
|
+
formData,
|
|
175
|
+
onFieldChange,
|
|
176
|
+
buttonVariant,
|
|
177
|
+
disabled,
|
|
178
|
+
fillContainer: isMediaSlide,
|
|
179
|
+
mediaFrame: {
|
|
180
|
+
width: slideWidth,
|
|
181
|
+
height: isMediaSlide ? mediaSlideHeight : nestedImageHeight,
|
|
182
|
+
mode: 'cover',
|
|
183
|
+
},
|
|
184
|
+
})}
|
|
185
|
+
</View>
|
|
186
|
+
)
|
|
187
|
+
})}
|
|
188
|
+
</ScrollView>
|
|
189
|
+
) : null}
|
|
190
|
+
</View>
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
ContentRegistry.register('carousel', CarouselContent)
|
|
195
|
+
ContentRegistry.register('h-scroll', CarouselContent)
|
|
196
|
+
|
|
197
|
+
export default CarouselContent
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Text, TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import WorkflowText from '../components/WorkflowText'
|
|
4
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
5
|
+
import { useResponsive } from '../responsive'
|
|
6
|
+
import { resolveItemBackgroundColor } from '../style/resolveDisplayHintStyle'
|
|
7
|
+
|
|
8
|
+
const TEAL = '#0D7377'
|
|
9
|
+
const PILL_H = 24
|
|
10
|
+
const PILL_PAD_H = 12
|
|
11
|
+
const PILL_RADIUS = PILL_H / 2
|
|
12
|
+
|
|
13
|
+
const priceAmount = (raw: string): string | null => {
|
|
14
|
+
const t = String(raw || '')
|
|
15
|
+
.replace(/\u00A0/g, ' ')
|
|
16
|
+
.trim()
|
|
17
|
+
const m = t.match(/^\$\s*(.+)$/)
|
|
18
|
+
return m ? m[1].trim() : null
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const resolveChipAlign = (align: unknown): 'flex-start' | 'center' | 'flex-end' => {
|
|
22
|
+
const a = String(align || '').toLowerCase()
|
|
23
|
+
if (a === 'center' || a === 'middle') return 'center'
|
|
24
|
+
if (a === 'end' || a === 'right' || a === 'flex-end') return 'flex-end'
|
|
25
|
+
return 'flex-start'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const PricePill: React.FC<{ amount: string; alignSelf: 'flex-start' | 'center' | 'flex-end' }> = ({
|
|
29
|
+
amount,
|
|
30
|
+
alignSelf,
|
|
31
|
+
}) => (
|
|
32
|
+
<View
|
|
33
|
+
style={{
|
|
34
|
+
height: PILL_H,
|
|
35
|
+
minHeight: PILL_H,
|
|
36
|
+
maxHeight: PILL_H,
|
|
37
|
+
paddingHorizontal: PILL_PAD_H,
|
|
38
|
+
borderRadius: PILL_RADIUS,
|
|
39
|
+
backgroundColor: TEAL,
|
|
40
|
+
overflow: 'hidden',
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
flexWrap: 'nowrap',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
alignSelf,
|
|
46
|
+
flexGrow: 0,
|
|
47
|
+
flexShrink: 0,
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
<Text
|
|
51
|
+
numberOfLines={1}
|
|
52
|
+
allowFontScaling={false}
|
|
53
|
+
style={{
|
|
54
|
+
color: '#FFFFFF',
|
|
55
|
+
fontSize: 10,
|
|
56
|
+
fontWeight: '600',
|
|
57
|
+
includeFontPadding: false,
|
|
58
|
+
textAlignVertical: 'center',
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
{'$'}
|
|
62
|
+
</Text>
|
|
63
|
+
<Text
|
|
64
|
+
numberOfLines={1}
|
|
65
|
+
allowFontScaling={false}
|
|
66
|
+
style={{
|
|
67
|
+
color: '#FFFFFF',
|
|
68
|
+
fontSize: 13,
|
|
69
|
+
fontWeight: '600',
|
|
70
|
+
includeFontPadding: false,
|
|
71
|
+
textAlignVertical: 'center',
|
|
72
|
+
marginLeft: 3,
|
|
73
|
+
}}
|
|
74
|
+
>
|
|
75
|
+
{amount}
|
|
76
|
+
</Text>
|
|
77
|
+
</View>
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
const ChipContent: React.FC<ContentProps> = ({ item, colors, onAction, disabled, context, optimisticContext }) => {
|
|
81
|
+
const { s, isSmall } = useResponsive()
|
|
82
|
+
const label = (item.label as string | undefined) ?? (item.text as string | undefined) ?? 'Chip'
|
|
83
|
+
const icon = item.icon != null ? String(item.icon) : ''
|
|
84
|
+
const event = item.event as string | undefined
|
|
85
|
+
const input = item.input as Record<string, unknown> | undefined
|
|
86
|
+
const tone = (item.tone as string | undefined) ?? 'default'
|
|
87
|
+
const customBg = resolveItemBackgroundColor(item)
|
|
88
|
+
const customText = typeof item.color === 'string' && item.color.trim() ? item.color.trim() : undefined
|
|
89
|
+
|
|
90
|
+
const liveContext = { ...(context ?? {}), ...(optimisticContext ?? {}) }
|
|
91
|
+
const isProgramFilterChip = event === 'filter_by_degree' || event === 'filter_by_delivery'
|
|
92
|
+
const selected = (() => {
|
|
93
|
+
if (!isProgramFilterChip) {
|
|
94
|
+
return item.selected === true || item.selected === 'true'
|
|
95
|
+
}
|
|
96
|
+
if (event === 'filter_by_degree') {
|
|
97
|
+
return String(input?.degree_filter ?? '') === String(liveContext.degree_filter ?? '')
|
|
98
|
+
}
|
|
99
|
+
return String(input?.delivery_filter ?? '') === String(liveContext.delivery_filter ?? '')
|
|
100
|
+
})()
|
|
101
|
+
const filled = Boolean(customBg) || selected
|
|
102
|
+
const alignSelf = resolveChipAlign(item.align)
|
|
103
|
+
|
|
104
|
+
const baseBg = selected ? colors.primary : 'transparent'
|
|
105
|
+
const baseBorder = selected ? colors.primary : colors.border
|
|
106
|
+
const baseText = selected ? '#ffffff' : colors.text
|
|
107
|
+
const toneOverrides: Record<string, { bg: string; border: string; text: string }> = {
|
|
108
|
+
success: { bg: '#1f8a3b22', border: '#1f8a3b', text: '#1f8a3b' },
|
|
109
|
+
danger: { bg: '#b3261e22', border: '#b3261e', text: '#b3261e' },
|
|
110
|
+
}
|
|
111
|
+
const palette = customBg
|
|
112
|
+
? { bg: customBg, border: customBg, text: customText || '#FFFFFF' }
|
|
113
|
+
: !selected && toneOverrides[tone]
|
|
114
|
+
? toneOverrides[tone]
|
|
115
|
+
: { bg: baseBg, border: baseBorder, text: customText || baseText }
|
|
116
|
+
|
|
117
|
+
const rawLabel = icon ? `${label} ${icon}` : label
|
|
118
|
+
const amount = priceAmount(rawLabel)
|
|
119
|
+
|
|
120
|
+
/** Degree/delivery chips only set one field — carry the other from live context so stacked filters survive. */
|
|
121
|
+
const pressInput = (): Record<string, unknown> => {
|
|
122
|
+
const payload: Record<string, unknown> = { ...(input ?? {}) }
|
|
123
|
+
if (!isProgramFilterChip) return payload
|
|
124
|
+
if (!('degree_filter' in payload) && 'degree_filter' in liveContext) {
|
|
125
|
+
payload.degree_filter = liveContext.degree_filter
|
|
126
|
+
}
|
|
127
|
+
if (!('delivery_filter' in payload) && 'delivery_filter' in liveContext) {
|
|
128
|
+
payload.delivery_filter = liveContext.delivery_filter
|
|
129
|
+
}
|
|
130
|
+
return payload
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (amount) {
|
|
134
|
+
const pill = <PricePill amount={amount} alignSelf={alignSelf} />
|
|
135
|
+
if (!event) return pill
|
|
136
|
+
return (
|
|
137
|
+
<TouchableOpacity
|
|
138
|
+
activeOpacity={0.7}
|
|
139
|
+
disabled={item.disabled === true || disabled}
|
|
140
|
+
onPress={() => onAction(event, pressInput())}
|
|
141
|
+
style={{
|
|
142
|
+
flexGrow: 0,
|
|
143
|
+
flexShrink: 0,
|
|
144
|
+
alignSelf,
|
|
145
|
+
borderRadius: PILL_RADIUS,
|
|
146
|
+
overflow: 'hidden',
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
{pill}
|
|
150
|
+
</TouchableOpacity>
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const padH = s(isSmall ? 10 : 12)
|
|
155
|
+
const padV = s(isSmall ? 3 : 4)
|
|
156
|
+
|
|
157
|
+
const Content = (
|
|
158
|
+
<View
|
|
159
|
+
style={{
|
|
160
|
+
flexDirection: 'row',
|
|
161
|
+
flexWrap: 'nowrap',
|
|
162
|
+
alignItems: 'center',
|
|
163
|
+
justifyContent: 'center',
|
|
164
|
+
flexGrow: 0,
|
|
165
|
+
flexShrink: 0,
|
|
166
|
+
paddingHorizontal: padH,
|
|
167
|
+
paddingVertical: padV,
|
|
168
|
+
borderRadius: 999,
|
|
169
|
+
borderWidth: filled ? 0 : 1,
|
|
170
|
+
borderColor: palette.border,
|
|
171
|
+
backgroundColor: palette.bg,
|
|
172
|
+
alignSelf,
|
|
173
|
+
overflow: 'hidden',
|
|
174
|
+
}}
|
|
175
|
+
>
|
|
176
|
+
<WorkflowText
|
|
177
|
+
variant="badge"
|
|
178
|
+
size={isSmall ? 11 : 12}
|
|
179
|
+
numberOfLines={1}
|
|
180
|
+
style={{
|
|
181
|
+
color: palette.text,
|
|
182
|
+
fontWeight: '700',
|
|
183
|
+
flexShrink: 0,
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
{rawLabel}
|
|
187
|
+
</WorkflowText>
|
|
188
|
+
</View>
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
if (!event) {
|
|
192
|
+
return Content
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<TouchableOpacity
|
|
197
|
+
activeOpacity={0.7}
|
|
198
|
+
disabled={item.disabled === true || disabled}
|
|
199
|
+
onPress={() => onAction(event, pressInput())}
|
|
200
|
+
style={{ flexGrow: 0, flexShrink: 0, alignSelf }}
|
|
201
|
+
>
|
|
202
|
+
{Content}
|
|
203
|
+
</TouchableOpacity>
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
ContentRegistry.register('chip', ChipContent)
|
|
208
|
+
|
|
209
|
+
export default ChipContent
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ScrollView, View } from 'react-native'
|
|
3
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
4
|
+
import { useResponsive } from '../responsive'
|
|
5
|
+
import './BadgeContent'
|
|
6
|
+
import './ChipContent'
|
|
7
|
+
|
|
8
|
+
const CHIP_ROW_MAX = 5
|
|
9
|
+
|
|
10
|
+
const isChipChild = (child: ContentProps['item'] | undefined): boolean => {
|
|
11
|
+
const t = String(child?.type || '').toLowerCase()
|
|
12
|
+
return t === 'chip' || t === 'badge'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const collectChipKids = (item: ContentProps['item']): ContentProps['item'][] => {
|
|
16
|
+
const raw =
|
|
17
|
+
(item.children as ContentProps['item'][] | undefined) ??
|
|
18
|
+
(item.items as ContentProps['item'][] | undefined) ??
|
|
19
|
+
(item.content as ContentProps['item'][] | undefined) ??
|
|
20
|
+
[]
|
|
21
|
+
return raw.filter(isChipChild).slice(0, CHIP_ROW_MAX)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const coerceToChipRowItem = (item: ContentProps['item']): ContentProps['item'] | null => {
|
|
25
|
+
const t = String(item?.type || '').toLowerCase()
|
|
26
|
+
if (t === 'chip-row' || t === 'pill-row' || t === 'chip_row' || t === 'chips') {
|
|
27
|
+
return {
|
|
28
|
+
...item,
|
|
29
|
+
type: 'chip-row',
|
|
30
|
+
scroll: true,
|
|
31
|
+
wrap: false,
|
|
32
|
+
children: collectChipKids(item),
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const kids = collectChipKids(item)
|
|
36
|
+
const allKids =
|
|
37
|
+
(item.children as ContentProps['item'][] | undefined) ?? (item.items as ContentProps['item'][] | undefined) ?? []
|
|
38
|
+
const chipOnly =
|
|
39
|
+
kids.length >= 3 && allKids.length > 0 && allKids.every((c) => isChipChild(c) || String(c?.type || '') === 'spacer')
|
|
40
|
+
if (
|
|
41
|
+
chipOnly &&
|
|
42
|
+
(t === 'row' || t === 'grid' || t === 'grid-layout' || t === 'grid_layout' || t === 'section' || t === 'list')
|
|
43
|
+
) {
|
|
44
|
+
return {
|
|
45
|
+
...item,
|
|
46
|
+
type: 'chip-row',
|
|
47
|
+
scroll: true,
|
|
48
|
+
wrap: false,
|
|
49
|
+
children: kids,
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return null
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const ChipRowContent: React.FC<ContentProps> = (props) => {
|
|
56
|
+
const {
|
|
57
|
+
item,
|
|
58
|
+
onAction,
|
|
59
|
+
onOutcome,
|
|
60
|
+
styles,
|
|
61
|
+
colors,
|
|
62
|
+
formData,
|
|
63
|
+
onFieldChange,
|
|
64
|
+
buttonVariant,
|
|
65
|
+
disabled,
|
|
66
|
+
context,
|
|
67
|
+
optimisticContext,
|
|
68
|
+
} = props
|
|
69
|
+
const { s } = useResponsive()
|
|
70
|
+
const children = collectChipKids(item)
|
|
71
|
+
const gap = s(typeof item.gap === 'number' ? item.gap : 8)
|
|
72
|
+
|
|
73
|
+
if (children.length === 0) return null
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<View style={{ width: '100%', maxWidth: '100%', alignSelf: 'stretch' }}>
|
|
77
|
+
<ScrollView
|
|
78
|
+
horizontal
|
|
79
|
+
nestedScrollEnabled
|
|
80
|
+
scrollEnabled
|
|
81
|
+
bounces
|
|
82
|
+
alwaysBounceHorizontal
|
|
83
|
+
overScrollMode="always"
|
|
84
|
+
showsHorizontalScrollIndicator={false}
|
|
85
|
+
showsVerticalScrollIndicator={false}
|
|
86
|
+
decelerationRate="fast"
|
|
87
|
+
keyboardShouldPersistTaps="handled"
|
|
88
|
+
directionalLockEnabled
|
|
89
|
+
style={{ width: '100%', flexGrow: 0 }}
|
|
90
|
+
contentContainerStyle={{
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
flexWrap: 'nowrap',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
gap,
|
|
95
|
+
paddingVertical: s(2),
|
|
96
|
+
paddingRight: s(16),
|
|
97
|
+
flexGrow: 0,
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
{children.map((child, index) => {
|
|
101
|
+
const t = String(child.type || '').toLowerCase()
|
|
102
|
+
const registryType = t === 'badge' && ContentRegistry.has('badge') ? 'badge' : 'chip'
|
|
103
|
+
const label =
|
|
104
|
+
(typeof child.label === 'string' && child.label) || (typeof child.text === 'string' && child.text) || 'Chip'
|
|
105
|
+
return (
|
|
106
|
+
<View key={`chip-h-${index}-${label}`} style={{ flexGrow: 0, flexShrink: 0 }}>
|
|
107
|
+
{ContentRegistry.render(registryType, {
|
|
108
|
+
item: child,
|
|
109
|
+
onAction,
|
|
110
|
+
onOutcome,
|
|
111
|
+
styles,
|
|
112
|
+
colors,
|
|
113
|
+
formData,
|
|
114
|
+
onFieldChange,
|
|
115
|
+
buttonVariant,
|
|
116
|
+
disabled,
|
|
117
|
+
context,
|
|
118
|
+
optimisticContext,
|
|
119
|
+
})}
|
|
120
|
+
</View>
|
|
121
|
+
)
|
|
122
|
+
})}
|
|
123
|
+
</ScrollView>
|
|
124
|
+
</View>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
ContentRegistry.register('chip-row', ChipRowContent)
|
|
129
|
+
ContentRegistry.register('pill-row', ChipRowContent)
|
|
130
|
+
ContentRegistry.register('chip_row', ChipRowContent)
|
|
131
|
+
ContentRegistry.register('chips', ChipRowContent)
|
|
132
|
+
|
|
133
|
+
export default ChipRowContent
|