@elliemae/ds-slider 2.2.1 → 2.3.0-alpha.4
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/cjs/DSSlider.js +48 -33
- package/cjs/DSSlider.js.map +7 -0
- package/cjs/components/SliderImp.js +154 -158
- package/cjs/components/SliderImp.js.map +7 -0
- package/cjs/components/Thumb.js +64 -63
- package/cjs/components/Thumb.js.map +7 -0
- package/cjs/components/TickMarks.js +72 -31
- package/cjs/components/TickMarks.js.map +7 -0
- package/cjs/components/TickMarksValues.js +59 -38
- package/cjs/components/TickMarksValues.js.map +7 -0
- package/cjs/components/Track.js +66 -55
- package/cjs/components/Track.js.map +7 -0
- package/cjs/components/context.js +36 -13
- package/cjs/components/context.js.map +7 -0
- package/cjs/components/styled.js +93 -58
- package/cjs/components/styled.js.map +7 -0
- package/cjs/components/utils.js +46 -36
- package/cjs/components/utils.js.map +7 -0
- package/cjs/index.js +36 -11
- package/cjs/index.js.map +7 -0
- package/cjs/prop-types.js +52 -49
- package/cjs/prop-types.js.map +7 -0
- package/esm/DSSlider.js +16 -20
- package/esm/DSSlider.js.map +7 -0
- package/esm/components/SliderImp.js +120 -139
- package/esm/components/SliderImp.js.map +7 -0
- package/esm/components/Thumb.js +33 -54
- package/esm/components/Thumb.js.map +7 -0
- package/esm/components/TickMarks.js +42 -23
- package/esm/components/TickMarks.js.map +7 -0
- package/esm/components/TickMarksValues.js +30 -31
- package/esm/components/TickMarksValues.js.map +7 -0
- package/esm/components/Track.js +36 -46
- package/esm/components/Track.js.map +7 -0
- package/esm/components/context.js +7 -5
- package/esm/components/context.js.map +7 -0
- package/esm/components/styled.js +64 -44
- package/esm/components/styled.js.map +7 -0
- package/esm/components/utils.js +15 -29
- package/esm/components/utils.js.map +7 -0
- package/esm/index.js +7 -1
- package/esm/index.js.map +7 -0
- package/esm/prop-types.js +23 -44
- package/esm/prop-types.js.map +7 -0
- package/package.json +6 -6
package/esm/components/Track.js
CHANGED
|
@@ -1,30 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import styled from 'styled-components';
|
|
11
|
-
import { __UNSAFE_SPACE_TO_DIMSUM } from '@elliemae/ds-system';
|
|
12
|
-
import TickMarks$1 from './TickMarks.js';
|
|
13
|
-
import TickMarks from './TickMarksValues.js';
|
|
14
|
-
import { SliderContext } from './context.js';
|
|
15
|
-
import { jsxs, Fragment } from 'react/jsx-runtime';
|
|
16
|
-
|
|
17
|
-
var _TickMarks, _TickMarksValues;
|
|
18
|
-
|
|
19
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
-
|
|
21
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
|
-
|
|
23
|
-
const Track = _ref => {
|
|
24
|
-
let {
|
|
25
|
-
children,
|
|
26
|
-
props
|
|
27
|
-
} = _ref;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useContext } from "react";
|
|
3
|
+
import { getTrackBackground } from "react-range";
|
|
4
|
+
import styled from "styled-components";
|
|
5
|
+
import { __UNSAFE_SPACE_TO_DIMSUM } from "@elliemae/ds-system";
|
|
6
|
+
import TickMarks from "./TickMarks";
|
|
7
|
+
import TickMarksValues from "./TickMarksValues";
|
|
8
|
+
import { SliderContext } from "./context";
|
|
9
|
+
const Track = ({ children, props }) => {
|
|
28
10
|
const {
|
|
29
11
|
disabled,
|
|
30
12
|
minValue,
|
|
@@ -34,26 +16,34 @@ const Track = _ref => {
|
|
|
34
16
|
withTickMarksValues,
|
|
35
17
|
withTwoHandles
|
|
36
18
|
} = useContext(SliderContext);
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
children: [children, withTickMarks && !disabled && (_TickMarks || (_TickMarks = /*#__PURE__*/_jsx(TickMarks$1, {})))]
|
|
46
|
-
})), withTickMarksValues && (_TickMarksValues || (_TickMarksValues = /*#__PURE__*/_jsx(TickMarks, {})))]
|
|
47
|
-
});
|
|
19
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(TrackStyled, {
|
|
20
|
+
...props,
|
|
21
|
+
disabled,
|
|
22
|
+
minValue,
|
|
23
|
+
maxValue,
|
|
24
|
+
rangeValues,
|
|
25
|
+
withTwoHandles
|
|
26
|
+
}, children, withTickMarks && !disabled && /* @__PURE__ */ React2.createElement(TickMarks, null)), withTickMarksValues && /* @__PURE__ */ React2.createElement(TickMarksValues, null));
|
|
48
27
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
28
|
+
const TrackStyled = styled.div`
|
|
29
|
+
position: relative;
|
|
30
|
+
height: ${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)};
|
|
31
|
+
width: 100%;
|
|
32
|
+
min-width: ${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxl)};
|
|
33
|
+
border-radius: ${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)};
|
|
34
|
+
background: ${(props) => props.disabled ? props.theme.colors.neutral[100] : getTrackBackground({
|
|
53
35
|
values: props.rangeValues,
|
|
54
|
-
colors: props.withTwoHandles ? [
|
|
36
|
+
colors: props.withTwoHandles ? [
|
|
37
|
+
props.theme.colors.neutral[100],
|
|
38
|
+
props.theme.colors.brand[600],
|
|
39
|
+
props.theme.colors.neutral[100]
|
|
40
|
+
] : [props.theme.colors.brand[600], props.theme.colors.neutral[100]],
|
|
55
41
|
min: props.minValue,
|
|
56
42
|
max: props.maxValue
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
|
|
43
|
+
})};
|
|
44
|
+
`;
|
|
45
|
+
var Track_default = Track;
|
|
46
|
+
export {
|
|
47
|
+
Track_default as default
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=Track.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/Track.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\n/* eslint-disable react/prop-types */\nimport React, { useContext } from 'react';\nimport { getTrackBackground } from 'react-range';\nimport styled from 'styled-components';\nimport { __UNSAFE_SPACE_TO_DIMSUM } from '@elliemae/ds-system';\n\nimport TickMarks from './TickMarks';\nimport TickMarksValues from './TickMarksValues';\nimport { SliderContext } from './context';\n\nconst Track = ({ children, props }) => {\n const {\n disabled,\n minValue,\n maxValue,\n rangeValues,\n withTickMarks,\n withTickMarksValues,\n withTwoHandles,\n } = useContext(SliderContext);\n\n return (\n <>\n <TrackStyled\n {...props} // This is needed because it's received from the library\n disabled={disabled}\n minValue={minValue}\n maxValue={maxValue}\n rangeValues={rangeValues}\n withTwoHandles={withTwoHandles}\n >\n {children}\n {withTickMarks && !disabled && <TickMarks />}\n </TrackStyled>\n {withTickMarksValues && <TickMarksValues />}\n </>\n );\n};\n\nconst TrackStyled = styled.div`\n position: relative;\n height: ${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)};\n width: 100%;\n min-width: ${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxl)};\n border-radius: ${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)};\n background: ${(props) =>\n props.disabled\n ? props.theme.colors.neutral[100]\n : getTrackBackground({\n values: props.rangeValues,\n colors: props.withTwoHandles\n ? [\n props.theme.colors.neutral[100],\n props.theme.colors.brand[600],\n props.theme.colors.neutral[100],\n ]\n : [props.theme.colors.brand[600], props.theme.colors.neutral[100]],\n min: props.minValue,\n max: props.maxValue,\n })};\n`;\n\nexport default Track;\n"],
|
|
5
|
+
"mappings": "AAAA;ACEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA,MAAM,QAAQ,CAAC,EAAE,UAAU,YAAY;AACrC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,WAAW;AAEf,SACE,4DACE,qCAAC,aAAD;AAAA,OACM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,KAEC,UACA,iBAAiB,CAAC,YAAY,qCAAC,WAAD,QAEhC,uBAAuB,qCAAC,iBAAD;AAAA;AAK9B,MAAM,cAAc,OAAO;AAAA;AAAA,YAEf,CAAC,UAAU,yBAAyB,MAAM,MAAM,MAAM;AAAA;AAAA,eAEnD,CAAC,UAAU,yBAAyB,MAAM,MAAM,MAAM;AAAA,mBAClD,CAAC,UAAU,yBAAyB,MAAM,MAAM,MAAM;AAAA,gBACzD,CAAC,UACb,MAAM,WACF,MAAM,MAAM,OAAO,QAAQ,OAC3B,mBAAmB;AAAA,EACjB,QAAQ,MAAM;AAAA,EACd,QAAQ,MAAM,iBACV;AAAA,IACE,MAAM,MAAM,OAAO,QAAQ;AAAA,IAC3B,MAAM,MAAM,OAAO,MAAM;AAAA,IACzB,MAAM,MAAM,OAAO,QAAQ;AAAA,MAE7B,CAAC,MAAM,MAAM,OAAO,MAAM,MAAM,MAAM,MAAM,OAAO,QAAQ;AAAA,EAC/D,KAAK,MAAM;AAAA,EACX,KAAK,MAAM;AAAA;AAAA;AAIrB,IAAO,gBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
|
|
3
|
-
const SliderContext =
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
const SliderContext = React2.createContext();
|
|
4
|
+
export {
|
|
5
|
+
SliderContext
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/context.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\n\nexport const SliderContext = React.createContext();\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEO,MAAM,gBAAgB,OAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/components/styled.js
CHANGED
|
@@ -1,47 +1,67 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { __UNSAFE_SPACE_TO_DIMSUM } from "@elliemae/ds-system";
|
|
4
|
+
import { TooltipContainer } from "@elliemae/ds-tooltip";
|
|
5
|
+
const ThumbStyled = styled.div`
|
|
6
|
+
height: 20px;
|
|
7
|
+
width: 20px;
|
|
8
|
+
background-color: ${(props) => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral["000"]};
|
|
9
|
+
border-radius: 10px;
|
|
10
|
+
border: 1px solid ${(props) => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral[400]};
|
|
4
11
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
let {
|
|
10
|
-
disabled,
|
|
11
|
-
theme
|
|
12
|
-
} = _ref;
|
|
13
|
-
return disabled ? theme.colors.neutral[100] : theme.colors.brand[200];
|
|
14
|
-
});
|
|
15
|
-
const TooltipContainerStyled = /*#__PURE__*/styled(TooltipContainer).withConfig({
|
|
16
|
-
componentId: "sc-24in0j-1"
|
|
17
|
-
})(["position:relative;display:flex;align-items:center;flex-direction:column;top:-35px;width:max-content;left:50%;transform:translateX(-50%);visibility:", ";"], _ref2 => {
|
|
18
|
-
let {
|
|
19
|
-
isDragged,
|
|
20
|
-
isHovered
|
|
21
|
-
} = _ref2;
|
|
22
|
-
return isDragged || isHovered ? 'visible' : 'hidden';
|
|
23
|
-
}); // TODO: didn't work with DSTooltip, see how to improve
|
|
12
|
+
:focus {
|
|
13
|
+
border: 1px solid ${(props) => props.theme.colors.brand[600]};
|
|
14
|
+
outline: unset;
|
|
15
|
+
}
|
|
24
16
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
17
|
+
:hover {
|
|
18
|
+
background-color: ${({ disabled, theme }) => disabled ? theme.colors.neutral[100] : theme.colors.brand[200]};
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
const TooltipContainerStyled = styled(TooltipContainer)`
|
|
22
|
+
position: relative;
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
top: -35px;
|
|
27
|
+
width: max-content;
|
|
28
|
+
left: 50%;
|
|
29
|
+
transform: translateX(-50%);
|
|
30
|
+
visibility: ${({ isDragged, isHovered }) => isDragged || isHovered ? "visible" : "hidden"};
|
|
31
|
+
`;
|
|
32
|
+
const TooltipArrow = styled.div`
|
|
33
|
+
position: absolute;
|
|
34
|
+
width: 0;
|
|
35
|
+
height: 0;
|
|
36
|
+
top: 20px;
|
|
37
|
+
border-left: calc(${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)} * 2.5) solid transparent;
|
|
38
|
+
border-right: calc(${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)} * 2.5) solid transparent;
|
|
46
39
|
|
|
47
|
-
|
|
40
|
+
border-top: calc(${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)} * 2.5) solid
|
|
41
|
+
${(props) => props.theme.colors.neutral[0]};
|
|
42
|
+
`;
|
|
43
|
+
const LabelWrapper = styled.div`
|
|
44
|
+
margin-bottom: ${(props) => props.theme.space.xxs};
|
|
45
|
+
max-width: 100%;
|
|
46
|
+
width: ${(props) => `${props.width || 0}px`};
|
|
47
|
+
`;
|
|
48
|
+
const LabelText = styled.span`
|
|
49
|
+
color: ${(props) => props.theme.colors.neutral[600]};
|
|
50
|
+
`;
|
|
51
|
+
const ValueText = styled.span`
|
|
52
|
+
color: ${({ disabled, theme }) => theme.colors.neutral[disabled ? 500 : 800]};
|
|
53
|
+
`;
|
|
54
|
+
const StyledRangeWrapper = styled.div`
|
|
55
|
+
min-height: 28px;
|
|
56
|
+
margin: 0 10px;
|
|
57
|
+
`;
|
|
58
|
+
export {
|
|
59
|
+
LabelText,
|
|
60
|
+
LabelWrapper,
|
|
61
|
+
StyledRangeWrapper,
|
|
62
|
+
ThumbStyled,
|
|
63
|
+
TooltipArrow,
|
|
64
|
+
TooltipContainerStyled,
|
|
65
|
+
ValueText
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/styled.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\nimport styled from 'styled-components';\nimport { __UNSAFE_SPACE_TO_DIMSUM } from '@elliemae/ds-system';\nimport { TooltipContainer } from '@elliemae/ds-tooltip';\n\nexport const ThumbStyled = styled.div`\n height: 20px;\n width: 20px;\n background-color: ${(props) =>\n props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral['000']};\n border-radius: 10px;\n border: 1px solid ${(props) => (props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral[400])};\n\n :focus {\n border: 1px solid ${(props) => props.theme.colors.brand[600]};\n outline: unset;\n }\n\n :hover {\n background-color: ${({ disabled, theme }) => (disabled ? theme.colors.neutral[100] : theme.colors.brand[200])};\n }\n`;\n\nexport const TooltipContainerStyled = styled(TooltipContainer)`\n position: relative;\n display: flex;\n align-items: center;\n flex-direction: column;\n top: -35px;\n width: max-content;\n left: 50%;\n transform: translateX(-50%);\n visibility: ${({ isDragged, isHovered }) => (isDragged || isHovered ? 'visible' : 'hidden')};\n`;\n// TODO: didn't work with DSTooltip, see how to improve\nexport const TooltipArrow = styled.div`\n position: absolute;\n width: 0;\n height: 0;\n top: 20px;\n border-left: calc(${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)} * 2.5) solid transparent;\n border-right: calc(${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)} * 2.5) solid transparent;\n\n border-top: calc(${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)} * 2.5) solid\n ${(props) => props.theme.colors.neutral[0]};\n`;\n\nexport const LabelWrapper = styled.div`\n margin-bottom: ${(props) => props.theme.space.xxs};\n max-width: 100%;\n width: ${(props) => `${props.width || 0}px`};\n`;\n\nexport const LabelText = styled.span`\n color: ${(props) => props.theme.colors.neutral[600]};\n`;\n\nexport const ValueText = styled.span`\n color: ${({ disabled, theme }) => theme.colors.neutral[disabled ? 500 : 800]};\n`;\n\nexport const StyledRangeWrapper = styled.div`\n min-height: 28px;\n margin: 0 10px;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AACA;AAEO,MAAM,cAAc,OAAO;AAAA;AAAA;AAAA,sBAGZ,CAAC,UACnB,MAAM,WAAW,MAAM,MAAM,OAAO,QAAQ,OAAO,MAAM,MAAM,OAAO,QAAQ;AAAA;AAAA,sBAE5D,CAAC,UAAW,MAAM,WAAW,MAAM,MAAM,OAAO,QAAQ,OAAO,MAAM,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA,wBAGxF,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,wBAKpC,CAAC,EAAE,UAAU,YAAa,WAAW,MAAM,OAAO,QAAQ,OAAO,MAAM,OAAO,MAAM;AAAA;AAAA;AAIrG,MAAM,yBAAyB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAS7B,CAAC,EAAE,WAAW,gBAAiB,aAAa,YAAY,YAAY;AAAA;AAG7E,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKb,CAAC,UAAU,yBAAyB,MAAM,MAAM,MAAM;AAAA,uBACrD,CAAC,UAAU,yBAAyB,MAAM,MAAM,MAAM;AAAA;AAAA,qBAExD,CAAC,UAAU,yBAAyB,MAAM,MAAM,MAAM;AAAA,MACrE,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ;AAAA;AAGrC,MAAM,eAAe,OAAO;AAAA,mBAChB,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA,WAErC,CAAC,UAAU,GAAG,MAAM,SAAS;AAAA;AAGjC,MAAM,YAAY,OAAO;AAAA,WACrB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ;AAAA;AAG1C,MAAM,YAAY,OAAO;AAAA,WACrB,CAAC,EAAE,UAAU,YAAY,MAAM,OAAO,QAAQ,WAAW,MAAM;AAAA;AAGnE,MAAM,qBAAqB,OAAO;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/components/utils.js
CHANGED
|
@@ -1,44 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const conformedLabel = function (rangeValues) {
|
|
5
|
-
let label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
6
|
-
let labelWithValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7
|
-
let withTwoHandles = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8
|
-
let customTickMarksValues = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
9
|
-
let step = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
|
|
10
|
-
let minValue = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { isEmpty } from "@elliemae/ds-utilities";
|
|
3
|
+
const conformedLabel = (rangeValues, label = "", labelWithValue = false, withTwoHandles = false, customTickMarksValues = [], step = 1, minValue = 0) => {
|
|
11
4
|
const msg = label.trim();
|
|
12
|
-
let value =
|
|
13
|
-
|
|
5
|
+
let value = "";
|
|
14
6
|
if (!isEmpty(customTickMarksValues) && labelWithValue && label) {
|
|
15
7
|
const firstValue = customTickMarksValues[(rangeValues[0] - minValue) / step];
|
|
16
8
|
const secondValue = customTickMarksValues[(rangeValues[1] - minValue) / step];
|
|
17
|
-
value =
|
|
9
|
+
value = `${firstValue || rangeValues[0].toFixed(1)} ${withTwoHandles ? `, ${secondValue || rangeValues[1].toFixed(1)}` : ""} `;
|
|
18
10
|
} else if (labelWithValue && label) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
value = "".concat(rangeValues[0].toFixed(1), " ").concat(withTwoHandles ? ", ".concat((_rangeValues$ = rangeValues[1]) === null || _rangeValues$ === void 0 ? void 0 : _rangeValues$.toFixed(1)) : '', " ");
|
|
11
|
+
value = `${rangeValues[0].toFixed(1)} ${withTwoHandles ? `, ${rangeValues[1]?.toFixed(1)}` : ""} `;
|
|
22
12
|
}
|
|
23
|
-
|
|
24
13
|
value = value.trim();
|
|
25
14
|
return [msg, value];
|
|
26
15
|
};
|
|
27
|
-
const conformedThumbLabel =
|
|
28
|
-
let
|
|
29
|
-
let index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
30
|
-
let step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
31
|
-
let minValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
32
|
-
let msg = "Value: ";
|
|
33
|
-
|
|
16
|
+
const conformedThumbLabel = (rangeValues, customTickMarksValues = [], index = 0, step = 1, minValue = 0) => {
|
|
17
|
+
let msg = `Value: `;
|
|
34
18
|
if (!isEmpty(customTickMarksValues)) {
|
|
35
19
|
const foundValue = customTickMarksValues[(rangeValues[index] - minValue) / step];
|
|
36
|
-
msg +=
|
|
20
|
+
msg += `${foundValue || rangeValues[index].toFixed(1)}`;
|
|
37
21
|
} else {
|
|
38
|
-
msg +=
|
|
22
|
+
msg += `${rangeValues[index].toFixed(1)}`;
|
|
39
23
|
}
|
|
40
|
-
|
|
41
24
|
return msg;
|
|
42
25
|
};
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
export {
|
|
27
|
+
conformedLabel,
|
|
28
|
+
conformedThumbLabel
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/utils.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-params */\nimport { isEmpty } from '@elliemae/ds-utilities';\n\nexport const conformedLabel = (\n rangeValues,\n label = '',\n labelWithValue = false,\n withTwoHandles = false,\n customTickMarksValues = [],\n step = 1,\n minValue = 0,\n) => {\n const msg = label.trim();\n let value = '';\n if (!isEmpty(customTickMarksValues) && labelWithValue && label) {\n const firstValue =\n customTickMarksValues[(rangeValues[0] - minValue) / step];\n const secondValue =\n customTickMarksValues[(rangeValues[1] - minValue) / step];\n value = `${firstValue || rangeValues[0].toFixed(1)} ${\n withTwoHandles ? `, ${secondValue || rangeValues[1].toFixed(1)}` : ''\n } `;\n } else if (labelWithValue && label) {\n value = `${rangeValues[0].toFixed(1)} ${\n withTwoHandles ? `, ${rangeValues[1]?.toFixed(1)}` : ''\n } `;\n }\n value = value.trim();\n\n return [msg, value];\n};\n\nexport const conformedThumbLabel = (\n rangeValues,\n customTickMarksValues = [],\n index = 0,\n step = 1,\n minValue = 0,\n) => {\n let msg = `Value: `;\n if (!isEmpty(customTickMarksValues)) {\n const foundValue =\n customTickMarksValues[(rangeValues[index] - minValue) / step];\n msg += `${foundValue || rangeValues[index].toFixed(1)}`;\n } else {\n msg += `${rangeValues[index].toFixed(1)}`;\n }\n\n return msg;\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AAEO,MAAM,iBAAiB,CAC5B,aACA,QAAQ,IACR,iBAAiB,OACjB,iBAAiB,OACjB,wBAAwB,IACxB,OAAO,GACP,WAAW,MACR;AACH,QAAM,MAAM,MAAM;AAClB,MAAI,QAAQ;AACZ,MAAI,CAAC,QAAQ,0BAA0B,kBAAkB,OAAO;AAC9D,UAAM,aACJ,sBAAuB,aAAY,KAAK,YAAY;AACtD,UAAM,cACJ,sBAAuB,aAAY,KAAK,YAAY;AACtD,YAAQ,GAAG,cAAc,YAAY,GAAG,QAAQ,MAC9C,iBAAiB,KAAK,eAAe,YAAY,GAAG,QAAQ,OAAO;AAAA,aAE5D,kBAAkB,OAAO;AAClC,YAAQ,GAAG,YAAY,GAAG,QAAQ,MAChC,iBAAiB,KAAK,YAAY,IAAI,QAAQ,OAAO;AAAA;AAGzD,UAAQ,MAAM;AAEd,SAAO,CAAC,KAAK;AAAA;AAGR,MAAM,sBAAsB,CACjC,aACA,wBAAwB,IACxB,QAAQ,GACR,OAAO,GACP,WAAW,MACR;AACH,MAAI,MAAM;AACV,MAAI,CAAC,QAAQ,wBAAwB;AACnC,UAAM,aACJ,sBAAuB,aAAY,SAAS,YAAY;AAC1D,WAAO,GAAG,cAAc,YAAY,OAAO,QAAQ;AAAA,SAC9C;AACL,WAAO,GAAG,YAAY,OAAO,QAAQ;AAAA;AAGvC,SAAO;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/index.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { default as default2 } from "./DSSlider";
|
|
3
|
+
export * from "./DSSlider";
|
|
4
|
+
export {
|
|
5
|
+
default2 as default
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default } from './DSSlider';\nexport * from './DSSlider';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/prop-types.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PropTypes } from "react-desc";
|
|
3
3
|
const defaultProps = {
|
|
4
4
|
containerProps: {},
|
|
5
5
|
disabled: false,
|
|
6
|
-
label:
|
|
6
|
+
label: "",
|
|
7
7
|
labelWithValue: false,
|
|
8
8
|
minValue: 0,
|
|
9
9
|
maxValue: 100,
|
|
10
10
|
step: 5,
|
|
11
|
-
onChange: () => {
|
|
11
|
+
onChange: () => {
|
|
12
|
+
},
|
|
12
13
|
withTickMarks: false,
|
|
13
14
|
withTickMarksValues: false,
|
|
14
15
|
withTwoHandles: false,
|
|
@@ -16,44 +17,22 @@ const defaultProps = {
|
|
|
16
17
|
zIndex: 0
|
|
17
18
|
};
|
|
18
19
|
const sliderPropTypes = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
minValue: PropTypes.number.description('min value for slider'),
|
|
33
|
-
|
|
34
|
-
/** max value for slider */
|
|
35
|
-
maxValue: PropTypes.number.description('max value for slider'),
|
|
36
|
-
|
|
37
|
-
/** steps of values from min to max */
|
|
38
|
-
step: PropTypes.number.description('steps of values from min to max'),
|
|
39
|
-
|
|
40
|
-
/** change handler */
|
|
41
|
-
onChange: PropTypes.func.description('change handler'),
|
|
42
|
-
|
|
43
|
-
/** add tick marks between steps */
|
|
44
|
-
withTickMarks: PropTypes.bool.description('add tick marks between steps'),
|
|
45
|
-
|
|
46
|
-
/** add step value to tickmark */
|
|
47
|
-
withTickMarksValues: PropTypes.bool.description('add step value to tickmark'),
|
|
48
|
-
|
|
49
|
-
/** add two handles */
|
|
50
|
-
withTwoHandles: PropTypes.bool.description('add two handles'),
|
|
51
|
-
|
|
52
|
-
/** change manually tickmark values */
|
|
53
|
-
customTickMarksValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])).description('change manually tickmark values'),
|
|
54
|
-
|
|
55
|
-
/** z index for thumb */
|
|
56
|
-
zIndex: PropTypes.number.description('z index for thumb')
|
|
20
|
+
containerProps: PropTypes.shape({}).description("props to inject to slider wrapper"),
|
|
21
|
+
disabled: PropTypes.bool.description("disable slider"),
|
|
22
|
+
label: PropTypes.string.description("label for slider"),
|
|
23
|
+
labelWithValue: PropTypes.bool.description("if the label comes with value attached for slider or not"),
|
|
24
|
+
minValue: PropTypes.number.description("min value for slider"),
|
|
25
|
+
maxValue: PropTypes.number.description("max value for slider"),
|
|
26
|
+
step: PropTypes.number.description("steps of values from min to max"),
|
|
27
|
+
onChange: PropTypes.func.description("change handler"),
|
|
28
|
+
withTickMarks: PropTypes.bool.description("add tick marks between steps"),
|
|
29
|
+
withTickMarksValues: PropTypes.bool.description("add step value to tickmark"),
|
|
30
|
+
withTwoHandles: PropTypes.bool.description("add two handles"),
|
|
31
|
+
customTickMarksValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])).description("change manually tickmark values"),
|
|
32
|
+
zIndex: PropTypes.number.description("z index for thumb")
|
|
57
33
|
};
|
|
58
|
-
|
|
59
|
-
|
|
34
|
+
export {
|
|
35
|
+
defaultProps,
|
|
36
|
+
sliderPropTypes
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/prop-types.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\n\nexport const defaultProps = {\n containerProps: {},\n disabled: false,\n label: '',\n labelWithValue: false,\n minValue: 0,\n maxValue: 100,\n step: 5,\n onChange: () => {},\n withTickMarks: false,\n withTickMarksValues: false,\n withTwoHandles: false,\n customTickMarksValues: [],\n zIndex: 0,\n};\n\nexport const sliderPropTypes = {\n /** props to inject to slider wrapper */\n containerProps: PropTypes.shape({}).description(\n 'props to inject to slider wrapper',\n ),\n /** disable slider */\n disabled: PropTypes.bool.description('disable slider'),\n /** label for slider */\n label: PropTypes.string.description('label for slider'),\n /** if the label comes with value attached for slider or not */\n labelWithValue: PropTypes.bool.description(\n 'if the label comes with value attached for slider or not',\n ),\n /** min value for slider */\n minValue: PropTypes.number.description('min value for slider'),\n /** max value for slider */\n maxValue: PropTypes.number.description('max value for slider'),\n /** steps of values from min to max */\n step: PropTypes.number.description('steps of values from min to max'),\n /** change handler */\n onChange: PropTypes.func.description('change handler'),\n /** add tick marks between steps */\n withTickMarks: PropTypes.bool.description('add tick marks between steps'),\n /** add step value to tickmark */\n withTickMarksValues: PropTypes.bool.description('add step value to tickmark'),\n /** add two handles */\n withTwoHandles: PropTypes.bool.description('add two handles'),\n /** change manually tickmark values */\n customTickMarksValues: PropTypes.arrayOf(\n PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n ).description('change manually tickmark values'),\n /** z index for thumb */\n zIndex: PropTypes.number.description('z index for thumb'),\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEO,MAAM,eAAe;AAAA,EAC1B,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU,MAAM;AAAA;AAAA,EAChB,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,gBAAgB;AAAA,EAChB,uBAAuB;AAAA,EACvB,QAAQ;AAAA;AAGH,MAAM,kBAAkB;AAAA,EAE7B,gBAAgB,UAAU,MAAM,IAAI,YAClC;AAAA,EAGF,UAAU,UAAU,KAAK,YAAY;AAAA,EAErC,OAAO,UAAU,OAAO,YAAY;AAAA,EAEpC,gBAAgB,UAAU,KAAK,YAC7B;AAAA,EAGF,UAAU,UAAU,OAAO,YAAY;AAAA,EAEvC,UAAU,UAAU,OAAO,YAAY;AAAA,EAEvC,MAAM,UAAU,OAAO,YAAY;AAAA,EAEnC,UAAU,UAAU,KAAK,YAAY;AAAA,EAErC,eAAe,UAAU,KAAK,YAAY;AAAA,EAE1C,qBAAqB,UAAU,KAAK,YAAY;AAAA,EAEhD,gBAAgB,UAAU,KAAK,YAAY;AAAA,EAE3C,uBAAuB,UAAU,QAC/B,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,UACjD,YAAY;AAAA,EAEd,QAAQ,UAAU,OAAO,YAAY;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-slider",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-alpha.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Slider",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
"build": "node ../../scripts/build/build.js"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@elliemae/ds-grid": "2.
|
|
76
|
-
"@elliemae/ds-system": "2.
|
|
77
|
-
"@elliemae/ds-tooltip": "2.
|
|
78
|
-
"@elliemae/ds-truncated-tooltip-text": "2.
|
|
79
|
-
"@elliemae/ds-utilities": "2.
|
|
75
|
+
"@elliemae/ds-grid": "2.3.0-alpha.4",
|
|
76
|
+
"@elliemae/ds-system": "2.3.0-alpha.4",
|
|
77
|
+
"@elliemae/ds-tooltip": "2.3.0-alpha.4",
|
|
78
|
+
"@elliemae/ds-truncated-tooltip-text": "2.3.0-alpha.4",
|
|
79
|
+
"@elliemae/ds-utilities": "2.3.0-alpha.4",
|
|
80
80
|
"prop-types": "~15.7.2",
|
|
81
81
|
"react-desc": "~4.1.3",
|
|
82
82
|
"react-range": "~1.8.11",
|