@cloudscape-design/components 3.0.786 → 3.0.787

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.
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/button/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAsB3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAQlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG;IAC/D,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,eAAe,GAAG,kBAAkB,GAAG,cAAc,GAAG,eAAe,CAAC;IAC3G,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EACf,CAAC,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC,GACnF,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,GAAG,0BAA0B,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAAC;AAEtE,eAAO,MAAM,cAAc;cAbf,WAAW,CAAC,SAAS,CAAC,GAAG,eAAe,GAAG,kBAAkB,GAAG,cAAc,GAAG,eAAe;;;;;;;;;6GAyP3G,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/button/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAsB3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AASlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG;IAC/D,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,eAAe,GAAG,kBAAkB,GAAG,cAAc,GAAG,eAAe,CAAC;IAC3G,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EACf,CAAC,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC,GACnF,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,GAAG,0BAA0B,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAAC;AAEtE,eAAO,MAAM,cAAc;cAbf,WAAW,CAAC,SAAS,CAAC,GAAG,eAAe,GAAG,kBAAkB,GAAG,cAAc,GAAG,eAAe;;;;;;;;;6GA0P3G,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -15,6 +15,7 @@ import { fireCancelableEvent, isPlainLeftClick } from '../internal/events';
15
15
  import useForwardFocus from '../internal/hooks/forward-focus';
16
16
  import useHiddenDescription from '../internal/hooks/use-hidden-description';
17
17
  import { useMergeRefs } from '../internal/hooks/use-merge-refs';
18
+ import { useModalContextLoadingButtonComponent } from '../internal/hooks/use-modal-component-analytics';
18
19
  import { usePerformanceMarks } from '../internal/hooks/use-performance-marks';
19
20
  import { useUniqueId } from '../internal/hooks/use-unique-id';
20
21
  import { checkSafeUrl } from '../internal/utils/check-safe-url';
@@ -46,6 +47,7 @@ export const InternalButton = React.forwardRef((_a, ref) => {
46
47
  text: (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.innerText,
47
48
  });
48
49
  }, [loading, disabled]);
50
+ useModalContextLoadingButtonComponent(variant === 'primary', loading);
49
51
  const { targetProps, descriptionEl } = useHiddenDescription(disabledReason);
50
52
  const handleClick = (event) => {
51
53
  if (isNotInteractive) {
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/button/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,kEAAkE,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AACpG,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAC5D,OAAO,OAAO,MAAM,yCAAyC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAE9D,OAAO,oBAAoB,MAAM,0CAA0C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CAAC,yBAAyB,CAAC,EACpD,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,cAAe,GACtB,CACH,CACA,CACJ,CACM;QACR,OAAO,IAAI,WAAW,IAAI,oBAAC,UAAU,QAAE,WAAW,CAAc,CAChE,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport {\n getAnalyticsLabelAttribute,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FUNNEL_VALUE,\n getFunnelValueSelector,\n getSubStepAllSelector,\n getTextFromSelector,\n} from '../internal/analytics/selectors';\nimport LiveRegion from '../internal/components/live-region';\nimport Tooltip from '../internal/components/tooltip/index.js';\nimport { useButtonContext } from '../internal/context/button-context';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireCancelableEvent, isPlainLeftClick } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport useHiddenDescription from '../internal/hooks/use-hidden-description';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { usePerformanceMarks } from '../internal/hooks/use-performance-marks';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport { GeneratedAnalyticsMetadataButtonFragment } from './analytics-metadata/interfaces';\nimport { ButtonIconProps, LeftIcon, RightIcon } from './icon-helper';\nimport { ButtonProps } from './interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport type InternalButtonProps = Omit<ButtonProps, 'variant'> & {\n variant?: ButtonProps['variant'] | 'flashbar-icon' | 'breadcrumb-group' | 'menu-trigger' | 'modal-dismiss';\n badge?: boolean;\n analyticsAction?: string;\n __nativeAttributes?:\n | (React.HTMLAttributes<HTMLAnchorElement> & React.HTMLAttributes<HTMLButtonElement>)\n | Record<`data-${string}`, string>;\n __iconClass?: string;\n __focusable?: boolean;\n __injectAnalyticsComponentMetadata?: boolean;\n __title?: string;\n __emitPerformanceMarks?: boolean;\n} & InternalBaseComponentProps<HTMLAnchorElement | HTMLButtonElement>;\n\nexport const InternalButton = React.forwardRef(\n (\n {\n children,\n iconName,\n __iconClass,\n onClick,\n onFollow,\n iconAlign = 'left',\n iconUrl,\n iconSvg,\n iconAlt,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n wrapText = true,\n href,\n target,\n rel,\n download,\n formAction = 'submit',\n ariaLabel,\n ariaDescribedby,\n ariaExpanded,\n ariaControls,\n fullWidth,\n badge,\n __nativeAttributes,\n __internalRootRef = null,\n __focusable = false,\n __injectAnalyticsComponentMetadata = false,\n __title,\n __emitPerformanceMarks = true,\n analyticsAction = 'click',\n ...props\n }: InternalButtonProps,\n ref: React.Ref<ButtonProps.Ref>\n ) => {\n const [showTooltip, setShowTooltip] = useState(false);\n\n checkSafeUrl('Button', href);\n const isAnchor = Boolean(href);\n const isNotInteractive = loading || disabled;\n const isDisabledWithReason = (variant === 'normal' || variant === 'primary') && !!disabledReason && disabled;\n const hasAriaDisabled = (loading && !disabled) || (disabled && __focusable) || isDisabledWithReason;\n const shouldHaveContent =\n children && ['icon', 'inline-icon', 'flashbar-icon', 'modal-dismiss'].indexOf(variant) === -1;\n\n const buttonRef = useRef<HTMLElement>(null);\n useForwardFocus(ref, buttonRef);\n\n const buttonContext = useButtonContext();\n\n const uniqueId = useUniqueId('button');\n const { funnelInteractionId } = useFunnel();\n const { stepNumber, stepNameSelector } = useFunnelStep();\n const { subStepSelector, subStepNameSelector } = useFunnelSubStep();\n\n const performanceMarkAttributes = usePerformanceMarks(\n 'primaryButton',\n variant === 'primary' && __emitPerformanceMarks,\n buttonRef,\n () => ({\n loading,\n disabled,\n text: buttonRef.current?.innerText,\n }),\n [loading, disabled]\n );\n\n const { targetProps, descriptionEl } = useHiddenDescription(disabledReason);\n\n const handleClick = (event: React.MouseEvent) => {\n if (isNotInteractive) {\n return event.preventDefault();\n }\n\n if (isAnchor && isPlainLeftClick(event)) {\n fireCancelableEvent(onFollow, { href, target }, event);\n\n if ((iconName === 'external' || target === '_blank') && funnelInteractionId) {\n const stepName = getTextFromSelector(stepNameSelector);\n const subStepName = getTextFromSelector(subStepNameSelector);\n\n FunnelMetrics.externalLinkInteracted({\n funnelInteractionId,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n elementSelector: getFunnelValueSelector(uniqueId),\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n }\n\n const { altKey, button, ctrlKey, metaKey, shiftKey } = event;\n fireCancelableEvent(onClick, { altKey, button, ctrlKey, metaKey, shiftKey }, event);\n buttonContext.onClick({ variant });\n };\n\n const buttonClass = clsx(props.className, styles.button, styles[`variant-${variant}`], {\n [styles.disabled]: isNotInteractive,\n [styles['button-no-wrap']]: !wrapText,\n [styles['button-no-text']]: !shouldHaveContent,\n [styles['full-width']]: shouldHaveContent && fullWidth,\n [styles.link]: isAnchor,\n });\n\n const explicitTabIndex =\n __nativeAttributes && 'tabIndex' in __nativeAttributes ? __nativeAttributes.tabIndex : undefined;\n const { tabIndex } = useSingleTabStopNavigation(buttonRef, {\n tabIndex: isAnchor && isNotInteractive ? -1 : explicitTabIndex,\n });\n\n const analyticsMetadata: GeneratedAnalyticsMetadataButtonFragment = disabled\n ? {}\n : {\n action: analyticsAction,\n detail: { label: { root: 'self' } },\n };\n if (__injectAnalyticsComponentMetadata) {\n analyticsMetadata.component = {\n name: 'awsui.Button',\n label: { root: 'self' },\n properties: { variant, disabled: `${disabled}` },\n };\n }\n\n const buttonProps = {\n ...props,\n ...__nativeAttributes,\n ...performanceMarkAttributes,\n tabIndex,\n // https://github.com/microsoft/TypeScript/issues/36659\n ref: useMergeRefs(buttonRef, __internalRootRef),\n 'aria-label': ariaLabel,\n 'aria-describedby': ariaDescribedby,\n 'aria-expanded': ariaExpanded,\n 'aria-controls': ariaControls,\n // add ariaLabel as `title` as visible hint text\n title: __title ?? ariaLabel,\n className: buttonClass,\n onClick: handleClick,\n [DATA_ATTR_FUNNEL_VALUE]: uniqueId,\n ...getAnalyticsMetadataAttribute(analyticsMetadata),\n ...getAnalyticsLabelAttribute(children ? `.${analyticsSelectors.label}` : ''),\n } as const;\n\n const iconProps: ButtonIconProps = {\n loading,\n iconName,\n iconAlign,\n iconUrl,\n iconSvg,\n iconAlt,\n variant,\n badge,\n iconClass: __iconClass,\n iconSize: variant === 'modal-dismiss' ? 'medium' : 'normal',\n };\n const buttonContent = (\n <>\n <LeftIcon {...iconProps} />\n {shouldHaveContent && <span className={clsx(styles.content, analyticsSelectors.label)}>{children}</span>}\n <RightIcon {...iconProps} />\n </>\n );\n\n const { loadingButtonCount } = useFunnel();\n useEffect(() => {\n if (loading) {\n loadingButtonCount.current++;\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n loadingButtonCount.current--;\n };\n }\n }, [loading, loadingButtonCount]);\n\n if (isAnchor) {\n return (\n // https://github.com/yannickcr/eslint-plugin-react/issues/2962\n // eslint-disable-next-line react/jsx-no-target-blank\n <>\n <a\n {...buttonProps}\n href={href}\n target={target}\n // security recommendation: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target\n rel={rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined)}\n aria-disabled={isNotInteractive ? true : undefined}\n download={download}\n >\n {buttonContent}\n </a>\n {loading && loadingText && <LiveRegion>{loadingText}</LiveRegion>}\n </>\n );\n }\n\n return (\n <>\n <button\n {...buttonProps}\n type={formAction === 'none' ? 'button' : 'submit'}\n disabled={disabled && !__focusable && !isDisabledWithReason}\n aria-disabled={hasAriaDisabled ? true : undefined}\n onFocus={isDisabledWithReason ? () => setShowTooltip(true) : undefined}\n onBlur={isDisabledWithReason ? () => setShowTooltip(false) : undefined}\n onMouseEnter={isDisabledWithReason ? () => setShowTooltip(true) : undefined}\n onMouseLeave={isDisabledWithReason ? () => setShowTooltip(false) : undefined}\n {...(isDisabledWithReason ? targetProps : {})}\n >\n {buttonContent}\n {isDisabledWithReason && (\n <>\n {descriptionEl}\n {showTooltip && (\n <Tooltip\n className={testUtilStyles['disabled-reason-tooltip']}\n trackRef={buttonRef}\n value={disabledReason!}\n />\n )}\n </>\n )}\n </button>\n {loading && loadingText && <LiveRegion>{loadingText}</LiveRegion>}\n </>\n );\n }\n);\n\nexport default InternalButton;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/button/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,kEAAkE,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AACpG,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAC5D,OAAO,OAAO,MAAM,yCAAyC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AAC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AAC,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,IACxE,CAAC,oBAAoB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;YAE5C,aAAa;YACb,oBAAoB,IAAI,CACvB;gBACG,aAAa;gBACb,WAAW,IAAI,CACd,oBAAC,OAAO,IACN,SAAS,EAAE,cAAc,CAAC,yBAAyB,CAAC,EACpD,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,cAAe,GACtB,CACH,CACA,CACJ,CACM;QACR,OAAO,IAAI,WAAW,IAAI,oBAAC,UAAU,QAAE,WAAW,CAAc,CAChE,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport {\n getAnalyticsLabelAttribute,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FUNNEL_VALUE,\n getFunnelValueSelector,\n getSubStepAllSelector,\n getTextFromSelector,\n} from '../internal/analytics/selectors';\nimport LiveRegion from '../internal/components/live-region';\nimport Tooltip from '../internal/components/tooltip/index.js';\nimport { useButtonContext } from '../internal/context/button-context';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireCancelableEvent, isPlainLeftClick } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport useHiddenDescription from '../internal/hooks/use-hidden-description';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useModalContextLoadingButtonComponent } from '../internal/hooks/use-modal-component-analytics';\nimport { usePerformanceMarks } from '../internal/hooks/use-performance-marks';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport { GeneratedAnalyticsMetadataButtonFragment } from './analytics-metadata/interfaces';\nimport { ButtonIconProps, LeftIcon, RightIcon } from './icon-helper';\nimport { ButtonProps } from './interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport type InternalButtonProps = Omit<ButtonProps, 'variant'> & {\n variant?: ButtonProps['variant'] | 'flashbar-icon' | 'breadcrumb-group' | 'menu-trigger' | 'modal-dismiss';\n badge?: boolean;\n analyticsAction?: string;\n __nativeAttributes?:\n | (React.HTMLAttributes<HTMLAnchorElement> & React.HTMLAttributes<HTMLButtonElement>)\n | Record<`data-${string}`, string>;\n __iconClass?: string;\n __focusable?: boolean;\n __injectAnalyticsComponentMetadata?: boolean;\n __title?: string;\n __emitPerformanceMarks?: boolean;\n} & InternalBaseComponentProps<HTMLAnchorElement | HTMLButtonElement>;\n\nexport const InternalButton = React.forwardRef(\n (\n {\n children,\n iconName,\n __iconClass,\n onClick,\n onFollow,\n iconAlign = 'left',\n iconUrl,\n iconSvg,\n iconAlt,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n wrapText = true,\n href,\n target,\n rel,\n download,\n formAction = 'submit',\n ariaLabel,\n ariaDescribedby,\n ariaExpanded,\n ariaControls,\n fullWidth,\n badge,\n __nativeAttributes,\n __internalRootRef = null,\n __focusable = false,\n __injectAnalyticsComponentMetadata = false,\n __title,\n __emitPerformanceMarks = true,\n analyticsAction = 'click',\n ...props\n }: InternalButtonProps,\n ref: React.Ref<ButtonProps.Ref>\n ) => {\n const [showTooltip, setShowTooltip] = useState(false);\n\n checkSafeUrl('Button', href);\n const isAnchor = Boolean(href);\n const isNotInteractive = loading || disabled;\n const isDisabledWithReason = (variant === 'normal' || variant === 'primary') && !!disabledReason && disabled;\n const hasAriaDisabled = (loading && !disabled) || (disabled && __focusable) || isDisabledWithReason;\n const shouldHaveContent =\n children && ['icon', 'inline-icon', 'flashbar-icon', 'modal-dismiss'].indexOf(variant) === -1;\n\n const buttonRef = useRef<HTMLElement>(null);\n useForwardFocus(ref, buttonRef);\n\n const buttonContext = useButtonContext();\n\n const uniqueId = useUniqueId('button');\n const { funnelInteractionId } = useFunnel();\n const { stepNumber, stepNameSelector } = useFunnelStep();\n const { subStepSelector, subStepNameSelector } = useFunnelSubStep();\n\n const performanceMarkAttributes = usePerformanceMarks(\n 'primaryButton',\n variant === 'primary' && __emitPerformanceMarks,\n buttonRef,\n () => ({\n loading,\n disabled,\n text: buttonRef.current?.innerText,\n }),\n [loading, disabled]\n );\n useModalContextLoadingButtonComponent(variant === 'primary', loading);\n\n const { targetProps, descriptionEl } = useHiddenDescription(disabledReason);\n\n const handleClick = (event: React.MouseEvent) => {\n if (isNotInteractive) {\n return event.preventDefault();\n }\n\n if (isAnchor && isPlainLeftClick(event)) {\n fireCancelableEvent(onFollow, { href, target }, event);\n\n if ((iconName === 'external' || target === '_blank') && funnelInteractionId) {\n const stepName = getTextFromSelector(stepNameSelector);\n const subStepName = getTextFromSelector(subStepNameSelector);\n\n FunnelMetrics.externalLinkInteracted({\n funnelInteractionId,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n elementSelector: getFunnelValueSelector(uniqueId),\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n }\n\n const { altKey, button, ctrlKey, metaKey, shiftKey } = event;\n fireCancelableEvent(onClick, { altKey, button, ctrlKey, metaKey, shiftKey }, event);\n buttonContext.onClick({ variant });\n };\n\n const buttonClass = clsx(props.className, styles.button, styles[`variant-${variant}`], {\n [styles.disabled]: isNotInteractive,\n [styles['button-no-wrap']]: !wrapText,\n [styles['button-no-text']]: !shouldHaveContent,\n [styles['full-width']]: shouldHaveContent && fullWidth,\n [styles.link]: isAnchor,\n });\n\n const explicitTabIndex =\n __nativeAttributes && 'tabIndex' in __nativeAttributes ? __nativeAttributes.tabIndex : undefined;\n const { tabIndex } = useSingleTabStopNavigation(buttonRef, {\n tabIndex: isAnchor && isNotInteractive ? -1 : explicitTabIndex,\n });\n\n const analyticsMetadata: GeneratedAnalyticsMetadataButtonFragment = disabled\n ? {}\n : {\n action: analyticsAction,\n detail: { label: { root: 'self' } },\n };\n if (__injectAnalyticsComponentMetadata) {\n analyticsMetadata.component = {\n name: 'awsui.Button',\n label: { root: 'self' },\n properties: { variant, disabled: `${disabled}` },\n };\n }\n\n const buttonProps = {\n ...props,\n ...__nativeAttributes,\n ...performanceMarkAttributes,\n tabIndex,\n // https://github.com/microsoft/TypeScript/issues/36659\n ref: useMergeRefs(buttonRef, __internalRootRef),\n 'aria-label': ariaLabel,\n 'aria-describedby': ariaDescribedby,\n 'aria-expanded': ariaExpanded,\n 'aria-controls': ariaControls,\n // add ariaLabel as `title` as visible hint text\n title: __title ?? ariaLabel,\n className: buttonClass,\n onClick: handleClick,\n [DATA_ATTR_FUNNEL_VALUE]: uniqueId,\n ...getAnalyticsMetadataAttribute(analyticsMetadata),\n ...getAnalyticsLabelAttribute(children ? `.${analyticsSelectors.label}` : ''),\n } as const;\n\n const iconProps: ButtonIconProps = {\n loading,\n iconName,\n iconAlign,\n iconUrl,\n iconSvg,\n iconAlt,\n variant,\n badge,\n iconClass: __iconClass,\n iconSize: variant === 'modal-dismiss' ? 'medium' : 'normal',\n };\n const buttonContent = (\n <>\n <LeftIcon {...iconProps} />\n {shouldHaveContent && <span className={clsx(styles.content, analyticsSelectors.label)}>{children}</span>}\n <RightIcon {...iconProps} />\n </>\n );\n\n const { loadingButtonCount } = useFunnel();\n useEffect(() => {\n if (loading) {\n loadingButtonCount.current++;\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n loadingButtonCount.current--;\n };\n }\n }, [loading, loadingButtonCount]);\n\n if (isAnchor) {\n return (\n // https://github.com/yannickcr/eslint-plugin-react/issues/2962\n // eslint-disable-next-line react/jsx-no-target-blank\n <>\n <a\n {...buttonProps}\n href={href}\n target={target}\n // security recommendation: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target\n rel={rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined)}\n aria-disabled={isNotInteractive ? true : undefined}\n download={download}\n >\n {buttonContent}\n </a>\n {loading && loadingText && <LiveRegion>{loadingText}</LiveRegion>}\n </>\n );\n }\n\n return (\n <>\n <button\n {...buttonProps}\n type={formAction === 'none' ? 'button' : 'submit'}\n disabled={disabled && !__focusable && !isDisabledWithReason}\n aria-disabled={hasAriaDisabled ? true : undefined}\n onFocus={isDisabledWithReason ? () => setShowTooltip(true) : undefined}\n onBlur={isDisabledWithReason ? () => setShowTooltip(false) : undefined}\n onMouseEnter={isDisabledWithReason ? () => setShowTooltip(true) : undefined}\n onMouseLeave={isDisabledWithReason ? () => setShowTooltip(false) : undefined}\n {...(isDisabledWithReason ? targetProps : {})}\n >\n {buttonContent}\n {isDisabledWithReason && (\n <>\n {descriptionEl}\n {showTooltip && (\n <Tooltip\n className={testUtilStyles['disabled-reason-tooltip']}\n trackRef={buttonRef}\n value={disabledReason!}\n />\n )}\n </>\n )}\n </button>\n {loading && loadingText && <LiveRegion>{loadingText}</LiveRegion>}\n </>\n );\n }\n);\n\nexport default InternalButton;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/internal/analytics/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEtF,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,cAAc,QAE7D;AACD,wBAAgB,qBAAqB,CAAC,kBAAkB,EAAE,mBAAmB,QAE5E;AACD,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,iBAAiB,QAEtE;AAED;;;GAGG;AACH,eAAO,IAAI,aAAa,EAAE,cAoBzB,CAAC;AAEF;;;GAGG;AACH,eAAO,IAAI,kBAAkB,EAAE,mBAG9B,CAAC;AAEF,eAAO,IAAI,gBAAgB,EAAE,iBAI5B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/internal/analytics/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEtF,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,cAAc,QAE7D;AACD,wBAAgB,qBAAqB,CAAC,kBAAkB,EAAE,mBAAmB,QAE5E;AACD,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,iBAAiB,QAEtE;AAED;;;GAGG;AACH,eAAO,IAAI,aAAa,EAAE,cAoBzB,CAAC;AAEF;;;GAGG;AACH,eAAO,IAAI,kBAAkB,EAAE,mBAI9B,CAAC;AAEF,eAAO,IAAI,gBAAgB,EAAE,iBAI5B,CAAC"}
@@ -41,6 +41,7 @@ export let FunnelMetrics = {
41
41
  export let PerformanceMetrics = {
42
42
  tableInteraction() { },
43
43
  taskCompletionData() { },
44
+ modalPerformanceData() { },
44
45
  };
45
46
  export let ComponentMetrics = {
46
47
  componentMounted() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/analytics/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,0BAA0B;AAI1B,MAAM,UAAU,gBAAgB,CAAC,aAA6B;IAC5D,aAAa,GAAG,aAAa,CAAC;AAChC,CAAC;AACD,MAAM,UAAU,qBAAqB,CAAC,kBAAuC;IAC3E,kBAAkB,GAAG,kBAAkB,CAAC;AAC1C,CAAC;AACD,MAAM,UAAU,mBAAmB,CAAC,gBAAmC;IACrE,gBAAgB,GAAG,gBAAgB,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,IAAI,aAAa,GAAmB;IACzC,WAAW;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,WAAW,KAAU,CAAC;IACtB,cAAc,KAAU,CAAC;IACzB,gBAAgB,KAAU,CAAC;IAC3B,eAAe,KAAU,CAAC;IAC1B,YAAY,KAAU,CAAC;IACvB,eAAe,KAAU,CAAC;IAC1B,kBAAkB,KAAU,CAAC;IAC7B,oBAAoB,KAAU,CAAC;IAC/B,eAAe,KAAU,CAAC;IAC1B,gBAAgB,KAAU,CAAC;IAC3B,kBAAkB,KAAU,CAAC;IAC7B,qBAAqB,KAAU,CAAC;IAChC,kBAAkB,KAAU,CAAC;IAC7B,mBAAmB,KAAU,CAAC;IAC9B,sBAAsB,KAAU,CAAC;CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,IAAI,kBAAkB,GAAwB;IACnD,gBAAgB,KAAU,CAAC;IAC3B,kBAAkB,KAAU,CAAC;CAC9B,CAAC;AAEF,MAAM,CAAC,IAAI,gBAAgB,GAAsB;IAC/C,gBAAgB;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/* istanbul ignore file */\n\nimport { IComponentMetrics, IFunnelMetrics, IPerformanceMetrics } from './interfaces';\n\nexport function setFunnelMetrics(funnelMetrics: IFunnelMetrics) {\n FunnelMetrics = funnelMetrics;\n}\nexport function setPerformanceMetrics(performanceMetrics: IPerformanceMetrics) {\n PerformanceMetrics = performanceMetrics;\n}\nexport function setComponentMetrics(componentMetrics: IComponentMetrics) {\n ComponentMetrics = componentMetrics;\n}\n\n/**\n * This is a stub implementation of the FunnelMetrics interface and will be replaced during\n * build time with the actual implementation.\n */\nexport let FunnelMetrics: IFunnelMetrics = {\n funnelStart(): string {\n return '';\n },\n\n funnelError(): void {},\n funnelComplete(): void {},\n funnelSuccessful(): void {},\n funnelCancelled(): void {},\n funnelChange(): void {},\n funnelStepStart(): void {},\n funnelStepComplete(): void {},\n funnelStepNavigation(): void {},\n funnelStepError(): void {},\n funnelStepChange(): void {},\n funnelSubStepStart(): void {},\n funnelSubStepComplete(): void {},\n funnelSubStepError(): void {},\n helpPanelInteracted(): void {},\n externalLinkInteracted(): void {},\n};\n\n/**\n * This is a stub implementation of the PerformanceMetrics interface and will be replaced during\n * build time with the actual implementation.\n */\nexport let PerformanceMetrics: IPerformanceMetrics = {\n tableInteraction(): void {},\n taskCompletionData(): void {},\n};\n\nexport let ComponentMetrics: IComponentMetrics = {\n componentMounted(): string {\n return '';\n },\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/analytics/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,0BAA0B;AAI1B,MAAM,UAAU,gBAAgB,CAAC,aAA6B;IAC5D,aAAa,GAAG,aAAa,CAAC;AAChC,CAAC;AACD,MAAM,UAAU,qBAAqB,CAAC,kBAAuC;IAC3E,kBAAkB,GAAG,kBAAkB,CAAC;AAC1C,CAAC;AACD,MAAM,UAAU,mBAAmB,CAAC,gBAAmC;IACrE,gBAAgB,GAAG,gBAAgB,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,IAAI,aAAa,GAAmB;IACzC,WAAW;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,WAAW,KAAU,CAAC;IACtB,cAAc,KAAU,CAAC;IACzB,gBAAgB,KAAU,CAAC;IAC3B,eAAe,KAAU,CAAC;IAC1B,YAAY,KAAU,CAAC;IACvB,eAAe,KAAU,CAAC;IAC1B,kBAAkB,KAAU,CAAC;IAC7B,oBAAoB,KAAU,CAAC;IAC/B,eAAe,KAAU,CAAC;IAC1B,gBAAgB,KAAU,CAAC;IAC3B,kBAAkB,KAAU,CAAC;IAC7B,qBAAqB,KAAU,CAAC;IAChC,kBAAkB,KAAU,CAAC;IAC7B,mBAAmB,KAAU,CAAC;IAC9B,sBAAsB,KAAU,CAAC;CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,IAAI,kBAAkB,GAAwB;IACnD,gBAAgB,KAAU,CAAC;IAC3B,kBAAkB,KAAU,CAAC;IAC7B,oBAAoB,KAAU,CAAC;CAChC,CAAC;AAEF,MAAM,CAAC,IAAI,gBAAgB,GAAsB;IAC/C,gBAAgB;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/* istanbul ignore file */\n\nimport { IComponentMetrics, IFunnelMetrics, IPerformanceMetrics } from './interfaces';\n\nexport function setFunnelMetrics(funnelMetrics: IFunnelMetrics) {\n FunnelMetrics = funnelMetrics;\n}\nexport function setPerformanceMetrics(performanceMetrics: IPerformanceMetrics) {\n PerformanceMetrics = performanceMetrics;\n}\nexport function setComponentMetrics(componentMetrics: IComponentMetrics) {\n ComponentMetrics = componentMetrics;\n}\n\n/**\n * This is a stub implementation of the FunnelMetrics interface and will be replaced during\n * build time with the actual implementation.\n */\nexport let FunnelMetrics: IFunnelMetrics = {\n funnelStart(): string {\n return '';\n },\n\n funnelError(): void {},\n funnelComplete(): void {},\n funnelSuccessful(): void {},\n funnelCancelled(): void {},\n funnelChange(): void {},\n funnelStepStart(): void {},\n funnelStepComplete(): void {},\n funnelStepNavigation(): void {},\n funnelStepError(): void {},\n funnelStepChange(): void {},\n funnelSubStepStart(): void {},\n funnelSubStepComplete(): void {},\n funnelSubStepError(): void {},\n helpPanelInteracted(): void {},\n externalLinkInteracted(): void {},\n};\n\n/**\n * This is a stub implementation of the PerformanceMetrics interface and will be replaced during\n * build time with the actual implementation.\n */\nexport let PerformanceMetrics: IPerformanceMetrics = {\n tableInteraction(): void {},\n taskCompletionData(): void {},\n modalPerformanceData(): void {},\n};\n\nexport let ComponentMetrics: IComponentMetrics = {\n componentMounted(): string {\n return '';\n },\n};\n"]}
@@ -124,6 +124,7 @@ export type TaskCompletionDataMethod = (props: TaskCompletionDataProps) => void;
124
124
  export interface IPerformanceMetrics {
125
125
  tableInteraction: TableInteractionMethod;
126
126
  taskCompletionData: TaskCompletionDataMethod;
127
+ modalPerformanceData: ModalPerformanceDataMethod;
127
128
  }
128
129
  export interface ComponentMountedProps {
129
130
  componentName: string;
@@ -134,4 +135,11 @@ export type ComponentMountedMethod = (props: ComponentMountedProps) => string;
134
135
  export interface IComponentMetrics {
135
136
  componentMounted: ComponentMountedMethod;
136
137
  }
138
+ export interface ModalPerformanceDataProps {
139
+ timeToContentReadyInModal: number;
140
+ instanceIdentifier?: string;
141
+ componentIdentifier?: string;
142
+ modalMetadata?: string;
143
+ }
144
+ export type ModalPerformanceDataMethod = (props: ModalPerformanceDataProps) => void;
137
145
  //# sourceMappingURL=interfaces.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/internal/analytics/interfaces.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,YAAY,CAAC;AACtD,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,eAAe,CAAC;AAClF,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD,MAAM,WAAW,eAAe;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,QAAQ,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,eAAe,EAAE,qBAAqB,CAAC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,CAAC,EAAE,UAAU,CAAC;IAEtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,wBAAwB,GAAG,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,CAAC;AAEhF,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,EAAE,sBAAsB,CAAC;IACzC,kBAAkB,EAAE,wBAAwB,CAAC;IAC7C,oBAAoB,EAAE,0BAA0B,CAAC;CAClD;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;CAChE;AACD,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,qBAAqB,KAAK,MAAM,CAAC;AAC9E,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,EAAE,sBAAsB,CAAC;CAC1C;AAGD,MAAM,WAAW,yBAAyB;IAGxC,yBAAyB,EAAE,MAAM,CAAC;IAGlC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAG5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,0BAA0B,GAAG,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/internal/analytics/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport type FunnelType = 'single-page' | 'multi-page';\nexport type FlowType = 'create' | 'edit' | 'home' | 'dashboard' | 'view-resource';\nexport interface AnalyticsMetadata {\n instanceIdentifier?: string;\n flowType?: FlowType;\n errorContext?: string;\n resourceType?: string;\n}\n\n// Common properties for all funnels\nexport interface BaseFunnelProps {\n funnelIdentifier?: string;\n funnelInteractionId: string;\n currentDocument?: Document;\n}\n\nexport interface FunnelErrorProps extends BaseFunnelProps {\n funnelErrorContext?: string;\n}\n\nexport interface FunnelStartProps extends Omit<BaseFunnelProps, 'funnelInteractionId'> {\n flowType?: FlowType;\n resourceType?: string;\n funnelNameSelector: string;\n totalFunnelSteps: number;\n optionalStepNumbers: number[];\n stepConfiguration?: StepConfiguration[];\n funnelType: FunnelType;\n funnelVersion: string;\n componentVersion: string;\n componentTheme: string;\n funnelInteractionId?: string;\n}\n\n// A function type for a generic funnel method\nexport type FunnelMethod<T extends BaseFunnelProps> = (props: T) => void;\n\n// Interface for table interaction method props\nexport interface TableInteractionProps {\n // Time to render table in either no data state or with data after user actions like filtering, pagination.\n // in milliseconds\n interactionTime: number;\n // User action like sorting, filtering, pagination which triggered new data load in table.\n userAction: string;\n // Unique instance identifier for the component.\n // Default: ''\n instanceIdentifier?: string;\n // Component identifier like table header which can be used to identify the table\n // Default: ''\n componentIdentifier?: string;\n // Number of resources in table after user action\n // Default: 0\n noOfResourcesInTable?: number;\n // Additional metadata related to user interaction\n interactionMetadata?: string;\n}\n\nexport type TableInteractionMethod = (props: TableInteractionProps) => void;\n\n// A function type specifically for funnelStart\nexport type FunnelStartMethod = (props: FunnelStartProps) => string;\n\n// Define individual method props by extending the base\nexport interface FunnelStepProps extends BaseFunnelProps {\n stepIdentifier?: string;\n stepNumber: number;\n stepName?: string | undefined;\n stepNameSelector?: string;\n subStepAllSelector: string;\n totalSubSteps?: number;\n subStepConfiguration?: SubStepConfiguration[];\n}\n\nexport interface FunnelStepNavigationProps extends FunnelStepProps {\n destinationStepNumber: number;\n navigationType: string;\n totalSubSteps?: number;\n}\n\nexport interface FunnelStepErrorProps extends FunnelStepProps {\n stepErrorContext?: string;\n stepErrorSelector: string;\n}\n\nexport interface FunnelSubStepProps extends FunnelStepProps {\n subStepIdentifier?: string;\n subStepSelector: string;\n subStepName?: string | undefined;\n subStepNameSelector: string;\n subStepNumber?: number;\n}\n\nexport interface FunnelSubStepErrorProps extends FunnelSubStepProps {\n subStepErrorContext?: string;\n fieldIdentifier?: string;\n fieldErrorContext?: string;\n fieldLabelSelector: string;\n fieldErrorSelector: string;\n}\n\nexport interface OptionalFunnelSubStepErrorProps extends FunnelSubStepProps {\n subStepErrorContext?: string;\n fieldIdentifier?: string;\n fieldErrorContext?: string;\n fieldLabelSelector?: string;\n fieldErrorSelector?: string;\n}\n\nexport interface FunnelLinkInteractionProps extends FunnelSubStepProps {\n elementSelector: string;\n}\n\nexport interface FunnelChangeProps extends BaseFunnelProps {\n stepConfiguration: StepConfiguration[];\n}\n\nexport interface StepConfiguration {\n number: number;\n name: string;\n isOptional: boolean;\n stepIdentifier?: string;\n}\n\nexport interface SubStepConfiguration {\n number: number;\n name: string;\n subStepIdentifier?: string;\n}\n\n// Define the interface using the method type\nexport interface IFunnelMetrics {\n funnelStart: FunnelStartMethod;\n funnelError: FunnelMethod<FunnelErrorProps>;\n funnelComplete: FunnelMethod<BaseFunnelProps>;\n funnelSuccessful: FunnelMethod<BaseFunnelProps>;\n funnelCancelled: FunnelMethod<BaseFunnelProps>;\n funnelChange: FunnelMethod<FunnelChangeProps>;\n\n funnelStepStart: FunnelMethod<FunnelStepProps>;\n funnelStepComplete: FunnelMethod<FunnelStepProps>;\n funnelStepNavigation: FunnelMethod<FunnelStepNavigationProps>;\n funnelStepError: FunnelMethod<FunnelStepErrorProps>;\n funnelStepChange: FunnelMethod<FunnelStepProps>;\n\n funnelSubStepStart: FunnelMethod<FunnelSubStepProps>;\n funnelSubStepComplete: FunnelMethod<FunnelSubStepProps>;\n funnelSubStepError: FunnelMethod<OptionalFunnelSubStepErrorProps>;\n\n helpPanelInteracted: FunnelMethod<FunnelLinkInteractionProps>;\n externalLinkInteracted: FunnelMethod<FunnelLinkInteractionProps>;\n}\n\n// Interface for task completion method props\nexport interface TaskCompletionDataProps {\n // Time taken to respond to customers after customers submit the form\n // in milliseconds\n timeToRespondAfterFormSubmit: number;\n // Unique identifier for the task aka funnelInteractionId.\n // Default: ''\n taskInteractionId: string;\n // Task name identifier to identify the task aka funnelName\n // Default: ''\n taskIdentifier?: string;\n // To identify create or edit flow\n // Default: ''\n taskFlowType?: string;\n //\"single-page\" | \"multi-page\"\n // Default: ''\n taskType?: FunnelType;\n // Additional metadata related to completion such as success or error\n completionMetadata?: string;\n}\n\nexport type TaskCompletionDataMethod = (props: TaskCompletionDataProps) => void;\n\nexport interface IPerformanceMetrics {\n tableInteraction: TableInteractionMethod;\n taskCompletionData: TaskCompletionDataMethod;\n}\n\nexport interface ComponentMountedProps {\n componentName: string;\n taskInteractionId?: string;\n details: Record<string, string | boolean | number | undefined>;\n}\nexport type ComponentMountedMethod = (props: ComponentMountedProps) => string;\nexport interface IComponentMetrics {\n componentMounted: ComponentMountedMethod;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/internal/analytics/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport type FunnelType = 'single-page' | 'multi-page';\nexport type FlowType = 'create' | 'edit' | 'home' | 'dashboard' | 'view-resource';\nexport interface AnalyticsMetadata {\n instanceIdentifier?: string;\n flowType?: FlowType;\n errorContext?: string;\n resourceType?: string;\n}\n\n// Common properties for all funnels\nexport interface BaseFunnelProps {\n funnelIdentifier?: string;\n funnelInteractionId: string;\n currentDocument?: Document;\n}\n\nexport interface FunnelErrorProps extends BaseFunnelProps {\n funnelErrorContext?: string;\n}\n\nexport interface FunnelStartProps extends Omit<BaseFunnelProps, 'funnelInteractionId'> {\n flowType?: FlowType;\n resourceType?: string;\n funnelNameSelector: string;\n totalFunnelSteps: number;\n optionalStepNumbers: number[];\n stepConfiguration?: StepConfiguration[];\n funnelType: FunnelType;\n funnelVersion: string;\n componentVersion: string;\n componentTheme: string;\n funnelInteractionId?: string;\n}\n\n// A function type for a generic funnel method\nexport type FunnelMethod<T extends BaseFunnelProps> = (props: T) => void;\n\n// Interface for table interaction method props\nexport interface TableInteractionProps {\n // Time to render table in either no data state or with data after user actions like filtering, pagination.\n // in milliseconds\n interactionTime: number;\n // User action like sorting, filtering, pagination which triggered new data load in table.\n userAction: string;\n // Unique instance identifier for the component.\n // Default: ''\n instanceIdentifier?: string;\n // Component identifier like table header which can be used to identify the table\n // Default: ''\n componentIdentifier?: string;\n // Number of resources in table after user action\n // Default: 0\n noOfResourcesInTable?: number;\n // Additional metadata related to user interaction\n interactionMetadata?: string;\n}\n\nexport type TableInteractionMethod = (props: TableInteractionProps) => void;\n\n// A function type specifically for funnelStart\nexport type FunnelStartMethod = (props: FunnelStartProps) => string;\n\n// Define individual method props by extending the base\nexport interface FunnelStepProps extends BaseFunnelProps {\n stepIdentifier?: string;\n stepNumber: number;\n stepName?: string | undefined;\n stepNameSelector?: string;\n subStepAllSelector: string;\n totalSubSteps?: number;\n subStepConfiguration?: SubStepConfiguration[];\n}\n\nexport interface FunnelStepNavigationProps extends FunnelStepProps {\n destinationStepNumber: number;\n navigationType: string;\n totalSubSteps?: number;\n}\n\nexport interface FunnelStepErrorProps extends FunnelStepProps {\n stepErrorContext?: string;\n stepErrorSelector: string;\n}\n\nexport interface FunnelSubStepProps extends FunnelStepProps {\n subStepIdentifier?: string;\n subStepSelector: string;\n subStepName?: string | undefined;\n subStepNameSelector: string;\n subStepNumber?: number;\n}\n\nexport interface FunnelSubStepErrorProps extends FunnelSubStepProps {\n subStepErrorContext?: string;\n fieldIdentifier?: string;\n fieldErrorContext?: string;\n fieldLabelSelector: string;\n fieldErrorSelector: string;\n}\n\nexport interface OptionalFunnelSubStepErrorProps extends FunnelSubStepProps {\n subStepErrorContext?: string;\n fieldIdentifier?: string;\n fieldErrorContext?: string;\n fieldLabelSelector?: string;\n fieldErrorSelector?: string;\n}\n\nexport interface FunnelLinkInteractionProps extends FunnelSubStepProps {\n elementSelector: string;\n}\n\nexport interface FunnelChangeProps extends BaseFunnelProps {\n stepConfiguration: StepConfiguration[];\n}\n\nexport interface StepConfiguration {\n number: number;\n name: string;\n isOptional: boolean;\n stepIdentifier?: string;\n}\n\nexport interface SubStepConfiguration {\n number: number;\n name: string;\n subStepIdentifier?: string;\n}\n\n// Define the interface using the method type\nexport interface IFunnelMetrics {\n funnelStart: FunnelStartMethod;\n funnelError: FunnelMethod<FunnelErrorProps>;\n funnelComplete: FunnelMethod<BaseFunnelProps>;\n funnelSuccessful: FunnelMethod<BaseFunnelProps>;\n funnelCancelled: FunnelMethod<BaseFunnelProps>;\n funnelChange: FunnelMethod<FunnelChangeProps>;\n\n funnelStepStart: FunnelMethod<FunnelStepProps>;\n funnelStepComplete: FunnelMethod<FunnelStepProps>;\n funnelStepNavigation: FunnelMethod<FunnelStepNavigationProps>;\n funnelStepError: FunnelMethod<FunnelStepErrorProps>;\n funnelStepChange: FunnelMethod<FunnelStepProps>;\n\n funnelSubStepStart: FunnelMethod<FunnelSubStepProps>;\n funnelSubStepComplete: FunnelMethod<FunnelSubStepProps>;\n funnelSubStepError: FunnelMethod<OptionalFunnelSubStepErrorProps>;\n\n helpPanelInteracted: FunnelMethod<FunnelLinkInteractionProps>;\n externalLinkInteracted: FunnelMethod<FunnelLinkInteractionProps>;\n}\n\n// Interface for task completion method props\nexport interface TaskCompletionDataProps {\n // Time taken to respond to customers after customers submit the form\n // in milliseconds\n timeToRespondAfterFormSubmit: number;\n // Unique identifier for the task aka funnelInteractionId.\n // Default: ''\n taskInteractionId: string;\n // Task name identifier to identify the task aka funnelName\n // Default: ''\n taskIdentifier?: string;\n // To identify create or edit flow\n // Default: ''\n taskFlowType?: string;\n //\"single-page\" | \"multi-page\"\n // Default: ''\n taskType?: FunnelType;\n // Additional metadata related to completion such as success or error\n completionMetadata?: string;\n}\n\nexport type TaskCompletionDataMethod = (props: TaskCompletionDataProps) => void;\n\nexport interface IPerformanceMetrics {\n tableInteraction: TableInteractionMethod;\n taskCompletionData: TaskCompletionDataMethod;\n modalPerformanceData: ModalPerformanceDataMethod;\n}\n\nexport interface ComponentMountedProps {\n componentName: string;\n taskInteractionId?: string;\n details: Record<string, string | boolean | number | undefined>;\n}\nexport type ComponentMountedMethod = (props: ComponentMountedProps) => string;\nexport interface IComponentMetrics {\n componentMounted: ComponentMountedMethod;\n}\n\n// Interface for modal metrics\nexport interface ModalPerformanceDataProps {\n // Time span from when the modal begins loading to when the primary button or modal has finished loading.\n // in milliseconds\n timeToContentReadyInModal: number;\n // Unique instance identifier for the component.\n // Default: ''\n instanceIdentifier?: string;\n // Component identifier like modal header which can be used to identify the modal\n // Default: ''\n componentIdentifier?: string;\n // Additional metadata related to modal\n modalMetadata?: string;\n}\n\nexport type ModalPerformanceDataMethod = (props: ModalPerformanceDataProps) => void;\n"]}
@@ -1,8 +1,9 @@
1
- /// <reference types="react" />
2
- export declare const ModalContext: import("react").Context<{
1
+ import { MutableRefObject } from 'react';
2
+ export interface ModalContextProps {
3
3
  isInModal: boolean;
4
- }>;
5
- export declare const useModalContext: () => {
6
- isInModal: boolean;
7
- };
4
+ componentLoadingCount: MutableRefObject<number>;
5
+ emitTimeToContentReadyInModal: (loadCompleteTime: number) => void;
6
+ }
7
+ export declare const ModalContext: import("react").Context<ModalContextProps>;
8
+ export declare const useModalContext: () => ModalContextProps;
8
9
  //# sourceMappingURL=modal-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"modal-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/modal-context.ts"],"names":[],"mappings":";AAIA,eAAO,MAAM,YAAY;eAA8B,OAAO;EAAyB,CAAC;AAExF,eAAO,MAAM,eAAe;eAF2B,OAAO;CAK7D,CAAC"}
1
+ {"version":3,"file":"modal-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/modal-context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,gBAAgB,EAAc,MAAM,OAAO,CAAC;AAEpE,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,qBAAqB,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChD,6BAA6B,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,IAAI,CAAC;CACnE;AAED,eAAO,MAAM,YAAY,4CAIvB,CAAC;AAEH,eAAO,MAAM,eAAe,yBAG3B,CAAC"}
@@ -1,7 +1,11 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { createContext, useContext } from 'react';
4
- export const ModalContext = createContext({ isInModal: false });
4
+ export const ModalContext = createContext({
5
+ isInModal: false,
6
+ componentLoadingCount: { current: 0 },
7
+ emitTimeToContentReadyInModal: () => { },
8
+ });
5
9
  export const useModalContext = () => {
6
10
  const modalContext = useContext(ModalContext);
7
11
  return modalContext;
@@ -1 +1 @@
1
- {"version":3,"file":"modal-context.js","sourceRoot":"","sources":["../../../../src/internal/context/modal-context.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAyB,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAC9C,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { createContext, useContext } from 'react';\n\nexport const ModalContext = createContext<{ isInModal: boolean }>({ isInModal: false });\n\nexport const useModalContext = () => {\n const modalContext = useContext(ModalContext);\n return modalContext;\n};\n"]}
1
+ {"version":3,"file":"modal-context.js","sourceRoot":"","sources":["../../../../src/internal/context/modal-context.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,aAAa,EAAoB,UAAU,EAAE,MAAM,OAAO,CAAC;AAQpE,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAoB;IAC3D,SAAS,EAAE,KAAK;IAChB,qBAAqB,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE;IACrC,6BAA6B,EAAE,GAAG,EAAE,GAAE,CAAC;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAC9C,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { createContext, MutableRefObject, useContext } from 'react';\n\nexport interface ModalContextProps {\n isInModal: boolean;\n componentLoadingCount: MutableRefObject<number>;\n emitTimeToContentReadyInModal: (loadCompleteTime: number) => void;\n}\n\nexport const ModalContext = createContext<ModalContextProps>({\n isInModal: false,\n componentLoadingCount: { current: 0 },\n emitTimeToContentReadyInModal: () => {},\n});\n\nexport const useModalContext = () => {\n const modalContext = useContext(ModalContext);\n return modalContext;\n};\n"]}
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (583c0689)";
2
+ export var PACKAGE_VERSION = "3.0.0 (72b0dfe2)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (583c0689)",
3
+ "PACKAGE_VERSION": "3.0.0 (72b0dfe2)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -0,0 +1,3 @@
1
+ export declare const useModalContextLoadingButtonComponent: (isPrimaryButton: boolean, loading: boolean) => void;
2
+ export declare const useModalContextLoadingComponent: () => void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-modal-component-analytics/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,qCAAqC,oBAAqB,OAAO,WAAW,OAAO,SAe/F,CAAC;AAEF,eAAO,MAAM,+BAA+B,YAa3C,CAAC"}
@@ -0,0 +1,35 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { useEffect } from 'react';
4
+ import { useModalContext } from '../../context/modal-context';
5
+ export const useModalContextLoadingButtonComponent = (isPrimaryButton, loading) => {
6
+ const modalContext = useModalContext();
7
+ useEffect(() => {
8
+ if (!isPrimaryButton || !modalContext.isInModal) {
9
+ return;
10
+ }
11
+ if (loading) {
12
+ modalContext.componentLoadingCount.current++;
13
+ return () => {
14
+ modalContext.componentLoadingCount.current--;
15
+ modalContext.emitTimeToContentReadyInModal(performance.now());
16
+ };
17
+ }
18
+ // eslint-disable-next-line react-hooks/exhaustive-deps
19
+ }, [loading]);
20
+ };
21
+ export const useModalContextLoadingComponent = () => {
22
+ const modalContext = useModalContext();
23
+ useEffect(() => {
24
+ if (!modalContext.isInModal) {
25
+ return;
26
+ }
27
+ modalContext.componentLoadingCount.current++;
28
+ return () => {
29
+ modalContext.componentLoadingCount.current--;
30
+ modalContext.emitTimeToContentReadyInModal(performance.now());
31
+ };
32
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33
+ }, []);
34
+ };
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-modal-component-analytics/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,eAAwB,EAAE,OAAgB,EAAE,EAAE;IAClG,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,eAAe,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE;YAC/C,OAAO;SACR;QACD,IAAI,OAAO,EAAE;YACX,YAAY,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;YAC7C,OAAO,GAAG,EAAE;gBACV,YAAY,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;gBAC7C,YAAY,CAAC,6BAA6B,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC;YAChE,CAAC,CAAC;SACH;QACD,uDAAuD;IACzD,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,EAAE;IAClD,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE;YAC3B,OAAO;SACR;QACD,YAAY,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;QAC7C,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;YAC7C,YAAY,CAAC,6BAA6B,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC;QAChE,CAAC,CAAC;QACF,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useEffect } from 'react';\n\nimport { useModalContext } from '../../context/modal-context';\n\nexport const useModalContextLoadingButtonComponent = (isPrimaryButton: boolean, loading: boolean) => {\n const modalContext = useModalContext();\n useEffect(() => {\n if (!isPrimaryButton || !modalContext.isInModal) {\n return;\n }\n if (loading) {\n modalContext.componentLoadingCount.current++;\n return () => {\n modalContext.componentLoadingCount.current--;\n modalContext.emitTimeToContentReadyInModal(performance.now());\n };\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loading]);\n};\n\nexport const useModalContextLoadingComponent = () => {\n const modalContext = useModalContext();\n useEffect(() => {\n if (!modalContext.isInModal) {\n return;\n }\n modalContext.componentLoadingCount.current++;\n return () => {\n modalContext.componentLoadingCount.current--;\n modalContext.emitTimeToContentReadyInModal(performance.now());\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-performance-marks/index.ts"],"names":[],"mappings":";AA4BA;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,EACxC,UAAU,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,EACvE,YAAY,EAAE,KAAK,CAAC,cAAc;;EA0DnC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-performance-marks/index.ts"],"names":[],"mappings":";AA4BA;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,EACxC,UAAU,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,EACvE,YAAY,EAAE,KAAK,CAAC,cAAc;;EAyDnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-performance-marks/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;EAEE;AACF,SAAS,2BAA2B,CAAC,UAAwC,EAAE,KAAa;IAC1F,MAAM,aAAa,GAAG,iCAAiC,CAAC;IAExD,MAAM,iBAAiB,GAAG,MAAM,EAAsB,CAAC;IAEvD,SAAS,CAAC,GAAG,EAAE;;QACb,0FAA0F;QAC1F,iBAAiB,CAAC,OAAO,GAAG,KAAK,CAAC;QAClC,MAAA,UAAU,CAAC,OAAO,0CAAE,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;IAExB,OAAO;QACL,CAAC,aAAa,CAAC,EAAE,iBAAiB,CAAC,OAAO;KAC3C,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAY,EACZ,OAAgB,EAChB,UAAwC,EACxC,UAAuE,EACvE,YAAkC;IAElC,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IACzB,MAAM,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,CAAC;IACxC,MAAM,UAAU,GAAG,2BAA2B,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAE/D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,SAAS,EAAE;YAChD,OAAO;SACR;QAED,MAAM,cAAc,GAClB,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC;YAClC,UAAU,CAAC,OAAO,CAAC,YAAY,GAAG,CAAC;YACnC,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC;QAE/D,IAAI,CAAC,cAAc,EAAE;YACnB,OAAO;SACR;QAED,MAAM,gBAAgB,GAAG,GAAG,IAAI,UAAU,CAAC;QAE3C,WAAW,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACjC,MAAM,kBACJ,MAAM,EAAE,OAAO,EACf,kBAAkB,EAAE,EAAE,IACnB,UAAU,EAAE,CAChB;SACF,CAAC,CAAC;QACH,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,iBAAiB,CAAC,GAAG,EAAE;QACrB,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,SAAS,EAAE;YAChD,OAAO;SACR;QACD,MAAM,cAAc,GAClB,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC;YAClC,UAAU,CAAC,OAAO,CAAC,YAAY,GAAG,CAAC;YACnC,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC;QAE/D,IAAI,CAAC,cAAc,EAAE;YACnB,OAAO;SACR;QAED,MAAM,eAAe,GAAG,GAAG,IAAI,SAAS,CAAC;QAEzC,WAAW,CAAC,IAAI,CAAC,eAAe,EAAE;YAChC,MAAM,kBACJ,MAAM,EAAE,OAAO,EACf,kBAAkB,EAAE,EAAE,IACnB,UAAU,EAAE,CAChB;SACF,CAAC,CAAC;QACH,uDAAuD;IACzD,CAAC,EAAE,YAAY,CAAC,CAAC;IAEjB,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useEffect, useRef } from 'react';\n\nimport { useModalContext } from '../../context/modal-context';\nimport { useEffectOnUpdate } from '../use-effect-on-update';\nimport { useRandomId } from '../use-unique-id';\n\n/*\nThis hook allows setting an HTML attribute after the first render, without rerendering the component.\n*/\nfunction usePerformanceMarkAttribute(elementRef: React.RefObject<HTMLElement>, value: string) {\n const attributeName = 'data-analytics-performance-mark';\n\n const attributeValueRef = useRef<string | undefined>();\n\n useEffect(() => {\n // With this effect, we apply the attribute only on the client, to avoid hydration errors.\n attributeValueRef.current = value;\n elementRef.current?.setAttribute(attributeName, value);\n }, [value, elementRef]);\n\n return {\n [attributeName]: attributeValueRef.current,\n };\n}\n\n/**\n * This function returns an object that needs to be spread onto the same\n * element as the `elementRef`, so that the data attribute is applied\n * correctly.\n */\nexport function usePerformanceMarks(\n name: string,\n enabled: boolean,\n elementRef: React.RefObject<HTMLElement>,\n getDetails: () => Record<string, string | boolean | number | undefined>,\n dependencies: React.DependencyList\n) {\n const id = useRandomId();\n const { isInModal } = useModalContext();\n const attributes = usePerformanceMarkAttribute(elementRef, id);\n\n useEffect(() => {\n if (!enabled || !elementRef.current || isInModal) {\n return;\n }\n\n const elementVisible =\n elementRef.current.offsetWidth > 0 &&\n elementRef.current.offsetHeight > 0 &&\n getComputedStyle(elementRef.current).visibility !== 'hidden';\n\n if (!elementVisible) {\n return;\n }\n\n const renderedMarkName = `${name}Rendered`;\n\n performance.mark(renderedMarkName, {\n detail: {\n source: 'awsui',\n instanceIdentifier: id,\n ...getDetails(),\n },\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffectOnUpdate(() => {\n if (!enabled || !elementRef.current || isInModal) {\n return;\n }\n const elementVisible =\n elementRef.current.offsetWidth > 0 &&\n elementRef.current.offsetHeight > 0 &&\n getComputedStyle(elementRef.current).visibility !== 'hidden';\n\n if (!elementVisible) {\n return;\n }\n\n const updatedMarkName = `${name}Updated`;\n\n performance.mark(updatedMarkName, {\n detail: {\n source: 'awsui',\n instanceIdentifier: id,\n ...getDetails(),\n },\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n\n return attributes;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-performance-marks/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;EAEE;AACF,SAAS,2BAA2B,CAAC,UAAwC,EAAE,KAAa;IAC1F,MAAM,aAAa,GAAG,iCAAiC,CAAC;IAExD,MAAM,iBAAiB,GAAG,MAAM,EAAsB,CAAC;IAEvD,SAAS,CAAC,GAAG,EAAE;;QACb,0FAA0F;QAC1F,iBAAiB,CAAC,OAAO,GAAG,KAAK,CAAC;QAClC,MAAA,UAAU,CAAC,OAAO,0CAAE,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;IAExB,OAAO;QACL,CAAC,aAAa,CAAC,EAAE,iBAAiB,CAAC,OAAO;KAC3C,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAY,EACZ,OAAgB,EAChB,UAAwC,EACxC,UAAuE,EACvE,YAAkC;IAElC,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IACzB,MAAM,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,CAAC;IACxC,MAAM,UAAU,GAAG,2BAA2B,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAC/D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,SAAS,EAAE;YAChD,OAAO;SACR;QAED,MAAM,cAAc,GAClB,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC;YAClC,UAAU,CAAC,OAAO,CAAC,YAAY,GAAG,CAAC;YACnC,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC;QAE/D,IAAI,CAAC,cAAc,EAAE;YACnB,OAAO;SACR;QAED,MAAM,gBAAgB,GAAG,GAAG,IAAI,UAAU,CAAC;QAE3C,WAAW,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACjC,MAAM,kBACJ,MAAM,EAAE,OAAO,EACf,kBAAkB,EAAE,EAAE,IACnB,UAAU,EAAE,CAChB;SACF,CAAC,CAAC;QACH,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,iBAAiB,CAAC,GAAG,EAAE;QACrB,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,SAAS,EAAE;YAChD,OAAO;SACR;QACD,MAAM,cAAc,GAClB,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC;YAClC,UAAU,CAAC,OAAO,CAAC,YAAY,GAAG,CAAC;YACnC,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC;QAE/D,IAAI,CAAC,cAAc,EAAE;YACnB,OAAO;SACR;QAED,MAAM,eAAe,GAAG,GAAG,IAAI,SAAS,CAAC;QAEzC,WAAW,CAAC,IAAI,CAAC,eAAe,EAAE;YAChC,MAAM,kBACJ,MAAM,EAAE,OAAO,EACf,kBAAkB,EAAE,EAAE,IACnB,UAAU,EAAE,CAChB;SACF,CAAC,CAAC;QACH,uDAAuD;IACzD,CAAC,EAAE,YAAY,CAAC,CAAC;IAEjB,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useEffect, useRef } from 'react';\n\nimport { useModalContext } from '../../context/modal-context';\nimport { useEffectOnUpdate } from '../use-effect-on-update';\nimport { useRandomId } from '../use-unique-id';\n\n/*\nThis hook allows setting an HTML attribute after the first render, without rerendering the component.\n*/\nfunction usePerformanceMarkAttribute(elementRef: React.RefObject<HTMLElement>, value: string) {\n const attributeName = 'data-analytics-performance-mark';\n\n const attributeValueRef = useRef<string | undefined>();\n\n useEffect(() => {\n // With this effect, we apply the attribute only on the client, to avoid hydration errors.\n attributeValueRef.current = value;\n elementRef.current?.setAttribute(attributeName, value);\n }, [value, elementRef]);\n\n return {\n [attributeName]: attributeValueRef.current,\n };\n}\n\n/**\n * This function returns an object that needs to be spread onto the same\n * element as the `elementRef`, so that the data attribute is applied\n * correctly.\n */\nexport function usePerformanceMarks(\n name: string,\n enabled: boolean,\n elementRef: React.RefObject<HTMLElement>,\n getDetails: () => Record<string, string | boolean | number | undefined>,\n dependencies: React.DependencyList\n) {\n const id = useRandomId();\n const { isInModal } = useModalContext();\n const attributes = usePerformanceMarkAttribute(elementRef, id);\n useEffect(() => {\n if (!enabled || !elementRef.current || isInModal) {\n return;\n }\n\n const elementVisible =\n elementRef.current.offsetWidth > 0 &&\n elementRef.current.offsetHeight > 0 &&\n getComputedStyle(elementRef.current).visibility !== 'hidden';\n\n if (!elementVisible) {\n return;\n }\n\n const renderedMarkName = `${name}Rendered`;\n\n performance.mark(renderedMarkName, {\n detail: {\n source: 'awsui',\n instanceIdentifier: id,\n ...getDetails(),\n },\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffectOnUpdate(() => {\n if (!enabled || !elementRef.current || isInModal) {\n return;\n }\n const elementVisible =\n elementRef.current.offsetWidth > 0 &&\n elementRef.current.offsetHeight > 0 &&\n getComputedStyle(elementRef.current).visibility !== 'hidden';\n\n if (!elementVisible) {\n return;\n }\n\n const updatedMarkName = `${name}Updated`;\n\n performance.mark(updatedMarkName, {\n detail: {\n source: 'awsui',\n instanceIdentifier: id,\n ...getDetails(),\n },\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n\n return attributes;\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "583c0689c44113d36694bfd331a8669e18e8a3fd"
2
+ "commit": "72b0dfe28b24982feea1caae264040f23093de18"
3
3
  }
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/modal/internal.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAMlF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,KAAK,kBAAkB,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,GACxD,0BAA0B,GAAG;IAAE,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAErG,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,EAAE,kBAAkB,eAM9G"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/modal/internal.tsx"],"names":[],"mappings":";AAqBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAMlF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,KAAK,kBAAkB,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,GACxD,0BAA0B,GAAG;IAAE,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAErG,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,EAAE,kBAAkB,eAM9G"}
package/modal/internal.js CHANGED
@@ -8,6 +8,7 @@ import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-tool
8
8
  import { InternalButton } from '../button/internal';
9
9
  import InternalHeader from '../header/internal';
10
10
  import { useInternalI18n } from '../i18n/context';
11
+ import { PerformanceMetrics } from '../internal/analytics';
11
12
  import { FunnelNameSelectorContext } from '../internal/analytics/context/analytics-context';
12
13
  import { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';
13
14
  import { getBaseProps } from '../internal/base-component';
@@ -52,20 +53,53 @@ function PortaledModal(_a) {
52
53
  const metadataAttribute = __injectAnalyticsComponentMetadata
53
54
  ? getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })
54
55
  : {};
56
+ const loadStartTime = useRef(0);
57
+ const loadCompleteTime = useRef(0);
58
+ const componentLoadingCount = useRef(0);
59
+ const performanceMetricLogged = useRef(false);
55
60
  // enable body scroll and restore focus if unmounting while visible
56
61
  useEffect(() => {
57
62
  return () => {
58
63
  enableBodyScrolling();
59
64
  };
60
65
  }, []);
61
- // enable / disable body scroll
66
+ const resetModalPerformanceData = () => {
67
+ loadStartTime.current = performance.now();
68
+ loadCompleteTime.current = 0;
69
+ performanceMetricLogged.current = false;
70
+ };
71
+ const emitTimeToContentReadyInModal = (loadCompleteTime) => {
72
+ if (componentLoadingCount.current === 0 &&
73
+ loadStartTime.current &&
74
+ loadStartTime.current !== 0 &&
75
+ !performanceMetricLogged.current) {
76
+ const timeToContentReadyInModal = loadCompleteTime - loadStartTime.current;
77
+ PerformanceMetrics.modalPerformanceData({
78
+ timeToContentReadyInModal,
79
+ instanceIdentifier: instanceUniqueId,
80
+ });
81
+ performanceMetricLogged.current = true;
82
+ }
83
+ };
84
+ const MODAL_READY_TIMEOUT = 100;
85
+ /**
86
+ * This useEffect is triggered when the visible attribute of modal changes.
87
+ * When modal becomes visible, modal performance metrics are reset marking the beginning loading process.
88
+ * To ensure that the modal component ready metric is always emitted, a setTimeout is implemented.
89
+ * This setTimeout automatically emits the component ready metric after a specified duration.
90
+ */
62
91
  useEffect(() => {
63
92
  if (visible) {
64
93
  disableBodyScrolling();
94
+ resetModalPerformanceData();
95
+ setTimeout(() => {
96
+ emitTimeToContentReadyInModal(loadStartTime.current);
97
+ }, MODAL_READY_TIMEOUT);
65
98
  }
66
99
  else {
67
100
  enableBodyScrolling();
68
101
  }
102
+ // eslint-disable-next-line react-hooks/exhaustive-deps
69
103
  }, [visible]);
70
104
  // Because we hide the element with styles (and not actually detach it from DOM), we need to scroll to top
71
105
  useEffect(() => {
@@ -99,7 +133,11 @@ function PortaledModal(_a) {
99
133
  const { subStepRef } = useFunnelSubStep();
100
134
  return (React.createElement(FunnelNameSelectorContext.Provider, { value: `.${styles['header--text']}` },
101
135
  React.createElement(ResetContextsForModal, null,
102
- React.createElement(ModalContext.Provider, { value: { isInModal: true } },
136
+ React.createElement(ModalContext.Provider, { value: {
137
+ isInModal: true,
138
+ componentLoadingCount,
139
+ emitTimeToContentReadyInModal,
140
+ } },
103
141
  React.createElement("div", Object.assign({}, baseProps, { className: clsx(styles.root, { [styles.hidden]: !visible }, baseProps.className, isRefresh && styles.refresh), role: "dialog", "aria-modal": true, "aria-labelledby": headerId, onMouseDown: onOverlayMouseDown, onClick: onOverlayClick, ref: mergedRef, style: footerHeight ? { scrollPaddingBottom: footerHeight } : undefined, "data-awsui-referrer-id": ((_b = subStepRef.current) === null || _b === void 0 ? void 0 : _b.id) || referrerId }),
104
142
  React.createElement(FocusLock, { disabled: !visible, autoFocus: true, restoreFocus: true, className: styles['focus-lock'] },
105
143
  React.createElement("div", Object.assign({ className: clsx(styles.dialog, styles[size], styles[`breakpoint-${breakpoint}`], isRefresh && styles.refresh), onKeyDown: escKeyHandler }, metadataAttribute),
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/modal/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,O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AM,EAAE,WAAW,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC,IACxF,MAAM,CACH,CACP,CACG,CACF,CACI,CACR,CACgB,CACF,CACW,CACtC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { InternalButton } from '../button/internal';\nimport InternalHeader from '../header/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { FunnelNameSelectorContext } from '../internal/analytics/context/analytics-context';\nimport { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { getBaseProps } from '../internal/base-component';\nimport FocusLock from '../internal/components/focus-lock';\nimport Portal from '../internal/components/portal';\nimport { ModalContext } from '../internal/context/modal-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useIntersectionObserver } from '../internal/hooks/use-intersection-observer';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport { SomeRequired } from '../internal/types';\nimport {\n GeneratedAnalyticsMetadataModalComponent,\n GeneratedAnalyticsMetadataModalDismiss,\n} from './analytics-metadata/interfaces';\nimport { disableBodyScrolling, enableBodyScrolling } from './body-scroll';\nimport { ModalProps } from './interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\ntype InternalModalProps = SomeRequired<ModalProps, 'size'> &\n InternalBaseComponentProps & { __injectAnalyticsComponentMetadata?: boolean; referrerId?: string };\n\nexport default function InternalModal({ modalRoot, getModalRoot, removeModalRoot, ...rest }: InternalModalProps) {\n return (\n <Portal container={modalRoot} getContainer={getModalRoot} removeContainer={removeModalRoot}>\n <PortaledModal {...rest} />\n </Portal>\n );\n}\n\ntype PortaledModalProps = Omit<InternalModalProps, 'modalRoot' | 'getModalRoot' | 'removeModalRoot'>;\n\n// Separate component to prevent the Portal from getting in the way of refs, as it needs extra cycles to render the inner components.\n// useContainerQuery needs its targeted element to exist on the first render in order to work properly.\nfunction PortaledModal({\n size,\n visible,\n header,\n children,\n footer,\n disableContentPaddings,\n onDismiss,\n __internalRootRef = null,\n __injectAnalyticsComponentMetadata,\n referrerId,\n ...rest\n}: PortaledModalProps) {\n const instanceUniqueId = useUniqueId();\n const headerId = `${rest.id || instanceUniqueId}-header`;\n const lastMouseDownElementRef = useRef<HTMLElement | null>(null);\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n\n const i18n = useInternalI18n('modal');\n const closeAriaLabel = i18n('closeAriaLabel', rest.closeAriaLabel);\n\n const refObject = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(breakpointsRef, refObject, __internalRootRef);\n\n const isRefresh = useVisualRefresh();\n\n const baseProps = getBaseProps(rest);\n\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataModalComponent = {\n name: 'awsui.Modal',\n label: `.${analyticsSelectors.header} h2`,\n };\n\n const metadataAttribute = __injectAnalyticsComponentMetadata\n ? getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })\n : {};\n\n // enable body scroll and restore focus if unmounting while visible\n useEffect(() => {\n return () => {\n enableBodyScrolling();\n };\n }, []);\n\n // enable / disable body scroll\n useEffect(() => {\n if (visible) {\n disableBodyScrolling();\n } else {\n enableBodyScrolling();\n }\n }, [visible]);\n\n // Because we hide the element with styles (and not actually detach it from DOM), we need to scroll to top\n useEffect(() => {\n if (visible && refObject.current) {\n refObject.current.scrollTop = 0;\n }\n }, [visible]);\n\n const dismiss = (reason: string) => fireNonCancelableEvent(onDismiss, { reason });\n\n const onOverlayMouseDown = (event: React.MouseEvent) => {\n lastMouseDownElementRef.current = event.target as HTMLElement;\n };\n const onOverlayClick = (event: React.MouseEvent) => {\n const overlay = refObject.current;\n const lastClicked = lastMouseDownElementRef.current;\n\n if (event.target === overlay && lastClicked === overlay) {\n dismiss('overlay');\n }\n };\n const onCloseButtonClick = () => dismiss('closeButton');\n const escKeyHandler = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n dismiss('keyboard');\n }\n };\n\n // We use an empty div element at the end of the content slot as a sentinel\n // to detect when the user has scrolled to the bottom.\n const { ref: stickySentinelRef, isIntersecting: footerStuck } = useIntersectionObserver();\n\n // Add extra scroll padding to account for the height of the sticky footer,\n // to prevent it from covering focused elements.\n const [footerHeight, footerRef] = useContainerQuery(rect => rect.borderBoxHeight);\n const { subStepRef } = useFunnelSubStep();\n\n return (\n <FunnelNameSelectorContext.Provider value={`.${styles['header--text']}`}>\n <ResetContextsForModal>\n <ModalContext.Provider value={{ isInModal: true }}>\n <div\n {...baseProps}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible },\n baseProps.className,\n isRefresh && styles.refresh\n )}\n role=\"dialog\"\n aria-modal={true}\n aria-labelledby={headerId}\n onMouseDown={onOverlayMouseDown}\n onClick={onOverlayClick}\n ref={mergedRef}\n style={footerHeight ? { scrollPaddingBottom: footerHeight } : undefined}\n data-awsui-referrer-id={subStepRef.current?.id || referrerId}\n >\n <FocusLock disabled={!visible} autoFocus={true} restoreFocus={true} className={styles['focus-lock']}>\n <div\n className={clsx(\n styles.dialog,\n styles[size],\n styles[`breakpoint-${breakpoint}`],\n isRefresh && styles.refresh\n )}\n onKeyDown={escKeyHandler}\n {...metadataAttribute}\n >\n <div className={styles.container}>\n <div className={clsx(styles.header, analyticsSelectors.header)}>\n <InternalHeader\n variant=\"h2\"\n __disableActionsWrapping={true}\n actions={\n <div\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataModalDismiss>)}\n >\n <InternalButton\n ariaLabel={closeAriaLabel}\n className={styles['dismiss-control']}\n variant=\"modal-dismiss\"\n iconName=\"close\"\n formAction=\"none\"\n onClick={onCloseButtonClick}\n />\n </div>\n }\n >\n <span id={headerId} className={styles['header--text']}>\n {header}\n </span>\n </InternalHeader>\n </div>\n <div className={clsx(styles.content, { [styles['no-paddings']]: disableContentPaddings })}>\n {children}\n <div ref={stickySentinelRef} />\n </div>\n {footer && (\n <div ref={footerRef} className={clsx(styles.footer, footerStuck && styles['footer--stuck'])}>\n {footer}\n </div>\n )}\n </div>\n </div>\n </FocusLock>\n </div>\n </ModalContext.Provider>\n </ResetContextsForModal>\n </FunnelNameSelectorContext.Provider>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/modal/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,MAAM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AAM,CAAC,iBAAiB,CAAC,EACpC,OAAO,EAAC,eAAe,EACvB,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,kBAAkB,GAC3B,CACE;wCAGR,8BAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,IAClD,MAAM,CACF,CACQ,CACb;gCACN,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,sBAAsB,EAAE,CAAC;oCACtF,QAAQ;oCACT,6BAAK,GAAG,EAAE,iBAAiB,GAAI,CAC3B;gCACL,MAAM,IAAI,CACT,6BAAK,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC,IACxF,MAAM,CACH,CACP,CACG,CACF,CACI,CACR,CACgB,CACF,CACW,CACtC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { InternalButton } from '../button/internal';\nimport InternalHeader from '../header/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { PerformanceMetrics } from '../internal/analytics';\nimport { FunnelNameSelectorContext } from '../internal/analytics/context/analytics-context';\nimport { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { getBaseProps } from '../internal/base-component';\nimport FocusLock from '../internal/components/focus-lock';\nimport Portal from '../internal/components/portal';\nimport { ModalContext } from '../internal/context/modal-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useIntersectionObserver } from '../internal/hooks/use-intersection-observer';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport { SomeRequired } from '../internal/types';\nimport {\n GeneratedAnalyticsMetadataModalComponent,\n GeneratedAnalyticsMetadataModalDismiss,\n} from './analytics-metadata/interfaces';\nimport { disableBodyScrolling, enableBodyScrolling } from './body-scroll';\nimport { ModalProps } from './interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\ntype InternalModalProps = SomeRequired<ModalProps, 'size'> &\n InternalBaseComponentProps & { __injectAnalyticsComponentMetadata?: boolean; referrerId?: string };\n\nexport default function InternalModal({ modalRoot, getModalRoot, removeModalRoot, ...rest }: InternalModalProps) {\n return (\n <Portal container={modalRoot} getContainer={getModalRoot} removeContainer={removeModalRoot}>\n <PortaledModal {...rest} />\n </Portal>\n );\n}\n\ntype PortaledModalProps = Omit<InternalModalProps, 'modalRoot' | 'getModalRoot' | 'removeModalRoot'>;\n\n// Separate component to prevent the Portal from getting in the way of refs, as it needs extra cycles to render the inner components.\n// useContainerQuery needs its targeted element to exist on the first render in order to work properly.\nfunction PortaledModal({\n size,\n visible,\n header,\n children,\n footer,\n disableContentPaddings,\n onDismiss,\n __internalRootRef = null,\n __injectAnalyticsComponentMetadata,\n referrerId,\n ...rest\n}: PortaledModalProps) {\n const instanceUniqueId = useUniqueId();\n const headerId = `${rest.id || instanceUniqueId}-header`;\n const lastMouseDownElementRef = useRef<HTMLElement | null>(null);\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n\n const i18n = useInternalI18n('modal');\n const closeAriaLabel = i18n('closeAriaLabel', rest.closeAriaLabel);\n\n const refObject = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(breakpointsRef, refObject, __internalRootRef);\n\n const isRefresh = useVisualRefresh();\n\n const baseProps = getBaseProps(rest);\n\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataModalComponent = {\n name: 'awsui.Modal',\n label: `.${analyticsSelectors.header} h2`,\n };\n const metadataAttribute = __injectAnalyticsComponentMetadata\n ? getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })\n : {};\n const loadStartTime = useRef<number>(0);\n const loadCompleteTime = useRef<number>(0);\n const componentLoadingCount = useRef<number>(0);\n const performanceMetricLogged = useRef<boolean>(false);\n\n // enable body scroll and restore focus if unmounting while visible\n useEffect(() => {\n return () => {\n enableBodyScrolling();\n };\n }, []);\n\n const resetModalPerformanceData = () => {\n loadStartTime.current = performance.now();\n loadCompleteTime.current = 0;\n performanceMetricLogged.current = false;\n };\n\n const emitTimeToContentReadyInModal = (loadCompleteTime: number) => {\n if (\n componentLoadingCount.current === 0 &&\n loadStartTime.current &&\n loadStartTime.current !== 0 &&\n !performanceMetricLogged.current\n ) {\n const timeToContentReadyInModal = loadCompleteTime - loadStartTime.current;\n PerformanceMetrics.modalPerformanceData({\n timeToContentReadyInModal,\n instanceIdentifier: instanceUniqueId,\n });\n performanceMetricLogged.current = true;\n }\n };\n\n const MODAL_READY_TIMEOUT = 100;\n /**\n * This useEffect is triggered when the visible attribute of modal changes.\n * When modal becomes visible, modal performance metrics are reset marking the beginning loading process.\n * To ensure that the modal component ready metric is always emitted, a setTimeout is implemented.\n * This setTimeout automatically emits the component ready metric after a specified duration.\n */\n useEffect(() => {\n if (visible) {\n disableBodyScrolling();\n resetModalPerformanceData();\n setTimeout(() => {\n emitTimeToContentReadyInModal(loadStartTime.current);\n }, MODAL_READY_TIMEOUT);\n } else {\n enableBodyScrolling();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [visible]);\n\n // Because we hide the element with styles (and not actually detach it from DOM), we need to scroll to top\n useEffect(() => {\n if (visible && refObject.current) {\n refObject.current.scrollTop = 0;\n }\n }, [visible]);\n\n const dismiss = (reason: string) => fireNonCancelableEvent(onDismiss, { reason });\n\n const onOverlayMouseDown = (event: React.MouseEvent) => {\n lastMouseDownElementRef.current = event.target as HTMLElement;\n };\n const onOverlayClick = (event: React.MouseEvent) => {\n const overlay = refObject.current;\n const lastClicked = lastMouseDownElementRef.current;\n\n if (event.target === overlay && lastClicked === overlay) {\n dismiss('overlay');\n }\n };\n const onCloseButtonClick = () => dismiss('closeButton');\n const escKeyHandler = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n dismiss('keyboard');\n }\n };\n\n // We use an empty div element at the end of the content slot as a sentinel\n // to detect when the user has scrolled to the bottom.\n const { ref: stickySentinelRef, isIntersecting: footerStuck } = useIntersectionObserver();\n\n // Add extra scroll padding to account for the height of the sticky footer,\n // to prevent it from covering focused elements.\n const [footerHeight, footerRef] = useContainerQuery(rect => rect.borderBoxHeight);\n const { subStepRef } = useFunnelSubStep();\n\n return (\n <FunnelNameSelectorContext.Provider value={`.${styles['header--text']}`}>\n <ResetContextsForModal>\n <ModalContext.Provider\n value={{\n isInModal: true,\n componentLoadingCount,\n emitTimeToContentReadyInModal,\n }}\n >\n <div\n {...baseProps}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible },\n baseProps.className,\n isRefresh && styles.refresh\n )}\n role=\"dialog\"\n aria-modal={true}\n aria-labelledby={headerId}\n onMouseDown={onOverlayMouseDown}\n onClick={onOverlayClick}\n ref={mergedRef}\n style={footerHeight ? { scrollPaddingBottom: footerHeight } : undefined}\n data-awsui-referrer-id={subStepRef.current?.id || referrerId}\n >\n <FocusLock disabled={!visible} autoFocus={true} restoreFocus={true} className={styles['focus-lock']}>\n <div\n className={clsx(\n styles.dialog,\n styles[size],\n styles[`breakpoint-${breakpoint}`],\n isRefresh && styles.refresh\n )}\n onKeyDown={escKeyHandler}\n {...metadataAttribute}\n >\n <div className={styles.container}>\n <div className={clsx(styles.header, analyticsSelectors.header)}>\n <InternalHeader\n variant=\"h2\"\n __disableActionsWrapping={true}\n actions={\n <div\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataModalDismiss>)}\n >\n <InternalButton\n ariaLabel={closeAriaLabel}\n className={styles['dismiss-control']}\n variant=\"modal-dismiss\"\n iconName=\"close\"\n formAction=\"none\"\n onClick={onCloseButtonClick}\n />\n </div>\n }\n >\n <span id={headerId} className={styles['header--text']}>\n {header}\n </span>\n </InternalHeader>\n </div>\n <div className={clsx(styles.content, { [styles['no-paddings']]: disableContentPaddings })}>\n {children}\n <div ref={stickySentinelRef} />\n </div>\n {footer && (\n <div ref={footerRef} className={clsx(styles.footer, footerStuck && styles['footer--stuck'])}>\n {footer}\n </div>\n )}\n </div>\n </div>\n </FocusLock>\n </div>\n </ModalContext.Provider>\n </ResetContextsForModal>\n </FunnelNameSelectorContext.Provider>\n );\n}\n"]}
package/package.json CHANGED
@@ -127,7 +127,7 @@
127
127
  "./internal/base-component/index.js",
128
128
  "./internal/base-component/styles.css.js"
129
129
  ],
130
- "version": "3.0.786",
130
+ "version": "3.0.787",
131
131
  "repository": {
132
132
  "type": "git",
133
133
  "url": "https://github.com/cloudscape-design/components.git"
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/spinner/internal.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C,UAAU,oBAAqB,SAAQ,YAAY,EAAE,0BAA0B;CAAG;AAElF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,IAAe,EACf,OAAkB,EAClB,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,oBAAoB,eAatB"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/spinner/internal.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C,UAAU,oBAAqB,SAAQ,YAAY,EAAE,0BAA0B;CAAG;AAElF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,IAAe,EACf,OAAkB,EAClB,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,oBAAoB,eAatB"}
@@ -4,10 +4,12 @@ import { __rest } from "tslib";
4
4
  import React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import { getBaseProps } from '../internal/base-component';
7
+ import { useModalContextLoadingComponent } from '../internal/hooks/use-modal-component-analytics';
7
8
  import styles from './styles.css.js';
8
9
  export default function InternalSpinner(_a) {
9
10
  var { size = 'normal', variant = 'normal', __internalRootRef } = _a, props = __rest(_a, ["size", "variant", "__internalRootRef"]);
10
11
  const baseProps = getBaseProps(props);
12
+ useModalContextLoadingComponent();
11
13
  return (React.createElement("span", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles.root, styles[`size-${size}`], styles[`variant-${variant}`]), ref: __internalRootRef }),
12
14
  React.createElement("span", { className: clsx(styles.circle, styles['circle-left']) }),
13
15
  React.createElement("span", { className: clsx(styles.circle, styles['circle-right']) })));
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/spinner/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAKjB;QALiB,EACtC,IAAI,GAAG,QAAQ,EACf,OAAO,GAAG,QAAQ,EAClB,iBAAiB,OAEI,EADlB,KAAK,cAJ8B,wCAKvC,CADS;IAER,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAEtC,OAAO,CACL,8CACM,SAAS,IACb,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC,EACvG,GAAG,EAAE,iBAAiB;QAEtB,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,GAAI;QAC/D,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,GAAI,CAC3D,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { SpinnerProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface InternalSpinnerProps extends SpinnerProps, InternalBaseComponentProps {}\n\nexport default function InternalSpinner({\n size = 'normal',\n variant = 'normal',\n __internalRootRef,\n ...props\n}: InternalSpinnerProps) {\n const baseProps = getBaseProps(props);\n\n return (\n <span\n {...baseProps}\n className={clsx(baseProps.className, styles.root, styles[`size-${size}`], styles[`variant-${variant}`])}\n ref={__internalRootRef}\n >\n <span className={clsx(styles.circle, styles['circle-left'])} />\n <span className={clsx(styles.circle, styles['circle-right'])} />\n </span>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/spinner/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,iDAAiD,CAAC;AAGlG,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAKjB;QALiB,EACtC,IAAI,GAAG,QAAQ,EACf,OAAO,GAAG,QAAQ,EAClB,iBAAiB,OAEI,EADlB,KAAK,cAJ8B,wCAKvC,CADS;IAER,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACtC,+BAA+B,EAAE,CAAC;IAClC,OAAO,CACL,8CACM,SAAS,IACb,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC,EACvG,GAAG,EAAE,iBAAiB;QAEtB,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,GAAI;QAC/D,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,GAAI,CAC3D,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useModalContextLoadingComponent } from '../internal/hooks/use-modal-component-analytics';\nimport { SpinnerProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface InternalSpinnerProps extends SpinnerProps, InternalBaseComponentProps {}\n\nexport default function InternalSpinner({\n size = 'normal',\n variant = 'normal',\n __internalRootRef,\n ...props\n}: InternalSpinnerProps) {\n const baseProps = getBaseProps(props);\n useModalContextLoadingComponent();\n return (\n <span\n {...baseProps}\n className={clsx(baseProps.className, styles.root, styles[`size-${size}`], styles[`variant-${variant}`])}\n ref={__internalRootRef}\n >\n <span className={clsx(styles.circle, styles['circle-left'])} />\n <span className={clsx(styles.circle, styles['circle-right'])} />\n </span>\n );\n}\n"]}