igniteui-webcomponents 7.0.1 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/components/combo/themes/shared/combo.common.css.js +1 -1
- package/components/combo/themes/shared/combo.common.css.js.map +1 -1
- package/components/combo/types.js.map +1 -1
- package/components/common/definitions/defineAllComponents.js +4 -0
- package/components/common/definitions/defineAllComponents.js.map +1 -1
- package/components/common/mixins/forms/form-transformers.js.map +1 -1
- package/components/common/util.d.ts +11 -1
- package/components/common/util.js +3 -0
- package/components/common/util.js.map +1 -1
- package/components/date-picker/date-picker.js.map +1 -1
- package/components/file-input/file-input.js.map +1 -1
- package/components/highlight/highlight.d.ts +130 -0
- package/components/highlight/highlight.js +77 -0
- package/components/highlight/highlight.js.map +1 -0
- package/components/highlight/service.d.ts +58 -0
- package/components/highlight/service.js +132 -0
- package/components/highlight/service.js.map +1 -0
- package/components/highlight/themes/dark/highlight.bootstrap.css.js +3 -0
- package/components/highlight/themes/dark/highlight.bootstrap.css.js.map +1 -0
- package/components/highlight/themes/dark/highlight.fluent.css.d.ts +1 -0
- package/components/highlight/themes/dark/highlight.fluent.css.js +3 -0
- package/components/highlight/themes/dark/highlight.fluent.css.js.map +1 -0
- package/components/highlight/themes/dark/highlight.indigo.css.d.ts +1 -0
- package/components/highlight/themes/dark/highlight.indigo.css.js +3 -0
- package/components/highlight/themes/dark/highlight.indigo.css.js.map +1 -0
- package/components/highlight/themes/dark/highlight.material.css.d.ts +1 -0
- package/components/highlight/themes/dark/highlight.material.css.js +3 -0
- package/components/highlight/themes/dark/highlight.material.css.js.map +1 -0
- package/components/highlight/themes/dark/highlight.shared.css.d.ts +1 -0
- package/components/highlight/themes/dark/highlight.shared.css.js +3 -0
- package/components/highlight/themes/dark/highlight.shared.css.js.map +1 -0
- package/components/highlight/themes/light/highlight.bootstrap.css.d.ts +1 -0
- package/components/highlight/themes/light/highlight.bootstrap.css.js +3 -0
- package/components/highlight/themes/light/highlight.bootstrap.css.js.map +1 -0
- package/components/highlight/themes/light/highlight.fluent.css.d.ts +1 -0
- package/components/highlight/themes/light/highlight.fluent.css.js +3 -0
- package/components/highlight/themes/light/highlight.fluent.css.js.map +1 -0
- package/components/highlight/themes/light/highlight.indigo.css.d.ts +1 -0
- package/components/highlight/themes/light/highlight.indigo.css.js +3 -0
- package/components/highlight/themes/light/highlight.indigo.css.js.map +1 -0
- package/components/highlight/themes/light/highlight.material.css.d.ts +1 -0
- package/components/highlight/themes/light/highlight.material.css.js +3 -0
- package/components/highlight/themes/light/highlight.material.css.js.map +1 -0
- package/components/highlight/themes/light/highlight.shared.css.d.ts +1 -0
- package/components/highlight/themes/light/highlight.shared.css.js +3 -0
- package/components/highlight/themes/light/highlight.shared.css.js.map +1 -0
- package/components/highlight/themes/shared/highlight.common.css.d.ts +1 -0
- package/components/highlight/themes/shared/highlight.common.css.js +3 -0
- package/components/highlight/themes/shared/highlight.common.css.js.map +1 -0
- package/components/highlight/themes/themes.d.ts +2 -0
- package/components/highlight/themes/themes.js +47 -0
- package/components/highlight/themes/themes.js.map +1 -0
- package/components/splitter/splitter.d.ts +240 -0
- package/components/splitter/splitter.js +608 -0
- package/components/splitter/splitter.js.map +1 -0
- package/components/splitter/themes/dark/splitter.bootstrap.css.d.ts +1 -0
- package/components/splitter/themes/dark/splitter.bootstrap.css.js +3 -0
- package/components/splitter/themes/dark/splitter.bootstrap.css.js.map +1 -0
- package/components/splitter/themes/dark/splitter.fluent.css.d.ts +1 -0
- package/components/splitter/themes/dark/splitter.fluent.css.js +3 -0
- package/components/splitter/themes/dark/splitter.fluent.css.js.map +1 -0
- package/components/splitter/themes/dark/splitter.indigo.css.d.ts +1 -0
- package/components/splitter/themes/dark/splitter.indigo.css.js +3 -0
- package/components/splitter/themes/dark/splitter.indigo.css.js.map +1 -0
- package/components/splitter/themes/dark/splitter.material.css.d.ts +1 -0
- package/components/splitter/themes/dark/splitter.material.css.js +3 -0
- package/components/splitter/themes/dark/splitter.material.css.js.map +1 -0
- package/components/splitter/themes/dark/splitter.shared.css.d.ts +1 -0
- package/components/splitter/themes/dark/splitter.shared.css.js +3 -0
- package/components/splitter/themes/dark/splitter.shared.css.js.map +1 -0
- package/components/splitter/themes/light/splitter.bootstrap.css.d.ts +1 -0
- package/components/splitter/themes/light/splitter.bootstrap.css.js +3 -0
- package/components/splitter/themes/light/splitter.bootstrap.css.js.map +1 -0
- package/components/splitter/themes/light/splitter.fluent.css.d.ts +1 -0
- package/components/splitter/themes/light/splitter.fluent.css.js +3 -0
- package/components/splitter/themes/light/splitter.fluent.css.js.map +1 -0
- package/components/splitter/themes/light/splitter.indigo.css.d.ts +1 -0
- package/components/splitter/themes/light/splitter.indigo.css.js +3 -0
- package/components/splitter/themes/light/splitter.indigo.css.js.map +1 -0
- package/components/splitter/themes/light/splitter.material.css.d.ts +1 -0
- package/components/splitter/themes/light/splitter.material.css.js +3 -0
- package/components/splitter/themes/light/splitter.material.css.js.map +1 -0
- package/components/splitter/themes/light/splitter.shared.css.d.ts +1 -0
- package/components/splitter/themes/light/splitter.shared.css.js +3 -0
- package/components/splitter/themes/light/splitter.shared.css.js.map +1 -0
- package/components/splitter/themes/shared/splitter.common.css.d.ts +1 -0
- package/components/splitter/themes/shared/splitter.common.css.js +3 -0
- package/components/splitter/themes/shared/splitter.common.css.js.map +1 -0
- package/components/splitter/themes/shared/splitter.indigo.css.d.ts +1 -0
- package/components/splitter/themes/shared/splitter.indigo.css.js +3 -0
- package/components/splitter/themes/shared/splitter.indigo.css.js.map +1 -0
- package/components/splitter/themes/splitter.base.css.d.ts +1 -0
- package/components/splitter/themes/splitter.base.css.js +3 -0
- package/components/splitter/themes/splitter.base.css.js.map +1 -0
- package/components/splitter/themes/themes.d.ts +2 -0
- package/components/splitter/themes/themes.js +48 -0
- package/components/splitter/themes/themes.js.map +1 -0
- package/components/splitter/types.d.ts +39 -0
- package/components/splitter/types.js +2 -0
- package/components/splitter/types.js.map +1 -0
- package/components/stepper/{animations.d.ts → common/animations.d.ts} +2 -2
- package/components/stepper/{animations.js → common/animations.js} +2 -2
- package/components/stepper/common/animations.js.map +1 -0
- package/components/stepper/common/context.d.ts +9 -0
- package/components/stepper/common/context.js +3 -0
- package/components/stepper/common/context.js.map +1 -0
- package/components/stepper/common/state.d.ts +67 -0
- package/components/stepper/common/state.js +134 -0
- package/components/stepper/common/state.js.map +1 -0
- package/components/stepper/common/types.js +2 -0
- package/components/stepper/common/types.js.map +1 -0
- package/components/stepper/step.d.ts +101 -55
- package/components/stepper/step.js +145 -160
- package/components/stepper/step.js.map +1 -1
- package/components/stepper/stepper.d.ts +98 -53
- package/components/stepper/stepper.js +168 -308
- package/components/stepper/stepper.js.map +1 -1
- package/components/stepper/themes/step/shared/step.bootstrap.css.js +1 -1
- package/components/stepper/themes/step/shared/step.bootstrap.css.js.map +1 -1
- package/components/stepper/themes/step/shared/step.common.css.js +1 -1
- package/components/stepper/themes/step/shared/step.common.css.js.map +1 -1
- package/components/stepper/themes/step/shared/step.indigo.css.js +1 -1
- package/components/stepper/themes/step/shared/step.indigo.css.js.map +1 -1
- package/components/stepper/themes/step/themes.js +2 -3
- package/components/stepper/themes/step/themes.js.map +1 -1
- package/components/tabs/themes/tabs.base.css.js +1 -1
- package/components/tabs/themes/tabs.base.css.js.map +1 -1
- package/components/textarea/textarea.js.map +1 -1
- package/components/types.d.ts +1 -0
- package/components/types.js.map +1 -1
- package/components/visually-hidden/visually-hidden.d.ts +49 -0
- package/components/visually-hidden/visually-hidden.js +26 -0
- package/components/visually-hidden/visually-hidden.js.map +1 -0
- package/custom-elements.json +2681 -379
- package/igniteui-webcomponents.css-data.json +2 -2
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +6 -2
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/package.json +3 -1
- package/web-types.json +3 -3
- package/components/stepper/animations.js.map +0 -1
- package/components/stepper/stepper.common.js +0 -2
- package/components/stepper/stepper.common.js.map +0 -1
- package/components/stepper/themes/step/shared/step.fluent.css.js +0 -3
- package/components/stepper/themes/step/shared/step.fluent.css.js.map +0 -1
- /package/components/{stepper/themes/step/shared/step.fluent.css.d.ts → highlight/themes/dark/highlight.bootstrap.css.d.ts} +0 -0
- /package/components/stepper/{stepper.common.d.ts → common/types.d.ts} +0 -0
|
@@ -4,17 +4,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
+
import { consume } from '@lit/context';
|
|
7
8
|
import { html, LitElement, nothing } from 'lit';
|
|
8
|
-
import { property
|
|
9
|
+
import { property } from 'lit/decorators.js';
|
|
10
|
+
import { cache } from 'lit/directives/cache.js';
|
|
9
11
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
10
|
-
import { when } from 'lit/directives/when.js';
|
|
11
12
|
import { EaseInOut } from '../../animations/easings.js';
|
|
12
13
|
import { addAnimationController } from '../../animations/player.js';
|
|
13
14
|
import { addThemingController } from '../../theming/theming-controller.js';
|
|
14
|
-
import {
|
|
15
|
+
import { addSlotController, setSlots } from '../common/controllers/slot.js';
|
|
15
16
|
import { registerComponent } from '../common/definitions/register.js';
|
|
16
17
|
import { partMap } from '../common/part-map.js';
|
|
17
|
-
import { bodyAnimations, contentAnimations
|
|
18
|
+
import { bodyAnimations, contentAnimations } from './common/animations.js';
|
|
19
|
+
import { STEPPER_CONTEXT } from './common/context.js';
|
|
18
20
|
import { styles as shared } from './themes/step/shared/step.common.css.js';
|
|
19
21
|
import { styles } from './themes/step/step.base.css.js';
|
|
20
22
|
import { all } from './themes/step/themes.js';
|
|
@@ -24,37 +26,85 @@ export default class IgcStepComponent extends LitElement {
|
|
|
24
26
|
static register() {
|
|
25
27
|
registerComponent(IgcStepComponent);
|
|
26
28
|
}
|
|
29
|
+
get _stepper() {
|
|
30
|
+
return this._stepperContext?.stepper;
|
|
31
|
+
}
|
|
32
|
+
get _state() {
|
|
33
|
+
return this._stepperContext?.state;
|
|
34
|
+
}
|
|
35
|
+
get _isHorizontal() {
|
|
36
|
+
return this._orientation === 'horizontal';
|
|
37
|
+
}
|
|
38
|
+
get _hasTitle() {
|
|
39
|
+
return this._slots.hasAssignedElements('title');
|
|
40
|
+
}
|
|
41
|
+
get _hasSubtitle() {
|
|
42
|
+
return this._slots.hasAssignedElements('subtitle');
|
|
43
|
+
}
|
|
44
|
+
get _animation() {
|
|
45
|
+
const animation = this._isHorizontal
|
|
46
|
+
? this._stepper?.horizontalAnimation
|
|
47
|
+
: this._stepper?.verticalAnimation;
|
|
48
|
+
return animation ?? (this._isHorizontal ? 'slide' : 'grow');
|
|
49
|
+
}
|
|
50
|
+
get _animationDuration() {
|
|
51
|
+
return this._stepper?.animationDuration ?? 320;
|
|
52
|
+
}
|
|
53
|
+
get _contentTop() {
|
|
54
|
+
return this._stepper?.contentTop ?? false;
|
|
55
|
+
}
|
|
56
|
+
get _index() {
|
|
57
|
+
return this._stepper?.steps.indexOf(this) ?? -1;
|
|
58
|
+
}
|
|
59
|
+
get _orientation() {
|
|
60
|
+
return this._stepper?.orientation ?? 'horizontal';
|
|
61
|
+
}
|
|
62
|
+
get _titlePosition() {
|
|
63
|
+
return this._stepper?.titlePosition ?? 'auto';
|
|
64
|
+
}
|
|
65
|
+
get _stepType() {
|
|
66
|
+
return this._stepper?.stepType ?? 'full';
|
|
67
|
+
}
|
|
68
|
+
get _previousComplete() {
|
|
69
|
+
return this._state?.get(this)?.previousCompleted ?? false;
|
|
70
|
+
}
|
|
71
|
+
get _visited() {
|
|
72
|
+
return this._state?.get(this)?.visited ?? false;
|
|
73
|
+
}
|
|
74
|
+
get _isAccessible() {
|
|
75
|
+
return this._state?.isAccessible(this) ?? true;
|
|
76
|
+
}
|
|
27
77
|
constructor() {
|
|
28
78
|
super();
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
79
|
+
this._bodyRef = createRef();
|
|
80
|
+
this._contentRef = createRef();
|
|
81
|
+
this._bodyPlayer = addAnimationController(this, this._bodyRef);
|
|
82
|
+
this._contentPlayer = addAnimationController(this, this._contentRef);
|
|
83
|
+
this._slots = addSlotController(this, {
|
|
84
|
+
slots: setSlots('indicator', 'title', 'subtitle'),
|
|
85
|
+
});
|
|
33
86
|
this.invalid = false;
|
|
34
87
|
this.active = false;
|
|
35
88
|
this.optional = false;
|
|
36
89
|
this.disabled = false;
|
|
37
90
|
this.complete = false;
|
|
38
|
-
this.previousComplete = false;
|
|
39
|
-
this.stepType = 'full';
|
|
40
|
-
this.titlePosition = 'auto';
|
|
41
|
-
this.orientation = 'horizontal';
|
|
42
|
-
this.index = -1;
|
|
43
|
-
this.contentTop = false;
|
|
44
|
-
this.linearDisabled = false;
|
|
45
|
-
this.visited = false;
|
|
46
|
-
this.animation = 'fade';
|
|
47
|
-
this.animationDuration = 350;
|
|
48
91
|
addThemingController(this, all);
|
|
49
92
|
}
|
|
93
|
+
willUpdate(changed) {
|
|
94
|
+
if (changed.has('active') ||
|
|
95
|
+
changed.has('complete') ||
|
|
96
|
+
changed.has('disabled') ||
|
|
97
|
+
changed.has('invalid') ||
|
|
98
|
+
changed.has('optional')) {
|
|
99
|
+
this._state?.onStepPropertyChanged(this, changed);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
50
102
|
async toggleAnimation(type, direction = 'normal') {
|
|
51
|
-
const bodyAnimation = bodyAnimations.get(this.
|
|
52
|
-
const contentAnimation = contentAnimations.get(this.
|
|
53
|
-
const bodyHeight =
|
|
54
|
-
.getComputedStyle(this)
|
|
55
|
-
.getPropertyValue('--vertical-body-height');
|
|
103
|
+
const bodyAnimation = bodyAnimations.get(this._animation).get(type);
|
|
104
|
+
const contentAnimation = contentAnimations.get(this._animation).get(type);
|
|
105
|
+
const bodyHeight = getComputedStyle(this).getPropertyValue('--vertical-body-height');
|
|
56
106
|
const options = {
|
|
57
|
-
duration: this.
|
|
107
|
+
duration: this._animationDuration,
|
|
58
108
|
easing: EaseInOut.Quad,
|
|
59
109
|
direction,
|
|
60
110
|
};
|
|
@@ -62,78 +112,49 @@ export default class IgcStepComponent extends LitElement {
|
|
|
62
112
|
height: bodyHeight,
|
|
63
113
|
};
|
|
64
114
|
const result = await Promise.all([
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
115
|
+
this._bodyPlayer.playExclusive(bodyAnimation({ keyframe: options, step })),
|
|
116
|
+
this._contentPlayer.playExclusive(contentAnimation({ keyframe: options, step })),
|
|
67
117
|
]);
|
|
68
118
|
return result.every(Boolean);
|
|
69
119
|
}
|
|
70
|
-
|
|
71
|
-
if (this.active) {
|
|
72
|
-
this.dispatchEvent(new CustomEvent('stepActiveChanged', { bubbles: true, detail: false }));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
disabledInvalidOptionalChange() {
|
|
76
|
-
this.dispatchEvent(new CustomEvent('stepDisabledInvalidChanged', { bubbles: true }));
|
|
77
|
-
}
|
|
78
|
-
completeChange() {
|
|
79
|
-
this.dispatchEvent(new CustomEvent('stepCompleteChanged', { bubbles: true }));
|
|
80
|
-
}
|
|
81
|
-
handleClick(event) {
|
|
82
|
-
event.stopPropagation();
|
|
83
|
-
if (this.isAccessible) {
|
|
84
|
-
this.dispatchEvent(new CustomEvent('stepActiveChanged', { bubbles: true, detail: true }));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
handleKeydown(event) {
|
|
88
|
-
this.dispatchEvent(new CustomEvent('stepHeaderKeydown', {
|
|
89
|
-
bubbles: true,
|
|
90
|
-
detail: { event, focusedStep: this },
|
|
91
|
-
}));
|
|
92
|
-
}
|
|
93
|
-
get isAccessible() {
|
|
94
|
-
return !this.disabled && !this.linearDisabled;
|
|
95
|
-
}
|
|
96
|
-
get headerContainerParts() {
|
|
120
|
+
get _headerContainerParts() {
|
|
97
121
|
return {
|
|
98
122
|
'header-container': true,
|
|
99
|
-
disabled: !this.
|
|
123
|
+
disabled: !this._isAccessible,
|
|
100
124
|
'complete-start': this.complete,
|
|
101
|
-
'complete-end': this.
|
|
125
|
+
'complete-end': this._previousComplete,
|
|
102
126
|
optional: this.optional,
|
|
103
|
-
invalid: this.invalid && this.
|
|
104
|
-
top: this.
|
|
105
|
-
bottom: this.
|
|
106
|
-
(this.
|
|
107
|
-
start: this.
|
|
108
|
-
end: this.
|
|
109
|
-
(this.
|
|
127
|
+
invalid: this.invalid && this._visited && !this.active && this._isAccessible,
|
|
128
|
+
top: this._titlePosition === 'top',
|
|
129
|
+
bottom: this._titlePosition === 'bottom' ||
|
|
130
|
+
(this._isHorizontal && this._titlePosition === 'auto'),
|
|
131
|
+
start: this._titlePosition === 'start',
|
|
132
|
+
end: this._titlePosition === 'end' ||
|
|
133
|
+
(!this._isHorizontal && this._titlePosition === 'auto'),
|
|
110
134
|
};
|
|
111
135
|
}
|
|
112
|
-
get
|
|
136
|
+
get _textParts() {
|
|
137
|
+
const hasText = this._hasTitle || this._hasSubtitle;
|
|
113
138
|
return {
|
|
114
139
|
text: true,
|
|
115
|
-
empty: this.
|
|
116
|
-
|
|
117
|
-
: this.stepType === 'full' &&
|
|
118
|
-
!this._titleChildren.length &&
|
|
119
|
-
!this._subTitleChildren.length,
|
|
140
|
+
empty: this._stepType === 'indicator' ||
|
|
141
|
+
(this._stepType === 'full' && !hasText),
|
|
120
142
|
};
|
|
121
143
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return nothing;
|
|
144
|
+
_renderIndicator() {
|
|
145
|
+
return this._stepType !== 'title'
|
|
146
|
+
? html `
|
|
147
|
+
<div part="indicator">
|
|
148
|
+
<slot name="indicator">
|
|
149
|
+
<span>${this._index + 1}</span>
|
|
150
|
+
</slot>
|
|
151
|
+
</div>
|
|
152
|
+
`
|
|
153
|
+
: nothing;
|
|
133
154
|
}
|
|
134
|
-
|
|
155
|
+
_renderTitleAndSubtitle() {
|
|
135
156
|
return html `
|
|
136
|
-
<div part=${partMap(this.
|
|
157
|
+
<div part=${partMap(this._textParts)}>
|
|
137
158
|
<div part="title">
|
|
138
159
|
<slot name="title"></slot>
|
|
139
160
|
</div>
|
|
@@ -143,104 +164,68 @@ export default class IgcStepComponent extends LitElement {
|
|
|
143
164
|
</div>
|
|
144
165
|
`;
|
|
145
166
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
id="igc-step-content-${this.index}"
|
|
150
|
-
part="body"
|
|
151
|
-
role="tabpanel"
|
|
152
|
-
aria-labelledby="igc-step-header-${this.index}"
|
|
153
|
-
>
|
|
154
|
-
<div part="content" ${ref(this.contentRef)}>
|
|
155
|
-
<slot></slot>
|
|
156
|
-
</div>
|
|
157
|
-
</div>`;
|
|
158
|
-
}
|
|
159
|
-
render() {
|
|
167
|
+
_renderHeader() {
|
|
168
|
+
const index = this._index + 1;
|
|
169
|
+
const size = this._stepper?.steps.length ?? 0;
|
|
160
170
|
return html `
|
|
161
|
-
|
|
162
|
-
<div part=${partMap(this.headerContainerParts)}>
|
|
171
|
+
<div part=${partMap(this._headerContainerParts)}>
|
|
163
172
|
<div
|
|
164
|
-
|
|
165
|
-
tabindex=${this.active ? '0' : '-1'}
|
|
173
|
+
data-step-header
|
|
166
174
|
role="tab"
|
|
175
|
+
part="header"
|
|
176
|
+
id="igc-step-header-${index}"
|
|
167
177
|
aria-selected=${this.active}
|
|
168
|
-
|
|
169
|
-
|
|
178
|
+
aria-controls="igc-step-content-${index}"
|
|
179
|
+
aria-posinset=${index}
|
|
180
|
+
aria-setsize=${size}
|
|
181
|
+
tabindex=${this.active ? 0 : -1}
|
|
170
182
|
>
|
|
171
|
-
${this.
|
|
183
|
+
${this._renderIndicator()} ${this._renderTitleAndSubtitle()}
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
`;
|
|
187
|
+
}
|
|
188
|
+
_renderContent() {
|
|
189
|
+
const index = this._index + 1;
|
|
190
|
+
return html `
|
|
191
|
+
<div
|
|
192
|
+
${ref(this._bodyRef)}
|
|
193
|
+
id="igc-step-content-${index}"
|
|
194
|
+
part="body"
|
|
195
|
+
role="tabpanel"
|
|
196
|
+
aria-labelledby="igc-step-header-${index}"
|
|
197
|
+
>
|
|
198
|
+
<div ${ref(this._contentRef)} part="content">
|
|
199
|
+
<slot></slot>
|
|
172
200
|
</div>
|
|
173
201
|
</div>
|
|
174
|
-
|
|
202
|
+
`;
|
|
203
|
+
}
|
|
204
|
+
render() {
|
|
205
|
+
const renderBeforeHeader = this._contentTop && this._isHorizontal;
|
|
206
|
+
return html `
|
|
207
|
+
${cache(renderBeforeHeader
|
|
208
|
+
? html `${this._renderContent()} ${this._renderHeader()}`
|
|
209
|
+
: html `${this._renderHeader()} ${this._renderContent()}`)}
|
|
175
210
|
`;
|
|
176
211
|
}
|
|
177
212
|
}
|
|
178
213
|
__decorate([
|
|
179
|
-
|
|
180
|
-
], IgcStepComponent.prototype, "
|
|
181
|
-
__decorate([
|
|
182
|
-
queryAssignedElements({ slot: 'subtitle' })
|
|
183
|
-
], IgcStepComponent.prototype, "_subTitleChildren", void 0);
|
|
184
|
-
__decorate([
|
|
185
|
-
query('[part~="header"]')
|
|
186
|
-
], IgcStepComponent.prototype, "header", void 0);
|
|
214
|
+
consume({ context: STEPPER_CONTEXT, subscribe: true })
|
|
215
|
+
], IgcStepComponent.prototype, "_stepperContext", void 0);
|
|
187
216
|
__decorate([
|
|
188
|
-
|
|
189
|
-
], IgcStepComponent.prototype, "contentBody", void 0);
|
|
190
|
-
__decorate([
|
|
191
|
-
property({ reflect: true, type: Boolean })
|
|
217
|
+
property({ type: Boolean, reflect: true })
|
|
192
218
|
], IgcStepComponent.prototype, "invalid", void 0);
|
|
193
219
|
__decorate([
|
|
194
|
-
property({
|
|
220
|
+
property({ type: Boolean, reflect: true })
|
|
195
221
|
], IgcStepComponent.prototype, "active", void 0);
|
|
196
222
|
__decorate([
|
|
197
|
-
property({ type: Boolean })
|
|
223
|
+
property({ type: Boolean, reflect: true })
|
|
198
224
|
], IgcStepComponent.prototype, "optional", void 0);
|
|
199
225
|
__decorate([
|
|
200
|
-
property({
|
|
226
|
+
property({ type: Boolean, reflect: true })
|
|
201
227
|
], IgcStepComponent.prototype, "disabled", void 0);
|
|
202
228
|
__decorate([
|
|
203
|
-
property({
|
|
229
|
+
property({ type: Boolean, reflect: true })
|
|
204
230
|
], IgcStepComponent.prototype, "complete", void 0);
|
|
205
|
-
__decorate([
|
|
206
|
-
property({ attribute: false })
|
|
207
|
-
], IgcStepComponent.prototype, "previousComplete", void 0);
|
|
208
|
-
__decorate([
|
|
209
|
-
property({ attribute: false })
|
|
210
|
-
], IgcStepComponent.prototype, "stepType", void 0);
|
|
211
|
-
__decorate([
|
|
212
|
-
property({ attribute: false })
|
|
213
|
-
], IgcStepComponent.prototype, "titlePosition", void 0);
|
|
214
|
-
__decorate([
|
|
215
|
-
property({ attribute: false })
|
|
216
|
-
], IgcStepComponent.prototype, "orientation", void 0);
|
|
217
|
-
__decorate([
|
|
218
|
-
property({ attribute: false })
|
|
219
|
-
], IgcStepComponent.prototype, "index", void 0);
|
|
220
|
-
__decorate([
|
|
221
|
-
property({ attribute: false })
|
|
222
|
-
], IgcStepComponent.prototype, "contentTop", void 0);
|
|
223
|
-
__decorate([
|
|
224
|
-
property({ attribute: false })
|
|
225
|
-
], IgcStepComponent.prototype, "linearDisabled", void 0);
|
|
226
|
-
__decorate([
|
|
227
|
-
property({ attribute: false })
|
|
228
|
-
], IgcStepComponent.prototype, "visited", void 0);
|
|
229
|
-
__decorate([
|
|
230
|
-
property({ attribute: false })
|
|
231
|
-
], IgcStepComponent.prototype, "animation", void 0);
|
|
232
|
-
__decorate([
|
|
233
|
-
property({ attribute: false })
|
|
234
|
-
], IgcStepComponent.prototype, "animationDuration", void 0);
|
|
235
|
-
__decorate([
|
|
236
|
-
watch('active', { waitUntilFirstUpdate: true })
|
|
237
|
-
], IgcStepComponent.prototype, "activeChange", null);
|
|
238
|
-
__decorate([
|
|
239
|
-
watch('disabled', { waitUntilFirstUpdate: true }),
|
|
240
|
-
watch('invalid', { waitUntilFirstUpdate: true }),
|
|
241
|
-
watch('optional', { waitUntilFirstUpdate: true })
|
|
242
|
-
], IgcStepComponent.prototype, "disabledInvalidOptionalChange", null);
|
|
243
|
-
__decorate([
|
|
244
|
-
watch('complete', { waitUntilFirstUpdate: true })
|
|
245
|
-
], IgcStepComponent.prototype, "completeChange", null);
|
|
246
231
|
//# sourceMappingURL=step.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.js","sourceRoot":"","sources":["../../../src/components/stepper/step.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAY,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAMhD,OAAO,EAEL,cAAc,EACd,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAA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N,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uDACqB;AAI7C;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;qDACuB;AAI/C;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CACb;AAIX;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oDACL;AAInB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;wDACD;AAIvB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDACR;AAIhB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;mDACM;AAI9B;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2DACA;AA4CrB;IADT,KAAK,CAAC,QAAQ,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;oDAO/C;AAKS;IAHT,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;IACjD,KAAK,CAAC,SAAS,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;IAChD,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;qEAKjD;AAGS;IADT,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;sDAKjD","sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, query, queryAssignedElements } from 'lit/decorators.js';\nimport { createRef, type Ref, ref } from 'lit/directives/ref.js';\nimport { when } from 'lit/directives/when.js';\n\nimport { EaseInOut } from '../../animations/easings.js';\nimport { addAnimationController } from '../../animations/player.js';\nimport { addThemingController } from '../../theming/theming-controller.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport { partMap } from '../common/part-map.js';\nimport type {\n StepperOrientation,\n StepperStepType,\n StepperTitlePosition,\n} from '../types.js';\nimport {\n type Animation,\n bodyAnimations,\n contentAnimations,\n} from './animations.js';\nimport { styles as shared } from './themes/step/shared/step.common.css.js';\nimport { styles } from './themes/step/step.base.css.js';\nimport { all } from './themes/step/themes.js';\n\n/**\n * The step component is used within the `igc-stepper` element and it holds the content of each step.\n * It also supports custom indicators, title and subtitle.\n *\n * @element igc-step\n *\n * @slot - Renders the content of the step.\n * @slot indicator - Renders the indicator of the step. By default, it displays the step index + 1.\n * @slot title - Renders the title of the step.\n * @slot subtitle - Renders the subtitle of the step.\n *\n * @csspart header-container - Wrapper of the step's `header` and its separators.\n * @csspart disabled - Indicates a disabled state. Applies to `header-container`.\n * @csspart complete-start - Indicates a complete state of the current step. Applies to `header-container`.\n * @csspart complete-end - Indicates a complete state of the previous step. Applies to `header-container`.\n * @csspart optional - Indicates an optional state. Applies to `header-container`.\n * @csspart invalid - Indicates an invalid state. Applies to `header-container`.\n * @csspart top - Indicates that the title should be above the indicator. Applies to `header-container`.\n * @csspart bottom - Indicates that the title should be below the indicator. Applies to `header-container`.\n * @csspart start - Indicates that the title should be before the indicator. Applies to `header-container`.\n * @csspart end - Indicates that the title should be after the indicator. Applies to `header-container`.\n * @csspart header - Wrapper of the step's `indicator` and `text`.\n * @csspart indicator - The indicator of the step.\n * @csspart text - Wrapper of the step's `title` and `subtitle`.\n * @csspart empty - Indicates that no title and subtitle has been provided to the step. Applies to `text`.\n * @csspart title - The title of the step.\n * @csspart subtitle - The subtitle of the step.\n * @csspart body - Wrapper of the step's `content`.\n * @csspart content - The steps `content`.\n */\nexport default class IgcStepComponent extends LitElement {\n public static readonly tagName = 'igc-step';\n public static override styles = [styles, shared];\n\n /* blazorSuppress */\n public static register() {\n registerComponent(IgcStepComponent);\n }\n\n private bodyRef: Ref<HTMLElement> = createRef();\n private contentRef: Ref<HTMLElement> = createRef();\n\n private bodyAnimationPlayer = addAnimationController(this, this.bodyRef);\n private contentAnimationPlayer = addAnimationController(\n this,\n this.contentRef\n );\n\n @queryAssignedElements({ slot: 'title' })\n private _titleChildren!: Array<HTMLElement>;\n\n @queryAssignedElements({ slot: 'subtitle' })\n private _subTitleChildren!: Array<HTMLElement>;\n\n /* blazorSuppress */\n @query('[part~=\"header\"]')\n public header!: HTMLElement;\n\n /* blazorSuppress */\n @query('[part~=\"body\"]')\n public contentBody!: HTMLElement;\n\n /** Gets/sets whether the step is invalid. */\n @property({ reflect: true, type: Boolean })\n public invalid = false;\n\n /** Gets/sets whether the step is activе. */\n @property({ reflect: true, type: Boolean })\n public active = false;\n\n /**\n * Gets/sets whether the step is optional.\n *\n * @remarks\n * Optional steps validity does not affect the default behavior when the stepper is in linear mode i.e.\n * if optional step is invalid the user could still move to the next step.\n */\n @property({ type: Boolean })\n public optional = false;\n\n /** Gets/sets whether the step is interactable. */\n @property({ reflect: true, type: Boolean })\n public disabled = false;\n\n /** Gets/sets whether the step is completed.\n *\n * @remarks\n * When set to `true` the following separator is styled `solid`.\n */\n @property({ reflect: true, type: Boolean })\n public complete = false;\n\n /** @hidden @internal @private */\n @property({ attribute: false })\n public previousComplete = false;\n\n /** @hidden @internal @private */\n @property({ attribute: false })\n public stepType: StepperStepType = 'full';\n\n /** @hidden @internal @private */\n @property({ attribute: false })\n public titlePosition: StepperTitlePosition = 'auto';\n\n /** @hidden @internal @private */\n @property({ attribute: false })\n public orientation: StepperOrientation = 'horizontal';\n\n /** @hidden @internal @private */\n @property({ attribute: false })\n public index = -1;\n\n /** @hidden @internal @private */\n @property({ attribute: false })\n public contentTop = false;\n\n /** @hidden @internal @private */\n @property({ attribute: false })\n public linearDisabled = false;\n\n /** @hidden @internal @private */\n @property({ attribute: false })\n public visited = false;\n\n /** @hidden @internal @private */\n @property({ attribute: false })\n public animation: Animation = 'fade';\n\n /** @hidden @internal @private */\n @property({ attribute: false })\n public animationDuration = 350;\n\n constructor() {\n super();\n addThemingController(this, all);\n }\n\n /**\n * @hidden @internal\n * @deprecated since 5.4.0. Use the Stepper's `navigateTo` method instead.\n */\n public async toggleAnimation(\n type: 'in' | 'out',\n direction: 'normal' | 'reverse' = 'normal'\n ) {\n const bodyAnimation = bodyAnimations.get(this.animation)!.get(type)!;\n const contentAnimation = contentAnimations.get(this.animation)!.get(type)!;\n const bodyHeight = window\n .getComputedStyle(this)\n .getPropertyValue('--vertical-body-height');\n\n const options: KeyframeAnimationOptions = {\n duration: this.animationDuration,\n easing: EaseInOut.Quad,\n direction,\n };\n\n const step = {\n height: bodyHeight,\n };\n\n const result = await Promise.all([\n this.bodyAnimationPlayer.playExclusive(\n bodyAnimation({ keyframe: options, step })\n ),\n this.contentAnimationPlayer.playExclusive(\n contentAnimation({ keyframe: options, step })\n ),\n ]);\n\n return result.every(Boolean);\n }\n\n @watch('active', { waitUntilFirstUpdate: true })\n protected activeChange() {\n if (this.active) {\n this.dispatchEvent(\n new CustomEvent('stepActiveChanged', { bubbles: true, detail: false })\n );\n }\n }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n @watch('invalid', { waitUntilFirstUpdate: true })\n @watch('optional', { waitUntilFirstUpdate: true })\n protected disabledInvalidOptionalChange() {\n this.dispatchEvent(\n new CustomEvent('stepDisabledInvalidChanged', { bubbles: true })\n );\n }\n\n @watch('complete', { waitUntilFirstUpdate: true })\n protected completeChange() {\n this.dispatchEvent(\n new CustomEvent('stepCompleteChanged', { bubbles: true })\n );\n }\n\n private handleClick(event: MouseEvent): void {\n event.stopPropagation();\n if (this.isAccessible) {\n this.dispatchEvent(\n new CustomEvent('stepActiveChanged', { bubbles: true, detail: true })\n );\n }\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n this.dispatchEvent(\n new CustomEvent('stepHeaderKeydown', {\n bubbles: true,\n detail: { event, focusedStep: this },\n })\n );\n }\n\n /** @hidden @internal */\n public get isAccessible(): boolean {\n return !this.disabled && !this.linearDisabled;\n }\n\n private get headerContainerParts() {\n return {\n 'header-container': true,\n disabled: !this.isAccessible,\n 'complete-start': this.complete,\n 'complete-end': this.previousComplete,\n optional: this.optional,\n invalid:\n this.invalid && this.visited && !this.active && this.isAccessible,\n top: this.titlePosition === 'top',\n bottom:\n this.titlePosition === 'bottom' ||\n (this.orientation === 'horizontal' && this.titlePosition === 'auto'),\n start: this.titlePosition === 'start',\n end:\n this.titlePosition === 'end' ||\n (this.orientation === 'vertical' && this.titlePosition === 'auto'),\n };\n }\n\n private get textParts() {\n return {\n text: true,\n empty:\n this.stepType === 'indicator'\n ? true\n : this.stepType === 'full' &&\n !this._titleChildren.length &&\n !this._subTitleChildren.length,\n };\n }\n\n protected renderIndicator() {\n if (this.stepType !== 'title') {\n return html`\n <div part=\"indicator\">\n <slot name=\"indicator\">\n <span>${this.index + 1}</span>\n </slot>\n </div>\n `;\n }\n return nothing;\n }\n\n protected renderTitleAndSubtitle() {\n return html`\n <div part=${partMap(this.textParts)}>\n <div part=\"title\">\n <slot name=\"title\"></slot>\n </div>\n <div part=\"subtitle\">\n <slot name=\"subtitle\"></slot>\n </div>\n </div>\n `;\n }\n\n protected renderContent() {\n return html`<div\n ${ref(this.bodyRef)}\n id=\"igc-step-content-${this.index}\"\n part=\"body\"\n role=\"tabpanel\"\n aria-labelledby=\"igc-step-header-${this.index}\"\n >\n <div part=\"content\" ${ref(this.contentRef)}>\n <slot></slot>\n </div>\n </div>`;\n }\n\n protected override render() {\n return html`\n ${when(\n this.contentTop && this.orientation === 'horizontal',\n () => this.renderContent(),\n () => nothing\n )}\n <div part=${partMap(this.headerContainerParts)}>\n <div\n part=\"header\"\n tabindex=${this.active ? '0' : '-1'}\n role=\"tab\"\n aria-selected=${this.active}\n @click=${this.handleClick}\n @keydown=${this.handleKeydown}\n >\n ${this.renderIndicator()} ${this.renderTitleAndSubtitle()}\n </div>\n </div>\n ${when(\n this.orientation === 'vertical' || !this.contentTop,\n () => this.renderContent(),\n () => nothing\n )}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-step': IgcStepComponent;\n }\n}\n"]}
|
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AAYf;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACnB;AAWjB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACnB;AASjB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACnB","sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement, nothing, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { cache } from 'lit/directives/cache.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { EaseInOut } from '../../animations/easings.js';\nimport { addAnimationController } from '../../animations/player.js';\nimport { addThemingController } from '../../theming/theming-controller.js';\nimport { addSlotController, setSlots } from '../common/controllers/slot.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport { partMap } from '../common/part-map.js';\nimport type {\n HorizontalTransitionAnimation,\n StepperOrientation,\n StepperStepType,\n StepperTitlePosition,\n StepperVerticalAnimation,\n} from '../types.js';\nimport { bodyAnimations, contentAnimations } from './common/animations.js';\nimport { STEPPER_CONTEXT, type StepperContext } from './common/context.js';\nimport type { StepperState } from './common/state.js';\nimport type IgcStepperComponent from './stepper.js';\nimport { styles as shared } from './themes/step/shared/step.common.css.js';\nimport { styles } from './themes/step/step.base.css.js';\nimport { all } from './themes/step/themes.js';\n\n/**\n * A step component used within an `igc-stepper` to represent an individual step in a wizard-like workflow.\n *\n * @remarks\n * Each step has a header (with an indicator, title, and subtitle) and a content area.\n * Steps can be marked as `active`, `complete`, `disabled`, `optional`, or `invalid`\n * to control their appearance and behavior within the stepper.\n *\n * Custom indicators can be provided via the `indicator` slot, and the content area\n * is rendered in the default slot.\n *\n * @element igc-step\n *\n * @slot - Renders the content of the step.\n * @slot indicator - Renders the indicator of the step. By default, it displays the step index + 1.\n * @slot title - Renders the title of the step.\n * @slot subtitle - Renders the subtitle of the step.\n *\n * @csspart header-container - Wrapper of the step's `header` and its separators.\n * @csspart disabled - Indicates a disabled state. Applies to `header-container`.\n * @csspart complete-start - Indicates a complete state of the current step. Applies to `header-container`.\n * @csspart complete-end - Indicates a complete state of the previous step. Applies to `header-container`.\n * @csspart optional - Indicates an optional state. Applies to `header-container`.\n * @csspart invalid - Indicates an invalid state. Applies to `header-container`.\n * @csspart top - Indicates that the title should be above the indicator. Applies to `header-container`.\n * @csspart bottom - Indicates that the title should be below the indicator. Applies to `header-container`.\n * @csspart start - Indicates that the title should be before the indicator. Applies to `header-container`.\n * @csspart end - Indicates that the title should be after the indicator. Applies to `header-container`.\n * @csspart header - Wrapper of the step's `indicator` and `text`.\n * @csspart indicator - The indicator of the step.\n * @csspart text - Wrapper of the step's `title` and `subtitle`.\n * @csspart empty - Indicates that no title and subtitle have been provided to the step. Applies to `text`.\n * @csspart title - The title of the step.\n * @csspart subtitle - The subtitle of the step.\n * @csspart body - Wrapper of the step's `content`.\n * @csspart content - The step's `content`.\n *\n * @example\n * ```html\n * <igc-step>\n * <igc-icon slot=\"indicator\" name=\"home\"></igc-icon>\n * <span slot=\"title\">Home</span>\n * <span slot=\"subtitle\">Return to the home page</span>\n * <p>Welcome! This is the first step.</p>\n * </igc-step>\n * ```\n *\n * @example Step with state attributes\n * ```html\n * <igc-step complete>\n * <span slot=\"title\">Completed step</span>\n * <p>This step has been completed.</p>\n * </igc-step>\n *\n * <igc-step active invalid>\n * <span slot=\"title\">Current step</span>\n * <p>This step has validation errors.</p>\n * </igc-step>\n *\n * <igc-step disabled>\n * <span slot=\"title\">Disabled step</span>\n * <p>This step is not accessible.</p>\n * </igc-step>\n * ```\n */\nexport default class IgcStepComponent extends LitElement {\n public static readonly tagName = 'igc-step';\n public static override styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcStepComponent);\n }\n\n //#region Internal state and properties\n\n private readonly _bodyRef = createRef<HTMLElement>();\n private readonly _contentRef = createRef<HTMLElement>();\n\n private readonly _bodyPlayer = addAnimationController(this, this._bodyRef);\n private readonly _contentPlayer = addAnimationController(\n this,\n this._contentRef\n );\n\n private readonly _slots = addSlotController(this, {\n slots: setSlots('indicator', 'title', 'subtitle'),\n });\n\n @consume({ context: STEPPER_CONTEXT, subscribe: true })\n private readonly _stepperContext?: StepperContext;\n\n private get _stepper(): IgcStepperComponent | undefined {\n return this._stepperContext?.stepper;\n }\n\n private get _state(): StepperState | undefined {\n return this._stepperContext?.state;\n }\n\n private get _isHorizontal(): boolean {\n return this._orientation === 'horizontal';\n }\n\n private get _hasTitle(): boolean {\n return this._slots.hasAssignedElements('title');\n }\n\n private get _hasSubtitle(): boolean {\n return this._slots.hasAssignedElements('subtitle');\n }\n\n private get _animation():\n | StepperVerticalAnimation\n | HorizontalTransitionAnimation {\n const animation = this._isHorizontal\n ? this._stepper?.horizontalAnimation\n : this._stepper?.verticalAnimation;\n\n return animation ?? (this._isHorizontal ? 'slide' : 'grow');\n }\n\n private get _animationDuration(): number {\n return this._stepper?.animationDuration ?? 320;\n }\n\n private get _contentTop(): boolean {\n return this._stepper?.contentTop ?? false;\n }\n\n private get _index(): number {\n return this._stepper?.steps.indexOf(this) ?? -1;\n }\n\n private get _orientation(): StepperOrientation {\n return this._stepper?.orientation ?? 'horizontal';\n }\n\n private get _titlePosition(): StepperTitlePosition {\n return this._stepper?.titlePosition ?? 'auto';\n }\n\n private get _stepType(): StepperStepType {\n return this._stepper?.stepType ?? 'full';\n }\n\n private get _previousComplete(): boolean {\n return this._state?.get(this)?.previousCompleted ?? false;\n }\n\n private get _visited(): boolean {\n return this._state?.get(this)?.visited ?? false;\n }\n\n private get _isAccessible(): boolean {\n return this._state?.isAccessible(this) ?? true;\n }\n\n //#endregion\n\n //#region Public attributes and properties\n\n /**\n * Whether the step is invalid.\n *\n * Invalid steps are styled with an error state and are not\n * interactive when the stepper is in linear mode.\n *\n * @attr invalid\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public invalid = false;\n\n /**\n * Whether the step is active.\n *\n * Active steps are styled with an active state and their content is visible.\n *\n * @attr active\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n /**\n * Whether the step is optional.\n *\n * Optional steps validity does not affect the default behavior when the stepper is in linear mode i.e.\n * if optional step is invalid the user could still move to the next step.\n *\n * @attr optional\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public optional = false;\n\n /**\n * Whether the step is disabled.\n *\n * Disabled steps are styled with a disabled state and are not interactive.\n *\n * @attr disabled\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n /**\n * Whether the step is completed.\n *\n * @attr complete\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public complete = false;\n\n //#endregion\n\n constructor() {\n super();\n addThemingController(this, all);\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n if (\n changed.has('active') ||\n changed.has('complete') ||\n changed.has('disabled') ||\n changed.has('invalid') ||\n changed.has('optional')\n ) {\n this._state?.onStepPropertyChanged(this, changed);\n }\n }\n\n /**\n * @hidden @internal\n * @deprecated since 5.4.0. Use the Stepper's `navigateTo` method instead.\n */\n public async toggleAnimation(\n type: 'in' | 'out',\n direction: 'normal' | 'reverse' = 'normal'\n ) {\n const bodyAnimation = bodyAnimations.get(this._animation)!.get(type)!;\n const contentAnimation = contentAnimations.get(this._animation)!.get(type)!;\n const bodyHeight = getComputedStyle(this).getPropertyValue(\n '--vertical-body-height'\n );\n\n const options: KeyframeAnimationOptions = {\n duration: this._animationDuration,\n easing: EaseInOut.Quad,\n direction,\n };\n\n const step = {\n height: bodyHeight,\n };\n\n const result = await Promise.all([\n this._bodyPlayer.playExclusive(\n bodyAnimation({ keyframe: options, step })\n ),\n this._contentPlayer.playExclusive(\n contentAnimation({ keyframe: options, step })\n ),\n ]);\n\n return result.every(Boolean);\n }\n\n private get _headerContainerParts() {\n return {\n 'header-container': true,\n disabled: !this._isAccessible,\n 'complete-start': this.complete,\n 'complete-end': this._previousComplete,\n optional: this.optional,\n invalid:\n this.invalid && this._visited && !this.active && this._isAccessible,\n top: this._titlePosition === 'top',\n bottom:\n this._titlePosition === 'bottom' ||\n (this._isHorizontal && this._titlePosition === 'auto'),\n start: this._titlePosition === 'start',\n end:\n this._titlePosition === 'end' ||\n (!this._isHorizontal && this._titlePosition === 'auto'),\n };\n }\n\n private get _textParts() {\n const hasText = this._hasTitle || this._hasSubtitle;\n\n return {\n text: true,\n empty:\n this._stepType === 'indicator' ||\n (this._stepType === 'full' && !hasText),\n };\n }\n\n private _renderIndicator() {\n return this._stepType !== 'title'\n ? html`\n <div part=\"indicator\">\n <slot name=\"indicator\">\n <span>${this._index + 1}</span>\n </slot>\n </div>\n `\n : nothing;\n }\n\n private _renderTitleAndSubtitle() {\n return html`\n <div part=${partMap(this._textParts)}>\n <div part=\"title\">\n <slot name=\"title\"></slot>\n </div>\n <div part=\"subtitle\">\n <slot name=\"subtitle\"></slot>\n </div>\n </div>\n `;\n }\n\n private _renderHeader() {\n const index = this._index + 1;\n const size = this._stepper?.steps.length ?? 0;\n\n return html`\n <div part=${partMap(this._headerContainerParts)}>\n <div\n data-step-header\n role=\"tab\"\n part=\"header\"\n id=\"igc-step-header-${index}\"\n aria-selected=${this.active}\n aria-controls=\"igc-step-content-${index}\"\n aria-posinset=${index}\n aria-setsize=${size}\n tabindex=${this.active ? 0 : -1}\n >\n ${this._renderIndicator()} ${this._renderTitleAndSubtitle()}\n </div>\n </div>\n `;\n }\n\n private _renderContent() {\n const index = this._index + 1;\n\n return html`\n <div\n ${ref(this._bodyRef)}\n id=\"igc-step-content-${index}\"\n part=\"body\"\n role=\"tabpanel\"\n aria-labelledby=\"igc-step-header-${index}\"\n >\n <div ${ref(this._contentRef)} part=\"content\">\n <slot></slot>\n </div>\n </div>\n `;\n }\n\n protected override render() {\n const renderBeforeHeader = this._contentTop && this._isHorizontal;\n\n return html`\n ${cache(\n renderBeforeHeader\n ? html`${this._renderContent()} ${this._renderHeader()}`\n : html`${this._renderHeader()} ${this._renderContent()}`\n )}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-step': IgcStepComponent;\n }\n}\n"]}
|