@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,163 +1,124 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
boxSizing: 'border-box',
|
|
124
|
-
appearance: 'none',
|
|
125
|
-
width: '100%',
|
|
126
|
-
// for Firefox
|
|
127
|
-
outline: 'none',
|
|
128
|
-
margin: 0,
|
|
129
|
-
'&::-webkit-slider-thumb': {
|
|
130
|
-
...thumbStyle,
|
|
131
|
-
...thumbPosition[thumbVariant]
|
|
132
|
-
},
|
|
133
|
-
'&::-moz-range-thumb': thumbStyle,
|
|
134
|
-
'&:focus, &:active': {
|
|
135
|
-
outline: 'none',
|
|
136
|
-
'&::-webkit-slider-thumb': thumbFocusActiveStyle[thumbVariant],
|
|
137
|
-
'&::-moz-range-thumb': thumbFocusActiveStyle[thumbVariant]
|
|
138
|
-
},
|
|
139
|
-
// remove outline in FF
|
|
140
|
-
'&::-moz-focus-inner, &::-moz-focus-outer': {
|
|
141
|
-
border: 0,
|
|
142
|
-
outline: 'none'
|
|
143
|
-
},
|
|
144
|
-
'&::-webkit-slider-runnable-track': trackStyle,
|
|
145
|
-
'&::-moz-range-track': trackStyle,
|
|
146
|
-
'[dir="rtl"] &': {
|
|
147
|
-
direction: 'rtl'
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
rangeInputInputValue: {
|
|
151
|
-
label: 'rangeInput__value',
|
|
152
|
-
all: 'initial',
|
|
153
|
-
boxSizing: 'border-box',
|
|
154
|
-
display: 'block',
|
|
155
|
-
color: 'inherit',
|
|
156
|
-
fontFamily: componentTheme.valueFontFamily,
|
|
157
|
-
fontWeight: componentTheme.valueFontWeight,
|
|
158
|
-
textAlign: 'center',
|
|
159
|
-
...valueSizeVariants[size]
|
|
160
|
-
}
|
|
161
|
-
};
|
|
1
|
+
const generateStyle = (componentTheme, props)=>{
|
|
2
|
+
const { size, thumbVariant } = props;
|
|
3
|
+
const valueSizeVariants = {
|
|
4
|
+
small: {
|
|
5
|
+
fontSize: componentTheme.valueSmallFontSize,
|
|
6
|
+
padding: componentTheme.valueSmallPadding,
|
|
7
|
+
lineHeight: componentTheme.valueSmallLineHeight
|
|
8
|
+
},
|
|
9
|
+
medium: {
|
|
10
|
+
fontSize: componentTheme.valueMediumFontSize,
|
|
11
|
+
padding: componentTheme.valueMediumPadding,
|
|
12
|
+
lineHeight: componentTheme.valueMediumLineHeight
|
|
13
|
+
},
|
|
14
|
+
large: {
|
|
15
|
+
fontSize: componentTheme.valueLargeFontSize,
|
|
16
|
+
padding: componentTheme.valueLargePadding,
|
|
17
|
+
lineHeight: componentTheme.valueLargeLineHeight
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const trackStyle = {
|
|
21
|
+
borderRadius: '0.312em',
|
|
22
|
+
borderColor: 'transparent',
|
|
23
|
+
color: 'transparent',
|
|
24
|
+
cursor: 'pointer',
|
|
25
|
+
background: componentTheme.trackBackground,
|
|
26
|
+
height: `calc(${componentTheme.handleSize} / 2)`
|
|
27
|
+
};
|
|
28
|
+
const borderedHandleSize = `calc(${componentTheme.handleSize} + (${componentTheme.handleBorderSize} * 2))`;
|
|
29
|
+
const thumbVariantStyle = {
|
|
30
|
+
deprecated: {
|
|
31
|
+
width: componentTheme.handleSize,
|
|
32
|
+
height: componentTheme.handleSize,
|
|
33
|
+
boxShadow: `0 0.0625rem 0 ${componentTheme.handleShadowColor}`
|
|
34
|
+
},
|
|
35
|
+
accessible: {
|
|
36
|
+
width: borderedHandleSize,
|
|
37
|
+
height: borderedHandleSize,
|
|
38
|
+
borderWidth: componentTheme.handleBorderSize,
|
|
39
|
+
borderColor: componentTheme.handleBorderColor,
|
|
40
|
+
borderStyle: 'solid',
|
|
41
|
+
boxSizing: 'border-box',
|
|
42
|
+
boxShadow: componentTheme.handleShadow
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const thumbStyle = {
|
|
46
|
+
appearance: 'none',
|
|
47
|
+
borderRadius: '50%',
|
|
48
|
+
cursor: 'pointer',
|
|
49
|
+
transition: 'all 0.15s ease-in-out',
|
|
50
|
+
background: componentTheme.handleBackground,
|
|
51
|
+
...thumbVariantStyle[thumbVariant],
|
|
52
|
+
'&:hover': {
|
|
53
|
+
background: componentTheme.handleHoverBackground
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const thumbPosition = {
|
|
57
|
+
deprecated: {
|
|
58
|
+
marginTop: `calc(-1 * ${componentTheme.handleSize} / 4)`
|
|
59
|
+
},
|
|
60
|
+
accessible: {
|
|
61
|
+
marginTop: `calc(-1 * ${borderedHandleSize} / 4)`
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const thumbFocusActiveStyle = {
|
|
65
|
+
deprecated: {
|
|
66
|
+
background: componentTheme.handleFocusBackground,
|
|
67
|
+
boxShadow: `0 0.0625rem 0 ${componentTheme.handleShadowColor}, 0 0 0 ${componentTheme.handleFocusOutlineWidth} ${componentTheme.handleFocusOutlineColor}`
|
|
68
|
+
},
|
|
69
|
+
accessible: {
|
|
70
|
+
background: componentTheme.handleFocusBackground,
|
|
71
|
+
boxShadow: componentTheme.handleShadow + ', ' + `inset 0 0 0 ${componentTheme.handleFocusInset} ${componentTheme.handleFocusBackground}, ` + `inset 0 0 0 calc(${componentTheme.handleFocusInset} + ${componentTheme.handleFocusRingSize}) ${componentTheme.handleFocusRingColor}`
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
rangeInput: {
|
|
76
|
+
label: 'rangeInput',
|
|
77
|
+
display: 'flex',
|
|
78
|
+
justifyContent: 'center',
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
minWidth: componentTheme.minWidth
|
|
81
|
+
},
|
|
82
|
+
rangeInputInput: {
|
|
83
|
+
label: 'rangeInput__input',
|
|
84
|
+
all: 'initial',
|
|
85
|
+
flex: 'auto',
|
|
86
|
+
boxSizing: 'border-box',
|
|
87
|
+
appearance: 'none',
|
|
88
|
+
width: '100%',
|
|
89
|
+
outline: 'none',
|
|
90
|
+
margin: 0,
|
|
91
|
+
'&::-webkit-slider-thumb': {
|
|
92
|
+
...thumbStyle,
|
|
93
|
+
...thumbPosition[thumbVariant]
|
|
94
|
+
},
|
|
95
|
+
'&::-moz-range-thumb': thumbStyle,
|
|
96
|
+
'&:focus, &:active': {
|
|
97
|
+
outline: 'none',
|
|
98
|
+
'&::-webkit-slider-thumb': thumbFocusActiveStyle[thumbVariant],
|
|
99
|
+
'&::-moz-range-thumb': thumbFocusActiveStyle[thumbVariant]
|
|
100
|
+
},
|
|
101
|
+
'&::-moz-focus-inner, &::-moz-focus-outer': {
|
|
102
|
+
border: 0,
|
|
103
|
+
outline: 'none'
|
|
104
|
+
},
|
|
105
|
+
'&::-webkit-slider-runnable-track': trackStyle,
|
|
106
|
+
'&::-moz-range-track': trackStyle,
|
|
107
|
+
'[dir="rtl"] &': {
|
|
108
|
+
direction: 'rtl'
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
rangeInputInputValue: {
|
|
112
|
+
label: 'rangeInput__value',
|
|
113
|
+
all: 'initial',
|
|
114
|
+
boxSizing: 'border-box',
|
|
115
|
+
display: 'block',
|
|
116
|
+
color: 'inherit',
|
|
117
|
+
fontFamily: componentTheme.valueFontFamily,
|
|
118
|
+
fontWeight: componentTheme.valueFontWeight,
|
|
119
|
+
textAlign: 'center',
|
|
120
|
+
...valueSizeVariants[size]
|
|
121
|
+
}
|
|
122
|
+
};
|
|
162
123
|
};
|
|
163
|
-
export default generateStyle;
|
|
124
|
+
export default generateStyle;
|
|
@@ -1,85 +1,47 @@
|
|
|
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 { alpha, darken } from '@instructure/ui-color-utils';
|
|
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
|
-
valueSmallFontSize: typography?.fontSizeSmall,
|
|
71
|
-
valueSmallPadding: `0 ${spacing?.xSmall}`,
|
|
72
|
-
valueSmallLineHeight: forms?.inputHeightSmall,
|
|
73
|
-
valueMediumFontSize: typography?.fontSizeMedium,
|
|
74
|
-
valueMediumPadding: `0 ${spacing?.small}`,
|
|
75
|
-
valueMediumLineHeight: forms?.inputHeightMedium,
|
|
76
|
-
valueLargeFontSize: typography?.fontSizeLarge,
|
|
77
|
-
valueLargePadding: `0 ${spacing?.medium}`,
|
|
78
|
-
valueLargeLineHeight: forms?.inputHeightLarge
|
|
79
|
-
};
|
|
80
|
-
return {
|
|
81
|
-
...componentVariables,
|
|
82
|
-
...themeSpecificStyle[themeName]
|
|
83
|
-
};
|
|
2
|
+
const generateComponentTheme = (theme)=>{
|
|
3
|
+
const { colors, borders, typography, spacing, forms, key: themeName } = theme;
|
|
4
|
+
const themeSpecificStyle = {
|
|
5
|
+
canvas: {
|
|
6
|
+
handleBackground: theme['ic-brand-primary'],
|
|
7
|
+
handleHoverBackground: theme['ic-brand-primary'],
|
|
8
|
+
handleFocusBackground: theme['ic-brand-primary'],
|
|
9
|
+
handleShadowColor: darken(theme['ic-brand-primary'], 15),
|
|
10
|
+
handleFocusOutlineColor: alpha(theme['ic-brand-primary'], 40)
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const componentVariables = {
|
|
14
|
+
minWidth: '12.5rem',
|
|
15
|
+
handleSize: '1.5rem',
|
|
16
|
+
handleBackground: colors?.contrasts?.blue4570,
|
|
17
|
+
handleBorderColor: colors?.contrasts?.white1010,
|
|
18
|
+
handleBorderSize: borders?.widthMedium,
|
|
19
|
+
handleShadow: '0 0.0625rem 0.125rem rgba(0, 0, 0, .2), 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.1)',
|
|
20
|
+
handleFocusInset: borders?.widthSmall,
|
|
21
|
+
handleFocusRingSize: borders?.widthMedium,
|
|
22
|
+
handleFocusRingColor: colors?.contrasts?.white1010,
|
|
23
|
+
handleFocusBackground: colors?.contrasts?.blue4570,
|
|
24
|
+
handleHoverBackground: colors?.contrasts?.blue4570,
|
|
25
|
+
handleShadowColor: darken(colors?.contrasts?.blue5782, 10),
|
|
26
|
+
handleFocusOutlineColor: alpha(colors?.contrasts?.blue4570, 40),
|
|
27
|
+
handleFocusOutlineWidth: '0.75em',
|
|
28
|
+
trackBackground: colors?.contrasts?.grey4570,
|
|
29
|
+
valueColor: colors?.contrasts?.white1010,
|
|
30
|
+
valueFontFamily: typography?.fontFamily,
|
|
31
|
+
valueFontWeight: typography?.fontWeightNormal,
|
|
32
|
+
valueSmallFontSize: typography?.fontSizeSmall,
|
|
33
|
+
valueSmallPadding: `0 ${spacing?.xSmall}`,
|
|
34
|
+
valueSmallLineHeight: forms?.inputHeightSmall,
|
|
35
|
+
valueMediumFontSize: typography?.fontSizeMedium,
|
|
36
|
+
valueMediumPadding: `0 ${spacing?.small}`,
|
|
37
|
+
valueMediumLineHeight: forms?.inputHeightMedium,
|
|
38
|
+
valueLargeFontSize: typography?.fontSizeLarge,
|
|
39
|
+
valueLargePadding: `0 ${spacing?.medium}`,
|
|
40
|
+
valueLargeLineHeight: forms?.inputHeightLarge
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
...componentVariables,
|
|
44
|
+
...themeSpecificStyle[themeName]
|
|
45
|
+
};
|
|
84
46
|
};
|
|
85
|
-
export default generateComponentTheme;
|
|
47
|
+
export default generateComponentTheme;
|