@7shifts/sous-chef 3.21.0-beta.2 → 3.21.0-beta.4
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/index.css +62 -62
- package/dist/index.js +218 -212
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +218 -212
- package/dist/index.modern.js.map +1 -1
- package/dist/lists/DataTable/DataTableContext.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4564,7 +4564,7 @@ var DataTableHeader = function DataTableHeader(_ref) {
|
|
|
4564
4564
|
var initialValue = {
|
|
4565
4565
|
columns: [],
|
|
4566
4566
|
numberOfRows: 0,
|
|
4567
|
-
|
|
4567
|
+
state: 'SPINNER_LOADING'
|
|
4568
4568
|
};
|
|
4569
4569
|
var Context = React.createContext(initialValue);
|
|
4570
4570
|
var useDataTableContext = function useDataTableContext() {
|
|
@@ -6589,7 +6589,7 @@ var DataTableCellElement = function DataTableCellElement(_ref, ref) {
|
|
|
6589
6589
|
var _useDataTableContext = useDataTableContext(),
|
|
6590
6590
|
columns = _useDataTableContext.columns,
|
|
6591
6591
|
hasVerticalBorders = _useDataTableContext.hasVerticalBorders,
|
|
6592
|
-
|
|
6592
|
+
state = _useDataTableContext.state;
|
|
6593
6593
|
|
|
6594
6594
|
var column = (_columns$columnIndex = columns === null || columns === void 0 ? void 0 : columns[columnIndex]) != null ? _columns$columnIndex : null;
|
|
6595
6595
|
var isRightAligned = column ? column.isRightAligned : false;
|
|
@@ -6606,7 +6606,7 @@ var DataTableCellElement = function DataTableCellElement(_ref, ref) {
|
|
|
6606
6606
|
colSpan: colSpan,
|
|
6607
6607
|
ref: ref
|
|
6608
6608
|
}, React__default.createElement("div", {
|
|
6609
|
-
className: classnames(styles$q['data-table-cell__content'], (_classnames3 = {}, _classnames3[styles$q['data-table-cell__content--with-error']] = hasError, _classnames3[styles$q['data-table-cell__content--right-align']] = isRightAligned, _classnames3[styles$q['data-table-cell__content--loading']] =
|
|
6609
|
+
className: classnames(styles$q['data-table-cell__content'], (_classnames3 = {}, _classnames3[styles$q['data-table-cell__content--with-error']] = hasError, _classnames3[styles$q['data-table-cell__content--right-align']] = isRightAligned, _classnames3[styles$q['data-table-cell__content--loading']] = state === 'BACKGROUND_LOADING', _classnames3))
|
|
6610
6610
|
}, isRightAligned && icon, children, !isRightAligned && icon));
|
|
6611
6611
|
return React__default.createElement(Tooltip$1, {
|
|
6612
6612
|
overlay: errorMessage,
|
|
@@ -6618,188 +6618,6 @@ var DataTableCellElement = function DataTableCellElement(_ref, ref) {
|
|
|
6618
6618
|
|
|
6619
6619
|
var DataTableCell = React.forwardRef(DataTableCellElement);
|
|
6620
6620
|
|
|
6621
|
-
var DataTableRowActions = function DataTableRowActions(_ref) {
|
|
6622
|
-
var actions = _ref.actions,
|
|
6623
|
-
columnIndex = _ref.columnIndex;
|
|
6624
|
-
var kebabMenuItems = actions.filter(function (action) {
|
|
6625
|
-
return action.showInKebab === undefined || action.showInKebab;
|
|
6626
|
-
});
|
|
6627
|
-
var sideActions = actions.filter(function (action) {
|
|
6628
|
-
return action.showInKebab === false;
|
|
6629
|
-
});
|
|
6630
|
-
return React__default.createElement(DataTableCell, {
|
|
6631
|
-
columnIndex: columnIndex
|
|
6632
|
-
}, React__default.createElement("div", {
|
|
6633
|
-
className: styles$e['actions'],
|
|
6634
|
-
"data-testid": "data-table-dropdown-menu"
|
|
6635
|
-
}, sideActions.length > 0 && sideActions.map(function (action) {
|
|
6636
|
-
return React__default.createElement(Button$1, Object.assign({
|
|
6637
|
-
key: action.action,
|
|
6638
|
-
onClick: action.onAction,
|
|
6639
|
-
theme: typeof action.label === 'string' ? 'default' : 'link-icon'
|
|
6640
|
-
}, action.showInKebab === false ? action.buttonProps : {}), action.label);
|
|
6641
|
-
}), kebabMenuItems.length > 0 && React__default.createElement(KebabMenu, {
|
|
6642
|
-
actions: kebabMenuItems
|
|
6643
|
-
})));
|
|
6644
|
-
};
|
|
6645
|
-
|
|
6646
|
-
var styles$B = {"data-table-editable-cell":"_qYNve","data-table-editable-cell--right-aligned":"_3w6bw","data-table-editable-cell--currency":"_2y-_5","data-table-editable-cell--invalid":"_1Mx8j","data-table-editable-cell--top-left":"_2BlhN","data-table-editable-cell--top-right":"_1qDoN","data-table-editable-cell--bottom-left":"_2NUlb","data-table-editable-cell--bottom-right":"_3Mm-v"};
|
|
6647
|
-
|
|
6648
|
-
var DataTableEditableCellElement = function DataTableEditableCellElement(_ref, ref) {
|
|
6649
|
-
var _columns$columnIndex, _controllers$error, _classnames, _classnames2;
|
|
6650
|
-
|
|
6651
|
-
var name = _ref.name,
|
|
6652
|
-
columnIndex = _ref.columnIndex,
|
|
6653
|
-
rowIndex = _ref.rowIndex,
|
|
6654
|
-
inputId = _ref.id,
|
|
6655
|
-
value = _ref.value,
|
|
6656
|
-
onChange = _ref.onChange,
|
|
6657
|
-
onBlur = _ref.onBlur,
|
|
6658
|
-
placeholder = _ref.placeholder,
|
|
6659
|
-
disabled = _ref.disabled,
|
|
6660
|
-
error = _ref.error,
|
|
6661
|
-
prefix = _ref.prefix,
|
|
6662
|
-
suffix = _ref.suffix,
|
|
6663
|
-
defaultValue = _ref.defaultValue,
|
|
6664
|
-
_ref$type = _ref.type,
|
|
6665
|
-
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
6666
|
-
testId = _ref.testId;
|
|
6667
|
-
|
|
6668
|
-
var _useDataTableContext = useDataTableContext(),
|
|
6669
|
-
columns = _useDataTableContext.columns,
|
|
6670
|
-
numberOfRows = _useDataTableContext.numberOfRows;
|
|
6671
|
-
|
|
6672
|
-
var column = (_columns$columnIndex = columns === null || columns === void 0 ? void 0 : columns[columnIndex]) != null ? _columns$columnIndex : null;
|
|
6673
|
-
var isRightAligned = column ? column.isRightAligned : false;
|
|
6674
|
-
var numberOfColumns = (columns === null || columns === void 0 ? void 0 : columns.length) || 0;
|
|
6675
|
-
var isTopLeftCell = columnIndex === 0 && rowIndex === 0;
|
|
6676
|
-
var isTopRightCell = columnIndex === numberOfColumns - 1 && rowIndex === 0;
|
|
6677
|
-
var isBottomLeftCell = columnIndex === 0 && rowIndex === numberOfRows - 1;
|
|
6678
|
-
var isBottomRightCell = columnIndex === numberOfColumns - 1 && rowIndex === numberOfRows - 1;
|
|
6679
|
-
var controllers = useFieldControllers({
|
|
6680
|
-
name: name,
|
|
6681
|
-
id: inputId,
|
|
6682
|
-
value: value,
|
|
6683
|
-
onChange: onChange,
|
|
6684
|
-
onBlur: onBlur,
|
|
6685
|
-
error: error,
|
|
6686
|
-
type: type
|
|
6687
|
-
});
|
|
6688
|
-
var hasError = !!controllers.error;
|
|
6689
|
-
var errorMessage = (_controllers$error = controllers.error) === null || _controllers$error === void 0 ? void 0 : _controllers$error.toString();
|
|
6690
|
-
var fieldProps = {
|
|
6691
|
-
name: name,
|
|
6692
|
-
id: controllers.id
|
|
6693
|
-
};
|
|
6694
|
-
var EditableCell = React__default.createElement("div", {
|
|
6695
|
-
className: classnames((_classnames = {}, _classnames[styles$B['data-table-editable-cell--currency']] = type === 'currency', _classnames), styles$B['data-table-editable-cell']),
|
|
6696
|
-
"data-testid": testId,
|
|
6697
|
-
role: "cell"
|
|
6698
|
-
}, React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement(AffixContainer, {
|
|
6699
|
-
prefix: prefix,
|
|
6700
|
-
suffix: suffix
|
|
6701
|
-
}, React__default.createElement("input", {
|
|
6702
|
-
name: name,
|
|
6703
|
-
id: controllers.id,
|
|
6704
|
-
className: classnames((_classnames2 = {}, _classnames2[styles$B['data-table-editable-cell--right-aligned']] = isRightAligned, _classnames2[styles$B['data-table-editable-cell--top-left']] = isTopLeftCell, _classnames2[styles$B['data-table-editable-cell--top-right']] = isTopRightCell, _classnames2[styles$B['data-table-editable-cell--bottom-left']] = isBottomLeftCell, _classnames2[styles$B['data-table-editable-cell--bottom-right']] = isBottomRightCell, _classnames2[styles$B['data-table-editable-cell--invalid']] = hasError, _classnames2)),
|
|
6705
|
-
type: type === 'currency' ? 'number' : 'text',
|
|
6706
|
-
step: type === 'currency' ? 'any' : '',
|
|
6707
|
-
"data-testid": testId && testId + "-text-field",
|
|
6708
|
-
"aria-describedby": hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
|
|
6709
|
-
"aria-invalid": hasError,
|
|
6710
|
-
disabled: disabled,
|
|
6711
|
-
placeholder: placeholder,
|
|
6712
|
-
defaultValue: defaultValue,
|
|
6713
|
-
value: controllers.value,
|
|
6714
|
-
onChange: controllers.onChange,
|
|
6715
|
-
onBlur: controllers.onBlur,
|
|
6716
|
-
ref: ref,
|
|
6717
|
-
onWheel: function onWheel(e) {
|
|
6718
|
-
e.target.blur();
|
|
6719
|
-
}
|
|
6720
|
-
}))));
|
|
6721
|
-
return React__default.createElement(Tooltip$1, {
|
|
6722
|
-
overlay: errorMessage,
|
|
6723
|
-
placement: "top",
|
|
6724
|
-
theme: "white"
|
|
6725
|
-
}, EditableCell);
|
|
6726
|
-
};
|
|
6727
|
-
|
|
6728
|
-
var DataTableEditableCell = React.forwardRef(DataTableEditableCellElement);
|
|
6729
|
-
|
|
6730
|
-
var _excluded$2m = ["children", "onClick", "isSelected", "actions", "hasDefaultPadding", "hasDefaultCell", "testId"];
|
|
6731
|
-
|
|
6732
|
-
var DataTableRowComponent = function DataTableRowComponent(_ref, ref) {
|
|
6733
|
-
var _classnames;
|
|
6734
|
-
|
|
6735
|
-
var children = _ref.children,
|
|
6736
|
-
onClick = _ref.onClick,
|
|
6737
|
-
_ref$isSelected = _ref.isSelected,
|
|
6738
|
-
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
6739
|
-
_ref$actions = _ref.actions,
|
|
6740
|
-
actions = _ref$actions === void 0 ? [] : _ref$actions,
|
|
6741
|
-
_ref$hasDefaultCell = _ref.hasDefaultCell,
|
|
6742
|
-
hasDefaultCell = _ref$hasDefaultCell === void 0 ? true : _ref$hasDefaultCell,
|
|
6743
|
-
testId = _ref.testId,
|
|
6744
|
-
nativeDivProps = _objectWithoutPropertiesLoose(_ref, _excluded$2m);
|
|
6745
|
-
|
|
6746
|
-
var _useDataTableContext = useDataTableContext(),
|
|
6747
|
-
showActionMenu = _useDataTableContext.showActionMenu;
|
|
6748
|
-
|
|
6749
|
-
var styleNames = classnames(styles$d['item'], (_classnames = {}, _classnames[styles$d['clickable']] = onClick, _classnames[styles$d['selected']] = isSelected, _classnames));
|
|
6750
|
-
|
|
6751
|
-
var renderColumn = function renderColumn(columnElement, index) {
|
|
6752
|
-
var isUsingDataTableCell = columnElement && typeof columnElement === 'object' && 'type' in columnElement && (columnElement === null || columnElement === void 0 ? void 0 : columnElement.type) === DataTableCell;
|
|
6753
|
-
|
|
6754
|
-
if (isUsingDataTableCell || !hasDefaultCell) {
|
|
6755
|
-
return columnElement;
|
|
6756
|
-
}
|
|
6757
|
-
|
|
6758
|
-
var isUsingDataTableEditableCell = columnElement && typeof columnElement === 'object' && 'type' in columnElement && (columnElement === null || columnElement === void 0 ? void 0 : columnElement.type) === DataTableEditableCell;
|
|
6759
|
-
return React__default.createElement(DataTableCell, {
|
|
6760
|
-
key: index,
|
|
6761
|
-
columnIndex: index,
|
|
6762
|
-
noPadding: !!isUsingDataTableEditableCell
|
|
6763
|
-
}, columnElement);
|
|
6764
|
-
};
|
|
6765
|
-
|
|
6766
|
-
return React__default.createElement("tr", Object.assign({}, nativeDivProps, {
|
|
6767
|
-
className: styleNames,
|
|
6768
|
-
onClick: onClick ? onClick : undefined,
|
|
6769
|
-
onKeyPress: onClick ? onClick : undefined,
|
|
6770
|
-
"data-testid": testId && testId + "-row",
|
|
6771
|
-
role: "row",
|
|
6772
|
-
ref: ref
|
|
6773
|
-
}), React__default.Children.toArray(children).filter(Boolean).map(function (child, index) {
|
|
6774
|
-
return renderColumn(child, index);
|
|
6775
|
-
}), showActionMenu && React__default.createElement(DataTableRowActions, {
|
|
6776
|
-
actions: actions,
|
|
6777
|
-
columnIndex: React__default.Children.count(children)
|
|
6778
|
-
}));
|
|
6779
|
-
};
|
|
6780
|
-
|
|
6781
|
-
var DataTableRow = React.forwardRef(DataTableRowComponent);
|
|
6782
|
-
|
|
6783
|
-
var DataTableDefaultItemComponent = function DataTableDefaultItemComponent(_ref) {
|
|
6784
|
-
var columns = _ref.columns,
|
|
6785
|
-
item = _ref.item,
|
|
6786
|
-
testId = _ref.testId;
|
|
6787
|
-
var headingKeys = columns ? columns.map(function (column) {
|
|
6788
|
-
return column.name;
|
|
6789
|
-
}) : Object.keys(item);
|
|
6790
|
-
var columnsToShow = headingKeys.filter(function (key) {
|
|
6791
|
-
return key !== 'actions';
|
|
6792
|
-
});
|
|
6793
|
-
return React__default.createElement(DataTableRow, {
|
|
6794
|
-
actions: item.actions,
|
|
6795
|
-
testId: testId
|
|
6796
|
-
}, columnsToShow.map(function (headingKey) {
|
|
6797
|
-
return React__default.createElement("div", {
|
|
6798
|
-
key: headingKey
|
|
6799
|
-
}, item[headingKey] || '');
|
|
6800
|
-
}));
|
|
6801
|
-
};
|
|
6802
|
-
|
|
6803
6621
|
var BANNER_THEME = {
|
|
6804
6622
|
INFO: 'info',
|
|
6805
6623
|
WARNING: 'warning',
|
|
@@ -6812,7 +6630,7 @@ var BUTTON_THEME = {
|
|
|
6812
6630
|
UPSELL: 'upsell'
|
|
6813
6631
|
};
|
|
6814
6632
|
|
|
6815
|
-
var styles$
|
|
6633
|
+
var styles$B = {"banner":"_vgLin","banner__title":"_63TwY","banner__body":"_3n6S7","banner__body--multilineCTA":"_2pMYs","banner--info":"_ON6Eg","banner__icon":"_1-D-E","banner--success":"_1FFZh","banner--danger":"_2R34O","banner--warning":"_3Cfhe","banner--upsell":"_1SIOw","banner__close":"_3SNQ1","banner--single-line":"_3nLTI"};
|
|
6816
6634
|
|
|
6817
6635
|
var ButtonCTA = function ButtonCTA(_ref) {
|
|
6818
6636
|
var button = _ref.button,
|
|
@@ -6835,7 +6653,7 @@ var ButtonCTA = function ButtonCTA(_ref) {
|
|
|
6835
6653
|
}, button.props));
|
|
6836
6654
|
};
|
|
6837
6655
|
|
|
6838
|
-
var styles$
|
|
6656
|
+
var styles$C = {"banner__caption":"_1jqm8"};
|
|
6839
6657
|
|
|
6840
6658
|
var InlineBannerCTA = function InlineBannerCTA(_ref) {
|
|
6841
6659
|
var primaryButton = _ref.primaryButton,
|
|
@@ -6866,7 +6684,7 @@ var InlineBannerCTA = function InlineBannerCTA(_ref) {
|
|
|
6866
6684
|
bannerTheme: bannerTheme,
|
|
6867
6685
|
primaryCTA: true
|
|
6868
6686
|
})), caption && multiLine && React__default.createElement("div", {
|
|
6869
|
-
className: styles$
|
|
6687
|
+
className: styles$C['banner__caption']
|
|
6870
6688
|
}, caption));
|
|
6871
6689
|
};
|
|
6872
6690
|
|
|
@@ -6891,7 +6709,7 @@ var InlineBannerIcon = function InlineBannerIcon(_ref) {
|
|
|
6891
6709
|
}
|
|
6892
6710
|
};
|
|
6893
6711
|
|
|
6894
|
-
var _excluded$
|
|
6712
|
+
var _excluded$2m = ["children", "theme", "title", "onClose", "caption", "primaryButton", "secondaryButton", "testId"];
|
|
6895
6713
|
|
|
6896
6714
|
var InlineBanner = function InlineBanner(_ref) {
|
|
6897
6715
|
var _classnames, _classnames2;
|
|
@@ -6905,7 +6723,7 @@ var InlineBanner = function InlineBanner(_ref) {
|
|
|
6905
6723
|
primaryButton = _ref.primaryButton,
|
|
6906
6724
|
secondaryButton = _ref.secondaryButton,
|
|
6907
6725
|
testId = _ref.testId,
|
|
6908
|
-
positionProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
6726
|
+
positionProps = _objectWithoutPropertiesLoose(_ref, _excluded$2m);
|
|
6909
6727
|
|
|
6910
6728
|
var positionStyles = usePositionStyles(positionProps);
|
|
6911
6729
|
var multiLine = !!title;
|
|
@@ -6913,14 +6731,14 @@ var InlineBanner = function InlineBanner(_ref) {
|
|
|
6913
6731
|
var Layout = multiLine ? Stack : Inline;
|
|
6914
6732
|
return React__default.createElement("div", {
|
|
6915
6733
|
"data-testid": testId,
|
|
6916
|
-
className: classnames(styles$
|
|
6734
|
+
className: classnames(styles$B['banner'], (_classnames = {}, _classnames[styles$B['banner--info']] = theme === BANNER_THEME.INFO, _classnames[styles$B['banner--warning']] = theme === BANNER_THEME.WARNING, _classnames[styles$B['banner--success']] = theme === BANNER_THEME.SUCCESS, _classnames[styles$B['banner--danger']] = theme === BANNER_THEME.DANGER, _classnames[styles$B['banner--upsell']] = theme === BANNER_THEME.UPSELL, _classnames[styles$B['banner--single-line']] = !multiLine, _classnames)),
|
|
6917
6735
|
style: positionStyles
|
|
6918
6736
|
}, React__default.createElement(Inline, {
|
|
6919
6737
|
alignItems: multiLine ? undefined : 'center',
|
|
6920
6738
|
flex: ['0 1 auto', 1],
|
|
6921
6739
|
space: 12
|
|
6922
6740
|
}, React__default.createElement("div", {
|
|
6923
|
-
className: styles$
|
|
6741
|
+
className: styles$B['banner__icon']
|
|
6924
6742
|
}, React__default.createElement(InlineBannerIcon, {
|
|
6925
6743
|
theme: theme
|
|
6926
6744
|
})), React__default.createElement(Layout, {
|
|
@@ -6930,9 +6748,9 @@ var InlineBanner = function InlineBanner(_ref) {
|
|
|
6930
6748
|
flex: ['min-content'],
|
|
6931
6749
|
flexWrap: multiLine ? undefined : 'wrap'
|
|
6932
6750
|
}, title && React__default.createElement("div", {
|
|
6933
|
-
className: styles$
|
|
6751
|
+
className: styles$B['banner__title']
|
|
6934
6752
|
}, title), React__default.createElement("div", {
|
|
6935
|
-
className: classnames(styles$
|
|
6753
|
+
className: classnames(styles$B['banner__body'], (_classnames2 = {}, _classnames2[styles$B['banner__body--multilineCTA']] = primaryButton && multiLine, _classnames2))
|
|
6936
6754
|
}, children), primaryButton && React__default.createElement(InlineBannerCTA, {
|
|
6937
6755
|
primaryButton: primaryButton,
|
|
6938
6756
|
secondaryButton: secondaryButton,
|
|
@@ -6940,7 +6758,7 @@ var InlineBanner = function InlineBanner(_ref) {
|
|
|
6940
6758
|
multiLine: multiLine,
|
|
6941
6759
|
bannerTheme: theme
|
|
6942
6760
|
})), dismissable && React__default.createElement("div", {
|
|
6943
|
-
className: styles$
|
|
6761
|
+
className: styles$B['banner__close']
|
|
6944
6762
|
}, React__default.createElement(Button$1, {
|
|
6945
6763
|
theme: "link-icon",
|
|
6946
6764
|
type: "button",
|
|
@@ -6954,7 +6772,7 @@ var PERSISTENT_BANNER_THEME = {
|
|
|
6954
6772
|
DANGER: 'danger'
|
|
6955
6773
|
};
|
|
6956
6774
|
|
|
6957
|
-
var styles$
|
|
6775
|
+
var styles$D = {"persistent-banner":"_1KO1J","persistent-banner--info":"_2mTN3","persistent-banner--danger":"_1YuCF","persistent-banner--upsell":"_tlNFk"};
|
|
6958
6776
|
|
|
6959
6777
|
var PersistentBanner = function PersistentBanner(_ref) {
|
|
6960
6778
|
var _classNames;
|
|
@@ -6983,7 +6801,7 @@ var PersistentBanner = function PersistentBanner(_ref) {
|
|
|
6983
6801
|
};
|
|
6984
6802
|
|
|
6985
6803
|
return React__default.createElement("div", {
|
|
6986
|
-
className: classnames(styles$
|
|
6804
|
+
className: classnames(styles$D['persistent-banner'], (_classNames = {}, _classNames[styles$D['persistent-banner--info']] = theme === PERSISTENT_BANNER_THEME.INFO, _classNames[styles$D['persistent-banner--danger']] = theme === PERSISTENT_BANNER_THEME.DANGER, _classNames[styles$D['persistent-banner--upsell']] = theme === PERSISTENT_BANNER_THEME.UPSELL, _classNames)),
|
|
6987
6805
|
"data-testid": testId
|
|
6988
6806
|
}, onDismiss ? React__default.createElement(Inline, {
|
|
6989
6807
|
flex: [1],
|
|
@@ -7055,7 +6873,7 @@ var useProgress = function useProgress(progress, maxValue, getMetric) {
|
|
|
7055
6873
|
};
|
|
7056
6874
|
};
|
|
7057
6875
|
|
|
7058
|
-
var styles$
|
|
6876
|
+
var styles$E = {"circular-progress":"_1XR7V","circular-progress__label":"_1BygP","circular-progress__track":"_1Ak-z","circular-progress__indicator":"_22YIp"};
|
|
7059
6877
|
|
|
7060
6878
|
var CircularProgress = function CircularProgress(_ref) {
|
|
7061
6879
|
var progress = _ref.progress,
|
|
@@ -7070,7 +6888,7 @@ var CircularProgress = function CircularProgress(_ref) {
|
|
|
7070
6888
|
|
|
7071
6889
|
var determinant = metric.percentage * 2.79;
|
|
7072
6890
|
return React__default.createElement("div", Object.assign({}, elementProps, {
|
|
7073
|
-
className: styles$
|
|
6891
|
+
className: styles$E['circular-progress'],
|
|
7074
6892
|
"data-testid": testId
|
|
7075
6893
|
}), React__default.createElement("svg", {
|
|
7076
6894
|
viewBox: "0 0 100 100"
|
|
@@ -7079,21 +6897,21 @@ var CircularProgress = function CircularProgress(_ref) {
|
|
|
7079
6897
|
cy: 50,
|
|
7080
6898
|
r: 45,
|
|
7081
6899
|
strokeWidth: "10px",
|
|
7082
|
-
className: styles$
|
|
6900
|
+
className: styles$E['circular-progress__track']
|
|
7083
6901
|
}), React__default.createElement("circle", {
|
|
7084
6902
|
cx: 50,
|
|
7085
6903
|
cy: 50,
|
|
7086
6904
|
r: 45,
|
|
7087
6905
|
strokeWidth: "10px",
|
|
7088
|
-
className: styles$
|
|
6906
|
+
className: styles$E['circular-progress__indicator'],
|
|
7089
6907
|
strokeDashoffset: "66",
|
|
7090
6908
|
strokeDasharray: determinant + " " + (279 - determinant)
|
|
7091
6909
|
})), React__default.createElement("div", {
|
|
7092
|
-
className: styles$
|
|
6910
|
+
className: styles$E['circular-progress__label']
|
|
7093
6911
|
}, children || metric.progress + "/" + metric.maxValue));
|
|
7094
6912
|
};
|
|
7095
6913
|
|
|
7096
|
-
var styles$
|
|
6914
|
+
var styles$F = {"progress-bar":"_3nyZN","progress-bar__indicator":"_11TEp","progress-bar__steps":"_3XFTU"};
|
|
7097
6915
|
|
|
7098
6916
|
var ProgressBar = function ProgressBar(_ref) {
|
|
7099
6917
|
var progress = _ref.progress,
|
|
@@ -7108,15 +6926,15 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
7108
6926
|
metric = _useProgress.metric;
|
|
7109
6927
|
|
|
7110
6928
|
return React__default.createElement(Stack, null, React__default.createElement("div", Object.assign({}, elementProps, {
|
|
7111
|
-
className: styles$
|
|
6929
|
+
className: styles$F['progress-bar'],
|
|
7112
6930
|
"data-testid": testId
|
|
7113
6931
|
}), React__default.createElement("div", {
|
|
7114
|
-
className: styles$
|
|
6932
|
+
className: styles$F['progress-bar__indicator'],
|
|
7115
6933
|
style: {
|
|
7116
6934
|
width: metric.percentage + "%"
|
|
7117
6935
|
}
|
|
7118
6936
|
})), steps && steps.length > 0 && React__default.createElement("div", {
|
|
7119
|
-
className: styles$
|
|
6937
|
+
className: styles$F['progress-bar__steps']
|
|
7120
6938
|
}, steps.map(function (step) {
|
|
7121
6939
|
return React__default.createElement("div", {
|
|
7122
6940
|
key: step
|
|
@@ -7124,7 +6942,7 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
7124
6942
|
})));
|
|
7125
6943
|
};
|
|
7126
6944
|
|
|
7127
|
-
var styles$
|
|
6945
|
+
var styles$G = {"skeleton":"_3w7eX","skeleton__avatar":"_3FtIs","skeleton__avatar--small":"_3bCyy","skeleton__avatar--medium":"_2zQGs","skeleton__avatar--large":"_14IIB","skeleton__avatar--xlarge":"_1C4Xa"};
|
|
7128
6946
|
|
|
7129
6947
|
var SKELETON_COMPONENT = {
|
|
7130
6948
|
AVATAR: 'avatar',
|
|
@@ -7134,22 +6952,210 @@ var SKELETON_COMPONENT = {
|
|
|
7134
6952
|
AVATAR_XLARGE: 'avatar--xlarge'
|
|
7135
6953
|
};
|
|
7136
6954
|
|
|
7137
|
-
var _excluded$
|
|
6955
|
+
var _excluded$2n = ["as", "testId"];
|
|
7138
6956
|
|
|
7139
6957
|
var Skeleton = function Skeleton(_ref) {
|
|
7140
6958
|
var _classnames;
|
|
7141
6959
|
|
|
7142
6960
|
var as = _ref.as,
|
|
7143
6961
|
testId = _ref.testId,
|
|
7144
|
-
positionStyles = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
6962
|
+
positionStyles = _objectWithoutPropertiesLoose(_ref, _excluded$2n);
|
|
7145
6963
|
|
|
7146
6964
|
return React__default.createElement("div", {
|
|
7147
6965
|
"data-testid": testId,
|
|
7148
|
-
className: classnames(styles$
|
|
6966
|
+
className: classnames(styles$G['skeleton'], (_classnames = {}, _classnames[styles$G['skeleton__avatar']] = as === SKELETON_COMPONENT.AVATAR, _classnames[styles$G['skeleton__avatar--small']] = as === SKELETON_COMPONENT.AVATAR_SMALL, _classnames[styles$G['skeleton__avatar--medium']] = as === SKELETON_COMPONENT.AVATAR_MEDIUM, _classnames[styles$G['skeleton__avatar--large']] = as === SKELETON_COMPONENT.AVATAR_LARGE, _classnames[styles$G['skeleton__avatar--xlarge']] = as === SKELETON_COMPONENT.AVATAR_XLARGE, _classnames)),
|
|
7149
6967
|
style: positionStyles
|
|
7150
6968
|
});
|
|
7151
6969
|
};
|
|
7152
6970
|
|
|
6971
|
+
var DataTableRowActions = function DataTableRowActions(_ref) {
|
|
6972
|
+
var actions = _ref.actions,
|
|
6973
|
+
columnIndex = _ref.columnIndex;
|
|
6974
|
+
|
|
6975
|
+
var _useDataTableContext = useDataTableContext(),
|
|
6976
|
+
state = _useDataTableContext.state;
|
|
6977
|
+
|
|
6978
|
+
var kebabMenuItems = actions.filter(function (action) {
|
|
6979
|
+
return action.showInKebab === undefined || action.showInKebab;
|
|
6980
|
+
});
|
|
6981
|
+
var sideActions = actions.filter(function (action) {
|
|
6982
|
+
return action.showInKebab === false;
|
|
6983
|
+
});
|
|
6984
|
+
return React__default.createElement(DataTableCell, {
|
|
6985
|
+
columnIndex: columnIndex
|
|
6986
|
+
}, React__default.createElement("div", {
|
|
6987
|
+
className: styles$e['actions'],
|
|
6988
|
+
"data-testid": "data-table-dropdown-menu"
|
|
6989
|
+
}, state === 'SKELETON_LOADING' && React__default.createElement(Skeleton, {
|
|
6990
|
+
width: 96
|
|
6991
|
+
}), sideActions.length > 0 && sideActions.map(function (action) {
|
|
6992
|
+
return React__default.createElement(Button$1, Object.assign({
|
|
6993
|
+
key: action.action,
|
|
6994
|
+
onClick: action.onAction,
|
|
6995
|
+
theme: typeof action.label === 'string' ? 'default' : 'link-icon'
|
|
6996
|
+
}, action.showInKebab === false ? action.buttonProps : {}), action.label);
|
|
6997
|
+
}), kebabMenuItems.length > 0 && React__default.createElement(KebabMenu, {
|
|
6998
|
+
actions: kebabMenuItems
|
|
6999
|
+
})));
|
|
7000
|
+
};
|
|
7001
|
+
|
|
7002
|
+
var styles$H = {"data-table-editable-cell":"_qYNve","data-table-editable-cell--right-aligned":"_3w6bw","data-table-editable-cell--currency":"_2y-_5","data-table-editable-cell--invalid":"_1Mx8j","data-table-editable-cell--top-left":"_2BlhN","data-table-editable-cell--top-right":"_1qDoN","data-table-editable-cell--bottom-left":"_2NUlb","data-table-editable-cell--bottom-right":"_3Mm-v"};
|
|
7003
|
+
|
|
7004
|
+
var DataTableEditableCellElement = function DataTableEditableCellElement(_ref, ref) {
|
|
7005
|
+
var _columns$columnIndex, _controllers$error, _classnames, _classnames2;
|
|
7006
|
+
|
|
7007
|
+
var name = _ref.name,
|
|
7008
|
+
columnIndex = _ref.columnIndex,
|
|
7009
|
+
rowIndex = _ref.rowIndex,
|
|
7010
|
+
inputId = _ref.id,
|
|
7011
|
+
value = _ref.value,
|
|
7012
|
+
onChange = _ref.onChange,
|
|
7013
|
+
onBlur = _ref.onBlur,
|
|
7014
|
+
placeholder = _ref.placeholder,
|
|
7015
|
+
disabled = _ref.disabled,
|
|
7016
|
+
error = _ref.error,
|
|
7017
|
+
prefix = _ref.prefix,
|
|
7018
|
+
suffix = _ref.suffix,
|
|
7019
|
+
defaultValue = _ref.defaultValue,
|
|
7020
|
+
_ref$type = _ref.type,
|
|
7021
|
+
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
7022
|
+
testId = _ref.testId;
|
|
7023
|
+
|
|
7024
|
+
var _useDataTableContext = useDataTableContext(),
|
|
7025
|
+
columns = _useDataTableContext.columns,
|
|
7026
|
+
numberOfRows = _useDataTableContext.numberOfRows;
|
|
7027
|
+
|
|
7028
|
+
var column = (_columns$columnIndex = columns === null || columns === void 0 ? void 0 : columns[columnIndex]) != null ? _columns$columnIndex : null;
|
|
7029
|
+
var isRightAligned = column ? column.isRightAligned : false;
|
|
7030
|
+
var numberOfColumns = (columns === null || columns === void 0 ? void 0 : columns.length) || 0;
|
|
7031
|
+
var isTopLeftCell = columnIndex === 0 && rowIndex === 0;
|
|
7032
|
+
var isTopRightCell = columnIndex === numberOfColumns - 1 && rowIndex === 0;
|
|
7033
|
+
var isBottomLeftCell = columnIndex === 0 && rowIndex === numberOfRows - 1;
|
|
7034
|
+
var isBottomRightCell = columnIndex === numberOfColumns - 1 && rowIndex === numberOfRows - 1;
|
|
7035
|
+
var controllers = useFieldControllers({
|
|
7036
|
+
name: name,
|
|
7037
|
+
id: inputId,
|
|
7038
|
+
value: value,
|
|
7039
|
+
onChange: onChange,
|
|
7040
|
+
onBlur: onBlur,
|
|
7041
|
+
error: error,
|
|
7042
|
+
type: type
|
|
7043
|
+
});
|
|
7044
|
+
var hasError = !!controllers.error;
|
|
7045
|
+
var errorMessage = (_controllers$error = controllers.error) === null || _controllers$error === void 0 ? void 0 : _controllers$error.toString();
|
|
7046
|
+
var fieldProps = {
|
|
7047
|
+
name: name,
|
|
7048
|
+
id: controllers.id
|
|
7049
|
+
};
|
|
7050
|
+
var EditableCell = React__default.createElement("div", {
|
|
7051
|
+
className: classnames((_classnames = {}, _classnames[styles$H['data-table-editable-cell--currency']] = type === 'currency', _classnames), styles$H['data-table-editable-cell']),
|
|
7052
|
+
"data-testid": testId,
|
|
7053
|
+
role: "cell"
|
|
7054
|
+
}, React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement(AffixContainer, {
|
|
7055
|
+
prefix: prefix,
|
|
7056
|
+
suffix: suffix
|
|
7057
|
+
}, React__default.createElement("input", {
|
|
7058
|
+
name: name,
|
|
7059
|
+
id: controllers.id,
|
|
7060
|
+
className: classnames((_classnames2 = {}, _classnames2[styles$H['data-table-editable-cell--right-aligned']] = isRightAligned, _classnames2[styles$H['data-table-editable-cell--top-left']] = isTopLeftCell, _classnames2[styles$H['data-table-editable-cell--top-right']] = isTopRightCell, _classnames2[styles$H['data-table-editable-cell--bottom-left']] = isBottomLeftCell, _classnames2[styles$H['data-table-editable-cell--bottom-right']] = isBottomRightCell, _classnames2[styles$H['data-table-editable-cell--invalid']] = hasError, _classnames2)),
|
|
7061
|
+
type: type === 'currency' ? 'number' : 'text',
|
|
7062
|
+
step: type === 'currency' ? 'any' : '',
|
|
7063
|
+
"data-testid": testId && testId + "-text-field",
|
|
7064
|
+
"aria-describedby": hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
|
|
7065
|
+
"aria-invalid": hasError,
|
|
7066
|
+
disabled: disabled,
|
|
7067
|
+
placeholder: placeholder,
|
|
7068
|
+
defaultValue: defaultValue,
|
|
7069
|
+
value: controllers.value,
|
|
7070
|
+
onChange: controllers.onChange,
|
|
7071
|
+
onBlur: controllers.onBlur,
|
|
7072
|
+
ref: ref,
|
|
7073
|
+
onWheel: function onWheel(e) {
|
|
7074
|
+
e.target.blur();
|
|
7075
|
+
}
|
|
7076
|
+
}))));
|
|
7077
|
+
return React__default.createElement(Tooltip$1, {
|
|
7078
|
+
overlay: errorMessage,
|
|
7079
|
+
placement: "top",
|
|
7080
|
+
theme: "white"
|
|
7081
|
+
}, EditableCell);
|
|
7082
|
+
};
|
|
7083
|
+
|
|
7084
|
+
var DataTableEditableCell = React.forwardRef(DataTableEditableCellElement);
|
|
7085
|
+
|
|
7086
|
+
var _excluded$2o = ["children", "onClick", "isSelected", "actions", "hasDefaultPadding", "hasDefaultCell", "testId"];
|
|
7087
|
+
|
|
7088
|
+
var DataTableRowComponent = function DataTableRowComponent(_ref, ref) {
|
|
7089
|
+
var _classnames;
|
|
7090
|
+
|
|
7091
|
+
var children = _ref.children,
|
|
7092
|
+
onClick = _ref.onClick,
|
|
7093
|
+
_ref$isSelected = _ref.isSelected,
|
|
7094
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
7095
|
+
_ref$actions = _ref.actions,
|
|
7096
|
+
actions = _ref$actions === void 0 ? [] : _ref$actions,
|
|
7097
|
+
_ref$hasDefaultCell = _ref.hasDefaultCell,
|
|
7098
|
+
hasDefaultCell = _ref$hasDefaultCell === void 0 ? true : _ref$hasDefaultCell,
|
|
7099
|
+
testId = _ref.testId,
|
|
7100
|
+
nativeDivProps = _objectWithoutPropertiesLoose(_ref, _excluded$2o);
|
|
7101
|
+
|
|
7102
|
+
var _useDataTableContext = useDataTableContext(),
|
|
7103
|
+
showActionMenu = _useDataTableContext.showActionMenu;
|
|
7104
|
+
|
|
7105
|
+
var styleNames = classnames(styles$d['item'], (_classnames = {}, _classnames[styles$d['clickable']] = onClick, _classnames[styles$d['selected']] = isSelected, _classnames));
|
|
7106
|
+
|
|
7107
|
+
var renderColumn = function renderColumn(columnElement, index) {
|
|
7108
|
+
var isUsingDataTableCell = columnElement && typeof columnElement === 'object' && 'type' in columnElement && (columnElement === null || columnElement === void 0 ? void 0 : columnElement.type) === DataTableCell;
|
|
7109
|
+
|
|
7110
|
+
if (isUsingDataTableCell || !hasDefaultCell) {
|
|
7111
|
+
return columnElement;
|
|
7112
|
+
}
|
|
7113
|
+
|
|
7114
|
+
var isUsingDataTableEditableCell = columnElement && typeof columnElement === 'object' && 'type' in columnElement && (columnElement === null || columnElement === void 0 ? void 0 : columnElement.type) === DataTableEditableCell;
|
|
7115
|
+
return React__default.createElement(DataTableCell, {
|
|
7116
|
+
key: index,
|
|
7117
|
+
columnIndex: index,
|
|
7118
|
+
noPadding: !!isUsingDataTableEditableCell
|
|
7119
|
+
}, columnElement);
|
|
7120
|
+
};
|
|
7121
|
+
|
|
7122
|
+
return React__default.createElement("tr", Object.assign({}, nativeDivProps, {
|
|
7123
|
+
className: styleNames,
|
|
7124
|
+
onClick: onClick ? onClick : undefined,
|
|
7125
|
+
onKeyPress: onClick ? onClick : undefined,
|
|
7126
|
+
"data-testid": testId && testId + "-row",
|
|
7127
|
+
role: "row",
|
|
7128
|
+
ref: ref
|
|
7129
|
+
}), React__default.Children.toArray(children).filter(Boolean).map(function (child, index) {
|
|
7130
|
+
return renderColumn(child, index);
|
|
7131
|
+
}), showActionMenu && React__default.createElement(DataTableRowActions, {
|
|
7132
|
+
actions: actions,
|
|
7133
|
+
columnIndex: React__default.Children.count(children)
|
|
7134
|
+
}));
|
|
7135
|
+
};
|
|
7136
|
+
|
|
7137
|
+
var DataTableRow = React.forwardRef(DataTableRowComponent);
|
|
7138
|
+
|
|
7139
|
+
var DataTableDefaultItemComponent = function DataTableDefaultItemComponent(_ref) {
|
|
7140
|
+
var columns = _ref.columns,
|
|
7141
|
+
item = _ref.item,
|
|
7142
|
+
testId = _ref.testId;
|
|
7143
|
+
var headingKeys = columns ? columns.map(function (column) {
|
|
7144
|
+
return column.name;
|
|
7145
|
+
}) : Object.keys(item);
|
|
7146
|
+
var columnsToShow = headingKeys.filter(function (key) {
|
|
7147
|
+
return key !== 'actions';
|
|
7148
|
+
});
|
|
7149
|
+
return React__default.createElement(DataTableRow, {
|
|
7150
|
+
actions: item.actions,
|
|
7151
|
+
testId: testId
|
|
7152
|
+
}, columnsToShow.map(function (headingKey) {
|
|
7153
|
+
return React__default.createElement("div", {
|
|
7154
|
+
key: headingKey
|
|
7155
|
+
}, item[headingKey] || '');
|
|
7156
|
+
}));
|
|
7157
|
+
};
|
|
7158
|
+
|
|
7153
7159
|
var DataTable = function DataTable(_ref) {
|
|
7154
7160
|
var _classNames, _classNames2, _classNames3;
|
|
7155
7161
|
|
|
@@ -7210,14 +7216,14 @@ var DataTable = function DataTable(_ref) {
|
|
|
7210
7216
|
state = 'CONTENT';
|
|
7211
7217
|
}
|
|
7212
7218
|
|
|
7213
|
-
var skeletonRows = Array.from(Array(
|
|
7219
|
+
var skeletonRows = Array.from(Array(10).keys());
|
|
7214
7220
|
return React__default.createElement(Context.Provider, {
|
|
7215
7221
|
value: {
|
|
7216
7222
|
columns: columns,
|
|
7217
7223
|
showActionMenu: showActionMenu,
|
|
7218
7224
|
numberOfRows: numberOfRows,
|
|
7219
7225
|
hasVerticalBorders: hasVerticalBorders,
|
|
7220
|
-
|
|
7226
|
+
state: state
|
|
7221
7227
|
}
|
|
7222
7228
|
}, React__default.createElement("div", {
|
|
7223
7229
|
className: classnames(styles$a['data-table'])
|