@nulogy/components 6.6.3 → 6.7.1
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 +100 -64
- package/dist/main.module.js +96 -60
- package/dist/src/Layout/Sidebar.d.ts +1 -1
- package/dist/src/Layout/Sidebar.story.d.ts +1 -0
- package/dist/src/Radio/RadioGroup.story.d.ts +5 -0
- package/dist/src/Toggle/ToggleButton.d.ts +4 -7
- package/dist/src/utils/ts/FocusManager.d.ts +1 -0
- 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,
|
|
@@ -27497,9 +27514,10 @@
|
|
|
27497
27514
|
var FocusManager = function FocusManager(_ref) {
|
|
27498
27515
|
var children = _ref.children,
|
|
27499
27516
|
_ref$refs = _ref.refs,
|
|
27500
|
-
refs = _ref$refs === void 0 ? undefined : _ref$refs
|
|
27517
|
+
refs = _ref$refs === void 0 ? undefined : _ref$refs,
|
|
27518
|
+
defaultFocusedIndex = _ref.defaultFocusedIndex;
|
|
27501
27519
|
|
|
27502
|
-
var _useState = React.useState(0),
|
|
27520
|
+
var _useState = React.useState(defaultFocusedIndex !== null && defaultFocusedIndex !== void 0 ? defaultFocusedIndex : 0),
|
|
27503
27521
|
focusedIndex = _useState[0],
|
|
27504
27522
|
setFocusedIndex = _useState[1];
|
|
27505
27523
|
|
|
@@ -27970,7 +27988,8 @@
|
|
|
27970
27988
|
return /*#__PURE__*/React__default['default'].createElement(Box, {
|
|
27971
27989
|
position: "relative"
|
|
27972
27990
|
}, /*#__PURE__*/React__default['default'].createElement(FocusManager, {
|
|
27973
|
-
refs: this.tabRefs
|
|
27991
|
+
refs: this.tabRefs,
|
|
27992
|
+
defaultFocusedIndex: this.getSelectedIndex()
|
|
27974
27993
|
}, function (_ref2) {
|
|
27975
27994
|
var focusedIndex = _ref2.focusedIndex,
|
|
27976
27995
|
setFocusedIndex = _ref2.setFocusedIndex,
|
|
@@ -28019,6 +28038,14 @@
|
|
|
28019
28038
|
return value === selected;
|
|
28020
28039
|
};
|
|
28021
28040
|
|
|
28041
|
+
var getSelectedIndex = function getSelectedIndex() {
|
|
28042
|
+
return React__default['default'].Children.toArray(rest.children).findIndex(function (child) {
|
|
28043
|
+
var _a, _b;
|
|
28044
|
+
|
|
28045
|
+
return ((_b = (_a = child) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.value) === selected;
|
|
28046
|
+
});
|
|
28047
|
+
};
|
|
28048
|
+
|
|
28022
28049
|
var options = function options(focusedIndex, setFocusedIndex, handleArrowNavigation) {
|
|
28023
28050
|
return React__default['default'].Children.map(rest.children, function (child, index) {
|
|
28024
28051
|
return /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
@@ -28046,7 +28073,8 @@
|
|
|
28046
28073
|
bg: "whiteGrey",
|
|
28047
28074
|
borderRadius: "20px"
|
|
28048
28075
|
}, rest), /*#__PURE__*/React__default['default'].createElement(FocusManager, {
|
|
28049
|
-
refs: optionRefs
|
|
28076
|
+
refs: optionRefs,
|
|
28077
|
+
defaultFocusedIndex: getSelectedIndex()
|
|
28050
28078
|
}, function (_ref2) {
|
|
28051
28079
|
var focusedIndex = _ref2.focusedIndex,
|
|
28052
28080
|
setFocusedIndex = _ref2.setFocusedIndex,
|
|
@@ -52663,8 +52691,16 @@
|
|
|
52663
52691
|
}
|
|
52664
52692
|
}, /*#__PURE__*/React__default['default'].createElement(Flex, {
|
|
52665
52693
|
justifyContent: "space-between",
|
|
52666
|
-
alignItems: "flex-start"
|
|
52667
|
-
|
|
52694
|
+
alignItems: "flex-start",
|
|
52695
|
+
pb: "x3"
|
|
52696
|
+
}, title && /*#__PURE__*/React__default['default'].createElement(Flex, {
|
|
52697
|
+
alignItems: "center",
|
|
52698
|
+
height: "100%"
|
|
52699
|
+
}, /*#__PURE__*/React__default['default'].createElement(Heading3, {
|
|
52700
|
+
mb: 0
|
|
52701
|
+
}, title)), !hideCloseButton && /*#__PURE__*/React__default['default'].createElement(Box, {
|
|
52702
|
+
marginLeft: "x2"
|
|
52703
|
+
}, /*#__PURE__*/React__default['default'].createElement(IconicButton, {
|
|
52668
52704
|
ref: closeButton,
|
|
52669
52705
|
icon: "close",
|
|
52670
52706
|
onClick: onClose,
|
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,
|
|
@@ -27471,9 +27488,10 @@ Tab.defaultProps = {
|
|
|
27471
27488
|
var FocusManager = function FocusManager(_ref) {
|
|
27472
27489
|
var children = _ref.children,
|
|
27473
27490
|
_ref$refs = _ref.refs,
|
|
27474
|
-
refs = _ref$refs === void 0 ? undefined : _ref$refs
|
|
27491
|
+
refs = _ref$refs === void 0 ? undefined : _ref$refs,
|
|
27492
|
+
defaultFocusedIndex = _ref.defaultFocusedIndex;
|
|
27475
27493
|
|
|
27476
|
-
var _useState = useState(0),
|
|
27494
|
+
var _useState = useState(defaultFocusedIndex !== null && defaultFocusedIndex !== void 0 ? defaultFocusedIndex : 0),
|
|
27477
27495
|
focusedIndex = _useState[0],
|
|
27478
27496
|
setFocusedIndex = _useState[1];
|
|
27479
27497
|
|
|
@@ -27944,7 +27962,8 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
27944
27962
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
27945
27963
|
position: "relative"
|
|
27946
27964
|
}, /*#__PURE__*/React__default.createElement(FocusManager, {
|
|
27947
|
-
refs: this.tabRefs
|
|
27965
|
+
refs: this.tabRefs,
|
|
27966
|
+
defaultFocusedIndex: this.getSelectedIndex()
|
|
27948
27967
|
}, function (_ref2) {
|
|
27949
27968
|
var focusedIndex = _ref2.focusedIndex,
|
|
27950
27969
|
setFocusedIndex = _ref2.setFocusedIndex,
|
|
@@ -27993,6 +28012,14 @@ var Switcher = function Switcher(_a) {
|
|
|
27993
28012
|
return value === selected;
|
|
27994
28013
|
};
|
|
27995
28014
|
|
|
28015
|
+
var getSelectedIndex = function getSelectedIndex() {
|
|
28016
|
+
return React__default.Children.toArray(rest.children).findIndex(function (child) {
|
|
28017
|
+
var _a, _b;
|
|
28018
|
+
|
|
28019
|
+
return ((_b = (_a = child) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.value) === selected;
|
|
28020
|
+
});
|
|
28021
|
+
};
|
|
28022
|
+
|
|
27996
28023
|
var options = function options(focusedIndex, setFocusedIndex, handleArrowNavigation) {
|
|
27997
28024
|
return React__default.Children.map(rest.children, function (child, index) {
|
|
27998
28025
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
@@ -28020,7 +28047,8 @@ var Switcher = function Switcher(_a) {
|
|
|
28020
28047
|
bg: "whiteGrey",
|
|
28021
28048
|
borderRadius: "20px"
|
|
28022
28049
|
}, rest), /*#__PURE__*/React__default.createElement(FocusManager, {
|
|
28023
|
-
refs: optionRefs
|
|
28050
|
+
refs: optionRefs,
|
|
28051
|
+
defaultFocusedIndex: getSelectedIndex()
|
|
28024
28052
|
}, function (_ref2) {
|
|
28025
28053
|
var focusedIndex = _ref2.focusedIndex,
|
|
28026
28054
|
setFocusedIndex = _ref2.setFocusedIndex,
|
|
@@ -52637,8 +52665,16 @@ var Sidebar = function Sidebar(_a) {
|
|
|
52637
52665
|
}
|
|
52638
52666
|
}, /*#__PURE__*/React__default.createElement(Flex, {
|
|
52639
52667
|
justifyContent: "space-between",
|
|
52640
|
-
alignItems: "flex-start"
|
|
52641
|
-
|
|
52668
|
+
alignItems: "flex-start",
|
|
52669
|
+
pb: "x3"
|
|
52670
|
+
}, title && /*#__PURE__*/React__default.createElement(Flex, {
|
|
52671
|
+
alignItems: "center",
|
|
52672
|
+
height: "100%"
|
|
52673
|
+
}, /*#__PURE__*/React__default.createElement(Heading3, {
|
|
52674
|
+
mb: 0
|
|
52675
|
+
}, title)), !hideCloseButton && /*#__PURE__*/React__default.createElement(Box, {
|
|
52676
|
+
marginLeft: "x2"
|
|
52677
|
+
}, /*#__PURE__*/React__default.createElement(IconicButton, {
|
|
52642
52678
|
ref: closeButton,
|
|
52643
52679
|
icon: "close",
|
|
52644
52680
|
onClick: onClose,
|
|
@@ -16,5 +16,5 @@ declare type SidebarProps = AnimatedBoxProps & {
|
|
|
16
16
|
disableScroll?: boolean;
|
|
17
17
|
hideCloseButton?: boolean;
|
|
18
18
|
};
|
|
19
|
-
declare const Sidebar:
|
|
19
|
+
declare const Sidebar: React.FC<SidebarProps>;
|
|
20
20
|
export default Sidebar;
|
|
@@ -15,3 +15,4 @@ export declare const OpenByDefault: () => JSX.Element;
|
|
|
15
15
|
export declare const WithCustomOffset: () => JSX.Element;
|
|
16
16
|
export declare const DontCloseOnOutsideClick: () => JSX.Element;
|
|
17
17
|
export declare const WithoutCloseButton: () => JSX.Element;
|
|
18
|
+
export declare const WithALongTitle: () => JSX.Element;
|
|
@@ -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;
|
|
@@ -10,6 +10,7 @@ declare type ChildrenHandlers = {
|
|
|
10
10
|
};
|
|
11
11
|
declare type FocusManagerProps = {
|
|
12
12
|
refs?: Array<Reference>;
|
|
13
|
+
defaultFocusedIndex: number | null;
|
|
13
14
|
children: (handlers: ChildrenHandlers) => ReactNode;
|
|
14
15
|
};
|
|
15
16
|
declare const FocusManager: React.FC<FocusManagerProps>;
|