@nulogy/components 6.4.1 → 6.6.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 +170 -99
- package/dist/main.module.js +169 -100
- package/dist/src/Switcher/Switch.d.ts +6 -0
- package/dist/src/Switcher/Switch.story.d.ts +23 -0
- package/dist/src/Switcher/Switcher.d.ts +9 -0
- package/dist/src/Switcher/Switcher.story.d.ts +7 -0
- package/dist/src/Switcher/index.d.ts +2 -0
- package/dist/src/Tabs/index.d.ts +0 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/theme.type.d.ts +1 -0
- package/dist/src/utils/ts/FocusManager.d.ts +16 -0
- package/package.json +2 -2
- package/dist/src/Tabs/TabFocusManager.d.ts +0 -27
package/dist/main.js
CHANGED
|
@@ -275,7 +275,7 @@
|
|
|
275
275
|
|
|
276
276
|
/**
|
|
277
277
|
* Do not edit directly
|
|
278
|
-
* Generated on
|
|
278
|
+
* Generated on Tue, 01 Feb 2022 18:28:25 GMT
|
|
279
279
|
*/
|
|
280
280
|
|
|
281
281
|
const color_base_black = "#011e38";
|
|
@@ -356,6 +356,7 @@
|
|
|
356
356
|
const z_indices_sidebar = 800;
|
|
357
357
|
const z_indices_nav_bar = 900;
|
|
358
358
|
const z_indices_overlay = 1000;
|
|
359
|
+
const z_indices_above_overlay = 1010;
|
|
359
360
|
const z_indices_open_control = 1000;
|
|
360
361
|
|
|
361
362
|
var Theme = {
|
|
@@ -467,6 +468,7 @@
|
|
|
467
468
|
tabsScollIndicator: z_indices_tabs_scroll_indicator,
|
|
468
469
|
tabsBar: z_indices_tabs_bar,
|
|
469
470
|
overlay: z_indices_overlay,
|
|
471
|
+
aboveOverlay: z_indices_above_overlay,
|
|
470
472
|
tableHeader: z_indices_table_header,
|
|
471
473
|
modalHeaderAndFooter: z_indices_modal_header_and_footer,
|
|
472
474
|
openControl: z_indices_open_control,
|
|
@@ -24525,7 +24527,7 @@
|
|
|
24525
24527
|
}
|
|
24526
24528
|
};
|
|
24527
24529
|
});
|
|
24528
|
-
var Switch = styled__default['default'].div.withConfig({
|
|
24530
|
+
var Switch$1 = styled__default['default'].div.withConfig({
|
|
24529
24531
|
displayName: "ToggleButton__Switch",
|
|
24530
24532
|
componentId: "t7wo9n-1"
|
|
24531
24533
|
})(function (_ref2) {
|
|
@@ -24574,7 +24576,7 @@
|
|
|
24574
24576
|
}
|
|
24575
24577
|
};
|
|
24576
24578
|
|
|
24577
|
-
return /*#__PURE__*/React__default['default'].createElement(Switch, {
|
|
24579
|
+
return /*#__PURE__*/React__default['default'].createElement(Switch$1, {
|
|
24578
24580
|
onClick: handleClick
|
|
24579
24581
|
}, /*#__PURE__*/React__default['default'].createElement(ToggleInput, Object.assign({
|
|
24580
24582
|
ref: inputRef,
|
|
@@ -27492,6 +27494,55 @@
|
|
|
27492
27494
|
label: null
|
|
27493
27495
|
};
|
|
27494
27496
|
|
|
27497
|
+
var FocusManager = function FocusManager(_ref) {
|
|
27498
|
+
var children = _ref.children,
|
|
27499
|
+
_ref$refs = _ref.refs,
|
|
27500
|
+
refs = _ref$refs === void 0 ? undefined : _ref$refs;
|
|
27501
|
+
|
|
27502
|
+
var _useState = React.useState(0),
|
|
27503
|
+
focusedIndex = _useState[0],
|
|
27504
|
+
setFocusedIndex = _useState[1];
|
|
27505
|
+
|
|
27506
|
+
var focusPrevious = function focusPrevious() {
|
|
27507
|
+
setFocusedIndex(function (prevFocusedIndex) {
|
|
27508
|
+
return (prevFocusedIndex - 1 + refs.length) % refs.length;
|
|
27509
|
+
});
|
|
27510
|
+
};
|
|
27511
|
+
|
|
27512
|
+
var focusNext = function focusNext() {
|
|
27513
|
+
setFocusedIndex(function (prevFocusedIndex) {
|
|
27514
|
+
return (prevFocusedIndex + 1) % refs.length;
|
|
27515
|
+
});
|
|
27516
|
+
};
|
|
27517
|
+
|
|
27518
|
+
var handleArrowNavigation = function handleArrowNavigation(e) {
|
|
27519
|
+
switch (e.key) {
|
|
27520
|
+
case "ArrowLeft":
|
|
27521
|
+
e.preventDefault();
|
|
27522
|
+
focusPrevious();
|
|
27523
|
+
break;
|
|
27524
|
+
|
|
27525
|
+
case "ArrowRight":
|
|
27526
|
+
e.preventDefault();
|
|
27527
|
+
focusNext();
|
|
27528
|
+
break;
|
|
27529
|
+
}
|
|
27530
|
+
};
|
|
27531
|
+
|
|
27532
|
+
React.useEffect(function () {
|
|
27533
|
+
var updateFocused = function updateFocused() {
|
|
27534
|
+
refs[focusedIndex].focus();
|
|
27535
|
+
};
|
|
27536
|
+
|
|
27537
|
+
updateFocused();
|
|
27538
|
+
}, [focusedIndex, refs]);
|
|
27539
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, children({
|
|
27540
|
+
focusedIndex: focusedIndex,
|
|
27541
|
+
setFocusedIndex: setFocusedIndex,
|
|
27542
|
+
handleArrowNavigation: handleArrowNavigation
|
|
27543
|
+
}));
|
|
27544
|
+
};
|
|
27545
|
+
|
|
27495
27546
|
var TabContainer = styled__default['default'](Box).withConfig({
|
|
27496
27547
|
displayName: "TabContainer",
|
|
27497
27548
|
componentId: "sc-1esq49v-0"
|
|
@@ -27520,94 +27571,6 @@
|
|
|
27520
27571
|
};
|
|
27521
27572
|
});
|
|
27522
27573
|
|
|
27523
|
-
var TabFocusManager = /*#__PURE__*/function (_React$Component) {
|
|
27524
|
-
_inheritsLoose__default['default'](TabFocusManager, _React$Component);
|
|
27525
|
-
|
|
27526
|
-
function TabFocusManager(props) {
|
|
27527
|
-
var _this;
|
|
27528
|
-
|
|
27529
|
-
_this = _React$Component.call(this, props) || this;
|
|
27530
|
-
_this.state = {
|
|
27531
|
-
focusedIndex: 0
|
|
27532
|
-
};
|
|
27533
|
-
_this.handleArrowNavigation = _this.handleArrowNavigation.bind(_assertThisInitialized__default['default'](_this));
|
|
27534
|
-
_this.focusNextTab = _this.focusNextTab.bind(_assertThisInitialized__default['default'](_this));
|
|
27535
|
-
_this.focusPreviousTab = _this.focusPreviousTab.bind(_assertThisInitialized__default['default'](_this));
|
|
27536
|
-
_this.setFocusToTab = _this.setFocusToTab.bind(_assertThisInitialized__default['default'](_this));
|
|
27537
|
-
return _this;
|
|
27538
|
-
}
|
|
27539
|
-
|
|
27540
|
-
var _proto = TabFocusManager.prototype;
|
|
27541
|
-
|
|
27542
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
|
|
27543
|
-
var focusedIndex = this.state.focusedIndex;
|
|
27544
|
-
|
|
27545
|
-
if (prevState.focusedIndex !== focusedIndex) {
|
|
27546
|
-
this.updateFocusedTab();
|
|
27547
|
-
}
|
|
27548
|
-
};
|
|
27549
|
-
|
|
27550
|
-
_proto.setFocusToTab = function setFocusToTab(index) {
|
|
27551
|
-
this.setState({
|
|
27552
|
-
focusedIndex: index
|
|
27553
|
-
});
|
|
27554
|
-
};
|
|
27555
|
-
|
|
27556
|
-
_proto.handleArrowNavigation = function handleArrowNavigation(e) {
|
|
27557
|
-
switch (e.key) {
|
|
27558
|
-
case "ArrowLeft":
|
|
27559
|
-
e.preventDefault();
|
|
27560
|
-
this.focusPreviousTab();
|
|
27561
|
-
break;
|
|
27562
|
-
|
|
27563
|
-
case "ArrowRight":
|
|
27564
|
-
e.preventDefault();
|
|
27565
|
-
this.focusNextTab();
|
|
27566
|
-
break;
|
|
27567
|
-
}
|
|
27568
|
-
};
|
|
27569
|
-
|
|
27570
|
-
_proto.focusNextTab = function focusNextTab() {
|
|
27571
|
-
var tabRefs = this.props.tabRefs;
|
|
27572
|
-
this.setState(function (prevState) {
|
|
27573
|
-
return {
|
|
27574
|
-
focusedIndex: (prevState.focusedIndex + 1) % tabRefs.length
|
|
27575
|
-
};
|
|
27576
|
-
});
|
|
27577
|
-
};
|
|
27578
|
-
|
|
27579
|
-
_proto.focusPreviousTab = function focusPreviousTab() {
|
|
27580
|
-
var tabRefs = this.props.tabRefs;
|
|
27581
|
-
this.setState(function (prevState) {
|
|
27582
|
-
return {
|
|
27583
|
-
focusedIndex: (prevState.focusedIndex - 1 + tabRefs.length) % tabRefs.length
|
|
27584
|
-
};
|
|
27585
|
-
});
|
|
27586
|
-
};
|
|
27587
|
-
|
|
27588
|
-
_proto.updateFocusedTab = function updateFocusedTab() {
|
|
27589
|
-
var tabRefs = this.props.tabRefs;
|
|
27590
|
-
var focusedIndex = this.state.focusedIndex;
|
|
27591
|
-
tabRefs[focusedIndex].focus();
|
|
27592
|
-
};
|
|
27593
|
-
|
|
27594
|
-
_proto.render = function render() {
|
|
27595
|
-
var focusedIndex = this.state.focusedIndex;
|
|
27596
|
-
var children = this.props.children;
|
|
27597
|
-
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, children({
|
|
27598
|
-
focusedIndex: focusedIndex,
|
|
27599
|
-
handleArrowNavigation: this.handleArrowNavigation,
|
|
27600
|
-
setFocusToTab: this.setFocusToTab
|
|
27601
|
-
}));
|
|
27602
|
-
};
|
|
27603
|
-
|
|
27604
|
-
return TabFocusManager;
|
|
27605
|
-
}(React__default['default'].Component);
|
|
27606
|
-
|
|
27607
|
-
TabFocusManager.defaultProps = {
|
|
27608
|
-
tabRefs: undefined
|
|
27609
|
-
};
|
|
27610
|
-
|
|
27611
27574
|
var TabScrollIndicatorButton = styled__default['default'].button.withConfig({
|
|
27612
27575
|
displayName: "TabScrollIndicator__TabScrollIndicatorButton",
|
|
27613
27576
|
componentId: "sc-91z16z-0"
|
|
@@ -28006,12 +27969,12 @@
|
|
|
28006
27969
|
var spaceProps = getSubset(this.props, propTypes.space);
|
|
28007
27970
|
return /*#__PURE__*/React__default['default'].createElement(Box, {
|
|
28008
27971
|
position: "relative"
|
|
28009
|
-
}, /*#__PURE__*/React__default['default'].createElement(
|
|
28010
|
-
|
|
27972
|
+
}, /*#__PURE__*/React__default['default'].createElement(FocusManager, {
|
|
27973
|
+
refs: this.tabRefs
|
|
28011
27974
|
}, function (_ref2) {
|
|
28012
|
-
var
|
|
28013
|
-
|
|
28014
|
-
|
|
27975
|
+
var focusedIndex = _ref2.focusedIndex,
|
|
27976
|
+
setFocusedIndex = _ref2.setFocusedIndex,
|
|
27977
|
+
handleArrowNavigation = _ref2.handleArrowNavigation;
|
|
28015
27978
|
return /*#__PURE__*/React__default['default'].createElement(TabScrollIndicators, {
|
|
28016
27979
|
tabRefs: _this3.tabRefs,
|
|
28017
27980
|
tabContainerRef: _this3.tabContainerRef
|
|
@@ -28026,7 +27989,7 @@
|
|
|
28026
27989
|
}, spaceProps), /*#__PURE__*/React__default['default'].createElement(ResizeDetector, {
|
|
28027
27990
|
handleWidth: true,
|
|
28028
27991
|
onResize: handleResize
|
|
28029
|
-
}), _this3.getTabs(
|
|
27992
|
+
}), _this3.getTabs(setFocusedIndex, focusedIndex, handleArrowNavigation));
|
|
28030
27993
|
});
|
|
28031
27994
|
}), this.getTabContent());
|
|
28032
27995
|
};
|
|
@@ -28044,6 +28007,109 @@
|
|
|
28044
28007
|
onTabClick: undefined
|
|
28045
28008
|
};
|
|
28046
28009
|
|
|
28010
|
+
var Switcher = function Switcher(_a) {
|
|
28011
|
+
var selected = _a.selected,
|
|
28012
|
+
onChange = _a.onChange,
|
|
28013
|
+
rest = __rest(_a, ["selected", "onChange"]);
|
|
28014
|
+
|
|
28015
|
+
var optionRefs = [];
|
|
28016
|
+
|
|
28017
|
+
var isSelected = function isSelected(value, index) {
|
|
28018
|
+
if (!selected) return index === 0;
|
|
28019
|
+
return value === selected;
|
|
28020
|
+
};
|
|
28021
|
+
|
|
28022
|
+
var options = function options(focusedIndex, setFocusedIndex, handleArrowNavigation) {
|
|
28023
|
+
return React__default['default'].Children.map(rest.children, function (child, index) {
|
|
28024
|
+
return /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
28025
|
+
index: index,
|
|
28026
|
+
tabIndex: index === focusedIndex ? 0 : -1,
|
|
28027
|
+
selected: isSelected(child.props.value, index),
|
|
28028
|
+
"aria-selected": isSelected(child.props.value, index),
|
|
28029
|
+
onKeyDown: handleArrowNavigation,
|
|
28030
|
+
ref: function ref(_ref) {
|
|
28031
|
+
optionRefs[index] = _ref;
|
|
28032
|
+
},
|
|
28033
|
+
onFocus: function onFocus(e) {
|
|
28034
|
+
e.stopPropagation();
|
|
28035
|
+
},
|
|
28036
|
+
onClick: function onClick() {
|
|
28037
|
+
setFocusedIndex(index);
|
|
28038
|
+
if (onChange) onChange(child.props.value);
|
|
28039
|
+
}
|
|
28040
|
+
});
|
|
28041
|
+
});
|
|
28042
|
+
};
|
|
28043
|
+
|
|
28044
|
+
return /*#__PURE__*/React__default['default'].createElement(Box, Object.assign({
|
|
28045
|
+
display: "inline-flex",
|
|
28046
|
+
bg: "whiteGrey",
|
|
28047
|
+
borderRadius: "20px"
|
|
28048
|
+
}, rest), /*#__PURE__*/React__default['default'].createElement(FocusManager, {
|
|
28049
|
+
refs: optionRefs
|
|
28050
|
+
}, function (_ref2) {
|
|
28051
|
+
var focusedIndex = _ref2.focusedIndex,
|
|
28052
|
+
setFocusedIndex = _ref2.setFocusedIndex,
|
|
28053
|
+
handleArrowNavigation = _ref2.handleArrowNavigation;
|
|
28054
|
+
return options(focusedIndex, setFocusedIndex, handleArrowNavigation);
|
|
28055
|
+
}));
|
|
28056
|
+
};
|
|
28057
|
+
|
|
28058
|
+
Switcher.propTypes = {
|
|
28059
|
+
children: PropTypes__default['default'].node,
|
|
28060
|
+
selected: PropTypes__default['default'].string,
|
|
28061
|
+
onChange: PropTypes__default['default'].func
|
|
28062
|
+
};
|
|
28063
|
+
|
|
28064
|
+
var SwitchButton = styled__default['default'].button.withConfig({
|
|
28065
|
+
displayName: "Switch__SwitchButton",
|
|
28066
|
+
componentId: "wsu5uq-0"
|
|
28067
|
+
})(function (_ref) {
|
|
28068
|
+
var selected = _ref.selected,
|
|
28069
|
+
theme = _ref.theme;
|
|
28070
|
+
return Object.assign(Object.assign(Object.assign({
|
|
28071
|
+
height: theme.space.x4,
|
|
28072
|
+
margin: 1,
|
|
28073
|
+
padding: theme.space.half + " " + theme.space.x2,
|
|
28074
|
+
background: selected ? theme.colors.white : "none",
|
|
28075
|
+
color: selected ? theme.colors.darkBlue : theme.colors.darkGrey,
|
|
28076
|
+
cursor: "pointer",
|
|
28077
|
+
border: "none",
|
|
28078
|
+
borderRadius: 20,
|
|
28079
|
+
fontSize: theme.fontSizes.medium,
|
|
28080
|
+
fontWeight: theme.fontWeights.medium,
|
|
28081
|
+
lineHeight: theme.lineHeights.base,
|
|
28082
|
+
textDecoration: "none",
|
|
28083
|
+
whiteSpace: "nowrap"
|
|
28084
|
+
}, selected && {
|
|
28085
|
+
boxShadow: theme.shadows.small
|
|
28086
|
+
}), {
|
|
28087
|
+
"&:focus": {
|
|
28088
|
+
outline: "none",
|
|
28089
|
+
boxShadow: theme.shadows.focus
|
|
28090
|
+
}
|
|
28091
|
+
}), !selected && {
|
|
28092
|
+
"&:hover": {
|
|
28093
|
+
backgroundColor: theme.colors.lightGrey
|
|
28094
|
+
}
|
|
28095
|
+
});
|
|
28096
|
+
});
|
|
28097
|
+
/* eslint-disable-next-line react/display-name */
|
|
28098
|
+
|
|
28099
|
+
var Switch = /*#__PURE__*/React__default['default'].forwardRef(function (_a, ref) {
|
|
28100
|
+
var children = _a.children,
|
|
28101
|
+
rest = __rest(_a, ["children"]);
|
|
28102
|
+
|
|
28103
|
+
return /*#__PURE__*/React__default['default'].createElement(SwitchButton, Object.assign({}, rest, {
|
|
28104
|
+
ref: ref
|
|
28105
|
+
}), children);
|
|
28106
|
+
});
|
|
28107
|
+
Switch.propTypes = {
|
|
28108
|
+
children: PropTypes__default['default'].node,
|
|
28109
|
+
selected: PropTypes__default['default'].bool,
|
|
28110
|
+
value: PropTypes__default['default'].oneOfType([PropTypes__default['default'].string, PropTypes__default['default'].number, PropTypes__default['default'].array])
|
|
28111
|
+
};
|
|
28112
|
+
|
|
28047
28113
|
var getHoverBackground = function getHoverBackground(currentPage, disabled, theme) {
|
|
28048
28114
|
if (currentPage) {
|
|
28049
28115
|
return theme.colors.darkBlue;
|
|
@@ -43846,8 +43912,11 @@
|
|
|
43846
43912
|
width: "240px",
|
|
43847
43913
|
height: "24px",
|
|
43848
43914
|
viewBox: "0 0 100 10",
|
|
43849
|
-
preserveAspectRatio: "xMidYMid"
|
|
43850
|
-
|
|
43915
|
+
preserveAspectRatio: "xMidYMid",
|
|
43916
|
+
role: "img"
|
|
43917
|
+
}, /*#__PURE__*/React__default['default'].createElement("title", {
|
|
43918
|
+
id: "lightbulb11"
|
|
43919
|
+
}, "Loading animation"), /*#__PURE__*/React__default['default'].createElement("g", {
|
|
43851
43920
|
transform: "translate(4 5)"
|
|
43852
43921
|
}, /*#__PURE__*/React__default['default'].createElement("circle", {
|
|
43853
43922
|
cx: "0",
|
|
@@ -52786,6 +52855,8 @@
|
|
|
52786
52855
|
exports.Sidebar = Sidebar;
|
|
52787
52856
|
exports.SortingTable = SortingTable;
|
|
52788
52857
|
exports.StatusIndicator = StatusIndicator;
|
|
52858
|
+
exports.Switch = Switch;
|
|
52859
|
+
exports.Switcher = Switcher;
|
|
52789
52860
|
exports.Tab = Tab;
|
|
52790
52861
|
exports.Table = Table;
|
|
52791
52862
|
exports.Tabs = Tabs;
|
package/dist/main.module.js
CHANGED
|
@@ -249,7 +249,7 @@ function I18nextProvider(_ref) {
|
|
|
249
249
|
|
|
250
250
|
/**
|
|
251
251
|
* Do not edit directly
|
|
252
|
-
* Generated on
|
|
252
|
+
* Generated on Tue, 01 Feb 2022 18:28:25 GMT
|
|
253
253
|
*/
|
|
254
254
|
|
|
255
255
|
const color_base_black = "#011e38";
|
|
@@ -330,6 +330,7 @@ const z_indices_tabs_bar = 210;
|
|
|
330
330
|
const z_indices_sidebar = 800;
|
|
331
331
|
const z_indices_nav_bar = 900;
|
|
332
332
|
const z_indices_overlay = 1000;
|
|
333
|
+
const z_indices_above_overlay = 1010;
|
|
333
334
|
const z_indices_open_control = 1000;
|
|
334
335
|
|
|
335
336
|
var Theme = {
|
|
@@ -441,6 +442,7 @@ var Theme = {
|
|
|
441
442
|
tabsScollIndicator: z_indices_tabs_scroll_indicator,
|
|
442
443
|
tabsBar: z_indices_tabs_bar,
|
|
443
444
|
overlay: z_indices_overlay,
|
|
445
|
+
aboveOverlay: z_indices_above_overlay,
|
|
444
446
|
tableHeader: z_indices_table_header,
|
|
445
447
|
modalHeaderAndFooter: z_indices_modal_header_and_footer,
|
|
446
448
|
openControl: z_indices_open_control,
|
|
@@ -24499,7 +24501,7 @@ var Slider = styled.span.withConfig({
|
|
|
24499
24501
|
}
|
|
24500
24502
|
};
|
|
24501
24503
|
});
|
|
24502
|
-
var Switch = styled.div.withConfig({
|
|
24504
|
+
var Switch$1 = styled.div.withConfig({
|
|
24503
24505
|
displayName: "ToggleButton__Switch",
|
|
24504
24506
|
componentId: "t7wo9n-1"
|
|
24505
24507
|
})(function (_ref2) {
|
|
@@ -24548,7 +24550,7 @@ var ToggleButton = /*#__PURE__*/React__default.forwardRef(function (props, ref)
|
|
|
24548
24550
|
}
|
|
24549
24551
|
};
|
|
24550
24552
|
|
|
24551
|
-
return /*#__PURE__*/React__default.createElement(Switch, {
|
|
24553
|
+
return /*#__PURE__*/React__default.createElement(Switch$1, {
|
|
24552
24554
|
onClick: handleClick
|
|
24553
24555
|
}, /*#__PURE__*/React__default.createElement(ToggleInput, Object.assign({
|
|
24554
24556
|
ref: inputRef,
|
|
@@ -27466,6 +27468,55 @@ Tab.defaultProps = {
|
|
|
27466
27468
|
label: null
|
|
27467
27469
|
};
|
|
27468
27470
|
|
|
27471
|
+
var FocusManager = function FocusManager(_ref) {
|
|
27472
|
+
var children = _ref.children,
|
|
27473
|
+
_ref$refs = _ref.refs,
|
|
27474
|
+
refs = _ref$refs === void 0 ? undefined : _ref$refs;
|
|
27475
|
+
|
|
27476
|
+
var _useState = useState(0),
|
|
27477
|
+
focusedIndex = _useState[0],
|
|
27478
|
+
setFocusedIndex = _useState[1];
|
|
27479
|
+
|
|
27480
|
+
var focusPrevious = function focusPrevious() {
|
|
27481
|
+
setFocusedIndex(function (prevFocusedIndex) {
|
|
27482
|
+
return (prevFocusedIndex - 1 + refs.length) % refs.length;
|
|
27483
|
+
});
|
|
27484
|
+
};
|
|
27485
|
+
|
|
27486
|
+
var focusNext = function focusNext() {
|
|
27487
|
+
setFocusedIndex(function (prevFocusedIndex) {
|
|
27488
|
+
return (prevFocusedIndex + 1) % refs.length;
|
|
27489
|
+
});
|
|
27490
|
+
};
|
|
27491
|
+
|
|
27492
|
+
var handleArrowNavigation = function handleArrowNavigation(e) {
|
|
27493
|
+
switch (e.key) {
|
|
27494
|
+
case "ArrowLeft":
|
|
27495
|
+
e.preventDefault();
|
|
27496
|
+
focusPrevious();
|
|
27497
|
+
break;
|
|
27498
|
+
|
|
27499
|
+
case "ArrowRight":
|
|
27500
|
+
e.preventDefault();
|
|
27501
|
+
focusNext();
|
|
27502
|
+
break;
|
|
27503
|
+
}
|
|
27504
|
+
};
|
|
27505
|
+
|
|
27506
|
+
useEffect(function () {
|
|
27507
|
+
var updateFocused = function updateFocused() {
|
|
27508
|
+
refs[focusedIndex].focus();
|
|
27509
|
+
};
|
|
27510
|
+
|
|
27511
|
+
updateFocused();
|
|
27512
|
+
}, [focusedIndex, refs]);
|
|
27513
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children({
|
|
27514
|
+
focusedIndex: focusedIndex,
|
|
27515
|
+
setFocusedIndex: setFocusedIndex,
|
|
27516
|
+
handleArrowNavigation: handleArrowNavigation
|
|
27517
|
+
}));
|
|
27518
|
+
};
|
|
27519
|
+
|
|
27469
27520
|
var TabContainer = styled(Box).withConfig({
|
|
27470
27521
|
displayName: "TabContainer",
|
|
27471
27522
|
componentId: "sc-1esq49v-0"
|
|
@@ -27494,94 +27545,6 @@ var TabContainer = styled(Box).withConfig({
|
|
|
27494
27545
|
};
|
|
27495
27546
|
});
|
|
27496
27547
|
|
|
27497
|
-
var TabFocusManager = /*#__PURE__*/function (_React$Component) {
|
|
27498
|
-
_inheritsLoose$2(TabFocusManager, _React$Component);
|
|
27499
|
-
|
|
27500
|
-
function TabFocusManager(props) {
|
|
27501
|
-
var _this;
|
|
27502
|
-
|
|
27503
|
-
_this = _React$Component.call(this, props) || this;
|
|
27504
|
-
_this.state = {
|
|
27505
|
-
focusedIndex: 0
|
|
27506
|
-
};
|
|
27507
|
-
_this.handleArrowNavigation = _this.handleArrowNavigation.bind(_assertThisInitialized$4(_this));
|
|
27508
|
-
_this.focusNextTab = _this.focusNextTab.bind(_assertThisInitialized$4(_this));
|
|
27509
|
-
_this.focusPreviousTab = _this.focusPreviousTab.bind(_assertThisInitialized$4(_this));
|
|
27510
|
-
_this.setFocusToTab = _this.setFocusToTab.bind(_assertThisInitialized$4(_this));
|
|
27511
|
-
return _this;
|
|
27512
|
-
}
|
|
27513
|
-
|
|
27514
|
-
var _proto = TabFocusManager.prototype;
|
|
27515
|
-
|
|
27516
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
|
|
27517
|
-
var focusedIndex = this.state.focusedIndex;
|
|
27518
|
-
|
|
27519
|
-
if (prevState.focusedIndex !== focusedIndex) {
|
|
27520
|
-
this.updateFocusedTab();
|
|
27521
|
-
}
|
|
27522
|
-
};
|
|
27523
|
-
|
|
27524
|
-
_proto.setFocusToTab = function setFocusToTab(index) {
|
|
27525
|
-
this.setState({
|
|
27526
|
-
focusedIndex: index
|
|
27527
|
-
});
|
|
27528
|
-
};
|
|
27529
|
-
|
|
27530
|
-
_proto.handleArrowNavigation = function handleArrowNavigation(e) {
|
|
27531
|
-
switch (e.key) {
|
|
27532
|
-
case "ArrowLeft":
|
|
27533
|
-
e.preventDefault();
|
|
27534
|
-
this.focusPreviousTab();
|
|
27535
|
-
break;
|
|
27536
|
-
|
|
27537
|
-
case "ArrowRight":
|
|
27538
|
-
e.preventDefault();
|
|
27539
|
-
this.focusNextTab();
|
|
27540
|
-
break;
|
|
27541
|
-
}
|
|
27542
|
-
};
|
|
27543
|
-
|
|
27544
|
-
_proto.focusNextTab = function focusNextTab() {
|
|
27545
|
-
var tabRefs = this.props.tabRefs;
|
|
27546
|
-
this.setState(function (prevState) {
|
|
27547
|
-
return {
|
|
27548
|
-
focusedIndex: (prevState.focusedIndex + 1) % tabRefs.length
|
|
27549
|
-
};
|
|
27550
|
-
});
|
|
27551
|
-
};
|
|
27552
|
-
|
|
27553
|
-
_proto.focusPreviousTab = function focusPreviousTab() {
|
|
27554
|
-
var tabRefs = this.props.tabRefs;
|
|
27555
|
-
this.setState(function (prevState) {
|
|
27556
|
-
return {
|
|
27557
|
-
focusedIndex: (prevState.focusedIndex - 1 + tabRefs.length) % tabRefs.length
|
|
27558
|
-
};
|
|
27559
|
-
});
|
|
27560
|
-
};
|
|
27561
|
-
|
|
27562
|
-
_proto.updateFocusedTab = function updateFocusedTab() {
|
|
27563
|
-
var tabRefs = this.props.tabRefs;
|
|
27564
|
-
var focusedIndex = this.state.focusedIndex;
|
|
27565
|
-
tabRefs[focusedIndex].focus();
|
|
27566
|
-
};
|
|
27567
|
-
|
|
27568
|
-
_proto.render = function render() {
|
|
27569
|
-
var focusedIndex = this.state.focusedIndex;
|
|
27570
|
-
var children = this.props.children;
|
|
27571
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children({
|
|
27572
|
-
focusedIndex: focusedIndex,
|
|
27573
|
-
handleArrowNavigation: this.handleArrowNavigation,
|
|
27574
|
-
setFocusToTab: this.setFocusToTab
|
|
27575
|
-
}));
|
|
27576
|
-
};
|
|
27577
|
-
|
|
27578
|
-
return TabFocusManager;
|
|
27579
|
-
}(React__default.Component);
|
|
27580
|
-
|
|
27581
|
-
TabFocusManager.defaultProps = {
|
|
27582
|
-
tabRefs: undefined
|
|
27583
|
-
};
|
|
27584
|
-
|
|
27585
27548
|
var TabScrollIndicatorButton = styled.button.withConfig({
|
|
27586
27549
|
displayName: "TabScrollIndicator__TabScrollIndicatorButton",
|
|
27587
27550
|
componentId: "sc-91z16z-0"
|
|
@@ -27980,12 +27943,12 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
27980
27943
|
var spaceProps = getSubset(this.props, propTypes.space);
|
|
27981
27944
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
27982
27945
|
position: "relative"
|
|
27983
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
27984
|
-
|
|
27946
|
+
}, /*#__PURE__*/React__default.createElement(FocusManager, {
|
|
27947
|
+
refs: this.tabRefs
|
|
27985
27948
|
}, function (_ref2) {
|
|
27986
|
-
var
|
|
27987
|
-
|
|
27988
|
-
|
|
27949
|
+
var focusedIndex = _ref2.focusedIndex,
|
|
27950
|
+
setFocusedIndex = _ref2.setFocusedIndex,
|
|
27951
|
+
handleArrowNavigation = _ref2.handleArrowNavigation;
|
|
27989
27952
|
return /*#__PURE__*/React__default.createElement(TabScrollIndicators, {
|
|
27990
27953
|
tabRefs: _this3.tabRefs,
|
|
27991
27954
|
tabContainerRef: _this3.tabContainerRef
|
|
@@ -28000,7 +27963,7 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
28000
27963
|
}, spaceProps), /*#__PURE__*/React__default.createElement(ResizeDetector, {
|
|
28001
27964
|
handleWidth: true,
|
|
28002
27965
|
onResize: handleResize
|
|
28003
|
-
}), _this3.getTabs(
|
|
27966
|
+
}), _this3.getTabs(setFocusedIndex, focusedIndex, handleArrowNavigation));
|
|
28004
27967
|
});
|
|
28005
27968
|
}), this.getTabContent());
|
|
28006
27969
|
};
|
|
@@ -28018,6 +27981,109 @@ Tabs.defaultProps = {
|
|
|
28018
27981
|
onTabClick: undefined
|
|
28019
27982
|
};
|
|
28020
27983
|
|
|
27984
|
+
var Switcher = function Switcher(_a) {
|
|
27985
|
+
var selected = _a.selected,
|
|
27986
|
+
onChange = _a.onChange,
|
|
27987
|
+
rest = __rest(_a, ["selected", "onChange"]);
|
|
27988
|
+
|
|
27989
|
+
var optionRefs = [];
|
|
27990
|
+
|
|
27991
|
+
var isSelected = function isSelected(value, index) {
|
|
27992
|
+
if (!selected) return index === 0;
|
|
27993
|
+
return value === selected;
|
|
27994
|
+
};
|
|
27995
|
+
|
|
27996
|
+
var options = function options(focusedIndex, setFocusedIndex, handleArrowNavigation) {
|
|
27997
|
+
return React__default.Children.map(rest.children, function (child, index) {
|
|
27998
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
27999
|
+
index: index,
|
|
28000
|
+
tabIndex: index === focusedIndex ? 0 : -1,
|
|
28001
|
+
selected: isSelected(child.props.value, index),
|
|
28002
|
+
"aria-selected": isSelected(child.props.value, index),
|
|
28003
|
+
onKeyDown: handleArrowNavigation,
|
|
28004
|
+
ref: function ref(_ref) {
|
|
28005
|
+
optionRefs[index] = _ref;
|
|
28006
|
+
},
|
|
28007
|
+
onFocus: function onFocus(e) {
|
|
28008
|
+
e.stopPropagation();
|
|
28009
|
+
},
|
|
28010
|
+
onClick: function onClick() {
|
|
28011
|
+
setFocusedIndex(index);
|
|
28012
|
+
if (onChange) onChange(child.props.value);
|
|
28013
|
+
}
|
|
28014
|
+
});
|
|
28015
|
+
});
|
|
28016
|
+
};
|
|
28017
|
+
|
|
28018
|
+
return /*#__PURE__*/React__default.createElement(Box, Object.assign({
|
|
28019
|
+
display: "inline-flex",
|
|
28020
|
+
bg: "whiteGrey",
|
|
28021
|
+
borderRadius: "20px"
|
|
28022
|
+
}, rest), /*#__PURE__*/React__default.createElement(FocusManager, {
|
|
28023
|
+
refs: optionRefs
|
|
28024
|
+
}, function (_ref2) {
|
|
28025
|
+
var focusedIndex = _ref2.focusedIndex,
|
|
28026
|
+
setFocusedIndex = _ref2.setFocusedIndex,
|
|
28027
|
+
handleArrowNavigation = _ref2.handleArrowNavigation;
|
|
28028
|
+
return options(focusedIndex, setFocusedIndex, handleArrowNavigation);
|
|
28029
|
+
}));
|
|
28030
|
+
};
|
|
28031
|
+
|
|
28032
|
+
Switcher.propTypes = {
|
|
28033
|
+
children: PropTypes.node,
|
|
28034
|
+
selected: PropTypes.string,
|
|
28035
|
+
onChange: PropTypes.func
|
|
28036
|
+
};
|
|
28037
|
+
|
|
28038
|
+
var SwitchButton = styled.button.withConfig({
|
|
28039
|
+
displayName: "Switch__SwitchButton",
|
|
28040
|
+
componentId: "wsu5uq-0"
|
|
28041
|
+
})(function (_ref) {
|
|
28042
|
+
var selected = _ref.selected,
|
|
28043
|
+
theme = _ref.theme;
|
|
28044
|
+
return Object.assign(Object.assign(Object.assign({
|
|
28045
|
+
height: theme.space.x4,
|
|
28046
|
+
margin: 1,
|
|
28047
|
+
padding: theme.space.half + " " + theme.space.x2,
|
|
28048
|
+
background: selected ? theme.colors.white : "none",
|
|
28049
|
+
color: selected ? theme.colors.darkBlue : theme.colors.darkGrey,
|
|
28050
|
+
cursor: "pointer",
|
|
28051
|
+
border: "none",
|
|
28052
|
+
borderRadius: 20,
|
|
28053
|
+
fontSize: theme.fontSizes.medium,
|
|
28054
|
+
fontWeight: theme.fontWeights.medium,
|
|
28055
|
+
lineHeight: theme.lineHeights.base,
|
|
28056
|
+
textDecoration: "none",
|
|
28057
|
+
whiteSpace: "nowrap"
|
|
28058
|
+
}, selected && {
|
|
28059
|
+
boxShadow: theme.shadows.small
|
|
28060
|
+
}), {
|
|
28061
|
+
"&:focus": {
|
|
28062
|
+
outline: "none",
|
|
28063
|
+
boxShadow: theme.shadows.focus
|
|
28064
|
+
}
|
|
28065
|
+
}), !selected && {
|
|
28066
|
+
"&:hover": {
|
|
28067
|
+
backgroundColor: theme.colors.lightGrey
|
|
28068
|
+
}
|
|
28069
|
+
});
|
|
28070
|
+
});
|
|
28071
|
+
/* eslint-disable-next-line react/display-name */
|
|
28072
|
+
|
|
28073
|
+
var Switch = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
28074
|
+
var children = _a.children,
|
|
28075
|
+
rest = __rest(_a, ["children"]);
|
|
28076
|
+
|
|
28077
|
+
return /*#__PURE__*/React__default.createElement(SwitchButton, Object.assign({}, rest, {
|
|
28078
|
+
ref: ref
|
|
28079
|
+
}), children);
|
|
28080
|
+
});
|
|
28081
|
+
Switch.propTypes = {
|
|
28082
|
+
children: PropTypes.node,
|
|
28083
|
+
selected: PropTypes.bool,
|
|
28084
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array])
|
|
28085
|
+
};
|
|
28086
|
+
|
|
28021
28087
|
var getHoverBackground = function getHoverBackground(currentPage, disabled, theme) {
|
|
28022
28088
|
if (currentPage) {
|
|
28023
28089
|
return theme.colors.darkBlue;
|
|
@@ -43820,8 +43886,11 @@ var LoadingAnimation = function LoadingAnimation(_ref) {
|
|
|
43820
43886
|
width: "240px",
|
|
43821
43887
|
height: "24px",
|
|
43822
43888
|
viewBox: "0 0 100 10",
|
|
43823
|
-
preserveAspectRatio: "xMidYMid"
|
|
43824
|
-
|
|
43889
|
+
preserveAspectRatio: "xMidYMid",
|
|
43890
|
+
role: "img"
|
|
43891
|
+
}, /*#__PURE__*/React__default.createElement("title", {
|
|
43892
|
+
id: "lightbulb11"
|
|
43893
|
+
}, "Loading animation"), /*#__PURE__*/React__default.createElement("g", {
|
|
43825
43894
|
transform: "translate(4 5)"
|
|
43826
43895
|
}, /*#__PURE__*/React__default.createElement("circle", {
|
|
43827
43896
|
cx: "0",
|
|
@@ -52692,4 +52761,4 @@ var SortingTable = function SortingTable(_a) {
|
|
|
52692
52761
|
}, props));
|
|
52693
52762
|
};
|
|
52694
52763
|
|
|
52695
|
-
export { ALL_NDS_LOCALES, Alert, AnimatedBox, ApplicationFrame, AsyncSelect, Box, NavBar as BrandedNavBar, Branding, Breadcrumbs, Button, ButtonGroup, Card, CardSet, Checkbox, CheckboxGroup, ControlIcon, DangerButton, DatePicker, DateRange, Divider, DropdownButton, DropdownItem, DropdownLink, DropdownMenu, Field, FieldLabel, Fieldset, Flex, Form, FormSection, Heading1, Heading2, Heading3, Heading4, HelpText, Icon, IconicButton, InlineIcon, InlineValidation, Input$1 as Input, Link, List, ListItem, LoadingAnimation, Modal, NDSProvider, NavBar$1 as NavBar, Overlay, Page, Pagination, PrimaryButton, QuietButton, Radio, RadioGroup, RangeContainer, RequirementText, ReactSelect as Select, SelectClearIndicator, SelectContainer$1 as SelectContainer, SelectControl, SelectDropdownIndicator, SelectInput, SelectMenu, SelectMultiValue, SelectOption, Sidebar, SortingTable, StatusIndicator, Tab, Table, Tabs, Text, Textarea, TimePicker, TimeRange, Toast, ToggleComponent as Toggle, Tooltip, TruncatedText, Theme as theme, useWindowDimensions };
|
|
52764
|
+
export { ALL_NDS_LOCALES, Alert, AnimatedBox, ApplicationFrame, AsyncSelect, Box, NavBar as BrandedNavBar, Branding, Breadcrumbs, Button, ButtonGroup, Card, CardSet, Checkbox, CheckboxGroup, ControlIcon, DangerButton, DatePicker, DateRange, Divider, DropdownButton, DropdownItem, DropdownLink, DropdownMenu, Field, FieldLabel, Fieldset, Flex, Form, FormSection, Heading1, Heading2, Heading3, Heading4, HelpText, Icon, IconicButton, InlineIcon, InlineValidation, Input$1 as Input, Link, List, ListItem, LoadingAnimation, Modal, NDSProvider, NavBar$1 as NavBar, Overlay, Page, Pagination, PrimaryButton, QuietButton, Radio, RadioGroup, RangeContainer, RequirementText, ReactSelect as Select, SelectClearIndicator, SelectContainer$1 as SelectContainer, SelectControl, SelectDropdownIndicator, SelectInput, SelectMenu, SelectMultiValue, SelectOption, Sidebar, SortingTable, StatusIndicator, Switch, Switcher, Tab, Table, Tabs, Text, Textarea, TimePicker, TimeRange, Toast, ToggleComponent as Toggle, Tooltip, TruncatedText, Theme as theme, useWindowDimensions };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare type SwitchProps = {
|
|
3
|
+
selected?: boolean;
|
|
4
|
+
} & React.ComponentPropsWithRef<"button">;
|
|
5
|
+
declare const Switch: React.ForwardRefExoticComponent<Pick<SwitchProps, "form" | "slot" | "style" | "title" | "key" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "selected"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
export default Switch;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
|
6
|
+
export declare const _Switch: {
|
|
7
|
+
(): JSX.Element;
|
|
8
|
+
story: {
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const SelectedSwitch: {
|
|
13
|
+
(): JSX.Element;
|
|
14
|
+
story: {
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare const UnSelectedSwitch: {
|
|
19
|
+
(): JSX.Element;
|
|
20
|
+
story: {
|
|
21
|
+
name: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare type SwitchValue = HTMLButtonElement["value"];
|
|
3
|
+
declare type SwitcherProps = {
|
|
4
|
+
children?: any;
|
|
5
|
+
selected?: SwitchValue;
|
|
6
|
+
onChange?: Function;
|
|
7
|
+
};
|
|
8
|
+
declare const Switcher: React.FC<SwitcherProps>;
|
|
9
|
+
export default Switcher;
|
package/dist/src/Tabs/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as Tab } from "./Tab";
|
|
2
2
|
export { default as Tabs } from "./Tabs";
|
|
3
|
-
export { default as TabFocusManager } from "./TabFocusManager";
|
|
4
3
|
export { default as TabScrollIndicator } from "./TabScrollIndicator";
|
|
5
4
|
export { default as TabScrollIndicators } from "./TabScrollIndicators";
|
package/dist/src/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export { Tooltip } from "./Tooltip";
|
|
|
26
26
|
export { Card, CardSet } from "./Card";
|
|
27
27
|
export { Modal } from "./Modal";
|
|
28
28
|
export { Tab, Tabs } from "./Tabs";
|
|
29
|
+
export { Switch, Switcher } from "./Switcher";
|
|
29
30
|
export { Table } from "./Table";
|
|
30
31
|
export type { TableProps, TableColumnType, TableRowType, TableCellInfoType, } from "./Table";
|
|
31
32
|
export { StatusIndicator } from "./StatusIndicator";
|
package/dist/src/theme.type.d.ts
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
declare type Reference = {
|
|
3
|
+
current?: JSX.Element;
|
|
4
|
+
focus?: (...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
declare type ChildrenHandlers = {
|
|
7
|
+
focusedIndex: number;
|
|
8
|
+
handleArrowNavigation: Function;
|
|
9
|
+
setFocusedIndex: Function;
|
|
10
|
+
};
|
|
11
|
+
declare type FocusManagerProps = {
|
|
12
|
+
refs?: Array<Reference>;
|
|
13
|
+
children: (handlers: ChildrenHandlers) => ReactNode;
|
|
14
|
+
};
|
|
15
|
+
declare const FocusManager: React.FC<FocusManagerProps>;
|
|
16
|
+
export default FocusManager;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nulogy/components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.6.1",
|
|
4
4
|
"description": "Component library for the Nulogy Design System - http://nulogy.design",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
},
|
|
139
139
|
"dependencies": {
|
|
140
140
|
"@babel/runtime": "^7.9.6",
|
|
141
|
-
"@nulogy/tokens": "^5.
|
|
141
|
+
"@nulogy/tokens": "^5.2.0",
|
|
142
142
|
"@styled-system/prop-types": "^5.1.4",
|
|
143
143
|
"@styled-system/theme-get": "^5.1.2",
|
|
144
144
|
"body-scroll-lock": "^3.1.5",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
declare type TabFocusManagerProps = {
|
|
3
|
-
tabRefs?: {
|
|
4
|
-
current?: JSX.Element;
|
|
5
|
-
focus?: (...args: any[]) => any;
|
|
6
|
-
}[];
|
|
7
|
-
};
|
|
8
|
-
declare type TabFocusManagerState = {
|
|
9
|
-
focusedIndex: any;
|
|
10
|
-
} & ((prevState: any) => {
|
|
11
|
-
focusedIndex: number;
|
|
12
|
-
}) & ((prevState: any) => {
|
|
13
|
-
focusedIndex: number;
|
|
14
|
-
}) & {
|
|
15
|
-
focusedIndex: number;
|
|
16
|
-
};
|
|
17
|
-
declare class TabFocusManager extends React.Component<TabFocusManagerProps, TabFocusManagerState> {
|
|
18
|
-
constructor(props: any);
|
|
19
|
-
componentDidUpdate(prevProps: any, prevState: any): void;
|
|
20
|
-
setFocusToTab(index: any): void;
|
|
21
|
-
handleArrowNavigation(e: any): void;
|
|
22
|
-
focusNextTab(): void;
|
|
23
|
-
focusPreviousTab(): void;
|
|
24
|
-
updateFocusedTab(): void;
|
|
25
|
-
render(): JSX.Element;
|
|
26
|
-
}
|
|
27
|
-
export default TabFocusManager;
|