Skip to content

Commit ceb1a3d

Browse files
- add fill solid to ionic theme input;
- move input.outline.scss to input.ionic.scss; - add fill solid to states page;
1 parent f7a2d34 commit ceb1a3d

File tree

5 files changed

+283
-148
lines changed

5 files changed

+283
-148
lines changed

core/src/components/input/input.ionic.outline.scss

Lines changed: 0 additions & 142 deletions
This file was deleted.

core/src/components/input/input.ionic.scss

Lines changed: 134 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,128 @@
11
@use "../../themes/ionic/ionic.globals.scss" as globals;
22
@use "./input.common";
3-
@forward "./input.ionic.outline.scss";
4-
3+
@forward "./input.ionic.solid.scss";
54
// Ionic Input
65
// --------------------------------------------------
76

87
:host {
98
--color: #{globals.$ion-primitives-neutral-1200};
109
--border-width: #{globals.$ion-border-size-025};
1110
--border-color: #{globals.$ion-primitives-neutral-500};
11+
--border-radius: #{globals.$ion-border-radius-100};
1212
--highlight-color-valid: #{globals.$ion-semantics-success-900};
13-
--highlight-color-invalid: #{globals.$ion-semantics-danger-800};
13+
--highlight-color-invalid: #{globals.$ion-border-danger-default};
14+
--padding-start: #{globals.$ion-space-300};
15+
--padding-end: #{globals.$ion-space-300};
1416
--placeholder-color: #{globals.$ion-primitives-neutral-800};
1517
--placeholder-opacity: 1;
1618
--background: #{globals.$ion-primitives-base-white};
1719

1820
@include globals.typography(globals.$ion-body-md-regular);
1921
}
2022

23+
// Input Outline Container
24+
// ----------------------------------------------------------------
25+
26+
.input-outline {
27+
@include globals.position(0, 0, 0, 0);
28+
@include globals.border-radius(var(--border-radius));
29+
30+
position: absolute;
31+
32+
width: 100%;
33+
height: 100%;
34+
35+
pointer-events: none;
36+
37+
border: var(--border-width) var(--border-style) var(--border-color);
38+
}
39+
40+
// Input Label Placement: Stacked
41+
// ----------------------------------------------------------------
42+
43+
// This makes the label sit above the input.
44+
:host(.label-floating.input-label-placement-stacked) .label-text-wrapper {
45+
@include globals.margin(0);
46+
@include globals.padding(globals.$ion-space-100, null);
47+
}
48+
49+
.input-wrapper {
50+
/**
51+
* For the ionic theme, the padding needs to sit on the
52+
* native wrapper instead, so that it sits within the
53+
* outline container but does not always affect the
54+
* label text.
55+
*/
56+
@include globals.padding(0);
57+
58+
/**
59+
* Outline inputs do not have a bottom border.
60+
* Instead, they have a border that wraps the
61+
* input + label.
62+
*/
63+
border-bottom: none;
64+
65+
/**
66+
* Do not show a background on the input wrapper as
67+
* this includes the label, instead we apply the
68+
* background to the native wrapper.
69+
*/
70+
background: transparent;
71+
}
72+
73+
.label-text-wrapper {
74+
/**
75+
* The label should appear on top of an outline
76+
* container that overlaps it so it is always clickable.
77+
*/
78+
position: relative;
79+
}
80+
81+
:host(.input-label-placement-stacked) .label-text-wrapper {
82+
@include globals.transform-origin(start, top);
83+
84+
/**
85+
* Label text should not extend
86+
* beyond the bounds of the input.
87+
*/
88+
max-width: calc(100% - var(--padding-start) - var(--padding-end));
89+
}
90+
91+
/**
92+
* The bottom content should never have
93+
* a border with the outline style.
94+
*/
95+
.input-bottom {
96+
border-top: none;
97+
}
98+
99+
.native-wrapper {
100+
@include globals.border-radius(inherit);
101+
@include globals.padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start));
102+
103+
min-height: globals.$ion-scale-1000;
104+
105+
/**
106+
* Apply the background to the native input
107+
* wrapper to only style the input.
108+
*/
109+
background: var(--background);
110+
}
111+
112+
21113
// Ionic Input Sizes
22114
// --------------------------------------------------
23115

116+
:host(.input-size-large) {
117+
--padding-start: #{globals.$ion-space-400};
118+
--padding-end: #{globals.$ion-space-400};
119+
}
120+
121+
:host(.input-size-xlarge) {
122+
--padding-start: #{globals.$ion-space-500};
123+
--padding-end: #{globals.$ion-space-500};
124+
}
125+
24126
:host(.input-size-medium) .native-wrapper {
25127
min-height: globals.$ion-scale-1000;
26128
}
@@ -33,6 +135,21 @@
33135
min-height: globals.$ion-scale-1400;
34136
}
35137

138+
// Input Shapes
139+
// --------------------------------------------------
140+
141+
:host(.input-shape-soft) {
142+
--border-radius: #{globals.$ion-border-radius-200};
143+
}
144+
145+
:host(.input-shape-round) {
146+
--border-radius: #{globals.$ion-border-radius-400};
147+
}
148+
149+
:host(.input-shape-rectangular) {
150+
--border-radius: #{globals.$ion-border-radius-0};
151+
}
152+
36153
// Ionic Input Password Toggle Sizes
37154
// --------------------------------------------------
38155

@@ -50,7 +167,8 @@
50167

51168
// Target area
52169
// --------------------------------------------------
53-
:host .native-wrapper::after {
170+
171+
.native-wrapper::after {
54172
@include globals.position(50%, 0, null, 0);
55173

56174
position: absolute;
@@ -78,6 +196,17 @@
78196
z-index: 2;
79197
}
80198

199+
// Start/End Slots
200+
// ----------------------------------------------------------------
201+
202+
::slotted([slot="start"]) {
203+
margin-inline-end: globals.$ion-space-200;
204+
}
205+
206+
::slotted([slot="end"]) {
207+
margin-inline-start: globals.$ion-space-200;
208+
}
209+
81210
// Input Clear Button
82211
// ----------------------------------------------------------------
83212

@@ -225,6 +354,7 @@
225354

226355
:host(.has-focus) {
227356
--border-color: #{globals.$ion-border-focus-default};
357+
--border-width: #{globals.$ion-border-size-050};
228358
}
229359

230360
:host(.has-focus) .input-highlight {
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
@use "../../themes/ionic/ionic.globals.scss" as globals;
2+
// Input Fill: Solid
3+
// ----------------------------------------------------------------
4+
5+
:host(.input-fill-solid) {
6+
--background: #{globals.$ion-bg-input-bold-default};
7+
--border-color: #{globals.$ion-bg-input-bold-default};
8+
}
9+
10+
/**
11+
* If the input has a validity state, the
12+
* border should reflect that as a color.
13+
*/
14+
:host(.has-focus.input-fill-solid.ion-valid) .native-wrapper,
15+
:host(.input-fill-solid.ion-touched.ion-invalid) .native-wrapper{
16+
--border-color: var(--highlight-color);
17+
}
18+
19+
/**
20+
* Background and border should be
21+
* slightly darker on hover.
22+
*/
23+
@media (any-hover: hover) {
24+
:host(:hover){
25+
--border-color: #{globals.$ion-border-focus-default};
26+
}
27+
}
28+
29+
// Input - Disabled
30+
// ----------------------------------------------------------------
31+
32+
:host(.input-fill-solid.input-disabled){
33+
--background: #{globals.$ion-bg-input-bold-disabled};
34+
--placeholder-color: #{globals.$ion-text-disabled};
35+
}
36+
37+
// Input - Readonly
38+
// ----------------------------------------------------------------
39+
40+
:host(.input-fill-solid.input-readonly) {
41+
--background: #{globals.$ion-bg-input-bold-read-only};
42+
--border-color: #{globals.$ion-bg-input-bold-read-only};
43+
}
44+
45+
/**
46+
* Background and border should be
47+
* much darker on focus.
48+
*/
49+
:host(.input-fill-solid.has-focus){
50+
--border-color: #{globals.$ion-border-focus-default};
51+
}

0 commit comments

Comments
 (0)