@dataloop-ai/components 0.17.51 → 0.17.52

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.17.51",
3
+ "version": "0.17.52",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -90,6 +90,18 @@ export class Step {
90
90
  set(this._state, 'sidebarNavigation', value)
91
91
  }
92
92
 
93
+ public clearError() {
94
+ set(this._state, 'error', '')
95
+ }
96
+
97
+ public clearWarning() {
98
+ set(this._state, 'warning', '')
99
+ }
100
+
101
+ public clearCompleted() {
102
+ set(this._state, 'completed', false)
103
+ }
104
+
93
105
  public reset() {
94
106
  for (const key of Object.keys(this._initialState)) {
95
107
  if (key !== 'active') {
@@ -163,4 +163,38 @@ export class Stepper {
163
163
 
164
164
  stepToReset.reset()
165
165
  }
166
+
167
+ /**
168
+ *
169
+ * @param options { step?: number; error?: boolean, warning?: boolean, completed?: boolean }
170
+ * @param options.step The step to clear its state
171
+ * @returns
172
+ */
173
+ public clearStepState(
174
+ options: {
175
+ step?: Step
176
+ error?: boolean
177
+ warning?: boolean
178
+ completed?: boolean
179
+ } = {}
180
+ ) {
181
+ const { step, error, warning, completed } = options
182
+ const stepToClear = step ?? this.currentStep
183
+
184
+ if (!stepToClear) {
185
+ return
186
+ }
187
+
188
+ if (error) {
189
+ stepToClear.clearError()
190
+ }
191
+
192
+ if (warning) {
193
+ stepToClear.clearWarning()
194
+ }
195
+
196
+ if (completed) {
197
+ stepToClear.clearCompleted()
198
+ }
199
+ }
166
200
  }