Skip to content

Commit c4743fe

Browse files
committed
fix(input-otp): move separator next to native wrapper to properly collapse input width
1 parent 344c72a commit c4743fe

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
.input-otp-separator {
114114
@include border-radius(var(--separator-border-radius));
115115

116-
flex: 1 0 auto;
116+
flex-shrink: 0;
117117

118118
width: var(--separator-width);
119119
height: var(--separator-height);
@@ -131,8 +131,7 @@
131131
font-size: 0.875em;
132132
}
133133

134-
:host(.input-otp-size-small) .input-otp-group,
135-
:host(.input-otp-size-small) .native-wrapper {
134+
:host(.input-otp-size-small) .input-otp-group {
136135
gap: 8px;
137136
}
138137

@@ -151,9 +150,7 @@
151150
}
152151

153152
:host(.input-otp-size-medium) .input-otp-group,
154-
:host(.input-otp-size-medium) .native-wrapper,
155-
:host(.input-otp-size-large) .input-otp-group,
156-
:host(.input-otp-size-large) .native-wrapper {
153+
:host(.input-otp-size-large) .input-otp-group {
157154
gap: 12px;
158155
}
159156

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ComponentInterface, EventEmitter } from '@stencil/core';
2-
import { Component, Element, Event, Host, Prop, State, h, Watch } from '@stencil/core';
2+
import { Component, Element, Event, Fragment, Host, Prop, State, h, Watch } from '@stencil/core';
33
import { printIonWarning } from '@utils/logging';
44
import { isRTL } from '@utils/rtl';
55
import { createColorClasses } from '@utils/theme';
@@ -683,8 +683,8 @@ export class InputOTP implements ComponentInterface {
683683
})}
684684
>
685685
<div role="group" aria-label="One-time password input" class="input-otp-group">
686-
{Array.from({ length }).map((_, index) => {
687-
return (
686+
{Array.from({ length }).map((_, index) => (
687+
<Fragment>
688688
<div class="native-wrapper">
689689
<input
690690
class="native-input"
@@ -706,10 +706,10 @@ export class InputOTP implements ComponentInterface {
706706
onKeyDown={this.onKeyDown(index)}
707707
onPaste={this.onPaste}
708708
/>
709-
{this.showSeparator(index) && <div class="input-otp-separator" />}
710709
</div>
711-
);
712-
})}
710+
{this.showSeparator(index) && <div class="input-otp-separator" />}
711+
</Fragment>
712+
))}
713713
</div>
714714
<div class="input-otp-description">
715715
<slot></slot>

core/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"assumeChangesOnlyAffectDirectDependencies": true,
1111
"jsx": "react",
1212
"jsxFactory": "h",
13+
"jsxFragmentFactory": "Fragment",
1314
"lib": [
1415
"dom",
1516
"dom.iterable",

0 commit comments

Comments
 (0)