@cloudscape-design/components 3.0.161 → 3.0.163
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app-layout/visual-refresh/styles.css.js +60 -60
- package/app-layout/visual-refresh/styles.scoped.css +147 -147
- package/app-layout/visual-refresh/styles.selectors.js +60 -60
- package/button/internal.d.ts +1 -0
- package/button/internal.d.ts.map +1 -1
- package/button/internal.js +2 -2
- package/button/internal.js.map +1 -1
- package/code-editor/index.d.ts.map +1 -1
- package/code-editor/index.js +5 -8
- package/code-editor/index.js.map +1 -1
- package/code-editor/pane.d.ts.map +1 -1
- package/code-editor/pane.js +4 -4
- package/code-editor/pane.js.map +1 -1
- package/code-editor/resizable-box/index.d.ts +9 -0
- package/code-editor/resizable-box/index.d.ts.map +1 -0
- package/code-editor/resizable-box/index.js +44 -0
- package/code-editor/resizable-box/index.js.map +1 -0
- package/code-editor/resizable-box/styles.css.js +8 -0
- package/code-editor/resizable-box/styles.scoped.css +50 -0
- package/code-editor/resizable-box/styles.selectors.js +9 -0
- package/code-editor/styles.css.js +32 -33
- package/code-editor/styles.scoped.css +109 -139
- package/code-editor/styles.selectors.js +32 -33
- package/flashbar/styles.css.js +33 -33
- package/flashbar/styles.scoped.css +115 -115
- package/flashbar/styles.selectors.js +33 -33
- package/form-field/interfaces.d.ts +10 -0
- package/form-field/interfaces.d.ts.map +1 -1
- package/form-field/interfaces.js.map +1 -1
- package/form-field/internal.d.ts +1 -1
- package/form-field/internal.d.ts.map +1 -1
- package/form-field/internal.js +5 -4
- package/form-field/internal.js.map +1 -1
- package/input/internal.d.ts.map +1 -1
- package/input/internal.js +16 -4
- package/input/internal.js.map +1 -1
- package/internal/components/live-region/index.d.ts +1 -1
- package/internal/components/live-region/index.d.ts.map +1 -1
- package/internal/components/live-region/index.js +29 -6
- package/internal/components/live-region/index.js.map +1 -1
- package/internal/context/form-field-context.d.ts +6 -2
- package/internal/context/form-field-context.d.ts.map +1 -1
- package/internal/context/form-field-context.js +7 -1
- package/internal/context/form-field-context.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/hooks/use-telemetry/index.d.ts.map +1 -1
- package/internal/hooks/use-telemetry/index.js +4 -0
- package/internal/hooks/use-telemetry/index.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/internal/metrics.d.ts +2 -2
- package/internal/metrics.d.ts.map +1 -1
- package/internal/metrics.js +20 -17
- package/internal/metrics.js.map +1 -1
- package/internal/types.d.ts +9 -0
- package/internal/types.d.ts.map +1 -1
- package/internal/types.js +0 -2
- package/internal/types.js.map +1 -1
- package/internal/vendor/d3-scale.js +8 -8
- package/mixed-line-bar-chart/styles.css.js +19 -19
- package/mixed-line-bar-chart/styles.scoped.css +26 -26
- package/mixed-line-bar-chart/styles.selectors.js +19 -19
- package/package.json +30 -34
- package/progress-bar/index.d.ts.map +1 -1
- package/progress-bar/index.js +14 -3
- package/progress-bar/index.js.map +1 -1
- package/select/parts/styles.css.js +9 -9
- package/select/parts/styles.scoped.css +27 -9
- package/select/parts/styles.selectors.js +9 -9
- package/side-navigation/internal.d.ts.map +1 -1
- package/side-navigation/internal.js +2 -2
- package/side-navigation/internal.js.map +1 -1
- package/table/body-cell/click-away.d.ts +9 -0
- package/table/body-cell/click-away.d.ts.map +1 -0
- package/table/body-cell/click-away.js +38 -0
- package/table/body-cell/click-away.js.map +1 -0
- package/table/body-cell/index.d.ts +10 -19
- package/table/body-cell/index.d.ts.map +1 -1
- package/table/body-cell/index.js +49 -9
- package/table/body-cell/index.js.map +1 -1
- package/table/body-cell/inline-editor.d.ts +12 -0
- package/table/body-cell/inline-editor.d.ts.map +1 -0
- package/table/body-cell/inline-editor.js +88 -0
- package/table/body-cell/inline-editor.js.map +1 -0
- package/table/body-cell/styles.css.js +18 -12
- package/table/body-cell/styles.scoped.css +229 -46
- package/table/body-cell/styles.selectors.js +18 -12
- package/table/body-cell/td-element.d.ts +21 -0
- package/table/body-cell/td-element.d.ts.map +1 -0
- package/table/body-cell/td-element.js +11 -0
- package/table/body-cell/td-element.js.map +1 -0
- package/table/body-cell/use-stable-scroll-position.d.ts +17 -0
- package/table/body-cell/use-stable-scroll-position.d.ts.map +1 -0
- package/table/body-cell/use-stable-scroll-position.js +48 -0
- package/table/body-cell/use-stable-scroll-position.js.map +1 -0
- package/table/header-cell/index.d.ts +8 -7
- package/table/header-cell/index.d.ts.map +1 -1
- package/table/header-cell/index.js +6 -2
- package/table/header-cell/index.js.map +1 -1
- package/table/header-cell/styles.css.js +19 -18
- package/table/header-cell/styles.scoped.css +40 -35
- package/table/header-cell/styles.selectors.js +19 -18
- package/table/interfaces.d.ts +73 -6
- package/table/interfaces.d.ts.map +1 -1
- package/table/interfaces.js.map +1 -1
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +68 -18
- package/table/internal.js.map +1 -1
- package/table/thead.d.ts.map +1 -1
- package/table/thead.js +1 -1
- package/table/thead.js.map +1 -1
- package/table/use-table-focus-navigation.d.ts +16 -0
- package/table/use-table-focus-navigation.d.ts.map +1 -0
- package/table/use-table-focus-navigation.js +131 -0
- package/table/use-table-focus-navigation.js.map +1 -0
- package/tabs/index.d.ts +1 -1
- package/tabs/index.d.ts.map +1 -1
- package/tabs/index.js +2 -2
- package/tabs/index.js.map +1 -1
- package/tabs/interfaces.d.ts +14 -0
- package/tabs/interfaces.d.ts.map +1 -1
- package/tabs/interfaces.js.map +1 -1
- package/tabs/tab-header-bar.d.ts +2 -1
- package/tabs/tab-header-bar.d.ts.map +1 -1
- package/tabs/tab-header-bar.js +3 -7
- package/tabs/tab-header-bar.js.map +1 -1
- package/test-utils/dom/table/index.d.ts +4 -0
- package/test-utils/dom/table/index.js +21 -5
- package/test-utils/dom/table/index.js.map +1 -1
- package/test-utils/selectors/table/index.d.ts +4 -0
- package/test-utils/selectors/table/index.js +21 -5
- package/test-utils/selectors/table/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/wizard/internal/analytics.js +3 -3
- package/wizard/internal/analytics.js.map +1 -1
- package/code-editor/resize-handler.d.ts +0 -3
- package/code-editor/resize-handler.d.ts.map +0 -1
- package/code-editor/resize-handler.js +0 -7
- package/code-editor/resize-handler.js.map +0 -1
- package/internal/components/dynamic-aria-live/index.d.ts +0 -28
- package/internal/components/dynamic-aria-live/index.d.ts.map +0 -1
- package/internal/components/dynamic-aria-live/index.js +0 -38
- package/internal/components/dynamic-aria-live/index.js.map +0 -1
- package/internal/components/live-region/aria-liva-tag.d.ts +0 -13
- package/internal/components/live-region/aria-liva-tag.d.ts.map +0 -1
- package/internal/components/live-region/aria-liva-tag.js +0 -18
- package/internal/components/live-region/aria-liva-tag.js.map +0 -1
- package/internal/components/live-region/utils.d.ts +0 -8
- package/internal/components/live-region/utils.d.ts.map +0 -1
- package/internal/components/live-region/utils.js +0 -24
- package/internal/components/live-region/utils.js.map +0 -1
|
@@ -2,38 +2,38 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"flash-refresh": "awsui_flash-
|
|
6
|
-
"enter": "
|
|
7
|
-
"flash-body": "awsui_flash-
|
|
8
|
-
"flash-message": "awsui_flash-
|
|
9
|
-
"flash-header": "awsui_flash-
|
|
10
|
-
"flash-content": "awsui_flash-
|
|
11
|
-
"action-button-wrapper": "awsui_action-button-
|
|
12
|
-
"dismiss-button-wrapper": "awsui_dismiss-button-
|
|
13
|
-
"flash-icon": "awsui_flash-
|
|
14
|
-
"entering": "
|
|
15
|
-
"entered": "
|
|
16
|
-
"exiting": "
|
|
17
|
-
"flashbar": "
|
|
18
|
-
"flash": "
|
|
19
|
-
"flash-list": "awsui_flash-
|
|
20
|
-
"flash-focus-container": "awsui_flash-focus-
|
|
21
|
-
"flash-text": "awsui_flash-
|
|
22
|
-
"dismiss-button": "awsui_dismiss-
|
|
23
|
-
"breakpoint-default": "awsui_breakpoint-
|
|
24
|
-
"flash-list-item": "awsui_flash-list-
|
|
25
|
-
"action-button": "awsui_action-
|
|
26
|
-
"flash-type-success": "awsui_flash-type-
|
|
27
|
-
"flash-type-error": "awsui_flash-type-
|
|
28
|
-
"flash-type-warning": "awsui_flash-type-
|
|
29
|
-
"flash-type-info": "awsui_flash-type-
|
|
30
|
-
"stack": "
|
|
31
|
-
"expanded": "
|
|
32
|
-
"collapsed": "
|
|
33
|
-
"item": "
|
|
34
|
-
"visual-refresh": "awsui_visual-
|
|
35
|
-
"flash-items": "awsui_flash-
|
|
36
|
-
"toggle": "
|
|
37
|
-
"icon": "
|
|
5
|
+
"flash-refresh": "awsui_flash-refresh_1q84n_19pij_93",
|
|
6
|
+
"enter": "awsui_enter_1q84n_19pij_93",
|
|
7
|
+
"flash-body": "awsui_flash-body_1q84n_19pij_108",
|
|
8
|
+
"flash-message": "awsui_flash-message_1q84n_19pij_108",
|
|
9
|
+
"flash-header": "awsui_flash-header_1q84n_19pij_108",
|
|
10
|
+
"flash-content": "awsui_flash-content_1q84n_19pij_109",
|
|
11
|
+
"action-button-wrapper": "awsui_action-button-wrapper_1q84n_19pij_110",
|
|
12
|
+
"dismiss-button-wrapper": "awsui_dismiss-button-wrapper_1q84n_19pij_111",
|
|
13
|
+
"flash-icon": "awsui_flash-icon_1q84n_19pij_134",
|
|
14
|
+
"entering": "awsui_entering_1q84n_19pij_147",
|
|
15
|
+
"entered": "awsui_entered_1q84n_19pij_168",
|
|
16
|
+
"exiting": "awsui_exiting_1q84n_19pij_273",
|
|
17
|
+
"flashbar": "awsui_flashbar_1q84n_19pij_295",
|
|
18
|
+
"flash": "awsui_flash_1q84n_19pij_93",
|
|
19
|
+
"flash-list": "awsui_flash-list_1q84n_19pij_350",
|
|
20
|
+
"flash-focus-container": "awsui_flash-focus-container_1q84n_19pij_386",
|
|
21
|
+
"flash-text": "awsui_flash-text_1q84n_19pij_392",
|
|
22
|
+
"dismiss-button": "awsui_dismiss-button_1q84n_19pij_111",
|
|
23
|
+
"breakpoint-default": "awsui_breakpoint-default_1q84n_19pij_433",
|
|
24
|
+
"flash-list-item": "awsui_flash-list-item_1q84n_19pij_433",
|
|
25
|
+
"action-button": "awsui_action-button_1q84n_19pij_110",
|
|
26
|
+
"flash-type-success": "awsui_flash-type-success_1q84n_19pij_446",
|
|
27
|
+
"flash-type-error": "awsui_flash-type-error_1q84n_19pij_450",
|
|
28
|
+
"flash-type-warning": "awsui_flash-type-warning_1q84n_19pij_454",
|
|
29
|
+
"flash-type-info": "awsui_flash-type-info_1q84n_19pij_458",
|
|
30
|
+
"stack": "awsui_stack_1q84n_19pij_462",
|
|
31
|
+
"expanded": "awsui_expanded_1q84n_19pij_467",
|
|
32
|
+
"collapsed": "awsui_collapsed_1q84n_19pij_481",
|
|
33
|
+
"item": "awsui_item_1q84n_19pij_487",
|
|
34
|
+
"visual-refresh": "awsui_visual-refresh_1q84n_19pij_497",
|
|
35
|
+
"flash-items": "awsui_flash-items_1q84n_19pij_503",
|
|
36
|
+
"toggle": "awsui_toggle_1q84n_19pij_510",
|
|
37
|
+
"icon": "awsui_icon_1q84n_19pij_573"
|
|
38
38
|
};
|
|
39
39
|
|
|
@@ -72,5 +72,15 @@ export interface InternalFormFieldProps extends FormFieldProps, InternalBaseComp
|
|
|
72
72
|
* Visually hide the label.
|
|
73
73
|
*/
|
|
74
74
|
__hideLabel?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Disable the gutter applied by default.
|
|
77
|
+
*/
|
|
78
|
+
__disableGutters?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Use a React based implementation of the autofocus behavior. This is to prevent scroll jumps
|
|
81
|
+
* when the autofocus behavior is triggered. Built-in browser autofocus behavior seems to
|
|
82
|
+
* trigger a scroll jump even when the element is already in the viewport.
|
|
83
|
+
*/
|
|
84
|
+
__useReactAutofocus?: boolean;
|
|
75
85
|
}
|
|
76
86
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/form-field/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC;IAEzC;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEnC;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEjC;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,yBAAiB,cAAc,CAAC;IAC9B,UAAiB,WAAW;QAC1B;;WAEG;QACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B;CACF;AAED,MAAM,WAAW,sBAAuB,SAAQ,cAAc,EAAE,0BAA0B;IACxF;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/form-field/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC;IAEzC;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEnC;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEjC;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,yBAAiB,cAAc,CAAC;IAC9B,UAAiB,WAAW;QAC1B;;WAEG;QACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B;CACF;AAED,MAAM,WAAW,sBAAuB,SAAQ,cAAc,EAAE,0BAA0B;IACxF;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/form-field/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';\nimport React from 'react';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nexport interface FormFieldProps extends BaseComponentProps {\n /**\n * The ID of the primary form control. You can use this to set the\n * `for` attribute of a label for accessibility.\n *\n * If you don't set this property, the control group automatically sets\n * the label to the ID of an inner form control (for example, an [input](/components/input) component).\n * This only works well if you're using a single control in the form field.\n */\n controlId?: string;\n\n /**\n * Determines whether the primary control should expand to 12 columns.\n *\n * By default (or when this property is set to `false`), the primary control\n * occupies 9 columns. The secondary control uses the remaining 3 columns.\n * On smaller viewports, both components occupy 12 columns and stack on top of each other.\n *\n * If this property is set to `true`, the primary control uses the full\n * 12 columns. The secondary control (if present) also uses 12 columns, and the two\n * controls stack on top of each other.\n */\n stretch?: boolean;\n\n /**\n * The main label for the form field.\n */\n label?: React.ReactNode;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings?: FormFieldProps.I18nStrings;\n\n /**\n * Use to display an 'Info' link next to the label.\n */\n info?: React.ReactNode;\n\n /**\n * The primary form control (for example, input, textarea, etc.).\n * @displayname control\n */\n children?: React.ReactNode;\n\n /**\n * A secondary control. You can use this for custom actions and content.\n */\n secondaryControl?: React.ReactNode;\n\n /**\n * Detailed information about the form field that's displayed below the label.\n */\n description?: React.ReactNode;\n\n /**\n * Constraint text that's displayed below the control. Use this to provide\n * additional information about valid formats, etc.\n */\n constraintText?: React.ReactNode;\n\n /**\n * Text that displays as a validation message. If this is set to a\n * non-empty string, it will render the form field as invalid.\n */\n errorText?: React.ReactNode;\n}\n\nexport namespace FormFieldProps {\n export interface I18nStrings {\n /**\n * Provides a text alternative for the error icon in the error message.\n */\n errorIconAriaLabel?: string;\n }\n}\n\nexport interface InternalFormFieldProps extends FormFieldProps, InternalBaseComponentProps {\n /**\n * Visually hide the label.\n */\n __hideLabel?: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/form-field/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';\nimport React from 'react';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nexport interface FormFieldProps extends BaseComponentProps {\n /**\n * The ID of the primary form control. You can use this to set the\n * `for` attribute of a label for accessibility.\n *\n * If you don't set this property, the control group automatically sets\n * the label to the ID of an inner form control (for example, an [input](/components/input) component).\n * This only works well if you're using a single control in the form field.\n */\n controlId?: string;\n\n /**\n * Determines whether the primary control should expand to 12 columns.\n *\n * By default (or when this property is set to `false`), the primary control\n * occupies 9 columns. The secondary control uses the remaining 3 columns.\n * On smaller viewports, both components occupy 12 columns and stack on top of each other.\n *\n * If this property is set to `true`, the primary control uses the full\n * 12 columns. The secondary control (if present) also uses 12 columns, and the two\n * controls stack on top of each other.\n */\n stretch?: boolean;\n\n /**\n * The main label for the form field.\n */\n label?: React.ReactNode;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings?: FormFieldProps.I18nStrings;\n\n /**\n * Use to display an 'Info' link next to the label.\n */\n info?: React.ReactNode;\n\n /**\n * The primary form control (for example, input, textarea, etc.).\n * @displayname control\n */\n children?: React.ReactNode;\n\n /**\n * A secondary control. You can use this for custom actions and content.\n */\n secondaryControl?: React.ReactNode;\n\n /**\n * Detailed information about the form field that's displayed below the label.\n */\n description?: React.ReactNode;\n\n /**\n * Constraint text that's displayed below the control. Use this to provide\n * additional information about valid formats, etc.\n */\n constraintText?: React.ReactNode;\n\n /**\n * Text that displays as a validation message. If this is set to a\n * non-empty string, it will render the form field as invalid.\n */\n errorText?: React.ReactNode;\n}\n\nexport namespace FormFieldProps {\n export interface I18nStrings {\n /**\n * Provides a text alternative for the error icon in the error message.\n */\n errorIconAriaLabel?: string;\n }\n}\n\nexport interface InternalFormFieldProps extends FormFieldProps, InternalBaseComponentProps {\n /**\n * Visually hide the label.\n */\n __hideLabel?: boolean;\n\n /**\n * Disable the gutter applied by default.\n */\n __disableGutters?: boolean;\n\n /**\n * Use a React based implementation of the autofocus behavior. This is to prevent scroll jumps\n * when the autofocus behavior is triggered. Built-in browser autofocus behavior seems to\n * trigger a scroll jump even when the element is already in the viewport.\n */\n __useReactAutofocus?: boolean;\n}\n"]}
|
package/form-field/internal.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ interface FormFieldErrorProps {
|
|
|
6
6
|
errorIconAriaLabel?: string;
|
|
7
7
|
}
|
|
8
8
|
export declare const FormFieldError: ({ id, children, errorIconAriaLabel }: FormFieldErrorProps) => JSX.Element;
|
|
9
|
-
export default function InternalFormField({ controlId, stretch, label, info, i18nStrings, children, secondaryControl, description, constraintText, errorText, __hideLabel, __internalRootRef, ...rest }: InternalFormFieldProps): JSX.Element;
|
|
9
|
+
export default function InternalFormField({ controlId, stretch, label, info, i18nStrings, children, secondaryControl, description, constraintText, errorText, __hideLabel, __internalRootRef, __disableGutters, __useReactAutofocus, ...rest }: InternalFormFieldProps): JSX.Element;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGtD,UAAU,mBAAmB;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,cAAc,yCAA0C,mBAAmB,gBASvF,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,SAAS,EACT,OAAe,EACf,KAAK,EACL,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,SAAS,EACT,WAAW,EACX,iBAAwB,EACxB,GAAG,IAAI,EACR,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGtD,UAAU,mBAAmB;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,cAAc,yCAA0C,mBAAmB,gBASvF,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,SAAS,EACT,OAAe,EACf,KAAK,EACL,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,SAAS,EACT,WAAW,EACX,iBAAwB,EACxB,gBAAwB,EACxB,mBAA2B,EAC3B,GAAG,IAAI,EACR,EAAE,sBAAsB,eAkFxB"}
|
package/form-field/internal.js
CHANGED
|
@@ -21,7 +21,7 @@ export var FormFieldError = function (_a) {
|
|
|
21
21
|
React.createElement("span", { className: styles.error__message }, children)));
|
|
22
22
|
};
|
|
23
23
|
export default function InternalFormField(_a) {
|
|
24
|
-
var controlId = _a.controlId, _b = _a.stretch, stretch = _b === void 0 ? false : _b, label = _a.label, info = _a.info, i18nStrings = _a.i18nStrings, children = _a.children, secondaryControl = _a.secondaryControl, description = _a.description, constraintText = _a.constraintText, errorText = _a.errorText, __hideLabel = _a.__hideLabel, _c = _a.__internalRootRef, __internalRootRef = _c === void 0 ? null : _c, rest = __rest(_a, ["controlId", "stretch", "label", "info", "i18nStrings", "children", "secondaryControl", "description", "constraintText", "errorText", "__hideLabel", "__internalRootRef"]);
|
|
24
|
+
var controlId = _a.controlId, _b = _a.stretch, stretch = _b === void 0 ? false : _b, label = _a.label, info = _a.info, i18nStrings = _a.i18nStrings, children = _a.children, secondaryControl = _a.secondaryControl, description = _a.description, constraintText = _a.constraintText, errorText = _a.errorText, __hideLabel = _a.__hideLabel, _c = _a.__internalRootRef, __internalRootRef = _c === void 0 ? null : _c, _d = _a.__disableGutters, __disableGutters = _d === void 0 ? false : _d, _e = _a.__useReactAutofocus, __useReactAutofocus = _e === void 0 ? false : _e, rest = __rest(_a, ["controlId", "stretch", "label", "info", "i18nStrings", "children", "secondaryControl", "description", "constraintText", "errorText", "__hideLabel", "__internalRootRef", "__disableGutters", "__useReactAutofocus"]);
|
|
25
25
|
var baseProps = getBaseProps(rest);
|
|
26
26
|
var isRefresh = useVisualRefresh();
|
|
27
27
|
var instanceUniqueId = useUniqueId('formField');
|
|
@@ -30,11 +30,12 @@ export default function InternalFormField(_a) {
|
|
|
30
30
|
var slotIds = getSlotIds(formFieldId, label, description, constraintText, errorText);
|
|
31
31
|
var ariaDescribedBy = getAriaDescribedBy(slotIds);
|
|
32
32
|
var gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);
|
|
33
|
-
var
|
|
33
|
+
var _f = useFormFieldContext({}), parentAriaLabelledby = _f.ariaLabelledby, parentAriaDescribedby = _f.ariaDescribedby, parentInvalid = _f.invalid;
|
|
34
34
|
var contextValuesWithoutControlId = {
|
|
35
35
|
ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,
|
|
36
36
|
ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,
|
|
37
|
-
invalid: !!errorText || !!parentInvalid
|
|
37
|
+
invalid: !!errorText || !!parentInvalid,
|
|
38
|
+
__useReactAutofocus: __useReactAutofocus
|
|
38
39
|
};
|
|
39
40
|
return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: __internalRootRef }),
|
|
40
41
|
React.createElement("div", { className: clsx(__hideLabel && styles['visually-hidden']) },
|
|
@@ -42,7 +43,7 @@ export default function InternalFormField(_a) {
|
|
|
42
43
|
!__hideLabel && info && React.createElement("span", { className: styles.info }, info)),
|
|
43
44
|
description && (React.createElement("div", { className: styles.description, id: slotIds.description }, description)),
|
|
44
45
|
React.createElement("div", { className: clsx(styles.controls, __hideLabel && styles['label-hidden']) },
|
|
45
|
-
React.createElement(InternalGrid, { gridDefinition: gridDefinition },
|
|
46
|
+
React.createElement(InternalGrid, { gridDefinition: gridDefinition, disableGutters: __disableGutters },
|
|
46
47
|
React.createElement(FormFieldContext.Provider, { value: __assign({ controlId: generatedControlId }, contextValuesWithoutControlId) }, children && React.createElement("div", { className: styles.control }, children)),
|
|
47
48
|
secondaryControl && (React.createElement(FormFieldContext.Provider, { value: contextValuesWithoutControlId },
|
|
48
49
|
React.createElement("div", { className: styles['secondary-control'] }, secondaryControl))))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE3E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAQxD,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,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC;YAC1E,oBAAC,YAAY,IAAC,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB;gBAC5E,oBAAC,gBAAgB,CAAC,QAAQ,IACxB,KAAK,aACH,SAAS,EAAE,kBAAkB,IAC1B,6BAA6B,KAGjC,QAAQ,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO,IAAG,QAAQ,CAAO,CACnC;gBAE3B,gBAAgB,IAAI,CACnB,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,6BAA6B;oBAC7D,6BAAK,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC,IAAG,gBAAgB,CAAO,CAC3C,CAC7B,CACY,CACX;QAEL,CAAC,cAAc,IAAI,SAAS,CAAC,IAAI,CAChC,6BAAK,SAAS,EAAE,MAAM,CAAC,KAAK;YACzB,SAAS,IAAI,CACZ,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,IACnF,SAAS,CACK,CAClB;YACA,cAAc,IAAI,CACjB,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAC/E,EAAE,EAAE,OAAO,CAAC,UAAU,IAErB,cAAc,CACX,CACP,CACG,CACP,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\n\nimport InternalGrid from '../grid/internal';\nimport InternalIcon from '../icon/internal';\nimport { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';\n\nimport styles from './styles.css.js';\nimport { InternalFormFieldProps } from './interfaces';\nimport { joinStrings } from '../internal/utils/strings';\n\ninterface FormFieldErrorProps {\n id?: string;\n children?: React.ReactNode;\n errorIconAriaLabel?: string;\n}\n\nexport const FormFieldError = ({ id, children, errorIconAriaLabel }: FormFieldErrorProps) => (\n <div id={id} className={styles.error}>\n <div className={styles['error-icon-shake-wrapper']}>\n <div role=\"img\" aria-label={errorIconAriaLabel} className={styles['error-icon-scale-wrapper']}>\n <InternalIcon name=\"status-warning\" size=\"small\" />\n </div>\n </div>\n <span className={styles.error__message}>{children}</span>\n </div>\n);\n\nexport default function InternalFormField({\n controlId,\n stretch = false,\n label,\n info,\n i18nStrings,\n children,\n secondaryControl,\n description,\n constraintText,\n errorText,\n __hideLabel,\n __internalRootRef = null,\n __disableGutters = false,\n __useReactAutofocus = false,\n ...rest\n}: InternalFormFieldProps) {\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n\n const instanceUniqueId = useUniqueId('formField');\n const generatedControlId = controlId || instanceUniqueId;\n const formFieldId = controlId || generatedControlId;\n\n const slotIds = getSlotIds(formFieldId, label, description, constraintText, errorText);\n\n const ariaDescribedBy = getAriaDescribedBy(slotIds);\n\n const gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);\n\n const {\n ariaLabelledby: parentAriaLabelledby,\n ariaDescribedby: parentAriaDescribedby,\n invalid: parentInvalid,\n } = useFormFieldContext({});\n\n const contextValuesWithoutControlId = {\n ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,\n ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,\n invalid: !!errorText || !!parentInvalid,\n __useReactAutofocus,\n };\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div className={clsx(__hideLabel && styles['visually-hidden'])}>\n {label && (\n <label className={styles.label} id={slotIds.label} htmlFor={generatedControlId}>\n {label}\n </label>\n )}\n {!__hideLabel && info && <span className={styles.info}>{info}</span>}\n </div>\n\n {description && (\n <div className={styles.description} id={slotIds.description}>\n {description}\n </div>\n )}\n\n <div className={clsx(styles.controls, __hideLabel && styles['label-hidden'])}>\n <InternalGrid gridDefinition={gridDefinition} disableGutters={__disableGutters}>\n <FormFieldContext.Provider\n value={{\n controlId: generatedControlId,\n ...contextValuesWithoutControlId,\n }}\n >\n {children && <div className={styles.control}>{children}</div>}\n </FormFieldContext.Provider>\n\n {secondaryControl && (\n <FormFieldContext.Provider value={contextValuesWithoutControlId}>\n <div className={styles['secondary-control']}>{secondaryControl}</div>\n </FormFieldContext.Provider>\n )}\n </InternalGrid>\n </div>\n\n {(constraintText || errorText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError id={slotIds.error} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {constraintText && (\n <div\n className={clsx(styles.constraint, errorText && styles['constraint-has-error'])}\n id={slotIds.constraint}\n >\n {constraintText}\n </div>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
|
package/input/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAA6C,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC1G,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAgB,MAAM,4BAA4B,CAAC;AAG9E,OAAO,EAAE,+BAA+B,EAAuB,MAAM,wCAAwC,CAAC;AAC9G,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,MAAM,WAAW,kBACf,SAAQ,kBAAkB,EACxB,cAAc,EACd,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,EACxB,gBAAgB,EAChB,+BAA+B,EAC/B,0BAA0B;IAC5B,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC;IAC3C,UAAU,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,iBAAiB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACzC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAE/B,WAAW,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAChC,kBAAkB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC1C,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAEhC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACzC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,gBAAgB,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAC;IAC/D,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;QAAE,aAAa,EAAE,IAAI,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAE/E,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;;AAsKD,wBAA+C"}
|
package/input/internal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import React, { useRef } from 'react';
|
|
4
|
+
import React, { useEffect, useRef } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
7
7
|
import InternalIcon from '../icon/internal';
|
|
@@ -31,8 +31,14 @@ function InternalInput(_a, ref) {
|
|
|
31
31
|
__rightIcon = __rightIcon !== null && __rightIcon !== void 0 ? __rightIcon : searchProps.__rightIcon;
|
|
32
32
|
__onRightIconClick = __onRightIconClick !== null && __onRightIconClick !== void 0 ? __onRightIconClick : searchProps.__onRightIconClick;
|
|
33
33
|
var formFieldContext = useFormFieldContext(rest);
|
|
34
|
-
var _g = __inheritFormFieldProps
|
|
35
|
-
|
|
34
|
+
var _g = __inheritFormFieldProps
|
|
35
|
+
? formFieldContext
|
|
36
|
+
: __assign({ __useReactAutofocus: undefined }, rest), ariaLabelledby = _g.ariaLabelledby, ariaDescribedby = _g.ariaDescribedby, controlId = _g.controlId, invalid = _g.invalid, __useReactAutofocus = _g.__useReactAutofocus;
|
|
37
|
+
var autoFocusEnabled = (__nativeAttributes === null || __nativeAttributes === void 0 ? void 0 : __nativeAttributes.autoFocus) || autoFocus;
|
|
38
|
+
var reactAutofocusProps = __useReactAutofocus
|
|
39
|
+
? { autoFocus: !autoFocusEnabled, 'data-awsui-react-autofocus': autoFocusEnabled }
|
|
40
|
+
: {};
|
|
41
|
+
var attributes = __assign(__assign({ 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, name: name, placeholder: placeholder, autoFocus: autoFocus, id: controlId, className: clsx(styles.input, type && styles["input-type-".concat(type)], __rightIcon && styles['input-has-icon-right'], __leftIcon && styles['input-has-icon-left'], __noBorderRadius && styles['input-has-no-border-radius'], (_b = {},
|
|
36
42
|
_b[styles['input-readonly']] = readOnly,
|
|
37
43
|
_b[styles['input-invalid']] = invalid,
|
|
38
44
|
_b)), autoComplete: convertAutoComplete(autoComplete), disabled: disabled, readOnly: readOnly, type: type, step: step, inputMode: inputMode, spellCheck: spellcheck, onKeyDown: onKeyDown && (function (event) { return fireKeyboardEvent(onKeyDown, event); }), onKeyUp: onKeyUp && (function (event) { return fireKeyboardEvent(onKeyUp, event); }),
|
|
@@ -40,7 +46,7 @@ function InternalInput(_a, ref) {
|
|
|
40
46
|
value: value !== null && value !== void 0 ? value : '', onChange: onChange && (function (event) { return handleChange(event.target.value); }), onBlur: function (e) {
|
|
41
47
|
onBlur && fireNonCancelableEvent(onBlur);
|
|
42
48
|
__onBlurWithDetail && fireNonCancelableEvent(__onBlurWithDetail, { relatedTarget: e.relatedTarget });
|
|
43
|
-
}, onFocus: onFocus && (function () { return fireNonCancelableEvent(onFocus); }) }, __nativeAttributes);
|
|
49
|
+
}, onFocus: onFocus && (function () { return fireNonCancelableEvent(onFocus); }) }, __nativeAttributes), reactAutofocusProps);
|
|
44
50
|
if (type === 'number') {
|
|
45
51
|
// Chrome and Safari have a weird built-in behavior of letting focused
|
|
46
52
|
// number inputs be controlled by scrolling on them. However, they don't
|
|
@@ -64,6 +70,12 @@ function InternalInput(_a, ref) {
|
|
|
64
70
|
if (attributes.type === 'visualSearch') {
|
|
65
71
|
attributes.type = 'text';
|
|
66
72
|
}
|
|
73
|
+
useEffect(function () {
|
|
74
|
+
var _a;
|
|
75
|
+
if (__useReactAutofocus && autoFocusEnabled) {
|
|
76
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
77
|
+
}
|
|
78
|
+
}, [__useReactAutofocus, autoFocusEnabled]);
|
|
67
79
|
return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles['input-container']), ref: __internalRootRef }),
|
|
68
80
|
__leftIcon && (React.createElement("span", { onClick: __onLeftIconClick, className: iconClassName('left', !!__onLeftIconClick) },
|
|
69
81
|
React.createElement(InternalIcon, { name: __leftIcon, variant: disabled ? 'disabled' : __leftIconVariant }))),
|
package/input/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../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CAAC,CAAC,EAAE,GAAG,EAAE,iBAAiB;QACxG,UAAU,IAAI,CACb,8BAAM,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,iBAAiB,CAAC;YACrF,oBAAC,YAAY,IAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,GAAI,CACjF,CACR;QACD,wCAAO,GAAG,EAAE,SAAS,IAAM,UAAU,EAAI;QACxC,WAAW,IAAI,CACd,8BACE,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,gBAAgB,EAC7B,SAAS,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,kBAAkB,CAAC;YAEvD,oBAAC,YAAY,IAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,kBAAkB,GAAI,CACnF,CACR,CACG,CACP,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { MouseEventHandler, Ref, useRef } from 'react';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport styles from './styles.css.js';\nimport { fireNonCancelableEvent, fireKeyboardEvent, NonCancelableEventHandler } from '../internal/events';\nimport { InputProps, BaseInputProps, InputAutoCorrect, BaseChangeDetail } from './interfaces';\nimport { BaseComponentProps, getBaseProps } from '../internal/base-component';\nimport { useSearchProps, convertAutoComplete } from './utils';\nimport { useDebounceCallback } from '../internal/hooks/use-debounce-callback';\nimport { FormFieldValidationControlProps, useFormFieldContext } from '../internal/context/form-field-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nexport interface InternalInputProps\n extends BaseComponentProps,\n BaseInputProps,\n Omit<InputProps, 'type'>,\n InputAutoCorrect,\n FormFieldValidationControlProps,\n InternalBaseComponentProps {\n type?: InputProps['type'] | 'visualSearch';\n __leftIcon?: IconProps['name'];\n __leftIconVariant?: IconProps['variant'];\n __onLeftIconClick?: () => void;\n\n __rightIcon?: IconProps['name'];\n __rightIconVariant?: IconProps['variant'];\n __onRightIconClick?: () => void;\n\n __nativeAttributes?: Record<string, any>;\n __noBorderRadius?: boolean;\n\n __onDelayedInput?: NonCancelableEventHandler<BaseChangeDetail>;\n __onBlurWithDetail?: NonCancelableEventHandler<{ relatedTarget: Node | null }>;\n\n __inheritFormFieldProps?: boolean;\n}\n\nconst iconClassName = (position: string, hasHandler: boolean) =>\n clsx(styles['input-icon'], styles[`input-icon-${position}`], { [styles['input-icon-hoverable']]: hasHandler });\nconst preventMouseDown: MouseEventHandler = e => e.preventDefault();\n\nfunction InternalInput(\n {\n type = 'text',\n step,\n inputMode,\n autoComplete = true,\n ariaLabel,\n name,\n value,\n placeholder,\n autoFocus,\n disabled,\n readOnly,\n disableBrowserAutocorrect,\n spellcheck,\n __noBorderRadius,\n\n __leftIcon,\n __leftIconVariant = 'subtle',\n __onLeftIconClick,\n\n ariaRequired,\n\n __rightIcon,\n __rightIconVariant = 'normal',\n __onRightIconClick,\n\n onKeyDown,\n onKeyUp,\n onChange,\n __onDelayedInput,\n __onBlurWithDetail,\n onBlur,\n onFocus,\n __nativeAttributes,\n __internalRootRef,\n __inheritFormFieldProps,\n ...rest\n }: InternalInputProps,\n ref: Ref<HTMLInputElement>\n) {\n const baseProps = getBaseProps(rest);\n const fireDelayedInput = useDebounceCallback((value: string) => fireNonCancelableEvent(__onDelayedInput, { value }));\n\n const handleChange = (value: string) => {\n fireDelayedInput(value);\n fireNonCancelableEvent(onChange, { value });\n };\n\n const inputRef = useRef<HTMLInputElement>(null);\n const searchProps = useSearchProps(type, disabled, readOnly, value, inputRef, handleChange);\n __leftIcon = __leftIcon ?? searchProps.__leftIcon;\n __rightIcon = __rightIcon ?? searchProps.__rightIcon;\n __onRightIconClick = __onRightIconClick ?? searchProps.__onRightIconClick;\n\n const formFieldContext = useFormFieldContext(rest);\n const { ariaLabelledby, ariaDescribedby, controlId, invalid } = __inheritFormFieldProps ? formFieldContext : rest;\n\n const attributes: React.InputHTMLAttributes<HTMLInputElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n name,\n placeholder,\n autoFocus,\n id: controlId,\n className: clsx(\n styles.input,\n type && styles[`input-type-${type}`],\n __rightIcon && styles['input-has-icon-right'],\n __leftIcon && styles['input-has-icon-left'],\n __noBorderRadius && styles['input-has-no-border-radius'],\n {\n [styles['input-readonly']]: readOnly,\n [styles['input-invalid']]: invalid,\n }\n ),\n autoComplete: convertAutoComplete(autoComplete),\n disabled,\n readOnly,\n type,\n step,\n inputMode,\n spellCheck: spellcheck,\n onKeyDown: onKeyDown && (event => fireKeyboardEvent(onKeyDown, event)),\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: onChange && (event => handleChange(event.target.value)),\n onBlur: e => {\n onBlur && fireNonCancelableEvent(onBlur);\n __onBlurWithDetail && fireNonCancelableEvent(__onBlurWithDetail, { relatedTarget: e.relatedTarget });\n },\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n ...__nativeAttributes,\n };\n\n if (type === 'number') {\n // Chrome and Safari have a weird built-in behavior of letting focused\n // number inputs be controlled by scrolling on them. However, they don't\n // lock the browser's scroll, so it's very easy to accidentally increment\n // the input while scrolling down the page.\n attributes.onWheel = event => event.currentTarget.blur();\n }\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n // ensure aria properties are string literal \"true\"\n if (ariaRequired) {\n attributes['aria-required'] = 'true';\n }\n if (invalid) {\n attributes['aria-invalid'] = 'true';\n }\n\n const mergedRef = useMergeRefs(ref, inputRef);\n\n // type = \"visualSearch\" renders a type=\"text' input\n if (attributes.type === 'visualSearch') {\n attributes.type = 'text';\n }\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles['input-container'])} ref={__internalRootRef}>\n {__leftIcon && (\n <span onClick={__onLeftIconClick} className={iconClassName('left', !!__onLeftIconClick)}>\n <InternalIcon name={__leftIcon} variant={disabled ? 'disabled' : __leftIconVariant} />\n </span>\n )}\n <input ref={mergedRef} {...attributes} />\n {__rightIcon && (\n <span\n onClick={__onRightIconClick}\n onMouseDown={preventMouseDown}\n className={iconClassName('right', !!__onRightIconClick)}\n >\n <InternalIcon name={__rightIcon} variant={disabled ? 'disabled' : __rightIconVariant} />\n </span>\n )}\n </div>\n );\n}\n\nexport default React.forwardRef(InternalInput);\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/input/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAA0B,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAA6B,MAAM,oBAAoB,CAAC;AAE1G,OAAO,EAAsB,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAmC,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AA4B9G,IAAM,aAAa,GAAG,UA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ACb,8BAAM,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,iBAAiB,CAAC;YACrF,oBAAC,YAAY,IAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,GAAI,CACjF,CACR;QACD,wCAAO,GAAG,EAAE,SAAS,IAAM,UAAU,EAAI;QACxC,WAAW,IAAI,CACd,8BACE,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,gBAAgB,EAC7B,SAAS,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,kBAAkB,CAAC;YAEvD,oBAAC,YAAY,IAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,kBAAkB,GAAI,CACnF,CACR,CACG,CACP,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { MouseEventHandler, Ref, useEffect, useRef } from 'react';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport styles from './styles.css.js';\nimport { fireNonCancelableEvent, fireKeyboardEvent, NonCancelableEventHandler } from '../internal/events';\nimport { InputProps, BaseInputProps, InputAutoCorrect, BaseChangeDetail } from './interfaces';\nimport { BaseComponentProps, getBaseProps } from '../internal/base-component';\nimport { useSearchProps, convertAutoComplete } from './utils';\nimport { useDebounceCallback } from '../internal/hooks/use-debounce-callback';\nimport { FormFieldValidationControlProps, useFormFieldContext } from '../internal/context/form-field-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nexport interface InternalInputProps\n extends BaseComponentProps,\n BaseInputProps,\n Omit<InputProps, 'type'>,\n InputAutoCorrect,\n FormFieldValidationControlProps,\n InternalBaseComponentProps {\n type?: InputProps['type'] | 'visualSearch';\n __leftIcon?: IconProps['name'];\n __leftIconVariant?: IconProps['variant'];\n __onLeftIconClick?: () => void;\n\n __rightIcon?: IconProps['name'];\n __rightIconVariant?: IconProps['variant'];\n __onRightIconClick?: () => void;\n\n __nativeAttributes?: Record<string, any>;\n __noBorderRadius?: boolean;\n\n __onDelayedInput?: NonCancelableEventHandler<BaseChangeDetail>;\n __onBlurWithDetail?: NonCancelableEventHandler<{ relatedTarget: Node | null }>;\n\n __inheritFormFieldProps?: boolean;\n}\n\nconst iconClassName = (position: string, hasHandler: boolean) =>\n clsx(styles['input-icon'], styles[`input-icon-${position}`], { [styles['input-icon-hoverable']]: hasHandler });\nconst preventMouseDown: MouseEventHandler = e => e.preventDefault();\n\nfunction InternalInput(\n {\n type = 'text',\n step,\n inputMode,\n autoComplete = true,\n ariaLabel,\n name,\n value,\n placeholder,\n autoFocus,\n disabled,\n readOnly,\n disableBrowserAutocorrect,\n spellcheck,\n __noBorderRadius,\n\n __leftIcon,\n __leftIconVariant = 'subtle',\n __onLeftIconClick,\n\n ariaRequired,\n\n __rightIcon,\n __rightIconVariant = 'normal',\n __onRightIconClick,\n\n onKeyDown,\n onKeyUp,\n onChange,\n __onDelayedInput,\n __onBlurWithDetail,\n onBlur,\n onFocus,\n __nativeAttributes,\n __internalRootRef,\n __inheritFormFieldProps,\n ...rest\n }: InternalInputProps,\n ref: Ref<HTMLInputElement>\n) {\n const baseProps = getBaseProps(rest);\n const fireDelayedInput = useDebounceCallback((value: string) => fireNonCancelableEvent(__onDelayedInput, { value }));\n\n const handleChange = (value: string) => {\n fireDelayedInput(value);\n fireNonCancelableEvent(onChange, { value });\n };\n\n const inputRef = useRef<HTMLInputElement>(null);\n const searchProps = useSearchProps(type, disabled, readOnly, value, inputRef, handleChange);\n __leftIcon = __leftIcon ?? searchProps.__leftIcon;\n __rightIcon = __rightIcon ?? searchProps.__rightIcon;\n __onRightIconClick = __onRightIconClick ?? searchProps.__onRightIconClick;\n\n const formFieldContext = useFormFieldContext(rest);\n const { ariaLabelledby, ariaDescribedby, controlId, invalid, __useReactAutofocus } = __inheritFormFieldProps\n ? formFieldContext\n : { __useReactAutofocus: undefined, ...rest };\n\n const autoFocusEnabled = __nativeAttributes?.autoFocus || autoFocus;\n const reactAutofocusProps = __useReactAutofocus\n ? { autoFocus: !autoFocusEnabled, 'data-awsui-react-autofocus': autoFocusEnabled }\n : {};\n\n const attributes: React.InputHTMLAttributes<HTMLInputElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n name,\n placeholder,\n autoFocus,\n id: controlId,\n className: clsx(\n styles.input,\n type && styles[`input-type-${type}`],\n __rightIcon && styles['input-has-icon-right'],\n __leftIcon && styles['input-has-icon-left'],\n __noBorderRadius && styles['input-has-no-border-radius'],\n {\n [styles['input-readonly']]: readOnly,\n [styles['input-invalid']]: invalid,\n }\n ),\n autoComplete: convertAutoComplete(autoComplete),\n disabled,\n readOnly,\n type,\n step,\n inputMode,\n spellCheck: spellcheck,\n onKeyDown: onKeyDown && (event => fireKeyboardEvent(onKeyDown, event)),\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: onChange && (event => handleChange(event.target.value)),\n onBlur: e => {\n onBlur && fireNonCancelableEvent(onBlur);\n __onBlurWithDetail && fireNonCancelableEvent(__onBlurWithDetail, { relatedTarget: e.relatedTarget });\n },\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n ...__nativeAttributes,\n ...reactAutofocusProps,\n };\n\n if (type === 'number') {\n // Chrome and Safari have a weird built-in behavior of letting focused\n // number inputs be controlled by scrolling on them. However, they don't\n // lock the browser's scroll, so it's very easy to accidentally increment\n // the input while scrolling down the page.\n attributes.onWheel = event => event.currentTarget.blur();\n }\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n // ensure aria properties are string literal \"true\"\n if (ariaRequired) {\n attributes['aria-required'] = 'true';\n }\n if (invalid) {\n attributes['aria-invalid'] = 'true';\n }\n\n const mergedRef = useMergeRefs(ref, inputRef);\n\n // type = \"visualSearch\" renders a type=\"text' input\n if (attributes.type === 'visualSearch') {\n attributes.type = 'text';\n }\n\n useEffect(() => {\n if (__useReactAutofocus && autoFocusEnabled) {\n inputRef.current?.focus({ preventScroll: true });\n }\n }, [__useReactAutofocus, autoFocusEnabled]);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles['input-container'])} ref={__internalRootRef}>\n {__leftIcon && (\n <span onClick={__onLeftIconClick} className={iconClassName('left', !!__onLeftIconClick)}>\n <InternalIcon name={__leftIcon} variant={disabled ? 'disabled' : __leftIconVariant} />\n </span>\n )}\n <input ref={mergedRef} {...attributes} />\n {__rightIcon && (\n <span\n onClick={__onRightIconClick}\n onMouseDown={preventMouseDown}\n className={iconClassName('right', !!__onRightIconClick)}\n >\n <InternalIcon name={__rightIcon} variant={disabled ? 'disabled' : __rightIconVariant} />\n </span>\n )}\n </div>\n );\n}\n\nexport default React.forwardRef(InternalInput);\n"]}
|
|
@@ -41,5 +41,5 @@ export interface LiveRegionProps extends ScreenreaderOnlyProps {
|
|
|
41
41
|
*/
|
|
42
42
|
declare const _default: React.MemoExoticComponent<typeof LiveRegion>;
|
|
43
43
|
export default _default;
|
|
44
|
-
declare function LiveRegion({ delay, children, ...restProps }: LiveRegionProps): JSX.Element;
|
|
44
|
+
declare function LiveRegion({ assertive, delay, visible, children, ...restProps }: LiveRegionProps): JSX.Element;
|
|
45
45
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAyB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG/E,MAAM,WAAW,eAAgB,SAAQ,qBAAqB;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;AACH,wBAAgC;AAEhC,iBAAS,UAAU,CAAC,EAAE,SAAiB,EAAE,KAAU,EAAE,OAAe,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EAAE,eAAe,eA0D9G"}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { __assign, __rest } from "tslib";
|
|
4
4
|
/* eslint-disable @cloudscape-design/prefer-live-region */
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
import React, { memo, useEffect, useRef } from 'react';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
7
|
+
import ScreenreaderOnly from '../screenreader-only';
|
|
8
|
+
import styles from './styles.css.js';
|
|
8
9
|
/**
|
|
9
10
|
* The live region is hidden in the layout, but visible for screen readers.
|
|
10
11
|
* It's purpose it to announce changes e.g. when custom navigation logic is used.
|
|
@@ -40,7 +41,7 @@ import AriaLiveTag from './aria-liva-tag';
|
|
|
40
41
|
*/
|
|
41
42
|
export default memo(LiveRegion);
|
|
42
43
|
function LiveRegion(_a) {
|
|
43
|
-
var _b = _a.delay, delay =
|
|
44
|
+
var _b = _a.assertive, assertive = _b === void 0 ? false : _b, _c = _a.delay, delay = _c === void 0 ? 10 : _c, _d = _a.visible, visible = _d === void 0 ? false : _d, children = _a.children, restProps = __rest(_a, ["assertive", "delay", "visible", "children"]);
|
|
44
45
|
var sourceRef = useRef(null);
|
|
45
46
|
var targetRef = useRef(null);
|
|
46
47
|
/*
|
|
@@ -55,12 +56,24 @@ function LiveRegion(_a) {
|
|
|
55
56
|
does not impact the performance. If it does, prefer using a string as children prop.
|
|
56
57
|
*/
|
|
57
58
|
useEffect(function () {
|
|
59
|
+
function updateLiveRegion() {
|
|
60
|
+
if (targetRef.current && sourceRef.current) {
|
|
61
|
+
var sourceContent = extractInnerText(sourceRef.current);
|
|
62
|
+
var targetContent = extractInnerText(targetRef.current);
|
|
63
|
+
if (targetContent !== sourceContent) {
|
|
64
|
+
// The aria-atomic does not work properly in Voice Over, causing
|
|
65
|
+
// certain parts of the content to be ignored. To fix that,
|
|
66
|
+
// we assign the source text content as a single node.
|
|
67
|
+
targetRef.current.innerText = sourceContent;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
58
71
|
var timeoutId;
|
|
59
72
|
if (delay) {
|
|
60
|
-
timeoutId = setTimeout(
|
|
73
|
+
timeoutId = setTimeout(updateLiveRegion, delay);
|
|
61
74
|
}
|
|
62
75
|
else {
|
|
63
|
-
updateLiveRegion(
|
|
76
|
+
updateLiveRegion();
|
|
64
77
|
}
|
|
65
78
|
return function () {
|
|
66
79
|
if (timeoutId) {
|
|
@@ -68,6 +81,16 @@ function LiveRegion(_a) {
|
|
|
68
81
|
}
|
|
69
82
|
};
|
|
70
83
|
});
|
|
71
|
-
return (React.createElement(
|
|
84
|
+
return (React.createElement(React.Fragment, null,
|
|
85
|
+
visible && React.createElement("span", { ref: sourceRef }, children),
|
|
86
|
+
React.createElement(ScreenreaderOnly, __assign({}, restProps, { className: clsx(styles.root, restProps.className) }),
|
|
87
|
+
!visible && (React.createElement("span", { ref: sourceRef, "aria-hidden": "true" }, children)),
|
|
88
|
+
React.createElement("span", { ref: targetRef, "aria-atomic": "true", "aria-live": assertive ? 'assertive' : 'polite' }))));
|
|
89
|
+
}
|
|
90
|
+
// This only extracts text content from the node including all its children which is enough for now.
|
|
91
|
+
// To make it more powerful, it is possible to create a more sophisticated extractor with respect to
|
|
92
|
+
// ARIA properties to ignore aria-hidden nodes and read ARIA labels from the live content.
|
|
93
|
+
function extractInnerText(node) {
|
|
94
|
+
return (node.innerText || '').replace(/\s+/g, ' ').trim();
|
|
72
95
|
}
|
|
73
96
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,0DAA0D;AAE1D,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,0DAA0D;AAE1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,gBAA2C,MAAM,sBAAsB,CAAC;AAC/E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AASrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAe,IAAI,CAAC,UAAU,CAAC,CAAC;AAEhC,SAAS,UAAU,CAAC,EAA2F;IAAzF,IAAA,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EAAE,aAAU,EAAV,KAAK,mBAAG,EAAE,KAAA,EAAE,eAAe,EAAf,OAAO,mBAAG,KAAK,KAAA,EAAE,QAAQ,cAAA,EAAK,SAAS,cAAxE,6CAA0E,CAAF;IAC1F,IAAM,SAAS,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAC;IAChD,IAAM,SAAS,G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CAAC,IAAiB;IACzC,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @cloudscape-design/prefer-live-region */\n\nimport clsx from 'clsx';\nimport React, { memo, useEffect, useRef } from 'react';\nimport ScreenreaderOnly, { ScreenreaderOnlyProps } from '../screenreader-only';\nimport styles from './styles.css.js';\n\nexport interface LiveRegionProps extends ScreenreaderOnlyProps {\n assertive?: boolean;\n delay?: number;\n visible?: boolean;\n children: React.ReactNode;\n}\n\n/**\n * The live region is hidden in the layout, but visible for screen readers.\n * It's purpose it to announce changes e.g. when custom navigation logic is used.\n *\n * The way live region works differently in different browsers and screen readers and\n * it is recommended to manually test every new implementation.\n *\n * If you notice there are different words being merged together,\n * check if there are text nodes not being wrapped in elements, like:\n * <LiveRegion>\n * {title}\n * <span><Details /></span>\n * </LiveRegion>\n *\n * To fix, wrap \"title\" in an element:\n * <LiveRegion>\n * <span>{title}</span>\n * <span><Details /></span>\n * </LiveRegion>\n *\n * Or create a single text node if possible:\n * <LiveRegion>\n * {`${title} ${details}`}\n * </LiveRegion>\n *\n * The live region is always atomic, because non-atomic regions can be treated by screen readers\n * differently and produce unexpected results. To imitate non-atomic announcements simply use\n * multiple live regions:\n * <>\n * <LiveRegion>{title}</LiveRegion>\n * <LiveRegion><Details /></LiveRegion>\n * </>\n */\nexport default memo(LiveRegion);\n\nfunction LiveRegion({ assertive = false, delay = 10, visible = false, children, ...restProps }: LiveRegionProps) {\n const sourceRef = useRef<HTMLSpanElement>(null);\n const targetRef = useRef<HTMLSpanElement>(null);\n\n /*\n When React state changes, React often produces too many DOM updates, causing NVDA to\n issue many announcements for the same logical event (See https://github.com/nvaccess/nvda/issues/7996).\n\n The code below imitates a debouncing, scheduling a callback every time new React state\n update is detected. When a callback resolves, it copies content from a muted element\n to the live region, which is recognized by screen readers as an update.\n\n If the use case requires no announcement to be ignored, use delay = 0, but ensure it\n does not impact the performance. If it does, prefer using a string as children prop.\n */\n useEffect(() => {\n function updateLiveRegion() {\n if (targetRef.current && sourceRef.current) {\n const sourceContent = extractInnerText(sourceRef.current);\n const targetContent = extractInnerText(targetRef.current);\n if (targetContent !== sourceContent) {\n // The aria-atomic does not work properly in Voice Over, causing\n // certain parts of the content to be ignored. To fix that,\n // we assign the source text content as a single node.\n targetRef.current.innerText = sourceContent;\n }\n }\n }\n\n let timeoutId: null | number;\n if (delay) {\n timeoutId = setTimeout(updateLiveRegion, delay);\n } else {\n updateLiveRegion();\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n });\n\n return (\n <>\n {visible && <span ref={sourceRef}>{children}</span>}\n\n <ScreenreaderOnly {...restProps} className={clsx(styles.root, restProps.className)}>\n {!visible && (\n <span ref={sourceRef} aria-hidden=\"true\">\n {children}\n </span>\n )}\n\n <span ref={targetRef} aria-atomic=\"true\" aria-live={assertive ? 'assertive' : 'polite'}></span>\n </ScreenreaderOnly>\n </>\n );\n}\n\n// This only extracts text content from the node including all its children which is enough for now.\n// To make it more powerful, it is possible to create a more sophisticated extractor with respect to\n// ARIA properties to ignore aria-hidden nodes and read ARIA labels from the live content.\nfunction extractInnerText(node: HTMLElement) {\n return (node.innerText || '').replace(/\\s+/g, ' ').trim();\n}\n"]}
|
|
@@ -39,6 +39,10 @@ export interface FormFieldValidationControlProps extends FormFieldControlProps {
|
|
|
39
39
|
*/
|
|
40
40
|
invalid?: boolean;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
interface InternalFormFieldControlProps extends FormFieldValidationControlProps {
|
|
43
|
+
__useReactAutofocus?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export declare const FormFieldContext: import("react").Context<InternalFormFieldControlProps>;
|
|
46
|
+
export declare function useFormFieldContext(props: FormFieldValidationControlProps): InternalFormFieldControlProps;
|
|
47
|
+
export {};
|
|
44
48
|
//# sourceMappingURL=form-field-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/form-field-context.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,+BAAgC,SAAQ,qBAAqB;IAC5E;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"form-field-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/form-field-context.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,+BAAgC,SAAQ,qBAAqB;IAC5E;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,6BAA8B,SAAQ,+BAA+B;IAC7E,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,gBAAgB,wDAAmD,CAAC;AAUjF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,+BAA+B,iCASzE"}
|
|
@@ -11,6 +11,12 @@ function applyDefault(fields, defaults, keys) {
|
|
|
11
11
|
}
|
|
12
12
|
export function useFormFieldContext(props) {
|
|
13
13
|
var context = useContext(FormFieldContext);
|
|
14
|
-
return applyDefault(props, context, [
|
|
14
|
+
return applyDefault(props, context, [
|
|
15
|
+
'invalid',
|
|
16
|
+
'controlId',
|
|
17
|
+
'ariaLabelledby',
|
|
18
|
+
'ariaDescribedby',
|
|
19
|
+
'__useReactAutofocus',
|
|
20
|
+
]);
|
|
15
21
|
}
|
|
16
22
|
//# sourceMappingURL=form-field-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field-context.js","sourceRoot":"","sources":["../../../../src/internal/context/form-field-context.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"form-field-context.js","sourceRoot":"","sources":["../../../../src/internal/context/form-field-context.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAmDlD,MAAM,CAAC,IAAM,gBAAgB,GAAG,aAAa,CAAgC,EAAE,CAAC,CAAC;AAEjF,SAAS,YAAY,CAAI,MAAS,EAAE,QAAW,EAAE,IAAiB;IAChE,IAAM,MAAM,GAAM,EAAE,CAAC;IACrB,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;QACd,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAsC;IACxE,IAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC7C,OAAO,YAAY,CAAgC,KAAK,EAAE,OAAO,EAAE;QACjE,SAAS;QACT,WAAW;QACX,gBAAgB;QAChB,iBAAiB;QACjB,qBAAqB;KACtB,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useContext, createContext } from 'react';\n\nexport interface FormFieldControlProps {\n /**\n * Specifies the ID of the native form element. You can use it to relate\n * a label element's `for` attribute to this control.\n *\n * It defaults to an automatically generated ID that\n * is provided by its parent form field component.\n */\n controlId?: string;\n\n /**\n * Adds `aria-labelledby` to the component. If you're using this component within a form field,\n * don't set this property because the form field component automatically sets it.\n *\n * Use this property if the component isn't surrounded by a form field, or you want to override the value\n * automatically set by the form field (for example, if you have two components within a single form field).\n *\n * To use it correctly, define an ID for the element you want to use as label and set the property to that ID.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the component. If you're using this component within a form field,\n * don't set this property because the form field component automatically sets it.\n *\n * Use this property if the component isn't surrounded by a form field, or you want to override the value\n * automatically set by the form field (for example, if you have two components within a single form field).\n *\n * To use it correctly, define an ID for each element that you want to use as a description\n * and set the property to a string of each ID separated by spaces (for example, `\"id1 id2 id3\"`).\n */\n ariaDescribedby?: string;\n}\n\nexport interface FormFieldValidationControlProps extends FormFieldControlProps {\n /**\n * Overrides the invalidation state. Usually the invalid state\n * comes from the parent `FormField`component,\n * however sometimes you need to override its\n * state when you have more than one input within a\n * single form field.\n */\n invalid?: boolean;\n}\n\ninterface InternalFormFieldControlProps extends FormFieldValidationControlProps {\n __useReactAutofocus?: boolean;\n}\n\nexport const FormFieldContext = createContext<InternalFormFieldControlProps>({});\n\nfunction applyDefault<T>(fields: T, defaults: T, keys: (keyof T)[]) {\n const result = <T>{};\n keys.forEach(key => {\n result[key] = fields[key] === undefined ? defaults[key] : fields[key];\n });\n return result;\n}\n\nexport function useFormFieldContext(props: FormFieldValidationControlProps) {\n const context = useContext(FormFieldContext);\n return applyDefault<InternalFormFieldControlProps>(props, context, [\n 'invalid',\n 'controlId',\n 'ariaLabelledby',\n 'ariaDescribedby',\n '__useReactAutofocus',\n ]);\n}\n"]}
|
package/internal/environment.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-telemetry/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-telemetry/index.ts"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,QAcjD"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
|
+
import { THEME } from '../../environment';
|
|
4
5
|
import { Metrics } from '../../metrics';
|
|
6
|
+
import { useVisualRefresh } from '../use-visual-mode';
|
|
5
7
|
export function useTelemetry(componentName) {
|
|
8
|
+
var isVisualRefresh = useVisualRefresh();
|
|
6
9
|
useEffect(function () {
|
|
10
|
+
Metrics.initMetrics(isVisualRefresh ? 'vr' : THEME);
|
|
7
11
|
if (typeof window !== 'undefined') {
|
|
8
12
|
Metrics.sendMetricOnce('awsui-viewport-width', window.innerWidth || 0);
|
|
9
13
|
Metrics.sendMetricOnce('awsui-viewport-height', window.innerHeight || 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-telemetry/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-telemetry/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,UAAU,YAAY,CAAC,aAAqB;IAChD,IAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAE3C,SAAS,CAAC;QACR,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACpD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YACjC,OAAO,CAAC,cAAc,CAAC,sBAAsB,EAAE,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC;YACvE,OAAO,CAAC,cAAc,CAAC,uBAAuB,EAAE,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC;SAC1E;QACD,OAAO,CAAC,kBAAkB,EAAE,CAAC;QAC7B,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,CAAC;QACtD,4GAA4G;QAC5G,uDAAuD;IACzD,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';\nimport { THEME } from '../../environment';\nimport { Metrics } from '../../metrics';\nimport { useVisualRefresh } from '../use-visual-mode';\n\nexport function useTelemetry(componentName: string) {\n const isVisualRefresh = useVisualRefresh();\n\n useEffect(() => {\n Metrics.initMetrics(isVisualRefresh ? 'vr' : THEME);\n if (typeof window !== 'undefined') {\n Metrics.sendMetricOnce('awsui-viewport-width', window.innerWidth || 0);\n Metrics.sendMetricOnce('awsui-viewport-height', window.innerHeight || 0);\n }\n Metrics.logComponentLoaded();\n Metrics.logComponentUsed(componentName.toLowerCase());\n // Components do not change the name dynamically. Explicit empty array to prevent accidential double metrics\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n}\n"]}
|
package/internal/manifest.json
CHANGED
package/internal/metrics.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface MetricsV2EventItem {
|
|
|
10
10
|
eventValue?: string | Record<string, string | number | boolean>;
|
|
11
11
|
}
|
|
12
12
|
export declare const Metrics: {
|
|
13
|
-
initMetrics(
|
|
13
|
+
initMetrics(theme: string): void;
|
|
14
14
|
/**
|
|
15
15
|
* Calls Console Platform's client logging JS API with provided metric name, value, and detail.
|
|
16
16
|
* Does nothing if Console Platform client logging JS is not present in page.
|
|
@@ -20,7 +20,7 @@ export declare const Metrics: {
|
|
|
20
20
|
* Calls Console Platform's client v2 logging JS API with provided metric name and detail.
|
|
21
21
|
* Does nothing if Console Platform client logging JS is not present in page.
|
|
22
22
|
*/
|
|
23
|
-
sendPanoramaMetric(
|
|
23
|
+
sendPanoramaMetric(metric: MetricsV2EventItem): void;
|
|
24
24
|
sendMetricObject(metric: MetricsLogItem, value: number): void;
|
|
25
25
|
sendMetricObjectOnce(metric: MetricsLogItem, value: number): void;
|
|
26
26
|
sendMetricOnce(metricName: string, value: number, detail?: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACjE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAA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