@nulogy/components 6.3.2 → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +264 -117
- package/dist/main.module.js +262 -118
- package/dist/src/SortingTable/SortingTable.d.ts +7 -0
- package/dist/src/SortingTable/SortingTable.story.d.ts +25 -0
- package/dist/src/SortingTable/index.d.ts +1 -0
- 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/Table/{TableWithSorting.story.d.ts → TableWithCustomSorting.story.d.ts} +1 -1
- package/dist/src/Tabs/index.d.ts +0 -1
- package/dist/src/Toast/Toast.d.ts +1 -1
- package/dist/src/Toast/Toast.story.d.ts +6 -0
- package/dist/src/index.d.ts +2 -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;
|
|
@@ -44183,22 +44249,6 @@
|
|
|
44183
44249
|
opacity: 0
|
|
44184
44250
|
}, visible ? FADE_IN_STYLES : FADE_OUT_STYLES);
|
|
44185
44251
|
});
|
|
44186
|
-
var AnimatedBoxBottom = styled__default['default'](Box).withConfig({
|
|
44187
|
-
displayName: "Toast__AnimatedBoxBottom",
|
|
44188
|
-
componentId: "sc-1cheg2k-1"
|
|
44189
|
-
})(function (_ref2) {
|
|
44190
|
-
var visible = _ref2.visible;
|
|
44191
|
-
return Object.assign({
|
|
44192
|
-
position: "fixed",
|
|
44193
|
-
bottom: 0,
|
|
44194
|
-
left: 0,
|
|
44195
|
-
right: 0,
|
|
44196
|
-
marginLeft: "auto",
|
|
44197
|
-
marginRight: "auto",
|
|
44198
|
-
width: "fit-content",
|
|
44199
|
-
tranform: "translateY(" + TOAST_Y_MIN + ")"
|
|
44200
|
-
}, visible ? SLIDE_IN_STYLES : SLIDE_OUT_STYLES);
|
|
44201
|
-
});
|
|
44202
44252
|
var Toast = function Toast(_a) {
|
|
44203
44253
|
var triggered = _a.triggered,
|
|
44204
44254
|
onHide = _a.onHide,
|
|
@@ -44207,7 +44257,8 @@
|
|
|
44207
44257
|
children = _a.children,
|
|
44208
44258
|
showDuration = _a.showDuration,
|
|
44209
44259
|
onHidden = _a.onHidden,
|
|
44210
|
-
|
|
44260
|
+
zIndex = _a.zIndex,
|
|
44261
|
+
props = __rest(_a, ["triggered", "onHide", "onShow", "isCloseable", "children", "showDuration", "onHidden", "zIndex"]);
|
|
44211
44262
|
|
|
44212
44263
|
var _useState = React.useState(triggered),
|
|
44213
44264
|
visible = _useState[0],
|
|
@@ -44270,13 +44321,23 @@
|
|
|
44270
44321
|
hideToast(0);
|
|
44271
44322
|
};
|
|
44272
44323
|
|
|
44273
|
-
return /*#__PURE__*/React__default['default'].createElement(
|
|
44324
|
+
return /*#__PURE__*/React__default['default'].createElement(Box, Object.assign({
|
|
44274
44325
|
visible: visible,
|
|
44275
44326
|
onMouseEnter: onMouseIn,
|
|
44276
44327
|
onFocus: onMouseIn,
|
|
44277
44328
|
onMouseLeave: onMouseOut,
|
|
44278
|
-
onBlur: onMouseOut
|
|
44279
|
-
|
|
44329
|
+
onBlur: onMouseOut,
|
|
44330
|
+
position: "fixed",
|
|
44331
|
+
bottom: "0",
|
|
44332
|
+
left: "0",
|
|
44333
|
+
right: "0",
|
|
44334
|
+
marginLeft: "auto",
|
|
44335
|
+
marginRight: "auto",
|
|
44336
|
+
width: "fit-content",
|
|
44337
|
+
transform: "translateY(" + TOAST_Y_MIN + ")"
|
|
44338
|
+
}, visible ? SLIDE_IN_STYLES : SLIDE_OUT_STYLES, {
|
|
44339
|
+
zIndex: zIndex
|
|
44340
|
+
}), /*#__PURE__*/React__default['default'].createElement(AnimatedAlert, Object.assign({
|
|
44280
44341
|
visible: visible,
|
|
44281
44342
|
isCloseable: isCloseable,
|
|
44282
44343
|
onClose: handleCloseButtonClick,
|
|
@@ -52640,6 +52701,89 @@
|
|
|
52640
52701
|
}, props));
|
|
52641
52702
|
};
|
|
52642
52703
|
|
|
52704
|
+
var numericAlphabeticalSort = function numericAlphabeticalSort(a, b, numeric) {
|
|
52705
|
+
return String(a).localeCompare(b, undefined, {
|
|
52706
|
+
numeric: numeric,
|
|
52707
|
+
sensitivity: "base"
|
|
52708
|
+
});
|
|
52709
|
+
};
|
|
52710
|
+
|
|
52711
|
+
var applySort = function applySort(rows, sortColumn, columns) {
|
|
52712
|
+
return [].concat(rows).sort(function (a, b) {
|
|
52713
|
+
var column = columns.find(function (col) {
|
|
52714
|
+
return col.dataKey === sortColumn;
|
|
52715
|
+
});
|
|
52716
|
+
var numeric = column.numeric;
|
|
52717
|
+
return numericAlphabeticalSort(a[sortColumn], b[sortColumn], numeric);
|
|
52718
|
+
});
|
|
52719
|
+
};
|
|
52720
|
+
|
|
52721
|
+
var sortRows = function sortRows(rows, columns, sortState) {
|
|
52722
|
+
var sortedRows = applySort(rows, sortState.sortColumn, columns);
|
|
52723
|
+
return sortState.ascending ? sortedRows : sortedRows.reverse();
|
|
52724
|
+
};
|
|
52725
|
+
|
|
52726
|
+
var SortingTable = function SortingTable(_a) {
|
|
52727
|
+
var incomingColumns = _a.columns,
|
|
52728
|
+
incomingRows = _a.rows,
|
|
52729
|
+
initialSortColumn = _a.initialSortColumn,
|
|
52730
|
+
props = __rest(_a, ["columns", "rows", "initialSortColumn"]);
|
|
52731
|
+
|
|
52732
|
+
var _useState = React.useState({
|
|
52733
|
+
ascending: true,
|
|
52734
|
+
sortColumn: initialSortColumn
|
|
52735
|
+
}),
|
|
52736
|
+
sortState = _useState[0],
|
|
52737
|
+
setSortState = _useState[1];
|
|
52738
|
+
|
|
52739
|
+
var _useState2 = React.useState(function () {
|
|
52740
|
+
return sortRows(incomingRows, incomingColumns, sortState);
|
|
52741
|
+
}),
|
|
52742
|
+
rows = _useState2[0],
|
|
52743
|
+
setRows = _useState2[1];
|
|
52744
|
+
|
|
52745
|
+
var onSortChange = function onSortChange(dataKey) {
|
|
52746
|
+
var newSortState;
|
|
52747
|
+
setSortState(function (previousState) {
|
|
52748
|
+
var ascending = previousState.sortColumn !== dataKey || !previousState.ascending;
|
|
52749
|
+
newSortState = {
|
|
52750
|
+
ascending: ascending,
|
|
52751
|
+
sortColumn: dataKey
|
|
52752
|
+
};
|
|
52753
|
+
return newSortState;
|
|
52754
|
+
});
|
|
52755
|
+
setRows(function (previousState) {
|
|
52756
|
+
return sortRows(previousState, incomingColumns, newSortState);
|
|
52757
|
+
});
|
|
52758
|
+
};
|
|
52759
|
+
|
|
52760
|
+
var transformColumn = function transformColumn(column) {
|
|
52761
|
+
var isAscending = sortState.ascending && column.dataKey === sortState.sortColumn;
|
|
52762
|
+
return Object.assign(Object.assign({}, column), {
|
|
52763
|
+
headerFormatter: function headerFormatter(_ref) {
|
|
52764
|
+
var label = _ref.label,
|
|
52765
|
+
dataKey = _ref.dataKey;
|
|
52766
|
+
return /*#__PURE__*/React__default['default'].createElement(Table.SortingHeader, {
|
|
52767
|
+
onChange: function onChange() {
|
|
52768
|
+
return onSortChange(dataKey);
|
|
52769
|
+
},
|
|
52770
|
+
label: label,
|
|
52771
|
+
ascending: isAscending,
|
|
52772
|
+
active: dataKey === sortState.sortColumn
|
|
52773
|
+
});
|
|
52774
|
+
}
|
|
52775
|
+
});
|
|
52776
|
+
};
|
|
52777
|
+
|
|
52778
|
+
var columns = incomingColumns.map(function (column) {
|
|
52779
|
+
return transformColumn(column);
|
|
52780
|
+
});
|
|
52781
|
+
return /*#__PURE__*/React__default['default'].createElement(Table, Object.assign({
|
|
52782
|
+
columns: columns,
|
|
52783
|
+
rows: rows
|
|
52784
|
+
}, props));
|
|
52785
|
+
};
|
|
52786
|
+
|
|
52643
52787
|
exports.ALL_NDS_LOCALES = ALL_NDS_LOCALES;
|
|
52644
52788
|
exports.Alert = Alert;
|
|
52645
52789
|
exports.AnimatedBox = AnimatedBox;
|
|
@@ -52706,7 +52850,10 @@
|
|
|
52706
52850
|
exports.SelectMultiValue = SelectMultiValue;
|
|
52707
52851
|
exports.SelectOption = SelectOption;
|
|
52708
52852
|
exports.Sidebar = Sidebar;
|
|
52853
|
+
exports.SortingTable = SortingTable;
|
|
52709
52854
|
exports.StatusIndicator = StatusIndicator;
|
|
52855
|
+
exports.Switch = Switch;
|
|
52856
|
+
exports.Switcher = Switcher;
|
|
52710
52857
|
exports.Tab = Tab;
|
|
52711
52858
|
exports.Table = Table;
|
|
52712
52859
|
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;
|
|
@@ -44157,22 +44223,6 @@ var AnimatedAlert = styled(Alert).withConfig({
|
|
|
44157
44223
|
opacity: 0
|
|
44158
44224
|
}, visible ? FADE_IN_STYLES : FADE_OUT_STYLES);
|
|
44159
44225
|
});
|
|
44160
|
-
var AnimatedBoxBottom = styled(Box).withConfig({
|
|
44161
|
-
displayName: "Toast__AnimatedBoxBottom",
|
|
44162
|
-
componentId: "sc-1cheg2k-1"
|
|
44163
|
-
})(function (_ref2) {
|
|
44164
|
-
var visible = _ref2.visible;
|
|
44165
|
-
return Object.assign({
|
|
44166
|
-
position: "fixed",
|
|
44167
|
-
bottom: 0,
|
|
44168
|
-
left: 0,
|
|
44169
|
-
right: 0,
|
|
44170
|
-
marginLeft: "auto",
|
|
44171
|
-
marginRight: "auto",
|
|
44172
|
-
width: "fit-content",
|
|
44173
|
-
tranform: "translateY(" + TOAST_Y_MIN + ")"
|
|
44174
|
-
}, visible ? SLIDE_IN_STYLES : SLIDE_OUT_STYLES);
|
|
44175
|
-
});
|
|
44176
44226
|
var Toast = function Toast(_a) {
|
|
44177
44227
|
var triggered = _a.triggered,
|
|
44178
44228
|
onHide = _a.onHide,
|
|
@@ -44181,7 +44231,8 @@ var Toast = function Toast(_a) {
|
|
|
44181
44231
|
children = _a.children,
|
|
44182
44232
|
showDuration = _a.showDuration,
|
|
44183
44233
|
onHidden = _a.onHidden,
|
|
44184
|
-
|
|
44234
|
+
zIndex = _a.zIndex,
|
|
44235
|
+
props = __rest(_a, ["triggered", "onHide", "onShow", "isCloseable", "children", "showDuration", "onHidden", "zIndex"]);
|
|
44185
44236
|
|
|
44186
44237
|
var _useState = useState(triggered),
|
|
44187
44238
|
visible = _useState[0],
|
|
@@ -44244,13 +44295,23 @@ var Toast = function Toast(_a) {
|
|
|
44244
44295
|
hideToast(0);
|
|
44245
44296
|
};
|
|
44246
44297
|
|
|
44247
|
-
return /*#__PURE__*/React__default.createElement(
|
|
44298
|
+
return /*#__PURE__*/React__default.createElement(Box, Object.assign({
|
|
44248
44299
|
visible: visible,
|
|
44249
44300
|
onMouseEnter: onMouseIn,
|
|
44250
44301
|
onFocus: onMouseIn,
|
|
44251
44302
|
onMouseLeave: onMouseOut,
|
|
44252
|
-
onBlur: onMouseOut
|
|
44253
|
-
|
|
44303
|
+
onBlur: onMouseOut,
|
|
44304
|
+
position: "fixed",
|
|
44305
|
+
bottom: "0",
|
|
44306
|
+
left: "0",
|
|
44307
|
+
right: "0",
|
|
44308
|
+
marginLeft: "auto",
|
|
44309
|
+
marginRight: "auto",
|
|
44310
|
+
width: "fit-content",
|
|
44311
|
+
transform: "translateY(" + TOAST_Y_MIN + ")"
|
|
44312
|
+
}, visible ? SLIDE_IN_STYLES : SLIDE_OUT_STYLES, {
|
|
44313
|
+
zIndex: zIndex
|
|
44314
|
+
}), /*#__PURE__*/React__default.createElement(AnimatedAlert, Object.assign({
|
|
44254
44315
|
visible: visible,
|
|
44255
44316
|
isCloseable: isCloseable,
|
|
44256
44317
|
onClose: handleCloseButtonClick,
|
|
@@ -52614,4 +52675,87 @@ var Divider = function Divider(_a) {
|
|
|
52614
52675
|
}, props));
|
|
52615
52676
|
};
|
|
52616
52677
|
|
|
52617
|
-
|
|
52678
|
+
var numericAlphabeticalSort = function numericAlphabeticalSort(a, b, numeric) {
|
|
52679
|
+
return String(a).localeCompare(b, undefined, {
|
|
52680
|
+
numeric: numeric,
|
|
52681
|
+
sensitivity: "base"
|
|
52682
|
+
});
|
|
52683
|
+
};
|
|
52684
|
+
|
|
52685
|
+
var applySort = function applySort(rows, sortColumn, columns) {
|
|
52686
|
+
return [].concat(rows).sort(function (a, b) {
|
|
52687
|
+
var column = columns.find(function (col) {
|
|
52688
|
+
return col.dataKey === sortColumn;
|
|
52689
|
+
});
|
|
52690
|
+
var numeric = column.numeric;
|
|
52691
|
+
return numericAlphabeticalSort(a[sortColumn], b[sortColumn], numeric);
|
|
52692
|
+
});
|
|
52693
|
+
};
|
|
52694
|
+
|
|
52695
|
+
var sortRows = function sortRows(rows, columns, sortState) {
|
|
52696
|
+
var sortedRows = applySort(rows, sortState.sortColumn, columns);
|
|
52697
|
+
return sortState.ascending ? sortedRows : sortedRows.reverse();
|
|
52698
|
+
};
|
|
52699
|
+
|
|
52700
|
+
var SortingTable = function SortingTable(_a) {
|
|
52701
|
+
var incomingColumns = _a.columns,
|
|
52702
|
+
incomingRows = _a.rows,
|
|
52703
|
+
initialSortColumn = _a.initialSortColumn,
|
|
52704
|
+
props = __rest(_a, ["columns", "rows", "initialSortColumn"]);
|
|
52705
|
+
|
|
52706
|
+
var _useState = useState({
|
|
52707
|
+
ascending: true,
|
|
52708
|
+
sortColumn: initialSortColumn
|
|
52709
|
+
}),
|
|
52710
|
+
sortState = _useState[0],
|
|
52711
|
+
setSortState = _useState[1];
|
|
52712
|
+
|
|
52713
|
+
var _useState2 = useState(function () {
|
|
52714
|
+
return sortRows(incomingRows, incomingColumns, sortState);
|
|
52715
|
+
}),
|
|
52716
|
+
rows = _useState2[0],
|
|
52717
|
+
setRows = _useState2[1];
|
|
52718
|
+
|
|
52719
|
+
var onSortChange = function onSortChange(dataKey) {
|
|
52720
|
+
var newSortState;
|
|
52721
|
+
setSortState(function (previousState) {
|
|
52722
|
+
var ascending = previousState.sortColumn !== dataKey || !previousState.ascending;
|
|
52723
|
+
newSortState = {
|
|
52724
|
+
ascending: ascending,
|
|
52725
|
+
sortColumn: dataKey
|
|
52726
|
+
};
|
|
52727
|
+
return newSortState;
|
|
52728
|
+
});
|
|
52729
|
+
setRows(function (previousState) {
|
|
52730
|
+
return sortRows(previousState, incomingColumns, newSortState);
|
|
52731
|
+
});
|
|
52732
|
+
};
|
|
52733
|
+
|
|
52734
|
+
var transformColumn = function transformColumn(column) {
|
|
52735
|
+
var isAscending = sortState.ascending && column.dataKey === sortState.sortColumn;
|
|
52736
|
+
return Object.assign(Object.assign({}, column), {
|
|
52737
|
+
headerFormatter: function headerFormatter(_ref) {
|
|
52738
|
+
var label = _ref.label,
|
|
52739
|
+
dataKey = _ref.dataKey;
|
|
52740
|
+
return /*#__PURE__*/React__default.createElement(Table.SortingHeader, {
|
|
52741
|
+
onChange: function onChange() {
|
|
52742
|
+
return onSortChange(dataKey);
|
|
52743
|
+
},
|
|
52744
|
+
label: label,
|
|
52745
|
+
ascending: isAscending,
|
|
52746
|
+
active: dataKey === sortState.sortColumn
|
|
52747
|
+
});
|
|
52748
|
+
}
|
|
52749
|
+
});
|
|
52750
|
+
};
|
|
52751
|
+
|
|
52752
|
+
var columns = incomingColumns.map(function (column) {
|
|
52753
|
+
return transformColumn(column);
|
|
52754
|
+
});
|
|
52755
|
+
return /*#__PURE__*/React__default.createElement(Table, Object.assign({
|
|
52756
|
+
columns: columns,
|
|
52757
|
+
rows: rows
|
|
52758
|
+
}, props));
|
|
52759
|
+
};
|
|
52760
|
+
|
|
52761
|
+
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,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: React.FC<import("../Table/BaseTable").BaseTableProps & {
|
|
5
|
+
selectedRows?: string[];
|
|
6
|
+
onRowSelectionChange?: (...args: any[]) => any;
|
|
7
|
+
onRowExpansionChange?: (...args: any[]) => any;
|
|
8
|
+
rowsPerPage?: number;
|
|
9
|
+
onPageChange?: (...args: any[]) => any;
|
|
10
|
+
selectAllAriaLabel?: string;
|
|
11
|
+
deselectAllAriaLabel?: string;
|
|
12
|
+
paginationCss?: any;
|
|
13
|
+
paginationProps?: any;
|
|
14
|
+
expandedRows?: any[];
|
|
15
|
+
hasSelectableRows?: boolean;
|
|
16
|
+
hasExpandableRows?: boolean;
|
|
17
|
+
onSelectRow?: (...args: any[]) => any;
|
|
18
|
+
onSelectHeader?: (...args: any[]) => any;
|
|
19
|
+
isHeaderSelected?: any;
|
|
20
|
+
} & {
|
|
21
|
+
initialSortColumn: string;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
25
|
+
export declare const _SortingTable: () => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SortingTable } from "./SortingTable";
|
|
@@ -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";
|
|
@@ -8,7 +8,7 @@ declare type ToastProps = AlertProps & {
|
|
|
8
8
|
onHidden?: (...args: any[]) => any;
|
|
9
9
|
};
|
|
10
10
|
export declare const Toast: {
|
|
11
|
-
({ triggered, onHide, onShow, isCloseable, children, showDuration, onHidden, ...props }: ToastProps): JSX.Element;
|
|
11
|
+
({ triggered, onHide, onShow, isCloseable, children, showDuration, onHidden, zIndex, ...props }: ToastProps): JSX.Element;
|
|
12
12
|
defaultProps: {
|
|
13
13
|
triggered: boolean;
|
|
14
14
|
onShow: () => void;
|
|
@@ -22,6 +22,12 @@ export declare const WithCloseButton: {
|
|
|
22
22
|
name: string;
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
|
+
export declare const WithModal: {
|
|
26
|
+
(): JSX.Element;
|
|
27
|
+
story: {
|
|
28
|
+
name: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
25
31
|
export declare const CloseableWithMultiLineMessage: {
|
|
26
32
|
(): JSX.Element;
|
|
27
33
|
story: {
|
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";
|
|
@@ -46,3 +47,4 @@ export { AsyncSelect } from "./AsyncSelect";
|
|
|
46
47
|
export { ApplicationFrame, Page, Sidebar } from "./Layout";
|
|
47
48
|
export { useWindowDimensions } from "./utils";
|
|
48
49
|
export { Divider } from "./Divider";
|
|
50
|
+
export { SortingTable } from "./SortingTable";
|
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.0",
|
|
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;
|