@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,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var FeatureBand_exports = {};
|
|
21
|
+
__export(FeatureBand_exports, {
|
|
22
|
+
FeatureBand: () => FeatureBand
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(FeatureBand_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_core = require("@mantine/core");
|
|
27
|
+
var import_gds_theme = require("@sovereignsquad/gds-theme");
|
|
28
|
+
var import_EmptyState = require("./EmptyState");
|
|
29
|
+
var import_icons = require("./icons");
|
|
30
|
+
function FeatureBandSkeleton({
|
|
31
|
+
columns = 3,
|
|
32
|
+
bordered = true,
|
|
33
|
+
variant = "default"
|
|
34
|
+
}) {
|
|
35
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.SimpleGrid, { cols: { base: 1, sm: Math.min(columns, 2), lg: columns }, spacing: "lg", children: Array.from({ length: columns }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Paper, { withBorder: bordered, radius: "lg", p: variant === "compact" ? "md" : "lg", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Stack, { gap: "md", children: [
|
|
36
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Skeleton, { height: variant === "process" ? 28 : 42, width: variant === "process" ? 72 : 42, radius: "xl" }),
|
|
37
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Stack, { gap: "xs", children: [
|
|
38
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Skeleton, { height: 20, width: "75%", radius: "md" }),
|
|
39
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Skeleton, { height: 14, width: "100%", radius: "md" }),
|
|
40
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Skeleton, { height: 14, width: "82%", radius: "md" })
|
|
41
|
+
] })
|
|
42
|
+
] }) }, index)) });
|
|
43
|
+
}
|
|
44
|
+
function FeatureBand({
|
|
45
|
+
items,
|
|
46
|
+
columns = 3,
|
|
47
|
+
bordered = true,
|
|
48
|
+
loading = false,
|
|
49
|
+
emptyState,
|
|
50
|
+
variant = "default"
|
|
51
|
+
}) {
|
|
52
|
+
const { t } = (0, import_gds_theme.useGdsTranslation)();
|
|
53
|
+
if (loading) {
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FeatureBandSkeleton, { columns, bordered, variant });
|
|
55
|
+
}
|
|
56
|
+
if (!items.length) {
|
|
57
|
+
return emptyState ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: emptyState }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
+
import_EmptyState.EmptyState,
|
|
59
|
+
{
|
|
60
|
+
title: t("gds.featureBand.emptyTitle", "No supporting details available"),
|
|
61
|
+
description: t("gds.featureBand.emptyDescription", "Add shared feature-band items when this public surface needs trust, service, or location context.")
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Box, { component: "section", "aria-label": t("gds.featureBand.sectionLabel", "Supporting features"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.SimpleGrid, { cols: { base: 1, sm: Math.min(columns, 2), lg: columns }, spacing: "lg", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Paper, { withBorder: bordered, radius: "lg", p: variant === "compact" ? "md" : "lg", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Stack, { gap: "md", children: [
|
|
66
|
+
variant === "process" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Group, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
67
|
+
import_core.Text,
|
|
68
|
+
{
|
|
69
|
+
fw: 800,
|
|
70
|
+
size: "sm",
|
|
71
|
+
px: "sm",
|
|
72
|
+
py: 6,
|
|
73
|
+
style: {
|
|
74
|
+
borderRadius: "var(--gds-radius-pill)",
|
|
75
|
+
background: "var(--mantine-color-violet-light)"
|
|
76
|
+
},
|
|
77
|
+
children: item.stepLabel ?? `Step ${index + 1}`
|
|
78
|
+
}
|
|
79
|
+
) }) : item.media ? item.media : item.icon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Group, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ThemeIcon, { size: "xl", radius: "xl", variant: "light", color: "violet", "aria-hidden": true, children: item.icon }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Group, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ThemeIcon, { size: "xl", radius: "xl", variant: "light", color: "gray", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.GdsIcons.Info, { size: "1.25rem" }) }) }),
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Stack, { gap: "xs", children: [
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Title, { order: 4, children: item.title }),
|
|
82
|
+
item.description ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Text, { c: "dimmed", children: item.description }) : null,
|
|
83
|
+
item.meta ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Text, { size: "sm", c: "dimmed", children: item.meta }) : null
|
|
84
|
+
] })
|
|
85
|
+
] }) }, item.id)) }) });
|
|
86
|
+
}
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
FeatureBand
|
|
90
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Box, Group, Paper, SimpleGrid, Skeleton, Stack, Text, ThemeIcon, Title } from "@mantine/core";
|
|
4
|
+
import { useGdsTranslation } from "@sovereignsquad/gds-theme";
|
|
5
|
+
import { EmptyState } from "./EmptyState.mjs";
|
|
6
|
+
import { GdsIcons } from "./icons.mjs";
|
|
7
|
+
function FeatureBandSkeleton({
|
|
8
|
+
columns = 3,
|
|
9
|
+
bordered = true,
|
|
10
|
+
variant = "default"
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ jsx(SimpleGrid, { cols: { base: 1, sm: Math.min(columns, 2), lg: columns }, spacing: "lg", children: Array.from({ length: columns }).map((_, index) => /* @__PURE__ */ jsx(Paper, { withBorder: bordered, radius: "lg", p: variant === "compact" ? "md" : "lg", children: /* @__PURE__ */ jsxs(Stack, { gap: "md", children: [
|
|
13
|
+
/* @__PURE__ */ jsx(Skeleton, { height: variant === "process" ? 28 : 42, width: variant === "process" ? 72 : 42, radius: "xl" }),
|
|
14
|
+
/* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
15
|
+
/* @__PURE__ */ jsx(Skeleton, { height: 20, width: "75%", radius: "md" }),
|
|
16
|
+
/* @__PURE__ */ jsx(Skeleton, { height: 14, width: "100%", radius: "md" }),
|
|
17
|
+
/* @__PURE__ */ jsx(Skeleton, { height: 14, width: "82%", radius: "md" })
|
|
18
|
+
] })
|
|
19
|
+
] }) }, index)) });
|
|
20
|
+
}
|
|
21
|
+
function FeatureBand({
|
|
22
|
+
items,
|
|
23
|
+
columns = 3,
|
|
24
|
+
bordered = true,
|
|
25
|
+
loading = false,
|
|
26
|
+
emptyState,
|
|
27
|
+
variant = "default"
|
|
28
|
+
}) {
|
|
29
|
+
const { t } = useGdsTranslation();
|
|
30
|
+
if (loading) {
|
|
31
|
+
return /* @__PURE__ */ jsx(FeatureBandSkeleton, { columns, bordered, variant });
|
|
32
|
+
}
|
|
33
|
+
if (!items.length) {
|
|
34
|
+
return emptyState ? /* @__PURE__ */ jsx(Fragment, { children: emptyState }) : /* @__PURE__ */ jsx(
|
|
35
|
+
EmptyState,
|
|
36
|
+
{
|
|
37
|
+
title: t("gds.featureBand.emptyTitle", "No supporting details available"),
|
|
38
|
+
description: t("gds.featureBand.emptyDescription", "Add shared feature-band items when this public surface needs trust, service, or location context.")
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return /* @__PURE__ */ jsx(Box, { component: "section", "aria-label": t("gds.featureBand.sectionLabel", "Supporting features"), children: /* @__PURE__ */ jsx(SimpleGrid, { cols: { base: 1, sm: Math.min(columns, 2), lg: columns }, spacing: "lg", children: items.map((item, index) => /* @__PURE__ */ jsx(Paper, { withBorder: bordered, radius: "lg", p: variant === "compact" ? "md" : "lg", children: /* @__PURE__ */ jsxs(Stack, { gap: "md", children: [
|
|
43
|
+
variant === "process" ? /* @__PURE__ */ jsx(Group, { children: /* @__PURE__ */ jsx(
|
|
44
|
+
Text,
|
|
45
|
+
{
|
|
46
|
+
fw: 800,
|
|
47
|
+
size: "sm",
|
|
48
|
+
px: "sm",
|
|
49
|
+
py: 6,
|
|
50
|
+
style: {
|
|
51
|
+
borderRadius: "var(--gds-radius-pill)",
|
|
52
|
+
background: "var(--mantine-color-violet-light)"
|
|
53
|
+
},
|
|
54
|
+
children: item.stepLabel ?? `Step ${index + 1}`
|
|
55
|
+
}
|
|
56
|
+
) }) : item.media ? item.media : item.icon ? /* @__PURE__ */ jsx(Group, { children: /* @__PURE__ */ jsx(ThemeIcon, { size: "xl", radius: "xl", variant: "light", color: "violet", "aria-hidden": true, children: item.icon }) }) : /* @__PURE__ */ jsx(Group, { children: /* @__PURE__ */ jsx(ThemeIcon, { size: "xl", radius: "xl", variant: "light", color: "gray", "aria-hidden": true, children: /* @__PURE__ */ jsx(GdsIcons.Info, { size: "1.25rem" }) }) }),
|
|
57
|
+
/* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
58
|
+
/* @__PURE__ */ jsx(Title, { order: 4, children: item.title }),
|
|
59
|
+
item.description ? /* @__PURE__ */ jsx(Text, { c: "dimmed", children: item.description }) : null,
|
|
60
|
+
item.meta ? /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: item.meta }) : null
|
|
61
|
+
] })
|
|
62
|
+
] }) }, item.id)) }) });
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
FeatureBand
|
|
66
|
+
};
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var FeedbackRuntime_client_exports = {};
|
|
21
|
+
__export(FeedbackRuntime_client_exports, {
|
|
22
|
+
GdsConfirmProvider: () => GdsConfirmProvider,
|
|
23
|
+
GdsToastProvider: () => GdsToastProvider,
|
|
24
|
+
useGdsConfirm: () => useGdsConfirm,
|
|
25
|
+
useGdsToasts: () => useGdsToasts
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(FeedbackRuntime_client_exports);
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_gds_theme = require("@sovereignsquad/gds-theme");
|
|
31
|
+
var import_core = require("@mantine/core");
|
|
32
|
+
var import_ConfirmDialog = require("./ConfirmDialog");
|
|
33
|
+
var import_Notifications = require("./Notifications.client");
|
|
34
|
+
const GdsConfirmContext = (0, import_react.createContext)(null);
|
|
35
|
+
function createConfirmationEvent(type, request, status) {
|
|
36
|
+
return {
|
|
37
|
+
type,
|
|
38
|
+
id: request.id ?? "confirmation",
|
|
39
|
+
riskLevel: request.riskLevel ?? (request.danger ? "high" : "medium"),
|
|
40
|
+
status,
|
|
41
|
+
timestamp: Date.now(),
|
|
42
|
+
privacy: "metadata-only"
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function timeoutPromise(timeoutMs) {
|
|
46
|
+
return new Promise((_, reject) => {
|
|
47
|
+
window.setTimeout(() => reject(new Error("Confirmation action timed out.")), timeoutMs);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function GdsConfirmProvider({
|
|
51
|
+
children,
|
|
52
|
+
defaultTimeoutMs = 1e4,
|
|
53
|
+
onConfirmationEvent
|
|
54
|
+
}) {
|
|
55
|
+
const { t } = (0, import_gds_theme.useGdsTranslation)();
|
|
56
|
+
const [activeRequest, setActiveRequest] = (0, import_react.useState)(null);
|
|
57
|
+
const [undoState, setUndoState] = (0, import_react.useState)(null);
|
|
58
|
+
const activeResolver = (0, import_react.useRef)(null);
|
|
59
|
+
const actionResolver = (0, import_react.useRef)(null);
|
|
60
|
+
const focusReturnTarget = (0, import_react.useRef)(null);
|
|
61
|
+
const emit = (0, import_react.useCallback)((type, request, status) => {
|
|
62
|
+
onConfirmationEvent?.(createConfirmationEvent(type, request, status));
|
|
63
|
+
}, [onConfirmationEvent]);
|
|
64
|
+
const restoreFocus = (0, import_react.useCallback)(() => {
|
|
65
|
+
const target = focusReturnTarget.current;
|
|
66
|
+
focusReturnTarget.current = null;
|
|
67
|
+
if (target) window.setTimeout(() => target.focus(), 0);
|
|
68
|
+
}, []);
|
|
69
|
+
const openConfirm = (0, import_react.useCallback)((request) => new Promise((resolve) => {
|
|
70
|
+
if (activeResolver.current) {
|
|
71
|
+
activeResolver.current(false);
|
|
72
|
+
}
|
|
73
|
+
focusReturnTarget.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
74
|
+
activeResolver.current = resolve;
|
|
75
|
+
emit("opened", request, "open");
|
|
76
|
+
setActiveRequest({ ...request, mode: "boolean", status: "open", resolve });
|
|
77
|
+
}), [emit]);
|
|
78
|
+
const openActionConfirm = (0, import_react.useCallback)((request) => new Promise((resolve) => {
|
|
79
|
+
if (actionResolver.current) {
|
|
80
|
+
actionResolver.current({ status: "cancelled" });
|
|
81
|
+
}
|
|
82
|
+
focusReturnTarget.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
83
|
+
const resolver = resolve;
|
|
84
|
+
actionResolver.current = resolver;
|
|
85
|
+
emit("opened", request, "open");
|
|
86
|
+
const isDanger = request.danger ?? (request.riskLevel === "high" || request.riskLevel === "critical");
|
|
87
|
+
setActiveRequest({
|
|
88
|
+
...request,
|
|
89
|
+
mode: "action",
|
|
90
|
+
status: "open",
|
|
91
|
+
danger: isDanger,
|
|
92
|
+
confirmAction: request.confirmAction ?? (isDanger ? "delete" : "confirm"),
|
|
93
|
+
resolve: resolver
|
|
94
|
+
});
|
|
95
|
+
}), [emit]);
|
|
96
|
+
const resolveActive = (0, import_react.useCallback)((confirmed) => {
|
|
97
|
+
if (activeRequest?.mode === "boolean") {
|
|
98
|
+
emit(confirmed ? "confirmed" : "cancelled", activeRequest, confirmed ? "succeeded" : "cancelled");
|
|
99
|
+
}
|
|
100
|
+
activeResolver.current?.(confirmed);
|
|
101
|
+
activeResolver.current = null;
|
|
102
|
+
setActiveRequest(null);
|
|
103
|
+
restoreFocus();
|
|
104
|
+
}, [activeRequest, emit, restoreFocus]);
|
|
105
|
+
const cancelAction = (0, import_react.useCallback)(() => {
|
|
106
|
+
if (activeRequest?.mode === "action") {
|
|
107
|
+
emit("cancelled", activeRequest, "cancelled");
|
|
108
|
+
actionResolver.current?.({ status: "cancelled", payload: activeRequest.payload });
|
|
109
|
+
actionResolver.current = null;
|
|
110
|
+
}
|
|
111
|
+
setActiveRequest(null);
|
|
112
|
+
restoreFocus();
|
|
113
|
+
}, [activeRequest, emit, restoreFocus]);
|
|
114
|
+
const runAction = (0, import_react.useCallback)(async (retry = false) => {
|
|
115
|
+
if (!activeRequest || activeRequest.mode !== "action") return;
|
|
116
|
+
const request = activeRequest;
|
|
117
|
+
if (retry) emit("retry", request, "executing");
|
|
118
|
+
setActiveRequest({ ...request, status: request.validateTarget ? "validating" : "executing", error: void 0 });
|
|
119
|
+
try {
|
|
120
|
+
if (request.validateTarget) {
|
|
121
|
+
const validation = await request.validateTarget(request.payload);
|
|
122
|
+
if (validation !== true) {
|
|
123
|
+
throw new Error(typeof validation === "string" ? validation : "Target could not be validated.");
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
setActiveRequest({ ...request, status: "executing", error: void 0 });
|
|
127
|
+
if (request.execute) {
|
|
128
|
+
await Promise.race([
|
|
129
|
+
request.execute(request.payload),
|
|
130
|
+
timeoutPromise(request.timeoutMs ?? defaultTimeoutMs)
|
|
131
|
+
]);
|
|
132
|
+
}
|
|
133
|
+
emit("confirmed", request, request.undo ? "undoable" : "succeeded");
|
|
134
|
+
if (request.undo) {
|
|
135
|
+
const expiresAt = Date.now() + request.undo.windowMs;
|
|
136
|
+
const undoPolicy = request.undo;
|
|
137
|
+
setUndoState({
|
|
138
|
+
id: request.id ?? "confirmation-undo",
|
|
139
|
+
label: undoPolicy.label,
|
|
140
|
+
expiresAt,
|
|
141
|
+
onUndo: async () => {
|
|
142
|
+
emit("undo_started", request, "undoable");
|
|
143
|
+
await undoPolicy.onUndo(request.payload);
|
|
144
|
+
emit("undo_completed", request, "succeeded");
|
|
145
|
+
setUndoState(null);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
window.setTimeout(() => {
|
|
149
|
+
setUndoState((current) => current?.expiresAt === expiresAt ? null : current);
|
|
150
|
+
}, request.undo.windowMs);
|
|
151
|
+
actionResolver.current?.({ status: "undoable", payload: request.payload, undoUntil: expiresAt });
|
|
152
|
+
} else {
|
|
153
|
+
actionResolver.current?.({ status: "succeeded", payload: request.payload });
|
|
154
|
+
}
|
|
155
|
+
actionResolver.current = null;
|
|
156
|
+
setActiveRequest(null);
|
|
157
|
+
restoreFocus();
|
|
158
|
+
} catch (error) {
|
|
159
|
+
const message = error instanceof Error ? error.message : void 0;
|
|
160
|
+
emit("failed", request, "failed");
|
|
161
|
+
setActiveRequest({ ...request, status: "failed", error: message });
|
|
162
|
+
}
|
|
163
|
+
}, [activeRequest, defaultTimeoutMs, emit, restoreFocus]);
|
|
164
|
+
const value = (0, import_react.useMemo)(() => ({
|
|
165
|
+
confirm: openConfirm,
|
|
166
|
+
confirmDestructive: (request) => openConfirm({ ...request, danger: true, confirmAction: request.confirmAction ?? "delete" }),
|
|
167
|
+
confirmAction: openActionConfirm
|
|
168
|
+
}), [openActionConfirm, openConfirm]);
|
|
169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(GdsConfirmContext.Provider, { value, children: [
|
|
170
|
+
children,
|
|
171
|
+
undoState ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Paper, { withBorder: true, radius: "md", p: "sm", mb: "sm", role: "status", "aria-live": "polite", "aria-label": t("gds.confirm.undoTitle", "Action can be undone"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Group, { justify: "space-between", children: [
|
|
172
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Stack, { gap: 2, children: [
|
|
173
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Text, { fw: 700, size: "sm", children: t("gds.confirm.undoTitle", "Action can be undone") }),
|
|
174
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Text, { size: "sm", children: t("gds.confirm.undoDescription", "Undo is available until the recovery window expires.") })
|
|
175
|
+
] }),
|
|
176
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Button, { size: "xs", variant: "default", onClick: () => {
|
|
177
|
+
void undoState.onUndo();
|
|
178
|
+
}, children: undoState.label ?? t("gds.confirm.undo", "Undo") })
|
|
179
|
+
] }) }) : null,
|
|
180
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
181
|
+
import_ConfirmDialog.ConfirmDialog,
|
|
182
|
+
{
|
|
183
|
+
opened: Boolean(activeRequest),
|
|
184
|
+
onClose: () => activeRequest?.mode === "action" ? cancelAction() : resolveActive(false),
|
|
185
|
+
onConfirm: () => activeRequest?.mode === "action" ? void runAction(activeRequest.status === "failed") : resolveActive(true),
|
|
186
|
+
title: activeRequest?.title ?? "",
|
|
187
|
+
confirmAction: activeRequest?.confirmAction ?? (activeRequest?.danger ? "delete" : "confirm"),
|
|
188
|
+
cancelAction: activeRequest?.cancelAction ?? "cancel",
|
|
189
|
+
isDanger: activeRequest?.danger ?? false,
|
|
190
|
+
loading: activeRequest?.status === "executing" || activeRequest?.status === "validating",
|
|
191
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Stack, { gap: "xs", children: [
|
|
192
|
+
activeRequest?.targetName ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: activeRequest.targetName }) : null,
|
|
193
|
+
activeRequest?.targetName ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}) : null,
|
|
194
|
+
activeRequest?.message,
|
|
195
|
+
activeRequest?.consequence ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
196
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
197
|
+
activeRequest.consequence
|
|
198
|
+
] }) : null,
|
|
199
|
+
activeRequest?.mode === "action" && activeRequest.preview ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: activeRequest.preview }) : null,
|
|
200
|
+
activeRequest?.mode === "action" && activeRequest.status === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Alert, { color: "red", title: t("gds.confirm.failedTitle", "Action failed"), role: "alert", children: [
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Text, { size: "sm", children: activeRequest.error ?? t("gds.confirm.failedDescription", "The action did not complete.") }),
|
|
202
|
+
activeRequest.retryable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Text, { size: "xs", children: t("gds.confirm.retryHint", "Use the primary action to retry.") }) : null
|
|
203
|
+
] }) : null
|
|
204
|
+
] })
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
] });
|
|
208
|
+
}
|
|
209
|
+
function useGdsConfirm() {
|
|
210
|
+
const context = (0, import_react.useContext)(GdsConfirmContext);
|
|
211
|
+
if (!context) {
|
|
212
|
+
throw new Error("useGdsConfirm must be used within GdsConfirmProvider.");
|
|
213
|
+
}
|
|
214
|
+
return context;
|
|
215
|
+
}
|
|
216
|
+
const GdsToastContext = (0, import_react.createContext)(null);
|
|
217
|
+
function createToastId(prefix) {
|
|
218
|
+
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
219
|
+
}
|
|
220
|
+
function GdsToastProvider({ children, viewport = true }) {
|
|
221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Notifications.GdsNotificationProvider, { children: [
|
|
222
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(GdsToastProviderInner, { children }),
|
|
223
|
+
viewport ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Notifications.GdsToastViewport, { ...viewport === true ? {} : viewport }) : null
|
|
224
|
+
] });
|
|
225
|
+
}
|
|
226
|
+
function GdsToastProviderInner({ children }) {
|
|
227
|
+
const { notify } = (0, import_Notifications.useGdsNotifications)();
|
|
228
|
+
const value = (0, import_react.useMemo)(() => ({
|
|
229
|
+
notifySuccess: (message) => notify({
|
|
230
|
+
...message,
|
|
231
|
+
id: message.id ?? createToastId("success"),
|
|
232
|
+
severity: "success",
|
|
233
|
+
autoCloseMs: message.autoCloseMs ?? 4e3
|
|
234
|
+
}),
|
|
235
|
+
notifyError: (message) => notify({
|
|
236
|
+
...message,
|
|
237
|
+
id: message.id ?? createToastId("error"),
|
|
238
|
+
severity: "error",
|
|
239
|
+
autoCloseMs: message.autoCloseMs ?? false,
|
|
240
|
+
retry: message.retry ? { onRetry: message.retry, maxAttempts: 3 } : void 0
|
|
241
|
+
}),
|
|
242
|
+
notifyActionComplete: (message) => notify({
|
|
243
|
+
...message,
|
|
244
|
+
id: message.id ?? createToastId("complete"),
|
|
245
|
+
severity: "success",
|
|
246
|
+
autoCloseMs: message.autoCloseMs ?? 3e3
|
|
247
|
+
})
|
|
248
|
+
}), [notify]);
|
|
249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GdsToastContext.Provider, { value, children });
|
|
250
|
+
}
|
|
251
|
+
function useGdsToasts() {
|
|
252
|
+
const context = (0, import_react.useContext)(GdsToastContext);
|
|
253
|
+
if (!context) {
|
|
254
|
+
throw new Error("useGdsToasts must be used within GdsToastProvider.");
|
|
255
|
+
}
|
|
256
|
+
return context;
|
|
257
|
+
}
|
|
258
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
259
|
+
0 && (module.exports = {
|
|
260
|
+
GdsConfirmProvider,
|
|
261
|
+
GdsToastProvider,
|
|
262
|
+
useGdsConfirm,
|
|
263
|
+
useGdsToasts
|
|
264
|
+
});
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { useGdsTranslation } from "@sovereignsquad/gds-theme";
|
|
5
|
+
import { Alert, Button, Group, Paper, Stack, Text } from "@mantine/core";
|
|
6
|
+
import { ConfirmDialog } from "./ConfirmDialog.mjs";
|
|
7
|
+
import { GdsNotificationProvider, GdsToastViewport, useGdsNotifications } from "./Notifications.client.mjs";
|
|
8
|
+
const GdsConfirmContext = createContext(null);
|
|
9
|
+
function createConfirmationEvent(type, request, status) {
|
|
10
|
+
return {
|
|
11
|
+
type,
|
|
12
|
+
id: request.id ?? "confirmation",
|
|
13
|
+
riskLevel: request.riskLevel ?? (request.danger ? "high" : "medium"),
|
|
14
|
+
status,
|
|
15
|
+
timestamp: Date.now(),
|
|
16
|
+
privacy: "metadata-only"
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function timeoutPromise(timeoutMs) {
|
|
20
|
+
return new Promise((_, reject) => {
|
|
21
|
+
window.setTimeout(() => reject(new Error("Confirmation action timed out.")), timeoutMs);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function GdsConfirmProvider({
|
|
25
|
+
children,
|
|
26
|
+
defaultTimeoutMs = 1e4,
|
|
27
|
+
onConfirmationEvent
|
|
28
|
+
}) {
|
|
29
|
+
const { t } = useGdsTranslation();
|
|
30
|
+
const [activeRequest, setActiveRequest] = useState(null);
|
|
31
|
+
const [undoState, setUndoState] = useState(null);
|
|
32
|
+
const activeResolver = useRef(null);
|
|
33
|
+
const actionResolver = useRef(null);
|
|
34
|
+
const focusReturnTarget = useRef(null);
|
|
35
|
+
const emit = useCallback((type, request, status) => {
|
|
36
|
+
onConfirmationEvent?.(createConfirmationEvent(type, request, status));
|
|
37
|
+
}, [onConfirmationEvent]);
|
|
38
|
+
const restoreFocus = useCallback(() => {
|
|
39
|
+
const target = focusReturnTarget.current;
|
|
40
|
+
focusReturnTarget.current = null;
|
|
41
|
+
if (target) window.setTimeout(() => target.focus(), 0);
|
|
42
|
+
}, []);
|
|
43
|
+
const openConfirm = useCallback((request) => new Promise((resolve) => {
|
|
44
|
+
if (activeResolver.current) {
|
|
45
|
+
activeResolver.current(false);
|
|
46
|
+
}
|
|
47
|
+
focusReturnTarget.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
48
|
+
activeResolver.current = resolve;
|
|
49
|
+
emit("opened", request, "open");
|
|
50
|
+
setActiveRequest({ ...request, mode: "boolean", status: "open", resolve });
|
|
51
|
+
}), [emit]);
|
|
52
|
+
const openActionConfirm = useCallback((request) => new Promise((resolve) => {
|
|
53
|
+
if (actionResolver.current) {
|
|
54
|
+
actionResolver.current({ status: "cancelled" });
|
|
55
|
+
}
|
|
56
|
+
focusReturnTarget.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
57
|
+
const resolver = resolve;
|
|
58
|
+
actionResolver.current = resolver;
|
|
59
|
+
emit("opened", request, "open");
|
|
60
|
+
const isDanger = request.danger ?? (request.riskLevel === "high" || request.riskLevel === "critical");
|
|
61
|
+
setActiveRequest({
|
|
62
|
+
...request,
|
|
63
|
+
mode: "action",
|
|
64
|
+
status: "open",
|
|
65
|
+
danger: isDanger,
|
|
66
|
+
confirmAction: request.confirmAction ?? (isDanger ? "delete" : "confirm"),
|
|
67
|
+
resolve: resolver
|
|
68
|
+
});
|
|
69
|
+
}), [emit]);
|
|
70
|
+
const resolveActive = useCallback((confirmed) => {
|
|
71
|
+
if (activeRequest?.mode === "boolean") {
|
|
72
|
+
emit(confirmed ? "confirmed" : "cancelled", activeRequest, confirmed ? "succeeded" : "cancelled");
|
|
73
|
+
}
|
|
74
|
+
activeResolver.current?.(confirmed);
|
|
75
|
+
activeResolver.current = null;
|
|
76
|
+
setActiveRequest(null);
|
|
77
|
+
restoreFocus();
|
|
78
|
+
}, [activeRequest, emit, restoreFocus]);
|
|
79
|
+
const cancelAction = useCallback(() => {
|
|
80
|
+
if (activeRequest?.mode === "action") {
|
|
81
|
+
emit("cancelled", activeRequest, "cancelled");
|
|
82
|
+
actionResolver.current?.({ status: "cancelled", payload: activeRequest.payload });
|
|
83
|
+
actionResolver.current = null;
|
|
84
|
+
}
|
|
85
|
+
setActiveRequest(null);
|
|
86
|
+
restoreFocus();
|
|
87
|
+
}, [activeRequest, emit, restoreFocus]);
|
|
88
|
+
const runAction = useCallback(async (retry = false) => {
|
|
89
|
+
if (!activeRequest || activeRequest.mode !== "action") return;
|
|
90
|
+
const request = activeRequest;
|
|
91
|
+
if (retry) emit("retry", request, "executing");
|
|
92
|
+
setActiveRequest({ ...request, status: request.validateTarget ? "validating" : "executing", error: void 0 });
|
|
93
|
+
try {
|
|
94
|
+
if (request.validateTarget) {
|
|
95
|
+
const validation = await request.validateTarget(request.payload);
|
|
96
|
+
if (validation !== true) {
|
|
97
|
+
throw new Error(typeof validation === "string" ? validation : "Target could not be validated.");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
setActiveRequest({ ...request, status: "executing", error: void 0 });
|
|
101
|
+
if (request.execute) {
|
|
102
|
+
await Promise.race([
|
|
103
|
+
request.execute(request.payload),
|
|
104
|
+
timeoutPromise(request.timeoutMs ?? defaultTimeoutMs)
|
|
105
|
+
]);
|
|
106
|
+
}
|
|
107
|
+
emit("confirmed", request, request.undo ? "undoable" : "succeeded");
|
|
108
|
+
if (request.undo) {
|
|
109
|
+
const expiresAt = Date.now() + request.undo.windowMs;
|
|
110
|
+
const undoPolicy = request.undo;
|
|
111
|
+
setUndoState({
|
|
112
|
+
id: request.id ?? "confirmation-undo",
|
|
113
|
+
label: undoPolicy.label,
|
|
114
|
+
expiresAt,
|
|
115
|
+
onUndo: async () => {
|
|
116
|
+
emit("undo_started", request, "undoable");
|
|
117
|
+
await undoPolicy.onUndo(request.payload);
|
|
118
|
+
emit("undo_completed", request, "succeeded");
|
|
119
|
+
setUndoState(null);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
window.setTimeout(() => {
|
|
123
|
+
setUndoState((current) => current?.expiresAt === expiresAt ? null : current);
|
|
124
|
+
}, request.undo.windowMs);
|
|
125
|
+
actionResolver.current?.({ status: "undoable", payload: request.payload, undoUntil: expiresAt });
|
|
126
|
+
} else {
|
|
127
|
+
actionResolver.current?.({ status: "succeeded", payload: request.payload });
|
|
128
|
+
}
|
|
129
|
+
actionResolver.current = null;
|
|
130
|
+
setActiveRequest(null);
|
|
131
|
+
restoreFocus();
|
|
132
|
+
} catch (error) {
|
|
133
|
+
const message = error instanceof Error ? error.message : void 0;
|
|
134
|
+
emit("failed", request, "failed");
|
|
135
|
+
setActiveRequest({ ...request, status: "failed", error: message });
|
|
136
|
+
}
|
|
137
|
+
}, [activeRequest, defaultTimeoutMs, emit, restoreFocus]);
|
|
138
|
+
const value = useMemo(() => ({
|
|
139
|
+
confirm: openConfirm,
|
|
140
|
+
confirmDestructive: (request) => openConfirm({ ...request, danger: true, confirmAction: request.confirmAction ?? "delete" }),
|
|
141
|
+
confirmAction: openActionConfirm
|
|
142
|
+
}), [openActionConfirm, openConfirm]);
|
|
143
|
+
return /* @__PURE__ */ jsxs(GdsConfirmContext.Provider, { value, children: [
|
|
144
|
+
children,
|
|
145
|
+
undoState ? /* @__PURE__ */ jsx(Paper, { withBorder: true, radius: "md", p: "sm", mb: "sm", role: "status", "aria-live": "polite", "aria-label": t("gds.confirm.undoTitle", "Action can be undone"), children: /* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
146
|
+
/* @__PURE__ */ jsxs(Stack, { gap: 2, children: [
|
|
147
|
+
/* @__PURE__ */ jsx(Text, { fw: 700, size: "sm", children: t("gds.confirm.undoTitle", "Action can be undone") }),
|
|
148
|
+
/* @__PURE__ */ jsx(Text, { size: "sm", children: t("gds.confirm.undoDescription", "Undo is available until the recovery window expires.") })
|
|
149
|
+
] }),
|
|
150
|
+
/* @__PURE__ */ jsx(Button, { size: "xs", variant: "default", onClick: () => {
|
|
151
|
+
void undoState.onUndo();
|
|
152
|
+
}, children: undoState.label ?? t("gds.confirm.undo", "Undo") })
|
|
153
|
+
] }) }) : null,
|
|
154
|
+
/* @__PURE__ */ jsx(
|
|
155
|
+
ConfirmDialog,
|
|
156
|
+
{
|
|
157
|
+
opened: Boolean(activeRequest),
|
|
158
|
+
onClose: () => activeRequest?.mode === "action" ? cancelAction() : resolveActive(false),
|
|
159
|
+
onConfirm: () => activeRequest?.mode === "action" ? void runAction(activeRequest.status === "failed") : resolveActive(true),
|
|
160
|
+
title: activeRequest?.title ?? "",
|
|
161
|
+
confirmAction: activeRequest?.confirmAction ?? (activeRequest?.danger ? "delete" : "confirm"),
|
|
162
|
+
cancelAction: activeRequest?.cancelAction ?? "cancel",
|
|
163
|
+
isDanger: activeRequest?.danger ?? false,
|
|
164
|
+
loading: activeRequest?.status === "executing" || activeRequest?.status === "validating",
|
|
165
|
+
children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
166
|
+
activeRequest?.targetName ? /* @__PURE__ */ jsx("strong", { children: activeRequest.targetName }) : null,
|
|
167
|
+
activeRequest?.targetName ? /* @__PURE__ */ jsx("br", {}) : null,
|
|
168
|
+
activeRequest?.message,
|
|
169
|
+
activeRequest?.consequence ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
170
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
171
|
+
activeRequest.consequence
|
|
172
|
+
] }) : null,
|
|
173
|
+
activeRequest?.mode === "action" && activeRequest.preview ? /* @__PURE__ */ jsx("div", { children: activeRequest.preview }) : null,
|
|
174
|
+
activeRequest?.mode === "action" && activeRequest.status === "failed" ? /* @__PURE__ */ jsxs(Alert, { color: "red", title: t("gds.confirm.failedTitle", "Action failed"), role: "alert", children: [
|
|
175
|
+
/* @__PURE__ */ jsx(Text, { size: "sm", children: activeRequest.error ?? t("gds.confirm.failedDescription", "The action did not complete.") }),
|
|
176
|
+
activeRequest.retryable ? /* @__PURE__ */ jsx(Text, { size: "xs", children: t("gds.confirm.retryHint", "Use the primary action to retry.") }) : null
|
|
177
|
+
] }) : null
|
|
178
|
+
] })
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
] });
|
|
182
|
+
}
|
|
183
|
+
function useGdsConfirm() {
|
|
184
|
+
const context = useContext(GdsConfirmContext);
|
|
185
|
+
if (!context) {
|
|
186
|
+
throw new Error("useGdsConfirm must be used within GdsConfirmProvider.");
|
|
187
|
+
}
|
|
188
|
+
return context;
|
|
189
|
+
}
|
|
190
|
+
const GdsToastContext = createContext(null);
|
|
191
|
+
function createToastId(prefix) {
|
|
192
|
+
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
193
|
+
}
|
|
194
|
+
function GdsToastProvider({ children, viewport = true }) {
|
|
195
|
+
return /* @__PURE__ */ jsxs(GdsNotificationProvider, { children: [
|
|
196
|
+
/* @__PURE__ */ jsx(GdsToastProviderInner, { children }),
|
|
197
|
+
viewport ? /* @__PURE__ */ jsx(GdsToastViewport, { ...viewport === true ? {} : viewport }) : null
|
|
198
|
+
] });
|
|
199
|
+
}
|
|
200
|
+
function GdsToastProviderInner({ children }) {
|
|
201
|
+
const { notify } = useGdsNotifications();
|
|
202
|
+
const value = useMemo(() => ({
|
|
203
|
+
notifySuccess: (message) => notify({
|
|
204
|
+
...message,
|
|
205
|
+
id: message.id ?? createToastId("success"),
|
|
206
|
+
severity: "success",
|
|
207
|
+
autoCloseMs: message.autoCloseMs ?? 4e3
|
|
208
|
+
}),
|
|
209
|
+
notifyError: (message) => notify({
|
|
210
|
+
...message,
|
|
211
|
+
id: message.id ?? createToastId("error"),
|
|
212
|
+
severity: "error",
|
|
213
|
+
autoCloseMs: message.autoCloseMs ?? false,
|
|
214
|
+
retry: message.retry ? { onRetry: message.retry, maxAttempts: 3 } : void 0
|
|
215
|
+
}),
|
|
216
|
+
notifyActionComplete: (message) => notify({
|
|
217
|
+
...message,
|
|
218
|
+
id: message.id ?? createToastId("complete"),
|
|
219
|
+
severity: "success",
|
|
220
|
+
autoCloseMs: message.autoCloseMs ?? 3e3
|
|
221
|
+
})
|
|
222
|
+
}), [notify]);
|
|
223
|
+
return /* @__PURE__ */ jsx(GdsToastContext.Provider, { value, children });
|
|
224
|
+
}
|
|
225
|
+
function useGdsToasts() {
|
|
226
|
+
const context = useContext(GdsToastContext);
|
|
227
|
+
if (!context) {
|
|
228
|
+
throw new Error("useGdsToasts must be used within GdsToastProvider.");
|
|
229
|
+
}
|
|
230
|
+
return context;
|
|
231
|
+
}
|
|
232
|
+
export {
|
|
233
|
+
GdsConfirmProvider,
|
|
234
|
+
GdsToastProvider,
|
|
235
|
+
useGdsConfirm,
|
|
236
|
+
useGdsToasts
|
|
237
|
+
};
|