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