@salutejs/plasma-new-hope 0.83.0-dev.0 → 0.84.0-canary.1194.9208145301.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Combobox/hooks/useFocusController.js +1 -0
- package/cjs/components/Combobox/hooks/useFocusController.js.map +1 -1
- package/cjs/components/Slider/Slider.css +69 -0
- package/cjs/components/Slider/Slider.js +48 -0
- package/cjs/components/Slider/Slider.js.map +1 -0
- package/cjs/components/Slider/Slider.tokens.js +79 -0
- package/cjs/components/Slider/Slider.tokens.js.map +1 -0
- package/cjs/components/Slider/components/Double/Double.css +62 -0
- package/cjs/components/Slider/components/Double/Double.js +306 -0
- package/cjs/components/Slider/components/Double/Double.js.map +1 -0
- package/cjs/components/Slider/components/Double/Double.styles.js +61 -0
- package/cjs/components/Slider/components/Double/Double.styles.js.map +1 -0
- package/cjs/components/Slider/components/Double/Double.styles_1jhda4u.css +7 -0
- package/cjs/components/Slider/components/Single/Single.css +16 -0
- package/cjs/components/Slider/components/Single/Single.js +164 -0
- package/cjs/components/Slider/components/Single/Single.js.map +1 -0
- package/cjs/components/Slider/components/Single/Single.styles.js +45 -0
- package/cjs/components/Slider/components/Single/Single.styles.js.map +1 -0
- package/cjs/components/Slider/components/Single/Single.styles_1r9f1e0.css +6 -0
- package/cjs/components/Slider/components/SliderBase/SliderBase.css +4 -0
- package/cjs/components/Slider/components/SliderBase/SliderBase.js +82 -0
- package/cjs/components/Slider/components/SliderBase/SliderBase.js.map +1 -0
- package/cjs/components/Slider/components/SliderBase/SliderBase.styles.js +33 -0
- package/cjs/components/Slider/components/SliderBase/SliderBase.styles.js.map +1 -0
- package/cjs/components/Slider/components/SliderBase/SliderBase.styles_7is2ll.css +4 -0
- package/cjs/components/Slider/ui/Handler/Handler.css +4 -0
- package/cjs/components/Slider/ui/Handler/Handler.js +168 -0
- package/cjs/components/Slider/ui/Handler/Handler.js.map +1 -0
- package/cjs/components/Slider/ui/Handler/Handler.styles.js +21 -0
- package/cjs/components/Slider/ui/Handler/Handler.styles.js.map +1 -0
- package/cjs/components/Slider/ui/Handler/Handler.styles_8crx5z.css +2 -0
- package/cjs/components/Slider/ui/Thumb/Thumb.css +1 -0
- package/cjs/components/Slider/ui/Thumb/Thumb.js +31 -0
- package/cjs/components/Slider/ui/Thumb/Thumb.js.map +1 -0
- package/cjs/components/Slider/ui/Thumb/Thumb.styles.js +15 -0
- package/cjs/components/Slider/ui/Thumb/Thumb.styles.js.map +1 -0
- package/cjs/components/Slider/ui/Thumb/Thumb.styles_4w4gzn.css +1 -0
- package/cjs/components/Slider/utils/index.js +56 -0
- package/cjs/components/Slider/utils/index.js.map +1 -0
- package/cjs/components/Slider/variations/_disabled/base.js +9 -0
- package/cjs/components/Slider/variations/_disabled/base.js.map +1 -0
- package/cjs/components/Slider/variations/_disabled/base_x642ct.css +1 -0
- package/cjs/components/Slider/variations/_size/base.js +9 -0
- package/cjs/components/Slider/variations/_size/base.js.map +1 -0
- package/cjs/components/Slider/variations/_size/base_x642ct.css +1 -0
- package/cjs/components/Slider/variations/_view/base.js +9 -0
- package/cjs/components/Slider/variations/_view/base.js.map +1 -0
- package/cjs/components/Slider/variations/_view/base_x642ct.css +1 -0
- package/cjs/components/TextField/TextField.js +12 -3
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/engines/common.js +4 -0
- package/cjs/engines/common.js.map +1 -1
- package/cjs/engines/index.js.map +1 -1
- package/cjs/hooks/useIsomorphicLayoutEffect.js +15 -0
- package/cjs/hooks/useIsomorphicLayoutEffect.js.map +1 -0
- package/cjs/index.css +25 -0
- package/cjs/index.js +14 -0
- package/cjs/index.js.map +1 -1
- package/cjs/utils/canUseDOM.js +12 -0
- package/cjs/utils/canUseDOM.js.map +1 -0
- package/cjs/utils/index.js.map +1 -1
- package/es/components/Combobox/hooks/useFocusController.js +1 -0
- package/es/components/Combobox/hooks/useFocusController.js.map +1 -1
- package/es/components/Slider/Slider.css +69 -0
- package/es/components/Slider/Slider.js +43 -0
- package/es/components/Slider/Slider.js.map +1 -0
- package/es/components/Slider/Slider.tokens.js +74 -0
- package/es/components/Slider/Slider.tokens.js.map +1 -0
- package/es/components/Slider/components/Double/Double.css +62 -0
- package/es/components/Slider/components/Double/Double.js +302 -0
- package/es/components/Slider/components/Double/Double.js.map +1 -0
- package/es/components/Slider/components/Double/Double.styles.js +51 -0
- package/es/components/Slider/components/Double/Double.styles.js.map +1 -0
- package/es/components/Slider/components/Double/Double.styles_1jhda4u.css +7 -0
- package/es/components/Slider/components/Single/Single.css +16 -0
- package/es/components/Slider/components/Single/Single.js +160 -0
- package/es/components/Slider/components/Single/Single.js.map +1 -0
- package/es/components/Slider/components/Single/Single.styles.js +36 -0
- package/es/components/Slider/components/Single/Single.styles.js.map +1 -0
- package/es/components/Slider/components/Single/Single.styles_1r9f1e0.css +6 -0
- package/es/components/Slider/components/SliderBase/SliderBase.css +4 -0
- package/es/components/Slider/components/SliderBase/SliderBase.js +78 -0
- package/es/components/Slider/components/SliderBase/SliderBase.js.map +1 -0
- package/es/components/Slider/components/SliderBase/SliderBase.styles.js +26 -0
- package/es/components/Slider/components/SliderBase/SliderBase.styles.js.map +1 -0
- package/es/components/Slider/components/SliderBase/SliderBase.styles_7is2ll.css +4 -0
- package/es/components/Slider/ui/Handler/Handler.css +4 -0
- package/es/components/Slider/ui/Handler/Handler.js +164 -0
- package/es/components/Slider/ui/Handler/Handler.js.map +1 -0
- package/es/components/Slider/ui/Handler/Handler.styles.js +16 -0
- package/es/components/Slider/ui/Handler/Handler.styles.js.map +1 -0
- package/es/components/Slider/ui/Handler/Handler.styles_8crx5z.css +2 -0
- package/es/components/Slider/ui/Thumb/Thumb.css +1 -0
- package/es/components/Slider/ui/Thumb/Thumb.js +27 -0
- package/es/components/Slider/ui/Thumb/Thumb.js.map +1 -0
- package/es/components/Slider/ui/Thumb/Thumb.styles.js +11 -0
- package/es/components/Slider/ui/Thumb/Thumb.styles.js.map +1 -0
- package/es/components/Slider/ui/Thumb/Thumb.styles_4w4gzn.css +1 -0
- package/es/components/Slider/utils/index.js +50 -0
- package/es/components/Slider/utils/index.js.map +1 -0
- package/es/components/Slider/variations/_disabled/base.js +5 -0
- package/es/components/Slider/variations/_disabled/base.js.map +1 -0
- package/es/components/Slider/variations/_disabled/base_x642ct.css +1 -0
- package/es/components/Slider/variations/_size/base.js +5 -0
- package/es/components/Slider/variations/_size/base.js.map +1 -0
- package/es/components/Slider/variations/_size/base_x642ct.css +1 -0
- package/es/components/Slider/variations/_view/base.js +5 -0
- package/es/components/Slider/variations/_view/base.js.map +1 -0
- package/es/components/Slider/variations/_view/base_x642ct.css +1 -0
- package/es/components/TextField/TextField.js +12 -3
- package/es/components/TextField/TextField.js.map +1 -1
- package/es/engines/common.js +4 -0
- package/es/engines/common.js.map +1 -1
- package/es/engines/index.js.map +1 -1
- package/es/hooks/useIsomorphicLayoutEffect.js +11 -0
- package/es/hooks/useIsomorphicLayoutEffect.js.map +1 -0
- package/es/index.css +25 -0
- package/es/index.js +8 -0
- package/es/index.js.map +1 -1
- package/es/utils/canUseDOM.js +8 -0
- package/es/utils/canUseDOM.js.map +1 -0
- package/es/utils/index.js.map +1 -1
- package/package.json +3 -2
- package/styled-components/cjs/components/Slider/Slider.js +47 -0
- package/styled-components/cjs/components/Slider/Slider.tokens.js +77 -0
- package/styled-components/cjs/components/Slider/Slider.types.js +5 -0
- package/styled-components/cjs/components/Slider/components/Double/Double.js +318 -0
- package/styled-components/cjs/components/Slider/components/Double/Double.styles.js +36 -0
- package/styled-components/cjs/components/Slider/components/Double/Double.types.js +5 -0
- package/styled-components/cjs/components/Slider/components/Single/Single.js +176 -0
- package/styled-components/cjs/components/Slider/components/Single/Single.styles.js +27 -0
- package/styled-components/cjs/components/Slider/components/Single/Single.types.js +5 -0
- package/styled-components/cjs/components/Slider/components/SliderBase/SliderBase.js +83 -0
- package/styled-components/cjs/components/Slider/components/SliderBase/SliderBase.styles.js +21 -0
- package/styled-components/cjs/components/Slider/components/SliderBase/SliderBase.types.js +5 -0
- package/styled-components/cjs/components/Slider/components/index.js +27 -0
- package/styled-components/cjs/components/Slider/index.js +32 -0
- package/styled-components/cjs/components/Slider/ui/Handler/Handler.js +177 -0
- package/styled-components/cjs/components/Slider/ui/Handler/Handler.styles.js +15 -0
- package/styled-components/cjs/components/Slider/ui/Handler/Handler.types.js +5 -0
- package/styled-components/cjs/components/Slider/ui/Thumb/Thumb.js +32 -0
- package/styled-components/cjs/components/Slider/ui/Thumb/Thumb.styles.js +18 -0
- package/styled-components/cjs/components/Slider/ui/Thumb/Thumb.types.js +5 -0
- package/styled-components/cjs/components/Slider/ui/index.js +63 -0
- package/styled-components/cjs/components/Slider/utils/index.js +55 -0
- package/styled-components/cjs/components/Slider/variations/_disabled/base.js +8 -0
- package/styled-components/cjs/components/Slider/variations/_disabled/tokens.json +4 -0
- package/styled-components/cjs/components/Slider/variations/_size/base.js +8 -0
- package/styled-components/cjs/components/Slider/variations/_size/tokens.json +0 -0
- package/styled-components/cjs/components/Slider/variations/_view/base.js +8 -0
- package/styled-components/cjs/components/Slider/variations/_view/tokens.json +0 -0
- package/styled-components/cjs/components/TextField/TextField.js +12 -3
- package/styled-components/cjs/engines/common.js +4 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Slider/Slider.config.js +29 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Slider/Slider.js +16 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Slider/Slider.stories.tsx +169 -0
- package/styled-components/cjs/examples/plasma_web/components/Slider/Slider.config.js +29 -0
- package/styled-components/cjs/examples/plasma_web/components/Slider/Slider.js +16 -0
- package/styled-components/cjs/examples/plasma_web/components/Slider/Slider.stories.tsx +168 -0
- package/styled-components/cjs/hooks/index.js +8 -1
- package/styled-components/cjs/hooks/useIsomorphicLayoutEffect.js +12 -0
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/cjs/utils/canUseDOM.js +11 -0
- package/styled-components/cjs/utils/index.js +7 -0
- package/styled-components/es/components/Slider/Slider.js +38 -0
- package/styled-components/es/components/Slider/Slider.tokens.js +71 -0
- package/styled-components/es/components/Slider/Slider.types.js +1 -0
- package/styled-components/es/components/Slider/components/Double/Double.js +310 -0
- package/styled-components/es/components/Slider/components/Double/Double.styles.js +29 -0
- package/styled-components/es/components/Slider/components/Double/Double.types.js +1 -0
- package/styled-components/es/components/Slider/components/Single/Single.js +168 -0
- package/styled-components/es/components/Slider/components/Single/Single.styles.js +20 -0
- package/styled-components/es/components/Slider/components/Single/Single.types.js +1 -0
- package/styled-components/es/components/Slider/components/SliderBase/SliderBase.js +74 -0
- package/styled-components/es/components/Slider/components/SliderBase/SliderBase.styles.js +14 -0
- package/styled-components/es/components/Slider/components/SliderBase/SliderBase.types.js +1 -0
- package/styled-components/es/components/Slider/components/index.js +3 -0
- package/styled-components/es/components/Slider/index.js +3 -0
- package/styled-components/es/components/Slider/ui/Handler/Handler.js +168 -0
- package/styled-components/es/components/Slider/ui/Handler/Handler.styles.js +8 -0
- package/styled-components/es/components/Slider/ui/Handler/Handler.types.js +1 -0
- package/styled-components/es/components/Slider/ui/Thumb/Thumb.js +25 -0
- package/styled-components/es/components/Slider/ui/Thumb/Thumb.styles.js +11 -0
- package/styled-components/es/components/Slider/ui/Thumb/Thumb.types.js +1 -0
- package/styled-components/es/components/Slider/ui/index.js +5 -0
- package/styled-components/es/components/Slider/utils/index.js +47 -0
- package/styled-components/es/components/Slider/variations/_disabled/base.js +2 -0
- package/styled-components/es/components/Slider/variations/_disabled/tokens.json +4 -0
- package/styled-components/es/components/Slider/variations/_size/base.js +2 -0
- package/styled-components/es/components/Slider/variations/_size/tokens.json +0 -0
- package/styled-components/es/components/Slider/variations/_view/base.js +2 -0
- package/styled-components/es/components/Slider/variations/_view/tokens.json +0 -0
- package/styled-components/es/components/TextField/TextField.js +12 -3
- package/styled-components/es/engines/common.js +4 -0
- package/styled-components/es/examples/plasma_b2c/components/Slider/Slider.config.js +23 -0
- package/styled-components/es/examples/plasma_b2c/components/Slider/Slider.js +10 -0
- package/styled-components/es/examples/plasma_b2c/components/Slider/Slider.stories.tsx +169 -0
- package/styled-components/es/examples/plasma_web/components/Slider/Slider.config.js +23 -0
- package/styled-components/es/examples/plasma_web/components/Slider/Slider.js +10 -0
- package/styled-components/es/examples/plasma_web/components/Slider/Slider.stories.tsx +168 -0
- package/styled-components/es/hooks/index.js +2 -1
- package/styled-components/es/hooks/useIsomorphicLayoutEffect.js +7 -0
- package/styled-components/es/index.js +2 -1
- package/styled-components/es/utils/canUseDOM.js +5 -0
- package/styled-components/es/utils/index.js +1 -0
- package/types/components/Slider/Slider.d.ts +27 -0
- package/types/components/Slider/Slider.d.ts.map +1 -0
- package/types/components/Slider/Slider.tokens.d.ts +72 -0
- package/types/components/Slider/Slider.tokens.d.ts.map +1 -0
- package/types/components/Slider/Slider.types.d.ts +3 -0
- package/types/components/Slider/Slider.types.d.ts.map +1 -0
- package/types/components/Slider/components/Double/Double.d.ts +4 -0
- package/types/components/Slider/components/Double/Double.d.ts.map +1 -0
- package/types/components/Slider/components/Double/Double.styles.d.ts +43 -0
- package/types/components/Slider/components/Double/Double.styles.d.ts.map +1 -0
- package/types/components/Slider/components/Double/Double.types.d.ts +65 -0
- package/types/components/Slider/components/Double/Double.types.d.ts.map +1 -0
- package/types/components/Slider/components/Single/Single.d.ts +4 -0
- package/types/components/Slider/components/Single/Single.d.ts.map +1 -0
- package/types/components/Slider/components/Single/Single.styles.d.ts +8 -0
- package/types/components/Slider/components/Single/Single.styles.d.ts.map +1 -0
- package/types/components/Slider/components/Single/Single.types.d.ts +55 -0
- package/types/components/Slider/components/Single/Single.types.d.ts.map +1 -0
- package/types/components/Slider/components/SliderBase/SliderBase.d.ts +4 -0
- package/types/components/Slider/components/SliderBase/SliderBase.d.ts.map +1 -0
- package/types/components/Slider/components/SliderBase/SliderBase.styles.d.ts +6 -0
- package/types/components/Slider/components/SliderBase/SliderBase.styles.d.ts.map +1 -0
- package/types/components/Slider/components/SliderBase/SliderBase.types.d.ts +45 -0
- package/types/components/Slider/components/SliderBase/SliderBase.types.d.ts.map +1 -0
- package/types/components/Slider/components/index.d.ts +6 -0
- package/types/components/Slider/components/index.d.ts.map +1 -0
- package/types/components/Slider/index.d.ts +6 -0
- package/types/components/Slider/index.d.ts.map +1 -0
- package/types/components/Slider/ui/Handler/Handler.d.ts +9 -0
- package/types/components/Slider/ui/Handler/Handler.d.ts.map +1 -0
- package/types/components/Slider/ui/Handler/Handler.styles.d.ts +4 -0
- package/types/components/Slider/ui/Handler/Handler.styles.d.ts.map +1 -0
- package/types/components/Slider/ui/Handler/Handler.types.d.ts +24 -0
- package/types/components/Slider/ui/Handler/Handler.types.d.ts.map +1 -0
- package/types/components/Slider/ui/Thumb/Thumb.d.ts +4 -0
- package/types/components/Slider/ui/Thumb/Thumb.d.ts.map +1 -0
- package/types/components/Slider/ui/Thumb/Thumb.styles.d.ts +5 -0
- package/types/components/Slider/ui/Thumb/Thumb.styles.d.ts.map +1 -0
- package/types/components/Slider/ui/Thumb/Thumb.types.d.ts +12 -0
- package/types/components/Slider/ui/Thumb/Thumb.types.d.ts.map +1 -0
- package/types/components/Slider/ui/index.d.ts +6 -0
- package/types/components/Slider/ui/index.d.ts.map +1 -0
- package/types/components/Slider/utils/index.d.ts +33 -0
- package/types/components/Slider/utils/index.d.ts.map +1 -0
- package/types/components/Slider/variations/_disabled/base.d.ts +2 -0
- package/types/components/Slider/variations/_disabled/base.d.ts.map +1 -0
- package/types/components/Slider/variations/_size/base.d.ts +2 -0
- package/types/components/Slider/variations/_size/base.d.ts.map +1 -0
- package/types/components/Slider/variations/_view/base.d.ts +2 -0
- package/types/components/Slider/variations/_view/base.d.ts.map +1 -0
- package/types/components/TextField/TextField.d.ts.map +1 -1
- package/types/engines/common.d.ts +3 -3
- package/types/engines/common.d.ts.map +1 -1
- package/types/engines/index.d.ts +1 -1
- package/types/engines/index.d.ts.map +1 -1
- package/types/engines/types.d.ts +4 -0
- package/types/engines/types.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Slider/Slider.config.d.ts +22 -0
- package/types/examples/plasma_b2c/components/Slider/Slider.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Slider/Slider.d.ts +21 -0
- package/types/examples/plasma_b2c/components/Slider/Slider.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Slider/Slider.config.d.ts +22 -0
- package/types/examples/plasma_web/components/Slider/Slider.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Slider/Slider.d.ts +21 -0
- package/types/examples/plasma_web/components/Slider/Slider.d.ts.map +1 -0
- package/types/hooks/index.d.ts +1 -0
- package/types/hooks/index.d.ts.map +1 -1
- package/types/hooks/useIsomorphicLayoutEffect.d.ts +6 -0
- package/types/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/utils/canUseDOM.d.ts +6 -0
- package/types/utils/canUseDOM.d.ts.map +1 -0
- package/types/utils/index.d.ts +1 -0
- package/types/utils/index.d.ts.map +1 -1
@@ -0,0 +1,83 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
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); }
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.SliderBase = void 0;
|
8
|
+
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
+
var _hooks = /*#__PURE__*/require("../../../../hooks");
|
10
|
+
var _SliderBase = /*#__PURE__*/require("./SliderBase.styles");
|
11
|
+
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); }
|
12
|
+
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 && {}.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; }
|
13
|
+
var SliderBase = exports.SliderBase = function SliderBase(_ref) {
|
14
|
+
var max = _ref.max,
|
15
|
+
min = _ref.min,
|
16
|
+
setStepSize = _ref.setStepSize,
|
17
|
+
railFillWidth = _ref.railFillWidth,
|
18
|
+
children = _ref.children,
|
19
|
+
_ref$railFillXPositio = _ref.railFillXPosition,
|
20
|
+
railFillXPosition = _ref$railFillXPositio === void 0 ? 0 : _ref$railFillXPositio,
|
21
|
+
disabled = _ref.disabled,
|
22
|
+
labelPlacement = _ref.labelPlacement,
|
23
|
+
rangeValuesPlacement = _ref.rangeValuesPlacement,
|
24
|
+
onChange = _ref.onChange,
|
25
|
+
_ref$settings = _ref.settings,
|
26
|
+
settings = _ref$settings === void 0 ? {} : _ref$settings;
|
27
|
+
var _settings$indent = settings.indent,
|
28
|
+
indent = _settings$indent === void 0 ? 0.75 : _settings$indent,
|
29
|
+
_settings$fontSizeMul = settings.fontSizeMultiplier,
|
30
|
+
fontSizeMultiplier = _settings$fontSizeMul === void 0 ? 16 : _settings$fontSizeMul;
|
31
|
+
var ref = (0, _react.useRef)(null);
|
32
|
+
var gap = indent * fontSizeMultiplier * 2;
|
33
|
+
(0, _react.useEffect)(function () {
|
34
|
+
var resizeHandler = function resizeHandler() {
|
35
|
+
if (ref.current) {
|
36
|
+
var railSize = ref.current.offsetWidth - gap;
|
37
|
+
var totalSteps = max - min;
|
38
|
+
setStepSize(railSize / totalSteps);
|
39
|
+
}
|
40
|
+
};
|
41
|
+
resizeHandler();
|
42
|
+
}, [labelPlacement, rangeValuesPlacement, ref.current]);
|
43
|
+
var onHandleChange = function onHandleChange(e) {
|
44
|
+
if (!onChange || disabled) {
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
var _e$currentTarget$getB = e.currentTarget.getBoundingClientRect(),
|
48
|
+
x = _e$currentTarget$getB.x,
|
49
|
+
width = _e$currentTarget$getB.width;
|
50
|
+
var lastX = e.clientX - x;
|
51
|
+
var position = min + lastX / (width - gap) * (max - min);
|
52
|
+
var result = Math.max(min, Math.min(max, position));
|
53
|
+
onChange(result, {
|
54
|
+
lastX: lastX
|
55
|
+
});
|
56
|
+
};
|
57
|
+
(0, _hooks.useIsomorphicLayoutEffect)(function () {
|
58
|
+
var resizeHandler = function resizeHandler() {
|
59
|
+
if (ref.current) {
|
60
|
+
var railSize = ref.current.offsetWidth - gap;
|
61
|
+
var totalSteps = max - min;
|
62
|
+
setStepSize(railSize / totalSteps);
|
63
|
+
}
|
64
|
+
};
|
65
|
+
resizeHandler();
|
66
|
+
window.addEventListener('resize', resizeHandler);
|
67
|
+
return function () {
|
68
|
+
return window.removeEventListener('resize', resizeHandler);
|
69
|
+
};
|
70
|
+
}, [min, max, setStepSize, ref.current, gap, labelPlacement, rangeValuesPlacement]);
|
71
|
+
var fillStyle = {
|
72
|
+
left: "".concat(railFillXPosition, "px"),
|
73
|
+
width: "".concat(railFillWidth, "px")
|
74
|
+
};
|
75
|
+
return /*#__PURE__*/_react["default"].createElement(_SliderBase.Slider, {
|
76
|
+
ref: ref
|
77
|
+
}, /*#__PURE__*/_react["default"].createElement(_SliderBase.RailWrap, {
|
78
|
+
"aria-hidden": "true",
|
79
|
+
onMouseDown: onHandleChange
|
80
|
+
}, /*#__PURE__*/_react["default"].createElement(_SliderBase.Rail, null, /*#__PURE__*/_react["default"].createElement(_SliderBase.Fill, {
|
81
|
+
style: fillStyle
|
82
|
+
}))), children);
|
83
|
+
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Slider = exports.RailWrap = exports.Rail = exports.Fill = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("styled-components"));
|
8
|
+
var _Slider = /*#__PURE__*/require("../../Slider.tokens");
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
10
|
+
var Slider = exports.Slider = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
11
|
+
componentId: "plasma-new-hope__sc-ik0bjb-0"
|
12
|
+
})(["flex:1;position:relative;user-select:none;height:var(", ");"], _Slider.tokens.height);
|
13
|
+
var RailWrap = exports.RailWrap = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
14
|
+
componentId: "plasma-new-hope__sc-ik0bjb-1"
|
15
|
+
})(["height:100%;"]);
|
16
|
+
var Rail = exports.Rail = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
17
|
+
componentId: "plasma-new-hope__sc-ik0bjb-2"
|
18
|
+
})(["position:relative;top:50%;height:var(", ");border-radius:var(", ");background-color:var(", ");overflow:hidden;transform:translateY(-50%);"], _Slider.tokens.railHeight, _Slider.tokens.railBorderRadius, _Slider.tokens.railBackgroundColor);
|
19
|
+
var Fill = exports.Fill = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
20
|
+
componentId: "plasma-new-hope__sc-ik0bjb-3"
|
21
|
+
})(["position:absolute;height:100%;top:0;left:0;background:var(", ");width:0;"], _Slider.tokens.fillColor);
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
var _Single = /*#__PURE__*/require("./Single/Single");
|
7
|
+
Object.keys(_Single).forEach(function (key) {
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
9
|
+
if (key in exports && exports[key] === _Single[key]) return;
|
10
|
+
Object.defineProperty(exports, key, {
|
11
|
+
enumerable: true,
|
12
|
+
get: function get() {
|
13
|
+
return _Single[key];
|
14
|
+
}
|
15
|
+
});
|
16
|
+
});
|
17
|
+
var _Double = /*#__PURE__*/require("./Double/Double");
|
18
|
+
Object.keys(_Double).forEach(function (key) {
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
20
|
+
if (key in exports && exports[key] === _Double[key]) return;
|
21
|
+
Object.defineProperty(exports, key, {
|
22
|
+
enumerable: true,
|
23
|
+
get: function get() {
|
24
|
+
return _Double[key];
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "ThumbBase", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _ui.ThumbBase;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.defineProperty(exports, "sliderConfig", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function get() {
|
15
|
+
return _Slider.sliderConfig;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
Object.defineProperty(exports, "sliderRoot", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function get() {
|
21
|
+
return _Slider.sliderRoot;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
Object.defineProperty(exports, "sliderTokens", {
|
25
|
+
enumerable: true,
|
26
|
+
get: function get() {
|
27
|
+
return _Slider2.tokens;
|
28
|
+
}
|
29
|
+
});
|
30
|
+
var _Slider = /*#__PURE__*/require("./Slider");
|
31
|
+
var _Slider2 = /*#__PURE__*/require("./Slider.tokens");
|
32
|
+
var _ui = /*#__PURE__*/require("./ui");
|
@@ -0,0 +1,177 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
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); }
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.Handler = void 0;
|
8
|
+
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
+
var _reactDraggable = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("react-draggable"));
|
10
|
+
var _utils = /*#__PURE__*/require("../../utils");
|
11
|
+
var _Thumb = /*#__PURE__*/require("../Thumb/Thumb");
|
12
|
+
var _Handler = /*#__PURE__*/require("./Handler.styles");
|
13
|
+
var _excluded = ["stepSize", "onChangeCommitted", "onChange", "xPosition", "min", "max", "bounds", "zIndex", "disabled", "side", "showCurrentValue", "startOffset", "endOffset", "value"];
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15
|
+
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); }
|
16
|
+
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 && {}.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; }
|
17
|
+
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); }
|
18
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
19
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
21
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
22
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
23
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
24
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
25
|
+
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; }
|
26
|
+
// TODO: PLASMA-1707
|
27
|
+
|
28
|
+
var KeyboardSupport = {
|
29
|
+
PageUp: 33,
|
30
|
+
PageDown: 34,
|
31
|
+
End: 35,
|
32
|
+
Home: 36,
|
33
|
+
ArrowLeft: 37,
|
34
|
+
ArrowUp: 38,
|
35
|
+
ArrowRight: 39,
|
36
|
+
ArrowDown: 40
|
37
|
+
};
|
38
|
+
var Handler = exports.Handler = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
39
|
+
var stepSize = _ref.stepSize,
|
40
|
+
onChangeCommitted = _ref.onChangeCommitted,
|
41
|
+
onChange = _ref.onChange,
|
42
|
+
_ref$xPosition = _ref.xPosition,
|
43
|
+
xPosition = _ref$xPosition === void 0 ? 0 : _ref$xPosition,
|
44
|
+
min = _ref.min,
|
45
|
+
max = _ref.max,
|
46
|
+
_ref$bounds = _ref.bounds,
|
47
|
+
bounds = _ref$bounds === void 0 ? [] : _ref$bounds,
|
48
|
+
zIndex = _ref.zIndex,
|
49
|
+
disabled = _ref.disabled,
|
50
|
+
side = _ref.side,
|
51
|
+
_ref$showCurrentValue = _ref.showCurrentValue,
|
52
|
+
showCurrentValue = _ref$showCurrentValue === void 0 ? false : _ref$showCurrentValue,
|
53
|
+
_ref$startOffset = _ref.startOffset,
|
54
|
+
startOffset = _ref$startOffset === void 0 ? 0 : _ref$startOffset,
|
55
|
+
_ref$endOffset = _ref.endOffset,
|
56
|
+
endOffset = _ref$endOffset === void 0 ? 0 : _ref$endOffset,
|
57
|
+
value = _ref.value,
|
58
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
59
|
+
var lastOnChangeValue = (0, _react.useRef)();
|
60
|
+
var _getOffsets = (0, _utils.getOffsets)(ref, side),
|
61
|
+
_getOffsets2 = _slicedToArray(_getOffsets, 2),
|
62
|
+
offsetLeft = _getOffsets2[0],
|
63
|
+
offsetRight = _getOffsets2[1];
|
64
|
+
var _bounds = _slicedToArray(bounds, 2),
|
65
|
+
leftValueBound = _bounds[0],
|
66
|
+
rightValueBound = _bounds[1];
|
67
|
+
var leftPositionBound = leftValueBound ? (leftValueBound - min) * stepSize : null;
|
68
|
+
var rightPositionBound = rightValueBound ? (rightValueBound - min) * stepSize : null;
|
69
|
+
var position = typeof xPosition === 'number' ? {
|
70
|
+
x: xPosition,
|
71
|
+
y: 0
|
72
|
+
} : undefined;
|
73
|
+
var tabIndex = disabled ? -1 : 0;
|
74
|
+
var computedBounds = {
|
75
|
+
left: (leftPositionBound !== null && leftPositionBound !== void 0 ? leftPositionBound : 0) - (offsetLeft ? stepSize : 0),
|
76
|
+
right: (rightPositionBound !== null && rightPositionBound !== void 0 ? rightPositionBound : stepSize * (max - min)) - (offsetRight ? stepSize : 0)
|
77
|
+
};
|
78
|
+
console.log(computedBounds);
|
79
|
+
var showCurrentValueCondition = showCurrentValue && (xPosition >= startOffset && xPosition <= max * stepSize - endOffset || xPosition === 0 && value !== 0);
|
80
|
+
var onDrag = function onDrag(_, data) {
|
81
|
+
var newValue = (0, _utils.getSliderThumbValue)(data.x, stepSize, min, max);
|
82
|
+
if (lastOnChangeValue.current !== newValue) {
|
83
|
+
onChange === null || onChange === void 0 || onChange(newValue, data);
|
84
|
+
lastOnChangeValue.current = newValue;
|
85
|
+
}
|
86
|
+
};
|
87
|
+
var onStop = function onStop(_, data) {
|
88
|
+
var newValue = (0, _utils.getSliderThumbValue)(data.x, stepSize, min, max);
|
89
|
+
onChangeCommitted && onChangeCommitted(newValue, data);
|
90
|
+
};
|
91
|
+
var onKeyPress = function onKeyPress(event) {
|
92
|
+
event.persist();
|
93
|
+
var keyCode = event.keyCode,
|
94
|
+
target = event.target;
|
95
|
+
if (!Object.values(KeyboardSupport).includes(keyCode)) {
|
96
|
+
return;
|
97
|
+
}
|
98
|
+
var ArrowUp = KeyboardSupport.ArrowUp,
|
99
|
+
ArrowRight = KeyboardSupport.ArrowRight,
|
100
|
+
ArrowDown = KeyboardSupport.ArrowDown,
|
101
|
+
ArrowLeft = KeyboardSupport.ArrowLeft,
|
102
|
+
Home = KeyboardSupport.Home,
|
103
|
+
End = KeyboardSupport.End,
|
104
|
+
PageDown = KeyboardSupport.PageDown,
|
105
|
+
PageUp = KeyboardSupport.PageUp;
|
106
|
+
var computedMultipleSteps = stepSize * (rest.multipleStepSize / 100 * max);
|
107
|
+
var data = {
|
108
|
+
x: 0,
|
109
|
+
deltaX: stepSize,
|
110
|
+
lastX: xPosition,
|
111
|
+
y: 0,
|
112
|
+
deltaY: 0,
|
113
|
+
lastY: 0,
|
114
|
+
node: target
|
115
|
+
};
|
116
|
+
switch (keyCode) {
|
117
|
+
case ArrowUp:
|
118
|
+
case ArrowRight:
|
119
|
+
data.x = xPosition + stepSize;
|
120
|
+
break;
|
121
|
+
case ArrowDown:
|
122
|
+
case ArrowLeft:
|
123
|
+
data.x = xPosition - stepSize;
|
124
|
+
data.deltaX = -stepSize;
|
125
|
+
break;
|
126
|
+
case PageUp:
|
127
|
+
data.x = xPosition + computedMultipleSteps;
|
128
|
+
data.deltaX = computedMultipleSteps;
|
129
|
+
break;
|
130
|
+
case PageDown:
|
131
|
+
data.x = xPosition - computedMultipleSteps;
|
132
|
+
data.deltaX = -computedMultipleSteps;
|
133
|
+
break;
|
134
|
+
case End:
|
135
|
+
data.x = max * stepSize;
|
136
|
+
break;
|
137
|
+
case Home:
|
138
|
+
data.x = 0;
|
139
|
+
break;
|
140
|
+
default:
|
141
|
+
data.x = 0;
|
142
|
+
}
|
143
|
+
var left = computedBounds.left,
|
144
|
+
right = computedBounds.right;
|
145
|
+
|
146
|
+
/*
|
147
|
+
* INFO: Находим значение в диапазоне между указанными левой и правой границами.
|
148
|
+
* Необходимо для правильного расчета положения SliderThumb.
|
149
|
+
* см. функция clamp
|
150
|
+
*/
|
151
|
+
var boundedValue = Math.max(Math.min(right, data.x), left);
|
152
|
+
var computedValue = (0, _utils.getSliderThumbValue)(boundedValue, stepSize, min, max);
|
153
|
+
lastOnChangeValue.current = computedValue;
|
154
|
+
onChangeCommitted && onChangeCommitted(computedValue, data);
|
155
|
+
};
|
156
|
+
return /*#__PURE__*/_react["default"].createElement(_reactDraggable["default"], {
|
157
|
+
axis: "x",
|
158
|
+
bounds: computedBounds,
|
159
|
+
grid: [stepSize, 1],
|
160
|
+
onStop: onStop,
|
161
|
+
onDrag: onDrag,
|
162
|
+
position: position,
|
163
|
+
disabled: disabled
|
164
|
+
}, /*#__PURE__*/_react["default"].createElement(_Handler.HandlerStyled, {
|
165
|
+
ref: ref,
|
166
|
+
style: {
|
167
|
+
zIndex: zIndex
|
168
|
+
},
|
169
|
+
onKeyDown: onKeyPress
|
170
|
+
}, /*#__PURE__*/_react["default"].createElement(_Thumb.Thumb, _extends({
|
171
|
+
tabIndex: tabIndex,
|
172
|
+
min: min,
|
173
|
+
max: max,
|
174
|
+
value: value,
|
175
|
+
disabled: disabled
|
176
|
+
}, rest)), showCurrentValueCondition && /*#__PURE__*/_react["default"].createElement(_Handler.StyledValue, null, value)));
|
177
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.StyledValue = exports.HandlerStyled = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("styled-components"));
|
8
|
+
var _Slider = /*#__PURE__*/require("../../Slider.tokens");
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
10
|
+
var HandlerStyled = exports.HandlerStyled = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
11
|
+
componentId: "plasma-new-hope__sc-a1py3c-0"
|
12
|
+
})(["cursor:pointer;position:absolute;z-index:1;top:0;left:0;"]);
|
13
|
+
var StyledValue = exports.StyledValue = /*#__PURE__*/_styledComponents["default"].span.withConfig({
|
14
|
+
componentId: "plasma-new-hope__sc-a1py3c-1"
|
15
|
+
})(["position:absolute;z-index:1;top:var(", ");text-align:center;width:100%;margin-left:-0.125rem;display:flex;justify-content:center;font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");"], _Slider.tokens.currentValueTopOffset, _Slider.tokens.currentValueFontFamily, _Slider.tokens.currentValueFontSize, _Slider.tokens.currentValueFontStyle, _Slider.tokens.currentValueFontWeight, _Slider.tokens.currentValueLetterSpacing, _Slider.tokens.currentValueLineHeight);
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Thumb = void 0;
|
7
|
+
var _react = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("react"));
|
8
|
+
var _Thumb = /*#__PURE__*/require("./Thumb.styles");
|
9
|
+
var _excluded = ["min", "max", "value", "ariaValueMin", "ariaLabel", "disabled"];
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11
|
+
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); }
|
12
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
13
|
+
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; }
|
14
|
+
var Thumb = exports.Thumb = function Thumb(_ref) {
|
15
|
+
var min = _ref.min,
|
16
|
+
max = _ref.max,
|
17
|
+
value = _ref.value,
|
18
|
+
_ref$ariaValueMin = _ref.ariaValueMin,
|
19
|
+
ariaValueMin = _ref$ariaValueMin === void 0 ? min : _ref$ariaValueMin,
|
20
|
+
ariaLabel = _ref.ariaLabel,
|
21
|
+
disabled = _ref.disabled,
|
22
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
23
|
+
return /*#__PURE__*/_react["default"].createElement(_Thumb.ThumbBase, _extends({
|
24
|
+
role: "slider",
|
25
|
+
"aria-label": ariaLabel,
|
26
|
+
"aria-valuemin": ariaValueMin,
|
27
|
+
"aria-valuemax": max,
|
28
|
+
"aria-valuenow": value,
|
29
|
+
disabled: disabled,
|
30
|
+
"aria-orientation": "horizontal"
|
31
|
+
}, rest));
|
32
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.ThumbBase = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("styled-components"));
|
8
|
+
var _mixins = /*#__PURE__*/require("../../../../mixins");
|
9
|
+
var _Slider = /*#__PURE__*/require("../../Slider.tokens");
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11
|
+
var ThumbBase = exports.ThumbBase = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
12
|
+
componentId: "plasma-new-hope__sc-13botku-0"
|
13
|
+
})(["width:var(", ");height:var(", ");position:relative;left:-0.125rem;top:-0.125rem;border-radius:50%;box-sizing:border-box;background:var(", ");margin:0.125rem;transition:border-color 0.1s ease-in-out;&:after{background:var(", ");margin:-0.125rem;content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;}&:not([disabled]):hover:after,&:not([disabled]):active:after{background:var(", ");}&[disabled]{cursor:not-allowed;}&:focus{outline:none;}", ""], _Slider.tokens.thumbSize, _Slider.tokens.thumbSize, _Slider.tokens.thumbBackgroundColor, _Slider.tokens.thumbBorderColor, _Slider.tokens.thumbFocusBorderColor, /*#__PURE__*/(0, _mixins.addFocus)({
|
14
|
+
outlineOffset: '0.125rem',
|
15
|
+
outlineSize: '0.125rem',
|
16
|
+
outlineRadius: '50%',
|
17
|
+
outlineColor: /*#__PURE__*/"var(".concat(_Slider.tokens.thumbFocusBorderColor, ")")
|
18
|
+
}));
|
@@ -0,0 +1,63 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
var _exportNames = {
|
7
|
+
ThumbBase: true
|
8
|
+
};
|
9
|
+
Object.defineProperty(exports, "ThumbBase", {
|
10
|
+
enumerable: true,
|
11
|
+
get: function get() {
|
12
|
+
return _Thumb2.ThumbBase;
|
13
|
+
}
|
14
|
+
});
|
15
|
+
var _Handler = /*#__PURE__*/require("./Handler/Handler");
|
16
|
+
Object.keys(_Handler).forEach(function (key) {
|
17
|
+
if (key === "default" || key === "__esModule") return;
|
18
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
19
|
+
if (key in exports && exports[key] === _Handler[key]) return;
|
20
|
+
Object.defineProperty(exports, key, {
|
21
|
+
enumerable: true,
|
22
|
+
get: function get() {
|
23
|
+
return _Handler[key];
|
24
|
+
}
|
25
|
+
});
|
26
|
+
});
|
27
|
+
var _Thumb = /*#__PURE__*/require("./Thumb/Thumb");
|
28
|
+
Object.keys(_Thumb).forEach(function (key) {
|
29
|
+
if (key === "default" || key === "__esModule") return;
|
30
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
31
|
+
if (key in exports && exports[key] === _Thumb[key]) return;
|
32
|
+
Object.defineProperty(exports, key, {
|
33
|
+
enumerable: true,
|
34
|
+
get: function get() {
|
35
|
+
return _Thumb[key];
|
36
|
+
}
|
37
|
+
});
|
38
|
+
});
|
39
|
+
var _Thumb2 = /*#__PURE__*/require("./Thumb/Thumb.styles");
|
40
|
+
var _Handler2 = /*#__PURE__*/require("./Handler/Handler.types");
|
41
|
+
Object.keys(_Handler2).forEach(function (key) {
|
42
|
+
if (key === "default" || key === "__esModule") return;
|
43
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
44
|
+
if (key in exports && exports[key] === _Handler2[key]) return;
|
45
|
+
Object.defineProperty(exports, key, {
|
46
|
+
enumerable: true,
|
47
|
+
get: function get() {
|
48
|
+
return _Handler2[key];
|
49
|
+
}
|
50
|
+
});
|
51
|
+
});
|
52
|
+
var _Thumb3 = /*#__PURE__*/require("./Thumb/Thumb.types");
|
53
|
+
Object.keys(_Thumb3).forEach(function (key) {
|
54
|
+
if (key === "default" || key === "__esModule") return;
|
55
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
56
|
+
if (key in exports && exports[key] === _Thumb3[key]) return;
|
57
|
+
Object.defineProperty(exports, key, {
|
58
|
+
enumerable: true,
|
59
|
+
get: function get() {
|
60
|
+
return _Thumb3[key];
|
61
|
+
}
|
62
|
+
});
|
63
|
+
});
|
@@ -0,0 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getOffsets = getOffsets;
|
7
|
+
exports.getSliderThumbValue = getSliderThumbValue;
|
8
|
+
exports.sizeData = void 0;
|
9
|
+
/**
|
10
|
+
* Расчитать значение слайдера с учетом его координат и шага изменений.
|
11
|
+
* @param {number} handleCenterXRelative
|
12
|
+
* @param {number} stepSize
|
13
|
+
* @param {number} min
|
14
|
+
* @param {number} max
|
15
|
+
* @return {number}
|
16
|
+
*/
|
17
|
+
function getSliderThumbValue(handleCenterXRelative, stepSize, min, max) {
|
18
|
+
var newValue = Math.round(handleCenterXRelative / stepSize) + min;
|
19
|
+
return Math.min(Math.max(newValue, min), max);
|
20
|
+
}
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Расчитывает значение отступа слайдера на основе его положения (справа, слева) на отрезке слайдера.
|
24
|
+
* Значение используется для правильного расчета ограничения движения слайдера.
|
25
|
+
* @param ref
|
26
|
+
* @param {'left' | 'right'} side
|
27
|
+
* @return Array<number>
|
28
|
+
*/
|
29
|
+
function getOffsets(ref, side) {
|
30
|
+
if (!ref || !('current' in ref) || !ref.current || !side) {
|
31
|
+
return [0, 0];
|
32
|
+
}
|
33
|
+
var size = ref.current.clientWidth;
|
34
|
+
if (side === 'left') {
|
35
|
+
return [0, size];
|
36
|
+
}
|
37
|
+
if (side === 'right') {
|
38
|
+
return [size, 0];
|
39
|
+
}
|
40
|
+
return [0, 0];
|
41
|
+
}
|
42
|
+
var sizeData = exports.sizeData = {
|
43
|
+
s: {
|
44
|
+
indent: 0.5,
|
45
|
+
fontSizeMultiplier: 16
|
46
|
+
},
|
47
|
+
m: {
|
48
|
+
indent: 0.75,
|
49
|
+
fontSizeMultiplier: 16
|
50
|
+
},
|
51
|
+
l: {
|
52
|
+
indent: 0.75,
|
53
|
+
fontSizeMultiplier: 16
|
54
|
+
}
|
55
|
+
};
|
File without changes
|
File without changes
|
@@ -18,7 +18,7 @@ var _TextField = /*#__PURE__*/require("./TextField.styles");
|
|
18
18
|
var _TextField2 = /*#__PURE__*/require("./TextField.tokens");
|
19
19
|
var _ui = /*#__PURE__*/require("./ui");
|
20
20
|
var _hooks = /*#__PURE__*/require("./hooks");
|
21
|
-
var _excluded = ["id", "contentLeft", "contentRight", "label", "labelPlacement", "placeholder", "leftHelper", "enumerationType", "view", "size", "readOnly", "disabled", "chips", "onChange", "onChangeChips", "onSearch"];
|
21
|
+
var _excluded = ["id", "className", "style", "contentLeft", "contentRight", "label", "labelPlacement", "placeholder", "leftHelper", "enumerationType", "view", "size", "readOnly", "disabled", "chips", "onChange", "onChangeChips", "onSearch", "onKeyDown"];
|
22
22
|
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); }
|
23
23
|
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 && {}.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; }
|
24
24
|
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); }
|
@@ -34,6 +34,8 @@ var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["display:bloc
|
|
34
34
|
var textFieldRoot = exports.textFieldRoot = function textFieldRoot(Root) {
|
35
35
|
return /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
36
36
|
var id = _ref.id,
|
37
|
+
className = _ref.className,
|
38
|
+
style = _ref.style,
|
37
39
|
contentLeft = _ref.contentLeft,
|
38
40
|
contentRight = _ref.contentRight,
|
39
41
|
label = _ref.label,
|
@@ -52,6 +54,7 @@ var textFieldRoot = exports.textFieldRoot = function textFieldRoot(Root) {
|
|
52
54
|
onChange = _ref.onChange,
|
53
55
|
onChangeChips = _ref.onChangeChips,
|
54
56
|
onSearch = _ref.onSearch,
|
57
|
+
onKeyDown = _ref.onKeyDown,
|
55
58
|
rest = _objectWithoutProperties(_ref, _excluded);
|
56
59
|
var contentRef = (0, _react.useRef)(null);
|
57
60
|
var inputRef = (0, _react.useRef)(null);
|
@@ -131,6 +134,10 @@ var textFieldRoot = exports.textFieldRoot = function textFieldRoot(Root) {
|
|
131
134
|
chipsRefs.current[index] = element;
|
132
135
|
}
|
133
136
|
};
|
137
|
+
var handleOnKeyDown = function handleOnKeyDown(event) {
|
138
|
+
handleInputKeydown(event);
|
139
|
+
onKeyDown && onKeyDown(event);
|
140
|
+
};
|
134
141
|
(0, _react.useEffect)(function () {
|
135
142
|
if (!isChipEnumeration && !(values !== null && values !== void 0 && values.length)) {
|
136
143
|
return;
|
@@ -149,7 +156,9 @@ var textFieldRoot = exports.textFieldRoot = function textFieldRoot(Root) {
|
|
149
156
|
disabled: disabled,
|
150
157
|
readOnly: !disabled && readOnly,
|
151
158
|
labelPlacement: innerLabelPlacementValue,
|
152
|
-
onClick: handleInputFocus
|
159
|
+
onClick: handleInputFocus,
|
160
|
+
className: className,
|
161
|
+
style: style
|
153
162
|
}, labelInside || innerLabelValue && /*#__PURE__*/_react["default"].createElement(_TextField.Label, {
|
154
163
|
id: labelId,
|
155
164
|
htmlFor: id
|
@@ -190,7 +199,7 @@ var textFieldRoot = exports.textFieldRoot = function textFieldRoot(Root) {
|
|
190
199
|
disabled: disabled,
|
191
200
|
readOnly: !disabled && readOnly,
|
192
201
|
onChange: handleChange,
|
193
|
-
onKeyDown:
|
202
|
+
onKeyDown: handleOnKeyDown
|
194
203
|
})), labelInside && /*#__PURE__*/_react["default"].createElement(_TextField.Label, {
|
195
204
|
id: labelId,
|
196
205
|
htmlFor: innerId
|