@cloudscape-design/components 3.0.237 → 3.0.238
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.
- package/container/internal.d.ts.map +1 -1
- package/container/internal.js +4 -2
- package/container/internal.js.map +1 -1
- package/container/styles.css.js +18 -20
- package/container/styles.scoped.css +36 -43
- package/container/styles.selectors.js +18 -20
- package/icon/icons.js +1 -1
- package/icon/interfaces.d.ts +1 -1
- package/icon/interfaces.d.ts.map +1 -1
- package/icon/interfaces.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/hooks/use-intersection-observer/index.d.ts +9 -0
- package/internal/hooks/use-intersection-observer/index.d.ts.map +1 -0
- package/internal/hooks/use-intersection-observer/index.js +28 -0
- package/internal/hooks/use-intersection-observer/index.js.map +1 -0
- package/internal/manifest.json +1 -1
- package/modal/internal.d.ts.map +1 -1
- package/modal/internal.js +8 -2
- package/modal/internal.js.map +1 -1
- package/modal/styles.css.js +23 -22
- package/modal/styles.scoped.css +43 -37
- package/modal/styles.selectors.js +23 -22
- package/package.json +1 -1
- package/property-filter/index.d.ts.map +1 -1
- package/property-filter/index.js +6 -4
- package/property-filter/index.js.map +1 -1
- package/property-filter/property-filter-autosuggest.d.ts +1 -0
- package/property-filter/property-filter-autosuggest.d.ts.map +1 -1
- package/property-filter/property-filter-autosuggest.js +2 -2
- package/property-filter/property-filter-autosuggest.js.map +1 -1
- package/property-filter/styles.css.js +31 -33
- package/property-filter/styles.scoped.css +33 -43
- package/property-filter/styles.selectors.js +31 -33
- package/test-utils/dom/property-filter/index.js +2 -1
- package/test-utils/dom/property-filter/index.js.map +1 -1
- package/test-utils/selectors/property-filter/index.js +2 -1
- package/test-utils/selectors/property-filter/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/text-filter/internal.d.ts.map +1 -1
- package/text-filter/internal.js +4 -8
- package/text-filter/internal.js.map +1 -1
- package/text-filter/search-results.d.ts +8 -0
- package/text-filter/search-results.d.ts.map +1 -0
- package/text-filter/search-results.js +13 -0
- package/text-filter/search-results.js.map +1 -0
- package/text-filter/styles.css.js +3 -4
- package/text-filter/styles.scoped.css +3 -5
- package/text-filter/styles.selectors.js +3 -4
package/icon/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/icon/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface IconProps extends BaseComponentProps {\n /**\n * Specifies the icon to be displayed.\n */\n name?: IconProps.Name;\n /**\n * Specifies the size of the icon.\n *\n * If you set size to `inherit`, an icon size will be assigned based on the icon's inherited line height.\n * For icons used alongside text, ensure the icon is placed inside the acompanying text tag.\n * The icon will be vertically centered based on the height.\n *\n * @visualrefresh `medium` size\n */\n size?: IconProps.Size;\n\n /**\n * Specifies the color variant of the icon. The `normal` variant picks up the current color of its context.\n */\n variant?: IconProps.Variant;\n\n /**\n * Specifies the URL of a custom icon. Use this property if the icon you want isn't available, and your custom icon cannot be an SVG.\n * For SVG icons, use the `svg` slot instead.\n *\n * If you set both `url` and `svg`, `svg` will take precedence.\n */\n url?: string;\n /**\n * Specifies alternate text for a custom icon (using the `url` attribute). We recommend that you provide this for accessibility.\n * This property is ignored if you use a predefined icon or if you set your custom icon using the `svg` slot.\n */\n alt?: string;\n\n /**\n * Specifies the SVG of a custom icon.\n *\n * Use this property if the icon you want isn't available, and you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`.\n * - has `viewBox=\"0 0 16 16\"`.\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span` and ensure icon `size` is not set to `inherit`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `url` and `svg`, `svg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n svg?: React.ReactNode;\n}\n\nexport namespace IconProps {\n // Why not enums? Explained there\n // https://stackoverflow.com/questions/52393730/typescript-string-literal-union-type-from-enum\n export type Name =\n | 'add-plus'\n | 'angle-left-double'\n | 'angle-left'\n | 'angle-right-double'\n | 'angle-right'\n | 'angle-up'\n | 'angle-down'\n | 'arrow-left'\n | 'audio-full'\n | 'audio-half'\n | 'audio-off'\n | 'bug'\n | 'call'\n | 'calendar'\n | 'caret-down-filled'\n | 'caret-down'\n | 'caret-left-filled'\n | 'caret-right-filled'\n | 'caret-up-filled'\n | 'caret-up'\n | 'check'\n | 'contact'\n | 'close'\n | 'copy'\n | 'delete-marker'\n | 'download'\n | 'edit'\n | 'ellipsis'\n | 'envelope'\n | 'expand'\n | 'external'\n | 'file-open'\n | 'file'\n | 'filter'\n | 'flag'\n | 'folder-open'\n | 'folder'\n | 'group-active'\n | 'group'\n | 'heart'\n | 'insert-row'\n | 'key'\n | 'keyboard'\n | 'lock-private'\n | 'menu'\n | 'microphone'\n | 'microphone-off'\n | 'multiscreen'\n | 'notification'\n | 'redo'\n | 'refresh'\n | 'remove'\n | 'script'\n | 'search'\n | 'security'\n | 'settings'\n | 'share'\n | 'shrink'\n | 'status-in-progress'\n | 'status-info'\n | 'status-negative'\n | 'status-pending'\n | 'status-positive'\n | 'status-stopped'\n | 'status-warning'\n | 'suggestions'\n | 'thumbs-down-filled'\n | 'thumbs-down'\n | 'thumbs-up-filled'\n | 'thumbs-up'\n | 'ticket'\n | 'treeview-collapse'\n | 'treeview-expand'\n | 'undo'\n | 'unlocked'\n | 'upload-download'\n | 'upload'\n | 'user-profile-active'\n | 'user-profile'\n | 'video-off'\n | 'video-on'\n | 'video-unavailable'\n | 'view-full'\n | 'view-horizontal'\n | 'view-vertical'\n | 'zoom-in'\n | 'zoom-out'\n | 'zoom-to-fit';\n\n export type Variant = 'normal' | 'disabled' | 'error' | 'inverted' | 'link' | 'subtle' | 'success' | 'warning';\n\n export type Size = 'small' | 'normal' | 'medium' | 'big' | 'large' | 'inherit';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/icon/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface IconProps extends BaseComponentProps {\n /**\n * Specifies the icon to be displayed.\n */\n name?: IconProps.Name;\n /**\n * Specifies the size of the icon.\n *\n * If you set size to `inherit`, an icon size will be assigned based on the icon's inherited line height.\n * For icons used alongside text, ensure the icon is placed inside the acompanying text tag.\n * The icon will be vertically centered based on the height.\n *\n * @visualrefresh `medium` size\n */\n size?: IconProps.Size;\n\n /**\n * Specifies the color variant of the icon. The `normal` variant picks up the current color of its context.\n */\n variant?: IconProps.Variant;\n\n /**\n * Specifies the URL of a custom icon. Use this property if the icon you want isn't available, and your custom icon cannot be an SVG.\n * For SVG icons, use the `svg` slot instead.\n *\n * If you set both `url` and `svg`, `svg` will take precedence.\n */\n url?: string;\n /**\n * Specifies alternate text for a custom icon (using the `url` attribute). We recommend that you provide this for accessibility.\n * This property is ignored if you use a predefined icon or if you set your custom icon using the `svg` slot.\n */\n alt?: string;\n\n /**\n * Specifies the SVG of a custom icon.\n *\n * Use this property if the icon you want isn't available, and you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`.\n * - has `viewBox=\"0 0 16 16\"`.\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span` and ensure icon `size` is not set to `inherit`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `url` and `svg`, `svg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n svg?: React.ReactNode;\n}\n\nexport namespace IconProps {\n // Why not enums? Explained there\n // https://stackoverflow.com/questions/52393730/typescript-string-literal-union-type-from-enum\n export type Name =\n | 'add-plus'\n | 'angle-left-double'\n | 'angle-left'\n | 'angle-right-double'\n | 'angle-right'\n | 'angle-up'\n | 'angle-down'\n | 'arrow-left'\n | 'audio-full'\n | 'audio-half'\n | 'audio-off'\n | 'bug'\n | 'call'\n | 'calendar'\n | 'caret-down-filled'\n | 'caret-down'\n | 'caret-left-filled'\n | 'caret-right-filled'\n | 'caret-up-filled'\n | 'caret-up'\n | 'check'\n | 'contact'\n | 'close'\n | 'copy'\n | 'delete-marker'\n | 'download'\n | 'drag-indicator'\n | 'edit'\n | 'ellipsis'\n | 'envelope'\n | 'expand'\n | 'external'\n | 'file-open'\n | 'file'\n | 'filter'\n | 'flag'\n | 'folder-open'\n | 'folder'\n | 'group-active'\n | 'group'\n | 'heart'\n | 'insert-row'\n | 'key'\n | 'keyboard'\n | 'lock-private'\n | 'menu'\n | 'microphone'\n | 'microphone-off'\n | 'multiscreen'\n | 'notification'\n | 'redo'\n | 'refresh'\n | 'remove'\n | 'resize-area'\n | 'script'\n | 'search'\n | 'security'\n | 'settings'\n | 'share'\n | 'shrink'\n | 'status-in-progress'\n | 'status-info'\n | 'status-negative'\n | 'status-pending'\n | 'status-positive'\n | 'status-stopped'\n | 'status-warning'\n | 'suggestions'\n | 'thumbs-down-filled'\n | 'thumbs-down'\n | 'thumbs-up-filled'\n | 'thumbs-up'\n | 'ticket'\n | 'treeview-collapse'\n | 'treeview-expand'\n | 'undo'\n | 'unlocked'\n | 'upload-download'\n | 'upload'\n | 'user-profile-active'\n | 'user-profile'\n | 'video-off'\n | 'video-on'\n | 'video-unavailable'\n | 'view-full'\n | 'view-horizontal'\n | 'view-vertical'\n | 'zoom-in'\n | 'zoom-out'\n | 'zoom-to-fit';\n\n export type Variant = 'normal' | 'disabled' | 'error' | 'inverted' | 'link' | 'subtle' | 'success' | 'warning';\n\n export type Size = 'small' | 'normal' | 'medium' | 'big' | 'large' | 'inherit';\n}\n"]}
|
package/internal/environment.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A hook that uses an Intersection Observer on the target element ref
|
|
3
|
+
* and detects if the element is intersecting with its parent.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useIntersectionObserver<T extends HTMLElement>(): {
|
|
6
|
+
ref: (instance: T | null) => void;
|
|
7
|
+
isIntersecting: boolean;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-intersection-observer/index.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,WAAW;;;EAuB5D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { useCallback, useRef, useState } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* A hook that uses an Intersection Observer on the target element ref
|
|
6
|
+
* and detects if the element is intersecting with its parent.
|
|
7
|
+
*/
|
|
8
|
+
export function useIntersectionObserver() {
|
|
9
|
+
const observerRef = useRef(null);
|
|
10
|
+
const [isIntersecting, setIsIntersecting] = useState(false);
|
|
11
|
+
const ref = useCallback(targetElement => {
|
|
12
|
+
if (typeof IntersectionObserver === 'undefined') {
|
|
13
|
+
// Do nothing in environments like JSDOM
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (observerRef.current) {
|
|
17
|
+
// Dismiss previous observer because the target changed
|
|
18
|
+
observerRef.current.disconnect();
|
|
19
|
+
}
|
|
20
|
+
// Create a new observer with the target element
|
|
21
|
+
if (targetElement) {
|
|
22
|
+
observerRef.current = new IntersectionObserver(([entry]) => setIsIntersecting(entry.isIntersecting));
|
|
23
|
+
observerRef.current.observe(targetElement);
|
|
24
|
+
}
|
|
25
|
+
}, []);
|
|
26
|
+
return { ref, isIntersecting };
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-intersection-observer/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAe,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnE;;;GAGG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,WAAW,GAAG,MAAM,CAA8B,IAAI,CAAC,CAAC;IAC9D,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5D,MAAM,GAAG,GAAG,WAAW,CAAiB,aAAa,CAAC,EAAE;QACtD,IAAI,OAAO,oBAAoB,KAAK,WAAW,EAAE;YAC/C,wCAAwC;YACxC,OAAO;SACR;QAED,IAAI,WAAW,CAAC,OAAO,EAAE;YACvB,uDAAuD;YACvD,WAAW,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;SAClC;QAED,gDAAgD;QAChD,IAAI,aAAa,EAAE;YACjB,WAAW,CAAC,OAAO,GAAG,IAAI,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;YACrG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;SAC5C;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,CAAC;AACjC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { RefCallback, useCallback, useRef, useState } from 'react';\n\n/**\n * A hook that uses an Intersection Observer on the target element ref\n * and detects if the element is intersecting with its parent.\n */\nexport function useIntersectionObserver<T extends HTMLElement>() {\n const observerRef = useRef<IntersectionObserver | null>(null);\n const [isIntersecting, setIsIntersecting] = useState(false);\n\n const ref = useCallback<RefCallback<T>>(targetElement => {\n if (typeof IntersectionObserver === 'undefined') {\n // Do nothing in environments like JSDOM\n return;\n }\n\n if (observerRef.current) {\n // Dismiss previous observer because the target changed\n observerRef.current.disconnect();\n }\n\n // Create a new observer with the target element\n if (targetElement) {\n observerRef.current = new IntersectionObserver(([entry]) => setIsIntersecting(entry.isIntersecting));\n observerRef.current.observe(targetElement);\n }\n }, []);\n\n return { ref, isIntersecting };\n}\n"]}
|
package/internal/manifest.json
CHANGED
package/modal/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/modal/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAYlF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/modal/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAYlF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKjD,KAAK,kBAAkB,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAAC,GAAG,0BAA0B,CAAC;AAE3G,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,IAAI,EACJ,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,sBAAsB,EACtB,SAAS,EACT,SAAS,EACT,iBAAwB,EACxB,GAAG,IAAI,EACR,EAAE,kBAAkB,eAwHpB"}
|
package/modal/internal.js
CHANGED
|
@@ -18,6 +18,7 @@ import { disableBodyScrolling, enableBodyScrolling } from './body-scroll';
|
|
|
18
18
|
import styles from './styles.css.js';
|
|
19
19
|
import FocusLock from '../internal/components/focus-lock';
|
|
20
20
|
import { useInternalI18n } from '../internal/i18n/context';
|
|
21
|
+
import { useIntersectionObserver } from '../internal/hooks/use-intersection-observer';
|
|
21
22
|
export default function InternalModal(_a) {
|
|
22
23
|
var { size, visible, header, children, footer, disableContentPaddings, onDismiss, modalRoot, __internalRootRef = null } = _a, rest = __rest(_a, ["size", "visible", "header", "children", "footer", "disableContentPaddings", "onDismiss", "modalRoot", "__internalRootRef"]);
|
|
23
24
|
const instanceUniqueId = useUniqueId();
|
|
@@ -68,6 +69,9 @@ export default function InternalModal(_a) {
|
|
|
68
69
|
dismiss('keyboard');
|
|
69
70
|
}
|
|
70
71
|
};
|
|
72
|
+
// We use an empty div element at the end of the content slot as a sentinel
|
|
73
|
+
// to detect when the user has scrolled to the bottom.
|
|
74
|
+
const { ref: stickySentinelRef, isIntersecting: footerStuck } = useIntersectionObserver();
|
|
71
75
|
return (React.createElement(Portal, { container: modalRoot },
|
|
72
76
|
React.createElement(FormFieldContext.Provider, { value: {} },
|
|
73
77
|
React.createElement("div", Object.assign({}, baseProps, { className: clsx(styles.root, { [styles.hidden]: !visible }, baseProps.className, isRefresh && styles.refresh), role: "dialog", "aria-modal": true, "aria-labelledby": headerId, onMouseDown: onOverlayMouseDown, onClick: onOverlayClick, ref: mergedRef }),
|
|
@@ -77,7 +81,9 @@ export default function InternalModal(_a) {
|
|
|
77
81
|
React.createElement("div", { className: styles.header },
|
|
78
82
|
React.createElement(InternalHeader, { variant: "h2", __disableActionsWrapping: true, actions: React.createElement(InternalButton, { ariaLabel: closeAriaLabel, className: styles['dismiss-control'], variant: "modal-dismiss", iconName: "close", formAction: "none", onClick: onCloseButtonClick }) },
|
|
79
83
|
React.createElement("span", { id: headerId, className: styles['header--text'] }, header))),
|
|
80
|
-
React.createElement("div", { className: clsx(styles.content, { [styles['no-paddings']]: disableContentPaddings }) },
|
|
81
|
-
|
|
84
|
+
React.createElement("div", { className: clsx(styles.content, { [styles['no-paddings']]: disableContentPaddings }) },
|
|
85
|
+
children,
|
|
86
|
+
React.createElement("div", { ref: stickySentinelRef })),
|
|
87
|
+
footer && React.createElement("div", { className: clsx(styles.footer, footerStuck && styles['footer--stuck']) }, footer))))))));
|
|
82
88
|
}
|
|
83
89
|
//# sourceMappingURL=internal.js.map
|
package/modal/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/modal/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,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O,EACL,oBAAC,cAAc,IACb,SAAS,EAAE,cAAc,EACzB,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,EACpC,OAAO,EAAC,eAAe,EACvB,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,kBAAkB,GAC3B;oCAGJ,8BAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,IAClD,MAAM,CACF,CACQ,CACb;4BACN,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,sBAAsB,EAAE,CAAC,IACtF,QAAQ,CACL;4BACL,MAAM,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM,IAAG,MAAM,CAAO,CACpD,CACF,CACI,CACR,CACoB,CACrB,CACV,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { KeyCode } from '../internal/keycode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { InternalButton } from '../button/internal';\nimport InternalHeader from '../header/internal';\nimport Portal from '../internal/components/portal';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { FormFieldContext } from '../internal/context/form-field-context';\n\nimport { disableBodyScrolling, enableBodyScrolling } from './body-scroll';\nimport { ModalProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { SomeRequired } from '../internal/types';\nimport FocusLock from '../internal/components/focus-lock';\nimport { useInternalI18n } from '../internal/i18n/context';\n\ntype InternalModalProps = SomeRequired<ModalProps, 'size' | 'closeAriaLabel'> & InternalBaseComponentProps;\n\nexport default function InternalModal({\n size,\n visible,\n header,\n children,\n footer,\n disableContentPaddings,\n onDismiss,\n modalRoot,\n __internalRootRef = null,\n ...rest\n}: InternalModalProps) {\n const instanceUniqueId = useUniqueId();\n const headerId = `${rest.id || instanceUniqueId}-header`;\n const lastMouseDownElementRef = useRef<HTMLElement | null>(null);\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n\n const i18n = useInternalI18n('modal');\n const closeAriaLabel = i18n('closeAriaLabel', rest.closeAriaLabel);\n\n const refObject = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(breakpointsRef, refObject, __internalRootRef);\n\n const isRefresh = useVisualRefresh();\n\n const baseProps = getBaseProps(rest);\n\n // enable body scroll and restore focus if unmounting while visible\n useEffect(() => {\n return () => {\n enableBodyScrolling();\n };\n }, []);\n\n // enable / disable body scroll\n useEffect(() => {\n if (visible) {\n disableBodyScrolling();\n } else {\n enableBodyScrolling();\n }\n }, [visible]);\n\n // Because we hide the element with styles (and not actually detach it from DOM), we need to scroll to top\n useEffect(() => {\n if (visible && refObject.current) {\n refObject.current.scrollTop = 0;\n }\n }, [visible]);\n\n const dismiss = (reason: string) => fireNonCancelableEvent(onDismiss, { reason });\n\n const onOverlayMouseDown = (event: React.MouseEvent) => {\n lastMouseDownElementRef.current = event.target as HTMLElement;\n };\n const onOverlayClick = (event: React.MouseEvent) => {\n const overlay = refObject.current;\n const lastClicked = lastMouseDownElementRef.current;\n\n if (event.target === overlay && lastClicked === overlay) {\n dismiss('overlay');\n }\n };\n const onCloseButtonClick = () => dismiss('closeButton');\n const escKeyHandler = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n dismiss('keyboard');\n }\n };\n\n return (\n <Portal container={modalRoot}>\n <FormFieldContext.Provider value={{}}>\n <div\n {...baseProps}\n className={clsx(styles.root, { [styles.hidden]: !visible }, baseProps.className, isRefresh && styles.refresh)}\n role=\"dialog\"\n aria-modal={true}\n aria-labelledby={headerId}\n onMouseDown={onOverlayMouseDown}\n onClick={onOverlayClick}\n ref={mergedRef}\n >\n <FocusLock disabled={!visible} autoFocus={true} restoreFocus={true} className={styles['focus-lock']}>\n <div\n className={clsx(\n styles.dialog,\n styles[size],\n styles[`breakpoint-${breakpoint}`],\n isRefresh && styles.refresh\n )}\n onKeyDown={escKeyHandler}\n tabIndex={-1}\n >\n <div className={styles.container}>\n <div className={styles.header}>\n <InternalHeader\n variant=\"h2\"\n __disableActionsWrapping={true}\n actions={\n <InternalButton\n ariaLabel={closeAriaLabel}\n className={styles['dismiss-control']}\n variant=\"modal-dismiss\"\n iconName=\"close\"\n formAction=\"none\"\n onClick={onCloseButtonClick}\n />\n }\n >\n <span id={headerId} className={styles['header--text']}>\n {header}\n </span>\n </InternalHeader>\n </div>\n <div className={clsx(styles.content, { [styles['no-paddings']]: disableContentPaddings })}>\n {children}\n </div>\n {footer && <div className={styles.footer}>{footer}</div>}\n </div>\n </div>\n </FocusLock>\n </div>\n </FormFieldContext.Provider>\n </Portal>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/modal/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;A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AAI,EACZ,wBAAwB,EAAE,IAAI,EAC9B,OAAO,EACL,oBAAC,cAAc,IACb,SAAS,EAAE,cAAc,EACzB,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,EACpC,OAAO,EAAC,eAAe,EACvB,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,kBAAkB,GAC3B;oCAGJ,8BAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,IAClD,MAAM,CACF,CACQ,CACb;4BACN,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,sBAAsB,EAAE,CAAC;gCACtF,QAAQ;gCACT,6BAAK,GAAG,EAAE,iBAAiB,GAAI,CAC3B;4BACL,MAAM,IAAI,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC,IAAG,MAAM,CAAO,CAClG,CACF,CACI,CACR,CACoB,CACrB,CACV,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { KeyCode } from '../internal/keycode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { InternalButton } from '../button/internal';\nimport InternalHeader from '../header/internal';\nimport Portal from '../internal/components/portal';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { FormFieldContext } from '../internal/context/form-field-context';\n\nimport { disableBodyScrolling, enableBodyScrolling } from './body-scroll';\nimport { ModalProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { SomeRequired } from '../internal/types';\nimport FocusLock from '../internal/components/focus-lock';\nimport { useInternalI18n } from '../internal/i18n/context';\nimport { useIntersectionObserver } from '../internal/hooks/use-intersection-observer';\n\ntype InternalModalProps = SomeRequired<ModalProps, 'size' | 'closeAriaLabel'> & InternalBaseComponentProps;\n\nexport default function InternalModal({\n size,\n visible,\n header,\n children,\n footer,\n disableContentPaddings,\n onDismiss,\n modalRoot,\n __internalRootRef = null,\n ...rest\n}: InternalModalProps) {\n const instanceUniqueId = useUniqueId();\n const headerId = `${rest.id || instanceUniqueId}-header`;\n const lastMouseDownElementRef = useRef<HTMLElement | null>(null);\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n\n const i18n = useInternalI18n('modal');\n const closeAriaLabel = i18n('closeAriaLabel', rest.closeAriaLabel);\n\n const refObject = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(breakpointsRef, refObject, __internalRootRef);\n\n const isRefresh = useVisualRefresh();\n\n const baseProps = getBaseProps(rest);\n\n // enable body scroll and restore focus if unmounting while visible\n useEffect(() => {\n return () => {\n enableBodyScrolling();\n };\n }, []);\n\n // enable / disable body scroll\n useEffect(() => {\n if (visible) {\n disableBodyScrolling();\n } else {\n enableBodyScrolling();\n }\n }, [visible]);\n\n // Because we hide the element with styles (and not actually detach it from DOM), we need to scroll to top\n useEffect(() => {\n if (visible && refObject.current) {\n refObject.current.scrollTop = 0;\n }\n }, [visible]);\n\n const dismiss = (reason: string) => fireNonCancelableEvent(onDismiss, { reason });\n\n const onOverlayMouseDown = (event: React.MouseEvent) => {\n lastMouseDownElementRef.current = event.target as HTMLElement;\n };\n const onOverlayClick = (event: React.MouseEvent) => {\n const overlay = refObject.current;\n const lastClicked = lastMouseDownElementRef.current;\n\n if (event.target === overlay && lastClicked === overlay) {\n dismiss('overlay');\n }\n };\n const onCloseButtonClick = () => dismiss('closeButton');\n const escKeyHandler = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n dismiss('keyboard');\n }\n };\n\n // We use an empty div element at the end of the content slot as a sentinel\n // to detect when the user has scrolled to the bottom.\n const { ref: stickySentinelRef, isIntersecting: footerStuck } = useIntersectionObserver();\n\n return (\n <Portal container={modalRoot}>\n <FormFieldContext.Provider value={{}}>\n <div\n {...baseProps}\n className={clsx(styles.root, { [styles.hidden]: !visible }, baseProps.className, isRefresh && styles.refresh)}\n role=\"dialog\"\n aria-modal={true}\n aria-labelledby={headerId}\n onMouseDown={onOverlayMouseDown}\n onClick={onOverlayClick}\n ref={mergedRef}\n >\n <FocusLock disabled={!visible} autoFocus={true} restoreFocus={true} className={styles['focus-lock']}>\n <div\n className={clsx(\n styles.dialog,\n styles[size],\n styles[`breakpoint-${breakpoint}`],\n isRefresh && styles.refresh\n )}\n onKeyDown={escKeyHandler}\n tabIndex={-1}\n >\n <div className={styles.container}>\n <div className={styles.header}>\n <InternalHeader\n variant=\"h2\"\n __disableActionsWrapping={true}\n actions={\n <InternalButton\n ariaLabel={closeAriaLabel}\n className={styles['dismiss-control']}\n variant=\"modal-dismiss\"\n iconName=\"close\"\n formAction=\"none\"\n onClick={onCloseButtonClick}\n />\n }\n >\n <span id={headerId} className={styles['header--text']}>\n {header}\n </span>\n </InternalHeader>\n </div>\n <div className={clsx(styles.content, { [styles['no-paddings']]: disableContentPaddings })}>\n {children}\n <div ref={stickySentinelRef} />\n </div>\n {footer && <div className={clsx(styles.footer, footerStuck && styles['footer--stuck'])}>{footer}</div>}\n </div>\n </div>\n </FocusLock>\n </div>\n </FormFieldContext.Provider>\n </Portal>\n );\n}\n"]}
|
package/modal/styles.css.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"dialog": "
|
|
5
|
-
"modal-slide-up": "awsui_modal-slide-
|
|
6
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
7
|
-
"refresh": "
|
|
8
|
-
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-
|
|
9
|
-
"root": "
|
|
10
|
-
"awsui-motion-fade-in": "awsui_awsui-motion-fade-
|
|
11
|
-
"hidden": "
|
|
12
|
-
"focus-lock": "awsui_focus-
|
|
13
|
-
"small": "
|
|
14
|
-
"medium": "
|
|
15
|
-
"large": "
|
|
16
|
-
"max": "
|
|
17
|
-
"breakpoint-xs": "awsui_breakpoint-
|
|
18
|
-
"container": "
|
|
19
|
-
"content": "
|
|
20
|
-
"no-paddings": "awsui_no-
|
|
21
|
-
"header": "
|
|
22
|
-
"header--text": "awsui_header--
|
|
23
|
-
"footer": "
|
|
24
|
-
"
|
|
25
|
-
"
|
|
4
|
+
"dialog": "awsui_dialog_1d2i7_1ij78_105",
|
|
5
|
+
"modal-slide-up": "awsui_modal-slide-up_1d2i7_1ij78_1",
|
|
6
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_1d2i7_1ij78_1",
|
|
7
|
+
"refresh": "awsui_refresh_1d2i7_1ij78_128",
|
|
8
|
+
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_1d2i7_1ij78_1",
|
|
9
|
+
"root": "awsui_root_1d2i7_1ij78_161",
|
|
10
|
+
"awsui-motion-fade-in": "awsui_awsui-motion-fade-in_1d2i7_1ij78_1",
|
|
11
|
+
"hidden": "awsui_hidden_1d2i7_1ij78_226",
|
|
12
|
+
"focus-lock": "awsui_focus-lock_1d2i7_1ij78_230",
|
|
13
|
+
"small": "awsui_small_1d2i7_1ij78_248",
|
|
14
|
+
"medium": "awsui_medium_1d2i7_1ij78_251",
|
|
15
|
+
"large": "awsui_large_1d2i7_1ij78_254",
|
|
16
|
+
"max": "awsui_max_1d2i7_1ij78_257",
|
|
17
|
+
"breakpoint-xs": "awsui_breakpoint-xs_1d2i7_1ij78_257",
|
|
18
|
+
"container": "awsui_container_1d2i7_1ij78_262",
|
|
19
|
+
"content": "awsui_content_1d2i7_1ij78_281",
|
|
20
|
+
"no-paddings": "awsui_no-paddings_1d2i7_1ij78_284",
|
|
21
|
+
"header": "awsui_header_1d2i7_1ij78_288",
|
|
22
|
+
"header--text": "awsui_header--text_1d2i7_1ij78_295",
|
|
23
|
+
"footer": "awsui_footer_1d2i7_1ij78_299",
|
|
24
|
+
"footer--stuck": "awsui_footer--stuck_1d2i7_1ij78_306",
|
|
25
|
+
"dismiss-control": "awsui_dismiss-control_1d2i7_1ij78_315",
|
|
26
|
+
"modal-open": "awsui_modal-open_1d2i7_1ij78_319"
|
|
26
27
|
};
|
|
27
28
|
|
package/modal/styles.scoped.css
CHANGED
|
@@ -94,7 +94,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
94
94
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
95
95
|
SPDX-License-Identifier: Apache-2.0
|
|
96
96
|
*/
|
|
97
|
-
@keyframes awsui_modal-slide-
|
|
97
|
+
@keyframes awsui_modal-slide-up_1d2i7_1ij78_1 {
|
|
98
98
|
0% {
|
|
99
99
|
transform: translate(0, 10px);
|
|
100
100
|
}
|
|
@@ -102,12 +102,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
102
102
|
transform: translate(0, 0);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
.
|
|
106
|
-
animation: awsui_modal-slide-
|
|
105
|
+
.awsui_dialog_1d2i7_1ij78_105:not(#\9) {
|
|
106
|
+
animation: awsui_modal-slide-up_1d2i7_1ij78_1 var(--motion-duration-slow-0273ow, 180ms) ease-out, awsui_awsui-motion-fade-in-0_1d2i7_1ij78_1 var(--motion-duration-slow-0273ow, 180ms) ease-out;
|
|
107
107
|
animation-delay: var(--motion-duration-fast-nk2ap0, 90ms);
|
|
108
108
|
animation-fill-mode: both;
|
|
109
109
|
}
|
|
110
|
-
@keyframes awsui_awsui-motion-fade-in-
|
|
110
|
+
@keyframes awsui_awsui-motion-fade-in-0_1d2i7_1ij78_1 {
|
|
111
111
|
from {
|
|
112
112
|
opacity: 0;
|
|
113
113
|
}
|
|
@@ -116,22 +116,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
@media (prefers-reduced-motion: reduce) {
|
|
119
|
-
.
|
|
119
|
+
.awsui_dialog_1d2i7_1ij78_105:not(#\9) {
|
|
120
120
|
animation: none;
|
|
121
121
|
transition: none;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
.awsui-motion-disabled .
|
|
124
|
+
.awsui-motion-disabled .awsui_dialog_1d2i7_1ij78_105:not(#\9), .awsui-mode-entering .awsui_dialog_1d2i7_1ij78_105:not(#\9) {
|
|
125
125
|
animation: none;
|
|
126
126
|
transition: none;
|
|
127
127
|
}
|
|
128
|
-
.
|
|
129
|
-
animation: awsui_awsui-motion-scale-
|
|
128
|
+
.awsui_dialog_1d2i7_1ij78_105.awsui_refresh_1d2i7_1ij78_128:not(#\9) {
|
|
129
|
+
animation: awsui_awsui-motion-scale-popup_1d2i7_1ij78_1, awsui_awsui-motion-fade-in-0_1d2i7_1ij78_1;
|
|
130
130
|
animation-duration: var(--motion-duration-refresh-only-fast-addxjd, 115ms);
|
|
131
131
|
animation-timing-function: var(--motion-easing-refresh-only-a-sy0g8m, cubic-bezier(0, 0, 0, 1));
|
|
132
132
|
animation-fill-mode: both;
|
|
133
133
|
}
|
|
134
|
-
@keyframes awsui_awsui-motion-fade-in-
|
|
134
|
+
@keyframes awsui_awsui-motion-fade-in-0_1d2i7_1ij78_1 {
|
|
135
135
|
from {
|
|
136
136
|
opacity: 0;
|
|
137
137
|
}
|
|
@@ -139,7 +139,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
139
139
|
opacity: 1;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
@keyframes awsui_awsui-motion-scale-
|
|
142
|
+
@keyframes awsui_awsui-motion-scale-popup_1d2i7_1ij78_1 {
|
|
143
143
|
0% {
|
|
144
144
|
transform: scale(0.95);
|
|
145
145
|
}
|
|
@@ -148,21 +148,21 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
@media (prefers-reduced-motion: reduce) {
|
|
151
|
-
.
|
|
151
|
+
.awsui_dialog_1d2i7_1ij78_105.awsui_refresh_1d2i7_1ij78_128:not(#\9) {
|
|
152
152
|
animation: none;
|
|
153
153
|
transition: none;
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
.awsui-motion-disabled .
|
|
156
|
+
.awsui-motion-disabled .awsui_dialog_1d2i7_1ij78_105.awsui_refresh_1d2i7_1ij78_128:not(#\9), .awsui-mode-entering .awsui_dialog_1d2i7_1ij78_105.awsui_refresh_1d2i7_1ij78_128:not(#\9) {
|
|
157
157
|
animation: none;
|
|
158
158
|
transition: none;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
.
|
|
162
|
-
animation: awsui_awsui-motion-fade-
|
|
161
|
+
.awsui_root_1d2i7_1ij78_161:not(#\9) {
|
|
162
|
+
animation: awsui_awsui-motion-fade-in_1d2i7_1ij78_1 var(--motion-duration-extra-slow-8ks5rs, 270ms) ease-out;
|
|
163
163
|
animation-fill-mode: both;
|
|
164
164
|
}
|
|
165
|
-
@keyframes awsui_awsui-motion-fade-
|
|
165
|
+
@keyframes awsui_awsui-motion-fade-in_1d2i7_1ij78_1 {
|
|
166
166
|
from {
|
|
167
167
|
opacity: 0.2;
|
|
168
168
|
}
|
|
@@ -171,25 +171,25 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
@media (prefers-reduced-motion: reduce) {
|
|
174
|
-
.
|
|
174
|
+
.awsui_root_1d2i7_1ij78_161:not(#\9) {
|
|
175
175
|
animation: none;
|
|
176
176
|
transition: none;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
.awsui-motion-disabled .
|
|
179
|
+
.awsui-motion-disabled .awsui_root_1d2i7_1ij78_161:not(#\9), .awsui-mode-entering .awsui_root_1d2i7_1ij78_161:not(#\9) {
|
|
180
180
|
animation: none;
|
|
181
181
|
transition: none;
|
|
182
182
|
}
|
|
183
|
-
.
|
|
183
|
+
.awsui_root_1d2i7_1ij78_161.awsui_refresh_1d2i7_1ij78_128:not(#\9) {
|
|
184
184
|
animation-duration: var(--motion-duration-refresh-only-fast-addxjd, 115ms);
|
|
185
185
|
}
|
|
186
186
|
@media (prefers-reduced-motion: reduce) {
|
|
187
|
-
.
|
|
187
|
+
.awsui_root_1d2i7_1ij78_161.awsui_refresh_1d2i7_1ij78_128:not(#\9) {
|
|
188
188
|
animation: none;
|
|
189
189
|
transition: none;
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
.awsui-motion-disabled .
|
|
192
|
+
.awsui-motion-disabled .awsui_root_1d2i7_1ij78_161.awsui_refresh_1d2i7_1ij78_128:not(#\9), .awsui-mode-entering .awsui_root_1d2i7_1ij78_161.awsui_refresh_1d2i7_1ij78_128:not(#\9) {
|
|
193
193
|
animation: none;
|
|
194
194
|
transition: none;
|
|
195
195
|
}
|
|
@@ -198,7 +198,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
198
198
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
199
199
|
SPDX-License-Identifier: Apache-2.0
|
|
200
200
|
*/
|
|
201
|
-
.
|
|
201
|
+
.awsui_root_1d2i7_1ij78_161:not(#\9) {
|
|
202
202
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
203
203
|
border-collapse: separate;
|
|
204
204
|
border-spacing: 0;
|
|
@@ -249,11 +249,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
249
249
|
overflow: auto;
|
|
250
250
|
cursor: pointer;
|
|
251
251
|
}
|
|
252
|
-
.
|
|
252
|
+
.awsui_root_1d2i7_1ij78_161.awsui_hidden_1d2i7_1ij78_226:not(#\9) {
|
|
253
253
|
display: none;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
.awsui_focus-
|
|
256
|
+
.awsui_focus-lock_1d2i7_1ij78_230:not(#\9) {
|
|
257
257
|
align-self: flex-start;
|
|
258
258
|
margin: auto;
|
|
259
259
|
padding: var(--space-s-hv8c1d, 12px) 0;
|
|
@@ -261,7 +261,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
261
261
|
pointer-events: none;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
.
|
|
264
|
+
.awsui_dialog_1d2i7_1ij78_105:not(#\9) {
|
|
265
265
|
position: static;
|
|
266
266
|
top: 0;
|
|
267
267
|
transform: translate(0, 0);
|
|
@@ -271,21 +271,21 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
271
271
|
z-index: 5000;
|
|
272
272
|
pointer-events: all;
|
|
273
273
|
}
|
|
274
|
-
.
|
|
274
|
+
.awsui_dialog_1d2i7_1ij78_105.awsui_small_1d2i7_1ij78_248:not(#\9) {
|
|
275
275
|
max-width: 320px;
|
|
276
276
|
}
|
|
277
|
-
.
|
|
277
|
+
.awsui_dialog_1d2i7_1ij78_105.awsui_medium_1d2i7_1ij78_251:not(#\9) {
|
|
278
278
|
max-width: 600px;
|
|
279
279
|
}
|
|
280
|
-
.
|
|
280
|
+
.awsui_dialog_1d2i7_1ij78_105.awsui_large_1d2i7_1ij78_254:not(#\9) {
|
|
281
281
|
max-width: 820px;
|
|
282
282
|
}
|
|
283
|
-
.
|
|
283
|
+
.awsui_dialog_1d2i7_1ij78_105.awsui_max_1d2i7_1ij78_257.awsui_breakpoint-xs_1d2i7_1ij78_257:not(#\9) {
|
|
284
284
|
max-width: calc(100vw - (2 * 4 * 10px + var(--space-xxxl-bo9z7f, 40px)));
|
|
285
285
|
margin: auto;
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
.
|
|
288
|
+
.awsui_container_1d2i7_1ij78_262:not(#\9) {
|
|
289
289
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
290
290
|
border-collapse: separate;
|
|
291
291
|
border-spacing: 0;
|
|
@@ -330,39 +330,45 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
330
330
|
box-shadow: var(--shadow-modal-3qhlqt, 0px 4px 20px 1px rgba(0, 7, 22, 0.1));
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
-
.
|
|
333
|
+
.awsui_content_1d2i7_1ij78_281:not(#\9) {
|
|
334
334
|
padding: var(--space-container-content-top-fsd8nr, 0px) var(--space-modal-horizontal-ah0xld, 20px) var(--space-modal-content-bottom-cecclv, 16px);
|
|
335
335
|
}
|
|
336
|
-
.
|
|
336
|
+
.awsui_content_1d2i7_1ij78_281.awsui_no-paddings_1d2i7_1ij78_284:not(#\9) {
|
|
337
337
|
padding: 0;
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
-
.
|
|
340
|
+
.awsui_header_1d2i7_1ij78_288:not(#\9) {
|
|
341
341
|
padding: var(--space-s-hv8c1d, 12px) var(--space-modal-horizontal-ah0xld, 20px);
|
|
342
342
|
background-color: var(--color-background-container-header-4flbq5, #ffffff);
|
|
343
343
|
border-bottom: 1px solid var(--color-border-container-divider-4ade7z, transparent);
|
|
344
344
|
border-radius: var(--border-radius-container-gh9ysk, 16px) var(--border-radius-container-gh9ysk, 16px) 0 0;
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
-
.awsui_header--
|
|
347
|
+
.awsui_header--text_1d2i7_1ij78_295:not(#\9) {
|
|
348
348
|
/* used in test-utils */
|
|
349
349
|
}
|
|
350
350
|
|
|
351
|
-
.
|
|
351
|
+
.awsui_footer_1d2i7_1ij78_299:not(#\9) {
|
|
352
352
|
border-top: var(--border-divider-section-width-4wm2it, 2px) solid var(--color-border-divider-default-7s2wjw, #e9ebed);
|
|
353
353
|
padding: var(--space-scaled-s-cu1hzn, 12px) var(--space-container-horizontal-tlw03i, 20px);
|
|
354
|
+
background-color: var(--color-background-container-content-i8i4a0, #ffffff);
|
|
355
|
+
position: sticky;
|
|
356
|
+
bottom: 0;
|
|
357
|
+
}
|
|
358
|
+
.awsui_footer--stuck_1d2i7_1ij78_306:not(#\9) {
|
|
359
|
+
border-radius: 0 0 var(--border-radius-container-gh9ysk, 16px) var(--border-radius-container-gh9ysk, 16px);
|
|
354
360
|
}
|
|
355
|
-
.
|
|
361
|
+
.awsui_footer_1d2i7_1ij78_299:not(#\9):after {
|
|
356
362
|
content: "";
|
|
357
363
|
display: table;
|
|
358
364
|
clear: both;
|
|
359
365
|
}
|
|
360
366
|
|
|
361
|
-
.awsui_dismiss-
|
|
367
|
+
.awsui_dismiss-control_1d2i7_1ij78_315:not(#\9) {
|
|
362
368
|
/* used in test-utils */
|
|
363
369
|
}
|
|
364
370
|
|
|
365
|
-
.awsui_modal-
|
|
371
|
+
.awsui_modal-open_1d2i7_1ij78_319:not(#\9) {
|
|
366
372
|
overflow: hidden;
|
|
367
373
|
/*
|
|
368
374
|
* When padding-right is added to account for scrollbar being turned
|
|
@@ -2,27 +2,28 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"dialog": "
|
|
6
|
-
"modal-slide-up": "awsui_modal-slide-
|
|
7
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
8
|
-
"refresh": "
|
|
9
|
-
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-
|
|
10
|
-
"root": "
|
|
11
|
-
"awsui-motion-fade-in": "awsui_awsui-motion-fade-
|
|
12
|
-
"hidden": "
|
|
13
|
-
"focus-lock": "awsui_focus-
|
|
14
|
-
"small": "
|
|
15
|
-
"medium": "
|
|
16
|
-
"large": "
|
|
17
|
-
"max": "
|
|
18
|
-
"breakpoint-xs": "awsui_breakpoint-
|
|
19
|
-
"container": "
|
|
20
|
-
"content": "
|
|
21
|
-
"no-paddings": "awsui_no-
|
|
22
|
-
"header": "
|
|
23
|
-
"header--text": "awsui_header--
|
|
24
|
-
"footer": "
|
|
25
|
-
"
|
|
26
|
-
"
|
|
5
|
+
"dialog": "awsui_dialog_1d2i7_1ij78_105",
|
|
6
|
+
"modal-slide-up": "awsui_modal-slide-up_1d2i7_1ij78_1",
|
|
7
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_1d2i7_1ij78_1",
|
|
8
|
+
"refresh": "awsui_refresh_1d2i7_1ij78_128",
|
|
9
|
+
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_1d2i7_1ij78_1",
|
|
10
|
+
"root": "awsui_root_1d2i7_1ij78_161",
|
|
11
|
+
"awsui-motion-fade-in": "awsui_awsui-motion-fade-in_1d2i7_1ij78_1",
|
|
12
|
+
"hidden": "awsui_hidden_1d2i7_1ij78_226",
|
|
13
|
+
"focus-lock": "awsui_focus-lock_1d2i7_1ij78_230",
|
|
14
|
+
"small": "awsui_small_1d2i7_1ij78_248",
|
|
15
|
+
"medium": "awsui_medium_1d2i7_1ij78_251",
|
|
16
|
+
"large": "awsui_large_1d2i7_1ij78_254",
|
|
17
|
+
"max": "awsui_max_1d2i7_1ij78_257",
|
|
18
|
+
"breakpoint-xs": "awsui_breakpoint-xs_1d2i7_1ij78_257",
|
|
19
|
+
"container": "awsui_container_1d2i7_1ij78_262",
|
|
20
|
+
"content": "awsui_content_1d2i7_1ij78_281",
|
|
21
|
+
"no-paddings": "awsui_no-paddings_1d2i7_1ij78_284",
|
|
22
|
+
"header": "awsui_header_1d2i7_1ij78_288",
|
|
23
|
+
"header--text": "awsui_header--text_1d2i7_1ij78_295",
|
|
24
|
+
"footer": "awsui_footer_1d2i7_1ij78_299",
|
|
25
|
+
"footer--stuck": "awsui_footer--stuck_1d2i7_1ij78_306",
|
|
26
|
+
"dismiss-control": "awsui_dismiss-control_1d2i7_1ij78_315",
|
|
27
|
+
"modal-open": "awsui_modal-open_1d2i7_1ij78_319"
|
|
27
28
|
};
|
|
28
29
|
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/property-filter/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAY9E,OAAO,EAAE,mBAAmB,EAAiE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/property-filter/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAY9E,OAAO,EAAE,mBAAmB,EAAiE,MAAM,cAAc,CAAC;AAmBlH,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAa/B,QAAA,MAAM,cAAc,qGAiUnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
|
package/property-filter/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { getBaseProps } from '../internal/base-component';
|
|
|
9
9
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
10
10
|
import { KeyCode } from '../internal/keycode';
|
|
11
11
|
import SelectToggle from '../token-group/toggle';
|
|
12
|
-
import { generateUniqueId } from '../internal/hooks/use-unique-id/index';
|
|
12
|
+
import { generateUniqueId, useUniqueId } from '../internal/hooks/use-unique-id/index';
|
|
13
13
|
import { fireNonCancelableEvent } from '../internal/events';
|
|
14
14
|
import { TokenButton } from './token';
|
|
15
15
|
import { getQueryActions, parseText, getAutosuggestOptions, getAllowedOperators, getExtendedOperator, } from './controller';
|
|
@@ -20,6 +20,7 @@ import PropertyFilterAutosuggest from './property-filter-autosuggest';
|
|
|
20
20
|
import { PropertyEditor } from './property-editor';
|
|
21
21
|
import { matchTokenValue } from './utils';
|
|
22
22
|
import { useInternalI18n } from '../internal/i18n/context';
|
|
23
|
+
import { SearchResults } from '../text-filter/search-results';
|
|
23
24
|
const OPERATOR_I18N_MAPPING = {
|
|
24
25
|
'=': 'equals',
|
|
25
26
|
'!=': 'not_equals',
|
|
@@ -47,7 +48,7 @@ const PropertyFilter = React.forwardRef((_a, ref) => {
|
|
|
47
48
|
}) });
|
|
48
49
|
useImperativeHandle(ref, () => ({ focus: () => { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }), []);
|
|
49
50
|
const { tokens, operation } = query;
|
|
50
|
-
const showResults = (tokens === null || tokens === void 0 ? void 0 : tokens.length) && !disabled;
|
|
51
|
+
const showResults = !!(tokens === null || tokens === void 0 ? void 0 : tokens.length) && !disabled && !!countText;
|
|
51
52
|
const { addToken, removeToken, setToken, setOperation, removeAllTokens } = getQueryActions(query, onChange, inputRef);
|
|
52
53
|
const [filteringText, setFilteringText] = useState('');
|
|
53
54
|
const parsedText = parseText(filteringText, filteringProperties, disableFreeTextFiltering);
|
|
@@ -152,6 +153,7 @@ const PropertyFilter = React.forwardRef((_a, ref) => {
|
|
|
152
153
|
const controlId = useMemo(() => generateUniqueId(), []);
|
|
153
154
|
const operatorForm = parsedText.step === 'property' &&
|
|
154
155
|
((_b = getExtendedOperator(filteringProperties, parsedText.property.key, parsedText.operator)) === null || _b === void 0 ? void 0 : _b.form);
|
|
156
|
+
const searchResultsId = useUniqueId('property-filter-search-results');
|
|
155
157
|
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: __internalRootRef }),
|
|
156
158
|
React.createElement("div", { className: styles['search-field'] },
|
|
157
159
|
customControl && React.createElement("div", { className: styles['custom-control'] }, customControl),
|
|
@@ -166,8 +168,8 @@ const PropertyFilter = React.forwardRef((_a, ref) => {
|
|
|
166
168
|
setFilteringText('');
|
|
167
169
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventDropdown: true });
|
|
168
170
|
(_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.close();
|
|
169
|
-
} })), hideEnteredTextOption: disableFreeTextFiltering && parsedText.step !== 'property', clearAriaLabel: i18nStrings.clearAriaLabel })),
|
|
170
|
-
React.createElement(
|
|
171
|
+
} })), hideEnteredTextOption: disableFreeTextFiltering && parsedText.step !== 'property', clearAriaLabel: i18nStrings.clearAriaLabel, searchResultsId: showResults ? searchResultsId : undefined })),
|
|
172
|
+
showResults ? React.createElement(SearchResults, { id: searchResultsId }, countText) : null),
|
|
171
173
|
tokens && tokens.length > 0 && (React.createElement("div", { className: styles.tokens },
|
|
172
174
|
React.createElement(InternalSpaceBetween, { size: "xs", direction: "horizontal", id: controlId },
|
|
173
175
|
slicedTokens.map((token, index) => (React.createElement(TokenButton, { token: token, first: index === 0, operation: operation, key: index, removeToken: () => removeToken(index), setToken: (newToken) => setToken(index, newToken), setOperation: setOperation, filteringOptions: filteringOptions, filteringProperties: filteringProperties, asyncProps: asyncProps, onLoadItems: onLoadItems, i18nStrings: i18nStrings, asyncProperties: asyncProperties, hideOperations: hideOperations, customGroupsText: customGroupsText, disableFreeTextFiltering: disableFreeTextFiltering, disabled: disabled, expandToViewport: expandToViewport }))),
|