@instructure/ui-range-input 11.7.8 → 11.7.9-pr-snapshot-1792147648392
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/CHANGELOG.md +13 -0
- package/es/RangeInput/v1/index.js +131 -169
- package/es/RangeInput/v1/props.js +21 -26
- package/es/RangeInput/v1/styles.js +123 -162
- package/es/RangeInput/v1/theme.js +45 -83
- package/es/RangeInput/v2/index.js +140 -178
- package/es/RangeInput/v2/props.js +21 -26
- package/es/RangeInput/v2/styles.js +105 -146
- package/es/exports/a.js +1 -25
- package/es/exports/b.js +1 -25
- package/package.json +17 -23
- package/tsconfig.build.json +0 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/lib/RangeInput/v1/index.js +0 -194
- package/lib/RangeInput/v1/props.js +0 -31
- package/lib/RangeInput/v1/styles.js +0 -169
- package/lib/RangeInput/v1/theme.js +0 -92
- package/lib/RangeInput/v2/index.js +0 -202
- package/lib/RangeInput/v2/props.js +0 -31
- package/lib/RangeInput/v2/styles.js +0 -153
- package/lib/exports/a.js +0 -12
- package/lib/exports/b.js +0 -12
- package/lib/package.json +0 -1
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* The MIT License (MIT)
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
1
|
+
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
26
3
|
import { Component } from 'react';
|
|
27
4
|
import { warn } from '@instructure/console';
|
|
28
5
|
import { ContextView } from '@instructure/ui-view/latest';
|
|
@@ -32,165 +9,150 @@ import { withStyleNew } from '@instructure/emotion';
|
|
|
32
9
|
import { omitProps, pickProps, withDeterministicId } from '@instructure/ui-react-utils';
|
|
33
10
|
import generateStyle from './styles.js';
|
|
34
11
|
import { allowedProps } from './props.js';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
static componentId = 'RangeInput';
|
|
45
|
-
static outputLocatorAttribute = 'data-range-output';
|
|
46
|
-
static allowedProps = allowedProps;
|
|
47
|
-
static defaultProps = {
|
|
48
|
-
step: 1,
|
|
49
|
-
formatValue: val => val,
|
|
50
|
-
// If min and max has default value, they don't give a warning if not set, even if they are required props.
|
|
51
|
-
// TODO: figure out if they don't need to be required or remove defaults in V9.
|
|
52
|
-
max: 0,
|
|
53
|
-
min: 0,
|
|
54
|
-
inline: false,
|
|
55
|
-
size: 'medium',
|
|
56
|
-
layout: 'stacked',
|
|
57
|
-
displayValue: true,
|
|
58
|
-
disabled: false,
|
|
59
|
-
readOnly: false
|
|
60
|
-
};
|
|
61
|
-
ref = null;
|
|
62
|
-
_input = null;
|
|
63
|
-
_inputListener = null;
|
|
64
|
-
_changeListener = null;
|
|
65
|
-
defaultId;
|
|
66
|
-
handleRef = el => {
|
|
67
|
-
this.ref = el;
|
|
68
|
-
};
|
|
69
|
-
handleInputRef = el => {
|
|
70
|
-
this._input = el;
|
|
71
|
-
if (typeof this.props.inputRef === 'function') {
|
|
72
|
-
this.props.inputRef(el);
|
|
12
|
+
class RangeInput extends Component {
|
|
13
|
+
static{
|
|
14
|
+
this.displayName = 'RangeInput';
|
|
15
|
+
}
|
|
16
|
+
static{
|
|
17
|
+
this.componentId = 'RangeInput';
|
|
18
|
+
}
|
|
19
|
+
static{
|
|
20
|
+
this.outputLocatorAttribute = 'data-range-output';
|
|
73
21
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
super(props);
|
|
77
|
-
if (typeof props.value === 'undefined') {
|
|
78
|
-
this.state = {
|
|
79
|
-
value: props.defaultValue
|
|
80
|
-
};
|
|
22
|
+
static{
|
|
23
|
+
this.allowedProps = allowedProps;
|
|
81
24
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
25
|
+
static{
|
|
26
|
+
this.defaultProps = {
|
|
27
|
+
step: 1,
|
|
28
|
+
formatValue: (val)=>val,
|
|
29
|
+
max: 0,
|
|
30
|
+
min: 0,
|
|
31
|
+
inline: false,
|
|
32
|
+
size: 'medium',
|
|
33
|
+
layout: 'stacked',
|
|
34
|
+
displayValue: true,
|
|
35
|
+
disabled: false,
|
|
36
|
+
readOnly: false
|
|
37
|
+
};
|
|
92
38
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
39
|
+
constructor(props){
|
|
40
|
+
super(props), this.ref = null, this._input = null, this._inputListener = null, this._changeListener = null, this.handleRef = (el)=>{
|
|
41
|
+
this.ref = el;
|
|
42
|
+
}, this.handleInputRef = (el)=>{
|
|
43
|
+
this._input = el;
|
|
44
|
+
if (typeof this.props.inputRef === 'function') {
|
|
45
|
+
this.props.inputRef(el);
|
|
46
|
+
}
|
|
47
|
+
}, this.handleChange = (event)=>{
|
|
48
|
+
const { onChange, value } = this.props;
|
|
49
|
+
if (typeof value === 'undefined') {
|
|
50
|
+
this.setState({
|
|
51
|
+
value: event.target.value
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (typeof onChange === 'function') {
|
|
55
|
+
onChange(event.target.value);
|
|
56
|
+
}
|
|
57
|
+
}, this.noopChange = ()=>{};
|
|
58
|
+
if (typeof props.value === 'undefined') {
|
|
59
|
+
this.state = {
|
|
60
|
+
value: props.defaultValue
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
this.defaultId = props.deterministicId();
|
|
97
64
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.props.makeStyles?.();
|
|
105
|
-
}
|
|
106
|
-
handleChange = event => {
|
|
107
|
-
const {
|
|
108
|
-
onChange,
|
|
109
|
-
value
|
|
110
|
-
} = this.props;
|
|
111
|
-
if (typeof value === 'undefined') {
|
|
112
|
-
this.setState({
|
|
113
|
-
value: event.target.value
|
|
114
|
-
});
|
|
65
|
+
componentDidMount() {
|
|
66
|
+
this.props.makeStyles?.();
|
|
67
|
+
if (this._input !== null) {
|
|
68
|
+
this._inputListener = addEventListener(this._input, 'input', this.handleChange);
|
|
69
|
+
this._changeListener = addEventListener(this._input, 'change', this.handleChange);
|
|
70
|
+
}
|
|
115
71
|
}
|
|
116
|
-
|
|
117
|
-
|
|
72
|
+
componentWillUnmount() {
|
|
73
|
+
if (!this._input) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this._inputListener?.remove();
|
|
77
|
+
this._changeListener?.remove();
|
|
118
78
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
79
|
+
componentDidUpdate() {
|
|
80
|
+
this.props.makeStyles?.();
|
|
81
|
+
}
|
|
82
|
+
get value() {
|
|
83
|
+
const value = typeof this.props.value === 'undefined' ? this.state.value : this.props.value;
|
|
84
|
+
return typeof value === 'string' ? parseInt(value) : value;
|
|
85
|
+
}
|
|
86
|
+
get id() {
|
|
87
|
+
return this.props.id || this.defaultId;
|
|
88
|
+
}
|
|
89
|
+
renderValue() {
|
|
90
|
+
if (this.props.displayValue) {
|
|
91
|
+
if (!this.value) {
|
|
92
|
+
warn(false, 'RangeInput should have a `value` or `defaultValue` set for the value to be displayed. If no value has to be displayed, set `displayValue={false}`.');
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
const props = {
|
|
96
|
+
[RangeInput.outputLocatorAttribute]: this.id
|
|
97
|
+
};
|
|
98
|
+
return /*#__PURE__*/ _jsx(ContextView, {
|
|
99
|
+
background: "inverse",
|
|
100
|
+
placement: "end center",
|
|
101
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
102
|
+
...props,
|
|
103
|
+
css: this.props.styles?.rangeInputInputValue,
|
|
104
|
+
children: this.props.formatValue(this.value, this.props.max)
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
}
|
|
134
108
|
return null;
|
|
135
|
-
}
|
|
136
|
-
const props = {
|
|
137
|
-
[RangeInput.outputLocatorAttribute]: this.id
|
|
138
|
-
};
|
|
139
|
-
return _jsx(ContextView, {
|
|
140
|
-
background: "inverse",
|
|
141
|
-
placement: "end center",
|
|
142
|
-
children: _jsx("div", {
|
|
143
|
-
...props,
|
|
144
|
-
css: this.props.styles?.rangeInputInputValue,
|
|
145
|
-
children: this.props.formatValue(this.value, this.props.max)
|
|
146
|
-
})
|
|
147
|
-
});
|
|
148
109
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
110
|
+
render() {
|
|
111
|
+
const { formatValue, disabled, readOnly, messages } = this.props;
|
|
112
|
+
const props = omitProps(this.props, RangeInput.allowedProps);
|
|
113
|
+
const hasMessages = !!messages?.some((m)=>!!m.text);
|
|
114
|
+
const messagesId = `${this.id}-messages`;
|
|
115
|
+
const labelId = `${this.id}-label`;
|
|
116
|
+
return /*#__PURE__*/ _jsx(FormField, {
|
|
117
|
+
...pickProps(this.props, FormField.allowedProps),
|
|
118
|
+
label: this.props.label,
|
|
119
|
+
messagesId: messagesId,
|
|
120
|
+
labelId: labelId,
|
|
121
|
+
id: this.id,
|
|
122
|
+
elementRef: this.handleRef,
|
|
123
|
+
"data-cid": "RangeInput",
|
|
124
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
125
|
+
css: this.props.styles?.rangeInput,
|
|
126
|
+
children: [
|
|
127
|
+
/*#__PURE__*/ _jsx("input", {
|
|
128
|
+
css: this.props.styles?.rangeInputInput,
|
|
129
|
+
ref: this.handleInputRef,
|
|
130
|
+
type: "range",
|
|
131
|
+
id: this.id,
|
|
132
|
+
min: this.props.min,
|
|
133
|
+
max: this.props.max,
|
|
134
|
+
step: this.props.step,
|
|
135
|
+
value: this.value,
|
|
136
|
+
onChange: this.noopChange,
|
|
137
|
+
"aria-valuetext": formatValue(this.value, this.props.max),
|
|
138
|
+
...props,
|
|
139
|
+
disabled: disabled || readOnly,
|
|
140
|
+
"aria-disabled": disabled || readOnly ? 'true' : undefined,
|
|
141
|
+
"aria-describedby": [
|
|
142
|
+
props['aria-describedby'],
|
|
143
|
+
hasMessages ? messagesId : null
|
|
144
|
+
].filter(Boolean).join(' ') || undefined,
|
|
145
|
+
"aria-labelledby": hasMessages ? props['aria-labelledby'] || labelId : props['aria-labelledby']
|
|
146
|
+
}),
|
|
147
|
+
this.renderValue()
|
|
148
|
+
]
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
RangeInput = _ts_decorate([
|
|
154
|
+
withDeterministicId(),
|
|
155
|
+
withStyleNew(generateStyle)
|
|
156
|
+
], RangeInput);
|
|
195
157
|
export default RangeInput;
|
|
196
|
-
export { RangeInput };
|
|
158
|
+
export { RangeInput };
|
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const allowedProps = ['min', 'max', 'defaultValue', 'value', 'onChange', 'messages', 'size', 'layout', 'id', 'label', 'displayValue', 'step', 'formatValue', 'inline', 'disabled', 'readOnly', 'margin', 'inputRef'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'min',
|
|
3
|
+
'max',
|
|
4
|
+
'defaultValue',
|
|
5
|
+
'value',
|
|
6
|
+
'onChange',
|
|
7
|
+
'messages',
|
|
8
|
+
'size',
|
|
9
|
+
'layout',
|
|
10
|
+
'id',
|
|
11
|
+
'label',
|
|
12
|
+
'displayValue',
|
|
13
|
+
'step',
|
|
14
|
+
'formatValue',
|
|
15
|
+
'inline',
|
|
16
|
+
'disabled',
|
|
17
|
+
'readOnly',
|
|
18
|
+
'margin',
|
|
19
|
+
'inputRef'
|
|
20
|
+
];
|
|
21
|
+
export { allowedProps };
|
|
@@ -1,148 +1,107 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
1
|
import { boxShadowObjectsToCSSString } from '@instructure/ui-themes';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
'&::-moz-range-track': trackStyle,
|
|
131
|
-
'[dir="rtl"] &': {
|
|
132
|
-
direction: 'rtl'
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
rangeInputInputValue: {
|
|
136
|
-
label: 'rangeInput__value',
|
|
137
|
-
all: 'initial',
|
|
138
|
-
boxSizing: 'border-box',
|
|
139
|
-
display: 'block',
|
|
140
|
-
color: 'inherit',
|
|
141
|
-
fontFamily: componentTheme.valueFontFamily,
|
|
142
|
-
fontWeight: componentTheme.valueFontWeight,
|
|
143
|
-
textAlign: 'center',
|
|
144
|
-
...valueSizeVariants[size]
|
|
145
|
-
}
|
|
146
|
-
};
|
|
2
|
+
const generateStyle = (componentTheme, props, sharedTokens)=>{
|
|
3
|
+
const { size } = props;
|
|
4
|
+
const valueSizeVariants = {
|
|
5
|
+
small: {
|
|
6
|
+
fontSize: componentTheme.valueSmallFontSize,
|
|
7
|
+
paddingInline: componentTheme.valueSmallPadding,
|
|
8
|
+
lineHeight: componentTheme.valueSmallLineHeight
|
|
9
|
+
},
|
|
10
|
+
medium: {
|
|
11
|
+
fontSize: componentTheme.valueMediumFontSize,
|
|
12
|
+
paddingInline: componentTheme.valueMediumPadding,
|
|
13
|
+
lineHeight: componentTheme.valueMediumLineHeight
|
|
14
|
+
},
|
|
15
|
+
large: {
|
|
16
|
+
fontSize: componentTheme.valueLargeFontSize,
|
|
17
|
+
paddingInline: componentTheme.valueLargePadding,
|
|
18
|
+
lineHeight: componentTheme.valueLargeLineHeight
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const trackBorderWidth = '1px';
|
|
22
|
+
const trackStyle = {
|
|
23
|
+
borderRadius: '0.312em',
|
|
24
|
+
borderWidth: trackBorderWidth,
|
|
25
|
+
borderStyle: 'solid',
|
|
26
|
+
borderColor: componentTheme.trackBorderColor,
|
|
27
|
+
color: 'transparent',
|
|
28
|
+
cursor: 'pointer',
|
|
29
|
+
background: componentTheme.trackBackground,
|
|
30
|
+
height: `calc(${componentTheme.handleSize} / 2)`
|
|
31
|
+
};
|
|
32
|
+
const borderedHandleSize = `calc(${componentTheme.handleSize} + (${componentTheme.handleBorderSize} * 2))`;
|
|
33
|
+
const thumbStyle = {
|
|
34
|
+
appearance: 'none',
|
|
35
|
+
borderRadius: '50%',
|
|
36
|
+
cursor: 'pointer',
|
|
37
|
+
transition: 'all 0.15s ease-in-out',
|
|
38
|
+
background: componentTheme.handleBackground,
|
|
39
|
+
width: borderedHandleSize,
|
|
40
|
+
height: borderedHandleSize,
|
|
41
|
+
borderWidth: componentTheme.handleBorderSize,
|
|
42
|
+
borderColor: componentTheme.handleBorderColor,
|
|
43
|
+
borderStyle: 'solid',
|
|
44
|
+
boxSizing: 'border-box',
|
|
45
|
+
boxShadow: boxShadowObjectsToCSSString(componentTheme.boxShadow),
|
|
46
|
+
'&:hover': {
|
|
47
|
+
background: componentTheme.handleHoverBackground
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const thumbPosition = {
|
|
51
|
+
marginTop: `calc(-1 * ${borderedHandleSize} / 4 - ${trackBorderWidth})`
|
|
52
|
+
};
|
|
53
|
+
const thumbFocusActiveStyle = {
|
|
54
|
+
background: componentTheme.handleFocusBackground,
|
|
55
|
+
boxShadow: `${boxShadowObjectsToCSSString(componentTheme.boxShadow)}, ` + `inset 0 0 0 ${componentTheme.handleFocusInset} ${componentTheme.handleFocusBackground}, ` + `inset 0 0 0 calc(${componentTheme.handleFocusInset} + ${sharedTokens.focusOutline.width}) ${sharedTokens.focusOutline.onColor}`
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
rangeInput: {
|
|
59
|
+
label: 'rangeInput',
|
|
60
|
+
display: 'flex',
|
|
61
|
+
justifyContent: 'center',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
minWidth: componentTheme.minWidth
|
|
64
|
+
},
|
|
65
|
+
rangeInputInput: {
|
|
66
|
+
label: 'rangeInput__input',
|
|
67
|
+
all: 'initial',
|
|
68
|
+
flex: 'auto',
|
|
69
|
+
boxSizing: 'border-box',
|
|
70
|
+
appearance: 'none',
|
|
71
|
+
width: '100%',
|
|
72
|
+
outline: 'none',
|
|
73
|
+
margin: 0,
|
|
74
|
+
'&::-webkit-slider-thumb': {
|
|
75
|
+
...thumbStyle,
|
|
76
|
+
...thumbPosition
|
|
77
|
+
},
|
|
78
|
+
'&::-moz-range-thumb': thumbStyle,
|
|
79
|
+
'&:focus, &:active': {
|
|
80
|
+
outline: 'none',
|
|
81
|
+
'&::-webkit-slider-thumb': thumbFocusActiveStyle,
|
|
82
|
+
'&::-moz-range-thumb': thumbFocusActiveStyle
|
|
83
|
+
},
|
|
84
|
+
'&::-moz-focus-inner, &::-moz-focus-outer': {
|
|
85
|
+
border: 0,
|
|
86
|
+
outline: 'none'
|
|
87
|
+
},
|
|
88
|
+
'&::-webkit-slider-runnable-track': trackStyle,
|
|
89
|
+
'&::-moz-range-track': trackStyle,
|
|
90
|
+
'[dir="rtl"] &': {
|
|
91
|
+
direction: 'rtl'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
rangeInputInputValue: {
|
|
95
|
+
label: 'rangeInput__value',
|
|
96
|
+
all: 'initial',
|
|
97
|
+
boxSizing: 'border-box',
|
|
98
|
+
display: 'block',
|
|
99
|
+
color: 'inherit',
|
|
100
|
+
fontFamily: componentTheme.valueFontFamily,
|
|
101
|
+
fontWeight: componentTheme.valueFontWeight,
|
|
102
|
+
textAlign: 'center',
|
|
103
|
+
...valueSizeVariants[size]
|
|
104
|
+
}
|
|
105
|
+
};
|
|
147
106
|
};
|
|
148
|
-
export default generateStyle;
|
|
107
|
+
export default generateStyle;
|