@salutejs/plasma-new-hope 0.176.0-canary.1511.11569320253.0 → 0.176.0-canary.1511.11570259013.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/NumberInput/NumberInput.css +1 -1
- package/cjs/components/NumberInput/NumberInput.tokens.js +2 -1
- package/cjs/components/NumberInput/NumberInput.tokens.js.map +1 -1
- package/cjs/components/NumberInput/ui/Input/Input.js +2 -2
- package/cjs/components/NumberInput/ui/Input/Input.js.map +1 -1
- package/cjs/components/NumberInput/variations/_segmentation/base.js +1 -1
- package/cjs/components/NumberInput/variations/_segmentation/base.js.map +1 -1
- package/cjs/components/NumberInput/variations/_segmentation/base_3r9a58.css +1 -0
- package/cjs/components/Slider/Slider.css +15 -13
- package/cjs/components/Slider/Slider.js +11 -2
- package/cjs/components/Slider/Slider.js.map +1 -1
- package/cjs/components/Slider/Slider.tokens.js +23 -17
- package/cjs/components/Slider/Slider.tokens.js.map +1 -1
- package/cjs/components/Slider/components/Double/Double.css +8 -8
- package/cjs/components/Slider/components/Double/Double.js +58 -23
- package/cjs/components/Slider/components/Double/Double.js.map +1 -1
- package/cjs/components/Slider/components/DoubleUncontrolled/DoubleUncontrolled.css +98 -0
- package/cjs/components/Slider/components/Single/Single.css +14 -14
- package/cjs/components/Slider/components/Single/Single.js +64 -33
- package/cjs/components/Slider/components/Single/Single.js.map +1 -1
- package/cjs/components/Slider/components/Single/Single.styles.js +4 -4
- package/cjs/components/Slider/components/Single/Single.styles.js.map +1 -1
- package/cjs/components/Slider/components/Single/Single.styles_1h7n2s2.css +6 -0
- package/cjs/components/Slider/components/SliderBase/SliderBase.css +5 -5
- package/cjs/components/Slider/components/SliderBase/SliderBase.js +31 -12
- package/cjs/components/Slider/components/SliderBase/SliderBase.js.map +1 -1
- package/cjs/components/Slider/components/SliderBase/SliderBase.styles.js +7 -7
- package/cjs/components/Slider/components/SliderBase/SliderBase.styles.js.map +1 -1
- package/cjs/components/Slider/components/SliderBase/SliderBase.styles_1qt1224.css +5 -0
- package/cjs/components/Slider/ui/Handler/Handler.css +3 -3
- package/cjs/components/Slider/ui/Handler/Handler.js +49 -88
- package/cjs/components/Slider/ui/Handler/Handler.js.map +1 -1
- package/cjs/components/Slider/ui/Handler/Handler.styles.js +17 -7
- package/cjs/components/Slider/ui/Handler/Handler.styles.js.map +1 -1
- package/cjs/components/Slider/ui/Handler/Handler.styles_irtcgm.css +2 -0
- package/cjs/components/Slider/ui/Handler/computeKeyPressData.js +122 -0
- package/cjs/components/Slider/ui/Handler/computeKeyPressData.js.map +1 -0
- package/cjs/components/Slider/ui/Thumb/Thumb.css +1 -1
- package/cjs/components/Slider/ui/Thumb/Thumb.js +3 -2
- package/cjs/components/Slider/ui/Thumb/Thumb.js.map +1 -1
- package/cjs/components/Slider/ui/Thumb/Thumb.styles.js +1 -1
- package/cjs/components/Slider/ui/Thumb/Thumb.styles.js.map +1 -1
- package/cjs/components/Slider/ui/Thumb/Thumb.styles_uyn20e.css +1 -0
- package/cjs/components/Slider/utils/index.js +28 -10
- package/cjs/components/Slider/utils/index.js.map +1 -1
- package/cjs/components/Slider/variations/_view/base.js +1 -1
- package/cjs/components/Slider/variations/_view/base.js.map +1 -1
- package/cjs/components/Slider/variations/_view/base_1s3f6q8.css +1 -0
- package/cjs/index.css +16 -14
- package/cjs/utils/index.js.map +1 -1
- package/emotion/cjs/components/NumberInput/NumberInput.tokens.js +2 -1
- package/emotion/cjs/components/NumberInput/ui/Input/Input.js +2 -2
- package/emotion/cjs/components/NumberInput/variations/_segmentation/base.js +1 -1
- package/emotion/cjs/components/Slider/Slider.js +10 -2
- package/emotion/cjs/components/Slider/Slider.template-doc.mdx +26 -0
- package/emotion/cjs/components/Slider/Slider.tokens.js +23 -17
- package/emotion/cjs/components/Slider/components/Double/Double.js +54 -19
- package/emotion/cjs/components/Slider/components/Single/Single.js +64 -33
- package/emotion/cjs/components/Slider/components/Single/Single.styles.js +18 -9
- package/emotion/cjs/components/Slider/components/SliderBase/SliderBase.js +31 -12
- package/emotion/cjs/components/Slider/components/SliderBase/SliderBase.styles.js +10 -10
- package/emotion/cjs/components/Slider/ui/Handler/Handler.js +52 -88
- package/emotion/cjs/components/Slider/ui/Handler/Handler.styles.js +9 -15
- package/emotion/cjs/components/Slider/ui/Handler/computeKeyPressData.js +121 -0
- package/emotion/cjs/components/Slider/ui/Thumb/Thumb.js +3 -2
- package/emotion/cjs/components/Slider/ui/Thumb/Thumb.styles.js +3 -3
- package/emotion/cjs/components/Slider/utils/index.js +28 -10
- package/emotion/cjs/components/Slider/variations/_view/base.js +2 -1
- package/emotion/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +16 -16
- package/emotion/cjs/examples/plasma_b2c/components/Slider/Slider.config.js +7 -7
- package/emotion/cjs/examples/plasma_b2c/components/Slider/Slider.stories.tsx +98 -16
- package/emotion/cjs/examples/plasma_web/components/NumberInput/NumberInput.config.js +16 -16
- package/emotion/cjs/examples/plasma_web/components/Slider/Slider.config.js +7 -7
- package/emotion/cjs/examples/plasma_web/components/Slider/Slider.stories.tsx +98 -15
- package/emotion/es/components/NumberInput/NumberInput.tokens.js +2 -1
- package/emotion/es/components/NumberInput/ui/Input/Input.js +2 -2
- package/emotion/es/components/NumberInput/variations/_segmentation/base.js +1 -1
- package/emotion/es/components/Slider/Slider.js +11 -2
- package/emotion/es/components/Slider/Slider.template-doc.mdx +26 -0
- package/emotion/es/components/Slider/Slider.tokens.js +23 -17
- package/emotion/es/components/Slider/components/Double/Double.js +54 -19
- package/emotion/es/components/Slider/components/Single/Single.js +65 -34
- package/emotion/es/components/Slider/components/Single/Single.styles.js +17 -8
- package/emotion/es/components/Slider/components/SliderBase/SliderBase.js +31 -12
- package/emotion/es/components/Slider/components/SliderBase/SliderBase.styles.js +11 -11
- package/emotion/es/components/Slider/ui/Handler/Handler.js +51 -86
- package/emotion/es/components/Slider/ui/Handler/Handler.styles.js +10 -16
- package/emotion/es/components/Slider/ui/Handler/computeKeyPressData.js +115 -0
- package/emotion/es/components/Slider/ui/Thumb/Thumb.js +3 -2
- package/emotion/es/components/Slider/ui/Thumb/Thumb.styles.js +3 -3
- package/emotion/es/components/Slider/utils/index.js +28 -10
- package/emotion/es/components/Slider/variations/_view/base.js +2 -1
- package/emotion/es/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +16 -16
- package/emotion/es/examples/plasma_b2c/components/Slider/Slider.config.js +7 -7
- package/emotion/es/examples/plasma_b2c/components/Slider/Slider.stories.tsx +98 -16
- package/emotion/es/examples/plasma_web/components/NumberInput/NumberInput.config.js +16 -16
- package/emotion/es/examples/plasma_web/components/Slider/Slider.config.js +7 -7
- package/emotion/es/examples/plasma_web/components/Slider/Slider.stories.tsx +98 -15
- package/es/components/NumberInput/NumberInput.css +1 -1
- package/es/components/NumberInput/NumberInput.tokens.js +2 -1
- package/es/components/NumberInput/NumberInput.tokens.js.map +1 -1
- package/es/components/NumberInput/ui/Input/Input.js +2 -2
- package/es/components/NumberInput/ui/Input/Input.js.map +1 -1
- package/es/components/NumberInput/variations/_segmentation/base.js +1 -1
- package/es/components/NumberInput/variations/_segmentation/base.js.map +1 -1
- package/es/components/NumberInput/variations/_segmentation/base_3r9a58.css +1 -0
- package/es/components/Slider/Slider.css +15 -13
- package/es/components/Slider/Slider.js +11 -2
- package/es/components/Slider/Slider.js.map +1 -1
- package/es/components/Slider/Slider.tokens.js +23 -17
- package/es/components/Slider/Slider.tokens.js.map +1 -1
- package/es/components/Slider/components/Double/Double.css +8 -8
- package/es/components/Slider/components/Double/Double.js +54 -19
- package/es/components/Slider/components/Double/Double.js.map +1 -1
- package/es/components/Slider/components/DoubleUncontrolled/DoubleUncontrolled.css +98 -0
- package/es/components/Slider/components/Single/Single.css +14 -14
- package/es/components/Slider/components/Single/Single.js +65 -34
- package/es/components/Slider/components/Single/Single.js.map +1 -1
- package/es/components/Slider/components/Single/Single.styles.js +4 -4
- package/es/components/Slider/components/Single/Single.styles.js.map +1 -1
- package/es/components/Slider/components/Single/Single.styles_1h7n2s2.css +6 -0
- package/es/components/Slider/components/SliderBase/SliderBase.css +5 -5
- package/es/components/Slider/components/SliderBase/SliderBase.js +31 -12
- package/es/components/Slider/components/SliderBase/SliderBase.js.map +1 -1
- package/es/components/Slider/components/SliderBase/SliderBase.styles.js +7 -7
- package/es/components/Slider/components/SliderBase/SliderBase.styles.js.map +1 -1
- package/es/components/Slider/components/SliderBase/SliderBase.styles_1qt1224.css +5 -0
- package/es/components/Slider/ui/Handler/Handler.css +3 -3
- package/es/components/Slider/ui/Handler/Handler.js +48 -87
- package/es/components/Slider/ui/Handler/Handler.js.map +1 -1
- package/es/components/Slider/ui/Handler/Handler.styles.js +17 -7
- package/es/components/Slider/ui/Handler/Handler.styles.js.map +1 -1
- package/es/components/Slider/ui/Handler/Handler.styles_irtcgm.css +2 -0
- package/es/components/Slider/ui/Handler/computeKeyPressData.js +118 -0
- package/es/components/Slider/ui/Handler/computeKeyPressData.js.map +1 -0
- package/es/components/Slider/ui/Thumb/Thumb.css +1 -1
- package/es/components/Slider/ui/Thumb/Thumb.js +3 -2
- package/es/components/Slider/ui/Thumb/Thumb.js.map +1 -1
- package/es/components/Slider/ui/Thumb/Thumb.styles.js +1 -1
- package/es/components/Slider/ui/Thumb/Thumb.styles.js.map +1 -1
- package/es/components/Slider/ui/Thumb/Thumb.styles_uyn20e.css +1 -0
- package/es/components/Slider/utils/index.js +28 -10
- package/es/components/Slider/utils/index.js.map +1 -1
- package/es/components/Slider/variations/_view/base.js +1 -1
- package/es/components/Slider/variations/_view/base.js.map +1 -1
- package/es/components/Slider/variations/_view/base_1s3f6q8.css +1 -0
- package/es/index.css +16 -14
- package/es/utils/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/NumberInput/NumberInput.tokens.js +2 -1
- package/styled-components/cjs/components/NumberInput/ui/Input/Input.js +2 -2
- package/styled-components/cjs/components/NumberInput/variations/_segmentation/base.js +1 -1
- package/styled-components/cjs/components/Slider/Slider.js +10 -2
- package/styled-components/cjs/components/Slider/Slider.template-doc.mdx +26 -0
- package/styled-components/cjs/components/Slider/Slider.tokens.js +23 -17
- package/styled-components/cjs/components/Slider/components/Double/Double.js +54 -19
- package/styled-components/cjs/components/Slider/components/Single/Single.js +64 -33
- package/styled-components/cjs/components/Slider/components/Single/Single.styles.js +6 -6
- package/styled-components/cjs/components/Slider/components/SliderBase/SliderBase.js +31 -12
- package/styled-components/cjs/components/Slider/components/SliderBase/SliderBase.styles.js +6 -6
- package/styled-components/cjs/components/Slider/ui/Handler/Handler.js +52 -88
- package/styled-components/cjs/components/Slider/ui/Handler/Handler.styles.js +7 -4
- package/styled-components/cjs/components/Slider/ui/Handler/computeKeyPressData.js +121 -0
- package/styled-components/cjs/components/Slider/ui/Thumb/Thumb.js +3 -2
- package/styled-components/cjs/components/Slider/ui/Thumb/Thumb.styles.js +2 -2
- package/styled-components/cjs/components/Slider/utils/index.js +28 -10
- package/styled-components/cjs/components/Slider/variations/_view/base.js +2 -1
- package/styled-components/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +4 -4
- package/styled-components/cjs/examples/plasma_b2c/components/Slider/Slider.config.js +3 -3
- package/styled-components/cjs/examples/plasma_b2c/components/Slider/Slider.stories.tsx +98 -16
- package/styled-components/cjs/examples/plasma_web/components/NumberInput/NumberInput.config.js +4 -4
- package/styled-components/cjs/examples/plasma_web/components/Slider/Slider.config.js +3 -3
- package/styled-components/cjs/examples/plasma_web/components/Slider/Slider.stories.tsx +98 -15
- package/styled-components/es/components/NumberInput/NumberInput.tokens.js +2 -1
- package/styled-components/es/components/NumberInput/ui/Input/Input.js +2 -2
- package/styled-components/es/components/NumberInput/variations/_segmentation/base.js +1 -1
- package/styled-components/es/components/Slider/Slider.js +11 -2
- package/styled-components/es/components/Slider/Slider.template-doc.mdx +26 -0
- package/styled-components/es/components/Slider/Slider.tokens.js +23 -17
- package/styled-components/es/components/Slider/components/Double/Double.js +54 -19
- package/styled-components/es/components/Slider/components/Single/Single.js +65 -34
- package/styled-components/es/components/Slider/components/Single/Single.styles.js +5 -5
- package/styled-components/es/components/Slider/components/SliderBase/SliderBase.js +31 -12
- package/styled-components/es/components/Slider/components/SliderBase/SliderBase.styles.js +7 -7
- package/styled-components/es/components/Slider/ui/Handler/Handler.js +51 -86
- package/styled-components/es/components/Slider/ui/Handler/Handler.styles.js +8 -5
- package/styled-components/es/components/Slider/ui/Handler/computeKeyPressData.js +115 -0
- package/styled-components/es/components/Slider/ui/Thumb/Thumb.js +3 -2
- package/styled-components/es/components/Slider/ui/Thumb/Thumb.styles.js +2 -2
- package/styled-components/es/components/Slider/utils/index.js +28 -10
- package/styled-components/es/components/Slider/variations/_view/base.js +2 -1
- package/styled-components/es/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +4 -4
- package/styled-components/es/examples/plasma_b2c/components/Slider/Slider.config.js +3 -3
- package/styled-components/es/examples/plasma_b2c/components/Slider/Slider.stories.tsx +98 -16
- package/styled-components/es/examples/plasma_web/components/NumberInput/NumberInput.config.js +4 -4
- package/styled-components/es/examples/plasma_web/components/Slider/Slider.config.js +3 -3
- package/styled-components/es/examples/plasma_web/components/Slider/Slider.stories.tsx +98 -15
- package/types/components/NumberInput/NumberInput.tokens.d.ts +2 -1
- package/types/components/NumberInput/NumberInput.tokens.d.ts.map +1 -1
- package/types/components/NumberInput/ui/Input/Input.d.ts.map +1 -1
- package/types/components/NumberInput/variations/_segmentation/base.d.ts.map +1 -1
- package/types/components/Slider/Slider.d.ts.map +1 -1
- package/types/components/Slider/Slider.tokens.d.ts +22 -16
- package/types/components/Slider/Slider.tokens.d.ts.map +1 -1
- package/types/components/Slider/components/Double/Double.d.ts.map +1 -1
- package/types/components/Slider/components/Double/Double.types.d.ts +1 -0
- package/types/components/Slider/components/Double/Double.types.d.ts.map +1 -1
- package/types/components/Slider/components/Single/Single.d.ts.map +1 -1
- package/types/components/Slider/components/Single/Single.styles.d.ts +1 -1
- package/types/components/Slider/components/Single/Single.styles.d.ts.map +1 -1
- package/types/components/Slider/components/Single/Single.types.d.ts +79 -7
- package/types/components/Slider/components/Single/Single.types.d.ts.map +1 -1
- package/types/components/Slider/components/SliderBase/SliderBase.d.ts.map +1 -1
- package/types/components/Slider/components/SliderBase/SliderBase.styles.d.ts +1 -1
- package/types/components/Slider/components/SliderBase/SliderBase.styles.d.ts.map +1 -1
- package/types/components/Slider/components/SliderBase/SliderBase.types.d.ts +6 -0
- package/types/components/Slider/components/SliderBase/SliderBase.types.d.ts.map +1 -1
- package/types/components/Slider/ui/Handler/Handler.d.ts.map +1 -1
- package/types/components/Slider/ui/Handler/Handler.styles.d.ts +6 -2
- package/types/components/Slider/ui/Handler/Handler.styles.d.ts.map +1 -1
- package/types/components/Slider/ui/Handler/Handler.types.d.ts +5 -1
- package/types/components/Slider/ui/Handler/Handler.types.d.ts.map +1 -1
- package/types/components/Slider/ui/Handler/computeKeyPressData.d.ts +12 -0
- package/types/components/Slider/ui/Handler/computeKeyPressData.d.ts.map +1 -0
- package/types/components/Slider/ui/Thumb/Thumb.d.ts +1 -1
- package/types/components/Slider/ui/Thumb/Thumb.d.ts.map +1 -1
- package/types/components/Slider/ui/Thumb/Thumb.styles.d.ts.map +1 -1
- package/types/components/Slider/ui/Thumb/Thumb.types.d.ts +1 -0
- package/types/components/Slider/ui/Thumb/Thumb.types.d.ts.map +1 -1
- package/types/components/Slider/utils/index.d.ts +26 -8
- package/types/components/Slider/utils/index.d.ts.map +1 -1
- package/types/components/Slider/variations/_view/base.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/NumberInput/NumberInput.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Slider/Slider.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Slider/Slider.d.ts +80 -2
- package/types/examples/plasma_b2c/components/Slider/Slider.d.ts.map +1 -1
- package/types/examples/plasma_web/components/NumberInput/NumberInput.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Slider/Slider.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Slider/Slider.d.ts +80 -2
- package/types/examples/plasma_web/components/Slider/Slider.d.ts.map +1 -1
- package/types/utils/index.d.ts +1 -1
- package/types/utils/index.d.ts.map +1 -1
- package/cjs/components/NumberInput/variations/_segmentation/base_1jt83uh.css +0 -1
- package/cjs/components/Slider/components/Single/Single.styles_1r9f1e0.css +0 -6
- package/cjs/components/Slider/components/SliderBase/SliderBase.styles_9s4eb3.css +0 -5
- package/cjs/components/Slider/ui/Handler/Handler.styles_8crx5z.css +0 -2
- package/cjs/components/Slider/ui/Thumb/Thumb.styles_4w4gzn.css +0 -1
- package/cjs/components/Slider/variations/_view/base_x642ct.css +0 -1
- package/es/components/NumberInput/variations/_segmentation/base_1jt83uh.css +0 -1
- package/es/components/Slider/components/Single/Single.styles_1r9f1e0.css +0 -6
- package/es/components/Slider/components/SliderBase/SliderBase.styles_9s4eb3.css +0 -5
- package/es/components/Slider/ui/Handler/Handler.styles_8crx5z.css +0 -2
- package/es/components/Slider/ui/Thumb/Thumb.styles_4w4gzn.css +0 -1
- package/es/components/Slider/variations/_view/base_x642ct.css +0 -1
@@ -4,14 +4,18 @@ import styled from 'styled-components';
|
|
4
4
|
import { disableProps } from '@salutejs/plasma-sb-utils';
|
5
5
|
import type { StoryObj, Meta } from '@storybook/react';
|
6
6
|
|
7
|
+
import { IconMic } from '../../../../components/_Icon';
|
7
8
|
import { WithTheme } from '../../../_helpers';
|
8
9
|
|
9
10
|
import { Slider } from './Slider';
|
10
11
|
|
11
12
|
const sizes = ['l', 'm', 's'];
|
13
|
+
const pointerSizes = ['small', 'large', 'none'];
|
12
14
|
const views = ['default', 'accent', 'gradient'];
|
13
|
-
const
|
14
|
-
const
|
15
|
+
const sliderAligns = ['center', 'left', 'right', 'none'];
|
16
|
+
const labelPlacements = ['top', 'left'];
|
17
|
+
const scaleAligns = ['side', 'bottom'];
|
18
|
+
const orientations: Array<string> = ['vertical', 'horizontal'];
|
15
19
|
|
16
20
|
const meta: Meta<typeof Slider> = {
|
17
21
|
title: 'plasma_web/Slider',
|
@@ -30,9 +34,24 @@ const meta: Meta<typeof Slider> = {
|
|
30
34
|
type: 'inline-radio',
|
31
35
|
},
|
32
36
|
},
|
37
|
+
pointerSize: {
|
38
|
+
options: pointerSizes,
|
39
|
+
control: {
|
40
|
+
type: 'inline-radio',
|
41
|
+
},
|
42
|
+
},
|
43
|
+
orientation: {
|
44
|
+
options: orientations,
|
45
|
+
control: {
|
46
|
+
type: 'select',
|
47
|
+
},
|
48
|
+
},
|
33
49
|
...disableProps([
|
34
50
|
'value',
|
35
51
|
'onChangeCommitted',
|
52
|
+
'onChangeTextField',
|
53
|
+
'onBlurTextField',
|
54
|
+
'onKeyDownTextField',
|
36
55
|
'ariaLabel',
|
37
56
|
'onChange',
|
38
57
|
'fontSizeMultiplier',
|
@@ -40,6 +59,14 @@ const meta: Meta<typeof Slider> = {
|
|
40
59
|
'settings',
|
41
60
|
'hasHoverAnimation',
|
42
61
|
'type',
|
62
|
+
'labelContentLeft',
|
63
|
+
'rangeValuesPlacement',
|
64
|
+
'name',
|
65
|
+
'defaultValue',
|
66
|
+
'labelContent',
|
67
|
+
'showRangeValues',
|
68
|
+
'hideMinValueDiff',
|
69
|
+
'hideMaxValueDiff',
|
43
70
|
]),
|
44
71
|
},
|
45
72
|
};
|
@@ -52,8 +79,9 @@ type StorySingleProps = StoryProps;
|
|
52
79
|
type StorySingle = StoryObj<StorySingleProps>;
|
53
80
|
type StoryDouble = StoryObj<StoryProps>;
|
54
81
|
|
55
|
-
const SliderWrapper = styled.div
|
56
|
-
width: 25rem;
|
82
|
+
const SliderWrapper = styled.div<{ isVertical?: boolean }>`
|
83
|
+
width: ${({ isVertical }) => (isVertical ? 'auto' : '25rem')};
|
84
|
+
height: ${({ isVertical }) => (isVertical ? '25rem' : 'auto')};
|
57
85
|
`;
|
58
86
|
|
59
87
|
const StoryDefault = (args: StorySingleProps) => {
|
@@ -67,41 +95,86 @@ const StoryDefault = (args: StorySingleProps) => {
|
|
67
95
|
setValue(values);
|
68
96
|
};
|
69
97
|
|
98
|
+
const { hasIcon, showIcon, orientation, labelPlacement, labelVerticalPlacement, ...rest } = args;
|
99
|
+
const isVertical = orientation === 'vertical';
|
100
|
+
|
70
101
|
return (
|
71
|
-
<SliderWrapper>
|
72
|
-
<Slider
|
102
|
+
<SliderWrapper isVertical={isVertical}>
|
103
|
+
<Slider
|
104
|
+
value={value}
|
105
|
+
orientation={orientation}
|
106
|
+
labelPlacement={labelPlacement}
|
107
|
+
labelContent={showIcon ? <IconMic size={rest.size === 's' ? 'xs' : 's'} /> : null}
|
108
|
+
onChangeCommitted={onChangeCommittedHandle}
|
109
|
+
onChange={onChangeHandle}
|
110
|
+
{...rest}
|
111
|
+
/>
|
73
112
|
</SliderWrapper>
|
74
113
|
);
|
75
114
|
};
|
76
115
|
|
77
116
|
export const Default: StorySingle = {
|
78
117
|
argTypes: {
|
118
|
+
sliderAlign: {
|
119
|
+
options: sliderAligns,
|
120
|
+
control: {
|
121
|
+
type: 'inline-radio',
|
122
|
+
},
|
123
|
+
if: { arg: 'orientation', eq: 'vertical' },
|
124
|
+
},
|
79
125
|
labelPlacement: {
|
80
126
|
options: labelPlacements,
|
81
127
|
control: {
|
82
128
|
type: 'inline-radio',
|
83
129
|
},
|
130
|
+
if: { arg: 'orientation', eq: 'horizontal' },
|
131
|
+
},
|
132
|
+
labelReversed: {
|
133
|
+
control: {
|
134
|
+
type: 'boolean',
|
135
|
+
expanded: true,
|
136
|
+
},
|
137
|
+
if: { arg: 'orientation', eq: 'vertical' },
|
138
|
+
},
|
139
|
+
scaleAlign: {
|
140
|
+
options: scaleAligns,
|
141
|
+
control: {
|
142
|
+
type: 'inline-radio',
|
143
|
+
},
|
144
|
+
if: { arg: 'orientation', eq: 'horizontal' },
|
84
145
|
},
|
85
|
-
|
86
|
-
options:
|
146
|
+
orientation: {
|
147
|
+
options: orientations,
|
87
148
|
control: {
|
88
149
|
type: 'inline-radio',
|
89
150
|
},
|
90
151
|
},
|
152
|
+
reversed: {
|
153
|
+
control: {
|
154
|
+
type: 'boolean',
|
155
|
+
},
|
156
|
+
if: { arg: 'orientation', eq: 'vertical' },
|
157
|
+
},
|
91
158
|
},
|
92
159
|
args: {
|
93
160
|
view: 'default',
|
94
161
|
size: 'm',
|
162
|
+
pointerSize: 'small',
|
95
163
|
min: 0,
|
96
164
|
max: 100,
|
97
|
-
|
98
|
-
ariaLabel: 'Цена
|
165
|
+
orientation: 'horizontal',
|
166
|
+
ariaLabel: 'Цена микрофона',
|
99
167
|
multipleStepSize: 10,
|
100
|
-
label: 'Цена
|
101
|
-
labelPlacement: '
|
102
|
-
|
103
|
-
|
168
|
+
label: 'Цена микрофона',
|
169
|
+
labelPlacement: 'top',
|
170
|
+
sliderAlign: 'center',
|
171
|
+
scaleAlign: 'bottom',
|
172
|
+
showScale: true,
|
104
173
|
showCurrentValue: false,
|
174
|
+
showIcon: true,
|
175
|
+
reversed: false,
|
176
|
+
labelReversed: false,
|
177
|
+
disabled: false,
|
105
178
|
},
|
106
179
|
render: (args) => <StoryDefault {...args} />,
|
107
180
|
};
|
@@ -141,7 +214,7 @@ const StoryMultipleValues = (args: StoryProps) => {
|
|
141
214
|
};
|
142
215
|
|
143
216
|
return (
|
144
|
-
<SliderWrapper>
|
217
|
+
<SliderWrapper isVertical={args.orientation === 'vertical'}>
|
145
218
|
<Slider
|
146
219
|
value={value}
|
147
220
|
onKeyDownTextField={onKeyDownTextField}
|
@@ -158,6 +231,7 @@ export const MultipleValues: StoryDouble = {
|
|
158
231
|
args: {
|
159
232
|
view: 'default',
|
160
233
|
size: 'm',
|
234
|
+
pointerSize: 'small',
|
161
235
|
min: 0,
|
162
236
|
max: 100,
|
163
237
|
disabled: false,
|
@@ -165,5 +239,14 @@ export const MultipleValues: StoryDouble = {
|
|
165
239
|
ariaLabel: ['Минимальная цена товара', 'Максимальная цена товара'],
|
166
240
|
multipleStepSize: 10,
|
167
241
|
},
|
242
|
+
argTypes: {
|
243
|
+
pointerSize: {
|
244
|
+
options: ['small', 'large'],
|
245
|
+
control: {
|
246
|
+
type: 'inline-radio',
|
247
|
+
},
|
248
|
+
},
|
249
|
+
...disableProps(['orientation']),
|
250
|
+
},
|
168
251
|
render: (args) => <StoryMultipleValues {...args} />,
|
169
252
|
};
|
@@ -23,11 +23,12 @@ export var tokens = {
|
|
23
23
|
disabledOpacity: '--plasma-number-input_disabled-opacity',
|
24
24
|
// Action button view tokens
|
25
25
|
iconButtonColor: '--plasma-number-input_icon-button_color',
|
26
|
-
iconButtonColorSolidHover: '--plasma-number-input_icon-button_color_solid-hover',
|
27
26
|
iconButtonBackgroundColor: '--plasma-number-input_icon-button_background-color',
|
28
27
|
iconButtonColorHover: '--plasma-number-input_icon-button_color-hover',
|
28
|
+
iconButtonColorSolidHover: '--plasma-number-input_icon-button_color_solid-hover',
|
29
29
|
iconButtonBackgroundColorHover: '--plasma-number-input_icon-button_background-color-hover',
|
30
30
|
iconButtonColorActive: '--plasma-number-input_icon-button_color-active',
|
31
|
+
iconButtonColorSolidActive: '--plasma-number-input_icon-button_color_solid-active',
|
31
32
|
iconButtonBackgroundColorActive: '--plasma-number-input_icon-button_background-color-active',
|
32
33
|
actionButtonDisabledOpacity: '--plasma-number-input_action-button_disabled-opacity',
|
33
34
|
// Action button size tokens
|
@@ -176,7 +176,7 @@ export var NumberInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
176
176
|
onClick: handleClickInputWrapper
|
177
177
|
}, /*#__PURE__*/React.createElement(TextWrapper, {
|
178
178
|
ref: textWrapperRef
|
179
|
-
}, textBefore && /*#__PURE__*/React.createElement(AdditionalText, {
|
179
|
+
}, !isLoading && textBefore && /*#__PURE__*/React.createElement(AdditionalText, {
|
180
180
|
className: classes.textBefore
|
181
181
|
}, textBefore), isLoading ? /*#__PURE__*/React.createElement(Loader, null, loader || _StyledSpinner || (_StyledSpinner = /*#__PURE__*/React.createElement(StyledSpinner, null))) : /*#__PURE__*/React.createElement(DynamicInput, null, /*#__PURE__*/React.createElement(Input, _extends({
|
182
182
|
ref: inputForkRef,
|
@@ -192,7 +192,7 @@ export var NumberInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
192
192
|
}
|
193
193
|
}, rest)), /*#__PURE__*/React.createElement(InputWidthHelper, {
|
194
194
|
ref: inputHelperRef
|
195
|
-
}, value)), textAfter && /*#__PURE__*/React.createElement(AdditionalText, {
|
195
|
+
}, value)), !isLoading && textAfter && /*#__PURE__*/React.createElement(AdditionalText, {
|
196
196
|
className: classes.textAfter
|
197
197
|
}, textAfter)));
|
198
198
|
});
|
@@ -3,4 +3,4 @@ import { classes, privateTokens, tokens } from '../../NumberInput.tokens';
|
|
3
3
|
import { StyledIconButton } from '../../ui/ActionButton/ActionButton.styles';
|
4
4
|
import { AdditionalText, Input, InputWrapper, StyledSpinner } from '../../ui/Input/Input.styles';
|
5
5
|
import { spinnerTokens } from '../../../Spinner';
|
6
|
-
export var base = /*#__PURE__*/css(InputWrapper, "{border-radius:var(", tokens.inputWrapperBorderRadius, ");}", StyledIconButton, "{", privateTokens.segmentationBorderRadius, ":var(", tokens.iconButtonRadius, ");&.", classes.segmentedView, ",&.", classes.solidView, "{", privateTokens.segmentationBorderRadius, ":var(", tokens.iconButtonSegmentationRadius, ", var(", tokens.iconButtonRadius, "));}&.", classes.actionButtonDecrement, "{border-radius:var(", tokens.iconButtonRadius, ") var(", privateTokens.segmentationBorderRadius, ") var(", privateTokens.segmentationBorderRadius, ") var(", tokens.iconButtonRadius, ");}&.", classes.actionButtonIncrement, "{border-radius:var(", privateTokens.segmentationBorderRadius, ") var(", tokens.iconButtonRadius, ") var(", tokens.iconButtonRadius, ") var(", privateTokens.segmentationBorderRadius, ");}}&.", classes.segmentedView, "{", InputWrapper, "{border-radius:var(", tokens.iconButtonSegmentationRadius, ");}}&.", classes.solidView, "{position:relative;&:before{content:'';position:absolute;top:0;left:50%;transform:translateX(-50%);width:calc(100% - var(", tokens.iconButtonWidth, ") * 2);height:100%;background:var(", tokens.backgroundColorSolid, ");}", InputWrapper, "{position:relative;color:var(", tokens.colorSolid, ");&:not(", classes.errorAnimation, ").", classes.manualInput, ":focus-within{background-color:var(", tokens.backgroundColorSolidFocus, ");box-shadow:inset 0 0 0 var(", tokens.inputWrapperBorderWidth, ") var(", tokens.borderColorSolidFocus, ");}}", StyledIconButton, "{:hover,:active{background-color:var(", tokens.iconButtonBackgroundColor, ");color:var(", tokens.iconButtonColorSolidHover, ");}&.", classes.actionButtonDecrementDisabled, ",&.", classes.actionButtonIncrementDisabled, "{opacity:1;svg{opacity:var(", tokens.actionButtonDisabledOpacity, ");}:hover,:active{color:var(", tokens.iconButtonColor, ");svg{opacity:var(", tokens.actionButtonDisabledOpacity, ");}}}}&.", classes.clearView, "{", StyledIconButton, "{&.", classes.actionButtonDecrementDisabled, ",&.", classes.actionButtonIncrementDisabled, "{:hover,:active{background-color:transparent;}}}}", StyledSpinner, "{", spinnerTokens.color, ":var(", tokens.loaderSpinnerColorSolid, ");}", Input, "{caret-color:var(", tokens.caretColorSolid, ", var(", tokens.caretColor, "));&:not(.", classes.errorAnimation, "){color:var(", tokens.colorSolid, ");}}", AdditionalText, "{color:var(", tokens.additionalTextColorSolid, ");}};label:plasma-new-hope__base;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
6
|
+
export var base = /*#__PURE__*/css(InputWrapper, "{border-radius:var(", tokens.inputWrapperBorderRadius, ");}", StyledIconButton, "{", privateTokens.segmentationBorderRadius, ":var(", tokens.iconButtonRadius, ");&.", classes.segmentedView, ",&.", classes.solidView, "{", privateTokens.segmentationBorderRadius, ":var(", tokens.iconButtonSegmentationRadius, ", var(", tokens.iconButtonRadius, "));}&.", classes.actionButtonDecrement, "{border-radius:var(", tokens.iconButtonRadius, ") var(", privateTokens.segmentationBorderRadius, ") var(", privateTokens.segmentationBorderRadius, ") var(", tokens.iconButtonRadius, ");}&.", classes.actionButtonIncrement, "{border-radius:var(", privateTokens.segmentationBorderRadius, ") var(", tokens.iconButtonRadius, ") var(", tokens.iconButtonRadius, ") var(", privateTokens.segmentationBorderRadius, ");}}&.", classes.segmentedView, "{", InputWrapper, "{border-radius:var(", tokens.iconButtonSegmentationRadius, ");}}&.", classes.solidView, "{position:relative;&:before{content:'';position:absolute;top:0;left:50%;transform:translateX(-50%);width:calc(100% - var(", tokens.iconButtonWidth, ") * 2);height:100%;background:var(", tokens.backgroundColorSolid, ");}", InputWrapper, "{position:relative;color:var(", tokens.colorSolid, ");&:not(", classes.errorAnimation, ").", classes.manualInput, ":focus-within{background-color:var(", tokens.backgroundColorSolidFocus, ");box-shadow:inset 0 0 0 var(", tokens.inputWrapperBorderWidth, ") var(", tokens.borderColorSolidFocus, ");}}", StyledIconButton, "{:hover,:active{background-color:var(", tokens.iconButtonBackgroundColor, ");}:hover{color:var(", tokens.iconButtonColorSolidHover, ");}:active{color:var(", tokens.iconButtonColorSolidActive, ");}&.", classes.actionButtonDecrementDisabled, ",&.", classes.actionButtonIncrementDisabled, "{opacity:1;svg{opacity:var(", tokens.actionButtonDisabledOpacity, ");}:hover,:active{color:var(", tokens.iconButtonColor, ");svg{opacity:var(", tokens.actionButtonDisabledOpacity, ");}}}}&.", classes.clearView, "{", StyledIconButton, "{&.", classes.actionButtonDecrementDisabled, ",&.", classes.actionButtonIncrementDisabled, "{:hover,:active{background-color:transparent;}}}}", StyledSpinner, "{", spinnerTokens.color, ":var(", tokens.loaderSpinnerColorSolid, ");}", Input, "{caret-color:var(", tokens.caretColorSolid, ", var(", tokens.caretColor, "));&:not(.", classes.errorAnimation, "){color:var(", tokens.colorSolid, ");}}", AdditionalText, "{color:var(", tokens.additionalTextColorSolid, ");}};label:plasma-new-hope__base;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvTnVtYmVySW5wdXQvdmFyaWF0aW9ucy9fc2VnbWVudGF0aW9uL2Jhc2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBT3VCIiwiZmlsZSI6Ii4uLy4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvTnVtYmVySW5wdXQvdmFyaWF0aW9ucy9fc2VnbWVudGF0aW9uL2Jhc2UudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmltcG9ydCB7IGNsYXNzZXMsIHByaXZhdGVUb2tlbnMsIHRva2VucyB9IGZyb20gJy4uLy4uL051bWJlcklucHV0LnRva2Vucyc7XG5pbXBvcnQgeyBTdHlsZWRJY29uQnV0dG9uIH0gZnJvbSAnLi4vLi4vdWkvQWN0aW9uQnV0dG9uL0FjdGlvbkJ1dHRvbi5zdHlsZXMnO1xuaW1wb3J0IHsgQWRkaXRpb25hbFRleHQsIElucHV0LCBJbnB1dFdyYXBwZXIsIFN0eWxlZFNwaW5uZXIgfSBmcm9tICcuLi8uLi91aS9JbnB1dC9JbnB1dC5zdHlsZXMnO1xuaW1wb3J0IHsgc3Bpbm5lclRva2VucyB9IGZyb20gJy4uLy4uLy4uL1NwaW5uZXInO1xuXG5leHBvcnQgY29uc3QgYmFzZSA9IGNzc2BcbiAgICAke0lucHV0V3JhcHBlcn0ge1xuICAgICAgICBib3JkZXItcmFkaXVzOiB2YXIoJHt0b2tlbnMuaW5wdXRXcmFwcGVyQm9yZGVyUmFkaXVzfSk7XG4gICAgfVxuXG4gICAgJHtTdHlsZWRJY29uQnV0dG9ufSB7XG4gICAgICAgICR7cHJpdmF0ZVRva2Vucy5zZWdtZW50YXRpb25Cb3JkZXJSYWRpdXN9OiB2YXIoJHt0b2tlbnMuaWNvbkJ1dHRvblJhZGl1c30pO1xuXG4gICAgICAgICYuJHtjbGFzc2VzLnNlZ21lbnRlZFZpZXd9LCAmLiR7Y2xhc3Nlcy5zb2xpZFZpZXd9IHtcbiAgICAgICAgICAgICR7cHJpdmF0ZVRva2Vucy5zZWdtZW50YXRpb25Cb3JkZXJSYWRpdXN9OiB2YXIoJHt0b2tlbnMuaWNvbkJ1dHRvblNlZ21lbnRhdGlvblJhZGl1c30sIHZhcigke3Rva2Vucy5pY29uQnV0dG9uUmFkaXVzfSkpO1xuICAgICAgICB9XG5cbiAgICAgICAgJi4ke2NsYXNzZXMuYWN0aW9uQnV0dG9uRGVjcmVtZW50fSB7XG4gICAgICAgICAgICBib3JkZXItcmFkaXVzOiB2YXIoJHt0b2tlbnMuaWNvbkJ1dHRvblJhZGl1c30pIHZhcigke3ByaXZhdGVUb2tlbnMuc2VnbWVudGF0aW9uQm9yZGVyUmFkaXVzfSkgdmFyKCR7cHJpdmF0ZVRva2Vucy5zZWdtZW50YXRpb25Cb3JkZXJSYWRpdXN9KSB2YXIoJHt0b2tlbnMuaWNvbkJ1dHRvblJhZGl1c30pO1xuICAgICAgICB9XG5cbiAgICAgICAgJi4ke2NsYXNzZXMuYWN0aW9uQnV0dG9uSW5jcmVtZW50fSB7XG4gICAgICAgICAgICBib3JkZXItcmFkaXVzOiB2YXIoJHtwcml2YXRlVG9rZW5zLnNlZ21lbnRhdGlvbkJvcmRlclJhZGl1c30pIHZhcigke3Rva2Vucy5pY29uQnV0dG9uUmFkaXVzfSkgdmFyKCR7dG9rZW5zLmljb25CdXR0b25SYWRpdXN9KSB2YXIoJHtwcml2YXRlVG9rZW5zLnNlZ21lbnRhdGlvbkJvcmRlclJhZGl1c30pO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgJi4ke2NsYXNzZXMuc2VnbWVudGVkVmlld30ge1xuICAgICAgICAke0lucHV0V3JhcHBlcn0ge1xuICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogdmFyKCR7dG9rZW5zLmljb25CdXR0b25TZWdtZW50YXRpb25SYWRpdXN9KTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgICYuJHtjbGFzc2VzLnNvbGlkVmlld30ge1xuICAgICAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG5cbiAgICAgICAgJjpiZWZvcmUge1xuICAgICAgICAgICAgY29udGVudDogJyc7XG4gICAgICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgICAgICAgICB0b3A6IDA7XG4gICAgICAgICAgICBsZWZ0OiA1MCU7XG4gICAgICAgICAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZVgoLTUwJSk7XG4gICAgICAgICAgICB3aWR0aDogY2FsYygxMDAlIC0gdmFyKCR7dG9rZW5zLmljb25CdXR0b25XaWR0aH0pICogMik7XG4gICAgICAgICAgICBoZWlnaHQ6IDEwMCU7XG4gICAgICAgICAgICBiYWNrZ3JvdW5kOiB2YXIoJHt0b2tlbnMuYmFja2dyb3VuZENvbG9yU29saWR9KTtcbiAgICAgICAgfVxuXG4gICAgICAgICR7SW5wdXRXcmFwcGVyfSB7XG4gICAgICAgICAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgICAgICAgICBjb2xvcjogdmFyKCR7dG9rZW5zLmNvbG9yU29saWR9KTtcbiAgICAgICAgICAgIFxuICAgICAgICAgICAgJjpub3QoJHtjbGFzc2VzLmVycm9yQW5pbWF0aW9ufSkuJHtjbGFzc2VzLm1hbnVhbElucHV0fTpmb2N1cy13aXRoaW4ge1xuICAgICAgICAgICAgICAgIGJhY2tncm91bmQtY29sb3I6IHZhcigke3Rva2Vucy5iYWNrZ3JvdW5kQ29sb3JTb2xpZEZvY3VzfSk7XG4gICAgICAgICAgICAgICAgYm94LXNoYWRvdzogaW5zZXQgMCAwIDAgdmFyKCR7dG9rZW5zLmlucHV0V3JhcHBlckJvcmRlcldpZHRofSkgdmFyKCR7dG9rZW5zLmJvcmRlckNvbG9yU29saWRGb2N1c30pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgJHtTdHlsZWRJY29uQnV0dG9ufSB7XG4gICAgICAgICAgICA6aG92ZXIsXG4gICAgICAgICAgICA6YWN0aXZlIHsgICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogdmFyKCR7dG9rZW5zLmljb25CdXR0b25CYWNrZ3JvdW5kQ29sb3J9KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgOmhvdmVyIHsgICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgY29sb3I6IHZhcigke3Rva2Vucy5pY29uQnV0dG9uQ29sb3JTb2xpZEhvdmVyfSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIDphY3RpdmUgeyAgICAgICAgICAgICAgICBcbiAgICAgICAgICAgICAgICBjb2xvcjogdmFyKCR7dG9rZW5zLmljb25CdXR0b25Db2xvclNvbGlkQWN0aXZlfSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICYuJHtjbGFzc2VzLmFjdGlvbkJ1dHRvbkRlY3JlbWVudERpc2FibGVkfSwgJi4ke2NsYXNzZXMuYWN0aW9uQnV0dG9uSW5jcmVtZW50RGlzYWJsZWR9IHtcbiAgICAgICAgICAgICAgICBvcGFjaXR5OiAxO1xuXG4gICAgICAgICAgICAgICAgc3ZnIHtcbiAgICAgICAgICAgICAgICAgICAgb3BhY2l0eTogdmFyKCR7dG9rZW5zLmFjdGlvbkJ1dHRvbkRpc2FibGVkT3BhY2l0eX0pO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIDpob3ZlcixcbiAgICAgICAgICAgICAgICA6YWN0aXZlIHtcbiAgICAgICAgICAgICAgICAgICAgY29sb3I6IHZhcigke3Rva2Vucy5pY29uQnV0dG9uQ29sb3J9KTtcblxuICAgICAgICAgICAgICAgICAgICBzdmcge1xuICAgICAgICAgICAgICAgICAgICAgICAgb3BhY2l0eTogdmFyKCR7dG9rZW5zLmFjdGlvbkJ1dHRvbkRpc2FibGVkT3BhY2l0eX0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgJi4ke2NsYXNzZXMuY2xlYXJWaWV3fSB7XG4gICAgICAgICAgICAke1N0eWxlZEljb25CdXR0b259IHtcbiAgICAgICAgICAgICAgICAmLiR7Y2xhc3Nlcy5hY3Rpb25CdXR0b25EZWNyZW1lbnREaXNhYmxlZH0sICYuJHtjbGFzc2VzLmFjdGlvbkJ1dHRvbkluY3JlbWVudERpc2FibGVkfSB7XG4gICAgICAgICAgICAgICAgICAgIDpob3ZlcixcbiAgICAgICAgICAgICAgICAgICAgOmFjdGl2ZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiB0cmFuc3BhcmVudDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgICR7U3R5bGVkU3Bpbm5lcn0ge1xuICAgICAgICAgICAgJHtzcGlubmVyVG9rZW5zLmNvbG9yfTogdmFyKCR7dG9rZW5zLmxvYWRlclNwaW5uZXJDb2xvclNvbGlkfSk7XG4gICAgICAgIH1cbiAgICBcbiAgICAgICAgJHtJbnB1dH0ge1xuICAgICAgICAgICAgY2FyZXQtY29sb3I6IHZhcigke3Rva2Vucy5jYXJldENvbG9yU29saWR9LCB2YXIoJHt0b2tlbnMuY2FyZXRDb2xvcn0pKTtcblxuICAgICAgICAgICAgJjpub3QoLiR7Y2xhc3Nlcy5lcnJvckFuaW1hdGlvbn0pe1xuICAgICAgICAgICAgICAgIGNvbG9yOiB2YXIoJHt0b2tlbnMuY29sb3JTb2xpZH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgXG4gICAgICAgICR7QWRkaXRpb25hbFRleHR9IHtcbiAgICAgICAgICAgIGNvbG9yOiB2YXIoJHt0b2tlbnMuYWRkaXRpb25hbFRleHRDb2xvclNvbGlkfSk7XG4gICAgICAgIH1cbiAgICB9XG5gO1xuIl19 */"));
|
@@ -4,10 +4,13 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
4
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
5
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
6
6
|
import React, { forwardRef } from 'react';
|
7
|
+
import { cx } from '../../utils';
|
7
8
|
import { base as viewCSS } from './variations/_view/base';
|
8
9
|
import { base as sizeCSS } from './variations/_size/base';
|
9
10
|
import { base as disabledCSS } from './variations/_disabled/base';
|
10
11
|
import { SingleSlider, DoubleUncontrolled } from './components';
|
12
|
+
import { classes } from './Slider.tokens';
|
13
|
+
|
11
14
|
// TODO: проверить, можно ли обойтись без каста типов
|
12
15
|
|
13
16
|
var isSingleValueProps = function isSingleValueProps(props, type) {
|
@@ -21,9 +24,15 @@ export var sliderRoot = function sliderRoot(Root) {
|
|
21
24
|
var _ref$type = _ref.type,
|
22
25
|
type = _ref$type === void 0 ? 'single' : _ref$type,
|
23
26
|
props = _objectWithoutProperties(_ref, _excluded);
|
24
|
-
|
27
|
+
if (isSingleValueProps(props, type)) {
|
28
|
+
return /*#__PURE__*/React.createElement(Root, _extends({}, props, {
|
29
|
+
className: cx(props.orientation === 'vertical' && classes.verticalOrientation, props.className),
|
30
|
+
ref: ref
|
31
|
+
}), /*#__PURE__*/React.createElement(SingleSlider, props));
|
32
|
+
}
|
33
|
+
return /*#__PURE__*/React.createElement(Root, _extends({
|
25
34
|
ref: ref
|
26
|
-
}
|
35
|
+
}, props), isDoubleValueProps(props, type) && /*#__PURE__*/React.createElement(DoubleUncontrolled, props));
|
27
36
|
});
|
28
37
|
};
|
29
38
|
export var sliderConfig = {
|
@@ -76,3 +76,29 @@ export function App() {
|
|
76
76
|
);
|
77
77
|
}
|
78
78
|
```
|
79
|
+
|
80
|
+
# Вертикальное отображение
|
81
|
+
|
82
|
+
```tsx live
|
83
|
+
import React from 'react';
|
84
|
+
import { Slider } from '@salutejs/{{ package }}';
|
85
|
+
import { IconMic } from '@salutejs/plasma-icons';
|
86
|
+
|
87
|
+
export function App() {
|
88
|
+
return (
|
89
|
+
<section style={{ height: '300px' }}>
|
90
|
+
<Slider
|
91
|
+
onChangeCommitted={() => {}}
|
92
|
+
min={0}
|
93
|
+
max={100}
|
94
|
+
value={30}
|
95
|
+
label="Громкость"
|
96
|
+
labelContent={<IconMic size="s" />}
|
97
|
+
orientation="vertical"
|
98
|
+
sliderAlign="center"
|
99
|
+
size="m"
|
100
|
+
/>
|
101
|
+
</section>
|
102
|
+
);
|
103
|
+
}
|
104
|
+
```
|
@@ -1,6 +1,12 @@
|
|
1
1
|
export var classes = {
|
2
2
|
labelPlacementOuter: 'slider-label-placement-outer',
|
3
3
|
labelPlacementInner: 'slider-label-placement-inner',
|
4
|
+
labelPlacementBottom: 'slider-label-placement-bottom',
|
5
|
+
labelAlignLeft: 'slider-label-align-left',
|
6
|
+
labelAlignCenter: 'slider-label-align-center',
|
7
|
+
labelAlignRight: 'slider-label-align-right',
|
8
|
+
labelAlignNone: 'slider-label-align-none',
|
9
|
+
labelContentReversed: 'slider-label-content-reversed',
|
4
10
|
rangeValuesPlacementOuter: 'slider-range-values-placement-outer',
|
5
11
|
rangeValuesPlacementInner: 'slider-range-values-placement-inner',
|
6
12
|
maxRangeValue: 'slider-max-range-value',
|
@@ -9,13 +15,17 @@ export var classes = {
|
|
9
15
|
textFieldActive: 'slider-text-field-active',
|
10
16
|
firstTextField: 'slider-first-text-field',
|
11
17
|
secondTextField: 'slider-second-text-field',
|
12
|
-
activeRangeValue: 'slider-active-range-value'
|
18
|
+
activeRangeValue: 'slider-active-range-value',
|
19
|
+
verticalOrientation: 'slider-vertical-orientation',
|
20
|
+
valuePlacementLeft: 'slider-value-placement-left',
|
21
|
+
reversed: 'slider-reversed'
|
13
22
|
};
|
14
23
|
export var tokens = {
|
15
|
-
|
24
|
+
size: '--plasma-slider-size',
|
16
25
|
labelWrapperGap: '--plasma-slider-label-wrapper-gap',
|
17
26
|
labelWrapperMarginBottom: '--plasma-slider-label-wrapper-margin-bottom',
|
18
27
|
labelWrapperMarginRight: '--plasma-slider-label-wrapper-margin-right',
|
28
|
+
labelWrapperVerticalMargin: '--plasma-slider-label-wrapper-vertical-margin',
|
19
29
|
labelColor: '--plasma-slider-label-color',
|
20
30
|
labelFontFamily: '--plasma-slider-label-font-family',
|
21
31
|
labelFontSize: '--plasma-slider-label-font-size',
|
@@ -23,31 +33,27 @@ export var tokens = {
|
|
23
33
|
labelFontWeight: '--plasma-slider-label-font-weight',
|
24
34
|
labelLetterSpacing: '--plasma-slider-label-letter-spacing',
|
25
35
|
labelLineHeight: '--plasma-slider-label-line-height',
|
26
|
-
rangeMinValueMargin: '--plasma-slider-range-min-value-margin',
|
27
|
-
rangeMaxValueMargin: '--plasma-slider-range-max-value-margin',
|
28
36
|
rangeValueBottomOffset: '--plasma-slider-range-value-bottom-offset',
|
37
|
+
rangeValueHorizontalMargin: '--plasma-slider-range-value-horizontal-margin',
|
38
|
+
rangeValueHorizontalOffset: '--plasma-slider-range-value-horizontal-offset',
|
39
|
+
rangeValueVerticalMargin: '--plasma-slider-range-value-vertical-margin',
|
29
40
|
rangeValueColor: '--plasma-slider-range-value-color',
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
41
|
+
valueFontFamily: '--plasma-slider-value-font-family',
|
42
|
+
valueFontSize: '--plasma-slider-value-font-size',
|
43
|
+
valueFontStyle: '--plasma-slider-value-font-style',
|
44
|
+
valueFontWeight: '--plasma-slider-value-font-weight',
|
45
|
+
valueLetterSpacing: '--plasma-slider-value-letter-spacing',
|
46
|
+
valueLineHeight: '--plasma-slider-value-line-height',
|
36
47
|
doubleWrapperGap: '--plasma-slider-double-wrapper-gap',
|
37
48
|
thumbSize: '--plasma-slider-thumb-size',
|
49
|
+
thumbSizeLarge: '--plasma-slider-thumb-size-large',
|
38
50
|
thumbBorder: '--plasma-slider-thumb-border',
|
39
51
|
thumbBorderColor: '--plasma-slider-thumb-border-color',
|
40
52
|
thumbBackgroundColor: '--plasma-slider-thumb-background-color',
|
41
53
|
thumbFocusBorderColor: '--plasma-slider-thumb-focus-border-color',
|
42
54
|
currentValueTopOffset: '--plasma-slider-current-value-top-offset',
|
43
|
-
currentValueFontFamily: '--plasma-slider-current-value-font-family',
|
44
|
-
currentValueFontSize: '--plasma-slider-current-value-font-size',
|
45
|
-
currentValueFontStyle: '--plasma-slider-current-value-font-style',
|
46
|
-
currentValueFontWeight: '--plasma-slider-current-value-font-weight',
|
47
|
-
currentValueLetterSpacing: '--plasma-slider-current-value-letter-spacing',
|
48
|
-
currentValueLineHeight: '--plasma-slider-current-value-line-height',
|
49
55
|
railBackgroundColor: '--plasma-slider-rail-background-color',
|
50
|
-
|
56
|
+
railThickness: '--plasma-slider-rail-thickness',
|
51
57
|
railBorderRadius: '--plasma-slider-rail-border-radius',
|
52
58
|
railIndent: '--plasma-slider-rail-indent',
|
53
59
|
fillColor: '--plasma-slider-fill-color',
|
@@ -1,5 +1,5 @@
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
-
var _excluded = ["min", "max", "value", "disabled", "label", "labelContentLeft", "size", "onChangeCommitted", "onChangeTextField", "onBlurTextField", "onKeyDownTextField", "onChange", "ariaLabel", "multipleStepSize", "name"];
|
2
|
+
var _excluded = ["min", "max", "value", "disabled", "label", "labelContentLeft", "size", "pointerSize", "onChangeCommitted", "onChangeTextField", "onBlurTextField", "onKeyDownTextField", "onChange", "ariaLabel", "multipleStepSize", "name"];
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4
4
|
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; }
|
5
5
|
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) { _defineProperty(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; }
|
@@ -38,6 +38,8 @@ export var DoubleSlider = function DoubleSlider(_ref) {
|
|
38
38
|
labelContentLeft = _ref.labelContentLeft,
|
39
39
|
_ref$size = _ref.size,
|
40
40
|
size = _ref$size === void 0 ? 'm' : _ref$size,
|
41
|
+
_ref$pointerSize = _ref.pointerSize,
|
42
|
+
pointerSize = _ref$pointerSize === void 0 ? 'small' : _ref$pointerSize,
|
41
43
|
onChangeCommitted = _ref.onChangeCommitted,
|
42
44
|
onChangeTextField = _ref.onChangeTextField,
|
43
45
|
onBlurTextField = _ref.onBlurTextField,
|
@@ -64,20 +66,30 @@ export var DoubleSlider = function DoubleSlider(_ref) {
|
|
64
66
|
setState = _useState2[1];
|
65
67
|
var _useState3 = useState(false),
|
66
68
|
_useState4 = _slicedToArray(_useState3, 2),
|
67
|
-
|
68
|
-
|
69
|
+
firstInputHovered = _useState4[0],
|
70
|
+
setFirstInputHovered = _useState4[1];
|
69
71
|
var _useState5 = useState(false),
|
70
72
|
_useState6 = _slicedToArray(_useState5, 2),
|
71
|
-
|
72
|
-
|
73
|
-
var _useState7 = useState(
|
73
|
+
firstInputFocused = _useState6[0],
|
74
|
+
setFirstInputFocused = _useState6[1];
|
75
|
+
var _useState7 = useState(false),
|
74
76
|
_useState8 = _slicedToArray(_useState7, 2),
|
75
|
-
|
76
|
-
|
77
|
-
var _useState9 = useState(
|
77
|
+
secondInputHovered = _useState8[0],
|
78
|
+
setSecondInputHovered = _useState8[1];
|
79
|
+
var _useState9 = useState(false),
|
78
80
|
_useState10 = _slicedToArray(_useState9, 2),
|
79
|
-
|
80
|
-
|
81
|
+
secondInputFocused = _useState10[0],
|
82
|
+
setSecondInputFocused = _useState10[1];
|
83
|
+
var firstInputActive = firstInputHovered || firstInputFocused;
|
84
|
+
var secondInputActive = secondInputHovered || secondInputFocused;
|
85
|
+
var _useState11 = useState(value[0]),
|
86
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
87
|
+
firstValue = _useState12[0],
|
88
|
+
setFirstValue = _useState12[1];
|
89
|
+
var _useState13 = useState(value[1]),
|
90
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
91
|
+
secondValue = _useState14[0],
|
92
|
+
setSecondValue = _useState14[1];
|
81
93
|
var firstHandleRef = useRef(null);
|
82
94
|
var secondHandleRef = useRef(null);
|
83
95
|
var firstHandleValue = useRef(value[0]);
|
@@ -102,6 +114,16 @@ export var DoubleSlider = function DoubleSlider(_ref) {
|
|
102
114
|
});
|
103
115
|
});
|
104
116
|
}, [value, stepSize, min, max, setFirstValue, setSecondValue]);
|
117
|
+
useEffect(function () {
|
118
|
+
var onMouseUp = function onMouseUp() {
|
119
|
+
setFirstInputFocused(false);
|
120
|
+
setSecondInputFocused(false);
|
121
|
+
};
|
122
|
+
window.addEventListener('mouseup', onMouseUp);
|
123
|
+
return function () {
|
124
|
+
window.removeEventListener('mouseup', onMouseUp);
|
125
|
+
};
|
126
|
+
}, []);
|
105
127
|
var setStepSize = useCallback(function (newStepSize) {
|
106
128
|
setState(function (prevState) {
|
107
129
|
return _objectSpread(_objectSpread({}, prevState), {}, {
|
@@ -243,16 +265,20 @@ export var DoubleSlider = function DoubleSlider(_ref) {
|
|
243
265
|
ariaLabelLeft = _ref3[0],
|
244
266
|
ariaLabelRight = _ref3[1];
|
245
267
|
var currentFirstSliderValue = Math.max(state.firstValue, min);
|
268
|
+
var settings = sizeData[size][pointerSize === 'large' ? 'large' : 'small'];
|
246
269
|
return /*#__PURE__*/React.createElement(DoubleWrapper, null, hasLabelContent && /*#__PURE__*/React.createElement(LabelWrapper, null, labelContentLeft && /*#__PURE__*/React.createElement(LabelContentLeft, null, labelContentLeft), label && /*#__PURE__*/React.createElement(Label, null, label)), /*#__PURE__*/React.createElement(SliderWrapper, null, /*#__PURE__*/React.createElement(SliderBase, _extends({
|
247
270
|
min: min,
|
248
271
|
max: max,
|
272
|
+
size: size,
|
249
273
|
disabled: disabled,
|
250
274
|
setStepSize: setStepSize,
|
251
275
|
railFillWidth: state.railFillWidth,
|
252
|
-
settings:
|
253
|
-
railFillXPosition: state.railFillXPosition
|
276
|
+
settings: settings,
|
277
|
+
railFillXPosition: state.railFillXPosition,
|
278
|
+
orientation: "horizontal"
|
254
279
|
}, rest), /*#__PURE__*/React.createElement(Handler, {
|
255
280
|
ref: firstHandleRef,
|
281
|
+
size: pointerSize,
|
256
282
|
stepSize: state.stepSize,
|
257
283
|
multipleStepSize: multipleStepSize,
|
258
284
|
onChangeCommitted: onFirstHandleChangeCommitted,
|
@@ -262,18 +288,23 @@ export var DoubleSlider = function DoubleSlider(_ref) {
|
|
262
288
|
disabled: disabled,
|
263
289
|
bounds: [min, state.secondValue],
|
264
290
|
side: "left",
|
265
|
-
|
291
|
+
orientation: "horizontal",
|
292
|
+
position: state.xFirstHandle,
|
266
293
|
zIndex: state.firstHandleZIndex,
|
267
294
|
value: currentFirstSliderValue,
|
268
295
|
ariaLabel: ariaLabelLeft,
|
296
|
+
onMouseDown: function onMouseDown() {
|
297
|
+
return setFirstInputFocused(true);
|
298
|
+
},
|
269
299
|
onMouseEnter: function onMouseEnter() {
|
270
|
-
return
|
300
|
+
return setFirstInputHovered(true);
|
271
301
|
},
|
272
302
|
onMouseLeave: function onMouseLeave() {
|
273
|
-
return
|
303
|
+
return setFirstInputHovered(false);
|
274
304
|
}
|
275
305
|
}), /*#__PURE__*/React.createElement(Handler, {
|
276
306
|
ref: secondHandleRef,
|
307
|
+
size: pointerSize,
|
277
308
|
stepSize: state.stepSize,
|
278
309
|
multipleStepSize: multipleStepSize,
|
279
310
|
onChangeCommitted: onSecondHandleChangeCommitted,
|
@@ -284,15 +315,19 @@ export var DoubleSlider = function DoubleSlider(_ref) {
|
|
284
315
|
disabled: disabled,
|
285
316
|
bounds: [state.firstValue, max],
|
286
317
|
side: "right",
|
287
|
-
|
318
|
+
orientation: "horizontal",
|
319
|
+
position: state.xSecondHandle,
|
288
320
|
zIndex: state.secondHandleZIndex,
|
289
321
|
value: Math.max(state.secondValue, min),
|
290
322
|
ariaLabel: ariaLabelRight,
|
323
|
+
onMouseDown: function onMouseDown() {
|
324
|
+
return setSecondInputFocused(true);
|
325
|
+
},
|
291
326
|
onMouseEnter: function onMouseEnter() {
|
292
|
-
return
|
327
|
+
return setSecondInputHovered(true);
|
293
328
|
},
|
294
329
|
onMouseLeave: function onMouseLeave() {
|
295
|
-
return
|
330
|
+
return setSecondInputHovered(false);
|
296
331
|
}
|
297
332
|
})), /*#__PURE__*/React.createElement(InputsWrapper, null, /*#__PURE__*/React.createElement(StyledInput, {
|
298
333
|
className: cx(classes.firstTextField, firstInputActiveClass),
|