@sovereignsquad/gds-core 6.11.0 → 6.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AISearchCard.js +97 -0
- package/dist/AISearchCard.mjs +73 -0
- package/dist/AccentPanel.js +94 -0
- package/dist/AccentPanel.mjs +69 -0
- package/dist/AccessRecoveryPanel.js +164 -0
- package/dist/AccessRecoveryPanel.mjs +140 -0
- package/dist/AccessSummary.js +57 -0
- package/dist/AccessSummary.mjs +33 -0
- package/dist/AccessibilityEvidence.js +131 -0
- package/dist/AccessibilityEvidence.mjs +104 -0
- package/dist/ActionBar.js +84 -0
- package/dist/ActionBar.mjs +60 -0
- package/dist/AdvancedDataTable.client.js +204 -0
- package/dist/AdvancedDataTable.client.mjs +180 -0
- package/dist/ArticleShell.js +43 -0
- package/dist/ArticleShell.mjs +19 -0
- package/dist/AsyncSurface.js +156 -0
- package/dist/AsyncSurface.mjs +132 -0
- package/dist/AuthShell.js +72 -0
- package/dist/AuthShell.mjs +48 -0
- package/dist/BottomTabBar.js +152 -0
- package/dist/BottomTabBar.mjs +128 -0
- package/dist/BottomTabBar.shared.js +31 -0
- package/dist/BottomTabBar.shared.mjs +6 -0
- package/dist/BoundedPreviewSurface.js +54 -0
- package/dist/BoundedPreviewSurface.mjs +30 -0
- package/dist/BrowseSelection.client.js +50 -0
- package/dist/BrowseSelection.client.mjs +26 -0
- package/dist/BrowseSurface.js +151 -0
- package/dist/BrowseSurface.mjs +127 -0
- package/dist/CardContracts.js +97 -0
- package/dist/CardContracts.mjs +68 -0
- package/dist/ChartTokenPanel.js +102 -0
- package/dist/ChartTokenPanel.mjs +78 -0
- package/dist/ChatSurface.js +217 -0
- package/dist/ChatSurface.mjs +190 -0
- package/dist/ChoiceChip.js +257 -0
- package/dist/ChoiceChip.mjs +230 -0
- package/dist/CommandPalette.client.js +129 -0
- package/dist/CommandPalette.client.mjs +103 -0
- package/dist/ConfirmDialog.js +65 -0
- package/dist/ConfirmDialog.mjs +41 -0
- package/dist/ConsumerDashboardGrid.js +35 -0
- package/dist/ConsumerDashboardGrid.mjs +11 -0
- package/dist/ConsumerSection.js +38 -0
- package/dist/ConsumerSection.mjs +14 -0
- package/dist/CreatorTheme.js +146 -0
- package/dist/CreatorTheme.mjs +120 -0
- package/dist/CtaButtonGroup.js +38 -0
- package/dist/CtaButtonGroup.mjs +14 -0
- package/dist/DataToolbar.js +63 -0
- package/dist/DataToolbar.mjs +39 -0
- package/dist/DetailFactsTable.js +134 -0
- package/dist/DetailFactsTable.mjs +110 -0
- package/dist/DetailFactsTable.shared.js +41 -0
- package/dist/DetailFactsTable.shared.mjs +16 -0
- package/dist/DetailProfileShell.js +52 -0
- package/dist/DetailProfileShell.mjs +28 -0
- package/dist/DiscoveryShell.js +189 -0
- package/dist/DiscoveryShell.mjs +164 -0
- package/dist/DocsCodeBlock.js +67 -0
- package/dist/DocsCodeBlock.mjs +43 -0
- package/dist/DocsCodeDisclosure.js +74 -0
- package/dist/DocsCodeDisclosure.mjs +50 -0
- package/dist/DocsPageShell.js +55 -0
- package/dist/DocsPageShell.mjs +31 -0
- package/dist/DocsShell.js +205 -0
- package/dist/DocsShell.mjs +180 -0
- package/dist/EditorialCard.js +140 -0
- package/dist/EditorialCard.mjs +116 -0
- package/dist/EditorialHero.js +247 -0
- package/dist/EditorialHero.mjs +223 -0
- package/dist/EmptyState.js +37 -0
- package/dist/EmptyState.mjs +13 -0
- package/dist/EvidencePanel.js +85 -0
- package/dist/EvidencePanel.mjs +61 -0
- package/dist/FeatureBand.js +90 -0
- package/dist/FeatureBand.mjs +66 -0
- package/dist/FeedbackRuntime.client.js +264 -0
- package/dist/FeedbackRuntime.client.mjs +237 -0
- package/dist/FilterDrawer.js +67 -0
- package/dist/FilterDrawer.mjs +43 -0
- package/dist/FitScoreChip.js +72 -0
- package/dist/FitScoreChip.mjs +48 -0
- package/dist/FoodMenuSection.js +79 -0
- package/dist/FoodMenuSection.mjs +55 -0
- package/dist/FormField.js +37 -0
- package/dist/FormField.mjs +13 -0
- package/dist/GameBoardTile.js +63 -0
- package/dist/GameBoardTile.mjs +39 -0
- package/dist/GdsAccentContrastMatrix.js +102 -0
- package/dist/GdsAccentContrastMatrix.mjs +85 -0
- package/dist/GdsAccessGate.js +226 -0
- package/dist/GdsAccessGate.mjs +204 -0
- package/dist/GdsAccessGateRuntime.js +236 -0
- package/dist/GdsAccessGateRuntime.mjs +203 -0
- package/dist/GdsAccessibilitySystemReference.js +78 -0
- package/dist/GdsAccessibilitySystemReference.mjs +54 -0
- package/dist/GdsAssetManager.client.js +208 -0
- package/dist/GdsAssetManager.client.mjs +180 -0
- package/dist/GdsBadge.js +115 -0
- package/dist/GdsBadge.mjs +91 -0
- package/dist/GdsBadge.shared-D2Cs4eos.d.mts +35 -0
- package/dist/GdsBadge.shared-D2Cs4eos.d.ts +35 -0
- package/dist/GdsBadge.shared.js +42 -0
- package/dist/GdsBadge.shared.mjs +16 -0
- package/dist/GdsBadgeStack.js +58 -0
- package/dist/GdsBadgeStack.mjs +33 -0
- package/dist/GdsBreadcrumbs.js +42 -0
- package/dist/GdsBreadcrumbs.mjs +18 -0
- package/dist/GdsBulkActionBar.js +73 -0
- package/dist/GdsBulkActionBar.mjs +49 -0
- package/dist/GdsButtonFeedbackReference.js +289 -0
- package/dist/GdsButtonFeedbackReference.mjs +273 -0
- package/dist/GdsChart.js +169 -0
- package/dist/GdsChart.mjs +145 -0
- package/dist/GdsChart.shared.js +247 -0
- package/dist/GdsChart.shared.mjs +215 -0
- package/dist/GdsColorSystemReference.js +116 -0
- package/dist/GdsColorSystemReference.mjs +100 -0
- package/dist/GdsCompareButton.js +79 -0
- package/dist/GdsCompareButton.mjs +55 -0
- package/dist/GdsContentDesign.js +371 -0
- package/dist/GdsContentDesign.mjs +339 -0
- package/dist/GdsCountBadge.js +70 -0
- package/dist/GdsCountBadge.mjs +46 -0
- package/dist/GdsDataTable.client.js +412 -0
- package/dist/GdsDataTable.client.mjs +385 -0
- package/dist/GdsDateInput.client.js +116 -0
- package/dist/GdsDateInput.client.mjs +90 -0
- package/dist/GdsDensity.js +46 -0
- package/dist/GdsDensity.mjs +20 -0
- package/dist/GdsDensitySpacingSystemReference.js +70 -0
- package/dist/GdsDensitySpacingSystemReference.mjs +52 -0
- package/dist/GdsDesignHandoff.js +250 -0
- package/dist/GdsDesignHandoff.mjs +222 -0
- package/dist/GdsDesignRuleProfilePanel.js +80 -0
- package/dist/GdsDesignRuleProfilePanel.mjs +61 -0
- package/dist/GdsForm.client.js +303 -0
- package/dist/GdsForm.client.mjs +271 -0
- package/dist/GdsFormControls.js +193 -0
- package/dist/GdsFormControls.mjs +166 -0
- package/dist/GdsGeneratedAvatar.js +86 -0
- package/dist/GdsGeneratedAvatar.mjs +65 -0
- package/dist/GdsGeneratedAvatar.shared.js +34 -0
- package/dist/GdsGeneratedAvatar.shared.mjs +10 -0
- package/dist/GdsGeneratedHero.js +277 -0
- package/dist/GdsGeneratedHero.mjs +256 -0
- package/dist/GdsGeneratedMark.js +90 -0
- package/dist/GdsGeneratedMark.mjs +66 -0
- package/dist/GdsGeneratedThumbnail.js +301 -0
- package/dist/GdsGeneratedThumbnail.mjs +280 -0
- package/dist/GdsI18nRuntime.js +83 -0
- package/dist/GdsI18nRuntime.mjs +52 -0
- package/dist/GdsI18nRuntime.shared.js +232 -0
- package/dist/GdsI18nRuntime.shared.mjs +198 -0
- package/dist/GdsIconBadge.js +60 -0
- package/dist/GdsIconBadge.mjs +36 -0
- package/dist/GdsIconSystemReference.js +128 -0
- package/dist/GdsIconSystemReference.mjs +104 -0
- package/dist/GdsInlineLink.js +42 -0
- package/dist/{chunk-W5O2JSVK.mjs → GdsInlineLink.mjs} +1 -3
- package/dist/GdsLogoLockup.js +131 -0
- package/dist/GdsLogoLockup.mjs +107 -0
- package/dist/GdsMap.client.js +395 -0
- package/dist/GdsMap.client.mjs +358 -0
- package/dist/GdsMapBasemapWash.js +51 -0
- package/dist/GdsMapBasemapWash.mjs +25 -0
- package/dist/GdsMapFilterRail.js +84 -0
- package/dist/GdsMapFilterRail.mjs +60 -0
- package/dist/GdsMapPinBadge.js +95 -0
- package/dist/{chunk-NTNVQZJU.mjs → GdsMapPinBadge.mjs} +12 -30
- package/dist/GdsMapPinBadge.shared.js +43 -0
- package/dist/GdsMapPinBadge.shared.mjs +14 -0
- package/dist/GdsMapPinPreviewCard.js +134 -0
- package/dist/GdsMapPinPreviewCard.mjs +110 -0
- package/dist/GdsMessageThread.js +92 -0
- package/dist/GdsMessageThread.mjs +68 -0
- package/dist/GdsMeter.js +46 -0
- package/dist/GdsMeter.mjs +22 -0
- package/dist/GdsMotionSystemReference.js +124 -0
- package/dist/GdsMotionSystemReference.mjs +106 -0
- package/dist/GdsNotificationBell.js +78 -0
- package/dist/GdsNotificationBell.mjs +54 -0
- package/dist/GdsPageTemplateFrame.js +178 -0
- package/dist/GdsPageTemplateFrame.mjs +150 -0
- package/dist/GdsPageTemplates.client.js +129 -0
- package/dist/GdsPageTemplates.client.mjs +104 -0
- package/dist/GdsPageTemplates.js +279 -0
- package/dist/GdsPageTemplates.mjs +247 -0
- package/dist/GdsPageTemplates.shared.js +331 -0
- package/dist/GdsPageTemplates.shared.mjs +303 -0
- package/dist/GdsPictogramSystemReference.js +288 -0
- package/dist/GdsPictogramSystemReference.mjs +264 -0
- package/dist/GdsPinSystemReference.js +164 -0
- package/dist/GdsPinSystemReference.mjs +147 -0
- package/dist/GdsPrimitives.js +84 -0
- package/dist/GdsPrimitives.mjs +62 -0
- package/dist/GdsRatingDisplay.js +61 -0
- package/dist/GdsRatingDisplay.mjs +37 -0
- package/dist/GdsReleaseNotes.client.js +126 -0
- package/dist/GdsReleaseNotes.client.mjs +102 -0
- package/dist/GdsRemovableTag.js +61 -0
- package/dist/GdsRemovableTag.mjs +37 -0
- package/dist/GdsResourceManager.client.js +280 -0
- package/dist/GdsResourceManager.client.mjs +254 -0
- package/dist/GdsRichTextEditor.client.js +146 -0
- package/dist/GdsRichTextEditor.client.mjs +112 -0
- package/dist/GdsSavedIndicator.js +62 -0
- package/dist/GdsSavedIndicator.mjs +38 -0
- package/dist/GdsSchemaForm.client.js +679 -0
- package/dist/GdsSchemaForm.client.mjs +650 -0
- package/dist/GdsShapeElevationSystemReference.js +140 -0
- package/dist/GdsShapeElevationSystemReference.mjs +125 -0
- package/dist/GdsShapeScope.js +44 -0
- package/dist/GdsShapeScope.mjs +19 -0
- package/dist/GdsTableScrollContainer.js +46 -0
- package/dist/GdsTableScrollContainer.mjs +22 -0
- package/dist/GdsThreadList.js +118 -0
- package/dist/GdsThreadList.mjs +94 -0
- package/dist/GdsTour.client.js +399 -0
- package/dist/GdsTour.client.mjs +380 -0
- package/dist/GdsTreeView.js +194 -0
- package/dist/GdsTreeView.mjs +170 -0
- package/dist/GdsTypographySystemReference.js +77 -0
- package/dist/GdsTypographySystemReference.mjs +57 -0
- package/dist/GdsViewToggle.js +48 -0
- package/dist/GdsViewToggle.mjs +24 -0
- package/dist/GdsViewportFrame.js +61 -0
- package/dist/GdsViewportFrame.mjs +37 -0
- package/dist/HeroSearchPanel.client.js +135 -0
- package/dist/HeroSearchPanel.client.mjs +109 -0
- package/dist/KanbanBoard.client.js +400 -0
- package/dist/KanbanBoard.client.mjs +382 -0
- package/dist/LayoutBlocks.js +331 -0
- package/dist/LayoutBlocks.mjs +301 -0
- package/dist/LayoutPrimitives.js +501 -0
- package/dist/LayoutPrimitives.mjs +465 -0
- package/dist/LayoutTemplatePreview.client.js +172 -0
- package/dist/LayoutTemplatePreview.client.mjs +151 -0
- package/dist/ListingCard.js +397 -0
- package/dist/ListingCard.mjs +373 -0
- package/dist/ListingCard.shared.js +49 -0
- package/dist/ListingCard.shared.mjs +18 -0
- package/dist/ListingPrimitives.js +116 -0
- package/dist/ListingPrimitives.mjs +89 -0
- package/dist/ListingState.client.js +98 -0
- package/dist/ListingState.client.mjs +72 -0
- package/dist/MapPanel.js +93 -0
- package/dist/MapPanel.mjs +69 -0
- package/dist/MaturityCapabilities.js +211 -0
- package/dist/MaturityCapabilities.mjs +184 -0
- package/dist/MeaningBadge.js +65 -0
- package/dist/MeaningBadge.mjs +41 -0
- package/dist/MediaCard.js +61 -0
- package/dist/MediaCard.mjs +37 -0
- package/dist/MediaField.js +117 -0
- package/dist/MediaField.mjs +93 -0
- package/dist/MediaPreviewCard.js +90 -0
- package/dist/MediaPreviewCard.mjs +66 -0
- package/dist/MediaWithFallback.js +112 -0
- package/dist/MediaWithFallback.mjs +88 -0
- package/dist/MetricCard.js +60 -0
- package/dist/MetricCard.mjs +36 -0
- package/dist/Notifications.client.js +301 -0
- package/dist/Notifications.client.mjs +273 -0
- package/dist/Notifications.js +220 -0
- package/dist/Notifications.mjs +194 -0
- package/dist/Notifications.shared.js +52 -0
- package/dist/Notifications.shared.mjs +26 -0
- package/dist/NumberStepper.js +124 -0
- package/dist/NumberStepper.mjs +100 -0
- package/dist/OverlayManager.client.js +300 -0
- package/dist/OverlayManager.client.mjs +270 -0
- package/dist/OwnedContrastSurface.js +83 -0
- package/dist/OwnedContrastSurface.mjs +58 -0
- package/dist/PageHeader.js +48 -0
- package/dist/PageHeader.mjs +24 -0
- package/dist/{PartnerDiscovery-pdJmaKwq.d.ts → PartnerDiscovery-BUwzROQc.d.mts} +37 -35
- package/dist/{PartnerDiscovery-Dy3YnO02.d.mts → PartnerDiscovery-DmIj5bAw.d.ts} +37 -35
- package/dist/PartnerDiscovery.js +629 -0
- package/dist/{chunk-PCG34VRY.mjs → PartnerDiscovery.mjs} +19 -106
- package/dist/PartnerDiscovery.shared.js +116 -0
- package/dist/PartnerDiscovery.shared.mjs +84 -0
- package/dist/PeriodSelector.js +69 -0
- package/dist/PeriodSelector.mjs +45 -0
- package/dist/PlaceholderPanel.js +59 -0
- package/dist/PlaceholderPanel.mjs +35 -0
- package/dist/PlaybackControls.client.js +91 -0
- package/dist/PlaybackControls.client.mjs +65 -0
- package/dist/PlaybackSurface.js +107 -0
- package/dist/PlaybackSurface.mjs +83 -0
- package/dist/ProductCard.js +75 -0
- package/dist/ProductCard.mjs +51 -0
- package/dist/ProgressCard.js +58 -0
- package/dist/ProgressCard.mjs +34 -0
- package/dist/ProviderCTA.js +104 -0
- package/dist/ProviderCTA.mjs +80 -0
- package/dist/ProviderIdentityButtons.js +221 -0
- package/dist/ProviderIdentityButtons.mjs +192 -0
- package/dist/PublicBrandFooter.js +70 -0
- package/dist/PublicBrandFooter.mjs +46 -0
- package/dist/PublicCaptureFlow.js +125 -0
- package/dist/PublicCaptureFlow.mjs +95 -0
- package/dist/PublicFlowShell.js +128 -0
- package/dist/PublicFlowShell.mjs +104 -0
- package/dist/PublicFoodCard.js +153 -0
- package/dist/PublicFoodCard.mjs +129 -0
- package/dist/PublicNav.js +51 -0
- package/dist/PublicNav.mjs +27 -0
- package/dist/PublicProductCard.js +145 -0
- package/dist/PublicProductCard.mjs +121 -0
- package/dist/PublicShell.js +168 -0
- package/dist/PublicShell.mjs +144 -0
- package/dist/PublicSiteFooter.js +35 -0
- package/dist/PublicSiteFooter.mjs +11 -0
- package/dist/{QuickStartCard-BhNYAGG3.d.ts → QuickStartCard-CYKhDjvS.d.ts} +551 -158
- package/dist/{QuickStartCard-BztqkfQK.d.mts → QuickStartCard-DT2GgJrP.d.mts} +551 -158
- package/dist/QuickStartCard.js +85 -0
- package/dist/QuickStartCard.mjs +60 -0
- package/dist/ReferenceLinkGrid.js +66 -0
- package/dist/ReferenceLinkGrid.mjs +42 -0
- package/dist/ReferenceLocaleNotice.js +32 -0
- package/dist/ReferenceLocaleNotice.mjs +8 -0
- package/dist/ReferenceSection.js +58 -0
- package/dist/ReferenceSection.mjs +34 -0
- package/dist/ReferenceThemeExplorer.copy.js +1209 -0
- package/dist/ReferenceThemeExplorer.copy.mjs +1184 -0
- package/dist/ReferenceThemeExplorer.js +801 -0
- package/dist/ReferenceThemeExplorer.mjs +802 -0
- package/dist/ReportingSection.js +72 -0
- package/dist/ReportingSection.mjs +48 -0
- package/dist/SafeStyles.js +303 -0
- package/dist/SafeStyles.mjs +274 -0
- package/dist/SearchableSelect.js +195 -0
- package/dist/SearchableSelect.mjs +171 -0
- package/dist/SectionPanel.js +96 -0
- package/dist/SectionPanel.mjs +72 -0
- package/dist/SemanticButton.js +326 -0
- package/dist/SemanticButton.mjs +296 -0
- package/dist/SemanticCharts.js +120 -0
- package/dist/SemanticCharts.mjs +77 -0
- package/dist/ShareButtonGroup.js +117 -0
- package/dist/ShareButtonGroup.mjs +93 -0
- package/dist/SidebarNav.js +92 -0
- package/dist/SidebarNav.mjs +66 -0
- package/dist/SimpleDataTable.js +59 -0
- package/dist/SimpleDataTable.mjs +35 -0
- package/dist/SocialAuthButtons.js +71 -0
- package/dist/SocialAuthButtons.mjs +49 -0
- package/dist/StateBlock.js +118 -0
- package/dist/StateBlock.mjs +95 -0
- package/dist/StatsSection.js +63 -0
- package/dist/StatsSection.mjs +39 -0
- package/dist/StatusBadge.js +94 -0
- package/dist/StatusBadge.mjs +68 -0
- package/dist/StyleUtilities.js +123 -0
- package/dist/StyleUtilities.mjs +91 -0
- package/dist/SurfacePresentation.js +63 -0
- package/dist/SurfacePresentation.mjs +38 -0
- package/dist/TaskPatterns.js +206 -0
- package/dist/TaskPatterns.mjs +180 -0
- package/dist/Telemetry.client.js +273 -0
- package/dist/Telemetry.client.mjs +243 -0
- package/dist/ThemeToggle.js +53 -0
- package/dist/{chunk-ZFGYQSNR.mjs → ThemeToggle.mjs} +3 -7
- package/dist/TrustLayer.client.js +184 -0
- package/dist/TrustLayer.client.mjs +158 -0
- package/dist/TrustLayer.js +94 -0
- package/dist/TrustLayer.mjs +68 -0
- package/dist/TrustLayer.shared.js +37 -0
- package/dist/TrustLayer.shared.mjs +13 -0
- package/dist/Typography.js +68 -0
- package/dist/Typography.mjs +37 -0
- package/dist/UploadDropzone.js +144 -0
- package/dist/UploadDropzone.mjs +120 -0
- package/dist/badge-shapes.js +75 -0
- package/dist/badge-shapes.mjs +44 -0
- package/dist/breakpoints.js +34 -0
- package/dist/breakpoints.mjs +10 -0
- package/dist/category-registry.js +33 -0
- package/dist/category-registry.mjs +9 -0
- package/dist/chart-colors.js +73 -0
- package/dist/chart-colors.mjs +44 -0
- package/dist/chart-primitives.js +169 -0
- package/dist/chart-primitives.mjs +144 -0
- package/dist/client.d.mts +3 -3
- package/dist/client.d.ts +3 -3
- package/dist/client.js +378 -23816
- package/dist/client.mjs +161 -959
- package/dist/dom-phrase-translation.js +130 -0
- package/dist/dom-phrase-translation.mjs +104 -0
- package/dist/generated-art-engine.js +119 -0
- package/dist/generated-art-engine.mjs +93 -0
- package/dist/generated-art-svg.js +263 -0
- package/dist/generated-art-svg.mjs +238 -0
- package/dist/generated-brand-badge.js +160 -0
- package/dist/generated-brand-badge.mjs +136 -0
- package/dist/generated-design-rule-coverage.js +54 -0
- package/dist/generated-design-rule-coverage.mjs +30 -0
- package/dist/icons.js +371 -0
- package/dist/{chunk-J66ITCXC.mjs → icons.mjs} +22 -15
- package/dist/index.d.mts +13 -12
- package/dist/index.d.ts +13 -12
- package/dist/index.js +448 -26750
- package/dist/index.mjs +192 -3030
- package/dist/locales/ar.js +477 -0
- package/dist/{chunk-EYRLICSG.mjs → locales/ar.mjs} +1 -3
- package/dist/locales/de.js +477 -0
- package/dist/{chunk-TVGDH5O5.mjs → locales/de.mjs} +1 -3
- package/dist/locales/en.js +477 -0
- package/dist/{chunk-D65VHUXK.mjs → locales/en.mjs} +1 -3
- package/dist/locales/es.js +477 -0
- package/dist/{chunk-J4TSXITU.mjs → locales/es.mjs} +1 -3
- package/dist/locales/fr.js +477 -0
- package/dist/{chunk-Z6XXK57E.mjs → locales/fr.mjs} +1 -3
- package/dist/locales/he.js +477 -0
- package/dist/{chunk-GAPCKZGX.mjs → locales/he.mjs} +1 -3
- package/dist/locales/hu.js +477 -0
- package/dist/{chunk-CWMDWMYL.mjs → locales/hu.mjs} +1 -3
- package/dist/locales/index.js +83 -0
- package/dist/locales/index.mjs +45 -0
- package/dist/locales/it.js +477 -0
- package/dist/{chunk-3UYDQTAZ.mjs → locales/it.mjs} +1 -3
- package/dist/locales/ja.js +477 -0
- package/dist/{chunk-FPDTLFIB.mjs → locales/ja.mjs} +1 -3
- package/dist/locales/ko.js +477 -0
- package/dist/{chunk-PLJT4I7B.mjs → locales/ko.mjs} +1 -3
- package/dist/locales/lazy/all.js +23 -5449
- package/dist/locales/lazy/all.mjs +12 -39
- package/dist/locales/lazy/ar.js +3 -919
- package/dist/locales/lazy/ar.mjs +2 -9
- package/dist/locales/lazy/de.js +3 -919
- package/dist/locales/lazy/de.mjs +2 -9
- package/dist/locales/lazy/es.js +3 -919
- package/dist/locales/lazy/es.mjs +2 -9
- package/dist/locales/lazy/fr.js +3 -919
- package/dist/locales/lazy/fr.mjs +2 -9
- package/dist/locales/lazy/he.js +3 -919
- package/dist/locales/lazy/he.mjs +2 -9
- package/dist/locales/lazy/hu.js +3 -919
- package/dist/locales/lazy/hu.mjs +2 -9
- package/dist/locales/lazy/index.js +3 -477
- package/dist/locales/lazy/index.mjs +1 -5
- package/dist/locales/lazy/it.js +3 -919
- package/dist/locales/lazy/it.mjs +2 -9
- package/dist/locales/lazy/ja.js +3 -919
- package/dist/locales/lazy/ja.mjs +2 -9
- package/dist/locales/lazy/ko.js +3 -919
- package/dist/locales/lazy/ko.mjs +2 -9
- package/dist/locales/lazy/registry.js +47 -0
- package/dist/{chunk-TD3JPMMO.mjs → locales/lazy/registry.mjs} +6 -11
- package/dist/locales/lazy/ru.js +3 -919
- package/dist/locales/lazy/ru.mjs +2 -9
- package/dist/locales/lazy/zh.js +3 -919
- package/dist/locales/lazy/zh.mjs +2 -9
- package/dist/locales/ru.js +477 -0
- package/dist/{chunk-RBXAJJB2.mjs → locales/ru.mjs} +1 -3
- package/dist/locales/zh.js +477 -0
- package/dist/{chunk-V6SP5O4D.mjs → locales/zh.mjs} +1 -3
- package/dist/map-tile-policy.js +55 -0
- package/dist/map-tile-policy.mjs +29 -0
- package/dist/map.d.mts +1 -3
- package/dist/map.d.ts +1 -3
- package/dist/map.js +6 -749
- package/dist/map.mjs +2 -389
- package/dist/pictograms.js +112 -0
- package/dist/pictograms.mjs +88 -0
- package/dist/pictograms.shared.js +262 -0
- package/dist/pictograms.shared.mjs +226 -0
- package/dist/reference-theme-explorer.js +3 -10401
- package/dist/reference-theme-explorer.mjs +1 -2008
- package/dist/rich-text-editor.js +3 -450
- package/dist/rich-text-editor.mjs +1 -115
- package/dist/server.d.mts +6 -5
- package/dist/server.d.ts +6 -5
- package/dist/server.js +304 -18097
- package/dist/server.mjs +120 -1122
- package/dist/useGdsDomPhraseTranslation.client.js +49 -0
- package/dist/useGdsDomPhraseTranslation.client.mjs +25 -0
- package/dist/vocabulary.js +166 -0
- package/dist/vocabulary.mjs +137 -0
- package/package.json +5 -5
- package/dist/GdsBadge-j_kQnIL0.d.mts +0 -417
- package/dist/GdsBadge-j_kQnIL0.d.ts +0 -417
- package/dist/chunk-ADNXPSGK.mjs +0 -6695
- package/dist/chunk-MQDFB3AS.mjs +0 -8311
- package/dist/chunk-RMPMU4MB.mjs +0 -2468
- package/dist/chunk-RSA7INLU.mjs +0 -246
- package/dist/chunk-SPPTDVJC.mjs +0 -211
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { Button, Checkbox, Group, Paper, Stack, Text, Title } from "@mantine/core";
|
|
5
|
+
import { useGdsTranslation } from "@sovereignsquad/gds-theme";
|
|
6
|
+
import { FormField } from "./FormField.mjs";
|
|
7
|
+
import { GdsDateInput } from "./GdsDateInput.client.mjs";
|
|
8
|
+
import { GdsFormProvider, GdsValidationSummary, ValidatedFieldMessage, useGdsFormOrchestration } from "./GdsForm.client.mjs";
|
|
9
|
+
import { StateBlock } from "./StateBlock.mjs";
|
|
10
|
+
import { UploadDropzone } from "./UploadDropzone.mjs";
|
|
11
|
+
function toIsoDateString(date) {
|
|
12
|
+
const year = date.getFullYear();
|
|
13
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
14
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
15
|
+
return `${year}-${month}-${day}`;
|
|
16
|
+
}
|
|
17
|
+
function createSchemaEvent(type, message, field) {
|
|
18
|
+
return { type, message, field, timestamp: Date.now(), privacy: "metadata-only" };
|
|
19
|
+
}
|
|
20
|
+
function humanizeFieldName(name) {
|
|
21
|
+
return name.replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/^./, (char) => char.toUpperCase());
|
|
22
|
+
}
|
|
23
|
+
function makeI18nKey(formId, fieldName) {
|
|
24
|
+
return `gds.form.${formId}.${fieldName}`;
|
|
25
|
+
}
|
|
26
|
+
function normalizeJsonField(formId, name, source, required) {
|
|
27
|
+
const title = typeof source.title === "string" ? source.title : humanizeFieldName(name);
|
|
28
|
+
const description = typeof source.description === "string" ? source.description : void 0;
|
|
29
|
+
const customType = typeof source["x-gds-fieldType"] === "string" ? source["x-gds-fieldType"] : void 0;
|
|
30
|
+
const hidden = source["x-gds-hidden"] === true;
|
|
31
|
+
const condition = typeof source["x-gds-condition"] === "string" ? source["x-gds-condition"] : void 0;
|
|
32
|
+
const base = {
|
|
33
|
+
name,
|
|
34
|
+
label: title,
|
|
35
|
+
description,
|
|
36
|
+
required,
|
|
37
|
+
hidden,
|
|
38
|
+
condition,
|
|
39
|
+
i18nKey: typeof source["x-gds-i18nKey"] === "string" ? source["x-gds-i18nKey"] : makeI18nKey(formId, name),
|
|
40
|
+
defaultValue: source.default,
|
|
41
|
+
minLength: typeof source.minLength === "number" ? source.minLength : void 0,
|
|
42
|
+
maxLength: typeof source.maxLength === "number" ? source.maxLength : void 0,
|
|
43
|
+
min: typeof source.minimum === "number" ? source.minimum : void 0,
|
|
44
|
+
max: typeof source.maximum === "number" ? source.maximum : void 0,
|
|
45
|
+
pattern: typeof source.pattern === "string" ? source.pattern : void 0,
|
|
46
|
+
accept: typeof source["x-gds-accept"] === "string" ? source["x-gds-accept"] : typeof source.contentMediaType === "string" ? source.contentMediaType : void 0,
|
|
47
|
+
multiple: typeof source["x-gds-multiple"] === "boolean" ? source["x-gds-multiple"] : void 0,
|
|
48
|
+
maxFileSizeBytes: typeof source["x-gds-maxFileSizeBytes"] === "number" ? source["x-gds-maxFileSizeBytes"] : void 0,
|
|
49
|
+
maxFileSizeLabel: typeof source["x-gds-maxFileSizeLabel"] === "string" ? source["x-gds-maxFileSizeLabel"] : void 0,
|
|
50
|
+
uploadActionLabel: typeof source["x-gds-uploadActionLabel"] === "string" ? source["x-gds-uploadActionLabel"] : void 0,
|
|
51
|
+
uploadPolicyText: typeof source["x-gds-uploadPolicyText"] === "string" ? source["x-gds-uploadPolicyText"] : void 0,
|
|
52
|
+
uploadState: typeof source["x-gds-uploadState"] === "string" ? source["x-gds-uploadState"] : void 0,
|
|
53
|
+
uploadProgress: typeof source["x-gds-uploadProgress"] === "number" ? source["x-gds-uploadProgress"] : void 0
|
|
54
|
+
};
|
|
55
|
+
const enumValues = Array.isArray(source.enum) ? source.enum : void 0;
|
|
56
|
+
if (hidden) return { ...base, type: "hidden" };
|
|
57
|
+
if (condition) return { ...base, type: "conditional" };
|
|
58
|
+
if (enumValues?.length) {
|
|
59
|
+
return {
|
|
60
|
+
...base,
|
|
61
|
+
// A schema author opts into a checkbox group over a dropdown with
|
|
62
|
+
// `x-gds-fieldType: 'checkbox-group'`; otherwise an enum renders as a select.
|
|
63
|
+
type: customType === "checkbox-group" ? "checkbox-group" : "select",
|
|
64
|
+
options: enumValues.map((value) => ({ label: String(value), value: String(value) }))
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (customType) return { ...base, type: customType };
|
|
68
|
+
if (source.oneOf || source.anyOf) return { ...base, type: "unsupported", unsupportedReason: "oneOf/anyOf schemas require an explicit GDS renderer override." };
|
|
69
|
+
if (source.type === "array") return { ...base, type: "unsupported", unsupportedReason: "Array schemas require an explicit GDS renderer override." };
|
|
70
|
+
if (source.type === "object" || source.$ref) return { ...base, type: "unsupported", unsupportedReason: "Nested or referenced schemas require a separate form section or renderer override." };
|
|
71
|
+
if (source.type === "boolean") return { ...base, type: "boolean" };
|
|
72
|
+
if (source.type === "number" || source.type === "integer") return { ...base, type: "number" };
|
|
73
|
+
if (source.format === "email") return { ...base, type: "email" };
|
|
74
|
+
if (source.format === "uri" || source.format === "url") return { ...base, type: "url" };
|
|
75
|
+
if (source.format === "date") return { ...base, type: "date" };
|
|
76
|
+
if (source.format === "password") return { ...base, type: "password" };
|
|
77
|
+
if (source.format === "binary" || source.format === "data-url") return { ...base, type: "file-upload" };
|
|
78
|
+
if (Number(source.maxLength) > 160) return { ...base, type: "textarea" };
|
|
79
|
+
return { ...base, type: "text" };
|
|
80
|
+
}
|
|
81
|
+
function jsonSchemaToGdsFormSchema(schema, options = {}) {
|
|
82
|
+
const id = options.id ?? (typeof schema.$id === "string" ? schema.$id.replace(/[^a-zA-Z0-9_-]/g, "-") : "schema-form");
|
|
83
|
+
const properties = schema.properties;
|
|
84
|
+
if (!properties || typeof properties !== "object" || Array.isArray(properties)) {
|
|
85
|
+
return {
|
|
86
|
+
issues: [{ field: "schema", message: "JSON Schema form generation requires an object schema with properties.", severity: "blocking" }],
|
|
87
|
+
events: [createSchemaEvent("schema_parse_failed", "Missing object properties.")]
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const required = new Set(Array.isArray(schema.required) ? schema.required.map(String) : []);
|
|
91
|
+
const fields = Object.entries(properties).map(([name, value]) => normalizeJsonField(id, name, value, required.has(name)));
|
|
92
|
+
const unsupported = fields.filter((field) => field.type === "unsupported");
|
|
93
|
+
return {
|
|
94
|
+
schema: {
|
|
95
|
+
id,
|
|
96
|
+
title: typeof schema.title === "string" ? schema.title : void 0,
|
|
97
|
+
description: typeof schema.description === "string" ? schema.description : void 0,
|
|
98
|
+
fields
|
|
99
|
+
},
|
|
100
|
+
issues: unsupported.map((field) => ({ field: field.name, message: field.unsupportedReason ?? "Unsupported schema field.", severity: "warning" })),
|
|
101
|
+
events: unsupported.map((field) => createSchemaEvent("unsupported_field", field.unsupportedReason, field.name))
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function openApiToGdsFormSchema(document, options = {}) {
|
|
105
|
+
const schema = options.schemaName ? document.components?.schemas?.[options.schemaName] : document.schema ?? document.requestBody?.content?.["application/json"]?.schema ?? document.components?.schemas?.[Object.keys(document.components?.schemas ?? {})[0]];
|
|
106
|
+
if (!schema) {
|
|
107
|
+
return {
|
|
108
|
+
issues: [{ field: "openapi", message: "OpenAPI form generation requires a requestBody schema or components.schemas entry.", severity: "blocking" }],
|
|
109
|
+
events: [createSchemaEvent("schema_parse_failed", "Missing OpenAPI schema.")]
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return jsonSchemaToGdsFormSchema(schema, { id: options.id ?? options.schemaName ?? "openapi-form" });
|
|
113
|
+
}
|
|
114
|
+
function readZodShape(schema) {
|
|
115
|
+
const shape = schema?.shape ?? schema?._def?.shape;
|
|
116
|
+
if (typeof shape === "function") return shape();
|
|
117
|
+
if (shape && typeof shape === "object") return shape;
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
function zodFieldToJson(name, field) {
|
|
121
|
+
const definition = field?._def ?? field?.def ?? {};
|
|
122
|
+
const typeName = String(definition.typeName ?? definition.type ?? field?.type ?? "");
|
|
123
|
+
const inner = definition.innerType ?? definition.schema;
|
|
124
|
+
const optional = typeName.toLowerCase().includes("optional") || Boolean(inner);
|
|
125
|
+
const target = inner ?? field;
|
|
126
|
+
const targetDefinition = target?._def ?? target?.def ?? definition;
|
|
127
|
+
const targetType = String(targetDefinition.typeName ?? targetDefinition.type ?? typeName).toLowerCase();
|
|
128
|
+
const description = typeof target.description === "string" ? target.description : void 0;
|
|
129
|
+
const json = { title: humanizeFieldName(name), description };
|
|
130
|
+
if (targetType.includes("number")) json.type = "number";
|
|
131
|
+
else if (targetType.includes("boolean")) json.type = "boolean";
|
|
132
|
+
else if (targetType.includes("enum")) {
|
|
133
|
+
json.type = "string";
|
|
134
|
+
json.enum = targetDefinition.values ?? targetDefinition.entries ? Object.values(targetDefinition.entries ?? targetDefinition.values) : void 0;
|
|
135
|
+
} else if (targetType.includes("array")) json.type = "array";
|
|
136
|
+
else if (targetType.includes("object")) json.type = "object";
|
|
137
|
+
else json.type = "string";
|
|
138
|
+
json["x-gds-optional"] = optional;
|
|
139
|
+
return json;
|
|
140
|
+
}
|
|
141
|
+
function zodToGdsFormSchema(zodSchema, options = {}) {
|
|
142
|
+
const shape = readZodShape(zodSchema);
|
|
143
|
+
if (!shape) {
|
|
144
|
+
return {
|
|
145
|
+
issues: [{ field: "zod", message: "Zod form generation requires an object schema with a readable shape.", severity: "blocking" }],
|
|
146
|
+
events: [createSchemaEvent("schema_parse_failed", "Missing Zod object shape.")]
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const properties = Object.fromEntries(Object.entries(shape).map(([name, field]) => [name, zodFieldToJson(name, field)]));
|
|
150
|
+
const required = Object.entries(properties).filter(([, value]) => value["x-gds-optional"] !== true).map(([name]) => name);
|
|
151
|
+
return jsonSchemaToGdsFormSchema({ type: "object", properties, required }, { id: options.id ?? "zod-form" });
|
|
152
|
+
}
|
|
153
|
+
function createGdsFormFromSchema(source, options) {
|
|
154
|
+
if (options.adapter === "json-schema") return jsonSchemaToGdsFormSchema(source, { id: options.id });
|
|
155
|
+
if (options.adapter === "openapi") return openApiToGdsFormSchema(source, { id: options.id, schemaName: options.schemaName });
|
|
156
|
+
return zodToGdsFormSchema(source, { id: options.id });
|
|
157
|
+
}
|
|
158
|
+
function scalarInitialValue(field) {
|
|
159
|
+
if (field.type === "boolean") return false;
|
|
160
|
+
if (field.type === "checkbox-group" || field.type === "repeatable") return [];
|
|
161
|
+
return "";
|
|
162
|
+
}
|
|
163
|
+
function makeRepeatableRow(field) {
|
|
164
|
+
return Object.fromEntries((field.fields ?? []).map((sub) => [sub.name, sub.defaultValue ?? scalarInitialValue(sub)]));
|
|
165
|
+
}
|
|
166
|
+
function getInitialValues(schema) {
|
|
167
|
+
return Object.fromEntries(schema.fields.map((field) => {
|
|
168
|
+
if (field.type === "repeatable") {
|
|
169
|
+
if (Array.isArray(field.defaultValue)) return [field.name, field.defaultValue];
|
|
170
|
+
const minRows = field.minRows ?? 0;
|
|
171
|
+
return [field.name, Array.from({ length: minRows }, () => makeRepeatableRow(field))];
|
|
172
|
+
}
|
|
173
|
+
return [field.name, field.defaultValue ?? scalarInitialValue(field)];
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
function isFileValue(value) {
|
|
177
|
+
return typeof File !== "undefined" && value instanceof File;
|
|
178
|
+
}
|
|
179
|
+
function validateSchemaValues(schema, values, renderers = {}, options = {}) {
|
|
180
|
+
const t = options.t ?? ((_id, defaultMessage) => defaultMessage);
|
|
181
|
+
return schema.fields.flatMap((field) => {
|
|
182
|
+
if (field.hidden || field.type === "hidden") return [];
|
|
183
|
+
const value = values[field.name];
|
|
184
|
+
const fileValues = Array.isArray(value) ? value : [];
|
|
185
|
+
const text = String(value ?? "").trim();
|
|
186
|
+
if (field.type === "unsupported" && !renderers[field.name] && !renderers[field.type]) return [{ field: field.name, message: field.unsupportedReason ?? "Unsupported schema field.", severity: "blocking" }];
|
|
187
|
+
if (field.type === "checkbox-group") {
|
|
188
|
+
const selected = Array.isArray(value) ? value : [];
|
|
189
|
+
if (field.required && selected.length === 0) {
|
|
190
|
+
return [{ field: field.name, message: `${field.label} ${t("gds.schemaForm.selectionRequired", "requires at least one selection.")}`, severity: "blocking" }];
|
|
191
|
+
}
|
|
192
|
+
return [];
|
|
193
|
+
}
|
|
194
|
+
if (field.type === "repeatable") {
|
|
195
|
+
const rows = Array.isArray(value) ? value : [];
|
|
196
|
+
const minRows = field.minRows ?? (field.required ? 1 : 0);
|
|
197
|
+
const issues = [];
|
|
198
|
+
if (rows.length < minRows) {
|
|
199
|
+
issues.push({ field: field.name, message: `${field.label} ${t("gds.schemaForm.minRowsPhrase", "requires at least")} ${minRows} ${minRows === 1 ? t("gds.schemaForm.rowOne", "row") : t("gds.schemaForm.rowMany", "rows")}.`, severity: "blocking" });
|
|
200
|
+
}
|
|
201
|
+
if (field.maxRows !== void 0 && rows.length > field.maxRows) {
|
|
202
|
+
issues.push({ field: field.name, message: `${field.label} ${t("gds.schemaForm.maxRowsPhrase", "allows at most")} ${field.maxRows} ${field.maxRows === 1 ? t("gds.schemaForm.rowOne", "row") : t("gds.schemaForm.rowMany", "rows")}.`, severity: "blocking" });
|
|
203
|
+
}
|
|
204
|
+
const requiredSubFields = (field.fields ?? []).filter((sub) => sub.required);
|
|
205
|
+
const hasMissingRequired = rows.some(
|
|
206
|
+
(row) => requiredSubFields.some((sub) => {
|
|
207
|
+
const subValue = row?.[sub.name];
|
|
208
|
+
if (sub.type === "checkbox-group") return !Array.isArray(subValue) || subValue.length === 0;
|
|
209
|
+
return subValue === void 0 || subValue === null || String(subValue).trim() === "";
|
|
210
|
+
})
|
|
211
|
+
);
|
|
212
|
+
if (hasMissingRequired) {
|
|
213
|
+
issues.push({ field: field.name, message: `${field.label} ${t("gds.schemaForm.rowMissingRequired", "has a row with a missing required field.")}`, severity: "blocking" });
|
|
214
|
+
}
|
|
215
|
+
return issues;
|
|
216
|
+
}
|
|
217
|
+
if (field.required && field.type === "file-upload" && fileValues.length === 0) return [{ field: field.name, message: `${field.label} ${t("gds.schemaForm.required", "is required.")}`, severity: "blocking" }];
|
|
218
|
+
if (field.required && field.type !== "file-upload" && (value === void 0 || value === null || text === "")) return [{ field: field.name, message: `${field.label} ${t("gds.schemaForm.required", "is required.")}`, severity: "blocking" }];
|
|
219
|
+
if (field.type === "file-upload" && field.maxFileSizeBytes && fileValues.some((file) => isFileValue(file) && file.size > field.maxFileSizeBytes)) return [{ field: field.name, message: `${field.label} contains a file larger than ${field.maxFileSizeLabel ?? `${field.maxFileSizeBytes} bytes`}.`, severity: "blocking" }];
|
|
220
|
+
if (field.type === "file-upload" && options.uploadAdapter && fileValues.some(isFileValue)) return [{ field: field.name, message: `${field.label} upload must finish before submit.`, severity: "blocking" }];
|
|
221
|
+
if (field.minLength && text.length > 0 && text.length < field.minLength) return [{ field: field.name, message: `${field.label} must contain at least ${field.minLength} characters.`, severity: "blocking" }];
|
|
222
|
+
if (field.maxLength && text.length > field.maxLength) return [{ field: field.name, message: `${field.label} must contain at most ${field.maxLength} characters.`, severity: "blocking" }];
|
|
223
|
+
if (field.pattern && text.length > 0 && !new RegExp(field.pattern).test(text)) return [{ field: field.name, message: `${field.label} does not match the required format.`, severity: "blocking" }];
|
|
224
|
+
if (field.type === "email" && text.length > 0 && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(text)) return [{ field: field.name, message: `${field.label} must be a valid email address.`, severity: "blocking" }];
|
|
225
|
+
if (field.type === "number" && value !== "" && value !== void 0) {
|
|
226
|
+
const numberValue = Number(value);
|
|
227
|
+
if (Number.isNaN(numberValue)) return [{ field: field.name, message: `${field.label} must be a number.`, severity: "blocking" }];
|
|
228
|
+
if (field.min !== void 0 && numberValue < field.min) return [{ field: field.name, message: `${field.label} must be at least ${field.min}.`, severity: "blocking" }];
|
|
229
|
+
if (field.max !== void 0 && numberValue > field.max) return [{ field: field.name, message: `${field.label} must be at most ${field.max}.`, severity: "blocking" }];
|
|
230
|
+
}
|
|
231
|
+
return [];
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
function getUploadFileNames(value) {
|
|
235
|
+
if (!Array.isArray(value)) {
|
|
236
|
+
return [];
|
|
237
|
+
}
|
|
238
|
+
return value.map((file) => {
|
|
239
|
+
if (typeof File !== "undefined" && file instanceof File) return file.name;
|
|
240
|
+
if (file && typeof file === "object" && "name" in file) return String(file.name);
|
|
241
|
+
return String(file);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function FileUploadField({
|
|
245
|
+
id,
|
|
246
|
+
label,
|
|
247
|
+
field,
|
|
248
|
+
value,
|
|
249
|
+
describedBy,
|
|
250
|
+
invalid,
|
|
251
|
+
required,
|
|
252
|
+
accept,
|
|
253
|
+
multiple,
|
|
254
|
+
maxFileSizeBytes,
|
|
255
|
+
maxFileSizeLabel,
|
|
256
|
+
actionLabel,
|
|
257
|
+
policyText,
|
|
258
|
+
state,
|
|
259
|
+
progressValue,
|
|
260
|
+
uploadAdapter,
|
|
261
|
+
onUploadEvent,
|
|
262
|
+
onChange
|
|
263
|
+
}) {
|
|
264
|
+
const abortRef = useRef(null);
|
|
265
|
+
const lastFilesRef = useRef([]);
|
|
266
|
+
const [adapterState, setAdapterState] = useState();
|
|
267
|
+
const [adapterProgress, setAdapterProgress] = useState();
|
|
268
|
+
const [adapterError, setAdapterError] = useState();
|
|
269
|
+
const selectedFiles = getUploadFileNames(value);
|
|
270
|
+
const oversize = Array.isArray(value) && maxFileSizeBytes ? value.some((file) => isFileValue(file) && file.size > maxFileSizeBytes) : false;
|
|
271
|
+
const effectiveState = adapterState ?? state ?? (oversize ? "too-large" : selectedFiles.length > 0 ? "selected" : "idle");
|
|
272
|
+
const effectivePolicyText = oversize ? `One or more files exceed ${maxFileSizeLabel ?? `${maxFileSizeBytes} bytes`}.` : policyText;
|
|
273
|
+
const effectiveProgressValue = adapterProgress ?? progressValue;
|
|
274
|
+
const emitUploadEvent = useCallback((type, message) => {
|
|
275
|
+
onUploadEvent?.(createSchemaEvent(type, message, field?.name ?? id));
|
|
276
|
+
}, [field?.name, id, onUploadEvent]);
|
|
277
|
+
useEffect(() => () => {
|
|
278
|
+
abortRef.current?.abort();
|
|
279
|
+
}, []);
|
|
280
|
+
const uploadFiles = useCallback((files) => {
|
|
281
|
+
const selectedOversize = Boolean(maxFileSizeBytes && files.some((file) => file.size > maxFileSizeBytes));
|
|
282
|
+
if (!uploadAdapter || !field || selectedOversize) {
|
|
283
|
+
onChange?.(files);
|
|
284
|
+
if (selectedOversize) {
|
|
285
|
+
setAdapterState("too-large");
|
|
286
|
+
}
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
abortRef.current?.abort();
|
|
290
|
+
const controller = new AbortController();
|
|
291
|
+
abortRef.current = controller;
|
|
292
|
+
lastFilesRef.current = files;
|
|
293
|
+
onChange?.(files);
|
|
294
|
+
setAdapterState("upload-pending");
|
|
295
|
+
setAdapterProgress(0);
|
|
296
|
+
setAdapterError(void 0);
|
|
297
|
+
emitUploadEvent("upload_started");
|
|
298
|
+
void uploadAdapter.upload({
|
|
299
|
+
field,
|
|
300
|
+
files,
|
|
301
|
+
signal: controller.signal,
|
|
302
|
+
onProgress: (progress) => {
|
|
303
|
+
const clamped = Math.max(0, Math.min(100, progress));
|
|
304
|
+
setAdapterProgress(clamped);
|
|
305
|
+
emitUploadEvent("upload_progress");
|
|
306
|
+
}
|
|
307
|
+
}).then((result) => {
|
|
308
|
+
if (controller.signal.aborted) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const results = Array.isArray(result) ? result : [result];
|
|
312
|
+
onChange?.(results);
|
|
313
|
+
setAdapterState("selected");
|
|
314
|
+
setAdapterProgress(100);
|
|
315
|
+
setAdapterError(void 0);
|
|
316
|
+
emitUploadEvent("upload_succeeded");
|
|
317
|
+
}).catch((error) => {
|
|
318
|
+
if (controller.signal.aborted) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
setAdapterState("upload-failed");
|
|
322
|
+
setAdapterError(error instanceof Error ? error.message : "Upload failed.");
|
|
323
|
+
emitUploadEvent("upload_failed", error instanceof Error ? error.message : void 0);
|
|
324
|
+
});
|
|
325
|
+
}, [emitUploadEvent, field, maxFileSizeBytes, onChange, uploadAdapter]);
|
|
326
|
+
const handleFilesSelected = (files) => {
|
|
327
|
+
uploadFiles(files);
|
|
328
|
+
};
|
|
329
|
+
const retryUpload = () => {
|
|
330
|
+
if (!lastFilesRef.current.length) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
emitUploadEvent("upload_retry_requested");
|
|
334
|
+
uploadFiles(lastFilesRef.current);
|
|
335
|
+
};
|
|
336
|
+
const cancelUpload = () => {
|
|
337
|
+
abortRef.current?.abort();
|
|
338
|
+
abortRef.current = null;
|
|
339
|
+
setAdapterState("idle");
|
|
340
|
+
setAdapterProgress(void 0);
|
|
341
|
+
setAdapterError(void 0);
|
|
342
|
+
onChange?.([]);
|
|
343
|
+
emitUploadEvent("upload_cancelled");
|
|
344
|
+
};
|
|
345
|
+
const removeUpload = () => {
|
|
346
|
+
const controller = new AbortController();
|
|
347
|
+
const currentValue = Array.isArray(value) ? value.filter((item) => !isFileValue(item) && typeof item === "object" && item !== null) : [];
|
|
348
|
+
abortRef.current?.abort();
|
|
349
|
+
abortRef.current = controller;
|
|
350
|
+
const completeRemoval = () => {
|
|
351
|
+
onChange?.([]);
|
|
352
|
+
setAdapterState("removed");
|
|
353
|
+
setAdapterProgress(void 0);
|
|
354
|
+
setAdapterError(void 0);
|
|
355
|
+
emitUploadEvent("upload_removed");
|
|
356
|
+
};
|
|
357
|
+
if (!uploadAdapter?.remove || !field || currentValue.length === 0) {
|
|
358
|
+
completeRemoval();
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
void uploadAdapter.remove({ field, value: currentValue, signal: controller.signal }).then(() => {
|
|
362
|
+
if (!controller.signal.aborted) completeRemoval();
|
|
363
|
+
}).catch((error) => {
|
|
364
|
+
if (controller.signal.aborted) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
setAdapterState("upload-failed");
|
|
368
|
+
setAdapterError(error instanceof Error ? error.message : "Remove failed.");
|
|
369
|
+
emitUploadEvent("upload_failed", error instanceof Error ? error.message : void 0);
|
|
370
|
+
});
|
|
371
|
+
};
|
|
372
|
+
return /* @__PURE__ */ jsx(Stack, { gap: 4, children: /* @__PURE__ */ jsx(
|
|
373
|
+
UploadDropzone,
|
|
374
|
+
{
|
|
375
|
+
title: label,
|
|
376
|
+
inputId: id,
|
|
377
|
+
describedBy,
|
|
378
|
+
invalid: invalid || oversize,
|
|
379
|
+
required,
|
|
380
|
+
accept,
|
|
381
|
+
multiple,
|
|
382
|
+
actionLabel,
|
|
383
|
+
acceptedTypesLabel: accept,
|
|
384
|
+
maxSizeLabel: maxFileSizeLabel,
|
|
385
|
+
policyText: effectivePolicyText,
|
|
386
|
+
state: effectiveState,
|
|
387
|
+
selectedFiles,
|
|
388
|
+
progressValue: effectiveProgressValue,
|
|
389
|
+
error: adapterError,
|
|
390
|
+
mode: "inline",
|
|
391
|
+
retryAction: effectiveState === "upload-failed" && uploadAdapter ? /* @__PURE__ */ jsx(Button, { size: "xs", variant: "light", onClick: retryUpload, children: "Retry upload" }) : void 0,
|
|
392
|
+
removeAction: effectiveState === "upload-pending" && uploadAdapter ? /* @__PURE__ */ jsx(Button, { size: "xs", variant: "subtle", onClick: cancelUpload, children: "Cancel upload" }) : selectedFiles.length > 0 ? /* @__PURE__ */ jsx(Button, { size: "xs", variant: "subtle", onClick: removeUpload, children: "Remove" }) : void 0,
|
|
393
|
+
onFilesSelected: handleFilesSelected
|
|
394
|
+
}
|
|
395
|
+
) });
|
|
396
|
+
}
|
|
397
|
+
const visuallyHidden = {
|
|
398
|
+
position: "absolute",
|
|
399
|
+
width: 1,
|
|
400
|
+
height: 1,
|
|
401
|
+
padding: 0,
|
|
402
|
+
margin: -1,
|
|
403
|
+
overflow: "hidden",
|
|
404
|
+
clip: "rect(0, 0, 0, 0)",
|
|
405
|
+
whiteSpace: "nowrap",
|
|
406
|
+
border: 0
|
|
407
|
+
};
|
|
408
|
+
function CheckboxGroupField({ field, value, setValue, describedBy, invalid }) {
|
|
409
|
+
const selected = Array.isArray(value) ? value : [];
|
|
410
|
+
const toggle = (optionValue, checked) => {
|
|
411
|
+
setValue(checked ? [...selected, optionValue] : selected.filter((entry) => entry !== optionValue));
|
|
412
|
+
};
|
|
413
|
+
return /* @__PURE__ */ jsxs(
|
|
414
|
+
"fieldset",
|
|
415
|
+
{
|
|
416
|
+
"data-gds-checkbox-group": field.name,
|
|
417
|
+
"aria-describedby": describedBy,
|
|
418
|
+
"aria-invalid": invalid || void 0,
|
|
419
|
+
style: { border: 0, margin: 0, padding: 0, minInlineSize: "auto" },
|
|
420
|
+
children: [
|
|
421
|
+
/* @__PURE__ */ jsx("legend", { style: visuallyHidden, children: field.label }),
|
|
422
|
+
/* @__PURE__ */ jsx(Stack, { gap: 6, children: (field.options ?? []).map((option) => (
|
|
423
|
+
// Mantine Checkbox (not a raw native input) so the control inherits the GDS
|
|
424
|
+
// theme styling and the governed forced-colors remap like every other control.
|
|
425
|
+
/* @__PURE__ */ jsx(
|
|
426
|
+
Checkbox,
|
|
427
|
+
{
|
|
428
|
+
value: option.value,
|
|
429
|
+
label: option.label,
|
|
430
|
+
"aria-label": option.label,
|
|
431
|
+
checked: selected.includes(option.value),
|
|
432
|
+
onChange: (event) => toggle(option.value, event.currentTarget.checked)
|
|
433
|
+
},
|
|
434
|
+
option.value
|
|
435
|
+
)
|
|
436
|
+
)) })
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
function RepeatableField({ field, value, setValue, describedBy, invalid, renderers, uploadAdapter, onEvent }) {
|
|
442
|
+
const { t } = useGdsTranslation();
|
|
443
|
+
const rows = Array.isArray(value) ? value : [];
|
|
444
|
+
const subFields = field.fields ?? [];
|
|
445
|
+
const minRows = field.minRows ?? 0;
|
|
446
|
+
const canAdd = field.maxRows === void 0 || rows.length < field.maxRows;
|
|
447
|
+
const canRemove = rows.length > minRows;
|
|
448
|
+
const addLabel = field.addRowLabel ?? t("gds.schemaForm.addRow", "Add row");
|
|
449
|
+
const removeLabel = field.removeRowLabel ?? t("gds.schemaForm.removeRow", "Remove");
|
|
450
|
+
const rowNoun = (count) => count === 1 ? t("gds.schemaForm.rowOne", "row") : t("gds.schemaForm.rowMany", "rows");
|
|
451
|
+
const containerRef = useRef(null);
|
|
452
|
+
const addButtonRef = useRef(null);
|
|
453
|
+
const pendingFocus = useRef(null);
|
|
454
|
+
const [announcement, setAnnouncement] = useState("");
|
|
455
|
+
useEffect(() => {
|
|
456
|
+
if (pendingFocus.current === "add") {
|
|
457
|
+
const lastRow = containerRef.current?.querySelector(`[data-gds-repeatable-row="${rows.length - 1}"]`);
|
|
458
|
+
lastRow?.querySelector("input, select, textarea, button")?.focus();
|
|
459
|
+
} else if (pendingFocus.current === "remove") {
|
|
460
|
+
addButtonRef.current?.focus();
|
|
461
|
+
}
|
|
462
|
+
pendingFocus.current = null;
|
|
463
|
+
}, [rows.length]);
|
|
464
|
+
const addRow = () => {
|
|
465
|
+
pendingFocus.current = "add";
|
|
466
|
+
const next = [...rows, makeRepeatableRow(field)];
|
|
467
|
+
setValue(next);
|
|
468
|
+
setAnnouncement(`${t("gds.schemaForm.rowAdded", "Row added")}, ${next.length} ${rowNoun(next.length)}.`);
|
|
469
|
+
};
|
|
470
|
+
const removeRow = (index) => {
|
|
471
|
+
pendingFocus.current = "remove";
|
|
472
|
+
const next = rows.filter((_, rowIndex) => rowIndex !== index);
|
|
473
|
+
setValue(next);
|
|
474
|
+
setAnnouncement(`${t("gds.schemaForm.rowRemoved", "Row removed")}, ${next.length} ${rowNoun(next.length)}.`);
|
|
475
|
+
};
|
|
476
|
+
const setRowFieldValue = (index, name, next) => {
|
|
477
|
+
setValue(rows.map((row, rowIndex) => rowIndex === index ? { ...row, [name]: next } : row));
|
|
478
|
+
};
|
|
479
|
+
return /* @__PURE__ */ jsxs(Stack, { gap: "sm", ref: containerRef, "data-gds-repeatable": field.name, "aria-describedby": describedBy, "aria-invalid": invalid || void 0, children: [
|
|
480
|
+
rows.map((row, index) => /* @__PURE__ */ jsx(Paper, { withBorder: true, radius: "md", p: "sm", "data-gds-repeatable-row": index, children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
481
|
+
/* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "center", wrap: "nowrap", children: [
|
|
482
|
+
/* @__PURE__ */ jsx(Text, { size: "xs", fw: 600, c: "dimmed", children: `${field.label} ${index + 1}` }),
|
|
483
|
+
/* @__PURE__ */ jsx(
|
|
484
|
+
Button,
|
|
485
|
+
{
|
|
486
|
+
type: "button",
|
|
487
|
+
size: "xs",
|
|
488
|
+
variant: "subtle",
|
|
489
|
+
color: "red",
|
|
490
|
+
disabled: !canRemove,
|
|
491
|
+
"aria-label": `${removeLabel}: ${field.label} ${index + 1}`,
|
|
492
|
+
onClick: () => removeRow(index),
|
|
493
|
+
children: removeLabel
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
] }),
|
|
497
|
+
subFields.map((sub) => {
|
|
498
|
+
const subContext = {
|
|
499
|
+
field: sub,
|
|
500
|
+
value: row?.[sub.name],
|
|
501
|
+
setValue: (next) => setRowFieldValue(index, sub.name, next),
|
|
502
|
+
describedBy: `${field.name}-${index}-${sub.name}-description`,
|
|
503
|
+
invalid: false
|
|
504
|
+
};
|
|
505
|
+
const subRenderer = renderers[sub.name] ?? renderers[sub.type];
|
|
506
|
+
return /* @__PURE__ */ jsx(FormField, { label: `${sub.label}${sub.required ? ` ${t("gds.schemaForm.requiredMarker", "(required)")}` : ""}`, children: subRenderer ? subRenderer(subContext) : renderDefaultField(subContext, { uploadAdapter, onEvent, renderers }) }, sub.name);
|
|
507
|
+
})
|
|
508
|
+
] }) }, index)),
|
|
509
|
+
/* @__PURE__ */ jsx(Group, { children: /* @__PURE__ */ jsx(Button, { ref: addButtonRef, type: "button", size: "xs", variant: "light", disabled: !canAdd, onClick: addRow, children: addLabel }) }),
|
|
510
|
+
/* @__PURE__ */ jsx("div", { "aria-live": "polite", style: visuallyHidden, children: announcement })
|
|
511
|
+
] });
|
|
512
|
+
}
|
|
513
|
+
function renderDefaultField({ field, value, setValue, describedBy, invalid }, options = {}) {
|
|
514
|
+
const common = {
|
|
515
|
+
id: field.name,
|
|
516
|
+
"aria-label": field.label,
|
|
517
|
+
"aria-describedby": describedBy,
|
|
518
|
+
"aria-invalid": invalid || void 0,
|
|
519
|
+
required: field.required
|
|
520
|
+
};
|
|
521
|
+
if (field.type === "file-upload") {
|
|
522
|
+
return /* @__PURE__ */ jsx(
|
|
523
|
+
FileUploadField,
|
|
524
|
+
{
|
|
525
|
+
...common,
|
|
526
|
+
label: field.label,
|
|
527
|
+
field,
|
|
528
|
+
value,
|
|
529
|
+
accept: field.accept,
|
|
530
|
+
multiple: field.multiple,
|
|
531
|
+
maxFileSizeBytes: field.maxFileSizeBytes,
|
|
532
|
+
maxFileSizeLabel: field.maxFileSizeLabel,
|
|
533
|
+
actionLabel: field.uploadActionLabel,
|
|
534
|
+
policyText: field.uploadPolicyText,
|
|
535
|
+
state: field.uploadState,
|
|
536
|
+
progressValue: field.uploadProgress,
|
|
537
|
+
uploadAdapter: options.uploadAdapter,
|
|
538
|
+
onUploadEvent: options.onEvent,
|
|
539
|
+
onChange: (files) => setValue(files)
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
if (field.type === "checkbox-group") {
|
|
544
|
+
return /* @__PURE__ */ jsx(CheckboxGroupField, { field, value, setValue, describedBy, invalid });
|
|
545
|
+
}
|
|
546
|
+
if (field.type === "repeatable") {
|
|
547
|
+
return /* @__PURE__ */ jsx(
|
|
548
|
+
RepeatableField,
|
|
549
|
+
{
|
|
550
|
+
field,
|
|
551
|
+
value,
|
|
552
|
+
setValue,
|
|
553
|
+
describedBy,
|
|
554
|
+
invalid,
|
|
555
|
+
renderers: options.renderers ?? {},
|
|
556
|
+
uploadAdapter: options.uploadAdapter,
|
|
557
|
+
onEvent: options.onEvent
|
|
558
|
+
}
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
const textEntryStyle = { fontSize: "max(1rem, 1em)" };
|
|
562
|
+
if (field.type === "boolean") return /* @__PURE__ */ jsx("input", { ...common, type: "checkbox", checked: Boolean(value), onChange: (event) => setValue(event.currentTarget.checked) });
|
|
563
|
+
if (field.type === "number") return /* @__PURE__ */ jsx("input", { ...common, style: textEntryStyle, type: "number", value: String(value ?? ""), onChange: (event) => setValue(event.currentTarget.value === "" ? "" : Number(event.currentTarget.value)) });
|
|
564
|
+
if (field.type === "select") {
|
|
565
|
+
return /* @__PURE__ */ jsxs("select", { ...common, style: textEntryStyle, value: String(value ?? ""), onChange: (event) => setValue(event.currentTarget.value), children: [
|
|
566
|
+
/* @__PURE__ */ jsx("option", { value: "", children: "Select..." }),
|
|
567
|
+
(field.options ?? []).map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
|
|
568
|
+
] });
|
|
569
|
+
}
|
|
570
|
+
if (field.type === "textarea") return /* @__PURE__ */ jsx("textarea", { ...common, style: textEntryStyle, value: String(value ?? ""), onChange: (event) => setValue(event.currentTarget.value) });
|
|
571
|
+
if (field.type === "date") {
|
|
572
|
+
return /* @__PURE__ */ jsx(
|
|
573
|
+
GdsDateInput,
|
|
574
|
+
{
|
|
575
|
+
...common,
|
|
576
|
+
value: typeof value === "string" && value.length > 0 ? value : null,
|
|
577
|
+
onChange: (next) => setValue(next ? toIsoDateString(next) : "")
|
|
578
|
+
}
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
return /* @__PURE__ */ jsx("input", { ...common, style: textEntryStyle, type: field.type === "password" ? "password" : field.type === "email" ? "email" : field.type === "url" ? "url" : "text", value: String(value ?? ""), onChange: (event) => setValue(event.currentTarget.value) });
|
|
582
|
+
}
|
|
583
|
+
function GdsSchemaForm({
|
|
584
|
+
schema,
|
|
585
|
+
onSubmit,
|
|
586
|
+
renderers = {},
|
|
587
|
+
uploadAdapter,
|
|
588
|
+
onEvent,
|
|
589
|
+
submitLabel: submitLabelProp
|
|
590
|
+
}) {
|
|
591
|
+
const { t } = useGdsTranslation();
|
|
592
|
+
const submitLabel = submitLabelProp ?? t("gds.gdsSchemaForm.submitLabel", "Submit");
|
|
593
|
+
const initialValues = useMemo(() => getInitialValues(schema), [schema]);
|
|
594
|
+
const form = useGdsFormOrchestration({
|
|
595
|
+
initialValues,
|
|
596
|
+
validate: (snapshot) => validateSchemaValues(schema, Object.fromEntries(Object.entries(snapshot.fields).map(([name, field]) => [name, field.value])), renderers, { uploadAdapter, t }),
|
|
597
|
+
onSubmit: async (values) => {
|
|
598
|
+
try {
|
|
599
|
+
await onSubmit(values);
|
|
600
|
+
} catch (error) {
|
|
601
|
+
onEvent?.(createSchemaEvent("generated_submit_failed", error instanceof Error ? error.message : "Generated schema submit failed."));
|
|
602
|
+
throw error;
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
onEvent
|
|
606
|
+
});
|
|
607
|
+
return /* @__PURE__ */ jsx(GdsFormProvider, { snapshot: form.snapshot, children: /* @__PURE__ */ jsxs(Stack, { gap: "md", children: [
|
|
608
|
+
schema.title ? /* @__PURE__ */ jsx(Title, { order: 4, children: schema.title }) : null,
|
|
609
|
+
schema.description ? /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: schema.description }) : null,
|
|
610
|
+
/* @__PURE__ */ jsx(GdsValidationSummary, {}),
|
|
611
|
+
schema.fields.map((field) => {
|
|
612
|
+
if (field.hidden || field.type === "hidden") return null;
|
|
613
|
+
const issue = form.snapshot.issues.find((item) => item.field === field.name && item.severity === "blocking");
|
|
614
|
+
if (field.type === "unsupported" && !renderers[field.name] && !renderers[field.type]) {
|
|
615
|
+
return /* @__PURE__ */ jsx(StateBlock, { variant: "error", title: `Unsupported field: ${field.label}`, description: field.unsupportedReason ?? "Provide a renderer override for this field.", compact: true }, field.name);
|
|
616
|
+
}
|
|
617
|
+
const context = {
|
|
618
|
+
field,
|
|
619
|
+
value: form.snapshot.fields[field.name]?.value,
|
|
620
|
+
setValue: (next) => form.setFieldValue(field.name, next),
|
|
621
|
+
describedBy: `${field.name}-description ${field.name}-error`,
|
|
622
|
+
invalid: Boolean(issue)
|
|
623
|
+
};
|
|
624
|
+
const renderer = renderers[field.name] ?? renderers[field.type];
|
|
625
|
+
return /* @__PURE__ */ jsxs(
|
|
626
|
+
FormField,
|
|
627
|
+
{
|
|
628
|
+
label: `${field.label}${field.required ? ` ${t("gds.schemaForm.requiredMarker", "(required)")}` : ""}`,
|
|
629
|
+
description: field.description ? /* @__PURE__ */ jsx(Text, { id: `${field.name}-description`, size: "xs", c: "dimmed", children: field.description }) : void 0,
|
|
630
|
+
children: [
|
|
631
|
+
renderer ? renderer(context) : renderDefaultField(context, { uploadAdapter, onEvent, renderers }),
|
|
632
|
+
/* @__PURE__ */ jsx("span", { id: `${field.name}-error`, children: /* @__PURE__ */ jsx(ValidatedFieldMessage, { field: field.name }) })
|
|
633
|
+
]
|
|
634
|
+
},
|
|
635
|
+
field.name
|
|
636
|
+
);
|
|
637
|
+
}),
|
|
638
|
+
/* @__PURE__ */ jsx(Button, { type: "button", onClick: () => {
|
|
639
|
+
void form.submit();
|
|
640
|
+
}, loading: form.snapshot.submitState === "validating" || form.snapshot.submitState === "submitting" || form.snapshot.submitState === "optimistic", children: submitLabel })
|
|
641
|
+
] }) });
|
|
642
|
+
}
|
|
643
|
+
export {
|
|
644
|
+
FileUploadField,
|
|
645
|
+
GdsSchemaForm,
|
|
646
|
+
createGdsFormFromSchema,
|
|
647
|
+
jsonSchemaToGdsFormSchema,
|
|
648
|
+
openApiToGdsFormSchema,
|
|
649
|
+
zodToGdsFormSchema
|
|
650
|
+
};
|