Skip to content

Commit b47fa98

Browse files
committed
feat(input-otp): support autocapitalize
1 parent a968721 commit b47fa98

File tree

7 files changed

+23
-5
lines changed

7 files changed

+23
-5
lines changed

core/api.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,7 @@ ion-input,css-prop,--placeholder-opacity,ios
781781
ion-input,css-prop,--placeholder-opacity,md
782782

783783
ion-input-otp,scoped
784+
ion-input-otp,prop,autocapitalize,string,'off',false,false
784785
ion-input-otp,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record<never, never> | undefined,undefined,false,true
785786
ion-input-otp,prop,disabled,boolean,false,false,true
786787
ion-input-otp,prop,fill,"outline" | "solid" | undefined,'outline',false,false

core/src/components.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,10 @@ export namespace Components {
13221322
"value"?: string | number | null;
13231323
}
13241324
interface IonInputOtp {
1325+
/**
1326+
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user. Available options: `"off"`, `"none"`, `"on"`, `"sentences"`, `"words"`, `"characters"`.
1327+
*/
1328+
"autocapitalize": string;
13251329
/**
13261330
* The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics).
13271331
*/
@@ -6266,6 +6270,10 @@ declare namespace LocalJSX {
62666270
"value"?: string | number | null;
62676271
}
62686272
interface IonInputOtp {
6273+
/**
6274+
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user. Available options: `"off"`, `"none"`, `"on"`, `"sentences"`, `"words"`, `"characters"`.
6275+
*/
6276+
"autocapitalize"?: string;
62696277
/**
62706278
* The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics).
62716279
*/

core/src/components/input-otp/input-otp.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ export class InputOTP implements ComponentInterface {
4444
@State() private inputValues: string[] = [];
4545
@State() hasFocus = false;
4646

47+
/**
48+
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
49+
* Available options: `"off"`, `"none"`, `"on"`, `"sentences"`, `"words"`, `"characters"`.
50+
*/
51+
@Prop() autocapitalize = 'off';
52+
4753
/**
4854
* The color to use from your application's color palette.
4955
* Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
@@ -693,6 +699,7 @@ export class InputOTP implements ComponentInterface {
693699

694700
render() {
695701
const {
702+
autocapitalize,
696703
color,
697704
disabled,
698705
fill,
@@ -732,6 +739,7 @@ export class InputOTP implements ComponentInterface {
732739
id={`${inputId}-${index}`}
733740
aria-label={`Input ${index + 1} of ${length}`}
734741
type="text"
742+
autoCapitalize={autocapitalize}
735743
inputmode={inputmode}
736744
maxLength={1}
737745
pattern={pattern || (type === 'number' ? '[0-9]' : '[a-zA-Z0-9]')}

core/src/components/input-otp/test/basic/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ <h2>Types</h2>
6060
<ion-input-otp class="input-otp-type" type="text" pattern="[a-fA-F]">
6161
Custom Pattern: a-f and A-F <span id="value"></span>
6262
</ion-input-otp>
63-
<ion-input-otp class="input-otp-type" type="text" pattern="[D-L]">
63+
<ion-input-otp class="input-otp-type" type="text" pattern="[D-L]" autocapitalize="on">
6464
Custom Pattern: D-L <span id="value"></span>
6565
</ion-input-otp>
6666
</div>

packages/angular/src/directives/proxies.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,15 +1018,15 @@ This event will not emit when programmatically setting the `value` property.
10181018

10191019

10201020
@ProxyCmp({
1021-
inputs: ['color', 'disabled', 'fill', 'inputmode', 'length', 'pattern', 'readonly', 'separators', 'shape', 'size', 'type', 'value'],
1021+
inputs: ['autocapitalize', 'color', 'disabled', 'fill', 'inputmode', 'length', 'pattern', 'readonly', 'separators', 'shape', 'size', 'type', 'value'],
10221022
methods: ['reset', 'setFocus']
10231023
})
10241024
@Component({
10251025
selector: 'ion-input-otp',
10261026
changeDetection: ChangeDetectionStrategy.OnPush,
10271027
template: '<ng-content></ng-content>',
10281028
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
1029-
inputs: ['color', 'disabled', 'fill', 'inputmode', 'length', 'pattern', 'readonly', 'separators', 'shape', 'size', 'type', 'value'],
1029+
inputs: ['autocapitalize', 'color', 'disabled', 'fill', 'inputmode', 'length', 'pattern', 'readonly', 'separators', 'shape', 'size', 'type', 'value'],
10301030
})
10311031
export class IonInputOtp {
10321032
protected el: HTMLIonInputOtpElement;

packages/angular/standalone/src/directives/proxies.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -984,15 +984,15 @@ export declare interface IonInfiniteScrollContent extends Components.IonInfinite
984984

985985
@ProxyCmp({
986986
defineCustomElementFn: defineIonInputOtp,
987-
inputs: ['color', 'disabled', 'fill', 'inputmode', 'length', 'pattern', 'readonly', 'separators', 'shape', 'size', 'type', 'value'],
987+
inputs: ['autocapitalize', 'color', 'disabled', 'fill', 'inputmode', 'length', 'pattern', 'readonly', 'separators', 'shape', 'size', 'type', 'value'],
988988
methods: ['reset', 'setFocus']
989989
})
990990
@Component({
991991
selector: 'ion-input-otp',
992992
changeDetection: ChangeDetectionStrategy.OnPush,
993993
template: '<ng-content></ng-content>',
994994
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
995-
inputs: ['color', 'disabled', 'fill', 'inputmode', 'length', 'pattern', 'readonly', 'separators', 'shape', 'size', 'type', 'value'],
995+
inputs: ['autocapitalize', 'color', 'disabled', 'fill', 'inputmode', 'length', 'pattern', 'readonly', 'separators', 'shape', 'size', 'type', 'value'],
996996
standalone: true
997997
})
998998
export class IonInputOtp {

packages/vue/src/proxies.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ export const IonInput: StencilVueComponent<JSX.IonInput, JSX.IonInput["value"]>
493493

494494

495495
export const IonInputOtp: StencilVueComponent<JSX.IonInputOtp> = /*@__PURE__*/ defineContainer<JSX.IonInputOtp>('ion-input-otp', defineIonInputOtp, [
496+
'autocapitalize',
496497
'color',
497498
'disabled',
498499
'fill',

0 commit comments

Comments
 (0)