@cloudscape-design/components 3.0.311 → 3.0.313
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/autosuggest/virtual-list.d.ts.map +1 -1
- package/autosuggest/virtual-list.js +3 -4
- package/autosuggest/virtual-list.js.map +1 -1
- package/button/interfaces.d.ts +1 -1
- package/button/interfaces.js.map +1 -1
- package/button/internal.d.ts.map +1 -1
- package/button/internal.js +3 -1
- package/button/internal.js.map +1 -1
- package/code-editor/index.d.ts.map +1 -1
- package/code-editor/index.js +3 -2
- package/code-editor/index.js.map +1 -1
- package/code-editor/interfaces.d.ts +4 -0
- package/code-editor/interfaces.d.ts.map +1 -1
- package/code-editor/interfaces.js.map +1 -1
- package/code-editor/resizable-box/styles.css.js +3 -3
- package/code-editor/resizable-box/styles.scoped.css +10 -8
- package/code-editor/resizable-box/styles.selectors.js +3 -3
- package/code-editor/styles.css.js +32 -32
- package/code-editor/styles.scoped.css +189 -157
- package/code-editor/styles.selectors.js +32 -32
- package/container/interfaces.d.ts +50 -0
- package/container/interfaces.d.ts.map +1 -1
- package/container/interfaces.js.map +1 -1
- package/container/internal.d.ts +1 -1
- package/container/internal.d.ts.map +1 -1
- package/container/internal.js +24 -18
- package/container/internal.js.map +1 -1
- package/container/styles.css.js +28 -18
- package/container/styles.scoped.css +93 -36
- package/container/styles.selectors.js +28 -18
- package/expandable-section/expandable-section-header.d.ts +2 -1
- package/expandable-section/expandable-section-header.d.ts.map +1 -1
- package/expandable-section/expandable-section-header.js +6 -16
- package/expandable-section/expandable-section-header.js.map +1 -1
- package/expandable-section/internal.d.ts.map +1 -1
- package/expandable-section/internal.js +3 -2
- package/expandable-section/internal.js.map +1 -1
- package/help-panel/styles.css.js +4 -4
- package/help-panel/styles.scoped.css +135 -95
- package/help-panel/styles.selectors.js +4 -4
- package/i18n/provider.d.ts.map +1 -1
- package/i18n/provider.js +2 -0
- package/i18n/provider.js.map +1 -1
- package/internal/base-component/styles.scoped.css +382 -379
- package/internal/environment.js +1 -1
- package/internal/generated/theming/index.cjs +2 -1
- package/internal/generated/theming/index.js +2 -1
- package/internal/hooks/use-virtual/index.d.ts +27 -0
- package/internal/hooks/use-virtual/index.d.ts.map +1 -0
- package/internal/hooks/use-virtual/index.js +41 -0
- package/internal/hooks/use-virtual/index.js.map +1 -0
- package/internal/hooks/use-visual-mode/index.d.ts.map +1 -1
- package/internal/hooks/use-visual-mode/index.js +3 -0
- package/internal/hooks/use-visual-mode/index.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/property-filter/utils.d.ts.map +1 -1
- package/property-filter/utils.js +4 -1
- package/property-filter/utils.js.map +1 -1
- package/select/parts/virtual-list.d.ts.map +1 -1
- package/select/parts/virtual-list.js +2 -3
- package/select/parts/virtual-list.js.map +1 -1
- package/space-between/interfaces.d.ts +1 -1
- package/space-between/interfaces.d.ts.map +1 -1
- package/space-between/interfaces.js.map +1 -1
- package/space-between/styles.css.js +23 -21
- package/space-between/styles.scoped.css +30 -22
- package/space-between/styles.selectors.js +23 -21
- package/table/body-cell/index.d.ts.map +1 -1
- package/table/body-cell/index.js +9 -5
- package/table/body-cell/index.js.map +1 -1
- package/test-utils/dom/container/index.d.ts +1 -0
- package/test-utils/dom/container/index.js +3 -0
- package/test-utils/dom/container/index.js.map +1 -1
- package/test-utils/dom/expandable-section/index.js +1 -1
- package/test-utils/dom/expandable-section/index.js.map +1 -1
- package/test-utils/selectors/container/index.d.ts +1 -0
- package/test-utils/selectors/container/index.js +3 -0
- package/test-utils/selectors/container/index.js.map +1 -1
- package/test-utils/selectors/expandable-section/index.js +1 -1
- package/test-utils/selectors/expandable-section/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/text-content/styles.css.js +1 -1
- package/text-content/styles.scoped.css +65 -64
- package/text-content/styles.selectors.js +1 -1
package/internal/environment.js
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { VirtualItem } from 'react-virtual';
|
|
3
|
+
interface UseVirtualProps<Item> {
|
|
4
|
+
items: readonly Item[];
|
|
5
|
+
parentRef: React.RefObject<HTMLElement>;
|
|
6
|
+
estimateSize: () => number;
|
|
7
|
+
}
|
|
8
|
+
interface RowVirtualizer {
|
|
9
|
+
virtualItems: VirtualItem[];
|
|
10
|
+
totalSize: number;
|
|
11
|
+
scrollToIndex: (index: number) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The useVirtual from react-virtual@2 might produce an infinite update loop caused by setting
|
|
15
|
+
* measured item sizes in the render cycle (as part of the measureRef assignment):
|
|
16
|
+
* The sum of all measured item sizes is returned as totalSize which is then set on the list container.
|
|
17
|
+
* Enforcing new container height might result in an items size change e.g. when the content wraps.
|
|
18
|
+
*
|
|
19
|
+
* The infinite update cycle causes React "Maximum update depth exceeded" error and can be additionally confirmed
|
|
20
|
+
* by logging the totalSize which should then bounce between two values.
|
|
21
|
+
*
|
|
22
|
+
* The number of item refs assignments is limited to MAX_ITEM_MOUNTS unless items or indices change.
|
|
23
|
+
* That is based on the assumption the item height stays constant after its first render.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useVirtual<Item extends object>({ items, parentRef, estimateSize, }: UseVirtualProps<Item>): RowVirtualizer;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/hooks/use-virtual/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAmC,WAAW,EAAE,MAAM,eAAe,CAAC;AAI7E,UAAU,eAAe,CAAC,IAAI;IAC5B,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IACvB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,YAAY,EAAE,MAAM,MAAM,CAAC;CAC5B;AAED,UAAU,cAAc;IACtB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,IAAI,SAAS,MAAM,EAAE,EAC9C,KAAK,EACL,SAAS,EACT,YAAY,GACb,EAAE,eAAe,CAAC,IAAI,CAAC,GAAG,cAAc,CAgCxC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
4
|
+
import { useVirtual as useVirtualDefault } from 'react-virtual';
|
|
5
|
+
const MAX_ITEM_MOUNTS = 100;
|
|
6
|
+
/**
|
|
7
|
+
* The useVirtual from react-virtual@2 might produce an infinite update loop caused by setting
|
|
8
|
+
* measured item sizes in the render cycle (as part of the measureRef assignment):
|
|
9
|
+
* The sum of all measured item sizes is returned as totalSize which is then set on the list container.
|
|
10
|
+
* Enforcing new container height might result in an items size change e.g. when the content wraps.
|
|
11
|
+
*
|
|
12
|
+
* The infinite update cycle causes React "Maximum update depth exceeded" error and can be additionally confirmed
|
|
13
|
+
* by logging the totalSize which should then bounce between two values.
|
|
14
|
+
*
|
|
15
|
+
* The number of item refs assignments is limited to MAX_ITEM_MOUNTS unless items or indices change.
|
|
16
|
+
* That is based on the assumption the item height stays constant after its first render.
|
|
17
|
+
*/
|
|
18
|
+
export function useVirtual({ items, parentRef, estimateSize, }) {
|
|
19
|
+
const rowVirtualizer = useVirtualDefault({ size: items.length, parentRef, estimateSize, overscan: 5 });
|
|
20
|
+
// Cache virtual item mounts to limit the amount of mounts per item.
|
|
21
|
+
const measuresCache = useRef(new WeakMap());
|
|
22
|
+
// Clear mounts cache every time indices, items, or size estimate change.
|
|
23
|
+
const indicesKey = rowVirtualizer.virtualItems.map(item => `${item.index}`).join(':');
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
measuresCache.current = new WeakMap();
|
|
26
|
+
}, [indicesKey, items, estimateSize]);
|
|
27
|
+
const virtualItems = useMemo(() => rowVirtualizer.virtualItems.map(virtualItem => (Object.assign(Object.assign({}, virtualItem), { measureRef: (node) => {
|
|
28
|
+
var _a;
|
|
29
|
+
const mountedCount = (_a = measuresCache.current.get(items[virtualItem.index])) !== null && _a !== void 0 ? _a : 0;
|
|
30
|
+
if (mountedCount < MAX_ITEM_MOUNTS) {
|
|
31
|
+
virtualItem.measureRef(node);
|
|
32
|
+
measuresCache.current.set(items[virtualItem.index], mountedCount + 1);
|
|
33
|
+
}
|
|
34
|
+
} }))), [items, rowVirtualizer.virtualItems]);
|
|
35
|
+
return {
|
|
36
|
+
virtualItems,
|
|
37
|
+
totalSize: rowVirtualizer.totalSize,
|
|
38
|
+
scrollToIndex: rowVirtualizer.scrollToIndex,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["internal/hooks/use-virtual/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAe,MAAM,eAAe,CAAC;AAE7E,MAAM,eAAe,GAAG,GAAG,CAAC;AAc5B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAsB,EAC9C,KAAK,EACL,SAAS,EACT,YAAY,GACU;IACtB,MAAM,cAAc,GAAG,iBAAiB,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;IAEvG,oEAAoE;IACpE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,OAAO,EAAgB,CAAC,CAAC;IAE1D,yEAAyE;IACzE,MAAM,UAAU,GAAG,cAAc,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtF,SAAS,CAAC,GAAG,EAAE;QACb,aAAa,CAAC,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IACxC,CAAC,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;IAEtC,MAAM,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CACH,cAAc,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,iCAC1C,WAAW,KACd,UAAU,EAAE,CAAC,IAAwB,EAAE,EAAE;;YACvC,MAAM,YAAY,GAAG,MAAA,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,mCAAI,CAAC,CAAC;YAC9E,IAAI,YAAY,GAAG,eAAe,EAAE;gBAClC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;gBAC7B,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;aACvE;QACH,CAAC,IACD,CAAC,EACL,CAAC,KAAK,EAAE,cAAc,CAAC,YAAY,CAAC,CACrC,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,SAAS,EAAE,cAAc,CAAC,SAAS;QACnC,aAAa,EAAE,cAAc,CAAC,aAAa;KAC5C,CAAC;AACJ,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 { useVirtual as useVirtualDefault, VirtualItem } from 'react-virtual';\n\nconst MAX_ITEM_MOUNTS = 100;\n\ninterface UseVirtualProps<Item> {\n items: readonly Item[];\n parentRef: React.RefObject<HTMLElement>;\n estimateSize: () => number;\n}\n\ninterface RowVirtualizer {\n virtualItems: VirtualItem[];\n totalSize: number;\n scrollToIndex: (index: number) => void;\n}\n\n/**\n * The useVirtual from react-virtual@2 might produce an infinite update loop caused by setting\n * measured item sizes in the render cycle (as part of the measureRef assignment):\n * The sum of all measured item sizes is returned as totalSize which is then set on the list container.\n * Enforcing new container height might result in an items size change e.g. when the content wraps.\n *\n * The infinite update cycle causes React \"Maximum update depth exceeded\" error and can be additionally confirmed\n * by logging the totalSize which should then bounce between two values.\n *\n * The number of item refs assignments is limited to MAX_ITEM_MOUNTS unless items or indices change.\n * That is based on the assumption the item height stays constant after its first render.\n */\nexport function useVirtual<Item extends object>({\n items,\n parentRef,\n estimateSize,\n}: UseVirtualProps<Item>): RowVirtualizer {\n const rowVirtualizer = useVirtualDefault({ size: items.length, parentRef, estimateSize, overscan: 5 });\n\n // Cache virtual item mounts to limit the amount of mounts per item.\n const measuresCache = useRef(new WeakMap<Item, number>());\n\n // Clear mounts cache every time indices, items, or size estimate change.\n const indicesKey = rowVirtualizer.virtualItems.map(item => `${item.index}`).join(':');\n useEffect(() => {\n measuresCache.current = new WeakMap();\n }, [indicesKey, items, estimateSize]);\n\n const virtualItems = useMemo(\n () =>\n rowVirtualizer.virtualItems.map(virtualItem => ({\n ...virtualItem,\n measureRef: (node: null | HTMLElement) => {\n const mountedCount = measuresCache.current.get(items[virtualItem.index]) ?? 0;\n if (mountedCount < MAX_ITEM_MOUNTS) {\n virtualItem.measureRef(node);\n measuresCache.current.set(items[virtualItem.index], mountedCount + 1);\n }\n },\n })),\n [items, rowVirtualizer.virtualItems]\n );\n\n return {\n virtualItems,\n totalSize: rowVirtualizer.totalSize,\n scrollToIndex: rowVirtualizer.scrollToIndex,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/hooks/use-visual-mode/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/hooks/use-visual-mode/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAWxC,wBAAgB,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,oBAUtE;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,6BAUtE;AAED,eAAO,MAAM,gBAAgB,eAA+D,CAAC;AAM7F,wBAAgB,uBAAuB,SAEtC;AAMD,wBAAgB,uBAAuB,YAetC;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,WAMxE"}
|
|
@@ -7,6 +7,9 @@ import { findUpUntil } from '../../utils/dom';
|
|
|
7
7
|
import { useMutationObserver } from '../use-mutation-observer';
|
|
8
8
|
import { isDevelopment } from '../../is-development';
|
|
9
9
|
import { warnOnce } from '../../logging';
|
|
10
|
+
// Note that this hook doesn't take into consideration @media print (unlike the dark mode CSS),
|
|
11
|
+
// due to challenges with cross-browser implementations of media/print state change listeners.
|
|
12
|
+
// This means that components using this hook will render in dark mode even when printing.
|
|
10
13
|
export function useCurrentMode(elementRef) {
|
|
11
14
|
const [value, setValue] = useState('light');
|
|
12
15
|
useMutationObserver(elementRef, node => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["internal/hooks/use-visual-mode/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MA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CAAC;IAC1D,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,uBAAuB,CAAC;AAE7F,8EAA8E;AAC9E,IAAI,kBAAkB,GAAwB,SAAS,CAAC;AAExD,cAAc;AACd,MAAM,UAAU,uBAAuB;IACrC,kBAAkB,GAAG,SAAS,CAAC;AACjC,CAAC;AAED,SAAS,mBAAmB;IAC1B,OAAO,OAAO,QAAQ,KAAK,WAAW,IAAI,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC;AAC9F,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,IAAI,kBAAkB,KAAK,SAAS,EAAE;QACpC,kBAAkB,GAAG,mBAAmB,EAAE,CAAC;KAC5C;IACD,IAAI,aAAa,EAAE;QACjB,MAAM,qBAAqB,GAAG,mBAAmB,EAAE,CAAC;QACpD,IAAI,qBAAqB,KAAK,kBAAkB,EAAE;YAChD,QAAQ,CACN,gBAAgB,EAChB,iEAAiE;gBAC/D,kGAAkG,CACrG,CAAC;SACH;KACF;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,UAAwC;IACvE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1C,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE;QACrC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,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 { ALWAYS_VISUAL_REFRESH } from '../../environment';\nimport { isMotionDisabled } from '../../motion';\nimport { findUpUntil } from '../../utils/dom';\nimport { useMutationObserver } from '../use-mutation-observer';\nimport { isDevelopment } from '../../is-development';\nimport { warnOnce } from '../../logging';\n\nexport function useCurrentMode(elementRef: React.RefObject<HTMLElement>) {\n const [value, setValue] = useState<'light' | 'dark'>('light');\n useMutationObserver(elementRef, node => {\n const darkModeParent = findUpUntil(\n node,\n node => node.classList.contains('awsui-polaris-dark-mode') || node.classList.contains('awsui-dark-mode')\n );\n setValue(darkModeParent ? 'dark' : 'light');\n });\n return value;\n}\n\nexport function useDensityMode(elementRef: React.RefObject<HTMLElement>) {\n const [value, setValue] = useState<'comfortable' | 'compact'>('comfortable');\n useMutationObserver(elementRef, node => {\n const compactModeParent = findUpUntil(\n node,\n node => node.classList.contains('awsui-polaris-compact-mode') || node.classList.contains('awsui-compact-mode')\n );\n setValue(compactModeParent ? 'compact' : 'comfortable');\n });\n return value;\n}\n\nexport const useVisualRefresh = ALWAYS_VISUAL_REFRESH ? () => true : useVisualRefreshDynamic;\n\n// We expect VR is to be set only once and before the application is rendered.\nlet visualRefreshState: undefined | boolean = undefined;\n\n// for testing\nexport function clearVisualRefreshState() {\n visualRefreshState = undefined;\n}\n\nfunction detectVisualRefresh() {\n return typeof document !== 'undefined' && !!document.querySelector('.awsui-visual-refresh');\n}\n\nexport function useVisualRefreshDynamic() {\n if (visualRefreshState === undefined) {\n visualRefreshState = detectVisualRefresh();\n }\n if (isDevelopment) {\n const newVisualRefreshState = detectVisualRefresh();\n if (newVisualRefreshState !== visualRefreshState) {\n warnOnce(\n 'Visual Refresh',\n 'Dynamic visual refresh change detected. This is not supported. ' +\n 'Make sure `awsui-visual-refresh` is attached to the `<body>` element before initial React render'\n );\n }\n }\n return visualRefreshState;\n}\n\nexport function useReducedMotion(elementRef: React.RefObject<HTMLElement>) {\n const [value, setValue] = useState(false);\n useMutationObserver(elementRef, node => {\n setValue(isMotionDisabled(node));\n });\n return value;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index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,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,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 { ALWAYS_VISUAL_REFRESH } from '../../environment';\nimport { isMotionDisabled } from '../../motion';\nimport { findUpUntil } from '../../utils/dom';\nimport { useMutationObserver } from '../use-mutation-observer';\nimport { isDevelopment } from '../../is-development';\nimport { warnOnce } from '../../logging';\n\n// Note that this hook doesn't take into consideration @media print (unlike the dark mode CSS),\n// due to challenges with cross-browser implementations of media/print state change listeners.\n// This means that components using this hook will render in dark mode even when printing.\nexport function useCurrentMode(elementRef: React.RefObject<HTMLElement>) {\n const [value, setValue] = useState<'light' | 'dark'>('light');\n useMutationObserver(elementRef, node => {\n const darkModeParent = findUpUntil(\n node,\n node => node.classList.contains('awsui-polaris-dark-mode') || node.classList.contains('awsui-dark-mode')\n );\n setValue(darkModeParent ? 'dark' : 'light');\n });\n return value;\n}\n\nexport function useDensityMode(elementRef: React.RefObject<HTMLElement>) {\n const [value, setValue] = useState<'comfortable' | 'compact'>('comfortable');\n useMutationObserver(elementRef, node => {\n const compactModeParent = findUpUntil(\n node,\n node => node.classList.contains('awsui-polaris-compact-mode') || node.classList.contains('awsui-compact-mode')\n );\n setValue(compactModeParent ? 'compact' : 'comfortable');\n });\n return value;\n}\n\nexport const useVisualRefresh = ALWAYS_VISUAL_REFRESH ? () => true : useVisualRefreshDynamic;\n\n// We expect VR is to be set only once and before the application is rendered.\nlet visualRefreshState: undefined | boolean = undefined;\n\n// for testing\nexport function clearVisualRefreshState() {\n visualRefreshState = undefined;\n}\n\nfunction detectVisualRefresh() {\n return typeof document !== 'undefined' && !!document.querySelector('.awsui-visual-refresh');\n}\n\nexport function useVisualRefreshDynamic() {\n if (visualRefreshState === undefined) {\n visualRefreshState = detectVisualRefresh();\n }\n if (isDevelopment) {\n const newVisualRefreshState = detectVisualRefresh();\n if (newVisualRefreshState !== visualRefreshState) {\n warnOnce(\n 'Visual Refresh',\n 'Dynamic visual refresh change detected. This is not supported. ' +\n 'Make sure `awsui-visual-refresh` is attached to the `<body>` element before initial React render'\n );\n }\n }\n return visualRefreshState;\n}\n\nexport function useReducedMotion(elementRef: React.RefObject<HTMLElement>) {\n const [value, setValue] = useState(false);\n useMutationObserver(elementRef, node => {\n setValue(isMotionDisabled(node));\n });\n return value;\n}\n"]}
|
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"lib/default/","sources":["property-filter/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG7G,wBAAgB,sBAAsB,CACpC,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,EACzD,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,yBAAyB,CAgBlC;AAGD,wBAAgB,aAAa,CAC3B,gBAAgB,EAAE,SAAS,kBAAkB,EAAE,EAC/C,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,kBAAkB,CAc3B;AAGD,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,SAAS,kBAAkB,EAAE,EAC/C,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,MAAM,CAUf;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"lib/default/","sources":["property-filter/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG7G,wBAAgB,sBAAsB,CACpC,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,EACzD,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,yBAAyB,CAgBlC;AAGD,wBAAgB,aAAa,CAC3B,gBAAgB,EAAE,SAAS,kBAAkB,EAAE,EAC/C,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,kBAAkB,CAc3B;AAGD,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,SAAS,kBAAkB,EAAE,EAC/C,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,MAAM,CAUf;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,GAAG,KAAK,CAqBzG;AAED,wBAAgB,gBAAgB,CAAC,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,EAAE,GAAG,EAAE,MAAM,8CAGtG;AAED,wBAAgB,iBAAiB,CAAC,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,EAAE,KAAK,EAAE,KAAK;;;;;EAOxG;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUhD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
package/property-filter/utils.js
CHANGED
|
@@ -48,7 +48,10 @@ export function matchTokenValue(token, filteringOptions) {
|
|
|
48
48
|
// exact match found: return it
|
|
49
49
|
return Object.assign(Object.assign({}, token), { value: option.value });
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
// By default, the token value is a string, but when a custom property is used,
|
|
52
|
+
// the token value can be any, therefore we need to check for its type before calling toLowerCase()
|
|
53
|
+
if (typeof token.value === 'string' &&
|
|
54
|
+
token.value.toLowerCase() === ((_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.value) !== null && _b !== void 0 ? _b : '').toLowerCase()) {
|
|
52
55
|
// non-exact match: save and keep running in case exact match found later
|
|
53
56
|
bestMatch.value = option.value;
|
|
54
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ut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AAC;AACtC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ComparisonOperator, InternalFilteringOption, InternalFilteringProperty, Token } from './interfaces';\n\n// Finds the longest property the filtering text starts from.\nexport function matchFilteringProperty(\n filteringProperties: readonly InternalFilteringProperty[],\n filteringText: string\n): null | InternalFilteringProperty {\n let maxLength = 0;\n let matchedProperty: null | InternalFilteringProperty = null;\n\n for (const property of filteringProperties) {\n if (\n (property.propertyLabel.length >= maxLength && startsWith(filteringText, property.propertyLabel)) ||\n (property.propertyLabel.length > maxLength &&\n startsWith(filteringText.toLowerCase(), property.propertyLabel.toLowerCase()))\n ) {\n maxLength = property.propertyLabel.length;\n matchedProperty = property;\n }\n }\n\n return matchedProperty;\n}\n\n// Finds the longest operator the filtering text starts from.\nexport function matchOperator(\n allowedOperators: readonly ComparisonOperator[],\n filteringText: string\n): null | ComparisonOperator {\n filteringText = filteringText.toLowerCase();\n\n let maxLength = 0;\n let matchedOperator: null | ComparisonOperator = null;\n\n for (const operator of allowedOperators) {\n if (operator.length > maxLength && startsWith(filteringText, operator.toLowerCase())) {\n maxLength = operator.length;\n matchedOperator = operator;\n }\n }\n\n return matchedOperator;\n}\n\n// Finds if the filtering text matches any operator prefix.\nexport function matchOperatorPrefix(\n allowedOperators: readonly ComparisonOperator[],\n filteringText: string\n): null | string {\n if (filteringText.trim().length === 0) {\n return '';\n }\n for (const operator of allowedOperators) {\n if (startsWith(operator.toLowerCase(), filteringText.toLowerCase())) {\n return filteringText;\n }\n }\n return null;\n}\n\nexport function matchTokenValue(token: Token, filteringOptions: readonly InternalFilteringOption[]): Token {\n const propertyOptions = filteringOptions.filter(option => option.propertyKey === token.propertyKey);\n const bestMatch = { ...token };\n for (const option of propertyOptions) {\n if ((option.label && option.label === token.value) || (!option.label && option.value === token.value)) {\n // exact match found: return it\n return { ...token, value: option.value };\n }\n\n // By default, the token value is a string, but when a custom property is used,\n // the token value can be any, therefore we need to check for its type before calling toLowerCase()\n if (\n typeof token.value === 'string' &&\n token.value.toLowerCase() === (option.label ?? option.value ?? '').toLowerCase()\n ) {\n // non-exact match: save and keep running in case exact match found later\n bestMatch.value = option.value;\n }\n }\n\n return bestMatch;\n}\n\nexport function getPropertyByKey(filteringProperties: readonly InternalFilteringProperty[], key: string) {\n const propertyMap = new Map(filteringProperties.map(prop => [prop.propertyKey, prop]));\n return propertyMap.get(key) as InternalFilteringProperty | undefined;\n}\n\nexport function getFormattedToken(filteringProperties: readonly InternalFilteringProperty[], token: Token) {\n const property = token.propertyKey ? getPropertyByKey(filteringProperties, token.propertyKey) : undefined;\n const valueFormatter = property?.getValueFormatter(token.operator);\n const propertyLabel = property && property.propertyLabel;\n const tokenValue = valueFormatter ? valueFormatter(token.value) : token.value;\n const label = `${propertyLabel ?? ''} ${token.operator} ${tokenValue}`;\n return { property: propertyLabel, operator: token.operator, value: tokenValue, label };\n}\n\nexport function trimStart(source: string): string {\n let spacesLength = 0;\n for (let i = 0; i < source.length; i++) {\n if (source[i] === ' ') {\n spacesLength++;\n } else {\n break;\n }\n }\n return source.slice(spacesLength);\n}\n\nexport function trimFirstSpace(source: string): string {\n return source[0] === ' ' ? source.slice(1) : source;\n}\n\nfunction startsWith(source: string, target: string): boolean {\n return source.indexOf(target) === 0;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-list.d.ts","sourceRoot":"lib/default/","sources":["select/parts/virtual-list.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA+D,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"virtual-list.d.ts","sourceRoot":"lib/default/","sources":["select/parts/virtual-list.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAGpF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;;AA6F/C,wBAAuC"}
|
|
@@ -4,9 +4,9 @@ import { useMergeRefs } from '../../internal/hooks/use-merge-refs';
|
|
|
4
4
|
import React, { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
|
|
5
5
|
import OptionsList from '../../internal/components/options-list';
|
|
6
6
|
import { renderOptions } from '../utils/render-options';
|
|
7
|
-
import { useVirtual } from 'react-virtual';
|
|
8
7
|
import { useContainerQuery } from '../../internal/hooks/container-queries';
|
|
9
8
|
import styles from './styles.css.js';
|
|
9
|
+
import { useVirtual } from '../../internal/hooks/use-virtual';
|
|
10
10
|
const VirtualList = (props, ref) => {
|
|
11
11
|
return props.menuProps.open ? React.createElement(VirtualListOpen, Object.assign({}, props, { ref: ref })) : React.createElement(VirtualListClosed, Object.assign({}, props, { ref: ref }));
|
|
12
12
|
};
|
|
@@ -16,7 +16,7 @@ const VirtualListOpen = forwardRef(({ menuProps, getOptionProps, filteredOptions
|
|
|
16
16
|
const menuRefObject = useRef(null);
|
|
17
17
|
const menuRef = useMergeRefs(menuMeasureRef, menuRefObject, menuProps.ref);
|
|
18
18
|
const { virtualItems, totalSize, scrollToIndex } = useVirtual({
|
|
19
|
-
|
|
19
|
+
items: filteredOptions,
|
|
20
20
|
parentRef: menuRefObject,
|
|
21
21
|
// estimateSize is a dependency of measurements memo. We update it to force full recalculation
|
|
22
22
|
// when the height of any option could have changed:
|
|
@@ -24,7 +24,6 @@ const VirtualListOpen = forwardRef(({ menuProps, getOptionProps, filteredOptions
|
|
|
24
24
|
// 2: because the option changed its content (filteringValue property controls the highlight and the visibility of hidden tags)
|
|
25
25
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
26
|
estimateSize: useCallback(() => 31, [width, filteringValue]),
|
|
27
|
-
overscan: 5,
|
|
28
27
|
});
|
|
29
28
|
useImperativeHandle(ref, () => (index) => {
|
|
30
29
|
if (highlightType === 'keyboard') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-list.js","sourceRoot":"lib/default/","sources":["select/parts/virtual-list.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AAC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,MAAM,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAI;QAC3G,YAAY;QACZ,UAAU,CAAC,CAAC,CAAC,CACZ,4BAAI,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,IAC/C,UAAU,CACR,CACN,CAAC,CAAC,CAAC,IAAI,CACI,CACf,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,iBAAiB,GAAG,UAAU,CAClC,CAAC,EAAE,SAAS,EAAE,UAAU,EAAmB,EAAE,GAA6C,EAAE,EAAE;IAC5F,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAC7C,OAAO,CACL,oBAAC,WAAW,oBAAK,SAAS,IAAE,GAAG,EAAE,SAAS,CAAC,GAAG,KAC3C,UAAU,CAAC,CAAC,CAAC,CACZ,4BAAI,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,IAC/C,UAAU,CACR,CACN,CAAC,CAAC,CAAC,IAAI,CACI,CACf,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC,WAAW,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useMergeRefs } from '../../internal/hooks/use-merge-refs';\nimport React, { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';\nimport OptionsList from '../../internal/components/options-list';\nimport { renderOptions } from '../utils/render-options';\nimport { SelectListProps } from './plain-list';\nimport { useContainerQuery } from '../../internal/hooks/container-queries';\n\nimport styles from './styles.css.js';\nimport { useVirtual } from '../../internal/hooks/use-virtual';\n\nconst VirtualList = (props: SelectListProps, ref: React.Ref<SelectListProps.SelectListRef>) => {\n return props.menuProps.open ? <VirtualListOpen {...props} ref={ref} /> : <VirtualListClosed {...props} ref={ref} />;\n};\n\nconst VirtualListOpen = forwardRef(\n (\n {\n menuProps,\n getOptionProps,\n filteredOptions,\n filteringValue,\n highlightType,\n checkboxes,\n hasDropdownStatus,\n listBottom,\n useInteractiveGroups,\n screenReaderContent,\n }: SelectListProps,\n ref: React.Ref<SelectListProps.SelectListRef>\n ) => {\n // update component, when it gets wider or narrower to reposition items\n const [width, menuMeasureRef] = useContainerQuery(rect => rect.width, []);\n const menuRefObject = useRef(null);\n const menuRef = useMergeRefs(menuMeasureRef, menuRefObject, menuProps.ref);\n\n const { virtualItems, totalSize, scrollToIndex } = useVirtual({\n items: filteredOptions,\n parentRef: menuRefObject,\n // estimateSize is a dependency of measurements memo. We update it to force full recalculation\n // when the height of any option could have changed:\n // 1: because the component got resized (width property got updated)\n // 2: because the option changed its content (filteringValue property controls the highlight and the visibility of hidden tags)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n estimateSize: useCallback(() => 31, [width, filteringValue]),\n });\n\n useImperativeHandle(\n ref,\n () => (index: number) => {\n if (highlightType === 'keyboard') {\n scrollToIndex(index);\n }\n },\n [highlightType, scrollToIndex]\n );\n const finalOptions = renderOptions({\n options: virtualItems.map(({ index }) => filteredOptions[index]),\n getOptionProps,\n filteringValue,\n highlightType,\n checkboxes,\n hasDropdownStatus,\n virtualItems,\n useInteractiveGroups,\n screenReaderContent,\n ariaSetsize: filteredOptions.length,\n });\n\n return (\n <OptionsList {...menuProps} ref={menuRef}>\n <div aria-hidden=\"true\" key=\"total-size\" className={styles['layout-strut']} style={{ height: totalSize }} />\n {finalOptions}\n {listBottom ? (\n <li role=\"option\" className={styles['list-bottom']}>\n {listBottom}\n </li>\n ) : null}\n </OptionsList>\n );\n }\n);\n\nconst VirtualListClosed = forwardRef(\n ({ menuProps, listBottom }: SelectListProps, ref: React.Ref<SelectListProps.SelectListRef>) => {\n useImperativeHandle(ref, () => () => {}, []);\n return (\n <OptionsList {...menuProps} ref={menuProps.ref}>\n {listBottom ? (\n <li role=\"option\" className={styles['list-bottom']}>\n {listBottom}\n </li>\n ) : null}\n </OptionsList>\n );\n }\n);\n\nexport default forwardRef(VirtualList);\n"]}
|
|
@@ -21,6 +21,6 @@ export interface SpaceBetweenProps extends BaseComponentProps {
|
|
|
21
21
|
export declare namespace SpaceBetweenProps {
|
|
22
22
|
type Direction = 'vertical' | 'horizontal';
|
|
23
23
|
type Size = 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';
|
|
24
|
-
type AlignItems = 'center';
|
|
24
|
+
type AlignItems = 'center' | 'start' | 'end';
|
|
25
25
|
}
|
|
26
26
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["space-between/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D;;OAEG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAC,SAAS,CAAC;IAExC;;OAEG;IACH,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC;CAC3C;AAED,yBAAiB,iBAAiB,CAAC;IACjC,KAAY,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC;IAElD,KAAY,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC;IAE1E,KAAY,UAAU,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["space-between/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D;;OAEG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAC,SAAS,CAAC;IAExC;;OAEG;IACH,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC;CAC3C;AAED,yBAAiB,iBAAiB,CAAC;IACjC,KAAY,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC;IAElD,KAAY,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC;IAE1E,KAAY,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;CACrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["space-between/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface SpaceBetweenProps extends BaseComponentProps {\n /**\n * Defines the direction in which the content is laid out.\n */\n direction?: SpaceBetweenProps.Direction;\n\n /**\n * Defines the spacing between the individual items of the content.\n */\n size: SpaceBetweenProps.Size;\n\n /**\n * Content of this component.\n */\n children?: React.ReactNode;\n\n /**\n * Determines how the child elements will be aligned based on the [align-items](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) property of the CSS Flexbox.\n */\n alignItems?: SpaceBetweenProps.AlignItems;\n}\n\nexport namespace SpaceBetweenProps {\n export type Direction = 'vertical' | 'horizontal';\n\n export type Size = 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';\n\n export type AlignItems = 'center';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["space-between/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface SpaceBetweenProps extends BaseComponentProps {\n /**\n * Defines the direction in which the content is laid out.\n */\n direction?: SpaceBetweenProps.Direction;\n\n /**\n * Defines the spacing between the individual items of the content.\n */\n size: SpaceBetweenProps.Size;\n\n /**\n * Content of this component.\n */\n children?: React.ReactNode;\n\n /**\n * Determines how the child elements will be aligned based on the [align-items](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) property of the CSS Flexbox.\n */\n alignItems?: SpaceBetweenProps.AlignItems;\n}\n\nexport namespace SpaceBetweenProps {\n export type Direction = 'vertical' | 'horizontal';\n\n export type Size = 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';\n\n export type AlignItems = 'center' | 'start' | 'end';\n}\n"]}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"child": "
|
|
6
|
-
"horizontal": "
|
|
7
|
-
"horizontal-xxxs": "awsui_horizontal-
|
|
8
|
-
"horizontal-xxs": "awsui_horizontal-
|
|
9
|
-
"horizontal-xs": "awsui_horizontal-
|
|
10
|
-
"horizontal-s": "awsui_horizontal-
|
|
11
|
-
"horizontal-m": "awsui_horizontal-
|
|
12
|
-
"horizontal-l": "awsui_horizontal-
|
|
13
|
-
"horizontal-xl": "awsui_horizontal-
|
|
14
|
-
"horizontal-xxl": "awsui_horizontal-
|
|
15
|
-
"vertical": "
|
|
16
|
-
"vertical-xxxs": "awsui_vertical-
|
|
17
|
-
"vertical-xxs": "awsui_vertical-
|
|
18
|
-
"vertical-xs": "awsui_vertical-
|
|
19
|
-
"vertical-s": "awsui_vertical-
|
|
20
|
-
"vertical-m": "awsui_vertical-
|
|
21
|
-
"vertical-l": "awsui_vertical-
|
|
22
|
-
"vertical-xl": "awsui_vertical-
|
|
23
|
-
"vertical-xxl": "awsui_vertical-
|
|
24
|
-
"align-center": "awsui_align-
|
|
4
|
+
"root": "awsui_root_18582_vrts6_93",
|
|
5
|
+
"child": "awsui_child_18582_vrts6_97",
|
|
6
|
+
"horizontal": "awsui_horizontal_18582_vrts6_108",
|
|
7
|
+
"horizontal-xxxs": "awsui_horizontal-xxxs_18582_vrts6_112",
|
|
8
|
+
"horizontal-xxs": "awsui_horizontal-xxs_18582_vrts6_115",
|
|
9
|
+
"horizontal-xs": "awsui_horizontal-xs_18582_vrts6_118",
|
|
10
|
+
"horizontal-s": "awsui_horizontal-s_18582_vrts6_121",
|
|
11
|
+
"horizontal-m": "awsui_horizontal-m_18582_vrts6_124",
|
|
12
|
+
"horizontal-l": "awsui_horizontal-l_18582_vrts6_127",
|
|
13
|
+
"horizontal-xl": "awsui_horizontal-xl_18582_vrts6_130",
|
|
14
|
+
"horizontal-xxl": "awsui_horizontal-xxl_18582_vrts6_133",
|
|
15
|
+
"vertical": "awsui_vertical_18582_vrts6_140",
|
|
16
|
+
"vertical-xxxs": "awsui_vertical-xxxs_18582_vrts6_143",
|
|
17
|
+
"vertical-xxs": "awsui_vertical-xxs_18582_vrts6_146",
|
|
18
|
+
"vertical-xs": "awsui_vertical-xs_18582_vrts6_149",
|
|
19
|
+
"vertical-s": "awsui_vertical-s_18582_vrts6_152",
|
|
20
|
+
"vertical-m": "awsui_vertical-m_18582_vrts6_155",
|
|
21
|
+
"vertical-l": "awsui_vertical-l_18582_vrts6_158",
|
|
22
|
+
"vertical-xl": "awsui_vertical-xl_18582_vrts6_161",
|
|
23
|
+
"vertical-xxl": "awsui_vertical-xxl_18582_vrts6_164",
|
|
24
|
+
"align-center": "awsui_align-center_18582_vrts6_168",
|
|
25
|
+
"align-start": "awsui_align-start_18582_vrts6_172",
|
|
26
|
+
"align-end": "awsui_align-end_18582_vrts6_176"
|
|
25
27
|
};
|
|
26
28
|
|
|
@@ -90,81 +90,89 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
90
90
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
91
91
|
SPDX-License-Identifier: Apache-2.0
|
|
92
92
|
*/
|
|
93
|
-
.
|
|
93
|
+
.awsui_root_18582_vrts6_93:not(#\9) {
|
|
94
94
|
display: flex;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
.
|
|
97
|
+
.awsui_child_18582_vrts6_97:not(#\9) {
|
|
98
98
|
/* used in test-utils */
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
.
|
|
101
|
+
.awsui_child_18582_vrts6_97:not(#\9):empty {
|
|
102
102
|
display: none;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
/*
|
|
106
106
|
* Horizontal variant
|
|
107
107
|
*/
|
|
108
|
-
.
|
|
108
|
+
.awsui_horizontal_18582_vrts6_108:not(#\9) {
|
|
109
109
|
flex-direction: row;
|
|
110
110
|
flex-wrap: wrap;
|
|
111
111
|
}
|
|
112
|
-
.awsui_horizontal-
|
|
112
|
+
.awsui_horizontal-xxxs_18582_vrts6_112:not(#\9) {
|
|
113
113
|
gap: var(--space-xxxs-j6dpcy, 2px);
|
|
114
114
|
}
|
|
115
|
-
.awsui_horizontal-
|
|
115
|
+
.awsui_horizontal-xxs_18582_vrts6_115:not(#\9) {
|
|
116
116
|
gap: var(--space-xxs-ja5cp8, 4px);
|
|
117
117
|
}
|
|
118
|
-
.awsui_horizontal-
|
|
118
|
+
.awsui_horizontal-xs_18582_vrts6_118:not(#\9) {
|
|
119
119
|
gap: var(--space-xs-edba2s, 8px);
|
|
120
120
|
}
|
|
121
|
-
.awsui_horizontal-
|
|
121
|
+
.awsui_horizontal-s_18582_vrts6_121:not(#\9) {
|
|
122
122
|
gap: var(--space-s-hdd878, 12px);
|
|
123
123
|
}
|
|
124
|
-
.awsui_horizontal-
|
|
124
|
+
.awsui_horizontal-m_18582_vrts6_124:not(#\9) {
|
|
125
125
|
gap: var(--space-m-h2th94, 16px);
|
|
126
126
|
}
|
|
127
|
-
.awsui_horizontal-
|
|
127
|
+
.awsui_horizontal-l_18582_vrts6_127:not(#\9) {
|
|
128
128
|
gap: var(--space-l-f4l5gr, 20px);
|
|
129
129
|
}
|
|
130
|
-
.awsui_horizontal-
|
|
130
|
+
.awsui_horizontal-xl_18582_vrts6_130:not(#\9) {
|
|
131
131
|
gap: var(--space-xl-gsucfg, 24px);
|
|
132
132
|
}
|
|
133
|
-
.awsui_horizontal-
|
|
133
|
+
.awsui_horizontal-xxl_18582_vrts6_133:not(#\9) {
|
|
134
134
|
gap: var(--space-xxl-sgg5p8, 32px);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
/*
|
|
138
138
|
* Vertical variant
|
|
139
139
|
*/
|
|
140
|
-
.
|
|
140
|
+
.awsui_vertical_18582_vrts6_140:not(#\9) {
|
|
141
141
|
flex-direction: column;
|
|
142
142
|
}
|
|
143
|
-
.awsui_vertical-
|
|
143
|
+
.awsui_vertical-xxxs_18582_vrts6_143:not(#\9) {
|
|
144
144
|
row-gap: var(--space-xxxs-j6dpcy, 2px);
|
|
145
145
|
}
|
|
146
|
-
.awsui_vertical-
|
|
146
|
+
.awsui_vertical-xxs_18582_vrts6_146:not(#\9) {
|
|
147
147
|
row-gap: var(--space-xxs-ja5cp8, 4px);
|
|
148
148
|
}
|
|
149
|
-
.awsui_vertical-
|
|
149
|
+
.awsui_vertical-xs_18582_vrts6_149:not(#\9) {
|
|
150
150
|
row-gap: var(--space-xs-edba2s, 8px);
|
|
151
151
|
}
|
|
152
|
-
.awsui_vertical-
|
|
152
|
+
.awsui_vertical-s_18582_vrts6_152:not(#\9) {
|
|
153
153
|
row-gap: var(--space-scaled-s-913kwi, 12px);
|
|
154
154
|
}
|
|
155
|
-
.awsui_vertical-
|
|
155
|
+
.awsui_vertical-m_18582_vrts6_155:not(#\9) {
|
|
156
156
|
row-gap: var(--space-scaled-m-gxhdpl, 16px);
|
|
157
157
|
}
|
|
158
|
-
.awsui_vertical-
|
|
158
|
+
.awsui_vertical-l_18582_vrts6_158:not(#\9) {
|
|
159
159
|
row-gap: var(--space-scaled-l-2rs0gk, 20px);
|
|
160
160
|
}
|
|
161
|
-
.awsui_vertical-
|
|
161
|
+
.awsui_vertical-xl_18582_vrts6_161:not(#\9) {
|
|
162
162
|
row-gap: var(--space-scaled-xl-jawob6, 24px);
|
|
163
163
|
}
|
|
164
|
-
.awsui_vertical-
|
|
164
|
+
.awsui_vertical-xxl_18582_vrts6_164:not(#\9) {
|
|
165
165
|
row-gap: var(--space-scaled-xxl-fzmynl, 32px);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
.awsui_align-
|
|
168
|
+
.awsui_align-center_18582_vrts6_168:not(#\9) {
|
|
169
169
|
align-items: center;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.awsui_align-start_18582_vrts6_172:not(#\9) {
|
|
173
|
+
align-items: start;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.awsui_align-end_18582_vrts6_176:not(#\9) {
|
|
177
|
+
align-items: end;
|
|
170
178
|
}
|
|
@@ -2,26 +2,28 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"child": "
|
|
7
|
-
"horizontal": "
|
|
8
|
-
"horizontal-xxxs": "awsui_horizontal-
|
|
9
|
-
"horizontal-xxs": "awsui_horizontal-
|
|
10
|
-
"horizontal-xs": "awsui_horizontal-
|
|
11
|
-
"horizontal-s": "awsui_horizontal-
|
|
12
|
-
"horizontal-m": "awsui_horizontal-
|
|
13
|
-
"horizontal-l": "awsui_horizontal-
|
|
14
|
-
"horizontal-xl": "awsui_horizontal-
|
|
15
|
-
"horizontal-xxl": "awsui_horizontal-
|
|
16
|
-
"vertical": "
|
|
17
|
-
"vertical-xxxs": "awsui_vertical-
|
|
18
|
-
"vertical-xxs": "awsui_vertical-
|
|
19
|
-
"vertical-xs": "awsui_vertical-
|
|
20
|
-
"vertical-s": "awsui_vertical-
|
|
21
|
-
"vertical-m": "awsui_vertical-
|
|
22
|
-
"vertical-l": "awsui_vertical-
|
|
23
|
-
"vertical-xl": "awsui_vertical-
|
|
24
|
-
"vertical-xxl": "awsui_vertical-
|
|
25
|
-
"align-center": "awsui_align-
|
|
5
|
+
"root": "awsui_root_18582_vrts6_93",
|
|
6
|
+
"child": "awsui_child_18582_vrts6_97",
|
|
7
|
+
"horizontal": "awsui_horizontal_18582_vrts6_108",
|
|
8
|
+
"horizontal-xxxs": "awsui_horizontal-xxxs_18582_vrts6_112",
|
|
9
|
+
"horizontal-xxs": "awsui_horizontal-xxs_18582_vrts6_115",
|
|
10
|
+
"horizontal-xs": "awsui_horizontal-xs_18582_vrts6_118",
|
|
11
|
+
"horizontal-s": "awsui_horizontal-s_18582_vrts6_121",
|
|
12
|
+
"horizontal-m": "awsui_horizontal-m_18582_vrts6_124",
|
|
13
|
+
"horizontal-l": "awsui_horizontal-l_18582_vrts6_127",
|
|
14
|
+
"horizontal-xl": "awsui_horizontal-xl_18582_vrts6_130",
|
|
15
|
+
"horizontal-xxl": "awsui_horizontal-xxl_18582_vrts6_133",
|
|
16
|
+
"vertical": "awsui_vertical_18582_vrts6_140",
|
|
17
|
+
"vertical-xxxs": "awsui_vertical-xxxs_18582_vrts6_143",
|
|
18
|
+
"vertical-xxs": "awsui_vertical-xxs_18582_vrts6_146",
|
|
19
|
+
"vertical-xs": "awsui_vertical-xs_18582_vrts6_149",
|
|
20
|
+
"vertical-s": "awsui_vertical-s_18582_vrts6_152",
|
|
21
|
+
"vertical-m": "awsui_vertical-m_18582_vrts6_155",
|
|
22
|
+
"vertical-l": "awsui_vertical-l_18582_vrts6_158",
|
|
23
|
+
"vertical-xl": "awsui_vertical-xl_18582_vrts6_161",
|
|
24
|
+
"vertical-xxl": "awsui_vertical-xxl_18582_vrts6_164",
|
|
25
|
+
"align-center": "awsui_align-center_18582_vrts6_168",
|
|
26
|
+
"align-start": "awsui_align-start_18582_vrts6_172",
|
|
27
|
+
"align-end": "awsui_align-end_18582_vrts6_176"
|
|
26
28
|
};
|
|
27
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["table/body-cell/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["table/body-cell/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAkB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AASnE,UAAU,kBAAkB,CAAC,QAAQ,CAAE,SAAQ,mBAAmB;IAChE,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,UAAU,CAAC,EAAE,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACrD,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;CACtC;AA2FD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,EACtC,UAAU,EACV,GAAG,IAAI,EACR,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,eAMxD"}
|
package/table/body-cell/index.js
CHANGED
|
@@ -3,8 +3,7 @@ import { __rest } from "tslib";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import styles from './styles.css.js';
|
|
6
|
-
import React, { useRef, useState } from 'react';
|
|
7
|
-
import { useEffectOnUpdate } from '../../internal/hooks/use-effect-on-update';
|
|
6
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
8
7
|
import Icon from '../../icon/internal';
|
|
9
8
|
import { TableTdElement } from './td-element';
|
|
10
9
|
import { InlineEditor } from './inline-editor';
|
|
@@ -21,8 +20,10 @@ function TableCellEditable(_a) {
|
|
|
21
20
|
const tdNativeAttributes = {
|
|
22
21
|
'data-inline-editing-active': isEditing.toString(),
|
|
23
22
|
};
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const isFocusMoveNeededRef = useRef(false);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!isEditing && editActivateRef.current && isFocusMoveNeededRef.current) {
|
|
26
|
+
isFocusMoveNeededRef.current = false;
|
|
26
27
|
editActivateRef.current.focus();
|
|
27
28
|
}
|
|
28
29
|
}, [isEditing]);
|
|
@@ -30,7 +31,10 @@ function TableCellEditable(_a) {
|
|
|
30
31
|
const [hasHover, setHasHover] = useState(false);
|
|
31
32
|
const [hasFocus, setHasFocus] = useState(false);
|
|
32
33
|
const showIcon = hasHover || hasFocus;
|
|
33
|
-
return (React.createElement(TableTdElement, Object.assign({}, rest, { nativeAttributes: tdNativeAttributes, className: clsx(className, styles['body-cell-editable'], isEditing && styles['body-cell-edit-active'], successfulEdit && styles['body-cell-has-success'], isVisualRefresh && styles['is-visual-refresh']), onClick: !isEditing ? onEditStart : undefined, onMouseEnter: () => setHasHover(true), onMouseLeave: () => setHasHover(false) }), isEditing ? (React.createElement(InlineEditor, { ariaLabels: ariaLabels, column: column, item: item, onEditEnd:
|
|
34
|
+
return (React.createElement(TableTdElement, Object.assign({}, rest, { nativeAttributes: tdNativeAttributes, className: clsx(className, styles['body-cell-editable'], isEditing && styles['body-cell-edit-active'], successfulEdit && styles['body-cell-has-success'], isVisualRefresh && styles['is-visual-refresh']), onClick: !isEditing ? onEditStart : undefined, onMouseEnter: () => setHasHover(true), onMouseLeave: () => setHasHover(false) }), isEditing ? (React.createElement(InlineEditor, { ariaLabels: ariaLabels, column: column, item: item, onEditEnd: e => {
|
|
35
|
+
isFocusMoveNeededRef.current = true;
|
|
36
|
+
onEditEnd(e);
|
|
37
|
+
}, submitEdit: submitEdit !== null && submitEdit !== void 0 ? submitEdit : submitHandlerFallback })) : (React.createElement(React.Fragment, null,
|
|
34
38
|
column.cell(item),
|
|
35
39
|
successfulEdit && (React.createElement(React.Fragment, null,
|
|
36
40
|
React.createElement("span", { className: styles['body-cell-success'], "aria-label": (_b = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.successfulEditLabel) === null || _b === void 0 ? void 0 : _b.call(ariaLabels, column), role: "img" },
|