@cloudscape-design/components 3.0.211 → 3.0.213

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 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAK1D,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAiGtC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,KAAK,EACL,YAAY,EACZ,WAAW,EACX,QAAgB,EAChB,SAAS,EACT,QAAQ,EACR,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,gBAAgB,EAChB,GAAG,IAAI,EACR,EAAE,0BAA0B,eAyF5B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAK1D,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,KAAK,EACL,YAAY,EACZ,WAAW,EACX,QAAgB,EAChB,SAAS,EACT,QAAQ,EACR,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,gBAAgB,EAChB,GAAG,IAAI,EACR,EAAE,0BAA0B,eA6I5B"}
@@ -15,23 +15,6 @@ import checkControlled from '../internal/hooks/check-controlled';
15
15
  import styles from './styles.css.js';
16
16
  import { applyDisplayName } from '../internal/utils/apply-display-name';
17
17
  import useBaseComponent from '../internal/hooks/use-base-component';
18
- var ModalContent = function (_a) {
19
- var _b = _a.preferences, preferences = _b === void 0 ? {} : _b, pageSizePreference = _a.pageSizePreference, wrapLinesPreference = _a.wrapLinesPreference, stripedRowsPreference = _a.stripedRowsPreference, contentDensityPreference = _a.contentDensityPreference, customPreference = _a.customPreference, visibleContentPreference = _a.visibleContentPreference, onChange = _a.onChange;
20
- if (!visibleContentPreference &&
21
- !pageSizePreference &&
22
- !wrapLinesPreference &&
23
- !stripedRowsPreference &&
24
- !contentDensityPreference &&
25
- customPreference) {
26
- return (React.createElement(CustomPreference, { value: preferences.custom, customPreference: customPreference, onChange: function (custom) { return onChange({ custom: custom }); } }));
27
- }
28
- return (React.createElement(ModalContentLayout, { left: React.createElement(InternalSpaceBetween, { size: "l" },
29
- pageSizePreference && (React.createElement(PageSizePreference, __assign({ value: preferences.pageSize }, pageSizePreference, { onChange: function (pageSize) { return onChange({ pageSize: pageSize }); } }))),
30
- wrapLinesPreference && (React.createElement(WrapLinesPreference, __assign({ value: preferences.wrapLines }, wrapLinesPreference, { onChange: function (wrapLines) { return onChange({ wrapLines: wrapLines }); } }))),
31
- stripedRowsPreference && (React.createElement(StripedRowsPreference, __assign({ value: preferences.stripedRows }, stripedRowsPreference, { onChange: function (stripedRows) { return onChange({ stripedRows: stripedRows }); } }))),
32
- contentDensityPreference && (React.createElement(ContentDensityPreference, __assign({ value: preferences.contentDensity }, contentDensityPreference, { onChange: function (contentDensity) { return onChange({ contentDensity: contentDensity }); } }))),
33
- customPreference && (React.createElement(CustomPreference, { value: preferences.custom, customPreference: customPreference, onChange: function (custom) { return onChange({ custom: custom }); } }))), right: visibleContentPreference && (React.createElement(VisibleContentPreference, __assign({ value: preferences.visibleContent }, visibleContentPreference, { onChange: function (visibleContent) { return onChange({ visibleContent: visibleContent }); } }))) }));
34
- };
35
18
  export default function CollectionPreferences(_a) {
36
19
  var title = _a.title, confirmLabel = _a.confirmLabel, cancelLabel = _a.cancelLabel, _b = _a.disabled, disabled = _b === void 0 ? false : _b, onConfirm = _a.onConfirm, onCancel = _a.onCancel, visibleContentPreference = _a.visibleContentPreference, pageSizePreference = _a.pageSizePreference, wrapLinesPreference = _a.wrapLinesPreference, stripedRowsPreference = _a.stripedRowsPreference, contentDensityPreference = _a.contentDensityPreference, preferences = _a.preferences, customPreference = _a.customPreference, rest = __rest(_a, ["title", "confirmLabel", "cancelLabel", "disabled", "onConfirm", "onCancel", "visibleContentPreference", "pageSizePreference", "wrapLinesPreference", "stripedRowsPreference", "contentDensityPreference", "preferences", "customPreference"]);
37
20
  var __internalRootRef = useBaseComponent('CollectionPreferences').__internalRootRef;
@@ -58,6 +41,15 @@ export default function CollectionPreferences(_a) {
58
41
  setModalVisible(false);
59
42
  setTemporaryPreferences(copyPreferences(preferences || {}));
60
43
  };
44
+ var hasLeftContent = !!(pageSizePreference ||
45
+ wrapLinesPreference ||
46
+ stripedRowsPreference ||
47
+ contentDensityPreference ||
48
+ customPreference);
49
+ var hasRightContent = !!visibleContentPreference;
50
+ var onChange = function (changedPreferences) {
51
+ return setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences));
52
+ };
61
53
  return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: __internalRootRef }),
62
54
  React.createElement(InternalButton, { ref: triggerRef, className: styles['trigger-button'], disabled: disabled, ariaLabel: title, onClick: function () {
63
55
  setTemporaryPreferences(copyPreferences(preferences || {}));
@@ -66,10 +58,13 @@ export default function CollectionPreferences(_a) {
66
58
  !disabled && modalVisible && (React.createElement(InternalModal, { className: styles['modal-root'], visible: true, header: title, footer: React.createElement(InternalBox, { float: "right" },
67
59
  React.createElement(InternalSpaceBetween, { direction: "horizontal", size: "xs" },
68
60
  React.createElement(InternalButton, { className: styles['cancel-button'], variant: "link", formAction: "none", onClick: onCancelListener }, cancelLabel),
69
- React.createElement(InternalButton, { className: styles['confirm-button'], variant: "primary", formAction: "none", onClick: onConfirmListener }, confirmLabel))), closeAriaLabel: cancelLabel, size: "large", onDismiss: onCancelListener },
70
- React.createElement(ModalContent, { preferences: temporaryPreferences, visibleContentPreference: visibleContentPreference, pageSizePreference: pageSizePreference, wrapLinesPreference: wrapLinesPreference, stripedRowsPreference: stripedRowsPreference, contentDensityPreference: contentDensityPreference, customPreference: customPreference, onChange: function (changedPreferences) {
71
- return setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences));
72
- } })))));
61
+ React.createElement(InternalButton, { className: styles['confirm-button'], variant: "primary", formAction: "none", onClick: onConfirmListener }, confirmLabel))), closeAriaLabel: cancelLabel, size: hasLeftContent && hasRightContent ? 'large' : 'medium', onDismiss: onCancelListener },
62
+ React.createElement(ModalContentLayout, { left: hasLeftContent && (React.createElement(InternalSpaceBetween, { size: "l" },
63
+ pageSizePreference && (React.createElement(PageSizePreference, __assign({ value: temporaryPreferences.pageSize }, pageSizePreference, { onChange: function (pageSize) { return onChange({ pageSize: pageSize }); } }))),
64
+ wrapLinesPreference && (React.createElement(WrapLinesPreference, __assign({ value: temporaryPreferences.wrapLines }, wrapLinesPreference, { onChange: function (wrapLines) { return onChange({ wrapLines: wrapLines }); } }))),
65
+ stripedRowsPreference && (React.createElement(StripedRowsPreference, __assign({ value: temporaryPreferences.stripedRows }, stripedRowsPreference, { onChange: function (stripedRows) { return onChange({ stripedRows: stripedRows }); } }))),
66
+ contentDensityPreference && (React.createElement(ContentDensityPreference, __assign({ value: temporaryPreferences.contentDensity }, contentDensityPreference, { onChange: function (contentDensity) { return onChange({ contentDensity: contentDensity }); } }))),
67
+ customPreference && (React.createElement(CustomPreference, { value: temporaryPreferences.custom, customPreference: customPreference, onChange: function (custom) { return onChange({ custom: custom }); } })))), right: visibleContentPreference && (React.createElement(VisibleContentPreference, __assign({ value: temporaryPreferences.visibleContent }, visibleContentPreference, { onChange: function (visibleContent) { return onChange({ visibleContent: visibleContent }); } }))) })))));
73
68
  }
74
69
  applyDisplayName(CollectionPreferences, 'CollectionPreferences');
75
70
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCA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;gBACxB,oBAAC,oBAAoB,IAAC,SAAS,EAAC,YAAY,EAAC,IAAI,EAAC,IAAI;oBACpD,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,EAClC,OAAO,EAAC,MAAM,EACd,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,gBAAgB,IAExB,WAAW,CACG;oBACjB,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAC,SAAS,EACjB,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,iBAAiB,IAEzB,YAAY,CACE,CACI,CACX,EAEhB,cAAc,EAAE,WAAW,EAC3B,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,gBAAgB;YAE3B,oBAAC,YAAY,IACX,WAAW,EAAE,oBAAoB,EACjC,wBAAwB,EAAE,wBAAwB,EAClD,kBAAkB,EAAE,kBAAkB,EACtC,mBAAmB,EAAE,mBAAmB,EACxC,qBAAqB,EAAE,qBAAqB,EAC5C,wBAAwB,EAAE,wBAAwB,EAClD,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,UAAA,kBAAkB;oBAC1B,OAAA,uBAAuB,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;gBAAnF,CAAmF,GAErF,CACY,CACjB,CACG,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { getBaseProps } from '../internal/base-component';\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport InternalModal from '../modal/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport {\n copyPreferences,\n mergePreferences,\n ModalContentLayout,\n PageSizePreference,\n WrapLinesPreference,\n StripedRowsPreference,\n ContentDensityPreference,\n CustomPreference,\n} from './utils';\nimport VisibleContentPreference from './visible-content';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { CollectionPreferencesProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { CollectionPreferencesProps };\n\ninterface ModalContentProps\n extends Pick<\n CollectionPreferencesProps,\n | 'preferences'\n | 'visibleContentPreference'\n | 'pageSizePreference'\n | 'wrapLinesPreference'\n | 'stripedRowsPreference'\n | 'contentDensityPreference'\n | 'customPreference'\n > {\n onChange: (preferences: CollectionPreferencesProps.Preferences) => void;\n}\n\nconst ModalContent = ({\n preferences = {},\n pageSizePreference,\n wrapLinesPreference,\n stripedRowsPreference,\n contentDensityPreference,\n customPreference,\n visibleContentPreference,\n onChange,\n}: ModalContentProps) => {\n if (\n !visibleContentPreference &&\n !pageSizePreference &&\n !wrapLinesPreference &&\n !stripedRowsPreference &&\n !contentDensityPreference &&\n customPreference\n ) {\n return (\n <CustomPreference\n value={preferences.custom}\n customPreference={customPreference}\n onChange={custom => onChange({ custom })}\n />\n );\n }\n\n return (\n <ModalContentLayout\n left={\n <InternalSpaceBetween size=\"l\">\n {pageSizePreference && (\n <PageSizePreference\n value={preferences.pageSize}\n {...pageSizePreference}\n onChange={pageSize => onChange({ pageSize })}\n />\n )}\n {wrapLinesPreference && (\n <WrapLinesPreference\n value={preferences.wrapLines}\n {...wrapLinesPreference}\n onChange={wrapLines => onChange({ wrapLines })}\n />\n )}\n {stripedRowsPreference && (\n <StripedRowsPreference\n value={preferences.stripedRows}\n {...stripedRowsPreference}\n onChange={stripedRows => onChange({ stripedRows })}\n />\n )}\n {contentDensityPreference && (\n <ContentDensityPreference\n value={preferences.contentDensity}\n {...contentDensityPreference}\n onChange={contentDensity => onChange({ contentDensity })}\n />\n )}\n {customPreference && (\n <CustomPreference\n value={preferences.custom}\n customPreference={customPreference}\n onChange={custom => onChange({ custom })}\n />\n )}\n </InternalSpaceBetween>\n }\n right={\n visibleContentPreference && (\n <VisibleContentPreference\n value={preferences.visibleContent}\n {...visibleContentPreference}\n onChange={visibleContent => onChange({ visibleContent })}\n />\n )\n }\n />\n );\n};\n\nexport default function CollectionPreferences({\n title,\n confirmLabel,\n cancelLabel,\n disabled = false,\n onConfirm,\n onCancel,\n visibleContentPreference,\n pageSizePreference,\n wrapLinesPreference,\n stripedRowsPreference,\n contentDensityPreference,\n preferences,\n customPreference,\n ...rest\n}: CollectionPreferencesProps) {\n const { __internalRootRef } = useBaseComponent('CollectionPreferences');\n checkControlled('CollectioPreferences', 'preferences', preferences, 'onConfirm', onConfirm);\n const baseProps = getBaseProps(rest);\n const [modalVisible, setModalVisible] = useState(false);\n const [temporaryPreferences, setTemporaryPreferences] = useState(copyPreferences(preferences || {}));\n const triggerRef = useRef<ButtonProps.Ref>(null);\n const dialogPreviouslyOpen = useRef(false);\n useEffect(() => {\n if (!modalVisible) {\n dialogPreviouslyOpen.current && triggerRef.current && triggerRef.current.focus();\n } else {\n dialogPreviouslyOpen.current = true;\n }\n }, [modalVisible]);\n\n const onConfirmListener = () => {\n setModalVisible(false);\n fireNonCancelableEvent(onConfirm, temporaryPreferences);\n };\n\n const onCancelListener = () => {\n fireNonCancelableEvent(onCancel, {});\n setModalVisible(false);\n setTemporaryPreferences(copyPreferences(preferences || {}));\n };\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <InternalButton\n ref={triggerRef}\n className={styles['trigger-button']}\n disabled={disabled}\n ariaLabel={title}\n onClick={() => {\n setTemporaryPreferences(copyPreferences(preferences || {}));\n setModalVisible(true);\n }}\n variant=\"icon\"\n iconName=\"settings\"\n formAction=\"none\"\n />\n {!disabled && modalVisible && (\n <InternalModal\n className={styles['modal-root']}\n visible={true}\n header={title}\n footer={\n <InternalBox float=\"right\">\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\">\n <InternalButton\n className={styles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n onClick={onCancelListener}\n >\n {cancelLabel}\n </InternalButton>\n <InternalButton\n className={styles['confirm-button']}\n variant=\"primary\"\n formAction=\"none\"\n onClick={onConfirmListener}\n >\n {confirmLabel}\n </InternalButton>\n </InternalSpaceBetween>\n </InternalBox>\n }\n closeAriaLabel={cancelLabel}\n size=\"large\"\n onDismiss={onCancelListener}\n >\n <ModalContent\n preferences={temporaryPreferences}\n visibleContentPreference={visibleContentPreference}\n pageSizePreference={pageSizePreference}\n wrapLinesPreference={wrapLinesPreference}\n stripedRowsPreference={stripedRowsPreference}\n contentDensityPreference={contentDensityPreference}\n customPreference={customPreference}\n onChange={changedPreferences =>\n setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences))\n }\n />\n </InternalModal>\n )}\n </div>\n );\n}\n\napplyDisplayName(CollectionPreferences, 'CollectionPreferences');\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAw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vB,QAAQ,EAAE,UAAA,SAAS,IAAI,OAAA,QAAQ,CAAC,EAAE,SAAS,WAAA,EAAE,CAAC,EAAvB,CAAuB,IAC9C,CACH;oBACA,qBAAqB,IAAI,CACxB,oBAAC,qBAAqB,aACpB,KAAK,EAAE,oBAAoB,CAAC,WAAW,IACnC,qBAAqB,IACzB,QAAQ,EAAE,UAAA,WAAW,IAAI,OAAA,QAAQ,CAAC,EAAE,WAAW,aAAA,EAAE,CAAC,EAAzB,CAAyB,IAClD,CACH;oBACA,wBAAwB,IAAI,CAC3B,oBAAC,wBAAwB,aACvB,KAAK,EAAE,oBAAoB,CAAC,cAAc,IACtC,wBAAwB,IAC5B,QAAQ,EAAE,UAAA,cAAc,IAAI,OAAA,QAAQ,CAAC,EAAE,cAAc,gBAAA,EAAE,CAAC,EAA5B,CAA4B,IACxD,CACH;oBACA,gBAAgB,IAAI,CACnB,oBAAC,gBAAgB,IACf,KAAK,EAAE,oBAAoB,CAAC,MAAM,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,UAAA,MAAM,IAAI,OAAA,QAAQ,CAAC,EAAE,MAAM,QAAA,EAAE,CAAC,EAApB,CAAoB,GACxC,CACH,CACoB,CACxB,EAEH,KAAK,EACH,wBAAwB,IAAI,CAC1B,oBAAC,wBAAwB,aACvB,KAAK,EAAE,oBAAoB,CAAC,cAAc,IACtC,wBAAwB,IAC5B,QAAQ,EAAE,UAAA,cAAc,IAAI,OAAA,QAAQ,CAAC,EAAE,cAAc,gBAAA,EAAE,CAAC,EAA5B,CAA4B,IACxD,CACH,GAEH,CACY,CACjB,CACG,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { getBaseProps } from '../internal/base-component';\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport InternalModal from '../modal/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport {\n copyPreferences,\n mergePreferences,\n ModalContentLayout,\n PageSizePreference,\n WrapLinesPreference,\n StripedRowsPreference,\n ContentDensityPreference,\n CustomPreference,\n} from './utils';\nimport VisibleContentPreference from './visible-content';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { CollectionPreferencesProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { CollectionPreferencesProps };\n\nexport default function CollectionPreferences({\n title,\n confirmLabel,\n cancelLabel,\n disabled = false,\n onConfirm,\n onCancel,\n visibleContentPreference,\n pageSizePreference,\n wrapLinesPreference,\n stripedRowsPreference,\n contentDensityPreference,\n preferences,\n customPreference,\n ...rest\n}: CollectionPreferencesProps) {\n const { __internalRootRef } = useBaseComponent('CollectionPreferences');\n checkControlled('CollectioPreferences', 'preferences', preferences, 'onConfirm', onConfirm);\n const baseProps = getBaseProps(rest);\n const [modalVisible, setModalVisible] = useState(false);\n const [temporaryPreferences, setTemporaryPreferences] = useState(copyPreferences(preferences || {}));\n const triggerRef = useRef<ButtonProps.Ref>(null);\n const dialogPreviouslyOpen = useRef(false);\n useEffect(() => {\n if (!modalVisible) {\n dialogPreviouslyOpen.current && triggerRef.current && triggerRef.current.focus();\n } else {\n dialogPreviouslyOpen.current = true;\n }\n }, [modalVisible]);\n\n const onConfirmListener = () => {\n setModalVisible(false);\n fireNonCancelableEvent(onConfirm, temporaryPreferences);\n };\n\n const onCancelListener = () => {\n fireNonCancelableEvent(onCancel, {});\n setModalVisible(false);\n setTemporaryPreferences(copyPreferences(preferences || {}));\n };\n\n const hasLeftContent = !!(\n pageSizePreference ||\n wrapLinesPreference ||\n stripedRowsPreference ||\n contentDensityPreference ||\n customPreference\n );\n const hasRightContent = !!visibleContentPreference;\n\n const onChange = (changedPreferences: CollectionPreferencesProps.Preferences) =>\n setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences));\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <InternalButton\n ref={triggerRef}\n className={styles['trigger-button']}\n disabled={disabled}\n ariaLabel={title}\n onClick={() => {\n setTemporaryPreferences(copyPreferences(preferences || {}));\n setModalVisible(true);\n }}\n variant=\"icon\"\n iconName=\"settings\"\n formAction=\"none\"\n />\n {!disabled && modalVisible && (\n <InternalModal\n className={styles['modal-root']}\n visible={true}\n header={title}\n footer={\n <InternalBox float=\"right\">\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\">\n <InternalButton\n className={styles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n onClick={onCancelListener}\n >\n {cancelLabel}\n </InternalButton>\n <InternalButton\n className={styles['confirm-button']}\n variant=\"primary\"\n formAction=\"none\"\n onClick={onConfirmListener}\n >\n {confirmLabel}\n </InternalButton>\n </InternalSpaceBetween>\n </InternalBox>\n }\n closeAriaLabel={cancelLabel}\n size={hasLeftContent && hasRightContent ? 'large' : 'medium'}\n onDismiss={onCancelListener}\n >\n <ModalContentLayout\n left={\n hasLeftContent && (\n <InternalSpaceBetween size=\"l\">\n {pageSizePreference && (\n <PageSizePreference\n value={temporaryPreferences.pageSize}\n {...pageSizePreference}\n onChange={pageSize => onChange({ pageSize })}\n />\n )}\n {wrapLinesPreference && (\n <WrapLinesPreference\n value={temporaryPreferences.wrapLines}\n {...wrapLinesPreference}\n onChange={wrapLines => onChange({ wrapLines })}\n />\n )}\n {stripedRowsPreference && (\n <StripedRowsPreference\n value={temporaryPreferences.stripedRows}\n {...stripedRowsPreference}\n onChange={stripedRows => onChange({ stripedRows })}\n />\n )}\n {contentDensityPreference && (\n <ContentDensityPreference\n value={temporaryPreferences.contentDensity}\n {...contentDensityPreference}\n onChange={contentDensity => onChange({ contentDensity })}\n />\n )}\n {customPreference && (\n <CustomPreference\n value={temporaryPreferences.custom}\n customPreference={customPreference}\n onChange={custom => onChange({ custom })}\n />\n )}\n </InternalSpaceBetween>\n )\n }\n right={\n visibleContentPreference && (\n <VisibleContentPreference\n value={temporaryPreferences.visibleContent}\n {...visibleContentPreference}\n onChange={visibleContent => onChange({ visibleContent })}\n />\n )\n }\n />\n </InternalModal>\n )}\n </div>\n );\n}\n\napplyDisplayName(CollectionPreferences, 'CollectionPreferences');\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/utils.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAMxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAG1D,eAAO,MAAM,eAAe,kFAOzB,2BAA2B,WAAW,KAAG,2BAA2B,WAOrE,CAAC;AAEH,eAAO,MAAM,gBAAgB,YAClB,2BAA2B,WAAW,WACtC,2BAA2B,WAAW,KAC9C,2BAA2B,WAO5B,CAAC;AAEH,UAAU,uBAAuB;IAC/B,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,eAAO,MAAM,kBAAkB,oBAAqB,uBAAuB,gBAsB1E,CAAC;AAEF,UAAU,uBAAwB,SAAQ,0BAA0B,CAAC,kBAAkB;IACrF,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,kBAAkB,wCAAyC,uBAAuB,gBAW9F,CAAC;AAEF,UAAU,wBAAyB,SAAQ,0BAA0B,CAAC,mBAAmB;IACvF,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,m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served.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import React, { useState } from 'react';
4
+ import clsx from 'clsx';
4
5
  import InternalCheckbox from '../checkbox/internal';
5
6
  import InternalColumnLayout from '../column-layout/internal';
6
7
  import InternalFormField from '../form-field/internal';
@@ -32,13 +33,13 @@ export var ModalContentLayout = function (_a) {
32
33
  var smallContainer = breakpoint === 'default';
33
34
  if (smallContainer) {
34
35
  return (React.createElement("div", { ref: ref },
35
- React.createElement("div", null, left),
36
- right && React.createElement("div", { className: styles['second-column-small'] }, right)));
36
+ left && React.createElement("div", null, left),
37
+ right && React.createElement("div", { className: clsx(left && styles['second-column-small']) }, right)));
37
38
  }
38
- var columns = right ? 2 : 1;
39
+ var columns = left && right ? 2 : 1;
39
40
  return (React.createElement("div", { ref: ref },
40
41
  React.createElement(InternalColumnLayout, { columns: columns, variant: "text-grid" },
41
- React.createElement("div", null, left),
42
+ left && React.createElement("div", null, left),
42
43
  right && React.createElement("div", null, right))));
43
44
  };
44
45
  export var PageSizePreference = function (_a) {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/collection-preferences/utils.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,IAAM,eAAe,GAAG,UAAC,EAOS;QANvC,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,cAAc,oBAAA,EACd,cAAc,oBAAA,EACd,MAAM,YAA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CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC;QAApD,CAAoD,EAC9E,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAEnC,KAAK,CACW,CACpB;AATmH,CASnH,CAAC;AAMF,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAC,EAA4D;QAA1D,KAAK,WAAA,EAAE,gBAAgB,sBAAA,EAAE,QAAQ,cAAA;IAC5D,IAAA,KAAgC,QAAQ,CAAC,KAAK,CAAC,EAA9C,WAAW,QAAA,EAAE,cAAc,QAAmB,CAAC;IACtD,IAAI,gBAAgB,EAAE;QACpB,OAAO,CACL,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM,IAC1B,gBAAgB,CAAC,WAAW,EAAE,UAAA,KAAK;YAClC,uDAAuD;YACvD,cAAc,CAAC,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC,CAAC;YAC5B,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,CAAC,CACE,CACP,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport InternalCheckbox from '../checkbox/internal';\nimport InternalColumnLayout from '../column-layout/internal';\nimport InternalFormField from '../form-field/internal';\nimport InternalRadioGroup from '../radio-group/internal';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { CollectionPreferencesProps } from './interfaces';\nimport styles from './styles.css.js';\n\nexport const copyPreferences = ({\n pageSize,\n wrapLines,\n stripedRows,\n contentDensity,\n visibleContent,\n custom,\n}: CollectionPreferencesProps.Preferences): CollectionPreferencesProps.Preferences => ({\n pageSize,\n wrapLines,\n stripedRows,\n contentDensity,\n visibleContent,\n custom,\n});\n\nexport const mergePreferences = (\n newPref: CollectionPreferencesProps.Preferences,\n oldPref: CollectionPreferencesProps.Preferences\n): CollectionPreferencesProps.Preferences => ({\n pageSize: newPref.pageSize !== undefined ? newPref.pageSize : oldPref.pageSize,\n wrapLines: newPref.wrapLines !== undefined ? newPref.wrapLines : oldPref.wrapLines,\n stripedRows: newPref.stripedRows !== undefined ? newPref.stripedRows : oldPref.stripedRows,\n contentDensity: newPref.contentDensity !== undefined ? newPref.contentDensity : oldPref.contentDensity,\n visibleContent: newPref.visibleContent !== undefined ? newPref.visibleContent : oldPref.visibleContent,\n custom: newPref.custom !== undefined ? newPref.custom : oldPref.custom,\n});\n\ninterface ModalContentLayoutProps {\n left: React.ReactNode;\n right: React.ReactNode;\n}\n\nexport const ModalContentLayout = ({ left, right }: ModalContentLayoutProps) => {\n const [breakpoint, ref] = useContainerBreakpoints(['xs']);\n const smallContainer = breakpoint === 'default';\n\n if (smallContainer) {\n return (\n <div ref={ref}>\n <div>{left}</div>\n {right && <div className={styles['second-column-small']}>{right}</div>}\n </div>\n );\n }\n\n const columns = right ? 2 : 1;\n return (\n <div ref={ref}>\n <InternalColumnLayout columns={columns} variant=\"text-grid\">\n <div>{left}</div>\n {right && <div>{right}</div>}\n </InternalColumnLayout>\n </div>\n );\n};\n\ninterface PageSizePreferenceProps extends CollectionPreferencesProps.PageSizePreference {\n onChange: (value: number) => void;\n value?: number;\n}\n\nexport const PageSizePreference = ({ title, options, value, onChange }: PageSizePreferenceProps) => (\n <div className={styles['page-size']}>\n <InternalFormField label={title} stretch={true} className={styles['page-size-form-field']}>\n <InternalRadioGroup\n className={styles['page-size-radio-group']}\n value={`${value}`}\n items={options.map(({ label, value }) => ({ label, value: `${value}` }))}\n onChange={({ detail }) => onChange(parseInt(detail.value, 10))}\n />\n </InternalFormField>\n </div>\n);\n\ninterface WrapLinesPreferenceProps extends CollectionPreferencesProps.WrapLinesPreference {\n onChange: (value: boolean) => void;\n value?: boolean;\n}\n\nexport const WrapLinesPreference = ({ label, description, value, onChange }: WrapLinesPreferenceProps) => (\n <InternalCheckbox\n checked={!!value}\n description={description}\n onChange={({ detail }) => onChange(detail.checked)}\n className={styles['wrap-lines']}\n >\n {label}\n </InternalCheckbox>\n);\n\ninterface StripedRowsPreferenceProps extends CollectionPreferencesProps.StripedRowsPreference {\n onChange: (value: boolean) => void;\n value?: boolean;\n}\n\nexport const StripedRowsPreference = ({ label, description, value, onChange }: StripedRowsPreferenceProps) => (\n <InternalCheckbox\n checked={!!value}\n description={description}\n onChange={({ detail }) => onChange(detail.checked)}\n className={styles['striped-rows']}\n >\n {label}\n </InternalCheckbox>\n);\n\ninterface ContentDensityPreferenceProps extends CollectionPreferencesProps.ContentDensityPreference {\n onChange: (value: 'comfortable' | 'compact') => void;\n value?: 'comfortable' | 'compact';\n}\n\nexport const ContentDensityPreference = ({ label, description, value, onChange }: ContentDensityPreferenceProps) => (\n <InternalCheckbox\n checked={value === 'compact'}\n description={description}\n onChange={({ detail }) => onChange(detail.checked ? 'compact' : 'comfortable')}\n className={styles['content-density']}\n >\n {label}\n </InternalCheckbox>\n);\n\ninterface CustomPreferenceProps<T = any> extends Pick<CollectionPreferencesProps<T>, 'customPreference'> {\n onChange: (value: T) => void;\n value: T;\n}\nexport const CustomPreference = ({ value, customPreference, onChange }: CustomPreferenceProps) => {\n const [customState, setCustomState] = useState(value);\n if (customPreference) {\n return (\n <div className={styles.custom}>\n {customPreference(customState, value => {\n // prevent value to be treated as a functional callback\n setCustomState(() => value);\n onChange(value);\n })}\n </div>\n );\n }\n return null;\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/collection-preferences/utils.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,kBAAkB,MAAM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S7G,CAAC;AAOF,MAAM,CAAC,IAAM,wBAAwB,GAAG,UAAC,EAAsE;QAApE,KAAK,WAAA,EAAE,WAAW,iBAAA,EAAE,KAAK,WAAA,EAAE,QAAQ,cAAA;IAAsC,OAAA,CAClH,oBAAC,gBAAgB,IACf,OAAO,EAAE,KAAK,KAAK,SAAS,EAC5B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,UAAC,EAAU;gBAAR,MAAM,YAAA;YAAO,OAAA,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC;QAApD,CAAoD,EAC9E,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAEnC,KAAK,CACW,CACpB;AATmH,CASnH,CAAC;AAMF,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAC,EAA4D;QAA1D,KAAK,WAAA,EAAE,gBAAgB,sBAAA,EAAE,QAAQ,cAAA;IAC5D,IAAA,KAAgC,QAAQ,CAAC,KAAK,CAAC,EAA9C,WAAW,QAAA,EAAE,cAAc,QAAmB,CAAC;IACtD,IAAI,gBAAgB,EAAE;QACpB,OAAO,CACL,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM,IAC1B,gBAAgB,CAAC,WAAW,EAAE,UAAA,KAAK;YAClC,uDAAuD;YACvD,cAAc,CAAC,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC,CAAC;YAC5B,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,CAAC,CACE,CACP,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\nimport InternalCheckbox from '../checkbox/internal';\nimport InternalColumnLayout from '../column-layout/internal';\nimport InternalFormField from '../form-field/internal';\nimport InternalRadioGroup from '../radio-group/internal';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { CollectionPreferencesProps } from './interfaces';\nimport styles from './styles.css.js';\n\nexport const copyPreferences = ({\n pageSize,\n wrapLines,\n stripedRows,\n contentDensity,\n visibleContent,\n custom,\n}: CollectionPreferencesProps.Preferences): CollectionPreferencesProps.Preferences => ({\n pageSize,\n wrapLines,\n stripedRows,\n contentDensity,\n visibleContent,\n custom,\n});\n\nexport const mergePreferences = (\n newPref: CollectionPreferencesProps.Preferences,\n oldPref: CollectionPreferencesProps.Preferences\n): CollectionPreferencesProps.Preferences => ({\n pageSize: newPref.pageSize !== undefined ? newPref.pageSize : oldPref.pageSize,\n wrapLines: newPref.wrapLines !== undefined ? newPref.wrapLines : oldPref.wrapLines,\n stripedRows: newPref.stripedRows !== undefined ? newPref.stripedRows : oldPref.stripedRows,\n contentDensity: newPref.contentDensity !== undefined ? newPref.contentDensity : oldPref.contentDensity,\n visibleContent: newPref.visibleContent !== undefined ? newPref.visibleContent : oldPref.visibleContent,\n custom: newPref.custom !== undefined ? newPref.custom : oldPref.custom,\n});\n\ninterface ModalContentLayoutProps {\n left: React.ReactNode;\n right: React.ReactNode;\n}\n\nexport const ModalContentLayout = ({ left, right }: ModalContentLayoutProps) => {\n const [breakpoint, ref] = useContainerBreakpoints(['xs']);\n const smallContainer = breakpoint === 'default';\n\n if (smallContainer) {\n return (\n <div ref={ref}>\n {left && <div>{left}</div>}\n {right && <div className={clsx(left && styles['second-column-small'])}>{right}</div>}\n </div>\n );\n }\n\n const columns = left && right ? 2 : 1;\n return (\n <div ref={ref}>\n <InternalColumnLayout columns={columns} variant=\"text-grid\">\n {left && <div>{left}</div>}\n {right && <div>{right}</div>}\n </InternalColumnLayout>\n </div>\n );\n};\n\ninterface PageSizePreferenceProps extends CollectionPreferencesProps.PageSizePreference {\n onChange: (value: number) => void;\n value?: number;\n}\n\nexport const PageSizePreference = ({ title, options, value, onChange }: PageSizePreferenceProps) => (\n <div className={styles['page-size']}>\n <InternalFormField label={title} stretch={true} className={styles['page-size-form-field']}>\n <InternalRadioGroup\n className={styles['page-size-radio-group']}\n value={`${value}`}\n items={options.map(({ label, value }) => ({ label, value: `${value}` }))}\n onChange={({ detail }) => onChange(parseInt(detail.value, 10))}\n />\n </InternalFormField>\n </div>\n);\n\ninterface WrapLinesPreferenceProps extends CollectionPreferencesProps.WrapLinesPreference {\n onChange: (value: boolean) => void;\n value?: boolean;\n}\n\nexport const WrapLinesPreference = ({ label, description, value, onChange }: WrapLinesPreferenceProps) => (\n <InternalCheckbox\n checked={!!value}\n description={description}\n onChange={({ detail }) => onChange(detail.checked)}\n className={styles['wrap-lines']}\n >\n {label}\n </InternalCheckbox>\n);\n\ninterface StripedRowsPreferenceProps extends CollectionPreferencesProps.StripedRowsPreference {\n onChange: (value: boolean) => void;\n value?: boolean;\n}\n\nexport const StripedRowsPreference = ({ label, description, value, onChange }: StripedRowsPreferenceProps) => (\n <InternalCheckbox\n checked={!!value}\n description={description}\n onChange={({ detail }) => onChange(detail.checked)}\n className={styles['striped-rows']}\n >\n {label}\n </InternalCheckbox>\n);\n\ninterface ContentDensityPreferenceProps extends CollectionPreferencesProps.ContentDensityPreference {\n onChange: (value: 'comfortable' | 'compact') => void;\n value?: 'comfortable' | 'compact';\n}\n\nexport const ContentDensityPreference = ({ label, description, value, onChange }: ContentDensityPreferenceProps) => (\n <InternalCheckbox\n checked={value === 'compact'}\n description={description}\n onChange={({ detail }) => onChange(detail.checked ? 'compact' : 'comfortable')}\n className={styles['content-density']}\n >\n {label}\n </InternalCheckbox>\n);\n\ninterface CustomPreferenceProps<T = any> extends Pick<CollectionPreferencesProps<T>, 'customPreference'> {\n onChange: (value: T) => void;\n value: T;\n}\nexport const CustomPreference = ({ value, customPreference, onChange }: CustomPreferenceProps) => {\n const [customState, setCustomState] = useState(value);\n if (customPreference) {\n return (\n <div className={styles.custom}>\n {customPreference(customState, value => {\n // prevent value to be treated as a functional callback\n setCustomState(() => value);\n onChange(value);\n })}\n </div>\n );\n }\n return null;\n};\n"]}
@@ -18,7 +18,7 @@ var Highlight = function (_a) {
18
18
  export default function HighlightMatch(_a) {
19
19
  var str = _a.str, highlightText = _a.highlightText;
20
20
  if (!str || !highlightText) {
21
- return React.createElement(React.Fragment, null, str);
21
+ return React.createElement("span", null, str);
22
22
  }
23
23
  if (str === highlightText) {
24
24
  return React.createElement(Highlight, { str: str });
@@ -26,9 +26,9 @@ export default function HighlightMatch(_a) {
26
26
  var _b = splitOnFiltering(str, highlightText), noMatches = _b.noMatches, matches = _b.matches;
27
27
  var highlighted = [];
28
28
  noMatches.forEach(function (noMatch, idx) {
29
- highlighted.push(noMatch);
29
+ highlighted.push(React.createElement("span", { key: "noMatch-".concat(idx) }, noMatch));
30
30
  if (matches && idx < matches.length) {
31
- highlighted.push(React.createElement(Highlight, { key: idx, str: matches[idx] }));
31
+ highlighted.push(React.createElement(Highlight, { key: "match-".concat(idx), str: matches[idx] }));
32
32
  }
33
33
  });
34
34
  return React.createElement("span", null, highlighted);
@@ -1 +1 @@
1
- {"version":3,"file":"highlight-match.js","sourceRoot":"","sources":["../../../../../src/internal/components/option/highlight-match.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,IAAM,gBAAgB,GAAG,UAAC,GAAW,EAAE,aAAqB;IAC1D,yCAAyC;IACzC,IAAM,gBAAgB,GAAG,aAAa,CAAC,OAAO,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;IAChF,IAAM,MAAM,GAAG,IAAI,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IAClD,IAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,IAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAElC,OAAO,EAAE,SAAS,WAAA,EAAE,OAAO,SAAA,EAAE,CAAC;AAChC,CAAC,CAAC;AAOF,IAAM,SAAS,GAAG,UAAC,EAA4B;QAA1B,GAAG,SAAA;IACtB,OAAA,GAAG,CAAC,CAAC,CAAC,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC,IAAG,GAAG,CAAQ,CAAC,CAAC,CAAC,IAAI;AAArF,CAAqF,CAAC;AAExF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAA2C;QAAzC,GAAG,SAAA,EAAE,aAAa,mBAAA;IACzD,IAAI,CAAC,GAAG,IAAI,CAAC,aAAa,EAAE;QAC1B,OAAO,0CAAG,GAAG,CAAI,CAAC;KACnB;IAED,IAAI,GAAG,KAAK,aAAa,EAAE;QACzB,OAAO,oBAAC,SAAS,IAAC,GAAG,EAAE,GAAG,GAAI,CAAC;KAChC;IAEK,IAAA,KAAyB,gBAAgB,CAAC,GAAG,EAAE,aAAa,CAAC,EAA3D,SAAS,eAAA,EAAE,OAAO,aAAyC,CAAC;IAEpE,IAAM,WAAW,GAA6B,EAAE,CAAC;IAEjD,SAAS,CAAC,OAAO,CAAC,UAAC,OAAO,EAAE,GAAG;QAC7B,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE1B,IAAI,OAAO,IAAI,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE;YACnC,WAAW,CAAC,IAAI,CAAC,oBAAC,SAAS,IAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAI,CAAC,CAAC;SAC9D;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,kCAAO,WAAW,CAAQ,CAAC;AACpC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport styles from './styles.css.js';\nimport clsx from 'clsx';\n\nconst splitOnFiltering = (str: string, highlightText: string) => {\n // Filtering needs to be case insensitive\n const filteringPattern = highlightText.replace(/[-[\\]/{}()*+?.\\\\^$|]/g, '\\\\$&');\n const regexp = new RegExp(filteringPattern, 'gi');\n const noMatches = str.split(regexp);\n const matches = str.match(regexp);\n\n return { noMatches, matches };\n};\n\nexport interface HighlightMatchProps {\n str?: string;\n highlightText?: string;\n}\n\nconst Highlight = ({ str }: HighlightMatchProps) =>\n str ? <span className={clsx(styles['filtering-match-highlight'])}>{str}</span> : null;\n\nexport default function HighlightMatch({ str, highlightText }: HighlightMatchProps) {\n if (!str || !highlightText) {\n return <>{str}</>;\n }\n\n if (str === highlightText) {\n return <Highlight str={str} />;\n }\n\n const { noMatches, matches } = splitOnFiltering(str, highlightText);\n\n const highlighted: (string | JSX.Element)[] = [];\n\n noMatches.forEach((noMatch, idx) => {\n highlighted.push(noMatch);\n\n if (matches && idx < matches.length) {\n highlighted.push(<Highlight key={idx} str={matches[idx]} />);\n }\n });\n\n return <span>{highlighted}</span>;\n}\n"]}
1
+ {"version":3,"file":"highlight-match.js","sourceRoot":"","sources":["../../../../../src/internal/components/option/highlight-match.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,IAAM,gBAAgB,GAAG,UAAC,GAAW,EAAE,aAAqB;IAC1D,yCAAyC;IACzC,IAAM,gBAAgB,GAAG,aAAa,CAAC,OAAO,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;IAChF,IAAM,MAAM,GAAG,IAAI,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IAClD,IAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,IAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAElC,OAAO,EAAE,SAAS,WAAA,EAAE,OAAO,SAAA,EAAE,CAAC;AAChC,CAAC,CAAC;AAOF,IAAM,SAAS,GAAG,UAAC,EAA4B;QAA1B,GAAG,SAAA;IACtB,OAAA,GAAG,CAAC,CAAC,CAAC,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC,IAAG,GAAG,CAAQ,CAAC,CAAC,CAAC,IAAI;AAArF,CAAqF,CAAC;AAExF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAA2C;QAAzC,GAAG,SAAA,EAAE,aAAa,mBAAA;IACzD,IAAI,CAAC,GAAG,IAAI,CAAC,aAAa,EAAE;QAC1B,OAAO,kCAAO,GAAG,CAAQ,CAAC;KAC3B;IAED,IAAI,GAAG,KAAK,aAAa,EAAE;QACzB,OAAO,oBAAC,SAAS,IAAC,GAAG,EAAE,GAAG,GAAI,CAAC;KAChC;IAEK,IAAA,KAAyB,gBAAgB,CAAC,GAAG,EAAE,aAAa,CAAC,EAA3D,SAAS,eAAA,EAAE,OAAO,aAAyC,CAAC;IAEpE,IAAM,WAAW,GAA6B,EAAE,CAAC;IAEjD,SAAS,CAAC,OAAO,CAAC,UAAC,OAAO,EAAE,GAAG;QAC7B,WAAW,CAAC,IAAI,CAAC,8BAAM,GAAG,EAAE,kBAAW,GAAG,CAAE,IAAG,OAAO,CAAQ,CAAC,CAAC;QAEhE,IAAI,OAAO,IAAI,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE;YACnC,WAAW,CAAC,IAAI,CAAC,oBAAC,SAAS,IAAC,GAAG,EAAE,gBAAS,GAAG,CAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAI,CAAC,CAAC;SACzE;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,kCAAO,WAAW,CAAQ,CAAC;AACpC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport styles from './styles.css.js';\nimport clsx from 'clsx';\n\nconst splitOnFiltering = (str: string, highlightText: string) => {\n // Filtering needs to be case insensitive\n const filteringPattern = highlightText.replace(/[-[\\]/{}()*+?.\\\\^$|]/g, '\\\\$&');\n const regexp = new RegExp(filteringPattern, 'gi');\n const noMatches = str.split(regexp);\n const matches = str.match(regexp);\n\n return { noMatches, matches };\n};\n\nexport interface HighlightMatchProps {\n str?: string;\n highlightText?: string;\n}\n\nconst Highlight = ({ str }: HighlightMatchProps) =>\n str ? <span className={clsx(styles['filtering-match-highlight'])}>{str}</span> : null;\n\nexport default function HighlightMatch({ str, highlightText }: HighlightMatchProps) {\n if (!str || !highlightText) {\n return <span>{str}</span>;\n }\n\n if (str === highlightText) {\n return <Highlight str={str} />;\n }\n\n const { noMatches, matches } = splitOnFiltering(str, highlightText);\n\n const highlighted: (string | JSX.Element)[] = [];\n\n noMatches.forEach((noMatch, idx) => {\n highlighted.push(<span key={`noMatch-${idx}`}>{noMatch}</span>);\n\n if (matches && idx < matches.length) {\n highlighted.push(<Highlight key={`match-${idx}`} str={matches[idx]} />);\n }\n });\n\n return <span>{highlighted}</span>;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
 
2
2
  export var PACKAGE_SOURCE = 'components';
3
- export var PACKAGE_VERSION = '3.0.0 (a801b69)';
3
+ export var PACKAGE_VERSION = '3.0.0 (6c8eab3)';
4
4
  export var THEME = 'open-source-visual-refresh';
5
5
  export var ALWAYS_VISUAL_REFRESH = true;
6
6
 
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "a801b69343160cdecc6e828e738af38608e7cee2"
2
+ "commit": "6c8eab313909c7745c71f6885ff95b97b7b9b87c"
3
3
  }
package/package.json CHANGED
@@ -81,7 +81,7 @@
81
81
  "./internal/base-component/index.js",
82
82
  "./internal/base-component/styles.css.js"
83
83
  ],
84
- "version": "3.0.211",
84
+ "version": "3.0.213",
85
85
  "repository": {
86
86
  "type": "git",
87
87
  "url": "https://github.com/cloudscape-design/components.git"
@@ -20,7 +20,7 @@ var Item = function (_a, ref) {
20
20
  React.createElement("div", { className: clsx(styles.item, !isParent && wrappedOption.labelTag && styles['show-label-tag']) },
21
21
  hasCheckbox && !isParent && (React.createElement("div", { className: styles.checkbox },
22
22
  React.createElement(CheckboxIcon, { checked: selected || false, disabled: option.disabled }))),
23
- isParent ? (wrappedOption.label || wrappedOption.value) : (React.createElement(Option, { option: __assign(__assign({}, wrappedOption), { disabled: disabled }), highlightedOption: highlighted, selectedOption: selected, highlightText: filteringValue })),
23
+ isParent ? (React.createElement("span", null, wrappedOption.label || wrappedOption.value)) : (React.createElement(Option, { option: __assign(__assign({}, wrappedOption), { disabled: disabled }), highlightedOption: highlighted, selectedOption: selected, highlightText: filteringValue })),
24
24
  !hasCheckbox && !isParent && selected && (React.createElement("div", { className: styles['selected-icon'] },
25
25
  React.createElement(InternalIcon, { name: "check" }))))));
26
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"item.js","sourceRoot":"","sources":["../../../../src/select/parts/item.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,MAAM,MAAM,kCAAkC,CAAC;AACtD,OAAO,cAAc,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,YAAY,MAAM,yCAAyC,CAAC;AACnE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAkBlD,IAAM,IAAI,GAAG,UACX,EAcY,EACZ,GAA8B;IAd5B,IAAA,MAAM,YAAA,EACN,WAAW,iBAAA,EACX,QAAQ,cAAA,EACR,cAAc,oBAAA,EACd,WAAW,iBAAA,EACX,eAAe,qBAAA,EACf,SAAS,eAAA,EACT,cAAc,oBAAA,EACd,mBAAmB,yBAAA,EACnB,YAAY,kBAAA,EACZ,W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BAAC,MAAM,IACL,MAAM,wBAAO,aAAa,KAAE,QAAQ,UAAA,KACpC,iBAAiB,EAAE,WAAW,EAC9B,cAAc,EAAE,QAAQ,EACxB,aAAa,EAAE,cAAc,GAC7B,CACH;YACA,CAAC,WAAW,IAAI,CAAC,QAAQ,IAAI,QAAQ,IAAI,CACxC,6BAAK,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC;gBACrC,oBAAC,YAAY,IAAC,IAAI,EAAC,OAAO,GAAG,CACzB,CACP,CACG,CACS,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport Option from '../../internal/components/option';\nimport SelectableItem from '../../internal/components/selectable-item';\nimport { getBaseProps } from '../../internal/base-component';\nimport { DropdownOption, OptionDefinition } from '../../internal/components/option/interfaces';\nimport CheckboxIcon from '../../internal/components/checkbox-icon';\nimport InternalIcon from '../../icon/internal.js';\nimport { HighlightType } from '../../internal/components/options-list/utils/use-highlight-option.js';\n\nexport interface ItemProps {\n option: DropdownOption;\n highlighted?: boolean;\n selected?: boolean;\n filteringValue?: string;\n hasCheckbox?: boolean;\n virtualPosition?: number;\n padBottom?: boolean;\n isNextSelected?: boolean;\n screenReaderContent?: string;\n ariaPosinset?: number;\n ariaSetsize?: number;\n highlightType?: HighlightType;\n}\n\nconst Item = (\n {\n option,\n highlighted,\n selected,\n filteringValue,\n hasCheckbox,\n virtualPosition,\n padBottom,\n isNextSelected,\n screenReaderContent,\n ariaPosinset,\n ariaSetsize,\n highlightType,\n ...restProps\n }: ItemProps,\n ref: React.Ref<HTMLDivElement>\n) => {\n const baseProps = getBaseProps(restProps);\n\n const isParent = option.type === 'parent';\n const isChild = option.type === 'child';\n const wrappedOption: OptionDefinition = option.option;\n const disabled = option.disabled || wrappedOption.disabled;\n\n return (\n <SelectableItem\n ariaSelected={Boolean(selected)}\n selected={selected}\n isNextSelected={isNextSelected}\n highlighted={highlighted}\n disabled={option.disabled}\n isParent={isParent}\n isChild={isChild}\n ref={ref}\n virtualPosition={virtualPosition}\n padBottom={padBottom}\n screenReaderContent={screenReaderContent}\n ariaPosinset={ariaPosinset}\n ariaSetsize={ariaSetsize}\n highlightType={highlightType}\n {...baseProps}\n >\n <div className={clsx(styles.item, !isParent && wrappedOption.labelTag && styles['show-label-tag'])}>\n {hasCheckbox && !isParent && (\n <div className={styles.checkbox}>\n <CheckboxIcon checked={selected || false} disabled={option.disabled} />\n </div>\n )}\n {isParent ? (\n wrappedOption.label || wrappedOption.value\n ) : (\n <Option\n option={{ ...wrappedOption, disabled }}\n highlightedOption={highlighted}\n selectedOption={selected}\n highlightText={filteringValue}\n />\n )}\n {!hasCheckbox && !isParent && selected && (\n <div className={styles['selected-icon']}>\n <InternalIcon name=\"check\" />\n </div>\n )}\n </div>\n </SelectableItem>\n );\n};\n\nexport default React.memo(React.forwardRef(Item));\n"]}
1
+ {"version":3,"file":"item.js","sourceRoot":"","sources":["../../../../src/select/parts/item.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,MAAM,MAAM,kCAAkC,CAAC;AACtD,OAAO,cAAc,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,YAAY,MAAM,yCAAyC,CAAC;AACnE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAkBlD,IAAM,IAAI,GAAG,UACX,EAcY,EACZ,GAA8B;IAd5B,IAAA,MAAM,YAAA,EACN,WAAW,iBAAA,EACX,QA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E,MAAM,CAAC,QAAQ,GAAI,CACnE,CACP;YACA,QAAQ,CAAC,CAAC,CAAC,CACV,kCAAO,aAAa,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK,CAAQ,CAC1D,CAAC,CAAC,CAAC,CACF,oBAAC,MAAM,IACL,MAAM,wBAAO,aAAa,KAAE,QAAQ,UAAA,KACpC,iBAAiB,EAAE,WAAW,EAC9B,cAAc,EAAE,QAAQ,EACxB,aAAa,EAAE,cAAc,GAC7B,CACH;YACA,CAAC,WAAW,IAAI,CAAC,QAAQ,IAAI,QAAQ,IAAI,CACxC,6BAAK,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC;gBACrC,oBAAC,YAAY,IAAC,IAAI,EAAC,OAAO,GAAG,CACzB,CACP,CACG,CACS,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport Option from '../../internal/components/option';\nimport SelectableItem from '../../internal/components/selectable-item';\nimport { getBaseProps } from '../../internal/base-component';\nimport { DropdownOption, OptionDefinition } from '../../internal/components/option/interfaces';\nimport CheckboxIcon from '../../internal/components/checkbox-icon';\nimport InternalIcon from '../../icon/internal.js';\nimport { HighlightType } from '../../internal/components/options-list/utils/use-highlight-option.js';\n\nexport interface ItemProps {\n option: DropdownOption;\n highlighted?: boolean;\n selected?: boolean;\n filteringValue?: string;\n hasCheckbox?: boolean;\n virtualPosition?: number;\n padBottom?: boolean;\n isNextSelected?: boolean;\n screenReaderContent?: string;\n ariaPosinset?: number;\n ariaSetsize?: number;\n highlightType?: HighlightType;\n}\n\nconst Item = (\n {\n option,\n highlighted,\n selected,\n filteringValue,\n hasCheckbox,\n virtualPosition,\n padBottom,\n isNextSelected,\n screenReaderContent,\n ariaPosinset,\n ariaSetsize,\n highlightType,\n ...restProps\n }: ItemProps,\n ref: React.Ref<HTMLDivElement>\n) => {\n const baseProps = getBaseProps(restProps);\n\n const isParent = option.type === 'parent';\n const isChild = option.type === 'child';\n const wrappedOption: OptionDefinition = option.option;\n const disabled = option.disabled || wrappedOption.disabled;\n\n return (\n <SelectableItem\n ariaSelected={Boolean(selected)}\n selected={selected}\n isNextSelected={isNextSelected}\n highlighted={highlighted}\n disabled={option.disabled}\n isParent={isParent}\n isChild={isChild}\n ref={ref}\n virtualPosition={virtualPosition}\n padBottom={padBottom}\n screenReaderContent={screenReaderContent}\n ariaPosinset={ariaPosinset}\n ariaSetsize={ariaSetsize}\n highlightType={highlightType}\n {...baseProps}\n >\n <div className={clsx(styles.item, !isParent && wrappedOption.labelTag && styles['show-label-tag'])}>\n {hasCheckbox && !isParent && (\n <div className={styles.checkbox}>\n <CheckboxIcon checked={selected || false} disabled={option.disabled} />\n </div>\n )}\n {isParent ? (\n <span>{wrappedOption.label || wrappedOption.value}</span>\n ) : (\n <Option\n option={{ ...wrappedOption, disabled }}\n highlightedOption={highlighted}\n selectedOption={selected}\n highlightText={filteringValue}\n />\n )}\n {!hasCheckbox && !isParent && selected && (\n <div className={styles['selected-icon']}>\n <InternalIcon name=\"check\" />\n </div>\n )}\n </div>\n </SelectableItem>\n );\n};\n\nexport default React.memo(React.forwardRef(Item));\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/text-filter/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAMtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C,QAAA,MAAM,kBAAkB,0HA8CvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/text-filter/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAMtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAS/C,QAAA,MAAM,kBAAkB,0HA+CvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -8,15 +8,22 @@ import { getBaseProps } from '../internal/base-component';
8
8
  import useForwardFocus from '../internal/hooks/forward-focus';
9
9
  import { fireNonCancelableEvent } from '../internal/events';
10
10
  import styles from './styles.css.js';
11
+ import LiveRegion from '../internal/components/live-region';
12
+ import { useUniqueId } from '../internal/hooks/use-unique-id';
13
+ // Debounce delay for live region (based on testing with VoiceOver)
14
+ var LIVE_REGION_DELAY = 2000;
11
15
  var InternalTextFilter = React.forwardRef(function (_a, ref) {
12
16
  var filteringText = _a.filteringText, filteringAriaLabel = _a.filteringAriaLabel, filteringPlaceholder = _a.filteringPlaceholder, filteringClearAriaLabel = _a.filteringClearAriaLabel, disabled = _a.disabled, countText = _a.countText, onChange = _a.onChange, onDelayedChange = _a.onDelayedChange, __internalRootRef = _a.__internalRootRef, rest = __rest(_a, ["filteringText", "filteringAriaLabel", "filteringPlaceholder", "filteringClearAriaLabel", "disabled", "countText", "onChange", "onDelayedChange", "__internalRootRef"]);
13
- var inputRef = useRef(null);
14
17
  var baseProps = getBaseProps(rest);
18
+ var inputRef = useRef(null);
15
19
  useForwardFocus(ref, inputRef);
20
+ var countTextId = useUniqueId('text-filter');
16
21
  var showResults = filteringText && countText && !disabled;
17
22
  return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: __internalRootRef }),
18
- React.createElement(InternalInput, { ref: inputRef, className: styles.input, type: "search", ariaLabel: filteringAriaLabel, placeholder: filteringPlaceholder, value: filteringText, disabled: disabled, autoComplete: false, clearAriaLabel: filteringClearAriaLabel, onChange: function (event) { return fireNonCancelableEvent(onChange, { filteringText: event.detail.value }); }, __onDelayedInput: function (event) { return fireNonCancelableEvent(onDelayedChange, { filteringText: event.detail.value }); } }),
19
- React.createElement("span", { "aria-live": "polite", "aria-atomic": "true", className: clsx(styles.results, showResults && styles['results-visible']) }, showResults ? countText : '')));
23
+ React.createElement(InternalInput, { ref: inputRef, className: styles.input, type: "search", ariaLabel: filteringAriaLabel, placeholder: filteringPlaceholder, value: filteringText, disabled: disabled, autoComplete: false, ariaDescribedby: countTextId, clearAriaLabel: filteringClearAriaLabel, onChange: function (event) { return fireNonCancelableEvent(onChange, { filteringText: event.detail.value }); }, __onDelayedInput: function (event) { return fireNonCancelableEvent(onDelayedChange, { filteringText: event.detail.value }); } }),
24
+ React.createElement("span", { className: clsx(styles.results, showResults && styles['results-visible']) },
25
+ React.createElement(LiveRegion, { delay: LIVE_REGION_DELAY, visible: true },
26
+ React.createElement("span", { id: countTextId }, showResults ? countText : '')))));
20
27
  });
21
28
  export default InternalTextFilter;
22
29
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/text-filter/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAMrC,IAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,CACzC,UACE,EAW0B,EAC1B,GAAmC;IAXjC,IAAA,aAAa,mBAAA,EACb,kBAAkB,wBAAA,EAClB,oBAAoB,0BAAA,EACpB,uBAAuB,6BAAA,EAC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CACxB,CACH,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport InternalInput from '../input/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport styles from './styles.css.js';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { TextFilterProps } from './interfaces';\n\ntype InternalTextFilterProps = TextFilterProps & InternalBaseComponentProps;\n\nconst InternalTextFilter = React.forwardRef(\n (\n {\n filteringText,\n filteringAriaLabel,\n filteringPlaceholder,\n filteringClearAriaLabel,\n disabled,\n countText,\n onChange,\n onDelayedChange,\n __internalRootRef,\n ...rest\n }: InternalTextFilterProps,\n ref: React.Ref<TextFilterProps.Ref>\n ) => {\n const inputRef = useRef<HTMLInputElement>(null);\n const baseProps = getBaseProps(rest);\n useForwardFocus(ref, inputRef);\n const showResults = filteringText && countText && !disabled;\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <InternalInput\n ref={inputRef}\n className={styles.input}\n type=\"search\"\n ariaLabel={filteringAriaLabel}\n placeholder={filteringPlaceholder}\n value={filteringText}\n disabled={disabled}\n autoComplete={false}\n clearAriaLabel={filteringClearAriaLabel}\n onChange={event => fireNonCancelableEvent(onChange, { filteringText: event.detail.value })}\n __onDelayedInput={event => fireNonCancelableEvent(onDelayedChange, { filteringText: event.detail.value })}\n />\n <span\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className={clsx(styles.results, showResults && styles['results-visible'])}\n >\n {showResults ? countText : ''}\n </span>\n </div>\n );\n }\n);\n\nexport default InternalTextFilter;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/text-filter/internal.tsx"],"names":[],"mappings":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,GAAG,EAAE,QAAQ,EACb,SAAS,EAAE,MAAM,CAAC,KAAK,EACvB,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,kBAAkB,EAC7B,WAAW,EAAE,oBAAoB,EACjC,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,KAAK,EACnB,eAAe,EAAE,WAAW,EAC5B,cAAc,EAAE,uBAAuB,EACvC,QAAQ,EAAE,UAAA,KAAK,IAAI,OAAA,sBAAsB,CAAC,QAAQ,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAvE,CAAuE,EAC1F,gBAAgB,EAAE,UAAA,KAAK,IAAI,OAAA,sBAAsB,CAAC,eAAe,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAA9E,CAA8E,GACzG;QACF,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;YAC7E,oBAAC,UAAU,IAAC,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,IAAI;gBACjD,8BAAM,EAAE,EAAE,WAAW,IAAG,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAQ,CACjD,CACR,CACH,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport InternalInput from '../input/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport styles from './styles.css.js';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { TextFilterProps } from './interfaces';\nimport LiveRegion from '../internal/components/live-region';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\n\n// Debounce delay for live region (based on testing with VoiceOver)\nconst LIVE_REGION_DELAY = 2000;\n\ntype InternalTextFilterProps = TextFilterProps & InternalBaseComponentProps;\n\nconst InternalTextFilter = React.forwardRef(\n (\n {\n filteringText,\n filteringAriaLabel,\n filteringPlaceholder,\n filteringClearAriaLabel,\n disabled,\n countText,\n onChange,\n onDelayedChange,\n __internalRootRef,\n ...rest\n }: InternalTextFilterProps,\n ref: React.Ref<TextFilterProps.Ref>\n ) => {\n const baseProps = getBaseProps(rest);\n const inputRef = useRef<HTMLInputElement>(null);\n useForwardFocus(ref, inputRef);\n\n const countTextId = useUniqueId('text-filter');\n const showResults = filteringText && countText && !disabled;\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <InternalInput\n ref={inputRef}\n className={styles.input}\n type=\"search\"\n ariaLabel={filteringAriaLabel}\n placeholder={filteringPlaceholder}\n value={filteringText}\n disabled={disabled}\n autoComplete={false}\n ariaDescribedby={countTextId}\n clearAriaLabel={filteringClearAriaLabel}\n onChange={event => fireNonCancelableEvent(onChange, { filteringText: event.detail.value })}\n __onDelayedInput={event => fireNonCancelableEvent(onDelayedChange, { filteringText: event.detail.value })}\n />\n <span className={clsx(styles.results, showResults && styles['results-visible'])}>\n <LiveRegion delay={LIVE_REGION_DELAY} visible={true}>\n <span id={countTextId}>{showResults ? countText : ''}</span>\n </LiveRegion>\n </span>\n </div>\n );\n }\n);\n\nexport default InternalTextFilter;\n"]}