noph-ui 0.21.12 → 0.21.14

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.
@@ -78,7 +78,7 @@
78
78
  {:else if attributes.variant === 'button'}
79
79
  <button
80
80
  {...attributes}
81
- type="button"
81
+ type={attributes.type ?? 'button'}
82
82
  onfocus={(event) => {
83
83
  focused = true
84
84
  ;(onfocus as FocusEventHandler<HTMLButtonElement>)?.(event)
@@ -113,6 +113,8 @@
113
113
  if (checkValidity()) {
114
114
  errorRaw = error
115
115
  errorTextRaw = errorText
116
+ } else {
117
+ focusOnInvalid = true
116
118
  }
117
119
  } else {
118
120
  focusOnInvalid = true
@@ -1,2 +1 @@
1
1
  export declare const isFirstInvalidControlInForm: (form: HTMLFormElement | null, control: HTMLElement) => boolean;
2
- export declare const getFirstInvalidControlInForm: (form: HTMLFormElement) => Element | undefined;
@@ -2,15 +2,5 @@ export const isFirstInvalidControlInForm = (form, control) => {
2
2
  if (!form) {
3
3
  return true;
4
4
  }
5
- return getFirstInvalidControlInForm(form) === control;
6
- };
7
- export const getFirstInvalidControlInForm = (form) => {
8
- let firstInvalidControl;
9
- for (const element of form.elements) {
10
- if (element.matches(':invalid')) {
11
- firstInvalidControl = element;
12
- break;
13
- }
14
- }
15
- return firstInvalidControl;
5
+ return form.querySelector(':invalid') === control;
16
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.21.12",
3
+ "version": "0.21.14",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {