@cloudscape-design/components 3.0.161 → 3.0.163
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/app-layout/visual-refresh/styles.css.js +60 -60
- package/app-layout/visual-refresh/styles.scoped.css +147 -147
- package/app-layout/visual-refresh/styles.selectors.js +60 -60
- package/button/internal.d.ts +1 -0
- package/button/internal.d.ts.map +1 -1
- package/button/internal.js +2 -2
- package/button/internal.js.map +1 -1
- package/code-editor/index.d.ts.map +1 -1
- package/code-editor/index.js +5 -8
- package/code-editor/index.js.map +1 -1
- package/code-editor/pane.d.ts.map +1 -1
- package/code-editor/pane.js +4 -4
- package/code-editor/pane.js.map +1 -1
- package/code-editor/resizable-box/index.d.ts +9 -0
- package/code-editor/resizable-box/index.d.ts.map +1 -0
- package/code-editor/resizable-box/index.js +44 -0
- package/code-editor/resizable-box/index.js.map +1 -0
- package/code-editor/resizable-box/styles.css.js +8 -0
- package/code-editor/resizable-box/styles.scoped.css +50 -0
- package/code-editor/resizable-box/styles.selectors.js +9 -0
- package/code-editor/styles.css.js +32 -33
- package/code-editor/styles.scoped.css +109 -139
- package/code-editor/styles.selectors.js +32 -33
- package/flashbar/styles.css.js +33 -33
- package/flashbar/styles.scoped.css +115 -115
- package/flashbar/styles.selectors.js +33 -33
- package/form-field/interfaces.d.ts +10 -0
- package/form-field/interfaces.d.ts.map +1 -1
- package/form-field/interfaces.js.map +1 -1
- package/form-field/internal.d.ts +1 -1
- package/form-field/internal.d.ts.map +1 -1
- package/form-field/internal.js +5 -4
- package/form-field/internal.js.map +1 -1
- package/input/internal.d.ts.map +1 -1
- package/input/internal.js +16 -4
- package/input/internal.js.map +1 -1
- package/internal/components/live-region/index.d.ts +1 -1
- package/internal/components/live-region/index.d.ts.map +1 -1
- package/internal/components/live-region/index.js +29 -6
- package/internal/components/live-region/index.js.map +1 -1
- package/internal/context/form-field-context.d.ts +6 -2
- package/internal/context/form-field-context.d.ts.map +1 -1
- package/internal/context/form-field-context.js +7 -1
- package/internal/context/form-field-context.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/hooks/use-telemetry/index.d.ts.map +1 -1
- package/internal/hooks/use-telemetry/index.js +4 -0
- package/internal/hooks/use-telemetry/index.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/internal/metrics.d.ts +2 -2
- package/internal/metrics.d.ts.map +1 -1
- package/internal/metrics.js +20 -17
- package/internal/metrics.js.map +1 -1
- package/internal/types.d.ts +9 -0
- package/internal/types.d.ts.map +1 -1
- package/internal/types.js +0 -2
- package/internal/types.js.map +1 -1
- package/internal/vendor/d3-scale.js +8 -8
- package/mixed-line-bar-chart/styles.css.js +19 -19
- package/mixed-line-bar-chart/styles.scoped.css +26 -26
- package/mixed-line-bar-chart/styles.selectors.js +19 -19
- package/package.json +30 -34
- package/progress-bar/index.d.ts.map +1 -1
- package/progress-bar/index.js +14 -3
- package/progress-bar/index.js.map +1 -1
- package/select/parts/styles.css.js +9 -9
- package/select/parts/styles.scoped.css +27 -9
- package/select/parts/styles.selectors.js +9 -9
- package/side-navigation/internal.d.ts.map +1 -1
- package/side-navigation/internal.js +2 -2
- package/side-navigation/internal.js.map +1 -1
- package/table/body-cell/click-away.d.ts +9 -0
- package/table/body-cell/click-away.d.ts.map +1 -0
- package/table/body-cell/click-away.js +38 -0
- package/table/body-cell/click-away.js.map +1 -0
- package/table/body-cell/index.d.ts +10 -19
- package/table/body-cell/index.d.ts.map +1 -1
- package/table/body-cell/index.js +49 -9
- package/table/body-cell/index.js.map +1 -1
- package/table/body-cell/inline-editor.d.ts +12 -0
- package/table/body-cell/inline-editor.d.ts.map +1 -0
- package/table/body-cell/inline-editor.js +88 -0
- package/table/body-cell/inline-editor.js.map +1 -0
- package/table/body-cell/styles.css.js +18 -12
- package/table/body-cell/styles.scoped.css +229 -46
- package/table/body-cell/styles.selectors.js +18 -12
- package/table/body-cell/td-element.d.ts +21 -0
- package/table/body-cell/td-element.d.ts.map +1 -0
- package/table/body-cell/td-element.js +11 -0
- package/table/body-cell/td-element.js.map +1 -0
- package/table/body-cell/use-stable-scroll-position.d.ts +17 -0
- package/table/body-cell/use-stable-scroll-position.d.ts.map +1 -0
- package/table/body-cell/use-stable-scroll-position.js +48 -0
- package/table/body-cell/use-stable-scroll-position.js.map +1 -0
- package/table/header-cell/index.d.ts +8 -7
- package/table/header-cell/index.d.ts.map +1 -1
- package/table/header-cell/index.js +6 -2
- package/table/header-cell/index.js.map +1 -1
- package/table/header-cell/styles.css.js +19 -18
- package/table/header-cell/styles.scoped.css +40 -35
- package/table/header-cell/styles.selectors.js +19 -18
- package/table/interfaces.d.ts +73 -6
- package/table/interfaces.d.ts.map +1 -1
- package/table/interfaces.js.map +1 -1
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +68 -18
- package/table/internal.js.map +1 -1
- package/table/thead.d.ts.map +1 -1
- package/table/thead.js +1 -1
- package/table/thead.js.map +1 -1
- package/table/use-table-focus-navigation.d.ts +16 -0
- package/table/use-table-focus-navigation.d.ts.map +1 -0
- package/table/use-table-focus-navigation.js +131 -0
- package/table/use-table-focus-navigation.js.map +1 -0
- package/tabs/index.d.ts +1 -1
- package/tabs/index.d.ts.map +1 -1
- package/tabs/index.js +2 -2
- package/tabs/index.js.map +1 -1
- package/tabs/interfaces.d.ts +14 -0
- package/tabs/interfaces.d.ts.map +1 -1
- package/tabs/interfaces.js.map +1 -1
- package/tabs/tab-header-bar.d.ts +2 -1
- package/tabs/tab-header-bar.d.ts.map +1 -1
- package/tabs/tab-header-bar.js +3 -7
- package/tabs/tab-header-bar.js.map +1 -1
- package/test-utils/dom/table/index.d.ts +4 -0
- package/test-utils/dom/table/index.js +21 -5
- package/test-utils/dom/table/index.js.map +1 -1
- package/test-utils/selectors/table/index.d.ts +4 -0
- package/test-utils/selectors/table/index.js +21 -5
- package/test-utils/selectors/table/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/wizard/internal/analytics.js +3 -3
- package/wizard/internal/analytics.js.map +1 -1
- package/code-editor/resize-handler.d.ts +0 -3
- package/code-editor/resize-handler.d.ts.map +0 -1
- package/code-editor/resize-handler.js +0 -7
- package/code-editor/resize-handler.js.map +0 -1
- package/internal/components/dynamic-aria-live/index.d.ts +0 -28
- package/internal/components/dynamic-aria-live/index.d.ts.map +0 -1
- package/internal/components/dynamic-aria-live/index.js +0 -38
- package/internal/components/dynamic-aria-live/index.js.map +0 -1
- package/internal/components/live-region/aria-liva-tag.d.ts +0 -13
- package/internal/components/live-region/aria-liva-tag.d.ts.map +0 -1
- package/internal/components/live-region/aria-liva-tag.js +0 -18
- package/internal/components/live-region/aria-liva-tag.js.map +0 -1
- package/internal/components/live-region/utils.d.ts +0 -8
- package/internal/components/live-region/utils.d.ts.map +0 -1
- package/internal/components/live-region/utils.js +0 -24
- package/internal/components/live-region/utils.js.map +0 -1
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import styles from './styles.css.js';
|
|
5
|
-
var ResizeHandler = React.createElement("span", { className: styles['resizable-box-handle'] });
|
|
6
|
-
export default ResizeHandler;
|
|
7
|
-
//# sourceMappingURL=resize-handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resize-handler.js","sourceRoot":"","sources":["../../../src/code-editor/resize-handler.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,IAAM,aAAa,GAAG,8BAAM,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC,GAAI,CAAC;AAE1E,eAAe,aAAa,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport styles from './styles.css.js';\n\nconst ResizeHandler = <span className={styles['resizable-box-handle']} />;\n\nexport default ResizeHandler;\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ScreenreaderOnlyProps } from '../screenreader-only';
|
|
3
|
-
export interface DynamicAriaLiveProps extends ScreenreaderOnlyProps {
|
|
4
|
-
assertive?: boolean;
|
|
5
|
-
delay?: number;
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Dynamic aria live component is hidden in the layout, but visible for screen readers.
|
|
10
|
-
* Purpose of this component is to announce recurring changes for a content.
|
|
11
|
-
*
|
|
12
|
-
* To avoid merging words, provide all text nodes wrapped with elements, like:
|
|
13
|
-
* <LiveRegion>
|
|
14
|
-
* <span>{title}</span>
|
|
15
|
-
* <span><Details /></span>
|
|
16
|
-
* </LiveRegion>
|
|
17
|
-
* Or create a single text node if possible:
|
|
18
|
-
* <LiveRegion>
|
|
19
|
-
* {`${title} ${details}`}
|
|
20
|
-
* </LiveRegion>
|
|
21
|
-
*
|
|
22
|
-
* @param delay time value in milliseconds to set minimal time interval between announcements.
|
|
23
|
-
* @param assertive determine aria-live priority. Given value == false, aria-live have `polite` attribute value.
|
|
24
|
-
*/
|
|
25
|
-
declare const _default: React.MemoExoticComponent<typeof DynamicAriaLive>;
|
|
26
|
-
export default _default;
|
|
27
|
-
declare function DynamicAriaLive({ delay, children, ...restProps }: DynamicAriaLiveProps): JSX.Element;
|
|
28
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dynamic-aria-live/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;GAgBG;;AACH,wBAAqC;AAErC,iBAAS,eAAe,CAAC,EAAE,KAAY,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EAAE,oBAAoB,eAiBtF"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { __assign, __rest } from "tslib";
|
|
4
|
-
import React, { memo, useEffect, useMemo, useRef } from 'react';
|
|
5
|
-
import { throttle } from '../../utils/throttle';
|
|
6
|
-
import { updateLiveRegion } from '../live-region/utils';
|
|
7
|
-
import AriaLiveTag from '../live-region/aria-liva-tag';
|
|
8
|
-
/**
|
|
9
|
-
* Dynamic aria live component is hidden in the layout, but visible for screen readers.
|
|
10
|
-
* Purpose of this component is to announce recurring changes for a content.
|
|
11
|
-
*
|
|
12
|
-
* To avoid merging words, provide all text nodes wrapped with elements, like:
|
|
13
|
-
* <LiveRegion>
|
|
14
|
-
* <span>{title}</span>
|
|
15
|
-
* <span><Details /></span>
|
|
16
|
-
* </LiveRegion>
|
|
17
|
-
* Or create a single text node if possible:
|
|
18
|
-
* <LiveRegion>
|
|
19
|
-
* {`${title} ${details}`}
|
|
20
|
-
* </LiveRegion>
|
|
21
|
-
*
|
|
22
|
-
* @param delay time value in milliseconds to set minimal time interval between announcements.
|
|
23
|
-
* @param assertive determine aria-live priority. Given value == false, aria-live have `polite` attribute value.
|
|
24
|
-
*/
|
|
25
|
-
export default memo(DynamicAriaLive);
|
|
26
|
-
function DynamicAriaLive(_a) {
|
|
27
|
-
var _b = _a.delay, delay = _b === void 0 ? 5000 : _b, children = _a.children, restProps = __rest(_a, ["delay", "children"]);
|
|
28
|
-
var sourceRef = useRef(null);
|
|
29
|
-
var targetRef = useRef(null);
|
|
30
|
-
var throttledUpdate = useMemo(function () {
|
|
31
|
-
return throttle(function () { return updateLiveRegion(targetRef, sourceRef); }, delay);
|
|
32
|
-
}, [delay]);
|
|
33
|
-
useEffect(function () {
|
|
34
|
-
throttledUpdate();
|
|
35
|
-
});
|
|
36
|
-
return (React.createElement(AriaLiveTag, __assign({ targetRef: targetRef, sourceRef: sourceRef }, restProps), children));
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/dynamic-aria-live/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,WAAW,MAAM,8BAA8B,CAAC;AAQvD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAe,IAAI,CAAC,eAAe,CAAC,CAAC;AAErC,SAAS,eAAe,CAAC,EAA8D;IAA5D,IAAA,aAAY,EAAZ,KAAK,mBAAG,IAAI,KAAA,EAAE,QAAQ,cAAA,EAAK,SAAS,cAAtC,qBAAwC,CAAF;IAC7D,IAAM,SAAS,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAC;IAChD,IAAM,SAAS,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAC;IAEhD,IAAM,eAAe,GAAG,OAAO,CAAC;QAC9B,OAAO,QAAQ,CAAC,cAAM,OAAA,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,EAAtC,CAAsC,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,SAAS,CAAC;QACR,eAAe,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,WAAW,aAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,IAAM,SAAS,GACnE,QAAQ,CACG,CACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { memo, useEffect, useMemo, useRef } from 'react';\nimport { throttle } from '../../utils/throttle';\nimport { ScreenreaderOnlyProps } from '../screenreader-only';\nimport { updateLiveRegion } from '../live-region/utils';\nimport AriaLiveTag from '../live-region/aria-liva-tag';\n\nexport interface DynamicAriaLiveProps extends ScreenreaderOnlyProps {\n assertive?: boolean;\n delay?: number;\n children: React.ReactNode;\n}\n\n/**\n * Dynamic aria live component is hidden in the layout, but visible for screen readers.\n * Purpose of this component is to announce recurring changes for a content.\n *\n * To avoid merging words, provide all text nodes wrapped with elements, like:\n * <LiveRegion>\n * <span>{title}</span>\n * <span><Details /></span>\n * </LiveRegion>\n * Or create a single text node if possible:\n * <LiveRegion>\n * {`${title} ${details}`}\n * </LiveRegion>\n *\n * @param delay time value in milliseconds to set minimal time interval between announcements.\n * @param assertive determine aria-live priority. Given value == false, aria-live have `polite` attribute value.\n */\nexport default memo(DynamicAriaLive);\n\nfunction DynamicAriaLive({ delay = 5000, children, ...restProps }: DynamicAriaLiveProps) {\n const sourceRef = useRef<HTMLSpanElement>(null);\n const targetRef = useRef<HTMLSpanElement>(null);\n\n const throttledUpdate = useMemo(() => {\n return throttle(() => updateLiveRegion(targetRef, sourceRef), delay);\n }, [delay]);\n\n useEffect(() => {\n throttledUpdate();\n });\n\n return (\n <AriaLiveTag targetRef={targetRef} sourceRef={sourceRef} {...restProps}>\n {children}\n </AriaLiveTag>\n );\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ScreenreaderOnlyProps } from '../screenreader-only/index.js';
|
|
3
|
-
export interface AriaLiveTagProps extends ScreenreaderOnlyProps {
|
|
4
|
-
assertive?: boolean;
|
|
5
|
-
visible?: boolean;
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
targetRef: React.RefObject<HTMLSpanElement>;
|
|
8
|
-
sourceRef: React.RefObject<HTMLSpanElement>;
|
|
9
|
-
}
|
|
10
|
-
declare const _default: React.MemoExoticComponent<typeof AriaLiveTag>;
|
|
11
|
-
export default _default;
|
|
12
|
-
declare function AriaLiveTag({ assertive, visible, targetRef, sourceRef, children, ...restProps }: AriaLiveTagProps): JSX.Element;
|
|
13
|
-
//# sourceMappingURL=aria-liva-tag.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aria-liva-tag.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/aria-liva-tag.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAe,MAAM,OAAO,CAAC;AACpC,OAAyB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAGxF,MAAM,WAAW,gBAAiB,SAAQ,qBAAqB;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAC5C,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;CAC7C;;AAED,wBAAiC;AAEjC,iBAAS,WAAW,CAAC,EACnB,SAAiB,EACjB,OAAe,EACf,SAAS,EACT,SAAS,EACT,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,gBAAgB,eAgBlB"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { __assign, __rest } from "tslib";
|
|
4
|
-
/* eslint-disable @cloudscape-design/prefer-live-region */
|
|
5
|
-
import clsx from 'clsx';
|
|
6
|
-
import React, { memo } from 'react';
|
|
7
|
-
import ScreenreaderOnly from '../screenreader-only/index.js';
|
|
8
|
-
import styles from './styles.css.js';
|
|
9
|
-
export default memo(AriaLiveTag);
|
|
10
|
-
function AriaLiveTag(_a) {
|
|
11
|
-
var _b = _a.assertive, assertive = _b === void 0 ? false : _b, _c = _a.visible, visible = _c === void 0 ? false : _c, targetRef = _a.targetRef, sourceRef = _a.sourceRef, children = _a.children, restProps = __rest(_a, ["assertive", "visible", "targetRef", "sourceRef", "children"]);
|
|
12
|
-
return (React.createElement(React.Fragment, null,
|
|
13
|
-
visible && React.createElement("span", { ref: sourceRef }, children),
|
|
14
|
-
React.createElement(ScreenreaderOnly, __assign({}, restProps, { className: clsx(styles.root, restProps.className) }),
|
|
15
|
-
!visible && (React.createElement("span", { ref: sourceRef, "aria-hidden": "true" }, children)),
|
|
16
|
-
React.createElement("span", { ref: targetRef, "aria-atomic": "true", "aria-live": assertive ? 'assertive' : 'polite' }))));
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=aria-liva-tag.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aria-liva-tag.js","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/aria-liva-tag.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,0DAA0D;AAE1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,gBAA2C,MAAM,+BAA+B,CAAC;AACxF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAUrC,eAAe,IAAI,CAAC,WAAW,CAAC,CAAC;AAEjC,SAAS,WAAW,CAAC,EAOF;IANjB,IAAA,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EACjB,eAAe,EAAf,OAAO,mBAAG,KAAK,KAAA,EACf,SAAS,eAAA,EACT,SAAS,eAAA,EACT,QAAQ,cAAA,EACL,SAAS,cANO,8DAOpB,CADa;IAEZ,OAAO,CACL;QACG,OAAO,IAAI,8BAAM,GAAG,EAAE,SAAS,IAAG,QAAQ,CAAQ;QAEnD,oBAAC,gBAAgB,eAAK,SAAS,IAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC;YAC/E,CAAC,OAAO,IAAI,CACX,8BAAM,GAAG,EAAE,SAAS,iBAAc,MAAM,IACrC,QAAQ,CACJ,CACR;YAED,8BAAM,GAAG,EAAE,SAAS,iBAAc,MAAM,eAAY,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,GAAS,CAC9E,CAClB,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @cloudscape-design/prefer-live-region */\n\nimport clsx from 'clsx';\nimport React, { memo } from 'react';\nimport ScreenreaderOnly, { ScreenreaderOnlyProps } from '../screenreader-only/index.js';\nimport styles from './styles.css.js';\n\nexport interface AriaLiveTagProps extends ScreenreaderOnlyProps {\n assertive?: boolean;\n visible?: boolean;\n children: React.ReactNode;\n targetRef: React.RefObject<HTMLSpanElement>;\n sourceRef: React.RefObject<HTMLSpanElement>;\n}\n\nexport default memo(AriaLiveTag);\n\nfunction AriaLiveTag({\n assertive = false,\n visible = false,\n targetRef,\n sourceRef,\n children,\n ...restProps\n}: AriaLiveTagProps) {\n return (\n <>\n {visible && <span ref={sourceRef}>{children}</span>}\n\n <ScreenreaderOnly {...restProps} className={clsx(styles.root, restProps.className)}>\n {!visible && (\n <span ref={sourceRef} aria-hidden=\"true\">\n {children}\n </span>\n )}\n\n <span ref={targetRef} aria-atomic=\"true\" aria-live={assertive ? 'assertive' : 'polite'}></span>\n </ScreenreaderOnly>\n </>\n );\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Updates text of the target node if it's differ from source node.
|
|
4
|
-
* @param targetRef - Ref to the element with aria-live
|
|
5
|
-
* @param sourceRef - Ref to the element to be announced
|
|
6
|
-
*/
|
|
7
|
-
export declare function updateLiveRegion(targetRef: React.RefObject<HTMLSpanElement>, sourceRef: React.RefObject<HTMLSpanElement>): void;
|
|
8
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,EAC3C,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,QAY5C"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Updates text of the target node if it's differ from source node.
|
|
3
|
-
* @param targetRef - Ref to the element with aria-live
|
|
4
|
-
* @param sourceRef - Ref to the element to be announced
|
|
5
|
-
*/
|
|
6
|
-
export function updateLiveRegion(targetRef, sourceRef) {
|
|
7
|
-
if (targetRef.current && sourceRef.current) {
|
|
8
|
-
var sourceContent = extractInnerText(sourceRef.current);
|
|
9
|
-
var targetContent = extractInnerText(targetRef.current);
|
|
10
|
-
if (targetContent !== sourceContent) {
|
|
11
|
-
// The aria-atomic does not work properly in Voice Over, causing
|
|
12
|
-
// certain parts of the content to be ignored. To fix that,
|
|
13
|
-
// we assign the source text content as a single node.
|
|
14
|
-
targetRef.current.innerText = sourceContent;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
// This only extracts text content from the node including all its children which is enough for now.
|
|
19
|
-
// To make it more powerful, it is possible to create a more sophisticated extractor with respect to
|
|
20
|
-
// ARIA properties to ignore aria-hidden nodes and read ARIA labels from the live content.
|
|
21
|
-
function extractInnerText(node) {
|
|
22
|
-
return (node.innerText || '').replace(/\s+/g, ' ').trim();
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/utils.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAA2C,EAC3C,SAA2C;IAE3C,IAAI,SAAS,CAAC,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE;QAC1C,IAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,aAAa,KAAK,aAAa,EAAE;YACnC,gEAAgE;YAChE,2DAA2D;YAC3D,sDAAsD;YACtD,SAAS,CAAC,OAAO,CAAC,SAAS,GAAG,aAAa,CAAC;SAC7C;KACF;AACH,CAAC;AAED,oGAAoG;AACpG,oGAAoG;AACpG,0FAA0F;AAC1F,SAAS,gBAAgB,CAAC,IAAiB;IACzC,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\n/**\n * Updates text of the target node if it's differ from source node.\n * @param targetRef - Ref to the element with aria-live\n * @param sourceRef - Ref to the element to be announced\n */\nexport function updateLiveRegion(\n targetRef: React.RefObject<HTMLSpanElement>,\n sourceRef: React.RefObject<HTMLSpanElement>\n) {\n if (targetRef.current && sourceRef.current) {\n const sourceContent = extractInnerText(sourceRef.current);\n const targetContent = extractInnerText(targetRef.current);\n if (targetContent !== sourceContent) {\n // The aria-atomic does not work properly in Voice Over, causing\n // certain parts of the content to be ignored. To fix that,\n // we assign the source text content as a single node.\n targetRef.current.innerText = sourceContent;\n }\n }\n}\n\n// This only extracts text content from the node including all its children which is enough for now.\n// To make it more powerful, it is possible to create a more sophisticated extractor with respect to\n// ARIA properties to ignore aria-hidden nodes and read ARIA labels from the live content.\nfunction extractInnerText(node: HTMLElement) {\n return (node.innerText || '').replace(/\\s+/g, ' ').trim();\n}\n"]}
|