@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 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('classnames'), require('@babel/runtime/helpers/toConsumableArray'), require('react-input-autosize'), require('@babel/runtime/helpers/taggedTemplateLiteral')) :
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', 'classnames', '@babel/runtime/helpers/toConsumableArray', 'react-input-autosize', '@babel/runtime/helpers/taggedTemplateLiteral'], 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, global.t, null, global.AutosizeInput));
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, t, toConsumableArray, AutosizeInput) { 'use strict';
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 Slider = styled__default['default'].span.withConfig({
24499
- displayName: "ToggleButton__Slider",
24500
- componentId: "t7wo9n-0"
24501
- })(function (_ref) {
24502
- var disabled = _ref.disabled,
24503
- theme = _ref.theme;
24504
- return {
24505
- position: "absolute",
24506
- height: theme.space.x3,
24507
- width: theme.space.x6,
24508
- top: "0",
24509
- right: "0",
24510
- bottom: "0",
24511
- left: "0",
24512
- backgroundColor: disabled ? theme.colors.grey : theme.colors.darkGrey,
24513
- borderRadius: "12px",
24514
- transition: ".2s ease",
24515
- cursor: disabled ? undefined : "pointer",
24516
- "&:before": {
24517
- content: "''",
24518
- position: "absolute",
24519
- height: "22px",
24520
- width: "22px",
24521
- left: "1px",
24522
- top: "1px",
24523
- borderRadius: theme.radii.circle,
24524
- boxSizing: "border-box",
24525
- backgroundColor: disabled ? theme.colors.whiteGrey : theme.colors.white,
24526
- transition: ".2s ease"
24527
- }
24528
- };
24529
- });
24530
- var Switch$1 = styled__default['default'].div.withConfig({
24531
- displayName: "ToggleButton__Switch",
24532
- componentId: "t7wo9n-1"
24533
- })(function (_ref2) {
24534
- var theme = _ref2.theme;
24535
- return {
24536
- position: "relative",
24537
- display: "inline-flex",
24538
- minWidth: theme.space.x6,
24539
- minHeight: theme.space.x3,
24540
- input: {
24541
- opacity: "0",
24542
- width: "1px",
24543
- height: "1px"
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-2"
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 = {}, _ref4["&:checked + " + Slider + ":before"] = {
24556
- transform: "translateX(24px)"
24557
- }, _ref4["&:checked + " + Slider] = {
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 + " + Slider + ":before"] = {
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
- }, /*#__PURE__*/React__default['default'].createElement(Box, null, title && /*#__PURE__*/React__default['default'].createElement(Heading3, null, title)), !hideCloseButton && /*#__PURE__*/React__default['default'].createElement(Box, null, /*#__PURE__*/React__default['default'].createElement(IconicButton, {
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,
@@ -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 Slider = styled.span.withConfig({
24473
- displayName: "ToggleButton__Slider",
24474
- componentId: "t7wo9n-0"
24475
- })(function (_ref) {
24476
- var disabled = _ref.disabled,
24477
- theme = _ref.theme;
24478
- return {
24479
- position: "absolute",
24480
- height: theme.space.x3,
24481
- width: theme.space.x6,
24482
- top: "0",
24483
- right: "0",
24484
- bottom: "0",
24485
- left: "0",
24486
- backgroundColor: disabled ? theme.colors.grey : theme.colors.darkGrey,
24487
- borderRadius: "12px",
24488
- transition: ".2s ease",
24489
- cursor: disabled ? undefined : "pointer",
24490
- "&:before": {
24491
- content: "''",
24492
- position: "absolute",
24493
- height: "22px",
24494
- width: "22px",
24495
- left: "1px",
24496
- top: "1px",
24497
- borderRadius: theme.radii.circle,
24498
- boxSizing: "border-box",
24499
- backgroundColor: disabled ? theme.colors.whiteGrey : theme.colors.white,
24500
- transition: ".2s ease"
24501
- }
24502
- };
24503
- });
24504
- var Switch$1 = styled.div.withConfig({
24505
- displayName: "ToggleButton__Switch",
24506
- componentId: "t7wo9n-1"
24507
- })(function (_ref2) {
24508
- var theme = _ref2.theme;
24509
- return {
24510
- position: "relative",
24511
- display: "inline-flex",
24512
- minWidth: theme.space.x6,
24513
- minHeight: theme.space.x3,
24514
- input: {
24515
- opacity: "0",
24516
- width: "1px",
24517
- height: "1px"
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-2"
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 = {}, _ref4["&:checked + " + Slider + ":before"] = {
24530
- transform: "translateX(24px)"
24531
- }, _ref4["&:checked + " + Slider] = {
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 + " + Slider + ":before"] = {
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
- }, /*#__PURE__*/React__default.createElement(Box, null, title && /*#__PURE__*/React__default.createElement(Heading3, null, title)), !hideCloseButton && /*#__PURE__*/React__default.createElement(Box, null, /*#__PURE__*/React__default.createElement(IconicButton, {
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: ({ p, width, children, onClose, title, isOpen, footer, closeButtonTestId, closeButtonAriaLabel, offset, triggerRef, duration, top, closeOnOutsideClick, overlay, disableScroll, hideCloseButton, zIndex, ...props }: SidebarProps) => JSX.Element;
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,6 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  declare const _default: {
3
3
  title: string;
4
+ parameters: {
5
+ chromatic: {
6
+ diffThreshold: number;
7
+ };
8
+ };
4
9
  };
5
10
  export default _default;
6
11
  export declare const _RadioGroup: {
@@ -1,14 +1,11 @@
1
1
  import React from "react";
2
2
  import { DefaultNDSThemeType } from "../theme.type";
3
- declare type ToggleInputProps = React.ComponentPropsWithRef<"input"> & {
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.SFC<ToggleButtonProps>;
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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nulogy/components",
3
- "version": "6.6.3",
3
+ "version": "6.7.1",
4
4
  "description": "Component library for the Nulogy Design System - http://nulogy.design",
5
5
  "private": false,
6
6
  "publishConfig": {