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/lib/jb-select.ts CHANGED
@@ -1,4 +1,5 @@
1
- import CSS from "./jb-select.scss";
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 = `${label} حتما باید انتخاب شود`;
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.4.2",
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.14.0"
38
+ "jb-core":">=0.18.1"
39
39
  },
40
40
  "devDependencies": {
41
- "jb-form":">=0.6.10"
41
+ "jb-form":">=0.7.1"
42
42
  }
43
43
  }
package/react/README.md CHANGED
@@ -8,7 +8,9 @@ Demo : Demo: [codeSandbox preview](https://3f63dj.csb.app/samples/jb-select) fo
8
8
 
9
9
  ## installation
10
10
 
11
- run `npm install jb-select` to install package with npm
11
+ ```sh
12
+ npm install jb-select
13
+ ```
12
14
 
13
15
  ## usage
14
16
 
File without changes