@atlaskit/range 5.0.9 → 5.1.1
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 +32 -0
- package/build/tsconfig.json +10 -3
- package/dist/cjs/styled.js +10 -8
- package/dist/cjs/theme.js +10 -14
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/styled.js +9 -7
- package/dist/es2019/theme.js +10 -14
- package/dist/es2019/version.json +1 -1
- package/dist/esm/styled.js +9 -7
- package/dist/esm/theme.js +10 -14
- package/dist/esm/version.json +1 -1
- package/dist/types/theme.d.ts +11 -14
- package/docs/0-intro.tsx +8 -61
- package/package.json +15 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @atlaskit/range
|
|
2
2
|
|
|
3
|
+
## 5.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f460cc7c411`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f460cc7c411) - Builds for this package now pass through a tokens babel plugin, removing runtime invocations of the tokens() function and improving bundle size.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 5.1.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`21c178539a2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/21c178539a2) - [ux] Instrumented range with the new theming package, `@atlaskit/tokens`.
|
|
15
|
+
|
|
16
|
+
New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).
|
|
17
|
+
These changes are intended to be interoperable with the legacy theme implementation. Legacy dark mode users should expect no visual or breaking changes.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
23
|
+
## 5.0.11
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
29
|
+
## 5.0.10
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- [`378d1cef00f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/378d1cef00f) - Bump `@atlaskit/theme` to version `^11.3.0`.
|
|
34
|
+
|
|
3
35
|
## 5.0.9
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
package/build/tsconfig.json
CHANGED
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
"target": "es5",
|
|
6
6
|
"paths": {}
|
|
7
7
|
},
|
|
8
|
-
"include": [
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
"include": [
|
|
9
|
+
"../src/**/*.ts",
|
|
10
|
+
"../src/**/*.tsx"
|
|
11
|
+
],
|
|
12
|
+
"exclude": [
|
|
13
|
+
"../src/**/__tests__/*",
|
|
14
|
+
"../src/**/*.test.*",
|
|
15
|
+
"../src/**/test.*"
|
|
16
|
+
]
|
|
17
|
+
}
|
package/dist/cjs/styled.js
CHANGED
|
@@ -17,9 +17,9 @@ var _react = require("react");
|
|
|
17
17
|
|
|
18
18
|
var _core = require("@emotion/core");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
23
23
|
|
|
24
24
|
var _templateObject;
|
|
25
25
|
|
|
@@ -35,27 +35,28 @@ var getBackgroundGradient = function getBackgroundGradient(_ref) {
|
|
|
35
35
|
var lower = _ref.lower,
|
|
36
36
|
upper = _ref.upper;
|
|
37
37
|
return "\n background: linear-gradient(".concat(lower, ", ").concat(lower, ") 0 / var(--range-inline-width) 100%\n no-repeat ").concat(upper, ";\n [dir='rtl'] & {\n background-position: right;\n }\n ");
|
|
38
|
-
};
|
|
38
|
+
};
|
|
39
39
|
|
|
40
|
+
var elevationStyle = "var(--ds-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N50A, ", 0 0 1px ").concat(_colors.N60A), ")"); // Thumb style
|
|
40
41
|
|
|
41
42
|
var sliderThumbStyle = function sliderThumbStyle(_ref2) {
|
|
42
43
|
var thumb = _ref2.thumb;
|
|
43
|
-
return "\n background: ".concat(thumb.default.background, ";\n border: ").concat(sliderThumbBorderThickness, "px solid transparent;\n border-radius: 50%;\n height: ").concat(sliderThumbSize, "px;\n width: ").concat(sliderThumbSize, "px;\n box-sizing: border-box;\n transition: border-color ").concat(transitionDuration, " ease-in-out;\n ").concat(
|
|
44
|
+
return "\n background: ".concat(thumb.default.background, ";\n border: ").concat(sliderThumbBorderThickness, "px solid transparent;\n border-radius: 50%;\n height: ").concat(sliderThumbSize, "px;\n width: ").concat(sliderThumbSize, "px;\n box-sizing: border-box;\n transition: border-color ").concat(transitionDuration, " ease-in-out;\n box-shadow: ").concat(elevationStyle, "\n ");
|
|
44
45
|
}; // Track styles
|
|
45
46
|
|
|
46
47
|
|
|
47
48
|
var sliderTrackStyle = "\n border-radius: ".concat(sliderBorderRadius, "px;\n border: 0;\n cursor: pointer;\n height: ").concat(sliderLineThickness, "px;\n width: 100%;\n transition: background-color ").concat(transitionDuration, " ease-in-out;\n"); // Range input styles
|
|
48
49
|
|
|
49
50
|
var chromeRangeInputStyle = function chromeRangeInputStyle(tokens) {
|
|
50
|
-
return "\n &::-webkit-slider-thumb {\n -webkit-appearance: none;\n margin-top: -".concat((sliderThumbSize - sliderLineThickness) / 2, "px;\n ").concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-webkit-slider-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-webkit-slider-thumb {\n cursor: not-allowed;\n box-shadow:
|
|
51
|
+
return "\n &::-webkit-slider-thumb {\n -webkit-appearance: none;\n margin-top: -".concat((sliderThumbSize - sliderLineThickness) / 2, "px;\n ").concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-webkit-slider-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-webkit-slider-thumb {\n cursor: not-allowed;\n box-shadow: ").concat(tokens.thumb.disabled.boxShadow, ";\n }\n\n &::-webkit-slider-runnable-track {\n ").concat(sliderTrackStyle, ";\n ").concat(getBackgroundGradient(tokens.track.default), ";\n }\n\n &:focus::-webkit-slider-runnable-track {\n ").concat(getBackgroundGradient(tokens.track.default), ";\n }\n\n &:active::-webkit-slider-runnable-track,\n &:hover::-webkit-slider-runnable-track {\n ").concat(getBackgroundGradient(tokens.track.hover), ";\n }\n\n &:disabled::-webkit-slider-runnable-track {\n ").concat(getBackgroundGradient(tokens.track.disabled), "\n cursor: not-allowed;\n }\n ");
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
var firefoxRangeInputStyle = function firefoxRangeInputStyle(tokens) {
|
|
54
|
-
return "\n &::-moz-focus-outer {\n border: 0;\n }\n\n &::-moz-range-thumb {\n ".concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-moz-range-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-moz-range-thumb {\n cursor: not-allowed;\n box-shadow:
|
|
55
|
+
return "\n &::-moz-focus-outer {\n border: 0;\n }\n\n &::-moz-range-thumb {\n ".concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-moz-range-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-moz-range-thumb {\n cursor: not-allowed;\n box-shadow: ").concat(tokens.thumb.disabled.boxShadow, ";\n }\n\n &::-moz-range-progress {\n ").concat(sliderTrackStyle, ";\n background: ").concat(tokens.track.default.lower, ";\n }\n\n &::-moz-range-track {\n ").concat(sliderTrackStyle, ";\n background: ").concat(tokens.track.default.upper, ";\n }\n\n &:active::-moz-range-progress,\n &:hover::-moz-range-progress {\n background: ").concat(tokens.track.hover.lower, ";\n }\n\n &:active::-moz-range-track,\n &:hover::-moz-range-track {\n background: ").concat(tokens.track.hover.upper, ";\n }\n\n &:disabled::-moz-range-progress {\n background: ").concat(tokens.track.disabled.lower, ";\n cursor: not-allowed;\n }\n\n &:disabled::-moz-range-track {\n background: ").concat(tokens.track.disabled.upper, ";\n cursor: not-allowed;\n }\n");
|
|
55
56
|
};
|
|
56
57
|
|
|
57
58
|
var IERangeInputStyle = function IERangeInputStyle(tokens) {
|
|
58
|
-
return "\n &::-ms-thumb {\n margin-top: 0;\n ".concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-ms-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-ms-thumb {\n cursor: not-allowed;\n box-shadow:
|
|
59
|
+
return "\n &::-ms-thumb {\n margin-top: 0;\n ".concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-ms-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-ms-thumb {\n cursor: not-allowed;\n box-shadow: ").concat(tokens.thumb.disabled.boxShadow, ";\n }\n\n &::-ms-track {\n background: transparent;\n border-color: transparent;\n color: transparent;\n cursor: pointer;\n height: ").concat(sliderLineThickness, "px;\n transition: background-color ").concat(transitionDuration, " ease-in-out;\n width: 100%;\n }\n\n &::-ms-fill-lower {\n background: ").concat(tokens.track.default.lower, ";\n border-radius: ").concat(sliderBorderRadius, "px;\n border: 0;\n }\n\n &::-ms-fill-upper {\n background: ").concat(tokens.track.default.upper, ";\n border-radius: ").concat(sliderBorderRadius, "px;\n border: 0;\n }\n\n &:active::-ms-fill-lower,\n &:hover::-ms-fill-lower {\n background: ").concat(tokens.track.hover.lower, ";\n }\n\n &:active::-ms-fill-upper,\n &:hover::-ms-fill-upper {\n background: ").concat(tokens.track.hover.upper, ";\n }\n\n &:disabled::-ms-fill-lower {\n background: ").concat(tokens.track.disabled.lower, ";\n cursor: not-allowed;\n }\n\n &:disabled::-ms-fill-upper {\n background: ").concat(tokens.track.disabled.upper, ";\n cursor: not-allowed;\n }\n");
|
|
59
60
|
}; // Styles are split per browser as they are implemented differently
|
|
60
61
|
// Cannot consolidate as Chrome & Firefox don't recognise styles if they are grouped
|
|
61
62
|
// with CSS selectors they don't recognise, e.g. &::-ms-thumb
|
|
@@ -86,7 +87,8 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
86
87
|
style: {
|
|
87
88
|
'--range-inline-width': "".concat(valuePercent, "%")
|
|
88
89
|
},
|
|
89
|
-
ref: ref
|
|
90
|
+
ref: ref // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
91
|
+
,
|
|
90
92
|
css: styles
|
|
91
93
|
}));
|
|
92
94
|
});
|
package/dist/cjs/theme.js
CHANGED
|
@@ -17,33 +17,29 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
17
17
|
|
|
18
18
|
var thumb = {
|
|
19
19
|
default: {
|
|
20
|
-
background: colors.N0,
|
|
21
|
-
// This border color is not being used - awaiting focus state lift to props
|
|
22
|
-
border: colors.N800
|
|
20
|
+
background: "var(--ds-background-card, ".concat(colors.N0, ")")
|
|
23
21
|
},
|
|
24
22
|
disabled: {
|
|
25
|
-
boxShadow: colors.N60A
|
|
23
|
+
boxShadow: "var(--ds-card, ".concat("0 0 1px ".concat(colors.N60A), ")")
|
|
26
24
|
},
|
|
27
25
|
focus: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
border: colors.B200
|
|
26
|
+
background: "var(--ds-background-boldNeutral-resting, ".concat(colors.N0, ")"),
|
|
27
|
+
border: "var(--ds-border-focus, ".concat(colors.B200, ")")
|
|
31
28
|
}
|
|
32
29
|
};
|
|
33
30
|
exports.thumb = thumb;
|
|
34
31
|
var track = {
|
|
35
|
-
background: colors.N30A,
|
|
36
32
|
default: {
|
|
37
|
-
lower: colors.B400,
|
|
38
|
-
upper: colors.N30
|
|
33
|
+
lower: "var(--ds-background-boldBrand-resting, ".concat(colors.B400, ")"),
|
|
34
|
+
upper: "var(--ds-background-subtleNeutral-resting, ".concat(colors.N30, ")")
|
|
39
35
|
},
|
|
40
36
|
disabled: {
|
|
41
|
-
lower: colors.N50,
|
|
42
|
-
upper: colors.N30
|
|
37
|
+
lower: "var(--ds-text-disabled, ".concat(colors.N50, ")"),
|
|
38
|
+
upper: "var(--ds-background-disabled, ".concat(colors.N30, ")")
|
|
43
39
|
},
|
|
44
40
|
hover: {
|
|
45
|
-
lower: colors.B300,
|
|
46
|
-
upper: colors.N40
|
|
41
|
+
lower: "var(--ds-background-boldBrand-hover, ".concat(colors.B300, ")"),
|
|
42
|
+
upper: "var(--ds-background-subtleNeutral-hover, ".concat(colors.N40, ")")
|
|
47
43
|
}
|
|
48
44
|
};
|
|
49
45
|
exports.track = track;
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/styled.js
CHANGED
|
@@ -5,8 +5,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
5
5
|
/* eslint-disable no-mixed-operators */
|
|
6
6
|
import { forwardRef, useMemo } from 'react';
|
|
7
7
|
import { css, jsx } from '@emotion/core';
|
|
8
|
+
import { N50A, N60A } from '@atlaskit/theme/colors';
|
|
8
9
|
import { fontFamily } from '@atlaskit/theme/constants';
|
|
9
|
-
import { e200 } from '@atlaskit/theme/elevation';
|
|
10
10
|
const sliderThumbSize = 16;
|
|
11
11
|
const sliderThumbBorderThickness = 2;
|
|
12
12
|
const sliderLineThickness = 4;
|
|
@@ -23,8 +23,9 @@ const getBackgroundGradient = ({
|
|
|
23
23
|
[dir='rtl'] & {
|
|
24
24
|
background-position: right;
|
|
25
25
|
}
|
|
26
|
-
`;
|
|
26
|
+
`;
|
|
27
27
|
|
|
28
|
+
const elevationStyle = `var(--ds-overlay, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})`; // Thumb style
|
|
28
29
|
|
|
29
30
|
const sliderThumbStyle = ({
|
|
30
31
|
thumb
|
|
@@ -37,7 +38,7 @@ const sliderThumbStyle = ({
|
|
|
37
38
|
width: ${sliderThumbSize}px;
|
|
38
39
|
box-sizing: border-box;
|
|
39
40
|
transition: border-color ${transitionDuration} ease-in-out;
|
|
40
|
-
${
|
|
41
|
+
box-shadow: ${elevationStyle}
|
|
41
42
|
`;
|
|
42
43
|
}; // Track styles
|
|
43
44
|
|
|
@@ -65,7 +66,7 @@ const chromeRangeInputStyle = tokens => {
|
|
|
65
66
|
|
|
66
67
|
&:disabled::-webkit-slider-thumb {
|
|
67
68
|
cursor: not-allowed;
|
|
68
|
-
box-shadow:
|
|
69
|
+
box-shadow: ${tokens.thumb.disabled.boxShadow};
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
&::-webkit-slider-runnable-track {
|
|
@@ -105,7 +106,7 @@ const firefoxRangeInputStyle = tokens => {
|
|
|
105
106
|
|
|
106
107
|
&:disabled::-moz-range-thumb {
|
|
107
108
|
cursor: not-allowed;
|
|
108
|
-
box-shadow:
|
|
109
|
+
box-shadow: ${tokens.thumb.disabled.boxShadow};
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
&::-moz-range-progress {
|
|
@@ -153,7 +154,7 @@ const IERangeInputStyle = tokens => {
|
|
|
153
154
|
|
|
154
155
|
&:disabled::-ms-thumb {
|
|
155
156
|
cursor: not-allowed;
|
|
156
|
-
box-shadow:
|
|
157
|
+
box-shadow: ${tokens.thumb.disabled.boxShadow};
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
&::-ms-track {
|
|
@@ -248,7 +249,8 @@ export const Input = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
248
249
|
style: {
|
|
249
250
|
'--range-inline-width': `${valuePercent}%`
|
|
250
251
|
},
|
|
251
|
-
ref: ref
|
|
252
|
+
ref: ref // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
253
|
+
,
|
|
252
254
|
css: styles
|
|
253
255
|
}));
|
|
254
256
|
});
|
package/dist/es2019/theme.js
CHANGED
|
@@ -2,32 +2,28 @@ import * as colors from '@atlaskit/theme/colors';
|
|
|
2
2
|
import { createTheme } from '@atlaskit/theme/components';
|
|
3
3
|
export const thumb = {
|
|
4
4
|
default: {
|
|
5
|
-
background: colors.N0
|
|
6
|
-
// This border color is not being used - awaiting focus state lift to props
|
|
7
|
-
border: colors.N800
|
|
5
|
+
background: `var(--ds-background-card, ${colors.N0})`
|
|
8
6
|
},
|
|
9
7
|
disabled: {
|
|
10
|
-
boxShadow: colors.N60A
|
|
8
|
+
boxShadow: `var(--ds-card, ${`0 0 1px ${colors.N60A}`})`
|
|
11
9
|
},
|
|
12
10
|
focus: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
border: colors.B200
|
|
11
|
+
background: `var(--ds-background-boldNeutral-resting, ${colors.N0})`,
|
|
12
|
+
border: `var(--ds-border-focus, ${colors.B200})`
|
|
16
13
|
}
|
|
17
14
|
};
|
|
18
15
|
export const track = {
|
|
19
|
-
background: colors.N30A,
|
|
20
16
|
default: {
|
|
21
|
-
lower: colors.B400
|
|
22
|
-
upper: colors.N30
|
|
17
|
+
lower: `var(--ds-background-boldBrand-resting, ${colors.B400})`,
|
|
18
|
+
upper: `var(--ds-background-subtleNeutral-resting, ${colors.N30})`
|
|
23
19
|
},
|
|
24
20
|
disabled: {
|
|
25
|
-
lower: colors.N50
|
|
26
|
-
upper: colors.N30
|
|
21
|
+
lower: `var(--ds-text-disabled, ${colors.N50})`,
|
|
22
|
+
upper: `var(--ds-background-disabled, ${colors.N30})`
|
|
27
23
|
},
|
|
28
24
|
hover: {
|
|
29
|
-
lower: colors.B300
|
|
30
|
-
upper: colors.N40
|
|
25
|
+
lower: `var(--ds-background-boldBrand-hover, ${colors.B300})`,
|
|
26
|
+
upper: `var(--ds-background-subtleNeutral-hover, ${colors.N40})`
|
|
31
27
|
}
|
|
32
28
|
};
|
|
33
29
|
export const Theme = createTheme(() => ({
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/styled.js
CHANGED
|
@@ -9,8 +9,8 @@ var _templateObject;
|
|
|
9
9
|
/* eslint-disable no-mixed-operators */
|
|
10
10
|
import { forwardRef, useMemo } from 'react';
|
|
11
11
|
import { css, jsx } from '@emotion/core';
|
|
12
|
+
import { N50A, N60A } from '@atlaskit/theme/colors';
|
|
12
13
|
import { fontFamily } from '@atlaskit/theme/constants';
|
|
13
|
-
import { e200 } from '@atlaskit/theme/elevation';
|
|
14
14
|
var sliderThumbSize = 16;
|
|
15
15
|
var sliderThumbBorderThickness = 2;
|
|
16
16
|
var sliderLineThickness = 4;
|
|
@@ -22,27 +22,28 @@ var getBackgroundGradient = function getBackgroundGradient(_ref) {
|
|
|
22
22
|
var lower = _ref.lower,
|
|
23
23
|
upper = _ref.upper;
|
|
24
24
|
return "\n background: linear-gradient(".concat(lower, ", ").concat(lower, ") 0 / var(--range-inline-width) 100%\n no-repeat ").concat(upper, ";\n [dir='rtl'] & {\n background-position: right;\n }\n ");
|
|
25
|
-
};
|
|
25
|
+
};
|
|
26
26
|
|
|
27
|
+
var elevationStyle = "var(--ds-overlay, ".concat("0 4px 8px -2px ".concat(N50A, ", 0 0 1px ").concat(N60A), ")"); // Thumb style
|
|
27
28
|
|
|
28
29
|
var sliderThumbStyle = function sliderThumbStyle(_ref2) {
|
|
29
30
|
var thumb = _ref2.thumb;
|
|
30
|
-
return "\n background: ".concat(thumb.default.background, ";\n border: ").concat(sliderThumbBorderThickness, "px solid transparent;\n border-radius: 50%;\n height: ").concat(sliderThumbSize, "px;\n width: ").concat(sliderThumbSize, "px;\n box-sizing: border-box;\n transition: border-color ").concat(transitionDuration, " ease-in-out;\n ").concat(
|
|
31
|
+
return "\n background: ".concat(thumb.default.background, ";\n border: ").concat(sliderThumbBorderThickness, "px solid transparent;\n border-radius: 50%;\n height: ").concat(sliderThumbSize, "px;\n width: ").concat(sliderThumbSize, "px;\n box-sizing: border-box;\n transition: border-color ").concat(transitionDuration, " ease-in-out;\n box-shadow: ").concat(elevationStyle, "\n ");
|
|
31
32
|
}; // Track styles
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
var sliderTrackStyle = "\n border-radius: ".concat(sliderBorderRadius, "px;\n border: 0;\n cursor: pointer;\n height: ").concat(sliderLineThickness, "px;\n width: 100%;\n transition: background-color ").concat(transitionDuration, " ease-in-out;\n"); // Range input styles
|
|
35
36
|
|
|
36
37
|
var chromeRangeInputStyle = function chromeRangeInputStyle(tokens) {
|
|
37
|
-
return "\n &::-webkit-slider-thumb {\n -webkit-appearance: none;\n margin-top: -".concat((sliderThumbSize - sliderLineThickness) / 2, "px;\n ").concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-webkit-slider-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-webkit-slider-thumb {\n cursor: not-allowed;\n box-shadow:
|
|
38
|
+
return "\n &::-webkit-slider-thumb {\n -webkit-appearance: none;\n margin-top: -".concat((sliderThumbSize - sliderLineThickness) / 2, "px;\n ").concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-webkit-slider-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-webkit-slider-thumb {\n cursor: not-allowed;\n box-shadow: ").concat(tokens.thumb.disabled.boxShadow, ";\n }\n\n &::-webkit-slider-runnable-track {\n ").concat(sliderTrackStyle, ";\n ").concat(getBackgroundGradient(tokens.track.default), ";\n }\n\n &:focus::-webkit-slider-runnable-track {\n ").concat(getBackgroundGradient(tokens.track.default), ";\n }\n\n &:active::-webkit-slider-runnable-track,\n &:hover::-webkit-slider-runnable-track {\n ").concat(getBackgroundGradient(tokens.track.hover), ";\n }\n\n &:disabled::-webkit-slider-runnable-track {\n ").concat(getBackgroundGradient(tokens.track.disabled), "\n cursor: not-allowed;\n }\n ");
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
var firefoxRangeInputStyle = function firefoxRangeInputStyle(tokens) {
|
|
41
|
-
return "\n &::-moz-focus-outer {\n border: 0;\n }\n\n &::-moz-range-thumb {\n ".concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-moz-range-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-moz-range-thumb {\n cursor: not-allowed;\n box-shadow:
|
|
42
|
+
return "\n &::-moz-focus-outer {\n border: 0;\n }\n\n &::-moz-range-thumb {\n ".concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-moz-range-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-moz-range-thumb {\n cursor: not-allowed;\n box-shadow: ").concat(tokens.thumb.disabled.boxShadow, ";\n }\n\n &::-moz-range-progress {\n ").concat(sliderTrackStyle, ";\n background: ").concat(tokens.track.default.lower, ";\n }\n\n &::-moz-range-track {\n ").concat(sliderTrackStyle, ";\n background: ").concat(tokens.track.default.upper, ";\n }\n\n &:active::-moz-range-progress,\n &:hover::-moz-range-progress {\n background: ").concat(tokens.track.hover.lower, ";\n }\n\n &:active::-moz-range-track,\n &:hover::-moz-range-track {\n background: ").concat(tokens.track.hover.upper, ";\n }\n\n &:disabled::-moz-range-progress {\n background: ").concat(tokens.track.disabled.lower, ";\n cursor: not-allowed;\n }\n\n &:disabled::-moz-range-track {\n background: ").concat(tokens.track.disabled.upper, ";\n cursor: not-allowed;\n }\n");
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
var IERangeInputStyle = function IERangeInputStyle(tokens) {
|
|
45
|
-
return "\n &::-ms-thumb {\n margin-top: 0;\n ".concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-ms-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-ms-thumb {\n cursor: not-allowed;\n box-shadow:
|
|
46
|
+
return "\n &::-ms-thumb {\n margin-top: 0;\n ".concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-ms-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-ms-thumb {\n cursor: not-allowed;\n box-shadow: ").concat(tokens.thumb.disabled.boxShadow, ";\n }\n\n &::-ms-track {\n background: transparent;\n border-color: transparent;\n color: transparent;\n cursor: pointer;\n height: ").concat(sliderLineThickness, "px;\n transition: background-color ").concat(transitionDuration, " ease-in-out;\n width: 100%;\n }\n\n &::-ms-fill-lower {\n background: ").concat(tokens.track.default.lower, ";\n border-radius: ").concat(sliderBorderRadius, "px;\n border: 0;\n }\n\n &::-ms-fill-upper {\n background: ").concat(tokens.track.default.upper, ";\n border-radius: ").concat(sliderBorderRadius, "px;\n border: 0;\n }\n\n &:active::-ms-fill-lower,\n &:hover::-ms-fill-lower {\n background: ").concat(tokens.track.hover.lower, ";\n }\n\n &:active::-ms-fill-upper,\n &:hover::-ms-fill-upper {\n background: ").concat(tokens.track.hover.upper, ";\n }\n\n &:disabled::-ms-fill-lower {\n background: ").concat(tokens.track.disabled.lower, ";\n cursor: not-allowed;\n }\n\n &:disabled::-ms-fill-upper {\n background: ").concat(tokens.track.disabled.upper, ";\n cursor: not-allowed;\n }\n");
|
|
46
47
|
}; // Styles are split per browser as they are implemented differently
|
|
47
48
|
// Cannot consolidate as Chrome & Firefox don't recognise styles if they are grouped
|
|
48
49
|
// with CSS selectors they don't recognise, e.g. &::-ms-thumb
|
|
@@ -72,7 +73,8 @@ export var Input = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
72
73
|
style: {
|
|
73
74
|
'--range-inline-width': "".concat(valuePercent, "%")
|
|
74
75
|
},
|
|
75
|
-
ref: ref
|
|
76
|
+
ref: ref // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
77
|
+
,
|
|
76
78
|
css: styles
|
|
77
79
|
}));
|
|
78
80
|
});
|
package/dist/esm/theme.js
CHANGED
|
@@ -2,32 +2,28 @@ import * as colors from '@atlaskit/theme/colors';
|
|
|
2
2
|
import { createTheme } from '@atlaskit/theme/components';
|
|
3
3
|
export var thumb = {
|
|
4
4
|
default: {
|
|
5
|
-
background: colors.N0,
|
|
6
|
-
// This border color is not being used - awaiting focus state lift to props
|
|
7
|
-
border: colors.N800
|
|
5
|
+
background: "var(--ds-background-card, ".concat(colors.N0, ")")
|
|
8
6
|
},
|
|
9
7
|
disabled: {
|
|
10
|
-
boxShadow: colors.N60A
|
|
8
|
+
boxShadow: "var(--ds-card, ".concat("0 0 1px ".concat(colors.N60A), ")")
|
|
11
9
|
},
|
|
12
10
|
focus: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
border: colors.B200
|
|
11
|
+
background: "var(--ds-background-boldNeutral-resting, ".concat(colors.N0, ")"),
|
|
12
|
+
border: "var(--ds-border-focus, ".concat(colors.B200, ")")
|
|
16
13
|
}
|
|
17
14
|
};
|
|
18
15
|
export var track = {
|
|
19
|
-
background: colors.N30A,
|
|
20
16
|
default: {
|
|
21
|
-
lower: colors.B400,
|
|
22
|
-
upper: colors.N30
|
|
17
|
+
lower: "var(--ds-background-boldBrand-resting, ".concat(colors.B400, ")"),
|
|
18
|
+
upper: "var(--ds-background-subtleNeutral-resting, ".concat(colors.N30, ")")
|
|
23
19
|
},
|
|
24
20
|
disabled: {
|
|
25
|
-
lower: colors.N50,
|
|
26
|
-
upper: colors.N30
|
|
21
|
+
lower: "var(--ds-text-disabled, ".concat(colors.N50, ")"),
|
|
22
|
+
upper: "var(--ds-background-disabled, ".concat(colors.N30, ")")
|
|
27
23
|
},
|
|
28
24
|
hover: {
|
|
29
|
-
lower: colors.B300,
|
|
30
|
-
upper: colors.N40
|
|
25
|
+
lower: "var(--ds-background-boldBrand-hover, ".concat(colors.B300, ")"),
|
|
26
|
+
upper: "var(--ds-background-subtleNeutral-hover, ".concat(colors.N40, ")")
|
|
31
27
|
}
|
|
32
28
|
};
|
|
33
29
|
export var Theme = createTheme(function () {
|
package/dist/esm/version.json
CHANGED
package/dist/types/theme.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface ThemeTokensThumb {
|
|
3
3
|
background: string;
|
|
4
|
-
border
|
|
4
|
+
border?: string;
|
|
5
5
|
}
|
|
6
6
|
export interface ThemeTokensTrack {
|
|
7
7
|
lower: string;
|
|
@@ -16,7 +16,6 @@ export interface ThemeTokens {
|
|
|
16
16
|
focus: ThemeTokensThumb;
|
|
17
17
|
};
|
|
18
18
|
track: {
|
|
19
|
-
background: string;
|
|
20
19
|
default: ThemeTokensTrack;
|
|
21
20
|
disabled: ThemeTokensTrack;
|
|
22
21
|
hover: ThemeTokensTrack;
|
|
@@ -24,30 +23,28 @@ export interface ThemeTokens {
|
|
|
24
23
|
}
|
|
25
24
|
export declare const thumb: {
|
|
26
25
|
default: {
|
|
27
|
-
background:
|
|
28
|
-
border: string;
|
|
26
|
+
background: "var(--ds-background-card)";
|
|
29
27
|
};
|
|
30
28
|
disabled: {
|
|
31
|
-
boxShadow:
|
|
29
|
+
boxShadow: "var(--ds-card)";
|
|
32
30
|
};
|
|
33
31
|
focus: {
|
|
34
|
-
background:
|
|
35
|
-
border:
|
|
32
|
+
background: "var(--ds-background-boldNeutral-resting)";
|
|
33
|
+
border: "var(--ds-border-focus)";
|
|
36
34
|
};
|
|
37
35
|
};
|
|
38
36
|
export declare const track: {
|
|
39
|
-
background: string;
|
|
40
37
|
default: {
|
|
41
|
-
lower:
|
|
42
|
-
upper:
|
|
38
|
+
lower: "var(--ds-background-boldBrand-resting)";
|
|
39
|
+
upper: "var(--ds-background-subtleNeutral-resting)";
|
|
43
40
|
};
|
|
44
41
|
disabled: {
|
|
45
|
-
lower:
|
|
46
|
-
upper:
|
|
42
|
+
lower: "var(--ds-text-disabled)";
|
|
43
|
+
upper: "var(--ds-background-disabled)";
|
|
47
44
|
};
|
|
48
45
|
hover: {
|
|
49
|
-
lower:
|
|
50
|
-
upper:
|
|
46
|
+
lower: "var(--ds-background-boldBrand-hover)";
|
|
47
|
+
upper: "var(--ds-background-subtleNeutral-hover)";
|
|
51
48
|
};
|
|
52
49
|
};
|
|
53
50
|
export declare const Theme: {
|
package/docs/0-intro.tsx
CHANGED
|
@@ -1,66 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { md } from '@atlaskit/docs';
|
|
4
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
4
5
|
|
|
5
6
|
export default md`
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
${code`import FieldRange from '@atlaskit/range';`}
|
|
13
|
-
|
|
14
|
-
${(
|
|
15
|
-
<Example
|
|
16
|
-
packageName="@atlaskit/range"
|
|
17
|
-
Component={require('../examples/00-basic-example-uncontrolled').default}
|
|
18
|
-
title="Basic"
|
|
19
|
-
source={require('!!raw-loader!../examples/00-basic-example-uncontrolled')}
|
|
20
|
-
/>
|
|
21
|
-
)}
|
|
22
|
-
|
|
23
|
-
You can also take full control of the range yourself if you need to manage its state, rather than simply respond to changes.
|
|
24
|
-
|
|
25
|
-
${(
|
|
26
|
-
<Example
|
|
27
|
-
packageName="@atlaskit/range"
|
|
28
|
-
Component={require('../examples/01-basic-example-controlled').default}
|
|
29
|
-
title="Controlled Example"
|
|
30
|
-
source={require('!!raw-loader!../examples/01-basic-example-controlled')}
|
|
31
|
-
/>
|
|
32
|
-
)}
|
|
33
|
-
|
|
34
|
-
## Rate limiting
|
|
35
|
-
|
|
36
|
-
It is recommended that if you have an expensive onChange function
|
|
37
|
-
that you rate limit as it will be called on each step when you move
|
|
38
|
-
the range. You can do this in whatever way is best for your use case but
|
|
39
|
-
below is an example with:
|
|
40
|
-
|
|
41
|
-
* debouncing - function is called once after it isn't called for a given period
|
|
42
|
-
* throttling - function is only called once in a given period
|
|
43
|
-
|
|
44
|
-
${(
|
|
45
|
-
<Example
|
|
46
|
-
packageName="@atlaskit/range"
|
|
47
|
-
Component={require('../examples/08-rate-limited').default}
|
|
48
|
-
title="Rate limited example"
|
|
49
|
-
source={require('!!raw-loader!../examples/08-rate-limited')}
|
|
50
|
-
/>
|
|
51
|
-
)}
|
|
52
|
-
|
|
53
|
-
## Props
|
|
54
|
-
|
|
55
|
-
In addition to the props below, we spread all other props provided on to the input
|
|
56
|
-
component. Between this and the innerRef, you should be empowered to take full control
|
|
57
|
-
of any aspect you need to do.
|
|
58
|
-
|
|
59
|
-
${(
|
|
60
|
-
<Props
|
|
61
|
-
props={require('!!extract-react-types-loader!../extract-react-types/range-props')}
|
|
62
|
-
heading=""
|
|
63
|
-
/>
|
|
64
|
-
)}
|
|
65
|
-
|
|
7
|
+
${(
|
|
8
|
+
<SectionMessage appearance="information">
|
|
9
|
+
This component is now documented on{' '}
|
|
10
|
+
<a href="https://atlassian.design/components">atlassian.design</a>
|
|
11
|
+
</SectionMessage>
|
|
12
|
+
)}
|
|
66
13
|
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/range",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "A range lets users choose an approximate value on a slider.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@atlaskit/theme": "^
|
|
28
|
+
"@atlaskit/theme": "^12.0.0",
|
|
29
|
+
"@atlaskit/tokens": "^0.4.0",
|
|
29
30
|
"@babel/runtime": "^7.0.0",
|
|
30
31
|
"@emotion/core": "^10.0.9"
|
|
31
32
|
},
|
|
@@ -34,16 +35,19 @@
|
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@atlaskit/build-utils": "*",
|
|
38
|
+
"@atlaskit/button": "^16.0.0",
|
|
37
39
|
"@atlaskit/checkbox": "^12.0.0",
|
|
38
40
|
"@atlaskit/docs": "*",
|
|
41
|
+
"@atlaskit/form": "^8.4.0",
|
|
42
|
+
"@atlaskit/section-message": "^6.0.0",
|
|
39
43
|
"@atlaskit/ssr": "*",
|
|
40
|
-
"@atlaskit/tooltip": "^17.
|
|
44
|
+
"@atlaskit/tooltip": "^17.5.0",
|
|
41
45
|
"@atlaskit/visual-regression": "*",
|
|
42
46
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
43
47
|
"@emotion/styled": "^10.0.7",
|
|
44
48
|
"@testing-library/react": "^8.0.1",
|
|
45
49
|
"@types/jscodeshift": "^0.11.0",
|
|
46
|
-
"jscodeshift": "^0.
|
|
50
|
+
"jscodeshift": "^0.13.0",
|
|
47
51
|
"lodash": "^4.17.15",
|
|
48
52
|
"react-dom": "^16.8.0",
|
|
49
53
|
"storybook-addon-performance": "^0.16.0",
|
|
@@ -59,19 +63,14 @@
|
|
|
59
63
|
"import-structure": "atlassian-conventions"
|
|
60
64
|
},
|
|
61
65
|
"@repo/internal": {
|
|
62
|
-
"ui-components":
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"theming": [
|
|
69
|
-
"new-theming-api"
|
|
70
|
-
],
|
|
71
|
-
"deprecation": [
|
|
72
|
-
"no-deprecated-imports"
|
|
66
|
+
"ui-components": "lite-mode",
|
|
67
|
+
"analytics": "analytics-next",
|
|
68
|
+
"theming": "tokens",
|
|
69
|
+
"deprecation": "no-deprecated-imports",
|
|
70
|
+
"styling": [
|
|
71
|
+
"emotion"
|
|
73
72
|
]
|
|
74
73
|
}
|
|
75
74
|
},
|
|
76
75
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
77
|
-
}
|
|
76
|
+
}
|