@atlaskit/range 7.2.0 → 7.3.0
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 +315 -307
- package/README.md +2 -1
- package/__perf__/default.tsx +1 -3
- package/__perf__/range.tsx +21 -26
- package/afm-jira/tsconfig.json +31 -0
- package/codemods/4.0.0-lite-mode.tsx +48 -73
- package/codemods/__tests__/4.0.0-lite-mode.tsx +21 -21
- package/constellation/index/examples.mdx +6 -3
- package/constellation/index/usage.mdx +14 -7
- package/dist/cjs/styled.js +20 -4
- package/dist/es2019/styled.js +38 -3
- package/dist/esm/styled.js +22 -3
- package/dist/types/styled.d.ts +3 -0
- package/dist/types-ts4.5/styled.d.ts +3 -0
- package/docs/0-intro.tsx +5 -4
- package/package.json +94 -96
- package/report.api.md +19 -24
package/README.md
CHANGED
|
@@ -10,4 +10,5 @@ yarn add @atlaskit/range
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
For more information, see our
|
|
13
|
+
For more information, see our
|
|
14
|
+
[detailed range docs and examples](https://atlassian.design/components/range/).
|
package/__perf__/default.tsx
CHANGED
package/__perf__/range.tsx
CHANGED
|
@@ -1,42 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { fireEvent } from '@testing-library/react';
|
|
4
|
-
import type {
|
|
5
|
-
InteractionTaskArgs,
|
|
6
|
-
PublicInteractionTask,
|
|
7
|
-
} from 'storybook-addon-performance';
|
|
4
|
+
import type { InteractionTaskArgs, PublicInteractionTask } from 'storybook-addon-performance';
|
|
8
5
|
|
|
9
6
|
import Range from '../src';
|
|
10
7
|
|
|
11
8
|
const interactionTasks: PublicInteractionTask[] = [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
},
|
|
9
|
+
{
|
|
10
|
+
name: 'Changing input value',
|
|
11
|
+
description: 'Change the input value of a range with 500 steps',
|
|
12
|
+
run: async ({ container }: InteractionTaskArgs): Promise<void> => {
|
|
13
|
+
const range: HTMLElement | null = container.querySelector('[data-testid="my-range"]');
|
|
14
|
+
if (range == null) {
|
|
15
|
+
throw new Error('Could not find range element');
|
|
16
|
+
}
|
|
17
|
+
for (let i = 251; i < 300; i++) {
|
|
18
|
+
fireEvent.change(range, { target: { value: i } });
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
},
|
|
27
22
|
];
|
|
28
23
|
|
|
29
24
|
function PerformanceComponent() {
|
|
30
|
-
|
|
25
|
+
return <Range defaultValue={250} min={0} max={500} testId="my-range" />;
|
|
31
26
|
}
|
|
32
27
|
|
|
33
28
|
PerformanceComponent.story = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
name: 'Performance',
|
|
30
|
+
parameters: {
|
|
31
|
+
performance: {
|
|
32
|
+
interactions: interactionTasks,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
40
35
|
};
|
|
41
36
|
|
|
42
37
|
export default PerformanceComponent;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.products.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"outDir": "../../../../../tsDist/@atlaskit__range/app",
|
|
7
|
+
"composite": true,
|
|
8
|
+
"rootDir": "../",
|
|
9
|
+
"baseUrl": "../"
|
|
10
|
+
},
|
|
11
|
+
"include": [
|
|
12
|
+
"../src/**/*.ts",
|
|
13
|
+
"../src/**/*.tsx"
|
|
14
|
+
],
|
|
15
|
+
"exclude": [
|
|
16
|
+
"../src/**/__tests__/*",
|
|
17
|
+
"../src/**/*.test.*",
|
|
18
|
+
"../src/**/test.*"
|
|
19
|
+
],
|
|
20
|
+
"references": [
|
|
21
|
+
{
|
|
22
|
+
"path": "../../ds-lib/afm-jira/tsconfig.json"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"path": "../../theme/afm-jira/tsconfig.json"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"path": "../../tokens/afm-jira/tsconfig.json"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -1,92 +1,67 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import {
|
|
2
|
+
type API,
|
|
3
|
+
type ASTPath,
|
|
4
|
+
type default as core,
|
|
5
|
+
type FileInfo,
|
|
6
|
+
type ImportDeclaration,
|
|
7
|
+
type JSXAttribute,
|
|
8
|
+
type Options,
|
|
8
9
|
} from 'jscodeshift';
|
|
9
10
|
|
|
10
|
-
function getDefaultSpecifier(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
)
|
|
15
|
-
const specifiers = source
|
|
16
|
-
.find(j.ImportDeclaration)
|
|
17
|
-
.filter(
|
|
18
|
-
(path: ASTPath<ImportDeclaration>) =>
|
|
19
|
-
path.node.source.value === specifier,
|
|
20
|
-
)
|
|
21
|
-
.find(j.ImportDefaultSpecifier);
|
|
11
|
+
function getDefaultSpecifier(j: core.JSCodeshift, source: any, specifier: string) {
|
|
12
|
+
const specifiers = source
|
|
13
|
+
.find(j.ImportDeclaration)
|
|
14
|
+
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
|
|
15
|
+
.find(j.ImportDefaultSpecifier);
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
if (!specifiers.length) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return specifiers.nodes()[0]!.local!.name;
|
|
27
21
|
}
|
|
28
22
|
|
|
29
|
-
function getJSXAttributesByName(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.find(j.JSXIdentifier)
|
|
40
|
-
.filter((identifier) => identifier.value.name === attributeName);
|
|
41
|
-
return Boolean(matches.length);
|
|
42
|
-
});
|
|
23
|
+
function getJSXAttributesByName(j: core.JSCodeshift, element: ASTPath<any>, attributeName: string) {
|
|
24
|
+
return j(element)
|
|
25
|
+
.find(j.JSXOpeningElement)
|
|
26
|
+
.find(j.JSXAttribute)
|
|
27
|
+
.filter((attribute) => {
|
|
28
|
+
const matches = j(attribute)
|
|
29
|
+
.find(j.JSXIdentifier)
|
|
30
|
+
.filter((identifier) => identifier.value.name === attributeName);
|
|
31
|
+
return Boolean(matches.length);
|
|
32
|
+
});
|
|
43
33
|
}
|
|
44
34
|
|
|
45
35
|
function updateRef(j: core.JSCodeshift, source: any) {
|
|
46
|
-
|
|
36
|
+
const defaultSpecifier = getDefaultSpecifier(j, source, '@atlaskit/range');
|
|
47
37
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
if (!defaultSpecifier) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
51
41
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
j.jsxAttribute(j.jsxIdentifier('ref'), attribute.node.value),
|
|
58
|
-
);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
42
|
+
source.findJSXElements(defaultSpecifier).forEach((element: ASTPath<JSXAttribute>) => {
|
|
43
|
+
getJSXAttributesByName(j, element, 'inputRef').forEach((attribute) => {
|
|
44
|
+
j(attribute).replaceWith(j.jsxAttribute(j.jsxIdentifier('ref'), attribute.node.value));
|
|
45
|
+
});
|
|
46
|
+
});
|
|
61
47
|
}
|
|
62
48
|
|
|
63
|
-
function hasImportDeclaration(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
) {
|
|
68
|
-
const imports = source
|
|
69
|
-
.find(j.ImportDeclaration)
|
|
70
|
-
.filter(
|
|
71
|
-
(path: ASTPath<ImportDeclaration>) =>
|
|
72
|
-
path.node.source.value === importPath,
|
|
73
|
-
);
|
|
49
|
+
function hasImportDeclaration(j: core.JSCodeshift, source: any, importPath: string) {
|
|
50
|
+
const imports = source
|
|
51
|
+
.find(j.ImportDeclaration)
|
|
52
|
+
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === importPath);
|
|
74
53
|
|
|
75
|
-
|
|
54
|
+
return Boolean(imports.length);
|
|
76
55
|
}
|
|
77
56
|
|
|
78
|
-
export default function transformer(
|
|
79
|
-
|
|
80
|
-
{ jscodeshift: j }: API,
|
|
81
|
-
options: Options,
|
|
82
|
-
) {
|
|
83
|
-
const source = j(fileInfo.source);
|
|
57
|
+
export default function transformer(fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) {
|
|
58
|
+
const source = j(fileInfo.source);
|
|
84
59
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
60
|
+
if (!hasImportDeclaration(j, source, '@atlaskit/range')) {
|
|
61
|
+
return fileInfo.source;
|
|
62
|
+
}
|
|
88
63
|
|
|
89
|
-
|
|
64
|
+
updateRef(j, source);
|
|
90
65
|
|
|
91
|
-
|
|
66
|
+
return source.toSource(options.printOptions || { quote: 'single' });
|
|
92
67
|
}
|
|
@@ -5,10 +5,10 @@ import transformer from '../4.0.0-lite-mode';
|
|
|
5
5
|
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
6
|
|
|
7
7
|
describe('Update ref prop', () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
defineInlineTest(
|
|
9
|
+
{ default: transformer, parser: 'tsx' },
|
|
10
|
+
{},
|
|
11
|
+
`
|
|
12
12
|
import React, { useRef } from 'react';
|
|
13
13
|
import Range from '@atlaskit/range';
|
|
14
14
|
|
|
@@ -21,7 +21,7 @@ describe('Update ref prop', () => {
|
|
|
21
21
|
return <Range inputRef={inputRef} />;
|
|
22
22
|
}
|
|
23
23
|
`,
|
|
24
|
-
|
|
24
|
+
`
|
|
25
25
|
import React, { useRef } from 'react';
|
|
26
26
|
import Range from '@atlaskit/range';
|
|
27
27
|
|
|
@@ -34,13 +34,13 @@ describe('Update ref prop', () => {
|
|
|
34
34
|
return <Range ref={inputRef} />;
|
|
35
35
|
}
|
|
36
36
|
`,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
'should replace inputRef with ref',
|
|
38
|
+
);
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
defineInlineTest(
|
|
41
|
+
{ default: transformer, parser: 'tsx' },
|
|
42
|
+
{},
|
|
43
|
+
`
|
|
44
44
|
import React, { useRef } from 'react';
|
|
45
45
|
import Range from '@atlaskit/range';
|
|
46
46
|
|
|
@@ -56,7 +56,7 @@ describe('Update ref prop', () => {
|
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
`,
|
|
59
|
-
|
|
59
|
+
`
|
|
60
60
|
import React, { useRef } from 'react';
|
|
61
61
|
import Range from '@atlaskit/range';
|
|
62
62
|
|
|
@@ -72,13 +72,13 @@ describe('Update ref prop', () => {
|
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
`,
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
'should replace inputRef with ref when defined inline',
|
|
76
|
+
);
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
defineInlineTest(
|
|
79
|
+
{ default: transformer, parser: 'tsx' },
|
|
80
|
+
{},
|
|
81
|
+
`
|
|
82
82
|
import React, { useRef } from 'react';
|
|
83
83
|
import Foo from '@atlaskit/range';
|
|
84
84
|
|
|
@@ -91,7 +91,7 @@ describe('Update ref prop', () => {
|
|
|
91
91
|
return <Foo inputRef={inputRef} />;
|
|
92
92
|
}
|
|
93
93
|
`,
|
|
94
|
-
|
|
94
|
+
`
|
|
95
95
|
import React, { useRef } from 'react';
|
|
96
96
|
import Foo from '@atlaskit/range';
|
|
97
97
|
|
|
@@ -104,6 +104,6 @@ describe('Update ref prop', () => {
|
|
|
104
104
|
return <Foo ref={inputRef} />;
|
|
105
105
|
}
|
|
106
106
|
`,
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
'should change inputRef with aliased import name',
|
|
108
|
+
);
|
|
109
109
|
});
|
|
@@ -22,7 +22,8 @@ Range used with the [form component](/components/form/).
|
|
|
22
22
|
|
|
23
23
|
## Controlled
|
|
24
24
|
|
|
25
|
-
In a controlled range, the state is managed by the React component. Use the `onChange` handler to
|
|
25
|
+
In a controlled range, the state is managed by the React component. Use the `onChange` handler to
|
|
26
|
+
set the value.
|
|
26
27
|
|
|
27
28
|
<Example Component={RangeControlled} packageName="@atlaskit/range" />
|
|
28
29
|
|
|
@@ -34,8 +35,10 @@ In an uncontrolled range, the state is managed by the DOM.
|
|
|
34
35
|
|
|
35
36
|
## Disabled
|
|
36
37
|
|
|
37
|
-
Set `isDisabled` to disable a range when another action has to be completed before the range is
|
|
38
|
+
Set `isDisabled` to disable a range when another action has to be completed before the range is
|
|
39
|
+
usable.
|
|
38
40
|
|
|
39
|
-
Avoid using disabled UI where possible. This can cause accessibility problems, because disabled UI
|
|
41
|
+
Avoid using disabled UI where possible. This can cause accessibility problems, because disabled UI
|
|
42
|
+
does not give enough information about what went wrong and how to proceed.
|
|
40
43
|
|
|
41
44
|
<Example Component={RangeDisabled} packageName="@atlaskit/range" />
|
|
@@ -4,26 +4,33 @@ order: 2
|
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
Use ranges in [forms](/patterns/forms) to let people select a value within a given range of minimum
|
|
7
|
+
Use ranges in [forms](/patterns/forms) to let people select a value within a given range of minimum
|
|
8
|
+
and maximum values.
|
|
8
9
|
|
|
9
10
|
## Anatomy
|
|
10
11
|
|
|
11
12
|

|
|
12
13
|
|
|
13
|
-
1. **Track:** The track is a horizontal line that displays the range available for the user to
|
|
14
|
-
|
|
14
|
+
1. **Track:** The track is a horizontal line that displays the range available for the user to
|
|
15
|
+
select from.
|
|
16
|
+
2. **Handle:** A circular position indicator that people can move along the track to change the
|
|
17
|
+
value.
|
|
15
18
|
|
|
16
19
|
## Accessibility
|
|
17
20
|
|
|
18
|
-
- Don't use a range if choosing a specific value is important. The slider interaction isn't as
|
|
19
|
-
|
|
21
|
+
- Don't use a range if choosing a specific value is important. The slider interaction isn't as
|
|
22
|
+
precise as explicitly typing or choosing an option from a list.
|
|
23
|
+
- Don't use a range for values that aren't numeric. For example, selecting weekdays (Monday to
|
|
24
|
+
Friday).
|
|
20
25
|
|
|
21
26
|
## Best practices
|
|
22
27
|
|
|
23
28
|
- Place labels directly above the input, and align to the left.
|
|
24
29
|
- Don't use for ranges that are extremely large. For example, values over 100.
|
|
25
|
-
- Don't use for ranges that are very small (for example, 1-3). The range moves in steps when the
|
|
26
|
-
|
|
30
|
+
- Don't use for ranges that are very small (for example, 1-3). The range moves in steps when the
|
|
31
|
+
range of values is lower.
|
|
32
|
+
- For left-to-right user interfaces, put the lowest value on the left of the slider. For
|
|
33
|
+
right-to-left user interfaces, put the lowest value on the right.
|
|
27
34
|
|
|
28
35
|
## Content guidelines
|
|
29
36
|
|
package/dist/cjs/styled.js
CHANGED
|
@@ -17,7 +17,9 @@ var _hoverNotDisabled, _css;
|
|
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
19
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
21
|
+
* @jsxRuntime classic
|
|
22
|
+
*/ /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
21
23
|
var VAR_THUMB_BORDER_COLOR = '--thumb-border';
|
|
22
24
|
var VAR_THUMB_SHADOW = '--thumb-shadow';
|
|
23
25
|
var VAR_THUMB_BACKGROUND_COLOR = '--thumb-bg';
|
|
@@ -55,11 +57,13 @@ var browserStyles = {
|
|
|
55
57
|
webkit: (0, _react2.css)({
|
|
56
58
|
WebkitAppearance: 'none',
|
|
57
59
|
// Hides the slider so that custom slider can be made
|
|
60
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
58
61
|
'::-webkit-slider-thumb': _objectSpread(_objectSpread({}, sliderThumbStyles), {}, {
|
|
59
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
60
|
-
|
|
62
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
63
|
+
marginBlockStart: -(theme.thumb.size - theme.track.height) / 2,
|
|
61
64
|
WebkitAppearance: 'none'
|
|
62
65
|
}),
|
|
66
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
63
67
|
'::-webkit-slider-runnable-track': _objectSpread(_objectSpread({}, sliderTrackStyles), {}, {
|
|
64
68
|
/**
|
|
65
69
|
* Webkit does not have separate properties for the background/foreground like firefox.
|
|
@@ -73,29 +77,37 @@ var browserStyles = {
|
|
|
73
77
|
backgroundImage: "linear-gradient(var(".concat(VAR_TRACK_FOREGROUND_COLOR, "), var(").concat(VAR_TRACK_FOREGROUND_COLOR, "))"),
|
|
74
78
|
backgroundRepeat: 'no-repeat',
|
|
75
79
|
backgroundSize: "var(".concat(VAR_TRACK_FOREGROUND_WIDTH, ") 100%"),
|
|
76
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
80
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
77
81
|
'[dir="rtl"] &': {
|
|
78
82
|
backgroundPosition: 'right'
|
|
79
83
|
}
|
|
80
84
|
}),
|
|
85
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
81
86
|
':disabled': {
|
|
87
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
82
88
|
'::-webkit-slider-thumb, ::-webkit-slider-runnable-track': {
|
|
83
89
|
cursor: 'not-allowed'
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
}),
|
|
87
93
|
firefox: (0, _react2.css)({
|
|
94
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
88
95
|
'::-moz-range-thumb': sliderThumbStyles,
|
|
96
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
89
97
|
'::-moz-focus-outer': {
|
|
90
98
|
border: 0
|
|
91
99
|
},
|
|
100
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
92
101
|
'::-moz-range-progress': _objectSpread(_objectSpread({}, sliderTrackStyles), {}, {
|
|
93
102
|
background: "var(".concat(VAR_TRACK_FOREGROUND_COLOR, ")")
|
|
94
103
|
}),
|
|
104
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
95
105
|
'::-moz-range-track': _objectSpread(_objectSpread({}, sliderTrackStyles), {}, {
|
|
96
106
|
background: "var(".concat(VAR_TRACK_BACKGROUND_COLOR, ")")
|
|
97
107
|
}),
|
|
108
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
98
109
|
':disabled': {
|
|
110
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
99
111
|
'::-moz-range-thumb, ::-moz-range-progress, ::-moz-range-track': {
|
|
100
112
|
cursor: 'not-allowed'
|
|
101
113
|
}
|
|
@@ -105,13 +117,16 @@ var browserStyles = {
|
|
|
105
117
|
var baseStyles = (0, _react2.css)({
|
|
106
118
|
width: '100%',
|
|
107
119
|
// Has a fixed width by default
|
|
120
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
108
121
|
height: theme.input.height,
|
|
109
122
|
// Otherwise thumb will collide with previous box element
|
|
110
123
|
background: 'transparent',
|
|
111
124
|
// Otherwise white
|
|
125
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
112
126
|
':focus': {
|
|
113
127
|
outline: 'none'
|
|
114
128
|
},
|
|
129
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
115
130
|
':disabled': {
|
|
116
131
|
cursor: 'not-allowed',
|
|
117
132
|
opacity: "var(--ds-opacity-disabled, 0.4)"
|
|
@@ -128,6 +143,7 @@ var Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
|
128
143
|
style = props.style,
|
|
129
144
|
strippedProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
130
145
|
return (0, _react2.jsx)("input", (0, _extends2.default)({}, strippedProps, {
|
|
146
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
131
147
|
style: (0, _defineProperty2.default)({}, VAR_TRACK_FOREGROUND_WIDTH, "".concat(valuePercent, "%")),
|
|
132
148
|
ref: ref,
|
|
133
149
|
css: [baseStyles, browserStyles.webkit, browserStyles.firefox, themeStyles]
|
package/dist/es2019/styled.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
*/
|
|
2
5
|
/** @jsx jsx */
|
|
3
6
|
|
|
4
7
|
import { forwardRef } from 'react';
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
10
|
import { css, jsx } from '@emotion/react';
|
|
6
11
|
import * as theme from './theme';
|
|
7
12
|
const VAR_THUMB_BORDER_COLOR = '--thumb-border';
|
|
@@ -41,13 +46,17 @@ const browserStyles = {
|
|
|
41
46
|
webkit: css({
|
|
42
47
|
WebkitAppearance: 'none',
|
|
43
48
|
// Hides the slider so that custom slider can be made
|
|
49
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
44
50
|
'::-webkit-slider-thumb': {
|
|
51
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
45
52
|
...sliderThumbStyles,
|
|
46
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
47
|
-
|
|
53
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
54
|
+
marginBlockStart: -(theme.thumb.size - theme.track.height) / 2,
|
|
48
55
|
WebkitAppearance: 'none'
|
|
49
56
|
},
|
|
57
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
50
58
|
'::-webkit-slider-runnable-track': {
|
|
59
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
51
60
|
...sliderTrackStyles,
|
|
52
61
|
/**
|
|
53
62
|
* Webkit does not have separate properties for the background/foreground like firefox.
|
|
@@ -61,31 +70,41 @@ const browserStyles = {
|
|
|
61
70
|
backgroundImage: `linear-gradient(var(${VAR_TRACK_FOREGROUND_COLOR}), var(${VAR_TRACK_FOREGROUND_COLOR}))`,
|
|
62
71
|
backgroundRepeat: 'no-repeat',
|
|
63
72
|
backgroundSize: `var(${VAR_TRACK_FOREGROUND_WIDTH}) 100%`,
|
|
64
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
73
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
65
74
|
'[dir="rtl"] &': {
|
|
66
75
|
backgroundPosition: 'right'
|
|
67
76
|
}
|
|
68
77
|
},
|
|
78
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
69
79
|
':disabled': {
|
|
80
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
70
81
|
'::-webkit-slider-thumb, ::-webkit-slider-runnable-track': {
|
|
71
82
|
cursor: 'not-allowed'
|
|
72
83
|
}
|
|
73
84
|
}
|
|
74
85
|
}),
|
|
75
86
|
firefox: css({
|
|
87
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
76
88
|
'::-moz-range-thumb': sliderThumbStyles,
|
|
89
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
77
90
|
'::-moz-focus-outer': {
|
|
78
91
|
border: 0
|
|
79
92
|
},
|
|
93
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
80
94
|
'::-moz-range-progress': {
|
|
95
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
81
96
|
...sliderTrackStyles,
|
|
82
97
|
background: `var(${VAR_TRACK_FOREGROUND_COLOR})`
|
|
83
98
|
},
|
|
99
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
84
100
|
'::-moz-range-track': {
|
|
101
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
85
102
|
...sliderTrackStyles,
|
|
86
103
|
background: `var(${VAR_TRACK_BACKGROUND_COLOR})`
|
|
87
104
|
},
|
|
105
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
88
106
|
':disabled': {
|
|
107
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
89
108
|
'::-moz-range-thumb, ::-moz-range-progress, ::-moz-range-track': {
|
|
90
109
|
cursor: 'not-allowed'
|
|
91
110
|
}
|
|
@@ -95,31 +114,45 @@ const browserStyles = {
|
|
|
95
114
|
const baseStyles = css({
|
|
96
115
|
width: '100%',
|
|
97
116
|
// Has a fixed width by default
|
|
117
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
98
118
|
height: theme.input.height,
|
|
99
119
|
// Otherwise thumb will collide with previous box element
|
|
100
120
|
background: 'transparent',
|
|
101
121
|
// Otherwise white
|
|
122
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
102
123
|
':focus': {
|
|
103
124
|
outline: 'none'
|
|
104
125
|
},
|
|
126
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
105
127
|
':disabled': {
|
|
106
128
|
cursor: 'not-allowed',
|
|
107
129
|
opacity: "var(--ds-opacity-disabled, 0.4)"
|
|
108
130
|
}
|
|
109
131
|
});
|
|
110
132
|
const themeStyles = css({
|
|
133
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
111
134
|
[VAR_THUMB_SHADOW]: theme.thumb.boxShadow.default,
|
|
135
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
112
136
|
[VAR_TRACK_BACKGROUND_COLOR]: theme.track.background.default,
|
|
137
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
113
138
|
[VAR_TRACK_FOREGROUND_COLOR]: theme.track.foreground.default,
|
|
139
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
114
140
|
':hover:not(:disabled)': {
|
|
141
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
115
142
|
[VAR_THUMB_BACKGROUND_COLOR]: theme.thumb.background.hovered,
|
|
143
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
116
144
|
[VAR_TRACK_BACKGROUND_COLOR]: theme.track.background.hovered,
|
|
145
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
117
146
|
[VAR_TRACK_FOREGROUND_COLOR]: theme.track.foreground.hovered
|
|
118
147
|
},
|
|
148
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
119
149
|
':active:not(:disabled)': {
|
|
150
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
120
151
|
[VAR_THUMB_BACKGROUND_COLOR]: theme.thumb.background.pressed
|
|
121
152
|
},
|
|
153
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
122
154
|
':focus-visible': {
|
|
155
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
123
156
|
[VAR_THUMB_BORDER_COLOR]: theme.thumb.borderColor.focused
|
|
124
157
|
}
|
|
125
158
|
});
|
|
@@ -135,10 +168,12 @@ export const Input = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
135
168
|
...strippedProps
|
|
136
169
|
} = props;
|
|
137
170
|
return jsx("input", _extends({}, strippedProps, {
|
|
171
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
138
172
|
style: {
|
|
139
173
|
// We are creating a css variable to control the "progress" portion of the range input
|
|
140
174
|
// This avoids us needing to create a new css class for each new percentage value
|
|
141
175
|
[VAR_TRACK_FOREGROUND_WIDTH]: `${valuePercent}%`
|
|
176
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
142
177
|
},
|
|
143
178
|
ref: ref,
|
|
144
179
|
css: [baseStyles, browserStyles.webkit, browserStyles.firefox, themeStyles]
|