@nulogy/components 6.6.4 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +75 -58
- package/dist/main.module.js +71 -54
- package/dist/src/Toggle/ToggleButton.d.ts +4 -7
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('styled-components'), require('@babel/runtime/helpers/typeof'), require('@babel/runtime/helpers/classCallCheck'), require('@babel/runtime/helpers/createClass'), require('@babel/runtime/helpers/defineProperty'), require('object-assign'), require('@nulogy/icons'), require('@babel/runtime/helpers/extends'), require('@babel/runtime/helpers/assertThisInitialized'), require('@babel/runtime/helpers/inheritsLoose'), require('prop-types'), require('react-fast-compare'), require('warning'), require('@babel/runtime/helpers/slicedToArray'), require('@babel/runtime/helpers/objectWithoutPropertiesLoose'), require('deep-equal'), require('create-react-context'), require('react-dom'), require('react-windowed-select'), require('exenv'), require('smoothscroll-polyfill'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', 'styled-components', '@babel/runtime/helpers/typeof', '@babel/runtime/helpers/classCallCheck', '@babel/runtime/helpers/createClass', '@babel/runtime/helpers/defineProperty', 'object-assign', '@nulogy/icons', '@babel/runtime/helpers/extends', '@babel/runtime/helpers/assertThisInitialized', '@babel/runtime/helpers/inheritsLoose', 'prop-types', 'react-fast-compare', 'warning', '@babel/runtime/helpers/slicedToArray', '@babel/runtime/helpers/objectWithoutPropertiesLoose', 'deep-equal', 'create-react-context', 'react-dom', 'react-windowed-select', 'exenv', 'smoothscroll-polyfill', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.NDSComponents = {}, global.React, global.styled, global.typeof, global.classCallCheck, global.createClass, global.defineProperty, global.assign, global.icons, global.extends, global.assertThisInitialized, global.inheritsLoose, global.PropTypes, global.isEqual, global.warning, global.slicedToArray, global.objectWithoutPropertiesLoose, global.deepEqual, global.createReactContext, global.reactDom, global.components, global.exenv, global.smoothscroll, global.
|
|
5
|
-
}(this, (function (exports, React, styled, _typeof$3, _classCallCheck$3, _createClass$3, _defineProperty$2, assign$1, icons, _extends$4, _assertThisInitialized$4, _inheritsLoose$2, PropTypes, isEqual$2, warning$1, _slicedToArray$1, _objectWithoutPropertiesLoose$2, deepEqual, createContext, reactDom, WindowedSelect, exenv, smoothscroll,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('styled-components'), require('@babel/runtime/helpers/typeof'), require('@babel/runtime/helpers/classCallCheck'), require('@babel/runtime/helpers/createClass'), require('@babel/runtime/helpers/defineProperty'), require('object-assign'), require('@nulogy/icons'), require('@babel/runtime/helpers/extends'), require('@babel/runtime/helpers/assertThisInitialized'), require('@babel/runtime/helpers/inheritsLoose'), require('prop-types'), require('react-fast-compare'), require('warning'), require('@babel/runtime/helpers/slicedToArray'), require('@babel/runtime/helpers/objectWithoutPropertiesLoose'), require('deep-equal'), require('create-react-context'), require('react-dom'), require('react-windowed-select'), require('exenv'), require('smoothscroll-polyfill'), require('@babel/runtime/helpers/toConsumableArray'), require('react-input-autosize'), require('@babel/runtime/helpers/taggedTemplateLiteral'), require('classnames')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', 'styled-components', '@babel/runtime/helpers/typeof', '@babel/runtime/helpers/classCallCheck', '@babel/runtime/helpers/createClass', '@babel/runtime/helpers/defineProperty', 'object-assign', '@nulogy/icons', '@babel/runtime/helpers/extends', '@babel/runtime/helpers/assertThisInitialized', '@babel/runtime/helpers/inheritsLoose', 'prop-types', 'react-fast-compare', 'warning', '@babel/runtime/helpers/slicedToArray', '@babel/runtime/helpers/objectWithoutPropertiesLoose', 'deep-equal', 'create-react-context', 'react-dom', 'react-windowed-select', 'exenv', 'smoothscroll-polyfill', '@babel/runtime/helpers/toConsumableArray', 'react-input-autosize', '@babel/runtime/helpers/taggedTemplateLiteral', 'classnames'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.NDSComponents = {}, global.React, global.styled, global.typeof, global.classCallCheck, global.createClass, global.defineProperty, global.assign, global.icons, global.extends, global.assertThisInitialized, global.inheritsLoose, global.PropTypes, global.isEqual, global.warning, global.slicedToArray, global.objectWithoutPropertiesLoose, global.deepEqual, global.createReactContext, global.reactDom, global.components, global.exenv, global.smoothscroll, null, global.AutosizeInput, null, global.t));
|
|
5
|
+
}(this, (function (exports, React, styled, _typeof$3, _classCallCheck$3, _createClass$3, _defineProperty$2, assign$1, icons, _extends$4, _assertThisInitialized$4, _inheritsLoose$2, PropTypes, isEqual$2, warning$1, _slicedToArray$1, _objectWithoutPropertiesLoose$2, deepEqual, createContext, reactDom, WindowedSelect, exenv, smoothscroll, toConsumableArray, AutosizeInput, taggedTemplateLiteral, t) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
var WindowedSelect__default = /*#__PURE__*/_interopDefaultLegacy(WindowedSelect);
|
|
50
50
|
var exenv__default = /*#__PURE__*/_interopDefaultLegacy(exenv);
|
|
51
51
|
var smoothscroll__default = /*#__PURE__*/_interopDefaultLegacy(smoothscroll);
|
|
52
|
-
var t__default = /*#__PURE__*/_interopDefaultLegacy(t);
|
|
53
52
|
var AutosizeInput__default = /*#__PURE__*/_interopDefaultLegacy(AutosizeInput);
|
|
53
|
+
var t__default = /*#__PURE__*/_interopDefaultLegacy(t);
|
|
54
54
|
|
|
55
55
|
var defaultOptions = {
|
|
56
56
|
bindI18n: 'languageChanged',
|
|
@@ -24495,68 +24495,83 @@
|
|
|
24495
24495
|
default: false
|
|
24496
24496
|
};
|
|
24497
24497
|
|
|
24498
|
-
var
|
|
24499
|
-
|
|
24500
|
-
|
|
24501
|
-
|
|
24502
|
-
|
|
24503
|
-
|
|
24504
|
-
|
|
24505
|
-
|
|
24506
|
-
|
|
24507
|
-
|
|
24508
|
-
|
|
24509
|
-
|
|
24510
|
-
|
|
24511
|
-
|
|
24512
|
-
|
|
24513
|
-
|
|
24514
|
-
|
|
24515
|
-
|
|
24516
|
-
|
|
24517
|
-
|
|
24518
|
-
|
|
24519
|
-
|
|
24520
|
-
|
|
24521
|
-
|
|
24522
|
-
|
|
24523
|
-
|
|
24524
|
-
|
|
24525
|
-
|
|
24526
|
-
|
|
24527
|
-
|
|
24528
|
-
|
|
24529
|
-
|
|
24530
|
-
|
|
24531
|
-
|
|
24532
|
-
|
|
24533
|
-
|
|
24534
|
-
|
|
24535
|
-
return {
|
|
24536
|
-
|
|
24537
|
-
|
|
24538
|
-
|
|
24539
|
-
|
|
24540
|
-
|
|
24541
|
-
|
|
24542
|
-
|
|
24543
|
-
|
|
24498
|
+
var getSwitchBackground = function getSwitchBackground(toggled) {
|
|
24499
|
+
return toggled ? "darkBlue" : "darkGrey";
|
|
24500
|
+
};
|
|
24501
|
+
|
|
24502
|
+
var animationConfig = {
|
|
24503
|
+
transition: {
|
|
24504
|
+
type: "spring",
|
|
24505
|
+
stiffness: 850,
|
|
24506
|
+
damping: 37,
|
|
24507
|
+
duration: 0.1
|
|
24508
|
+
},
|
|
24509
|
+
scale: 1.08
|
|
24510
|
+
};
|
|
24511
|
+
|
|
24512
|
+
var Switch$1 = function Switch(_ref) {
|
|
24513
|
+
var children = _ref.children,
|
|
24514
|
+
disabled = _ref.disabled,
|
|
24515
|
+
toggled = _ref.toggled,
|
|
24516
|
+
onClick = _ref.onClick;
|
|
24517
|
+
return /*#__PURE__*/React__default['default'].createElement(AnimatedBox, {
|
|
24518
|
+
display: "flex",
|
|
24519
|
+
alignItems: "center",
|
|
24520
|
+
justifyContent: toggled ? "flex-end" : "flex-start",
|
|
24521
|
+
height: "24px",
|
|
24522
|
+
width: "48px",
|
|
24523
|
+
bg: disabled ? "grey" : getSwitchBackground(toggled),
|
|
24524
|
+
borderRadius: "20px",
|
|
24525
|
+
padding: "2px",
|
|
24526
|
+
boxShadow: "small",
|
|
24527
|
+
whileHover: "hover",
|
|
24528
|
+
onClick: onClick
|
|
24529
|
+
}, children);
|
|
24530
|
+
};
|
|
24531
|
+
|
|
24532
|
+
var Slider = function Slider(_ref2) {
|
|
24533
|
+
var disabled = _ref2.disabled,
|
|
24534
|
+
children = _ref2.children;
|
|
24535
|
+
return /*#__PURE__*/React__default['default'].createElement(motion.div, {
|
|
24536
|
+
className: "slider",
|
|
24537
|
+
layout: true,
|
|
24538
|
+
variants: {
|
|
24539
|
+
hover: {
|
|
24540
|
+
boxShadow: disabled ? undefined : Theme.shadows.focus,
|
|
24541
|
+
scale: disabled ? undefined : animationConfig.scale
|
|
24542
|
+
}
|
|
24543
|
+
},
|
|
24544
|
+
transition: animationConfig.transition,
|
|
24545
|
+
whileFocus: {
|
|
24546
|
+
boxShadow: disabled ? undefined : Theme.shadows.focus,
|
|
24547
|
+
scale: disabled ? undefined : animationConfig.scale
|
|
24548
|
+
},
|
|
24549
|
+
style: {
|
|
24550
|
+
height: "20px",
|
|
24551
|
+
width: "20px",
|
|
24552
|
+
borderRadius: "50%",
|
|
24553
|
+
backgroundColor: disabled ? Theme.colors.whiteGrey : Theme.colors.white
|
|
24544
24554
|
}
|
|
24545
|
-
};
|
|
24546
|
-
}
|
|
24555
|
+
}, children);
|
|
24556
|
+
};
|
|
24557
|
+
|
|
24547
24558
|
var ToggleInput = styled__default['default'].input.withConfig({
|
|
24548
24559
|
displayName: "ToggleButton__ToggleInput",
|
|
24549
|
-
componentId: "t7wo9n-
|
|
24560
|
+
componentId: "t7wo9n-0"
|
|
24550
24561
|
})(function (_ref3) {
|
|
24551
24562
|
var _ref4;
|
|
24552
24563
|
|
|
24553
24564
|
var disabled = _ref3.disabled,
|
|
24554
24565
|
theme = _ref3.theme;
|
|
24555
|
-
return _ref4 = {
|
|
24556
|
-
|
|
24557
|
-
|
|
24566
|
+
return _ref4 = {
|
|
24567
|
+
width: "1px",
|
|
24568
|
+
height: "1px",
|
|
24569
|
+
opacity: 0,
|
|
24570
|
+
position: "absolute"
|
|
24571
|
+
}, _ref4["&:checked + .slider}"] = {
|
|
24558
24572
|
backgroundColor: disabled ? theme.colors.grey : theme.colors.darkBlue
|
|
24559
|
-
}, _ref4["&:focus + "
|
|
24573
|
+
}, _ref4["&:focus + .slider"] = {
|
|
24574
|
+
transform: disabled ? null : "scale(" + animationConfig.scale + ")",
|
|
24560
24575
|
boxShadow: disabled ? undefined : theme.shadows.focus
|
|
24561
24576
|
}, _ref4;
|
|
24562
24577
|
});
|
|
@@ -24577,6 +24592,8 @@
|
|
|
24577
24592
|
};
|
|
24578
24593
|
|
|
24579
24594
|
return /*#__PURE__*/React__default['default'].createElement(Switch$1, {
|
|
24595
|
+
disabled: disabled,
|
|
24596
|
+
toggled: toggled,
|
|
24580
24597
|
onClick: handleClick
|
|
24581
24598
|
}, /*#__PURE__*/React__default['default'].createElement(ToggleInput, Object.assign({
|
|
24582
24599
|
ref: inputRef,
|
package/dist/main.module.js
CHANGED
|
@@ -21,10 +21,10 @@ import reactDom, { findDOMNode, createPortal } from 'react-dom';
|
|
|
21
21
|
import WindowedSelect, { components as components$1 } from 'react-windowed-select';
|
|
22
22
|
import exenv from 'exenv';
|
|
23
23
|
import smoothscroll from 'smoothscroll-polyfill';
|
|
24
|
-
import t from 'classnames';
|
|
25
24
|
import '@babel/runtime/helpers/toConsumableArray';
|
|
26
25
|
import AutosizeInput from 'react-input-autosize';
|
|
27
26
|
import '@babel/runtime/helpers/taggedTemplateLiteral';
|
|
27
|
+
import t from 'classnames';
|
|
28
28
|
|
|
29
29
|
var defaultOptions = {
|
|
30
30
|
bindI18n: 'languageChanged',
|
|
@@ -24469,68 +24469,83 @@ RadioGroup.defaultProps = {
|
|
|
24469
24469
|
default: false
|
|
24470
24470
|
};
|
|
24471
24471
|
|
|
24472
|
-
var
|
|
24473
|
-
|
|
24474
|
-
|
|
24475
|
-
|
|
24476
|
-
|
|
24477
|
-
|
|
24478
|
-
|
|
24479
|
-
|
|
24480
|
-
|
|
24481
|
-
|
|
24482
|
-
|
|
24483
|
-
|
|
24484
|
-
|
|
24485
|
-
|
|
24486
|
-
|
|
24487
|
-
|
|
24488
|
-
|
|
24489
|
-
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
|
|
24493
|
-
|
|
24494
|
-
|
|
24495
|
-
|
|
24496
|
-
|
|
24497
|
-
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
|
|
24501
|
-
|
|
24502
|
-
|
|
24503
|
-
});
|
|
24504
|
-
|
|
24505
|
-
|
|
24506
|
-
|
|
24507
|
-
|
|
24508
|
-
|
|
24509
|
-
return {
|
|
24510
|
-
|
|
24511
|
-
|
|
24512
|
-
|
|
24513
|
-
|
|
24514
|
-
|
|
24515
|
-
|
|
24516
|
-
|
|
24517
|
-
|
|
24472
|
+
var getSwitchBackground = function getSwitchBackground(toggled) {
|
|
24473
|
+
return toggled ? "darkBlue" : "darkGrey";
|
|
24474
|
+
};
|
|
24475
|
+
|
|
24476
|
+
var animationConfig = {
|
|
24477
|
+
transition: {
|
|
24478
|
+
type: "spring",
|
|
24479
|
+
stiffness: 850,
|
|
24480
|
+
damping: 37,
|
|
24481
|
+
duration: 0.1
|
|
24482
|
+
},
|
|
24483
|
+
scale: 1.08
|
|
24484
|
+
};
|
|
24485
|
+
|
|
24486
|
+
var Switch$1 = function Switch(_ref) {
|
|
24487
|
+
var children = _ref.children,
|
|
24488
|
+
disabled = _ref.disabled,
|
|
24489
|
+
toggled = _ref.toggled,
|
|
24490
|
+
onClick = _ref.onClick;
|
|
24491
|
+
return /*#__PURE__*/React__default.createElement(AnimatedBox, {
|
|
24492
|
+
display: "flex",
|
|
24493
|
+
alignItems: "center",
|
|
24494
|
+
justifyContent: toggled ? "flex-end" : "flex-start",
|
|
24495
|
+
height: "24px",
|
|
24496
|
+
width: "48px",
|
|
24497
|
+
bg: disabled ? "grey" : getSwitchBackground(toggled),
|
|
24498
|
+
borderRadius: "20px",
|
|
24499
|
+
padding: "2px",
|
|
24500
|
+
boxShadow: "small",
|
|
24501
|
+
whileHover: "hover",
|
|
24502
|
+
onClick: onClick
|
|
24503
|
+
}, children);
|
|
24504
|
+
};
|
|
24505
|
+
|
|
24506
|
+
var Slider = function Slider(_ref2) {
|
|
24507
|
+
var disabled = _ref2.disabled,
|
|
24508
|
+
children = _ref2.children;
|
|
24509
|
+
return /*#__PURE__*/React__default.createElement(motion.div, {
|
|
24510
|
+
className: "slider",
|
|
24511
|
+
layout: true,
|
|
24512
|
+
variants: {
|
|
24513
|
+
hover: {
|
|
24514
|
+
boxShadow: disabled ? undefined : Theme.shadows.focus,
|
|
24515
|
+
scale: disabled ? undefined : animationConfig.scale
|
|
24516
|
+
}
|
|
24517
|
+
},
|
|
24518
|
+
transition: animationConfig.transition,
|
|
24519
|
+
whileFocus: {
|
|
24520
|
+
boxShadow: disabled ? undefined : Theme.shadows.focus,
|
|
24521
|
+
scale: disabled ? undefined : animationConfig.scale
|
|
24522
|
+
},
|
|
24523
|
+
style: {
|
|
24524
|
+
height: "20px",
|
|
24525
|
+
width: "20px",
|
|
24526
|
+
borderRadius: "50%",
|
|
24527
|
+
backgroundColor: disabled ? Theme.colors.whiteGrey : Theme.colors.white
|
|
24518
24528
|
}
|
|
24519
|
-
};
|
|
24520
|
-
}
|
|
24529
|
+
}, children);
|
|
24530
|
+
};
|
|
24531
|
+
|
|
24521
24532
|
var ToggleInput = styled.input.withConfig({
|
|
24522
24533
|
displayName: "ToggleButton__ToggleInput",
|
|
24523
|
-
componentId: "t7wo9n-
|
|
24534
|
+
componentId: "t7wo9n-0"
|
|
24524
24535
|
})(function (_ref3) {
|
|
24525
24536
|
var _ref4;
|
|
24526
24537
|
|
|
24527
24538
|
var disabled = _ref3.disabled,
|
|
24528
24539
|
theme = _ref3.theme;
|
|
24529
|
-
return _ref4 = {
|
|
24530
|
-
|
|
24531
|
-
|
|
24540
|
+
return _ref4 = {
|
|
24541
|
+
width: "1px",
|
|
24542
|
+
height: "1px",
|
|
24543
|
+
opacity: 0,
|
|
24544
|
+
position: "absolute"
|
|
24545
|
+
}, _ref4["&:checked + .slider}"] = {
|
|
24532
24546
|
backgroundColor: disabled ? theme.colors.grey : theme.colors.darkBlue
|
|
24533
|
-
}, _ref4["&:focus + "
|
|
24547
|
+
}, _ref4["&:focus + .slider"] = {
|
|
24548
|
+
transform: disabled ? null : "scale(" + animationConfig.scale + ")",
|
|
24534
24549
|
boxShadow: disabled ? undefined : theme.shadows.focus
|
|
24535
24550
|
}, _ref4;
|
|
24536
24551
|
});
|
|
@@ -24551,6 +24566,8 @@ var ToggleButton = /*#__PURE__*/React__default.forwardRef(function (props, ref)
|
|
|
24551
24566
|
};
|
|
24552
24567
|
|
|
24553
24568
|
return /*#__PURE__*/React__default.createElement(Switch$1, {
|
|
24569
|
+
disabled: disabled,
|
|
24570
|
+
toggled: toggled,
|
|
24554
24571
|
onClick: handleClick
|
|
24555
24572
|
}, /*#__PURE__*/React__default.createElement(ToggleInput, Object.assign({
|
|
24556
24573
|
ref: inputRef,
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DefaultNDSThemeType } from "../theme.type";
|
|
3
|
-
declare type
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
name?: string;
|
|
6
|
-
theme?: DefaultNDSThemeType;
|
|
7
|
-
};
|
|
8
|
-
declare type ToggleButtonProps = ToggleInputProps & {
|
|
3
|
+
declare type ToggleButtonProps = React.ComponentPropsWithRef<"input"> & {
|
|
9
4
|
defaultToggled?: boolean;
|
|
10
5
|
toggled?: boolean;
|
|
11
6
|
disabled?: boolean;
|
|
7
|
+
name?: string;
|
|
8
|
+
theme?: DefaultNDSThemeType;
|
|
12
9
|
};
|
|
13
|
-
declare const ToggleButton: React.
|
|
10
|
+
declare const ToggleButton: React.FC<ToggleButtonProps>;
|
|
14
11
|
export default ToggleButton;
|