kr-elements 0.0.1-alpha.35 → 0.0.1-alpha.36

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.
@@ -147,7 +147,7 @@ class ComboboxMarkup {
147
147
  const template = this.tagTemplate;
148
148
  tag = template.cloneNode(true);
149
149
  const label = tag.querySelector('[part="tag-label"]');
150
- label.textContent = option.label;
150
+ label.textContent = option.textContent;
151
151
  button = tag.querySelector('[part="clear-tag"]');
152
152
  }
153
153
  button?.setAttribute('value', value);
@@ -5,54 +5,29 @@ exports.HTMLComboboxOptionElement = void 0;
5
5
  const Boolean_attribute_value_normalizer_js_1 = require("./Boolean.attribute.value.normalizer.js");
6
6
  class HTMLComboboxOptionElement extends HTMLElement {
7
7
  static OWN_IDL = new Set(['value', 'label', 'selected']);
8
- constructor() {
9
- super();
10
- }
11
8
  connectedCallback() {
12
9
  this.#initialAttributesSynchronization();
13
10
  this.part.add('option');
14
11
  super.setAttribute('tabindex', "0");
15
12
  super.setAttribute('role', "option");
16
- const value = this.value;
17
- const label = this.label;
18
- const hasNoMarkup = this.children.length === 0;
19
- const text = this.textContent.trim();
20
- const hasText = text.length > 0;
21
- if (!value && !label) {
22
- if (hasNoMarkup && hasText) {
23
- this.value = text;
24
- this.label = text;
25
- }
26
- else {
27
- throw new Error('box-option must have value and label attributes');
28
- }
29
- return;
30
- }
31
- if (value && !label) {
32
- if (hasNoMarkup && hasText) {
33
- this.label = text;
34
- }
35
- else {
36
- this.label = value;
37
- }
38
- }
39
- if (!value && label) {
40
- this.value = label;
41
- }
42
- if (hasNoMarkup && !hasText) {
43
- this.textContent = label || value;
13
+ if (!this.value) {
14
+ this.value = this.textContent;
44
15
  }
45
16
  }
46
17
  get value() {
47
18
  return this.getAttribute('value');
48
19
  }
49
20
  set value(value) {
21
+ if (value == null)
22
+ return;
50
23
  super.setAttribute('value', String(value));
51
24
  }
52
25
  get label() {
53
26
  return this.getAttribute('label');
54
27
  }
55
28
  set label(value) {
29
+ if (value == null)
30
+ return;
56
31
  super.setAttribute('label', String(value));
57
32
  }
58
33
  get selected() {
@@ -144,7 +144,7 @@ export class ComboboxMarkup {
144
144
  const template = this.tagTemplate;
145
145
  tag = template.cloneNode(true);
146
146
  const label = tag.querySelector('[part="tag-label"]');
147
- label.textContent = option.label;
147
+ label.textContent = option.textContent;
148
148
  button = tag.querySelector('[part="clear-tag"]');
149
149
  }
150
150
  button?.setAttribute('value', value);
@@ -1,54 +1,29 @@
1
1
  import { toBoolean } from './Boolean.attribute.value.normalizer.js';
2
2
  export class HTMLComboboxOptionElement extends HTMLElement {
3
3
  static OWN_IDL = new Set(['value', 'label', 'selected']);
4
- constructor() {
5
- super();
6
- }
7
4
  connectedCallback() {
8
5
  this.#initialAttributesSynchronization();
9
6
  this.part.add('option');
10
7
  super.setAttribute('tabindex', "0");
11
8
  super.setAttribute('role', "option");
12
- const value = this.value;
13
- const label = this.label;
14
- const hasNoMarkup = this.children.length === 0;
15
- const text = this.textContent.trim();
16
- const hasText = text.length > 0;
17
- if (!value && !label) {
18
- if (hasNoMarkup && hasText) {
19
- this.value = text;
20
- this.label = text;
21
- }
22
- else {
23
- throw new Error('box-option must have value and label attributes');
24
- }
25
- return;
26
- }
27
- if (value && !label) {
28
- if (hasNoMarkup && hasText) {
29
- this.label = text;
30
- }
31
- else {
32
- this.label = value;
33
- }
34
- }
35
- if (!value && label) {
36
- this.value = label;
37
- }
38
- if (hasNoMarkup && !hasText) {
39
- this.textContent = label || value;
9
+ if (!this.value) {
10
+ this.value = this.textContent;
40
11
  }
41
12
  }
42
13
  get value() {
43
14
  return this.getAttribute('value');
44
15
  }
45
16
  set value(value) {
17
+ if (value == null)
18
+ return;
46
19
  super.setAttribute('value', String(value));
47
20
  }
48
21
  get label() {
49
22
  return this.getAttribute('label');
50
23
  }
51
24
  set label(value) {
25
+ if (value == null)
26
+ return;
52
27
  super.setAttribute('label', String(value));
53
28
  }
54
29
  get selected() {
@@ -1,7 +1,6 @@
1
1
  export declare class HTMLComboboxOptionElement extends HTMLElement {
2
2
  #private;
3
3
  static OWN_IDL: Set<string>;
4
- constructor();
5
4
  connectedCallback(): void;
6
5
  get value(): string;
7
6
  set value(value: string);
@@ -1 +1 @@
1
- {"version":3,"file":"HTML.combobox.option.element.d.ts","sourceRoot":"","sources":["../../../src/combobox/HTML.combobox.option.element.ts"],"names":[],"mappings":"AAEA,qBAAa,yBAA0B,SAAQ,WAAW;;IACxD,MAAM,CAAC,OAAO,cAA2C;;IAMzD,iBAAiB;IA0CjB,IAAI,KAAK,WAER;IACD,IAAI,KAAK,CAAC,KAAK,QAAA,EAEd;IAED,IAAI,KAAK,WAER;IACD,IAAI,KAAK,CAAC,KAAK,QAAA,EAEd;IAED,IAAI,QAAQ,YAEX;IACD,IAAI,QAAQ,CAAC,KAAK,SAAA,EAEjB;IAQD,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAQxC,eAAe,CAAC,IAAI,EAAE,MAAM;CAO7B"}
1
+ {"version":3,"file":"HTML.combobox.option.element.d.ts","sourceRoot":"","sources":["../../../src/combobox/HTML.combobox.option.element.ts"],"names":[],"mappings":"AAEA,qBAAa,yBAA0B,SAAQ,WAAW;;IACxD,MAAM,CAAC,OAAO,cAA2C;IAEzD,iBAAiB;IAWjB,IAAI,KAAK,WAER;IACD,IAAI,KAAK,CAAC,KAAK,QAAA,EAGd;IAED,IAAI,KAAK,WAER;IACD,IAAI,KAAK,CAAC,KAAK,QAAA,EAGd;IAED,IAAI,QAAQ,YAEX;IACD,IAAI,QAAQ,CAAC,KAAK,SAAA,EAEjB;IAQD,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAQxC,eAAe,CAAC,IAAI,EAAE,MAAM;CAO7B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kr-elements",
3
- "version": "0.0.1-alpha.35",
3
+ "version": "0.0.1-alpha.36",
4
4
  "description": "Custom elements",
5
5
  "type": "module",
6
6
  "scripts": {