@microsoft/atlas-js
Advanced tools
Comparing version 1.5.5 to 1.6.0
@@ -75,3 +75,3 @@ export declare const defaultMessageStrings: { | ||
} | ||
export declare type NavigationSteps = 'follow' | 'hash-reload' | 'replace' | 'reload' | null; | ||
export type NavigationSteps = 'follow' | 'hash-reload' | 'replace' | 'reload' | null; | ||
export interface FormValidationError { | ||
@@ -81,3 +81,3 @@ message: string; | ||
} | ||
export declare type FormValidationResult = { | ||
export type FormValidationResult = { | ||
valid: true; | ||
@@ -88,3 +88,3 @@ } | { | ||
}; | ||
declare type Validator = (input: HTMLValueElement, label: string) => string | null; | ||
type Validator = (input: HTMLValueElement, label: string) => string | null; | ||
export declare function getLabel(input: HTMLValueElement): string; | ||
@@ -91,0 +91,0 @@ export declare function getField(input: HTMLValueElement): HTMLElement; |
@@ -154,3 +154,3 @@ import { generateElementId, kebabToCamelCase } from '../utilities/util'; | ||
this.submitting = true; | ||
setBusySubmitButton(form, this.submitting); | ||
setBusySubmitButton(event, form, this.submitting); | ||
const result = await this.validateForm(form); | ||
@@ -229,3 +229,3 @@ if (!result.valid) { | ||
this.submitting = isNavigating; | ||
setBusySubmitButton(form, this.submitting); | ||
setBusySubmitButton(event, form, this.submitting); | ||
} | ||
@@ -468,6 +468,12 @@ } | ||
} | ||
function setBusySubmitButton(form, isLoading) { | ||
function setBusySubmitButton(event, form, isLoading) { | ||
const submitter = event.submitter; | ||
Array.from(form.elements).forEach(element => { | ||
if (element instanceof HTMLButtonElement && element.type === 'submit') { | ||
element.classList.toggle('is-loading', isLoading); | ||
if (submitter && submitter === element) { | ||
element.classList.toggle('is-loading', isLoading); | ||
} | ||
else { | ||
element.disabled = isLoading; | ||
} | ||
} | ||
@@ -474,0 +480,0 @@ }); |
@@ -0,1 +1,2 @@ | ||
export * from './behaviors/dismiss'; | ||
export * from './behaviors/popover'; | ||
@@ -2,0 +3,0 @@ export * from './behaviors/snap-scroll'; |
@@ -0,1 +1,2 @@ | ||
export * from './behaviors/dismiss'; | ||
export * from './behaviors/popover'; | ||
@@ -2,0 +3,0 @@ export * from './behaviors/snap-scroll'; |
{ | ||
"name": "@microsoft/atlas-js", | ||
"version": "1.5.5", | ||
"version": "1.6.0", | ||
"public": true, | ||
@@ -36,11 +36,11 @@ "description": "Scripts backing the Atlas Design System used by Microsoft's Developer Relations.", | ||
"devDependencies": { | ||
"eslint": "^8.24.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint": "^8.38.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-jasmine": "^4.1.3", | ||
"eslint-plugin-jsdoc": "^39.3.6", | ||
"eslint-plugin-security": "^1.5.0", | ||
"rimraf": "^3.0.2", | ||
"tslib": "^2.4.0", | ||
"typescript": "^4.8.4" | ||
"eslint-plugin-jsdoc": "^41.1.1", | ||
"eslint-plugin-security": "^1.7.1", | ||
"rimraf": "^5.0.0", | ||
"tslib": "^2.5.0", | ||
"typescript": "^5.0.4" | ||
} | ||
} |
@@ -192,3 +192,3 @@ import { generateElementId, kebabToCamelCase } from '../utilities/util'; | ||
this.submitting = true; | ||
setBusySubmitButton(form, this.submitting); | ||
setBusySubmitButton(event, form, this.submitting); | ||
const result = await this.validateForm(form); | ||
@@ -279,3 +279,3 @@ if (!result.valid) { | ||
this.submitting = isNavigating; | ||
setBusySubmitButton(form, this.submitting); | ||
setBusySubmitButton(event, form, this.submitting); | ||
} | ||
@@ -630,6 +630,11 @@ } | ||
function setBusySubmitButton(form: HTMLFormElement, isLoading: boolean) { | ||
function setBusySubmitButton(event: Event, form: HTMLFormElement, isLoading: boolean) { | ||
const submitter = (event as SubmitEvent).submitter; | ||
Array.from(form.elements).forEach(element => { | ||
if (element instanceof HTMLButtonElement && element.type === 'submit') { | ||
element.classList.toggle('is-loading', isLoading); | ||
if (submitter && submitter === element) { | ||
element.classList.toggle('is-loading', isLoading); | ||
} else { | ||
element.disabled = isLoading; | ||
} | ||
} | ||
@@ -636,0 +641,0 @@ }); |
@@ -0,1 +1,2 @@ | ||
export * from './behaviors/dismiss'; | ||
export * from './behaviors/popover'; | ||
@@ -2,0 +3,0 @@ export * from './behaviors/snap-scroll'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
67106
26
1719