@brightspace-ui/core 1.208.2 → 1.209.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.
@@ -97,6 +97,11 @@ export const FormElementMixin = superclass => class extends LocalizeCoreElement(
97
97
  * @ignore
98
98
  */
99
99
  noValidate: { type: Boolean, attribute: 'novalidate' },
100
+ /**
101
+ * @ignore
102
+ * Perform validation immediately instead of waiting for the user to make changes.
103
+ */
104
+ validateOnInit: { type: Boolean, attribute: 'validate-on-init' },
100
105
  /**
101
106
  * @ignore
102
107
  */
@@ -125,6 +130,8 @@ export const FormElementMixin = superclass => class extends LocalizeCoreElement(
125
130
  /** @ignore */
126
131
  this.noValidate = false;
127
132
  /** @ignore */
133
+ this.validateOnInit = false;
134
+ /** @ignore */
128
135
  this.validationError = null;
129
136
  /** @ignore */
130
137
  this.childErrors = new Map();
@@ -171,6 +178,9 @@ export const FormElementMixin = superclass => class extends LocalizeCoreElement(
171
178
  this.dispatchEvent(new CustomEvent('invalid-change'));
172
179
  }
173
180
  }
181
+ if (this.validateOnInit && (changedProperties.has('noValidate') || changedProperties.has('validateOnInit'))) {
182
+ this.requestValidate(true);
183
+ }
174
184
  }
175
185
 
176
186
  async requestValidate(showNewErrors = true) {
@@ -210,6 +220,9 @@ export const FormElementMixin = superclass => class extends LocalizeCoreElement(
210
220
 
211
221
  validationCustomConnected(custom) {
212
222
  this._validationCustoms.add(custom);
223
+ if (this.validateOnInit) {
224
+ this.requestValidate(true);
225
+ }
213
226
  }
214
227
 
215
228
  validationCustomDisconnected(custom) {
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.208.2",
3
+ "version": "1.209.0",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "repository": "https://github.com/BrightspaceUI/core.git",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
9
  "scripts": {
10
- "build:clean": "node ./cli/clean.js",
11
- "build:icons": "node ./cli/icon-generator.js",
10
+ "build:clean": "node ./cli/clean.mjs",
11
+ "build:icons": "node ./cli/icon-generator.mjs",
12
12
  "build:sass": "node-sass --output-style expanded ./test/sass.scss > ./test/sass.output.css",
13
13
  "build": "npm run build:clean && npm run build:icons && npm run build:sass",
14
14
  "lint": "npm run lint:eslint && npm run lint:style && npm run lint:lit",
15
- "lint:eslint": "eslint . --ext .js,.html",
15
+ "lint:eslint": "eslint . --ext .js,.mjs,.html",
16
16
  "lint:lit": "lit-analyzer \"{components,directives,helpers,mixins,templates,test,tools}/**/*.js\" --strict",
17
17
  "lint:style": "stylelint \"**/*.{js,html}\"",
18
18
  "start": "web-dev-server --node-resolve --watch --open",
@@ -48,7 +48,7 @@
48
48
  "@web/test-runner": "^0.13",
49
49
  "@web/test-runner-playwright": "^0.8.8",
50
50
  "axe-core": "^4",
51
- "chalk": "^4",
51
+ "chalk": "^5",
52
52
  "eslint": "^7",
53
53
  "eslint-config-brightspace": "^0.16",
54
54
  "eslint-plugin-html": "^6",