jb-select 6.4.2 → 6.5.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/README.md +1 -1
- package/dist/i18n.d.ts +17 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.br +0 -0
- package/dist/index.cjs.js.gz +0 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.br +0 -0
- package/dist/index.umd.js.gz +0 -0
- package/dist/index.umd.js.map +1 -1
- package/dist/jb-select.d.ts.map +1 -1
- package/lib/global.d.ts +1 -1
- package/lib/i18n.ts +24 -0
- package/lib/jb-option/jb-option.ts +1 -1
- package/lib/{jb-select.scss → jb-select.css} +15 -18
- package/lib/jb-select.ts +13 -3
- package/package.json +3 -3
- package/react/README.md +3 -1
- /package/lib/jb-option/{jb-option.scss → jb-option.css} +0 -0
package/lib/jb-select.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import CSS from "./jb-select.
|
|
1
|
+
import CSS from "./jb-select.css";
|
|
2
|
+
import VariablesCSS from "./variables.css";
|
|
2
3
|
import {
|
|
3
4
|
JBSelectCallbacks,
|
|
4
5
|
JBSelectElements,
|
|
@@ -11,6 +12,8 @@ import { JBFormInputStandards } from 'jb-form';
|
|
|
11
12
|
import { JBOptionWebComponent } from "./jb-option/jb-option";
|
|
12
13
|
import { registerDefaultVariables } from 'jb-core/theme';
|
|
13
14
|
import { renderHTML } from "./render";
|
|
15
|
+
import { dictionary } from "./i18n";
|
|
16
|
+
import { i18n } from "jb-core/i18n";
|
|
14
17
|
|
|
15
18
|
//TODO: add IncludeInputInList or freeSolo so user can select item that he wrote without even it exist in select list
|
|
16
19
|
//TODO: handleHomeEndKeys to move focus inside the popup with the Home and End keys.
|
|
@@ -63,6 +66,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
63
66
|
}
|
|
64
67
|
set placeholder(value: string) {
|
|
65
68
|
this.#placeholder = value;
|
|
69
|
+
this.#internals.ariaPlaceholder = value;
|
|
66
70
|
if (this.value !== null && this.value !== undefined) {
|
|
67
71
|
this.elements.input.placeholder = "";
|
|
68
72
|
} else {
|
|
@@ -111,13 +115,16 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
111
115
|
this.elements.input.disabled = value;
|
|
112
116
|
if (value) {
|
|
113
117
|
(this.#internals as any).states?.add("disabled");
|
|
118
|
+
this.#internals.ariaDisabled = "true";
|
|
114
119
|
} else {
|
|
115
120
|
(this.#internals as any).states?.delete("disabled");
|
|
121
|
+
this.#internals.ariaDisabled = "false";
|
|
116
122
|
}
|
|
117
123
|
}
|
|
118
124
|
#required = false;
|
|
119
125
|
set required(value: boolean) {
|
|
120
126
|
this.#required = value;
|
|
127
|
+
this.#internals.ariaRequired = value?"true":"false";
|
|
121
128
|
this.#validation.checkValiditySync({ showError: false });
|
|
122
129
|
}
|
|
123
130
|
get required() {
|
|
@@ -166,7 +173,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
166
173
|
delegatesFocus: true,
|
|
167
174
|
});
|
|
168
175
|
registerDefaultVariables();
|
|
169
|
-
const html = `<style>${CSS}</style>` + "\n" + renderHTML();
|
|
176
|
+
const html = `<style>${CSS} ${VariablesCSS}</style>` + "\n" + renderHTML();
|
|
170
177
|
const element = document.createElement("template");
|
|
171
178
|
element.innerHTML = html;
|
|
172
179
|
shadowRoot.appendChild(element.content.cloneNode(true));
|
|
@@ -231,6 +238,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
231
238
|
switch (name) {
|
|
232
239
|
case "label":
|
|
233
240
|
this.elements.label.text.innerHTML = value;
|
|
241
|
+
this.#internals.ariaLabel = value;
|
|
234
242
|
if (value == null || value == undefined || value == "") {
|
|
235
243
|
this.elements.label.wrapper.classList.add("--hide");
|
|
236
244
|
} else {
|
|
@@ -238,6 +246,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
238
246
|
}
|
|
239
247
|
break;
|
|
240
248
|
case "message":
|
|
249
|
+
this.#internals.ariaDescription = value;
|
|
241
250
|
this.elements.messageBox.innerHTML = value;
|
|
242
251
|
break;
|
|
243
252
|
case "value":
|
|
@@ -252,6 +261,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
252
261
|
break;
|
|
253
262
|
case "placeholder":
|
|
254
263
|
this.placeholder = value;
|
|
264
|
+
this.#internals.ariaPlaceholder = value;
|
|
255
265
|
break;
|
|
256
266
|
case "search-placeholder":
|
|
257
267
|
this.searchPlaceholder = value;
|
|
@@ -589,7 +599,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
589
599
|
}
|
|
590
600
|
if (this.required) {
|
|
591
601
|
const label = this.getAttribute("label") || "";
|
|
592
|
-
const message =
|
|
602
|
+
const message = dictionary.get(i18n,"requireMessage")(label || null);
|
|
593
603
|
validationList.push({
|
|
594
604
|
validator: ({ value }) => {
|
|
595
605
|
return value !== null && value !== undefined;
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"web component",
|
|
17
17
|
"react component"
|
|
18
18
|
],
|
|
19
|
-
"version": "6.
|
|
19
|
+
"version": "6.5.0",
|
|
20
20
|
"bugs": "https://github.com/javadbat/jb-select/issues",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"files": [
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"jb-validation": ">=0.4.0",
|
|
38
|
-
"jb-core":">=0.
|
|
38
|
+
"jb-core":">=0.18.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"jb-form":">=0.
|
|
41
|
+
"jb-form":">=0.7.1"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/react/README.md
CHANGED
|
File without changes
|