@cloudscape-design/components 3.0.971 → 3.0.973
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/internal/components/drag-handle/button.d.ts.map +1 -1
- package/internal/components/drag-handle/button.js +2 -1
- package/internal/components/drag-handle/button.js.map +1 -1
- package/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.d.ts.map +1 -1
- package/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.js +5 -0
- package/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.js.map +1 -1
- package/internal/components/drag-handle/test-classes/styles.css.js +6 -0
- package/internal/components/drag-handle/test-classes/styles.scoped.css +7 -0
- package/internal/components/drag-handle/test-classes/styles.selectors.js +7 -0
- package/internal/components/drag-handle-wrapper/direction-button.d.ts.map +1 -1
- package/internal/components/drag-handle-wrapper/direction-button.js +2 -1
- package/internal/components/drag-handle-wrapper/direction-button.js.map +1 -1
- package/internal/components/drag-handle-wrapper/index.d.ts.map +1 -1
- package/internal/components/drag-handle-wrapper/index.js +6 -3
- package/internal/components/drag-handle-wrapper/index.js.map +1 -1
- package/internal/components/drag-handle-wrapper/test-classes/styles.css.js +12 -0
- package/internal/components/drag-handle-wrapper/test-classes/styles.scoped.css +31 -0
- package/internal/components/drag-handle-wrapper/test-classes/styles.selectors.js +13 -0
- package/internal/context/table-component-context.d.ts +3 -1
- package/internal/context/table-component-context.d.ts.map +1 -1
- package/internal/context/table-component-context.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +3 -1
- package/property-filter/internal.d.ts.map +1 -1
- package/property-filter/internal.js +29 -1
- package/property-filter/internal.js.map +1 -1
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +9 -7
- package/table/internal.js.map +1 -1
- package/test-utils/dom/internal/drag-handle.d.ts +9 -0
- package/test-utils/dom/internal/drag-handle.js +27 -0
- package/test-utils/dom/internal/drag-handle.js.map +1 -0
- package/test-utils/selectors/internal/drag-handle.d.ts +9 -0
- package/test-utils/selectors/internal/drag-handle.js +27 -0
- package/test-utils/selectors/internal/drag-handle.js.map +1 -0
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/text-filter/internal.d.ts.map +1 -1
- package/text-filter/internal.js +22 -5
- package/text-filter/internal.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/text-filter/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/text-filter/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAQ1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAQ/C,QAAA,MAAM,kBAAkB,+HA0FvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
package/text-filter/internal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import React, { useRef } from 'react';
|
|
4
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import InternalInput from '../input/internal';
|
|
7
7
|
import { getBaseProps } from '../internal/base-component';
|
|
@@ -14,18 +14,35 @@ import { SearchResults } from './search-results';
|
|
|
14
14
|
import useDebounceSearchResultCallback from './use-debounce-search-result-callback';
|
|
15
15
|
import styles from './styles.css.js';
|
|
16
16
|
const InternalTextFilter = React.forwardRef((_a, ref) => {
|
|
17
|
-
var _b;
|
|
18
17
|
var { filteringText, filteringAriaLabel, filteringPlaceholder, filteringClearAriaLabel, controlId, ariaLabelledby, ariaDescribedby, disabled, countText, disableBrowserAutocorrect, onChange, onDelayedChange, loading = false, __internalRootRef } = _a, rest = __rest(_a, ["filteringText", "filteringAriaLabel", "filteringPlaceholder", "filteringClearAriaLabel", "controlId", "ariaLabelledby", "ariaDescribedby", "disabled", "countText", "disableBrowserAutocorrect", "onChange", "onDelayedChange", "loading", "__internalRootRef"]);
|
|
19
18
|
const baseProps = getBaseProps(rest);
|
|
20
19
|
const inputRef = useRef(null);
|
|
21
20
|
const searchResultsRef = useRef(null);
|
|
22
21
|
useForwardFocus(ref, inputRef);
|
|
22
|
+
const countValue = useMemo(() => {
|
|
23
|
+
if (!countText || typeof countText !== 'string') {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const m = countText.match(/\d+/);
|
|
27
|
+
return m ? parseInt(m[0]) : undefined;
|
|
28
|
+
}, [countText]);
|
|
23
29
|
const searchResultsId = useUniqueId('text-filter-search-results');
|
|
24
30
|
const showResults = filteringText && countText && !disabled;
|
|
25
31
|
const tableComponentContext = useTableComponentsContext();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
var _a;
|
|
34
|
+
if ((_a = tableComponentContext === null || tableComponentContext === void 0 ? void 0 : tableComponentContext.filterRef) === null || _a === void 0 ? void 0 : _a.current) {
|
|
35
|
+
tableComponentContext.filterRef.current.filterText = filteringText;
|
|
36
|
+
tableComponentContext.filterRef.current.filterCount = countValue;
|
|
37
|
+
tableComponentContext.filterRef.current.filtered = !!filteringText;
|
|
38
|
+
return () => {
|
|
39
|
+
var _a, _b, _c;
|
|
40
|
+
(_a = tableComponentContext.filterRef.current) === null || _a === void 0 ? true : delete _a.filterText;
|
|
41
|
+
(_b = tableComponentContext.filterRef.current) === null || _b === void 0 ? true : delete _b.filterCount;
|
|
42
|
+
(_c = tableComponentContext.filterRef.current) === null || _c === void 0 ? true : delete _c.filtered;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}, [tableComponentContext === null || tableComponentContext === void 0 ? void 0 : tableComponentContext.filterRef, countValue, filteringText]);
|
|
29
46
|
useDebounceSearchResultCallback({
|
|
30
47
|
searchQuery: filteringText,
|
|
31
48
|
countText,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/text-filter/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/text-filter/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,+BAA+B,MAAM,uCAAuC,CAAC;AAEpF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,CACzC,CACE,EAgB0B,EAC1B,GAAmC,EACnC,EAAE;QAlBF,EACE,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,SAAS,EACT,cAAc,EACd,eAAe,EACf,QAAQ,EACR,SAAS,EAC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M,CAAC,KAAK,EAAE,CAAC,EAC1F,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAAC,eAAe,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,GACzG;QACD,WAAW,CAAC,CAAC,CAAC,CACb,oBAAC,aAAa,IAAC,gBAAgB,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE,GAAG,EAAE,gBAAgB,IAClF,SAAS,CACI,CACjB,CAAC,CAAC,CAAC,IAAI,CACJ,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 React, { useEffect, useMemo, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport InternalInput from '../input/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { useTableComponentsContext } from '../internal/context/table-component-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { joinStrings } from '../internal/utils/strings';\nimport { InternalLiveRegionRef } from '../live-region/internal';\nimport { TextFilterProps } from './interfaces';\nimport { SearchResults } from './search-results';\nimport useDebounceSearchResultCallback from './use-debounce-search-result-callback';\n\nimport styles from './styles.css.js';\n\ntype InternalTextFilterProps = TextFilterProps & InternalBaseComponentProps;\n\nconst InternalTextFilter = React.forwardRef(\n (\n {\n filteringText,\n filteringAriaLabel,\n filteringPlaceholder,\n filteringClearAriaLabel,\n controlId,\n ariaLabelledby,\n ariaDescribedby,\n disabled,\n countText,\n disableBrowserAutocorrect,\n onChange,\n onDelayedChange,\n loading = false,\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 const searchResultsRef = useRef<InternalLiveRegionRef>(null);\n useForwardFocus(ref, inputRef);\n\n const countValue = useMemo(() => {\n if (!countText || typeof countText !== 'string') {\n return undefined;\n }\n\n const m = countText.match(/\\d+/);\n return m ? parseInt(m[0]) : undefined;\n }, [countText]);\n\n const searchResultsId = useUniqueId('text-filter-search-results');\n const showResults = filteringText && countText && !disabled;\n const tableComponentContext = useTableComponentsContext();\n\n useEffect(() => {\n if (tableComponentContext?.filterRef?.current) {\n tableComponentContext.filterRef.current.filterText = filteringText;\n tableComponentContext.filterRef.current.filterCount = countValue;\n tableComponentContext.filterRef.current.filtered = !!filteringText;\n\n return () => {\n delete tableComponentContext.filterRef.current?.filterText;\n delete tableComponentContext.filterRef.current?.filterCount;\n delete tableComponentContext.filterRef.current?.filtered;\n };\n }\n }, [tableComponentContext?.filterRef, countValue, filteringText]);\n\n useDebounceSearchResultCallback({\n searchQuery: filteringText,\n countText,\n loading,\n announceCallback: () => {\n searchResultsRef.current?.reannounce();\n },\n });\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <InternalInput\n __inheritFormFieldProps={true}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n ref={inputRef}\n className={styles.input}\n type=\"search\"\n ariaLabel={filteringAriaLabel}\n placeholder={filteringPlaceholder}\n value={filteringText}\n disabled={disabled}\n controlId={controlId}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={joinStrings(showResults ? searchResultsId : undefined, ariaDescribedby)}\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 {showResults ? (\n <SearchResults renderLiveRegion={!loading} id={searchResultsId} ref={searchResultsRef}>\n {countText}\n </SearchResults>\n ) : null}\n </div>\n );\n }\n);\n\nexport default InternalTextFilter;\n"]}
|