@dodlhuat/basix 1.2.3 → 1.2.4

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 CHANGED
@@ -1,4 +1,4 @@
1
- # Basix 1.2.1
1
+ # Basix 1.2.4
2
2
 
3
3
  Basix is intended as a starter for the rapid development of a design. Each design element can be added individually to
4
4
  include only the data required. It is using plain javascript / typescript and therefore is not dependent on any plugin.
@@ -781,6 +781,8 @@ The TimeSpanPicker component provides a paired start/end time input for selectin
781
781
  const picker = new TimeSpanPicker('my-container', {
782
782
  defaultStart: '09:00',
783
783
  defaultEnd: '17:00',
784
+ fromString: 'Von', // optional — defaults to 'From'
785
+ toString: 'Bis', // optional — defaults to 'To'
784
786
  onChange: (start, end) => console.log(start, end),
785
787
  });
786
788
 
package/js/timepicker.js CHANGED
@@ -22,6 +22,18 @@ class TimeSpanPicker {
22
22
  if (options?.defaultEnd) {
23
23
  this.endTimeInput.value = options.defaultEnd;
24
24
  }
25
+ if (options?.fromString) {
26
+ this.fromString = options.fromString;
27
+ }
28
+ else {
29
+ this.fromString = 'From';
30
+ }
31
+ if (options?.toString) {
32
+ this.toString = options.toString;
33
+ }
34
+ else {
35
+ this.toString = 'To';
36
+ }
25
37
  this.attachEventListeners();
26
38
  // Render initial state if defaults provided
27
39
  if (options?.defaultStart || options?.defaultEnd) {
@@ -41,7 +53,7 @@ class TimeSpanPicker {
41
53
  this.container.innerHTML = `
42
54
  <div class="timespan-picker">
43
55
  <div class="timespan-field timespan-field-start">
44
- <label for="${startId}">From</label>
56
+ <label for="${startId}">${this.fromString}</label>
45
57
  <input type="time" class="timespan-start" id="${startId}"/>
46
58
  </div>
47
59
 
@@ -51,7 +63,7 @@ class TimeSpanPicker {
51
63
  </div>
52
64
 
53
65
  <div class="timespan-field timespan-field-end">
54
- <label for="${endId}">To</label>
66
+ <label for="${endId}">${this.toString}</label>
55
67
  <input type="time" class="timespan-end" id="${endId}"/>
56
68
  </div>
57
69
  </div>
package/js/timepicker.ts CHANGED
@@ -7,6 +7,8 @@ interface TimeSpanPickerOptions {
7
7
  onChange?: (start: string, end: string) => void;
8
8
  defaultStart?: string;
9
9
  defaultEnd?: string;
10
+ fromString?: string;
11
+ toString?: string;
10
12
  }
11
13
 
12
14
  class TimeSpanPicker {
@@ -15,6 +17,8 @@ class TimeSpanPicker {
15
17
  private endTimeInput: HTMLInputElement;
16
18
  private onChange?: (start: string, end: string) => void;
17
19
  private readonly uid: string;
20
+ private fromString: string;
21
+ private toString: string;
18
22
 
19
23
  constructor(elementOrSelector: string | HTMLElement, options?: TimeSpanPickerOptions) {
20
24
  const element = typeof elementOrSelector === 'string'
@@ -30,6 +34,8 @@ class TimeSpanPicker {
30
34
  this.container = element;
31
35
  this.onChange = options?.onChange;
32
36
  this.uid = `tsp-${Math.random().toString(36).slice(2, 9)}`;
37
+ this.fromString = options?.fromString ?? 'From';
38
+ this.toString = options?.toString ?? 'To';
33
39
 
34
40
  this.render();
35
41
 
@@ -65,7 +71,7 @@ class TimeSpanPicker {
65
71
  this.container.innerHTML = `
66
72
  <div class="timespan-picker">
67
73
  <div class="timespan-field timespan-field-start">
68
- <label for="${startId}">From</label>
74
+ <label for="${startId}">${this.fromString}</label>
69
75
  <input type="time" class="timespan-start" id="${startId}"/>
70
76
  </div>
71
77
 
@@ -75,7 +81,7 @@ class TimeSpanPicker {
75
81
  </div>
76
82
 
77
83
  <div class="timespan-field timespan-field-end">
78
- <label for="${endId}">To</label>
84
+ <label for="${endId}">${this.toString}</label>
79
85
  <input type="time" class="timespan-end" id="${endId}"/>
80
86
  </div>
81
87
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dodlhuat/basix",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Basix is intended as a starter for the rapid development of a design. Each design element can be added individually to include only the data required. It is using plain javascript / typescript and therefore is not dependent on any plugin.",
5
5
  "exports": {
6
6
  "./css/*": "./css/*",