@cloudscape-design/components-themeable 3.0.976 → 3.0.977

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.
Files changed (72) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/internal/components/selectable-item/styles.scss +21 -8
  3. package/lib/internal/template/alert/index.js +3 -3
  4. package/lib/internal/template/alert/index.js.map +1 -1
  5. package/lib/internal/template/alert/interfaces.d.ts +10 -0
  6. package/lib/internal/template/alert/interfaces.d.ts.map +1 -1
  7. package/lib/internal/template/alert/interfaces.js.map +1 -1
  8. package/lib/internal/template/flashbar/flash.js +3 -5
  9. package/lib/internal/template/flashbar/flash.js.map +1 -1
  10. package/lib/internal/template/flashbar/interfaces.d.ts +2 -0
  11. package/lib/internal/template/flashbar/interfaces.d.ts.map +1 -1
  12. package/lib/internal/template/flashbar/interfaces.js.map +1 -1
  13. package/lib/internal/template/form/index.js +1 -1
  14. package/lib/internal/template/form/index.js.map +1 -1
  15. package/lib/internal/template/form/interfaces.d.ts +3 -1
  16. package/lib/internal/template/form/interfaces.d.ts.map +1 -1
  17. package/lib/internal/template/form/interfaces.js.map +1 -1
  18. package/lib/internal/template/form-field/index.d.ts.map +1 -1
  19. package/lib/internal/template/form-field/index.js +1 -0
  20. package/lib/internal/template/form-field/index.js.map +1 -1
  21. package/lib/internal/template/form-field/interfaces.d.ts +3 -1
  22. package/lib/internal/template/form-field/interfaces.d.ts.map +1 -1
  23. package/lib/internal/template/form-field/interfaces.js.map +1 -1
  24. package/lib/internal/template/form-field/internal.d.ts.map +1 -1
  25. package/lib/internal/template/form-field/internal.js +2 -3
  26. package/lib/internal/template/form-field/internal.js.map +1 -1
  27. package/lib/internal/template/internal/analytics/hooks/use-funnel.d.ts +1 -1
  28. package/lib/internal/template/internal/analytics/interfaces.d.ts +12 -5
  29. package/lib/internal/template/internal/analytics/interfaces.d.ts.map +1 -1
  30. package/lib/internal/template/internal/analytics/interfaces.js.map +1 -1
  31. package/lib/internal/template/internal/components/drag-handle/hooks/interfaces.d.ts +66 -0
  32. package/lib/internal/template/internal/components/drag-handle/hooks/interfaces.d.ts.map +1 -0
  33. package/lib/internal/template/internal/components/drag-handle/hooks/interfaces.js +4 -0
  34. package/lib/internal/template/internal/components/drag-handle/hooks/interfaces.js.map +1 -0
  35. package/lib/internal/template/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.d.ts +35 -0
  36. package/lib/internal/template/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.d.ts.map +1 -0
  37. package/lib/internal/template/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.js +259 -0
  38. package/lib/internal/template/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.js.map +1 -0
  39. package/lib/internal/template/internal/components/drag-handle/index.d.ts.map +1 -1
  40. package/lib/internal/template/internal/components/drag-handle/index.js +2 -2
  41. package/lib/internal/template/internal/components/drag-handle/index.js.map +1 -1
  42. package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts +1 -0
  43. package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts.map +1 -1
  44. package/lib/internal/template/internal/components/drag-handle/interfaces.js.map +1 -1
  45. package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts +1 -1
  46. package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts.map +1 -1
  47. package/lib/internal/template/internal/components/drag-handle-wrapper/index.js +4 -4
  48. package/lib/internal/template/internal/components/drag-handle-wrapper/index.js.map +1 -1
  49. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts +1 -0
  50. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts.map +1 -1
  51. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.js.map +1 -1
  52. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts +1 -1
  53. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts.map +1 -1
  54. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js +3 -3
  55. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js.map +1 -1
  56. package/lib/internal/template/internal/components/selectable-item/styles.css.js +21 -21
  57. package/lib/internal/template/internal/components/selectable-item/styles.scoped.css +56 -43
  58. package/lib/internal/template/internal/components/selectable-item/styles.selectors.js +21 -21
  59. package/lib/internal/template/internal/do-not-use/drag-handle.d.ts +5 -0
  60. package/lib/internal/template/internal/do-not-use/drag-handle.d.ts.map +1 -0
  61. package/lib/internal/template/internal/do-not-use/drag-handle.js +6 -0
  62. package/lib/internal/template/internal/do-not-use/drag-handle.js.map +1 -0
  63. package/lib/internal/template/internal/environment.js +1 -1
  64. package/lib/internal/template/internal/environment.json +1 -1
  65. package/lib/internal/template/package.json +1 -0
  66. package/lib/internal/template/wizard/interfaces.d.ts +3 -1
  67. package/lib/internal/template/wizard/interfaces.d.ts.map +1 -1
  68. package/lib/internal/template/wizard/interfaces.js.map +1 -1
  69. package/lib/internal/template/wizard/wizard-form.d.ts.map +1 -1
  70. package/lib/internal/template/wizard/wizard-form.js +2 -2
  71. package/lib/internal/template/wizard/wizard-form.js.map +1 -1
  72. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/form-field/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,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kEAAkE,CAAC;AAElH,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;A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IAAI,WAAW,CAAC,IAAI,CAC/C,6BAAK,SAAS,EAAE,MAAM,CAAC,KAAK;YACzB,SAAS,IAAI,CACZ,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,IACnF,SAAS,CACK,CAClB;YACA,WAAW,IAAI,CACd,oBAAC,gBAAgB,IAAC,EAAE,EAAE,OAAO,CAAC,OAAO,EAAE,oBAAoB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,oBAAoB,IAC3F,WAAW,CACK,CACpB;YACA,cAAc,IAAI,CACjB,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,WAAW,IACpF,cAAc,CACA,CAClB,CACG,CACP,CACG,CACP,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 { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { copyAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalGrid from '../grid/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport InternalIcon from '../icon/internal';\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FIELD_ERROR,\n DATA_ATTR_FIELD_LABEL,\n getFieldSlotSeletor,\n getSubStepAllSelector,\n getTextFromSelector,\n} from '../internal/analytics/selectors';\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { joinStrings } from '../internal/utils/strings';\nimport InternalLiveRegion from '../live-region/internal';\nimport { InternalFormFieldProps } from './interfaces';\nimport { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface FormFieldErrorProps {\n id?: string;\n children?: React.ReactNode;\n errorIconAriaLabel?: string;\n}\n\ninterface FormFieldWarningProps {\n id?: string;\n children?: React.ReactNode;\n warningIconAriaLabel?: string;\n}\n\nexport function FormFieldError({ id, children, errorIconAriaLabel }: FormFieldErrorProps) {\n const i18n = useInternalI18n('form-field');\n const contentRef = useRef<HTMLDivElement | null>(null);\n const i18nErrorIconAriaLabel = i18n('i18nStrings.errorIconAriaLabel', errorIconAriaLabel);\n\n return (\n <>\n <div id={id} className={styles.error}>\n <div className={styles['error-icon-shake-wrapper']}>\n <div className={styles['error-icon-scale-wrapper']}>\n <InternalIcon name=\"status-negative\" size=\"small\" ariaLabel={i18nErrorIconAriaLabel} />\n </div>\n </div>\n <span className={styles.error__message} ref={contentRef}>\n {children}\n </span>\n </div>\n\n <InternalLiveRegion assertive={true} tagName=\"span\" sources={[i18nErrorIconAriaLabel, contentRef]} />\n </>\n );\n}\n\nexport function FormFieldWarning({ id, children, warningIconAriaLabel }: FormFieldWarningProps) {\n const i18n = useInternalI18n('form-field');\n const contentRef = useRef<HTMLDivElement | null>(null);\n const i18nWarningIconAriaLabel = i18n('i18nStrings.warningIconAriaLabel', warningIconAriaLabel);\n\n return (\n <>\n <div id={id} className={styles.warning}>\n <div className={styles['warning-icon-shake-wrapper']}>\n <div className={styles['warning-icon-scale-wrapper']}>\n <InternalIcon name=\"status-warning\" size=\"small\" ariaLabel={i18nWarningIconAriaLabel} />\n </div>\n </div>\n <span className={styles.warning__message} ref={contentRef}>\n {children}\n </span>\n </div>\n\n <InternalLiveRegion assertive={true} tagName=\"span\" sources={[i18nWarningIconAriaLabel, contentRef]} />\n </>\n );\n}\n\nexport function ConstraintText({\n id,\n hasValidationText,\n children,\n}: {\n id?: string;\n hasValidationText: boolean;\n children: React.ReactNode;\n}) {\n return (\n <div id={id} className={clsx(styles.constraint, hasValidationText && styles['constraint-has-validation-text'])}>\n {children}\n </div>\n );\n}\n\nexport default function InternalFormField({\n controlId,\n stretch = false,\n label,\n info,\n i18nStrings,\n children,\n secondaryControl,\n description,\n constraintText,\n errorText,\n warningText,\n __hideLabel,\n __internalRootRef = null,\n __disableGutters = false,\n __analyticsMetadata = undefined,\n __style = {},\n ...rest\n}: InternalFormFieldProps) {\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n\n const instanceUniqueId = useUniqueId('formField');\n const generatedControlId = controlId || instanceUniqueId;\n const formFieldId = controlId || generatedControlId;\n\n const { funnelIdentifier, funnelInteractionId, submissionAttempt, funnelState, errorCount } = useFunnel();\n const { stepIdentifier, stepNumber, stepNameSelector } = useFunnelStep();\n const { subStepErrorContext, subStepIdentifier, subStepSelector, subStepNameSelector } = useFunnelSubStep();\n\n const showWarning = warningText && !errorText;\n\n if (warningText && errorText) {\n warnOnce('FileUpload', 'Both `errorText` and `warningText` exist. `warningText` will not be shown.');\n }\n\n const slotIds = getSlotIds(\n formFieldId,\n label,\n description,\n constraintText,\n errorText,\n showWarning ? warningText : undefined\n );\n\n const ariaDescribedBy = getAriaDescribedBy(slotIds);\n\n const gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);\n\n const {\n ariaLabelledby: parentAriaLabelledby,\n ariaDescribedby: parentAriaDescribedby,\n invalid: parentInvalid,\n warning: parentWarning,\n } = useFormFieldContext({});\n\n const contextValuesWithoutControlId = {\n ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,\n ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,\n invalid: !!errorText || !!parentInvalid,\n warning: (!!warningText && !errorText) || (!!parentWarning && !parentInvalid),\n };\n\n const analyticsAttributes = {\n [DATA_ATTR_FIELD_LABEL]: slotIds.label ? getFieldSlotSeletor(slotIds.label) : undefined,\n [DATA_ATTR_FIELD_ERROR]: slotIds.error ? getFieldSlotSeletor(slotIds.error) : undefined,\n };\n\n useEffect(() => {\n if (funnelInteractionId && errorText && funnelState.current !== 'complete') {\n const stepName = getTextFromSelector(stepNameSelector);\n const subStepName = getTextFromSelector(subStepNameSelector);\n\n errorCount.current++;\n\n // We don't want to report an error if it is hidden, e.g. inside an Expandable Section.\n const errorIsVisible = (__internalRootRef?.current?.getBoundingClientRect()?.width ?? 0) > 0;\n\n if (errorIsVisible) {\n FunnelMetrics.funnelSubStepError({\n funnelInteractionId,\n funnelIdentifier,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n subStepIdentifier,\n stepNumber,\n stepName,\n stepNameSelector,\n stepIdentifier,\n subStepErrorContext,\n fieldErrorSelector: `${getFieldSlotSeletor(slotIds.error)} .${styles.error__message}`,\n fieldLabelSelector: getFieldSlotSeletor(slotIds.label),\n subStepAllSelector: getSubStepAllSelector(),\n fieldIdentifier: __analyticsMetadata?.instanceIdentifier,\n fieldErrorContext: __analyticsMetadata?.errorContext,\n });\n }\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n errorCount.current--;\n };\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [funnelInteractionId, errorText, submissionAttempt, errorCount]);\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n style={__style}\n ref={__internalRootRef}\n {...analyticsAttributes}\n {...copyAnalyticsMetadataAttribute(rest)}\n >\n <div className={clsx(styles['label-wrapper'], __hideLabel && styles['visually-hidden'])}>\n {label && (\n <label\n className={clsx(styles.label, analyticsSelectors.label)}\n id={slotIds.label}\n htmlFor={generatedControlId}\n >\n {label}\n </label>\n )}\n <InfoLinkLabelContext.Provider value={slotIds.label}>\n {!__hideLabel && info && <span className={styles.info}>{info}</span>}\n </InfoLinkLabelContext.Provider>\n </div>\n\n {description && (\n <div className={styles.description} id={slotIds.description}>\n {description}\n </div>\n )}\n\n <div className={clsx(styles.controls, __hideLabel && styles['label-hidden'])}>\n <InternalGrid gridDefinition={gridDefinition} disableGutters={__disableGutters}>\n <FormFieldContext.Provider\n value={{\n controlId: generatedControlId,\n ...contextValuesWithoutControlId,\n }}\n >\n {children && <div className={styles.control}>{children}</div>}\n </FormFieldContext.Provider>\n\n {secondaryControl && (\n <FormFieldContext.Provider value={contextValuesWithoutControlId}>\n <div className={styles['secondary-control']}>{secondaryControl}</div>\n </FormFieldContext.Provider>\n )}\n </InternalGrid>\n </div>\n\n {(constraintText || errorText || warningText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError id={slotIds.error} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning id={slotIds.warning} warningIconAriaLabel={i18nStrings?.warningIconAriaLabel}>\n {warningText}\n </FormFieldWarning>\n )}\n {constraintText && (\n <ConstraintText id={slotIds.constraint} hasValidationText={!!errorText || !!warningText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/form-field/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,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kEAAkE,CAAC;AAElH,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB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CAC/C,6BAAK,SAAS,EAAE,MAAM,CAAC,KAAK;YACzB,SAAS,IAAI,CACZ,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,IACnF,SAAS,CACK,CAClB;YACA,WAAW,IAAI,CACd,oBAAC,gBAAgB,IAAC,EAAE,EAAE,OAAO,CAAC,OAAO,EAAE,oBAAoB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,oBAAoB,IAC3F,WAAW,CACK,CACpB;YACA,cAAc,IAAI,CACjB,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,WAAW,IACpF,cAAc,CACA,CAClB,CACG,CACP,CACG,CACP,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 { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { copyAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalGrid from '../grid/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport InternalIcon from '../icon/internal';\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FIELD_ERROR,\n DATA_ATTR_FIELD_LABEL,\n getFieldSlotSeletor,\n getSubStepAllSelector,\n getTextFromSelector,\n} from '../internal/analytics/selectors';\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { joinStrings } from '../internal/utils/strings';\nimport InternalLiveRegion from '../live-region/internal';\nimport { InternalFormFieldProps } from './interfaces';\nimport { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface FormFieldErrorProps {\n id?: string;\n children?: React.ReactNode;\n errorIconAriaLabel?: string;\n}\n\ninterface FormFieldWarningProps {\n id?: string;\n children?: React.ReactNode;\n warningIconAriaLabel?: string;\n}\n\nexport function FormFieldError({ id, children, errorIconAriaLabel }: FormFieldErrorProps) {\n const i18n = useInternalI18n('form-field');\n const contentRef = useRef<HTMLDivElement | null>(null);\n const i18nErrorIconAriaLabel = i18n('i18nStrings.errorIconAriaLabel', errorIconAriaLabel);\n\n return (\n <>\n <div id={id} className={styles.error}>\n <div className={styles['error-icon-shake-wrapper']}>\n <div className={styles['error-icon-scale-wrapper']}>\n <InternalIcon name=\"status-negative\" size=\"small\" ariaLabel={i18nErrorIconAriaLabel} />\n </div>\n </div>\n <span className={styles.error__message} ref={contentRef}>\n {children}\n </span>\n </div>\n\n <InternalLiveRegion assertive={true} tagName=\"span\" sources={[i18nErrorIconAriaLabel, contentRef]} />\n </>\n );\n}\n\nexport function FormFieldWarning({ id, children, warningIconAriaLabel }: FormFieldWarningProps) {\n const i18n = useInternalI18n('form-field');\n const contentRef = useRef<HTMLDivElement | null>(null);\n const i18nWarningIconAriaLabel = i18n('i18nStrings.warningIconAriaLabel', warningIconAriaLabel);\n\n return (\n <>\n <div id={id} className={styles.warning}>\n <div className={styles['warning-icon-shake-wrapper']}>\n <div className={styles['warning-icon-scale-wrapper']}>\n <InternalIcon name=\"status-warning\" size=\"small\" ariaLabel={i18nWarningIconAriaLabel} />\n </div>\n </div>\n <span className={styles.warning__message} ref={contentRef}>\n {children}\n </span>\n </div>\n\n <InternalLiveRegion assertive={true} tagName=\"span\" sources={[i18nWarningIconAriaLabel, contentRef]} />\n </>\n );\n}\n\nexport function ConstraintText({\n id,\n hasValidationText,\n children,\n}: {\n id?: string;\n hasValidationText: boolean;\n children: React.ReactNode;\n}) {\n return (\n <div id={id} className={clsx(styles.constraint, hasValidationText && styles['constraint-has-validation-text'])}>\n {children}\n </div>\n );\n}\n\nexport default function InternalFormField({\n controlId,\n stretch = false,\n label,\n info,\n i18nStrings,\n children,\n secondaryControl,\n description,\n constraintText,\n errorText,\n warningText,\n __hideLabel,\n __internalRootRef = null,\n __disableGutters = false,\n __analyticsMetadata = undefined,\n __style = {},\n ...rest\n}: InternalFormFieldProps) {\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n\n const instanceUniqueId = useUniqueId('formField');\n const generatedControlId = controlId || instanceUniqueId;\n const formFieldId = controlId || generatedControlId;\n\n const { funnelIdentifier, funnelInteractionId, submissionAttempt, funnelState, errorCount } = useFunnel();\n const { stepIdentifier, stepNumber, stepNameSelector } = useFunnelStep();\n const { subStepIdentifier, subStepSelector, subStepNameSelector } = useFunnelSubStep();\n\n const showWarning = warningText && !errorText;\n\n if (warningText && errorText) {\n warnOnce('FileUpload', 'Both `errorText` and `warningText` exist. `warningText` will not be shown.');\n }\n\n const slotIds = getSlotIds(\n formFieldId,\n label,\n description,\n constraintText,\n errorText,\n showWarning ? warningText : undefined\n );\n\n const ariaDescribedBy = getAriaDescribedBy(slotIds);\n\n const gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);\n\n const {\n ariaLabelledby: parentAriaLabelledby,\n ariaDescribedby: parentAriaDescribedby,\n invalid: parentInvalid,\n warning: parentWarning,\n } = useFormFieldContext({});\n\n const contextValuesWithoutControlId = {\n ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,\n ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,\n invalid: !!errorText || !!parentInvalid,\n warning: (!!warningText && !errorText) || (!!parentWarning && !parentInvalid),\n };\n\n const analyticsAttributes = {\n [DATA_ATTR_FIELD_LABEL]: slotIds.label ? getFieldSlotSeletor(slotIds.label) : undefined,\n [DATA_ATTR_FIELD_ERROR]: slotIds.error ? getFieldSlotSeletor(slotIds.error) : undefined,\n };\n\n useEffect(() => {\n if (funnelInteractionId && errorText && funnelState.current !== 'complete') {\n const stepName = getTextFromSelector(stepNameSelector);\n const subStepName = getTextFromSelector(subStepNameSelector);\n\n errorCount.current++;\n\n // We don't want to report an error if it is hidden, e.g. inside an Expandable Section.\n const errorIsVisible = (__internalRootRef?.current?.getBoundingClientRect()?.width ?? 0) > 0;\n\n if (errorIsVisible) {\n FunnelMetrics.funnelSubStepError({\n funnelInteractionId,\n funnelIdentifier,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n subStepIdentifier,\n stepNumber,\n stepName,\n stepNameSelector,\n stepIdentifier,\n fieldErrorSelector: `${getFieldSlotSeletor(slotIds.error)} .${styles.error__message}`,\n fieldLabelSelector: getFieldSlotSeletor(slotIds.label),\n subStepAllSelector: getSubStepAllSelector(),\n fieldIdentifier: __analyticsMetadata?.instanceIdentifier,\n errorContext: __analyticsMetadata?.errorContext,\n });\n }\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n errorCount.current--;\n };\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [funnelInteractionId, errorText, submissionAttempt, errorCount]);\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n style={__style}\n ref={__internalRootRef}\n {...analyticsAttributes}\n {...copyAnalyticsMetadataAttribute(rest)}\n >\n <div className={clsx(styles['label-wrapper'], __hideLabel && styles['visually-hidden'])}>\n {label && (\n <label\n className={clsx(styles.label, analyticsSelectors.label)}\n id={slotIds.label}\n htmlFor={generatedControlId}\n >\n {label}\n </label>\n )}\n <InfoLinkLabelContext.Provider value={slotIds.label}>\n {!__hideLabel && info && <span className={styles.info}>{info}</span>}\n </InfoLinkLabelContext.Provider>\n </div>\n\n {description && (\n <div className={styles.description} id={slotIds.description}>\n {description}\n </div>\n )}\n\n <div className={clsx(styles.controls, __hideLabel && styles['label-hidden'])}>\n <InternalGrid gridDefinition={gridDefinition} disableGutters={__disableGutters}>\n <FormFieldContext.Provider\n value={{\n controlId: generatedControlId,\n ...contextValuesWithoutControlId,\n }}\n >\n {children && <div className={styles.control}>{children}</div>}\n </FormFieldContext.Provider>\n\n {secondaryControl && (\n <FormFieldContext.Provider value={contextValuesWithoutControlId}>\n <div className={styles['secondary-control']}>{secondaryControl}</div>\n </FormFieldContext.Provider>\n )}\n </InternalGrid>\n </div>\n\n {(constraintText || errorText || warningText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError id={slotIds.error} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning id={slotIds.warning} warningIconAriaLabel={i18nStrings?.warningIconAriaLabel}>\n {warningText}\n </FormFieldWarning>\n )}\n {constraintText && (\n <ConstraintText id={slotIds.constraint} hasValidationText={!!errorText || !!warningText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
@@ -12,7 +12,7 @@ import { FunnelContextValue } from '../context/analytics-context';
12
12
  */
13
13
  export declare const useFunnelSubStep: () => import("../context/analytics-context").FunnelSubStepContextValue | {
14
14
  subStepIdentifier?: string | undefined;
15
- subStepErrorContext?: string | undefined;
15
+ subStepErrorContext?: import("../interfaces").ErrorContext | undefined;
16
16
  subStepId: string;
17
17
  subStepSelector: string;
18
18
  subStepNameSelector: string;
@@ -1,9 +1,16 @@
1
1
  export type FunnelType = 'single-page' | 'multi-page' | 'modal';
2
2
  export type FlowType = 'create' | 'edit' | 'delete' | 'home' | 'dashboard' | 'view-resource';
3
+ type ErrorSubCategory = 'data_format' | 'parameter_validation' | 'access_control' | 'identity_management' | 'resource_state' | 'resource_capacity' | 'connection' | 'network_config' | 'resource_limit' | 'service_quota' | 'service_integration' | 'resource_config' | 'service_operations' | 'api_request' | 'other';
4
+ type ErrorCategory = 'input_validation' | 'permission' | 'resource_availability' | 'network' | 'service_limits' | 'configuration' | 'api_specific' | 'other';
5
+ export interface ErrorContext {
6
+ errorCategory: ErrorCategory;
7
+ errorSubCategory: ErrorSubCategory;
8
+ errorMessage: string;
9
+ }
3
10
  export interface AnalyticsMetadata {
4
11
  instanceIdentifier?: string;
5
12
  flowType?: FlowType;
6
- errorContext?: string;
13
+ errorContext?: ErrorContext;
7
14
  resourceType?: string;
8
15
  }
9
16
  interface BaseFunnelProps {
@@ -12,7 +19,7 @@ interface BaseFunnelProps {
12
19
  currentDocument?: Document;
13
20
  }
14
21
  interface FunnelErrorProps extends BaseFunnelProps {
15
- funnelErrorContext?: string;
22
+ errorContext?: AnalyticsMetadata['errorContext'];
16
23
  }
17
24
  export interface FunnelStartProps extends Omit<BaseFunnelProps, 'funnelInteractionId'> {
18
25
  flowType?: FlowType;
@@ -54,7 +61,7 @@ interface FunnelStepNavigationProps extends FunnelStepProps {
54
61
  totalSubSteps?: number;
55
62
  }
56
63
  interface FunnelStepErrorProps extends FunnelStepProps {
57
- stepErrorContext?: string;
64
+ errorContext?: AnalyticsMetadata['errorContext'];
58
65
  stepErrorSelector: string;
59
66
  }
60
67
  interface FunnelSubStepProps extends FunnelStepProps {
@@ -65,9 +72,9 @@ interface FunnelSubStepProps extends FunnelStepProps {
65
72
  subStepNumber?: number;
66
73
  }
67
74
  interface OptionalFunnelSubStepErrorProps extends FunnelSubStepProps {
68
- subStepErrorContext?: string;
75
+ subStepErrorContext?: AnalyticsMetadata['errorContext'];
69
76
  fieldIdentifier?: string;
70
- fieldErrorContext?: string;
77
+ errorContext?: AnalyticsMetadata['errorContext'];
71
78
  fieldLabelSelector?: string;
72
79
  fieldErrorSelector?: string;
73
80
  }
@@ -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,YA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faces.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' | 'modal';\nexport type FlowType = 'create' | 'edit' | 'delete' | '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\ninterface BaseFunnelProps {\n funnelIdentifier?: string;\n funnelInteractionId: string;\n currentDocument?: Document;\n}\n\ninterface FunnelErrorProps extends BaseFunnelProps {\n funnelErrorContext?: string;\n}\n\nexport interface FunnelStartProps extends Omit<BaseFunnelProps, 'funnelInteractionId'> {\n flowType?: FlowType;\n resourceType?: string;\n funnelName: 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\ntype 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\ntype TableInteractionMethod = (props: TableInteractionProps) => void;\n\n// A function type specifically for funnelStart\ntype 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\ninterface FunnelStepNavigationProps extends FunnelStepProps {\n destinationStepNumber: number;\n navigationType: string;\n totalSubSteps?: number;\n}\n\ninterface FunnelStepErrorProps extends FunnelStepProps {\n stepErrorContext?: string;\n stepErrorSelector: string;\n}\n\ninterface FunnelSubStepProps extends FunnelStepProps {\n subStepIdentifier?: string;\n subStepSelector: string;\n subStepName?: string | undefined;\n subStepNameSelector: string;\n subStepNumber?: number;\n}\n\ninterface OptionalFunnelSubStepErrorProps extends FunnelSubStepProps {\n subStepErrorContext?: string;\n fieldIdentifier?: string;\n fieldErrorContext?: string;\n fieldLabelSelector?: string;\n fieldErrorSelector?: string;\n}\n\ninterface FunnelLinkInteractionProps extends FunnelSubStepProps {\n elementSelector: string;\n}\n\ninterface 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\ntype TaskCompletionDataMethod = (props: TaskCompletionDataProps) => void;\n\nexport interface IPerformanceMetrics {\n tableInteraction: TableInteractionMethod;\n taskCompletionData: TaskCompletionDataMethod;\n modalPerformanceData: ModalPerformanceDataMethod;\n}\n\ntype JSONValue = string | number | boolean | null | undefined;\nexport interface JSONObject {\n [key: string]: JSONObject | JSONValue;\n}\n\ninterface ComponentMountedProps {\n componentName: string;\n taskInteractionId?: string;\n componentConfiguration: JSONObject;\n}\n\ninterface ComponentUpdatedProps extends ComponentMountedProps {\n taskInteractionId: string;\n actionType: string;\n}\n\ntype ComponentMountedMethod = (props: ComponentMountedProps) => string;\ntype ComponentUpdatedMethod = (props: ComponentUpdatedProps) => void;\nexport interface IComponentMetrics {\n componentMounted: ComponentMountedMethod;\n componentUpdated: ComponentUpdatedMethod;\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\ntype ModalPerformanceDataMethod = (props: ModalPerformanceDataProps) => void;\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' | 'modal';\nexport type FlowType = 'create' | 'edit' | 'delete' | 'home' | 'dashboard' | 'view-resource';\n\ntype ErrorSubCategory =\n | 'data_format'\n | 'parameter_validation'\n | 'access_control'\n | 'identity_management'\n | 'resource_state'\n | 'resource_capacity'\n | 'connection'\n | 'network_config'\n | 'resource_limit'\n | 'service_quota'\n | 'service_integration'\n | 'resource_config'\n | 'service_operations'\n | 'api_request'\n | 'other';\n\ntype ErrorCategory =\n | 'input_validation'\n | 'permission'\n | 'resource_availability'\n | 'network'\n | 'service_limits'\n | 'configuration'\n | 'api_specific'\n | 'other';\n\nexport interface ErrorContext {\n errorCategory: ErrorCategory;\n errorSubCategory: ErrorSubCategory;\n errorMessage: string;\n}\n\nexport interface AnalyticsMetadata {\n instanceIdentifier?: string;\n flowType?: FlowType;\n errorContext?: ErrorContext;\n resourceType?: string;\n}\n\n// Common properties for all funnels\ninterface BaseFunnelProps {\n funnelIdentifier?: string;\n funnelInteractionId: string;\n currentDocument?: Document;\n}\n\ninterface FunnelErrorProps extends BaseFunnelProps {\n errorContext?: AnalyticsMetadata['errorContext'];\n}\n\nexport interface FunnelStartProps extends Omit<BaseFunnelProps, 'funnelInteractionId'> {\n flowType?: FlowType;\n resourceType?: string;\n funnelName: 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\ntype 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\ntype TableInteractionMethod = (props: TableInteractionProps) => void;\n\n// A function type specifically for funnelStart\ntype 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\ninterface FunnelStepNavigationProps extends FunnelStepProps {\n destinationStepNumber: number;\n navigationType: string;\n totalSubSteps?: number;\n}\n\ninterface FunnelStepErrorProps extends FunnelStepProps {\n errorContext?: AnalyticsMetadata['errorContext'];\n stepErrorSelector: string;\n}\n\ninterface FunnelSubStepProps extends FunnelStepProps {\n subStepIdentifier?: string;\n subStepSelector: string;\n subStepName?: string | undefined;\n subStepNameSelector: string;\n subStepNumber?: number;\n}\n\ninterface OptionalFunnelSubStepErrorProps extends FunnelSubStepProps {\n subStepErrorContext?: AnalyticsMetadata['errorContext'];\n fieldIdentifier?: string;\n errorContext?: AnalyticsMetadata['errorContext'];\n fieldLabelSelector?: string;\n fieldErrorSelector?: string;\n}\n\ninterface FunnelLinkInteractionProps extends FunnelSubStepProps {\n elementSelector: string;\n}\n\ninterface 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\ntype TaskCompletionDataMethod = (props: TaskCompletionDataProps) => void;\n\nexport interface IPerformanceMetrics {\n tableInteraction: TableInteractionMethod;\n taskCompletionData: TaskCompletionDataMethod;\n modalPerformanceData: ModalPerformanceDataMethod;\n}\n\ntype JSONValue = string | number | boolean | null | undefined;\nexport interface JSONObject {\n [key: string]: JSONObject | JSONValue;\n}\n\ninterface ComponentMountedProps {\n componentName: string;\n taskInteractionId?: string;\n componentConfiguration: JSONObject;\n}\n\ninterface ComponentUpdatedProps extends ComponentMountedProps {\n taskInteractionId: string;\n actionType: string;\n}\n\ntype ComponentMountedMethod = (props: ComponentMountedProps) => string;\ntype ComponentUpdatedMethod = (props: ComponentUpdatedProps) => void;\nexport interface IComponentMetrics {\n componentMounted: ComponentMountedMethod;\n componentUpdated: ComponentUpdatedMethod;\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\ntype ModalPerformanceDataMethod = (props: ModalPerformanceDataProps) => void;\n"]}
@@ -0,0 +1,66 @@
1
+ export type UapActionInteractionStateValue = 'uap-action-start' | 'uap-action-end';
2
+ export type DndInteractionStateValue = 'dnd-start' | 'dnd-active' | 'dnd-end';
3
+ export type InteractionState = null | UapActionInteractionStateValue | DndInteractionStateValue;
4
+ export type StateTransitionCallbacks<T = void> = {
5
+ type: 'onDndStart';
6
+ payload: PointerEvent;
7
+ metadata?: T;
8
+ } | {
9
+ type: 'onDndActive';
10
+ payload: PointerEvent;
11
+ } | {
12
+ type: 'onDndEnd';
13
+ } | {
14
+ type: 'onUapActionStart';
15
+ metadata?: T;
16
+ } | {
17
+ type: 'onUapActionEnd';
18
+ };
19
+ export interface DragHandleInteractionState<T = void> {
20
+ value: InteractionState;
21
+ eventData?: PointerEvent;
22
+ metadata?: T;
23
+ transitionCallbacks?: StateTransitionCallbacks<T>[];
24
+ }
25
+ export interface UseDragHandleInteractionStateProps<T = void> {
26
+ onDndStartAction?: (event: PointerEvent, metadata?: T) => void;
27
+ onDndActiveAction?: (event: PointerEvent) => void;
28
+ onDndEndAction?: () => void;
29
+ onUapActionStartAction?: (metadata?: T) => void;
30
+ onUapActionEndAction?: () => void;
31
+ }
32
+ interface DefaultActionPayload {
33
+ nativeEvent: PointerEvent;
34
+ }
35
+ interface PointerDownActionPayload<T = void> extends DefaultActionPayload {
36
+ metadata?: T;
37
+ }
38
+ interface KeyDownActionPayload<T = void> {
39
+ key: string;
40
+ metadata?: T;
41
+ }
42
+ export type Action<T = void> = {
43
+ type: 'POINTER_DOWN';
44
+ payload: PointerDownActionPayload<T>;
45
+ } | {
46
+ type: 'POINTER_MOVE';
47
+ payload: DefaultActionPayload;
48
+ } | {
49
+ type: 'POINTER_UP';
50
+ payload: DefaultActionPayload;
51
+ } | {
52
+ type: 'POINTER_CANCEL';
53
+ } | {
54
+ type: 'KEY_DOWN';
55
+ payload: KeyDownActionPayload<T>;
56
+ } | {
57
+ type: 'FOCUS';
58
+ } | {
59
+ type: 'BLUR';
60
+ } | {
61
+ type: 'RESET_TO_IDLE';
62
+ } | {
63
+ type: 'CLEAR_CALLBACKS';
64
+ };
65
+ export {};
66
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/drag-handle/hooks/interfaces.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,8BAA8B,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;AACnF,MAAM,MAAM,wBAAwB,GAAG,WAAW,GAAG,YAAY,GAAG,SAAS,CAAC;AAC9E,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,8BAA8B,GAAG,wBAAwB,CAAC;AAEhG,MAAM,MAAM,wBAAwB,CAAC,CAAC,GAAG,IAAI,IACzC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,GAC9C;IAAE,I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AAC;IAAC,OAAO,EAAE,oBAAoB,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,oBAAoB,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAC1B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export {};
4
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../../src/internal/components/drag-handle/hooks/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 UapActionInteractionStateValue = 'uap-action-start' | 'uap-action-end';\nexport type DndInteractionStateValue = 'dnd-start' | 'dnd-active' | 'dnd-end';\nexport type InteractionState = null | UapActionInteractionStateValue | DndInteractionStateValue;\n\nexport type StateTransitionCallbacks<T = void> =\n | { type: 'onDndStart'; payload: PointerEvent; metadata?: T }\n | { type: 'onDndActive'; payload: PointerEvent }\n | { type: 'onDndEnd' }\n | { type: 'onUapActionStart'; metadata?: T }\n | { type: 'onUapActionEnd' };\n\nexport interface DragHandleInteractionState<T = void> {\n value: InteractionState;\n eventData?: PointerEvent; // Only relevant for dnd states\n metadata?: T;\n transitionCallbacks?: StateTransitionCallbacks<T>[];\n}\n\nexport interface UseDragHandleInteractionStateProps<T = void> {\n onDndStartAction?: (event: PointerEvent, metadata?: T) => void;\n onDndActiveAction?: (event: PointerEvent) => void;\n onDndEndAction?: () => void;\n onUapActionStartAction?: (metadata?: T) => void;\n onUapActionEndAction?: () => void;\n}\n\ninterface DefaultActionPayload {\n nativeEvent: PointerEvent;\n}\n\ninterface PointerDownActionPayload<T = void> extends DefaultActionPayload {\n metadata?: T;\n}\n\ninterface KeyDownActionPayload<T = void> {\n key: string;\n metadata?: T;\n}\n\nexport type Action<T = void> =\n | { type: 'POINTER_DOWN'; payload: PointerDownActionPayload<T> }\n | { type: 'POINTER_MOVE'; payload: DefaultActionPayload }\n | { type: 'POINTER_UP'; payload: DefaultActionPayload }\n | { type: 'POINTER_CANCEL' }\n | { type: 'KEY_DOWN'; payload: KeyDownActionPayload<T> }\n | { type: 'FOCUS' }\n | { type: 'BLUR' }\n | { type: 'RESET_TO_IDLE' }\n | { type: 'CLEAR_CALLBACKS' };\n"]}
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import type { Action, DragHandleInteractionState, StateTransitionCallbacks, UseDragHandleInteractionStateProps } from './interfaces';
3
+ export { UseDragHandleInteractionStateProps };
4
+ export declare function calculateNextState<T = void>(state: DragHandleInteractionState<T>, action: Action<T>): DragHandleInteractionState<T>;
5
+ export declare function getCallbacksForTransition<T = void>(prevState: DragHandleInteractionState<T>, nextState: DragHandleInteractionState<T>): StateTransitionCallbacks<T>[];
6
+ /**
7
+ * Manages interaction states for drag handle components.
8
+ *
9
+ * The hook implements a state machine for drag handles that supports:
10
+ * - Pointer-based drag-and-drop (DnD) interactions
11
+ * - Keyboard-based universal access pattern (UAP) interactions
12
+ * - State transitions with appropriate callbacks
13
+ * - Metadata passing between states
14
+ *
15
+ * States:
16
+ * - null: Idle state with no active interaction
17
+ * - dnd-start: Initial pointer down, beginning of potential drag
18
+ * - dnd-active: Active dragging with pointer movement
19
+ * - dnd-end: Completed drag operation
20
+ * - uap-action-start: Keyboard/accessibility action initiated
21
+ * - uap-action-end: Keyboard/accessibility action completed
22
+ */
23
+ export default function useDragHandleInteractionState<T = void>(props?: UseDragHandleInteractionStateProps<T>, options?: {
24
+ debug: boolean;
25
+ }): {
26
+ interaction: DragHandleInteractionState<T>;
27
+ processPointerDown: (event: PointerEvent, metadata?: T) => void;
28
+ processPointerMove: (event: PointerEvent) => void;
29
+ processPointerUp: (event: PointerEvent) => void;
30
+ processPointerCancel: () => void;
31
+ processKeyDown: (event: React.KeyboardEvent<Element>, metadata?: T) => void;
32
+ processFocus: () => void;
33
+ processBlur: () => void;
34
+ };
35
+ //# sourceMappingURL=use-drag-handle-interaction-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-drag-handle-interaction-state.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EACV,MAAM,EACN,0BAA0B,EAC1B,wBAAwB,EACxB,kCAAkC,EACnC,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,kCAAkC,EAAE,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,IAAI,EACzC,KAAK,EAAE,0BAA0B,CAAC,CAAC,CAAC,EACpC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAChB,0BAA0B,CAAC,CAAC,CAAC,CA6F/B;AAED,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,IAAI,EAChD,SAAS,EAAE,0BAA0B,CAAC,CAAC,CAAC,EACxC,SAAS,EAAE,0BAA0B,CAAC,CAAC,CAAC,GACvC,wBAAwB,CAAC,CAAC,CAAC,EAAE,CA2C/B;AAwFD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,6BAA6B,CAAC,CAAC,GAAG,IAAI,EAC5D,KAAK,GAAE,kCAAkC,CAAC,CAAC,CAAM,EACjD,OAAO;;CAAmB;;gCAUI,YAAY,aAAa,CAAC;gCAM1B,YAAY;8BAMd,YAAY;;4BAWd,mBAAmB,CAAC,OAAO,CAAC,aAAa,CAAC;;;EAgBrE"}
@@ -0,0 +1,259 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { useEffect, useReducer, useRef } from 'react';
4
+ export function calculateNextState(state, action) {
5
+ switch (action.type) {
6
+ case 'POINTER_DOWN': {
7
+ const { nativeEvent, metadata } = action.payload;
8
+ return {
9
+ value: 'dnd-start',
10
+ eventData: nativeEvent,
11
+ metadata,
12
+ };
13
+ }
14
+ case 'POINTER_MOVE': {
15
+ const { nativeEvent } = action.payload;
16
+ if (state.value === 'dnd-start' || state.value === 'dnd-active') {
17
+ return Object.assign(Object.assign({}, state), { value: 'dnd-active', eventData: nativeEvent });
18
+ }
19
+ return state;
20
+ }
21
+ case 'POINTER_UP': {
22
+ if (state.value === 'dnd-start' || state.value === 'dnd-active') {
23
+ const dndSubStateBeforeUp = state.value;
24
+ if (dndSubStateBeforeUp === 'dnd-start') {
25
+ return {
26
+ value: 'uap-action-start',
27
+ metadata: state.metadata, // Preserve metadata when transitioning from dnd-start to uap-action-start
28
+ };
29
+ }
30
+ else {
31
+ return {
32
+ value: 'dnd-end',
33
+ eventData: state.eventData,
34
+ };
35
+ }
36
+ }
37
+ return state;
38
+ }
39
+ case 'POINTER_CANCEL': {
40
+ if (state.value === 'dnd-start' || state.value === 'dnd-active') {
41
+ return {
42
+ value: 'dnd-end',
43
+ };
44
+ }
45
+ return state;
46
+ }
47
+ case 'KEY_DOWN': {
48
+ const { key, metadata } = action.payload;
49
+ if (key === 'Enter' || key === ' ') {
50
+ if (state.value === null || state.value === 'uap-action-end' || state.value === 'dnd-end') {
51
+ return {
52
+ value: 'uap-action-start',
53
+ metadata,
54
+ };
55
+ }
56
+ else if (state.value === 'uap-action-start') {
57
+ return {
58
+ value: 'uap-action-end',
59
+ };
60
+ }
61
+ else if (state.value === 'dnd-start' || state.value === 'dnd-active') {
62
+ return {
63
+ value: 'uap-action-start',
64
+ metadata,
65
+ };
66
+ }
67
+ }
68
+ else if (key === 'Escape') {
69
+ if (state.value === 'uap-action-start') {
70
+ return {
71
+ value: 'uap-action-end',
72
+ };
73
+ }
74
+ }
75
+ return state;
76
+ }
77
+ case 'FOCUS':
78
+ return state;
79
+ case 'BLUR':
80
+ if (state.value === 'uap-action-start') {
81
+ return {
82
+ value: 'uap-action-end',
83
+ };
84
+ }
85
+ return state;
86
+ default:
87
+ throw new Error(`The given action type [${action.type}] is not supported.`);
88
+ }
89
+ }
90
+ export function getCallbacksForTransition(prevState, nextState) {
91
+ const callbacks = [];
92
+ // Transitions from dnd-start or dnd-active to any other state
93
+ if ((prevState.value === 'dnd-start' || prevState.value === 'dnd-active') &&
94
+ nextState.value !== 'dnd-start' &&
95
+ nextState.value !== 'dnd-active') {
96
+ callbacks.push({ type: 'onDndEnd' });
97
+ }
98
+ // From uap-action-start to uap-action-end directly
99
+ if (prevState.value === 'uap-action-start' && nextState.value === 'uap-action-end') {
100
+ callbacks.push({ type: 'onUapActionEnd' });
101
+ }
102
+ // Transitions to dnd-start
103
+ if (nextState.value === 'dnd-start') {
104
+ callbacks.push({
105
+ type: 'onDndStart',
106
+ payload: nextState.eventData,
107
+ metadata: nextState.metadata,
108
+ });
109
+ }
110
+ // Transitions to dnd-active
111
+ if (nextState.value === 'dnd-active' && prevState.value === 'dnd-start') {
112
+ callbacks.push({
113
+ type: 'onDndActive',
114
+ payload: nextState.eventData,
115
+ });
116
+ }
117
+ // Transitions to uap-action-start
118
+ if (nextState.value === 'uap-action-start') {
119
+ callbacks.push({
120
+ type: 'onUapActionStart',
121
+ metadata: nextState.metadata,
122
+ });
123
+ }
124
+ return callbacks;
125
+ }
126
+ function interactionReducer(state, action) {
127
+ const nextState = calculateNextState(state, action);
128
+ // Special handling for POINTER_MOVE to always trigger onDndActive callback
129
+ if (action.type === 'POINTER_MOVE' && action.payload.nativeEvent) {
130
+ const transitionCallbacks = getCallbacksForTransition(state, nextState);
131
+ // Check if there's already an onDndActive callback from the transition
132
+ const hasOnDndActiveCallback = transitionCallbacks.some(callback => callback.type === 'onDndActive');
133
+ const callbacks = hasOnDndActiveCallback
134
+ ? transitionCallbacks
135
+ : [...transitionCallbacks, { type: 'onDndActive', payload: action.payload.nativeEvent }];
136
+ return Object.assign(Object.assign({}, nextState), { transitionCallbacks: callbacks });
137
+ }
138
+ // Return current state if state didn't change
139
+ const isDndState = (state) => {
140
+ return state.value === 'dnd-start' || state.value === 'dnd-active' || state.value === 'dnd-end';
141
+ };
142
+ if (nextState.value === state.value) {
143
+ if (isDndState(nextState) && isDndState(state)) {
144
+ if (nextState.eventData === state.eventData) {
145
+ return state;
146
+ }
147
+ }
148
+ else {
149
+ return state;
150
+ }
151
+ }
152
+ const callbacks = getCallbacksForTransition(state, nextState);
153
+ return Object.assign(Object.assign({}, nextState), { transitionCallbacks: callbacks.length > 0 ? callbacks : undefined });
154
+ }
155
+ function useStateLogger(state, isEnabled) {
156
+ const prevStateRef = useRef(state);
157
+ useEffect(() => {
158
+ if (state.value !== prevStateRef.current.value && isEnabled) {
159
+ console.log(`State transition: ${prevStateRef.current.value} -> ${state.value}`, {
160
+ prevState: prevStateRef.current,
161
+ nextState: state,
162
+ });
163
+ }
164
+ prevStateRef.current = state;
165
+ }, [state, isEnabled]);
166
+ }
167
+ function useCallbackHandler(pendingCallbacks, props, dispatch) {
168
+ useEffect(() => {
169
+ if (!(pendingCallbacks === null || pendingCallbacks === void 0 ? void 0 : pendingCallbacks.length)) {
170
+ return;
171
+ }
172
+ pendingCallbacks.forEach(callback => {
173
+ var _a, _b, _c, _d, _e;
174
+ switch (callback.type) {
175
+ case 'onDndStart':
176
+ (_a = props.onDndStartAction) === null || _a === void 0 ? void 0 : _a.call(props, callback.payload, callback.metadata);
177
+ break;
178
+ case 'onDndActive':
179
+ (_b = props.onDndActiveAction) === null || _b === void 0 ? void 0 : _b.call(props, callback.payload);
180
+ break;
181
+ case 'onDndEnd':
182
+ (_c = props.onDndEndAction) === null || _c === void 0 ? void 0 : _c.call(props);
183
+ break;
184
+ case 'onUapActionStart':
185
+ (_d = props.onUapActionStartAction) === null || _d === void 0 ? void 0 : _d.call(props, callback.metadata);
186
+ break;
187
+ case 'onUapActionEnd':
188
+ (_e = props.onUapActionEndAction) === null || _e === void 0 ? void 0 : _e.call(props);
189
+ break;
190
+ }
191
+ });
192
+ }, [pendingCallbacks, props, dispatch]);
193
+ }
194
+ /**
195
+ * Manages interaction states for drag handle components.
196
+ *
197
+ * The hook implements a state machine for drag handles that supports:
198
+ * - Pointer-based drag-and-drop (DnD) interactions
199
+ * - Keyboard-based universal access pattern (UAP) interactions
200
+ * - State transitions with appropriate callbacks
201
+ * - Metadata passing between states
202
+ *
203
+ * States:
204
+ * - null: Idle state with no active interaction
205
+ * - dnd-start: Initial pointer down, beginning of potential drag
206
+ * - dnd-active: Active dragging with pointer movement
207
+ * - dnd-end: Completed drag operation
208
+ * - uap-action-start: Keyboard/accessibility action initiated
209
+ * - uap-action-end: Keyboard/accessibility action completed
210
+ */
211
+ export default function useDragHandleInteractionState(props = {}, options = { debug: false }) {
212
+ const propsRef = useRef(props);
213
+ propsRef.current = props;
214
+ const [interaction, dispatch] = useReducer((interactionReducer), { value: null });
215
+ useStateLogger(interaction, options.debug);
216
+ useCallbackHandler(interaction.transitionCallbacks, propsRef.current, dispatch);
217
+ return {
218
+ interaction,
219
+ processPointerDown: (event, metadata) => {
220
+ dispatch({
221
+ type: 'POINTER_DOWN',
222
+ payload: { nativeEvent: event, metadata },
223
+ });
224
+ },
225
+ processPointerMove: (event) => {
226
+ dispatch({
227
+ type: 'POINTER_MOVE',
228
+ payload: { nativeEvent: event },
229
+ });
230
+ },
231
+ processPointerUp: (event) => {
232
+ dispatch({
233
+ type: 'POINTER_UP',
234
+ payload: { nativeEvent: event },
235
+ });
236
+ },
237
+ processPointerCancel: () => {
238
+ dispatch({
239
+ type: 'POINTER_CANCEL',
240
+ });
241
+ },
242
+ processKeyDown: (event, metadata) => {
243
+ const key = event.key;
244
+ if (key === 'Enter' || key === 'Escape' || key === ' ') {
245
+ dispatch({
246
+ type: 'KEY_DOWN',
247
+ payload: { key, metadata },
248
+ });
249
+ }
250
+ },
251
+ processFocus: () => {
252
+ dispatch({ type: 'FOCUS' });
253
+ },
254
+ processBlur: () => {
255
+ dispatch({ type: 'BLUR' });
256
+ },
257
+ };
258
+ }
259
+ //# sourceMappingURL=use-drag-handle-interaction-state.js.map