@pictogrammers/components 0.5.10 → 0.5.11

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pictogrammers/components",
3
3
  "type": "module",
4
- "version": "0.5.10",
4
+ "version": "0.5.11",
5
5
  "license": "MIT",
6
6
  "author": "Austin Andrews",
7
7
  "scripts": {
@@ -9,17 +9,30 @@ import style from './inputRange.css';
9
9
  template
10
10
  })
11
11
  export default class PgInputRange extends HTMLElement {
12
- @Prop() min: string = '0';
13
- @Prop() max: string = '100';
14
- @Prop() step: string = '1';
12
+ @Prop() value: number = 0;
13
+ @Prop() min: number = 0;
14
+ @Prop() max: number = 100;
15
+ @Prop() step: number = 1;
15
16
  @Prop() name: string = '';
16
17
 
17
18
  @Part() $input: HTMLInputElement;
18
19
 
19
- render() {
20
- this.$input.min = this.min;
21
- this.$input.max = this.max;
22
- this.$input.step = this.step;
20
+ render(changes: any) {
21
+ if (changes.min) {
22
+ this.$input.min = `${this.min}`;
23
+ }
24
+ if (changes.max) {
25
+ this.$input.max = `${this.max}`;
26
+ }
27
+ if (changes.step) {
28
+ this.$input.step = `${this.step}`;
29
+ }
30
+ if (changes.value) {
31
+ this.$input.value = `${this.value}`;
32
+ }
33
+ if (changes.name) {
34
+ this.$input.name = this.name;
35
+ }
23
36
  }
24
37
 
25
38
  connectedCallback() {
@@ -28,28 +41,26 @@ export default class PgInputRange extends HTMLElement {
28
41
  }
29
42
 
30
43
  #handleChange(e: any) {
31
- e.stopPropagation();
32
44
  const { value } = e.target;
33
45
  this.dispatchEvent(
34
46
  new CustomEvent('change', {
35
47
  detail: {
36
48
  value,
37
- name: this.name
49
+ name: this.name,
38
50
  }
39
51
  })
40
52
  );
41
53
  }
42
54
 
43
55
  #handleInput(e: any) {
44
- e.stopPropagation();
45
56
  const { value } = e.target;
46
57
  this.dispatchEvent(
47
58
  new CustomEvent('input', {
48
59
  detail: {
49
60
  value,
50
- name: this.name
61
+ name: this.name,
51
62
  }
52
63
  })
53
64
  );
54
65
  }
55
- }
66
+ }