@cloudscape-design/components-themeable 3.0.1010 → 3.0.1012
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/app-layout/visual-refresh-toolbar/drawer/styles.scss +0 -1
- package/lib/internal/scss/internal/base-component/styles.scss +5 -0
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +3 -0
- package/lib/internal/template/alert/styles.scoped.css +2 -4
- package/lib/internal/template/anchor-navigation/styles.scoped.css +1 -2
- package/lib/internal/template/annotation-context/annotation/styles.scoped.css +1 -2
- package/lib/internal/template/app-layout/visual-refresh/styles.scoped.css +2 -4
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.css.js +17 -17
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +35 -36
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +17 -17
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +1 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/styles.scoped.css +1 -2
- package/lib/internal/template/attribute-editor/styles.scoped.css +1 -2
- package/lib/internal/template/badge/styles.scoped.css +1 -2
- package/lib/internal/template/breadcrumb-group/styles.scoped.css +2 -4
- package/lib/internal/template/button/styles.scoped.css +1 -2
- package/lib/internal/template/button-dropdown/mobile-expandable-group/styles.scoped.css +1 -2
- package/lib/internal/template/button-group/styles.scoped.css +1 -2
- package/lib/internal/template/calendar/styles.scoped.css +1 -2
- package/lib/internal/template/cards/styles.scoped.css +1 -2
- package/lib/internal/template/checkbox/styles.scoped.css +1 -2
- package/lib/internal/template/code-editor/styles.scoped.css +1 -2
- package/lib/internal/template/collection-preferences/content-display/styles.scoped.css +1 -2
- package/lib/internal/template/collection-preferences/styles.scoped.css +1 -2
- package/lib/internal/template/column-layout/styles.scoped.css +1 -2
- package/lib/internal/template/container/interfaces.d.ts +5 -0
- package/lib/internal/template/container/interfaces.d.ts.map +1 -1
- package/lib/internal/template/container/interfaces.js.map +1 -1
- package/lib/internal/template/container/internal.d.ts +2 -2
- package/lib/internal/template/container/internal.d.ts.map +1 -1
- package/lib/internal/template/container/internal.js +2 -2
- package/lib/internal/template/container/internal.js.map +1 -1
- package/lib/internal/template/container/styles.scoped.css +1 -2
- package/lib/internal/template/date-picker/styles.scoped.css +1 -2
- package/lib/internal/template/date-range-picker/styles.scoped.css +1 -2
- package/lib/internal/template/drawer/styles.scoped.css +1 -2
- package/lib/internal/template/expandable-section/styles.scoped.css +1 -2
- package/lib/internal/template/file-token-group/styles.scoped.css +1 -2
- package/lib/internal/template/flashbar/styles.scoped.css +1 -2
- package/lib/internal/template/form/styles.scoped.css +1 -2
- package/lib/internal/template/form-field/styles.scoped.css +1 -2
- package/lib/internal/template/grid/styles.scoped.css +1 -2
- package/lib/internal/template/header/styles.scoped.css +1 -2
- package/lib/internal/template/help-panel/styles.scoped.css +1 -2
- package/lib/internal/template/input/styles.scoped.css +1 -2
- package/lib/internal/template/internal/base-component/styles.scoped.css +3 -0
- package/lib/internal/template/internal/components/button-trigger/styles.scoped.css +1 -2
- package/lib/internal/template/internal/components/chart-filter/styles.scoped.css +1 -2
- package/lib/internal/template/internal/components/chart-legend/styles.scoped.css +1 -2
- package/lib/internal/template/internal/components/chart-popover/styles.scoped.css +1 -2
- package/lib/internal/template/internal/components/chart-series-details/styles.scoped.css +3 -6
- package/lib/internal/template/internal/components/chart-series-marker/styles.scoped.css +1 -2
- package/lib/internal/template/internal/components/chart-wrapper/styles.scoped.css +1 -2
- package/lib/internal/template/internal/components/dropdown/styles.scoped.css +1 -2
- package/lib/internal/template/internal/components/dropdown-footer/styles.scoped.css +1 -2
- package/lib/internal/template/internal/components/dropdown-status/styles.scoped.css +1 -2
- package/lib/internal/template/internal/components/menu-dropdown/styles.scoped.css +1 -2
- package/lib/internal/template/internal/components/option/styles.scoped.css +1 -2
- package/lib/internal/template/internal/components/options-list/styles.scoped.css +1 -2
- package/lib/internal/template/internal/components/options-list/utils/use-highlight-option.d.ts +1 -0
- package/lib/internal/template/internal/components/options-list/utils/use-highlight-option.d.ts.map +1 -1
- package/lib/internal/template/internal/components/options-list/utils/use-highlight-option.js +1 -0
- package/lib/internal/template/internal/components/options-list/utils/use-highlight-option.js.map +1 -1
- package/lib/internal/template/internal/components/token-list/styles.scoped.css +1 -2
- package/lib/internal/template/internal/environment.d.ts +1 -0
- package/lib/internal/template/internal/environment.js +2 -1
- package/lib/internal/template/internal/environment.json +2 -1
- package/lib/internal/template/internal/hooks/use-base-component/index.d.ts.map +1 -1
- package/lib/internal/template/internal/hooks/use-base-component/index.js +2 -0
- package/lib/internal/template/internal/hooks/use-base-component/index.js.map +1 -1
- package/lib/internal/template/internal/hooks/use-base-component/styles-check.d.ts +4 -0
- package/lib/internal/template/internal/hooks/use-base-component/styles-check.d.ts.map +1 -0
- package/lib/internal/template/internal/hooks/use-base-component/styles-check.js +46 -0
- package/lib/internal/template/internal/hooks/use-base-component/styles-check.js.map +1 -0
- package/lib/internal/template/internal/metrics.d.ts.map +1 -1
- package/lib/internal/template/internal/metrics.js +2 -2
- package/lib/internal/template/internal/metrics.js.map +1 -1
- package/lib/internal/template/key-value-pairs/styles.scoped.css +2 -4
- package/lib/internal/template/link/styles.scoped.css +1 -2
- package/lib/internal/template/modal/styles.scoped.css +2 -4
- package/lib/internal/template/multiselect/styles.scoped.css +2 -4
- package/lib/internal/template/pagination/styles.scoped.css +1 -2
- package/lib/internal/template/popover/styles.scoped.css +3 -6
- package/lib/internal/template/progress-bar/styles.scoped.css +1 -2
- package/lib/internal/template/prompt-input/internal.d.ts.map +1 -1
- package/lib/internal/template/prompt-input/internal.js +3 -3
- package/lib/internal/template/prompt-input/internal.js.map +1 -1
- package/lib/internal/template/prompt-input/styles.scoped.css +4 -8
- package/lib/internal/template/property-filter/filtering-token/styles.scoped.css +1 -2
- package/lib/internal/template/property-filter/styles.scoped.css +2 -4
- package/lib/internal/template/radio-group/styles.scoped.css +1 -2
- package/lib/internal/template/segmented-control/interfaces.d.ts +2 -1
- package/lib/internal/template/segmented-control/interfaces.d.ts.map +1 -1
- package/lib/internal/template/segmented-control/interfaces.js.map +1 -1
- package/lib/internal/template/segmented-control/styles.scoped.css +1 -2
- package/lib/internal/template/select/styles.scoped.css +1 -2
- package/lib/internal/template/select/utils/use-select.d.ts.map +1 -1
- package/lib/internal/template/select/utils/use-select.js +17 -4
- package/lib/internal/template/select/utils/use-select.js.map +1 -1
- package/lib/internal/template/side-navigation/styles.scoped.css +1 -2
- package/lib/internal/template/slider/styles.scoped.css +1 -2
- package/lib/internal/template/split-panel/styles.scoped.css +1 -2
- package/lib/internal/template/steps/styles.scoped.css +1 -2
- package/lib/internal/template/table/expandable-rows/styles.scoped.css +1 -2
- package/lib/internal/template/table/internal.js +1 -1
- package/lib/internal/template/table/internal.js.map +1 -1
- package/lib/internal/template/table/resizer/styles.scoped.css +1 -2
- package/lib/internal/template/tabs/styles.scoped.css +1 -2
- package/lib/internal/template/text-content/styles.scoped.css +1 -2
- package/lib/internal/template/text-filter/styles.scoped.css +1 -2
- package/lib/internal/template/textarea/styles.scoped.css +1 -2
- package/lib/internal/template/tiles/styles.scoped.css +2 -4
- package/lib/internal/template/toggle/styles.scoped.css +1 -2
- package/lib/internal/template/token-group/styles.scoped.css +1 -2
- package/lib/internal/template/top-navigation/1.0-beta/styles.scoped.css +1 -2
- package/lib/internal/template/top-navigation/styles.scoped.css +3 -6
- package/lib/internal/template/tutorial-panel/components/tutorial-detail-view/styles.scoped.css +1 -2
- package/lib/internal/template/tutorial-panel/components/tutorial-list/styles.scoped.css +3 -6
- package/lib/internal/template/tutorial-panel/styles.scoped.css +1 -2
- package/lib/internal/template/wizard/styles.scoped.css +1 -2
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export var PACKAGE_SOURCE = "components";
|
|
2
|
-
export var PACKAGE_VERSION = "3.0.0 (
|
|
2
|
+
export var PACKAGE_VERSION = "3.0.0 (a98874e5)";
|
|
3
|
+
export var GIT_SHA = "a98874e5";
|
|
3
4
|
export var THEME = "open-source-visual-refresh";
|
|
4
5
|
export var ALWAYS_VISUAL_REFRESH = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,sBAAsB,EAIvB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,sBAAsB,EAIvB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAM/D,MAAM,WAAW,0BAA0B,CAAC,CAAC,GAAG,GAAG;IACjD,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;CACvD;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,GAAG,GAAG,EAC9C,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,sBAAsB,EAC/B,iBAAiB,CAAC,EAAE,iBAAiB;;EAatC"}
|
|
@@ -2,6 +2,7 @@ import { useComponentMetadata, useComponentMetrics, useFocusVisible, } from '@cl
|
|
|
2
2
|
import { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from '../../environment';
|
|
3
3
|
import { getVisualTheme } from '../../utils/get-visual-theme';
|
|
4
4
|
import { useVisualRefresh } from '../use-visual-mode';
|
|
5
|
+
import { useMissingStylesCheck } from './styles-check';
|
|
5
6
|
/**
|
|
6
7
|
* This hook is used for components which are exported to customers. The returned __internalRootRef needs to be
|
|
7
8
|
* attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this
|
|
@@ -12,6 +13,7 @@ export default function useBaseComponent(componentName, config, analyticsMetadat
|
|
|
12
13
|
const theme = getVisualTheme(THEME, isVisualRefresh);
|
|
13
14
|
useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);
|
|
14
15
|
useFocusVisible();
|
|
16
|
+
useMissingStylesCheck();
|
|
15
17
|
const elementRef = useComponentMetadata(componentName, { packageName: PACKAGE_SOURCE, version: PACKAGE_VERSION, theme }, analyticsMetadata);
|
|
16
18
|
return { __internalRootRef: elementRef };
|
|
17
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,GAChB,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,GAChB,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAMvD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,aAAqB,EACrB,MAA+B,EAC/B,iBAAqC;IAErC,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACrD,mBAAmB,CAAC,aAAa,EAAE,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,CAAC;IACtH,eAAe,EAAE,CAAC;IAClB,qBAAqB,EAAE,CAAC;IACxB,MAAM,UAAU,GAAG,oBAAoB,CACrC,aAAa,EACb,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,EAChE,iBAAwB,CACzB,CAAC;IACF,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { MutableRefObject } from 'react';\n\nimport {\n ComponentConfiguration,\n useComponentMetadata,\n useComponentMetrics,\n useFocusVisible,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport { AnalyticsMetadata } from '../../analytics/interfaces';\nimport { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from '../../environment';\nimport { getVisualTheme } from '../../utils/get-visual-theme';\nimport { useVisualRefresh } from '../use-visual-mode';\nimport { useMissingStylesCheck } from './styles-check';\n\nexport interface InternalBaseComponentProps<T = any> {\n __internalRootRef?: MutableRefObject<T | null> | null;\n}\n\n/**\n * This hook is used for components which are exported to customers. The returned __internalRootRef needs to be\n * attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this\n * root DOM node and emits the telemetry for this component.\n */\nexport default function useBaseComponent<T = any>(\n componentName: string,\n config?: ComponentConfiguration,\n analyticsMetadata?: AnalyticsMetadata\n) {\n const isVisualRefresh = useVisualRefresh();\n const theme = getVisualTheme(THEME, isVisualRefresh);\n useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);\n useFocusVisible();\n useMissingStylesCheck();\n const elementRef = useComponentMetadata<T>(\n componentName,\n { packageName: PACKAGE_SOURCE, version: PACKAGE_VERSION, theme },\n analyticsMetadata as any\n );\n return { __internalRootRef: elementRef };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles-check.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/styles-check.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,SAMjC;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,IAAI,4BAsB3C;AAUD,wBAAgB,qBAAqB,SAIpC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { GIT_SHA, PACKAGE_VERSION, THEME } from '../../environment';
|
|
5
|
+
import { metrics } from '../../metrics';
|
|
6
|
+
export function checkMissingStyles() {
|
|
7
|
+
const result = getComputedStyle(document.body).getPropertyValue(`--awsui-version-info-${GIT_SHA}`);
|
|
8
|
+
if (!result) {
|
|
9
|
+
console.error(`Missing AWS-UI CSS for theme "${THEME}", version "${PACKAGE_VERSION}", and git sha "${GIT_SHA}".`);
|
|
10
|
+
metrics.sendOpsMetricObject('awsui-missing-css-asset', {});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function idleWithDelay(cb) {
|
|
14
|
+
// if idle callbacks not supported, we simply do not collect the metric
|
|
15
|
+
if (typeof requestIdleCallback !== 'function') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let aborted = false;
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
if (aborted) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
requestIdleCallback(() => {
|
|
24
|
+
if (aborted) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
cb();
|
|
28
|
+
});
|
|
29
|
+
}, 1000);
|
|
30
|
+
return () => {
|
|
31
|
+
aborted = true;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
let checked = false;
|
|
35
|
+
const checkMissingStylesOnce = () => {
|
|
36
|
+
if (!checked) {
|
|
37
|
+
checkMissingStyles();
|
|
38
|
+
checked = true;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export function useMissingStylesCheck() {
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
return idleWithDelay(() => checkMissingStylesOnce());
|
|
44
|
+
}, []);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=styles-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles-check.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/styles-check.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,UAAU,kBAAkB;IAChC,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;IACnG,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,CAAC,KAAK,CAAC,iCAAiC,KAAK,eAAe,eAAe,mBAAmB,OAAO,IAAI,CAAC,CAAC;QAClH,OAAO,CAAC,mBAAmB,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC;KAC5D;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,EAAc;IAC1C,uEAAuE;IACvE,IAAI,OAAO,mBAAmB,KAAK,UAAU,EAAE;QAC7C,OAAO;KACR;IACD,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,OAAO,EAAE;YACX,OAAO;SACR;QACD,mBAAmB,CAAC,GAAG,EAAE;YACvB,IAAI,OAAO,EAAE;gBACX,OAAO;aACR;YACD,EAAE,EAAE,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,IAAI,CAAC,CAAC;IAET,OAAO,GAAG,EAAE;QACV,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC;AAED,IAAI,OAAO,GAAG,KAAK,CAAC;AACpB,MAAM,sBAAsB,GAAG,GAAG,EAAE;IAClC,IAAI,CAAC,OAAO,EAAE;QACZ,kBAAkB,EAAE,CAAC;QACrB,OAAO,GAAG,IAAI,CAAC;KAChB;AACH,CAAC,CAAC;AAEF,MAAM,UAAU,qBAAqB;IACnC,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,aAAa,CAAC,GAAG,EAAE,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACvD,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect } from 'react';\n\nimport { GIT_SHA, PACKAGE_VERSION, THEME } from '../../environment';\nimport { metrics } from '../../metrics';\n\nexport function checkMissingStyles() {\n const result = getComputedStyle(document.body).getPropertyValue(`--awsui-version-info-${GIT_SHA}`);\n if (!result) {\n console.error(`Missing AWS-UI CSS for theme \"${THEME}\", version \"${PACKAGE_VERSION}\", and git sha \"${GIT_SHA}\".`);\n metrics.sendOpsMetricObject('awsui-missing-css-asset', {});\n }\n}\n\nexport function idleWithDelay(cb: () => void) {\n // if idle callbacks not supported, we simply do not collect the metric\n if (typeof requestIdleCallback !== 'function') {\n return;\n }\n let aborted = false;\n\n setTimeout(() => {\n if (aborted) {\n return;\n }\n requestIdleCallback(() => {\n if (aborted) {\n return;\n }\n cb();\n });\n }, 1000);\n\n return () => {\n aborted = true;\n };\n}\n\nlet checked = false;\nconst checkMissingStylesOnce = () => {\n if (!checked) {\n checkMissingStyles();\n checked = true;\n }\n};\n\nexport function useMissingStylesCheck() {\n useEffect(() => {\n return idleWithDelay(() => checkMissingStylesOnce());\n }, []);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAIxE,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAIxE,eAAO,MAAM,OAAO,SAAgG,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { Metrics } from '@cloudscape-design/component-toolkit/internal';
|
|
4
|
-
import { PACKAGE_SOURCE, PACKAGE_VERSION } from './environment';
|
|
5
|
-
export const metrics = new Metrics(PACKAGE_SOURCE, PACKAGE_VERSION);
|
|
4
|
+
import { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from './environment';
|
|
5
|
+
export const metrics = new Metrics({ packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme: THEME });
|
|
6
6
|
//# sourceMappingURL=metrics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Metrics } from '@cloudscape-design/component-toolkit/internal';\n\nimport { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from './environment';\n\nexport const metrics = new Metrics({ packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme: THEME });\n"]}
|
|
@@ -154,8 +154,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
154
154
|
font-style: normal;
|
|
155
155
|
font-variant: normal;
|
|
156
156
|
font-stretch: normal;
|
|
157
|
-
|
|
158
|
-
hyphens: none;
|
|
157
|
+
hyphens: none;
|
|
159
158
|
letter-spacing: normal;
|
|
160
159
|
list-style: disc outside none;
|
|
161
160
|
tab-size: 8;
|
|
@@ -222,8 +221,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
222
221
|
font-style: normal;
|
|
223
222
|
font-variant: normal;
|
|
224
223
|
font-stretch: normal;
|
|
225
|
-
|
|
226
|
-
hyphens: none;
|
|
224
|
+
hyphens: none;
|
|
227
225
|
letter-spacing: normal;
|
|
228
226
|
list-style: disc outside none;
|
|
229
227
|
tab-size: 8;
|
|
@@ -154,8 +154,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
154
154
|
font-style: normal;
|
|
155
155
|
font-variant: normal;
|
|
156
156
|
font-stretch: normal;
|
|
157
|
-
|
|
158
|
-
hyphens: none;
|
|
157
|
+
hyphens: none;
|
|
159
158
|
letter-spacing: normal;
|
|
160
159
|
list-style: disc outside none;
|
|
161
160
|
tab-size: 8;
|
|
@@ -270,8 +270,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
270
270
|
font-style: normal;
|
|
271
271
|
font-variant: normal;
|
|
272
272
|
font-stretch: normal;
|
|
273
|
-
|
|
274
|
-
hyphens: none;
|
|
273
|
+
hyphens: none;
|
|
275
274
|
letter-spacing: normal;
|
|
276
275
|
list-style: disc outside none;
|
|
277
276
|
tab-size: 8;
|
|
@@ -351,8 +350,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
351
350
|
font-style: normal;
|
|
352
351
|
font-variant: normal;
|
|
353
352
|
font-stretch: normal;
|
|
354
|
-
|
|
355
|
-
hyphens: none;
|
|
353
|
+
hyphens: none;
|
|
356
354
|
letter-spacing: normal;
|
|
357
355
|
list-style: disc outside none;
|
|
358
356
|
tab-size: 8;
|
|
@@ -154,8 +154,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
154
154
|
font-style: normal;
|
|
155
155
|
font-variant: normal;
|
|
156
156
|
font-stretch: normal;
|
|
157
|
-
|
|
158
|
-
hyphens: none;
|
|
157
|
+
hyphens: none;
|
|
159
158
|
letter-spacing: normal;
|
|
160
159
|
list-style: disc outside none;
|
|
161
160
|
tab-size: 8;
|
|
@@ -187,8 +186,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
187
186
|
font-style: normal;
|
|
188
187
|
font-variant: normal;
|
|
189
188
|
font-stretch: normal;
|
|
190
|
-
|
|
191
|
-
hyphens: none;
|
|
189
|
+
hyphens: none;
|
|
192
190
|
letter-spacing: normal;
|
|
193
191
|
list-style: disc outside none;
|
|
194
192
|
tab-size: 8;
|
|
@@ -154,8 +154,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
154
154
|
font-style: normal;
|
|
155
155
|
font-variant: normal;
|
|
156
156
|
font-stretch: normal;
|
|
157
|
-
|
|
158
|
-
hyphens: none;
|
|
157
|
+
hyphens: none;
|
|
159
158
|
letter-spacing: normal;
|
|
160
159
|
list-style: disc outside none;
|
|
161
160
|
tab-size: 8;
|
|
@@ -501,8 +501,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
501
501
|
font-style: normal;
|
|
502
502
|
font-variant: normal;
|
|
503
503
|
font-stretch: normal;
|
|
504
|
-
|
|
505
|
-
hyphens: none;
|
|
504
|
+
hyphens: none;
|
|
506
505
|
letter-spacing: normal;
|
|
507
506
|
list-style: disc outside none;
|
|
508
507
|
tab-size: 8;
|
|
@@ -776,8 +775,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
776
775
|
font-style: normal;
|
|
777
776
|
font-variant: normal;
|
|
778
777
|
font-stretch: normal;
|
|
779
|
-
|
|
780
|
-
hyphens: none;
|
|
778
|
+
hyphens: none;
|
|
781
779
|
letter-spacing: normal;
|
|
782
780
|
list-style: disc outside none;
|
|
783
781
|
tab-size: 8;
|
|
@@ -1102,8 +1100,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
1102
1100
|
font-style: normal;
|
|
1103
1101
|
font-variant: normal;
|
|
1104
1102
|
font-stretch: normal;
|
|
1105
|
-
|
|
1106
|
-
hyphens: none;
|
|
1103
|
+
hyphens: none;
|
|
1107
1104
|
letter-spacing: normal;
|
|
1108
1105
|
list-style: disc outside none;
|
|
1109
1106
|
tab-size: 8;
|
|
@@ -409,8 +409,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
409
409
|
font-style: normal;
|
|
410
410
|
font-variant: normal;
|
|
411
411
|
font-stretch: normal;
|
|
412
|
-
|
|
413
|
-
hyphens: none;
|
|
412
|
+
hyphens: none;
|
|
414
413
|
letter-spacing: normal;
|
|
415
414
|
list-style: disc outside none;
|
|
416
415
|
tab-size: 8;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAWxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,UAAU,wBACR,SAAQ,YAAY,CAAC,gBAAgB,EAAE,SAAS,GAAG,SAAS,CAAC,EAC3D,0BAA0B;CAAG;AAEjC,QAAA,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAWxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,UAAU,wBACR,SAAQ,YAAY,CAAC,gBAAgB,EAAE,SAAS,GAAG,SAAS,CAAC,EAC3D,0BAA0B;CAAG;AAEjC,QAAA,MAAM,mBAAmB,uGAkNxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -39,9 +39,9 @@ const InternalPromptInput = React.forwardRef((_a, ref) => {
|
|
|
39
39
|
}), [textareaRef]);
|
|
40
40
|
const handleKeyDown = (event) => {
|
|
41
41
|
fireKeyboardEvent(onKeyDown, event);
|
|
42
|
-
if (event.key === 'Enter' && !event.shiftKey) {
|
|
43
|
-
if (
|
|
44
|
-
event.
|
|
42
|
+
if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {
|
|
43
|
+
if (event.currentTarget.form && !event.isDefaultPrevented()) {
|
|
44
|
+
event.currentTarget.form.requestSubmit();
|
|
45
45
|
}
|
|
46
46
|
event.preventDefault();
|
|
47
47
|
fireNonCancelableEvent(onAction, { value });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAO,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACxF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,MAAM,MAAM,qCAAqC,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAA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,EAAE,WAAW,EAAE,EAAE,EAAE,SAAS,IAAM,UAAU,EAAI;YAC5D,eAAe,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAC3C;QACL,gBAAgB,IAAI,CACnB,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,cAAc,CAAC,mBAAmB,CAAC,EAAE;gBAChF,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,+BAA+B;gBAC3D,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;gBACzB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;aAC1B,CAAC;YAED,gBAAgB;YACjB,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,WAAC,OAAA,MAAA,WAAW,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAA,EAAA,GAAI;YAC7E,eAAe,IAAI,MAAM,CACtB,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useCallback, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useDensityMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalButton from '../button/internal';\nimport { convertAutoComplete } from '../input/utils';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireKeyboardEvent, fireNonCancelableEvent } from '../internal/events';\nimport * as tokens from '../internal/generated/styles/tokens';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { SomeRequired } from '../internal/types';\nimport { PromptInputProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\ninterface InternalPromptInputProps\n extends SomeRequired<PromptInputProps, 'maxRows' | 'minRows'>,\n InternalBaseComponentProps {}\n\nconst InternalPromptInput = React.forwardRef(\n (\n {\n value,\n actionButtonAriaLabel,\n actionButtonIconName,\n actionButtonIconUrl,\n actionButtonIconSvg,\n actionButtonIconAlt,\n ariaLabel,\n autoComplete,\n autoFocus,\n disableActionButton,\n disableBrowserAutocorrect,\n disabled,\n maxRows,\n minRows,\n name,\n onAction,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onKeyUp,\n placeholder,\n readOnly,\n spellcheck,\n secondaryActions,\n secondaryContent,\n disableSecondaryActionsPaddings,\n disableSecondaryContentPaddings,\n __internalRootRef = null,\n ...rest\n }: InternalPromptInputProps,\n ref: Ref<PromptInputProps.Ref>\n ) => {\n const { ariaLabelledby, ariaDescribedby, controlId, invalid, warning } = useFormFieldContext(rest);\n\n const baseProps = getBaseProps(rest);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const isRefresh = useVisualRefresh();\n const isCompactMode = useDensityMode(textareaRef) === 'compact';\n\n const PADDING = isRefresh ? tokens.spaceXxs : tokens.spaceXxxs;\n const LINE_HEIGHT = tokens.lineHeightBodyM;\n const DEFAULT_MAX_ROWS = 3;\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args: Parameters<HTMLElement['focus']>) {\n textareaRef.current?.focus(...args);\n },\n select() {\n textareaRef.current?.select();\n },\n setSelectionRange(...args: Parameters<HTMLTextAreaElement['setSelectionRange']>) {\n textareaRef.current?.setSelectionRange(...args);\n },\n }),\n [textareaRef]\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n fireKeyboardEvent(onKeyDown, event);\n\n if (event.key === 'Enter' && !event.shiftKey) {\n if ('form' in event.target && event.target.form !== null && !event.isDefaultPrevented()) {\n (event.target.form as HTMLFormElement).requestSubmit();\n }\n\n event.preventDefault();\n fireNonCancelableEvent(onAction, { value });\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n fireNonCancelableEvent(onChange, { value: event.target.value });\n adjustTextareaHeight();\n };\n\n const hasActionButton = actionButtonIconName || actionButtonIconSvg || actionButtonIconUrl;\n\n const adjustTextareaHeight = useCallback(() => {\n if (textareaRef.current) {\n // this is required so the scrollHeight becomes dynamic, otherwise it will be locked at the highest value for the size it reached e.g. 500px\n textareaRef.current.style.height = 'auto';\n\n const minTextareaHeight = `calc(${LINE_HEIGHT} + ${tokens.spaceScaledXxs} * 2)`; // the min height of Textarea with 1 row\n\n if (maxRows === -1) {\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n textareaRef.current.style.height = `max(${scrollHeight}, ${minTextareaHeight})`;\n } else {\n const maxRowsHeight = `calc(${maxRows <= 0 ? DEFAULT_MAX_ROWS : maxRows} * (${LINE_HEIGHT} + ${PADDING} / 2) + ${PADDING})`;\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n textareaRef.current.style.height = `min(max(${scrollHeight}, ${minTextareaHeight}), ${maxRowsHeight})`;\n }\n }\n }, [maxRows, LINE_HEIGHT, PADDING]);\n\n useEffect(() => {\n const handleResize = () => {\n adjustTextareaHeight();\n };\n\n window.addEventListener('resize', handleResize);\n\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, [adjustTextareaHeight]);\n\n useEffect(() => {\n adjustTextareaHeight();\n }, [value, adjustTextareaHeight, maxRows, isCompactMode]);\n\n const attributes: React.TextareaHTMLAttributes<HTMLTextAreaElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-invalid': invalid ? 'true' : undefined,\n name,\n placeholder,\n autoFocus,\n className: clsx(styles.textarea, testutilStyles.textarea, {\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n }),\n autoComplete: convertAutoComplete(autoComplete),\n spellCheck: spellcheck,\n disabled,\n readOnly: readOnly ? true : undefined,\n rows: minRows,\n onKeyDown: handleKeyDown,\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n // We set a default value on the component in order to force it into the controlled mode.\n value: value || '',\n onChange: handleChange,\n onBlur: onBlur && (() => fireNonCancelableEvent(onBlur)),\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n };\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n const action = (\n <div className={styles.button}>\n <InternalButton\n className={clsx(styles['action-button'], testutilStyles['action-button'])}\n ariaLabel={actionButtonAriaLabel}\n disabled={disabled || readOnly || disableActionButton}\n __focusable={readOnly}\n iconName={actionButtonIconName}\n iconUrl={actionButtonIconUrl}\n iconSvg={actionButtonIconSvg}\n iconAlt={actionButtonIconAlt}\n onClick={() => fireNonCancelableEvent(onAction, { value })}\n variant=\"icon\"\n />\n </div>\n );\n\n return (\n <div\n {...baseProps}\n aria-label={ariaLabel}\n className={clsx(styles.root, testutilStyles.root, baseProps.className, {\n [styles['textarea-readonly']]: readOnly,\n [styles['textarea-invalid']]: invalid,\n [styles['textarea-warning']]: warning && !invalid,\n [styles.disabled]: disabled,\n })}\n ref={__internalRootRef}\n role=\"region\"\n >\n {secondaryContent && (\n <div\n className={clsx(styles['secondary-content'], testutilStyles['secondary-content'], {\n [styles['with-paddings']]: !disableSecondaryContentPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryContent}\n </div>\n )}\n <div className={styles['textarea-wrapper']}>\n <textarea ref={textareaRef} id={controlId} {...attributes} />\n {hasActionButton && !secondaryActions && action}\n </div>\n {secondaryActions && (\n <div\n className={clsx(styles['secondary-actions'], testutilStyles['secondary-actions'], {\n [styles['with-paddings']]: !disableSecondaryActionsPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryActions}\n <div className={styles.buffer} onClick={() => textareaRef.current?.focus()} />\n {hasActionButton && action}\n </div>\n )}\n </div>\n );\n }\n);\n\nexport default InternalPromptInput;\n"]}
|
|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M,CACtB,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useCallback, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useDensityMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalButton from '../button/internal';\nimport { convertAutoComplete } from '../input/utils';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireKeyboardEvent, fireNonCancelableEvent } from '../internal/events';\nimport * as tokens from '../internal/generated/styles/tokens';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { SomeRequired } from '../internal/types';\nimport { PromptInputProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\ninterface InternalPromptInputProps\n extends SomeRequired<PromptInputProps, 'maxRows' | 'minRows'>,\n InternalBaseComponentProps {}\n\nconst InternalPromptInput = React.forwardRef(\n (\n {\n value,\n actionButtonAriaLabel,\n actionButtonIconName,\n actionButtonIconUrl,\n actionButtonIconSvg,\n actionButtonIconAlt,\n ariaLabel,\n autoComplete,\n autoFocus,\n disableActionButton,\n disableBrowserAutocorrect,\n disabled,\n maxRows,\n minRows,\n name,\n onAction,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onKeyUp,\n placeholder,\n readOnly,\n spellcheck,\n secondaryActions,\n secondaryContent,\n disableSecondaryActionsPaddings,\n disableSecondaryContentPaddings,\n __internalRootRef = null,\n ...rest\n }: InternalPromptInputProps,\n ref: Ref<PromptInputProps.Ref>\n ) => {\n const { ariaLabelledby, ariaDescribedby, controlId, invalid, warning } = useFormFieldContext(rest);\n\n const baseProps = getBaseProps(rest);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const isRefresh = useVisualRefresh();\n const isCompactMode = useDensityMode(textareaRef) === 'compact';\n\n const PADDING = isRefresh ? tokens.spaceXxs : tokens.spaceXxxs;\n const LINE_HEIGHT = tokens.lineHeightBodyM;\n const DEFAULT_MAX_ROWS = 3;\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args: Parameters<HTMLElement['focus']>) {\n textareaRef.current?.focus(...args);\n },\n select() {\n textareaRef.current?.select();\n },\n setSelectionRange(...args: Parameters<HTMLTextAreaElement['setSelectionRange']>) {\n textareaRef.current?.setSelectionRange(...args);\n },\n }),\n [textareaRef]\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n fireKeyboardEvent(onKeyDown, event);\n\n if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {\n if (event.currentTarget.form && !event.isDefaultPrevented()) {\n event.currentTarget.form.requestSubmit();\n }\n event.preventDefault();\n fireNonCancelableEvent(onAction, { value });\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n fireNonCancelableEvent(onChange, { value: event.target.value });\n adjustTextareaHeight();\n };\n\n const hasActionButton = actionButtonIconName || actionButtonIconSvg || actionButtonIconUrl;\n\n const adjustTextareaHeight = useCallback(() => {\n if (textareaRef.current) {\n // this is required so the scrollHeight becomes dynamic, otherwise it will be locked at the highest value for the size it reached e.g. 500px\n textareaRef.current.style.height = 'auto';\n\n const minTextareaHeight = `calc(${LINE_HEIGHT} + ${tokens.spaceScaledXxs} * 2)`; // the min height of Textarea with 1 row\n\n if (maxRows === -1) {\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n textareaRef.current.style.height = `max(${scrollHeight}, ${minTextareaHeight})`;\n } else {\n const maxRowsHeight = `calc(${maxRows <= 0 ? DEFAULT_MAX_ROWS : maxRows} * (${LINE_HEIGHT} + ${PADDING} / 2) + ${PADDING})`;\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n textareaRef.current.style.height = `min(max(${scrollHeight}, ${minTextareaHeight}), ${maxRowsHeight})`;\n }\n }\n }, [maxRows, LINE_HEIGHT, PADDING]);\n\n useEffect(() => {\n const handleResize = () => {\n adjustTextareaHeight();\n };\n\n window.addEventListener('resize', handleResize);\n\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, [adjustTextareaHeight]);\n\n useEffect(() => {\n adjustTextareaHeight();\n }, [value, adjustTextareaHeight, maxRows, isCompactMode]);\n\n const attributes: React.TextareaHTMLAttributes<HTMLTextAreaElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-invalid': invalid ? 'true' : undefined,\n name,\n placeholder,\n autoFocus,\n className: clsx(styles.textarea, testutilStyles.textarea, {\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n }),\n autoComplete: convertAutoComplete(autoComplete),\n spellCheck: spellcheck,\n disabled,\n readOnly: readOnly ? true : undefined,\n rows: minRows,\n onKeyDown: handleKeyDown,\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n // We set a default value on the component in order to force it into the controlled mode.\n value: value || '',\n onChange: handleChange,\n onBlur: onBlur && (() => fireNonCancelableEvent(onBlur)),\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n };\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n const action = (\n <div className={styles.button}>\n <InternalButton\n className={clsx(styles['action-button'], testutilStyles['action-button'])}\n ariaLabel={actionButtonAriaLabel}\n disabled={disabled || readOnly || disableActionButton}\n __focusable={readOnly}\n iconName={actionButtonIconName}\n iconUrl={actionButtonIconUrl}\n iconSvg={actionButtonIconSvg}\n iconAlt={actionButtonIconAlt}\n onClick={() => fireNonCancelableEvent(onAction, { value })}\n variant=\"icon\"\n />\n </div>\n );\n\n return (\n <div\n {...baseProps}\n aria-label={ariaLabel}\n className={clsx(styles.root, testutilStyles.root, baseProps.className, {\n [styles['textarea-readonly']]: readOnly,\n [styles['textarea-invalid']]: invalid,\n [styles['textarea-warning']]: warning && !invalid,\n [styles.disabled]: disabled,\n })}\n ref={__internalRootRef}\n role=\"region\"\n >\n {secondaryContent && (\n <div\n className={clsx(styles['secondary-content'], testutilStyles['secondary-content'], {\n [styles['with-paddings']]: !disableSecondaryContentPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryContent}\n </div>\n )}\n <div className={styles['textarea-wrapper']}>\n <textarea ref={textareaRef} id={controlId} {...attributes} />\n {hasActionButton && !secondaryActions && action}\n </div>\n {secondaryActions && (\n <div\n className={clsx(styles['secondary-actions'], testutilStyles['secondary-actions'], {\n [styles['with-paddings']]: !disableSecondaryActionsPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryActions}\n <div className={styles.buffer} onClick={() => textareaRef.current?.focus()} />\n {hasActionButton && action}\n </div>\n )}\n </div>\n );\n }\n);\n\nexport default InternalPromptInput;\n"]}
|
|
@@ -155,8 +155,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
155
155
|
font-style: normal;
|
|
156
156
|
font-variant: normal;
|
|
157
157
|
font-stretch: normal;
|
|
158
|
-
|
|
159
|
-
hyphens: none;
|
|
158
|
+
hyphens: none;
|
|
160
159
|
letter-spacing: normal;
|
|
161
160
|
list-style: disc outside none;
|
|
162
161
|
tab-size: 8;
|
|
@@ -269,8 +268,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
269
268
|
font-style: normal;
|
|
270
269
|
font-variant: normal;
|
|
271
270
|
font-stretch: normal;
|
|
272
|
-
|
|
273
|
-
hyphens: none;
|
|
271
|
+
hyphens: none;
|
|
274
272
|
letter-spacing: normal;
|
|
275
273
|
list-style: disc outside none;
|
|
276
274
|
tab-size: 8;
|
|
@@ -387,8 +385,7 @@ body[data-awsui-focus-visible=true] .awsui_button_55fkh_ukbvx_346 > .awsui_actio
|
|
|
387
385
|
font-style: normal;
|
|
388
386
|
font-variant: normal;
|
|
389
387
|
font-stretch: normal;
|
|
390
|
-
|
|
391
|
-
hyphens: none;
|
|
388
|
+
hyphens: none;
|
|
392
389
|
letter-spacing: normal;
|
|
393
390
|
list-style: disc outside none;
|
|
394
391
|
tab-size: 8;
|
|
@@ -433,8 +430,7 @@ body[data-awsui-focus-visible=true] .awsui_button_55fkh_ukbvx_346 > .awsui_actio
|
|
|
433
430
|
font-style: normal;
|
|
434
431
|
font-variant: normal;
|
|
435
432
|
font-stretch: normal;
|
|
436
|
-
|
|
437
|
-
hyphens: none;
|
|
433
|
+
hyphens: none;
|
|
438
434
|
letter-spacing: normal;
|
|
439
435
|
list-style: disc outside none;
|
|
440
436
|
tab-size: 8;
|
|
@@ -163,8 +163,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
163
163
|
font-style: normal;
|
|
164
164
|
font-variant: normal;
|
|
165
165
|
font-stretch: normal;
|
|
166
|
-
|
|
167
|
-
hyphens: none;
|
|
166
|
+
hyphens: none;
|
|
168
167
|
letter-spacing: normal;
|
|
169
168
|
list-style: disc outside none;
|
|
170
169
|
tab-size: 8;
|
|
@@ -154,8 +154,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
154
154
|
font-style: normal;
|
|
155
155
|
font-variant: normal;
|
|
156
156
|
font-stretch: normal;
|
|
157
|
-
|
|
158
|
-
hyphens: none;
|
|
157
|
+
hyphens: none;
|
|
159
158
|
letter-spacing: normal;
|
|
160
159
|
list-style: disc outside none;
|
|
161
160
|
tab-size: 8;
|
|
@@ -312,8 +311,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
312
311
|
font-style: normal;
|
|
313
312
|
font-variant: normal;
|
|
314
313
|
font-stretch: normal;
|
|
315
|
-
|
|
316
|
-
hyphens: none;
|
|
314
|
+
hyphens: none;
|
|
317
315
|
letter-spacing: normal;
|
|
318
316
|
list-style: disc outside none;
|
|
319
317
|
tab-size: 8;
|
|
@@ -154,8 +154,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
154
154
|
font-style: normal;
|
|
155
155
|
font-variant: normal;
|
|
156
156
|
font-stretch: normal;
|
|
157
|
-
|
|
158
|
-
hyphens: none;
|
|
157
|
+
hyphens: none;
|
|
159
158
|
letter-spacing: normal;
|
|
160
159
|
list-style: disc outside none;
|
|
161
160
|
tab-size: 8;
|
|
@@ -8,7 +8,8 @@ export interface SegmentedControlProps extends BaseComponentProps {
|
|
|
8
8
|
*/
|
|
9
9
|
selectedId: string | null;
|
|
10
10
|
/**
|
|
11
|
-
* An array of objects representing options.
|
|
11
|
+
* An array of objects representing options. Only up to 6 options are supported.
|
|
12
|
+
* Each segment has the following properties:
|
|
12
13
|
*
|
|
13
14
|
* - `id` (string) - The ID of the segment.
|
|
14
15
|
* - `disabled` [boolean] - (Optional) Determines whether the segment is disabled, which prevents the user from selecting it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEtD;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;CAC1E;AAED,yBAAiB,qBAAqB,CAAC;IACrC,UAAiB,MAAM;QACrB,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;QAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,YAAY;QAC3B,UAAU,EAAE,MAAM,CAAC;KACpB;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/segmented-control/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface SegmentedControlProps extends BaseComponentProps {\n /**\n * ID of the selected option. If you want to clear the selection, use `null`.\n */\n selectedId: string | null;\n\n /**\n * An array of objects representing options. Each segment has the following properties:\n *\n * - `id` (string) - The ID of the segment.\n * - `disabled` [boolean] - (Optional) Determines whether the segment is disabled, which prevents the user from selecting it.\n * - `disabledReason` (string) - (Optional) Displays tooltip near the segment when disabled. Use to provide additional context.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`, or `iconName` without `text`.\n * This is required when you use an icon without `text`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `text` (string) - (Optional) Specifies the text of the segment.\n */\n options?: ReadonlyArray<SegmentedControlProps.Option>;\n\n /**\n * Defines the label of the entire segmented control. In the standard view (that is, all individual segments are visible),\n * this label is used as `aria-label` on the group of segments. In a narrow container, where this component is displayed as a select component,\n * the label is visible and attached to the select component, unless `ariaLabelledBy` is defined. Don't use `label` and `ariaLabelledBy` at the same time.\n */\n label?: string;\n\n /**\n * Adds aria-labelledby to the component. Create a visually hidden element with an ID and set this property to that ID. If you don't want the label to be visible in narrow containers, use this property instead of `label`.\n */\n ariaLabelledby?: string;\n\n /**\n * Called when the user selects a different segment.\n */\n onChange?: NonCancelableEventHandler<SegmentedControlProps.ChangeDetail>;\n}\n\nexport namespace SegmentedControlProps {\n export interface Option {\n id: string;\n disabled?: boolean;\n disabledReason?: string;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n text?: string;\n }\n\n export interface ChangeDetail {\n selectedId: string;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/segmented-control/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface SegmentedControlProps extends BaseComponentProps {\n /**\n * ID of the selected option. If you want to clear the selection, use `null`.\n */\n selectedId: string | null;\n\n /**\n * An array of objects representing options. Only up to 6 options are supported.\n * Each segment has the following properties:\n *\n * - `id` (string) - The ID of the segment.\n * - `disabled` [boolean] - (Optional) Determines whether the segment is disabled, which prevents the user from selecting it.\n * - `disabledReason` (string) - (Optional) Displays tooltip near the segment when disabled. Use to provide additional context.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`, or `iconName` without `text`.\n * This is required when you use an icon without `text`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `text` (string) - (Optional) Specifies the text of the segment.\n */\n options?: ReadonlyArray<SegmentedControlProps.Option>;\n\n /**\n * Defines the label of the entire segmented control. In the standard view (that is, all individual segments are visible),\n * this label is used as `aria-label` on the group of segments. In a narrow container, where this component is displayed as a select component,\n * the label is visible and attached to the select component, unless `ariaLabelledBy` is defined. Don't use `label` and `ariaLabelledBy` at the same time.\n */\n label?: string;\n\n /**\n * Adds aria-labelledby to the component. Create a visually hidden element with an ID and set this property to that ID. If you don't want the label to be visible in narrow containers, use this property instead of `label`.\n */\n ariaLabelledby?: string;\n\n /**\n * Called when the user selects a different segment.\n */\n onChange?: NonCancelableEventHandler<SegmentedControlProps.ChangeDetail>;\n}\n\nexport namespace SegmentedControlProps {\n export interface Option {\n id: string;\n disabled?: boolean;\n disabledReason?: string;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n text?: string;\n }\n\n export interface ChangeDetail {\n selectedId: string;\n }\n}\n"]}
|
|
@@ -303,8 +303,7 @@ body[data-awsui-focus-visible=true] .awsui_segment_8cbea_1iwu6_161:not(#\9):focu
|
|
|
303
303
|
font-style: normal;
|
|
304
304
|
font-variant: normal;
|
|
305
305
|
font-stretch: normal;
|
|
306
|
-
|
|
307
|
-
hyphens: none;
|
|
306
|
+
hyphens: none;
|
|
308
307
|
letter-spacing: normal;
|
|
309
308
|
list-style: disc outside none;
|
|
310
309
|
tab-size: 8;
|
|
@@ -154,8 +154,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
154
154
|
font-style: normal;
|
|
155
155
|
font-variant: normal;
|
|
156
156
|
font-stretch: normal;
|
|
157
|
-
|
|
158
|
-
hyphens: none;
|
|
157
|
+
hyphens: none;
|
|
159
158
|
letter-spacing: normal;
|
|
160
159
|
list-style: disc outside none;
|
|
161
160
|
tab-size: 8;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-select.d.ts","sourceRoot":"","sources":["../../../../src/select/utils/use-select.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAe,MAAM,6CAA6C,CAAC;AAE5G,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAK1E,OAAO,EAA0B,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAG1F,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MA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AAO,CAAC;IACnB,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,aAAa,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC;IAC3C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,GAAG,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;CACnC;AAED,wBAAgB,SAAS,CAAC,EACxB,eAAe,EACf,oBAAoB,EACpB,OAAO,EACP,aAAa,EACb,MAAM,EACN,OAAO,EACP,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,oBAA4B,EAC5B,UAAU,EACV,aAAa,EACb,cAAc,EACd,SAAS,GACV,EAAE,cAAc;;;;;;4BA6Ge,KAC5B,aAAa,EACb,SAAS,GAAG,QAAQ,GAAG,mBAAmB,GAAG,qBAAqB,CACnE;;0BA4B0B,QAAQ,WAAW,CAAC;6BAoEf,cAAc,SAAS,MAAM;;4BApJ9B,cAAc;;;EA4O9C"}
|
|
@@ -24,7 +24,7 @@ export function useSelect({ selectedOptions, updateSelectedOption, options, filt
|
|
|
24
24
|
}
|
|
25
25
|
return selectedValuesSet;
|
|
26
26
|
}, new Set());
|
|
27
|
-
const [{ highlightType, highlightedOption, highlightedIndex }, { moveHighlightWithKeyboard, resetHighlightWithKeyboard, setHighlightedIndexWithMouse, highlightOptionWithKeyboard, goHomeWithKeyboard, goEndWithKeyboard, },] = useHighlightedOption({ options: options, isHighlightable });
|
|
27
|
+
const [{ highlightType, highlightedOption, highlightedIndex }, { moveHighlightWithKeyboard, resetHighlightWithKeyboard, setHighlightedIndexWithMouse, highlightOptionWithKeyboard, highlightFirstOptionWithMouse, goHomeWithKeyboard, goEndWithKeyboard, },] = useHighlightedOption({ options: options, isHighlightable });
|
|
28
28
|
const { isOpen, openDropdown, closeDropdown, toggleDropdown, openedWithKeyboard } = useOpenState({
|
|
29
29
|
defaultOpen: embedded,
|
|
30
30
|
onOpen: () => fireLoadItems(''),
|
|
@@ -214,12 +214,23 @@ export function useSelect({ selectedOptions, updateSelectedOption, options, filt
|
|
|
214
214
|
useEffect(() => {
|
|
215
215
|
// highlight the first selected option, when opening the Select component without filter input
|
|
216
216
|
// keep the focus in the filter input when opening, so that screenreader can recognize the combobox
|
|
217
|
-
if (isOpen && !prevOpen &&
|
|
217
|
+
if (isOpen && !prevOpen && options.length > 0 && !hasFilter) {
|
|
218
218
|
if (openedWithKeyboard) {
|
|
219
|
-
|
|
219
|
+
if (__selectedOptions[0]) {
|
|
220
|
+
highlightOptionWithKeyboard(__selectedOptions[0]);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
goHomeWithKeyboard();
|
|
224
|
+
}
|
|
220
225
|
}
|
|
221
226
|
else {
|
|
222
|
-
|
|
227
|
+
if (!__selectedOptions[0] || !options.includes(__selectedOptions[0])) {
|
|
228
|
+
highlightFirstOptionWithMouse();
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
const highlightedIndex = options.indexOf(__selectedOptions[0]);
|
|
232
|
+
setHighlightedIndexWithMouse(highlightedIndex, true);
|
|
233
|
+
}
|
|
223
234
|
}
|
|
224
235
|
}
|
|
225
236
|
}, [
|
|
@@ -228,6 +239,8 @@ export function useSelect({ selectedOptions, updateSelectedOption, options, filt
|
|
|
228
239
|
hasSelectedOption,
|
|
229
240
|
setHighlightedIndexWithMouse,
|
|
230
241
|
highlightOptionWithKeyboard,
|
|
242
|
+
highlightFirstOptionWithMouse,
|
|
243
|
+
goHomeWithKeyboard,
|
|
231
244
|
openedWithKeyboard,
|
|
232
245
|
options,
|
|
233
246
|
prevOpen,
|