@cloudscape-design/components 3.0.1156 → 3.0.1157
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/alert/index.js +1 -1
- package/alert/interfaces.d.ts +1 -2
- package/app-layout/runtime-drawer/index.d.ts.map +1 -1
- package/app-layout/runtime-drawer/index.js +20 -18
- package/app-layout/runtime-drawer/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/styles.css.js +30 -30
- package/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +83 -83
- package/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +30 -30
- package/autosuggest/index.js +28 -11
- package/autosuggest/interfaces.d.ts +2 -1
- package/autosuggest/interfaces.js.map +1 -1
- package/badge/index.d.ts +2 -0
- package/badge/index.js +14 -13
- package/badge/interfaces.d.ts +3 -2
- package/box/index.js +18 -13
- package/box/interfaces.d.ts +2 -1
- package/button/index.js +12 -11
- package/button/interfaces.d.ts +4 -2
- package/button-dropdown/index.js +27 -11
- package/button-dropdown/interfaces.d.ts +6 -2
- package/button-group/index.js +42 -11
- package/button-group/interfaces.d.ts +10 -0
- package/button-group/interfaces.d.ts.map +1 -1
- package/button-group/interfaces.js.map +1 -1
- package/checkbox/index.js +9 -11
- package/checkbox/interfaces.d.ts +3 -2
- package/container/index.js +29 -13
- package/container/interfaces.d.ts +2 -1
- package/date-input/index.js +8 -10
- package/flashbar/index.js +10 -13
- package/flashbar/interfaces.d.ts +1 -0
- package/icon/index.js +8 -13
- package/icon/interfaces.d.ts +2 -1
- package/icon-provider/index.js +12 -2
- package/index.d.ts +4 -1
- package/index.js +4 -0
- package/input/index.js +53 -12
- package/input/interfaces.d.ts +3 -1
- package/internal/base-component/styles.scoped.css +1 -1
- package/internal/components/radio-button/interfaces.d.ts +3 -3
- package/internal/environment.js +3 -3
- package/internal/environment.json +3 -3
- package/internal/manifest.json +1 -1
- package/internal/plugins/controllers/drawers.d.ts +2 -2
- package/internal/plugins/controllers/drawers.d.ts.map +1 -1
- package/internal/plugins/controllers/drawers.js.map +1 -1
- package/internal/plugins/widget/interfaces.d.ts +2 -2
- package/internal/plugins/widget/interfaces.d.ts.map +1 -1
- package/internal/plugins/widget/interfaces.js.map +1 -1
- package/link/index.js +25 -11
- package/link/interfaces.d.ts +3 -2
- package/navigable-group/index.js +19 -4
- package/package.json +4 -1
- package/progress-bar/index.d.ts +1 -0
- package/progress-bar/index.js +52 -14
- package/progress-bar/interfaces.d.ts +1 -0
- package/prompt-input/index.js +19 -11
- package/prompt-input/interfaces.d.ts +4 -3
- package/radio-button/index.js +19 -4
- package/radio-group/index.js +20 -11
- package/radio-group/interfaces.d.ts +1 -1
- package/segmented-control/index.js +14 -13
- package/segmented-control/interfaces.d.ts +1 -0
- package/select/interfaces.d.ts +1 -1
- package/select/interfaces.js.map +1 -1
- package/space-between/index.js +10 -13
- package/space-between/interfaces.d.ts +2 -1
- package/spinner/index.js +10 -13
- package/spinner/interfaces.d.ts +2 -1
- package/status-indicator/index.js +10 -13
- package/status-indicator/interfaces.d.ts +2 -1
- package/steps/index.js +11 -11
- package/steps/interfaces.d.ts +6 -2
- package/table/header-cell/index.d.ts +1 -1
- package/table/header-cell/index.d.ts.map +1 -1
- package/table/header-cell/index.js +1 -1
- package/table/header-cell/index.js.map +1 -1
- package/table/header-cell/th-element.d.ts +1 -1
- package/table/header-cell/th-element.d.ts.map +1 -1
- package/table/header-cell/th-element.js.map +1 -1
- package/table/resizer/index.d.ts +3 -1
- package/table/resizer/index.d.ts.map +1 -1
- package/table/resizer/index.js +8 -5
- package/table/resizer/index.js.map +1 -1
- package/table/resizer/styles.css.js +13 -12
- package/table/resizer/styles.scoped.css +22 -22
- package/table/resizer/styles.selectors.js +13 -12
- package/table/thead.d.ts +1 -1
- package/table/thead.d.ts.map +1 -1
- package/table/thead.js.map +1 -1
- package/text-filter/index.js +17 -10
- package/text-filter/interfaces.d.ts +1 -0
- package/textarea/index.js +65 -12
- package/textarea/interfaces.d.ts +3 -2
- package/time-input/index.js +15 -11
- package/toggle/index.js +6 -10
- package/toggle/interfaces.d.ts +3 -2
- package/toggle-button/index.js +14 -11
- package/wizard/index.js +35 -13
- package/wizard/interfaces.d.ts +1 -1
- package/autosuggest/internal-do-not-use-core.js +0 -35
- package/badge/internal-do-not-use-core.js +0 -19
- package/box/internal-do-not-use-core.js +0 -23
- package/button/internal-do-not-use-core.js +0 -19
- package/button-dropdown/internal-do-not-use-core.js +0 -34
- package/button-group/internal-do-not-use-core.js +0 -49
- package/checkbox/internal-do-not-use-core.js +0 -16
- package/container/internal-do-not-use-core.js +0 -34
- package/date-input/internal-do-not-use-core.js +0 -16
- package/flashbar/internal-do-not-use-core.js +0 -15
- package/icon/internal-do-not-use-core.js +0 -13
- package/input/internal-do-not-use-core.js +0 -59
- package/link/internal-do-not-use-core.js +0 -32
- package/progress-bar/internal-do-not-use-core.js +0 -56
- package/prompt-input/internal-do-not-use-core.js +0 -26
- package/radio-group/internal-do-not-use-core.js +0 -27
- package/segmented-control/internal-do-not-use-core.js +0 -19
- package/space-between/internal-do-not-use-core.js +0 -15
- package/spinner/internal-do-not-use-core.js +0 -15
- package/status-indicator/internal-do-not-use-core.js +0 -15
- package/steps/internal-do-not-use-core.js +0 -18
- package/text-filter/internal-do-not-use-core.js +0 -25
- package/textarea/internal-do-not-use-core.js +0 -71
- package/time-input/internal-do-not-use-core.js +0 -22
- package/toggle/internal-do-not-use-core.js +0 -14
- package/toggle-button/internal-do-not-use-core.js +0 -21
- package/wizard/internal-do-not-use-core.js +0 -40
- /package/autosuggest/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/badge/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/box/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/button/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/button-dropdown/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/button-group/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/checkbox/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/container/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/date-input/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/flashbar/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/icon/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/input/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/link/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/progress-bar/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/prompt-input/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/radio-group/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/segmented-control/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/space-between/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/spinner/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/status-indicator/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/steps/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/text-filter/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/textarea/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/time-input/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/toggle/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/toggle-button/{internal-do-not-use-core.js.map → index.js.map} +0 -0
- /package/wizard/{internal-do-not-use-core.js.map → index.js.map} +0 -0
package/autosuggest/index.js
CHANGED
|
@@ -1,18 +1,35 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import
|
|
5
|
+
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
6
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
7
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
import { getExternalProps } from '../internal/utils/external-props';
|
|
9
|
+
import InternalAutosuggest from './internal';
|
|
10
|
+
const Autosuggest = React.forwardRef(({ filteringType = 'auto', statusType = 'finished', disableBrowserAutocorrect = false, hideEnteredTextOption = false, ...props }, ref) => {
|
|
11
|
+
const baseComponentProps = useBaseComponent('Autosuggest', {
|
|
12
|
+
props: {
|
|
13
|
+
autoFocus: props.autoFocus,
|
|
14
|
+
disableBrowserAutocorrect,
|
|
15
|
+
expandToViewport: props.expandToViewport,
|
|
16
|
+
filteringType,
|
|
17
|
+
readOnly: props.readOnly,
|
|
18
|
+
virtualScroll: props.virtualScroll,
|
|
19
|
+
hideEnteredTextOption,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const componentAnalyticsMetadata = {
|
|
23
|
+
name: 'awsui.Autosuggest',
|
|
24
|
+
label: 'input',
|
|
25
|
+
properties: {
|
|
26
|
+
disabled: `${!!props.disabled}`,
|
|
27
|
+
value: props.value || '',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
const externalProps = getExternalProps(props);
|
|
31
|
+
return (React.createElement(InternalAutosuggest, { filteringType: filteringType, statusType: statusType, disableBrowserAutocorrect: disableBrowserAutocorrect, hideEnteredTextOption: hideEnteredTextOption, ...externalProps, ...baseComponentProps, ref: ref, ...getAnalyticsMetadataAttribute({ component: componentAnalyticsMetadata }) }));
|
|
14
32
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
33
|
applyDisplayName(Autosuggest, 'Autosuggest');
|
|
18
34
|
export default Autosuggest;
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -95,7 +95,7 @@ export interface AutosuggestProps extends BaseComponentProps, BaseInputProps, In
|
|
|
95
95
|
* Overrides the element that is announced to screen readers
|
|
96
96
|
* when the highlighted option changes. By default, this announces
|
|
97
97
|
* the option's name and properties, and its selected state if
|
|
98
|
-
* the `
|
|
98
|
+
* the `selectedAriaLabel` property is defined.
|
|
99
99
|
* The highlighted option is provided, and its group (if groups
|
|
100
100
|
* are used and it differs from the group of the previously highlighted option).
|
|
101
101
|
*
|
|
@@ -106,6 +106,7 @@ export interface AutosuggestProps extends BaseComponentProps, BaseInputProps, In
|
|
|
106
106
|
/**
|
|
107
107
|
* @awsuiSystem core
|
|
108
108
|
*/
|
|
109
|
+
style?: AutosuggestProps.Style;
|
|
109
110
|
}
|
|
110
111
|
export declare namespace AutosuggestProps {
|
|
111
112
|
type ChangeDetail = InputProps.ChangeDetail;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/autosuggest/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 { BaseInputProps, InputAutoCorrect, InputClearLabel, InputKeyEvents, InputProps } from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport {\n BaseDropdownHostProps,\n OptionsFilteringType,\n OptionsLoadItemsDetail,\n} from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface AutosuggestProps\n extends BaseComponentProps,\n BaseInputProps,\n InputAutoCorrect,\n BaseDropdownHostProps,\n InputKeyEvents,\n InputClearLabel,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n * - `label` (string) - (Optional) Option text displayed to the user.\n * - `lang` (string) - (Optional) The language of the option, provided as a BCP 47 language tag.\n * - `description` (string) - (Optional) Further information about the option that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option is disabled.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.\n * - `iconAriaLabel` (string) - (Optional) Specifies alternate text for the icon. We recommend that you provide this for accessibility.\n * - `iconAlt` (string) - (Optional) **Deprecated**, replaced by \\`iconAriaLabel\\`. Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * #### OptionGroup\n * - `label` (string) - Option group text displayed to the user.\n * - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: AutosuggestProps.Options;\n /**\n * Determines how filtering is applied to the list of `options`:\n *\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value`, `label`, `description` or `labelTag` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Specifies a function that generates the custom value indicator (for example, `Use \"${value}\"`).\n * @i18n\n */\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\n\n /**\n * Defines whether entered text option is shown as the first option in the dropdown when value is non-empty.\n */\n hideEnteredTextOption?: boolean;\n\n /**\n * Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.\n *\n * Note that the `matchesCount` includes the `enteredTextLabel` (\"Use ${value}\") item, so in most cases you\n * should subtract 1 from `matchesCount`. If using manual filtering, you should provide your own value for `totalCount`.\n */\n filteringResultsText?: (matchesCount: number, totalCount: number) => string;\n\n /**\n * Specifies the text that's displayed when there aren't any suggestions to display.\n * This is displayed when `statusType` is set to `finished` or it's not set at all.\n */\n empty?: React.ReactNode;\n\n /**\n * Called whenever a user selects an option in the dropdown. Don't use this event as the only way to handle user input.\n * Instead, use `onSelect` in combination with the `onChange` handler only as an optional convenience for the user.\n */\n onSelect?: NonCancelableEventHandler<AutosuggestProps.SelectDetail>;\n\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n * @i18n\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/autosuggest/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 { BaseInputProps, InputAutoCorrect, InputClearLabel, InputKeyEvents, InputProps } from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport {\n BaseDropdownHostProps,\n OptionsFilteringType,\n OptionsLoadItemsDetail,\n} from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface AutosuggestProps\n extends BaseComponentProps,\n BaseInputProps,\n InputAutoCorrect,\n BaseDropdownHostProps,\n InputKeyEvents,\n InputClearLabel,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n * - `label` (string) - (Optional) Option text displayed to the user.\n * - `lang` (string) - (Optional) The language of the option, provided as a BCP 47 language tag.\n * - `description` (string) - (Optional) Further information about the option that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option is disabled.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.\n * - `iconAriaLabel` (string) - (Optional) Specifies alternate text for the icon. We recommend that you provide this for accessibility.\n * - `iconAlt` (string) - (Optional) **Deprecated**, replaced by \\`iconAriaLabel\\`. Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * #### OptionGroup\n * - `label` (string) - Option group text displayed to the user.\n * - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: AutosuggestProps.Options;\n /**\n * Determines how filtering is applied to the list of `options`:\n *\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value`, `label`, `description` or `labelTag` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Specifies a function that generates the custom value indicator (for example, `Use \"${value}\"`).\n * @i18n\n */\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\n\n /**\n * Defines whether entered text option is shown as the first option in the dropdown when value is non-empty.\n */\n hideEnteredTextOption?: boolean;\n\n /**\n * Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.\n *\n * Note that the `matchesCount` includes the `enteredTextLabel` (\"Use ${value}\") item, so in most cases you\n * should subtract 1 from `matchesCount`. If using manual filtering, you should provide your own value for `totalCount`.\n */\n filteringResultsText?: (matchesCount: number, totalCount: number) => string;\n\n /**\n * Specifies the text that's displayed when there aren't any suggestions to display.\n * This is displayed when `statusType` is set to `finished` or it's not set at all.\n */\n empty?: React.ReactNode;\n\n /**\n * Called whenever a user selects an option in the dropdown. Don't use this event as the only way to handle user input.\n * Instead, use `onSelect` in combination with the `onChange` handler only as an optional convenience for the user.\n */\n onSelect?: NonCancelableEventHandler<AutosuggestProps.SelectDetail>;\n\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n * @i18n\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `selectedAriaLabel` property is defined.\n * The highlighted option is provided, and its group (if groups\n * are used and it differs from the group of the previously highlighted option).\n *\n * For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n */\n renderHighlightedAriaLive?: AutosuggestProps.ContainingOptionAndGroupString;\n\n /**\n * @awsuiSystem core\n */\n style?: AutosuggestProps.Style;\n}\n\nexport namespace AutosuggestProps {\n export type ChangeDetail = InputProps.ChangeDetail;\n export type KeyDetail = InputProps.KeyDetail;\n export type FilteringType = OptionsFilteringType;\n export type Option = OptionDefinition;\n export type Options = ReadonlyArray<Option | OptionGroup>;\n export type EnteredTextLabel = (value: string) => string;\n export interface OptionGroup extends Option {\n label?: string;\n options: ReadonlyArray<Option>;\n }\n export type LoadItemsDetail = OptionsLoadItemsDetail;\n export type StatusType = DropdownStatusProps.StatusType;\n export interface SelectDetail {\n value: string;\n selectedOption?: Option;\n }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n\n /**\n * Selects all text in the input control.\n */\n select(): void;\n }\n\n export interface Style {\n root?: {\n backgroundColor?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n borderColor?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n boxShadow?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n color?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n fontSize?: string;\n fontWeight?: string;\n paddingBlock?: string;\n paddingInline?: string;\n };\n placeholder?: {\n color?: string;\n fontSize?: string;\n fontStyle?: string;\n fontWeight?: string;\n };\n }\n}\n\n// TODO: use DropdownOption type same as in select and multiselect\nexport type AutosuggestItem = (AutosuggestProps.Option | AutosuggestProps.OptionGroup) & {\n type?: 'parent' | 'child' | 'use-entered';\n option: OptionDefinition | OptionGroup;\n};\n"]}
|
package/badge/index.d.ts
CHANGED
package/badge/index.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { getBaseProps } from '../internal/base-component';
|
|
7
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
8
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
import WithNativeAttributes from '../internal/utils/with-native-attributes';
|
|
10
|
+
import { getBadgeStyles } from './style';
|
|
11
|
+
import styles from './styles.css.js';
|
|
12
|
+
export default function Badge({ color = 'grey', children, style, nativeAttributes, ...rest }) {
|
|
13
|
+
const { __internalRootRef } = useBaseComponent('Badge', { props: { color } });
|
|
14
|
+
const baseProps = getBaseProps(rest);
|
|
15
|
+
const className = clsx(baseProps.className, styles.badge, styles[`badge-color-${color}`]);
|
|
16
|
+
return (React.createElement(WithNativeAttributes, { ...baseProps, tag: "span", componentName: "Badge", nativeAttributes: nativeAttributes, className: className, ref: __internalRootRef, style: getBadgeStyles(style) }, children));
|
|
17
|
+
}
|
|
17
18
|
applyDisplayName(Badge, 'Badge');
|
|
18
|
-
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
package/badge/interfaces.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { BaseComponentProps } from '../internal/base-component';
|
|
|
3
3
|
/**
|
|
4
4
|
* @awsuiSystem core
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
import { NativeAttributes } from '../internal/utils/with-native-attributes';
|
|
7
7
|
export interface BadgeProps extends BaseComponentProps {
|
|
8
8
|
/**
|
|
9
9
|
* Specifies the badge color.
|
|
@@ -16,7 +16,7 @@ export interface BadgeProps extends BaseComponentProps {
|
|
|
16
16
|
/**
|
|
17
17
|
* @awsuiSystem core
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
style?: BadgeProps.Style;
|
|
20
20
|
/**
|
|
21
21
|
* Attributes to add to the native element.
|
|
22
22
|
* Some attributes will be automatically combined with internal attribute values:
|
|
@@ -27,6 +27,7 @@ export interface BadgeProps extends BaseComponentProps {
|
|
|
27
27
|
*
|
|
28
28
|
* @awsuiSystem core
|
|
29
29
|
*/
|
|
30
|
+
nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;
|
|
30
31
|
}
|
|
31
32
|
export declare namespace BadgeProps {
|
|
32
33
|
interface Style {
|
package/box/index.js
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import CoreComponent from './internal-do-not-use-core';
|
|
5
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
6
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
import InternalBox from './internal';
|
|
8
|
+
export default function Box({ variant = 'div', margin = {}, padding = {}, ...props }) {
|
|
9
|
+
const baseComponentProps = useBaseComponent('Box', {
|
|
10
|
+
props: {
|
|
11
|
+
color: props.color,
|
|
12
|
+
display: props.display,
|
|
13
|
+
float: props.float,
|
|
14
|
+
fontSize: props.fontSize,
|
|
15
|
+
fontWeight: props.fontWeight,
|
|
16
|
+
textAlign: props.textAlign,
|
|
17
|
+
variant,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return React.createElement(InternalBox, { variant: variant, margin: margin, padding: padding, ...props, ...baseComponentProps });
|
|
21
|
+
}
|
|
17
22
|
applyDisplayName(Box, 'Box');
|
|
18
|
-
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
package/box/interfaces.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { BaseComponentProps } from '../internal/base-component';
|
|
|
2
2
|
/**
|
|
3
3
|
* @awsuiSystem core
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
import { NativeAttributes } from '../internal/utils/with-native-attributes';
|
|
6
6
|
export interface BoxProps extends BaseComponentProps {
|
|
7
7
|
/**
|
|
8
8
|
* Defines the style of element to display.
|
|
@@ -129,6 +129,7 @@ export interface BoxProps extends BaseComponentProps {
|
|
|
129
129
|
*
|
|
130
130
|
* @awsuiSystem core
|
|
131
131
|
*/
|
|
132
|
+
nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;
|
|
132
133
|
}
|
|
133
134
|
export declare namespace BoxProps {
|
|
134
135
|
type Variant = 'div' | 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'p' | 'strong' | 'small' | 'code' | 'pre' | 'samp' | 'awsui-key-label' | 'awsui-gen-ai-label' | 'awsui-value-large' | 'awsui-inline-code';
|
package/button/index.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import
|
|
5
|
+
import { getBaseProps } from '../internal/base-component';
|
|
6
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
7
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
import { InternalButton } from './internal';
|
|
9
|
+
const Button = React.forwardRef(({ children, iconName, iconAlign = 'left', iconUrl, iconSvg, iconAlt, variant = 'normal', loading = false, loadingText, disabled = false, disabledReason, wrapText = true, href, target, rel, external = false, download, formAction = 'submit', ariaLabel, ariaDescribedby, onClick, onFollow, ariaExpanded, ariaControls, fullWidth, form, i18nStrings, style, nativeButtonAttributes, nativeAnchorAttributes, ...props }, ref) => {
|
|
10
|
+
const baseComponentProps = useBaseComponent('Button', {
|
|
11
|
+
props: { formAction, fullWidth, iconAlign, iconName, rel, target, external, variant, wrapText },
|
|
12
|
+
metadata: { hasDisabledReason: Boolean(disabledReason) },
|
|
13
|
+
});
|
|
14
|
+
const baseProps = getBaseProps(props);
|
|
15
|
+
return (React.createElement(InternalButton, { ...baseProps, ...baseComponentProps, ref: ref, iconName: iconName, iconAlign: iconAlign, iconUrl: iconUrl, iconSvg: iconSvg, iconAlt: iconAlt, variant: variant, loading: loading, loadingText: loadingText, disabled: disabled, disabledReason: disabledReason, wrapText: wrapText, href: href, target: target, rel: rel, external: external, download: download, formAction: formAction, ariaLabel: ariaLabel, ariaDescribedby: ariaDescribedby, onClick: onClick, onFollow: onFollow, ariaExpanded: ariaExpanded, ariaControls: ariaControls, fullWidth: fullWidth, form: form, i18nStrings: i18nStrings, style: style, nativeButtonAttributes: nativeButtonAttributes, nativeAnchorAttributes: nativeAnchorAttributes, __injectAnalyticsComponentMetadata: true }, children));
|
|
14
16
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
17
|
applyDisplayName(Button, 'Button');
|
|
18
18
|
export default Button;
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
package/button/interfaces.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { BaseNavigationDetail, CancelableEventHandler, ClickDetail as _ClickDeta
|
|
|
5
5
|
/**
|
|
6
6
|
* @awsuiSystem core
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
import { NativeAttributes } from '../internal/utils/with-native-attributes';
|
|
9
9
|
export interface BaseButtonProps {
|
|
10
10
|
/**
|
|
11
11
|
* Renders the button as disabled and prevents clicks.
|
|
@@ -103,7 +103,7 @@ export interface BaseButtonProps {
|
|
|
103
103
|
*
|
|
104
104
|
* @awsuiSystem core
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
nativeButtonAttributes?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
107
107
|
/**
|
|
108
108
|
* Attributes to add to the native `a` element (when `href` is provided).
|
|
109
109
|
* Some attributes will be automatically combined with internal attribute values:
|
|
@@ -114,6 +114,7 @@ export interface BaseButtonProps {
|
|
|
114
114
|
*
|
|
115
115
|
* @awsuiSystem core
|
|
116
116
|
*/
|
|
117
|
+
nativeAnchorAttributes?: NativeAttributes<React.AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
117
118
|
}
|
|
118
119
|
export interface ButtonProps extends BaseComponentProps, BaseButtonProps {
|
|
119
120
|
/**
|
|
@@ -183,6 +184,7 @@ export interface ButtonProps extends BaseComponentProps, BaseButtonProps {
|
|
|
183
184
|
/**
|
|
184
185
|
* @awsuiSystem core
|
|
185
186
|
*/
|
|
187
|
+
style?: ButtonProps.Style;
|
|
186
188
|
}
|
|
187
189
|
export declare namespace ButtonProps {
|
|
188
190
|
type Variant = 'normal' | 'primary' | 'link' | 'icon' | 'inline-icon' | 'inline-link';
|
package/button-dropdown/index.js
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import
|
|
5
|
+
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
6
|
+
import { getBaseProps } from '../internal/base-component';
|
|
7
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
8
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import InternalButtonDropdown from './internal';
|
|
10
|
+
import { hasCheckboxItems, hasDisabledReasonItems } from './utils/utils';
|
|
11
|
+
import analyticsSelectors from './analytics-metadata/styles.css.js';
|
|
12
|
+
const ButtonDropdown = React.forwardRef(({ items, variant = 'normal', loading = false, loadingText, disabled = false, disabledReason, expandableGroups = false, expandToViewport = false, ariaLabel, children, onItemClick, onItemFollow, mainAction, fullWidth, nativeMainActionAttributes, nativeTriggerAttributes, ...props }, ref) => {
|
|
13
|
+
const baseComponentProps = useBaseComponent('ButtonDropdown', {
|
|
14
|
+
props: { expandToViewport, expandableGroups, variant },
|
|
15
|
+
metadata: {
|
|
16
|
+
mainAction: !!mainAction,
|
|
17
|
+
checkboxItems: hasCheckboxItems(items),
|
|
18
|
+
hasDisabledReason: Boolean(disabledReason),
|
|
19
|
+
hasDisabledReasons: hasDisabledReasonItems(items),
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const baseProps = getBaseProps(props);
|
|
23
|
+
const analyticsComponentMetadata = {
|
|
24
|
+
name: 'awsui.ButtonDropdown',
|
|
25
|
+
label: `.${analyticsSelectors['trigger-label']}`,
|
|
26
|
+
properties: { variant, disabled: `${disabled}` },
|
|
27
|
+
};
|
|
28
|
+
return (React.createElement(InternalButtonDropdown, { ...baseProps, ...baseComponentProps, ref: ref, items: items, variant: variant, loading: loading, loadingText: loadingText, disabled: disabled, disabledReason: disabledReason, expandableGroups: expandableGroups, expandToViewport: expandToViewport, ariaLabel: ariaLabel, onItemClick: onItemClick, onItemFollow: onItemFollow, mainAction: mainAction, fullWidth: fullWidth, nativeMainActionAttributes: nativeMainActionAttributes, nativeTriggerAttributes: nativeTriggerAttributes, ...getAnalyticsMetadataAttribute({
|
|
29
|
+
component: analyticsComponentMetadata,
|
|
30
|
+
}) }, children));
|
|
14
31
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
32
|
applyDisplayName(ButtonDropdown, 'ButtonDropdown');
|
|
18
33
|
export default ButtonDropdown;
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -9,7 +9,7 @@ import { InternalBaseComponentProps } from '../internal/hooks/use-base-component
|
|
|
9
9
|
/**
|
|
10
10
|
* @awsuiSystem core
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
import { NativeAttributes } from '../internal/utils/with-native-attributes';
|
|
13
13
|
export interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewport {
|
|
14
14
|
/**
|
|
15
15
|
* Array of objects with a number of supported types.
|
|
@@ -132,7 +132,7 @@ export interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewpor
|
|
|
132
132
|
*
|
|
133
133
|
* @awsuiSystem core
|
|
134
134
|
*/
|
|
135
|
-
|
|
135
|
+
nativeTriggerAttributes?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
136
136
|
/**
|
|
137
137
|
* Attributes to add to the native element of the `mainAction`.
|
|
138
138
|
*
|
|
@@ -146,6 +146,10 @@ export interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewpor
|
|
|
146
146
|
*
|
|
147
147
|
* @awsuiSystem core
|
|
148
148
|
*/
|
|
149
|
+
nativeMainActionAttributes?: {
|
|
150
|
+
button?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
151
|
+
anchor?: NativeAttributes<React.AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
152
|
+
};
|
|
149
153
|
}
|
|
150
154
|
export declare namespace ButtonDropdownProps {
|
|
151
155
|
type Variant = 'normal' | 'primary' | 'icon' | 'inline-icon';
|
package/button-group/index.js
CHANGED
|
@@ -1,18 +1,49 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import
|
|
5
|
+
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
6
|
+
import { getBaseProps } from '../internal/base-component';
|
|
7
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
8
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import { getExternalProps } from '../internal/utils/external-props';
|
|
10
|
+
import InternalButtonGroup from './internal';
|
|
11
|
+
const ButtonGroup = React.forwardRef(({ variant, dropdownExpandToViewport = false, style, ...rest }, ref) => {
|
|
12
|
+
const baseProps = getBaseProps(rest);
|
|
13
|
+
const itemCounts = getItemCounts(rest.items);
|
|
14
|
+
const baseComponentProps = useBaseComponent('ButtonGroup', {
|
|
15
|
+
props: {
|
|
16
|
+
variant,
|
|
17
|
+
dropdownExpandToViewport,
|
|
18
|
+
},
|
|
19
|
+
metadata: {
|
|
20
|
+
iconButtonsCount: itemCounts['icon-button'],
|
|
21
|
+
iconToggleButtonsCount: itemCounts['icon-toggle-button'],
|
|
22
|
+
iconFileInputsCount: itemCounts['icon-file-input'],
|
|
23
|
+
menuDropdownsCount: itemCounts['menu-dropdown'],
|
|
24
|
+
groupsCount: itemCounts.group,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const externalProps = getExternalProps(rest);
|
|
28
|
+
const componentMetadata = {
|
|
29
|
+
name: 'awsui.ButtonGroup',
|
|
30
|
+
label: { root: 'self' },
|
|
31
|
+
};
|
|
32
|
+
return (React.createElement(InternalButtonGroup, { ...baseProps, ...baseComponentProps, ...externalProps, ref: ref, variant: variant, dropdownExpandToViewport: dropdownExpandToViewport, style: style, ...getAnalyticsMetadataAttribute({ component: componentMetadata }) }));
|
|
14
33
|
});
|
|
15
|
-
|
|
16
|
-
|
|
34
|
+
function getItemCounts(allItems = []) {
|
|
35
|
+
const counters = { 'icon-button': 0, 'icon-toggle-button': 0, 'icon-file-input': 0, 'menu-dropdown': 0, group: 0 };
|
|
36
|
+
function count(items) {
|
|
37
|
+
for (const item of items) {
|
|
38
|
+
counters[item.type] += 1;
|
|
39
|
+
if (item.type === 'group') {
|
|
40
|
+
count(item.items);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
count(allItems);
|
|
45
|
+
return counters;
|
|
46
|
+
}
|
|
17
47
|
applyDisplayName(ButtonGroup, 'ButtonGroup');
|
|
18
48
|
export default ButtonGroup;
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -98,6 +98,7 @@ export interface ButtonGroupProps extends BaseComponentProps {
|
|
|
98
98
|
/**
|
|
99
99
|
* @awsuiSystem core
|
|
100
100
|
*/
|
|
101
|
+
style?: ButtonGroupProps.Style;
|
|
101
102
|
}
|
|
102
103
|
export interface InternalIconButton extends ButtonGroupProps.IconButton {
|
|
103
104
|
analyticsAction?: string;
|
|
@@ -105,6 +106,15 @@ export interface InternalIconButton extends ButtonGroupProps.IconButton {
|
|
|
105
106
|
export interface InternalIconToggleButton extends ButtonGroupProps.IconToggleButton {
|
|
106
107
|
analyticsAction?: string;
|
|
107
108
|
}
|
|
109
|
+
export interface IconButtonRuntime extends Omit<ButtonGroupProps.IconButton, 'iconSvg' | 'popoverFeedback'> {
|
|
110
|
+
iconSvg?: string;
|
|
111
|
+
}
|
|
112
|
+
export interface IconToggleButtonRuntime extends Omit<ButtonGroupProps.IconToggleButton, 'iconSvg' | 'pressedIconSvg' | 'popoverFeedback' | 'pressedPopoverFeedback'> {
|
|
113
|
+
iconSvg?: string;
|
|
114
|
+
pressedIconSvg?: string;
|
|
115
|
+
}
|
|
116
|
+
export type ItemOrGroupRuntime = ItemRuntime | ButtonGroupProps.Group;
|
|
117
|
+
export type ItemRuntime = IconButtonRuntime | IconToggleButtonRuntime | ButtonGroupProps.IconFileInput | ButtonGroupProps.MenuDropdown;
|
|
108
118
|
export type InternalItemOrGroup = InternalItem | ButtonGroupProps.Group;
|
|
109
119
|
export type InternalItem = InternalIconButton | InternalIconToggleButton | ButtonGroupProps.IconFileInput | ButtonGroupProps.MenuDropdown;
|
|
110
120
|
export interface InternalButtonGroupProps extends SomeRequired<ButtonGroupProps, 'dropdownExpandToViewport'>, InternalBaseComponentProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/button-group/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC;IAClC;;;;;;;;;;;;OAYG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;IACH,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACnD;;OAEG;IACH,WAAW,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAC3E;;OAEG;IACH,aAAa,CAAC,EAAE,yBAAyB,CAA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C,EAAE,MAAM,CAAC;YACvB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,SAAS,CAAC,EAAE;gBACV,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,WAAW,CAAC,EAAE,MAAM,CAAC;aACtB,CAAC;SACH,CAAC;QACF,IAAI,CAAC,EAAE;YACL,KAAK,CAAC,EAAE;gBACN,MAAM,CAAC,EAAE,MAAM,CAAC;gBAChB,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,KAAK,CAAC,EAAE,MAAM,CAAC;aAChB,CAAC;YACF,SAAS,CAAC,EAAE;gBACV,MAAM,CAAC,EAAE,MAAM,CAAC;gBAChB,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,KAAK,CAAC,EAAE,MAAM,CAAC;aAChB,CAAC;YACF,SAAS,CAAC,EAAE;gBACV,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,WAAW,CAAC,EAAE,MAAM,CAAC;aACtB,CAAC;SACH,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/button-group/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ButtonDropdownProps } from '../button-dropdown/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { SomeRequired } from '../internal/types';\n\nexport interface ButtonGroupProps extends BaseComponentProps {\n /**\n * Adds `aria-label` to the button group toolbar element.\n * Use this to provide a unique accessible name for each button group on the page.\n */\n ariaLabel?: string;\n /**\n * Determines the general styling of the button dropdown.\n * * `icon` for icon buttons.\n */\n variant: ButtonGroupProps.Variant;\n /**\n * Use this property to determine dropdown placement strategy for all menu dropdown items.\n *\n * By default, the dropdown height is constrained to fit inside the height of its next scrollable container element.\n * Enabling this property will allow the dropdown to extend beyond that container by using fixed positioning and\n * [React Portals](https://reactjs.org/docs/portals.html).\n *\n * Set this property if the dropdown would otherwise be constrained by a scrollable container,\n * for example inside table and split view layouts.\n *\n * We recommend you use discretion, and don't enable this property unless necessary\n * because fixed positioning results in a slight, visible lag when scrolling complex pages.\n */\n dropdownExpandToViewport?: boolean;\n /**\n * Array of objects with a number of supported types.\n *\n * ### icon-button\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick` handler and to focus the button using `ref.focus(id)`.\n * * `text` (string) - The name shown as a tooltip for this button.\n * * `disabled` (optional, boolean) - The disabled state indication for this button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for this button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `iconName` (optional, string) - Specifies the name of the icon, used with the [icon component](/components/icon/).\n * * `iconAlt` (optional, string) - Specifies alternate text for the icon when using `iconUrl`.\n * * `iconUrl` (optional, string) - Specifies the URL of a custom icon.\n * * `iconSvg` (optional, ReactNode) - Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `popoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button. Use to provide feedback to the user.\n *\n * ### icon-toggle-button\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick` handler and to focus the button using `ref.focus(id)`.\n * * `pressed` (boolean) - The toggle button pressed state.\n * * `text` (string) - The name shown as a tooltip for this button.\n * * `disabled` (optional, boolean) - The disabled state indication for this button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for this button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `iconName` (optional, string) - Specifies the name of the icon, used with the [icon component](/components/icon/).\n * * `iconUrl` (optional, string) - Specifies the URL of a custom icon.\n * * `iconSvg` (optional, ReactNode) - Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `pressedIconName` (optional, string) - Specifies the name of the icon in pressed state, used with the [icon component](/components/icon/).\n * * `pressedIconUrl` (optional, string) - Specifies the URL of a custom icon in pressed state.\n * * `pressedIconSvg` (optional, ReactNode) - Custom SVG icon in pressed state. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `popoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button. Use to provide feedback to the user.\n * * `pressedPopoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button in pressed state. Defaults to `popoverFeedback`.\n *\n * * ### file-input\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onFilesChange`.\n * * `text` (string) - The name of the menu button shown as a tooltip.\n * * `accept` (optional, string) - Specifies the native file input `accept` attribute to describe the allow-list of file types.\n * * `multiple` (optional, string) - Specifies the native file input `multiple` attribute to allow users entering more than one file.\n *\n * ### menu-dropdown\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick`.\n * * `text` (string) - The name of the menu button shown as a tooltip.\n * * `disabled` (optional, boolean) - The disabled state indication for the menu button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for the menu button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `items` (ButtonDropdownProps.ItemOrGroup[]) - The array of dropdown items that belong to this menu.\n *\n * ### group\n *\n * * `text` (string) - The name of the group rendered as ARIA label for this group.\n * * `items` ((ButtonGroupProps.IconButton | ButtonGroupProps.MenuDropdown)[]) - The array of items that belong to this group.\n */\n items: ReadonlyArray<ButtonGroupProps.ItemOrGroup>;\n /**\n * Called when the user clicks on an item, and the item is not disabled. The event detail object contains the id of the clicked item.\n */\n onItemClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n /**\n * Called when the user uploads files. The event detail object contains the id and files from the file input item.\n */\n onFilesChange?: NonCancelableEventHandler<ButtonGroupProps.FilesChangeDetails>;\n /**\n * @awsuiSystem core\n */\n style?: ButtonGroupProps.Style;\n}\n\nexport interface InternalIconButton extends ButtonGroupProps.IconButton {\n analyticsAction?: string;\n}\nexport interface InternalIconToggleButton extends ButtonGroupProps.IconToggleButton {\n analyticsAction?: string;\n}\n\nexport type InternalItemOrGroup = InternalItem | ButtonGroupProps.Group;\nexport type InternalItem =\n | InternalIconButton\n | InternalIconToggleButton\n | ButtonGroupProps.IconFileInput\n | ButtonGroupProps.MenuDropdown;\n\nexport interface InternalButtonGroupProps\n extends SomeRequired<ButtonGroupProps, 'dropdownExpandToViewport'>,\n InternalBaseComponentProps {\n style?: ButtonGroupProps.Style;\n items: ReadonlyArray<InternalItemOrGroup>;\n}\n\nexport namespace ButtonGroupProps {\n export type Variant = 'icon';\n\n export type ItemOrGroup = Item | Group;\n export type Item = IconButton | IconToggleButton | IconFileInput | MenuDropdown;\n\n export interface IconButton {\n type: 'icon-button';\n id: string;\n text: string;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n popoverFeedback?: React.ReactNode;\n }\n\n export interface IconToggleButton {\n type: 'icon-toggle-button';\n id: string;\n text: string;\n pressed: boolean;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n pressedIconName?: IconProps.Name;\n pressedIconUrl?: string;\n pressedIconSvg?: React.ReactNode;\n popoverFeedback?: React.ReactNode;\n pressedPopoverFeedback?: React.ReactNode;\n }\n\n export interface IconFileInput {\n type: 'icon-file-input';\n id: string;\n text: string;\n accept?: string;\n multiple?: boolean;\n }\n\n export interface MenuDropdown {\n type: 'menu-dropdown';\n id: string;\n text: string;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n items: ReadonlyArray<ButtonDropdownProps.ItemOrGroup>;\n }\n\n export interface Group {\n type: 'group';\n text: string;\n items: ReadonlyArray<ButtonGroupProps.Item>;\n }\n\n export interface ItemClickDetails {\n id: string;\n pressed?: boolean;\n checked?: boolean;\n }\n\n export interface FilesChangeDetails {\n id: string;\n files: File[];\n }\n\n export interface Ref {\n /**\n * Focuses button group item by id.\n */\n focus(itemId: string): void;\n }\n export interface Style {\n root?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n paddingBlock?: string;\n paddingInline?: string;\n boxShadow?: string;\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n item?: {\n color?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n boxShadow?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/button-group/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ButtonDropdownProps } from '../button-dropdown/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { SomeRequired } from '../internal/types';\n\nexport interface ButtonGroupProps extends BaseComponentProps {\n /**\n * Adds `aria-label` to the button group toolbar element.\n * Use this to provide a unique accessible name for each button group on the page.\n */\n ariaLabel?: string;\n /**\n * Determines the general styling of the button dropdown.\n * * `icon` for icon buttons.\n */\n variant: ButtonGroupProps.Variant;\n /**\n * Use this property to determine dropdown placement strategy for all menu dropdown items.\n *\n * By default, the dropdown height is constrained to fit inside the height of its next scrollable container element.\n * Enabling this property will allow the dropdown to extend beyond that container by using fixed positioning and\n * [React Portals](https://reactjs.org/docs/portals.html).\n *\n * Set this property if the dropdown would otherwise be constrained by a scrollable container,\n * for example inside table and split view layouts.\n *\n * We recommend you use discretion, and don't enable this property unless necessary\n * because fixed positioning results in a slight, visible lag when scrolling complex pages.\n */\n dropdownExpandToViewport?: boolean;\n /**\n * Array of objects with a number of supported types.\n *\n * ### icon-button\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick` handler and to focus the button using `ref.focus(id)`.\n * * `text` (string) - The name shown as a tooltip for this button.\n * * `disabled` (optional, boolean) - The disabled state indication for this button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for this button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `iconName` (optional, string) - Specifies the name of the icon, used with the [icon component](/components/icon/).\n * * `iconAlt` (optional, string) - Specifies alternate text for the icon when using `iconUrl`.\n * * `iconUrl` (optional, string) - Specifies the URL of a custom icon.\n * * `iconSvg` (optional, ReactNode) - Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `popoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button. Use to provide feedback to the user.\n *\n * ### icon-toggle-button\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick` handler and to focus the button using `ref.focus(id)`.\n * * `pressed` (boolean) - The toggle button pressed state.\n * * `text` (string) - The name shown as a tooltip for this button.\n * * `disabled` (optional, boolean) - The disabled state indication for this button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for this button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `iconName` (optional, string) - Specifies the name of the icon, used with the [icon component](/components/icon/).\n * * `iconUrl` (optional, string) - Specifies the URL of a custom icon.\n * * `iconSvg` (optional, ReactNode) - Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `pressedIconName` (optional, string) - Specifies the name of the icon in pressed state, used with the [icon component](/components/icon/).\n * * `pressedIconUrl` (optional, string) - Specifies the URL of a custom icon in pressed state.\n * * `pressedIconSvg` (optional, ReactNode) - Custom SVG icon in pressed state. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `popoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button. Use to provide feedback to the user.\n * * `pressedPopoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button in pressed state. Defaults to `popoverFeedback`.\n *\n * * ### file-input\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onFilesChange`.\n * * `text` (string) - The name of the menu button shown as a tooltip.\n * * `accept` (optional, string) - Specifies the native file input `accept` attribute to describe the allow-list of file types.\n * * `multiple` (optional, string) - Specifies the native file input `multiple` attribute to allow users entering more than one file.\n *\n * ### menu-dropdown\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick`.\n * * `text` (string) - The name of the menu button shown as a tooltip.\n * * `disabled` (optional, boolean) - The disabled state indication for the menu button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for the menu button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `items` (ButtonDropdownProps.ItemOrGroup[]) - The array of dropdown items that belong to this menu.\n *\n * ### group\n *\n * * `text` (string) - The name of the group rendered as ARIA label for this group.\n * * `items` ((ButtonGroupProps.IconButton | ButtonGroupProps.MenuDropdown)[]) - The array of items that belong to this group.\n */\n items: ReadonlyArray<ButtonGroupProps.ItemOrGroup>;\n /**\n * Called when the user clicks on an item, and the item is not disabled. The event detail object contains the id of the clicked item.\n */\n onItemClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n /**\n * Called when the user uploads files. The event detail object contains the id and files from the file input item.\n */\n onFilesChange?: NonCancelableEventHandler<ButtonGroupProps.FilesChangeDetails>;\n /**\n * @awsuiSystem core\n */\n style?: ButtonGroupProps.Style;\n}\n\nexport interface InternalIconButton extends ButtonGroupProps.IconButton {\n analyticsAction?: string;\n}\nexport interface InternalIconToggleButton extends ButtonGroupProps.IconToggleButton {\n analyticsAction?: string;\n}\n\nexport interface IconButtonRuntime extends Omit<ButtonGroupProps.IconButton, 'iconSvg' | 'popoverFeedback'> {\n iconSvg?: string;\n}\nexport interface IconToggleButtonRuntime\n extends Omit<\n ButtonGroupProps.IconToggleButton,\n 'iconSvg' | 'pressedIconSvg' | 'popoverFeedback' | 'pressedPopoverFeedback'\n > {\n iconSvg?: string;\n pressedIconSvg?: string;\n}\nexport type ItemOrGroupRuntime = ItemRuntime | ButtonGroupProps.Group;\nexport type ItemRuntime =\n | IconButtonRuntime\n | IconToggleButtonRuntime\n | ButtonGroupProps.IconFileInput\n | ButtonGroupProps.MenuDropdown;\n\nexport type InternalItemOrGroup = InternalItem | ButtonGroupProps.Group;\nexport type InternalItem =\n | InternalIconButton\n | InternalIconToggleButton\n | ButtonGroupProps.IconFileInput\n | ButtonGroupProps.MenuDropdown;\n\nexport interface InternalButtonGroupProps\n extends SomeRequired<ButtonGroupProps, 'dropdownExpandToViewport'>,\n InternalBaseComponentProps {\n style?: ButtonGroupProps.Style;\n items: ReadonlyArray<InternalItemOrGroup>;\n}\n\nexport namespace ButtonGroupProps {\n export type Variant = 'icon';\n\n export type ItemOrGroup = Item | Group;\n export type Item = IconButton | IconToggleButton | IconFileInput | MenuDropdown;\n\n export interface IconButton {\n type: 'icon-button';\n id: string;\n text: string;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n popoverFeedback?: React.ReactNode;\n }\n\n export interface IconToggleButton {\n type: 'icon-toggle-button';\n id: string;\n text: string;\n pressed: boolean;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n pressedIconName?: IconProps.Name;\n pressedIconUrl?: string;\n pressedIconSvg?: React.ReactNode;\n popoverFeedback?: React.ReactNode;\n pressedPopoverFeedback?: React.ReactNode;\n }\n\n export interface IconFileInput {\n type: 'icon-file-input';\n id: string;\n text: string;\n accept?: string;\n multiple?: boolean;\n }\n\n export interface MenuDropdown {\n type: 'menu-dropdown';\n id: string;\n text: string;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n items: ReadonlyArray<ButtonDropdownProps.ItemOrGroup>;\n }\n\n export interface Group {\n type: 'group';\n text: string;\n items: ReadonlyArray<ButtonGroupProps.Item>;\n }\n\n export interface ItemClickDetails {\n id: string;\n pressed?: boolean;\n checked?: boolean;\n }\n\n export interface FilesChangeDetails {\n id: string;\n files: File[];\n }\n\n export interface Ref {\n /**\n * Focuses button group item by id.\n */\n focus(itemId: string): void;\n }\n export interface Style {\n root?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n paddingBlock?: string;\n paddingInline?: string;\n boxShadow?: string;\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n item?: {\n color?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n boxShadow?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n }\n}\n"]}
|
package/checkbox/index.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import CoreComponent from './internal-do-not-use-core';
|
|
5
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
6
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return React.createElement(CoreComponent, {ref,...props});
|
|
7
|
+
import InternalCheckbox from './internal';
|
|
8
|
+
const Checkbox = React.forwardRef(({ ...props }, ref) => {
|
|
9
|
+
const baseComponentProps = useBaseComponent('Checkbox', {
|
|
10
|
+
props: { readOnly: props.readOnly },
|
|
11
|
+
});
|
|
12
|
+
return React.createElement(InternalCheckbox, { ...props, ...baseComponentProps, ref: ref, __injectAnalyticsComponentMetadata: true });
|
|
14
13
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
14
|
applyDisplayName(Checkbox, 'Checkbox');
|
|
18
15
|
export default Checkbox;
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
package/checkbox/interfaces.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { NonCancelableEventHandler } from '../internal/events';
|
|
|
3
3
|
/**
|
|
4
4
|
* @awsuiSystem core
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
import { NativeAttributes } from '../internal/utils/with-native-attributes';
|
|
7
7
|
import { BaseCheckboxProps } from './base-checkbox';
|
|
8
8
|
export interface CheckboxProps extends BaseCheckboxProps {
|
|
9
9
|
/**
|
|
@@ -28,7 +28,7 @@ export interface CheckboxProps extends BaseCheckboxProps {
|
|
|
28
28
|
/**
|
|
29
29
|
* @awsuiSystem core
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
style?: CheckboxProps.Style;
|
|
32
32
|
/**
|
|
33
33
|
* Attributes to add to the native `input` element.
|
|
34
34
|
* Some attributes will be automatically combined with internal attribute values:
|
|
@@ -39,6 +39,7 @@ export interface CheckboxProps extends BaseCheckboxProps {
|
|
|
39
39
|
*
|
|
40
40
|
* @awsuiSystem core
|
|
41
41
|
*/
|
|
42
|
+
nativeInputAttributes?: NativeAttributes<React.InputHTMLAttributes<HTMLInputElement>>;
|
|
42
43
|
}
|
|
43
44
|
export declare namespace CheckboxProps {
|
|
44
45
|
interface Ref {
|