@cloudscape-design/components 3.0.609 → 3.0.611

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 (83) hide show
  1. package/alert/index.d.ts.map +1 -1
  2. package/alert/index.js +5 -1
  3. package/alert/index.js.map +1 -1
  4. package/annotation-context/annotation/styles.css.js +24 -24
  5. package/annotation-context/annotation/styles.scoped.css +33 -29
  6. package/annotation-context/annotation/styles.selectors.js +24 -24
  7. package/app-layout/index.d.ts.map +1 -1
  8. package/app-layout/index.js +16 -12
  9. package/app-layout/index.js.map +1 -1
  10. package/button-dropdown/category-elements/styles.css.js +14 -14
  11. package/button-dropdown/category-elements/styles.scoped.css +25 -22
  12. package/button-dropdown/category-elements/styles.selectors.js +14 -14
  13. package/container/index.d.ts.map +1 -1
  14. package/container/index.js +1 -1
  15. package/container/index.js.map +1 -1
  16. package/flashbar/flash.d.ts.map +1 -1
  17. package/flashbar/flash.js +8 -2
  18. package/flashbar/flash.js.map +1 -1
  19. package/form/index.js +2 -2
  20. package/form/index.js.map +1 -1
  21. package/internal/analytics/components/analytics-funnel.d.ts +4 -4
  22. package/internal/analytics/components/analytics-funnel.d.ts.map +1 -1
  23. package/internal/analytics/components/analytics-funnel.js +9 -9
  24. package/internal/analytics/components/analytics-funnel.js.map +1 -1
  25. package/internal/analytics/context/analytics-context.d.ts +2 -2
  26. package/internal/analytics/context/analytics-context.d.ts.map +1 -1
  27. package/internal/analytics/context/analytics-context.js.map +1 -1
  28. package/internal/analytics/hooks/use-funnel.d.ts +1 -1
  29. package/internal/analytics/hooks/use-funnel.js +3 -3
  30. package/internal/analytics/hooks/use-funnel.js.map +1 -1
  31. package/internal/analytics/interfaces.d.ts +13 -7
  32. package/internal/analytics/interfaces.d.ts.map +1 -1
  33. package/internal/analytics/interfaces.js.map +1 -1
  34. package/internal/components/chart-popover/index.d.ts +1 -1
  35. package/internal/components/chart-popover/index.d.ts.map +1 -1
  36. package/internal/components/chart-popover/index.js.map +1 -1
  37. package/internal/components/dropdown/dropdown-fit-handler.d.ts +12 -12
  38. package/internal/components/dropdown/dropdown-fit-handler.d.ts.map +1 -1
  39. package/internal/components/dropdown/dropdown-fit-handler.js +103 -83
  40. package/internal/components/dropdown/dropdown-fit-handler.js.map +1 -1
  41. package/internal/components/dropdown/index.d.ts.map +1 -1
  42. package/internal/components/dropdown/index.js +30 -29
  43. package/internal/components/dropdown/index.js.map +1 -1
  44. package/internal/components/tooltip/index.d.ts +1 -1
  45. package/internal/components/tooltip/index.d.ts.map +1 -1
  46. package/internal/components/tooltip/index.js.map +1 -1
  47. package/internal/direction.d.ts +14 -0
  48. package/internal/direction.d.ts.map +1 -1
  49. package/internal/direction.js +25 -0
  50. package/internal/direction.js.map +1 -1
  51. package/internal/environment.js +1 -1
  52. package/internal/environment.json +1 -1
  53. package/internal/generated/theming/index.cjs +14 -14
  54. package/internal/generated/theming/index.js +14 -14
  55. package/internal/hooks/use-performance-marks.js +2 -2
  56. package/internal/hooks/use-performance-marks.js.map +1 -1
  57. package/internal/manifest.json +1 -1
  58. package/internal/utils/scrollable-containers.d.ts +5 -5
  59. package/internal/utils/scrollable-containers.d.ts.map +1 -1
  60. package/internal/utils/scrollable-containers.js +19 -19
  61. package/internal/utils/scrollable-containers.js.map +1 -1
  62. package/package.json +1 -1
  63. package/popover/container.d.ts +1 -1
  64. package/popover/container.d.ts.map +1 -1
  65. package/popover/container.js.map +1 -1
  66. package/popover/interfaces.d.ts +4 -4
  67. package/popover/interfaces.d.ts.map +1 -1
  68. package/popover/interfaces.js.map +1 -1
  69. package/popover/styles.css.js +50 -50
  70. package/popover/styles.scoped.css +76 -64
  71. package/popover/styles.selectors.js +50 -50
  72. package/popover/use-popover-position.d.ts +1 -1
  73. package/popover/use-popover-position.d.ts.map +1 -1
  74. package/popover/use-popover-position.js +32 -29
  75. package/popover/use-popover-position.js.map +1 -1
  76. package/popover/utils/positions.d.ts +2 -2
  77. package/popover/utils/positions.d.ts.map +1 -1
  78. package/popover/utils/positions.js +74 -74
  79. package/popover/utils/positions.js.map +1 -1
  80. package/wizard/index.js +1 -1
  81. package/wizard/index.js.map +1 -1
  82. package/wizard/wizard-form.js +1 -1
  83. package/wizard/wizard-form.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"use-funnel.js","sourceRoot":"","sources":["../../../../../src/internal/analytics/hooks/use-funnel.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACjD,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,0BAA0B,EAAE,GAAG,SAAS,EAAE,CAAC;IACrF,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,GAAG,aAAa,EAAE,CAAC;IAE/E,MAAM,EACJ,UAAU,EACV,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,GACrB,GAAG,OAAO,CAAC;IAEZ,IAAI,eAAe,EAAE;QACnB,OAAO,OAAO,CAAC;KAChB;IAED,MAAM,OAAO,GAAG,CAAO,KAAuC,EAAE,EAAE;;QAChE,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC;QAC7B,kFAAkF;Q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AAC;AACjB,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAC1C,MAAM,WAAW,GAA0D,OAAO,CAAC,mBAAmB;QACpG,CAAC,CAAC;YACE,CAAC,+BAA+B,CAAC,EAAE,OAAO,CAAC,mBAAmB;SAC/D;QACH,CAAC,CAAC,EAAE,CAAC;IAEP,uBAAS,WAAW,IAAK,OAAO,EAAG;AACrC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,OAAO,GAAG,UAAU,CAAC,yBAAyB,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useContext } from 'react';\nimport {\n FunnelContext,\n FunnelNameSelectorContext,\n FunnelStepContext,\n FunnelSubStepContext,\n} from '../context/analytics-context';\nimport {\n DATA_ATTR_FUNNEL_INTERACTION_ID,\n DATA_ATTR_FUNNEL_SUBSTEP,\n getNameFromSelector,\n getSubStepAllSelector,\n} from '../selectors';\nimport { FunnelMetrics } from '../';\nimport { nodeBelongs } from '../../utils/node-belongs';\n\n/**\n * Custom React Hook to manage and interact with FunnelSubStep.\n * This hook will provide necessary properties and methods required\n * to track and manage interactions with a FunnelSubStep component.\n *\n * The `onFocus` method is used to track the beginning of interaction with the FunnelSubStep.\n * The `onBlur` method is used to track the completion of interaction with the FunnelSubStep.\n * The subStepId is a unique identifier for the funnel sub-step.\n * The subStepRef is a reference to the DOM element of the funnel sub-step.\n */\nexport const useFunnelSubStep = () => {\n const context = useContext(FunnelSubStepContext);\n const { funnelInteractionId, funnelState, latestFocusCleanupFunction } = useFunnel();\n const { stepNumber, stepNameSelector, subStepConfiguration } = useFunnelStep();\n\n const {\n instanceId,\n subStepId,\n subStepSelector,\n subStepNameSelector,\n subStepRef,\n isNestedSubStep,\n mousePressed,\n isFocusedSubStep,\n focusCleanupFunction,\n } = context;\n\n if (isNestedSubStep) {\n return context;\n }\n\n const onFocus = async (event: React.FocusEvent<HTMLDivElement>) => {\n const element = event.target;\n // Ignore spurious focus events, such as when the browser window is focused again.\n await new Promise(r => setTimeout(r, 1));\n if (document.activeElement !== element) {\n return;\n }\n\n if (isFocusedSubStep.current) {\n return;\n }\n isFocusedSubStep.current = true;\n\n if (funnelInteractionId && subStepId) {\n /*\n If the previously focused substep has provided a cleanup function, we\n call it here on behalf of the previously focused substep.\n */\n latestFocusCleanupFunction.current?.();\n\n const subStepName = getNameFromSelector(subStepNameSelector);\n const stepName = getNameFromSelector(stepNameSelector);\n const subStepNumber = subStepConfiguration.current\n ?.get(stepNumber)\n ?.find(step => step.name === subStepName)?.number;\n FunnelMetrics.funnelSubStepStart({\n instanceId,\n funnelInteractionId,\n subStepSelector,\n subStepNameSelector,\n subStepName,\n subStepNumber,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n });\n\n /*\n This cleanup function will be called when the user leaves this substep.\n The function might be called either:\n\n - by the next focused substep as `latestFocusCleanupFunction`\n (through a separate instance of the function we're currently in), or\n\n - by the same substep as `focusCleanupFunction`\n (through the `onMouseUp` handler or the `onBlur` handler).\n */\n let cleanupFunctionHasBeenRun = false;\n focusCleanupFunction.current = () => {\n if (cleanupFunctionHasBeenRun) {\n return;\n }\n cleanupFunctionHasBeenRun = true;\n\n const subStepNumber = subStepConfiguration.current?.get(stepNumber)?.find(s => s.name === subStepName)?.number;\n\n if (funnelState.current !== 'cancelled') {\n FunnelMetrics.funnelSubStepComplete({\n instanceId,\n funnelInteractionId,\n subStepSelector,\n subStepNameSelector,\n subStepName,\n subStepNumber,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n };\n latestFocusCleanupFunction.current = focusCleanupFunction.current;\n }\n };\n\n const onBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n if (mousePressed.current) {\n /*\n Ignore blur events that are caused by mouse interaction, because these events don't\n always reflect user intention. For example, clicking the label of an interactive form\n element will briefly blur it.\n The mouse-caused events are handled in the global `onMouseUp` handler of the substep\n context instead.\n */\n return;\n }\n\n if (!subStepRef.current || !event.relatedTarget || !nodeBelongs(subStepRef.current, event.relatedTarget)) {\n isFocusedSubStep.current = false;\n\n if (funnelInteractionId && subStepId && funnelState.current !== 'cancelled') {\n /*\n Run this substep's own focus cleanup function if another substep\n hasn't already done it for us.\n */\n focusCleanupFunction.current?.();\n }\n }\n };\n\n const funnelSubStepProps: Record<string, any> = funnelInteractionId\n ? {\n [DATA_ATTR_FUNNEL_SUBSTEP]: subStepId,\n onFocus,\n onBlur,\n }\n : {};\n\n return { funnelSubStepProps, ...context };\n};\n\n/**\n * Custom React Hook to manage and interact with FunnelStep.\n * This hook will provide necessary properties required to track\n * and manage interactions with a FunnelStep component.\n *\n * The 'data-analytics-funnel-step' property of funnelStepProps is used to track the index of the current step in the funnel.\n * The context contains additional properties of the FunnelStep.\n */\nexport const useFunnelStep = () => {\n const context = useContext(FunnelStepContext);\n return context;\n};\n\n/**\n * Custom React Hook to manage and interact with Funnel.\n * This hook will provide necessary properties required to track\n * and manage interactions with a Funnel component.\n *\n * The 'data-analytics-funnel-interaction-id' property of funnelProps is used to track the unique identifier of the current interaction with the funnel.\n */\nexport const useFunnel = () => {\n const context = useContext(FunnelContext);\n const funnelProps: Record<string, string | number | boolean | undefined> = context.funnelInteractionId\n ? {\n [DATA_ATTR_FUNNEL_INTERACTION_ID]: context.funnelInteractionId,\n }\n : {};\n\n return { funnelProps, ...context };\n};\n\nexport const useFunnelNameSelector = () => {\n const context = useContext(FunnelNameSelectorContext);\n return context;\n};\n"]}
1
+ {"version":3,"file":"use-funnel.js","sourceRoot":"","sources":["../../../../../src/internal/analytics/hooks/use-funnel.ts"],"names":[],"mappings":"A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C,mBAAmB;SAC/D;QACH,CAAC,CAAC,EAAE,CAAC;IAEP,uBAAS,WAAW,IAAK,OAAO,EAAG;AACrC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,OAAO,GAAG,UAAU,CAAC,yBAAyB,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useContext } from 'react';\nimport {\n FunnelContext,\n FunnelNameSelectorContext,\n FunnelStepContext,\n FunnelSubStepContext,\n} from '../context/analytics-context';\nimport {\n DATA_ATTR_FUNNEL_INTERACTION_ID,\n DATA_ATTR_FUNNEL_SUBSTEP,\n getNameFromSelector,\n getSubStepAllSelector,\n} from '../selectors';\nimport { FunnelMetrics } from '../';\nimport { nodeBelongs } from '../../utils/node-belongs';\n\n/**\n * Custom React Hook to manage and interact with FunnelSubStep.\n * This hook will provide necessary properties and methods required\n * to track and manage interactions with a FunnelSubStep component.\n *\n * The `onFocus` method is used to track the beginning of interaction with the FunnelSubStep.\n * The `onBlur` method is used to track the completion of interaction with the FunnelSubStep.\n * The subStepId is a unique identifier for the funnel sub-step.\n * The subStepRef is a reference to the DOM element of the funnel sub-step.\n */\nexport const useFunnelSubStep = () => {\n const context = useContext(FunnelSubStepContext);\n const { funnelInteractionId, funnelState, latestFocusCleanupFunction } = useFunnel();\n const { stepNumber, stepNameSelector, subStepConfiguration } = useFunnelStep();\n\n const {\n instanceIdentifier,\n subStepId,\n subStepSelector,\n subStepNameSelector,\n subStepRef,\n isNestedSubStep,\n mousePressed,\n isFocusedSubStep,\n focusCleanupFunction,\n } = context;\n\n if (isNestedSubStep) {\n return context;\n }\n\n const onFocus = async (event: React.FocusEvent<HTMLDivElement>) => {\n const element = event.target;\n // Ignore spurious focus events, such as when the browser window is focused again.\n await new Promise(r => setTimeout(r, 1));\n if (document.activeElement !== element) {\n return;\n }\n\n if (isFocusedSubStep.current) {\n return;\n }\n isFocusedSubStep.current = true;\n\n if (funnelInteractionId && subStepId) {\n /*\n If the previously focused substep has provided a cleanup function, we\n call it here on behalf of the previously focused substep.\n */\n latestFocusCleanupFunction.current?.();\n\n const subStepName = getNameFromSelector(subStepNameSelector);\n const stepName = getNameFromSelector(stepNameSelector);\n const subStepNumber = subStepConfiguration.current\n ?.get(stepNumber)\n ?.find(step => step.name === subStepName)?.number;\n FunnelMetrics.funnelSubStepStart({\n instanceIdentifier,\n funnelInteractionId,\n subStepSelector,\n subStepNameSelector,\n subStepName,\n subStepNumber,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n });\n\n /*\n This cleanup function will be called when the user leaves this substep.\n The function might be called either:\n\n - by the next focused substep as `latestFocusCleanupFunction`\n (through a separate instance of the function we're currently in), or\n\n - by the same substep as `focusCleanupFunction`\n (through the `onMouseUp` handler or the `onBlur` handler).\n */\n let cleanupFunctionHasBeenRun = false;\n focusCleanupFunction.current = () => {\n if (cleanupFunctionHasBeenRun) {\n return;\n }\n cleanupFunctionHasBeenRun = true;\n\n const subStepNumber = subStepConfiguration.current?.get(stepNumber)?.find(s => s.name === subStepName)?.number;\n\n if (funnelState.current !== 'cancelled') {\n FunnelMetrics.funnelSubStepComplete({\n instanceIdentifier,\n funnelInteractionId,\n subStepSelector,\n subStepNameSelector,\n subStepName,\n subStepNumber,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n };\n latestFocusCleanupFunction.current = focusCleanupFunction.current;\n }\n };\n\n const onBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n if (mousePressed.current) {\n /*\n Ignore blur events that are caused by mouse interaction, because these events don't\n always reflect user intention. For example, clicking the label of an interactive form\n element will briefly blur it.\n The mouse-caused events are handled in the global `onMouseUp` handler of the substep\n context instead.\n */\n return;\n }\n\n if (!subStepRef.current || !event.relatedTarget || !nodeBelongs(subStepRef.current, event.relatedTarget)) {\n isFocusedSubStep.current = false;\n\n if (funnelInteractionId && subStepId && funnelState.current !== 'cancelled') {\n /*\n Run this substep's own focus cleanup function if another substep\n hasn't already done it for us.\n */\n focusCleanupFunction.current?.();\n }\n }\n };\n\n const funnelSubStepProps: Record<string, any> = funnelInteractionId\n ? {\n [DATA_ATTR_FUNNEL_SUBSTEP]: subStepId,\n onFocus,\n onBlur,\n }\n : {};\n\n return { funnelSubStepProps, ...context };\n};\n\n/**\n * Custom React Hook to manage and interact with FunnelStep.\n * This hook will provide necessary properties required to track\n * and manage interactions with a FunnelStep component.\n *\n * The 'data-analytics-funnel-step' property of funnelStepProps is used to track the index of the current step in the funnel.\n * The context contains additional properties of the FunnelStep.\n */\nexport const useFunnelStep = () => {\n const context = useContext(FunnelStepContext);\n return context;\n};\n\n/**\n * Custom React Hook to manage and interact with Funnel.\n * This hook will provide necessary properties required to track\n * and manage interactions with a Funnel component.\n *\n * The 'data-analytics-funnel-interaction-id' property of funnelProps is used to track the unique identifier of the current interaction with the funnel.\n */\nexport const useFunnel = () => {\n const context = useContext(FunnelContext);\n const funnelProps: Record<string, string | number | boolean | undefined> = context.funnelInteractionId\n ? {\n [DATA_ATTR_FUNNEL_INTERACTION_ID]: context.funnelInteractionId,\n }\n : {};\n\n return { funnelProps, ...context };\n};\n\nexport const useFunnelNameSelector = () => {\n const context = useContext(FunnelNameSelectorContext);\n return context;\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  export interface AnalyticsMetadata {
2
- instanceId?: string;
2
+ instanceIdentifier?: string;
3
3
  flowType?: 'create' | 'edit';
4
4
  errorContext?: string;
5
5
  }
@@ -8,7 +8,7 @@ export interface BaseFunnelProps {
8
8
  funnelInteractionId: string;
9
9
  }
10
10
  export interface FunnelProps extends BaseFunnelProps {
11
- instanceId?: AnalyticsMetadata['instanceId'];
11
+ instanceIdentifier?: AnalyticsMetadata['instanceIdentifier'];
12
12
  flowType?: AnalyticsMetadata['flowType'];
13
13
  totalFunnelSteps: number;
14
14
  optionalStepNumbers: number[];
@@ -16,7 +16,7 @@ export interface FunnelProps extends BaseFunnelProps {
16
16
  funnelNameSelector?: string;
17
17
  }
18
18
  export interface FunnelStartProps {
19
- instanceId?: AnalyticsMetadata['instanceId'];
19
+ instanceIdentifier?: AnalyticsMetadata['instanceIdentifier'];
20
20
  flowType?: AnalyticsMetadata['flowType'];
21
21
  funnelNameSelector: string;
22
22
  totalFunnelSteps: number;
@@ -30,7 +30,7 @@ export interface FunnelStartProps {
30
30
  export type FunnelMethod<T extends BaseFunnelProps> = (props: T) => void;
31
31
  export type FunnelStartMethod = (props: FunnelStartProps) => string;
32
32
  export interface FunnelStepProps extends BaseFunnelProps {
33
- instanceId?: AnalyticsMetadata['instanceId'];
33
+ instanceIdentifier?: AnalyticsMetadata['instanceIdentifier'];
34
34
  stepNumber: number;
35
35
  stepName?: string | undefined;
36
36
  stepNameSelector: string;
@@ -50,9 +50,10 @@ export interface FunnelStepNavigationProps extends FunnelStepProps {
50
50
  }
51
51
  export interface FunnelStepErrorProps extends FunnelStepProps {
52
52
  stepErrorSelector: string;
53
+ errorContext?: AnalyticsMetadata['errorContext'];
53
54
  }
54
55
  export interface FunnelSubStepProps extends FunnelStepProps {
55
- instanceId?: AnalyticsMetadata['instanceId'];
56
+ instanceIdentifier?: AnalyticsMetadata['instanceIdentifier'];
56
57
  subStepSelector: string;
57
58
  subStepName?: string | undefined;
58
59
  subStepNameSelector: string;
@@ -61,10 +62,12 @@ export interface FunnelSubStepProps extends FunnelStepProps {
61
62
  export interface FunnelSubStepErrorProps extends FunnelSubStepProps {
62
63
  fieldLabelSelector: string;
63
64
  fieldErrorSelector: string;
65
+ errorContext?: AnalyticsMetadata['errorContext'];
64
66
  }
65
67
  export interface OptionalFunnelSubStepErrorProps extends FunnelSubStepProps {
66
68
  fieldLabelSelector?: string;
67
69
  fieldErrorSelector?: string;
70
+ errorContext?: AnalyticsMetadata['errorContext'];
68
71
  }
69
72
  export interface FunnelLinkInteractionProps extends FunnelSubStepProps {
70
73
  elementSelector: string;
@@ -73,7 +76,7 @@ export interface FunnelChangeProps extends BaseFunnelProps {
73
76
  stepConfiguration: StepConfiguration[];
74
77
  }
75
78
  export interface FunnelStepChangeProps extends BaseFunnelProps {
76
- instanceId?: AnalyticsMetadata['instanceId'];
79
+ instanceIdentifier?: AnalyticsMetadata['instanceIdentifier'];
77
80
  stepNumber: number;
78
81
  stepName: string;
79
82
  stepNameSelector: string;
@@ -90,9 +93,12 @@ export interface SubStepConfiguration {
90
93
  number: number;
91
94
  name: string;
92
95
  }
96
+ export interface FunnelErrorProps extends BaseFunnelProps {
97
+ errorContext?: AnalyticsMetadata['errorContext'];
98
+ }
93
99
  export interface IFunnelMetrics {
94
100
  funnelStart: FunnelStartMethod;
95
- funnelError: FunnelMethod<BaseFunnelProps>;
101
+ funnelError: FunnelMethod<FunnelErrorProps>;
96
102
  funnelComplete: FunnelMethod<BaseFunnelProps>;
97
103
  funnelSuccessful: FunnelMethod<BaseFunnelProps>;
98
104
  funnelCancelled: FunnelMethod<BaseFunnelProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/internal/analytics/interfaces.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,YAAY,CAAC;AAGtD,MAAM,WAAW,eAAe;IAC9B,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD,UAAU,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC7C,QAAQ,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACzC,gBAAgB,E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,CAAC,CAAC;IAEtD,kBAAkB,EAAE,YAAY,CAAC,kBAAkB,CAAC,CAAC;IACrD,qBAAqB,EAAE,YAAY,CAAC,kBAAkB,CAAC,CAAC;IACxD,kBAAkB,EAAE,YAAY,CAAC,+BAA+B,CAAC,CAAC;IAElE,mBAAmB,EAAE,YAAY,CAAC,0BAA0B,CAAC,CAAC;IAC9D,sBAAsB,EAAE,YAAY,CAAC,0BAA0B,CAAC,CAAC;CAClE"}
@@ -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\n// TODO: Replace with correct type from component-toolkit\nexport interface AnalyticsMetadata {\n instanceId?: string;\n flowType?: 'create' | 'edit';\n errorContext?: string;\n}\n\nexport type FunnelType = 'single-page' | 'multi-page';\n\n// Common properties for all funnels\nexport interface BaseFunnelProps {\n funnelInteractionId: string;\n}\n\nexport interface FunnelProps extends BaseFunnelProps {\n instanceId?: AnalyticsMetadata['instanceId'];\n flowType?: AnalyticsMetadata['flowType'];\n totalFunnelSteps: number;\n optionalStepNumbers: number[];\n funnelType: FunnelType;\n funnelNameSelector?: string;\n}\n\nexport interface FunnelStartProps {\n instanceId?: AnalyticsMetadata['instanceId'];\n flowType?: AnalyticsMetadata['flowType'];\n funnelNameSelector: string;\n totalFunnelSteps: number;\n optionalStepNumbers: number[];\n stepConfiguration?: StepConfiguration[];\n funnelType: FunnelType;\n funnelVersion: string;\n componentVersion: string;\n theme: string;\n}\n\n// A function type for a generic funnel method\nexport type FunnelMethod<T extends BaseFunnelProps> = (props: T) => 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 instanceId?: AnalyticsMetadata['instanceId'];\n stepNumber: number;\n stepName?: string | undefined;\n stepNameSelector: string;\n subStepAllSelector: string;\n}\n\nexport interface FunnelStepStartProps extends FunnelStepProps {\n totalSubSteps?: number;\n subStepConfiguration?: SubStepConfiguration[];\n}\nexport interface FunnelStepCompleteProps extends FunnelStepProps {\n totalSubSteps?: number;\n}\n\nexport interface FunnelStepNavigationProps extends FunnelStepProps {\n destinationStepNumber: number;\n navigationType: string;\n totalSubSteps?: number;\n}\n\nexport interface FunnelStepErrorProps extends FunnelStepProps {\n stepErrorSelector: string;\n}\n\nexport interface FunnelSubStepProps extends FunnelStepProps {\n instanceId?: AnalyticsMetadata['instanceId'];\n subStepSelector: string;\n subStepName?: string | undefined;\n subStepNameSelector: string;\n subStepNumber?: number;\n}\n\nexport interface FunnelSubStepErrorProps extends FunnelSubStepProps {\n fieldLabelSelector: string;\n fieldErrorSelector: string;\n}\n\nexport interface OptionalFunnelSubStepErrorProps extends FunnelSubStepProps {\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 FunnelStepChangeProps extends BaseFunnelProps {\n instanceId?: AnalyticsMetadata['instanceId'];\n stepNumber: number;\n stepName: string;\n stepNameSelector: string;\n subStepAllSelector: string;\n totalSubSteps: number;\n subStepConfiguration: SubStepConfiguration[];\n}\n\nexport interface StepConfiguration {\n number: number;\n name: string;\n isOptional: boolean;\n}\n\nexport interface SubStepConfiguration {\n number: number;\n name: string;\n}\n\n// Define the interface using the method type\nexport interface IFunnelMetrics {\n funnelStart: FunnelStartMethod;\n funnelError: FunnelMethod<BaseFunnelProps>;\n funnelComplete: FunnelMethod<BaseFunnelProps>;\n funnelSuccessful: FunnelMethod<BaseFunnelProps>;\n funnelCancelled: FunnelMethod<BaseFunnelProps>;\n funnelChange: FunnelMethod<FunnelChangeProps>;\n\n funnelStepStart: FunnelMethod<FunnelStepStartProps>;\n funnelStepComplete: FunnelMethod<FunnelStepCompleteProps>;\n funnelStepNavigation: FunnelMethod<FunnelStepNavigationProps>;\n funnelStepError: FunnelMethod<FunnelStepErrorProps>;\n funnelStepChange: FunnelMethod<FunnelStepChangeProps>;\n\n funnelSubStepStart: FunnelMethod<FunnelSubStepProps>;\n funnelSubStepComplete: FunnelMethod<FunnelSubStepProps>;\n funnelSubStepError: FunnelMethod<OptionalFunnelSubStepErrorProps>;\n\n helpPanelInteracted: FunnelMethod<FunnelLinkInteractionProps>;\n externalLinkInteracted: FunnelMethod<FunnelLinkInteractionProps>;\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\n// TODO: Replace with correct type from component-toolkit\nexport interface AnalyticsMetadata {\n instanceIdentifier?: string;\n flowType?: 'create' | 'edit';\n errorContext?: string;\n}\n\nexport type FunnelType = 'single-page' | 'multi-page';\n\n// Common properties for all funnels\nexport interface BaseFunnelProps {\n funnelInteractionId: string;\n}\n\nexport interface FunnelProps extends BaseFunnelProps {\n instanceIdentifier?: AnalyticsMetadata['instanceIdentifier'];\n flowType?: AnalyticsMetadata['flowType'];\n totalFunnelSteps: number;\n optionalStepNumbers: number[];\n funnelType: FunnelType;\n funnelNameSelector?: string;\n}\n\nexport interface FunnelStartProps {\n instanceIdentifier?: AnalyticsMetadata['instanceIdentifier'];\n flowType?: AnalyticsMetadata['flowType'];\n funnelNameSelector: string;\n totalFunnelSteps: number;\n optionalStepNumbers: number[];\n stepConfiguration?: StepConfiguration[];\n funnelType: FunnelType;\n funnelVersion: string;\n componentVersion: string;\n theme: string;\n}\n\n// A function type for a generic funnel method\nexport type FunnelMethod<T extends BaseFunnelProps> = (props: T) => 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 instanceIdentifier?: AnalyticsMetadata['instanceIdentifier'];\n stepNumber: number;\n stepName?: string | undefined;\n stepNameSelector: string;\n subStepAllSelector: string;\n}\n\nexport interface FunnelStepStartProps extends FunnelStepProps {\n totalSubSteps?: number;\n subStepConfiguration?: SubStepConfiguration[];\n}\nexport interface FunnelStepCompleteProps extends FunnelStepProps {\n totalSubSteps?: number;\n}\n\nexport interface FunnelStepNavigationProps extends FunnelStepProps {\n destinationStepNumber: number;\n navigationType: string;\n totalSubSteps?: number;\n}\n\nexport interface FunnelStepErrorProps extends FunnelStepProps {\n stepErrorSelector: string;\n errorContext?: AnalyticsMetadata['errorContext'];\n}\n\nexport interface FunnelSubStepProps extends FunnelStepProps {\n instanceIdentifier?: AnalyticsMetadata['instanceIdentifier'];\n subStepSelector: string;\n subStepName?: string | undefined;\n subStepNameSelector: string;\n subStepNumber?: number;\n}\n\nexport interface FunnelSubStepErrorProps extends FunnelSubStepProps {\n fieldLabelSelector: string;\n fieldErrorSelector: string;\n errorContext?: AnalyticsMetadata['errorContext'];\n}\n\nexport interface OptionalFunnelSubStepErrorProps extends FunnelSubStepProps {\n fieldLabelSelector?: string;\n fieldErrorSelector?: string;\n errorContext?: AnalyticsMetadata['errorContext'];\n}\n\nexport interface FunnelLinkInteractionProps extends FunnelSubStepProps {\n elementSelector: string;\n}\n\nexport interface FunnelChangeProps extends BaseFunnelProps {\n stepConfiguration: StepConfiguration[];\n}\n\nexport interface FunnelStepChangeProps extends BaseFunnelProps {\n instanceIdentifier?: AnalyticsMetadata['instanceIdentifier'];\n stepNumber: number;\n stepName: string;\n stepNameSelector: string;\n subStepAllSelector: string;\n totalSubSteps: number;\n subStepConfiguration: SubStepConfiguration[];\n}\n\nexport interface StepConfiguration {\n number: number;\n name: string;\n isOptional: boolean;\n}\n\nexport interface SubStepConfiguration {\n number: number;\n name: string;\n}\n\nexport interface FunnelErrorProps extends BaseFunnelProps {\n errorContext?: AnalyticsMetadata['errorContext'];\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<FunnelStepStartProps>;\n funnelStepComplete: FunnelMethod<FunnelStepCompleteProps>;\n funnelStepNavigation: FunnelMethod<FunnelStepNavigationProps>;\n funnelStepError: FunnelMethod<FunnelStepErrorProps>;\n funnelStepChange: FunnelMethod<FunnelStepChangeProps>;\n\n funnelSubStepStart: FunnelMethod<FunnelSubStepProps>;\n funnelSubStepComplete: FunnelMethod<FunnelSubStepProps>;\n funnelSubStepError: FunnelMethod<OptionalFunnelSubStepErrorProps>;\n\n helpPanelInteracted: FunnelMethod<FunnelLinkInteractionProps>;\n externalLinkInteracted: FunnelMethod<FunnelLinkInteractionProps>;\n}\n"]}
@@ -4,7 +4,7 @@ export interface ChartPopoverProps extends PopoverProps {
4
4
  /** Title of the popover */
5
5
  title?: React.ReactNode;
6
6
  /** References the element the container is positioned against. */
7
- trackRef: React.RefObject<Element>;
7
+ trackRef: React.RefObject<HTMLElement | SVGElement>;
8
8
  /**
9
9
  Used to update the container position in case track or track position changes:
10
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/chart-popover/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAMjD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAS3D,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,2BAA2B;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS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AAE,CAAC,CAAC;QAEZ,oBAAC,gBAAgB,IACf,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,CACjB,6BAAK,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,kBAAkB,QAAQ,EAAE,CAAC,CAAC;gBACpF,6BAAK,SAAS,EAAE,aAAa,CAAC,aAAa,CAAC,GAAI;gBAChD,6BAAK,SAAS,EAAE,aAAa,CAAC,aAAa,CAAC,GAAI,CAC5C,CACP,EACD,YAAY,EAAE,IAAI,EAClB,qBAAqB,EAAE,IAAI,EAC3B,gBAAgB,EAAE,QAAQ;YAE1B,6BAAK,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC;gBAClC,oBAAC,WAAW,IACV,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,KAAK,EACb,SAAS,EAAE,SAAS,EACpB,eAAe,EAAC,SAAS,EACzB,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,IAEhC,QAAQ,CACG,CACV,CACW,CACf,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';\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\n\nimport { getBaseProps } from '../../base-component';\n\nimport { PopoverProps } from '../../../popover/interfaces';\nimport PopoverContainer from '../../../popover/container';\nimport PopoverBody from '../../../popover/body';\nimport popoverStyles from '../../../popover/styles.css.js';\nimport { useMergeRefs } from '../../hooks/use-merge-refs';\n\nimport styles from './styles.css.js';\nimport { nodeBelongs } from '../../utils/node-belongs';\n\nexport interface ChartPopoverProps extends PopoverProps {\n /** Title of the popover */\n title?: React.ReactNode;\n\n /** References the element the container is positioned against. */\n trackRef: React.RefObject<Element>;\n /**\n Used to update the container position in case track or track position changes:\n \n const trackRef = useRef<Element>(null)\n return (<>\n <Track style={getPosition(selectedItemId)} ref={trackRef} />\n <PopoverContainer trackRef={trackRef} trackKey={selectedItemId} .../>\n </>)\n */\n trackKey?: string | number;\n\n /** Optional container element that prevents any clicks in there from dismissing the popover */\n container: Element | null;\n\n /** Event that is fired when the popover is dismissed */\n onDismiss: (outsideClick?: boolean) => void;\n\n /** Fired when the pointer enters the hoverable area around the popover */\n onMouseEnter?: (event: React.MouseEvent) => void;\n\n /** Fired when the pointer leaves the hoverable area around the popover */\n onMouseLeave?: (event: React.MouseEvent) => void;\n\n onBlur?: (event: React.FocusEvent) => void;\n\n /** Popover content */\n children?: React.ReactNode;\n}\n\nexport default React.forwardRef(ChartPopover);\n\nfunction ChartPopover(\n {\n position = 'right',\n size = 'medium',\n fixedWidth = false,\n dismissButton = false,\n dismissAriaLabel,\n\n children,\n\n title,\n trackRef,\n trackKey,\n onDismiss,\n container,\n\n onMouseEnter,\n onMouseLeave,\n onBlur,\n\n ...restProps\n }: ChartPopoverProps,\n ref: React.Ref<HTMLElement>\n) {\n const baseProps = getBaseProps(restProps);\n const popoverObjectRef = useRef<HTMLDivElement | null>(null);\n\n const popoverRef = useMergeRefs(popoverObjectRef, ref);\n\n useEffect(() => {\n const onDocumentClick = (event: MouseEvent) => {\n if (\n event.target &&\n !nodeBelongs(popoverObjectRef.current, event.target as Element) && // click not in popover\n !nodeContains(container, event.target as Element) // click not in segment\n ) {\n onDismiss(true);\n }\n };\n\n document.addEventListener('mousedown', onDocumentClick, { capture: true });\n return () => {\n document.removeEventListener('mousedown', onDocumentClick, { capture: true });\n };\n }, [container, onDismiss]);\n\n // In chart popovers, dismiss button is present when they are pinned, so both values are equivalent.\n const isPinned = dismissButton;\n\n return (\n <div\n {...baseProps}\n className={clsx(popoverStyles.root, styles.root, baseProps.className)}\n ref={popoverRef}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onBlur={onBlur}\n // The tabIndex makes it so that clicking inside popover assigns this element as blur target.\n // That is necessary in charts to ensure the blur target is within the chart and no cleanup is needed.\n tabIndex={-1}\n >\n <PopoverContainer\n size={size}\n fixedWidth={fixedWidth}\n position={position}\n trackRef={trackRef}\n trackKey={trackKey}\n arrow={position => (\n <div className={clsx(popoverStyles.arrow, popoverStyles[`arrow-position-${position}`])}>\n <div className={popoverStyles['arrow-outer']} />\n <div className={popoverStyles['arrow-inner']} />\n </div>\n )}\n keepPosition={true}\n allowVerticalOverflow={true}\n allowScrollToFit={isPinned}\n >\n <div className={styles['hover-area']}>\n <PopoverBody\n dismissButton={dismissButton}\n dismissAriaLabel={dismissAriaLabel}\n header={title}\n onDismiss={onDismiss}\n overflowVisible=\"content\"\n className={styles['popover-body']}\n >\n {children}\n </PopoverBody>\n </div>\n </PopoverContainer>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/chart-popover/index.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;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAC1D,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAqCvD,eAAe,KAAK,CAAC,UAAU,CAAC,YAAY,CAA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SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,EACrE,GAAG,EAAE,UAAU,EACf,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM;QACd,6FAA6F;QAC7F,sGAAsG;QACtG,QAAQ,EAAE,CAAC,CAAC;QAEZ,oBAAC,gBAAgB,IACf,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,CACjB,6BAAK,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,kBAAkB,QAAQ,EAAE,CAAC,CAAC;gBACpF,6BAAK,SAAS,EAAE,aAAa,CAAC,aAAa,CAAC,GAAI;gBAChD,6BAAK,SAAS,EAAE,aAAa,CAAC,aAAa,CAAC,GAAI,CAC5C,CACP,EACD,YAAY,EAAE,IAAI,EAClB,qBAAqB,EAAE,IAAI,EAC3B,gBAAgB,EAAE,QAAQ;YAE1B,6BAAK,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC;gBAClC,oBAAC,WAAW,IACV,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,KAAK,EACb,SAAS,EAAE,SAAS,EACpB,eAAe,EAAC,SAAS,EACzB,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,IAEhC,QAAQ,CACG,CACV,CACW,CACf,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';\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\n\nimport { getBaseProps } from '../../base-component';\n\nimport { PopoverProps } from '../../../popover/interfaces';\nimport PopoverContainer from '../../../popover/container';\nimport PopoverBody from '../../../popover/body';\nimport popoverStyles from '../../../popover/styles.css.js';\nimport { useMergeRefs } from '../../hooks/use-merge-refs';\n\nimport styles from './styles.css.js';\nimport { nodeBelongs } from '../../utils/node-belongs';\n\nexport interface ChartPopoverProps extends PopoverProps {\n /** Title of the popover */\n title?: React.ReactNode;\n\n /** References the element the container is positioned against. */\n trackRef: React.RefObject<HTMLElement | SVGElement>;\n /**\n Used to update the container position in case track or track position changes:\n \n const trackRef = useRef<Element>(null)\n return (<>\n <Track style={getPosition(selectedItemId)} ref={trackRef} />\n <PopoverContainer trackRef={trackRef} trackKey={selectedItemId} .../>\n </>)\n */\n trackKey?: string | number;\n\n /** Optional container element that prevents any clicks in there from dismissing the popover */\n container: Element | null;\n\n /** Event that is fired when the popover is dismissed */\n onDismiss: (outsideClick?: boolean) => void;\n\n /** Fired when the pointer enters the hoverable area around the popover */\n onMouseEnter?: (event: React.MouseEvent) => void;\n\n /** Fired when the pointer leaves the hoverable area around the popover */\n onMouseLeave?: (event: React.MouseEvent) => void;\n\n onBlur?: (event: React.FocusEvent) => void;\n\n /** Popover content */\n children?: React.ReactNode;\n}\n\nexport default React.forwardRef(ChartPopover);\n\nfunction ChartPopover(\n {\n position = 'right',\n size = 'medium',\n fixedWidth = false,\n dismissButton = false,\n dismissAriaLabel,\n\n children,\n\n title,\n trackRef,\n trackKey,\n onDismiss,\n container,\n\n onMouseEnter,\n onMouseLeave,\n onBlur,\n\n ...restProps\n }: ChartPopoverProps,\n ref: React.Ref<HTMLElement>\n) {\n const baseProps = getBaseProps(restProps);\n const popoverObjectRef = useRef<HTMLDivElement | null>(null);\n\n const popoverRef = useMergeRefs(popoverObjectRef, ref);\n\n useEffect(() => {\n const onDocumentClick = (event: MouseEvent) => {\n if (\n event.target &&\n !nodeBelongs(popoverObjectRef.current, event.target as Element) && // click not in popover\n !nodeContains(container, event.target as Element) // click not in segment\n ) {\n onDismiss(true);\n }\n };\n\n document.addEventListener('mousedown', onDocumentClick, { capture: true });\n return () => {\n document.removeEventListener('mousedown', onDocumentClick, { capture: true });\n };\n }, [container, onDismiss]);\n\n // In chart popovers, dismiss button is present when they are pinned, so both values are equivalent.\n const isPinned = dismissButton;\n\n return (\n <div\n {...baseProps}\n className={clsx(popoverStyles.root, styles.root, baseProps.className)}\n ref={popoverRef}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onBlur={onBlur}\n // The tabIndex makes it so that clicking inside popover assigns this element as blur target.\n // That is necessary in charts to ensure the blur target is within the chart and no cleanup is needed.\n tabIndex={-1}\n >\n <PopoverContainer\n size={size}\n fixedWidth={fixedWidth}\n position={position}\n trackRef={trackRef}\n trackKey={trackKey}\n arrow={position => (\n <div className={clsx(popoverStyles.arrow, popoverStyles[`arrow-position-${position}`])}>\n <div className={popoverStyles['arrow-outer']} />\n <div className={popoverStyles['arrow-inner']} />\n </div>\n )}\n keepPosition={true}\n allowVerticalOverflow={true}\n allowScrollToFit={isPinned}\n >\n <div className={styles['hover-area']}>\n <PopoverBody\n dismissButton={dismissButton}\n dismissAriaLabel={dismissAriaLabel}\n header={title}\n onDismiss={onDismiss}\n overflowVisible=\"content\"\n className={styles['popover-body']}\n >\n {children}\n </PopoverBody>\n </div>\n </PopoverContainer>\n </div>\n );\n}\n"]}
@@ -1,20 +1,20 @@
1
1
  import { BoundingBox } from '../../utils/scrollable-containers';
2
2
  interface AvailableSpace {
3
- above: number;
4
- below: number;
5
- left: number;
6
- right: number;
3
+ blockStart: number;
4
+ blockEnd: number;
5
+ inlineStart: number;
6
+ inlineEnd: number;
7
7
  }
8
8
  export interface DropdownPosition {
9
- height: string;
10
- width: string;
11
- dropUp: boolean;
12
- dropLeft: boolean;
13
- left: string;
9
+ blockSize: string;
10
+ inlineSize: string;
11
+ dropBlockStart: boolean;
12
+ dropInlineStart: boolean;
13
+ insetInlineStart: string;
14
14
  }
15
15
  export interface InteriorDropdownPosition extends DropdownPosition {
16
- bottom: string;
17
- top: string;
16
+ insetBlockEnd: string;
17
+ insetBlockStart: string;
18
18
  }
19
19
  export declare const defaultMaxDropdownWidth: number;
20
20
  export declare const getAvailableSpace: ({ trigger, overflowParents, stretchWidth, stretchHeight, isMobile, }: {
@@ -37,7 +37,7 @@ export declare const getWidths: ({ triggerElement, dropdownElement, desiredMinWi
37
37
  }) => {
38
38
  idealWidth: number;
39
39
  minWidth: number;
40
- triggerWidth: number;
40
+ triggerInlineSize: number;
41
41
  };
42
42
  export declare const hasEnoughSpaceToStretchBeyondTriggerWidth: ({ triggerElement, dropdownElement, desiredMinWidth, expandToViewport, stretchWidth, stretchHeight, isMobile, }: {
43
43
  triggerElement: HTMLElement;
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-fit-handler.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/dropdown-fit-handler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAmD,MAAM,mCAAmC,CAAC;AAOjH,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IAChE,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAkBD,eAAO,MAAM,uBAAuB,QAA4B,CAAC;AAEjE,eAAO,MAAM,iBAAiB;aAOnB,WAAW;qBACH,cAAc,WAAW,CAAC;;;;MAIzC,cA8BH,CAAC;AAEF,eAAO,MAAM,yBAAyB;aAK3B,WAAW;qBACH,cAAc,WAAW,CAAC;;MAEzC,cA+BH,CAAC;AAEF,eAAO,MAAM,SAAS;oBAMJ,WAAW;qBACV,WAAW;;;;;;;CAe7B,CAAC;AAEF,eAAO,MAAM,yCAAyC;oBASpC,WAAW;qBACV,WAAW;;sBAEV,OAAO;kBACX,OAAO;mBACN,OAAO;cACZ,OAAO;aAsBlB,CAAC;AAEF,eAAO,MAAM,mBAAmB;oBAWd,WAAW;qBACV,WAAW;qBACX,cAAc,WAAW,CAAC;;;;;;;MAOzC,gBAyDH,CAAC;AAEF,eAAO,MAAM,2BAA2B,YAC7B,WAAW,YACV,WAAW,mBACJ,cAAc,WAAW,CAAC,aAChC,OAAO,KACjB,wBAmCF,CAAC;AAEF,eAAO,MAAM,iBAAiB,oBACX,cAAc,kBACf,cAAc,4BACJ,cAAc,YAC9B,OAAO,oBACC,OAAO,gBACX,OAAO,gBACP,OAAO,iBACN,OAAO,YACZ,OAAO,aACN,MAAM,8BACW,OAAO,KAClC,CAAC,gBAAgB,EAAE,OAAO,CAkC5B,CAAC"}
1
+ {"version":3,"file":"dropdown-fit-handler.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/dropdown-fit-handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAmD,MAAM,mCAAmC,CAAC;AAOjH,UAAU,cAAc;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AACD,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IAChE,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB;AAkBD,eAAO,MAAM,uBAAuB,QAA4B,CAAC;AAEjE,eAAO,MAAM,iBAAiB;aAOnB,WAAW;qBACH,cAAc,WAAW,CAAC;;;;MAIzC,cA2CH,CAAC;AAEF,eAAO,MAAM,yBAAyB;aAK3B,WAAW;qBACH,cAAc,WAAW,CAAC;;MAEzC,cA4CH,CAAC;AAEF,eAAO,MAAM,SAAS;oBAMJ,WAAW;qBACV,WAAW;;;;;;;CAe7B,CAAC;AAEF,eAAO,MAAM,yCAAyC;oBASpC,WAAW;qBACV,WAAW;;sBAEV,OAAO;kBACX,OAAO;mBACN,OAAO;cACZ,OAAO;aAsBlB,CAAC;AAEF,eAAO,MAAM,mBAAmB;oBAWd,WAAW;qBACV,WAAW;qBACX,cAAc,WAAW,CAAC;;;;;;;MAOzC,gBA0DH,CAAC;AAEF,eAAO,MAAM,2BAA2B,YAC7B,WAAW,YACV,WAAW,mBACJ,cAAc,WAAW,CAAC,aAChC,OAAO,KACjB,wBAyCF,CAAC;AAEF,eAAO,MAAM,iBAAiB,oBACX,cAAc,kBACf,cAAc,4BACJ,cAAc,YAC9B,OAAO,oBACC,OAAO,gBACX,OAAO,gBACP,OAAO,iBACN,OAAO,YACZ,OAAO,aACN,MAAM,8BACW,OAAO,KAClC,CAAC,gBAAgB,EAAE,OAAO,CAkC5B,CAAC"}
@@ -1,19 +1,20 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { getBreakpointValue } from '../../breakpoints';
4
+ import { getLogicalBoundingClientRect } from '../../direction';
4
5
  import { getOverflowParents, getOverflowParentDimensions } from '../../utils/scrollable-containers';
5
6
  import styles from './styles.css.js';
6
7
  const AVAILABLE_SPACE_RESERVE_DEFAULT = 50;
7
8
  const AVAILABLE_SPACE_RESERVE_MOBILE_VERTICAL = 19; // 50 - 31
8
9
  const AVAILABLE_SPACE_RESERVE_MOBILE_HORIZONTAL = 20;
9
10
  const getClosestParentDimensions = (element) => {
10
- const parents = getOverflowParents(element).map(el => {
11
- const { height, width, top, left } = el.getBoundingClientRect();
11
+ const parents = getOverflowParents(element).map(element => {
12
+ const { blockSize, inlineSize, insetBlockStart, insetInlineStart } = getLogicalBoundingClientRect(element);
12
13
  return {
13
- height,
14
- width,
15
- top,
16
- left,
14
+ blockSize,
15
+ inlineSize,
16
+ insetBlockStart,
17
+ insetInlineStart,
17
18
  };
18
19
  });
19
20
  return parents.shift();
@@ -32,20 +33,28 @@ export const getAvailableSpace = ({ trigger, overflowParents, stretchWidth = fal
32
33
  : isMobile
33
34
  ? AVAILABLE_SPACE_RESERVE_MOBILE_HORIZONTAL
34
35
  : AVAILABLE_SPACE_RESERVE_DEFAULT;
35
- const { bottom: triggerBottom, left: triggerLeft, right: triggerRight } = trigger.getBoundingClientRect();
36
- return overflowParents.reduce(({ above, below, left, right }, overflowParent) => {
37
- const offsetTop = triggerBottom - overflowParent.top;
38
- const currentAbove = offsetTop - trigger.offsetHeight - availableSpaceReserveVertical;
39
- const currentBelow = overflowParent.height - offsetTop - availableSpaceReserveVertical;
40
- const currentLeft = triggerRight - overflowParent.left - availableSpaceReserveHorizontal;
41
- const currentRight = overflowParent.left + overflowParent.width - triggerLeft - availableSpaceReserveHorizontal;
36
+ const { insetBlockEnd: triggerBlockEnd, insetInlineStart: triggerInlineStart, insetInlineEnd: triggerInlineEnd, } = getLogicalBoundingClientRect(trigger);
37
+ return overflowParents.reduce(({ blockStart, blockEnd, inlineStart, inlineEnd }, overflowParent) => {
38
+ const offsetTop = triggerBlockEnd - overflowParent.insetBlockStart;
39
+ const currentBlockStart = offsetTop - trigger.offsetHeight - availableSpaceReserveVertical;
40
+ const currentBlockEnd = overflowParent.blockSize - offsetTop - availableSpaceReserveVertical;
41
+ const currentInlineStart = triggerInlineEnd - overflowParent.insetInlineStart - availableSpaceReserveHorizontal;
42
+ const currentInlineEnd = overflowParent.insetInlineStart +
43
+ overflowParent.inlineSize -
44
+ triggerInlineStart -
45
+ availableSpaceReserveHorizontal;
42
46
  return {
43
- above: Math.min(above, currentAbove),
44
- below: Math.min(below, currentBelow),
45
- left: Math.min(left, currentLeft),
46
- right: Math.min(right, currentRight),
47
+ blockStart: Math.min(blockStart, currentBlockStart),
48
+ blockEnd: Math.min(blockEnd, currentBlockEnd),
49
+ inlineStart: Math.min(inlineStart, currentInlineStart),
50
+ inlineEnd: Math.min(inlineEnd, currentInlineEnd),
47
51
  };
48
- }, { above: Number.MAX_VALUE, below: Number.MAX_VALUE, left: Number.MAX_VALUE, right: Number.MAX_VALUE });
52
+ }, {
53
+ blockStart: Number.MAX_VALUE,
54
+ blockEnd: Number.MAX_VALUE,
55
+ inlineStart: Number.MAX_VALUE,
56
+ inlineEnd: Number.MAX_VALUE,
57
+ });
49
58
  };
50
59
  export const getInteriorAvailableSpace = ({ trigger, overflowParents, isMobile, }) => {
51
60
  const AVAILABLE_SPACE_RESERVE_VERTICAL = isMobile
@@ -54,32 +63,43 @@ export const getInteriorAvailableSpace = ({ trigger, overflowParents, isMobile,
54
63
  const AVAILABLE_SPACE_RESERVE_HORIZONTAL = isMobile
55
64
  ? AVAILABLE_SPACE_RESERVE_MOBILE_HORIZONTAL
56
65
  : AVAILABLE_SPACE_RESERVE_DEFAULT;
57
- const { bottom: triggerBottom, top: triggerTop, left: triggerLeft, right: triggerRight, } = trigger.getBoundingClientRect();
58
- return overflowParents.reduce(({ above, below, left, right }, overflowParent) => {
59
- const currentAbove = triggerBottom - overflowParent.top - AVAILABLE_SPACE_RESERVE_VERTICAL;
60
- const currentBelow = overflowParent.height - triggerTop + overflowParent.top - AVAILABLE_SPACE_RESERVE_VERTICAL;
61
- const currentLeft = triggerLeft - overflowParent.left - AVAILABLE_SPACE_RESERVE_HORIZONTAL;
62
- const currentRight = overflowParent.left + overflowParent.width - triggerRight - AVAILABLE_SPACE_RESERVE_HORIZONTAL;
66
+ const { insetBlockEnd: triggerBlockEnd, insetBlockStart: triggerBlockStart, insetInlineStart: triggerInlineStart, insetInlineEnd: triggerInlineEnd, } = getLogicalBoundingClientRect(trigger);
67
+ return overflowParents.reduce(({ blockStart, blockEnd, inlineStart, inlineEnd }, overflowParent) => {
68
+ const currentBlockStart = triggerBlockEnd - overflowParent.insetBlockStart - AVAILABLE_SPACE_RESERVE_VERTICAL;
69
+ const currentBlockEnd = overflowParent.blockSize -
70
+ triggerBlockStart +
71
+ overflowParent.insetBlockStart -
72
+ AVAILABLE_SPACE_RESERVE_VERTICAL;
73
+ const currentInlineStart = triggerInlineStart - overflowParent.insetInlineStart - AVAILABLE_SPACE_RESERVE_HORIZONTAL;
74
+ const currentInlineEnd = overflowParent.insetInlineStart +
75
+ overflowParent.inlineSize -
76
+ triggerInlineEnd -
77
+ AVAILABLE_SPACE_RESERVE_HORIZONTAL;
63
78
  return {
64
- above: Math.min(above, currentAbove),
65
- below: Math.min(below, currentBelow),
66
- left: Math.min(left, currentLeft),
67
- right: Math.min(right, currentRight),
79
+ blockStart: Math.min(blockStart, currentBlockStart),
80
+ blockEnd: Math.min(blockEnd, currentBlockEnd),
81
+ inlineStart: Math.min(inlineStart, currentInlineStart),
82
+ inlineEnd: Math.min(inlineEnd, currentInlineEnd),
68
83
  };
69
- }, { above: Number.MAX_VALUE, below: Number.MAX_VALUE, left: Number.MAX_VALUE, right: Number.MAX_VALUE });
84
+ }, {
85
+ blockStart: Number.MAX_VALUE,
86
+ blockEnd: Number.MAX_VALUE,
87
+ inlineStart: Number.MAX_VALUE,
88
+ inlineEnd: Number.MAX_VALUE,
89
+ });
70
90
  };
71
91
  export const getWidths = ({ triggerElement, dropdownElement, desiredMinWidth, stretchBeyondTriggerWidth = false, }) => {
72
92
  // Determine the width of the trigger
73
- const triggerWidth = triggerElement.getBoundingClientRect().width;
93
+ const { inlineSize: triggerInlineSize } = getLogicalBoundingClientRect(triggerElement);
74
94
  // Minimum width is determined by either an explicit number (desiredMinWidth) or the trigger width
75
- const minWidth = desiredMinWidth ? Math.min(triggerWidth, desiredMinWidth) : triggerWidth;
95
+ const minWidth = desiredMinWidth ? Math.min(triggerInlineSize, desiredMinWidth) : triggerInlineSize;
76
96
  // If stretchBeyondTriggerWidth is true, the maximum width is the XS breakpoint (465px) or the trigger width (if bigger).
77
- const maxWidth = stretchBeyondTriggerWidth ? Math.max(defaultMaxDropdownWidth, triggerWidth) : Number.MAX_VALUE;
97
+ const maxWidth = stretchBeyondTriggerWidth ? Math.max(defaultMaxDropdownWidth, triggerInlineSize) : Number.MAX_VALUE;
78
98
  // Determine the actual dropdown width, the size that it "wants" to be
79
- const requiredWidth = dropdownElement.getBoundingClientRect().width;
99
+ const { inlineSize: requiredWidth } = getLogicalBoundingClientRect(dropdownElement);
80
100
  // Try to achieve the required/desired width within the given parameters
81
101
  const idealWidth = Math.min(Math.max(requiredWidth, minWidth), maxWidth);
82
- return { idealWidth, minWidth, triggerWidth };
102
+ return { idealWidth, minWidth, triggerInlineSize };
83
103
  };
84
104
  export const hasEnoughSpaceToStretchBeyondTriggerWidth = ({ triggerElement, dropdownElement, desiredMinWidth, expandToViewport, stretchWidth, stretchHeight, isMobile, }) => {
85
105
  const overflowParents = getOverflowParentDimensions({
@@ -101,7 +121,7 @@ export const hasEnoughSpaceToStretchBeyondTriggerWidth = ({ triggerElement, drop
101
121
  stretchHeight,
102
122
  isMobile,
103
123
  });
104
- return idealWidth <= availableSpace.left || idealWidth <= availableSpace.right;
124
+ return idealWidth <= availableSpace.inlineStart || idealWidth <= availableSpace.inlineEnd;
105
125
  };
106
126
  export const getDropdownPosition = ({ triggerElement, dropdownElement, overflowParents, minWidth: desiredMinWidth, preferCenter = false, stretchWidth = false, stretchHeight = false, isMobile = false, stretchBeyondTriggerWidth = false, }) => {
107
127
  // Determine the space available around the dropdown that it can grow in
@@ -112,91 +132,91 @@ export const getDropdownPosition = ({ triggerElement, dropdownElement, overflowP
112
132
  stretchHeight,
113
133
  isMobile,
114
134
  });
115
- const { idealWidth, minWidth, triggerWidth } = getWidths({
135
+ const { idealWidth, minWidth, triggerInlineSize } = getWidths({
116
136
  triggerElement,
117
137
  dropdownElement,
118
138
  desiredMinWidth,
119
139
  stretchBeyondTriggerWidth,
120
140
  });
121
- let dropLeft;
122
- let left = null;
123
- let width = idealWidth;
141
+ let dropInlineStart;
142
+ let insetInlineStart = null;
143
+ let inlineSize = idealWidth;
124
144
  //1. Can it be positioned with ideal width to the right?
125
- if (idealWidth <= availableSpace.right) {
126
- dropLeft = false;
145
+ if (idealWidth <= availableSpace.inlineEnd) {
146
+ dropInlineStart = false;
127
147
  //2. Can it be positioned with ideal width to the left?
128
148
  }
129
- else if (idealWidth <= availableSpace.left) {
130
- dropLeft = true;
149
+ else if (idealWidth <= availableSpace.inlineStart) {
150
+ dropInlineStart = true;
131
151
  //3. Fit into biggest available space either on left or right
132
152
  }
133
153
  else {
134
- dropLeft = availableSpace.left > availableSpace.right;
135
- width = Math.max(availableSpace.left, availableSpace.right, minWidth);
154
+ dropInlineStart = availableSpace.inlineStart > availableSpace.inlineEnd;
155
+ inlineSize = Math.max(availableSpace.inlineStart, availableSpace.inlineEnd, minWidth);
136
156
  }
137
157
  if (preferCenter) {
138
- const spillOver = (idealWidth - triggerWidth) / 2;
158
+ const spillOver = (idealWidth - triggerInlineSize) / 2;
139
159
  // availableSpace always includes the trigger width, but we want to exclude that
140
- const availableOutsideLeft = availableSpace.left - triggerWidth;
141
- const availableOutsideRight = availableSpace.right - triggerWidth;
160
+ const availableOutsideLeft = availableSpace.inlineStart - triggerInlineSize;
161
+ const availableOutsideRight = availableSpace.inlineEnd - triggerInlineSize;
142
162
  const fitsInCenter = availableOutsideLeft >= spillOver && availableOutsideRight >= spillOver;
143
163
  if (fitsInCenter) {
144
- left = -spillOver;
164
+ insetInlineStart = -spillOver;
145
165
  }
146
166
  }
147
- const dropUp = availableSpace.below < dropdownElement.offsetHeight && availableSpace.above > availableSpace.below;
148
- const availableHeight = dropUp ? availableSpace.above : availableSpace.below;
167
+ const dropBlockStart = availableSpace.blockEnd < dropdownElement.offsetHeight && availableSpace.blockStart > availableSpace.blockEnd;
168
+ const availableHeight = dropBlockStart ? availableSpace.blockStart : availableSpace.blockEnd;
149
169
  // Try and crop the bottom item when all options can't be displayed, affordance for "there's more"
150
170
  const croppedHeight = stretchHeight ? availableHeight : Math.floor(availableHeight / 31) * 31 + 16;
151
171
  return {
152
- dropUp,
153
- dropLeft,
154
- left: left === null ? 'auto' : `${left}px`,
155
- height: `${croppedHeight}px`,
156
- width: `${width}px`,
172
+ dropBlockStart,
173
+ dropInlineStart,
174
+ insetInlineStart: insetInlineStart === null ? 'auto' : `${insetInlineStart}px`,
175
+ blockSize: `${croppedHeight}px`,
176
+ inlineSize: `${inlineSize}px`,
157
177
  };
158
178
  };
159
179
  export const getInteriorDropdownPosition = (trigger, dropdown, overflowParents, isMobile) => {
160
180
  const availableSpace = getInteriorAvailableSpace({ trigger, overflowParents, isMobile });
161
- const { bottom: triggerBottom, top: triggerTop, width: triggerWidth } = trigger.getBoundingClientRect();
162
- const { top: parentDropdownTop, height: parentDropdownHeight } = getClosestParentDimensions(trigger);
163
- let dropLeft;
164
- let width = dropdown.getBoundingClientRect().width;
165
- const top = triggerTop - parentDropdownTop;
166
- if (width <= availableSpace.right) {
167
- dropLeft = false;
181
+ const { insetBlockEnd: triggerBlockEnd, insetBlockStart: triggerBlockStart, inlineSize: triggerInlineSize, } = getLogicalBoundingClientRect(trigger);
182
+ const { insetBlockStart: parentDropdownBlockStart, blockSize: parentDropdownHeight } = getClosestParentDimensions(trigger);
183
+ let dropInlineStart;
184
+ let { inlineSize } = getLogicalBoundingClientRect(dropdown);
185
+ const insetBlockStart = triggerBlockStart - parentDropdownBlockStart;
186
+ if (inlineSize <= availableSpace.inlineEnd) {
187
+ dropInlineStart = false;
168
188
  }
169
- else if (width <= availableSpace.left) {
170
- dropLeft = true;
189
+ else if (inlineSize <= availableSpace.inlineStart) {
190
+ dropInlineStart = true;
171
191
  }
172
192
  else {
173
- dropLeft = availableSpace.left > availableSpace.right;
174
- width = Math.max(availableSpace.left, availableSpace.right);
193
+ dropInlineStart = availableSpace.inlineStart > availableSpace.inlineEnd;
194
+ inlineSize = Math.max(availableSpace.inlineStart, availableSpace.inlineEnd);
175
195
  }
176
- const left = dropLeft ? 0 - width : triggerWidth;
177
- const dropUp = availableSpace.below < dropdown.offsetHeight && availableSpace.above > availableSpace.below;
178
- const bottom = dropUp ? parentDropdownTop + parentDropdownHeight - triggerBottom : 0;
179
- const availableHeight = dropUp ? availableSpace.above : availableSpace.below;
196
+ const insetInlineStart = dropInlineStart ? 0 - inlineSize : triggerInlineSize;
197
+ const dropBlockStart = availableSpace.blockEnd < dropdown.offsetHeight && availableSpace.blockStart > availableSpace.blockEnd;
198
+ const insetBlockEnd = dropBlockStart ? parentDropdownBlockStart + parentDropdownHeight - triggerBlockEnd : 0;
199
+ const availableHeight = dropBlockStart ? availableSpace.blockStart : availableSpace.blockEnd;
180
200
  // Try and crop the bottom item when all options can't be displayed, affordance for "there's more"
181
201
  const croppedHeight = Math.floor(availableHeight / 31) * 31 + 16;
182
202
  return {
183
- dropUp,
184
- dropLeft,
185
- height: `${croppedHeight}px`,
186
- width: `${width}px`,
187
- top: `${top}px`,
188
- bottom: `${bottom}px`,
189
- left: `${left}px`,
203
+ dropBlockStart,
204
+ dropInlineStart,
205
+ blockSize: `${croppedHeight}px`,
206
+ inlineSize: `${inlineSize}px`,
207
+ insetBlockStart: `${insetBlockStart}px`,
208
+ insetBlockEnd: `${insetBlockEnd}px`,
209
+ insetInlineStart: `${insetInlineStart}px`,
190
210
  };
191
211
  };
192
212
  export const calculatePosition = (dropdownElement, triggerElement, verticalContainerElement, interior, expandToViewport, preferCenter, stretchWidth, stretchHeight, isMobile, minWidth, stretchBeyondTriggerWidth) => {
193
213
  // cleaning previously assigned values,
194
214
  // so that they are not reused in case of screen resize and similar events
195
- verticalContainerElement.style.maxHeight = '';
196
- dropdownElement.style.width = '';
197
- dropdownElement.style.top = '';
198
- dropdownElement.style.bottom = '';
199
- dropdownElement.style.left = '';
215
+ verticalContainerElement.style.maxBlockSize = '';
216
+ dropdownElement.style.inlineSize = '';
217
+ dropdownElement.style.insetBlockStart = '';
218
+ dropdownElement.style.insetBlockEnd = '';
219
+ dropdownElement.style.insetInlineStart = '';
200
220
  dropdownElement.classList.remove(styles['dropdown-drop-left']);
201
221
  dropdownElement.classList.remove(styles['dropdown-drop-right']);
202
222
  dropdownElement.classList.remove(styles['dropdown-drop-up']);