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.
Files changed (149) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/components/combo/themes/shared/combo.common.css.js +1 -1
  3. package/components/combo/themes/shared/combo.common.css.js.map +1 -1
  4. package/components/combo/types.js.map +1 -1
  5. package/components/common/definitions/defineAllComponents.js +4 -0
  6. package/components/common/definitions/defineAllComponents.js.map +1 -1
  7. package/components/common/mixins/forms/form-transformers.js.map +1 -1
  8. package/components/common/util.d.ts +11 -1
  9. package/components/common/util.js +3 -0
  10. package/components/common/util.js.map +1 -1
  11. package/components/date-picker/date-picker.js.map +1 -1
  12. package/components/file-input/file-input.js.map +1 -1
  13. package/components/highlight/highlight.d.ts +130 -0
  14. package/components/highlight/highlight.js +77 -0
  15. package/components/highlight/highlight.js.map +1 -0
  16. package/components/highlight/service.d.ts +58 -0
  17. package/components/highlight/service.js +132 -0
  18. package/components/highlight/service.js.map +1 -0
  19. package/components/highlight/themes/dark/highlight.bootstrap.css.js +3 -0
  20. package/components/highlight/themes/dark/highlight.bootstrap.css.js.map +1 -0
  21. package/components/highlight/themes/dark/highlight.fluent.css.d.ts +1 -0
  22. package/components/highlight/themes/dark/highlight.fluent.css.js +3 -0
  23. package/components/highlight/themes/dark/highlight.fluent.css.js.map +1 -0
  24. package/components/highlight/themes/dark/highlight.indigo.css.d.ts +1 -0
  25. package/components/highlight/themes/dark/highlight.indigo.css.js +3 -0
  26. package/components/highlight/themes/dark/highlight.indigo.css.js.map +1 -0
  27. package/components/highlight/themes/dark/highlight.material.css.d.ts +1 -0
  28. package/components/highlight/themes/dark/highlight.material.css.js +3 -0
  29. package/components/highlight/themes/dark/highlight.material.css.js.map +1 -0
  30. package/components/highlight/themes/dark/highlight.shared.css.d.ts +1 -0
  31. package/components/highlight/themes/dark/highlight.shared.css.js +3 -0
  32. package/components/highlight/themes/dark/highlight.shared.css.js.map +1 -0
  33. package/components/highlight/themes/light/highlight.bootstrap.css.d.ts +1 -0
  34. package/components/highlight/themes/light/highlight.bootstrap.css.js +3 -0
  35. package/components/highlight/themes/light/highlight.bootstrap.css.js.map +1 -0
  36. package/components/highlight/themes/light/highlight.fluent.css.d.ts +1 -0
  37. package/components/highlight/themes/light/highlight.fluent.css.js +3 -0
  38. package/components/highlight/themes/light/highlight.fluent.css.js.map +1 -0
  39. package/components/highlight/themes/light/highlight.indigo.css.d.ts +1 -0
  40. package/components/highlight/themes/light/highlight.indigo.css.js +3 -0
  41. package/components/highlight/themes/light/highlight.indigo.css.js.map +1 -0
  42. package/components/highlight/themes/light/highlight.material.css.d.ts +1 -0
  43. package/components/highlight/themes/light/highlight.material.css.js +3 -0
  44. package/components/highlight/themes/light/highlight.material.css.js.map +1 -0
  45. package/components/highlight/themes/light/highlight.shared.css.d.ts +1 -0
  46. package/components/highlight/themes/light/highlight.shared.css.js +3 -0
  47. package/components/highlight/themes/light/highlight.shared.css.js.map +1 -0
  48. package/components/highlight/themes/shared/highlight.common.css.d.ts +1 -0
  49. package/components/highlight/themes/shared/highlight.common.css.js +3 -0
  50. package/components/highlight/themes/shared/highlight.common.css.js.map +1 -0
  51. package/components/highlight/themes/themes.d.ts +2 -0
  52. package/components/highlight/themes/themes.js +47 -0
  53. package/components/highlight/themes/themes.js.map +1 -0
  54. package/components/splitter/splitter.d.ts +240 -0
  55. package/components/splitter/splitter.js +608 -0
  56. package/components/splitter/splitter.js.map +1 -0
  57. package/components/splitter/themes/dark/splitter.bootstrap.css.d.ts +1 -0
  58. package/components/splitter/themes/dark/splitter.bootstrap.css.js +3 -0
  59. package/components/splitter/themes/dark/splitter.bootstrap.css.js.map +1 -0
  60. package/components/splitter/themes/dark/splitter.fluent.css.d.ts +1 -0
  61. package/components/splitter/themes/dark/splitter.fluent.css.js +3 -0
  62. package/components/splitter/themes/dark/splitter.fluent.css.js.map +1 -0
  63. package/components/splitter/themes/dark/splitter.indigo.css.d.ts +1 -0
  64. package/components/splitter/themes/dark/splitter.indigo.css.js +3 -0
  65. package/components/splitter/themes/dark/splitter.indigo.css.js.map +1 -0
  66. package/components/splitter/themes/dark/splitter.material.css.d.ts +1 -0
  67. package/components/splitter/themes/dark/splitter.material.css.js +3 -0
  68. package/components/splitter/themes/dark/splitter.material.css.js.map +1 -0
  69. package/components/splitter/themes/dark/splitter.shared.css.d.ts +1 -0
  70. package/components/splitter/themes/dark/splitter.shared.css.js +3 -0
  71. package/components/splitter/themes/dark/splitter.shared.css.js.map +1 -0
  72. package/components/splitter/themes/light/splitter.bootstrap.css.d.ts +1 -0
  73. package/components/splitter/themes/light/splitter.bootstrap.css.js +3 -0
  74. package/components/splitter/themes/light/splitter.bootstrap.css.js.map +1 -0
  75. package/components/splitter/themes/light/splitter.fluent.css.d.ts +1 -0
  76. package/components/splitter/themes/light/splitter.fluent.css.js +3 -0
  77. package/components/splitter/themes/light/splitter.fluent.css.js.map +1 -0
  78. package/components/splitter/themes/light/splitter.indigo.css.d.ts +1 -0
  79. package/components/splitter/themes/light/splitter.indigo.css.js +3 -0
  80. package/components/splitter/themes/light/splitter.indigo.css.js.map +1 -0
  81. package/components/splitter/themes/light/splitter.material.css.d.ts +1 -0
  82. package/components/splitter/themes/light/splitter.material.css.js +3 -0
  83. package/components/splitter/themes/light/splitter.material.css.js.map +1 -0
  84. package/components/splitter/themes/light/splitter.shared.css.d.ts +1 -0
  85. package/components/splitter/themes/light/splitter.shared.css.js +3 -0
  86. package/components/splitter/themes/light/splitter.shared.css.js.map +1 -0
  87. package/components/splitter/themes/shared/splitter.common.css.d.ts +1 -0
  88. package/components/splitter/themes/shared/splitter.common.css.js +3 -0
  89. package/components/splitter/themes/shared/splitter.common.css.js.map +1 -0
  90. package/components/splitter/themes/shared/splitter.indigo.css.d.ts +1 -0
  91. package/components/splitter/themes/shared/splitter.indigo.css.js +3 -0
  92. package/components/splitter/themes/shared/splitter.indigo.css.js.map +1 -0
  93. package/components/splitter/themes/splitter.base.css.d.ts +1 -0
  94. package/components/splitter/themes/splitter.base.css.js +3 -0
  95. package/components/splitter/themes/splitter.base.css.js.map +1 -0
  96. package/components/splitter/themes/themes.d.ts +2 -0
  97. package/components/splitter/themes/themes.js +48 -0
  98. package/components/splitter/themes/themes.js.map +1 -0
  99. package/components/splitter/types.d.ts +39 -0
  100. package/components/splitter/types.js +2 -0
  101. package/components/splitter/types.js.map +1 -0
  102. package/components/stepper/{animations.d.ts → common/animations.d.ts} +2 -2
  103. package/components/stepper/{animations.js → common/animations.js} +2 -2
  104. package/components/stepper/common/animations.js.map +1 -0
  105. package/components/stepper/common/context.d.ts +9 -0
  106. package/components/stepper/common/context.js +3 -0
  107. package/components/stepper/common/context.js.map +1 -0
  108. package/components/stepper/common/state.d.ts +67 -0
  109. package/components/stepper/common/state.js +134 -0
  110. package/components/stepper/common/state.js.map +1 -0
  111. package/components/stepper/common/types.js +2 -0
  112. package/components/stepper/common/types.js.map +1 -0
  113. package/components/stepper/step.d.ts +101 -55
  114. package/components/stepper/step.js +145 -160
  115. package/components/stepper/step.js.map +1 -1
  116. package/components/stepper/stepper.d.ts +98 -53
  117. package/components/stepper/stepper.js +168 -308
  118. package/components/stepper/stepper.js.map +1 -1
  119. package/components/stepper/themes/step/shared/step.bootstrap.css.js +1 -1
  120. package/components/stepper/themes/step/shared/step.bootstrap.css.js.map +1 -1
  121. package/components/stepper/themes/step/shared/step.common.css.js +1 -1
  122. package/components/stepper/themes/step/shared/step.common.css.js.map +1 -1
  123. package/components/stepper/themes/step/shared/step.indigo.css.js +1 -1
  124. package/components/stepper/themes/step/shared/step.indigo.css.js.map +1 -1
  125. package/components/stepper/themes/step/themes.js +2 -3
  126. package/components/stepper/themes/step/themes.js.map +1 -1
  127. package/components/tabs/themes/tabs.base.css.js +1 -1
  128. package/components/tabs/themes/tabs.base.css.js.map +1 -1
  129. package/components/textarea/textarea.js.map +1 -1
  130. package/components/types.d.ts +1 -0
  131. package/components/types.js.map +1 -1
  132. package/components/visually-hidden/visually-hidden.d.ts +49 -0
  133. package/components/visually-hidden/visually-hidden.js +26 -0
  134. package/components/visually-hidden/visually-hidden.js.map +1 -0
  135. package/custom-elements.json +2681 -379
  136. package/igniteui-webcomponents.css-data.json +2 -2
  137. package/igniteui-webcomponents.html-data.json +1 -1
  138. package/index.d.ts +6 -2
  139. package/index.js +2 -0
  140. package/index.js.map +1 -1
  141. package/package.json +3 -1
  142. package/web-types.json +3 -3
  143. package/components/stepper/animations.js.map +0 -1
  144. package/components/stepper/stepper.common.js +0 -2
  145. package/components/stepper/stepper.common.js.map +0 -1
  146. package/components/stepper/themes/step/shared/step.fluent.css.js +0 -3
  147. package/components/stepper/themes/step/shared/step.fluent.css.js.map +0 -1
  148. /package/components/{stepper/themes/step/shared/step.fluent.css.d.ts → highlight/themes/dark/highlight.bootstrap.css.d.ts} +0 -0
  149. /package/components/stepper/{stepper.common.d.ts → common/types.d.ts} +0 -0
@@ -0,0 +1,134 @@
1
+ class StepperState {
2
+ constructor() {
3
+ this._state = new WeakMap();
4
+ this._steps = [];
5
+ this.linear = false;
6
+ }
7
+ get steps() {
8
+ return this._steps;
9
+ }
10
+ get activeStep() {
11
+ return this._activeStep;
12
+ }
13
+ get accessibleSteps() {
14
+ return this._steps.filter((step) => this.isAccessible(step));
15
+ }
16
+ set(step, state) {
17
+ this.has(step)
18
+ ? this._state.set(step, { ...this.get(step), ...state })
19
+ : this._state.set(step, {
20
+ linearDisabled: false,
21
+ previousCompleted: false,
22
+ visited: false,
23
+ ...state,
24
+ });
25
+ step.requestUpdate();
26
+ }
27
+ has(step) {
28
+ return this._state.has(step);
29
+ }
30
+ get(step) {
31
+ return this._state.get(step);
32
+ }
33
+ delete(step) {
34
+ return this._state.delete(step);
35
+ }
36
+ isAccessible(step) {
37
+ return !(step.disabled || this.get(step)?.linearDisabled);
38
+ }
39
+ setSteps(steps) {
40
+ this._steps = steps;
41
+ }
42
+ changeActiveStep(step) {
43
+ if (step === this._activeStep) {
44
+ return;
45
+ }
46
+ if (this._activeStep) {
47
+ this._activeStep.active = false;
48
+ }
49
+ step.active = true;
50
+ this.set(step, { visited: true });
51
+ this._activeStep = step;
52
+ }
53
+ activateFirstStep() {
54
+ const step = this._steps.find((s) => !s.disabled);
55
+ if (step) {
56
+ this.changeActiveStep(step);
57
+ }
58
+ }
59
+ getAdjacentStep(next = true) {
60
+ const steps = this.accessibleSteps;
61
+ const activeIndex = steps.indexOf(this._activeStep);
62
+ if (activeIndex === -1) {
63
+ return undefined;
64
+ }
65
+ return next ? steps[activeIndex + 1] : steps[activeIndex - 1];
66
+ }
67
+ syncState() {
68
+ for (const [index, step] of this._steps.entries()) {
69
+ step.active = this._activeStep === step;
70
+ if (index > 0) {
71
+ this.set(step, {
72
+ previousCompleted: this._steps[index - 1].complete,
73
+ });
74
+ }
75
+ }
76
+ }
77
+ setVisitedState(value) {
78
+ const activeIndex = this._steps.indexOf(this._activeStep);
79
+ this.linear = value;
80
+ for (const [index, step] of this._steps.entries()) {
81
+ this.set(step, { visited: index <= activeIndex });
82
+ }
83
+ this.setLinearState();
84
+ }
85
+ setLinearState() {
86
+ if (!this.linear) {
87
+ for (const step of this._steps) {
88
+ this.set(step, { linearDisabled: false });
89
+ }
90
+ return;
91
+ }
92
+ const invalidIndex = this._steps.findIndex((step) => !(step.disabled || step.optional) && step.invalid);
93
+ if (invalidIndex > -1) {
94
+ for (const [index, step] of this._steps.entries()) {
95
+ this.set(step, { linearDisabled: index > invalidIndex });
96
+ }
97
+ }
98
+ else {
99
+ for (const step of this._steps) {
100
+ this.set(step, { linearDisabled: false });
101
+ }
102
+ }
103
+ }
104
+ onStepPropertyChanged(step, changed) {
105
+ if (changed.has('active') && step.active) {
106
+ this.changeActiveStep(step);
107
+ }
108
+ this.syncState();
109
+ this.setLinearState();
110
+ }
111
+ stepsChanged() {
112
+ const lastActiveStep = this._steps.findLast((step) => step.active);
113
+ if (lastActiveStep) {
114
+ this.changeActiveStep(lastActiveStep);
115
+ }
116
+ else {
117
+ this.activateFirstStep();
118
+ }
119
+ this.syncState();
120
+ this.setLinearState();
121
+ }
122
+ reset() {
123
+ for (const step of this._steps) {
124
+ this.delete(step);
125
+ }
126
+ this.activateFirstStep();
127
+ this.setLinearState();
128
+ }
129
+ }
130
+ function createStepperState() {
131
+ return new StepperState();
132
+ }
133
+ export { createStepperState };
134
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../src/components/stepper/common/state.ts"],"names":[],"mappings":"AASA,MAAM,YAAY;IAAlB;QACmB,WAAM,GAAG,IAAI,OAAO,EAA+B,CAAC;QAE7D,WAAM,GAAuB,EAAE,CAAC;QAGjC,WAAM,GAAG,KAAK,CAAC;IA0MxB,CAAC;IArMC,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAGD,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAGD,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC;IAcM,GAAG,CAAC,IAAsB,EAAE,KAAyB;QAC1D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YACZ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAE,EAAE,GAAG,KAAK,EAAE,CAAC;YACzD,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;gBACpB,cAAc,EAAE,KAAK;gBACrB,iBAAiB,EAAE,KAAK;gBACxB,OAAO,EAAE,KAAK;gBACd,GAAG,KAAK;aACT,CAAC,CAAC;QAEP,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAGM,GAA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AAc,EAAE,CAAC;YACnB,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;QACxC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC3B,CAAC;QAED,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAGM,KAAK;QACV,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC/B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;QAED,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;CAGF;AAKD,SAAS,kBAAkB;IACzB,OAAO,IAAI,YAAY,EAAE,CAAC;AAC5B,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import type { PropertyValues } from 'lit';\nimport type IgcStepComponent from '../step.js';\n\ntype StepState = {\n linearDisabled: boolean;\n previousCompleted: boolean;\n visited: boolean;\n};\n\nclass StepperState {\n private readonly _state = new WeakMap<IgcStepComponent, StepState>();\n\n private _steps: IgcStepComponent[] = [];\n private _activeStep?: IgcStepComponent;\n\n public linear = false;\n\n //#region Collection accessors\n\n /** Returns all registered step components. */\n public get steps(): readonly IgcStepComponent[] {\n return this._steps;\n }\n\n /** Returns the currently active step. */\n public get activeStep(): IgcStepComponent | undefined {\n return this._activeStep;\n }\n\n /** Returns all steps that are currently accessible (not disabled or linear-disabled). */\n public get accessibleSteps(): IgcStepComponent[] {\n return this._steps.filter((step) => this.isAccessible(step));\n }\n\n //#endregion\n\n //#region Per-step state\n\n /**\n * Sets the state of a given step component.\n *\n * If the step already has an existing state, it merges the new state with the existing one.\n * If the step does not have an existing state, it initializes it with default values and then applies the new state.\n *\n * After updating the state, it requests an update on the step component to reflect the changes in the UI.\n */\n public set(step: IgcStepComponent, state: Partial<StepState>): void {\n this.has(step)\n ? this._state.set(step, { ...this.get(step)!, ...state })\n : this._state.set(step, {\n linearDisabled: false,\n previousCompleted: false,\n visited: false,\n ...state,\n });\n\n step.requestUpdate();\n }\n\n /** Checks if a given step component has an associated state. */\n public has(step: IgcStepComponent): boolean {\n return this._state.has(step);\n }\n\n /** Retrieves the state of a given step component. */\n public get(step: IgcStepComponent): StepState | undefined {\n return this._state.get(step);\n }\n\n /** Deletes the state of a given step component. */\n public delete(step: IgcStepComponent): boolean {\n return this._state.delete(step);\n }\n\n /**\n * Determines if a given step component is accessible based on its `disabled` state\n * and the `linearDisabled` state from the stepper state management.\n */\n public isAccessible(step: IgcStepComponent): boolean {\n return !(step.disabled || this.get(step)?.linearDisabled);\n }\n\n //#endregion\n\n //#region Active step management\n\n /** Updates the registered steps collection. */\n public setSteps(steps: IgcStepComponent[]): void {\n this._steps = steps;\n }\n\n /** Changes the active step, deactivating the previous one and marking the new one as visited. */\n public changeActiveStep(step: IgcStepComponent): void {\n if (step === this._activeStep) {\n return;\n }\n\n if (this._activeStep) {\n this._activeStep.active = false;\n }\n step.active = true;\n this.set(step, { visited: true });\n this._activeStep = step;\n }\n\n /** Activates the first non-disabled step. */\n public activateFirstStep(): void {\n const step = this._steps.find((s) => !s.disabled);\n if (step) {\n this.changeActiveStep(step);\n }\n }\n\n /** Returns the next or previous accessible step relative to the active step. */\n public getAdjacentStep(next = true): IgcStepComponent | undefined {\n const steps = this.accessibleSteps;\n const activeIndex = steps.indexOf(this._activeStep!);\n\n if (activeIndex === -1) {\n return undefined;\n }\n\n return next ? steps[activeIndex + 1] : steps[activeIndex - 1];\n }\n\n //#endregion\n\n //#region State synchronization\n\n /** Synchronizes the `active` and `previousCompleted` state across all steps. */\n public syncState(): void {\n for (const [index, step] of this._steps.entries()) {\n step.active = this._activeStep === step;\n\n if (index > 0) {\n this.set(step, {\n previousCompleted: this._steps[index - 1].complete,\n });\n }\n }\n }\n\n /**\n * Sets the visited state for all steps based on the current active step and the linear mode.\n */\n public setVisitedState(value: boolean): void {\n const activeIndex = this._steps.indexOf(this._activeStep!);\n this.linear = value;\n\n for (const [index, step] of this._steps.entries()) {\n this.set(step, { visited: index <= activeIndex });\n }\n\n this.setLinearState();\n }\n\n /** Computes and applies the linear-disabled state for all steps. */\n public setLinearState(): void {\n if (!this.linear) {\n for (const step of this._steps) {\n this.set(step, { linearDisabled: false });\n }\n return;\n }\n\n const invalidIndex = this._steps.findIndex(\n (step) => !(step.disabled || step.optional) && step.invalid\n );\n\n if (invalidIndex > -1) {\n for (const [index, step] of this._steps.entries()) {\n this.set(step, { linearDisabled: index > invalidIndex });\n }\n } else {\n for (const step of this._steps) {\n this.set(step, { linearDisabled: false });\n }\n }\n }\n\n /** Handles step property changes, updating active step tracking and re-syncing state. */\n public onStepPropertyChanged(\n step: IgcStepComponent,\n changed: PropertyValues<IgcStepComponent>\n ): void {\n if (changed.has('active') && step.active) {\n this.changeActiveStep(step);\n }\n this.syncState();\n this.setLinearState();\n }\n\n /** Processes a change in the steps collection, resolving the active step and syncing state. */\n public stepsChanged(): void {\n const lastActiveStep = this._steps.findLast((step) => step.active);\n\n if (lastActiveStep) {\n this.changeActiveStep(lastActiveStep);\n } else {\n this.activateFirstStep();\n }\n\n this.syncState();\n this.setLinearState();\n }\n\n /** Resets all step states and activates the first step. */\n public reset(): void {\n for (const step of this._steps) {\n this.delete(step);\n }\n\n this.activateFirstStep();\n this.setLinearState();\n }\n\n //#endregion\n}\n\n/**\n * Creates a new instance of the StepperState class, which manages the state of steps in a stepper component.\n */\nfunction createStepperState(): StepperState {\n return new StepperState();\n}\n\nexport { createStepperState };\nexport type { StepperState };\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/stepper/common/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface IgcActiveStepChangingEventArgs {\n oldIndex: number;\n newIndex: number;\n}\n\nexport interface IgcActiveStepChangedEventArgs {\n index: number;\n}\n\nexport interface IgcStepperComponentEventMap {\n igcActiveStepChanging: CustomEvent<IgcActiveStepChangingEventArgs>;\n igcActiveStepChanged: CustomEvent<IgcActiveStepChangedEventArgs>;\n}\n"]}
@@ -1,9 +1,14 @@
1
- import { LitElement, nothing } from 'lit';
2
- import type { StepperOrientation, StepperStepType, StepperTitlePosition } from '../types.js';
3
- import { type Animation } from './animations.js';
1
+ import { LitElement, type PropertyValues } from 'lit';
4
2
  /**
5
- * The step component is used within the `igc-stepper` element and it holds the content of each step.
6
- * It also supports custom indicators, title and subtitle.
3
+ * A step component used within an `igc-stepper` to represent an individual step in a wizard-like workflow.
4
+ *
5
+ * @remarks
6
+ * Each step has a header (with an indicator, title, and subtitle) and a content area.
7
+ * Steps can be marked as `active`, `complete`, `disabled`, `optional`, or `invalid`
8
+ * to control their appearance and behavior within the stepper.
9
+ *
10
+ * Custom indicators can be provided via the `indicator` slot, and the content area
11
+ * is rendered in the default slot.
7
12
  *
8
13
  * @element igc-step
9
14
  *
@@ -25,82 +30,123 @@ import { type Animation } from './animations.js';
25
30
  * @csspart header - Wrapper of the step's `indicator` and `text`.
26
31
  * @csspart indicator - The indicator of the step.
27
32
  * @csspart text - Wrapper of the step's `title` and `subtitle`.
28
- * @csspart empty - Indicates that no title and subtitle has been provided to the step. Applies to `text`.
33
+ * @csspart empty - Indicates that no title and subtitle have been provided to the step. Applies to `text`.
29
34
  * @csspart title - The title of the step.
30
35
  * @csspart subtitle - The subtitle of the step.
31
36
  * @csspart body - Wrapper of the step's `content`.
32
- * @csspart content - The steps `content`.
37
+ * @csspart content - The step's `content`.
38
+ *
39
+ * @example
40
+ * ```html
41
+ * <igc-step>
42
+ * <igc-icon slot="indicator" name="home"></igc-icon>
43
+ * <span slot="title">Home</span>
44
+ * <span slot="subtitle">Return to the home page</span>
45
+ * <p>Welcome! This is the first step.</p>
46
+ * </igc-step>
47
+ * ```
48
+ *
49
+ * @example Step with state attributes
50
+ * ```html
51
+ * <igc-step complete>
52
+ * <span slot="title">Completed step</span>
53
+ * <p>This step has been completed.</p>
54
+ * </igc-step>
55
+ *
56
+ * <igc-step active invalid>
57
+ * <span slot="title">Current step</span>
58
+ * <p>This step has validation errors.</p>
59
+ * </igc-step>
60
+ *
61
+ * <igc-step disabled>
62
+ * <span slot="title">Disabled step</span>
63
+ * <p>This step is not accessible.</p>
64
+ * </igc-step>
65
+ * ```
33
66
  */
34
67
  export default class IgcStepComponent extends LitElement {
35
68
  static readonly tagName = "igc-step";
36
69
  static styles: import("lit").CSSResult[];
37
70
  static register(): void;
38
- private bodyRef;
39
- private contentRef;
40
- private bodyAnimationPlayer;
41
- private contentAnimationPlayer;
42
- private _titleChildren;
43
- private _subTitleChildren;
44
- header: HTMLElement;
45
- contentBody: HTMLElement;
46
- /** Gets/sets whether the step is invalid. */
71
+ private readonly _bodyRef;
72
+ private readonly _contentRef;
73
+ private readonly _bodyPlayer;
74
+ private readonly _contentPlayer;
75
+ private readonly _slots;
76
+ private readonly _stepperContext?;
77
+ private get _stepper();
78
+ private get _state();
79
+ private get _isHorizontal();
80
+ private get _hasTitle();
81
+ private get _hasSubtitle();
82
+ private get _animation();
83
+ private get _animationDuration();
84
+ private get _contentTop();
85
+ private get _index();
86
+ private get _orientation();
87
+ private get _titlePosition();
88
+ private get _stepType();
89
+ private get _previousComplete();
90
+ private get _visited();
91
+ private get _isAccessible();
92
+ /**
93
+ * Whether the step is invalid.
94
+ *
95
+ * Invalid steps are styled with an error state and are not
96
+ * interactive when the stepper is in linear mode.
97
+ *
98
+ * @attr invalid
99
+ * @default false
100
+ */
47
101
  invalid: boolean;
48
- /** Gets/sets whether the step is activе. */
102
+ /**
103
+ * Whether the step is active.
104
+ *
105
+ * Active steps are styled with an active state and their content is visible.
106
+ *
107
+ * @attr active
108
+ * @default false
109
+ */
49
110
  active: boolean;
50
111
  /**
51
- * Gets/sets whether the step is optional.
112
+ * Whether the step is optional.
52
113
  *
53
- * @remarks
54
114
  * Optional steps validity does not affect the default behavior when the stepper is in linear mode i.e.
55
115
  * if optional step is invalid the user could still move to the next step.
116
+ *
117
+ * @attr optional
118
+ * @default false
56
119
  */
57
120
  optional: boolean;
58
- /** Gets/sets whether the step is interactable. */
121
+ /**
122
+ * Whether the step is disabled.
123
+ *
124
+ * Disabled steps are styled with a disabled state and are not interactive.
125
+ *
126
+ * @attr disabled
127
+ * @default false
128
+ */
59
129
  disabled: boolean;
60
- /** Gets/sets whether the step is completed.
130
+ /**
131
+ * Whether the step is completed.
61
132
  *
62
- * @remarks
63
- * When set to `true` the following separator is styled `solid`.
133
+ * @attr complete
134
+ * @default false
64
135
  */
65
136
  complete: boolean;
66
- /** @hidden @internal @private */
67
- previousComplete: boolean;
68
- /** @hidden @internal @private */
69
- stepType: StepperStepType;
70
- /** @hidden @internal @private */
71
- titlePosition: StepperTitlePosition;
72
- /** @hidden @internal @private */
73
- orientation: StepperOrientation;
74
- /** @hidden @internal @private */
75
- index: number;
76
- /** @hidden @internal @private */
77
- contentTop: boolean;
78
- /** @hidden @internal @private */
79
- linearDisabled: boolean;
80
- /** @hidden @internal @private */
81
- visited: boolean;
82
- /** @hidden @internal @private */
83
- animation: Animation;
84
- /** @hidden @internal @private */
85
- animationDuration: number;
86
137
  constructor();
138
+ protected willUpdate(changed: PropertyValues<this>): void;
87
139
  /**
88
140
  * @hidden @internal
89
141
  * @deprecated since 5.4.0. Use the Stepper's `navigateTo` method instead.
90
142
  */
91
143
  toggleAnimation(type: 'in' | 'out', direction?: 'normal' | 'reverse'): Promise<boolean>;
92
- protected activeChange(): void;
93
- protected disabledInvalidOptionalChange(): void;
94
- protected completeChange(): void;
95
- private handleClick;
96
- private handleKeydown;
97
- /** @hidden @internal */
98
- get isAccessible(): boolean;
99
- private get headerContainerParts();
100
- private get textParts();
101
- protected renderIndicator(): typeof nothing | import("lit-html").TemplateResult<1>;
102
- protected renderTitleAndSubtitle(): import("lit-html").TemplateResult<1>;
103
- protected renderContent(): import("lit-html").TemplateResult<1>;
144
+ private get _headerContainerParts();
145
+ private get _textParts();
146
+ private _renderIndicator;
147
+ private _renderTitleAndSubtitle;
148
+ private _renderHeader;
149
+ private _renderContent;
104
150
  protected render(): import("lit-html").TemplateResult<1>;
105
151
  }
106
152
  declare global {