@backstage/plugin-app 0.4.3 → 0.4.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @backstage/plugin-app
2
2
 
3
+ ## 0.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 23fb582: Migrated React Aria imports from individual packages (`@react-aria/toast`, `@react-aria/button`, `@react-stately/toast`) to the monopackages (`react-aria`, `react-stately`).
8
+ - 6b60bd7: Replaced old config schema values from existing extensions and blueprints.
9
+ - Updated dependencies
10
+ - @backstage/ui@0.14.1
11
+ - @backstage/frontend-plugin-api@0.16.1
12
+
3
13
  ## 0.4.3
4
14
 
5
15
  ### Patch Changes
@@ -1,7 +1,6 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { forwardRef, useRef, useState, useLayoutEffect } from 'react';
3
- import { useToast } from '@react-aria/toast';
4
- import { useButton } from '@react-aria/button';
3
+ import { useToast, useButton } from 'react-aria';
5
4
  import { motion } from 'motion/react';
6
5
  import { Box } from '@backstage/ui';
7
6
  import { RiCloseLine, RiInformationLine, RiAlertLine, RiErrorWarningLine, RiCheckLine } from '@remixicon/react';
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.esm.js","sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, Ref, useRef, useLayoutEffect, useState } from 'react';\nimport { useToast } from '@react-aria/toast';\nimport { useButton } from '@react-aria/button';\nimport { motion } from 'motion/react';\nimport { Box } from '@backstage/ui';\nimport {\n RiInformationLine,\n RiCheckLine,\n RiErrorWarningLine,\n RiAlertLine,\n RiCloseLine,\n} from '@remixicon/react';\nimport type { ToastApiMessageProps } from './types';\nimport styles from './Toast.module.css';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { BgReset } from '../../../../../packages/ui/src/hooks/useBg';\n\n// Track which toasts are being manually closed (vs auto-timeout)\n// This allows different exit animations for each case\nconst manuallyClosingToasts = new Set<string>();\n\n/**\n * A Toast displays a brief, temporary notification of actions, errors, or other events in an application.\n *\n * @remarks\n * The Toast component is used internally by ToastContainer and managed by a ToastQueue.\n * It supports multiple status variants (neutral, info, success, warning, danger) and can display\n * a title and description. Toasts can be dismissed manually or automatically.\n *\n * @internal\n */\nexport const Toast = forwardRef(\n (props: ToastApiMessageProps, ref: Ref<HTMLDivElement>) => {\n const {\n toast,\n state,\n index = 0,\n isExpanded = false,\n onClose,\n status,\n expandedY: expandedYProp = 0,\n collapsedHeight,\n naturalHeight,\n onHeightChange,\n } = props;\n\n // Use internal ref if none provided\n const internalRef = useRef<HTMLDivElement>(null);\n const toastRef = (ref as React.RefObject<HTMLDivElement>) || internalRef;\n\n // Get ARIA props from useToast hook\n const { toastProps, titleProps, closeButtonProps } = useToast(\n { toast },\n state,\n toastRef,\n );\n\n // Close button ref for useButton hook\n const closeButtonRef = useRef<HTMLButtonElement>(null);\n\n // Extract only ARIA and accessibility props from toastProps to avoid\n // conflicts with motion.div's event handler types (motion has its own drag API)\n const ariaProps = {\n role: toastProps.role,\n tabIndex: toastProps.tabIndex,\n 'aria-label': toastProps['aria-label'],\n 'aria-labelledby': toastProps['aria-labelledby'],\n 'aria-describedby': toastProps['aria-describedby'],\n 'aria-posinset': toastProps['aria-posinset'],\n 'aria-setsize': toastProps['aria-setsize'],\n };\n\n // Track whether we've measured this toast's natural height\n const [hasMeasured, setHasMeasured] = useState(false);\n // Store the measured natural height locally to avoid re-measurement issues\n const naturalHeightRef = useRef<number | null>(null);\n\n // Measure this toast's natural height on mount (before paint)\n // Using useLayoutEffect ensures we measure before the browser paints\n useLayoutEffect(() => {\n if (!onHeightChange) return;\n if (naturalHeightRef.current) return; // Already measured\n\n const element = toastRef.current;\n if (!element) return;\n\n // Measure immediately - useLayoutEffect runs before paint\n const height = element.getBoundingClientRect().height;\n if (height > 0) {\n naturalHeightRef.current = height;\n onHeightChange(toast.key, height);\n setHasMeasured(true);\n }\n }, [toast.key, onHeightChange, toastRef]);\n\n // Close button handler\n const handleClose = () => {\n // Mark this toast as manually closed for exit animation\n manuallyClosingToasts.add(toast.key);\n onClose?.();\n state.close(toast.key);\n };\n\n // Get button props from useButton hook\n const { buttonProps } = useButton(\n {\n 'aria-label': closeButtonProps['aria-label'],\n onPress: handleClose,\n },\n closeButtonRef,\n );\n\n // Get content from toast\n const content = toast.content;\n const finalStatus = status || content.status || 'info';\n\n // Determine which icon to render based on status\n const getStatusIcon = () => {\n switch (finalStatus) {\n case 'neutral':\n // Neutral status has no icon\n return null;\n case 'success':\n return <RiCheckLine aria-hidden=\"true\" />;\n case 'warning':\n return <RiErrorWarningLine aria-hidden=\"true\" />;\n case 'danger':\n return <RiAlertLine aria-hidden=\"true\" />;\n case 'info':\n default:\n return <RiInformationLine aria-hidden=\"true\" />;\n }\n };\n\n const statusIcon = getStatusIcon();\n\n // Calculate stacking values based on index\n // Collapsed: each toast behind scales down 5% and peeks up 12px\n const collapsedScale = Math.max(0.85, 1 - index * 0.05);\n const collapsedY = -index * 12;\n\n // Use expanded or collapsed values based on hover state\n // expandedYProp is pre-calculated based on actual toast heights\n const animateY = isExpanded ? expandedYProp : collapsedY;\n const animateScale = isExpanded ? 1 : collapsedScale;\n const stackZIndex = 1000 - index;\n\n // Check if this toast is being manually closed\n const isManualClose = manuallyClosingToasts.has(toast.key);\n\n // Different exit animations for manual close vs auto-timeout\n // Manual close: slide down from front, stay on top\n // Auto-timeout: fade out in place, stay in stack position\n const exitAnimation = isManualClose\n ? { opacity: 0, y: 100, scale: 1, zIndex: 2000 }\n : {\n opacity: 0,\n y: animateY + 50,\n scale: animateScale,\n zIndex: stackZIndex,\n };\n\n // Height animation for back toasts:\n // - Front toast (index 0): never set height, uses natural CSS height\n // - Back toasts: animate between collapsedHeight and their own naturalHeight\n const measuredHeight = naturalHeight || naturalHeightRef.current;\n const isBackToast = index > 0;\n const hasValidMeasurements =\n hasMeasured && collapsedHeight && measuredHeight;\n\n // For back toasts with valid measurements, calculate target height\n // Otherwise, let CSS handle it naturally\n const animateProps: {\n opacity: number;\n y: number;\n scale: number;\n zIndex: number;\n height?: number;\n } = {\n opacity: 1,\n y: animateY,\n scale: animateScale,\n zIndex: stackZIndex,\n ...(isBackToast && hasValidMeasurements\n ? { height: isExpanded ? measuredHeight : collapsedHeight }\n : {}),\n };\n\n const shouldClipContent =\n isBackToast && hasValidMeasurements && !isExpanded;\n\n return (\n <motion.div\n {...ariaProps}\n ref={toastRef}\n className={styles.toast}\n style={\n {\n '--toast-index': index,\n overflow: shouldClipContent ? 'hidden' : undefined,\n } as React.CSSProperties\n }\n initial={{ opacity: 0, y: 100, scale: 1 }}\n animate={animateProps}\n exit={exitAnimation}\n onAnimationComplete={definition => {\n // Clean up the manual close tracking after exit animation\n if (definition === 'exit') {\n manuallyClosingToasts.delete(toast.key);\n }\n }}\n transition={{ type: 'spring', stiffness: 400, damping: 35 }}\n data-status={finalStatus}\n >\n <BgReset>\n <Box className={styles.surface}>\n <div className={styles.wrapper}>\n {statusIcon && <div className={styles.icon}>{statusIcon}</div>}\n <div className={styles.content}>\n <div {...titleProps} className={styles.title}>\n {content.title}\n </div>\n {content.description && (\n <div className={styles.description}>\n {content.description}\n </div>\n )}\n {content.links && content.links.length > 0 && (\n <div className={styles.links}>\n {content.links.map(link => (\n <a key={link.href} href={link.href}>\n {link.label}\n </a>\n ))}\n </div>\n )}\n </div>\n </div>\n {/* eslint-disable-next-line react/forbid-elements */}\n <button\n {...buttonProps}\n ref={closeButtonRef}\n className={styles.closeButton}\n >\n <RiCloseLine aria-hidden=\"true\" />\n </button>\n </Box>\n </BgReset>\n </motion.div>\n );\n },\n);\n\nToast.displayName = 'Toast';\n"],"names":[],"mappings":";;;;;;;;;;AAmCA,MAAM,qBAAA,uBAA4B,GAAA,EAAY;AAYvC,MAAM,KAAA,GAAQ,UAAA;AAAA,EACnB,CAAC,OAA6B,GAAA,KAA6B;AACzD,IAAA,MAAM;AAAA,MACJ,KAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA,GAAQ,CAAA;AAAA,MACR,UAAA,GAAa,KAAA;AAAA,MACb,OAAA;AAAA,MACA,MAAA;AAAA,MACA,WAAW,aAAA,GAAgB,CAAA;AAAA,MAC3B,eAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACF,GAAI,KAAA;AAGJ,IAAA,MAAM,WAAA,GAAc,OAAuB,IAAI,CAAA;AAC/C,IAAA,MAAM,WAAY,GAAA,IAA2C,WAAA;AAG7D,IAAA,MAAM,EAAE,UAAA,EAAY,UAAA,EAAY,gBAAA,EAAiB,GAAI,QAAA;AAAA,MACnD,EAAE,KAAA,EAAM;AAAA,MACR,KAAA;AAAA,MACA;AAAA,KACF;AAGA,IAAA,MAAM,cAAA,GAAiB,OAA0B,IAAI,CAAA;AAIrD,IAAA,MAAM,SAAA,GAAY;AAAA,MAChB,MAAM,UAAA,CAAW,IAAA;AAAA,MACjB,UAAU,UAAA,CAAW,QAAA;AAAA,MACrB,YAAA,EAAc,WAAW,YAAY,CAAA;AAAA,MACrC,iBAAA,EAAmB,WAAW,iBAAiB,CAAA;AAAA,MAC/C,kBAAA,EAAoB,WAAW,kBAAkB,CAAA;AAAA,MACjD,eAAA,EAAiB,WAAW,eAAe,CAAA;AAAA,MAC3C,cAAA,EAAgB,WAAW,cAAc;AAAA,KAC3C;AAGA,IAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,KAAK,CAAA;AAEpD,IAAA,MAAM,gBAAA,G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SAAA,EAAW,MAAA,CAAO,MAAO,QAAA,EAAA,UAAA,EAAW,CAAA;AAAA,4BACxD,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,OAAA,EACrB,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,SAAK,GAAG,UAAA,EAAY,WAAW,MAAA,CAAO,KAAA,EACpC,kBAAQ,KAAA,EACX,CAAA;AAAA,cACC,OAAA,CAAQ,+BACP,GAAA,CAAC,KAAA,EAAA,EAAI,WAAW,MAAA,CAAO,WAAA,EACpB,kBAAQ,WAAA,EACX,CAAA;AAAA,cAED,OAAA,CAAQ,KAAA,IAAS,OAAA,CAAQ,KAAA,CAAM,MAAA,GAAS,qBACvC,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,KAAA,EACpB,QAAA,EAAA,OAAA,CAAQ,MAAM,GAAA,CAAI,CAAA,IAAA,qBACjB,GAAA,CAAC,GAAA,EAAA,EAAkB,IAAA,EAAM,IAAA,CAAK,IAAA,EAC3B,QAAA,EAAA,IAAA,CAAK,KAAA,EAAA,EADA,IAAA,CAAK,IAEb,CACD,CAAA,EACH;AAAA,aAAA,EAEJ;AAAA,WAAA,EACF,CAAA;AAAA,0BAEA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACE,GAAG,WAAA;AAAA,cACJ,GAAA,EAAK,cAAA;AAAA,cACL,WAAW,MAAA,CAAO,WAAA;AAAA,cAElB,QAAA,kBAAA,GAAA,CAAC,WAAA,EAAA,EAAY,aAAA,EAAY,MAAA,EAAO;AAAA;AAAA;AAClC,SAAA,EACF,CAAA,EACF;AAAA;AAAA,KACF;AAAA,EAEJ;AACF;AAEA,KAAA,CAAM,WAAA,GAAc,OAAA;;;;"}
1
+ {"version":3,"file":"Toast.esm.js","sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, Ref, useRef, useLayoutEffect, useState } from 'react';\nimport { useToast, useButton } from 'react-aria';\nimport { motion } from 'motion/react';\nimport { Box } from '@backstage/ui';\nimport {\n RiInformationLine,\n RiCheckLine,\n RiErrorWarningLine,\n RiAlertLine,\n RiCloseLine,\n} from '@remixicon/react';\nimport type { ToastApiMessageProps } from './types';\nimport styles from './Toast.module.css';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { BgReset } from '../../../../../packages/ui/src/hooks/useBg';\n\n// Track which toasts are being manually closed (vs auto-timeout)\n// This allows different exit animations for each case\nconst manuallyClosingToasts = new Set<string>();\n\n/**\n * A Toast displays a brief, temporary notification of actions, errors, or other events in an application.\n *\n * @remarks\n * The Toast component is used internally by ToastContainer and managed by a ToastQueue.\n * It supports multiple status variants (neutral, info, success, warning, danger) and can display\n * a title and description. Toasts can be dismissed manually or automatically.\n *\n * @internal\n */\nexport const Toast = forwardRef(\n (props: ToastApiMessageProps, ref: Ref<HTMLDivElement>) => {\n const {\n toast,\n state,\n index = 0,\n isExpanded = false,\n onClose,\n status,\n expandedY: expandedYProp = 0,\n collapsedHeight,\n naturalHeight,\n onHeightChange,\n } = props;\n\n // Use internal ref if none provided\n const internalRef = useRef<HTMLDivElement>(null);\n const toastRef = (ref as React.RefObject<HTMLDivElement>) || internalRef;\n\n // Get ARIA props from useToast hook\n const { toastProps, titleProps, closeButtonProps } = useToast(\n { toast },\n state,\n toastRef,\n );\n\n // Close button ref for useButton hook\n const closeButtonRef = useRef<HTMLButtonElement>(null);\n\n // Extract only ARIA and accessibility props from toastProps to avoid\n // conflicts with motion.div's event handler types (motion has its own drag API)\n const ariaProps = {\n role: toastProps.role,\n tabIndex: toastProps.tabIndex,\n 'aria-label': toastProps['aria-label'],\n 'aria-labelledby': toastProps['aria-labelledby'],\n 'aria-describedby': toastProps['aria-describedby'],\n 'aria-posinset': toastProps['aria-posinset'],\n 'aria-setsize': toastProps['aria-setsize'],\n };\n\n // Track whether we've measured this toast's natural height\n const [hasMeasured, setHasMeasured] = useState(false);\n // Store the measured natural height locally to avoid re-measurement issues\n const naturalHeightRef = useRef<number | null>(null);\n\n // Measure this toast's natural height on mount (before paint)\n // Using useLayoutEffect ensures we measure before the browser paints\n useLayoutEffect(() => {\n if (!onHeightChange) return;\n if (naturalHeightRef.current) return; // Already measured\n\n const element = toastRef.current;\n if (!element) return;\n\n // Measure immediately - useLayoutEffect runs before paint\n const height = element.getBoundingClientRect().height;\n if (height > 0) {\n naturalHeightRef.current = height;\n onHeightChange(toast.key, height);\n setHasMeasured(true);\n }\n }, [toast.key, onHeightChange, toastRef]);\n\n // Close button handler\n const handleClose = () => {\n // Mark this toast as manually closed for exit animation\n manuallyClosingToasts.add(toast.key);\n onClose?.();\n state.close(toast.key);\n };\n\n // Get button props from useButton hook\n const { buttonProps } = useButton(\n {\n 'aria-label': closeButtonProps['aria-label'],\n onPress: handleClose,\n },\n closeButtonRef,\n );\n\n // Get content from toast\n const content = toast.content;\n const finalStatus = status || content.status || 'info';\n\n // Determine which icon to render based on status\n const getStatusIcon = () => {\n switch (finalStatus) {\n case 'neutral':\n // Neutral status has no icon\n return null;\n case 'success':\n return <RiCheckLine aria-hidden=\"true\" />;\n case 'warning':\n return <RiErrorWarningLine aria-hidden=\"true\" />;\n case 'danger':\n return <RiAlertLine aria-hidden=\"true\" />;\n case 'info':\n default:\n return <RiInformationLine aria-hidden=\"true\" />;\n }\n };\n\n const statusIcon = getStatusIcon();\n\n // Calculate stacking values based on index\n // Collapsed: each toast behind scales down 5% and peeks up 12px\n const collapsedScale = Math.max(0.85, 1 - index * 0.05);\n const collapsedY = -index * 12;\n\n // Use expanded or collapsed values based on hover state\n // expandedYProp is pre-calculated based on actual toast heights\n const animateY = isExpanded ? expandedYProp : collapsedY;\n const animateScale = isExpanded ? 1 : collapsedScale;\n const stackZIndex = 1000 - index;\n\n // Check if this toast is being manually closed\n const isManualClose = manuallyClosingToasts.has(toast.key);\n\n // Different exit animations for manual close vs auto-timeout\n // Manual close: slide down from front, stay on top\n // Auto-timeout: fade out in place, stay in stack position\n const exitAnimation = isManualClose\n ? { opacity: 0, y: 100, scale: 1, zIndex: 2000 }\n : {\n opacity: 0,\n y: animateY + 50,\n scale: animateScale,\n zIndex: stackZIndex,\n };\n\n // Height animation for back toasts:\n // - Front toast (index 0): never set height, uses natural CSS height\n // - Back toasts: animate between collapsedHeight and their own naturalHeight\n const measuredHeight = naturalHeight || naturalHeightRef.current;\n const isBackToast = index > 0;\n const hasValidMeasurements =\n hasMeasured && collapsedHeight && measuredHeight;\n\n // For back toasts with valid measurements, calculate target height\n // Otherwise, let CSS handle it naturally\n const animateProps: {\n opacity: number;\n y: number;\n scale: number;\n zIndex: number;\n height?: number;\n } = {\n opacity: 1,\n y: animateY,\n scale: animateScale,\n zIndex: stackZIndex,\n ...(isBackToast && hasValidMeasurements\n ? { height: isExpanded ? measuredHeight : collapsedHeight }\n : {}),\n };\n\n const shouldClipContent =\n isBackToast && hasValidMeasurements && !isExpanded;\n\n return (\n <motion.div\n {...ariaProps}\n ref={toastRef}\n className={styles.toast}\n style={\n {\n '--toast-index': index,\n overflow: shouldClipContent ? 'hidden' : undefined,\n } as React.CSSProperties\n }\n initial={{ opacity: 0, y: 100, scale: 1 }}\n animate={animateProps}\n exit={exitAnimation}\n onAnimationComplete={definition => {\n // Clean up the manual close tracking after exit animation\n if (definition === 'exit') {\n manuallyClosingToasts.delete(toast.key);\n }\n }}\n transition={{ type: 'spring', stiffness: 400, damping: 35 }}\n data-status={finalStatus}\n >\n <BgReset>\n <Box className={styles.surface}>\n <div className={styles.wrapper}>\n {statusIcon && <div className={styles.icon}>{statusIcon}</div>}\n <div className={styles.content}>\n <div {...titleProps} className={styles.title}>\n {content.title}\n </div>\n {content.description && (\n <div className={styles.description}>\n {content.description}\n </div>\n )}\n {content.links && content.links.length > 0 && (\n <div className={styles.links}>\n {content.links.map(link => (\n <a key={link.href} href={link.href}>\n {link.label}\n </a>\n ))}\n </div>\n )}\n </div>\n </div>\n {/* eslint-disable-next-line react/forbid-elements */}\n <button\n {...buttonProps}\n ref={closeButtonRef}\n className={styles.closeButton}\n >\n <RiCloseLine aria-hidden=\"true\" />\n </button>\n </Box>\n </BgReset>\n </motion.div>\n );\n },\n);\n\nToast.displayName = 'Toast';\n"],"names":[],"mappings":";;;;;;;;;AAkCA,MAAM,qBAAA,uBAA4B,GAAA,EAAY;AAYvC,MAAM,KAAA,GAAQ,UAAA;AAAA,EACnB,CAAC,OAA6B,GAAA,KAA6B;AACzD,IAAA,MAAM;AAAA,MACJ,KAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA,GAAQ,CAAA;AAAA,MACR,UAAA,GAAa,KAAA;AAAA,MACb,OAAA;AAAA,MACA,MAAA;AAAA,MACA,WAAW,aAAA,GAAgB,CAAA;AAAA,MAC3B,eAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACF,GAAI,KAAA;AAGJ,IAAA,MAAM,WAAA,GAAc,OAAuB,IAAI,CAAA;AAC/C,IAAA,MAAM,WAAY,GAAA,IAA2C,WAAA;AAG7D,IAAA,MAAM,EAAE,UAAA,EAAY,UAAA,EAAY,gBAAA,EAAiB,GAAI,QAAA;AAAA,MACnD,EAAE,KAAA,EAAM;AAAA,MACR,KAAA;AAAA,MACA;AAAA,KACF;AAGA,IAAA,MAAM,cAAA,GAAiB,OAA0B,IAAI,CAAA;AAIrD,IAAA,MAAM,SAAA,GAAY;AAAA,MAChB,MAAM,UAAA,CAAW,IAAA;AAAA,MACjB,UAAU,UAAA,CAAW,QAAA;AAAA,MACrB,YAAA,EAAc,WAAW,YAAY,CAA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,WAAA,EAAA,EAAY,aAAA,EAAY,MAAA,EAAO;AAAA;AAAA;AAClC,SAAA,EACF,CAAA,EACF;AAAA;AAAA,KACF;AAAA,EAEJ;AACF;AAEA,KAAA,CAAM,WAAA,GAAc,OAAA;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { forwardRef, useRef, useState, useCallback, useMemo } from 'react';
3
- import { useToastRegion } from '@react-aria/toast';
4
- import { useToastQueue } from '@react-stately/toast';
3
+ import { useToastRegion } from 'react-aria';
4
+ import { useToastQueue } from 'react-stately';
5
5
  import { AnimatePresence } from 'motion/react';
6
6
  import { useInvertedThemeMode } from '../../hooks/useInvertedThemeMode.esm.js';
7
7
  import { Toast } from './Toast.esm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"ToastContainer.esm.js","sources":["../../../src/components/Toast/ToastContainer.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, Ref, useState, useRef, useCallback, useMemo } from 'react';\nimport { useToastRegion } from '@react-aria/toast';\nimport { useToastQueue } from '@react-stately/toast';\nimport { AnimatePresence } from 'motion/react';\nimport type { ToastApiMessageContainerProps } from './types';\nimport { useInvertedThemeMode } from '../../hooks/useInvertedThemeMode';\nimport { Toast } from './Toast';\nimport styles from './Toast.module.css';\n\n/**\n * A ToastContainer displays one or more toast notifications in the bottom-center of the screen.\n *\n * @remarks\n * The ToastContainer component should typically be placed once at the root of your application.\n * It manages the display and stacking of all toast notifications added to its queue.\n * Toasts appear in the bottom-center with deep stacking when multiple are visible.\n * Toast containers are ARIA landmark regions that can be navigated using F6 (forward) and\n * Shift+F6 (backward) for keyboard accessibility.\n *\n * @internal\n */\nexport const ToastContainer = forwardRef(\n (props: ToastApiMessageContainerProps, ref: Ref<HTMLDivElement>) => {\n const { queue, className } = props;\n\n // Subscribe to the toast queue state\n const state = useToastQueue(queue);\n\n // Use internal ref if none provided\n const internalRef = useRef<HTMLDivElement>(null);\n const containerRef =\n (ref as React.RefObject<HTMLDivElement>) || internalRef;\n\n // Get ARIA props for the toast region\n const { regionProps } = useToastRegion({}, state, containerRef);\n\n // Track hover state for expanding/collapsing the stack\n const [isHovered, setIsHovered] = useState(false);\n\n // Lock expanded state after close to prevent stack collapse during exit animation\n const [isHoverLocked, setIsHoverLocked] = useState(false);\n const unlockTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // Toasts are expanded when hovered, focused, or locked\n const isExpanded = isHovered || isHoverLocked;\n\n // Track heights of all toasts by their key\n const [toastHeights, setToastHeights] = useState<Record<string, number>>(\n {},\n );\n\n // Callback for toasts to report their height\n const handleHeightChange = useCallback((key: string, height: number) => {\n setToastHeights(prev => {\n if (prev[key] === height) return prev;\n return { ...prev, [key]: height };\n });\n }, []);\n\n // Calculate expanded Y positions and get front toast height\n const { expandedYPositions, frontToastHeight } = useMemo(() => {\n const gap = 8;\n const positions: Record<string, number> = {};\n let frontHeight = 60; // Default fallback\n\n // visibleToasts[0] is the front toast (newest)\n const toasts = state.visibleToasts;\n\n if (toasts.length > 0 && toastHeights[toasts[0].key]) {\n frontHeight = toastHeights[toasts[0].key];\n }\n\n // Calculate cumulative Y position for each toast when expanded\n // Position is negative Y (moving up from bottom)\n let cumulativeY = 0;\n for (let i = 0; i < toasts.length; i++) {\n positions[toasts[i].key] = -cumulativeY;\n const height = toastHeights[toasts[i].key] || 60;\n cumulativeY += height + gap;\n }\n\n return { expandedYPositions: positions, frontToastHeight: frontHeight };\n }, [state.visibleToasts, toastHeights]);\n\n // Get inverted theme mode for toasts (light when app is dark, dark when app is light)\n const invertedThemeMode = useInvertedThemeMode();\n\n const handleClose = () => {\n // Lock the expanded state while toast is being removed\n setIsHoverLocked(true);\n\n // Clear any pending unlock\n if (unlockTimerRef.current) {\n clearTimeout(unlockTimerRef.current);\n }\n\n // Unlock after a short delay to allow exit animation to complete\n unlockTimerRef.current = setTimeout(() => {\n setIsHoverLocked(false);\n }, 500);\n };\n\n return (\n <div\n {...regionProps}\n ref={containerRef}\n className={className || styles.container}\n data-theme-mode={invertedThemeMode}\n data-hover-locked={isHoverLocked ? '' : undefined}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onFocus={() => setIsHovered(true)}\n onBlur={() => setIsHovered(false)}\n >\n <AnimatePresence>\n {state.visibleToasts.map((toast, index) => (\n <Toast\n key={toast.key}\n toast={toast}\n state={state}\n index={index}\n isExpanded={isExpanded}\n onClose={handleClose}\n expandedY={expandedYPositions[toast.key] ?? 0}\n collapsedHeight={index > 0 ? frontToastHeight : undefined}\n naturalHeight={toastHeights[toast.key]}\n onHeightChange={handleHeightChange}\n />\n ))}\n </AnimatePresence>\n </div>\n );\n },\n);\n\nToastContainer.displayName = 'ToastContainer';\n"],"names":[],"mappings":";;;;;;;;;AAqCO,MAAM,cAAA,GAAiB,UAAA;AAAA,EAC5B,CAAC,OAAsC,GAAA,KAA6B;AAClE,IAAA,MAAM,EAAE,KAAA,EAAO,SAAA,EAAU,GAAI,KAAA;AAG7B,IAAA,MAAM,KAAA,GAAQ,cAAc,KAAK,CAAA;AAGjC,IAAA,MAAM,WAAA,GAAc,OAAuB,IAAI,CAAA;AAC/C,IAAA,MAAM,eACH,GAAA,IAA2C,WAAA;AAG9C,IAAA,MAAM,EAAE,WAAA,EAAY,GAAI,eAAe,EAAC,EAAG,OAAO,YAAY,CAAA;AAG9D,IAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAGhD,IAAA,MAAM,CAAC,aAAA,EAA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,YACA,UAAA;AAAA,YACA,OAAA,EAAS,WAAA;AAAA,YACT,SAAA,EAAW,kBAAA,CAAmB,KAAA,CAAM,GAAG,CAAA,IAAK,CAAA;AAAA,YAC5C,eAAA,EAAiB,KAAA,GAAQ,CAAA,GAAI,gBAAA,GAAmB,MAAA;AAAA,YAChD,aAAA,EAAe,YAAA,CAAa,KAAA,CAAM,GAAG,CAAA;AAAA,YACrC,cAAA,EAAgB;AAAA,WAAA;AAAA,UATX,KAAA,CAAM;AAAA,SAWd,CAAA,EACH;AAAA;AAAA,KACF;AAAA,EAEJ;AACF;AAEA,cAAA,CAAe,WAAA,GAAc,gBAAA;;;;"}
1
+ {"version":3,"file":"ToastContainer.esm.js","sources":["../../../src/components/Toast/ToastContainer.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, Ref, useState, useRef, useCallback, useMemo } from 'react';\nimport { useToastRegion } from 'react-aria';\nimport { useToastQueue } from 'react-stately';\nimport { AnimatePresence } from 'motion/react';\nimport type { ToastApiMessageContainerProps } from './types';\nimport { useInvertedThemeMode } from '../../hooks/useInvertedThemeMode';\nimport { Toast } from './Toast';\nimport styles from './Toast.module.css';\n\n/**\n * A ToastContainer displays one or more toast notifications in the bottom-center of the screen.\n *\n * @remarks\n * The ToastContainer component should typically be placed once at the root of your application.\n * It manages the display and stacking of all toast notifications added to its queue.\n * Toasts appear in the bottom-center with deep stacking when multiple are visible.\n * Toast containers are ARIA landmark regions that can be navigated using F6 (forward) and\n * Shift+F6 (backward) for keyboard accessibility.\n *\n * @internal\n */\nexport const ToastContainer = forwardRef(\n (props: ToastApiMessageContainerProps, ref: Ref<HTMLDivElement>) => {\n const { queue, className } = props;\n\n // Subscribe to the toast queue state\n const state = useToastQueue(queue);\n\n // Use internal ref if none provided\n const internalRef = useRef<HTMLDivElement>(null);\n const containerRef =\n (ref as React.RefObject<HTMLDivElement>) || internalRef;\n\n // Get ARIA props for the toast region\n const { regionProps } = useToastRegion({}, state, containerRef);\n\n // Track hover state for expanding/collapsing the stack\n const [isHovered, setIsHovered] = useState(false);\n\n // Lock expanded state after close to prevent stack collapse during exit animation\n const [isHoverLocked, setIsHoverLocked] = useState(false);\n const unlockTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // Toasts are expanded when hovered, focused, or locked\n const isExpanded = isHovered || isHoverLocked;\n\n // Track heights of all toasts by their key\n const [toastHeights, setToastHeights] = useState<Record<string, number>>(\n {},\n );\n\n // Callback for toasts to report their height\n const handleHeightChange = useCallback((key: string, height: number) => {\n setToastHeights(prev => {\n if (prev[key] === height) return prev;\n return { ...prev, [key]: height };\n });\n }, []);\n\n // Calculate expanded Y positions and get front toast height\n const { expandedYPositions, frontToastHeight } = useMemo(() => {\n const gap = 8;\n const positions: Record<string, number> = {};\n let frontHeight = 60; // Default fallback\n\n // visibleToasts[0] is the front toast (newest)\n const toasts = state.visibleToasts;\n\n if (toasts.length > 0 && toastHeights[toasts[0].key]) {\n frontHeight = toastHeights[toasts[0].key];\n }\n\n // Calculate cumulative Y position for each toast when expanded\n // Position is negative Y (moving up from bottom)\n let cumulativeY = 0;\n for (let i = 0; i < toasts.length; i++) {\n positions[toasts[i].key] = -cumulativeY;\n const height = toastHeights[toasts[i].key] || 60;\n cumulativeY += height + gap;\n }\n\n return { expandedYPositions: positions, frontToastHeight: frontHeight };\n }, [state.visibleToasts, toastHeights]);\n\n // Get inverted theme mode for toasts (light when app is dark, dark when app is light)\n const invertedThemeMode = useInvertedThemeMode();\n\n const handleClose = () => {\n // Lock the expanded state while toast is being removed\n setIsHoverLocked(true);\n\n // Clear any pending unlock\n if (unlockTimerRef.current) {\n clearTimeout(unlockTimerRef.current);\n }\n\n // Unlock after a short delay to allow exit animation to complete\n unlockTimerRef.current = setTimeout(() => {\n setIsHoverLocked(false);\n }, 500);\n };\n\n return (\n <div\n {...regionProps}\n ref={containerRef}\n className={className || styles.container}\n data-theme-mode={invertedThemeMode}\n data-hover-locked={isHoverLocked ? '' : undefined}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onFocus={() => setIsHovered(true)}\n onBlur={() => setIsHovered(false)}\n >\n <AnimatePresence>\n {state.visibleToasts.map((toast, index) => (\n <Toast\n key={toast.key}\n toast={toast}\n state={state}\n index={index}\n isExpanded={isExpanded}\n onClose={handleClose}\n expandedY={expandedYPositions[toast.key] ?? 0}\n collapsedHeight={index > 0 ? frontToastHeight : undefined}\n naturalHeight={toastHeights[toast.key]}\n onHeightChange={handleHeightChange}\n />\n ))}\n </AnimatePresence>\n </div>\n );\n },\n);\n\nToastContainer.displayName = 'ToastContainer';\n"],"names":[],"mappings":";;;;;;;;;AAqCO,MAAM,cAAA,GAAiB,UAAA;AAAA,EAC5B,CAAC,OAAsC,GAAA,KAA6B;AAClE,IAAA,MAAM,EAAE,KAAA,EAAO,SAAA,EAAU,GAAI,KAAA;AAG7B,IAAA,MAAM,KAAA,GAAQ,cAAc,KAAK,CAAA;AAGjC,IAAA,MAAM,WAAA,GAAc,OAAuB,IAAI,CAAA;AAC/C,IAAA,MAAM,eACH,GAAA,IAA2C,WAAA;AAG9C,IAAA,MAAM,EAAE,WAAA,EAAY,GAAI,eAAe,EAAC,EAAG,OAAO,YAAY,CAAA;AAG9D,IAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAGhD,IAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,SAAS,KAAK,CAAA;AACxD,IAAA,MAAM,cAAA,GAAiB,OAA6C,IAAI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CAAM,GAAG,CAAA,IAAK,CAAA;AAAA,YAC5C,eAAA,EAAiB,KAAA,GAAQ,CAAA,GAAI,gBAAA,GAAmB,MAAA;AAAA,YAChD,aAAA,EAAe,YAAA,CAAa,KAAA,CAAM,GAAG,CAAA;AAAA,YACrC,cAAA,EAAgB;AAAA,WAAA;AAAA,UATX,KAAA,CAAM;AAAA,SAWd,CAAA,EACH;AAAA;AAAA,KACF;AAAA,EAEJ;AACF;AAEA,cAAA,CAAe,WAAA,GAAc,gBAAA;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { useState, useEffect } from 'react';
3
3
  import { useApi, alertApiRef } from '@backstage/core-plugin-api';
4
- import { ToastQueue } from '@react-stately/toast';
4
+ import { ToastQueue } from 'react-stately';
5
5
  import { ToastContainer } from './ToastContainer.esm.js';
6
6
  import 'zen-observable';
7
7
  import { toastApiForwarderRef } from '../../apis/toastApiForwarderRef.esm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"ToastDisplay.esm.js","sources":["../../../src/components/Toast/ToastDisplay.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useState } from 'react';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport { ToastQueue } from '@react-stately/toast';\nimport { ToastContainer } from './ToastContainer';\nimport { toastApiForwarderRef } from '../../apis';\nimport type {\n ToastApiMessageDisplayProps,\n ToastApiMessageContent,\n} from './types';\n\n/**\n * Maps AlertApi severity to Toast status.\n * AlertApi uses 'error' while Toast uses 'danger' for the same semantic meaning.\n */\nfunction mapSeverity(\n severity: 'success' | 'info' | 'warning' | 'error' | undefined,\n): ToastApiMessageContent['status'] {\n if (severity === 'error') {\n return 'danger';\n }\n return severity ?? 'success';\n}\n\n/**\n * ToastDisplay bridges both the ToastApi and AlertApi with the Toast notification system.\n *\n * @remarks\n * This component provides a migration bridge between the deprecated AlertApi and the new ToastApi.\n * During the migration period, it subscribes to both APIs simultaneously, allowing plugins to\n * migrate incrementally without breaking existing functionality.\n *\n * **Subscriptions:**\n * - `toastApi.toast$()` - New toast notifications with full features (title, description, links, icons)\n * - `alertApi.alert$()` - Deprecated alerts for backward compatibility (message maps to title only)\n *\n * **ToastApi (recommended):**\n * - Uses toast content directly (title, description, status, icon, links)\n * - Uses the provided timeout from the toast message\n * - Supports programmatic dismiss via the returned `close()` handle\n *\n * **AlertApi (deprecated - please migrate to ToastApi):**\n * - `alert.message` → `toast.title`\n * - `alert.severity` → `toast.status` ('error' maps to 'danger')\n * - `alert.display` → `timeout` (transient gets default timeout, permanent stays until dismissed)\n *\n * @example\n * ```tsx\n * // In your app root element extension\n * <ToastDisplay transientTimeoutMs={5000} />\n *\n * // Using the new ToastApi (recommended):\n * import { toastApiRef, useApi } from '@backstage/frontend-plugin-api';\n * const toastApi = useApi(toastApiRef);\n * const { close } = toastApi.post({\n * title: 'Entity saved',\n * description: 'Your changes have been saved successfully.',\n * status: 'success',\n * timeout: 5000,\n * });\n * // Later: close() to dismiss programmatically\n *\n * // Using the deprecated AlertApi (migrate to ToastApi):\n * import { alertApiRef, useApi } from '@backstage/core-plugin-api';\n * const alertApi = useApi(alertApiRef);\n * alertApi.post({ message: 'Saved!', severity: 'success', display: 'transient' });\n * ```\n *\n * @public\n */\nexport function ToastDisplay(props: ToastApiMessageDisplayProps) {\n const alertApi = useApi(alertApiRef);\n const toastApi = useApi(toastApiForwarderRef);\n const { transientTimeoutMs = 5000 } = props;\n\n // Create toast queue once per component instance\n const [toastQueue] = useState(\n () => new ToastQueue<ToastApiMessageContent>({ maxVisibleToasts: 4 }),\n );\n\n // Subscribe to ToastApi\n useEffect(() => {\n const subscription = toastApi.toast$().subscribe(toast => {\n const content: ToastApiMessageContent = {\n title: toast.title,\n description: toast.description,\n status: toast.status ?? 'success',\n links: toast.links,\n };\n\n // Use the timeout from the toast message if provided\n const options = toast.timeout ? { timeout: toast.timeout } : {};\n\n const queueKey = toastQueue.add(content, options);\n\n // When the toast is programmatically closed, remove it from the queue\n toast.onClose(() => toastQueue.close(queueKey));\n });\n\n return () => subscription.unsubscribe();\n }, [toastApi, toastQueue]);\n\n // Subscribe to AlertApi (deprecated - provides backward compatibility during migration)\n // This subscription will be removed when AlertApi is fully deprecated\n useEffect(() => {\n const subscription = alertApi.alert$().subscribe(alert => {\n const content: ToastApiMessageContent = {\n title: alert.message,\n status: mapSeverity(alert.severity),\n };\n\n // Transient alerts auto-dismiss after timeout, permanent alerts stay until dismissed\n const options =\n alert.display === 'transient' ? { timeout: transientTimeoutMs } : {};\n\n toastQueue.add(content, options);\n });\n\n return () => subscription.unsubscribe();\n }, [alertApi, transientTimeoutMs, toastQueue]);\n\n return <ToastContainer queue={toastQueue} />;\n}\n"],"names":[],"mappings":";;;;;;;;AA8BA,SAAS,YACP,QAAA,EACkC;AAClC,EAAA,IAAI,aAAa,OAAA,EAAS;AACxB,IAAA,OAAO,QAAA;AAAA,EACT;AACA,EAAA,OAAO,QAAA,IAAY,SAAA;AACrB;AAgDO,SAAS,aAAa,KAAA,EAAoC;AAC/D,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,QAAA,GAAW,OAAO,oBAAoB,CAAA;AAC5C,EAAA,MAAM,EAAE,kBAAA,GAAqB,GAAA,EAAK,GAAI,KAAA;AAGtC,EAAA,MAAM,CAAC,UAAU,CAAA,GAAI,QAAA;AAAA,IACnB,MAAM,IAAI,UAAA,CAAmC,EAAE,gBAAA,EAAkB,GAAG;AAAA,GACtE;AAGA,EAAA,SAAA,CAAU,MAAM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,cAAA,EAAA,EAAe,KAAA,EAAO,UAAA,EAAY,CAAA;AAC5C;;;;"}
1
+ {"version":3,"file":"ToastDisplay.esm.js","sources":["../../../src/components/Toast/ToastDisplay.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useState } from 'react';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport { ToastQueue } from 'react-stately';\nimport { ToastContainer } from './ToastContainer';\nimport { toastApiForwarderRef } from '../../apis';\nimport type {\n ToastApiMessageDisplayProps,\n ToastApiMessageContent,\n} from './types';\n\n/**\n * Maps AlertApi severity to Toast status.\n * AlertApi uses 'error' while Toast uses 'danger' for the same semantic meaning.\n */\nfunction mapSeverity(\n severity: 'success' | 'info' | 'warning' | 'error' | undefined,\n): ToastApiMessageContent['status'] {\n if (severity === 'error') {\n return 'danger';\n }\n return severity ?? 'success';\n}\n\n/**\n * ToastDisplay bridges both the ToastApi and AlertApi with the Toast notification system.\n *\n * @remarks\n * This component provides a migration bridge between the deprecated AlertApi and the new ToastApi.\n * During the migration period, it subscribes to both APIs simultaneously, allowing plugins to\n * migrate incrementally without breaking existing functionality.\n *\n * **Subscriptions:**\n * - `toastApi.toast$()` - New toast notifications with full features (title, description, links, icons)\n * - `alertApi.alert$()` - Deprecated alerts for backward compatibility (message maps to title only)\n *\n * **ToastApi (recommended):**\n * - Uses toast content directly (title, description, status, icon, links)\n * - Uses the provided timeout from the toast message\n * - Supports programmatic dismiss via the returned `close()` handle\n *\n * **AlertApi (deprecated - please migrate to ToastApi):**\n * - `alert.message` → `toast.title`\n * - `alert.severity` → `toast.status` ('error' maps to 'danger')\n * - `alert.display` → `timeout` (transient gets default timeout, permanent stays until dismissed)\n *\n * @example\n * ```tsx\n * // In your app root element extension\n * <ToastDisplay transientTimeoutMs={5000} />\n *\n * // Using the new ToastApi (recommended):\n * import { toastApiRef, useApi } from '@backstage/frontend-plugin-api';\n * const toastApi = useApi(toastApiRef);\n * const { close } = toastApi.post({\n * title: 'Entity saved',\n * description: 'Your changes have been saved successfully.',\n * status: 'success',\n * timeout: 5000,\n * });\n * // Later: close() to dismiss programmatically\n *\n * // Using the deprecated AlertApi (migrate to ToastApi):\n * import { alertApiRef, useApi } from '@backstage/core-plugin-api';\n * const alertApi = useApi(alertApiRef);\n * alertApi.post({ message: 'Saved!', severity: 'success', display: 'transient' });\n * ```\n *\n * @public\n */\nexport function ToastDisplay(props: ToastApiMessageDisplayProps) {\n const alertApi = useApi(alertApiRef);\n const toastApi = useApi(toastApiForwarderRef);\n const { transientTimeoutMs = 5000 } = props;\n\n // Create toast queue once per component instance\n const [toastQueue] = useState(\n () => new ToastQueue<ToastApiMessageContent>({ maxVisibleToasts: 4 }),\n );\n\n // Subscribe to ToastApi\n useEffect(() => {\n const subscription = toastApi.toast$().subscribe(toast => {\n const content: ToastApiMessageContent = {\n title: toast.title,\n description: toast.description,\n status: toast.status ?? 'success',\n links: toast.links,\n };\n\n // Use the timeout from the toast message if provided\n const options = toast.timeout ? { timeout: toast.timeout } : {};\n\n const queueKey = toastQueue.add(content, options);\n\n // When the toast is programmatically closed, remove it from the queue\n toast.onClose(() => toastQueue.close(queueKey));\n });\n\n return () => subscription.unsubscribe();\n }, [toastApi, toastQueue]);\n\n // Subscribe to AlertApi (deprecated - provides backward compatibility during migration)\n // This subscription will be removed when AlertApi is fully deprecated\n useEffect(() => {\n const subscription = alertApi.alert$().subscribe(alert => {\n const content: ToastApiMessageContent = {\n title: alert.message,\n status: mapSeverity(alert.severity),\n };\n\n // Transient alerts auto-dismiss after timeout, permanent alerts stay until dismissed\n const options =\n alert.display === 'transient' ? { timeout: transientTimeoutMs } : {};\n\n toastQueue.add(content, options);\n });\n\n return () => subscription.unsubscribe();\n }, [alertApi, transientTimeoutMs, toastQueue]);\n\n return <ToastContainer queue={toastQueue} />;\n}\n"],"names":[],"mappings":";;;;;;;;AA8BA,SAAS,YACP,QAAA,EACkC;AAClC,EAAA,IAAI,aAAa,OAAA,EAAS;AACxB,IAAA,OAAO,QAAA;AAAA,EACT;AACA,EAAA,OAAO,QAAA,IAAY,SAAA;AACrB;AAgDO,SAAS,aAAa,KAAA,EAAoC;AAC/D,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,QAAA,GAAW,OAAO,oBAAoB,CAAA;AAC5C,EAAA,MAAM,EAAE,kBAAA,GAAqB,GAAA,EAAK,GAAI,KAAA;AAGtC,EAAA,MAAM,CAAC,UAAU,CAAA,GAAI,QAAA;AAAA,IACnB,MAAM,IAAI,UAAA,CAAmC,EAAE,gBAAA,EAAkB,GAAG;AAAA,GACtE;AAGA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,YAAA,GAAe,QAAA,CAAS,MAAA,EAAO,CAAE,UAAU,CAAA,KAAA,KAAS;AACxD,MAAA,MAAM,OAAA,GAAkC;AAAA,QACtC,OAAO,KAAA,CAAM,KAAA;AAAA,QACb,aAAa,KAAA,CAAM,WAAA;AAAA,QACnB,MAAA,EAAQ,MAAM,MAAA,IAAU,SAAA;AAAA,QACxB,OAAO,KAAA,CAAM;AAAA,OACf;AAGA,MAAA,MAAM,OAAA,GAAU,MAAM,OAAA,GAAU,EAAE,SAAS,KAAA,CAAM,OAAA,KAAY,EAAC;AAE9D,MAAA,MAAM,QAAA,GAAW,UAAA,CAAW,GAAA,CAAI,OAAA,EAAS,OAAO,CAAA;AAGhD,MAAA,KAAA,CAAM,OAAA,CAAQ,MAAM,UAAA,CAAW,KAAA,CAAM,QAAQ,CAAC,CAAA;AAAA,IAChD,CAAC,CAAA;AAED,IAAA,OAAO,MAAM,aAAa,WAAA,EAAY;AAAA,EACxC,CAAA,EAAG,CAAC,QAAA,EAAU,UAAU,CAAC,CAAA;AAIzB,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,YAAA,GAAe,QAAA,CAAS,MAAA,EAAO,CAAE,UAAU,CAAA,KAAA,KAAS;AACxD,MAAA,MAAM,OAAA,GAAkC;AAAA,QACtC,OAAO,KAAA,CAAM,OAAA;AAAA,QACb,MAAA,EAAQ,WAAA,CAAY,KAAA,CAAM,QAAQ;AAAA,OACpC;AAGA,MAAA,MAAM,OAAA,GACJ,MAAM,OAAA,KAAY,WAAA,GAAc,EAAE,OAAA,EAAS,kBAAA,KAAuB,EAAC;AAErE,MAAA,UAAA,CAAW,GAAA,CAAI,SAAS,OAAO,CAAA;AAAA,IACjC,CAAC,CAAA;AAED,IAAA,OAAO,MAAM,aAAa,WAAA,EAAY;AAAA,EACxC,CAAA,EAAG,CAAC,QAAA,EAAU,kBAAA,EAAoB,UAAU,CAAC,CAAA;AAE7C,EAAA,uBAAO,GAAA,CAAC,cAAA,EAAA,EAAe,KAAA,EAAO,UAAA,EAAY,CAAA;AAC5C;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { AppLanguageSelector } from '../packages/core-app-api/src/apis/implementations/AppLanguageApi/AppLanguageSelector.esm.js';
2
2
  import { ApiBlueprint, appLanguageApiRef } from '@backstage/frontend-plugin-api';
3
- import { z } from 'zod';
3
+ import { z } from 'zod/v4';
4
4
 
5
5
  const AppLanguageApi = ApiBlueprint.makeWithOverrides({
6
6
  name: "app-language",
@@ -1 +1 @@
1
- {"version":3,"file":"AppLanguageApi.esm.js","sources":["../../src/extensions/AppLanguageApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { AppLanguageSelector } from '../../../../packages/core-app-api/src/apis/implementations/AppLanguageApi';\nimport { appLanguageApiRef } from '@backstage/frontend-plugin-api';\nimport { ApiBlueprint } from '@backstage/frontend-plugin-api';\nimport { z } from 'zod';\n\nexport const AppLanguageApi = ApiBlueprint.makeWithOverrides({\n name: 'app-language',\n configSchema: {\n defaultLanguage: z.string().optional(),\n availableLanguages: z.array(z.string()).optional(),\n },\n factory(originalFactory, { config }) {\n return originalFactory(defineParams =>\n defineParams({\n api: appLanguageApiRef,\n deps: {},\n factory: () =>\n AppLanguageSelector.createWithStorage({\n defaultLanguage: config.defaultLanguage,\n availableLanguages: config.availableLanguages,\n }),\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;;AAsBO,MAAM,cAAA,GAAiB,aAAa,iBAAA,CAAkB;AAAA,EAC3D,IAAA,EAAM,cAAA;AAAA,EACN,YAAA,EAAc;AAAA,IACZ,eAAA,EAAiB,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,IACrC,oBAAoB,CAAA,CAAE,KAAA,CAAM,EAAE,MAAA,EAAQ,EAAE,QAAA;AAAS,GACnD;AAAA,EACA,OAAA,CAAQ,eAAA,EAAiB,EAAE,MAAA,EAAO,EAAG;AACnC,IAAA,OAAO,eAAA;AAAA,MAAgB,kBACrB,YAAA,CAAa;AAAA,QACX,GAAA,EAAK,iBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MACP,mBAAA,CAAoB,iBAAA,CAAkB;AAAA,UACpC,iBAAiB,MAAA,CAAO,eAAA;AAAA,UACxB,oBAAoB,MAAA,CAAO;AAAA,SAC5B;AAAA,OACJ;AAAA,KACH;AAAA,EACF;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"AppLanguageApi.esm.js","sources":["../../src/extensions/AppLanguageApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { AppLanguageSelector } from '../../../../packages/core-app-api/src/apis/implementations/AppLanguageApi';\nimport { appLanguageApiRef } from '@backstage/frontend-plugin-api';\nimport { ApiBlueprint } from '@backstage/frontend-plugin-api';\nimport { z } from 'zod/v4';\n\nexport const AppLanguageApi = ApiBlueprint.makeWithOverrides({\n name: 'app-language',\n configSchema: {\n defaultLanguage: z.string().optional(),\n availableLanguages: z.array(z.string()).optional(),\n },\n factory(originalFactory, { config }) {\n return originalFactory(defineParams =>\n defineParams({\n api: appLanguageApiRef,\n deps: {},\n factory: () =>\n AppLanguageSelector.createWithStorage({\n defaultLanguage: config.defaultLanguage,\n availableLanguages: config.availableLanguages,\n }),\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;;AAsBO,MAAM,cAAA,GAAiB,aAAa,iBAAA,CAAkB;AAAA,EAC3D,IAAA,EAAM,cAAA;AAAA,EACN,YAAA,EAAc;AAAA,IACZ,eAAA,EAAiB,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,IACrC,oBAAoB,CAAA,CAAE,KAAA,CAAM,EAAE,MAAA,EAAQ,EAAE,QAAA;AAAS,GACnD;AAAA,EACA,OAAA,CAAQ,eAAA,EAAiB,EAAE,MAAA,EAAO,EAAG;AACnC,IAAA,OAAO,eAAA;AAAA,MAAgB,kBACrB,YAAA,CAAa;AAAA,QACX,GAAA,EAAK,iBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MACP,mBAAA,CAAoB,iBAAA,CAAkB;AAAA,UACpC,iBAAiB,MAAA,CAAO,eAAA;AAAA,UACxB,oBAAoB,MAAA,CAAO;AAAA,SAC5B;AAAA,OACJ;AAAA,KACH;AAAA,EACF;AACF,CAAC;;;;"}
@@ -1,4 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
+ import { z } from 'zod/v4';
2
3
  import { createExtension, coreExtensionData, createExtensionInput, NotFoundErrorPage } from '@backstage/frontend-plugin-api';
3
4
  import { useRoutes, Navigate } from 'react-router-dom';
4
5
 
@@ -12,15 +13,13 @@ const AppRoutes = createExtension({
12
13
  coreExtensionData.reactElement
13
14
  ])
14
15
  },
15
- config: {
16
- schema: {
17
- redirects: (z) => z.array(
18
- z.object({
19
- from: z.string(),
20
- to: z.string()
21
- })
22
- ).optional()
23
- }
16
+ configSchema: {
17
+ redirects: z.array(
18
+ z.object({
19
+ from: z.string(),
20
+ to: z.string()
21
+ })
22
+ ).optional()
24
23
  },
25
24
  output: [coreExtensionData.reactElement],
26
25
  factory({ inputs, config }) {
@@ -1 +1 @@
1
- {"version":3,"file":"AppRoutes.esm.js","sources":["../../src/extensions/AppRoutes.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createExtension,\n coreExtensionData,\n createExtensionInput,\n NotFoundErrorPage,\n} from '@backstage/frontend-plugin-api';\nimport { Navigate, useRoutes } from 'react-router-dom';\n\nexport const AppRoutes = createExtension({\n name: 'routes',\n attachTo: { id: 'app/layout', input: 'content' },\n inputs: {\n routes: createExtensionInput([\n coreExtensionData.routePath,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.reactElement,\n ]),\n },\n config: {\n schema: {\n redirects: z =>\n z\n .array(\n z.object({\n from: z.string(),\n to: z.string(),\n }),\n )\n .optional(),\n },\n },\n output: [coreExtensionData.reactElement],\n factory({ inputs, config }) {\n const redirects = config.redirects ?? [];\n\n const Routes = () => {\n const element = useRoutes([\n ...redirects.map(redirect => ({\n path:\n redirect.from === '/'\n ? redirect.from\n : `${redirect.from.replace(/\\/$/, '')}/*`,\n element: <Navigate to={redirect.to} replace />,\n })),\n ...inputs.routes.map(route => {\n const routePath = route.get(coreExtensionData.routePath);\n\n return {\n path:\n routePath === '/'\n ? routePath\n : `${routePath.replace(/\\/$/, '')}/*`,\n\n element: route.get(coreExtensionData.reactElement),\n };\n }),\n {\n path: '*',\n element: <NotFoundErrorPage />,\n },\n ]);\n\n return element;\n };\n\n return [coreExtensionData.reactElement(<Routes />)];\n },\n});\n"],"names":[],"mappings":";;;;AAwBO,MAAM,YAAY,eAAA,CAAgB;AAAA,EACvC,IAAA,EAAM,QAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,YAAA,EAAc,OAAO,SAAA,EAAU;AAAA,EAC/C,MAAA,EAAQ;AAAA,IACN,QAAQ,oBAAA,CAAqB;AAAA,MAC3B,iBAAA,CAAkB,SAAA;AAAA,MAClB,iBAAA,CAAkB,SAAS,QAAA,EAAS;AAAA,MACpC,iBAAA,CAAkB;AAAA,KACnB;AAAA,GACH;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ;AAAA,MACN,SAAA,EAAW,OACT,CAAA,CACG,KAAA;AAAA,QACC,EAAE,MAAA,CAAO;AAAA,UACP,IAAA,EAAM,EAAE,MAAA,EAAO;AAAA,UACf,EAAA,EAAI,EAAE,MAAA;AAAO,SACd;AAA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,GAAA,CAAC,MAAA,EAAA,EAAO,CAAE,CAAC,CAAA;AAAA,EACpD;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"AppRoutes.esm.js","sources":["../../src/extensions/AppRoutes.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { z } from 'zod/v4';\nimport {\n createExtension,\n coreExtensionData,\n createExtensionInput,\n NotFoundErrorPage,\n} from '@backstage/frontend-plugin-api';\nimport { Navigate, useRoutes } from 'react-router-dom';\n\nexport const AppRoutes = createExtension({\n name: 'routes',\n attachTo: { id: 'app/layout', input: 'content' },\n inputs: {\n routes: createExtensionInput([\n coreExtensionData.routePath,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.reactElement,\n ]),\n },\n configSchema: {\n redirects: z\n .array(\n z.object({\n from: z.string(),\n to: z.string(),\n }),\n )\n .optional(),\n },\n output: [coreExtensionData.reactElement],\n factory({ inputs, config }) {\n const redirects = config.redirects ?? [];\n\n const Routes = () => {\n const element = useRoutes([\n ...redirects.map(redirect => ({\n path:\n redirect.from === '/'\n ? redirect.from\n : `${redirect.from.replace(/\\/$/, '')}/*`,\n element: <Navigate to={redirect.to} replace />,\n })),\n ...inputs.routes.map(route => {\n const routePath = route.get(coreExtensionData.routePath);\n\n return {\n path:\n routePath === '/'\n ? routePath\n : `${routePath.replace(/\\/$/, '')}/*`,\n\n element: route.get(coreExtensionData.reactElement),\n };\n }),\n {\n path: '*',\n element: <NotFoundErrorPage />,\n },\n ]);\n\n return element;\n };\n\n return [coreExtensionData.reactElement(<Routes />)];\n },\n});\n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AAM,SAAA,GAAY,KAAA,CAAM,GAAA,CAAI,iBAAA,CAAkB,SAAS,CAAA;AAEvD,UAAA,OAAO;AAAA,YACL,IAAA,EACE,cAAc,GAAA,GACV,SAAA,GACA,GAAG,SAAA,CAAU,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAC,CAAA,EAAA,CAAA;AAAA,YAErC,OAAA,EAAS,KAAA,CAAM,GAAA,CAAI,iBAAA,CAAkB,YAAY;AAAA,WACnD;AAAA,QACF,CAAC,CAAA;AAAA,QACD;AAAA,UACE,IAAA,EAAM,GAAA;AAAA,UACN,OAAA,sBAAU,iBAAA,EAAA,EAAkB;AAAA;AAC9B,OACD,CAAA;AAED,MAAA,OAAO,OAAA;AAAA,IACT,CAAA;AAEA,IAAA,OAAO,CAAC,iBAAA,CAAkB,YAAA,iBAAa,GAAA,CAAC,MAAA,EAAA,EAAO,CAAE,CAAC,CAAA;AAAA,EACpD;AACF,CAAC;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { OAuthRequestDialog } from '@backstage/core-components';
3
3
  import { AppRootElementBlueprint } from '@backstage/frontend-plugin-api';
4
+ import { z } from 'zod/v4';
4
5
  import { ToastDisplay } from '../components/Toast/ToastDisplay.esm.js';
5
6
  import '../components/Toast/ToastContainer.esm.js';
6
7
 
@@ -12,14 +13,15 @@ const oauthRequestDialogAppRootElement = AppRootElementBlueprint.make({
12
13
  });
13
14
  const alertDisplayAppRootElement = AppRootElementBlueprint.makeWithOverrides({
14
15
  name: "alert-display",
15
- config: {
16
- schema: {
17
- transientTimeoutMs: (z) => z.number().default(5e3),
18
- anchorOrigin: (z) => z.object({
19
- vertical: z.enum(["top", "bottom"]).default("top"),
20
- horizontal: z.enum(["left", "center", "right"]).default("center")
21
- }).default({})
22
- }
16
+ configSchema: {
17
+ transientTimeoutMs: z.number().default(5e3),
18
+ anchorOrigin: z.object({
19
+ vertical: z.enum(["top", "bottom"]).default("top"),
20
+ horizontal: z.enum(["left", "center", "right"]).default("center")
21
+ }).default({
22
+ vertical: "top",
23
+ horizontal: "center"
24
+ })
23
25
  },
24
26
  factory: (originalFactory, { config }) => {
25
27
  return originalFactory({
@@ -1 +1 @@
1
- {"version":3,"file":"elements.esm.js","sources":["../../src/extensions/elements.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OAuthRequestDialog } from '@backstage/core-components';\nimport { AppRootElementBlueprint } from '@backstage/frontend-plugin-api';\nimport { ToastDisplay } from '../components/Toast';\n\nexport const oauthRequestDialogAppRootElement = AppRootElementBlueprint.make({\n name: 'oauth-request-dialog',\n params: {\n element: <OAuthRequestDialog />,\n },\n});\n\nexport const alertDisplayAppRootElement =\n AppRootElementBlueprint.makeWithOverrides({\n name: 'alert-display',\n config: {\n schema: {\n transientTimeoutMs: z => z.number().default(5000),\n anchorOrigin: z =>\n z\n .object({\n vertical: z.enum(['top', 'bottom']).default('top'),\n horizontal: z.enum(['left', 'center', 'right']).default('center'),\n })\n .default({}),\n },\n },\n factory: (originalFactory, { config }) => {\n return originalFactory({\n element: (\n <ToastDisplay transientTimeoutMs={config.transientTimeoutMs} />\n ),\n });\n },\n });\n"],"names":[],"mappings":";;;;;;AAoBO,MAAM,gCAAA,GAAmC,wBAAwB,IAAA,CAAK;AAAA,EAC3E,IAAA,EAAM,sBAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,OAAA,sBAAU,kBAAA,EAAA,EAAmB;AAAA;AAEjC,CAAC;AAEM,MAAM,0BAAA,GACX,wBAAwB,iBAAA,CAAkB;AAAA,EACxC,IAAA,EAAM,eAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ;AAAA,MACN,oBAAoB,CAAA,CAAA,KAAK,CAAA,CAAE,MAAA,EAAO,CAAE,QAAQ,GAAI,CAAA;AAAA,MAChD,YAAA,EAAc,CAAA,CAAA,KACZ,CAAA,CACG,MAAA,CAAO;AAAA,QACN,QAAA,EAAU,EAAE,IAAA,CAAK,CAAC,OAAO,QAAQ,CAAC,CAAA,CAAE,OAAA,CAAQ,KAAK,CAAA;AAAA,QACjD,UAAA,EAAY,CAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,UAAU,OAAO,CAAC,CAAA,CAAE,OAAA,CAAQ,QAAQ;AAAA,OACjE,CAAA,CACA,OAAA,CAAQ,EAAE;AAAA;AACjB,GACF;AAAA,EACA,OAAA,EAAS,CAAC,eAAA,EAAiB,EAAE,QAAO,KAAM;AACxC,IAAA,OAAO,eAAA,CAAgB;AAAA,MACrB,OAAA,kBACE,GAAA,CAAC,YAAA,EAAA,EAAa,kBAAA,EAAoB,OAAO,kBAAA,EAAoB;AAAA,KAEhE,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"elements.esm.js","sources":["../../src/extensions/elements.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OAuthRequestDialog } from '@backstage/core-components';\nimport { AppRootElementBlueprint } from '@backstage/frontend-plugin-api';\nimport { z } from 'zod/v4';\nimport { ToastDisplay } from '../components/Toast';\n\nexport const oauthRequestDialogAppRootElement = AppRootElementBlueprint.make({\n name: 'oauth-request-dialog',\n params: {\n element: <OAuthRequestDialog />,\n },\n});\n\nexport const alertDisplayAppRootElement =\n AppRootElementBlueprint.makeWithOverrides({\n name: 'alert-display',\n configSchema: {\n transientTimeoutMs: z.number().default(5000),\n anchorOrigin: z\n .object({\n vertical: z.enum(['top', 'bottom']).default('top'),\n horizontal: z.enum(['left', 'center', 'right']).default('center'),\n })\n .default({\n vertical: 'top',\n horizontal: 'center',\n }),\n },\n factory: (originalFactory, { config }) => {\n return originalFactory({\n element: (\n <ToastDisplay transientTimeoutMs={config.transientTimeoutMs} />\n ),\n });\n },\n });\n"],"names":[],"mappings":";;;;;;;AAqBO,MAAM,gCAAA,GAAmC,wBAAwB,IAAA,CAAK;AAAA,EAC3E,IAAA,EAAM,sBAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,OAAA,sBAAU,kBAAA,EAAA,EAAmB;AAAA;AAEjC,CAAC;AAEM,MAAM,0BAAA,GACX,wBAAwB,iBAAA,CAAkB;AAAA,EACxC,IAAA,EAAM,eAAA;AAAA,EACN,YAAA,EAAc;AAAA,IACZ,kBAAA,EAAoB,CAAA,CAAE,MAAA,EAAO,CAAE,QAAQ,GAAI,CAAA;AAAA,IAC3C,YAAA,EAAc,EACX,MAAA,CAAO;AAAA,MACN,QAAA,EAAU,EAAE,IAAA,CAAK,CAAC,OAAO,QAAQ,CAAC,CAAA,CAAE,OAAA,CAAQ,KAAK,CAAA;AAAA,MACjD,UAAA,EAAY,CAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,UAAU,OAAO,CAAC,CAAA,CAAE,OAAA,CAAQ,QAAQ;AAAA,KACjE,EACA,OAAA,CAAQ;AAAA,MACP,QAAA,EAAU,KAAA;AAAA,MACV,UAAA,EAAY;AAAA,KACb;AAAA,GACL;AAAA,EACA,OAAA,EAAS,CAAC,eAAA,EAAiB,EAAE,QAAO,KAAM;AACxC,IAAA,OAAO,eAAA,CAAgB;AAAA,MACrB,OAAA,kBACE,GAAA,CAAC,YAAA,EAAA,EAAa,kBAAA,EAAoB,OAAO,kBAAA,EAAoB;AAAA,KAEhE,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
package/dist/index.d.ts CHANGED
@@ -485,16 +485,16 @@ declare const appPlugin: _backstage_frontend_plugin_api.OverridableFrontendPlugi
485
485
  config: {
486
486
  transientTimeoutMs: number;
487
487
  anchorOrigin: {
488
- horizontal: "center" | "left" | "right";
489
488
  vertical: "top" | "bottom";
489
+ horizontal: "center" | "left" | "right";
490
490
  };
491
491
  };
492
492
  configInput: {
493
+ transientTimeoutMs?: number | undefined;
493
494
  anchorOrigin?: {
494
- horizontal?: "center" | "left" | "right" | undefined;
495
495
  vertical?: "top" | "bottom" | undefined;
496
+ horizontal?: "center" | "left" | "right" | undefined;
496
497
  } | undefined;
497
- transientTimeoutMs?: number | undefined;
498
498
  };
499
499
  output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}>;
500
500
  inputs: {};
@@ -1,5 +1,5 @@
1
1
  var name = "@backstage/plugin-app";
2
- var version = "0.4.3";
2
+ var version = "0.4.4";
3
3
  var backstage = {
4
4
  role: "frontend-plugin",
5
5
  pluginId: "app",
@@ -64,12 +64,11 @@ var dependencies = {
64
64
  "@material-ui/core": "^4.9.13",
65
65
  "@material-ui/icons": "^4.9.1",
66
66
  "@material-ui/lab": "^4.0.0-alpha.61",
67
- "@react-aria/button": "^3.14.3",
68
- "@react-aria/toast": "^3.0.9",
69
67
  "@react-hookz/web": "^24.0.0",
70
- "@react-stately/toast": "^3.1.2",
71
68
  "@remixicon/react": "^4.6.0",
72
69
  motion: "^12.0.0",
70
+ "react-aria": "^3.48.0",
71
+ "react-stately": "^3.46.0",
73
72
  "react-use": "^17.2.4",
74
73
  "zen-observable": "^0.10.0",
75
74
  zod: "^3.25.76 || ^4.0.0"
@@ -1 +1 @@
1
- {"version":3,"file":"package.json.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"package.json.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-app",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "backstage": {
5
5
  "role": "frontend-plugin",
6
6
  "pluginId": "app",
@@ -66,23 +66,22 @@
66
66
  "@backstage/core-components": "^0.18.9",
67
67
  "@backstage/core-plugin-api": "^1.12.5",
68
68
  "@backstage/filter-predicates": "^0.1.2",
69
- "@backstage/frontend-plugin-api": "^0.16.0",
69
+ "@backstage/frontend-plugin-api": "^0.16.1",
70
70
  "@backstage/integration-react": "^1.2.17",
71
71
  "@backstage/plugin-app-react": "^0.2.2",
72
72
  "@backstage/plugin-permission-react": "^0.5.0",
73
73
  "@backstage/theme": "^0.7.3",
74
74
  "@backstage/types": "^1.2.2",
75
- "@backstage/ui": "^0.14.0",
75
+ "@backstage/ui": "^0.14.1",
76
76
  "@backstage/version-bridge": "^1.0.12",
77
77
  "@material-ui/core": "^4.9.13",
78
78
  "@material-ui/icons": "^4.9.1",
79
79
  "@material-ui/lab": "^4.0.0-alpha.61",
80
- "@react-aria/button": "^3.14.3",
81
- "@react-aria/toast": "^3.0.9",
82
80
  "@react-hookz/web": "^24.0.0",
83
- "@react-stately/toast": "^3.1.2",
84
81
  "@remixicon/react": "^4.6.0",
85
82
  "motion": "^12.0.0",
83
+ "react-aria": "^3.48.0",
84
+ "react-stately": "^3.46.0",
86
85
  "react-use": "^17.2.4",
87
86
  "zen-observable": "^0.10.0",
88
87
  "zod": "^3.25.76 || ^4.0.0"