Skip to content

Commit 1e2eb9d

Browse files
committed
Create type for autocapitalize propertie of input and textarea
Fix #21463. Change none to off in textarea for coherence. Didn't use parenthese like in AutocompleteTypes.
1 parent 698e526 commit 1e2eb9d

File tree

7 files changed

+15
-13
lines changed

7 files changed

+15
-13
lines changed

core/api.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ ion-infinite-scroll-content,prop,loadingText,IonicSafeString | string | undefine
442442

443443
ion-input,scoped
444444
ion-input,prop,accept,string | undefined,undefined,false,false
445-
ion-input,prop,autocapitalize,string,'off',false,false
445+
ion-input,prop,autocapitalize,"characters" | "none" | "off" | "on" | "sentences" | "words",'off',false,false
446446
ion-input,prop,autocomplete,"on" | "off" | "name" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "email" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "url" | "photo",'off',false,false
447447
ion-input,prop,autocorrect,"off" | "on",'off',false,false
448448
ion-input,prop,autofocus,boolean,false,false,false
@@ -1188,7 +1188,7 @@ ion-text,prop,mode,"ios" | "md",undefined,false,false
11881188

11891189
ion-textarea,scoped
11901190
ion-textarea,prop,autoGrow,boolean,false,false,false
1191-
ion-textarea,prop,autocapitalize,string,'none',false,false
1191+
ion-textarea,prop,autocapitalize,"characters" | "none" | "off" | "on" | "sentences" | "words",'off',false,false
11921192
ion-textarea,prop,autofocus,boolean,false,false,false
11931193
ion-textarea,prop,clearOnEdit,boolean,false,false,false
11941194
ion-textarea,prop,color,string | undefined,undefined,false,false

core/src/components.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* It contains typing information for all components that exist in this project.
66
*/
77
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
8-
import { ActionSheetButton, AlertButton, AlertInput, AnimationBuilder, AutocompleteTypes, CheckboxChangeEventDetail, Color, ComponentProps, ComponentRef, DatetimeChangeEventDetail, DatetimeOptions, DomRenderFn, FooterHeightFn, FrameworkDelegate, HeaderFn, HeaderHeightFn, InputChangeEventDetail, ItemHeightFn, ItemRenderFn, ItemReorderEventDetail, MenuChangeEventDetail, NavComponent, NavOptions, OverlayEventDetail, PickerButton, PickerColumn, RadioGroupChangeEventDetail, RangeChangeEventDetail, RangeValue, RefresherEventDetail, RouteID, RouterDirection, RouterEventDetail, RouterOutletOptions, RouteWrite, ScrollBaseDetail, ScrollDetail, SearchbarChangeEventDetail, SegmentButtonLayout, SegmentChangeEventDetail, SelectChangeEventDetail, SelectInterface, SelectPopoverOption, Side, SpinnerTypes, StyleEventDetail, SwipeGestureHandler, TabBarChangedEventDetail, TabButtonClickEventDetail, TabButtonLayout, TextareaChangeEventDetail, TextFieldTypes, ToastButton, ToggleChangeEventDetail, TransitionDoneFn, TransitionInstruction, ViewController, } from "./interface";
8+
import { ActionSheetButton, AlertButton, AlertInput, AnimationBuilder, AutocapitalizeTypes, AutocompleteTypes, CheckboxChangeEventDetail, Color, ComponentProps, ComponentRef, DatetimeChangeEventDetail, DatetimeOptions, DomRenderFn, FooterHeightFn, FrameworkDelegate, HeaderFn, HeaderHeightFn, InputChangeEventDetail, ItemHeightFn, ItemRenderFn, ItemReorderEventDetail, MenuChangeEventDetail, NavComponent, NavOptions, OverlayEventDetail, PickerButton, PickerColumn, RadioGroupChangeEventDetail, RangeChangeEventDetail, RangeValue, RefresherEventDetail, RouteID, RouterDirection, RouterEventDetail, RouterOutletOptions, RouteWrite, ScrollBaseDetail, ScrollDetail, SearchbarChangeEventDetail, SegmentButtonLayout, SegmentChangeEventDetail, SelectChangeEventDetail, SelectInterface, SelectPopoverOption, Side, SpinnerTypes, StyleEventDetail, SwipeGestureHandler, TabBarChangedEventDetail, TabButtonClickEventDetail, TabButtonLayout, TextareaChangeEventDetail, TextFieldTypes, ToastButton, ToggleChangeEventDetail, TransitionDoneFn, TransitionInstruction, ViewController, } from "./interface";
99
import { IonicSafeString, } from "./utils/sanitization";
1010
import { SelectCompareFn, } from "./components/select/select-interface";
1111
export namespace Components {
@@ -831,7 +831,7 @@ export namespace Components {
831831
/**
832832
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
833833
*/
834-
"autocapitalize": string;
834+
"autocapitalize": AutocapitalizeTypes;
835835
/**
836836
* Indicates whether the value of the control can be automatically completed by the browser.
837837
*/
@@ -2390,7 +2390,7 @@ export namespace Components {
23902390
/**
23912391
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
23922392
*/
2393-
"autocapitalize": string;
2393+
"autocapitalize": AutocapitalizeTypes;
23942394
/**
23952395
* This Boolean attribute lets you specify that a form control should have input focus when the page loads.
23962396
*/
@@ -4131,7 +4131,7 @@ declare namespace LocalJSX {
41314131
/**
41324132
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
41334133
*/
4134-
"autocapitalize"?: string;
4134+
"autocapitalize"?: AutocapitalizeTypes;
41354135
/**
41364136
* Indicates whether the value of the control can be automatically completed by the browser.
41374137
*/
@@ -5603,7 +5603,7 @@ declare namespace LocalJSX {
56035603
/**
56045604
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
56055605
*/
5606-
"autocapitalize"?: string;
5606+
"autocapitalize"?: AutocapitalizeTypes;
56075607
/**
56085608
* This Boolean attribute lets you specify that a form control should have input focus when the page loads.
56095609
*/

core/src/components/input/input.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Build, Component, ComponentInterface, Element, Event, EventEmitter, Host, Method, Prop, State, Watch, h } from '@stencil/core';
22

33
import { getIonMode } from '../../global/ionic-global';
4-
import { AutocompleteTypes, Color, InputChangeEventDetail, StyleEventDetail, TextFieldTypes } from '../../interface';
4+
import { AutocapitalizeTypes, AutocompleteTypes, Color, InputChangeEventDetail, StyleEventDetail, TextFieldTypes } from '../../interface';
55
import { debounceEvent, findItemLabel } from '../../utils/helpers';
66
import { createColorClasses } from '../../utils/theme';
77

@@ -42,7 +42,7 @@ export class Input implements ComponentInterface {
4242
/**
4343
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
4444
*/
45-
@Prop() autocapitalize = 'off';
45+
@Prop() autocapitalize: AutocapitalizeTypes = 'off';
4646

4747
/**
4848
* Indicates whether the value of the control can be automatically completed by the browser.

core/src/components/input/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ export class InputExample {
292292
| Property | Attribute | Description | Type | Default |
293293
| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
294294
| `accept` | `accept` | If the value of the type attribute is `"file"`, then this attribute will indicate the types of files that the server accepts, otherwise it will be ignored. The value must be a comma-separated list of unique content type specifiers. | `string \| undefined` | `undefined` |
295-
| `autocapitalize` | `autocapitalize` | Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user. | `string` | `'off'` |
295+
| `autocapitalize` | `autocapitalize` | Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user. | `"characters" \| "none" \| "off" \| "on" \| "sentences" \| "words"` | `'off'` |
296296
| `autocomplete` | `autocomplete` | Indicates whether the value of the control can be automatically completed by the browser. | `"on" \| "off" \| "name" \| "honorific-prefix" \| "given-name" \| "additional-name" \| "family-name" \| "honorific-suffix" \| "nickname" \| "email" \| "username" \| "new-password" \| "current-password" \| "one-time-code" \| "organization-title" \| "organization" \| "street-address" \| "address-line1" \| "address-line2" \| "address-line3" \| "address-level4" \| "address-level3" \| "address-level2" \| "address-level1" \| "country" \| "country-name" \| "postal-code" \| "cc-name" \| "cc-given-name" \| "cc-additional-name" \| "cc-family-name" \| "cc-number" \| "cc-exp" \| "cc-exp-month" \| "cc-exp-year" \| "cc-csc" \| "cc-type" \| "transaction-currency" \| "transaction-amount" \| "language" \| "bday" \| "bday-day" \| "bday-month" \| "bday-year" \| "sex" \| "tel" \| "tel-country-code" \| "tel-national" \| "tel-area-code" \| "tel-local" \| "tel-extension" \| "impp" \| "url" \| "photo"` | `'off'` |
297297
| `autocorrect` | `autocorrect` | Whether auto correction should be enabled when the user is entering/editing the text value. | `"off" \| "on"` | `'off'` |
298298
| `autofocus` | `autofocus` | This Boolean attribute lets you specify that a form control should have input focus when the page loads. | `boolean` | `false` |

0 commit comments

Comments
 (0)