@cloudscape-design/components 3.0.875 → 3.0.877

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (76a85a0a)";
2
+ export var PACKAGE_VERSION = "3.0.0 (c357e206)";
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 (76a85a0a)",
3
+ "PACKAGE_VERSION": "3.0.0 (c357e206)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "76a85a0a9bab7d01dd78abc1ce8fd64a4af5f2d8"
2
+ "commit": "c357e206802e520ac990260852b182fcd2b36ad9"
3
3
  }
package/package.json CHANGED
@@ -132,7 +132,7 @@
132
132
  "./internal/base-component/index.js",
133
133
  "./internal/base-component/styles.css.js"
134
134
  ],
135
- "version": "3.0.875",
135
+ "version": "3.0.877",
136
136
  "repository": {
137
137
  "type": "git",
138
138
  "url": "https://github.com/cloudscape-design/components.git"
@@ -18,7 +18,8 @@ export interface PopoverProps extends BaseComponentProps {
18
18
  fixedWidth?: boolean;
19
19
  /**
20
20
  * Specifies the type of content inside the trigger region. The following types are available:
21
- * - `text` - Use for inline text triggers.
21
+ * - `text` - Use for triggers containing inline components, like status indicator.
22
+ * - `text-inline` - Use for triggers containing plain text only.
22
23
  * - `custom` - Use for the [button](/components/button/) component.
23
24
  */
24
25
  triggerType?: PopoverProps.TriggerType;
@@ -85,7 +86,7 @@ export type Rect = BoundingBox & {
85
86
  export declare namespace PopoverProps {
86
87
  type Position = 'top' | 'right' | 'bottom' | 'left';
87
88
  type Size = 'small' | 'medium' | 'large';
88
- type TriggerType = 'text' | 'custom';
89
+ type TriggerType = 'text' | 'text-inline' | 'custom';
89
90
  interface Ref {
90
91
  /**
91
92
  * Sets focus on the popover's trigger.
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/popover/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,YAAa,SAAQ,kBAAkB;IACtD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC;IAEjC;;OAEG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;OAIG;IACH,WAAW,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC;IAEvC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,WAAW,GACX,cAAc,GACd,UAAU,GACV,aAAa,GACb,YAAY,GACZ,WAAW,GACX,UAAU,GACV,eAAe,GACf,cAAc,GACd,aAAa,CAAC;AAElB,MAAM,WAAW,MAAM;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;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H,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,WAAW,GACX,cAAc,GACd,UAAU,GACV,aAAa,GACb,YAAY,GACZ,WAAW,GACX,UAAU,GACV,eAAe,GACf,cAAc,GACd,aAAa,CAAC;AAElB,MAAM,WAAW,MAAM;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,IAAI,GAAG,WAAW,GAAG;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,yBAAiB,YAAY,CAAC;IAC5B,KAAY,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3D,KAAY,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAChD,KAAY,WAAW,GAAG,MAAM,GAAG,aAAa,GAAG,QAAQ,CAAC;IAE5D,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/popover/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface PopoverProps extends BaseComponentProps {\n /**\n * Determines where the popover is displayed when opened, relative to the trigger.\n * If the popover doesn't have enough space to open in this direction, it\n * automatically chooses a better direction based on available space.\n */\n position?: PopoverProps.Position;\n\n /**\n * Determines the maximum width for the popover.\n */\n size?: PopoverProps.Size;\n\n /**\n * Expands the popover body to its maximum width regardless of content.\n * For example, use it when you need to place a column layout in the popover content.\n */\n fixedWidth?: boolean;\n\n /**\n * Specifies the type of content inside the trigger region. The following types are available:\n * - `text` - Use for inline text triggers.\n * - `custom` - Use for the [button](/components/button/) component.\n */\n triggerType?: PopoverProps.TriggerType;\n\n /**\n * Adds `aria-label` to the text trigger button. Use this to provide an accessible name for triggers\n * that don't have visible text, and to distinguish between multiple triggers with identical visible text.\n */\n triggerAriaLabel?: string;\n\n /**\n * Specifies if the text trigger content should wrap. If you set it to false, it prevents the text from\n * wrapping and truncates it with an ellipsis.\n */\n wrapTriggerText?: boolean;\n\n /**\n * Element that triggers the popover when selected by the user.\n * @displayname trigger\n */\n children?: React.ReactNode;\n\n /**\n * Specifies optional header text for the popover.\n */\n header?: string;\n\n /**\n * Content of the popover.\n */\n content?: React.ReactNode;\n\n /**\n * Determines whether the dismiss button is shown in the popover body.\n */\n dismissButton?: boolean;\n\n /**\n * Adds an `aria-label` to the dismiss button for accessibility.\n * @i18n\n */\n dismissAriaLabel?: string;\n\n /**\n * By default, the popover is constrained to fit inside its parent\n * [stacking context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context).\n * Enabling this property will allow the popover to be rendered in the root stack context using\n * [React Portals](https://reactjs.org/docs/portals.html).\n * Enable this setting if you need the popover to ignore its parent stacking context, such as in side navigation.\n *\n * Note: Using popover rendered with portal within a Modal is not supported.\n */\n renderWithPortal?: boolean;\n}\n\n/**\n * The position the popover is actually in, given space constraints.\n */\nexport type InternalPosition =\n | 'right-top'\n | 'right-bottom'\n | 'left-top'\n | 'left-bottom'\n | 'top-center'\n | 'top-right'\n | 'top-left'\n | 'bottom-center'\n | 'bottom-right'\n | 'bottom-left';\n\nexport interface Offset {\n insetInlineStart: number;\n insetBlockStart: number;\n}\n\nexport interface Dimensions {\n inlineSize: number;\n blockSize: number;\n}\n\nexport type BoundingBox = Dimensions & Offset;\n\nexport type Rect = BoundingBox & {\n insetBlockEnd: number;\n insetInlineEnd: number;\n};\n\nexport namespace PopoverProps {\n export type Position = 'top' | 'right' | 'bottom' | 'left';\n export type Size = 'small' | 'medium' | 'large';\n export type TriggerType = 'text' | 'custom';\n\n export interface Ref {\n /**\n * Sets focus on the popover's trigger.\n */\n focus(): void;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/popover/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface PopoverProps extends BaseComponentProps {\n /**\n * Determines where the popover is displayed when opened, relative to the trigger.\n * If the popover doesn't have enough space to open in this direction, it\n * automatically chooses a better direction based on available space.\n */\n position?: PopoverProps.Position;\n\n /**\n * Determines the maximum width for the popover.\n */\n size?: PopoverProps.Size;\n\n /**\n * Expands the popover body to its maximum width regardless of content.\n * For example, use it when you need to place a column layout in the popover content.\n */\n fixedWidth?: boolean;\n\n /**\n * Specifies the type of content inside the trigger region. The following types are available:\n * - `text` - Use for triggers containing inline components, like status indicator.\n * - `text-inline` - Use for triggers containing plain text only.\n * - `custom` - Use for the [button](/components/button/) component.\n */\n triggerType?: PopoverProps.TriggerType;\n\n /**\n * Adds `aria-label` to the text trigger button. Use this to provide an accessible name for triggers\n * that don't have visible text, and to distinguish between multiple triggers with identical visible text.\n */\n triggerAriaLabel?: string;\n\n /**\n * Specifies if the text trigger content should wrap. If you set it to false, it prevents the text from\n * wrapping and truncates it with an ellipsis.\n */\n wrapTriggerText?: boolean;\n\n /**\n * Element that triggers the popover when selected by the user.\n * @displayname trigger\n */\n children?: React.ReactNode;\n\n /**\n * Specifies optional header text for the popover.\n */\n header?: string;\n\n /**\n * Content of the popover.\n */\n content?: React.ReactNode;\n\n /**\n * Determines whether the dismiss button is shown in the popover body.\n */\n dismissButton?: boolean;\n\n /**\n * Adds an `aria-label` to the dismiss button for accessibility.\n * @i18n\n */\n dismissAriaLabel?: string;\n\n /**\n * By default, the popover is constrained to fit inside its parent\n * [stacking context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context).\n * Enabling this property will allow the popover to be rendered in the root stack context using\n * [React Portals](https://reactjs.org/docs/portals.html).\n * Enable this setting if you need the popover to ignore its parent stacking context, such as in side navigation.\n *\n * Note: Using popover rendered with portal within a Modal is not supported.\n */\n renderWithPortal?: boolean;\n}\n\n/**\n * The position the popover is actually in, given space constraints.\n */\nexport type InternalPosition =\n | 'right-top'\n | 'right-bottom'\n | 'left-top'\n | 'left-bottom'\n | 'top-center'\n | 'top-right'\n | 'top-left'\n | 'bottom-center'\n | 'bottom-right'\n | 'bottom-left';\n\nexport interface Offset {\n insetInlineStart: number;\n insetBlockStart: number;\n}\n\nexport interface Dimensions {\n inlineSize: number;\n blockSize: number;\n}\n\nexport type BoundingBox = Dimensions & Offset;\n\nexport type Rect = BoundingBox & {\n insetBlockEnd: number;\n insetInlineEnd: number;\n};\n\nexport namespace PopoverProps {\n export type Position = 'top' | 'right' | 'bottom' | 'left';\n export type Size = 'small' | 'medium' | 'large';\n export type TriggerType = 'text' | 'text-inline' | 'custom';\n\n export interface Ref {\n /**\n * Sets focus on the popover's trigger.\n */\n focus(): void;\n }\n}\n"]}
@@ -31,7 +31,7 @@ function InternalPopover(_a, ref) {
31
31
  const [visible, setVisible] = useState(false);
32
32
  const focusTrigger = useCallback(() => {
33
33
  var _a, _b;
34
- if (triggerType === 'text') {
34
+ if (['text', 'text-inline'].includes(triggerType)) {
35
35
  (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
36
36
  }
37
37
  else {
@@ -101,7 +101,7 @@ function InternalPopover(_a, ref) {
101
101
  clickFrameId.current = null;
102
102
  });
103
103
  } }),
104
- triggerType === 'text' ? (React.createElement("button", Object.assign({}, triggerProps, { className: clsx(triggerProps.className, wrapTriggerText === false && styles['overflow-ellipsis']), tabIndex: triggerTabIndex, type: "button", "aria-haspopup": "dialog", id: referrerId, "aria-label": triggerAriaLabel }), children)) : (React.createElement("span", Object.assign({}, triggerProps, { id: referrerId }), children)),
104
+ ['text', 'text-inline'].includes(triggerType) ? (React.createElement("button", Object.assign({}, triggerProps, { className: clsx(triggerProps.className, wrapTriggerText === false && styles['overflow-ellipsis']), tabIndex: triggerTabIndex, type: "button", "aria-haspopup": "dialog", id: referrerId, "aria-label": triggerAriaLabel }), children)) : (React.createElement("span", Object.assign({}, triggerProps, { id: referrerId }), children)),
105
105
  visible && (React.createElement(ResetContextsForModal, null, renderWithPortal ? React.createElement(Portal, null, popoverContent) : popoverContent))));
106
106
  }
107
107
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/popover/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,qBAAqB,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAA6B,MAAM,0BAA0B,CAAC;AAE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AAK,KAAK,IAAI,MAAM,CAAC,mBAAmB,CAAC,CAAC,EACjG,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAC,QAAQ,mBACC,QAAQ,EACtB,EAAE,EAAE,UAAU,gBACF,gBAAgB,KAE3B,QAAQ,CACF,CACV,CAAC,CAAC,CAAC,CACF,8CAAU,YAAY,IAAE,EAAE,EAAE,UAAU,KACnC,QAAQ,CACJ,CACR;QACA,OAAO,IAAI,CACV,oBAAC,qBAAqB,QACnB,gBAAgB,CAAC,CAAC,CAAC,oBAAC,MAAM,QAAE,cAAc,CAAU,CAAC,CAAC,CAAC,cAAc,CAChD,CACzB,CACI,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { getFirstFocusable } from '../internal/components/focus-lock/utils';\nimport Portal from '../internal/components/portal';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events/index';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { KeyCode } from '../internal/keycode';\nimport Arrow from './arrow';\nimport PopoverBody from './body';\nimport PopoverContainer from './container';\nimport { PopoverProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport interface InternalPopoverProps extends Omit<PopoverProps, 'triggerType' | 'size'>, InternalBaseComponentProps {\n __onOpen?: NonCancelableEventHandler<null>;\n triggerType?: PopoverProps.TriggerType | 'filtering-token';\n size: PopoverProps.Size | 'content';\n __closeAnalyticsAction?: string;\n isInline?: boolean;\n}\n\nexport interface InternalPopoverRef {\n dismissPopover: () => void;\n focus: HTMLElement['focus'];\n}\n\nexport default React.forwardRef(InternalPopover);\n\nfunction InternalPopover(\n {\n position = 'right',\n size = 'medium',\n fixedWidth = false,\n triggerType = 'text',\n dismissButton = true,\n\n children,\n header,\n content,\n triggerAriaLabel,\n\n wrapTriggerText = true,\n isInline = false,\n renderWithPortal = false,\n\n __onOpen,\n __internalRootRef = null,\n __closeAnalyticsAction,\n\n ...restProps\n }: InternalPopoverProps,\n ref: React.Ref<InternalPopoverRef>\n) {\n const baseProps = getBaseProps(restProps);\n const triggerRef = useRef<HTMLElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const clickFrameId = useRef<number | null>(null);\n\n const i18n = useInternalI18n('popover');\n const dismissAriaLabel = i18n('dismissAriaLabel', restProps.dismissAriaLabel);\n\n const [visible, setVisible] = useState(false);\n\n const focusTrigger = useCallback(() => {\n if (triggerType === 'text') {\n triggerRef.current?.focus();\n } else {\n triggerRef.current && getFirstFocusable(triggerRef.current)?.focus();\n }\n }, [triggerType]);\n\n const onTriggerClick = useCallback(() => {\n fireNonCancelableEvent(__onOpen);\n setVisible(true);\n }, [__onOpen]);\n\n const onDismiss = useCallback(() => {\n setVisible(false);\n focusTrigger();\n }, [focusTrigger]);\n\n const onTriggerKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n const isEscapeKey = event.keyCode === KeyCode.escape;\n const isTabKey = event.keyCode === KeyCode.tab;\n if (isEscapeKey && visible) {\n event.stopPropagation();\n }\n if (isTabKey || isEscapeKey) {\n setVisible(false);\n }\n },\n [visible]\n );\n\n useImperativeHandle(ref, () => ({\n dismissPopover: onDismiss,\n focus: () => {\n setVisible(false);\n focusTrigger();\n },\n }));\n\n useEffect(() => {\n if (!triggerRef.current) {\n return;\n }\n const document = triggerRef.current.ownerDocument;\n\n const onDocumentClick = () => {\n // Dismiss popover unless there was a click inside within the last animation frame.\n if (clickFrameId.current === null) {\n setVisible(false);\n }\n };\n\n document.addEventListener('mousedown', onDocumentClick);\n\n return () => {\n document.removeEventListener('mousedown', onDocumentClick);\n };\n }, []);\n\n const popoverClasses = usePortalModeClasses(triggerRef);\n\n const triggerProps = {\n // https://github.com/microsoft/TypeScript/issues/36659\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: triggerRef as any,\n onClick: onTriggerClick,\n onKeyDown: onTriggerKeyDown,\n className: clsx(styles.trigger, styles[`trigger-type-${triggerType}`]),\n };\n const { tabIndex: triggerTabIndex } = useSingleTabStopNavigation(triggerRef);\n\n const referrerId = useUniqueId();\n\n const popoverContent = (\n <div\n aria-live={dismissButton ? undefined : 'polite'}\n aria-atomic={dismissButton ? undefined : true}\n className={clsx(popoverClasses, !renderWithPortal && styles['popover-inline-content'])}\n data-awsui-referrer-id={referrerId}\n >\n <PopoverContainer\n size={size}\n fixedWidth={fixedWidth}\n position={position}\n trackRef={triggerRef}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={renderWithPortal}\n zIndex={renderWithPortal ? 7000 : undefined}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <PopoverBody\n dismissButton={dismissButton}\n dismissAriaLabel={dismissAriaLabel}\n header={header}\n onDismiss={onDismiss}\n overflowVisible=\"both\"\n closeAnalyticsAction={__closeAnalyticsAction}\n >\n {content}\n </PopoverBody>\n </LinkDefaultVariantContext.Provider>\n </PopoverContainer>\n </div>\n );\n\n const mergedRef = useMergeRefs(popoverRef, __internalRootRef);\n\n return (\n <span\n {...baseProps}\n className={clsx(\n styles.root,\n baseProps.className,\n triggerType === 'filtering-token' && styles['root-filtering-token'],\n isInline && styles['no-wrap']\n )}\n ref={mergedRef}\n onMouseDown={() => {\n // Indicate there was a click inside popover recently, including nested portals.\n clickFrameId.current = requestAnimationFrame(() => {\n clickFrameId.current = null;\n });\n }}\n >\n {triggerType === 'text' ? (\n <button\n {...triggerProps}\n className={clsx(triggerProps.className, wrapTriggerText === false && styles['overflow-ellipsis'])}\n tabIndex={triggerTabIndex}\n type=\"button\"\n aria-haspopup=\"dialog\"\n id={referrerId}\n aria-label={triggerAriaLabel}\n >\n {children}\n </button>\n ) : (\n <span {...triggerProps} id={referrerId}>\n {children}\n </span>\n )}\n {visible && (\n <ResetContextsForModal>\n {renderWithPortal ? <Portal>{popoverContent}</Portal> : popoverContent}\n </ResetContextsForModal>\n )}\n </span>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/popover/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,qBAAqB,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAA6B,MAAM,0BAA0B,CAAC;AAE7F,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,MAAM,SAAS,CAAC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AE3B,QAAQ,CACF,CACV,CAAC,CAAC,CAAC,CACF,8CAAU,YAAY,IAAE,EAAE,EAAE,UAAU,KACnC,QAAQ,CACJ,CACR;QACA,OAAO,IAAI,CACV,oBAAC,qBAAqB,QACnB,gBAAgB,CAAC,CAAC,CAAC,oBAAC,MAAM,QAAE,cAAc,CAAU,CAAC,CAAC,CAAC,cAAc,CAChD,CACzB,CACI,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { getFirstFocusable } from '../internal/components/focus-lock/utils';\nimport Portal from '../internal/components/portal';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events/index';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { KeyCode } from '../internal/keycode';\nimport Arrow from './arrow';\nimport PopoverBody from './body';\nimport PopoverContainer from './container';\nimport { PopoverProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport interface InternalPopoverProps extends Omit<PopoverProps, 'triggerType' | 'size'>, InternalBaseComponentProps {\n __onOpen?: NonCancelableEventHandler<null>;\n triggerType?: PopoverProps.TriggerType | 'filtering-token';\n size: PopoverProps.Size | 'content';\n __closeAnalyticsAction?: string;\n isInline?: boolean;\n}\n\nexport interface InternalPopoverRef {\n dismissPopover: () => void;\n focus: HTMLElement['focus'];\n}\n\nexport default React.forwardRef(InternalPopover);\n\nfunction InternalPopover(\n {\n position = 'right',\n size = 'medium',\n fixedWidth = false,\n triggerType = 'text',\n dismissButton = true,\n\n children,\n header,\n content,\n triggerAriaLabel,\n\n wrapTriggerText = true,\n isInline = false,\n renderWithPortal = false,\n\n __onOpen,\n __internalRootRef = null,\n __closeAnalyticsAction,\n\n ...restProps\n }: InternalPopoverProps,\n ref: React.Ref<InternalPopoverRef>\n) {\n const baseProps = getBaseProps(restProps);\n const triggerRef = useRef<HTMLElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const clickFrameId = useRef<number | null>(null);\n\n const i18n = useInternalI18n('popover');\n const dismissAriaLabel = i18n('dismissAriaLabel', restProps.dismissAriaLabel);\n\n const [visible, setVisible] = useState(false);\n\n const focusTrigger = useCallback(() => {\n if (['text', 'text-inline'].includes(triggerType)) {\n triggerRef.current?.focus();\n } else {\n triggerRef.current && getFirstFocusable(triggerRef.current)?.focus();\n }\n }, [triggerType]);\n\n const onTriggerClick = useCallback(() => {\n fireNonCancelableEvent(__onOpen);\n setVisible(true);\n }, [__onOpen]);\n\n const onDismiss = useCallback(() => {\n setVisible(false);\n focusTrigger();\n }, [focusTrigger]);\n\n const onTriggerKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n const isEscapeKey = event.keyCode === KeyCode.escape;\n const isTabKey = event.keyCode === KeyCode.tab;\n if (isEscapeKey && visible) {\n event.stopPropagation();\n }\n if (isTabKey || isEscapeKey) {\n setVisible(false);\n }\n },\n [visible]\n );\n\n useImperativeHandle(ref, () => ({\n dismissPopover: onDismiss,\n focus: () => {\n setVisible(false);\n focusTrigger();\n },\n }));\n\n useEffect(() => {\n if (!triggerRef.current) {\n return;\n }\n const document = triggerRef.current.ownerDocument;\n\n const onDocumentClick = () => {\n // Dismiss popover unless there was a click inside within the last animation frame.\n if (clickFrameId.current === null) {\n setVisible(false);\n }\n };\n\n document.addEventListener('mousedown', onDocumentClick);\n\n return () => {\n document.removeEventListener('mousedown', onDocumentClick);\n };\n }, []);\n\n const popoverClasses = usePortalModeClasses(triggerRef);\n\n const triggerProps = {\n // https://github.com/microsoft/TypeScript/issues/36659\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: triggerRef as any,\n onClick: onTriggerClick,\n onKeyDown: onTriggerKeyDown,\n className: clsx(styles.trigger, styles[`trigger-type-${triggerType}`]),\n };\n const { tabIndex: triggerTabIndex } = useSingleTabStopNavigation(triggerRef);\n\n const referrerId = useUniqueId();\n\n const popoverContent = (\n <div\n aria-live={dismissButton ? undefined : 'polite'}\n aria-atomic={dismissButton ? undefined : true}\n className={clsx(popoverClasses, !renderWithPortal && styles['popover-inline-content'])}\n data-awsui-referrer-id={referrerId}\n >\n <PopoverContainer\n size={size}\n fixedWidth={fixedWidth}\n position={position}\n trackRef={triggerRef}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={renderWithPortal}\n zIndex={renderWithPortal ? 7000 : undefined}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <PopoverBody\n dismissButton={dismissButton}\n dismissAriaLabel={dismissAriaLabel}\n header={header}\n onDismiss={onDismiss}\n overflowVisible=\"both\"\n closeAnalyticsAction={__closeAnalyticsAction}\n >\n {content}\n </PopoverBody>\n </LinkDefaultVariantContext.Provider>\n </PopoverContainer>\n </div>\n );\n\n const mergedRef = useMergeRefs(popoverRef, __internalRootRef);\n\n return (\n <span\n {...baseProps}\n className={clsx(\n styles.root,\n baseProps.className,\n triggerType === 'filtering-token' && styles['root-filtering-token'],\n isInline && styles['no-wrap']\n )}\n ref={mergedRef}\n onMouseDown={() => {\n // Indicate there was a click inside popover recently, including nested portals.\n clickFrameId.current = requestAnimationFrame(() => {\n clickFrameId.current = null;\n });\n }}\n >\n {['text', 'text-inline'].includes(triggerType) ? (\n <button\n {...triggerProps}\n className={clsx(triggerProps.className, wrapTriggerText === false && styles['overflow-ellipsis'])}\n tabIndex={triggerTabIndex}\n type=\"button\"\n aria-haspopup=\"dialog\"\n id={referrerId}\n aria-label={triggerAriaLabel}\n >\n {children}\n </button>\n ) : (\n <span {...triggerProps} id={referrerId}>\n {children}\n </span>\n )}\n {visible && (\n <ResetContextsForModal>\n {renderWithPortal ? <Portal>{popoverContent}</Portal> : popoverContent}\n </ResetContextsForModal>\n )}\n </span>\n );\n}\n"]}
@@ -1,58 +1,59 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "arrow": "awsui_arrow_xjuzf_hg5hv_289",
5
- "arrow-outer": "awsui_arrow-outer_xjuzf_hg5hv_293",
6
- "arrow-inner": "awsui_arrow-inner_xjuzf_hg5hv_293",
7
- "arrow-position-right-top": "awsui_arrow-position-right-top_xjuzf_hg5hv_335",
8
- "arrow-position-right-bottom": "awsui_arrow-position-right-bottom_xjuzf_hg5hv_335",
9
- "arrow-position-left-top": "awsui_arrow-position-left-top_xjuzf_hg5hv_338",
10
- "arrow-position-left-bottom": "awsui_arrow-position-left-bottom_xjuzf_hg5hv_338",
11
- "arrow-position-top-center": "awsui_arrow-position-top-center_xjuzf_hg5hv_341",
12
- "arrow-position-top-right": "awsui_arrow-position-top-right_xjuzf_hg5hv_341",
13
- "arrow-position-top-left": "awsui_arrow-position-top-left_xjuzf_hg5hv_341",
14
- "arrow-position-top-responsive": "awsui_arrow-position-top-responsive_xjuzf_hg5hv_341",
15
- "arrow-position-bottom-center": "awsui_arrow-position-bottom-center_xjuzf_hg5hv_344",
16
- "arrow-position-bottom-right": "awsui_arrow-position-bottom-right_xjuzf_hg5hv_344",
17
- "arrow-position-bottom-left": "awsui_arrow-position-bottom-left_xjuzf_hg5hv_344",
18
- "arrow-position-bottom-responsive": "awsui_arrow-position-bottom-responsive_xjuzf_hg5hv_344",
19
- "body": "awsui_body_xjuzf_hg5hv_492",
20
- "body-overflow-visible": "awsui_body-overflow-visible_xjuzf_hg5hv_528",
21
- "has-dismiss": "awsui_has-dismiss_xjuzf_hg5hv_532",
22
- "dismiss": "awsui_dismiss_xjuzf_hg5hv_537",
23
- "dismiss-control": "awsui_dismiss-control_xjuzf_hg5hv_545",
24
- "header-row": "awsui_header-row_xjuzf_hg5hv_549",
25
- "header": "awsui_header_xjuzf_hg5hv_549",
26
- "content": "awsui_content_xjuzf_hg5hv_574",
27
- "content-overflow-visible": "awsui_content-overflow-visible_xjuzf_hg5hv_582",
28
- "container": "awsui_container_xjuzf_hg5hv_730",
29
- "container-body": "awsui_container-body_xjuzf_hg5hv_738",
30
- "container-body-variant-annotation": "awsui_container-body-variant-annotation_xjuzf_hg5hv_778",
31
- "container-body-size-small": "awsui_container-body-size-small_xjuzf_hg5hv_783",
32
- "fixed-width": "awsui_fixed-width_xjuzf_hg5hv_786",
33
- "container-body-size-medium": "awsui_container-body-size-medium_xjuzf_hg5hv_790",
34
- "container-body-size-large": "awsui_container-body-size-large_xjuzf_hg5hv_797",
35
- "container-arrow": "awsui_container-arrow_xjuzf_hg5hv_809",
36
- "container-arrow-position-right-top": "awsui_container-arrow-position-right-top_xjuzf_hg5hv_813",
37
- "container-arrow-position-right-bottom": "awsui_container-arrow-position-right-bottom_xjuzf_hg5hv_813",
38
- "container-arrow-position-left-top": "awsui_container-arrow-position-left-top_xjuzf_hg5hv_830",
39
- "container-arrow-position-left-bottom": "awsui_container-arrow-position-left-bottom_xjuzf_hg5hv_830",
40
- "container-arrow-position-top-center": "awsui_container-arrow-position-top-center_xjuzf_hg5hv_847",
41
- "container-arrow-position-top-right": "awsui_container-arrow-position-top-right_xjuzf_hg5hv_847",
42
- "container-arrow-position-top-left": "awsui_container-arrow-position-top-left_xjuzf_hg5hv_847",
43
- "container-arrow-position-top-responsive": "awsui_container-arrow-position-top-responsive_xjuzf_hg5hv_847",
44
- "container-arrow-position-bottom-center": "awsui_container-arrow-position-bottom-center_xjuzf_hg5hv_863",
45
- "container-arrow-position-bottom-right": "awsui_container-arrow-position-bottom-right_xjuzf_hg5hv_867",
46
- "container-arrow-position-bottom-left": "awsui_container-arrow-position-bottom-left_xjuzf_hg5hv_871",
47
- "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_xjuzf_hg5hv_1",
48
- "refresh": "awsui_refresh_xjuzf_hg5hv_1041",
49
- "root": "awsui_root_xjuzf_hg5hv_1063",
50
- "no-wrap": "awsui_no-wrap_xjuzf_hg5hv_1095",
51
- "root-filtering-token": "awsui_root-filtering-token_xjuzf_hg5hv_1099",
52
- "trigger": "awsui_trigger_xjuzf_hg5hv_1103",
53
- "overflow-ellipsis": "awsui_overflow-ellipsis_xjuzf_hg5hv_1110",
54
- "trigger-type-text": "awsui_trigger-type-text_xjuzf_hg5hv_1118",
55
- "trigger-type-filtering-token": "awsui_trigger-type-filtering-token_xjuzf_hg5hv_1154",
56
- "popover-inline-content": "awsui_popover-inline-content_xjuzf_hg5hv_1158"
4
+ "arrow": "awsui_arrow_xjuzf_7fmsc_289",
5
+ "arrow-outer": "awsui_arrow-outer_xjuzf_7fmsc_293",
6
+ "arrow-inner": "awsui_arrow-inner_xjuzf_7fmsc_293",
7
+ "arrow-position-right-top": "awsui_arrow-position-right-top_xjuzf_7fmsc_335",
8
+ "arrow-position-right-bottom": "awsui_arrow-position-right-bottom_xjuzf_7fmsc_335",
9
+ "arrow-position-left-top": "awsui_arrow-position-left-top_xjuzf_7fmsc_338",
10
+ "arrow-position-left-bottom": "awsui_arrow-position-left-bottom_xjuzf_7fmsc_338",
11
+ "arrow-position-top-center": "awsui_arrow-position-top-center_xjuzf_7fmsc_341",
12
+ "arrow-position-top-right": "awsui_arrow-position-top-right_xjuzf_7fmsc_341",
13
+ "arrow-position-top-left": "awsui_arrow-position-top-left_xjuzf_7fmsc_341",
14
+ "arrow-position-top-responsive": "awsui_arrow-position-top-responsive_xjuzf_7fmsc_341",
15
+ "arrow-position-bottom-center": "awsui_arrow-position-bottom-center_xjuzf_7fmsc_344",
16
+ "arrow-position-bottom-right": "awsui_arrow-position-bottom-right_xjuzf_7fmsc_344",
17
+ "arrow-position-bottom-left": "awsui_arrow-position-bottom-left_xjuzf_7fmsc_344",
18
+ "arrow-position-bottom-responsive": "awsui_arrow-position-bottom-responsive_xjuzf_7fmsc_344",
19
+ "body": "awsui_body_xjuzf_7fmsc_492",
20
+ "body-overflow-visible": "awsui_body-overflow-visible_xjuzf_7fmsc_528",
21
+ "has-dismiss": "awsui_has-dismiss_xjuzf_7fmsc_532",
22
+ "dismiss": "awsui_dismiss_xjuzf_7fmsc_537",
23
+ "dismiss-control": "awsui_dismiss-control_xjuzf_7fmsc_545",
24
+ "header-row": "awsui_header-row_xjuzf_7fmsc_549",
25
+ "header": "awsui_header_xjuzf_7fmsc_549",
26
+ "content": "awsui_content_xjuzf_7fmsc_574",
27
+ "content-overflow-visible": "awsui_content-overflow-visible_xjuzf_7fmsc_582",
28
+ "container": "awsui_container_xjuzf_7fmsc_730",
29
+ "container-body": "awsui_container-body_xjuzf_7fmsc_738",
30
+ "container-body-variant-annotation": "awsui_container-body-variant-annotation_xjuzf_7fmsc_778",
31
+ "container-body-size-small": "awsui_container-body-size-small_xjuzf_7fmsc_783",
32
+ "fixed-width": "awsui_fixed-width_xjuzf_7fmsc_786",
33
+ "container-body-size-medium": "awsui_container-body-size-medium_xjuzf_7fmsc_790",
34
+ "container-body-size-large": "awsui_container-body-size-large_xjuzf_7fmsc_797",
35
+ "container-arrow": "awsui_container-arrow_xjuzf_7fmsc_809",
36
+ "container-arrow-position-right-top": "awsui_container-arrow-position-right-top_xjuzf_7fmsc_813",
37
+ "container-arrow-position-right-bottom": "awsui_container-arrow-position-right-bottom_xjuzf_7fmsc_813",
38
+ "container-arrow-position-left-top": "awsui_container-arrow-position-left-top_xjuzf_7fmsc_830",
39
+ "container-arrow-position-left-bottom": "awsui_container-arrow-position-left-bottom_xjuzf_7fmsc_830",
40
+ "container-arrow-position-top-center": "awsui_container-arrow-position-top-center_xjuzf_7fmsc_847",
41
+ "container-arrow-position-top-right": "awsui_container-arrow-position-top-right_xjuzf_7fmsc_847",
42
+ "container-arrow-position-top-left": "awsui_container-arrow-position-top-left_xjuzf_7fmsc_847",
43
+ "container-arrow-position-top-responsive": "awsui_container-arrow-position-top-responsive_xjuzf_7fmsc_847",
44
+ "container-arrow-position-bottom-center": "awsui_container-arrow-position-bottom-center_xjuzf_7fmsc_863",
45
+ "container-arrow-position-bottom-right": "awsui_container-arrow-position-bottom-right_xjuzf_7fmsc_867",
46
+ "container-arrow-position-bottom-left": "awsui_container-arrow-position-bottom-left_xjuzf_7fmsc_871",
47
+ "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_xjuzf_7fmsc_1",
48
+ "refresh": "awsui_refresh_xjuzf_7fmsc_1041",
49
+ "root": "awsui_root_xjuzf_7fmsc_1063",
50
+ "no-wrap": "awsui_no-wrap_xjuzf_7fmsc_1095",
51
+ "root-filtering-token": "awsui_root-filtering-token_xjuzf_7fmsc_1099",
52
+ "trigger": "awsui_trigger_xjuzf_7fmsc_1103",
53
+ "overflow-ellipsis": "awsui_overflow-ellipsis_xjuzf_7fmsc_1110",
54
+ "trigger-type-text-inline": "awsui_trigger-type-text-inline_xjuzf_7fmsc_1118",
55
+ "trigger-type-text": "awsui_trigger-type-text_xjuzf_7fmsc_1118",
56
+ "trigger-type-filtering-token": "awsui_trigger-type-filtering-token_xjuzf_7fmsc_1179",
57
+ "popover-inline-content": "awsui_popover-inline-content_xjuzf_7fmsc_1183"
57
58
  };
58
59