@cloudscape-design/components-themeable 3.0.954 → 3.0.955

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 (24) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/popover/container.scss +48 -0
  3. package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.d.ts.map +1 -1
  4. package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js +4 -10
  5. package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js.map +1 -1
  6. package/lib/internal/template/breadcrumb-group/item/item.d.ts.map +1 -1
  7. package/lib/internal/template/breadcrumb-group/item/item.js +9 -18
  8. package/lib/internal/template/breadcrumb-group/item/item.js.map +1 -1
  9. package/lib/internal/template/code-editor/resizable-box/index.d.ts.map +1 -1
  10. package/lib/internal/template/code-editor/resizable-box/index.js +2 -0
  11. package/lib/internal/template/code-editor/resizable-box/index.js.map +1 -1
  12. package/lib/internal/template/internal/environment.js +1 -1
  13. package/lib/internal/template/internal/environment.json +1 -1
  14. package/lib/internal/template/popover/styles.css.js +54 -54
  15. package/lib/internal/template/popover/styles.scoped.css +101 -77
  16. package/lib/internal/template/popover/styles.selectors.js +54 -54
  17. package/lib/internal/template/slider/internal.d.ts.map +1 -1
  18. package/lib/internal/template/slider/internal.js +48 -47
  19. package/lib/internal/template/slider/internal.js.map +1 -1
  20. package/package.json +1 -1
  21. package/lib/internal/template/internal/components/tooltip/registry.d.ts +0 -4
  22. package/lib/internal/template/internal/components/tooltip/registry.d.ts.map +0 -1
  23. package/lib/internal/template/internal/components/tooltip/registry.js +0 -28
  24. package/lib/internal/template/internal/components/tooltip/registry.js.map +0 -1
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "0e10faf3e2a2463ebbacf77a09eabb3de5003781"
2
+ "commit": "e6c589ba5c8e5fa58f05b5e000561979f895f4f3"
3
3
  }
@@ -6,12 +6,60 @@
6
6
  @use '../internal/styles' as styles;
7
7
  @use '../internal/styles/tokens' as awsui;
8
8
 
9
+ $arrow-height: 10px;
10
+
9
11
  .container {
10
12
  display: inline-block;
11
13
  position: fixed;
12
14
  inset-block-start: -9999px;
13
15
  inset-inline-start: -9999px;
14
16
  z-index: 2000;
17
+
18
+ // A little pseudoelement to extend the container to the space between the
19
+ // popover and the trigger to avoid hover-based popovers/tooltips from
20
+ // closing too eagerly when the cursor goes between them.
21
+ &::before {
22
+ content: '';
23
+ position: absolute;
24
+ }
25
+
26
+ &:has(&-arrow-position-bottom-left),
27
+ &:has(&-arrow-position-bottom-center),
28
+ &:has(&-arrow-position-bottom-right) {
29
+ &::before {
30
+ inset-inline: 0;
31
+ inset-block-start: -$arrow-height;
32
+ block-size: $arrow-height;
33
+ }
34
+ }
35
+
36
+ &:has(&-arrow-position-top-left),
37
+ &:has(&-arrow-position-top-center),
38
+ &:has(&-arrow-position-top-right) {
39
+ &::before {
40
+ inset-inline: 0;
41
+ inset-block-end: -$arrow-height;
42
+ block-size: $arrow-height;
43
+ }
44
+ }
45
+
46
+ &:has(&-arrow-position-right-top),
47
+ &:has(&-arrow-position-right-bottom) {
48
+ &::before {
49
+ inset-block: 0;
50
+ inset-inline-start: -$arrow-height;
51
+ inline-size: $arrow-height;
52
+ }
53
+ }
54
+
55
+ &:has(&-arrow-position-left-top),
56
+ &:has(&-arrow-position-left-bottom) {
57
+ &::before {
58
+ inset-block: 0;
59
+ inset-inline-end: -$arrow-height;
60
+ inline-size: $arrow-height;
61
+ }
62
+ }
15
63
  }
16
64
 
17
65
  .container-body {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiE,MAAM,OAAO,CAAC;AAGtF,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAQxD,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAEpD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;;AAyLD,wBAA+C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiE,MAAM,OAAO,CAAC;AAGtF,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAOxD,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAEpD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;;AAmLD,wBAA+C"}
@@ -4,7 +4,6 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
4
4
  import clsx from 'clsx';
5
5
  import Icon from '../../../../icon/internal';
6
6
  import Tooltip from '../../../../internal/components/tooltip';
7
- import { registerTooltip } from '../../../../internal/components/tooltip/registry';
8
7
  import testutilStyles from '../../../test-classes/styles.css.js';
9
8
  import styles from './styles.css.js';
10
9
  function TriggerButton({ ariaLabel, className, iconName, iconSvg, ariaExpanded, ariaControls, onClick, testId, disabled = false, badge, selected = false, hasTooltip = false, tooltipText, hasOpenDrawer = false, isMobile = false, isForPreviousActiveDrawer = false, isForSplitPanel = false, }, ref) {
@@ -93,14 +92,6 @@ function TriggerButton({ ariaLabel, className, iconName, iconSvg, ariaExpanded,
93
92
  }
94
93
  }
95
94
  }, [containerRef, hasTooltip, tooltipValue]);
96
- useEffect(() => {
97
- if (tooltipVisible) {
98
- return registerTooltip(() => {
99
- setShowTooltip(false);
100
- setSupressTooltip(false);
101
- });
102
- }
103
- }, [tooltipVisible]);
104
95
  return (React.createElement("div", Object.assign({ ref: containerRef }, (hasTooltip && {
105
96
  onPointerEnter: () => handlePointerEnter(),
106
97
  onPointerLeave: () => handleBlur(true),
@@ -114,7 +105,10 @@ function TriggerButton({ ariaLabel, className, iconName, iconSvg, ariaExpanded,
114
105
  }, className), onClick: handleTriggerClick, ref: ref, type: "button", "data-testid": testId, "data-shift-focus": "awsui-layout-drawer-trigger" },
115
106
  React.createElement("span", { className: clsx(badge && clsx(styles['trigger-badge-wrapper'], styles['trigger-button-styles'])) }, (iconName || iconSvg) && React.createElement(Icon, { name: iconName, svg: iconSvg }))),
116
107
  badge && React.createElement("div", { className: styles.dot }),
117
- tooltipVisible && (React.createElement(Tooltip, { trackRef: containerRef, value: tooltipValue, className: testutilStyles['trigger-tooltip'], onDismiss: () => setShowTooltip(false) }))));
108
+ tooltipVisible && (React.createElement(Tooltip, { trackRef: containerRef, value: tooltipValue, className: testutilStyles['trigger-tooltip'], onDismiss: () => {
109
+ setShowTooltip(false);
110
+ setSupressTooltip(false);
111
+ } }))));
118
112
  }
119
113
  export default React.forwardRef(TriggerButton);
120
114
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAO,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtF,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,OAAO,IAAI,MAAM,2BAA2B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AAuB,CAAC,CAAC,CAAC,IACnG,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,oBAAC,IAAI,IAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,GAAI,CAC3D,CACA;QACR,KAAK,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,GAAG,GAAI;QACvC,cAAc,IAAI,CACjB,oBAAC,OAAO,IACN,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,cAAc,CAAC,iBAAiB,CAAC,EAC5C,SAAS,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,GACtC,CACH,CACG,CACP,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { ButtonProps } from '../../../../button/interfaces';\nimport { IconProps } from '../../../../icon/interfaces';\nimport Icon from '../../../../icon/internal';\nimport Tooltip from '../../../../internal/components/tooltip';\nimport { registerTooltip } from '../../../../internal/components/tooltip/registry';\n\nimport testutilStyles from '../../../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\nexport interface TriggerButtonProps {\n ariaLabel?: string;\n className?: string;\n iconName?: IconProps.Name;\n iconSvg?: React.ReactNode;\n ariaExpanded: boolean | undefined;\n ariaControls?: string;\n disabled?: boolean;\n /**\n * Ovewrwrites any internal testIds when provided\n */\n testId?: string;\n /**\n * If button is selected. Used only for desktop and applies a selected class\n */\n selected?: boolean;\n onClick: React.MouseEventHandler<HTMLButtonElement>;\n\n badge?: boolean;\n /**\n * If the button is expected to have a tooltip. When false it will not set the event listeners\n *\n * defaults to false\n */\n hasTooltip?: boolean;\n /**\n * This text allows for a customized tooltip.\n *\n * When falsy, the tooltip will parse the tooltip form the aria-lable\n */\n tooltipText?: string;\n hasOpenDrawer?: boolean;\n /**\n * If the AppLayout is in mobile mode\n * Used to determine if and where to render tooltips\n */\n isMobile?: boolean;\n /**\n * set to true if the trigger button was used to open the last active drawer\n * this is also used to hide the tooltip should the focus be set programmatically\n * on focus from a drawer close using this\n */\n isForPreviousActiveDrawer?: boolean;\n /**\n * if the trigger button is for the split panel\n */\n isForSplitPanel?: boolean;\n tabIndex?: number | undefined;\n}\n\nfunction TriggerButton(\n {\n ariaLabel,\n className,\n iconName,\n iconSvg,\n ariaExpanded,\n ariaControls,\n onClick,\n testId,\n disabled = false,\n badge,\n selected = false,\n hasTooltip = false,\n tooltipText,\n hasOpenDrawer = false,\n isMobile = false,\n isForPreviousActiveDrawer = false,\n isForSplitPanel = false,\n }: TriggerButtonProps,\n ref: React.Ref<ButtonProps.Ref>\n) {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const tooltipValue = tooltipText ? tooltipText : ariaLabel ? ariaLabel : '';\n const [showTooltip, setShowTooltip] = useState<boolean>(false);\n const [suppressTooltip, setSupressTooltip] = useState<boolean>(false);\n\n const handleTriggerClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation(); // Stop the event from propagating to the badge icon\n setShowTooltip(false);\n setSupressTooltip(true);\n onClick(event);\n };\n\n const handleBlur = (keepSupressed = false) => {\n setSupressTooltip(keepSupressed);\n setShowTooltip(false);\n };\n\n const handlePointerEnter = () => {\n setSupressTooltip(false);\n setShowTooltip(true);\n };\n\n /**\n * Takes the drawer being closed and the data-shift-focus value from a close button on that drawer that persists\n * on the event relatedTarget to determine not to show the tooltip\n * @param event\n */\n const handleOnFocus = useCallback(\n (event: FocusEvent) => {\n let shouldShowTooltip = false;\n const eventWithRelatedTarget = event as any;\n const relatedTarget = eventWithRelatedTarget?.relatedTarget;\n const isFromAnotherTrigger = relatedTarget?.dataset?.shiftFocus === 'awsui-layout-drawer-trigger';\n if (\n (isForSplitPanel && !!relatedTarget) || // relatedTarget is null when split panel is closed\n (!isForSplitPanel &&\n (isFromAnotherTrigger || // for key navigation from another trigger button\n !isForPreviousActiveDrawer)) // for when the drawer was not opened recently\n ) {\n shouldShowTooltip = true;\n }\n setSupressTooltip(!shouldShowTooltip);\n setShowTooltip(true);\n },\n [\n // To assert reference equality check\n isForPreviousActiveDrawer,\n isForSplitPanel,\n ]\n );\n\n const tooltipVisible = useMemo(() => {\n return (\n hasTooltip &&\n showTooltip &&\n !suppressTooltip &&\n !!containerRef?.current &&\n tooltipValue &&\n !(isMobile && hasOpenDrawer)\n );\n }, [hasTooltip, showTooltip, containerRef, tooltipValue, isMobile, hasOpenDrawer, suppressTooltip]);\n\n useEffect(() => {\n if (hasTooltip && tooltipValue) {\n const close = () => {\n setShowTooltip(false);\n setSupressTooltip(false);\n };\n\n const shouldCloseTooltip = (event: PointerEvent) => {\n if (event.target && containerRef && (containerRef.current as any)?.contains(event.target as HTMLElement)) {\n return false;\n }\n return true;\n };\n\n const handlePointerDownEvent = (event: PointerEvent) => {\n if (shouldCloseTooltip(event)) {\n close();\n }\n };\n\n const handleKeyDownEvent = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n close();\n }\n };\n\n const wrapperDiv = containerRef.current;\n if (wrapperDiv) {\n const controller = new AbortController();\n wrapperDiv.addEventListener('pointerdown', handlePointerDownEvent, { signal: controller.signal });\n wrapperDiv.addEventListener('keydown', handleKeyDownEvent, { signal: controller.signal });\n\n return () => {\n controller.abort();\n };\n }\n }\n }, [containerRef, hasTooltip, tooltipValue]);\n\n useEffect(() => {\n if (tooltipVisible) {\n return registerTooltip(() => {\n setShowTooltip(false);\n setSupressTooltip(false);\n });\n }\n }, [tooltipVisible]);\n\n return (\n <div\n ref={containerRef}\n {...(hasTooltip && {\n onPointerEnter: () => handlePointerEnter(),\n onPointerLeave: () => handleBlur(true),\n onFocus: e => handleOnFocus(e as any),\n onBlur: () => handleBlur(true),\n })}\n className={styles['trigger-wrapper']}\n >\n <button\n aria-expanded={ariaExpanded}\n aria-controls={ariaControls}\n aria-haspopup={true}\n aria-label={ariaLabel}\n aria-disabled={disabled}\n disabled={disabled}\n className={clsx(\n styles.trigger,\n styles['trigger-button-styles'],\n {\n [styles.selected]: selected,\n [styles.badge]: badge,\n [testutilStyles['drawers-trigger-with-badge']]: badge,\n },\n className\n )}\n onClick={handleTriggerClick}\n ref={ref as Ref<HTMLButtonElement>}\n type=\"button\"\n data-testid={testId}\n data-shift-focus=\"awsui-layout-drawer-trigger\"\n >\n <span className={clsx(badge && clsx(styles['trigger-badge-wrapper'], styles['trigger-button-styles']))}>\n {(iconName || iconSvg) && <Icon name={iconName} svg={iconSvg} />}\n </span>\n </button>\n {badge && <div className={styles.dot} />}\n {tooltipVisible && (\n <Tooltip\n trackRef={containerRef}\n value={tooltipValue}\n className={testutilStyles['trigger-tooltip']}\n onDismiss={() => setShowTooltip(false)}\n />\n )}\n </div>\n );\n}\n\nexport default React.forwardRef(TriggerButton);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAO,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtF,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,OAAO,IAAI,MAAM,2BAA2B,CAAC;AAC7C,OAAO,OAAO,MAAM,yCAAyC,CAAC;AAE9D,OAAO,cAAc,MAAM,qCAAqC,CAAC;AACjE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAoDrC,SAAS,aAAa,CACpB,EACE,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,MAAM,EACN,QAAQ,GAAG,KAAK,EAChB,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,UAAU,GAAG,KAAK,EACl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port React, { Ref, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { ButtonProps } from '../../../../button/interfaces';\nimport { IconProps } from '../../../../icon/interfaces';\nimport Icon from '../../../../icon/internal';\nimport Tooltip from '../../../../internal/components/tooltip';\n\nimport testutilStyles from '../../../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\nexport interface TriggerButtonProps {\n ariaLabel?: string;\n className?: string;\n iconName?: IconProps.Name;\n iconSvg?: React.ReactNode;\n ariaExpanded: boolean | undefined;\n ariaControls?: string;\n disabled?: boolean;\n /**\n * Ovewrwrites any internal testIds when provided\n */\n testId?: string;\n /**\n * If button is selected. Used only for desktop and applies a selected class\n */\n selected?: boolean;\n onClick: React.MouseEventHandler<HTMLButtonElement>;\n\n badge?: boolean;\n /**\n * If the button is expected to have a tooltip. When false it will not set the event listeners\n *\n * defaults to false\n */\n hasTooltip?: boolean;\n /**\n * This text allows for a customized tooltip.\n *\n * When falsy, the tooltip will parse the tooltip form the aria-lable\n */\n tooltipText?: string;\n hasOpenDrawer?: boolean;\n /**\n * If the AppLayout is in mobile mode\n * Used to determine if and where to render tooltips\n */\n isMobile?: boolean;\n /**\n * set to true if the trigger button was used to open the last active drawer\n * this is also used to hide the tooltip should the focus be set programmatically\n * on focus from a drawer close using this\n */\n isForPreviousActiveDrawer?: boolean;\n /**\n * if the trigger button is for the split panel\n */\n isForSplitPanel?: boolean;\n tabIndex?: number | undefined;\n}\n\nfunction TriggerButton(\n {\n ariaLabel,\n className,\n iconName,\n iconSvg,\n ariaExpanded,\n ariaControls,\n onClick,\n testId,\n disabled = false,\n badge,\n selected = false,\n hasTooltip = false,\n tooltipText,\n hasOpenDrawer = false,\n isMobile = false,\n isForPreviousActiveDrawer = false,\n isForSplitPanel = false,\n }: TriggerButtonProps,\n ref: React.Ref<ButtonProps.Ref>\n) {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const tooltipValue = tooltipText ? tooltipText : ariaLabel ? ariaLabel : '';\n const [showTooltip, setShowTooltip] = useState<boolean>(false);\n const [suppressTooltip, setSupressTooltip] = useState<boolean>(false);\n\n const handleTriggerClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation(); // Stop the event from propagating to the badge icon\n setShowTooltip(false);\n setSupressTooltip(true);\n onClick(event);\n };\n\n const handleBlur = (keepSupressed = false) => {\n setSupressTooltip(keepSupressed);\n setShowTooltip(false);\n };\n\n const handlePointerEnter = () => {\n setSupressTooltip(false);\n setShowTooltip(true);\n };\n\n /**\n * Takes the drawer being closed and the data-shift-focus value from a close button on that drawer that persists\n * on the event relatedTarget to determine not to show the tooltip\n * @param event\n */\n const handleOnFocus = useCallback(\n (event: FocusEvent) => {\n let shouldShowTooltip = false;\n const eventWithRelatedTarget = event as any;\n const relatedTarget = eventWithRelatedTarget?.relatedTarget;\n const isFromAnotherTrigger = relatedTarget?.dataset?.shiftFocus === 'awsui-layout-drawer-trigger';\n if (\n (isForSplitPanel && !!relatedTarget) || // relatedTarget is null when split panel is closed\n (!isForSplitPanel &&\n (isFromAnotherTrigger || // for key navigation from another trigger button\n !isForPreviousActiveDrawer)) // for when the drawer was not opened recently\n ) {\n shouldShowTooltip = true;\n }\n setSupressTooltip(!shouldShowTooltip);\n setShowTooltip(true);\n },\n [\n // To assert reference equality check\n isForPreviousActiveDrawer,\n isForSplitPanel,\n ]\n );\n\n const tooltipVisible = useMemo(() => {\n return (\n hasTooltip &&\n showTooltip &&\n !suppressTooltip &&\n !!containerRef?.current &&\n tooltipValue &&\n !(isMobile && hasOpenDrawer)\n );\n }, [hasTooltip, showTooltip, containerRef, tooltipValue, isMobile, hasOpenDrawer, suppressTooltip]);\n\n useEffect(() => {\n if (hasTooltip && tooltipValue) {\n const close = () => {\n setShowTooltip(false);\n setSupressTooltip(false);\n };\n\n const shouldCloseTooltip = (event: PointerEvent) => {\n if (event.target && containerRef && (containerRef.current as any)?.contains(event.target as HTMLElement)) {\n return false;\n }\n return true;\n };\n\n const handlePointerDownEvent = (event: PointerEvent) => {\n if (shouldCloseTooltip(event)) {\n close();\n }\n };\n\n const handleKeyDownEvent = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n close();\n }\n };\n\n const wrapperDiv = containerRef.current;\n if (wrapperDiv) {\n const controller = new AbortController();\n wrapperDiv.addEventListener('pointerdown', handlePointerDownEvent, { signal: controller.signal });\n wrapperDiv.addEventListener('keydown', handleKeyDownEvent, { signal: controller.signal });\n\n return () => {\n controller.abort();\n };\n }\n }\n }, [containerRef, hasTooltip, tooltipValue]);\n\n return (\n <div\n ref={containerRef}\n {...(hasTooltip && {\n onPointerEnter: () => handlePointerEnter(),\n onPointerLeave: () => handleBlur(true),\n onFocus: e => handleOnFocus(e as any),\n onBlur: () => handleBlur(true),\n })}\n className={styles['trigger-wrapper']}\n >\n <button\n aria-expanded={ariaExpanded}\n aria-controls={ariaControls}\n aria-haspopup={true}\n aria-label={ariaLabel}\n aria-disabled={disabled}\n disabled={disabled}\n className={clsx(\n styles.trigger,\n styles['trigger-button-styles'],\n {\n [styles.selected]: selected,\n [styles.badge]: badge,\n [testutilStyles['drawers-trigger-with-badge']]: badge,\n },\n className\n )}\n onClick={handleTriggerClick}\n ref={ref as Ref<HTMLButtonElement>}\n type=\"button\"\n data-testid={testId}\n data-shift-focus=\"awsui-layout-drawer-trigger\"\n >\n <span className={clsx(badge && clsx(styles['trigger-badge-wrapper'], styles['trigger-button-styles']))}>\n {(iconName || iconSvg) && <Icon name={iconName} svg={iconSvg} />}\n </span>\n </button>\n {badge && <div className={styles.dot} />}\n {tooltipVisible && (\n <Tooltip\n trackRef={containerRef}\n value={tooltipValue}\n className={testutilStyles['trigger-tooltip']}\n onDismiss={() => {\n setShowTooltip(false);\n setSupressTooltip(false);\n }}\n />\n )}\n </div>\n );\n}\n\nexport default React.forwardRef(TriggerButton);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../../src/breadcrumb-group/item/item.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AA4E1E,wBAAgB,cAAc,CAAC,CAAC,SAAS,oBAAoB,CAAC,IAAI,EAAE,EAClE,IAAI,EACJ,SAAS,EACT,UAAU,EACV,OAAO,EACP,QAAQ,EACR,OAAe,EACf,WAAmB,GACpB,EAAE,mBAAmB,CAAC,CAAC,CAAC,eA6DxB"}
1
+ {"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../../src/breadcrumb-group/item/item.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAiE1E,wBAAgB,cAAc,CAAC,CAAC,SAAS,oBAAoB,CAAC,IAAI,EAAE,EAClE,IAAI,EACJ,SAAS,EACT,UAAU,EACV,OAAO,EACP,QAAQ,EACR,OAAe,EACf,WAAmB,GACpB,EAAE,mBAAmB,CAAC,CAAC,CAAC,eA6DxB"}
@@ -1,33 +1,24 @@
1
1
  import { __rest } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- import React, { useEffect, useRef, useState } from 'react';
4
+ import React, { useRef, useState } from 'react';
5
5
  import clsx from 'clsx';
6
6
  import InternalIcon from '../../icon/internal';
7
7
  import Tooltip from '../../internal/components/tooltip';
8
- import { registerTooltip } from '../../internal/components/tooltip/registry';
9
8
  import { fireCancelableEvent, isPlainLeftClick } from '../../internal/events';
10
9
  import { getEventDetail } from '../utils';
11
10
  import { FunnelBreadcrumbItem } from './funnel';
12
11
  import styles from './styles.css.js';
13
12
  const BreadcrumbItemWithPopover = ({ item, isLast, anchorAttributes, itemAttributes, children, }) => {
14
- const [showPopover, setShowPopover] = useState(false);
13
+ const [showTooltip, setShowTooltip] = useState(false);
15
14
  const textRef = useRef(null);
16
- const popoverContent = (React.createElement(Tooltip, { trackRef: textRef, value: item.text, size: "medium", onDismiss: () => setShowPopover(false) }));
17
- useEffect(() => {
18
- if (showPopover) {
19
- return registerTooltip(() => {
20
- setShowPopover(false);
21
- });
22
- }
23
- }, [showPopover]);
24
- return (React.createElement(React.Fragment, null,
25
- React.createElement(Item, Object.assign({ ref: textRef, isLast: isLast, onFocus: () => {
26
- setShowPopover(true);
27
- }, onBlur: () => setShowPopover(false), onMouseEnter: () => {
28
- setShowPopover(true);
29
- }, onMouseLeave: () => setShowPopover(false), anchorAttributes: anchorAttributes }, itemAttributes), children),
30
- showPopover && popoverContent));
15
+ return (React.createElement(Item, Object.assign({ ref: textRef, isLast: isLast, onFocus: () => {
16
+ setShowTooltip(true);
17
+ }, onBlur: () => setShowTooltip(false), onMouseEnter: () => {
18
+ setShowTooltip(true);
19
+ }, onMouseLeave: () => setShowTooltip(false), anchorAttributes: anchorAttributes }, itemAttributes),
20
+ children,
21
+ showTooltip && (React.createElement(Tooltip, { trackRef: textRef, value: item.text, size: "medium", onDismiss: () => setShowTooltip(false) }))));
31
22
  };
32
23
  const Item = React.forwardRef((_a, ref) => {
33
24
  var { anchorAttributes, children, isLast } = _a, itemAttributes = __rest(_a, ["anchorAttributes", "children", "isLast"]);
@@ -1 +1 @@
1
- {"version":3,"file":"item.js","sourceRoot":"","sources":["../../../../src/breadcrumb-group/item/item.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,OAAO,MAAM,mCAAmC,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAA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sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport InternalIcon from '../../icon/internal';\nimport Tooltip from '../../internal/components/tooltip';\nimport { registerTooltip } from '../../internal/components/tooltip/registry';\nimport { fireCancelableEvent, isPlainLeftClick } from '../../internal/events';\nimport { BreadcrumbGroupProps, BreadcrumbItemProps } from '../interfaces';\nimport { getEventDetail } from '../utils';\nimport { FunnelBreadcrumbItem } from './funnel';\n\nimport styles from './styles.css.js';\n\ninterface BreadcrumbItemWithPopoverProps<T extends BreadcrumbGroupProps.Item> {\n item: T;\n isLast: boolean;\n anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement>;\n children: React.ReactNode;\n itemAttributes: React.HTMLAttributes<HTMLElement>;\n}\n\nconst BreadcrumbItemWithPopover = <T extends BreadcrumbGroupProps.Item>({\n item,\n isLast,\n anchorAttributes,\n itemAttributes,\n children,\n}: BreadcrumbItemWithPopoverProps<T>) => {\n const [showPopover, setShowPopover] = useState(false);\n const textRef = useRef<HTMLElement>(null);\n const popoverContent = (\n <Tooltip trackRef={textRef} value={item.text} size=\"medium\" onDismiss={() => setShowPopover(false)} />\n );\n\n useEffect(() => {\n if (showPopover) {\n return registerTooltip(() => {\n setShowPopover(false);\n });\n }\n }, [showPopover]);\n\n return (\n <>\n <Item\n ref={textRef}\n isLast={isLast}\n onFocus={() => {\n setShowPopover(true);\n }}\n onBlur={() => setShowPopover(false)}\n onMouseEnter={() => {\n setShowPopover(true);\n }}\n onMouseLeave={() => setShowPopover(false)}\n anchorAttributes={anchorAttributes}\n {...itemAttributes}\n >\n {children}\n </Item>\n {showPopover && popoverContent}\n </>\n );\n};\n\ntype ItemProps = React.HTMLAttributes<HTMLElement> & {\n anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement>;\n isLast: boolean;\n};\nconst Item = React.forwardRef<HTMLElement, ItemProps>(\n ({ anchorAttributes, children, isLast, ...itemAttributes }, ref) => {\n return isLast ? (\n <span ref={ref} className={styles.anchor} {...itemAttributes}>\n {children}\n </span>\n ) : (\n <a ref={ref as React.Ref<HTMLAnchorElement>} className={styles.anchor} {...itemAttributes} {...anchorAttributes}>\n {children}\n </a>\n );\n }\n);\n\nexport function BreadcrumbItem<T extends BreadcrumbGroupProps.Item>({\n item,\n itemIndex,\n totalCount,\n onClick,\n onFollow,\n isGhost = false,\n isTruncated = false,\n}: BreadcrumbItemProps<T>) {\n const isLast = itemIndex === totalCount - 1;\n const preventDefault = (event: React.MouseEvent) => event.preventDefault();\n const onClickHandler = (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireCancelableEvent(onFollow, getEventDetail(item), event);\n }\n fireCancelableEvent(onClick, getEventDetail(item), event);\n };\n\n const anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement> = {\n href: item.href || '#',\n onClick: isLast ? preventDefault : onClickHandler,\n tabIndex: 0,\n };\n\n const itemAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement> = {};\n if (isGhost) {\n anchorAttributes.tabIndex = -1;\n }\n\n if (isLast && !isGhost) {\n itemAttributes['aria-current'] = 'page';\n itemAttributes['aria-disabled'] = true;\n itemAttributes.tabIndex = 0;\n itemAttributes.role = 'link';\n }\n\n const breadcrumbItem = (\n <FunnelBreadcrumbItem\n className={styles.text}\n itemIndex={itemIndex}\n totalCount={totalCount}\n text={item.text}\n disableAnalytics={isGhost}\n />\n );\n\n return (\n <div className={clsx(!isGhost && styles.breadcrumb, isGhost && styles['ghost-breadcrumb'], isLast && styles.last)}>\n {isTruncated && !isGhost ? (\n <BreadcrumbItemWithPopover\n item={item}\n isLast={isLast}\n anchorAttributes={anchorAttributes}\n itemAttributes={itemAttributes}\n >\n {breadcrumbItem}\n </BreadcrumbItemWithPopover>\n ) : (\n <Item isLast={isLast} anchorAttributes={anchorAttributes} {...itemAttributes}>\n {breadcrumbItem}\n </Item>\n )}\n {!isLast ? (\n <span className={styles.icon}>\n <InternalIcon name=\"angle-right\" />\n </span>\n ) : null}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"item.js","sourceRoot":"","sources":["../../../../src/breadcrumb-group/item/item.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,OAAO,MAAM,mCAAmC,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAUrC,MAAM,yBAAyB,GAAG,CAAsC,EACtE,IAAI,EACJ,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,QAAQ,GAC0B,EAAE,EAAE;IACtC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAC;IAEjD,OAAO,CACL,oBAAC,IAAI,kBACH,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;YACZ,cAAc,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC,EACD,MAAM,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,EACnC,YAAY,EAAE,GAAG,EAAE;YACjB,cAAc,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC,EACD,YAAY,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,EACzC,gBAAgB,EAAE,gBAAgB,IAC9B,cA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AAE,gBAAgB,EAAE,gBAAgB,IAAM,cAAc,GACzE,cAAc,CACV,CACR;QACA,CAAC,MAAM,CAAC,CAAC,CAAC,CACT,8BAAM,SAAS,EAAE,MAAM,CAAC,IAAI;YAC1B,oBAAC,YAAY,IAAC,IAAI,EAAC,aAAa,GAAG,CAC9B,CACR,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport InternalIcon from '../../icon/internal';\nimport Tooltip from '../../internal/components/tooltip';\nimport { fireCancelableEvent, isPlainLeftClick } from '../../internal/events';\nimport { BreadcrumbGroupProps, BreadcrumbItemProps } from '../interfaces';\nimport { getEventDetail } from '../utils';\nimport { FunnelBreadcrumbItem } from './funnel';\n\nimport styles from './styles.css.js';\n\ninterface BreadcrumbItemWithPopoverProps<T extends BreadcrumbGroupProps.Item> {\n item: T;\n isLast: boolean;\n anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement>;\n children: React.ReactNode;\n itemAttributes: React.HTMLAttributes<HTMLElement>;\n}\n\nconst BreadcrumbItemWithPopover = <T extends BreadcrumbGroupProps.Item>({\n item,\n isLast,\n anchorAttributes,\n itemAttributes,\n children,\n}: BreadcrumbItemWithPopoverProps<T>) => {\n const [showTooltip, setShowTooltip] = useState(false);\n const textRef = useRef<HTMLElement | null>(null);\n\n return (\n <Item\n ref={textRef}\n isLast={isLast}\n onFocus={() => {\n setShowTooltip(true);\n }}\n onBlur={() => setShowTooltip(false)}\n onMouseEnter={() => {\n setShowTooltip(true);\n }}\n onMouseLeave={() => setShowTooltip(false)}\n anchorAttributes={anchorAttributes}\n {...itemAttributes}\n >\n {children}\n {showTooltip && (\n <Tooltip trackRef={textRef} value={item.text} size=\"medium\" onDismiss={() => setShowTooltip(false)} />\n )}\n </Item>\n );\n};\n\ntype ItemProps = React.HTMLAttributes<HTMLElement> & {\n anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement>;\n isLast: boolean;\n};\nconst Item = React.forwardRef<HTMLElement, ItemProps>(\n ({ anchorAttributes, children, isLast, ...itemAttributes }, ref) => {\n return isLast ? (\n <span ref={ref} className={styles.anchor} {...itemAttributes}>\n {children}\n </span>\n ) : (\n <a ref={ref as React.Ref<HTMLAnchorElement>} className={styles.anchor} {...itemAttributes} {...anchorAttributes}>\n {children}\n </a>\n );\n }\n);\n\nexport function BreadcrumbItem<T extends BreadcrumbGroupProps.Item>({\n item,\n itemIndex,\n totalCount,\n onClick,\n onFollow,\n isGhost = false,\n isTruncated = false,\n}: BreadcrumbItemProps<T>) {\n const isLast = itemIndex === totalCount - 1;\n const preventDefault = (event: React.MouseEvent) => event.preventDefault();\n const onClickHandler = (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireCancelableEvent(onFollow, getEventDetail(item), event);\n }\n fireCancelableEvent(onClick, getEventDetail(item), event);\n };\n\n const anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement> = {\n href: item.href || '#',\n onClick: isLast ? preventDefault : onClickHandler,\n tabIndex: 0,\n };\n\n const itemAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement> = {};\n if (isGhost) {\n anchorAttributes.tabIndex = -1;\n }\n\n if (isLast && !isGhost) {\n itemAttributes['aria-current'] = 'page';\n itemAttributes['aria-disabled'] = true;\n itemAttributes.tabIndex = 0;\n itemAttributes.role = 'link';\n }\n\n const breadcrumbItem = (\n <FunnelBreadcrumbItem\n className={styles.text}\n itemIndex={itemIndex}\n totalCount={totalCount}\n text={item.text}\n disableAnalytics={isGhost}\n />\n );\n\n return (\n <div className={clsx(!isGhost && styles.breadcrumb, isGhost && styles['ghost-breadcrumb'], isLast && styles.last)}>\n {isTruncated && !isGhost ? (\n <BreadcrumbItemWithPopover\n item={item}\n isLast={isLast}\n anchorAttributes={anchorAttributes}\n itemAttributes={itemAttributes}\n >\n {breadcrumbItem}\n </BreadcrumbItemWithPopover>\n ) : (\n <Item isLast={isLast} anchorAttributes={anchorAttributes} {...itemAttributes}>\n {breadcrumbItem}\n </Item>\n )}\n {!isLast ? (\n <span className={styles.icon}>\n <InternalIcon name=\"angle-right\" />\n </span>\n ) : null}\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAU3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAEtC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,GAClB,EAAE,cAAc,eAoFhB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAU3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAEtC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,GAClB,EAAE,cAAc,eAsFhB"}
@@ -20,10 +20,12 @@ export function ResizableBox({ children, height, minHeight, onResize, handleAria
20
20
  switch (event.key) {
21
21
  case 'ArrowDown':
22
22
  case 'ArrowRight':
23
+ event.preventDefault(); // Prevent page scroll
23
24
  onResizeStable(height + KEYBOARD_STEP_SIZE);
24
25
  break;
25
26
  case 'ArrowUp':
26
27
  case 'ArrowLeft':
28
+ event.preventDefault(); // Prevent page scroll
27
29
  onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));
28
30
  break;
29
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,kBAAkB,MAAM,uCAAuC,CAAC;AAEvE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAY9B,MAAM,UAAU,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,GACF;IACf,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAClE,MAAM,cAAc,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAElD,MAAM,aAAa,GAA8B,KAAK,CAAC,EAAE;QACvD,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,OAAO,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YAClF,OAAO;SACR;QACD,MAAM,e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AAE;wBACjB,KAAK,WAAW;4BACd,cAAc,CAAC,MAAM,GAAG,kBAAkB,CAAC,CAAC;4BAC5C,MAAM;wBACR,KAAK,aAAa;4BAChB,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,kBAAkB,EAAE,SAAS,CAAC,CAAC,CAAC;4BACjE,MAAM;qBACT;gBACH,CAAC,GACD,CACE,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, useState } from 'react';\n\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalDragHandle from '../../internal/components/drag-handle';\n\nimport styles from './styles.css.js';\n\nconst KEYBOARD_STEP_SIZE = 20;\n\nexport interface ResizeBoxProps {\n children: React.ReactNode;\n height: number;\n minHeight: number;\n onResize: (newHeight: number) => void;\n\n handleAriaLabel?: string;\n handleTooltipText?: string;\n}\n\nexport function ResizableBox({\n children,\n height,\n minHeight,\n onResize,\n handleAriaLabel,\n handleTooltipText,\n}: ResizeBoxProps) {\n const [dragOffset, setDragOffset] = useState<null | number>(null);\n const onResizeStable = useStableCallback(onResize);\n const containerRef = useRef<HTMLDivElement>(null);\n\n const onPointerDown: React.PointerEventHandler = event => {\n if ((event.pointerType === 'mouse' && event.button !== 0) || !containerRef.current) {\n return;\n }\n const containerBottom = containerRef.current.getBoundingClientRect().bottom;\n setDragOffset(containerBottom - event.clientY);\n };\n\n const onKeyDown: React.KeyboardEventHandler = event => {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowRight':\n onResizeStable(height + KEYBOARD_STEP_SIZE);\n break;\n case 'ArrowUp':\n case 'ArrowLeft':\n onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));\n break;\n }\n };\n\n useEffect(() => {\n if (dragOffset === null || !containerRef.current) {\n return;\n }\n const container = containerRef.current;\n\n const onPointerMove = (event: PointerEvent) => {\n const { top } = container.getBoundingClientRect();\n const cursor = event.clientY;\n onResizeStable(Math.max(cursor + dragOffset - top, minHeight));\n };\n const onPointerUp = () => {\n setDragOffset(null);\n };\n const controller = new AbortController();\n document.body.classList.add(styles['resize-active']);\n container.classList.add(styles['cursor-active']);\n document.addEventListener('pointermove', onPointerMove, { signal: controller.signal });\n document.addEventListener('pointerup', onPointerUp, { signal: controller.signal });\n return () => {\n controller.abort();\n document.body.classList.remove(styles['resize-active']);\n container.classList.remove(styles['cursor-active']);\n };\n }, [dragOffset, minHeight, onResizeStable]);\n\n return (\n <div ref={containerRef} className={styles['resizable-box']} style={{ height }}>\n {children}\n\n <div className={styles['resizable-box-handle']}>\n <InternalDragHandle\n ariaLabel={handleAriaLabel}\n variant=\"resize-area\"\n // Provide an arbitrary large value to valueMax since the editor can be\n // resized to be infinitely large.\n ariaValue={{ valueMin: minHeight, valueMax: 1000000, valueNow: height }}\n tooltipText={handleTooltipText}\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n directions={{\n 'block-start': height > minHeight ? 'active' : 'disabled',\n 'block-end': 'active',\n }}\n onDirectionClick={direction => {\n switch (direction) {\n case 'block-end':\n onResizeStable(height + KEYBOARD_STEP_SIZE);\n break;\n case 'block-start':\n onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));\n break;\n }\n }}\n />\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/code-editor/resizable-box/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,kBAAkB,MAAM,uCAAuC,CAAC;AAEvE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAY9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M,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE;QAC1E,QAAQ;QAET,6BAAK,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC;YAC5C,oBAAC,kBAAkB,IACjB,SAAS,EAAE,eAAe,EAC1B,OAAO,EAAC,aAAa;gBACrB,uEAAuE;gBACvE,kCAAkC;gBAClC,SAAS,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EACvE,WAAW,EAAE,iBAAiB,EAC9B,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE;oBACV,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU;oBACzD,WAAW,EAAE,QAAQ;iBACtB,EACD,gBAAgB,EAAE,SAAS,CAAC,EAAE;oBAC5B,QAAQ,SAAS,EAAE;wBACjB,KAAK,WAAW;4BACd,cAAc,CAAC,MAAM,GAAG,kBAAkB,CAAC,CAAC;4BAC5C,MAAM;wBACR,KAAK,aAAa;4BAChB,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,kBAAkB,EAAE,SAAS,CAAC,CAAC,CAAC;4BACjE,MAAM;qBACT;gBACH,CAAC,GACD,CACE,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, useState } from 'react';\n\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalDragHandle from '../../internal/components/drag-handle';\n\nimport styles from './styles.css.js';\n\nconst KEYBOARD_STEP_SIZE = 20;\n\nexport interface ResizeBoxProps {\n children: React.ReactNode;\n height: number;\n minHeight: number;\n onResize: (newHeight: number) => void;\n\n handleAriaLabel?: string;\n handleTooltipText?: string;\n}\n\nexport function ResizableBox({\n children,\n height,\n minHeight,\n onResize,\n handleAriaLabel,\n handleTooltipText,\n}: ResizeBoxProps) {\n const [dragOffset, setDragOffset] = useState<null | number>(null);\n const onResizeStable = useStableCallback(onResize);\n const containerRef = useRef<HTMLDivElement>(null);\n\n const onPointerDown: React.PointerEventHandler = event => {\n if ((event.pointerType === 'mouse' && event.button !== 0) || !containerRef.current) {\n return;\n }\n const containerBottom = containerRef.current.getBoundingClientRect().bottom;\n setDragOffset(containerBottom - event.clientY);\n };\n\n const onKeyDown: React.KeyboardEventHandler = event => {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowRight':\n event.preventDefault(); // Prevent page scroll\n onResizeStable(height + KEYBOARD_STEP_SIZE);\n break;\n case 'ArrowUp':\n case 'ArrowLeft':\n event.preventDefault(); // Prevent page scroll\n onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));\n break;\n }\n };\n\n useEffect(() => {\n if (dragOffset === null || !containerRef.current) {\n return;\n }\n const container = containerRef.current;\n\n const onPointerMove = (event: PointerEvent) => {\n const { top } = container.getBoundingClientRect();\n const cursor = event.clientY;\n onResizeStable(Math.max(cursor + dragOffset - top, minHeight));\n };\n const onPointerUp = () => {\n setDragOffset(null);\n };\n const controller = new AbortController();\n document.body.classList.add(styles['resize-active']);\n container.classList.add(styles['cursor-active']);\n document.addEventListener('pointermove', onPointerMove, { signal: controller.signal });\n document.addEventListener('pointerup', onPointerUp, { signal: controller.signal });\n return () => {\n controller.abort();\n document.body.classList.remove(styles['resize-active']);\n container.classList.remove(styles['cursor-active']);\n };\n }, [dragOffset, minHeight, onResizeStable]);\n\n return (\n <div ref={containerRef} className={styles['resizable-box']} style={{ height }}>\n {children}\n\n <div className={styles['resizable-box-handle']}>\n <InternalDragHandle\n ariaLabel={handleAriaLabel}\n variant=\"resize-area\"\n // Provide an arbitrary large value to valueMax since the editor can be\n // resized to be infinitely large.\n ariaValue={{ valueMin: minHeight, valueMax: 1000000, valueNow: height }}\n tooltipText={handleTooltipText}\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n directions={{\n 'block-start': height > minHeight ? 'active' : 'disabled',\n 'block-end': 'active',\n }}\n onDirectionClick={direction => {\n switch (direction) {\n case 'block-end':\n onResizeStable(height + KEYBOARD_STEP_SIZE);\n break;\n case 'block-start':\n onResizeStable(Math.max(height - KEYBOARD_STEP_SIZE, minHeight));\n break;\n }\n }}\n />\n </div>\n </div>\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (0e10faf3)";
2
+ export var PACKAGE_VERSION = "3.0.0 (e6c589ba)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (0e10faf3)",
3
+ "PACKAGE_VERSION": "3.0.0 (e6c589ba)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,59 +1,59 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "arrow": "awsui_arrow_xjuzf_d2ijc_289",
5
- "arrow-outer": "awsui_arrow-outer_xjuzf_d2ijc_293",
6
- "arrow-inner": "awsui_arrow-inner_xjuzf_d2ijc_293",
7
- "arrow-position-right-top": "awsui_arrow-position-right-top_xjuzf_d2ijc_335",
8
- "arrow-position-right-bottom": "awsui_arrow-position-right-bottom_xjuzf_d2ijc_335",
9
- "arrow-position-left-top": "awsui_arrow-position-left-top_xjuzf_d2ijc_338",
10
- "arrow-position-left-bottom": "awsui_arrow-position-left-bottom_xjuzf_d2ijc_338",
11
- "arrow-position-top-center": "awsui_arrow-position-top-center_xjuzf_d2ijc_341",
12
- "arrow-position-top-right": "awsui_arrow-position-top-right_xjuzf_d2ijc_341",
13
- "arrow-position-top-left": "awsui_arrow-position-top-left_xjuzf_d2ijc_341",
14
- "arrow-position-top-responsive": "awsui_arrow-position-top-responsive_xjuzf_d2ijc_341",
15
- "arrow-position-bottom-center": "awsui_arrow-position-bottom-center_xjuzf_d2ijc_344",
16
- "arrow-position-bottom-right": "awsui_arrow-position-bottom-right_xjuzf_d2ijc_344",
17
- "arrow-position-bottom-left": "awsui_arrow-position-bottom-left_xjuzf_d2ijc_344",
18
- "arrow-position-bottom-responsive": "awsui_arrow-position-bottom-responsive_xjuzf_d2ijc_344",
19
- "body": "awsui_body_xjuzf_d2ijc_492",
20
- "body-overflow-visible": "awsui_body-overflow-visible_xjuzf_d2ijc_528",
21
- "has-dismiss": "awsui_has-dismiss_xjuzf_d2ijc_532",
22
- "dismiss": "awsui_dismiss_xjuzf_d2ijc_537",
23
- "dismiss-control": "awsui_dismiss-control_xjuzf_d2ijc_545",
24
- "header-row": "awsui_header-row_xjuzf_d2ijc_549",
25
- "header": "awsui_header_xjuzf_d2ijc_549",
26
- "content": "awsui_content_xjuzf_d2ijc_574",
27
- "content-overflow-visible": "awsui_content-overflow-visible_xjuzf_d2ijc_582",
28
- "container": "awsui_container_xjuzf_d2ijc_730",
29
- "container-body": "awsui_container-body_xjuzf_d2ijc_738",
30
- "container-body-variant-annotation": "awsui_container-body-variant-annotation_xjuzf_d2ijc_778",
31
- "container-body-size-small": "awsui_container-body-size-small_xjuzf_d2ijc_783",
32
- "fixed-width": "awsui_fixed-width_xjuzf_d2ijc_786",
33
- "container-body-size-medium": "awsui_container-body-size-medium_xjuzf_d2ijc_790",
34
- "container-body-size-large": "awsui_container-body-size-large_xjuzf_d2ijc_797",
35
- "container-arrow": "awsui_container-arrow_xjuzf_d2ijc_809",
36
- "container-arrow-position-right-top": "awsui_container-arrow-position-right-top_xjuzf_d2ijc_813",
37
- "container-arrow-position-right-bottom": "awsui_container-arrow-position-right-bottom_xjuzf_d2ijc_813",
38
- "container-arrow-position-left-top": "awsui_container-arrow-position-left-top_xjuzf_d2ijc_830",
39
- "container-arrow-position-left-bottom": "awsui_container-arrow-position-left-bottom_xjuzf_d2ijc_830",
40
- "container-arrow-position-top-center": "awsui_container-arrow-position-top-center_xjuzf_d2ijc_847",
41
- "container-arrow-position-top-right": "awsui_container-arrow-position-top-right_xjuzf_d2ijc_847",
42
- "container-arrow-position-top-left": "awsui_container-arrow-position-top-left_xjuzf_d2ijc_847",
43
- "container-arrow-position-top-responsive": "awsui_container-arrow-position-top-responsive_xjuzf_d2ijc_847",
44
- "container-arrow-position-bottom-center": "awsui_container-arrow-position-bottom-center_xjuzf_d2ijc_863",
45
- "container-arrow-position-bottom-right": "awsui_container-arrow-position-bottom-right_xjuzf_d2ijc_867",
46
- "container-arrow-position-bottom-left": "awsui_container-arrow-position-bottom-left_xjuzf_d2ijc_871",
47
- "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_xjuzf_d2ijc_1",
48
- "refresh": "awsui_refresh_xjuzf_d2ijc_1041",
49
- "root": "awsui_root_xjuzf_d2ijc_1063",
50
- "no-wrap": "awsui_no-wrap_xjuzf_d2ijc_1095",
51
- "root-filtering-token": "awsui_root-filtering-token_xjuzf_d2ijc_1099",
52
- "trigger": "awsui_trigger_xjuzf_d2ijc_1103",
53
- "overflow-ellipsis": "awsui_overflow-ellipsis_xjuzf_d2ijc_1110",
54
- "trigger-type-text-inline": "awsui_trigger-type-text-inline_xjuzf_d2ijc_1118",
55
- "trigger-type-text": "awsui_trigger-type-text_xjuzf_d2ijc_1118",
56
- "trigger-type-filtering-token": "awsui_trigger-type-filtering-token_xjuzf_d2ijc_1186",
57
- "popover-inline-content": "awsui_popover-inline-content_xjuzf_d2ijc_1190"
4
+ "arrow": "awsui_arrow_xjuzf_1q42r_289",
5
+ "arrow-outer": "awsui_arrow-outer_xjuzf_1q42r_293",
6
+ "arrow-inner": "awsui_arrow-inner_xjuzf_1q42r_293",
7
+ "arrow-position-right-top": "awsui_arrow-position-right-top_xjuzf_1q42r_335",
8
+ "arrow-position-right-bottom": "awsui_arrow-position-right-bottom_xjuzf_1q42r_335",
9
+ "arrow-position-left-top": "awsui_arrow-position-left-top_xjuzf_1q42r_338",
10
+ "arrow-position-left-bottom": "awsui_arrow-position-left-bottom_xjuzf_1q42r_338",
11
+ "arrow-position-top-center": "awsui_arrow-position-top-center_xjuzf_1q42r_341",
12
+ "arrow-position-top-right": "awsui_arrow-position-top-right_xjuzf_1q42r_341",
13
+ "arrow-position-top-left": "awsui_arrow-position-top-left_xjuzf_1q42r_341",
14
+ "arrow-position-top-responsive": "awsui_arrow-position-top-responsive_xjuzf_1q42r_341",
15
+ "arrow-position-bottom-center": "awsui_arrow-position-bottom-center_xjuzf_1q42r_344",
16
+ "arrow-position-bottom-right": "awsui_arrow-position-bottom-right_xjuzf_1q42r_344",
17
+ "arrow-position-bottom-left": "awsui_arrow-position-bottom-left_xjuzf_1q42r_344",
18
+ "arrow-position-bottom-responsive": "awsui_arrow-position-bottom-responsive_xjuzf_1q42r_344",
19
+ "body": "awsui_body_xjuzf_1q42r_492",
20
+ "body-overflow-visible": "awsui_body-overflow-visible_xjuzf_1q42r_528",
21
+ "has-dismiss": "awsui_has-dismiss_xjuzf_1q42r_532",
22
+ "dismiss": "awsui_dismiss_xjuzf_1q42r_537",
23
+ "dismiss-control": "awsui_dismiss-control_xjuzf_1q42r_545",
24
+ "header-row": "awsui_header-row_xjuzf_1q42r_549",
25
+ "header": "awsui_header_xjuzf_1q42r_549",
26
+ "content": "awsui_content_xjuzf_1q42r_574",
27
+ "content-overflow-visible": "awsui_content-overflow-visible_xjuzf_1q42r_582",
28
+ "container": "awsui_container_xjuzf_1q42r_730",
29
+ "container-arrow-position-bottom-left": "awsui_container-arrow-position-bottom-left_xjuzf_1q42r_741",
30
+ "container-arrow-position-bottom-center": "awsui_container-arrow-position-bottom-center_xjuzf_1q42r_741",
31
+ "container-arrow-position-bottom-right": "awsui_container-arrow-position-bottom-right_xjuzf_1q42r_741",
32
+ "container-arrow-position-top-left": "awsui_container-arrow-position-top-left_xjuzf_1q42r_746",
33
+ "container-arrow-position-top-center": "awsui_container-arrow-position-top-center_xjuzf_1q42r_746",
34
+ "container-arrow-position-top-right": "awsui_container-arrow-position-top-right_xjuzf_1q42r_746",
35
+ "container-arrow-position-right-top": "awsui_container-arrow-position-right-top_xjuzf_1q42r_751",
36
+ "container-arrow-position-right-bottom": "awsui_container-arrow-position-right-bottom_xjuzf_1q42r_751",
37
+ "container-arrow-position-left-top": "awsui_container-arrow-position-left-top_xjuzf_1q42r_756",
38
+ "container-arrow-position-left-bottom": "awsui_container-arrow-position-left-bottom_xjuzf_1q42r_756",
39
+ "container-body": "awsui_container-body_xjuzf_1q42r_762",
40
+ "container-body-variant-annotation": "awsui_container-body-variant-annotation_xjuzf_1q42r_802",
41
+ "container-body-size-small": "awsui_container-body-size-small_xjuzf_1q42r_807",
42
+ "fixed-width": "awsui_fixed-width_xjuzf_1q42r_810",
43
+ "container-body-size-medium": "awsui_container-body-size-medium_xjuzf_1q42r_814",
44
+ "container-body-size-large": "awsui_container-body-size-large_xjuzf_1q42r_821",
45
+ "container-arrow": "awsui_container-arrow_xjuzf_1q42r_741",
46
+ "container-arrow-position-top-responsive": "awsui_container-arrow-position-top-responsive_xjuzf_1q42r_871",
47
+ "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_xjuzf_1q42r_1",
48
+ "refresh": "awsui_refresh_xjuzf_1q42r_1065",
49
+ "root": "awsui_root_xjuzf_1q42r_1087",
50
+ "no-wrap": "awsui_no-wrap_xjuzf_1q42r_1119",
51
+ "root-filtering-token": "awsui_root-filtering-token_xjuzf_1q42r_1123",
52
+ "trigger": "awsui_trigger_xjuzf_1q42r_1127",
53
+ "overflow-ellipsis": "awsui_overflow-ellipsis_xjuzf_1q42r_1134",
54
+ "trigger-type-text-inline": "awsui_trigger-type-text-inline_xjuzf_1q42r_1142",
55
+ "trigger-type-text": "awsui_trigger-type-text_xjuzf_1q42r_1142",
56
+ "trigger-type-filtering-token": "awsui_trigger-type-filtering-token_xjuzf_1q42r_1210",
57
+ "popover-inline-content": "awsui_popover-inline-content_xjuzf_1q42r_1214"
58
58
  };
59
59