@mustib/web-components 0.0.0-alpha.1 → 0.0.0-alpha.3
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/components/mu-element.d.ts +15 -6
- package/components/mu-element.js +1 -2
- package/components/mu-icon.d.ts +8 -2
- package/components/mu-icon.js +16 -11
- package/components/mu-range-fill.d.ts +9 -2
- package/components/mu-range-fill.js +7 -5
- package/components/mu-range-thumb-value.d.ts +9 -2
- package/components/mu-range-thumb-value.js +12 -10
- package/components/mu-range-thumb.d.ts +16 -2
- package/components/mu-range-thumb.js +32 -21
- package/components/mu-range.d.ts +15 -3
- package/components/mu-range.js +126 -56
- package/components/mu-select-item.d.ts +12 -3
- package/components/mu-select-item.js +17 -12
- package/components/mu-select-items.d.ts +26 -14
- package/components/mu-select-items.js +122 -60
- package/components/mu-select-label-content.d.ts +10 -3
- package/components/mu-select-label-content.js +16 -11
- package/components/mu-select-label.d.ts +12 -3
- package/components/mu-select-label.js +40 -26
- package/components/mu-select.d.ts +16 -8
- package/components/mu-select.js +66 -34
- package/components/mu-transparent.d.ts +10 -4
- package/components/mu-transparent.js +4 -6
- package/components/mu-trigger.d.ts +20 -4
- package/components/mu-trigger.js +57 -21
- package/index.d.ts +46 -13
- package/index.js +13 -14
- package/{mu-element-CZDI_RCY.js → mu-element-C36Rgp-m.js} +39 -30
- package/package.json +2 -7
- package/decorators.d.ts +0 -34
- package/decorators.js +0 -50
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
1
|
import { closestPierce, EventAction } from '@mustib/utils/browser';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
3
|
|
|
4
|
+
type MuElementComponent = {
|
|
5
|
+
attributes: {
|
|
6
|
+
disabled: MuElement['disabled'];
|
|
7
|
+
readonly: MuElement['readonly'];
|
|
8
|
+
'no-event-action-attributes': MuElement['noEventActionAttributes'];
|
|
9
|
+
'event-action-events': MuElement['eventActionEvents'];
|
|
10
|
+
};
|
|
11
|
+
};
|
|
4
12
|
type Elements = [
|
|
5
13
|
'mu-select-item',
|
|
6
14
|
'mu-select-items',
|
|
@@ -17,11 +25,11 @@ type Elements = [
|
|
|
17
25
|
'mu-range-thumb-value',
|
|
18
26
|
'mu-icon'
|
|
19
27
|
];
|
|
20
|
-
declare abstract class
|
|
28
|
+
declare abstract class MuElement extends LitElement {
|
|
21
29
|
#private;
|
|
22
30
|
static closestPierce: typeof closestPierce;
|
|
23
31
|
static register(this: {
|
|
24
|
-
new ():
|
|
32
|
+
new (): MuElement;
|
|
25
33
|
}, tagName: Elements[number]): void;
|
|
26
34
|
static css: {
|
|
27
35
|
focus: any;
|
|
@@ -61,7 +69,7 @@ declare abstract class MUElement extends LitElement {
|
|
|
61
69
|
get interactable(): boolean;
|
|
62
70
|
muId: string;
|
|
63
71
|
constructor();
|
|
64
|
-
generateIsReadyPromise({ timeout, onTimeout }?: {
|
|
72
|
+
generateIsReadyPromise({ timeout, onTimeout, }?: {
|
|
65
73
|
timeout?: number;
|
|
66
74
|
onTimeout?: () => void;
|
|
67
75
|
}): Readonly<{
|
|
@@ -71,7 +79,7 @@ declare abstract class MUElement extends LitElement {
|
|
|
71
79
|
resolve: () => void;
|
|
72
80
|
}>;
|
|
73
81
|
getMuElementById(id: string): {
|
|
74
|
-
element:
|
|
82
|
+
element: MuElement;
|
|
75
83
|
} | undefined;
|
|
76
84
|
closestPierce(selector: string): HTMLElement | null;
|
|
77
85
|
/**
|
|
@@ -104,4 +112,5 @@ declare abstract class MUElement extends LitElement {
|
|
|
104
112
|
disconnectedCallback(): void;
|
|
105
113
|
}
|
|
106
114
|
|
|
107
|
-
export {
|
|
115
|
+
export { MuElement };
|
|
116
|
+
export type { MuElementComponent };
|
package/components/mu-element.js
CHANGED
package/components/mu-icon.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { CSSResultGroup, PropertyValues } from 'lit';
|
|
2
|
-
import {
|
|
2
|
+
import { MuElement, MuElementComponent } from './mu-element.js';
|
|
3
3
|
import '@mustib/utils/browser';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type MuIconComponent = {
|
|
6
|
+
attributes: MuElementComponent['attributes'] & {
|
|
7
|
+
name: MuIcon['name'];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
declare class MuIcon extends MuElement {
|
|
6
11
|
static styles?: CSSResultGroup | undefined;
|
|
7
12
|
eventActionData: undefined;
|
|
8
13
|
_addEventActionAttributes: undefined;
|
|
@@ -23,3 +28,4 @@ declare global {
|
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
export { MuIcon };
|
|
31
|
+
export type { MuIconComponent };
|
package/components/mu-icon.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { M as
|
|
1
|
+
import { M as MuElement, _ as __decorate } from '../mu-element-C36Rgp-m.js';
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
|
-
import {
|
|
4
|
-
import 'lit/decorators.js';
|
|
3
|
+
import { property } from 'lit/decorators.js';
|
|
5
4
|
|
|
6
|
-
class MuIcon extends
|
|
5
|
+
class MuIcon extends MuElement {
|
|
7
6
|
constructor() {
|
|
8
7
|
super(...arguments);
|
|
9
8
|
this.eventActionData = undefined;
|
|
@@ -17,15 +16,21 @@ class MuIcon extends MUElement {
|
|
|
17
16
|
}
|
|
18
17
|
render() {
|
|
19
18
|
const name = this.name;
|
|
20
|
-
const icon = name && Reflect.has(MuIcon.icons, name)
|
|
21
|
-
|
|
19
|
+
const icon = name && Reflect.has(MuIcon.icons, name)
|
|
20
|
+
? MuIcon.icons[name]
|
|
21
|
+
: MuIcon.icons.noImage;
|
|
22
|
+
return name
|
|
23
|
+
? html `
|
|
22
24
|
<div id='container' part='container'>
|
|
23
25
|
${icon}
|
|
24
26
|
</div>
|
|
25
|
-
`
|
|
27
|
+
`
|
|
28
|
+
: undefined;
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
|
-
MuIcon.styles = [
|
|
31
|
+
MuIcon.styles = [
|
|
32
|
+
MuElement.cssBase,
|
|
33
|
+
css `
|
|
29
34
|
:host {
|
|
30
35
|
display: inline-block;
|
|
31
36
|
}
|
|
@@ -40,7 +45,7 @@ MuIcon.styles = [MUElement.cssBase, css `
|
|
|
40
45
|
height: var(--icon-size);
|
|
41
46
|
transition: all 0.1s ease-in-out;
|
|
42
47
|
}
|
|
43
|
-
|
|
48
|
+
`,
|
|
44
49
|
];
|
|
45
50
|
MuIcon.icons = {
|
|
46
51
|
downArrow: html `
|
|
@@ -55,10 +60,10 @@ MuIcon.icons = {
|
|
|
55
60
|
`,
|
|
56
61
|
noImage: html `
|
|
57
62
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 115.19 123.38" style="enable-background:new 0 0 115.19 123.38" xml:space="preserve"><style type="text/css">.st0{fill-rule:evenodd;clip-rule:evenodd;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.6131;}</style><g><path class="st0" d="M93.13,79.5c12.05,0,21.82,9.77,21.82,21.82c0,12.05-9.77,21.82-21.82,21.82c-12.05,0-21.82-9.77-21.82-21.82 C71.31,89.27,81.08,79.5,93.13,79.5L93.13,79.5z M8.08,0.25h95.28c2.17,0,4.11,0.89,5.53,2.3c1.42,1.42,2.3,3.39,2.3,5.53v70.01 c-2.46-1.91-5.24-3.44-8.25-4.48V9.98c0-0.43-0.16-0.79-0.46-1.05c-0.26-0.26-0.66-0.46-1.05-0.46H9.94 c-0.43,0-0.79,0.16-1.05,0.46C8.63,9.19,8.43,9.58,8.43,9.98v70.02h0.03l31.97-30.61c1.28-1.18,3.29-1.05,4.44,0.23 c0.03,0.03,0.03,0.07,0.07,0.07l26.88,31.8c-4.73,5.18-7.62,12.08-7.62,19.65c0,3.29,0.55,6.45,1.55,9.4H8.08 c-2.17,0-4.11-0.89-5.53-2.3s-2.3-3.39-2.3-5.53V8.08c0-2.17,0.89-4.11,2.3-5.53S5.94,0.25,8.08,0.25L8.08,0.25z M73.98,79.35 l3.71-22.79c0.3-1.71,1.91-2.9,3.62-2.6c0.66,0.1,1.25,0.43,1.71,0.86l17.1,17.97c-2.18-0.52-4.44-0.79-6.78-0.79 C85.91,71.99,79.13,74.77,73.98,79.35L73.98,79.35z M81.98,18.19c3.13,0,5.99,1.28,8.03,3.32c2.07,2.07,3.32,4.9,3.32,8.03 c0,3.13-1.28,5.99-3.32,8.03c-2.07,2.07-4.9,3.32-8.03,3.32c-3.13,0-5.99-1.28-8.03-3.32c-2.07-2.07-3.32-4.9-3.32-8.03 c0-3.13,1.28-5.99,3.32-8.03C76.02,19.44,78.86,18.19,81.98,18.19L81.98,18.19z M85.82,88.05l19.96,21.6 c1.58-2.39,2.5-5.25,2.5-8.33c0-8.36-6.78-15.14-15.14-15.14C90.48,86.17,87.99,86.85,85.82,88.05L85.82,88.05z M100.44,114.58 l-19.96-21.6c-1.58,2.39-2.5,5.25-2.5,8.33c0,8.36,6.78,15.14,15.14,15.14C95.78,116.46,98.27,115.78,100.44,114.58L100.44,114.58z"/></g></svg>
|
|
58
|
-
|
|
63
|
+
`,
|
|
59
64
|
};
|
|
60
65
|
__decorate([
|
|
61
|
-
|
|
66
|
+
property()
|
|
62
67
|
], MuIcon.prototype, "name", void 0);
|
|
63
68
|
MuIcon.register('mu-icon');
|
|
64
69
|
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { CSSResultGroup } from 'lit';
|
|
2
|
-
import {
|
|
2
|
+
import { MuElement, MuElementComponent } from './mu-element.js';
|
|
3
3
|
import '@mustib/utils/browser';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type MuRangeFillComponent = {
|
|
6
|
+
attributes: MuElementComponent['attributes'] & {
|
|
7
|
+
for: MuRangeFill['for'];
|
|
8
|
+
type: MuRangeFill['type'];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
declare class MuRangeFill extends MuElement {
|
|
6
12
|
static styles: CSSResultGroup;
|
|
7
13
|
eventActionData: undefined;
|
|
8
14
|
_addEventActionAttributes: undefined;
|
|
@@ -46,3 +52,4 @@ declare class MuRangeFill extends MUElement {
|
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
export { MuRangeFill };
|
|
55
|
+
export type { MuRangeFillComponent };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { M as
|
|
1
|
+
import { M as MuElement, _ as __decorate } from '../mu-element-C36Rgp-m.js';
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
3
|
import { property, query } from 'lit/decorators.js';
|
|
4
|
-
import '../decorators.js';
|
|
5
4
|
|
|
6
|
-
class MuRangeFill extends
|
|
5
|
+
class MuRangeFill extends MuElement {
|
|
7
6
|
constructor() {
|
|
8
7
|
super(...arguments);
|
|
9
8
|
this.eventActionData = undefined;
|
|
@@ -48,7 +47,9 @@ class MuRangeFill extends MUElement {
|
|
|
48
47
|
`;
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
|
-
MuRangeFill.styles = [
|
|
50
|
+
MuRangeFill.styles = [
|
|
51
|
+
MuElement.cssBase,
|
|
52
|
+
css `
|
|
52
53
|
#container {
|
|
53
54
|
--range-fill-background-color: var(--mu-range-fill-background-color, var(--mu-color-500));
|
|
54
55
|
--start: 25%;
|
|
@@ -79,7 +80,8 @@ MuRangeFill.styles = [MUElement.cssBase, css `
|
|
|
79
80
|
top: var(--start);
|
|
80
81
|
bottom: calc(100% - var(--end));
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
+
`,
|
|
84
|
+
];
|
|
83
85
|
__decorate([
|
|
84
86
|
property()
|
|
85
87
|
], MuRangeFill.prototype, "for", void 0);
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { CSSResultGroup } from 'lit';
|
|
2
|
-
import {
|
|
2
|
+
import { MuElement, MuElementComponent } from './mu-element.js';
|
|
3
3
|
import '@mustib/utils/browser';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type MuRangeThumbValueComponent = {
|
|
6
|
+
attributes: MuElementComponent['attributes'] & {
|
|
7
|
+
reversed: MuRangeThumbValue['reversed'];
|
|
8
|
+
type: MuRangeThumbValue['type'];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
declare class MuRangeThumbValue extends MuElement {
|
|
6
12
|
static styles: CSSResultGroup;
|
|
7
13
|
eventActionData: undefined;
|
|
8
14
|
_addEventActionAttributes: undefined;
|
|
@@ -46,3 +52,4 @@ declare class MuRangeThumbValue extends MUElement {
|
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
export { MuRangeThumbValue };
|
|
55
|
+
export type { MuRangeThumbValueComponent };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { M as
|
|
1
|
+
import { M as MuElement, _ as __decorate } from '../mu-element-C36Rgp-m.js';
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
3
|
import { property, query } from 'lit/decorators.js';
|
|
4
|
-
import '../decorators.js';
|
|
5
4
|
|
|
6
|
-
class MuRangeThumbValue extends
|
|
5
|
+
class MuRangeThumbValue extends MuElement {
|
|
7
6
|
constructor() {
|
|
8
7
|
super(...arguments);
|
|
9
8
|
this.eventActionData = undefined;
|
|
@@ -41,16 +40,16 @@ class MuRangeThumbValue extends MUElement {
|
|
|
41
40
|
async setValue(data) {
|
|
42
41
|
await this.updateComplete;
|
|
43
42
|
switch (this.type) {
|
|
44
|
-
case
|
|
43
|
+
case 'percentage':
|
|
45
44
|
// keep two decimal places
|
|
46
|
-
this.contentEl.textContent = `${
|
|
45
|
+
this.contentEl.textContent = `${Math.trunc(data.percentage * 100) / 100}%`;
|
|
47
46
|
break;
|
|
48
|
-
case
|
|
47
|
+
case 'percentage:round':
|
|
49
48
|
this.contentEl.textContent = `${Math.round(data.percentage)}%`;
|
|
50
49
|
break;
|
|
51
|
-
case
|
|
50
|
+
case 'unit':
|
|
52
51
|
// keep one decimal place
|
|
53
|
-
this.contentEl.textContent = `${
|
|
52
|
+
this.contentEl.textContent = `${Math.trunc(data.value * 10) / 10}`;
|
|
54
53
|
break;
|
|
55
54
|
default:
|
|
56
55
|
this.type;
|
|
@@ -72,7 +71,9 @@ class MuRangeThumbValue extends MUElement {
|
|
|
72
71
|
`;
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
|
-
MuRangeThumbValue.styles = [
|
|
74
|
+
MuRangeThumbValue.styles = [
|
|
75
|
+
MuElement.cssBase,
|
|
76
|
+
css `
|
|
76
77
|
:host([reversed]) #container[axis='x'] {
|
|
77
78
|
top: 100%;
|
|
78
79
|
bottom: unset;
|
|
@@ -122,7 +123,8 @@ MuRangeThumbValue.styles = [MUElement.cssBase, css `
|
|
|
122
123
|
color: var(--mu-color-100);
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
|
-
|
|
126
|
+
`,
|
|
127
|
+
];
|
|
126
128
|
__decorate([
|
|
127
129
|
property({ type: Boolean })
|
|
128
130
|
], MuRangeThumbValue.prototype, "reversed", void 0);
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import { CSSResultGroup, PropertyValues } from 'lit';
|
|
2
|
-
import {
|
|
2
|
+
import { MuElement, MuElementComponent } from './mu-element.js';
|
|
3
3
|
import { MuRangeThumbValue } from './mu-range-thumb-value.js';
|
|
4
4
|
import '@mustib/utils/browser';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type MuRangeThumbComponent = {
|
|
7
|
+
attributes: MuElementComponent['attributes'] & {
|
|
8
|
+
'min-value': MuRangeThumb['minValue'];
|
|
9
|
+
'max-value': MuRangeThumb['maxValue'];
|
|
10
|
+
value: MuRangeThumb['value'];
|
|
11
|
+
step: MuRangeThumb['step'];
|
|
12
|
+
name: MuRangeThumb['name'];
|
|
13
|
+
focused: MuRangeThumb['focused'];
|
|
14
|
+
'intersect-behavior': MuRangeThumb['intersectBehavior'];
|
|
15
|
+
transparent: MuRangeThumb['transparent'];
|
|
16
|
+
'force-step': MuRangeThumb['forceStep'];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
declare class MuRangeThumb extends MuElement {
|
|
7
20
|
static styles?: CSSResultGroup | undefined;
|
|
8
21
|
eventActionData: undefined;
|
|
9
22
|
_addEventActionAttributes: undefined;
|
|
@@ -118,3 +131,4 @@ declare global {
|
|
|
118
131
|
}
|
|
119
132
|
|
|
120
133
|
export { MuRangeThumb };
|
|
134
|
+
export type { MuRangeThumbComponent };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { M as
|
|
1
|
+
import { M as MuElement, _ as __decorate, g as getElementBoundaries } from '../mu-element-C36Rgp-m.js';
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
3
|
import { state, property, query } from 'lit/decorators.js';
|
|
4
|
-
import { MuRangeThumbValue } from './mu-range-thumb-value.js';
|
|
5
4
|
import { MuTransparent } from './mu-transparent.js';
|
|
6
|
-
import '
|
|
5
|
+
import { MuRangeThumbValue } from './mu-range-thumb-value.js';
|
|
7
6
|
|
|
8
|
-
class MuRangeThumb extends
|
|
7
|
+
class MuRangeThumb extends MuElement {
|
|
9
8
|
get range() {
|
|
10
9
|
return this._range;
|
|
11
10
|
}
|
|
12
11
|
set range(value) {
|
|
13
|
-
if (this._isRangeReady.resolved &&
|
|
12
|
+
if (this._isRangeReady.resolved &&
|
|
13
|
+
(value[0] > this.minValue || value[1] < this.maxValue)) {
|
|
14
14
|
console.warn(`range must not be less than max value (${this.maxValue}) or greater than min value (${this.minValue}), but got (${value})`, this);
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
@@ -71,7 +71,10 @@ class MuRangeThumb extends MUElement {
|
|
|
71
71
|
this._valueElements.add(el);
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
this.renderRoot
|
|
74
|
+
this.renderRoot
|
|
75
|
+
.querySelector('slot')
|
|
76
|
+
?.assignedElements({ flatten: true })
|
|
77
|
+
.forEach((el) => {
|
|
75
78
|
if (el instanceof MuTransparent) {
|
|
76
79
|
el.contents.forEach(addElement);
|
|
77
80
|
}
|
|
@@ -121,10 +124,10 @@ class MuRangeThumb extends MUElement {
|
|
|
121
124
|
_updateValueElements() {
|
|
122
125
|
if (this._valueElements.size === 0)
|
|
123
126
|
return;
|
|
124
|
-
this._valueElements.forEach(el => {
|
|
127
|
+
this._valueElements.forEach((el) => {
|
|
125
128
|
el.setValue({
|
|
126
129
|
value: this.value,
|
|
127
|
-
percentage: this.getPercentageFromValue(this.value)
|
|
130
|
+
percentage: this.getPercentageFromValue(this.value),
|
|
128
131
|
});
|
|
129
132
|
});
|
|
130
133
|
}
|
|
@@ -158,26 +161,29 @@ class MuRangeThumb extends MUElement {
|
|
|
158
161
|
* @returns A boolean indicating if the value was changed
|
|
159
162
|
*/
|
|
160
163
|
setValueFromPercentage(percentage) {
|
|
161
|
-
const value = (
|
|
164
|
+
const value = (percentage / 100) * (this.range[1] - this.range[0]) + this.range[0];
|
|
162
165
|
return this.setValue(value);
|
|
163
166
|
}
|
|
164
167
|
/**
|
|
165
168
|
* Converts a given value to a percentage based on the current range and returns it.
|
|
166
169
|
*/
|
|
167
170
|
getPercentageFromValue(value) {
|
|
168
|
-
return (
|
|
171
|
+
return (value / (this.range[1] - this.range[0])) * 100;
|
|
169
172
|
}
|
|
170
173
|
/**
|
|
171
174
|
* Updates the axis of related mu-range-thumb-value elements
|
|
172
175
|
*/
|
|
173
176
|
updateValueElementsAxis() {
|
|
174
|
-
this._valueElements.forEach(el =>
|
|
177
|
+
this._valueElements.forEach((el) => {
|
|
178
|
+
el.setAxis(this.axis === 'x' || this.axis === '-x' ? 'x' : 'y');
|
|
179
|
+
});
|
|
175
180
|
}
|
|
176
181
|
async updated(_changedProperties) {
|
|
177
182
|
await this.updateComplete;
|
|
178
183
|
if (_changedProperties.has('axis')) {
|
|
179
184
|
this.updateValueElementsAxis();
|
|
180
|
-
this.ariaOrientation =
|
|
185
|
+
this.ariaOrientation =
|
|
186
|
+
this.axis === '-y' || this.axis === 'y' ? 'vertical' : 'horizontal';
|
|
181
187
|
}
|
|
182
188
|
if (_changedProperties.has('value')) {
|
|
183
189
|
if (!this.isValidValue(this.value)) {
|
|
@@ -187,13 +193,15 @@ class MuRangeThumb extends MUElement {
|
|
|
187
193
|
this.setAttribute('aria-valuenow', `${this.value}`);
|
|
188
194
|
this._updateValueElements();
|
|
189
195
|
}
|
|
190
|
-
if (_changedProperties.has('minValue') ||
|
|
196
|
+
if (_changedProperties.has('minValue') ||
|
|
197
|
+
_changedProperties.has('maxValue')) {
|
|
191
198
|
this.setAttribute('aria-valuemin', `${this.minValue}`);
|
|
192
199
|
this.setAttribute('aria-valuemax', `${this.maxValue}`);
|
|
193
200
|
if (this.minValue > this.maxValue) {
|
|
194
201
|
console.warn(`minValue attribute must not be greater than maxValue attribute, but got (${this.minValue}, ${this.maxValue})`, this);
|
|
195
202
|
}
|
|
196
|
-
else if (this.minValue < this.range[0] ||
|
|
203
|
+
else if (this.minValue < this.range[0] ||
|
|
204
|
+
this.maxValue > this.range[1]) {
|
|
197
205
|
console.warn(`minValue (${this.minValue}) and maxValue (${this.maxValue}) attributes must be equal to or in the range of range property (${this.range})`, this);
|
|
198
206
|
}
|
|
199
207
|
}
|
|
@@ -206,7 +214,9 @@ class MuRangeThumb extends MUElement {
|
|
|
206
214
|
`;
|
|
207
215
|
}
|
|
208
216
|
}
|
|
209
|
-
MuRangeThumb.styles = [
|
|
217
|
+
MuRangeThumb.styles = [
|
|
218
|
+
MuElement.cssBase,
|
|
219
|
+
css `
|
|
210
220
|
#container {
|
|
211
221
|
--thumb-size: var(--mu-range-thumb-size, calc(var(--range-thickness) * 3));
|
|
212
222
|
--range-thumb-background-color: var(--mu-range-thumb-background-color, var(--mu-color-500));
|
|
@@ -225,7 +235,7 @@ MuRangeThumb.styles = [MUElement.cssBase, css `
|
|
|
225
235
|
|
|
226
236
|
|
|
227
237
|
:host([focused]) #container {
|
|
228
|
-
${
|
|
238
|
+
${MuElement.css.focus};
|
|
229
239
|
}
|
|
230
240
|
|
|
231
241
|
#container[axis='x'] {
|
|
@@ -254,7 +264,8 @@ MuRangeThumb.styles = [MUElement.cssBase, css `
|
|
|
254
264
|
left: 50%;
|
|
255
265
|
transform: translateX(-50%);
|
|
256
266
|
}
|
|
257
|
-
|
|
267
|
+
`,
|
|
268
|
+
];
|
|
258
269
|
__decorate([
|
|
259
270
|
state()
|
|
260
271
|
], MuRangeThumb.prototype, "axis", void 0);
|
|
@@ -262,25 +273,25 @@ __decorate([
|
|
|
262
273
|
property({
|
|
263
274
|
reflect: true,
|
|
264
275
|
type: Number,
|
|
265
|
-
attribute: 'min-value'
|
|
276
|
+
attribute: 'min-value',
|
|
266
277
|
})
|
|
267
278
|
], MuRangeThumb.prototype, "minValue", void 0);
|
|
268
279
|
__decorate([
|
|
269
280
|
property({
|
|
270
281
|
reflect: true,
|
|
271
282
|
type: Number,
|
|
272
|
-
attribute: 'max-value'
|
|
283
|
+
attribute: 'max-value',
|
|
273
284
|
})
|
|
274
285
|
], MuRangeThumb.prototype, "maxValue", void 0);
|
|
275
286
|
__decorate([
|
|
276
287
|
property({
|
|
277
288
|
reflect: true,
|
|
278
289
|
type: Number,
|
|
279
|
-
attribute: 'value'
|
|
290
|
+
attribute: 'value',
|
|
280
291
|
})
|
|
281
292
|
], MuRangeThumb.prototype, "value", void 0);
|
|
282
293
|
__decorate([
|
|
283
|
-
property({ reflect: true, type: Number
|
|
294
|
+
property({ reflect: true, type: Number })
|
|
284
295
|
], MuRangeThumb.prototype, "step", void 0);
|
|
285
296
|
__decorate([
|
|
286
297
|
property()
|
package/components/mu-range.d.ts
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { CSSResultGroup, PropertyValues } from 'lit';
|
|
2
|
-
import {
|
|
3
|
-
import { MuRangeThumb } from './mu-range-thumb.js';
|
|
2
|
+
import { MuElement, MuElementComponent } from './mu-element.js';
|
|
4
3
|
import { MuRangeFill } from './mu-range-fill.js';
|
|
4
|
+
import { MuRangeThumb } from './mu-range-thumb.js';
|
|
5
5
|
import '@mustib/utils/browser';
|
|
6
6
|
import './mu-range-thumb-value.js';
|
|
7
7
|
|
|
8
|
+
type MuRangeComponent = {
|
|
9
|
+
attributes: MuElementComponent['attributes'] & {
|
|
10
|
+
axis: MuRange['axis'];
|
|
11
|
+
min: MuRange['min'];
|
|
12
|
+
max: MuRange['max'];
|
|
13
|
+
value: MuRange['value'];
|
|
14
|
+
'default-value': MuRange['defaultValue'];
|
|
15
|
+
'empty-area': MuRange['emptyArea'];
|
|
16
|
+
};
|
|
17
|
+
events: Events;
|
|
18
|
+
};
|
|
8
19
|
type RangeThumb = {
|
|
9
20
|
element: MuRangeThumb;
|
|
10
21
|
linkedFillElements: RangeFill[] | undefined;
|
|
@@ -53,7 +64,7 @@ type Events = {
|
|
|
53
64
|
}[];
|
|
54
65
|
}>;
|
|
55
66
|
};
|
|
56
|
-
declare class MuRange extends
|
|
67
|
+
declare class MuRange extends MuElement {
|
|
57
68
|
static styles?: CSSResultGroup | undefined;
|
|
58
69
|
eventActionData: undefined;
|
|
59
70
|
_addEventActionAttributes: undefined;
|
|
@@ -204,3 +215,4 @@ declare global {
|
|
|
204
215
|
}
|
|
205
216
|
|
|
206
217
|
export { MuRange };
|
|
218
|
+
export type { MuRangeComponent };
|