Skip to content

Commit e9cddfa

Browse files
authored
Merge branch 'master' into igniteui-webcomponents-1441
2 parents fb23b6f + df67212 commit e9cddfa

File tree

4 files changed

+70
-39
lines changed

4 files changed

+70
-39
lines changed

src/components/avatar/themes/shared/avatar.common.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ $theme: $material;
55

66
:host {
77
--component-size: var(--ig-size, #{var-get($theme, 'default-size')});
8+
9+
::slotted(igc-icon) {
10+
--ig-size: 3;
11+
12+
color: var-get($theme, 'icon-color');
13+
}
814
}
915

1016
[part='base'] {

src/components/avatar/themes/shared/avatar.indigo.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@ $theme: $indigo;
88

99
::slotted(igc-icon) {
1010
--ig-size: 1;
11-
12-
color: var-get($theme, 'icon-color');
1311
}
1412
}

stories/avatar.stories.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import type { Meta, StoryObj } from '@storybook/web-components';
22

3-
import { IgcAvatarComponent, defineComponents } from 'igniteui-webcomponents';
3+
import {
4+
IgcAvatarComponent,
5+
IgcIconComponent,
6+
defineComponents,
7+
registerIcon,
8+
} from 'igniteui-webcomponents';
9+
import { html } from 'lit';
410

5-
defineComponents(IgcAvatarComponent);
11+
defineComponents(IgcAvatarComponent, IgcIconComponent);
612

713
// region default
814
const metadata: Meta<IgcAvatarComponent> = {
@@ -57,6 +63,11 @@ interface IgcAvatarArgs {
5763
}
5864
type Story = StoryObj<IgcAvatarArgs>;
5965

66+
registerIcon(
67+
'home',
68+
'https://unpkg.com/[email protected]/action/svg/production/ic_home_24px.svg'
69+
);
70+
6071
// endregion
6172

6273
export const Image: Story = {
@@ -66,6 +77,14 @@ export const Image: Story = {
6677
},
6778
};
6879

80+
export const WithIcon: Story = {
81+
render: () => html`
82+
<igc-avatar>
83+
<igc-icon name="home"></igc-icon>
84+
</igc-avatar>
85+
`,
86+
};
87+
6988
export const WithInitials: Story = {
7089
args: {
7190
initials: 'RK',

stories/stepper.stories.ts

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { html } from 'lit';
44
import {
55
IgcButtonComponent,
66
IgcInputComponent,
7+
type IgcStepComponent,
78
IgcStepperComponent,
89
defineComponents,
910
} from 'igniteui-webcomponents';
@@ -122,19 +123,35 @@ const BasicTemplate = ({
122123
verticalAnimation,
123124
horizontalAnimation,
124125
}: IgcStepperArgs) => {
125-
const next = () => {
126+
document.addEventListener('DOMContentLoaded', () => {
126127
const stepper = document.getElementById('stepper') as IgcStepperComponent;
127-
stepper.next();
128-
};
129128

130-
const prev = () => {
129+
stepper.addEventListener('igcInput', () => {
130+
checkValidity();
131+
});
132+
stepper.addEventListener('igcChange', () => {
133+
checkValidity();
134+
});
135+
});
136+
137+
function checkValidity() {
131138
const stepper = document.getElementById('stepper') as IgcStepperComponent;
132-
stepper.prev();
133-
};
139+
const activeStep = stepper.steps.find(
140+
(step) => step.active
141+
) as IgcStepComponent;
142+
const form = activeStep!.querySelector('form') as HTMLFormElement;
143+
const isFormInvalid = !form.checkValidity();
134144

135-
return html`
136-
<span>test content top</span>
145+
if (activeStep!.optional) {
146+
return;
147+
}
148+
149+
if (stepper.linear) {
150+
activeStep!.invalid = isFormInvalid;
151+
}
152+
}
137153

154+
return html`
138155
<igc-stepper
139156
id="stepper"
140157
.orientation=${orientation}
@@ -146,31 +163,28 @@ const BasicTemplate = ({
146163
.verticalAnimation=${verticalAnimation}
147164
.horizontalAnimation=${horizontalAnimation}
148165
>
149-
<igc-step complete>
166+
<igc-step invalid>
150167
<span slot="title">Step1</span>
151-
<span slot="subtitle">(completed)</span>
152-
<igc-input
153-
label="First Name"
154-
id="first-name"
155-
name="first-name"
156-
required
157-
></igc-input>
158-
<br /><br />
159-
<igc-button @click=${next}>Next</igc-button>
168+
<form id="form">
169+
<igc-input
170+
label="First Name"
171+
id="first-name"
172+
name="first-name"
173+
required
174+
></igc-input>
175+
</form>
160176
</igc-step>
161177
162-
<igc-step active>
178+
<igc-step invalid>
163179
<span slot="title">Step 2</span>
164-
<span slot="subtitle">(default)</span>
165-
<igc-input
166-
label="Last Name"
167-
id="last-name"
168-
name="last-name"
169-
required
170-
></igc-input>
171-
<br /><br />
172-
<igc-button @click=${prev}>Prev</igc-button>
173-
<igc-button @click=${next}>Next</igc-button>
180+
<form id="form">
181+
<igc-input
182+
label="Last Name"
183+
id="last-name"
184+
name="last-name"
185+
required
186+
></igc-input>
187+
</form>
174188
</igc-step>
175189
176190
<igc-step optional>
@@ -180,9 +194,6 @@ const BasicTemplate = ({
180194
soluta nulla asperiores, officia ullam recusandae voluptatem omnis
181195
perferendis vitae non magni magnam praesentium placeat nemo quas
182196
repudiandae. Nisi, quo ex!
183-
<br /><br />
184-
<igc-button @click=${prev}>Prev</igc-button>
185-
<igc-button @click=${next}>Next</igc-button>
186197
</igc-step>
187198
188199
<igc-step disabled>
@@ -197,11 +208,8 @@ const BasicTemplate = ({
197208
repudiandae. Nisi, quo ex!
198209
</div>
199210
<br />
200-
<igc-button @click=${prev}>Prev</igc-button>
201211
</igc-step>
202212
</igc-stepper>
203-
204-
<span>test content bottom</span>
205213
`;
206214
};
207215

0 commit comments

Comments
 (0)