ember-validated-form 6.1.2 → 7.0.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 CHANGED
@@ -1,3 +1,32 @@
1
+ # [7.0.0](https://github.com/adfinis/ember-validated-form/compare/v6.2.0...v7.0.0) (2023-11-21)
2
+
3
+
4
+ ### chore
5
+
6
+ * **deps:** update ember and dependencies ([fc26b0b](https://github.com/adfinis/ember-validated-form/commit/fc26b0be302c24dafccad37a53dc7dd2bcc59bc9))
7
+
8
+
9
+ ### Features
10
+
11
+ * allow html attributes to be passed to wrapping form element ([b29f4d8](https://github.com/adfinis/ember-validated-form/commit/b29f4d88133aa58a9613aa9bf9f1f6a2761a7974))
12
+
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * **deps:** Drop support for Ember v3.
17
+
18
+ # [6.2.0](https://github.com/adfinis/ember-validated-form/compare/v6.1.2...v6.2.0) (2023-02-23)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * scroll error into view with nested key names ([#904](https://github.com/adfinis/ember-validated-form/issues/904)) ([5c192a5](https://github.com/adfinis/ember-validated-form/commit/5c192a5b00abf05d80f36d1fad8b67a79a36e43c))
24
+
25
+
26
+ ### Features
27
+
28
+ * **a11y:** add aria invalid and describedby attributes on validation ([6e16a51](https://github.com/adfinis/ember-validated-form/commit/6e16a5122f134ca991205c03c0dd8628288e4b08)), closes [#48](https://github.com/adfinis/ember-validated-form/issues/48)
29
+
1
30
  ## [6.1.2](https://github.com/adfinis/ember-validated-form/compare/v6.1.1...v6.1.2) (2022-09-20)
2
31
 
3
32
 
@@ -43,7 +43,7 @@ export default class ValidatedButtonComponent extends Component {
43
43
  if (macroCondition(getOwnConfig().scrollErrorIntoView)) {
44
44
  if (model.errors[0]?.key) {
45
45
  document
46
- .querySelector(`[name=${model.errors[0].key}]`)
46
+ .querySelector(`[name=${model.errors[0].key.replaceAll(".", "\\.")}]`)
47
47
  ?.scrollIntoView({ behavior: "smooth" });
48
48
  }
49
49
  }
@@ -1,4 +1,8 @@
1
- <form autocomplete={{@autocomplete}} class={{if this.submitted "submitted"}}>
1
+ <form
2
+ autocomplete={{@autocomplete}}
3
+ class={{if this.submitted "submitted"}}
4
+ ...attributes
5
+ >
2
6
  {{yield
3
7
  (hash
4
8
  model=@model
@@ -48,7 +48,9 @@ export default class ValidatedFormComponent extends Component {
48
48
  if (macroCondition(getOwnConfig().scrollErrorIntoView)) {
49
49
  if (model.errors[0]?.key) {
50
50
  document
51
- .querySelector(`[name=${model.errors[0].key}]`)
51
+ .querySelector(
52
+ `[name=${model.errors[0].key.replaceAll(".", "\\.")}]`
53
+ )
52
54
  ?.scrollIntoView({ behavior: "smooth" });
53
55
  }
54
56
  }
@@ -1,9 +1,10 @@
1
1
  {{#if (macroCondition (macroGetOwnConfig "isUikit"))}}
2
- <small class="uk-text-danger" ...attributes>
2
+ <small id={{@id}} class="uk-text-danger" ...attributes>
3
3
  {{yield}}{{this.errorString}}
4
4
  </small>
5
5
  {{else}}
6
6
  <span
7
+ id={{@id}}
7
8
  class={{if
8
9
  (macroCondition (macroGetOwnConfig "isBootstrap"))
9
10
  "d-block invalid-feedback"
@@ -1,4 +1,5 @@
1
1
  <small
2
+ id={{@id}}
2
3
  class={{class-list
3
4
  (if (macroCondition (macroGetOwnConfig "isUikit")) "uk-text-muted")
4
5
  (if
@@ -86,9 +86,9 @@
86
86
  @update={{@update}}
87
87
  ...attributes
88
88
  />
89
- {{else if (and
90
- (eq @type "date") (not-eq this.dateComponent this.inputComponent)
91
- )}}
89
+ {{else if
90
+ (and (eq @type "date") (not-eq this.dateComponent this.inputComponent))
91
+ }}
92
92
  <this.dateComponent
93
93
  @autocomplete={{@autocomplete}}
94
94
  @autofocus={{@autofocus}}
@@ -14,6 +14,7 @@
14
14
  id="{{@inputId}}-{{i}}"
15
15
  disabled={{@disabled}}
16
16
  {{on "input" (fn this.onUpdate option.key)}}
17
+ ...attributes
17
18
  />
18
19
  {{option.label}}
19
20
  </label>
@@ -29,6 +30,7 @@
29
30
  id="{{@inputId}}-{{i}}"
30
31
  disabled={{@disabled}}
31
32
  {{on "input" (fn this.onUpdate option.key)}}
33
+ ...attributes
32
34
  />
33
35
  <label
34
36
  class="custom-control-label"
@@ -10,6 +10,7 @@
10
10
  disabled={{@disabled}}
11
11
  checked={{@value}}
12
12
  {{on "input" this.onUpdate}}
13
+ ...attributes
13
14
  />
14
15
  </@labelComponent>
15
16
  {{else if (macroCondition (macroGetOwnConfig "isBootstrap"))}}
@@ -24,6 +25,7 @@
24
25
  disabled={{@disabled}}
25
26
  checked={{@value}}
26
27
  {{on "input" this.onUpdate}}
28
+ ...attributes
27
29
  />
28
30
  <@labelComponent class="custom-control-label" />
29
31
  </div>
@@ -15,6 +15,7 @@
15
15
  id="{{@inputId}}-{{i}}"
16
16
  disabled={{@disabled}}
17
17
  {{on "input" (fn this.onUpdate option.key)}}
18
+ ...attributes
18
19
  />
19
20
  {{option.label}}
20
21
  </label>
@@ -31,6 +32,7 @@
31
32
  id="{{@inputId}}-{{i}}"
32
33
  disabled={{@disabled}}
33
34
  {{on "input" (fn this.onUpdate option.key)}}
35
+ ...attributes
34
36
  />
35
37
  <label
36
38
  class="custom-control-label"
@@ -21,11 +21,11 @@
21
21
  }}
22
22
 
23
23
  {{#if @hint}}
24
- <this.hintComponent @hint={{@hint}} />
24
+ <this.hintComponent @hint={{@hint}} id={{this.hintId}} />
25
25
  {{/if}}
26
26
 
27
27
  {{#if (and this.showValidity this.errors)}}
28
- <this.errorComponent @errors={{this.errors}} />
28
+ <this.errorComponent @errors={{this.errors}} id={{this.errorId}} />
29
29
  {{/if}}
30
30
  {{else}}
31
31
  <this.renderComponent
@@ -64,12 +64,20 @@
64
64
  }}
65
65
  @hintComponent={{if
66
66
  @hint
67
- (component (ensure-safe-component this.hintComponent) hint=@hint)
67
+ (component
68
+ (ensure-safe-component this.hintComponent) hint=@hint id=this.hintId
69
+ )
68
70
  }}
69
71
  @errorComponent={{if
70
72
  (and this.showValidity this.errors)
71
- (component (ensure-safe-component this.errorComponent) errors=this.errors)
73
+ (component
74
+ (ensure-safe-component this.errorComponent)
75
+ errors=this.errors
76
+ id=this.errorId
77
+ )
72
78
  }}
79
+ aria-invalid={{if this.isInvalid "true"}}
80
+ aria-describedby={{if this.isInvalid this.errorId this.hintId}}
73
81
  ...attributes
74
82
  />
75
83
  {{/if}}
@@ -1,5 +1,6 @@
1
1
  import { action, set, get } from "@ember/object";
2
2
  import { guidFor } from "@ember/object/internals";
3
+ import { isEmpty } from "@ember/utils";
3
4
  import Component from "@glimmer/component";
4
5
  import { tracked } from "@glimmer/tracking";
5
6
 
@@ -21,6 +22,14 @@ import passedOrDefault from "ember-validated-form/passed-or-default";
21
22
  export default class ValidatedInputComponent extends Component {
22
23
  inputId = guidFor(this);
23
24
 
25
+ get errorId() {
26
+ return `${this.inputId}-error`;
27
+ }
28
+
29
+ get hintId() {
30
+ return !isEmpty(this.args.hint) ? `${this.inputId}-hint` : null;
31
+ }
32
+
24
33
  @tracked dirty;
25
34
  @tracked required;
26
35
  @tracked type;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-validated-form",
3
- "version": "6.1.2",
3
+ "version": "7.0.0",
4
4
  "description": "Easily create forms with client-side validations",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -20,44 +20,49 @@
20
20
  },
21
21
  "scripts": {
22
22
  "build": "ember build --environment=production",
23
- "lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
24
- "lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
23
+ "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
24
+ "lint:css": "stylelint \"**/*.css\"",
25
+ "lint:css:fix": "concurrently \"npm:lint:css -- --fix\"",
26
+ "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
25
27
  "lint:hbs": "ember-template-lint .",
26
28
  "lint:hbs:fix": "ember-template-lint . --fix",
27
29
  "lint:js": "eslint . --cache",
28
30
  "lint:js:fix": "eslint . --fix",
29
31
  "start": "ember serve",
30
- "test": "npm-run-all lint test:*",
32
+ "test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
31
33
  "test:ember": "ember test",
32
34
  "test:ember-compatibility": "ember try:each",
33
35
  "prepare": "husky install"
34
36
  },
35
37
  "dependencies": {
36
- "@embroider/macros": "^1.8.3",
37
- "@embroider/util": "^1.8.3",
38
+ "@embroider/macros": "^1.10.0",
39
+ "@embroider/util": "^1.10.0",
38
40
  "@glimmer/component": "^1.1.2",
39
41
  "@glimmer/tracking": "^1.1.2",
40
- "ember-changeset": "^4.1.1",
41
- "ember-changeset-validations": "^4.1.0",
42
+ "ember-changeset": "^4.1.2",
43
+ "ember-changeset-validations": "^4.1.1",
42
44
  "ember-cli-babel": "^7.26.11",
43
- "ember-cli-htmlbars": "^6.1.1",
45
+ "ember-cli-htmlbars": "^6.2.0",
44
46
  "ember-truth-helpers": "^3.1.1"
45
47
  },
46
48
  "devDependencies": {
47
- "@adfinis-sygroup/eslint-config": "1.5.0",
48
- "@adfinis-sygroup/semantic-release-config": "3.4.0",
49
+ "@adfinis/eslint-config": "2.0.0",
50
+ "@adfinis/semantic-release-config": "4.0.0",
51
+ "@babel/eslint-parser": "7.21.3",
52
+ "@babel/plugin-proposal-decorators": "7.21.0",
49
53
  "@ember/optional-features": "2.0.0",
50
- "@ember/test-helpers": "2.8.1",
51
- "@embroider/test-setup": "1.8.3",
54
+ "@ember/string": "3.0.1",
55
+ "@ember/test-helpers": "2.9.3",
56
+ "@embroider/test-setup": "2.1.1",
52
57
  "@fortawesome/ember-fontawesome": "0.4.1",
53
- "@fortawesome/free-solid-svg-icons": "6.2.0",
54
- "babel-eslint": "10.1.0",
58
+ "@fortawesome/free-solid-svg-icons": "6.4.0",
55
59
  "broccoli-asset-rev": "3.0.0",
56
- "ember-auto-import": "2.4.2",
57
- "ember-cli": "4.7.0",
58
- "ember-cli-addon-docs": "5.0.0",
60
+ "concurrently": "8.0.1",
61
+ "ember-auto-import": "2.6.3",
62
+ "ember-cli": "4.12.1",
63
+ "ember-cli-addon-docs": "5.2.0",
59
64
  "ember-cli-dependency-checker": "3.3.1",
60
- "ember-cli-deploy": "1.0.2",
65
+ "ember-cli-deploy": "2.0.0",
61
66
  "ember-cli-deploy-build": "2.0.0",
62
67
  "ember-cli-deploy-git": "1.3.4",
63
68
  "ember-cli-deploy-git-ci": "1.0.1",
@@ -65,36 +70,40 @@
65
70
  "ember-cli-sri": "2.1.1",
66
71
  "ember-cli-terser": "4.0.2",
67
72
  "ember-cli-test-loader": "3.0.0",
68
- "ember-concurrency": "2.3.7",
69
- "ember-data": "4.4.1",
70
- "ember-disable-prototype-extensions": "1.1.3",
71
- "ember-flatpickr": "3.2.3",
73
+ "ember-concurrency": "3.0.0",
74
+ "ember-data": "4.12.0",
75
+ "ember-flatpickr": "4.0.0",
72
76
  "ember-load-initializers": "2.1.2",
73
- "ember-qunit": "5.1.5",
74
- "ember-resolver": "8.0.3",
75
- "ember-source": "4.7.0",
77
+ "ember-qunit": "6.2.0",
78
+ "ember-resolver": "10.0.0",
79
+ "ember-source": "4.12.0",
76
80
  "ember-source-channel-url": "3.0.0",
77
- "ember-template-lint": "4.14.0",
78
- "ember-template-lint-plugin-prettier": "4.0.0",
81
+ "ember-template-lint": "5.7.2",
82
+ "ember-template-lint-plugin-prettier": "4.1.0",
79
83
  "ember-try": "2.0.0",
80
- "eslint": "7.32.0",
81
- "eslint-config-prettier": "8.5.0",
82
- "eslint-plugin-ember": "11.0.6",
83
- "eslint-plugin-import": "2.26.0",
84
- "eslint-plugin-node": "11.1.0",
84
+ "eslint": "8.39.0",
85
+ "eslint-config-prettier": "8.8.0",
86
+ "eslint-plugin-ember": "11.5.2",
87
+ "eslint-plugin-import": "2.27.5",
88
+ "eslint-plugin-n": "15.7.0",
85
89
  "eslint-plugin-prettier": "4.2.1",
86
- "eslint-plugin-qunit": "7.3.1",
87
- "husky": "8.0.1",
88
- "lint-staged": "13.0.3",
90
+ "eslint-plugin-qunit": "7.3.4",
91
+ "husky": "8.0.3",
92
+ "lint-staged": "13.2.1",
89
93
  "loader.js": "4.7.0",
90
- "npm-run-all": "4.1.5",
91
- "prettier": "2.7.1",
92
- "qunit": "2.19.1",
94
+ "prettier": "2.8.8",
95
+ "qunit": "2.19.4",
93
96
  "qunit-dom": "2.0.0",
94
- "webpack": "5.74.0"
97
+ "stylelint": "15.10.3",
98
+ "stylelint-config-standard": "33.0.0",
99
+ "stylelint-prettier": "3.0.0",
100
+ "webpack": "5.88.2"
101
+ },
102
+ "peerDependencies": {
103
+ "ember-source": "^4.0.0"
95
104
  },
96
105
  "engines": {
97
- "node": "14.* || >= 16"
106
+ "node": "14.* || 16.* || >= 18"
98
107
  },
99
108
  "ember": {
100
109
  "edition": "octane"
@@ -104,12 +113,13 @@
104
113
  "demoURL": "https://adfinis.github.io/ember-validated-form"
105
114
  },
106
115
  "release": {
107
- "extends": "@adfinis-sygroup/semantic-release-config"
116
+ "extends": "@adfinis/semantic-release-config"
108
117
  },
109
118
  "lint-staged": {
110
119
  "*.js": "eslint --cache --fix",
111
120
  "*.hbs": "ember-template-lint --fix",
112
- "*.{scss,graphql,json,md,yml}": "prettier --write"
121
+ "*.css": "stylelint --fix",
122
+ "*.{json,md,yml}": "prettier --write"
113
123
  },
114
124
  "commitlint": {
115
125
  "extends": [
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = function (/* environment, appConfig */) {
4
- return {};
5
- };