@momentum-design/components 0.110.0 → 0.110.2
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/dist/browser/index.js +709 -405
- package/dist/browser/index.js.map +4 -4
- package/dist/components/slider/index.d.ts +1 -0
- package/dist/components/slider/index.js +1 -0
- package/dist/components/slider/slider.component.d.ts +154 -37
- package/dist/components/slider/slider.component.js +489 -90
- package/dist/components/slider/slider.constants.d.ts +14 -1
- package/dist/components/slider/slider.constants.js +14 -1
- package/dist/components/slider/slider.styles.js +195 -1
- package/dist/components/slider/slider.types.d.ts +8 -1
- package/dist/components/slider/slider.types.js +0 -1
- package/dist/custom-elements.json +927 -658
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +3 -3
- package/dist/react/slider/index.d.ts +34 -4
- package/dist/react/slider/index.js +31 -4
- package/dist/utils/styles/index.d.ts +2 -1
- package/dist/utils/styles/index.js +5 -5
- package/package.json +1 -1
@@ -1,2 +1,15 @@
|
|
1
1
|
declare const TAG_NAME: "mdc-slider";
|
2
|
-
|
2
|
+
declare const THUMBSTATE: {
|
3
|
+
readonly START: "start";
|
4
|
+
readonly END: "end";
|
5
|
+
readonly UNDEFINED: undefined;
|
6
|
+
};
|
7
|
+
declare const DEFAULTS: {
|
8
|
+
readonly MIN: 0;
|
9
|
+
readonly MAX: 100;
|
10
|
+
readonly STEP: 1;
|
11
|
+
readonly STATE: undefined;
|
12
|
+
readonly ICON_SIZE: 1.25;
|
13
|
+
readonly ICON_LENGTH_UNIT: "rem";
|
14
|
+
};
|
15
|
+
export { TAG_NAME, DEFAULTS, THUMBSTATE };
|
@@ -1,3 +1,16 @@
|
|
1
1
|
import utils from '../../utils/tag-name';
|
2
2
|
const TAG_NAME = utils.constructTagName('slider');
|
3
|
-
|
3
|
+
const THUMBSTATE = {
|
4
|
+
START: 'start',
|
5
|
+
END: 'end',
|
6
|
+
UNDEFINED: undefined,
|
7
|
+
};
|
8
|
+
const DEFAULTS = {
|
9
|
+
MIN: 0,
|
10
|
+
MAX: 100,
|
11
|
+
STEP: 1,
|
12
|
+
STATE: THUMBSTATE.UNDEFINED,
|
13
|
+
ICON_SIZE: 1.25,
|
14
|
+
ICON_LENGTH_UNIT: 'rem',
|
15
|
+
};
|
16
|
+
export { TAG_NAME, DEFAULTS, THUMBSTATE };
|
@@ -1,7 +1,201 @@
|
|
1
1
|
import { css } from 'lit';
|
2
|
+
import { baseHostStyleVariables, focusRingBoxShadow } from '../../utils/styles';
|
2
3
|
const styles = css `
|
3
4
|
:host {
|
5
|
+
width: 100%;
|
6
|
+
--mdc-slider-tooltip-left: 0;
|
7
|
+
--mdc-slider-tick-left: 0;
|
8
|
+
--mdc-slider-input-size: 0.5rem;
|
9
|
+
--mdc-slider-thumb-size: 1.5rem;
|
10
|
+
--mdc-slider-tick-size: 0.25rem;
|
11
|
+
--mdc-slider-track-height: 2rem;
|
12
|
+
--mdc-slider-thumb-color: var(--mds-color-theme-overlay-button-secondary-normal);
|
13
|
+
--mdc-slider-thumb-border-color: var(--mds-color-theme-outline-input-normal);
|
14
|
+
--mdc-slider-tick-color: var(--mds-color-theme-inverted-text-primary-normal);
|
15
|
+
--mdc-slider-progress-color: var(--mds-color-theme-control-active-normal);
|
16
|
+
--mdc-slider-track-color: var(--mds-color-theme-control-indicator-inactive-normal);
|
17
|
+
}
|
18
|
+
|
19
|
+
:host([disabled]),
|
20
|
+
:host([soft-disabled]) {
|
21
|
+
--mdc-slider-progress-color: var(--mds-color-theme-control-active-disabled);
|
22
|
+
--mdc-slider-track-color: var(--mds-color-theme-control-inactive-disabled);
|
23
|
+
}
|
24
|
+
|
25
|
+
:host::part(slider-label),
|
26
|
+
:host::part(slider-label-start),
|
27
|
+
:host::part(slider-label-end) {
|
28
|
+
color: var(--mds-color-theme-text-primary-normal);
|
29
|
+
font-size: var(--mds-font-apps-body-midsize-medium-font-size);
|
30
|
+
font-weight: var(--mds-font-apps-body-midsize-medium-font-weight);
|
31
|
+
line-height: var(--mds-font-apps-body-midsize-medium-line-height);
|
32
|
+
}
|
33
|
+
|
34
|
+
:host::part(slider-label) {
|
35
|
+
margin-bottom: 0.5rem;
|
4
36
|
display: block;
|
5
37
|
}
|
38
|
+
|
39
|
+
:host::part(slider-track) {
|
40
|
+
width: 100%;
|
41
|
+
height: var(--mdc-slider-track-height);
|
42
|
+
display: flex;
|
43
|
+
align-items: center;
|
44
|
+
gap: 0.75rem;
|
45
|
+
}
|
46
|
+
|
47
|
+
:host::part(slider-wrapper) {
|
48
|
+
position: relative;
|
49
|
+
width: 100%;
|
50
|
+
height: var(--mdc-slider-track-height);
|
51
|
+
display: flex;
|
52
|
+
align-items: center;
|
53
|
+
justify-content: center;
|
54
|
+
}
|
55
|
+
|
56
|
+
:host::part(slider-labels) {
|
57
|
+
display: flex;
|
58
|
+
justify-content: space-between;
|
59
|
+
}
|
60
|
+
|
61
|
+
:host::part(leading-icon),
|
62
|
+
:host::part(trailing-icon) {
|
63
|
+
flex-shrink: 0;
|
64
|
+
}
|
65
|
+
|
66
|
+
#start-slider {
|
67
|
+
height: 0;
|
68
|
+
z-index: 1;
|
69
|
+
}
|
70
|
+
|
71
|
+
input[type='range'] {
|
72
|
+
-webkit-appearance: none;
|
73
|
+
appearance: none;
|
74
|
+
width: 100%;
|
75
|
+
height: var(--mdc-slider-input-size);
|
76
|
+
border-radius: 0.25rem;
|
77
|
+
outline: none;
|
78
|
+
margin: 0;
|
79
|
+
position: absolute;
|
80
|
+
pointer-events: none;
|
81
|
+
}
|
82
|
+
|
83
|
+
input[type='range']::-webkit-slider-thumb {
|
84
|
+
-webkit-appearance: none;
|
85
|
+
appearance: none;
|
86
|
+
pointer-events: all;
|
87
|
+
cursor: pointer;
|
88
|
+
width: var(--mdc-slider-thumb-size);
|
89
|
+
height: var(--mdc-slider-thumb-size);
|
90
|
+
background: var(--mdc-slider-thumb-color);
|
91
|
+
border-radius: 50%;
|
92
|
+
border: 1px solid var(--mdc-slider-thumb-border-color);
|
93
|
+
}
|
94
|
+
|
95
|
+
input[type='range']::-moz-range-thumb {
|
96
|
+
pointer-events: all;
|
97
|
+
cursor: pointer;
|
98
|
+
width: var(--mdc-slider-thumb-size);
|
99
|
+
height: var(--mdc-slider-thumb-size);
|
100
|
+
background: var(--mdc-slider-thumb-color);
|
101
|
+
border-radius: 50%;
|
102
|
+
border: 1px solid var(--mdc-slider-thumb-border-color);
|
103
|
+
}
|
104
|
+
|
105
|
+
input[type='range']::-ms-thumb {
|
106
|
+
pointer-events: all;
|
107
|
+
cursor: pointer;
|
108
|
+
width: var(--mdc-slider-thumb-size);
|
109
|
+
height: var(--mdc-slider-thumb-size);
|
110
|
+
background: var(--mdc-slider-thumb-color);
|
111
|
+
border-radius: 50%;
|
112
|
+
border: 1px solid var(--mdc-slider-thumb-border-color);
|
113
|
+
}
|
114
|
+
|
115
|
+
:host(:not([soft-disabled])) input[type='range']:not(:disabled):hover::-webkit-slider-thumb {
|
116
|
+
--mdc-slider-thumb-color: var(--mds-color-theme-overlay-button-secondary-hover);
|
117
|
+
--mdc-slider-thumb-border-color: var(--mds-color-theme-outline-input-active);
|
118
|
+
}
|
119
|
+
|
120
|
+
:host(:not([soft-disabled])) input[type='range']:not(:disabled):active::-webkit-slider-thumb {
|
121
|
+
--mdc-slider-thumb-color: var(--mds-color-theme-overlay-button-secondary-pressed);
|
122
|
+
--mdc-slider-thumb-border-color: var(--mds-color-theme-outline-input-active);
|
123
|
+
}
|
124
|
+
|
125
|
+
:host(:not([soft-disabled])) input[type='range']:not(:disabled):hover::-moz-range-thumb {
|
126
|
+
--mdc-slider-thumb-color: var(--mds-color-theme-overlay-button-secondary-hover);
|
127
|
+
--mdc-slider-thumb-border-color: var(--mds-color-theme-outline-input-active);
|
128
|
+
}
|
129
|
+
|
130
|
+
:host(:not([soft-disabled])) input[type='range']:not(:disabled):active::-moz-range-thumb {
|
131
|
+
--mdc-slider-thumb-color: var(--mds-color-theme-overlay-button-secondary-pressed);
|
132
|
+
--mdc-slider-thumb-border-color: var(--mds-color-theme-outline-input-active);
|
133
|
+
}
|
134
|
+
|
135
|
+
:host(:not([soft-disabled])) input[type='range']:not(:disabled):hover::-ms-thumb {
|
136
|
+
--mdc-slider-thumb-color: var(--mds-color-theme-overlay-button-secondary-hover);
|
137
|
+
--mdc-slider-thumb-border-color: var(--mds-color-theme-outline-input-active);
|
138
|
+
}
|
139
|
+
|
140
|
+
:host(:not([soft-disabled])) input[type='range']:not(:disabled):active::-ms-thumb {
|
141
|
+
--mdc-slider-thumb-color: var(--mds-color-theme-overlay-button-secondary-pressed);
|
142
|
+
--mdc-slider-thumb-border-color: var(--mds-color-theme-outline-input-active);
|
143
|
+
}
|
144
|
+
|
145
|
+
input[type='range']:focus::-webkit-slider-thumb {
|
146
|
+
box-shadow: ${focusRingBoxShadow};
|
147
|
+
}
|
148
|
+
|
149
|
+
input[type='range']:focus::-moz-range-thumb {
|
150
|
+
box-shadow: ${focusRingBoxShadow};
|
151
|
+
}
|
152
|
+
|
153
|
+
input[type='range']:focus::-ms-thumb {
|
154
|
+
box-shadow: ${focusRingBoxShadow};
|
155
|
+
}
|
156
|
+
|
157
|
+
:host::part(slider-tooltip) {
|
158
|
+
position: absolute;
|
159
|
+
bottom: 120%;
|
160
|
+
border-radius: 0.5rem;
|
161
|
+
border: 1px solid var(--mds-color-theme-outline-secondary-normal);
|
162
|
+
background-color: var(--mds-color-theme-background-solid-primary-normal);
|
163
|
+
filter: var(--mds-elevation-3);
|
164
|
+
padding: 0.5rem;
|
165
|
+
transform: translateX(-50%);
|
166
|
+
left: calc(
|
167
|
+
var(--mdc-slider-tooltip-left) * (100% - var(--mdc-slider-thumb-size)) + (var(--mdc-slider-thumb-size) / 2)
|
168
|
+
);
|
169
|
+
}
|
170
|
+
|
171
|
+
:host::part(slider-ticks) {
|
172
|
+
position: absolute;
|
173
|
+
bottom: 7%;
|
174
|
+
width: 100%;
|
175
|
+
height: 100%;
|
176
|
+
pointer-events: none;
|
177
|
+
z-index: 1;
|
178
|
+
}
|
179
|
+
|
180
|
+
:host::part(slider-tick) {
|
181
|
+
position: absolute;
|
182
|
+
top: 50%;
|
183
|
+
width: var(--mdc-slider-tick-size);
|
184
|
+
height: var(--mdc-slider-tick-size);
|
185
|
+
background: var(--mdc-slider-tick-color);
|
186
|
+
border-radius: 50%;
|
187
|
+
transform: translateX(-50%);
|
188
|
+
left: calc(
|
189
|
+
var(--mdc-slider-tick-left) * (100% - var(--mdc-slider-thumb-size)) + (var(--mdc-slider-thumb-size) / 2)
|
190
|
+
);
|
191
|
+
}
|
192
|
+
|
193
|
+
@media (forced-colors: active) {
|
194
|
+
:host::part(end-slider),
|
195
|
+
:host::part(single-slider),
|
196
|
+
:host::part(slider-tick) {
|
197
|
+
border: 1px solid;
|
198
|
+
}
|
199
|
+
}
|
6
200
|
`;
|
7
|
-
export default [styles];
|
201
|
+
export default [baseHostStyleVariables, styles];
|
@@ -1,3 +1,10 @@
|
|
1
|
+
import type { OverrideEventTarget, TypedCustomEvent, ValueOf } from '../../utils/types';
|
2
|
+
import type Slider from './slider.component';
|
3
|
+
import { THUMBSTATE } from './slider.constants';
|
4
|
+
type SliderChangeEvent = TypedCustomEvent<Slider>;
|
5
|
+
type ThumbStateType = ValueOf<typeof THUMBSTATE>;
|
1
6
|
interface Events {
|
7
|
+
onInputEvent: OverrideEventTarget<InputEvent, Slider>;
|
8
|
+
onChangeEvent: SliderChangeEvent;
|
2
9
|
}
|
3
|
-
export type { Events };
|
10
|
+
export type { Events, ThumbStateType };
|