@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.77 → 2.0.0-next.79
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/.storybook/vitest.setup.ts +24 -0
- package/bundle/openbridge-webcomponents.bundle.js +117 -29
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +77 -5
- package/dist/components/input/input.d.ts +1 -0
- package/dist/components/input/input.d.ts.map +1 -0
- package/dist/components/input/input.js +2 -0
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/pagination/pagination.d.ts +9 -0
- package/dist/components/pagination/pagination.d.ts.map +1 -1
- package/dist/components/pagination/pagination.js +12 -2
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/slider/slider.d.ts +14 -1
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/slider/slider.js +17 -0
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/slider-double/slider-double.d.ts +17 -1
- package/dist/components/slider-double/slider-double.d.ts.map +1 -1
- package/dist/components/slider-double/slider-double.js +15 -0
- package/dist/components/slider-double/slider-double.js.map +1 -1
- package/dist/components/toggle-button-group/toggle-button-group.d.ts +4 -0
- package/dist/components/toggle-button-group/toggle-button-group.d.ts.map +1 -1
- package/dist/components/toggle-button-group/toggle-button-group.js +15 -3
- package/dist/components/toggle-button-group/toggle-button-group.js.map +1 -1
- package/dist/components/toggle-button-vertical-group/toggle-button-vertical-group.d.ts +4 -0
- package/dist/components/toggle-button-vertical-group/toggle-button-vertical-group.d.ts.map +1 -1
- package/dist/components/toggle-button-vertical-group/toggle-button-vertical-group.js +10 -3
- package/dist/components/toggle-button-vertical-group/toggle-button-vertical-group.js.map +1 -1
- package/dist/components/toggle-switch/toggle-switch.d.ts +2 -0
- package/dist/components/toggle-switch/toggle-switch.d.ts.map +1 -1
- package/dist/components/toggle-switch/toggle-switch.js +8 -0
- package/dist/components/toggle-switch/toggle-switch.js.map +1 -1
- package/dist/navigation-instruments/indicator-graph/indicator-graph.css.js +34 -20
- package/dist/navigation-instruments/indicator-graph/indicator-graph.css.js.map +1 -1
- package/dist/navigation-instruments/indicator-graph/indicator-graph.d.ts.map +1 -1
- package/dist/navigation-instruments/indicator-graph/indicator-graph.js +2 -1
- package/dist/navigation-instruments/indicator-graph/indicator-graph.js.map +1 -1
- package/dist/navigation-instruments/watch/watch.css.js +4 -0
- package/dist/navigation-instruments/watch/watch.css.js.map +1 -1
- package/package.json +1 -1
- package/src/components/input/input.ts +0 -0
- package/src/components/pagination/pagination.ts +25 -2
- package/src/components/slider/slider.ts +27 -1
- package/src/components/slider-double/slider-double.ts +28 -1
- package/src/components/toggle-button-group/toggle-button-group.ts +26 -3
- package/src/components/toggle-button-vertical-group/toggle-button-vertical-group.ts +28 -3
- package/src/components/toggle-switch/toggle-switch.ts +10 -0
- package/src/navigation-instruments/indicator-graph/indicator-graph.css +34 -20
- package/src/navigation-instruments/indicator-graph/indicator-graph.ts +2 -1
- package/src/navigation-instruments/watch/watch.css +4 -0
- package/src/navigation-instruments/watch/watch.stories.ts +161 -171
- package/src/storybook-util.ts +1 -1
- package/vitest.config.ts +6 -0
|
@@ -29,6 +29,15 @@ export type ObcSliderDoubleValueEvent = CustomEvent<{
|
|
|
29
29
|
high: number;
|
|
30
30
|
}>;
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Event type for change event in obc-slider-double (fired after user interaction completes).
|
|
34
|
+
* Contains the current low and high values of the slider.
|
|
35
|
+
*/
|
|
36
|
+
export type ObcSliderDoubleChangeEvent = CustomEvent<{
|
|
37
|
+
low: number;
|
|
38
|
+
high: number;
|
|
39
|
+
}>;
|
|
40
|
+
|
|
32
41
|
/**
|
|
33
42
|
* `<obc-slider-double>` – A dual-thumb range slider for selecting a value interval within a defined range.
|
|
34
43
|
*
|
|
@@ -86,7 +95,8 @@ export type ObcSliderDoubleValueEvent = CustomEvent<{
|
|
|
86
95
|
* - `hugcontainer` (attribute): If present, removes spacing between slider and container edges.
|
|
87
96
|
*
|
|
88
97
|
* ## Events
|
|
89
|
-
* - `value` – Fired whenever the low or high value changes. Event detail contains `{low, high}`.
|
|
98
|
+
* - `value` – Fired continuously whenever the low or high value changes during user interaction. Event detail contains `{low, high}`.
|
|
99
|
+
* - `change` – Fired only after user interaction completes (mouse release). Event detail contains `{low, high}`.
|
|
90
100
|
*
|
|
91
101
|
* ## Best Practices and Constraints
|
|
92
102
|
* - Ensure `low` is always less than or equal to `high`; the component enforces this automatically.
|
|
@@ -121,6 +131,7 @@ export type ObcSliderDoubleValueEvent = CustomEvent<{
|
|
|
121
131
|
* @slot left-readout - Custom content for the left (low) readout label (rendered when `showLeftReadout` is true)
|
|
122
132
|
* @slot right-readout - Custom content for the right (high) readout label (rendered when `showRightReadout` is true)
|
|
123
133
|
* @fires value {ObcSliderDoubleValueEvent} - Fires when the value is changed
|
|
134
|
+
* @fires change {ObcSliderDoubleChangeEvent} - Fires when user interaction completes
|
|
124
135
|
*/
|
|
125
136
|
@customElement('obc-slider-double')
|
|
126
137
|
export class ObcSliderDouble extends LitElement {
|
|
@@ -281,6 +292,19 @@ export class ObcSliderDouble extends LitElement {
|
|
|
281
292
|
);
|
|
282
293
|
}
|
|
283
294
|
|
|
295
|
+
/**
|
|
296
|
+
* Fires the `change` event with the current low and high values.
|
|
297
|
+
*
|
|
298
|
+
* @fires change
|
|
299
|
+
*/
|
|
300
|
+
private fireChangeEvent() {
|
|
301
|
+
this.dispatchEvent(
|
|
302
|
+
new CustomEvent('change', {
|
|
303
|
+
detail: {low: this.low, high: this.high},
|
|
304
|
+
}) as ObcSliderDoubleChangeEvent
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
|
|
284
308
|
private THUMB_WIDTH = 48;
|
|
285
309
|
private THUMB_VISIBLE_WIDTH = 12;
|
|
286
310
|
|
|
@@ -389,6 +413,7 @@ export class ObcSliderDouble extends LitElement {
|
|
|
389
413
|
window.removeEventListener('mousemove', this.onWindowMouseMove);
|
|
390
414
|
window.removeEventListener('mouseup', this.onWindowMouseUp);
|
|
391
415
|
this.stopAnimation();
|
|
416
|
+
this.fireChangeEvent();
|
|
392
417
|
}
|
|
393
418
|
|
|
394
419
|
private updateTargetValue(e: MouseEvent) {
|
|
@@ -534,6 +559,7 @@ export class ObcSliderDouble extends LitElement {
|
|
|
534
559
|
?disabled=${this.variant === ObcSliderDoubleVariant.NoInput ||
|
|
535
560
|
this.disabled}
|
|
536
561
|
@input=${this.onInput}
|
|
562
|
+
@change=${() => this.fireChangeEvent()}
|
|
537
563
|
/>
|
|
538
564
|
<input
|
|
539
565
|
type="range"
|
|
@@ -545,6 +571,7 @@ export class ObcSliderDouble extends LitElement {
|
|
|
545
571
|
?disabled=${this.variant === ObcSliderDoubleVariant.NoInput ||
|
|
546
572
|
this.disabled}
|
|
547
573
|
@input=${this.onInput}
|
|
574
|
+
@change=${() => this.fireChangeEvent()}
|
|
548
575
|
/>
|
|
549
576
|
<div class="interactive-track"></div>
|
|
550
577
|
<div class="thumb min"></div>
|
|
@@ -14,6 +14,10 @@ export type ObcToggleButtonGroupValueChangeEvent = CustomEvent<{
|
|
|
14
14
|
previousValue: string;
|
|
15
15
|
}>;
|
|
16
16
|
|
|
17
|
+
export type ObcToggleButtonGroupChangeEvent = CustomEvent<{
|
|
18
|
+
value: string;
|
|
19
|
+
}>;
|
|
20
|
+
|
|
17
21
|
/**
|
|
18
22
|
* `<obc-toggle-button-group>` – A segmented control for selecting a single option from a set (also known as a button group or segmented button).
|
|
19
23
|
*
|
|
@@ -122,6 +126,7 @@ export type ObcToggleButtonGroupValueChangeEvent = CustomEvent<{
|
|
|
122
126
|
*
|
|
123
127
|
* @slot - Place one or more `<obc-toggle-button-option>` elements here to define the selectable options.
|
|
124
128
|
* @fires value {CustomEvent<{value: string, previousValue: string}>} Fired when the selected value changes.
|
|
129
|
+
* @fires change {CustomEvent<{value: string}>} Fired when the selected value changes by user interaction.
|
|
125
130
|
*/
|
|
126
131
|
@customElement('obc-toggle-button-group')
|
|
127
132
|
export class ObcToggleButtonGroup extends LitElement {
|
|
@@ -229,7 +234,11 @@ export class ObcToggleButtonGroup extends LitElement {
|
|
|
229
234
|
return Array.from(this.options).find((opt) => !opt.disabled) || null;
|
|
230
235
|
}
|
|
231
236
|
|
|
232
|
-
private updateSelection(
|
|
237
|
+
private updateSelection(
|
|
238
|
+
newValue: string,
|
|
239
|
+
emitValueEvent: boolean = true,
|
|
240
|
+
emitChangeEvent: boolean = false
|
|
241
|
+
) {
|
|
233
242
|
const oldValue = this.value;
|
|
234
243
|
|
|
235
244
|
if (!this.hasAnyEnabledOption()) {
|
|
@@ -264,13 +273,21 @@ export class ObcToggleButtonGroup extends LitElement {
|
|
|
264
273
|
|
|
265
274
|
this.setNoDivider();
|
|
266
275
|
|
|
267
|
-
if (
|
|
276
|
+
if (emitValueEvent && oldValue !== newValue) {
|
|
268
277
|
this.dispatchEvent(
|
|
269
278
|
new CustomEvent('value', {
|
|
270
279
|
detail: {value: newValue, previousValue: oldValue},
|
|
271
280
|
})
|
|
272
281
|
);
|
|
273
282
|
}
|
|
283
|
+
|
|
284
|
+
if (emitChangeEvent && oldValue !== newValue) {
|
|
285
|
+
this.dispatchEvent(
|
|
286
|
+
new CustomEvent('change', {
|
|
287
|
+
detail: {value: newValue},
|
|
288
|
+
})
|
|
289
|
+
);
|
|
290
|
+
}
|
|
274
291
|
}
|
|
275
292
|
|
|
276
293
|
private updateActivated(newValue: string | undefined) {
|
|
@@ -391,8 +408,14 @@ export class ObcToggleButtonGroup extends LitElement {
|
|
|
391
408
|
detail: {value, previousValue: this.value},
|
|
392
409
|
})
|
|
393
410
|
);
|
|
411
|
+
|
|
412
|
+
this.dispatchEvent(
|
|
413
|
+
new CustomEvent('change', {
|
|
414
|
+
detail: {value},
|
|
415
|
+
})
|
|
416
|
+
);
|
|
394
417
|
} else {
|
|
395
|
-
this.updateSelection(value);
|
|
418
|
+
this.updateSelection(value, true, true);
|
|
396
419
|
}
|
|
397
420
|
}
|
|
398
421
|
|
|
@@ -15,6 +15,10 @@ export type ObcToggleButtonVerticalGroupValueChangeEvent = CustomEvent<{
|
|
|
15
15
|
previousValue: string;
|
|
16
16
|
}>;
|
|
17
17
|
|
|
18
|
+
export type ObcToggleButtonVerticalGroupChangeEvent = CustomEvent<{
|
|
19
|
+
value: string;
|
|
20
|
+
}>;
|
|
21
|
+
|
|
18
22
|
/**
|
|
19
23
|
* `<obc-toggle-button-vertical-group>` – A vertically oriented segmented control for selecting a single option from a set.
|
|
20
24
|
*
|
|
@@ -108,6 +112,7 @@ export type ObcToggleButtonVerticalGroupValueChangeEvent = CustomEvent<{
|
|
|
108
112
|
*
|
|
109
113
|
* @slot - Place one or more `<obc-toggle-button-vertical-option>` elements here to define the selectable options.
|
|
110
114
|
* @fires value {CustomEvent<{value: string, previousValue: string}>} Fired when the selected value changes.
|
|
115
|
+
* @fires change {CustomEvent<{value: string}>} Fired when the selected value changes by user interaction.
|
|
111
116
|
*/
|
|
112
117
|
@customElement('obc-toggle-button-vertical-group')
|
|
113
118
|
export class ObcToggleButtonVerticalGroup extends LitElement {
|
|
@@ -182,7 +187,11 @@ export class ObcToggleButtonVerticalGroup extends LitElement {
|
|
|
182
187
|
return Array.from(this.options).find((opt) => !opt.disabled) || null;
|
|
183
188
|
}
|
|
184
189
|
|
|
185
|
-
private updateSelection(
|
|
190
|
+
private updateSelection(
|
|
191
|
+
newValue: string,
|
|
192
|
+
emitValueEvent: boolean = true,
|
|
193
|
+
emitChangeEvent: boolean = false
|
|
194
|
+
) {
|
|
186
195
|
const oldValue = this.value;
|
|
187
196
|
|
|
188
197
|
if (!this.hasAnyEnabledOption()) {
|
|
@@ -217,7 +226,7 @@ export class ObcToggleButtonVerticalGroup extends LitElement {
|
|
|
217
226
|
|
|
218
227
|
this.updateDividers();
|
|
219
228
|
|
|
220
|
-
if (
|
|
229
|
+
if (emitValueEvent && oldValue !== newValue) {
|
|
221
230
|
/**
|
|
222
231
|
* Fired when the selected option changes.
|
|
223
232
|
*
|
|
@@ -232,6 +241,22 @@ export class ObcToggleButtonVerticalGroup extends LitElement {
|
|
|
232
241
|
})
|
|
233
242
|
);
|
|
234
243
|
}
|
|
244
|
+
|
|
245
|
+
if (emitChangeEvent && oldValue !== newValue) {
|
|
246
|
+
/**
|
|
247
|
+
* Fired when the selected value changes by user interaction.
|
|
248
|
+
*
|
|
249
|
+
* The event detail contains the new value:
|
|
250
|
+
* `{ value: string }`
|
|
251
|
+
*
|
|
252
|
+
* @event change
|
|
253
|
+
*/
|
|
254
|
+
this.dispatchEvent(
|
|
255
|
+
new CustomEvent('change', {
|
|
256
|
+
detail: {value: newValue},
|
|
257
|
+
})
|
|
258
|
+
);
|
|
259
|
+
}
|
|
235
260
|
}
|
|
236
261
|
|
|
237
262
|
protected override firstUpdated(changed: PropertyValues) {
|
|
@@ -350,7 +375,7 @@ export class ObcToggleButtonVerticalGroup extends LitElement {
|
|
|
350
375
|
|
|
351
376
|
private onOptionSelected(e: Event): void {
|
|
352
377
|
const {value} = (e as CustomEvent).detail;
|
|
353
|
-
this.updateSelection(value);
|
|
378
|
+
this.updateSelection(value, true, true);
|
|
354
379
|
}
|
|
355
380
|
|
|
356
381
|
override render() {
|
|
@@ -85,6 +85,7 @@ export type ObcToggleSwitchInputEvent = CustomEvent<{
|
|
|
85
85
|
*
|
|
86
86
|
* @slot icon - Leading icon slot (shown when `hasIcon` is true)
|
|
87
87
|
* @fires input - {ObcToggleSwitchInputEvent} Dispatched when the value of the input changes
|
|
88
|
+
* @fires change - Dispatched when the value of the input changes by user interaction
|
|
88
89
|
*/
|
|
89
90
|
@customElement('obc-toggle-switch')
|
|
90
91
|
export class ObcToggleSwitch extends LitElement {
|
|
@@ -162,6 +163,14 @@ export class ObcToggleSwitch extends LitElement {
|
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
|
|
166
|
+
private _fireChangeEvent(e: Event) {
|
|
167
|
+
if (this.disabled) {
|
|
168
|
+
e.preventDefault();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
this.dispatchEvent(new CustomEvent('change'));
|
|
172
|
+
}
|
|
173
|
+
|
|
165
174
|
override render() {
|
|
166
175
|
return html`
|
|
167
176
|
<label
|
|
@@ -190,6 +199,7 @@ export class ObcToggleSwitch extends LitElement {
|
|
|
190
199
|
.checked=${this.checked}
|
|
191
200
|
?disabled=${this.disabled}
|
|
192
201
|
@input=${this._tryChange}
|
|
202
|
+
@change=${this._fireChangeEvent}
|
|
193
203
|
/>
|
|
194
204
|
</div>
|
|
195
205
|
</div>
|
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
.chart-container {
|
|
2
2
|
width: 100%;
|
|
3
3
|
height: 100%;
|
|
4
|
+
box-sizing: border-box;
|
|
4
5
|
display: flex;
|
|
5
6
|
align-items: center;
|
|
6
7
|
justify-content: center;
|
|
7
8
|
position: relative;
|
|
9
|
+
|
|
10
|
+
padding-bottom: 0.5px;
|
|
11
|
+
|
|
12
|
+
--dot-width: 6px;
|
|
13
|
+
--dot-radius: calc(var(--dot-width) / 2);
|
|
14
|
+
|
|
15
|
+
&.medium {
|
|
16
|
+
--dot-width: 8px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.large {
|
|
20
|
+
--dot-width: 10px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.u-over {
|
|
25
|
+
position: absolute;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#chart {
|
|
29
|
+
position: absolute;
|
|
30
|
+
width: calc(100% - var(--dot-radius));
|
|
31
|
+
left: 0;
|
|
32
|
+
top: var(--dot-radius);
|
|
33
|
+
bottom: var(--dot-radius);
|
|
8
34
|
}
|
|
9
35
|
|
|
10
36
|
canvas {
|
|
@@ -16,11 +42,12 @@ canvas {
|
|
|
16
42
|
}
|
|
17
43
|
|
|
18
44
|
#dot {
|
|
45
|
+
box-sizing: border-box;
|
|
19
46
|
position: absolute;
|
|
20
|
-
width:
|
|
21
|
-
height:
|
|
22
|
-
right:
|
|
23
|
-
bottom:
|
|
47
|
+
width: var(--dot-width);
|
|
48
|
+
height: var(--dot-width);
|
|
49
|
+
right: 0;
|
|
50
|
+
bottom: 0;
|
|
24
51
|
border-radius: 50%;
|
|
25
52
|
background: var(--element-neutral-color);
|
|
26
53
|
border: 1px solid var(--border-silhouette-color);
|
|
@@ -31,25 +58,12 @@ canvas {
|
|
|
31
58
|
background: var(--element-neutral-enhanced-color);
|
|
32
59
|
}
|
|
33
60
|
|
|
34
|
-
.medium #dot {
|
|
35
|
-
width: 6px;
|
|
36
|
-
height: 6px;
|
|
37
|
-
right: -4px;
|
|
38
|
-
bottom: -4px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.large #dot {
|
|
42
|
-
width: 8px;
|
|
43
|
-
height: 8px;
|
|
44
|
-
right: -5px;
|
|
45
|
-
bottom: -5px;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
61
|
#zero-line {
|
|
49
62
|
position: absolute;
|
|
50
|
-
|
|
63
|
+
left: 0;
|
|
64
|
+
right: var(--dot-radius);
|
|
51
65
|
height: 1px;
|
|
52
|
-
bottom: -0.5px;
|
|
66
|
+
bottom: calc(var(--dot-radius) - 0.5px);
|
|
53
67
|
background: var(--element-disabled-color);
|
|
54
68
|
border-radius: 2px;
|
|
55
69
|
}
|
|
@@ -36,7 +36,7 @@ export class ObcIndicatorGraph extends LitElement {
|
|
|
36
36
|
@property({type: Object})
|
|
37
37
|
layout: ObcIndicatorGraphLayout = {};
|
|
38
38
|
|
|
39
|
-
@query('
|
|
39
|
+
@query('#chart')
|
|
40
40
|
private chart!: HTMLDivElement;
|
|
41
41
|
|
|
42
42
|
@state()
|
|
@@ -202,6 +202,7 @@ export class ObcIndicatorGraph extends LitElement {
|
|
|
202
202
|
class="chart-container ${this._effectivePriority} ${this
|
|
203
203
|
._effectiveSize}"
|
|
204
204
|
>
|
|
205
|
+
<div id="chart"></div>
|
|
205
206
|
<div
|
|
206
207
|
id="zero-line"
|
|
207
208
|
style="transform: translateY(${-(this.zeroLineY ?? 0)}px);
|