@cloudscape-design/components 3.0.112 → 3.0.114

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.
Files changed (39) hide show
  1. package/autosuggest/index.d.ts +1 -2
  2. package/autosuggest/index.d.ts.map +1 -1
  3. package/autosuggest/index.js.map +1 -1
  4. package/autosuggest/interfaces.d.ts +10 -0
  5. package/autosuggest/interfaces.d.ts.map +1 -1
  6. package/autosuggest/interfaces.js.map +1 -1
  7. package/autosuggest/internal.d.ts +1 -2
  8. package/autosuggest/internal.d.ts.map +1 -1
  9. package/autosuggest/internal.js.map +1 -1
  10. package/input/index.d.ts.map +1 -1
  11. package/input/index.js +2 -2
  12. package/input/index.js.map +1 -1
  13. package/input/interfaces.d.ts +14 -1
  14. package/input/interfaces.d.ts.map +1 -1
  15. package/input/interfaces.js.map +1 -1
  16. package/input/internal.d.ts.map +1 -1
  17. package/input/internal.js +3 -3
  18. package/input/internal.js.map +1 -1
  19. package/internal/components/autosuggest-input/index.d.ts +3 -2
  20. package/internal/components/autosuggest-input/index.d.ts.map +1 -1
  21. package/internal/components/autosuggest-input/index.js.map +1 -1
  22. package/internal/environment.js +1 -1
  23. package/internal/manifest.json +3 -0
  24. package/package.json +1 -1
  25. package/s3-resource-selector/index.d.ts.map +1 -1
  26. package/s3-resource-selector/index.js +4 -2
  27. package/s3-resource-selector/index.js.map +1 -1
  28. package/s3-resource-selector/interfaces.d.ts +25 -0
  29. package/s3-resource-selector/interfaces.d.ts.map +1 -1
  30. package/s3-resource-selector/interfaces.js.map +1 -1
  31. package/select/parts/filter.d.ts +1 -1
  32. package/select/parts/filter.d.ts.map +1 -1
  33. package/textarea/index.d.ts.map +1 -1
  34. package/textarea/index.js +3 -2
  35. package/textarea/index.js.map +1 -1
  36. package/textarea/interfaces.d.ts +5 -2
  37. package/textarea/interfaces.d.ts.map +1 -1
  38. package/textarea/interfaces.js.map +1 -1
  39. package/manifest.json +0 -3
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { AutosuggestProps } from './interfaces';
3
- import { InputProps } from '../input/interfaces';
4
3
  export { AutosuggestProps };
5
- declare const Autosuggest: React.ForwardRefExoticComponent<AutosuggestProps & React.RefAttributes<InputProps.Ref>>;
4
+ declare const Autosuggest: React.ForwardRefExoticComponent<AutosuggestProps & React.RefAttributes<AutosuggestProps.Ref>>;
6
5
  export default Autosuggest;
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIhD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,QAAA,MAAM,WAAW,yFAkBhB,CAAC;AAGF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAMhD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,QAAA,MAAM,WAAW,+FAkBhB,CAAC;AAGF,eAAe,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/autosuggest/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,mBAAmB,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAIpE,IAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAClC,UACE,EAAkH,EAClH,GAA8B;IAD5B,IAAA,qBAAsB,EAAtB,aAAa,mBAAG,MAAM,KAAA,EAAE,kBAAuB,EAAvB,UAAU,mBAAG,UAAU,KAAA,EAAE,iCAAiC,EAAjC,yBAAyB,mBAAG,KAAK,KAAA,EAAK,KAAK,cAA9F,4DAAgG,CAAF;IAG9F,IAAM,kBAAkB,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC3D,IAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,CACL,oBAAC,mBAAmB,aAClB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,yBAAyB,EAAE,yBAAyB,IAChD,aAAa,EACb,kBAAkB,IACtB,GAAG,EAAE,GAAG,IACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AAC7C,eAAe,WAAW,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { AutosuggestProps } from './interfaces';\nimport InternalAutosuggest from './internal';\nimport { getExternalProps } from '../internal/utils/external-props';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { InputProps } from '../input/interfaces';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { AutosuggestProps };\n\nconst Autosuggest = React.forwardRef(\n (\n { filteringType = 'auto', statusType = 'finished', disableBrowserAutocorrect = false, ...props }: AutosuggestProps,\n ref: React.Ref<InputProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('Autosuggest');\n const externalProps = getExternalProps(props);\n return (\n <InternalAutosuggest\n filteringType={filteringType}\n statusType={statusType}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n {...externalProps}\n {...baseComponentProps}\n ref={ref}\n />\n );\n }\n);\n\napplyDisplayName(Autosuggest, 'Autosuggest');\nexport default Autosuggest;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/autosuggest/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,mBAAmB,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAIpE,IAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAClC,UACE,EAAkH,EAClH,GAAoC;IADlC,IAAA,qBAAsB,EAAtB,aAAa,mBAAG,MAAM,KAAA,EAAE,kBAAuB,EAAvB,UAAU,mBAAG,UAAU,KAAA,EAAE,iCAAiC,EAAjC,yBAAyB,mBAAG,KAAK,KAAA,EAAK,KAAK,cAA9F,4DAAgG,CAAF;IAG9F,IAAM,kBAAkB,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC3D,IAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,CACL,oBAAC,mBAAmB,aAClB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,yBAAyB,EAAE,yBAAyB,IAChD,aAAa,EACb,kBAAkB,IACtB,GAAG,EAAE,GAAG,IACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AAC7C,eAAe,WAAW,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { AutosuggestProps } from './interfaces';\nimport InternalAutosuggest from './internal';\nimport { getExternalProps } from '../internal/utils/external-props';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { AutosuggestProps };\n\nconst Autosuggest = React.forwardRef(\n (\n { filteringType = 'auto', statusType = 'finished', disableBrowserAutocorrect = false, ...props }: AutosuggestProps,\n ref: React.Ref<AutosuggestProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('Autosuggest');\n const externalProps = getExternalProps(props);\n return (\n <InternalAutosuggest\n filteringType={filteringType}\n statusType={statusType}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n {...externalProps}\n {...baseComponentProps}\n ref={ref}\n />\n );\n }\n);\n\napplyDisplayName(Autosuggest, 'Autosuggest');\nexport default Autosuggest;\n"]}
@@ -107,6 +107,16 @@ export declare namespace AutosuggestProps {
107
107
  interface ContainingOptionAndGroupString {
108
108
  (option: Option, group?: OptionGroup): string;
109
109
  }
110
+ interface Ref {
111
+ /**
112
+ * Sets input focus onto the UI control.
113
+ */
114
+ focus(): void;
115
+ /**
116
+ * Selects all text in the input control.
117
+ */
118
+ select(): void;
119
+ }
110
120
  }
111
121
  export declare type AutosuggestItem = (AutosuggestProps.Option | AutosuggestProps.OptionGroup) & {
112
122
  type?: 'parent' | 'child' | 'use-entered';
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,E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gBAAgB,CAAC,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,GAAG;IACvF,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,aAAa,CAAC;IAC1C,MAAM,EAAE,gBAAgB,GAAG,WAAW,CAAC;CACxC,CAAC"}
@@ -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';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport {\n BaseDropdownHostProps,\n OptionsLoadItemsDetail,\n OptionsFilteringType,\n} from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { BaseInputProps, InputAutoCorrect, InputKeyEvents, InputProps } from '../input/interfaces';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface AutosuggestProps\n extends BaseComponentProps,\n BaseInputProps,\n InputAutoCorrect,\n BaseDropdownHostProps,\n InputKeyEvents,\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 * - `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 * - `iconAlt` (string) - (Optional) 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 * * `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` or `label` 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 */\n enteredTextLabel: AutosuggestProps.EnteredTextLabel;\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 */\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 `selectedLabel` 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\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 }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\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"]}
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';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport {\n BaseDropdownHostProps,\n OptionsLoadItemsDetail,\n OptionsFilteringType,\n} from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { BaseInputProps, InputAutoCorrect, InputKeyEvents, InputProps } from '../input/interfaces';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface AutosuggestProps\n extends BaseComponentProps,\n BaseInputProps,\n InputAutoCorrect,\n BaseDropdownHostProps,\n InputKeyEvents,\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 * - `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 * - `iconAlt` (string) - (Optional) 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 * * `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` or `label` 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 */\n enteredTextLabel: AutosuggestProps.EnteredTextLabel;\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 */\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 `selectedLabel` 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\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 }\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\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"]}
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
2
  import { AutosuggestProps } from './interfaces';
3
- import { InputProps } from '../input/interfaces';
4
3
  import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
5
4
  export interface InternalAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {
6
5
  }
7
- declare const InternalAutosuggest: React.ForwardRefExoticComponent<InternalAutosuggestProps & React.RefAttributes<InputProps.Ref>>;
6
+ declare const InternalAutosuggest: React.ForwardRefExoticComponent<InternalAutosuggestProps & React.RefAttributes<AutosuggestProps.Ref>>;
8
7
  export default InternalAutosuggest;
9
8
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAmB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAYjE,OAAO,EAAoB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAInE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAQlF,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB,EAAE,0BAA0B;CAAG;AAEjG,QAAA,MAAM,mBAAmB,iGAiLvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAGhE,OA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,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,2BAA2B,CAAC,oBAAoB,EAChE,iBAAiB,EAAE,cAAc,CAAC,OAAO,KAAK,IAAI,EAClD,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,iBAAiB,EACpC,yBAAyB,EAAE,yBAAyB,EACpD,UAAU,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAC,cAAc,IAAC,OAAO,EAAE,cAAc,CAAC,OAAO,GAAI,CAAC,CAAC,CAAC,IAAI,GACjG,EAEJ,cAAc,EACZ,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CACxB,oBAAC,cAAc,IAAC,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,GAAI,CACvG,CAAC,CAAC,CAAC,IAAI,EAEV,SAAS,EAAE,UAAU,KAAK,OAAO,IAAI,CAAC,CAAC,YAAY,EACnD,eAAe,EAAE,mBAAmB,EACpC,cAAc,EAAE,kBAAkB,EAClC,gBAAgB,EAAE,oBAAoB,EACtC,cAAc,EAAE,kBAAkB,EAClC,YAAY,EAAE,gBAAgB,IAC9B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useImperativeHandle, useRef } from 'react';\n\nimport { useAutosuggestItems } from './options-controller';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\n\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport DropdownFooter from '../internal/components/dropdown-footer';\n\nimport { generateUniqueId, useUniqueId } from '../internal/hooks/use-unique-id';\nimport {\n BaseKeyDetail,\n fireCancelableEvent,\n fireNonCancelableEvent,\n NonCancelableCustomEvent,\n} from '../internal/events';\nimport { BaseChangeDetail, InputProps } from '../input/interfaces';\nimport styles from './styles.css.js';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport AutosuggestOptionsList from './options-list';\nimport { useAutosuggestLoadMore } from './load-more-controller';\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport AutosuggestInput, { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport clsx from 'clsx';\n\nexport interface InternalAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {}\n\nconst InternalAutosuggest = React.forwardRef((props: InternalAutosuggestProps, ref: Ref<InputProps.Ref>) => {\n const {\n value,\n onChange,\n onBlur,\n onFocus,\n onKeyUp,\n onLoadItems,\n options,\n filteringType = 'auto',\n statusType = 'finished',\n recoveryText,\n placeholder,\n name,\n disabled,\n disableBrowserAutocorrect = false,\n autoFocus,\n readOnly,\n ariaLabel,\n ariaRequired,\n enteredTextLabel,\n onKeyDown,\n virtualScroll,\n expandToViewport,\n onSelect,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n __internalRootRef,\n ...restProps\n } = props;\n\n checkControlled('Autosuggest', 'value', value, 'onChange', onChange);\n checkOptionValueField('Autosuggest', 'options', options);\n\n const autosuggestInputRef = useRef<AutosuggestInputRef>(null);\n useImperativeHandle(\n ref,\n () => ({\n focus: () => autosuggestInputRef.current?.focus(),\n select: () => autosuggestInputRef.current?.select(),\n }),\n []\n );\n\n const [autosuggestItemsState, autosuggestItemsHandlers] = useAutosuggestItems({\n options: options || [],\n filterValue: value,\n filterText: value,\n filteringType,\n hideEnteredTextLabel: false,\n onSelectItem: (option: AutosuggestItem) => {\n const value = option.value || '';\n fireNonCancelableEvent(onChange, { value });\n fireNonCancelableEvent(onSelect, { value });\n autosuggestInputRef.current?.close();\n },\n });\n\n const autosuggestLoadMoreHandlers = useAutosuggestLoadMore({\n options,\n statusType,\n onLoadItems: (detail: OptionsLoadItemsDetail) => fireNonCancelableEvent(onLoadItems, detail),\n });\n\n const handleChange = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestItemsHandlers.setShowAll(false);\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n fireNonCancelableEvent(onChange, event.detail);\n };\n\n const handleDelayedInput = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputChange(event.detail.value);\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, null);\n };\n\n const handleFocus = () => {\n autosuggestItemsHandlers.setShowAll(true);\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputFocus();\n fireNonCancelableEvent(onFocus, null);\n };\n\n const handleKeyUp = (e: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyUp, e.detail);\n };\n\n const handleKeyDown = (e: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyDown, e.detail);\n };\n\n const handlePressArrowDown = () => {\n autosuggestItemsHandlers.moveHighlightWithKeyboard(1);\n };\n\n const handlePressArrowUp = () => {\n autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);\n };\n\n const handlePressEnter = () => {\n return autosuggestItemsHandlers.selectHighlightedOptionWithKeyboard();\n };\n\n const handleCloseDropdown = () => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n };\n\n const handleRecoveryClick = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnRecoveryClick();\n autosuggestInputRef.current?.focus();\n };\n\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('input');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const listId = useUniqueId('list');\n const highlightedOptionId = autosuggestItemsState.highlightedOption ? generateUniqueId() : undefined;\n\n const isEmpty = !value && !autosuggestItemsState.items.length;\n const dropdownStatus = useDropdownStatus({ ...props, isEmpty, recoveryText, onRecoveryClick: handleRecoveryClick });\n\n return (\n <AutosuggestInput\n {...restProps}\n className={clsx(styles.root, restProps.className)}\n ref={autosuggestInputRef}\n __internalRootRef={__internalRootRef}\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n onKeyDown={handleKeyDown}\n name={name}\n controlId={controlId}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n autoFocus={autoFocus}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n expandToViewport={expandToViewport}\n ariaControls={listId}\n ariaActivedescendant={highlightedOptionId}\n dropdownExpanded={autosuggestItemsState.items.length > 1 || dropdownStatus.content !== null}\n dropdownContent={\n <AutosuggestOptionsList\n autosuggestItemsState={autosuggestItemsState}\n autosuggestItemsHandlers={autosuggestItemsHandlers}\n highlightedOptionId={highlightedOptionId}\n highlightText={value}\n listId={listId}\n controlId={controlId}\n enteredTextLabel={enteredTextLabel}\n handleLoadMore={autosuggestLoadMoreHandlers.fireLoadMoreOnScroll}\n hasDropdownStatus={dropdownStatus.content !== null}\n virtualScroll={virtualScroll}\n selectedAriaLabel={selectedAriaLabel}\n renderHighlightedAriaLive={renderHighlightedAriaLive}\n listBottom={!dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} /> : null}\n />\n }\n dropdownFooter={\n dropdownStatus.isSticky ? (\n <DropdownFooter content={dropdownStatus.content} hasItems={autosuggestItemsState.items.length >= 1} />\n ) : null\n }\n loopFocus={statusType === 'error' && !!recoveryText}\n onCloseDropdown={handleCloseDropdown}\n onDelayedInput={handleDelayedInput}\n onPressArrowDown={handlePressArrowDown}\n onPressArrowUp={handlePressArrowUp}\n onPressEnter={handlePressEnter}\n />\n );\n});\n\nexport default InternalAutosuggest;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,E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Ac,EACZ,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CACxB,oBAAC,cAAc,IAAC,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,GAAI,CACvG,CAAC,CAAC,CAAC,IAAI,EAEV,SAAS,EAAE,UAAU,KAAK,OAAO,IAAI,CAAC,CAAC,YAAY,EACnD,eAAe,EAAE,mBAAmB,EACpC,cAAc,EAAE,kBAAkB,EAClC,gBAAgB,EAAE,oBAAoB,EACtC,cAAc,EAAE,kBAAkB,EAClC,YAAY,EAAE,gBAAgB,IAC9B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useImperativeHandle, useRef } from 'react';\n\nimport { useAutosuggestItems } from './options-controller';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\n\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport DropdownFooter from '../internal/components/dropdown-footer';\n\nimport { generateUniqueId, useUniqueId } from '../internal/hooks/use-unique-id';\nimport {\n BaseKeyDetail,\n fireCancelableEvent,\n fireNonCancelableEvent,\n NonCancelableCustomEvent,\n} from '../internal/events';\nimport { BaseChangeDetail } from '../input/interfaces';\nimport styles from './styles.css.js';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport AutosuggestOptionsList from './options-list';\nimport { useAutosuggestLoadMore } from './load-more-controller';\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport AutosuggestInput, { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport clsx from 'clsx';\n\nexport interface InternalAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {}\n\nconst InternalAutosuggest = React.forwardRef((props: InternalAutosuggestProps, ref: Ref<AutosuggestProps.Ref>) => {\n const {\n value,\n onChange,\n onBlur,\n onFocus,\n onKeyUp,\n onLoadItems,\n options,\n filteringType = 'auto',\n statusType = 'finished',\n recoveryText,\n placeholder,\n name,\n disabled,\n disableBrowserAutocorrect = false,\n autoFocus,\n readOnly,\n ariaLabel,\n ariaRequired,\n enteredTextLabel,\n onKeyDown,\n virtualScroll,\n expandToViewport,\n onSelect,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n __internalRootRef,\n ...restProps\n } = props;\n\n checkControlled('Autosuggest', 'value', value, 'onChange', onChange);\n checkOptionValueField('Autosuggest', 'options', options);\n\n const autosuggestInputRef = useRef<AutosuggestInputRef>(null);\n useImperativeHandle(\n ref,\n () => ({\n focus: () => autosuggestInputRef.current?.focus(),\n select: () => autosuggestInputRef.current?.select(),\n }),\n []\n );\n\n const [autosuggestItemsState, autosuggestItemsHandlers] = useAutosuggestItems({\n options: options || [],\n filterValue: value,\n filterText: value,\n filteringType,\n hideEnteredTextLabel: false,\n onSelectItem: (option: AutosuggestItem) => {\n const value = option.value || '';\n fireNonCancelableEvent(onChange, { value });\n fireNonCancelableEvent(onSelect, { value });\n autosuggestInputRef.current?.close();\n },\n });\n\n const autosuggestLoadMoreHandlers = useAutosuggestLoadMore({\n options,\n statusType,\n onLoadItems: (detail: OptionsLoadItemsDetail) => fireNonCancelableEvent(onLoadItems, detail),\n });\n\n const handleChange = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestItemsHandlers.setShowAll(false);\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n fireNonCancelableEvent(onChange, event.detail);\n };\n\n const handleDelayedInput = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputChange(event.detail.value);\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, null);\n };\n\n const handleFocus = () => {\n autosuggestItemsHandlers.setShowAll(true);\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputFocus();\n fireNonCancelableEvent(onFocus, null);\n };\n\n const handleKeyUp = (e: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyUp, e.detail);\n };\n\n const handleKeyDown = (e: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyDown, e.detail);\n };\n\n const handlePressArrowDown = () => {\n autosuggestItemsHandlers.moveHighlightWithKeyboard(1);\n };\n\n const handlePressArrowUp = () => {\n autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);\n };\n\n const handlePressEnter = () => {\n return autosuggestItemsHandlers.selectHighlightedOptionWithKeyboard();\n };\n\n const handleCloseDropdown = () => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n };\n\n const handleRecoveryClick = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnRecoveryClick();\n autosuggestInputRef.current?.focus();\n };\n\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('input');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const listId = useUniqueId('list');\n const highlightedOptionId = autosuggestItemsState.highlightedOption ? generateUniqueId() : undefined;\n\n const isEmpty = !value && !autosuggestItemsState.items.length;\n const dropdownStatus = useDropdownStatus({ ...props, isEmpty, recoveryText, onRecoveryClick: handleRecoveryClick });\n\n return (\n <AutosuggestInput\n {...restProps}\n className={clsx(styles.root, restProps.className)}\n ref={autosuggestInputRef}\n __internalRootRef={__internalRootRef}\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n onKeyDown={handleKeyDown}\n name={name}\n controlId={controlId}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n autoFocus={autoFocus}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n expandToViewport={expandToViewport}\n ariaControls={listId}\n ariaActivedescendant={highlightedOptionId}\n dropdownExpanded={autosuggestItemsState.items.length > 1 || dropdownStatus.content !== null}\n dropdownContent={\n <AutosuggestOptionsList\n autosuggestItemsState={autosuggestItemsState}\n autosuggestItemsHandlers={autosuggestItemsHandlers}\n highlightedOptionId={highlightedOptionId}\n highlightText={value}\n listId={listId}\n controlId={controlId}\n enteredTextLabel={enteredTextLabel}\n handleLoadMore={autosuggestLoadMoreHandlers.fireLoadMoreOnScroll}\n hasDropdownStatus={dropdownStatus.content !== null}\n virtualScroll={virtualScroll}\n selectedAriaLabel={selectedAriaLabel}\n renderHighlightedAriaLive={renderHighlightedAriaLive}\n listBottom={!dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} /> : null}\n />\n }\n dropdownFooter={\n dropdownStatus.isSticky ? (\n <DropdownFooter content={dropdownStatus.content} hasItems={autosuggestItemsState.items.length >= 1} />\n ) : null\n }\n loopFocus={statusType === 'error' && !!recoveryText}\n onCloseDropdown={handleCloseDropdown}\n onDelayedInput={handleDelayedInput}\n onPressArrowDown={handlePressArrowDown}\n onPressArrowUp={handlePressArrowUp}\n onPressEnter={handlePressEnter}\n />\n );\n});\n\nexport default InternalAutosuggest;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/input/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,mFAiFV,CAAC;AAGF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/input/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,mFAmFV,CAAC;AAGF,eAAe,KAAK,CAAC"}
package/input/index.js CHANGED
@@ -9,7 +9,7 @@ import styles from './styles.css.js';
9
9
  import { applyDisplayName } from '../internal/utils/apply-display-name';
10
10
  import useBaseComponent from '../internal/hooks/use-base-component';
11
11
  var Input = React.forwardRef(function (_a, ref) {
12
- var value = _a.value, _b = _a.type, type = _b === void 0 ? 'text' : _b, step = _a.step, inputMode = _a.inputMode, _c = _a.autoComplete, autoComplete = _c === void 0 ? true : _c, disabled = _a.disabled, readOnly = _a.readOnly, disableBrowserAutocorrect = _a.disableBrowserAutocorrect, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, ariaRequired = _a.ariaRequired, name = _a.name, placeholder = _a.placeholder, autoFocus = _a.autoFocus, ariaLabel = _a.ariaLabel, ariaLabelledby = _a.ariaLabelledby, ariaDescribedby = _a.ariaDescribedby, invalid = _a.invalid, controlId = _a.controlId, rest = __rest(_a, ["value", "type", "step", "inputMode", "autoComplete", "disabled", "readOnly", "disableBrowserAutocorrect", "onKeyDown", "onKeyUp", "onChange", "onBlur", "onFocus", "ariaRequired", "name", "placeholder", "autoFocus", "ariaLabel", "ariaLabelledby", "ariaDescribedby", "invalid", "controlId"]);
12
+ var value = _a.value, _b = _a.type, type = _b === void 0 ? 'text' : _b, step = _a.step, inputMode = _a.inputMode, _c = _a.autoComplete, autoComplete = _c === void 0 ? true : _c, spellcheck = _a.spellcheck, disabled = _a.disabled, readOnly = _a.readOnly, disableBrowserAutocorrect = _a.disableBrowserAutocorrect, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, ariaRequired = _a.ariaRequired, name = _a.name, placeholder = _a.placeholder, autoFocus = _a.autoFocus, ariaLabel = _a.ariaLabel, ariaLabelledby = _a.ariaLabelledby, ariaDescribedby = _a.ariaDescribedby, invalid = _a.invalid, controlId = _a.controlId, rest = __rest(_a, ["value", "type", "step", "inputMode", "autoComplete", "spellcheck", "disabled", "readOnly", "disableBrowserAutocorrect", "onKeyDown", "onKeyUp", "onChange", "onBlur", "onFocus", "ariaRequired", "name", "placeholder", "autoFocus", "ariaLabel", "ariaLabelledby", "ariaDescribedby", "invalid", "controlId"]);
13
13
  var baseComponentProps = useBaseComponent('Input');
14
14
  var baseProps = getBaseProps(rest);
15
15
  var inputRef = useRef(null);
@@ -27,7 +27,7 @@ var Input = React.forwardRef(function (_a, ref) {
27
27
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.select();
28
28
  }
29
29
  }); }, [inputRef]);
30
- return (React.createElement(InternalInput, __assign({ ref: inputRef }, __assign(__assign(__assign({}, baseProps), baseComponentProps), { autoComplete: autoComplete, ariaLabel: ariaLabel, ariaRequired: ariaRequired, autoFocus: autoFocus, disabled: disabled, disableBrowserAutocorrect: disableBrowserAutocorrect, name: name, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onChange: onChange, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, readOnly: readOnly, type: type, step: step, inputMode: inputMode, value: value, ariaDescribedby: ariaDescribedby, ariaLabelledby: ariaLabelledby, invalid: invalid, controlId: controlId }), { className: clsx(styles.root, baseProps.className), __inheritFormFieldProps: true })));
30
+ return (React.createElement(InternalInput, __assign({ ref: inputRef }, __assign(__assign(__assign({}, baseProps), baseComponentProps), { autoComplete: autoComplete, ariaLabel: ariaLabel, ariaRequired: ariaRequired, autoFocus: autoFocus, disabled: disabled, disableBrowserAutocorrect: disableBrowserAutocorrect, name: name, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onChange: onChange, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, readOnly: readOnly, type: type, step: step, inputMode: inputMode, spellcheck: spellcheck, value: value, ariaDescribedby: ariaDescribedby, ariaLabelledby: ariaLabelledby, invalid: invalid, controlId: controlId }), { className: clsx(styles.root, baseProps.className), __inheritFormFieldProps: true })));
31
31
  });
32
32
  applyDisplayName(Input, 'Input');
33
33
  export default Input;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/input/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAO,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,aAAa,MAAM,YAAY,CAAC;AAEvC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAIpE,IAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,UACE,EAwBa,EACb,GAAwB;IAxBtB,IAAA,KAAK,WAAA,EACL,YAAa,EAAb,IAAI,mBAAG,MAAM,KAAA,EACb,IAAI,UAAA,EACJ,SAAS,eAAA,EACT,oBAAmB,EAAnB,YAAY,mBAAG,IAAI,KAAA,EACnB,QAAQ,cAAA,EACR,QAAQ,cAAA,EACR,yBAAyB,+BAAA,EACzB,SAAS,eAAA,EACT,OAAO,aAAA,EACP,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,OAAO,aAAA,EACP,YAAY,kBAAA,EACZ,IAAI,UAAA,EACJ,WAAW,iBAAA,EACX,SAAS,eAAA,EACT,SAAS,eAAA,EACT,cAAc,oBAAA,EACd,eAAe,qBAAA,EACf,OAAO,aAAA,EACP,SAAS,eAAA,EACN,IAAI,cAvBT,kSAwBC,CADQ;IAIT,IAAM,kBAAkB,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACrD,IAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAErC,IAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAEhD,mBAAmB,CACjB,GAAG,EACH,cAAM,OAAA,CAAC;QACL,KAAK,EAAL;;YAAM,cAAyC;iBAAzC,UAAyC,EAAzC,qBAAyC,EAAzC,IAAyC;gBAAzC,yBAAyC;;YAC7C,MAAA,QAAQ,CAAC,OAAO,0CAAE,KAAK,WAAI,IAAI,CAAC,CAAC;QACnC,CAAC;QACD,MAAM;;YACJ,MAAA,QAAQ,CAAC,OAAO,0CAAE,MAAM,EAAE,CAAC;QAC7B,CAAC;KACF,CAAC,EAPI,CAOJ,EACF,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,oBAAC,aAAa,aACZ,GAAG,EAAE,QAAQ,mCAER,SAAS,GACT,kBAAkB,KACrB,YAAY,cAAA,EACZ,SAAS,WAAA,EACT,YAAY,cAAA,EACZ,SAAS,WAAA,EACT,QAAQ,UAAA,EACR,yBAAyB,2BAAA,EACzB,IAAI,MAAA,EACJ,SAAS,WAAA,EACT,OAAO,SAAA,EACP,QAAQ,UAAA,EACR,MAAM,QAAA,EACN,OAAO,SAAA,EACP,WAAW,aAAA,EACX,QAAQ,UAAA,EACR,IAAI,MAAA,EACJ,IAAI,MAAA,EACJ,SAAS,WAAA,EACT,KAAK,OAAA,EACL,eAAe,iBAAA,EACf,cAAc,gBAAA,EACd,OAAO,SAAA,EACP,SAAS,WAAA,OAEX,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,EACjD,uBAAuB,EAAE,IAAI,IAC7B,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACjC,eAAe,KAAK,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { Ref, useImperativeHandle, useRef } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport InternalInput from './internal';\nimport { InputProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { InputProps };\n\nconst Input = React.forwardRef(\n (\n {\n value,\n type = 'text',\n step,\n inputMode,\n autoComplete = true,\n disabled,\n readOnly,\n disableBrowserAutocorrect,\n onKeyDown,\n onKeyUp,\n onChange,\n onBlur,\n onFocus,\n ariaRequired,\n name,\n placeholder,\n autoFocus,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n invalid,\n controlId,\n ...rest\n }: InputProps,\n ref: Ref<InputProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('Input');\n const baseProps = getBaseProps(rest);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args: Parameters<HTMLElement['focus']>) {\n inputRef.current?.focus(...args);\n },\n select() {\n inputRef.current?.select();\n },\n }),\n [inputRef]\n );\n\n return (\n <InternalInput\n ref={inputRef}\n {...{\n ...baseProps,\n ...baseComponentProps,\n autoComplete,\n ariaLabel,\n ariaRequired,\n autoFocus,\n disabled,\n disableBrowserAutocorrect,\n name,\n onKeyDown,\n onKeyUp,\n onChange,\n onBlur,\n onFocus,\n placeholder,\n readOnly,\n type,\n step,\n inputMode,\n value,\n ariaDescribedby,\n ariaLabelledby,\n invalid,\n controlId,\n }}\n className={clsx(styles.root, baseProps.className)}\n __inheritFormFieldProps={true}\n />\n );\n }\n);\n\napplyDisplayName(Input, 'Input');\nexport default Input;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/input/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAO,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,aAAa,MAAM,YAAY,CAAC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,CAAC,CACX,CAAC;IAEF,OAAO,CACL,oBAAC,aAAa,aACZ,GAAG,EAAE,QAAQ,mCAER,SAAS,GACT,kBAAkB,KACrB,YAAY,cAAA,EACZ,SAAS,WAAA,EACT,YAAY,cAAA,EACZ,SAAS,WAAA,EACT,QAAQ,UAAA,EACR,yBAAyB,2BAAA,EACzB,IAAI,MAAA,EACJ,SAAS,WAAA,EACT,OAAO,SAAA,EACP,QAAQ,UAAA,EACR,MAAM,QAAA,EACN,OAAO,SAAA,EACP,WAAW,aAAA,EACX,QAAQ,UAAA,EACR,IAAI,MAAA,EACJ,IAAI,MAAA,EACJ,SAAS,WAAA,EACT,UAAU,YAAA,EACV,KAAK,OAAA,EACL,eAAe,iBAAA,EACf,cAAc,gBAAA,EACd,OAAO,SAAA,EACP,SAAS,WAAA,OAEX,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,EACjD,uBAAuB,EAAE,IAAI,IAC7B,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACjC,eAAe,KAAK,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { Ref, useImperativeHandle, useRef } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport InternalInput from './internal';\nimport { InputProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { InputProps };\n\nconst Input = React.forwardRef(\n (\n {\n value,\n type = 'text',\n step,\n inputMode,\n autoComplete = true,\n spellcheck,\n disabled,\n readOnly,\n disableBrowserAutocorrect,\n onKeyDown,\n onKeyUp,\n onChange,\n onBlur,\n onFocus,\n ariaRequired,\n name,\n placeholder,\n autoFocus,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n invalid,\n controlId,\n ...rest\n }: InputProps,\n ref: Ref<InputProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('Input');\n const baseProps = getBaseProps(rest);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args: Parameters<HTMLElement['focus']>) {\n inputRef.current?.focus(...args);\n },\n select() {\n inputRef.current?.select();\n },\n }),\n [inputRef]\n );\n\n return (\n <InternalInput\n ref={inputRef}\n {...{\n ...baseProps,\n ...baseComponentProps,\n autoComplete,\n ariaLabel,\n ariaRequired,\n autoFocus,\n disabled,\n disableBrowserAutocorrect,\n name,\n onKeyDown,\n onKeyUp,\n onChange,\n onBlur,\n onFocus,\n placeholder,\n readOnly,\n type,\n step,\n inputMode,\n spellcheck,\n value,\n ariaDescribedby,\n ariaLabelledby,\n invalid,\n controlId,\n }}\n className={clsx(styles.root, baseProps.className)}\n __inheritFormFieldProps={true}\n />\n );\n }\n);\n\napplyDisplayName(Input, 'Input');\nexport default Input;\n"]}
@@ -82,6 +82,19 @@ export interface InputAutoComplete {
82
82
  */
83
83
  autoComplete?: boolean | string;
84
84
  }
85
+ export interface InputSpellcheck {
86
+ /**
87
+ * Specifies the value of the `spellcheck` attribute on the native control.
88
+ * This value controls the native browser capability to check for spelling/grammar errors.
89
+ * If not set, the browser default behavior is to perform spellchecking.
90
+ * For more details, check the [spellcheck MDN article](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck).
91
+ *
92
+ * Enhanced spellchecking features of your browser and/or operating system may send input values to external parties.
93
+ * Make sure it’s deactivated for fields with sensitive information to prevent
94
+ * inadvertently sending data (such as user passwords) to third parties.
95
+ */
96
+ spellcheck?: boolean;
97
+ }
85
98
  export interface InputKeyEvents {
86
99
  /**
87
100
  * Called when the underlying native textarea emits a `keydown` event.
@@ -96,7 +109,7 @@ export interface InputKeyEvents {
96
109
  */
97
110
  onKeyUp?: CancelableEventHandler<InputProps.KeyDetail>;
98
111
  }
99
- export interface InputProps extends BaseComponentProps, BaseInputProps, InputKeyEvents, InputAutoCorrect, InputAutoComplete, FormFieldValidationControlProps {
112
+ export interface InputProps extends BaseComponentProps, BaseInputProps, InputKeyEvents, InputAutoCorrect, InputAutoComplete, InputSpellcheck, FormFieldValidationControlProps {
100
113
  /**
101
114
  * Specifies the type of control to render.
102
115
  * Inputs with a `number` type use the native element behavior, which might
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/input/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AAEzF,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,MAAM,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAEzC;;OAEG;IACH,OAAO,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAE1C;;;OAGG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OA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U,CAAC,SAAS,CAAC,CAAC;IAEzD;;;;OAIG;IACH,OAAO,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;CACxD;AAED,MAAM,WAAW,UACf,SAAQ,kBAAkB,EACxB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,+BAA+B;IACjC;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC;IAEvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC;IAEjC;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC;CACxB;AAED,yBAAiB,UAAU,CAAC;IAC1B,KAAY,IAAI,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;IAC/E,KAAY,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;IACrG,KAAY,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC;IAElC,KAAY,YAAY,GAAG,gBAAgB,CAAC;IAC5C,KAAY,SAAS,GAAG,aAAa,CAAC;IAEtC,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;QAEd;;WAEG;QACH,MAAM,IAAI,IAAI,CAAC;KAChB;CACF;AACD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/input/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 { BaseKeyDetail, CancelableEventHandler, NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\n\nexport interface BaseInputProps {\n /**\n * Specifies the text entered into the form element.\n */\n value: string;\n\n /**\n * Specifies the name of the control used in HTML forms.\n */\n name?: string;\n\n /**\n * Specifies the placeholder text rendered when the value is an empty string.\n */\n placeholder?: string;\n\n /**\n * Specifies if the control is disabled, which prevents the\n * user from modifying the value and prevents the value from\n * being included in a form submission. A disabled control can't\n * receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies if the control is read only, which prevents the\n * user from modifying the value but includes it in a form\n * submission. A read-only control can receive focus.\n *\n * Don't use read-only inputs outside a form.\n */\n readOnly?: boolean;\n\n /**\n * Indicates whether the control should be focused as\n * soon as the page loads, which enables the user to\n * start typing without having to manually focus the control. Don't\n * use this option on pages where the control may be\n * scrolled out of the viewport.\n */\n autoFocus?: boolean;\n\n /**\n * Adds an `aria-label` to the native control.\n *\n * Use this if you don't have a visible label for this control.\n */\n ariaLabel?: string;\n\n /**\n * Specifies whether to add `aria-required` to the native control.\n */\n ariaRequired?: boolean;\n\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * Called when input focus is moved to the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Called whenever a user changes the input value (by typing or pasting).\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<InputProps.ChangeDetail>;\n}\n\nexport interface InputAutoCorrect {\n /**\n * Specifies whether to disable browser autocorrect and related features.\n * If you set this to `true`, it disables any native browser capabilities\n * that automatically correct user input, such as `autocorrect` and\n * `autocapitalize`. If you don't set it, the behavior follows the default behavior\n * of the user's browser.\n */\n disableBrowserAutocorrect?: boolean;\n}\n\nexport interface InputAutoComplete {\n /**\n * Specifies whether to enable a browser's autocomplete functionality for this input.\n * In some cases it might be appropriate to disable autocomplete (for example, for security-sensitive fields).\n * To use it correctly, set the `name` property.\n *\n * You can either provide a boolean value to set the property to \"on\" or \"off\", or specify a string value\n * for the [autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) attribute.\n */\n autoComplete?: boolean | string;\n}\nexport interface InputKeyEvents {\n /**\n * Called when the underlying native textarea emits a `keydown` event.\n * The event `detail` contains the `keyCode` and information\n * about modifiers (that is, CTRL, ALT, SHIFT, META, etc.).\n */\n onKeyDown?: CancelableEventHandler<InputProps.KeyDetail>;\n\n /**\n * Called when the underlying native textarea emits a `keyup` event.\n * The event `detail` contains the `keyCode` and information\n * about modifiers (that is, CTRL, ALT, SHIFT, META, etc.).\n */\n onKeyUp?: CancelableEventHandler<InputProps.KeyDetail>;\n}\n\nexport interface InputProps\n extends BaseComponentProps,\n BaseInputProps,\n InputKeyEvents,\n InputAutoCorrect,\n InputAutoComplete,\n FormFieldValidationControlProps {\n /**\n * Specifies the type of control to render.\n * Inputs with a `number` type use the native element behavior, which might\n * be slightly different across browsers.\n */\n type?: InputProps.Type;\n\n /**\n * Adds a hint to the browser about the type of data a user may enter into this field.\n * Some devices may render a different virtual keyboard depending on this value.\n * This value may not be supported by all browsers or devices.\n */\n inputMode?: InputProps.InputMode;\n\n /**\n * The step attribute is a number that specifies the granularity that the value\n * must adhere to or the keyword \"any\". It is valid for the numeric input types,\n * including the date, month, week, time, datetime-local, number and range types.\n */\n step?: InputProps.Step;\n}\n\nexport namespace InputProps {\n export type Type = 'text' | 'password' | 'search' | 'number' | 'email' | 'url';\n export type InputMode = 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';\n export type Step = number | 'any';\n\n export type ChangeDetail = BaseChangeDetail;\n export type KeyDetail = BaseKeyDetail;\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}\nexport interface BaseChangeDetail {\n value: string;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/input/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 { BaseKeyDetail, CancelableEventHandler, NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\n\nexport interface BaseInputProps {\n /**\n * Specifies the text entered into the form element.\n */\n value: string;\n\n /**\n * Specifies the name of the control used in HTML forms.\n */\n name?: string;\n\n /**\n * Specifies the placeholder text rendered when the value is an empty string.\n */\n placeholder?: string;\n\n /**\n * Specifies if the control is disabled, which prevents the\n * user from modifying the value and prevents the value from\n * being included in a form submission. A disabled control can't\n * receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies if the control is read only, which prevents the\n * user from modifying the value but includes it in a form\n * submission. A read-only control can receive focus.\n *\n * Don't use read-only inputs outside a form.\n */\n readOnly?: boolean;\n\n /**\n * Indicates whether the control should be focused as\n * soon as the page loads, which enables the user to\n * start typing without having to manually focus the control. Don't\n * use this option on pages where the control may be\n * scrolled out of the viewport.\n */\n autoFocus?: boolean;\n\n /**\n * Adds an `aria-label` to the native control.\n *\n * Use this if you don't have a visible label for this control.\n */\n ariaLabel?: string;\n\n /**\n * Specifies whether to add `aria-required` to the native control.\n */\n ariaRequired?: boolean;\n\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * Called when input focus is moved to the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Called whenever a user changes the input value (by typing or pasting).\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<InputProps.ChangeDetail>;\n}\n\nexport interface InputAutoCorrect {\n /**\n * Specifies whether to disable browser autocorrect and related features.\n * If you set this to `true`, it disables any native browser capabilities\n * that automatically correct user input, such as `autocorrect` and\n * `autocapitalize`. If you don't set it, the behavior follows the default behavior\n * of the user's browser.\n */\n disableBrowserAutocorrect?: boolean;\n}\n\nexport interface InputAutoComplete {\n /**\n * Specifies whether to enable a browser's autocomplete functionality for this input.\n * In some cases it might be appropriate to disable autocomplete (for example, for security-sensitive fields).\n * To use it correctly, set the `name` property.\n *\n * You can either provide a boolean value to set the property to \"on\" or \"off\", or specify a string value\n * for the [autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) attribute.\n */\n autoComplete?: boolean | string;\n}\n\nexport interface InputSpellcheck {\n /**\n * Specifies the value of the `spellcheck` attribute on the native control.\n * This value controls the native browser capability to check for spelling/grammar errors.\n * If not set, the browser default behavior is to perform spellchecking.\n * For more details, check the [spellcheck MDN article](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck).\n *\n * Enhanced spellchecking features of your browser and/or operating system may send input values to external parties.\n * Make sure it’s deactivated for fields with sensitive information to prevent\n * inadvertently sending data (such as user passwords) to third parties.\n */\n spellcheck?: boolean;\n}\n\nexport interface InputKeyEvents {\n /**\n * Called when the underlying native textarea emits a `keydown` event.\n * The event `detail` contains the `keyCode` and information\n * about modifiers (that is, CTRL, ALT, SHIFT, META, etc.).\n */\n onKeyDown?: CancelableEventHandler<InputProps.KeyDetail>;\n\n /**\n * Called when the underlying native textarea emits a `keyup` event.\n * The event `detail` contains the `keyCode` and information\n * about modifiers (that is, CTRL, ALT, SHIFT, META, etc.).\n */\n onKeyUp?: CancelableEventHandler<InputProps.KeyDetail>;\n}\n\nexport interface InputProps\n extends BaseComponentProps,\n BaseInputProps,\n InputKeyEvents,\n InputAutoCorrect,\n InputAutoComplete,\n InputSpellcheck,\n FormFieldValidationControlProps {\n /**\n * Specifies the type of control to render.\n * Inputs with a `number` type use the native element behavior, which might\n * be slightly different across browsers.\n */\n type?: InputProps.Type;\n\n /**\n * Adds a hint to the browser about the type of data a user may enter into this field.\n * Some devices may render a different virtual keyboard depending on this value.\n * This value may not be supported by all browsers or devices.\n */\n inputMode?: InputProps.InputMode;\n\n /**\n * The step attribute is a number that specifies the granularity that the value\n * must adhere to or the keyword \"any\". It is valid for the numeric input types,\n * including the date, month, week, time, datetime-local, number and range types.\n */\n step?: InputProps.Step;\n}\n\nexport namespace InputProps {\n export type Type = 'text' | 'password' | 'search' | 'number' | 'email' | 'url';\n export type InputMode = 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';\n export type Step = number | 'any';\n\n export type ChangeDetail = BaseChangeDetail;\n export type KeyDetail = BaseKeyDetail;\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}\nexport interface BaseChangeDetail {\n value: string;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAG9D,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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AAiB,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;;AAwJD,wBAA+C"}
package/input/internal.js CHANGED
@@ -18,7 +18,7 @@ var iconClassName = function (position, hasHandler) {
18
18
  var preventMouseDown = function (e) { return e.preventDefault(); };
19
19
  function InternalInput(_a, ref) {
20
20
  var _b;
21
- var _c = _a.type, type = _c === void 0 ? 'text' : _c, step = _a.step, inputMode = _a.inputMode, _d = _a.autoComplete, autoComplete = _d === void 0 ? true : _d, ariaLabel = _a.ariaLabel, name = _a.name, value = _a.value, placeholder = _a.placeholder, autoFocus = _a.autoFocus, disabled = _a.disabled, readOnly = _a.readOnly, disableBrowserAutocorrect = _a.disableBrowserAutocorrect, __noBorderRadius = _a.__noBorderRadius, __leftIcon = _a.__leftIcon, _e = _a.__leftIconVariant, __leftIconVariant = _e === void 0 ? 'subtle' : _e, __onLeftIconClick = _a.__onLeftIconClick, ariaRequired = _a.ariaRequired, __rightIcon = _a.__rightIcon, _f = _a.__rightIconVariant, __rightIconVariant = _f === void 0 ? 'normal' : _f, __onRightIconClick = _a.__onRightIconClick, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, onChange = _a.onChange, __onDelayedInput = _a.__onDelayedInput, __onBlurWithDetail = _a.__onBlurWithDetail, onBlur = _a.onBlur, onFocus = _a.onFocus, __nativeAttributes = _a.__nativeAttributes, __internalRootRef = _a.__internalRootRef, __inheritFormFieldProps = _a.__inheritFormFieldProps, rest = __rest(_a, ["type", "step", "inputMode", "autoComplete", "ariaLabel", "name", "value", "placeholder", "autoFocus", "disabled", "readOnly", "disableBrowserAutocorrect", "__noBorderRadius", "__leftIcon", "__leftIconVariant", "__onLeftIconClick", "ariaRequired", "__rightIcon", "__rightIconVariant", "__onRightIconClick", "onKeyDown", "onKeyUp", "onChange", "__onDelayedInput", "__onBlurWithDetail", "onBlur", "onFocus", "__nativeAttributes", "__internalRootRef", "__inheritFormFieldProps"]);
21
+ var _c = _a.type, type = _c === void 0 ? 'text' : _c, step = _a.step, inputMode = _a.inputMode, _d = _a.autoComplete, autoComplete = _d === void 0 ? true : _d, ariaLabel = _a.ariaLabel, name = _a.name, value = _a.value, placeholder = _a.placeholder, autoFocus = _a.autoFocus, disabled = _a.disabled, readOnly = _a.readOnly, disableBrowserAutocorrect = _a.disableBrowserAutocorrect, spellcheck = _a.spellcheck, __noBorderRadius = _a.__noBorderRadius, __leftIcon = _a.__leftIcon, _e = _a.__leftIconVariant, __leftIconVariant = _e === void 0 ? 'subtle' : _e, __onLeftIconClick = _a.__onLeftIconClick, ariaRequired = _a.ariaRequired, __rightIcon = _a.__rightIcon, _f = _a.__rightIconVariant, __rightIconVariant = _f === void 0 ? 'normal' : _f, __onRightIconClick = _a.__onRightIconClick, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, onChange = _a.onChange, __onDelayedInput = _a.__onDelayedInput, __onBlurWithDetail = _a.__onBlurWithDetail, onBlur = _a.onBlur, onFocus = _a.onFocus, __nativeAttributes = _a.__nativeAttributes, __internalRootRef = _a.__internalRootRef, __inheritFormFieldProps = _a.__inheritFormFieldProps, rest = __rest(_a, ["type", "step", "inputMode", "autoComplete", "ariaLabel", "name", "value", "placeholder", "autoFocus", "disabled", "readOnly", "disableBrowserAutocorrect", "spellcheck", "__noBorderRadius", "__leftIcon", "__leftIconVariant", "__onLeftIconClick", "ariaRequired", "__rightIcon", "__rightIconVariant", "__onRightIconClick", "onKeyDown", "onKeyUp", "onChange", "__onDelayedInput", "__onBlurWithDetail", "onBlur", "onFocus", "__nativeAttributes", "__internalRootRef", "__inheritFormFieldProps"]);
22
22
  var baseProps = getBaseProps(rest);
23
23
  var fireDelayedInput = useDebounceCallback(function (value) { return fireNonCancelableEvent(__onDelayedInput, { value: value }); });
24
24
  var handleChange = function (value) {
@@ -35,7 +35,7 @@ function InternalInput(_a, ref) {
35
35
  var attributes = __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
36
  _b[styles['input-readonly']] = readOnly,
37
37
  _b[styles['input-invalid']] = invalid,
38
- _b)), autoComplete: convertAutoComplete(autoComplete), disabled: disabled, readOnly: readOnly, type: type, step: step, inputMode: inputMode, onKeyDown: onKeyDown && (function (event) { return fireKeyboardEvent(onKeyDown, event); }), onKeyUp: onKeyUp && (function (event) { return fireKeyboardEvent(onKeyUp, event); }),
38
+ _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); }),
39
39
  // We set a default value on the component in order to force it into the controlled mode.
40
40
  value: value !== null && value !== void 0 ? value : '', onChange: onChange && (function (event) { return handleChange(event.target.value); }), onBlur: function (e) {
41
41
  onBlur && fireNonCancelableEvent(onBlur);
@@ -67,7 +67,7 @@ function InternalInput(_a, ref) {
67
67
  return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles['input-container']), ref: __internalRootRef }),
68
68
  __leftIcon && (React.createElement("span", { onClick: __onLeftIconClick, className: iconClassName('left', !!__onLeftIconClick) },
69
69
  React.createElement(InternalIcon, { name: __leftIcon, variant: disabled ? 'disabled' : __leftIconVariant }))),
70
- React.createElement("input", __assign({ ref: mergedRef }, attributes, { spellCheck: false })),
70
+ React.createElement("input", __assign({ ref: mergedRef }, attributes)),
71
71
  __rightIcon && (React.createElement("span", { onClick: __onRightIconClick, onMouseDown: preventMouseDown, className: iconClassName('right', !!__onRightIconClick) },
72
72
  React.createElement(InternalIcon, { name: __rightIcon, variant: disabled ? 'disabled' : __rightIconVariant })))));
73
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/input/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAA0B,MAAM,EAAE,MAAM,OAAO,CAAC;AAC9D,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,UAAC,QAAgB,EAAE,UAAmB;;IAC1D,OAAA,IAAI,CAAC,M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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 __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 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} spellCheck={false} />\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,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,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"]}
@@ -2,7 +2,8 @@ import React from 'react';
2
2
  import { FormFieldValidationControlProps } from '../../context/form-field-context';
3
3
  import { BaseComponentProps } from '../../base-component';
4
4
  import { NonCancelableEventHandler } from '../../events';
5
- import { BaseChangeDetail, BaseInputProps, InputAutoCorrect, InputKeyEvents, InputProps } from '../../../input/interfaces';
5
+ import { BaseChangeDetail, BaseInputProps, InputAutoCorrect, InputKeyEvents } from '../../../input/interfaces';
6
+ import { AutosuggestProps } from '../../../autosuggest/interfaces';
6
7
  import { ExpandToViewport } from '../dropdown/interfaces';
7
8
  import { InternalBaseComponentProps } from '../../hooks/use-base-component';
8
9
  export interface AutosuggestInputProps extends BaseComponentProps, BaseInputProps, InputAutoCorrect, InputKeyEvents, FormFieldValidationControlProps, ExpandToViewport, InternalBaseComponentProps {
@@ -24,7 +25,7 @@ export interface AutosuggestInputProps extends BaseComponentProps, BaseInputProp
24
25
  export interface AutosuggestInputFocusOptions {
25
26
  preventDropdown?: boolean;
26
27
  }
27
- export interface AutosuggestInputRef extends InputProps.Ref {
28
+ export interface AutosuggestInputRef extends AutosuggestProps.Ref {
28
29
  focus(options?: AutosuggestInputFocusOptions): void;
29
30
  open(): void;
30
31
  close(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/autosuggest-input/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAgE,MAAM,OAAO,CAAC;AAIrF,OAAO,EAAE,+BAA+B,EAAuB,MAAM,kCAAkC,CAAC;AACxG,OAAO,EAAE,kBAAkB,EAAgB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAA8D,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAErH,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,UAAU,EACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAK5E,MAAM,WAAW,qBACf,SAAQ,kBAAkB,EACxB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,+BAA+B,EAC/B,gBAAgB,EAChB,0BAA0B;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAClD,cAAc,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAC;IAC7D,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,4BAA4B;IAC3C,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAoB,SAAQ,UAAU,CAAC,GAAG;IACzD,KAAK,CAAC,OAAO,CAAC,EAAE,4BAA4B,GAAG,IAAI,CAAC;IACpD,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;CACf;AAED,QAAA,MAAM,gBAAgB,mGA4OrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/autosuggest-input/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAgE,MAAM,OAAO,CAAC;AAIrF,OAAO,EAAE,+BAA+B,EAAuB,MAAM,kCAAkC,CAAC;AACxG,OAAO,EAAE,kBAAkB,EAAgB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAA8D,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAErH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC/G,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAK5E,MAAM,WAAW,qBACf,SAAQ,kBAAkB,EACxB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,+BAA+B,EAC/B,gBAAgB,EAChB,0BAA0B;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,cAAc,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W,EAAE,uBAAuB,EACpC,IAAI,EAAE,IAAI,EACV,MAAM,EACJ,iBAAiB,IAAI,CACnB,6BAAK,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAC9D,cAAc,CACX,CACP,EAEH,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,IAEnB,IAAI,IAAI,eAAe,CAAC,CAAC,CAAC,CACzB,6BAAK,GAAG,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC,IAChE,eAAe,CACZ,CACP,CAAC,CAAC,CAAC,IAAI,CACC,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useRef, useState, useImperativeHandle, useEffect } from 'react';\n\nimport Dropdown from '../dropdown';\n\nimport { FormFieldValidationControlProps, useFormFieldContext } from '../../context/form-field-context';\nimport { BaseComponentProps, getBaseProps } from '../../base-component';\nimport { BaseKeyDetail, fireCancelableEvent, fireNonCancelableEvent, NonCancelableEventHandler } from '../../events';\nimport InternalInput from '../../../input/internal';\nimport {\n BaseChangeDetail,\n BaseInputProps,\n InputAutoCorrect,\n InputKeyEvents,\n InputProps,\n} from '../../../input/interfaces';\nimport { ExpandToViewport } from '../dropdown/interfaces';\nimport { InternalBaseComponentProps } from '../../hooks/use-base-component';\nimport { KeyCode } from '../../keycode';\nimport styles from './styles.css.js';\nimport clsx from 'clsx';\n\nexport interface AutosuggestInputProps\n extends BaseComponentProps,\n BaseInputProps,\n InputAutoCorrect,\n InputKeyEvents,\n FormFieldValidationControlProps,\n ExpandToViewport,\n InternalBaseComponentProps {\n ariaControls?: string;\n ariaActivedescendant?: string;\n dropdownExpanded?: boolean;\n dropdownContentKey?: string;\n dropdownContentFocusable?: boolean;\n dropdownContent?: React.ReactNode;\n dropdownFooter?: React.ReactNode;\n dropdownWidth?: number;\n loopFocus?: boolean;\n onCloseDropdown?: NonCancelableEventHandler<null>;\n onDelayedInput?: NonCancelableEventHandler<BaseChangeDetail>;\n onPressArrowDown?: () => void;\n onPressArrowUp?: () => void;\n onPressEnter?: () => boolean;\n}\n\nexport interface AutosuggestInputFocusOptions {\n preventDropdown?: boolean;\n}\n\nexport interface AutosuggestInputRef extends InputProps.Ref {\n focus(options?: AutosuggestInputFocusOptions): void;\n open(): void;\n close(): void;\n}\n\nconst AutosuggestInput = React.forwardRef(\n (\n {\n value,\n onChange,\n onBlur,\n onFocus,\n onKeyUp,\n onKeyDown,\n name,\n placeholder,\n disabled,\n readOnly,\n autoFocus,\n ariaLabel,\n ariaRequired,\n disableBrowserAutocorrect = false,\n expandToViewport,\n ariaControls,\n ariaActivedescendant,\n dropdownExpanded = true,\n dropdownContentKey,\n dropdownContentFocusable = false,\n dropdownContent = null,\n dropdownFooter = null,\n dropdownWidth,\n loopFocus,\n onCloseDropdown,\n onDelayedInput,\n onPressArrowDown,\n onPressArrowUp,\n onPressEnter,\n __internalRootRef,\n ...restProps\n }: AutosuggestInputProps,\n ref: Ref<AutosuggestInputRef>\n ) => {\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n\n const inputRef = useRef<HTMLInputElement>(null);\n const dropdownContentRef = useRef<HTMLDivElement>(null);\n const dropdownFooterRef = useRef<HTMLDivElement>(null);\n const preventOpenOnFocusRef = useRef(false);\n const preventCloseOnBlurRef = useRef(false);\n\n const [open, setOpen] = useState(false);\n\n const openDropdown = () => !readOnly && setOpen(true);\n\n const closeDropdown = () => {\n setOpen(false);\n fireNonCancelableEvent(onCloseDropdown, null);\n };\n\n useImperativeHandle(ref, () => ({\n focus(options?: AutosuggestInputFocusOptions) {\n if (options?.preventDropdown) {\n preventOpenOnFocusRef.current = true;\n }\n inputRef.current?.focus();\n },\n select() {\n inputRef.current?.select();\n },\n open: openDropdown,\n close: closeDropdown,\n }));\n\n const handleBlur = () => {\n if (!preventCloseOnBlurRef.current) {\n closeDropdown();\n fireNonCancelableEvent(onBlur, null);\n }\n };\n\n const handleFocus = () => {\n if (!preventOpenOnFocusRef.current) {\n openDropdown();\n fireNonCancelableEvent(onFocus, null);\n }\n preventOpenOnFocusRef.current = false;\n };\n\n const handleKeyDown = (e: CustomEvent<BaseKeyDetail>) => {\n switch (e.detail.keyCode) {\n case KeyCode.down: {\n onPressArrowDown?.();\n openDropdown();\n e.preventDefault();\n break;\n }\n case KeyCode.up: {\n onPressArrowUp?.();\n openDropdown();\n e.preventDefault();\n break;\n }\n case KeyCode.enter: {\n if (open) {\n if (!onPressEnter?.()) {\n closeDropdown();\n }\n e.preventDefault();\n }\n fireCancelableEvent(onKeyDown, e.detail);\n break;\n }\n case KeyCode.escape: {\n if (open) {\n closeDropdown();\n } else if (value) {\n fireNonCancelableEvent(onChange, { value: '' });\n }\n e.preventDefault();\n fireCancelableEvent(onKeyDown, e.detail);\n break;\n }\n default: {\n fireCancelableEvent(onKeyDown, e.detail);\n }\n }\n };\n\n const handleChange = (value: string) => {\n openDropdown();\n fireNonCancelableEvent(onChange, { value });\n };\n\n const handleDelayedInput = (value: string) => {\n fireNonCancelableEvent(onDelayedInput, { value });\n };\n\n const handleDropdownMouseDown: React.MouseEventHandler = event => {\n // Prevent currently focused element from losing focus.\n if (!dropdownContentFocusable) {\n event.preventDefault();\n }\n // Prevent closing dropdown on click inside.\n else {\n preventCloseOnBlurRef.current = true;\n requestAnimationFrame(() => {\n preventCloseOnBlurRef.current = false;\n });\n }\n };\n\n const expanded = open && dropdownExpanded;\n const nativeAttributes = {\n name,\n placeholder,\n autoFocus,\n onClick: openDropdown,\n role: 'combobox',\n 'aria-autocomplete': 'list',\n 'aria-expanded': expanded,\n 'aria-controls': open ? ariaControls : undefined,\n // 'aria-owns' needed for safari+vo to announce activedescendant content\n 'aria-owns': open ? ariaControls : undefined,\n 'aria-label': ariaLabel,\n 'aria-activedescendant': ariaActivedescendant,\n };\n\n // Closes dropdown when outside click is detected.\n // Similar to the internal dropdown implementation but includes the target as well.\n useEffect(() => {\n if (!open) {\n return;\n }\n\n const clickListener = (event: MouseEvent) => {\n if (\n !inputRef.current?.contains(event.target as Node) &&\n !dropdownContentRef.current?.contains(event.target as Node) &&\n !dropdownFooterRef.current?.contains(event.target as Node)\n ) {\n closeDropdown();\n }\n };\n\n window.addEventListener('mousedown', clickListener);\n\n return () => {\n window.removeEventListener('mousedown', clickListener);\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open]);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <Dropdown\n minWidth={dropdownWidth}\n stretchWidth={!dropdownWidth}\n contentKey={dropdownContentKey}\n onFocus={handleFocus}\n onBlur={handleBlur}\n trigger={\n <InternalInput\n type=\"visualSearch\"\n value={value}\n onChange={event => handleChange(event.detail.value)}\n __onDelayedInput={event => handleDelayedInput(event.detail.value)}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n disabled={disabled}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n readOnly={readOnly}\n ariaRequired={ariaRequired}\n ref={inputRef}\n autoComplete={false}\n __nativeAttributes={nativeAttributes}\n {...formFieldContext}\n />\n }\n onMouseDown={handleDropdownMouseDown}\n open={open}\n footer={\n dropdownFooterRef && (\n <div ref={dropdownFooterRef} className={styles['dropdown-footer']}>\n {dropdownFooter}\n </div>\n )\n }\n expandToViewport={expandToViewport}\n loopFocus={loopFocus}\n >\n {open && dropdownContent ? (\n <div ref={dropdownContentRef} className={styles['dropdown-content']}>\n {dropdownContent}\n </div>\n ) : null}\n </Dropdown>\n </div>\n );\n }\n);\n\nexport default AutosuggestInput;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/autosuggest-input/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAA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KAAK,CAAC,EAAhC,CAAgC,EACnD,gBAAgB,EAAE,UAAA,KAAK,IAAI,OAAA,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAtC,CAAsC,EACjE,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,yBAAyB,EAAE,yBAAyB,EACpD,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,QAAQ,EACb,YAAY,EAAE,KAAK,EACnB,kBAAkB,EAAE,gBAAgB,IAChC,gBAAgB,EACpB,EAEJ,WAAW,EAAE,uBAAuB,EACpC,IAAI,EAAE,IAAI,EACV,MAAM,EACJ,iBAAiB,IAAI,CACnB,6BAAK,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAC9D,cAAc,CACX,CACP,EAEH,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,IAEnB,IAAI,IAAI,eAAe,CAAC,CAAC,CAAC,CACzB,6BAAK,GAAG,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC,IAChE,eAAe,CACZ,CACP,CAAC,CAAC,CAAC,IAAI,CACC,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useRef, useState, useImperativeHandle, useEffect } from 'react';\n\nimport Dropdown from '../dropdown';\n\nimport { FormFieldValidationControlProps, useFormFieldContext } from '../../context/form-field-context';\nimport { BaseComponentProps, getBaseProps } from '../../base-component';\nimport { BaseKeyDetail, fireCancelableEvent, fireNonCancelableEvent, NonCancelableEventHandler } from '../../events';\nimport InternalInput from '../../../input/internal';\nimport { BaseChangeDetail, BaseInputProps, InputAutoCorrect, InputKeyEvents } from '../../../input/interfaces';\nimport { AutosuggestProps } from '../../../autosuggest/interfaces';\nimport { ExpandToViewport } from '../dropdown/interfaces';\nimport { InternalBaseComponentProps } from '../../hooks/use-base-component';\nimport { KeyCode } from '../../keycode';\nimport styles from './styles.css.js';\nimport clsx from 'clsx';\n\nexport interface AutosuggestInputProps\n extends BaseComponentProps,\n BaseInputProps,\n InputAutoCorrect,\n InputKeyEvents,\n FormFieldValidationControlProps,\n ExpandToViewport,\n InternalBaseComponentProps {\n ariaControls?: string;\n ariaActivedescendant?: string;\n dropdownExpanded?: boolean;\n dropdownContentKey?: string;\n dropdownContentFocusable?: boolean;\n dropdownContent?: React.ReactNode;\n dropdownFooter?: React.ReactNode;\n dropdownWidth?: number;\n loopFocus?: boolean;\n onCloseDropdown?: NonCancelableEventHandler<null>;\n onDelayedInput?: NonCancelableEventHandler<BaseChangeDetail>;\n onPressArrowDown?: () => void;\n onPressArrowUp?: () => void;\n onPressEnter?: () => boolean;\n}\n\nexport interface AutosuggestInputFocusOptions {\n preventDropdown?: boolean;\n}\n\nexport interface AutosuggestInputRef extends AutosuggestProps.Ref {\n focus(options?: AutosuggestInputFocusOptions): void;\n open(): void;\n close(): void;\n}\n\nconst AutosuggestInput = React.forwardRef(\n (\n {\n value,\n onChange,\n onBlur,\n onFocus,\n onKeyUp,\n onKeyDown,\n name,\n placeholder,\n disabled,\n readOnly,\n autoFocus,\n ariaLabel,\n ariaRequired,\n disableBrowserAutocorrect = false,\n expandToViewport,\n ariaControls,\n ariaActivedescendant,\n dropdownExpanded = true,\n dropdownContentKey,\n dropdownContentFocusable = false,\n dropdownContent = null,\n dropdownFooter = null,\n dropdownWidth,\n loopFocus,\n onCloseDropdown,\n onDelayedInput,\n onPressArrowDown,\n onPressArrowUp,\n onPressEnter,\n __internalRootRef,\n ...restProps\n }: AutosuggestInputProps,\n ref: Ref<AutosuggestInputRef>\n ) => {\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n\n const inputRef = useRef<HTMLInputElement>(null);\n const dropdownContentRef = useRef<HTMLDivElement>(null);\n const dropdownFooterRef = useRef<HTMLDivElement>(null);\n const preventOpenOnFocusRef = useRef(false);\n const preventCloseOnBlurRef = useRef(false);\n\n const [open, setOpen] = useState(false);\n\n const openDropdown = () => !readOnly && setOpen(true);\n\n const closeDropdown = () => {\n setOpen(false);\n fireNonCancelableEvent(onCloseDropdown, null);\n };\n\n useImperativeHandle(ref, () => ({\n focus(options?: AutosuggestInputFocusOptions) {\n if (options?.preventDropdown) {\n preventOpenOnFocusRef.current = true;\n }\n inputRef.current?.focus();\n },\n select() {\n inputRef.current?.select();\n },\n open: openDropdown,\n close: closeDropdown,\n }));\n\n const handleBlur = () => {\n if (!preventCloseOnBlurRef.current) {\n closeDropdown();\n fireNonCancelableEvent(onBlur, null);\n }\n };\n\n const handleFocus = () => {\n if (!preventOpenOnFocusRef.current) {\n openDropdown();\n fireNonCancelableEvent(onFocus, null);\n }\n preventOpenOnFocusRef.current = false;\n };\n\n const handleKeyDown = (e: CustomEvent<BaseKeyDetail>) => {\n switch (e.detail.keyCode) {\n case KeyCode.down: {\n onPressArrowDown?.();\n openDropdown();\n e.preventDefault();\n break;\n }\n case KeyCode.up: {\n onPressArrowUp?.();\n openDropdown();\n e.preventDefault();\n break;\n }\n case KeyCode.enter: {\n if (open) {\n if (!onPressEnter?.()) {\n closeDropdown();\n }\n e.preventDefault();\n }\n fireCancelableEvent(onKeyDown, e.detail);\n break;\n }\n case KeyCode.escape: {\n if (open) {\n closeDropdown();\n } else if (value) {\n fireNonCancelableEvent(onChange, { value: '' });\n }\n e.preventDefault();\n fireCancelableEvent(onKeyDown, e.detail);\n break;\n }\n default: {\n fireCancelableEvent(onKeyDown, e.detail);\n }\n }\n };\n\n const handleChange = (value: string) => {\n openDropdown();\n fireNonCancelableEvent(onChange, { value });\n };\n\n const handleDelayedInput = (value: string) => {\n fireNonCancelableEvent(onDelayedInput, { value });\n };\n\n const handleDropdownMouseDown: React.MouseEventHandler = event => {\n // Prevent currently focused element from losing focus.\n if (!dropdownContentFocusable) {\n event.preventDefault();\n }\n // Prevent closing dropdown on click inside.\n else {\n preventCloseOnBlurRef.current = true;\n requestAnimationFrame(() => {\n preventCloseOnBlurRef.current = false;\n });\n }\n };\n\n const expanded = open && dropdownExpanded;\n const nativeAttributes = {\n name,\n placeholder,\n autoFocus,\n onClick: openDropdown,\n role: 'combobox',\n 'aria-autocomplete': 'list',\n 'aria-expanded': expanded,\n 'aria-controls': open ? ariaControls : undefined,\n // 'aria-owns' needed for safari+vo to announce activedescendant content\n 'aria-owns': open ? ariaControls : undefined,\n 'aria-label': ariaLabel,\n 'aria-activedescendant': ariaActivedescendant,\n };\n\n // Closes dropdown when outside click is detected.\n // Similar to the internal dropdown implementation but includes the target as well.\n useEffect(() => {\n if (!open) {\n return;\n }\n\n const clickListener = (event: MouseEvent) => {\n if (\n !inputRef.current?.contains(event.target as Node) &&\n !dropdownContentRef.current?.contains(event.target as Node) &&\n !dropdownFooterRef.current?.contains(event.target as Node)\n ) {\n closeDropdown();\n }\n };\n\n window.addEventListener('mousedown', clickListener);\n\n return () => {\n window.removeEventListener('mousedown', clickListener);\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open]);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <Dropdown\n minWidth={dropdownWidth}\n stretchWidth={!dropdownWidth}\n contentKey={dropdownContentKey}\n onFocus={handleFocus}\n onBlur={handleBlur}\n trigger={\n <InternalInput\n type=\"visualSearch\"\n value={value}\n onChange={event => handleChange(event.detail.value)}\n __onDelayedInput={event => handleDelayedInput(event.detail.value)}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n disabled={disabled}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n readOnly={readOnly}\n ariaRequired={ariaRequired}\n ref={inputRef}\n autoComplete={false}\n __nativeAttributes={nativeAttributes}\n {...formFieldContext}\n />\n }\n onMouseDown={handleDropdownMouseDown}\n open={open}\n footer={\n dropdownFooterRef && (\n <div ref={dropdownFooterRef} className={styles['dropdown-footer']}>\n {dropdownFooter}\n </div>\n )\n }\n expandToViewport={expandToViewport}\n loopFocus={loopFocus}\n >\n {open && dropdownContent ? (\n <div ref={dropdownContentRef} className={styles['dropdown-content']}>\n {dropdownContent}\n </div>\n ) : null}\n </Dropdown>\n </div>\n );\n }\n);\n\nexport default AutosuggestInput;\n"]}
@@ -1,5 +1,5 @@
1
1
 
2
- export var PACKAGE_VERSION = '3.0.0 (e65a151)';
2
+ export var PACKAGE_VERSION = '3.0.0 (51f25a5)';
3
3
  export var THEME = 'open-source-visual-refresh';
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
5
5
 
@@ -0,0 +1,3 @@
1
+ {
2
+ "commit": "51f25a58b9ade5d19428a63fcd9076a71078494b"
3
+ }
package/package.json CHANGED
@@ -112,6 +112,6 @@
112
112
  "./internal/base-component/index.js",
113
113
  "./internal/base-component/styles.css.js"
114
114
  ],
115
- "version": "3.0.112",
115
+ "version": "3.0.114",
116
116
  "license": "Apache-2.0"
117
117
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/s3-resource-selector/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAO3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAMvD,OAAO,EAAE,uBAAuB,EAAE,CAAC;AAEnC,QAAA,MAAM,kBAAkB,6GAoFvB,CAAC;AAGF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/s3-resource-selector/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAO3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAOvD,OAAO,EAAE,uBAAuB,EAAE,CAAC;AAEnC,QAAA,MAAM,kBAAkB,6GA8FvB,CAAC;AAGF,eAAe,kBAAkB,CAAC"}
@@ -13,14 +13,16 @@ import { S3Modal } from './s3-modal';
13
13
  import styles from './styles.css.js';
14
14
  import useBaseComponent from '../internal/hooks/use-base-component';
15
15
  import { checkSafeUrl } from '../internal/utils/check-safe-url';
16
+ import { useFormFieldContext } from '../contexts/form-field';
16
17
  var S3ResourceSelector = React.forwardRef(function (_a, ref) {
17
- var i18nStrings = _a.i18nStrings, alert = _a.alert, resource = _a.resource, viewHref = _a.viewHref, invalid = _a.invalid, _b = _a.selectableItemsTypes, selectableItemsTypes = _b === void 0 ? [] : _b, inputAriaDescribedby = _a.inputAriaDescribedby, _c = _a.bucketsVisibleColumns, bucketsVisibleColumns = _c === void 0 ? ['Name', 'CreationDate'] : _c, bucketsIsItemDisabled = _a.bucketsIsItemDisabled, fetchBuckets = _a.fetchBuckets, fetchObjects = _a.fetchObjects, _d = _a.objectsVisibleColumns, objectsVisibleColumns = _d === void 0 ? ['Key', 'LastModified', 'Size'] : _d, objectsIsItemDisabled = _a.objectsIsItemDisabled, fetchVersions = _a.fetchVersions, _e = _a.versionsVisibleColumns, versionsVisibleColumns = _e === void 0 ? ['ID', 'LastModified', 'Size'] : _e, versionsIsItemDisabled = _a.versionsIsItemDisabled, onChange = _a.onChange, rest = __rest(_a, ["i18nStrings", "alert", "resource", "viewHref", "invalid", "selectableItemsTypes", "inputAriaDescribedby", "bucketsVisibleColumns", "bucketsIsItemDisabled", "fetchBuckets", "fetchObjects", "objectsVisibleColumns", "objectsIsItemDisabled", "fetchVersions", "versionsVisibleColumns", "versionsIsItemDisabled", "onChange"]);
18
+ var i18nStrings = _a.i18nStrings, alert = _a.alert, resource = _a.resource, viewHref = _a.viewHref, invalid = _a.invalid, _b = _a.selectableItemsTypes, selectableItemsTypes = _b === void 0 ? [] : _b, inputAriaDescribedby = _a.inputAriaDescribedby, _c = _a.bucketsVisibleColumns, bucketsVisibleColumns = _c === void 0 ? ['Name', 'CreationDate'] : _c, bucketsIsItemDisabled = _a.bucketsIsItemDisabled, fetchBuckets = _a.fetchBuckets, fetchObjects = _a.fetchObjects, _d = _a.objectsVisibleColumns, objectsVisibleColumns = _d === void 0 ? ['Key', 'LastModified', 'Size'] : _d, objectsIsItemDisabled = _a.objectsIsItemDisabled, fetchVersions = _a.fetchVersions, _e = _a.versionsVisibleColumns, versionsVisibleColumns = _e === void 0 ? ['ID', 'LastModified', 'Size'] : _e, versionsIsItemDisabled = _a.versionsIsItemDisabled, onChange = _a.onChange, ariaLabel = _a.ariaLabel, rest = __rest(_a, ["i18nStrings", "alert", "resource", "viewHref", "invalid", "selectableItemsTypes", "inputAriaDescribedby", "bucketsVisibleColumns", "bucketsIsItemDisabled", "fetchBuckets", "fetchObjects", "objectsVisibleColumns", "objectsIsItemDisabled", "fetchVersions", "versionsVisibleColumns", "versionsIsItemDisabled", "onChange", "ariaLabel"]);
18
19
  checkSafeUrl('S3ResourceSelector', viewHref);
19
20
  var __internalRootRef = useBaseComponent('S3ResourceSelector').__internalRootRef;
20
21
  var _f = useState(false), modalOpen = _f[0], setModalOpen = _f[1];
21
22
  var inContextRef = useRef(null);
22
23
  var modalWasSubmitted = useRef(false);
23
24
  useForwardFocus(ref, inContextRef);
25
+ var _g = useFormFieldContext(rest), ariaLabelledby = _g.ariaLabelledby, ariaDescribedby = _g.ariaDescribedby;
24
26
  useEffect(function () {
25
27
  var _a;
26
28
  // Focus uriInput only when modal was submitted.
@@ -51,7 +53,7 @@ var S3ResourceSelector = React.forwardRef(function (_a, ref) {
51
53
  },
52
54
  onDismiss: function () { return setModalOpen(false); }
53
55
  };
54
- return (React.createElement("div", __assign({}, baseProps, { className: clsx(styles.root, baseProps.className), ref: __internalRootRef }),
56
+ return (React.createElement("div", __assign({}, baseProps, { className: clsx(styles.root, baseProps.className), ref: __internalRootRef, role: "group", "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-label": ariaLabel }),
55
57
  React.createElement(S3InContext, { ref: inContextRef, selectableItemsTypes: selectableItemsTypes, i18nStrings: i18nStrings, resource: resource, viewHref: viewHref, invalid: invalid, inputAriaDescribedby: inputAriaDescribedby, fetchVersions: fetchVersions, onBrowse: function () { return setModalOpen(true); }, onChange: function (resource, errorText) { return fireNonCancelableEvent(onChange, { resource: resource, errorText: errorText }); } }),
56
58
  !modalOpen && alert && (React.createElement(InternalBox, { className: styles.alert, margin: { top: 's' } }, alert)),
57
59
  modalOpen && React.createElement(S3Modal, __assign({}, modalProps))));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/s3-resource-selector/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAkB,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAgB,MAAM,YAAY,CAAC;AACnD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAIhE,IAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,CACzC,UACE,EAmB0B,EAC1B,GAA2C;IAnBzC,IAAA,WAAW,iBAAA,EACX,KAAK,WAAA,EACL,QAAQ,cAAA,EACR,QAAQ,cAAA,EACR,OAAO,aAAA,EACP,4BAAyB,EAAzB,oBAAoB,mBAAG,EAAE,KAAA,E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CACrC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;AAC3D,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useState, useRef, useEffect } from 'react';\nimport InternalBox from '../box/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { S3InContext, S3InContextRef } from './s3-in-context';\nimport { S3ResourceSelectorProps } from './interfaces';\nimport { S3Modal, S3ModalProps } from './s3-modal';\nimport styles from './styles.css.js';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\n\nexport { S3ResourceSelectorProps };\n\nconst S3ResourceSelector = React.forwardRef(\n (\n {\n i18nStrings,\n alert,\n resource,\n viewHref,\n invalid,\n selectableItemsTypes = [],\n inputAriaDescribedby,\n bucketsVisibleColumns = ['Name', 'CreationDate'],\n bucketsIsItemDisabled,\n fetchBuckets,\n fetchObjects,\n objectsVisibleColumns = ['Key', 'LastModified', 'Size'],\n objectsIsItemDisabled,\n fetchVersions,\n versionsVisibleColumns = ['ID', 'LastModified', 'Size'],\n versionsIsItemDisabled,\n onChange,\n ...rest\n }: S3ResourceSelectorProps,\n ref: React.Ref<S3ResourceSelectorProps.Ref>\n ) => {\n checkSafeUrl('S3ResourceSelector', viewHref);\n const { __internalRootRef } = useBaseComponent('S3ResourceSelector');\n const [modalOpen, setModalOpen] = useState(false);\n const inContextRef = useRef<S3InContextRef>(null);\n const modalWasSubmitted = useRef<boolean>(false);\n useForwardFocus(ref, inContextRef);\n\n useEffect(() => {\n // Focus uriInput only when modal was submitted.\n // When it was dismissed, the focus naturally goes to previously focused element (browse button)\n if (!modalOpen && modalWasSubmitted.current) {\n modalWasSubmitted.current = false;\n inContextRef.current?.focus();\n }\n }, [modalOpen]);\n\n const baseProps = getBaseProps(rest);\n const modalProps: S3ModalProps = {\n alert,\n i18nStrings,\n fetchBuckets,\n selectableItemsTypes,\n bucketsVisibleColumns,\n bucketsIsItemDisabled,\n fetchObjects,\n objectsVisibleColumns,\n objectsIsItemDisabled,\n fetchVersions,\n versionsVisibleColumns,\n versionsIsItemDisabled,\n onSubmit: resource => {\n fireNonCancelableEvent(onChange, { resource });\n setModalOpen(false);\n modalWasSubmitted.current = true;\n },\n onDismiss: () => setModalOpen(false),\n };\n return (\n <div {...baseProps} className={clsx(styles.root, baseProps.className)} ref={__internalRootRef}>\n <S3InContext\n ref={inContextRef}\n selectableItemsTypes={selectableItemsTypes}\n i18nStrings={i18nStrings}\n resource={resource}\n viewHref={viewHref}\n invalid={invalid}\n inputAriaDescribedby={inputAriaDescribedby}\n fetchVersions={fetchVersions}\n onBrowse={() => setModalOpen(true)}\n onChange={(resource, errorText) => fireNonCancelableEvent(onChange, { resource, errorText })}\n />\n {!modalOpen && alert && (\n <InternalBox className={styles.alert} margin={{ top: 's' }}>\n {alert}\n </InternalBox>\n )}\n {modalOpen && <S3Modal {...modalProps} />}\n </div>\n );\n }\n);\n\napplyDisplayName(S3ResourceSelector, 'S3ResourceSelector');\nexport default S3ResourceSelector;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/s3-resource-selector/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5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CAAC,SAAS,CAAC,EACjD,GAAG,EAAE,iBAAiB,EACtB,IAAI,EAAC,OAAO,qBACK,cAAc,sBACb,eAAe,gBACrB,SAAS;QAErB,oBAAC,WAAW,IACV,GAAG,EAAE,YAAY,EACjB,oBAAoB,EAAE,oBAAoB,EAC1C,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,oBAAoB,EAAE,oBAAoB,EAC1C,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,cAAM,OAAA,YAAY,CAAC,IAAI,CAAC,EAAlB,CAAkB,EAClC,QAAQ,EAAE,UAAC,QAAQ,EAAE,SAAS,IAAK,OAAA,sBAAsB,CAAC,QAAQ,EAAE,EAAE,QAAQ,UAAA,EAAE,SAAS,WAAA,EAAE,CAAC,EAAzD,CAAyD,GAC5F;QACD,CAAC,SAAS,IAAI,KAAK,IAAI,CACtB,oBAAC,WAAW,IAAC,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IACvD,KAAK,CACM,CACf;QACA,SAAS,IAAI,oBAAC,OAAO,eAAK,UAAU,EAAI,CACrC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;AAC3D,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useState, useRef, useEffect } from 'react';\nimport InternalBox from '../box/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { S3InContext, S3InContextRef } from './s3-in-context';\nimport { S3ResourceSelectorProps } from './interfaces';\nimport { S3Modal, S3ModalProps } from './s3-modal';\nimport styles from './styles.css.js';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport { useFormFieldContext } from '../contexts/form-field';\n\nexport { S3ResourceSelectorProps };\n\nconst S3ResourceSelector = React.forwardRef(\n (\n {\n i18nStrings,\n alert,\n resource,\n viewHref,\n invalid,\n selectableItemsTypes = [],\n inputAriaDescribedby,\n bucketsVisibleColumns = ['Name', 'CreationDate'],\n bucketsIsItemDisabled,\n fetchBuckets,\n fetchObjects,\n objectsVisibleColumns = ['Key', 'LastModified', 'Size'],\n objectsIsItemDisabled,\n fetchVersions,\n versionsVisibleColumns = ['ID', 'LastModified', 'Size'],\n versionsIsItemDisabled,\n onChange,\n ariaLabel,\n ...rest\n }: S3ResourceSelectorProps,\n ref: React.Ref<S3ResourceSelectorProps.Ref>\n ) => {\n checkSafeUrl('S3ResourceSelector', viewHref);\n const { __internalRootRef } = useBaseComponent('S3ResourceSelector');\n const [modalOpen, setModalOpen] = useState(false);\n const inContextRef = useRef<S3InContextRef>(null);\n const modalWasSubmitted = useRef<boolean>(false);\n useForwardFocus(ref, inContextRef);\n const { ariaLabelledby, ariaDescribedby } = useFormFieldContext(rest);\n\n useEffect(() => {\n // Focus uriInput only when modal was submitted.\n // When it was dismissed, the focus naturally goes to previously focused element (browse button)\n if (!modalOpen && modalWasSubmitted.current) {\n modalWasSubmitted.current = false;\n inContextRef.current?.focus();\n }\n }, [modalOpen]);\n\n const baseProps = getBaseProps(rest);\n const modalProps: S3ModalProps = {\n alert,\n i18nStrings,\n fetchBuckets,\n selectableItemsTypes,\n bucketsVisibleColumns,\n bucketsIsItemDisabled,\n fetchObjects,\n objectsVisibleColumns,\n objectsIsItemDisabled,\n fetchVersions,\n versionsVisibleColumns,\n versionsIsItemDisabled,\n onSubmit: resource => {\n fireNonCancelableEvent(onChange, { resource });\n setModalOpen(false);\n modalWasSubmitted.current = true;\n },\n onDismiss: () => setModalOpen(false),\n };\n return (\n <div\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n ref={__internalRootRef}\n role=\"group\"\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n aria-label={ariaLabel}\n >\n <S3InContext\n ref={inContextRef}\n selectableItemsTypes={selectableItemsTypes}\n i18nStrings={i18nStrings}\n resource={resource}\n viewHref={viewHref}\n invalid={invalid}\n inputAriaDescribedby={inputAriaDescribedby}\n fetchVersions={fetchVersions}\n onBrowse={() => setModalOpen(true)}\n onChange={(resource, errorText) => fireNonCancelableEvent(onChange, { resource, errorText })}\n />\n {!modalOpen && alert && (\n <InternalBox className={styles.alert} margin={{ top: 's' }}>\n {alert}\n </InternalBox>\n )}\n {modalOpen && <S3Modal {...modalProps} />}\n </div>\n );\n }\n);\n\napplyDisplayName(S3ResourceSelector, 'S3ResourceSelector');\nexport default S3ResourceSelector;\n"]}
@@ -8,6 +8,31 @@ export interface S3ResourceSelectorProps extends BaseComponentProps {
8
8
  * Specifies additional information about component status.
9
9
  */
10
10
  alert?: React.ReactNode;
11
+ /**
12
+ * Adds `aria-labelledby` to the component. If you're using this component within a form field,
13
+ * don't set this property because the form field component automatically sets it.
14
+ *
15
+ * Use this property if the component isn't surrounded by a form field, or you want to override the value
16
+ * automatically set by the form field (for example, if you have two components within a single form field).
17
+ *
18
+ * To use it correctly, define an ID for the element you want to use as label and set the property to that ID.
19
+ */
20
+ ariaLabelledby?: string;
21
+ /**
22
+ * Adds `aria-describedby` to the component. If you're using this component within a form field,
23
+ * don't set this property because the form field component automatically sets it.
24
+ *
25
+ * Use this property if the component isn't surrounded by a form field, or you want to override the value
26
+ * automatically set by the form field (for example, if you have two components within a single form field).
27
+ *
28
+ * To use it correctly, define an ID for each element that you want to use as a description
29
+ * and set the property to a string of each ID separated by spaces (for example, `"id1 id2 id3"`).
30
+ */
31
+ ariaDescribedby?: string;
32
+ /**
33
+ * Adds `aria-label` to the component.
34
+ */
35
+ ariaLabel?: string;
11
36
  /**
12
37
  * Adds `aria-labelledby` to the S3 URI input. If you're using this component within a form field,
13
38
  * you do not need to set this property, as the form field component will set it automatically.
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/s3-resource-selector/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC;IAE9E;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAE9C;;;OAGG;IACH,qBAAqB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAE9C;;;OAGG;IACH,sBAAsB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAE/C;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,uBAAuB,CAAC,MAAM,KAAK,OAAO,CAAC;IAE1E;;;OAGG;IACH,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,uBAAuB,CAAC,MAAM,KAAK,OAAO,CAAC;IAE1E;;;OAGG;IACH,sBAAsB,CAAC,EAAE,CAAC,IA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@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/s3-resource-selector/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';\nimport { TableProps } from '../table/interfaces';\nimport { PaginationProps } from '../pagination/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface S3ResourceSelectorProps extends BaseComponentProps {\n /**\n * Specifies additional information about component status.\n */\n alert?: React.ReactNode;\n\n /**\n * Adds `aria-labelledby` to the S3 URI input. If you're using this component within a form field,\n * you do not need to set this property, as the form field component will set it automatically.\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 inputAriaDescribedby?: string;\n\n /**\n * An array of the item types that are selectable in the table view. The array may contain the following items:\n * 'buckets', 'objects', or 'versions'. Example: ['buckets', 'objects']. By default, no items are selectable.\n * This property determines whether the component operates in Read mode or Write mode:\n * * Read mode - When 'objects' and 'versions' values are provided (folder selection should be disabled by\n * customizing `objectsIsItemDisabled` function).\n * * Write mode - When 'buckets' and 'objects' values are provided (file selection should be disabled by\n * customizing `objectsIsItemDisabled` function).\n */\n selectableItemsTypes?: ReadonlyArray<S3ResourceSelectorProps.SelectableItems>;\n\n /**\n * Href of the selected object that is applied to the View button.\n */\n viewHref?: string;\n\n /**\n * Whether the S3 URI input field is in invalid state.\n */\n invalid?: boolean;\n\n /**\n * Optionally overrides the set of visible columns in the Buckets view. Available columns: 'Name', 'CreationDate',\n * and 'Region'.\n */\n bucketsVisibleColumns?: ReadonlyArray<string>;\n\n /**\n * Optionally overrides the set of visible columns in the Objects view. Available columns: 'Key', 'LastModified',\n * and 'Size'.\n */\n objectsVisibleColumns?: ReadonlyArray<string>;\n\n /**\n * Optionally overrides the set of visible columns in the Versions view. Available columns: 'ID', 'CreationDate',\n * and 'Size'.\n */\n versionsVisibleColumns?: ReadonlyArray<string>;\n\n /**\n * Optionally overrides whether a bucket should be disabled for selection in the Buckets view or not.\n * It has higher priority than `selectableItemsTypes`. Example: if `selectableItemsTypes` has `['buckets']` value and\n * `bucketsIsItemDisabled` returns false for a bucket, then the bucket is disabled for selection.\n */\n bucketsIsItemDisabled?: (item: S3ResourceSelectorProps.Bucket) => boolean;\n\n /**\n * Optionally overrides whether an object should be disabled for selection in the Objects view or not. Similar to\n * `bucketsIsItemDisabled` this property takes precedence over the `selectableItemsTypes` property.\n */\n objectsIsItemDisabled?: (item: S3ResourceSelectorProps.Object) => boolean;\n\n /**\n * Optionally overrides whether a version should be disabled for selection in the Versions view or not. Similar to\n * `bucketsIsItemDisabled` this property takes precedence over the `selectableItemsTypes` property.\n */\n versionsIsItemDisabled?: (item: S3ResourceSelectorProps.Version) => boolean;\n\n /**\n * The current selected resource. Resource has the following properties:\n * - `uri` (string) - URI of the resource.\n * - `versionId` (string) - (Optional) Version ID of the selected resource.\n */\n resource: S3ResourceSelectorProps.Resource;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings?: S3ResourceSelectorProps.I18nStrings;\n\n /**\n * Specifies a function that returns all available buckets. The return type of the function should be a promise\n * that resolves to a list of objects with the following properties:\n * - `Name` (string) - Name of the bucket.\n * - `CreationDate` (string) - (Optional) Creation date of the bucket.\n * - `Region` (string) - (Optional) Region of the bucket.\n */\n fetchBuckets: () => Promise<ReadonlyArray<S3ResourceSelectorProps.Bucket>>;\n\n /**\n * Specifies a function that returns available objects and object prefixes for the given `bucketName` and `pathPrefix`.\n * The return type of the function should be a promise that resolves to a list of objects with the following properties:\n * - `Key` (string) - Name of the object or object prefix.\n * - `LastModified` (string) - (Optional) Date when this object was last modified.\n * - `Size` (number) - (Optional) Size of the object.\n * - `IsFolder` (boolean) - (Optional) Determines whether the entry is an object prefix (folder).\n */\n fetchObjects: (bucketName: string, pathPrefix: string) => Promise<ReadonlyArray<S3ResourceSelectorProps.Object>>;\n\n /**\n * Specifies a function that returns available versions for the given `bucketName` and `pathPrefix`.\n * The return type of the function should be a promise that resolves to a list of versions with the following properties:\n * - `VersionId` (string) - Version ID of an object.\n * - `LastModified` (string) - (Optional) Date when this object was last modified.\n * - `Size` (number) - (Optional) Size of the object version.\n */\n fetchVersions: (bucketName: string, pathPrefix: string) => Promise<ReadonlyArray<S3ResourceSelectorProps.Version>>;\n\n /**\n * Fired when the resource selection is changed. The event detail object contains resource that represents the full\n * path of the selected resource and `errorText` that may contain a validation error.\n */\n onChange?: NonCancelableEventHandler<S3ResourceSelectorProps.ChangeDetail>;\n}\n\n// Does not use TableProps.AriaLabels, because here we do not need \"allItemsSelectionLabel\"\n// it is not applicable to single selection mode\ninterface SelectionLabels<T> {\n itemSelectionLabel: (data: TableProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel: string;\n}\n\ntype SortingColumnContainingString = (columnName: string) => string;\n\nexport namespace S3ResourceSelectorProps {\n export interface Bucket {\n Name?: string;\n CreationDate?: string;\n // artificial field, does not exist on the real s3 response\n Region?: string;\n }\n export interface Object {\n Key?: string;\n LastModified?: string;\n Size?: number;\n // artificial field, does not exist on the real s3 response\n IsFolder?: boolean;\n }\n export interface Version {\n VersionId?: string;\n LastModified?: string;\n Size?: number;\n }\n\n export interface Resource {\n uri: string;\n versionId?: string;\n }\n\n export type SelectableItems = 'buckets' | 'objects' | 'versions';\n\n export interface I18nStrings {\n inContextInputPlaceholder: string;\n inContextSelectPlaceholder: string;\n inContextBrowseButton: string;\n inContextViewButton: string;\n inContextViewButtonAriaLabel?: string;\n inContextLoadingText: string;\n inContextUriLabel: string;\n inContextVersionSelectLabel: string;\n\n modalTitle: string;\n modalCancelButton: string;\n modalSubmitButton: string;\n modalBreadcrumbRootItem: string;\n\n selectionBuckets: string;\n selectionObjects: string;\n selectionVersions: string;\n selectionBucketsSearchPlaceholder: string;\n selectionObjectsSearchPlaceholder: string;\n selectionVersionsSearchPlaceholder: string;\n selectionBucketsLoading: string;\n selectionBucketsNoItems: string;\n selectionObjectsLoading: string;\n selectionObjectsNoItems: string;\n selectionVersionsLoading: string;\n selectionVersionsNoItems: string;\n\n filteringCounterText: (count: number) => string;\n filteringNoMatches: string;\n filteringCantFindMatch: string;\n clearFilterButtonText: string;\n\n columnBucketName: string;\n columnBucketCreationDate?: string;\n columnBucketRegion?: string;\n columnObjectKey: string;\n columnObjectLastModified?: string;\n columnObjectSize?: string;\n columnVersionID: string;\n columnVersionLastModified: string;\n columnVersionSize?: string;\n\n validationPathMustBegin: string;\n validationBucketLowerCase: string;\n validationBucketMustNotContain: string;\n validationBucketLength: string;\n validationBucketMustComplyDns: string;\n\n labelSortedDescending: SortingColumnContainingString;\n labelSortedAscending: SortingColumnContainingString;\n labelNotSorted: SortingColumnContainingString;\n labelsPagination: PaginationProps.Labels;\n labelsBucketsSelection: SelectionLabels<Bucket>;\n labelsObjectsSelection: SelectionLabels<S3ResourceSelectorProps.Object>;\n labelsVersionsSelection: SelectionLabels<Version>;\n labelFiltering: (itemsType: string) => string;\n labelRefresh: string;\n labelModalDismiss: string;\n labelBreadcrumbs: string;\n }\n\n export interface ChangeDetail {\n resource: Resource;\n errorText?: string;\n }\n\n export interface Ref {\n /**\n * Focuses the S3 URI input field\n */\n focus(): void;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/s3-resource-selector/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';\nimport { TableProps } from '../table/interfaces';\nimport { PaginationProps } from '../pagination/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface S3ResourceSelectorProps extends BaseComponentProps {\n /**\n * Specifies additional information about component status.\n */\n alert?: React.ReactNode;\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 /**\n * Adds `aria-label` to the component.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the S3 URI input. If you're using this component within a form field,\n * you do not need to set this property, as the form field component will set it automatically.\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 inputAriaDescribedby?: string;\n\n /**\n * An array of the item types that are selectable in the table view. The array may contain the following items:\n * 'buckets', 'objects', or 'versions'. Example: ['buckets', 'objects']. By default, no items are selectable.\n * This property determines whether the component operates in Read mode or Write mode:\n * * Read mode - When 'objects' and 'versions' values are provided (folder selection should be disabled by\n * customizing `objectsIsItemDisabled` function).\n * * Write mode - When 'buckets' and 'objects' values are provided (file selection should be disabled by\n * customizing `objectsIsItemDisabled` function).\n */\n selectableItemsTypes?: ReadonlyArray<S3ResourceSelectorProps.SelectableItems>;\n\n /**\n * Href of the selected object that is applied to the View button.\n */\n viewHref?: string;\n\n /**\n * Whether the S3 URI input field is in invalid state.\n */\n invalid?: boolean;\n\n /**\n * Optionally overrides the set of visible columns in the Buckets view. Available columns: 'Name', 'CreationDate',\n * and 'Region'.\n */\n bucketsVisibleColumns?: ReadonlyArray<string>;\n\n /**\n * Optionally overrides the set of visible columns in the Objects view. Available columns: 'Key', 'LastModified',\n * and 'Size'.\n */\n objectsVisibleColumns?: ReadonlyArray<string>;\n\n /**\n * Optionally overrides the set of visible columns in the Versions view. Available columns: 'ID', 'CreationDate',\n * and 'Size'.\n */\n versionsVisibleColumns?: ReadonlyArray<string>;\n\n /**\n * Optionally overrides whether a bucket should be disabled for selection in the Buckets view or not.\n * It has higher priority than `selectableItemsTypes`. Example: if `selectableItemsTypes` has `['buckets']` value and\n * `bucketsIsItemDisabled` returns false for a bucket, then the bucket is disabled for selection.\n */\n bucketsIsItemDisabled?: (item: S3ResourceSelectorProps.Bucket) => boolean;\n\n /**\n * Optionally overrides whether an object should be disabled for selection in the Objects view or not. Similar to\n * `bucketsIsItemDisabled` this property takes precedence over the `selectableItemsTypes` property.\n */\n objectsIsItemDisabled?: (item: S3ResourceSelectorProps.Object) => boolean;\n\n /**\n * Optionally overrides whether a version should be disabled for selection in the Versions view or not. Similar to\n * `bucketsIsItemDisabled` this property takes precedence over the `selectableItemsTypes` property.\n */\n versionsIsItemDisabled?: (item: S3ResourceSelectorProps.Version) => boolean;\n\n /**\n * The current selected resource. Resource has the following properties:\n * - `uri` (string) - URI of the resource.\n * - `versionId` (string) - (Optional) Version ID of the selected resource.\n */\n resource: S3ResourceSelectorProps.Resource;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings?: S3ResourceSelectorProps.I18nStrings;\n\n /**\n * Specifies a function that returns all available buckets. The return type of the function should be a promise\n * that resolves to a list of objects with the following properties:\n * - `Name` (string) - Name of the bucket.\n * - `CreationDate` (string) - (Optional) Creation date of the bucket.\n * - `Region` (string) - (Optional) Region of the bucket.\n */\n fetchBuckets: () => Promise<ReadonlyArray<S3ResourceSelectorProps.Bucket>>;\n\n /**\n * Specifies a function that returns available objects and object prefixes for the given `bucketName` and `pathPrefix`.\n * The return type of the function should be a promise that resolves to a list of objects with the following properties:\n * - `Key` (string) - Name of the object or object prefix.\n * - `LastModified` (string) - (Optional) Date when this object was last modified.\n * - `Size` (number) - (Optional) Size of the object.\n * - `IsFolder` (boolean) - (Optional) Determines whether the entry is an object prefix (folder).\n */\n fetchObjects: (bucketName: string, pathPrefix: string) => Promise<ReadonlyArray<S3ResourceSelectorProps.Object>>;\n\n /**\n * Specifies a function that returns available versions for the given `bucketName` and `pathPrefix`.\n * The return type of the function should be a promise that resolves to a list of versions with the following properties:\n * - `VersionId` (string) - Version ID of an object.\n * - `LastModified` (string) - (Optional) Date when this object was last modified.\n * - `Size` (number) - (Optional) Size of the object version.\n */\n fetchVersions: (bucketName: string, pathPrefix: string) => Promise<ReadonlyArray<S3ResourceSelectorProps.Version>>;\n\n /**\n * Fired when the resource selection is changed. The event detail object contains resource that represents the full\n * path of the selected resource and `errorText` that may contain a validation error.\n */\n onChange?: NonCancelableEventHandler<S3ResourceSelectorProps.ChangeDetail>;\n}\n\n// Does not use TableProps.AriaLabels, because here we do not need \"allItemsSelectionLabel\"\n// it is not applicable to single selection mode\ninterface SelectionLabels<T> {\n itemSelectionLabel: (data: TableProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel: string;\n}\n\ntype SortingColumnContainingString = (columnName: string) => string;\n\nexport namespace S3ResourceSelectorProps {\n export interface Bucket {\n Name?: string;\n CreationDate?: string;\n // artificial field, does not exist on the real s3 response\n Region?: string;\n }\n export interface Object {\n Key?: string;\n LastModified?: string;\n Size?: number;\n // artificial field, does not exist on the real s3 response\n IsFolder?: boolean;\n }\n export interface Version {\n VersionId?: string;\n LastModified?: string;\n Size?: number;\n }\n\n export interface Resource {\n uri: string;\n versionId?: string;\n }\n\n export type SelectableItems = 'buckets' | 'objects' | 'versions';\n\n export interface I18nStrings {\n inContextInputPlaceholder: string;\n inContextSelectPlaceholder: string;\n inContextBrowseButton: string;\n inContextViewButton: string;\n inContextViewButtonAriaLabel?: string;\n inContextLoadingText: string;\n inContextUriLabel: string;\n inContextVersionSelectLabel: string;\n\n modalTitle: string;\n modalCancelButton: string;\n modalSubmitButton: string;\n modalBreadcrumbRootItem: string;\n\n selectionBuckets: string;\n selectionObjects: string;\n selectionVersions: string;\n selectionBucketsSearchPlaceholder: string;\n selectionObjectsSearchPlaceholder: string;\n selectionVersionsSearchPlaceholder: string;\n selectionBucketsLoading: string;\n selectionBucketsNoItems: string;\n selectionObjectsLoading: string;\n selectionObjectsNoItems: string;\n selectionVersionsLoading: string;\n selectionVersionsNoItems: string;\n\n filteringCounterText: (count: number) => string;\n filteringNoMatches: string;\n filteringCantFindMatch: string;\n clearFilterButtonText: string;\n\n columnBucketName: string;\n columnBucketCreationDate?: string;\n columnBucketRegion?: string;\n columnObjectKey: string;\n columnObjectLastModified?: string;\n columnObjectSize?: string;\n columnVersionID: string;\n columnVersionLastModified: string;\n columnVersionSize?: string;\n\n validationPathMustBegin: string;\n validationBucketLowerCase: string;\n validationBucketMustNotContain: string;\n validationBucketLength: string;\n validationBucketMustComplyDns: string;\n\n labelSortedDescending: SortingColumnContainingString;\n labelSortedAscending: SortingColumnContainingString;\n labelNotSorted: SortingColumnContainingString;\n labelsPagination: PaginationProps.Labels;\n labelsBucketsSelection: SelectionLabels<Bucket>;\n labelsObjectsSelection: SelectionLabels<S3ResourceSelectorProps.Object>;\n labelsVersionsSelection: SelectionLabels<Version>;\n labelFiltering: (itemsType: string) => string;\n labelRefresh: string;\n labelModalDismiss: string;\n labelBreadcrumbs: string;\n }\n\n export interface ChangeDetail {\n resource: Resource;\n errorText?: string;\n }\n\n export interface Ref {\n /**\n * Focuses the S3 URI input field\n */\n focus(): void;\n }\n}\n"]}
@@ -5,6 +5,6 @@ export interface FilterProps extends InternalInputProps {
5
5
  ref?: React.Ref<HTMLInputElement>;
6
6
  filteringType: SelectProps.FilteringType;
7
7
  }
8
- declare const Filter: React.ForwardRefExoticComponent<Pick<FilterProps, "disabled" | "autoComplete" | "autoFocus" | "name" | "className" | "id" | "placeholder" | "inputMode" | "type" | "readOnly" | "step" | "value" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onKeyUp" | "invalid" | "__internalRootRef" | "ariaLabel" | "__nativeAttributes" | "ariaLabelledby" | "ariaDescribedby" | "controlId" | "ariaRequired" | "disableBrowserAutocorrect" | "__leftIcon" | "__leftIconVariant" | "__onLeftIconClick" | "__rightIcon" | "__rightIconVariant" | "__onRightIconClick" | "__noBorderRadius" | "__onDelayedInput" | "__onBlurWithDetail" | "__inheritFormFieldProps" | "filteringType"> & React.RefAttributes<HTMLInputElement>>;
8
+ declare const Filter: React.ForwardRefExoticComponent<Pick<FilterProps, "disabled" | "autoComplete" | "autoFocus" | "name" | "className" | "id" | "placeholder" | "inputMode" | "type" | "readOnly" | "step" | "value" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onKeyUp" | "invalid" | "__internalRootRef" | "ariaLabel" | "__nativeAttributes" | "ariaLabelledby" | "ariaDescribedby" | "controlId" | "ariaRequired" | "disableBrowserAutocorrect" | "spellcheck" | "__leftIcon" | "__leftIconVariant" | "__onLeftIconClick" | "__rightIcon" | "__rightIconVariant" | "__onRightIconClick" | "__noBorderRadius" | "__onDelayedInput" | "__onBlurWithDetail" | "__inheritFormFieldProps" | "filteringType"> & React.RefAttributes<HTMLInputElement>>;
9
9
  export default Filter;
10
10
  //# sourceMappingURL=filter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../src/select/parts/filter.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAsB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,MAAM,WAAW,WAAY,SAAQ,kBAAkB;IACrD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC,aAAa,EAAE,WAAW,CAAC,aAAa,CAAC;CAC1C;AAED,QAAA,MAAM,MAAM,6rBAyBV,CAAC;AAEH,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../src/select/parts/filter.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAsB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,MAAM,WAAW,WAAY,SAAQ,kBAAkB;IACrD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC,aAAa,EAAE,WAAW,CAAC,aAAa,CAAC;CAC1C;AAED,QAAA,MAAM,MAAM,4sBAyBV,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/textarea/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAS7C,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,QAAA,MAAM,QAAQ,yFAwEb,CAAC;AAGF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/textarea/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAS7C,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,QAAA,MAAM,QAAQ,yFA0Eb,CAAC;AAGF,eAAe,QAAQ,CAAC"}
package/textarea/index.js CHANGED
@@ -13,7 +13,7 @@ import useBaseComponent from '../internal/hooks/use-base-component';
13
13
  import { convertAutoComplete } from '../input/utils';
14
14
  var Textarea = React.forwardRef(function (_a, ref) {
15
15
  var _b;
16
- var value = _a.value, _c = _a.autoComplete, autoComplete = _c === void 0 ? true : _c, disabled = _a.disabled, readOnly = _a.readOnly, disableBrowserAutocorrect = _a.disableBrowserAutocorrect, disableBrowserSpellcheck = _a.disableBrowserSpellcheck, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, ariaRequired = _a.ariaRequired, name = _a.name, rows = _a.rows, placeholder = _a.placeholder, autoFocus = _a.autoFocus, ariaLabel = _a.ariaLabel, rest = __rest(_a, ["value", "autoComplete", "disabled", "readOnly", "disableBrowserAutocorrect", "disableBrowserSpellcheck", "onKeyDown", "onKeyUp", "onChange", "onBlur", "onFocus", "ariaRequired", "name", "rows", "placeholder", "autoFocus", "ariaLabel"]);
16
+ var value = _a.value, _c = _a.autoComplete, autoComplete = _c === void 0 ? true : _c, disabled = _a.disabled, readOnly = _a.readOnly, disableBrowserAutocorrect = _a.disableBrowserAutocorrect, disableBrowserSpellcheck = _a.disableBrowserSpellcheck, spellcheck = _a.spellcheck, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, ariaRequired = _a.ariaRequired, name = _a.name, rows = _a.rows, placeholder = _a.placeholder, autoFocus = _a.autoFocus, ariaLabel = _a.ariaLabel, rest = __rest(_a, ["value", "autoComplete", "disabled", "readOnly", "disableBrowserAutocorrect", "disableBrowserSpellcheck", "spellcheck", "onKeyDown", "onKeyUp", "onChange", "onBlur", "onFocus", "ariaRequired", "name", "rows", "placeholder", "autoFocus", "ariaLabel"]);
17
17
  var __internalRootRef = useBaseComponent('Textarea').__internalRootRef;
18
18
  var _d = useFormFieldContext(rest), ariaLabelledby = _d.ariaLabelledby, ariaDescribedby = _d.ariaDescribedby, controlId = _d.controlId, invalid = _d.invalid;
19
19
  var baseProps = getBaseProps(rest);
@@ -33,6 +33,7 @@ var Textarea = React.forwardRef(function (_a, ref) {
33
33
  _b[styles['textarea-invalid']] = invalid,
34
34
  _b)),
35
35
  autoComplete: convertAutoComplete(autoComplete),
36
+ spellCheck: spellcheck,
36
37
  disabled: disabled,
37
38
  readOnly: readOnly ? true : undefined,
38
39
  rows: rows || 3,
@@ -52,7 +53,7 @@ var Textarea = React.forwardRef(function (_a, ref) {
52
53
  attributes.spellCheck = 'false';
53
54
  }
54
55
  return (React.createElement("span", __assign({}, baseProps, { className: clsx(styles.root, baseProps.className), ref: __internalRootRef }),
55
- React.createElement("textarea", __assign({ ref: textareaRef, id: controlId }, attributes, { spellCheck: false }))));
56
+ React.createElement("textarea", __assign({ ref: textareaRef, id: controlId }, attributes))));
56
57
  });
57
58
  applyDisplayName(Textarea, 'Textarea');
58
59
  export default Textarea;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/textarea/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAO,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAIrD,IAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAC/B,UACE,EAmBgB,EAChB,GAA2B;;IAnBzB,IAAA,KAAK,WAAA,EACL,oBAAmB,EAAnB,YAAY,mBAAG,IAAI,KAAA,EACnB,QAAQ,cAAA,EACR,QAAQ,cAAA,EACR,yBAAyB,+BAAA,EACzB,wBAAwB,8BAAA,EACxB,SAAS,eAAA,EACT,OAAO,aAAA,E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, { Ref, useRef } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireKeyboardEvent, fireNonCancelableEvent } from '../internal/events';\nimport { TextareaProps } from './interfaces';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { convertAutoComplete } from '../input/utils';\n\nexport { TextareaProps };\n\nconst Textarea = React.forwardRef(\n (\n {\n value,\n autoComplete = true,\n disabled,\n readOnly,\n disableBrowserAutocorrect,\n disableBrowserSpellcheck,\n onKeyDown,\n onKeyUp,\n onChange,\n onBlur,\n onFocus,\n ariaRequired,\n name,\n rows,\n placeholder,\n autoFocus,\n ariaLabel,\n ...rest\n }: TextareaProps,\n ref: Ref<TextareaProps.Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('Textarea');\n const { ariaLabelledby, ariaDescribedby, controlId, invalid } = useFormFieldContext(rest);\n const baseProps = getBaseProps(rest);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n useForwardFocus(ref, textareaRef);\n\n const attributes: React.TextareaHTMLAttributes<HTMLTextAreaElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-required': ariaRequired ? 'true' : undefined,\n 'aria-invalid': invalid ? 'true' : undefined,\n name,\n placeholder,\n autoFocus,\n className: clsx(styles.textarea, {\n [styles['textarea-readonly']]: readOnly,\n [styles['textarea-invalid']]: invalid,\n }),\n autoComplete: convertAutoComplete(autoComplete),\n disabled,\n readOnly: readOnly ? true : undefined,\n rows: rows || 3,\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 => fireNonCancelableEvent(onChange, { value: event.target.value })),\n onBlur: onBlur && (() => fireNonCancelableEvent(onBlur)),\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n };\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n if (disableBrowserSpellcheck) {\n attributes.spellCheck = 'false';\n }\n\n return (\n <span {...baseProps} className={clsx(styles.root, baseProps.className)} ref={__internalRootRef}>\n <textarea ref={textareaRef} id={controlId} {...attributes} spellCheck={false} />\n </span>\n );\n }\n);\n\napplyDisplayName(Textarea, 'Textarea');\nexport default Textarea;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/textarea/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAO,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAIrD,IAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAC/B,UACE,EAoBgB,EAChB,GAA2B;;IApBzB,IAAA,KAAK,WAAA,EACL,oBAAmB,EAAnB,YAAY,mBAAG,IAAI,KAAA,EACnB,QAAQ,cAAA,EACR,QAAQ,cAAA,EACR,yBAAyB,+BAAA,EACzB,wBAAwB,8BAAA,EACxB,UAAU,gBA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reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useRef } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireKeyboardEvent, fireNonCancelableEvent } from '../internal/events';\nimport { TextareaProps } from './interfaces';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { convertAutoComplete } from '../input/utils';\n\nexport { TextareaProps };\n\nconst Textarea = React.forwardRef(\n (\n {\n value,\n autoComplete = true,\n disabled,\n readOnly,\n disableBrowserAutocorrect,\n disableBrowserSpellcheck,\n spellcheck,\n onKeyDown,\n onKeyUp,\n onChange,\n onBlur,\n onFocus,\n ariaRequired,\n name,\n rows,\n placeholder,\n autoFocus,\n ariaLabel,\n ...rest\n }: TextareaProps,\n ref: Ref<TextareaProps.Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('Textarea');\n const { ariaLabelledby, ariaDescribedby, controlId, invalid } = useFormFieldContext(rest);\n const baseProps = getBaseProps(rest);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n useForwardFocus(ref, textareaRef);\n\n const attributes: React.TextareaHTMLAttributes<HTMLTextAreaElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-required': ariaRequired ? 'true' : undefined,\n 'aria-invalid': invalid ? 'true' : undefined,\n name,\n placeholder,\n autoFocus,\n className: clsx(styles.textarea, {\n [styles['textarea-readonly']]: readOnly,\n [styles['textarea-invalid']]: invalid,\n }),\n autoComplete: convertAutoComplete(autoComplete),\n spellCheck: spellcheck,\n disabled,\n readOnly: readOnly ? true : undefined,\n rows: rows || 3,\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 => fireNonCancelableEvent(onChange, { value: event.target.value })),\n onBlur: onBlur && (() => fireNonCancelableEvent(onBlur)),\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n };\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n if (disableBrowserSpellcheck) {\n attributes.spellCheck = 'false';\n }\n\n return (\n <span {...baseProps} className={clsx(styles.root, baseProps.className)} ref={__internalRootRef}>\n <textarea ref={textareaRef} id={controlId} {...attributes} />\n </span>\n );\n }\n);\n\napplyDisplayName(Textarea, 'Textarea');\nexport default Textarea;\n"]}
@@ -1,8 +1,8 @@
1
1
  import { BaseComponentProps } from '../internal/base-component';
2
2
  import { BaseKeyDetail } from '../internal/events';
3
3
  import { FormFieldValidationControlProps } from '../internal/context/form-field-context';
4
- import { BaseInputProps, InputAutoCorrect, InputAutoComplete, InputKeyEvents } from '../input/interfaces';
5
- export interface TextareaProps extends BaseInputProps, InputKeyEvents, InputAutoCorrect, InputAutoComplete, BaseComponentProps, FormFieldValidationControlProps {
4
+ import { BaseInputProps, InputAutoCorrect, InputAutoComplete, InputKeyEvents, InputSpellcheck } from '../input/interfaces';
5
+ export interface TextareaProps extends BaseInputProps, InputKeyEvents, InputAutoCorrect, InputAutoComplete, InputSpellcheck, BaseComponentProps, FormFieldValidationControlProps {
6
6
  /**
7
7
  * Specifies the number of lines of text to set the height to.
8
8
  */
@@ -13,6 +13,9 @@ export interface TextareaProps extends BaseInputProps, InputKeyEvents, InputAuto
13
13
  * that checks for spelling/grammar errors.
14
14
  * If you don't set it, the behavior follows the default behavior
15
15
  * of the user's browser.
16
+ *
17
+ * This property is deprecated. Use the `spellcheck` property instead.
18
+ * @deprecated
16
19
  */
17
20
  disableBrowserSpellcheck?: boolean;
18
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/textarea/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1G,MAAM,WAAW,aACf,SAAQ,cAAc,EACpB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,+BAA+B;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;OAMG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,yBAAiB,aAAa,CAAC;IAC7B,KAAY,SAAS,GAAG,aAAa,CAAC;IAEtC,UAAiB,YAAY;QAC3B;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;KACf;IACD,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/textarea/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,aACf,SAAQ,cAAc,EACpB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,+BAA+B;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;;;;OASG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,yBAAiB,aAAa,CAAC;IAC7B,KAAY,SAAS,GAAG,aAAa,CAAC;IAEtC,UAAiB,YAAY;QAC3B;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;KACf;IACD,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/textarea/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 { BaseKeyDetail } from '../internal/events';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { BaseInputProps, InputAutoCorrect, InputAutoComplete, InputKeyEvents } from '../input/interfaces';\n\nexport interface TextareaProps\n extends BaseInputProps,\n InputKeyEvents,\n InputAutoCorrect,\n InputAutoComplete,\n BaseComponentProps,\n FormFieldValidationControlProps {\n /**\n * Specifies the number of lines of text to set the height to.\n */\n rows?: number;\n\n /**\n * Specifies whether to disable browser spellcheck feature.\n * If you set this to `true`, it disables native browser capability\n * that checks for spelling/grammar errors.\n * If you don't set it, the behavior follows the default behavior\n * of the user's browser.\n */\n disableBrowserSpellcheck?: boolean;\n}\n\nexport namespace TextareaProps {\n export type KeyDetail = BaseKeyDetail;\n\n export interface ChangeDetail {\n /**\n * The new value of this textarea.\n */\n value: string;\n }\n export interface Ref {\n /**\n * Sets input focus on the textarea control.\n */\n focus(): void;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/textarea/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 { BaseKeyDetail } from '../internal/events';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport {\n BaseInputProps,\n InputAutoCorrect,\n InputAutoComplete,\n InputKeyEvents,\n InputSpellcheck,\n} from '../input/interfaces';\n\nexport interface TextareaProps\n extends BaseInputProps,\n InputKeyEvents,\n InputAutoCorrect,\n InputAutoComplete,\n InputSpellcheck,\n BaseComponentProps,\n FormFieldValidationControlProps {\n /**\n * Specifies the number of lines of text to set the height to.\n */\n rows?: number;\n\n /**\n * Specifies whether to disable browser spellcheck feature.\n * If you set this to `true`, it disables native browser capability\n * that checks for spelling/grammar errors.\n * If you don't set it, the behavior follows the default behavior\n * of the user's browser.\n *\n * This property is deprecated. Use the `spellcheck` property instead.\n * @deprecated\n */\n disableBrowserSpellcheck?: boolean;\n}\n\nexport namespace TextareaProps {\n export type KeyDetail = BaseKeyDetail;\n\n export interface ChangeDetail {\n /**\n * The new value of this textarea.\n */\n value: string;\n }\n export interface Ref {\n /**\n * Sets input focus on the textarea control.\n */\n focus(): void;\n }\n}\n"]}
package/manifest.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "commit": "e65a1510adf94cbf7bbf5ef788a1801b61e9eb8b"
3
- }