@helpdice/ui 1.2.7 → 1.2.9
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.js +181 -185
- package/dist/table/index.js +1187 -1191
- package/esm/table/table-head.js +2 -82
- package/esm/table/table.js +78 -4
- package/package.json +1 -1
package/dist/table/index.js
CHANGED
|
@@ -989,47 +989,112 @@ var useTheme = function useTheme() {
|
|
|
989
989
|
return React.useContext(ThemeContext);
|
|
990
990
|
};
|
|
991
991
|
|
|
992
|
-
var
|
|
993
|
-
var
|
|
994
|
-
|
|
992
|
+
var makeColgroup = function makeColgroup(width, columns) {
|
|
993
|
+
var unsetWidthCount = columns.filter(function (c) {
|
|
994
|
+
return !c.width;
|
|
995
|
+
}).length;
|
|
996
|
+
var customWidthTotal = columns.reduce(function (pre, current) {
|
|
997
|
+
return current.width ? pre + current.width : pre;
|
|
998
|
+
}, 0);
|
|
999
|
+
var averageWidth = (width - customWidthTotal) / unsetWidthCount;
|
|
1000
|
+
if (averageWidth <= 0) return /*#__PURE__*/React.createElement("colgroup", null);
|
|
1001
|
+
return /*#__PURE__*/React.createElement("colgroup", null, columns.map(function (column, index) {
|
|
1002
|
+
return /*#__PURE__*/React.createElement("col", {
|
|
1003
|
+
key: "colgroup-".concat(index),
|
|
1004
|
+
width: column.width || averageWidth
|
|
1005
|
+
});
|
|
1006
|
+
}));
|
|
1007
|
+
};
|
|
1008
|
+
var TableHead = function TableHead(props) {
|
|
995
1009
|
var theme = useTheme();
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1010
|
+
var _ref = props,
|
|
1011
|
+
columns = _ref.columns,
|
|
1012
|
+
width = _ref.width;
|
|
1013
|
+
var isScalableWidth = React.useMemo(function () {
|
|
1014
|
+
return columns.find(function (item) {
|
|
1015
|
+
return !!item.width;
|
|
1016
|
+
});
|
|
1017
|
+
}, [columns]);
|
|
1018
|
+
var colgroup = React.useMemo(function () {
|
|
1019
|
+
if (!isScalableWidth) return /*#__PURE__*/React.createElement("colgroup", null);
|
|
1020
|
+
return makeColgroup(width, columns);
|
|
1021
|
+
}, [isScalableWidth, width]);
|
|
1022
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, colgroup, /*#__PURE__*/React.createElement("thead", {
|
|
1023
|
+
className: _JSXStyle.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
|
|
1024
|
+
}, /*#__PURE__*/React.createElement("tr", {
|
|
1025
|
+
className: _JSXStyle.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
|
|
1026
|
+
}, columns.map(function (column, index) {
|
|
1027
|
+
return /*#__PURE__*/React.createElement("th", {
|
|
1028
|
+
style: {
|
|
1029
|
+
// textAlign: `${column?.align} !important`,
|
|
1030
|
+
// paddingLeft: '0.3rem',
|
|
1031
|
+
// paddingRight: '0.3rem',
|
|
1032
|
+
// color: `${column?.color}`,
|
|
1033
|
+
whiteSpace: column !== null && column !== undefined && column.noWrap ? 'nowrap' : 'normal'
|
|
1034
|
+
},
|
|
1035
|
+
key: "table-th-".concat(column.prop.toString(), "-").concat(index),
|
|
1036
|
+
"data-column": column.label,
|
|
1037
|
+
className: _JSXStyle.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]]) + " " + (column.className || "")
|
|
1038
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1039
|
+
className: _JSXStyle.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]]) + " " + "thead-box"
|
|
1040
|
+
}, column.label, /*#__PURE__*/React.createElement("br", {
|
|
1041
|
+
className: _JSXStyle.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
|
|
1042
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
1043
|
+
style: {
|
|
1044
|
+
textAlign: 'center'
|
|
1045
|
+
},
|
|
1046
|
+
className: _JSXStyle.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
|
|
1047
|
+
}, column.text)));
|
|
1048
|
+
}))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1049
|
+
id: "134865897",
|
|
1050
|
+
dynamic: [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]
|
|
1051
|
+
}, "thead.__jsx-style-dynamic-selector{border-collapse:separate;border-spacing:0;font-size:inherit;}th.__jsx-style-dynamic-selector{padding:0 0.5em;font-size:calc(0.75 * var(--table-font-size));font-weight:normal;text-align:left;-webkit-letter-spacing:0;-moz-letter-spacing:0;-ms-letter-spacing:0;letter-spacing:0;vertical-align:middle;min-height:calc(2.5 * var(--table-font-size));color:".concat(theme.palette.accents_5, ";background:").concat(theme.palette.accents_1, ";border-bottom:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-radius:0;}th.__jsx-style-dynamic-selector:nth-child(1){border-bottom:1px solid ").concat(theme.palette.border, ";border-left:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-top-left-radius:").concat(theme.layout.radius, ";border-bottom-left-radius:").concat(theme.layout.radius, ";}th.__jsx-style-dynamic-selector:last-child{border-bottom:1px solid ").concat(theme.palette.border, ";border-right:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-top-right-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";}.thead-box.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-align:center;min-height:calc(2.5 * var(--table-font-size));text-transform:uppercase;}")));
|
|
1002
1052
|
};
|
|
1003
|
-
|
|
1053
|
+
TableHead.displayName = 'TableHead';
|
|
1004
1054
|
|
|
1005
|
-
var
|
|
1006
|
-
var
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1055
|
+
var TableCell = function TableCell(_ref) {
|
|
1056
|
+
var columns = _ref.columns,
|
|
1057
|
+
row = _ref.row,
|
|
1058
|
+
rowIndex = _ref.rowIndex,
|
|
1059
|
+
emptyText = _ref.emptyText,
|
|
1060
|
+
onCellClick = _ref.onCellClick;
|
|
1061
|
+
/* eslint-disable react/jsx-no-useless-fragment */
|
|
1062
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, columns.map(function (column, index) {
|
|
1063
|
+
var currentRowValue = row[column.prop];
|
|
1064
|
+
var cellValue = currentRowValue || emptyText;
|
|
1065
|
+
var shouldBeRenderElement = column.renderHandler(currentRowValue, row, rowIndex);
|
|
1066
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
1067
|
+
style: _objectSpread2({
|
|
1068
|
+
fontSize: "".concat(column === null || column === undefined ? undefined : column.fontSize),
|
|
1069
|
+
textAlign: "".concat(column === null || column === undefined ? undefined : column.align, " !important"),
|
|
1070
|
+
paddingLeft: '0.3rem',
|
|
1071
|
+
paddingRight: '0.3rem',
|
|
1072
|
+
color: "".concat(column === null || column === undefined ? undefined : column.color),
|
|
1073
|
+
whiteSpace: column !== null && column !== undefined && column.noWrap ? 'nowrap' : 'normal'
|
|
1074
|
+
}, currentRowValue === null || currentRowValue === undefined ? undefined : currentRowValue.style),
|
|
1075
|
+
"data-column": column.label,
|
|
1076
|
+
key: "row-td-".concat(index, "-").concat(column.prop.toString()),
|
|
1077
|
+
onClick: function onClick() {
|
|
1078
|
+
return onCellClick && onCellClick(currentRowValue, rowIndex, index);
|
|
1079
|
+
},
|
|
1080
|
+
className: column.className
|
|
1081
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1082
|
+
className: "cell"
|
|
1083
|
+
}, shouldBeRenderElement ? shouldBeRenderElement : cellValue));
|
|
1084
|
+
}));
|
|
1085
|
+
/* eslint-enable */
|
|
1014
1086
|
};
|
|
1015
|
-
InputBlockLabelComponent.displayName = 'GeistInputBlockLabel';
|
|
1016
|
-
var InputBlockLabel = /*#__PURE__*/React.memo(InputBlockLabelComponent);
|
|
1017
1087
|
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
id: "4247656379",
|
|
1028
|
-
dynamic: [clickable ? 'pointer' : 'default', clickable ? 'auto' : 'none']
|
|
1029
|
-
}, ".input-icon.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:calc(var(--input-height) - 2px);-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;margin:0;padding:0;line-height:1;position:relative;cursor:".concat(clickable ? 'pointer' : 'default', ";pointer-events:").concat(clickable ? 'auto' : 'none', ";}.input-icon.__jsx-style-dynamic-selector svg{width:calc(var(--input-height) - 2px);height:calc(var(--input-height) - 2px);-webkit-transform:scale(0.44);-ms-transform:scale(0.44);transform:scale(0.44);}")));
|
|
1088
|
+
/* "use client" */
|
|
1089
|
+
|
|
1090
|
+
var defaultContext$3 = {
|
|
1091
|
+
columns: [],
|
|
1092
|
+
updateColumn: function updateColumn() {}
|
|
1093
|
+
};
|
|
1094
|
+
var TableContext = /*#__PURE__*/React.createContext(defaultContext$3);
|
|
1095
|
+
var useTableContext = function useTableContext() {
|
|
1096
|
+
return React.useContext(TableContext);
|
|
1030
1097
|
};
|
|
1031
|
-
InputIconComponent.displayName = 'GeistInputIcon';
|
|
1032
|
-
var InputIcon = /*#__PURE__*/React.memo(InputIconComponent);
|
|
1033
1098
|
|
|
1034
1099
|
/* "use client" */
|
|
1035
1100
|
|
|
@@ -1064,660 +1129,28 @@ var useClasses = function useClasses() {
|
|
|
1064
1129
|
return classes.trim();
|
|
1065
1130
|
};
|
|
1066
1131
|
|
|
1067
|
-
var
|
|
1068
|
-
var onClick = _ref.onClick,
|
|
1069
|
-
disabled = _ref.disabled,
|
|
1070
|
-
visible = _ref.visible;
|
|
1071
|
-
var theme = useTheme();
|
|
1072
|
-
var classes = useClasses('clear-icon', {
|
|
1073
|
-
visible: visible
|
|
1074
|
-
});
|
|
1075
|
-
var clickHandler = function clickHandler(event) {
|
|
1076
|
-
event.preventDefault();
|
|
1077
|
-
event.stopPropagation();
|
|
1078
|
-
event.nativeEvent.stopImmediatePropagation();
|
|
1079
|
-
onClick && onClick(event);
|
|
1080
|
-
};
|
|
1081
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1082
|
-
onClick: clickHandler,
|
|
1083
|
-
className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]]) + " " + (classes || "")
|
|
1084
|
-
}, /*#__PURE__*/React.createElement("svg", {
|
|
1085
|
-
viewBox: "0 0 24 24",
|
|
1086
|
-
stroke: "currentColor",
|
|
1087
|
-
strokeWidth: "1.5",
|
|
1088
|
-
strokeLinecap: "round",
|
|
1089
|
-
strokeLinejoin: "round",
|
|
1090
|
-
fill: "none",
|
|
1091
|
-
shapeRendering: "geometricPrecision",
|
|
1092
|
-
className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]])
|
|
1093
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
1094
|
-
d: "M18 6L6 18",
|
|
1095
|
-
className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]])
|
|
1096
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
1097
|
-
d: "M6 6l12 12",
|
|
1098
|
-
className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]])
|
|
1099
|
-
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1100
|
-
id: "1567030211",
|
|
1101
|
-
dynamic: [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]
|
|
1102
|
-
}, ".clear-icon.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:calc(var(--input-height) - 2px);-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;cursor:".concat(disabled ? 'not-allowed' : 'pointer', ";-webkit-transition:color 150ms ease 0s;transition:color 150ms ease 0s;margin:0;padding:0;color:").concat(theme.palette.accents_3, ";visibility:hidden;opacity:0;}.visible.__jsx-style-dynamic-selector{visibility:visible;opacity:1;}.clear-icon.__jsx-style-dynamic-selector:hover{color:").concat(disabled ? theme.palette.accents_3 : theme.palette.foreground, ";}svg.__jsx-style-dynamic-selector{color:currentColor;width:calc(var(--input-height) - 2px);height:calc(var(--input-height) - 2px);-webkit-transform:scale(0.44);-ms-transform:scale(0.44);transform:scale(0.44);}")));
|
|
1103
|
-
};
|
|
1104
|
-
var MemoInputIconClear = /*#__PURE__*/React.memo(InputIconClear);
|
|
1132
|
+
var lodash$1 = {exports: {}};
|
|
1105
1133
|
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
borderColor: palette.secondary,
|
|
1116
|
-
hoverBorder: palette.secondary
|
|
1117
|
-
},
|
|
1118
|
-
success: {
|
|
1119
|
-
color: palette.foreground,
|
|
1120
|
-
borderColor: palette.successLight,
|
|
1121
|
-
hoverBorder: palette.success
|
|
1122
|
-
},
|
|
1123
|
-
warning: {
|
|
1124
|
-
color: palette.foreground,
|
|
1125
|
-
borderColor: palette.warningLight,
|
|
1126
|
-
hoverBorder: palette.warning
|
|
1127
|
-
},
|
|
1128
|
-
error: {
|
|
1129
|
-
color: palette.error,
|
|
1130
|
-
borderColor: palette.error,
|
|
1131
|
-
hoverBorder: palette.errorDark
|
|
1132
|
-
}
|
|
1133
|
-
};
|
|
1134
|
-
if (!status) return colors["default"];
|
|
1135
|
-
return colors[status];
|
|
1136
|
-
};
|
|
1134
|
+
/**
|
|
1135
|
+
* @license
|
|
1136
|
+
* Lodash <https://lodash.com/>
|
|
1137
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
1138
|
+
* Released under MIT license <https://lodash.com/license>
|
|
1139
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
1140
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
1141
|
+
*/
|
|
1142
|
+
var lodash = lodash$1.exports;
|
|
1137
1143
|
|
|
1138
|
-
|
|
1144
|
+
var hasRequiredLodash;
|
|
1139
1145
|
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
getScaleProps: function getScaleProps() {
|
|
1146
|
-
return undefined;
|
|
1147
|
-
},
|
|
1148
|
-
getAllScaleProps: function getAllScaleProps() {
|
|
1149
|
-
return {};
|
|
1150
|
-
},
|
|
1151
|
-
SCALES: {
|
|
1152
|
-
pl: defaultDynamicLayoutPipe,
|
|
1153
|
-
pr: defaultDynamicLayoutPipe,
|
|
1154
|
-
pb: defaultDynamicLayoutPipe,
|
|
1155
|
-
pt: defaultDynamicLayoutPipe,
|
|
1156
|
-
px: defaultDynamicLayoutPipe,
|
|
1157
|
-
py: defaultDynamicLayoutPipe,
|
|
1158
|
-
mb: defaultDynamicLayoutPipe,
|
|
1159
|
-
ml: defaultDynamicLayoutPipe,
|
|
1160
|
-
mr: defaultDynamicLayoutPipe,
|
|
1161
|
-
mt: defaultDynamicLayoutPipe,
|
|
1162
|
-
mx: defaultDynamicLayoutPipe,
|
|
1163
|
-
my: defaultDynamicLayoutPipe,
|
|
1164
|
-
width: defaultDynamicLayoutPipe,
|
|
1165
|
-
height: defaultDynamicLayoutPipe,
|
|
1166
|
-
font: defaultDynamicLayoutPipe
|
|
1167
|
-
},
|
|
1168
|
-
unit: '16px'
|
|
1169
|
-
};
|
|
1170
|
-
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext$3);
|
|
1171
|
-
var useScale = function useScale() {
|
|
1172
|
-
return React.useContext(ScaleContext);
|
|
1173
|
-
};
|
|
1146
|
+
function requireLodash () {
|
|
1147
|
+
if (hasRequiredLodash) return lodash$1.exports;
|
|
1148
|
+
hasRequiredLodash = 1;
|
|
1149
|
+
(function (module, exports) {
|
|
1150
|
+
(function() {
|
|
1174
1151
|
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
var getId = function getId() {
|
|
1178
|
-
return Math.random().toString(32).slice(2, 10);
|
|
1179
|
-
};
|
|
1180
|
-
var pickChildByProps = function pickChildByProps(children, key, value) {
|
|
1181
|
-
var target = [];
|
|
1182
|
-
var isArray = Array.isArray(value);
|
|
1183
|
-
var withoutPropChildren = React.Children.map(children, function (item) {
|
|
1184
|
-
if (! /*#__PURE__*/React.isValidElement(item)) return null;
|
|
1185
|
-
if (!item.props) return item;
|
|
1186
|
-
if (isArray) {
|
|
1187
|
-
if (value.includes(item.props[key])) {
|
|
1188
|
-
target.push(item);
|
|
1189
|
-
return null;
|
|
1190
|
-
}
|
|
1191
|
-
return item;
|
|
1192
|
-
}
|
|
1193
|
-
if (item.props[key] === value) {
|
|
1194
|
-
target.push(item);
|
|
1195
|
-
return null;
|
|
1196
|
-
}
|
|
1197
|
-
return item;
|
|
1198
|
-
});
|
|
1199
|
-
var targetChildren = target.length >= 0 ? target : undefined;
|
|
1200
|
-
return [withoutPropChildren, targetChildren];
|
|
1201
|
-
};
|
|
1202
|
-
var isBrowser = function isBrowser() {
|
|
1203
|
-
return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
1204
|
-
};
|
|
1205
|
-
var isCSSNumberValue = function isCSSNumberValue(value) {
|
|
1206
|
-
return value !== undefined && !Number.isNaN(+value);
|
|
1207
|
-
};
|
|
1208
|
-
|
|
1209
|
-
var generateGetScaleProps = function generateGetScaleProps(props) {
|
|
1210
|
-
var getScaleProps = function getScaleProps(keyOrKeys) {
|
|
1211
|
-
if (!Array.isArray(keyOrKeys)) return props[keyOrKeys];
|
|
1212
|
-
var value = undefined;
|
|
1213
|
-
var _iterator = _createForOfIteratorHelper(keyOrKeys),
|
|
1214
|
-
_step;
|
|
1215
|
-
try {
|
|
1216
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1217
|
-
var key = _step.value;
|
|
1218
|
-
var currentValue = props[key];
|
|
1219
|
-
if (typeof currentValue !== 'undefined') {
|
|
1220
|
-
value = currentValue;
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
} catch (err) {
|
|
1224
|
-
_iterator.e(err);
|
|
1225
|
-
} finally {
|
|
1226
|
-
_iterator.f();
|
|
1227
|
-
}
|
|
1228
|
-
return value;
|
|
1229
|
-
};
|
|
1230
|
-
return getScaleProps;
|
|
1231
|
-
};
|
|
1232
|
-
var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
|
|
1233
|
-
var getAllScaleProps = function getAllScaleProps() {
|
|
1234
|
-
var scaleProps = {};
|
|
1235
|
-
var _iterator2 = _createForOfIteratorHelper(ScalePropKeys),
|
|
1236
|
-
_step2;
|
|
1237
|
-
try {
|
|
1238
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1239
|
-
var key = _step2.value;
|
|
1240
|
-
var value = props[key];
|
|
1241
|
-
if (typeof value !== 'undefined') {
|
|
1242
|
-
scaleProps[key] = value;
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
} catch (err) {
|
|
1246
|
-
_iterator2.e(err);
|
|
1247
|
-
} finally {
|
|
1248
|
-
_iterator2.f();
|
|
1249
|
-
}
|
|
1250
|
-
return scaleProps;
|
|
1251
|
-
};
|
|
1252
|
-
return getAllScaleProps;
|
|
1253
|
-
};
|
|
1254
|
-
|
|
1255
|
-
var _excluded$e = ["children"];
|
|
1256
|
-
var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
|
|
1257
|
-
if (scale === 1) return scale;
|
|
1258
|
-
var diff = Math.abs((scale - 1) / 2);
|
|
1259
|
-
return scale > 1 ? 1 + diff : 1 - diff;
|
|
1260
|
-
};
|
|
1261
|
-
var withScale = function withScale(Render) {
|
|
1262
|
-
var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1263
|
-
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31, _ref32, _ref33;
|
|
1264
|
-
var children = _ref.children,
|
|
1265
|
-
props = _objectWithoutProperties(_ref, _excluded$e);
|
|
1266
|
-
var _useTheme = useTheme(),
|
|
1267
|
-
layout = _useTheme.layout;
|
|
1268
|
-
var paddingLeft = props.paddingLeft,
|
|
1269
|
-
pl = props.pl,
|
|
1270
|
-
paddingRight = props.paddingRight,
|
|
1271
|
-
pr = props.pr,
|
|
1272
|
-
paddingTop = props.paddingTop,
|
|
1273
|
-
pt = props.pt,
|
|
1274
|
-
paddingBottom = props.paddingBottom,
|
|
1275
|
-
pb = props.pb,
|
|
1276
|
-
marginTop = props.marginTop,
|
|
1277
|
-
mt = props.mt,
|
|
1278
|
-
marginRight = props.marginRight,
|
|
1279
|
-
mr = props.mr,
|
|
1280
|
-
marginBottom = props.marginBottom,
|
|
1281
|
-
mb = props.mb,
|
|
1282
|
-
marginLeft = props.marginLeft,
|
|
1283
|
-
ml = props.ml,
|
|
1284
|
-
px = props.px,
|
|
1285
|
-
py = props.py,
|
|
1286
|
-
mx = props.mx,
|
|
1287
|
-
my = props.my,
|
|
1288
|
-
width = props.width,
|
|
1289
|
-
height = props.height,
|
|
1290
|
-
font = props.font,
|
|
1291
|
-
w = props.w,
|
|
1292
|
-
h = props.h,
|
|
1293
|
-
margin = props.margin,
|
|
1294
|
-
padding = props.padding,
|
|
1295
|
-
_props$unit = props.unit,
|
|
1296
|
-
unit = _props$unit === undefined ? layout.unit : _props$unit,
|
|
1297
|
-
_props$scale = props.scale,
|
|
1298
|
-
scale = _props$scale === undefined ? 1 : _props$scale;
|
|
1299
|
-
var makeScaleHandler = function makeScaleHandler(attrValue) {
|
|
1300
|
-
return function (scale1x, defaultValue) {
|
|
1301
|
-
// 0 means disable scale and the default value is 0
|
|
1302
|
-
if (scale1x === 0) {
|
|
1303
|
-
scale1x = 1;
|
|
1304
|
-
defaultValue = defaultValue || 0;
|
|
1305
|
-
}
|
|
1306
|
-
var factor = reduceScaleCoefficient(scale) * scale1x;
|
|
1307
|
-
if (typeof attrValue === 'undefined') {
|
|
1308
|
-
if (typeof defaultValue !== 'undefined') return "".concat(defaultValue);
|
|
1309
|
-
return "calc(".concat(factor, " * ").concat(unit, ")");
|
|
1310
|
-
}
|
|
1311
|
-
if (!isCSSNumberValue(attrValue)) return "".concat(attrValue);
|
|
1312
|
-
var customFactor = factor * Number(attrValue);
|
|
1313
|
-
return "calc(".concat(customFactor, " * ").concat(unit, ")");
|
|
1314
|
-
};
|
|
1315
|
-
};
|
|
1316
|
-
var value = {
|
|
1317
|
-
unit: unit,
|
|
1318
|
-
SCALES: {
|
|
1319
|
-
pt: makeScaleHandler((_ref2 = (_ref3 = paddingTop !== null && paddingTop !== undefined ? paddingTop : pt) !== null && _ref3 !== undefined ? _ref3 : py) !== null && _ref2 !== undefined ? _ref2 : padding),
|
|
1320
|
-
pr: makeScaleHandler((_ref4 = (_ref5 = paddingRight !== null && paddingRight !== undefined ? paddingRight : pr) !== null && _ref5 !== undefined ? _ref5 : px) !== null && _ref4 !== undefined ? _ref4 : padding),
|
|
1321
|
-
pb: makeScaleHandler((_ref6 = (_ref7 = paddingBottom !== null && paddingBottom !== undefined ? paddingBottom : pb) !== null && _ref7 !== undefined ? _ref7 : py) !== null && _ref6 !== undefined ? _ref6 : padding),
|
|
1322
|
-
pl: makeScaleHandler((_ref8 = (_ref9 = paddingLeft !== null && paddingLeft !== undefined ? paddingLeft : pl) !== null && _ref9 !== undefined ? _ref9 : px) !== null && _ref8 !== undefined ? _ref8 : padding),
|
|
1323
|
-
px: makeScaleHandler((_ref10 = (_ref11 = (_ref12 = (_ref13 = px !== null && px !== undefined ? px : paddingLeft) !== null && _ref13 !== undefined ? _ref13 : paddingRight) !== null && _ref12 !== undefined ? _ref12 : pl) !== null && _ref11 !== undefined ? _ref11 : pr) !== null && _ref10 !== undefined ? _ref10 : padding),
|
|
1324
|
-
py: makeScaleHandler((_ref14 = (_ref15 = (_ref16 = (_ref17 = py !== null && py !== undefined ? py : paddingTop) !== null && _ref17 !== undefined ? _ref17 : paddingBottom) !== null && _ref16 !== undefined ? _ref16 : pt) !== null && _ref15 !== undefined ? _ref15 : pb) !== null && _ref14 !== undefined ? _ref14 : padding),
|
|
1325
|
-
mt: makeScaleHandler((_ref18 = (_ref19 = marginTop !== null && marginTop !== undefined ? marginTop : mt) !== null && _ref19 !== undefined ? _ref19 : my) !== null && _ref18 !== undefined ? _ref18 : margin),
|
|
1326
|
-
mr: makeScaleHandler((_ref20 = (_ref21 = marginRight !== null && marginRight !== undefined ? marginRight : mr) !== null && _ref21 !== undefined ? _ref21 : mx) !== null && _ref20 !== undefined ? _ref20 : margin),
|
|
1327
|
-
mb: makeScaleHandler((_ref22 = (_ref23 = marginBottom !== null && marginBottom !== undefined ? marginBottom : mb) !== null && _ref23 !== undefined ? _ref23 : my) !== null && _ref22 !== undefined ? _ref22 : margin),
|
|
1328
|
-
ml: makeScaleHandler((_ref24 = (_ref25 = marginLeft !== null && marginLeft !== undefined ? marginLeft : ml) !== null && _ref25 !== undefined ? _ref25 : mx) !== null && _ref24 !== undefined ? _ref24 : margin),
|
|
1329
|
-
mx: makeScaleHandler((_ref26 = (_ref27 = (_ref28 = (_ref29 = mx !== null && mx !== undefined ? mx : marginLeft) !== null && _ref29 !== undefined ? _ref29 : marginRight) !== null && _ref28 !== undefined ? _ref28 : ml) !== null && _ref27 !== undefined ? _ref27 : mr) !== null && _ref26 !== undefined ? _ref26 : margin),
|
|
1330
|
-
my: makeScaleHandler((_ref30 = (_ref31 = (_ref32 = (_ref33 = my !== null && my !== undefined ? my : marginTop) !== null && _ref33 !== undefined ? _ref33 : marginBottom) !== null && _ref32 !== undefined ? _ref32 : mt) !== null && _ref31 !== undefined ? _ref31 : mb) !== null && _ref30 !== undefined ? _ref30 : margin),
|
|
1331
|
-
width: makeScaleHandler(width !== null && width !== undefined ? width : w),
|
|
1332
|
-
height: makeScaleHandler(height !== null && height !== undefined ? height : h),
|
|
1333
|
-
font: makeScaleHandler(font)
|
|
1334
|
-
},
|
|
1335
|
-
getScaleProps: generateGetScaleProps(props),
|
|
1336
|
-
getAllScaleProps: generateGetAllScaleProps(props)
|
|
1337
|
-
};
|
|
1338
|
-
return /*#__PURE__*/React.createElement(ScaleContext.Provider, {
|
|
1339
|
-
value: value
|
|
1340
|
-
}, /*#__PURE__*/React.createElement(Render, _extends({}, props, {
|
|
1341
|
-
ref: ref
|
|
1342
|
-
}), children));
|
|
1343
|
-
});
|
|
1344
|
-
ScaleFC.displayName = "Scale".concat(Render.displayName || 'Wrapper');
|
|
1345
|
-
return ScaleFC;
|
|
1346
|
-
};
|
|
1347
|
-
|
|
1348
|
-
var _excluded$d = ["label", "labelRight", "type", "error", "htmlType", "icon", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "autoComplete", "placeholder", "children", "disabled"];
|
|
1349
|
-
var simulateChangeEvent = function simulateChangeEvent(el, event) {
|
|
1350
|
-
return _objectSpread2(_objectSpread2({}, event), {}, {
|
|
1351
|
-
target: el,
|
|
1352
|
-
currentTarget: el
|
|
1353
|
-
});
|
|
1354
|
-
};
|
|
1355
|
-
var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1356
|
-
var label = _ref.label,
|
|
1357
|
-
labelRight = _ref.labelRight,
|
|
1358
|
-
_ref$type = _ref.type,
|
|
1359
|
-
type = _ref$type === undefined ? 'default' : _ref$type,
|
|
1360
|
-
error = _ref.error,
|
|
1361
|
-
_ref$htmlType = _ref.htmlType,
|
|
1362
|
-
htmlType = _ref$htmlType === undefined ? 'text' : _ref$htmlType,
|
|
1363
|
-
icon = _ref.icon,
|
|
1364
|
-
iconRight = _ref.iconRight,
|
|
1365
|
-
_ref$iconClickable = _ref.iconClickable,
|
|
1366
|
-
iconClickable = _ref$iconClickable === undefined ? false : _ref$iconClickable,
|
|
1367
|
-
onIconClick = _ref.onIconClick,
|
|
1368
|
-
_ref$initialValue = _ref.initialValue,
|
|
1369
|
-
initialValue = _ref$initialValue === undefined ? '' : _ref$initialValue,
|
|
1370
|
-
onChange = _ref.onChange,
|
|
1371
|
-
_ref$readOnly = _ref.readOnly,
|
|
1372
|
-
readOnly = _ref$readOnly === undefined ? false : _ref$readOnly,
|
|
1373
|
-
value = _ref.value,
|
|
1374
|
-
onClearClick = _ref.onClearClick,
|
|
1375
|
-
_ref$clearable = _ref.clearable,
|
|
1376
|
-
clearable = _ref$clearable === undefined ? false : _ref$clearable,
|
|
1377
|
-
_ref$className = _ref.className,
|
|
1378
|
-
className = _ref$className === undefined ? '' : _ref$className,
|
|
1379
|
-
onBlur = _ref.onBlur,
|
|
1380
|
-
onFocus = _ref.onFocus,
|
|
1381
|
-
_ref$autoComplete = _ref.autoComplete,
|
|
1382
|
-
autoComplete = _ref$autoComplete === undefined ? 'off' : _ref$autoComplete,
|
|
1383
|
-
_ref$placeholder = _ref.placeholder,
|
|
1384
|
-
placeholder = _ref$placeholder === undefined ? '' : _ref$placeholder,
|
|
1385
|
-
children = _ref.children,
|
|
1386
|
-
_ref$disabled = _ref.disabled,
|
|
1387
|
-
disabled = _ref$disabled === undefined ? false : _ref$disabled,
|
|
1388
|
-
props = _objectWithoutProperties(_ref, _excluded$d);
|
|
1389
|
-
var theme = useTheme();
|
|
1390
|
-
var _useScale = useScale(),
|
|
1391
|
-
SCALES = _useScale.SCALES;
|
|
1392
|
-
var inputRef = React.useRef(null);
|
|
1393
|
-
React.useImperativeHandle(ref, function () {
|
|
1394
|
-
return inputRef.current;
|
|
1395
|
-
});
|
|
1396
|
-
var _useState = React.useState(initialValue),
|
|
1397
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1398
|
-
selfValue = _useState2[0],
|
|
1399
|
-
setSelfValue = _useState2[1];
|
|
1400
|
-
var _useState3 = React.useState(false),
|
|
1401
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1402
|
-
hover = _useState4[0],
|
|
1403
|
-
setHover = _useState4[1];
|
|
1404
|
-
var isControlledComponent = React.useMemo(function () {
|
|
1405
|
-
return value !== undefined;
|
|
1406
|
-
}, [value]);
|
|
1407
|
-
var labelClasses = React.useMemo(function () {
|
|
1408
|
-
return labelRight ? 'right-label' : label ? 'left-label' : '';
|
|
1409
|
-
}, [label, labelRight]);
|
|
1410
|
-
var iconClasses = React.useMemo(function () {
|
|
1411
|
-
return iconRight ? 'right-icon' : icon ? 'left-icon' : '';
|
|
1412
|
-
}, [icon, iconRight]);
|
|
1413
|
-
var _useMemo = React.useMemo(function () {
|
|
1414
|
-
return getColors$2(theme.palette, type);
|
|
1415
|
-
}, [theme.palette, type]),
|
|
1416
|
-
color = _useMemo.color,
|
|
1417
|
-
borderColor = _useMemo.borderColor,
|
|
1418
|
-
hoverBorder = _useMemo.hoverBorder;
|
|
1419
|
-
var changeHandler = function changeHandler(event) {
|
|
1420
|
-
if (disabled || readOnly) return;
|
|
1421
|
-
setSelfValue(event.target.value);
|
|
1422
|
-
onChange && onChange(event);
|
|
1423
|
-
};
|
|
1424
|
-
var clearHandler = function clearHandler(event) {
|
|
1425
|
-
setSelfValue('');
|
|
1426
|
-
onClearClick && onClearClick(event);
|
|
1427
|
-
/* istanbul ignore next */
|
|
1428
|
-
if (!inputRef.current) return;
|
|
1429
|
-
var changeEvent = simulateChangeEvent(inputRef.current, event);
|
|
1430
|
-
changeEvent.target.value = '';
|
|
1431
|
-
onChange && onChange(changeEvent);
|
|
1432
|
-
inputRef.current.focus();
|
|
1433
|
-
};
|
|
1434
|
-
var focusHandler = function focusHandler(e) {
|
|
1435
|
-
setHover(true);
|
|
1436
|
-
onFocus && onFocus(e);
|
|
1437
|
-
};
|
|
1438
|
-
var blurHandler = function blurHandler(e) {
|
|
1439
|
-
setHover(false);
|
|
1440
|
-
onBlur && onBlur(e);
|
|
1441
|
-
};
|
|
1442
|
-
var iconClickHandler = function iconClickHandler(e) {
|
|
1443
|
-
if (disabled) return;
|
|
1444
|
-
onIconClick && onIconClick(e);
|
|
1445
|
-
};
|
|
1446
|
-
var iconProps = React.useMemo(function () {
|
|
1447
|
-
return {
|
|
1448
|
-
clickable: iconClickable,
|
|
1449
|
-
onClick: iconClickHandler
|
|
1450
|
-
};
|
|
1451
|
-
}, [iconClickable, iconClickHandler]);
|
|
1452
|
-
React.useEffect(function () {
|
|
1453
|
-
if (isControlledComponent) {
|
|
1454
|
-
setSelfValue(value);
|
|
1455
|
-
}
|
|
1456
|
-
});
|
|
1457
|
-
var controlledValue = isControlledComponent ? {
|
|
1458
|
-
value: selfValue
|
|
1459
|
-
} : {
|
|
1460
|
-
defaultValue: initialValue
|
|
1461
|
-
};
|
|
1462
|
-
var inputProps = _objectSpread2(_objectSpread2({}, props), controlledValue);
|
|
1463
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1464
|
-
className: _JSXStyle.dynamic([["1424341926", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + "with-label"
|
|
1465
|
-
}, children && /*#__PURE__*/React.createElement(InputBlockLabel, null, children), /*#__PURE__*/React.createElement("div", {
|
|
1466
|
-
className: _JSXStyle.dynamic([["1424341926", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (useClasses('input-container', className) || "")
|
|
1467
|
-
}, label && /*#__PURE__*/React.createElement(MemoInputLabel, null, label), /*#__PURE__*/React.createElement("div", {
|
|
1468
|
-
className: _JSXStyle.dynamic([["1424341926", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (useClasses('input-wrapper', {
|
|
1469
|
-
hover: hover,
|
|
1470
|
-
disabled: disabled
|
|
1471
|
-
}, labelClasses) || "")
|
|
1472
|
-
}, icon && /*#__PURE__*/React.createElement(InputIcon, _extends({
|
|
1473
|
-
icon: icon
|
|
1474
|
-
}, iconProps)), /*#__PURE__*/React.createElement("input", _extends({
|
|
1475
|
-
type: htmlType,
|
|
1476
|
-
ref: inputRef,
|
|
1477
|
-
placeholder: placeholder,
|
|
1478
|
-
disabled: disabled,
|
|
1479
|
-
readOnly: readOnly,
|
|
1480
|
-
onFocus: focusHandler,
|
|
1481
|
-
onBlur: blurHandler,
|
|
1482
|
-
onChange: changeHandler,
|
|
1483
|
-
autoComplete: autoComplete
|
|
1484
|
-
}, inputProps, {
|
|
1485
|
-
className: _JSXStyle.dynamic([["1424341926", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (inputProps && inputProps.className != null && inputProps.className || useClasses({
|
|
1486
|
-
disabled: disabled
|
|
1487
|
-
}, iconClasses) || "")
|
|
1488
|
-
})), clearable && /*#__PURE__*/React.createElement(MemoInputIconClear, {
|
|
1489
|
-
visible: Boolean(inputRef.current && inputRef.current.value !== ''),
|
|
1490
|
-
disabled: disabled || readOnly,
|
|
1491
|
-
onClick: clearHandler
|
|
1492
|
-
}), iconRight && /*#__PURE__*/React.createElement(InputIcon, _extends({
|
|
1493
|
-
icon: iconRight
|
|
1494
|
-
}, iconProps))), labelRight && /*#__PURE__*/React.createElement(MemoInputLabel, {
|
|
1495
|
-
isRight: true
|
|
1496
|
-
}, labelRight), /*#__PURE__*/React.createElement("br", {
|
|
1497
|
-
className: _JSXStyle.dynamic([["1424341926", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]])
|
|
1498
|
-
})), error && /*#__PURE__*/React.createElement("p", {
|
|
1499
|
-
style: {
|
|
1500
|
-
marginTop: 0.4,
|
|
1501
|
-
marginRight: 0,
|
|
1502
|
-
marginLeft: 0,
|
|
1503
|
-
marginBottom: '0.4rem',
|
|
1504
|
-
textAlign: 'left'
|
|
1505
|
-
},
|
|
1506
|
-
className: _JSXStyle.dynamic([["1424341926", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + "input-error"
|
|
1507
|
-
}, error), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1508
|
-
id: "1424341926",
|
|
1509
|
-
dynamic: [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]
|
|
1510
|
-
}, ".with-label.__jsx-style-dynamic-selector{display:inline-block;box-sizing:border-box;-webkit-box-align:center;--input-height:".concat(SCALES.height(2.25), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'initial'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.input-error.__jsx-style-dynamic-selector{color:#aa4a44;}.input-container.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:").concat(SCALES.width(1, 'initial'), ";height:var(--input-height);}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:").concat(theme.layout.radius, ";border:1px solid ").concat(borderColor, ";-webkit-transition:border 0.2s ease 0s,color 0.2s ease 0s;transition:border 0.2s ease 0s,color 0.2s ease 0s;}.input-wrapper.left-label.__jsx-style-dynamic-selector{border-top-left-radius:0;border-bottom-left-radius:0;}.input-wrapper.right-label.__jsx-style-dynamic-selector{border-top-right-radius:0;border-bottom-right-radius:0;}.input-wrapper.disabled.__jsx-style-dynamic-selector{background-color:").concat(theme.palette.accents_1, ";border-color:").concat(theme.palette.accents_2, ";cursor:not-allowed;}input.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}.input-wrapper.hover.__jsx-style-dynamic-selector{border-color:").concat(hoverBorder, ";}input.__jsx-style-dynamic-selector{margin:0.25em 0.625em;padding:0;box-shadow:none;font-size:").concat(SCALES.font(0.875), ";background-color:transparent;border:none;color:").concat(color, ";outline:none;border-radius:0;width:100%;min-width:0;-webkit-appearance:none;}input.left-icon.__jsx-style-dynamic-selector{margin-left:0;}input.right-icon.__jsx-style-dynamic-selector{margin-right:0;}.__jsx-style-dynamic-selector::-webkit-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::-ms-reveal{display:none !important;}input.__jsx-style-dynamic-selector:-webkit-autofill,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:hover,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:active,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:focus{-webkit-box-shadow:0 0 0 30px ").concat(theme.palette.background, " inset !important;-webkit-text-fill-color:").concat(color, " !important;}")));
|
|
1511
|
-
});
|
|
1512
|
-
InputComponent.displayName = 'Input';
|
|
1513
|
-
var Input = withScale(InputComponent);
|
|
1514
|
-
|
|
1515
|
-
var tuple = function tuple() {
|
|
1516
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1517
|
-
args[_key] = arguments[_key];
|
|
1518
|
-
}
|
|
1519
|
-
return args;
|
|
1520
|
-
};
|
|
1521
|
-
tuple('default', 'secondary', 'success', 'warning', 'error', 'abort', 'secondary-light', 'success-light', 'warning-light', 'error-light');
|
|
1522
|
-
tuple('default', 'secondary', 'success', 'warning', 'error');
|
|
1523
|
-
tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite');
|
|
1524
|
-
tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite', 'alert', 'purple', 'violet', 'cyan');
|
|
1525
|
-
tuple('default', 'silent', 'prevent');
|
|
1526
|
-
tuple('hover', 'click');
|
|
1527
|
-
tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
|
|
1528
|
-
tuple('start', 'center', 'end', 'left', 'right');
|
|
1529
|
-
|
|
1530
|
-
var _excluded$c = ["type", "disabled", "readOnly", "onFocus", "onBlur", "className", "initialValue", "onChange", "value", "placeholder", "resize"];
|
|
1531
|
-
tuple('none', 'both', 'horizontal', 'vertical', 'initial', 'inherit');
|
|
1532
|
-
var TextareaComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1533
|
-
var _ref$type = _ref.type,
|
|
1534
|
-
type = _ref$type === undefined ? 'default' : _ref$type,
|
|
1535
|
-
_ref$disabled = _ref.disabled,
|
|
1536
|
-
disabled = _ref$disabled === undefined ? false : _ref$disabled,
|
|
1537
|
-
_ref$readOnly = _ref.readOnly,
|
|
1538
|
-
readOnly = _ref$readOnly === undefined ? false : _ref$readOnly,
|
|
1539
|
-
onFocus = _ref.onFocus,
|
|
1540
|
-
onBlur = _ref.onBlur,
|
|
1541
|
-
_ref$className = _ref.className,
|
|
1542
|
-
className = _ref$className === undefined ? '' : _ref$className,
|
|
1543
|
-
_ref$initialValue = _ref.initialValue,
|
|
1544
|
-
initialValue = _ref$initialValue === undefined ? '' : _ref$initialValue,
|
|
1545
|
-
onChange = _ref.onChange,
|
|
1546
|
-
value = _ref.value,
|
|
1547
|
-
placeholder = _ref.placeholder,
|
|
1548
|
-
_ref$resize = _ref.resize,
|
|
1549
|
-
resize = _ref$resize === undefined ? 'none' : _ref$resize,
|
|
1550
|
-
props = _objectWithoutProperties(_ref, _excluded$c);
|
|
1551
|
-
var theme = useTheme();
|
|
1552
|
-
var _useScale = useScale(),
|
|
1553
|
-
SCALES = _useScale.SCALES;
|
|
1554
|
-
var textareaRef = React.useRef(null);
|
|
1555
|
-
React.useImperativeHandle(ref, function () {
|
|
1556
|
-
return textareaRef.current;
|
|
1557
|
-
});
|
|
1558
|
-
var isControlledComponent = React.useMemo(function () {
|
|
1559
|
-
return value !== undefined;
|
|
1560
|
-
}, [value]);
|
|
1561
|
-
var _useState = React.useState(initialValue),
|
|
1562
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1563
|
-
selfValue = _useState2[0],
|
|
1564
|
-
setSelfValue = _useState2[1];
|
|
1565
|
-
var _useState3 = React.useState(false),
|
|
1566
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1567
|
-
hover = _useState4[0],
|
|
1568
|
-
setHover = _useState4[1];
|
|
1569
|
-
var _useMemo = React.useMemo(function () {
|
|
1570
|
-
return getColors$2(theme.palette, type);
|
|
1571
|
-
}, [theme.palette, type]),
|
|
1572
|
-
color = _useMemo.color,
|
|
1573
|
-
borderColor = _useMemo.borderColor,
|
|
1574
|
-
hoverBorder = _useMemo.hoverBorder;
|
|
1575
|
-
var classes = useClasses('wrapper', {
|
|
1576
|
-
hover: hover,
|
|
1577
|
-
disabled: disabled
|
|
1578
|
-
}, className);
|
|
1579
|
-
var changeHandler = function changeHandler(event) {
|
|
1580
|
-
if (disabled || readOnly) return;
|
|
1581
|
-
setSelfValue(event.target.value);
|
|
1582
|
-
onChange && onChange(event);
|
|
1583
|
-
};
|
|
1584
|
-
var focusHandler = function focusHandler(e) {
|
|
1585
|
-
setHover(true);
|
|
1586
|
-
onFocus && onFocus(e);
|
|
1587
|
-
};
|
|
1588
|
-
var blurHandler = function blurHandler(e) {
|
|
1589
|
-
setHover(false);
|
|
1590
|
-
onBlur && onBlur(e);
|
|
1591
|
-
};
|
|
1592
|
-
React.useEffect(function () {
|
|
1593
|
-
if (isControlledComponent) {
|
|
1594
|
-
setSelfValue(value);
|
|
1595
|
-
}
|
|
1596
|
-
});
|
|
1597
|
-
var controlledValue = isControlledComponent ? {
|
|
1598
|
-
value: selfValue
|
|
1599
|
-
} : {
|
|
1600
|
-
defaultValue: initialValue
|
|
1601
|
-
};
|
|
1602
|
-
var textareaProps = _objectSpread2(_objectSpread2({}, props), controlledValue);
|
|
1603
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1604
|
-
className: _JSXStyle.dynamic([["12276481", [theme.layout.radius, borderColor, color, SCALES.font(0.875), SCALES.height(1, 'auto'), SCALES.width(1, 'initial'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hoverBorder, theme.palette.accents_1, theme.palette.accents_2, theme.font.sans, SCALES.pt(0.5), SCALES.pr(0.5), SCALES.pb(0.5), SCALES.pl(0.5), resize, theme.palette.background]]]) + " " + (classes || "")
|
|
1605
|
-
}, /*#__PURE__*/React.createElement("textarea", _extends({
|
|
1606
|
-
ref: textareaRef,
|
|
1607
|
-
disabled: disabled,
|
|
1608
|
-
placeholder: placeholder,
|
|
1609
|
-
readOnly: readOnly,
|
|
1610
|
-
onFocus: focusHandler,
|
|
1611
|
-
onBlur: blurHandler,
|
|
1612
|
-
onChange: changeHandler
|
|
1613
|
-
}, textareaProps, {
|
|
1614
|
-
className: _JSXStyle.dynamic([["12276481", [theme.layout.radius, borderColor, color, SCALES.font(0.875), SCALES.height(1, 'auto'), SCALES.width(1, 'initial'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hoverBorder, theme.palette.accents_1, theme.palette.accents_2, theme.font.sans, SCALES.pt(0.5), SCALES.pr(0.5), SCALES.pb(0.5), SCALES.pl(0.5), resize, theme.palette.background]]]) + " " + (textareaProps && textareaProps.className != null && textareaProps.className || "")
|
|
1615
|
-
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1616
|
-
id: "12276481",
|
|
1617
|
-
dynamic: [theme.layout.radius, borderColor, color, SCALES.font(0.875), SCALES.height(1, 'auto'), SCALES.width(1, 'initial'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hoverBorder, theme.palette.accents_1, theme.palette.accents_2, theme.font.sans, SCALES.pt(0.5), SCALES.pr(0.5), SCALES.pb(0.5), SCALES.pl(0.5), resize, theme.palette.background]
|
|
1618
|
-
}, ".wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:".concat(theme.layout.radius, ";border:1px solid ").concat(borderColor, ";color:").concat(color, ";-webkit-transition:border 0.2s ease 0s,color 0.2s ease 0s;transition:border 0.2s ease 0s,color 0.2s ease 0s;min-width:12.5rem;max-width:95vw;--textarea-font-size:").concat(SCALES.font(0.875), ";--textarea-height:").concat(SCALES.height(1, 'auto'), ";width:").concat(SCALES.width(1, 'initial'), ";height:var(--textarea-height);margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.wrapper.hover.__jsx-style-dynamic-selector{border-color:").concat(hoverBorder, ";}.wrapper.disabled.__jsx-style-dynamic-selector{background-color:").concat(theme.palette.accents_1, ";border-color:").concat(theme.palette.accents_2, ";cursor:not-allowed;}textarea.__jsx-style-dynamic-selector{background-color:transparent;box-shadow:none;display:block;font-family:").concat(theme.font.sans, ";font-size:var(--textarea-font-size);width:100%;height:var(--textarea-height);border:none;outline:none;padding:").concat(SCALES.pt(0.5), " ").concat(SCALES.pr(0.5), " ").concat(SCALES.pb(0.5), " ").concat(SCALES.pl(0.5), ";resize:").concat(resize, ";}.disabled.__jsx-style-dynamic-selector>textarea.__jsx-style-dynamic-selector{cursor:not-allowed;}textarea.__jsx-style-dynamic-selector:-webkit-autofill,textarea.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:hover,textarea.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:active,textarea.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:focus{-webkit-box-shadow:0 0 0 30px ").concat(theme.palette.background, " inset !important;}")));
|
|
1619
|
-
});
|
|
1620
|
-
TextareaComponent.displayName = 'Textarea';
|
|
1621
|
-
var Textarea = withScale(TextareaComponent);
|
|
1622
|
-
|
|
1623
|
-
var PasswordIcon = function PasswordIcon(_ref) {
|
|
1624
|
-
var visible = _ref.visible;
|
|
1625
|
-
return /*#__PURE__*/React.createElement("svg", {
|
|
1626
|
-
viewBox: "0 0 24 24",
|
|
1627
|
-
stroke: "currentColor",
|
|
1628
|
-
strokeWidth: "1.5",
|
|
1629
|
-
strokeLinecap: "round",
|
|
1630
|
-
strokeLinejoin: "round",
|
|
1631
|
-
fill: "none",
|
|
1632
|
-
shapeRendering: "geometricPrecision",
|
|
1633
|
-
style: {
|
|
1634
|
-
color: 'currentColor'
|
|
1635
|
-
}
|
|
1636
|
-
}, !visible ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("path", {
|
|
1637
|
-
d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"
|
|
1638
|
-
}), /*#__PURE__*/React.createElement("circle", {
|
|
1639
|
-
cx: "12",
|
|
1640
|
-
cy: "12",
|
|
1641
|
-
r: "3"
|
|
1642
|
-
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("path", {
|
|
1643
|
-
d: "M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"
|
|
1644
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
1645
|
-
d: "M1 1l22 22"
|
|
1646
|
-
})));
|
|
1647
|
-
};
|
|
1648
|
-
var MemoPasswordIcon = /*#__PURE__*/React.memo(PasswordIcon);
|
|
1649
|
-
|
|
1650
|
-
var _excluded$b = ["hideToggle", "children"];
|
|
1651
|
-
var InputPasswordComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1652
|
-
var hideToggle = _ref.hideToggle,
|
|
1653
|
-
children = _ref.children,
|
|
1654
|
-
props = _objectWithoutProperties(_ref, _excluded$b);
|
|
1655
|
-
var _useScale = useScale(),
|
|
1656
|
-
getAllScaleProps = _useScale.getAllScaleProps;
|
|
1657
|
-
var inputRef = React.useRef(null);
|
|
1658
|
-
var _useState = React.useState(false),
|
|
1659
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1660
|
-
visible = _useState2[0],
|
|
1661
|
-
setVisible = _useState2[1];
|
|
1662
|
-
React.useImperativeHandle(ref, function () {
|
|
1663
|
-
return inputRef.current;
|
|
1664
|
-
});
|
|
1665
|
-
var iconClickHandler = function iconClickHandler() {
|
|
1666
|
-
setVisible(function (v) {
|
|
1667
|
-
return !v;
|
|
1668
|
-
});
|
|
1669
|
-
/* istanbul ignore next */
|
|
1670
|
-
if (inputRef && inputRef.current) {
|
|
1671
|
-
inputRef.current.focus();
|
|
1672
|
-
}
|
|
1673
|
-
};
|
|
1674
|
-
var inputProps = React.useMemo(function () {
|
|
1675
|
-
return _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1676
|
-
ref: inputRef,
|
|
1677
|
-
iconClickable: true,
|
|
1678
|
-
onIconClick: iconClickHandler,
|
|
1679
|
-
htmlType: visible ? 'text' : 'password'
|
|
1680
|
-
});
|
|
1681
|
-
}, [props, iconClickHandler, visible, inputRef]);
|
|
1682
|
-
var icon = React.useMemo(function () {
|
|
1683
|
-
if (hideToggle) return null;
|
|
1684
|
-
return /*#__PURE__*/React.createElement(MemoPasswordIcon, {
|
|
1685
|
-
visible: visible
|
|
1686
|
-
});
|
|
1687
|
-
}, [hideToggle, visible]);
|
|
1688
|
-
return /*#__PURE__*/React.createElement(Input, _extends({
|
|
1689
|
-
iconRight: icon
|
|
1690
|
-
}, getAllScaleProps(), inputProps), children);
|
|
1691
|
-
});
|
|
1692
|
-
InputPasswordComponent.displayName = 'InputPassword';
|
|
1693
|
-
var InputPassword = withScale(InputPasswordComponent);
|
|
1694
|
-
|
|
1695
|
-
/* "use client" */
|
|
1696
|
-
Input.Textarea = Textarea;
|
|
1697
|
-
Input.Password = InputPassword;
|
|
1698
|
-
|
|
1699
|
-
var lodash$1 = {exports: {}};
|
|
1700
|
-
|
|
1701
|
-
/**
|
|
1702
|
-
* @license
|
|
1703
|
-
* Lodash <https://lodash.com/>
|
|
1704
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
1705
|
-
* Released under MIT license <https://lodash.com/license>
|
|
1706
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
1707
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
1708
|
-
*/
|
|
1709
|
-
var lodash = lodash$1.exports;
|
|
1710
|
-
|
|
1711
|
-
var hasRequiredLodash;
|
|
1712
|
-
|
|
1713
|
-
function requireLodash () {
|
|
1714
|
-
if (hasRequiredLodash) return lodash$1.exports;
|
|
1715
|
-
hasRequiredLodash = 1;
|
|
1716
|
-
(function (module, exports) {
|
|
1717
|
-
(function() {
|
|
1718
|
-
|
|
1719
|
-
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
|
1720
|
-
var undefined$1;
|
|
1152
|
+
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
|
1153
|
+
var undefined$1;
|
|
1721
1154
|
|
|
1722
1155
|
/** Used as the semantic version number. */
|
|
1723
1156
|
var VERSION = '4.17.21';
|
|
@@ -18832,81 +18265,555 @@ function requireLodash () {
|
|
|
18832
18265
|
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
|
|
18833
18266
|
retUnwrapped = /^(?:pop|shift)$/.test(methodName);
|
|
18834
18267
|
|
|
18835
|
-
lodash.prototype[methodName] = function() {
|
|
18836
|
-
var args = arguments;
|
|
18837
|
-
if (retUnwrapped && !this.__chain__) {
|
|
18838
|
-
var value = this.value();
|
|
18839
|
-
return func.apply(isArray(value) ? value : [], args);
|
|
18840
|
-
}
|
|
18841
|
-
return this[chainName](function(value) {
|
|
18842
|
-
return func.apply(isArray(value) ? value : [], args);
|
|
18843
|
-
});
|
|
18844
|
-
};
|
|
18845
|
-
});
|
|
18268
|
+
lodash.prototype[methodName] = function() {
|
|
18269
|
+
var args = arguments;
|
|
18270
|
+
if (retUnwrapped && !this.__chain__) {
|
|
18271
|
+
var value = this.value();
|
|
18272
|
+
return func.apply(isArray(value) ? value : [], args);
|
|
18273
|
+
}
|
|
18274
|
+
return this[chainName](function(value) {
|
|
18275
|
+
return func.apply(isArray(value) ? value : [], args);
|
|
18276
|
+
});
|
|
18277
|
+
};
|
|
18278
|
+
});
|
|
18279
|
+
|
|
18280
|
+
// Map minified method names to their real names.
|
|
18281
|
+
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
|
18282
|
+
var lodashFunc = lodash[methodName];
|
|
18283
|
+
if (lodashFunc) {
|
|
18284
|
+
var key = lodashFunc.name + '';
|
|
18285
|
+
if (!hasOwnProperty.call(realNames, key)) {
|
|
18286
|
+
realNames[key] = [];
|
|
18287
|
+
}
|
|
18288
|
+
realNames[key].push({ 'name': methodName, 'func': lodashFunc });
|
|
18289
|
+
}
|
|
18290
|
+
});
|
|
18291
|
+
|
|
18292
|
+
realNames[createHybrid(undefined$1, WRAP_BIND_KEY_FLAG).name] = [{
|
|
18293
|
+
'name': 'wrapper',
|
|
18294
|
+
'func': undefined$1
|
|
18295
|
+
}];
|
|
18296
|
+
|
|
18297
|
+
// Add methods to `LazyWrapper`.
|
|
18298
|
+
LazyWrapper.prototype.clone = lazyClone;
|
|
18299
|
+
LazyWrapper.prototype.reverse = lazyReverse;
|
|
18300
|
+
LazyWrapper.prototype.value = lazyValue;
|
|
18301
|
+
|
|
18302
|
+
// Add chain sequence methods to the `lodash` wrapper.
|
|
18303
|
+
lodash.prototype.at = wrapperAt;
|
|
18304
|
+
lodash.prototype.chain = wrapperChain;
|
|
18305
|
+
lodash.prototype.commit = wrapperCommit;
|
|
18306
|
+
lodash.prototype.next = wrapperNext;
|
|
18307
|
+
lodash.prototype.plant = wrapperPlant;
|
|
18308
|
+
lodash.prototype.reverse = wrapperReverse;
|
|
18309
|
+
lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
|
|
18310
|
+
|
|
18311
|
+
// Add lazy aliases.
|
|
18312
|
+
lodash.prototype.first = lodash.prototype.head;
|
|
18313
|
+
|
|
18314
|
+
if (symIterator) {
|
|
18315
|
+
lodash.prototype[symIterator] = wrapperToIterator;
|
|
18316
|
+
}
|
|
18317
|
+
return lodash;
|
|
18318
|
+
});
|
|
18319
|
+
|
|
18320
|
+
/*--------------------------------------------------------------------------*/
|
|
18321
|
+
|
|
18322
|
+
// Export lodash.
|
|
18323
|
+
var _ = runInContext();
|
|
18324
|
+
|
|
18325
|
+
// Some AMD build optimizers, like r.js, check for condition patterns like:
|
|
18326
|
+
if (freeModule) {
|
|
18327
|
+
// Export for Node.js.
|
|
18328
|
+
(freeModule.exports = _)._ = _;
|
|
18329
|
+
// Export for CommonJS support.
|
|
18330
|
+
freeExports._ = _;
|
|
18331
|
+
}
|
|
18332
|
+
else {
|
|
18333
|
+
// Export to the global object.
|
|
18334
|
+
root._ = _;
|
|
18335
|
+
}
|
|
18336
|
+
}.call(lodash));
|
|
18337
|
+
} (lodash$1, lodash$1.exports));
|
|
18338
|
+
return lodash$1.exports;
|
|
18339
|
+
}
|
|
18340
|
+
|
|
18341
|
+
var lodashExports = requireLodash();
|
|
18342
|
+
var _ = /*@__PURE__*/getDefaultExportFromCjs(lodashExports);
|
|
18343
|
+
|
|
18344
|
+
var TableBody = function TableBody(_ref) {
|
|
18345
|
+
var data = _ref.data,
|
|
18346
|
+
emptyText = _ref.emptyText,
|
|
18347
|
+
onRow = _ref.onRow,
|
|
18348
|
+
onCell = _ref.onCell,
|
|
18349
|
+
rowClassName = _ref.rowClassName,
|
|
18350
|
+
_ref$rowDraggable = _ref.rowDraggable,
|
|
18351
|
+
rowDraggable = _ref$rowDraggable === undefined ? false : _ref$rowDraggable,
|
|
18352
|
+
_ref$readOnly = _ref.readOnly,
|
|
18353
|
+
readOnly = _ref$readOnly === undefined ? false : _ref$readOnly,
|
|
18354
|
+
onSelected = _ref.onSelected;
|
|
18355
|
+
var theme = useTheme();
|
|
18356
|
+
var _useState = React.useState([]),
|
|
18357
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18358
|
+
selected = _useState2[0],
|
|
18359
|
+
setSelected = _useState2[1];
|
|
18360
|
+
var _useTableContext = useTableContext(),
|
|
18361
|
+
columns = _useTableContext.columns;
|
|
18362
|
+
// const rowClickHandler = (row: TableDataItem, index: number) => {
|
|
18363
|
+
// onRow && onRow(row, index)
|
|
18364
|
+
// }
|
|
18365
|
+
|
|
18366
|
+
var handleClick = function handleClick(_event, id) {
|
|
18367
|
+
if (readOnly) {
|
|
18368
|
+
return true;
|
|
18369
|
+
}
|
|
18370
|
+
var selectedIndex = selected.indexOf(id);
|
|
18371
|
+
var newSelected = [];
|
|
18372
|
+
if (selectedIndex === -1) {
|
|
18373
|
+
newSelected = newSelected.concat(selected, id);
|
|
18374
|
+
} else if (selectedIndex === 0) {
|
|
18375
|
+
newSelected = newSelected.concat(selected.slice(1));
|
|
18376
|
+
} else if (selectedIndex === selected.length - 1) {
|
|
18377
|
+
newSelected = newSelected.concat(selected.slice(0, -1));
|
|
18378
|
+
} else if (selectedIndex > 0) {
|
|
18379
|
+
newSelected = newSelected.concat(selected.slice(0, selectedIndex), selected.slice(selectedIndex + 1));
|
|
18380
|
+
}
|
|
18381
|
+
setSelected(newSelected);
|
|
18382
|
+
};
|
|
18383
|
+
|
|
18384
|
+
// const handleSelectAllClick = (event: { target: { checked: any } }) => {
|
|
18385
|
+
// if (event.target.checked) {
|
|
18386
|
+
// const newSelecteds = data.map((n: any) => n._id);
|
|
18387
|
+
// setSelected(newSelecteds as never[]);
|
|
18388
|
+
// return;
|
|
18389
|
+
// }
|
|
18390
|
+
// setSelected([]);
|
|
18391
|
+
// };
|
|
18392
|
+
|
|
18393
|
+
// Push Selected Rows
|
|
18394
|
+
React.useEffect(function () {
|
|
18395
|
+
if (selected.length > 0 && onSelected) {
|
|
18396
|
+
onSelected(selected);
|
|
18397
|
+
}
|
|
18398
|
+
}, [selected]);
|
|
18399
|
+
function renderRow(cols, row, index) {
|
|
18400
|
+
var _row$style;
|
|
18401
|
+
var urid = _.uniqueId();
|
|
18402
|
+
var className = rowClassName(row, index);
|
|
18403
|
+
var rw = _objectSpread2({}, row);
|
|
18404
|
+
var rowStyle = (_row$style = row === null || row === undefined ? undefined : row.style) !== null && _row$style !== undefined ? _row$style : {};
|
|
18405
|
+
var onDragStart = row === null || row === undefined ? undefined : row.onDragStart;
|
|
18406
|
+
delete rw.table;
|
|
18407
|
+
delete rw.style;
|
|
18408
|
+
delete rw.onDragStart;
|
|
18409
|
+
// console.log(row);
|
|
18410
|
+
// const frow = Object.fromEntries(
|
|
18411
|
+
// Object.entries(row).filter(([ky, _]) => ky !== '_id' && cols.map((col: any) => col.id).includes(ky))
|
|
18412
|
+
// ) as unknown as TableDataItem
|
|
18413
|
+
// console.log(frow);
|
|
18414
|
+
var isRowSelected = selected.indexOf(row) !== -1;
|
|
18415
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("tr", {
|
|
18416
|
+
draggable: rowDraggable,
|
|
18417
|
+
role: "checkbox",
|
|
18418
|
+
onDragStart: onDragStart,
|
|
18419
|
+
"aria-checked": selected.indexOf(row) !== -1,
|
|
18420
|
+
tabIndex: -1,
|
|
18421
|
+
key: urid,
|
|
18422
|
+
style: _objectSpread2({
|
|
18423
|
+
cursor: 'pointer',
|
|
18424
|
+
backgroundColor: isRowSelected ? '#efefef' : ''
|
|
18425
|
+
}, rowStyle),
|
|
18426
|
+
onClick: function onClick(e) {
|
|
18427
|
+
if (!rowDraggable) {
|
|
18428
|
+
if (onRow) {
|
|
18429
|
+
onRow(row, index);
|
|
18430
|
+
} else {
|
|
18431
|
+
handleClick(e, row);
|
|
18432
|
+
}
|
|
18433
|
+
}
|
|
18434
|
+
},
|
|
18435
|
+
className: _JSXStyle.dynamic([["2019708038", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]]) + " " + (useClasses("".concat(rowDraggable ? 'draggable' : 'hover', " ").concat(className)) || "")
|
|
18436
|
+
}, /*#__PURE__*/React.createElement(TableCell, {
|
|
18437
|
+
columns: cols,
|
|
18438
|
+
row: rw,
|
|
18439
|
+
rowIndex: index,
|
|
18440
|
+
emptyText: emptyText,
|
|
18441
|
+
onCellClick: onCell
|
|
18442
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
18443
|
+
id: "2019708038",
|
|
18444
|
+
dynamic: [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]
|
|
18445
|
+
}, "tr.__jsx-style-dynamic-selector{-webkit-transition:background-color 0.25s ease;transition:background-color 0.25s ease;font-size:inherit;}tr.hover.__jsx-style-dynamic-selector:hover{background-color:".concat(theme.palette.accents_1, ";}tr.draggable.__jsx-style-dynamic-selector:hover{border:2px dashed #dfdfdf;margin:3px;}tr.__jsx-style-dynamic-selector td{padding:0 0.5em;border-bottom:1px solid ").concat(theme.palette.border, ";color:").concat(theme.palette.accents_6, ";font-size:calc(0.875 * var(--table-font-size));text-align:left;}tr.__jsx-style-dynamic-selector .cell{min-height:calc(3.125 * var(--table-font-size));display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;}")));
|
|
18446
|
+
}
|
|
18447
|
+
return /*#__PURE__*/React.createElement("tbody", {
|
|
18448
|
+
className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
|
|
18449
|
+
}, data.map(function (row, index) {
|
|
18450
|
+
var qid = _.uniqueId();
|
|
18451
|
+
if (row === null || row === undefined) {
|
|
18452
|
+
var uid = _.uniqueId();
|
|
18453
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
18454
|
+
key: uid,
|
|
18455
|
+
className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
|
|
18456
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
18457
|
+
colSpan: columns.length,
|
|
18458
|
+
className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
|
|
18459
|
+
}, "\u2003"));
|
|
18460
|
+
}
|
|
18461
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderRow(columns, row, index), (row === null || row === undefined ? undefined : row.table) && /*#__PURE__*/React.createElement("tr", {
|
|
18462
|
+
key: qid,
|
|
18463
|
+
className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
|
|
18464
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
18465
|
+
style: {
|
|
18466
|
+
padding: '1rem'
|
|
18467
|
+
},
|
|
18468
|
+
colSpan: columns.length,
|
|
18469
|
+
className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
|
|
18470
|
+
})));
|
|
18471
|
+
|
|
18472
|
+
// return (
|
|
18473
|
+
// <tr
|
|
18474
|
+
// key={`tbody-row-${index}`}
|
|
18475
|
+
// className={useClasses({ hover }, className)}
|
|
18476
|
+
// onClick={() => rowClickHandler(row, index)}>
|
|
18477
|
+
// <TableCell<TableDataItem>
|
|
18478
|
+
// columns={columns}
|
|
18479
|
+
// row={row}
|
|
18480
|
+
// rowIndex={index}
|
|
18481
|
+
// emptyText={emptyText}
|
|
18482
|
+
// onCellClick={onCell}
|
|
18483
|
+
// />
|
|
18484
|
+
// </tr>
|
|
18485
|
+
// )
|
|
18486
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
18487
|
+
id: "1422656197",
|
|
18488
|
+
dynamic: [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]
|
|
18489
|
+
}, "tr.__jsx-style-dynamic-selector{-webkit-transition:background-color 0.25s ease;transition:background-color 0.25s ease;font-size:inherit;}tr.hover.__jsx-style-dynamic-selector:hover{background-color:".concat(theme.palette.accents_1, ";}tr.draggable.__jsx-style-dynamic-selector:hover{border:2px dashed #dfdfdf;margin:3px;}tr.__jsx-style-dynamic-selector td{padding:0 0.5em;border-bottom:1px solid ").concat(theme.palette.border, ";color:").concat(theme.palette.accents_6, ";font-size:calc(0.875 * var(--table-font-size));text-align:left;}tr.__jsx-style-dynamic-selector .cell{min-height:calc(3.125 * var(--table-font-size));display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;}")));
|
|
18490
|
+
};
|
|
18491
|
+
TableBody.displayName = 'TableBody';
|
|
18492
|
+
|
|
18493
|
+
var getRealShape = function getRealShape(el) {
|
|
18494
|
+
var defaultShape = {
|
|
18495
|
+
width: 0,
|
|
18496
|
+
height: 0
|
|
18497
|
+
};
|
|
18498
|
+
if (!el || typeof window === 'undefined') return defaultShape;
|
|
18499
|
+
var rect = el.getBoundingClientRect();
|
|
18500
|
+
var _window$getComputedSt = window.getComputedStyle(el),
|
|
18501
|
+
width = _window$getComputedSt.width,
|
|
18502
|
+
height = _window$getComputedSt.height;
|
|
18503
|
+
var getCSSStyleVal = function getCSSStyleVal(str, parentNum) {
|
|
18504
|
+
if (!str) return 0;
|
|
18505
|
+
var strVal = str.includes('px') ? +str.split('px')[0] : str.includes('%') ? +str.split('%')[0] * parentNum * 0.01 : str;
|
|
18506
|
+
return Number.isNaN(+strVal) ? 0 : +strVal;
|
|
18507
|
+
};
|
|
18508
|
+
return {
|
|
18509
|
+
width: getCSSStyleVal("".concat(width), rect.width),
|
|
18510
|
+
height: getCSSStyleVal("".concat(height), rect.height)
|
|
18511
|
+
};
|
|
18512
|
+
};
|
|
18513
|
+
var useRealShape = function useRealShape(ref) {
|
|
18514
|
+
var _useState = React.useState({
|
|
18515
|
+
width: 0,
|
|
18516
|
+
height: 0
|
|
18517
|
+
}),
|
|
18518
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18519
|
+
state = _useState2[0],
|
|
18520
|
+
setState = _useState2[1];
|
|
18521
|
+
var update = function update() {
|
|
18522
|
+
var _getRealShape = getRealShape(ref.current),
|
|
18523
|
+
width = _getRealShape.width,
|
|
18524
|
+
height = _getRealShape.height;
|
|
18525
|
+
setState({
|
|
18526
|
+
width: width,
|
|
18527
|
+
height: height
|
|
18528
|
+
});
|
|
18529
|
+
};
|
|
18530
|
+
React.useEffect(function () {
|
|
18531
|
+
return update();
|
|
18532
|
+
}, [ref.current]);
|
|
18533
|
+
return [state, update];
|
|
18534
|
+
};
|
|
18535
|
+
|
|
18536
|
+
/* "use client" */
|
|
18846
18537
|
|
|
18847
|
-
|
|
18848
|
-
|
|
18849
|
-
|
|
18850
|
-
|
|
18851
|
-
|
|
18852
|
-
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
|
|
18856
|
-
|
|
18857
|
-
|
|
18538
|
+
var useResize = function useResize(callback) {
|
|
18539
|
+
var immediatelyInvoke = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
18540
|
+
React.useEffect(function () {
|
|
18541
|
+
var fn = function fn() {
|
|
18542
|
+
return callback();
|
|
18543
|
+
};
|
|
18544
|
+
if (immediatelyInvoke) {
|
|
18545
|
+
fn();
|
|
18546
|
+
}
|
|
18547
|
+
window.addEventListener('resize', fn);
|
|
18548
|
+
return function () {
|
|
18549
|
+
return window.removeEventListener('resize', fn);
|
|
18550
|
+
};
|
|
18551
|
+
}, []);
|
|
18552
|
+
};
|
|
18858
18553
|
|
|
18859
|
-
|
|
18860
|
-
'name': 'wrapper',
|
|
18861
|
-
'func': undefined$1
|
|
18862
|
-
}];
|
|
18554
|
+
/* "use client" */
|
|
18863
18555
|
|
|
18864
|
-
|
|
18865
|
-
|
|
18866
|
-
|
|
18867
|
-
|
|
18556
|
+
var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom', 'pl', 'pr', 'pt', 'pb', 'marginLeft', 'marginRight', 'marginTop', 'marginBottom', 'ml', 'mr', 'mt', 'mb', 'px', 'py', 'mx', 'my', 'font', 'unit', 'scale'];
|
|
18557
|
+
var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
|
|
18558
|
+
return "".concat(scale1x);
|
|
18559
|
+
};
|
|
18560
|
+
var defaultContext$2 = {
|
|
18561
|
+
getScaleProps: function getScaleProps() {
|
|
18562
|
+
return undefined;
|
|
18563
|
+
},
|
|
18564
|
+
getAllScaleProps: function getAllScaleProps() {
|
|
18565
|
+
return {};
|
|
18566
|
+
},
|
|
18567
|
+
SCALES: {
|
|
18568
|
+
pl: defaultDynamicLayoutPipe,
|
|
18569
|
+
pr: defaultDynamicLayoutPipe,
|
|
18570
|
+
pb: defaultDynamicLayoutPipe,
|
|
18571
|
+
pt: defaultDynamicLayoutPipe,
|
|
18572
|
+
px: defaultDynamicLayoutPipe,
|
|
18573
|
+
py: defaultDynamicLayoutPipe,
|
|
18574
|
+
mb: defaultDynamicLayoutPipe,
|
|
18575
|
+
ml: defaultDynamicLayoutPipe,
|
|
18576
|
+
mr: defaultDynamicLayoutPipe,
|
|
18577
|
+
mt: defaultDynamicLayoutPipe,
|
|
18578
|
+
mx: defaultDynamicLayoutPipe,
|
|
18579
|
+
my: defaultDynamicLayoutPipe,
|
|
18580
|
+
width: defaultDynamicLayoutPipe,
|
|
18581
|
+
height: defaultDynamicLayoutPipe,
|
|
18582
|
+
font: defaultDynamicLayoutPipe
|
|
18583
|
+
},
|
|
18584
|
+
unit: '16px'
|
|
18585
|
+
};
|
|
18586
|
+
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext$2);
|
|
18587
|
+
var useScale = function useScale() {
|
|
18588
|
+
return React.useContext(ScaleContext);
|
|
18589
|
+
};
|
|
18868
18590
|
|
|
18869
|
-
|
|
18870
|
-
lodash.prototype.at = wrapperAt;
|
|
18871
|
-
lodash.prototype.chain = wrapperChain;
|
|
18872
|
-
lodash.prototype.commit = wrapperCommit;
|
|
18873
|
-
lodash.prototype.next = wrapperNext;
|
|
18874
|
-
lodash.prototype.plant = wrapperPlant;
|
|
18875
|
-
lodash.prototype.reverse = wrapperReverse;
|
|
18876
|
-
lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
|
|
18591
|
+
/* "use client" */
|
|
18877
18592
|
|
|
18878
|
-
|
|
18879
|
-
|
|
18593
|
+
var getId = function getId() {
|
|
18594
|
+
return Math.random().toString(32).slice(2, 10);
|
|
18595
|
+
};
|
|
18596
|
+
var pickChildByProps = function pickChildByProps(children, key, value) {
|
|
18597
|
+
var target = [];
|
|
18598
|
+
var isArray = Array.isArray(value);
|
|
18599
|
+
var withoutPropChildren = React.Children.map(children, function (item) {
|
|
18600
|
+
if (! /*#__PURE__*/React.isValidElement(item)) return null;
|
|
18601
|
+
if (!item.props) return item;
|
|
18602
|
+
if (isArray) {
|
|
18603
|
+
if (value.includes(item.props[key])) {
|
|
18604
|
+
target.push(item);
|
|
18605
|
+
return null;
|
|
18606
|
+
}
|
|
18607
|
+
return item;
|
|
18608
|
+
}
|
|
18609
|
+
if (item.props[key] === value) {
|
|
18610
|
+
target.push(item);
|
|
18611
|
+
return null;
|
|
18612
|
+
}
|
|
18613
|
+
return item;
|
|
18614
|
+
});
|
|
18615
|
+
var targetChildren = target.length >= 0 ? target : undefined;
|
|
18616
|
+
return [withoutPropChildren, targetChildren];
|
|
18617
|
+
};
|
|
18618
|
+
var isBrowser = function isBrowser() {
|
|
18619
|
+
return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
18620
|
+
};
|
|
18621
|
+
var isCSSNumberValue = function isCSSNumberValue(value) {
|
|
18622
|
+
return value !== undefined && !Number.isNaN(+value);
|
|
18623
|
+
};
|
|
18880
18624
|
|
|
18881
|
-
|
|
18882
|
-
|
|
18883
|
-
|
|
18884
|
-
|
|
18885
|
-
|
|
18625
|
+
var generateGetScaleProps = function generateGetScaleProps(props) {
|
|
18626
|
+
var getScaleProps = function getScaleProps(keyOrKeys) {
|
|
18627
|
+
if (!Array.isArray(keyOrKeys)) return props[keyOrKeys];
|
|
18628
|
+
var value = undefined;
|
|
18629
|
+
var _iterator = _createForOfIteratorHelper(keyOrKeys),
|
|
18630
|
+
_step;
|
|
18631
|
+
try {
|
|
18632
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
18633
|
+
var key = _step.value;
|
|
18634
|
+
var currentValue = props[key];
|
|
18635
|
+
if (typeof currentValue !== 'undefined') {
|
|
18636
|
+
value = currentValue;
|
|
18637
|
+
}
|
|
18638
|
+
}
|
|
18639
|
+
} catch (err) {
|
|
18640
|
+
_iterator.e(err);
|
|
18641
|
+
} finally {
|
|
18642
|
+
_iterator.f();
|
|
18643
|
+
}
|
|
18644
|
+
return value;
|
|
18645
|
+
};
|
|
18646
|
+
return getScaleProps;
|
|
18647
|
+
};
|
|
18648
|
+
var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
|
|
18649
|
+
var getAllScaleProps = function getAllScaleProps() {
|
|
18650
|
+
var scaleProps = {};
|
|
18651
|
+
var _iterator2 = _createForOfIteratorHelper(ScalePropKeys),
|
|
18652
|
+
_step2;
|
|
18653
|
+
try {
|
|
18654
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
18655
|
+
var key = _step2.value;
|
|
18656
|
+
var value = props[key];
|
|
18657
|
+
if (typeof value !== 'undefined') {
|
|
18658
|
+
scaleProps[key] = value;
|
|
18659
|
+
}
|
|
18660
|
+
}
|
|
18661
|
+
} catch (err) {
|
|
18662
|
+
_iterator2.e(err);
|
|
18663
|
+
} finally {
|
|
18664
|
+
_iterator2.f();
|
|
18665
|
+
}
|
|
18666
|
+
return scaleProps;
|
|
18667
|
+
};
|
|
18668
|
+
return getAllScaleProps;
|
|
18669
|
+
};
|
|
18886
18670
|
|
|
18887
|
-
|
|
18671
|
+
var _excluded$e = ["children"];
|
|
18672
|
+
var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
|
|
18673
|
+
if (scale === 1) return scale;
|
|
18674
|
+
var diff = Math.abs((scale - 1) / 2);
|
|
18675
|
+
return scale > 1 ? 1 + diff : 1 - diff;
|
|
18676
|
+
};
|
|
18677
|
+
var withScale = function withScale(Render) {
|
|
18678
|
+
var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
18679
|
+
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31, _ref32, _ref33;
|
|
18680
|
+
var children = _ref.children,
|
|
18681
|
+
props = _objectWithoutProperties(_ref, _excluded$e);
|
|
18682
|
+
var _useTheme = useTheme(),
|
|
18683
|
+
layout = _useTheme.layout;
|
|
18684
|
+
var paddingLeft = props.paddingLeft,
|
|
18685
|
+
pl = props.pl,
|
|
18686
|
+
paddingRight = props.paddingRight,
|
|
18687
|
+
pr = props.pr,
|
|
18688
|
+
paddingTop = props.paddingTop,
|
|
18689
|
+
pt = props.pt,
|
|
18690
|
+
paddingBottom = props.paddingBottom,
|
|
18691
|
+
pb = props.pb,
|
|
18692
|
+
marginTop = props.marginTop,
|
|
18693
|
+
mt = props.mt,
|
|
18694
|
+
marginRight = props.marginRight,
|
|
18695
|
+
mr = props.mr,
|
|
18696
|
+
marginBottom = props.marginBottom,
|
|
18697
|
+
mb = props.mb,
|
|
18698
|
+
marginLeft = props.marginLeft,
|
|
18699
|
+
ml = props.ml,
|
|
18700
|
+
px = props.px,
|
|
18701
|
+
py = props.py,
|
|
18702
|
+
mx = props.mx,
|
|
18703
|
+
my = props.my,
|
|
18704
|
+
width = props.width,
|
|
18705
|
+
height = props.height,
|
|
18706
|
+
font = props.font,
|
|
18707
|
+
w = props.w,
|
|
18708
|
+
h = props.h,
|
|
18709
|
+
margin = props.margin,
|
|
18710
|
+
padding = props.padding,
|
|
18711
|
+
_props$unit = props.unit,
|
|
18712
|
+
unit = _props$unit === undefined ? layout.unit : _props$unit,
|
|
18713
|
+
_props$scale = props.scale,
|
|
18714
|
+
scale = _props$scale === undefined ? 1 : _props$scale;
|
|
18715
|
+
var makeScaleHandler = function makeScaleHandler(attrValue) {
|
|
18716
|
+
return function (scale1x, defaultValue) {
|
|
18717
|
+
// 0 means disable scale and the default value is 0
|
|
18718
|
+
if (scale1x === 0) {
|
|
18719
|
+
scale1x = 1;
|
|
18720
|
+
defaultValue = defaultValue || 0;
|
|
18721
|
+
}
|
|
18722
|
+
var factor = reduceScaleCoefficient(scale) * scale1x;
|
|
18723
|
+
if (typeof attrValue === 'undefined') {
|
|
18724
|
+
if (typeof defaultValue !== 'undefined') return "".concat(defaultValue);
|
|
18725
|
+
return "calc(".concat(factor, " * ").concat(unit, ")");
|
|
18726
|
+
}
|
|
18727
|
+
if (!isCSSNumberValue(attrValue)) return "".concat(attrValue);
|
|
18728
|
+
var customFactor = factor * Number(attrValue);
|
|
18729
|
+
return "calc(".concat(customFactor, " * ").concat(unit, ")");
|
|
18730
|
+
};
|
|
18731
|
+
};
|
|
18732
|
+
var value = {
|
|
18733
|
+
unit: unit,
|
|
18734
|
+
SCALES: {
|
|
18735
|
+
pt: makeScaleHandler((_ref2 = (_ref3 = paddingTop !== null && paddingTop !== undefined ? paddingTop : pt) !== null && _ref3 !== undefined ? _ref3 : py) !== null && _ref2 !== undefined ? _ref2 : padding),
|
|
18736
|
+
pr: makeScaleHandler((_ref4 = (_ref5 = paddingRight !== null && paddingRight !== undefined ? paddingRight : pr) !== null && _ref5 !== undefined ? _ref5 : px) !== null && _ref4 !== undefined ? _ref4 : padding),
|
|
18737
|
+
pb: makeScaleHandler((_ref6 = (_ref7 = paddingBottom !== null && paddingBottom !== undefined ? paddingBottom : pb) !== null && _ref7 !== undefined ? _ref7 : py) !== null && _ref6 !== undefined ? _ref6 : padding),
|
|
18738
|
+
pl: makeScaleHandler((_ref8 = (_ref9 = paddingLeft !== null && paddingLeft !== undefined ? paddingLeft : pl) !== null && _ref9 !== undefined ? _ref9 : px) !== null && _ref8 !== undefined ? _ref8 : padding),
|
|
18739
|
+
px: makeScaleHandler((_ref10 = (_ref11 = (_ref12 = (_ref13 = px !== null && px !== undefined ? px : paddingLeft) !== null && _ref13 !== undefined ? _ref13 : paddingRight) !== null && _ref12 !== undefined ? _ref12 : pl) !== null && _ref11 !== undefined ? _ref11 : pr) !== null && _ref10 !== undefined ? _ref10 : padding),
|
|
18740
|
+
py: makeScaleHandler((_ref14 = (_ref15 = (_ref16 = (_ref17 = py !== null && py !== undefined ? py : paddingTop) !== null && _ref17 !== undefined ? _ref17 : paddingBottom) !== null && _ref16 !== undefined ? _ref16 : pt) !== null && _ref15 !== undefined ? _ref15 : pb) !== null && _ref14 !== undefined ? _ref14 : padding),
|
|
18741
|
+
mt: makeScaleHandler((_ref18 = (_ref19 = marginTop !== null && marginTop !== undefined ? marginTop : mt) !== null && _ref19 !== undefined ? _ref19 : my) !== null && _ref18 !== undefined ? _ref18 : margin),
|
|
18742
|
+
mr: makeScaleHandler((_ref20 = (_ref21 = marginRight !== null && marginRight !== undefined ? marginRight : mr) !== null && _ref21 !== undefined ? _ref21 : mx) !== null && _ref20 !== undefined ? _ref20 : margin),
|
|
18743
|
+
mb: makeScaleHandler((_ref22 = (_ref23 = marginBottom !== null && marginBottom !== undefined ? marginBottom : mb) !== null && _ref23 !== undefined ? _ref23 : my) !== null && _ref22 !== undefined ? _ref22 : margin),
|
|
18744
|
+
ml: makeScaleHandler((_ref24 = (_ref25 = marginLeft !== null && marginLeft !== undefined ? marginLeft : ml) !== null && _ref25 !== undefined ? _ref25 : mx) !== null && _ref24 !== undefined ? _ref24 : margin),
|
|
18745
|
+
mx: makeScaleHandler((_ref26 = (_ref27 = (_ref28 = (_ref29 = mx !== null && mx !== undefined ? mx : marginLeft) !== null && _ref29 !== undefined ? _ref29 : marginRight) !== null && _ref28 !== undefined ? _ref28 : ml) !== null && _ref27 !== undefined ? _ref27 : mr) !== null && _ref26 !== undefined ? _ref26 : margin),
|
|
18746
|
+
my: makeScaleHandler((_ref30 = (_ref31 = (_ref32 = (_ref33 = my !== null && my !== undefined ? my : marginTop) !== null && _ref33 !== undefined ? _ref33 : marginBottom) !== null && _ref32 !== undefined ? _ref32 : mt) !== null && _ref31 !== undefined ? _ref31 : mb) !== null && _ref30 !== undefined ? _ref30 : margin),
|
|
18747
|
+
width: makeScaleHandler(width !== null && width !== undefined ? width : w),
|
|
18748
|
+
height: makeScaleHandler(height !== null && height !== undefined ? height : h),
|
|
18749
|
+
font: makeScaleHandler(font)
|
|
18750
|
+
},
|
|
18751
|
+
getScaleProps: generateGetScaleProps(props),
|
|
18752
|
+
getAllScaleProps: generateGetAllScaleProps(props)
|
|
18753
|
+
};
|
|
18754
|
+
return /*#__PURE__*/React.createElement(ScaleContext.Provider, {
|
|
18755
|
+
value: value
|
|
18756
|
+
}, /*#__PURE__*/React.createElement(Render, _extends({}, props, {
|
|
18757
|
+
ref: ref
|
|
18758
|
+
}), children));
|
|
18759
|
+
});
|
|
18760
|
+
ScaleFC.displayName = "Scale".concat(Render.displayName || 'Wrapper');
|
|
18761
|
+
return ScaleFC;
|
|
18762
|
+
};
|
|
18888
18763
|
|
|
18889
|
-
|
|
18890
|
-
|
|
18764
|
+
var warningStack = {};
|
|
18765
|
+
var useWarning = function useWarning(message, component) {
|
|
18766
|
+
var tag = component ? " [".concat(component, "]") : ' ';
|
|
18767
|
+
var log = "[Helpdice UI]".concat(tag, ": ").concat(message);
|
|
18768
|
+
if (typeof console === 'undefined') return;
|
|
18769
|
+
if (warningStack[log]) return;
|
|
18770
|
+
warningStack[log] = true;
|
|
18771
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
18772
|
+
return console.error(log);
|
|
18773
|
+
}
|
|
18774
|
+
console.warn(log);
|
|
18775
|
+
};
|
|
18891
18776
|
|
|
18892
|
-
|
|
18893
|
-
if (freeModule) {
|
|
18894
|
-
// Export for Node.js.
|
|
18895
|
-
(freeModule.exports = _)._ = _;
|
|
18896
|
-
// Export for CommonJS support.
|
|
18897
|
-
freeExports._ = _;
|
|
18898
|
-
}
|
|
18899
|
-
else {
|
|
18900
|
-
// Export to the global object.
|
|
18901
|
-
root._ = _;
|
|
18902
|
-
}
|
|
18903
|
-
}.call(lodash));
|
|
18904
|
-
} (lodash$1, lodash$1.exports));
|
|
18905
|
-
return lodash$1.exports;
|
|
18906
|
-
}
|
|
18777
|
+
/* "use client" */
|
|
18907
18778
|
|
|
18908
|
-
var
|
|
18909
|
-
var
|
|
18779
|
+
var TableColumn = function TableColumn(columnProps) {
|
|
18780
|
+
var _ref = columnProps,
|
|
18781
|
+
children = _ref.children,
|
|
18782
|
+
prop = _ref.prop,
|
|
18783
|
+
label = _ref.label,
|
|
18784
|
+
width = _ref.width,
|
|
18785
|
+
filter = _ref.filter,
|
|
18786
|
+
options = _ref.options,
|
|
18787
|
+
noWrap = _ref.noWrap,
|
|
18788
|
+
align = _ref.align,
|
|
18789
|
+
_ref$fontSize = _ref.fontSize,
|
|
18790
|
+
fontSize = _ref$fontSize === undefined ? 'smaller' : _ref$fontSize,
|
|
18791
|
+
_ref$className = _ref.className,
|
|
18792
|
+
className = _ref$className === undefined ? '' : _ref$className,
|
|
18793
|
+
renderHandler = _ref.render;
|
|
18794
|
+
var _useTableContext = useTableContext(),
|
|
18795
|
+
updateColumn = _useTableContext.updateColumn;
|
|
18796
|
+
var safeProp = "".concat(prop.toString()).trim();
|
|
18797
|
+
if (!safeProp) {
|
|
18798
|
+
useWarning('The props "prop" is required.', 'Table.Column');
|
|
18799
|
+
}
|
|
18800
|
+
React.useEffect(function () {
|
|
18801
|
+
updateColumn({
|
|
18802
|
+
label: children || label,
|
|
18803
|
+
filter: filter,
|
|
18804
|
+
noWrap: noWrap,
|
|
18805
|
+
options: options,
|
|
18806
|
+
prop: safeProp,
|
|
18807
|
+
width: width,
|
|
18808
|
+
align: align,
|
|
18809
|
+
fontSize: fontSize,
|
|
18810
|
+
className: className,
|
|
18811
|
+
renderHandler: function renderHandler() {}
|
|
18812
|
+
});
|
|
18813
|
+
}, [children, noWrap, fontSize, align, filter, options, label, prop, width, className, renderHandler]);
|
|
18814
|
+
return null;
|
|
18815
|
+
};
|
|
18816
|
+
TableColumn.displayName = 'TableColumn';
|
|
18910
18817
|
|
|
18911
18818
|
var useCurrentState = function useCurrentState(initialState) {
|
|
18912
18819
|
var _useState = React.useState(function () {
|
|
@@ -18948,11 +18855,11 @@ var SelectIcon = /*#__PURE__*/React.memo(SelectIconComponent);
|
|
|
18948
18855
|
|
|
18949
18856
|
/* "use client" */
|
|
18950
18857
|
|
|
18951
|
-
var defaultContext$
|
|
18858
|
+
var defaultContext$1 = {
|
|
18952
18859
|
visible: false,
|
|
18953
18860
|
disableAll: false
|
|
18954
18861
|
};
|
|
18955
|
-
var SelectContext = /*#__PURE__*/React.createContext(defaultContext$
|
|
18862
|
+
var SelectContext = /*#__PURE__*/React.createContext(defaultContext$1);
|
|
18956
18863
|
var useSelectContext = function useSelectContext() {
|
|
18957
18864
|
return React.useContext(SelectContext);
|
|
18958
18865
|
};
|
|
@@ -18999,25 +18906,7 @@ var usePortal = function usePortal() {
|
|
|
18999
18906
|
return elSnapshot;
|
|
19000
18907
|
};
|
|
19001
18908
|
|
|
19002
|
-
|
|
19003
|
-
|
|
19004
|
-
var useResize = function useResize(callback) {
|
|
19005
|
-
var immediatelyInvoke = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
19006
|
-
React.useEffect(function () {
|
|
19007
|
-
var fn = function fn() {
|
|
19008
|
-
return callback();
|
|
19009
|
-
};
|
|
19010
|
-
if (immediatelyInvoke) {
|
|
19011
|
-
fn();
|
|
19012
|
-
}
|
|
19013
|
-
window.addEventListener('resize', fn);
|
|
19014
|
-
return function () {
|
|
19015
|
-
return window.removeEventListener('resize', fn);
|
|
19016
|
-
};
|
|
19017
|
-
}, []);
|
|
19018
|
-
};
|
|
19019
|
-
|
|
19020
|
-
var _excluded$a = ["children", "className", "visible", "enterTime", "leaveTime", "clearTime", "name"];
|
|
18909
|
+
var _excluded$d = ["children", "className", "visible", "enterTime", "leaveTime", "clearTime", "name"];
|
|
19021
18910
|
var CssTransition = function CssTransition(_ref) {
|
|
19022
18911
|
var children = _ref.children,
|
|
19023
18912
|
_ref$className = _ref.className,
|
|
@@ -19032,7 +18921,7 @@ var CssTransition = function CssTransition(_ref) {
|
|
|
19032
18921
|
clearTime = _ref$clearTime === undefined ? 60 : _ref$clearTime,
|
|
19033
18922
|
_ref$name = _ref.name,
|
|
19034
18923
|
name = _ref$name === undefined ? 'transition' : _ref$name,
|
|
19035
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
18924
|
+
props = _objectWithoutProperties(_ref, _excluded$d);
|
|
19036
18925
|
var _useState = React.useState(''),
|
|
19037
18926
|
_useState2 = _slicedToArray(_useState, 2),
|
|
19038
18927
|
classes = _useState2[0],
|
|
@@ -19115,19 +19004,6 @@ var useDOMObserver = function useDOMObserver(ref) {
|
|
|
19115
19004
|
}, [ref]);
|
|
19116
19005
|
};
|
|
19117
19006
|
|
|
19118
|
-
var warningStack = {};
|
|
19119
|
-
var useWarning = function useWarning(message, component) {
|
|
19120
|
-
var tag = component ? " [".concat(component, "]") : ' ';
|
|
19121
|
-
var log = "[Helpdice UI]".concat(tag, ": ").concat(message);
|
|
19122
|
-
if (typeof console === 'undefined') return;
|
|
19123
|
-
if (warningStack[log]) return;
|
|
19124
|
-
warningStack[log] = true;
|
|
19125
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
19126
|
-
return console.error(log);
|
|
19127
|
-
}
|
|
19128
|
-
console.warn(log);
|
|
19129
|
-
};
|
|
19130
|
-
|
|
19131
19007
|
var getElementOffset = function getElementOffset(el) {
|
|
19132
19008
|
if (!el) return {
|
|
19133
19009
|
top: 0,
|
|
@@ -19288,7 +19164,7 @@ var SelectDropdown = /*#__PURE__*/React.forwardRef(function (_ref, dropdownRef)
|
|
|
19288
19164
|
});
|
|
19289
19165
|
SelectDropdown.displayName = 'SelectDropdown';
|
|
19290
19166
|
|
|
19291
|
-
var _excluded$
|
|
19167
|
+
var _excluded$c = ["xs", "sm", "md", "lg", "xl", "justify", "direction", "alignItems", "alignContent", "children", "className"];
|
|
19292
19168
|
var getItemLayout = function getItemLayout(val) {
|
|
19293
19169
|
var display = val === 0 ? 'display: none;' : 'display: inherit;';
|
|
19294
19170
|
if (typeof val === 'number') {
|
|
@@ -19326,7 +19202,7 @@ var GridBasicItem = function GridBasicItem(_ref) {
|
|
|
19326
19202
|
children = _ref.children,
|
|
19327
19203
|
_ref$className = _ref.className,
|
|
19328
19204
|
className = _ref$className === undefined ? '' : _ref$className,
|
|
19329
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
19205
|
+
props = _objectWithoutProperties(_ref, _excluded$c);
|
|
19330
19206
|
var theme = useTheme();
|
|
19331
19207
|
var _useScale = useScale(),
|
|
19332
19208
|
SCALES = _useScale.SCALES;
|
|
@@ -19366,12 +19242,12 @@ var GridBasicItem = function GridBasicItem(_ref) {
|
|
|
19366
19242
|
};
|
|
19367
19243
|
GridBasicItem.displayName = 'GridBasicItem';
|
|
19368
19244
|
|
|
19369
|
-
var _excluded$
|
|
19245
|
+
var _excluded$b = ["children", "className"];
|
|
19370
19246
|
var GridComponent = function GridComponent(_ref) {
|
|
19371
19247
|
var children = _ref.children,
|
|
19372
19248
|
_ref$className = _ref.className,
|
|
19373
19249
|
className = _ref$className === undefined ? '' : _ref$className,
|
|
19374
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
19250
|
+
props = _objectWithoutProperties(_ref, _excluded$b);
|
|
19375
19251
|
var _useScale = useScale(),
|
|
19376
19252
|
SCALES = _useScale.SCALES;
|
|
19377
19253
|
var _styles$className = {
|
|
@@ -19391,7 +19267,7 @@ var GridComponent = function GridComponent(_ref) {
|
|
|
19391
19267
|
GridComponent.displayName = 'Grid';
|
|
19392
19268
|
var Grid = withScale(GridComponent);
|
|
19393
19269
|
|
|
19394
|
-
var _excluded$
|
|
19270
|
+
var _excluded$a = ["gap", "wrap", "children", "className"];
|
|
19395
19271
|
var GridContainerComponent = function GridContainerComponent(_ref) {
|
|
19396
19272
|
var _ref$gap = _ref.gap,
|
|
19397
19273
|
gap = _ref$gap === undefined ? 0 : _ref$gap,
|
|
@@ -19400,7 +19276,7 @@ var GridContainerComponent = function GridContainerComponent(_ref) {
|
|
|
19400
19276
|
children = _ref.children,
|
|
19401
19277
|
_ref$className = _ref.className,
|
|
19402
19278
|
className = _ref$className === undefined ? '' : _ref$className,
|
|
19403
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
19279
|
+
props = _objectWithoutProperties(_ref, _excluded$a);
|
|
19404
19280
|
var _useScale = useScale(),
|
|
19405
19281
|
unit = _useScale.unit,
|
|
19406
19282
|
SCALES = _useScale.SCALES;
|
|
@@ -19476,7 +19352,7 @@ var SelectMultipleValue = function SelectMultipleValue(_ref) {
|
|
|
19476
19352
|
};
|
|
19477
19353
|
SelectMultipleValue.displayName = 'GeistSelectMultipleValue';
|
|
19478
19354
|
|
|
19479
|
-
var getColors$
|
|
19355
|
+
var getColors$2 = function getColors(palette, status) {
|
|
19480
19356
|
var colors = {
|
|
19481
19357
|
"default": {
|
|
19482
19358
|
border: palette.border,
|
|
@@ -19556,7 +19432,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (_ref, inputRef) {
|
|
|
19556
19432
|
});
|
|
19557
19433
|
SelectInput.displayName = 'GeistSelectInput';
|
|
19558
19434
|
|
|
19559
|
-
var _excluded$
|
|
19435
|
+
var _excluded$9 = ["children", "label", "type", "disabled", "initialValue", "value", "icon", "onChange", "pure", "multiple", "clearable", "placeholder", "className", "dropdownClassName", "dropdownStyle", "disableMatchWidth", "getPopupContainer", "onDropdownVisibleChange"];
|
|
19560
19436
|
var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
|
|
19561
19437
|
var children = _ref.children,
|
|
19562
19438
|
label = _ref.label,
|
|
@@ -19585,7 +19461,7 @@ var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
|
|
|
19585
19461
|
getPopupContainer = _ref.getPopupContainer,
|
|
19586
19462
|
_ref$onDropdownVisibl = _ref.onDropdownVisibleChange,
|
|
19587
19463
|
onDropdownVisibleChange = _ref$onDropdownVisibl === undefined ? function () {} : _ref$onDropdownVisibl,
|
|
19588
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
19464
|
+
props = _objectWithoutProperties(_ref, _excluded$9);
|
|
19589
19465
|
var theme = useTheme();
|
|
19590
19466
|
var _useScale = useScale(),
|
|
19591
19467
|
SCALES = _useScale.SCALES;
|
|
@@ -19614,7 +19490,7 @@ var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
|
|
|
19614
19490
|
return value.length === 0;
|
|
19615
19491
|
}, [value]);
|
|
19616
19492
|
var _useMemo = React.useMemo(function () {
|
|
19617
|
-
return getColors$
|
|
19493
|
+
return getColors$2(theme.palette, type);
|
|
19618
19494
|
}, [theme.palette, type]),
|
|
19619
19495
|
border = _useMemo.border,
|
|
19620
19496
|
borderActive = _useMemo.borderActive,
|
|
@@ -19757,7 +19633,7 @@ var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
|
|
|
19757
19633
|
SelectComponent.displayName = 'Select';
|
|
19758
19634
|
var Select = withScale(SelectComponent);
|
|
19759
19635
|
|
|
19760
|
-
var _excluded$
|
|
19636
|
+
var _excluded$8 = ["value", "className", "children", "disabled", "divider", "label", "preventAllEvents"];
|
|
19761
19637
|
var SelectOptionComponent = function SelectOptionComponent(_ref) {
|
|
19762
19638
|
var identValue = _ref.value,
|
|
19763
19639
|
_ref$className = _ref.className,
|
|
@@ -19771,7 +19647,7 @@ var SelectOptionComponent = function SelectOptionComponent(_ref) {
|
|
|
19771
19647
|
label = _ref$label === undefined ? false : _ref$label,
|
|
19772
19648
|
_ref$preventAllEvents = _ref.preventAllEvents,
|
|
19773
19649
|
preventAllEvents = _ref$preventAllEvents === undefined ? false : _ref$preventAllEvents,
|
|
19774
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
19650
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
19775
19651
|
var theme = useTheme();
|
|
19776
19652
|
var _useScale = useScale(),
|
|
19777
19653
|
SCALES = _useScale.SCALES;
|
|
@@ -19835,419 +19711,469 @@ var SelectOption = withScale(SelectOptionComponent);
|
|
|
19835
19711
|
|
|
19836
19712
|
Select.Option = SelectOption;
|
|
19837
19713
|
|
|
19838
|
-
var
|
|
19839
|
-
var
|
|
19840
|
-
|
|
19841
|
-
|
|
19842
|
-
|
|
19843
|
-
|
|
19844
|
-
},
|
|
19845
|
-
|
|
19846
|
-
|
|
19847
|
-
|
|
19848
|
-
return /*#__PURE__*/React.createElement("col", {
|
|
19849
|
-
key: "colgroup-".concat(index),
|
|
19850
|
-
width: column.width || averageWidth
|
|
19851
|
-
});
|
|
19852
|
-
}));
|
|
19714
|
+
var InputLabel = function InputLabel(_ref) {
|
|
19715
|
+
var children = _ref.children,
|
|
19716
|
+
isRight = _ref.isRight;
|
|
19717
|
+
var theme = useTheme();
|
|
19718
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
19719
|
+
className: _JSXStyle.dynamic([["3089782703", [theme.layout.gapHalf, theme.palette.accents_4, theme.palette.accents_1, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border]]]) + " " + ((isRight ? 'right' : '') || "")
|
|
19720
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
19721
|
+
id: "3089782703",
|
|
19722
|
+
dynamic: [theme.layout.gapHalf, theme.palette.accents_4, theme.palette.accents_1, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border]
|
|
19723
|
+
}, "span.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:initial;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;pointer-events:none;margin:0;padding:0 ".concat(theme.layout.gapHalf, ";color:").concat(theme.palette.accents_4, ";background-color:").concat(theme.palette.accents_1, ";border-top-left-radius:").concat(theme.layout.radius, ";border-bottom-left-radius:").concat(theme.layout.radius, ";border-top:1px solid ").concat(theme.palette.border, ";border-left:1px solid ").concat(theme.palette.border, ";border-bottom:1px solid ").concat(theme.palette.border, ";font-size:inherit;line-height:1;}span.right.__jsx-style-dynamic-selector{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";border-left:0;border-right:1px solid ").concat(theme.palette.border, ";}")));
|
|
19853
19724
|
};
|
|
19854
|
-
var
|
|
19725
|
+
var MemoInputLabel = /*#__PURE__*/React.memo(InputLabel);
|
|
19726
|
+
|
|
19727
|
+
var InputBlockLabelComponent = function InputBlockLabelComponent(_ref) {
|
|
19728
|
+
var children = _ref.children;
|
|
19855
19729
|
var theme = useTheme();
|
|
19856
|
-
|
|
19857
|
-
|
|
19858
|
-
|
|
19859
|
-
|
|
19860
|
-
|
|
19861
|
-
|
|
19862
|
-
|
|
19863
|
-
|
|
19864
|
-
|
|
19865
|
-
|
|
19866
|
-
|
|
19867
|
-
|
|
19868
|
-
|
|
19869
|
-
|
|
19870
|
-
|
|
19871
|
-
|
|
19872
|
-
|
|
19873
|
-
|
|
19874
|
-
|
|
19875
|
-
|
|
19876
|
-
|
|
19877
|
-
|
|
19878
|
-
|
|
19879
|
-
|
|
19880
|
-
|
|
19881
|
-
|
|
19882
|
-
|
|
19883
|
-
|
|
19884
|
-
|
|
19885
|
-
|
|
19886
|
-
|
|
19887
|
-
|
|
19888
|
-
|
|
19889
|
-
|
|
19890
|
-
|
|
19891
|
-
|
|
19892
|
-
|
|
19893
|
-
|
|
19894
|
-
|
|
19895
|
-
},
|
|
19896
|
-
"data-column": Header,
|
|
19897
|
-
key: unq_accessor
|
|
19898
|
-
}, accessor === 'fixed' && /*#__PURE__*/React.createElement(Select, {
|
|
19899
|
-
key: unq_accessor,
|
|
19900
|
-
name: filterName,
|
|
19901
|
-
value: (_filters$filterName = filters[filterName]) !== null && _filters$filterName !== undefined ? _filters$filterName : 'All',
|
|
19902
|
-
onChange: function onChange(newValue) {
|
|
19903
|
-
return handleFilterChange(filterName, newValue);
|
|
19904
|
-
}
|
|
19905
|
-
}, /*#__PURE__*/React.createElement(Select.Option, {
|
|
19906
|
-
value: "All"
|
|
19907
|
-
}, "All ", Header), options ? options.map(function (option) {
|
|
19908
|
-
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
19909
|
-
value: option.value
|
|
19910
|
-
}, option.name);
|
|
19911
|
-
}) : null), accessor === 'date' && /*#__PURE__*/React.createElement(Input, {
|
|
19912
|
-
id: "filter-date-".concat(filterName),
|
|
19913
|
-
htmlType: "date",
|
|
19914
|
-
name: filterName,
|
|
19915
|
-
value: filters[filterName],
|
|
19916
|
-
onChange: function onChange(e) {
|
|
19917
|
-
return handleFilterChange(filterName, e.target.value);
|
|
19918
|
-
}
|
|
19919
|
-
}), accessor === 'search' && /*#__PURE__*/React.createElement("th", {
|
|
19920
|
-
"data-column": Header
|
|
19921
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
19922
|
-
id: "filter-search-".concat(filterName),
|
|
19923
|
-
htmlType: "text"
|
|
19924
|
-
// ref={filterRefs.current[filterName]} // Dynamically set ref}
|
|
19925
|
-
,
|
|
19926
|
-
name: filterName,
|
|
19927
|
-
style: {
|
|
19928
|
-
height: 30,
|
|
19929
|
-
minWidth: 160
|
|
19930
|
-
},
|
|
19931
|
-
value: filters[filterName],
|
|
19932
|
-
onChange: function onChange(e) {
|
|
19933
|
-
return handleFilterChange(filterName, e.target.value);
|
|
19934
|
-
},
|
|
19935
|
-
placeholder: "Search...",
|
|
19936
|
-
fullWidth: true
|
|
19937
|
-
})));
|
|
19938
|
-
});
|
|
19730
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
19731
|
+
className: _JSXStyle.dynamic([["1278828862", [theme.palette.accents_6]]])
|
|
19732
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
19733
|
+
id: "1278828862",
|
|
19734
|
+
dynamic: [theme.palette.accents_6]
|
|
19735
|
+
}, "label.__jsx-style-dynamic-selector{display:block;font-weight:normal;color:".concat(theme.palette.accents_6, ";padding:0 0 0 1px;margin-bottom:0.5em;font-size:1em;line-height:1.5;}label.__jsx-style-dynamic-selector>*:first-child{margin-top:0;}label.__jsx-style-dynamic-selector>*:last-child{margin-bottom:0;}")));
|
|
19736
|
+
};
|
|
19737
|
+
InputBlockLabelComponent.displayName = 'GeistInputBlockLabel';
|
|
19738
|
+
var InputBlockLabel = /*#__PURE__*/React.memo(InputBlockLabelComponent);
|
|
19739
|
+
|
|
19740
|
+
var InputIconComponent = function InputIconComponent(_ref) {
|
|
19741
|
+
var icon = _ref.icon,
|
|
19742
|
+
_ref$clickable = _ref.clickable,
|
|
19743
|
+
clickable = _ref$clickable === undefined ? false : _ref$clickable,
|
|
19744
|
+
onClick = _ref.onClick;
|
|
19745
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
19746
|
+
onClick: onClick,
|
|
19747
|
+
className: _JSXStyle.dynamic([["4247656379", [clickable ? 'pointer' : 'default', clickable ? 'auto' : 'none']]]) + " " + "input-icon"
|
|
19748
|
+
}, icon, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
19749
|
+
id: "4247656379",
|
|
19750
|
+
dynamic: [clickable ? 'pointer' : 'default', clickable ? 'auto' : 'none']
|
|
19751
|
+
}, ".input-icon.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:calc(var(--input-height) - 2px);-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;margin:0;padding:0;line-height:1;position:relative;cursor:".concat(clickable ? 'pointer' : 'default', ";pointer-events:").concat(clickable ? 'auto' : 'none', ";}.input-icon.__jsx-style-dynamic-selector svg{width:calc(var(--input-height) - 2px);height:calc(var(--input-height) - 2px);-webkit-transform:scale(0.44);-ms-transform:scale(0.44);transform:scale(0.44);}")));
|
|
19752
|
+
};
|
|
19753
|
+
InputIconComponent.displayName = 'GeistInputIcon';
|
|
19754
|
+
var InputIcon = /*#__PURE__*/React.memo(InputIconComponent);
|
|
19755
|
+
|
|
19756
|
+
var InputIconClear = function InputIconClear(_ref) {
|
|
19757
|
+
var onClick = _ref.onClick,
|
|
19758
|
+
disabled = _ref.disabled,
|
|
19759
|
+
visible = _ref.visible;
|
|
19760
|
+
var theme = useTheme();
|
|
19761
|
+
var classes = useClasses('clear-icon', {
|
|
19762
|
+
visible: visible
|
|
19763
|
+
});
|
|
19764
|
+
var clickHandler = function clickHandler(event) {
|
|
19765
|
+
event.preventDefault();
|
|
19766
|
+
event.stopPropagation();
|
|
19767
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
19768
|
+
onClick && onClick(event);
|
|
19939
19769
|
};
|
|
19940
|
-
return /*#__PURE__*/React.createElement(
|
|
19941
|
-
|
|
19942
|
-
|
|
19943
|
-
|
|
19944
|
-
|
|
19945
|
-
|
|
19946
|
-
|
|
19947
|
-
|
|
19948
|
-
|
|
19949
|
-
|
|
19950
|
-
|
|
19951
|
-
|
|
19952
|
-
|
|
19953
|
-
|
|
19954
|
-
|
|
19955
|
-
|
|
19956
|
-
|
|
19957
|
-
|
|
19958
|
-
|
|
19959
|
-
|
|
19960
|
-
|
|
19961
|
-
|
|
19962
|
-
textAlign: 'center'
|
|
19963
|
-
},
|
|
19964
|
-
className: _JSXStyle.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
|
|
19965
|
-
}, column.text)));
|
|
19966
|
-
})), showFilters && /*#__PURE__*/React.createElement("tr", {
|
|
19967
|
-
className: _JSXStyle.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
|
|
19968
|
-
}, generateFilterInputs())), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
19969
|
-
id: "134865897",
|
|
19970
|
-
dynamic: [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]
|
|
19971
|
-
}, "thead.__jsx-style-dynamic-selector{border-collapse:separate;border-spacing:0;font-size:inherit;}th.__jsx-style-dynamic-selector{padding:0 0.5em;font-size:calc(0.75 * var(--table-font-size));font-weight:normal;text-align:left;-webkit-letter-spacing:0;-moz-letter-spacing:0;-ms-letter-spacing:0;letter-spacing:0;vertical-align:middle;min-height:calc(2.5 * var(--table-font-size));color:".concat(theme.palette.accents_5, ";background:").concat(theme.palette.accents_1, ";border-bottom:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-radius:0;}th.__jsx-style-dynamic-selector:nth-child(1){border-bottom:1px solid ").concat(theme.palette.border, ";border-left:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-top-left-radius:").concat(theme.layout.radius, ";border-bottom-left-radius:").concat(theme.layout.radius, ";}th.__jsx-style-dynamic-selector:last-child{border-bottom:1px solid ").concat(theme.palette.border, ";border-right:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-top-right-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";}.thead-box.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-align:center;min-height:calc(2.5 * var(--table-font-size));text-transform:uppercase;}")));
|
|
19770
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19771
|
+
onClick: clickHandler,
|
|
19772
|
+
className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]]) + " " + (classes || "")
|
|
19773
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
19774
|
+
viewBox: "0 0 24 24",
|
|
19775
|
+
stroke: "currentColor",
|
|
19776
|
+
strokeWidth: "1.5",
|
|
19777
|
+
strokeLinecap: "round",
|
|
19778
|
+
strokeLinejoin: "round",
|
|
19779
|
+
fill: "none",
|
|
19780
|
+
shapeRendering: "geometricPrecision",
|
|
19781
|
+
className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]])
|
|
19782
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
19783
|
+
d: "M18 6L6 18",
|
|
19784
|
+
className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]])
|
|
19785
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
19786
|
+
d: "M6 6l12 12",
|
|
19787
|
+
className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]])
|
|
19788
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
19789
|
+
id: "1567030211",
|
|
19790
|
+
dynamic: [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]
|
|
19791
|
+
}, ".clear-icon.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:calc(var(--input-height) - 2px);-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;cursor:".concat(disabled ? 'not-allowed' : 'pointer', ";-webkit-transition:color 150ms ease 0s;transition:color 150ms ease 0s;margin:0;padding:0;color:").concat(theme.palette.accents_3, ";visibility:hidden;opacity:0;}.visible.__jsx-style-dynamic-selector{visibility:visible;opacity:1;}.clear-icon.__jsx-style-dynamic-selector:hover{color:").concat(disabled ? theme.palette.accents_3 : theme.palette.foreground, ";}svg.__jsx-style-dynamic-selector{color:currentColor;width:calc(var(--input-height) - 2px);height:calc(var(--input-height) - 2px);-webkit-transform:scale(0.44);-ms-transform:scale(0.44);transform:scale(0.44);}")));
|
|
19972
19792
|
};
|
|
19973
|
-
|
|
19793
|
+
var MemoInputIconClear = /*#__PURE__*/React.memo(InputIconClear);
|
|
19974
19794
|
|
|
19975
|
-
var
|
|
19976
|
-
var
|
|
19977
|
-
|
|
19978
|
-
|
|
19979
|
-
|
|
19980
|
-
|
|
19981
|
-
|
|
19982
|
-
|
|
19983
|
-
|
|
19984
|
-
|
|
19985
|
-
|
|
19986
|
-
|
|
19987
|
-
|
|
19988
|
-
|
|
19989
|
-
|
|
19990
|
-
|
|
19991
|
-
|
|
19992
|
-
|
|
19993
|
-
|
|
19994
|
-
|
|
19995
|
-
|
|
19996
|
-
|
|
19997
|
-
|
|
19998
|
-
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
}
|
|
20002
|
-
|
|
20003
|
-
|
|
20004
|
-
|
|
20005
|
-
/* eslint-enable */
|
|
19795
|
+
var getColors$1 = function getColors(palette, status) {
|
|
19796
|
+
var colors = {
|
|
19797
|
+
"default": {
|
|
19798
|
+
color: palette.foreground,
|
|
19799
|
+
borderColor: palette.border,
|
|
19800
|
+
hoverBorder: palette.accents_5
|
|
19801
|
+
},
|
|
19802
|
+
secondary: {
|
|
19803
|
+
color: palette.foreground,
|
|
19804
|
+
borderColor: palette.secondary,
|
|
19805
|
+
hoverBorder: palette.secondary
|
|
19806
|
+
},
|
|
19807
|
+
success: {
|
|
19808
|
+
color: palette.foreground,
|
|
19809
|
+
borderColor: palette.successLight,
|
|
19810
|
+
hoverBorder: palette.success
|
|
19811
|
+
},
|
|
19812
|
+
warning: {
|
|
19813
|
+
color: palette.foreground,
|
|
19814
|
+
borderColor: palette.warningLight,
|
|
19815
|
+
hoverBorder: palette.warning
|
|
19816
|
+
},
|
|
19817
|
+
error: {
|
|
19818
|
+
color: palette.error,
|
|
19819
|
+
borderColor: palette.error,
|
|
19820
|
+
hoverBorder: palette.errorDark
|
|
19821
|
+
}
|
|
19822
|
+
};
|
|
19823
|
+
if (!status) return colors["default"];
|
|
19824
|
+
return colors[status];
|
|
20006
19825
|
};
|
|
20007
19826
|
|
|
20008
|
-
|
|
19827
|
+
var _excluded$7 = ["label", "labelRight", "type", "error", "htmlType", "icon", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "autoComplete", "placeholder", "children", "disabled"];
|
|
19828
|
+
var simulateChangeEvent = function simulateChangeEvent(el, event) {
|
|
19829
|
+
return _objectSpread2(_objectSpread2({}, event), {}, {
|
|
19830
|
+
target: el,
|
|
19831
|
+
currentTarget: el
|
|
19832
|
+
});
|
|
19833
|
+
};
|
|
19834
|
+
var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
19835
|
+
var label = _ref.label,
|
|
19836
|
+
labelRight = _ref.labelRight,
|
|
19837
|
+
_ref$type = _ref.type,
|
|
19838
|
+
type = _ref$type === undefined ? 'default' : _ref$type,
|
|
19839
|
+
error = _ref.error,
|
|
19840
|
+
_ref$htmlType = _ref.htmlType,
|
|
19841
|
+
htmlType = _ref$htmlType === undefined ? 'text' : _ref$htmlType,
|
|
19842
|
+
icon = _ref.icon,
|
|
19843
|
+
iconRight = _ref.iconRight,
|
|
19844
|
+
_ref$iconClickable = _ref.iconClickable,
|
|
19845
|
+
iconClickable = _ref$iconClickable === undefined ? false : _ref$iconClickable,
|
|
19846
|
+
onIconClick = _ref.onIconClick,
|
|
19847
|
+
_ref$initialValue = _ref.initialValue,
|
|
19848
|
+
initialValue = _ref$initialValue === undefined ? '' : _ref$initialValue,
|
|
19849
|
+
onChange = _ref.onChange,
|
|
19850
|
+
_ref$readOnly = _ref.readOnly,
|
|
19851
|
+
readOnly = _ref$readOnly === undefined ? false : _ref$readOnly,
|
|
19852
|
+
value = _ref.value,
|
|
19853
|
+
onClearClick = _ref.onClearClick,
|
|
19854
|
+
_ref$clearable = _ref.clearable,
|
|
19855
|
+
clearable = _ref$clearable === undefined ? false : _ref$clearable,
|
|
19856
|
+
_ref$className = _ref.className,
|
|
19857
|
+
className = _ref$className === undefined ? '' : _ref$className,
|
|
19858
|
+
onBlur = _ref.onBlur,
|
|
19859
|
+
onFocus = _ref.onFocus,
|
|
19860
|
+
_ref$autoComplete = _ref.autoComplete,
|
|
19861
|
+
autoComplete = _ref$autoComplete === undefined ? 'off' : _ref$autoComplete,
|
|
19862
|
+
_ref$placeholder = _ref.placeholder,
|
|
19863
|
+
placeholder = _ref$placeholder === undefined ? '' : _ref$placeholder,
|
|
19864
|
+
children = _ref.children,
|
|
19865
|
+
_ref$disabled = _ref.disabled,
|
|
19866
|
+
disabled = _ref$disabled === undefined ? false : _ref$disabled,
|
|
19867
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
19868
|
+
var theme = useTheme();
|
|
19869
|
+
var _useScale = useScale(),
|
|
19870
|
+
SCALES = _useScale.SCALES;
|
|
19871
|
+
var inputRef = React.useRef(null);
|
|
19872
|
+
React.useImperativeHandle(ref, function () {
|
|
19873
|
+
return inputRef.current;
|
|
19874
|
+
});
|
|
19875
|
+
var _useState = React.useState(initialValue),
|
|
19876
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19877
|
+
selfValue = _useState2[0],
|
|
19878
|
+
setSelfValue = _useState2[1];
|
|
19879
|
+
var _useState3 = React.useState(false),
|
|
19880
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
19881
|
+
hover = _useState4[0],
|
|
19882
|
+
setHover = _useState4[1];
|
|
19883
|
+
var isControlledComponent = React.useMemo(function () {
|
|
19884
|
+
return value !== undefined;
|
|
19885
|
+
}, [value]);
|
|
19886
|
+
var labelClasses = React.useMemo(function () {
|
|
19887
|
+
return labelRight ? 'right-label' : label ? 'left-label' : '';
|
|
19888
|
+
}, [label, labelRight]);
|
|
19889
|
+
var iconClasses = React.useMemo(function () {
|
|
19890
|
+
return iconRight ? 'right-icon' : icon ? 'left-icon' : '';
|
|
19891
|
+
}, [icon, iconRight]);
|
|
19892
|
+
var _useMemo = React.useMemo(function () {
|
|
19893
|
+
return getColors$1(theme.palette, type);
|
|
19894
|
+
}, [theme.palette, type]),
|
|
19895
|
+
color = _useMemo.color,
|
|
19896
|
+
borderColor = _useMemo.borderColor,
|
|
19897
|
+
hoverBorder = _useMemo.hoverBorder;
|
|
19898
|
+
var changeHandler = function changeHandler(event) {
|
|
19899
|
+
if (disabled || readOnly) return;
|
|
19900
|
+
setSelfValue(event.target.value);
|
|
19901
|
+
onChange && onChange(event);
|
|
19902
|
+
};
|
|
19903
|
+
var clearHandler = function clearHandler(event) {
|
|
19904
|
+
setSelfValue('');
|
|
19905
|
+
onClearClick && onClearClick(event);
|
|
19906
|
+
/* istanbul ignore next */
|
|
19907
|
+
if (!inputRef.current) return;
|
|
19908
|
+
var changeEvent = simulateChangeEvent(inputRef.current, event);
|
|
19909
|
+
changeEvent.target.value = '';
|
|
19910
|
+
onChange && onChange(changeEvent);
|
|
19911
|
+
inputRef.current.focus();
|
|
19912
|
+
};
|
|
19913
|
+
var focusHandler = function focusHandler(e) {
|
|
19914
|
+
setHover(true);
|
|
19915
|
+
onFocus && onFocus(e);
|
|
19916
|
+
};
|
|
19917
|
+
var blurHandler = function blurHandler(e) {
|
|
19918
|
+
setHover(false);
|
|
19919
|
+
onBlur && onBlur(e);
|
|
19920
|
+
};
|
|
19921
|
+
var iconClickHandler = function iconClickHandler(e) {
|
|
19922
|
+
if (disabled) return;
|
|
19923
|
+
onIconClick && onIconClick(e);
|
|
19924
|
+
};
|
|
19925
|
+
var iconProps = React.useMemo(function () {
|
|
19926
|
+
return {
|
|
19927
|
+
clickable: iconClickable,
|
|
19928
|
+
onClick: iconClickHandler
|
|
19929
|
+
};
|
|
19930
|
+
}, [iconClickable, iconClickHandler]);
|
|
19931
|
+
React.useEffect(function () {
|
|
19932
|
+
if (isControlledComponent) {
|
|
19933
|
+
setSelfValue(value);
|
|
19934
|
+
}
|
|
19935
|
+
});
|
|
19936
|
+
var controlledValue = isControlledComponent ? {
|
|
19937
|
+
value: selfValue
|
|
19938
|
+
} : {
|
|
19939
|
+
defaultValue: initialValue
|
|
19940
|
+
};
|
|
19941
|
+
var inputProps = _objectSpread2(_objectSpread2({}, props), controlledValue);
|
|
19942
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19943
|
+
className: _JSXStyle.dynamic([["1424341926", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + "with-label"
|
|
19944
|
+
}, children && /*#__PURE__*/React.createElement(InputBlockLabel, null, children), /*#__PURE__*/React.createElement("div", {
|
|
19945
|
+
className: _JSXStyle.dynamic([["1424341926", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (useClasses('input-container', className) || "")
|
|
19946
|
+
}, label && /*#__PURE__*/React.createElement(MemoInputLabel, null, label), /*#__PURE__*/React.createElement("div", {
|
|
19947
|
+
className: _JSXStyle.dynamic([["1424341926", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (useClasses('input-wrapper', {
|
|
19948
|
+
hover: hover,
|
|
19949
|
+
disabled: disabled
|
|
19950
|
+
}, labelClasses) || "")
|
|
19951
|
+
}, icon && /*#__PURE__*/React.createElement(InputIcon, _extends({
|
|
19952
|
+
icon: icon
|
|
19953
|
+
}, iconProps)), /*#__PURE__*/React.createElement("input", _extends({
|
|
19954
|
+
type: htmlType,
|
|
19955
|
+
ref: inputRef,
|
|
19956
|
+
placeholder: placeholder,
|
|
19957
|
+
disabled: disabled,
|
|
19958
|
+
readOnly: readOnly,
|
|
19959
|
+
onFocus: focusHandler,
|
|
19960
|
+
onBlur: blurHandler,
|
|
19961
|
+
onChange: changeHandler,
|
|
19962
|
+
autoComplete: autoComplete
|
|
19963
|
+
}, inputProps, {
|
|
19964
|
+
className: _JSXStyle.dynamic([["1424341926", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (inputProps && inputProps.className != null && inputProps.className || useClasses({
|
|
19965
|
+
disabled: disabled
|
|
19966
|
+
}, iconClasses) || "")
|
|
19967
|
+
})), clearable && /*#__PURE__*/React.createElement(MemoInputIconClear, {
|
|
19968
|
+
visible: Boolean(inputRef.current && inputRef.current.value !== ''),
|
|
19969
|
+
disabled: disabled || readOnly,
|
|
19970
|
+
onClick: clearHandler
|
|
19971
|
+
}), iconRight && /*#__PURE__*/React.createElement(InputIcon, _extends({
|
|
19972
|
+
icon: iconRight
|
|
19973
|
+
}, iconProps))), labelRight && /*#__PURE__*/React.createElement(MemoInputLabel, {
|
|
19974
|
+
isRight: true
|
|
19975
|
+
}, labelRight), /*#__PURE__*/React.createElement("br", {
|
|
19976
|
+
className: _JSXStyle.dynamic([["1424341926", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]])
|
|
19977
|
+
})), error && /*#__PURE__*/React.createElement("p", {
|
|
19978
|
+
style: {
|
|
19979
|
+
marginTop: 0.4,
|
|
19980
|
+
marginRight: 0,
|
|
19981
|
+
marginLeft: 0,
|
|
19982
|
+
marginBottom: '0.4rem',
|
|
19983
|
+
textAlign: 'left'
|
|
19984
|
+
},
|
|
19985
|
+
className: _JSXStyle.dynamic([["1424341926", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + "input-error"
|
|
19986
|
+
}, error), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
19987
|
+
id: "1424341926",
|
|
19988
|
+
dynamic: [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]
|
|
19989
|
+
}, ".with-label.__jsx-style-dynamic-selector{display:inline-block;box-sizing:border-box;-webkit-box-align:center;--input-height:".concat(SCALES.height(2.25), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'initial'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.input-error.__jsx-style-dynamic-selector{color:#aa4a44;}.input-container.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:").concat(SCALES.width(1, 'initial'), ";height:var(--input-height);}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:").concat(theme.layout.radius, ";border:1px solid ").concat(borderColor, ";-webkit-transition:border 0.2s ease 0s,color 0.2s ease 0s;transition:border 0.2s ease 0s,color 0.2s ease 0s;}.input-wrapper.left-label.__jsx-style-dynamic-selector{border-top-left-radius:0;border-bottom-left-radius:0;}.input-wrapper.right-label.__jsx-style-dynamic-selector{border-top-right-radius:0;border-bottom-right-radius:0;}.input-wrapper.disabled.__jsx-style-dynamic-selector{background-color:").concat(theme.palette.accents_1, ";border-color:").concat(theme.palette.accents_2, ";cursor:not-allowed;}input.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}.input-wrapper.hover.__jsx-style-dynamic-selector{border-color:").concat(hoverBorder, ";}input.__jsx-style-dynamic-selector{margin:0.25em 0.625em;padding:0;box-shadow:none;font-size:").concat(SCALES.font(0.875), ";background-color:transparent;border:none;color:").concat(color, ";outline:none;border-radius:0;width:100%;min-width:0;-webkit-appearance:none;}input.left-icon.__jsx-style-dynamic-selector{margin-left:0;}input.right-icon.__jsx-style-dynamic-selector{margin-right:0;}.__jsx-style-dynamic-selector::-webkit-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::-ms-reveal{display:none !important;}input.__jsx-style-dynamic-selector:-webkit-autofill,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:hover,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:active,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:focus{-webkit-box-shadow:0 0 0 30px ").concat(theme.palette.background, " inset !important;-webkit-text-fill-color:").concat(color, " !important;}")));
|
|
19990
|
+
});
|
|
19991
|
+
InputComponent.displayName = 'Input';
|
|
19992
|
+
var Input = withScale(InputComponent);
|
|
20009
19993
|
|
|
20010
|
-
var
|
|
20011
|
-
|
|
20012
|
-
|
|
20013
|
-
}
|
|
20014
|
-
|
|
20015
|
-
var useTableContext = function useTableContext() {
|
|
20016
|
-
return React.useContext(TableContext);
|
|
19994
|
+
var tuple = function tuple() {
|
|
19995
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19996
|
+
args[_key] = arguments[_key];
|
|
19997
|
+
}
|
|
19998
|
+
return args;
|
|
20017
19999
|
};
|
|
20000
|
+
tuple('default', 'secondary', 'success', 'warning', 'error', 'abort', 'secondary-light', 'success-light', 'warning-light', 'error-light');
|
|
20001
|
+
tuple('default', 'secondary', 'success', 'warning', 'error');
|
|
20002
|
+
tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite');
|
|
20003
|
+
tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite', 'alert', 'purple', 'violet', 'cyan');
|
|
20004
|
+
tuple('default', 'silent', 'prevent');
|
|
20005
|
+
tuple('hover', 'click');
|
|
20006
|
+
tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
|
|
20007
|
+
tuple('start', 'center', 'end', 'left', 'right');
|
|
20018
20008
|
|
|
20019
|
-
var
|
|
20020
|
-
|
|
20021
|
-
|
|
20022
|
-
|
|
20023
|
-
|
|
20024
|
-
|
|
20025
|
-
_ref$
|
|
20026
|
-
rowDraggable = _ref$rowDraggable === undefined ? false : _ref$rowDraggable,
|
|
20009
|
+
var _excluded$6 = ["type", "disabled", "readOnly", "onFocus", "onBlur", "className", "initialValue", "onChange", "value", "placeholder", "resize"];
|
|
20010
|
+
tuple('none', 'both', 'horizontal', 'vertical', 'initial', 'inherit');
|
|
20011
|
+
var TextareaComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
20012
|
+
var _ref$type = _ref.type,
|
|
20013
|
+
type = _ref$type === undefined ? 'default' : _ref$type,
|
|
20014
|
+
_ref$disabled = _ref.disabled,
|
|
20015
|
+
disabled = _ref$disabled === undefined ? false : _ref$disabled,
|
|
20027
20016
|
_ref$readOnly = _ref.readOnly,
|
|
20028
20017
|
readOnly = _ref$readOnly === undefined ? false : _ref$readOnly,
|
|
20029
|
-
|
|
20018
|
+
onFocus = _ref.onFocus,
|
|
20019
|
+
onBlur = _ref.onBlur,
|
|
20020
|
+
_ref$className = _ref.className,
|
|
20021
|
+
className = _ref$className === undefined ? '' : _ref$className,
|
|
20022
|
+
_ref$initialValue = _ref.initialValue,
|
|
20023
|
+
initialValue = _ref$initialValue === undefined ? '' : _ref$initialValue,
|
|
20024
|
+
onChange = _ref.onChange,
|
|
20025
|
+
value = _ref.value,
|
|
20026
|
+
placeholder = _ref.placeholder,
|
|
20027
|
+
_ref$resize = _ref.resize,
|
|
20028
|
+
resize = _ref$resize === undefined ? 'none' : _ref$resize,
|
|
20029
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
20030
20030
|
var theme = useTheme();
|
|
20031
|
-
var
|
|
20031
|
+
var _useScale = useScale(),
|
|
20032
|
+
SCALES = _useScale.SCALES;
|
|
20033
|
+
var textareaRef = React.useRef(null);
|
|
20034
|
+
React.useImperativeHandle(ref, function () {
|
|
20035
|
+
return textareaRef.current;
|
|
20036
|
+
});
|
|
20037
|
+
var isControlledComponent = React.useMemo(function () {
|
|
20038
|
+
return value !== undefined;
|
|
20039
|
+
}, [value]);
|
|
20040
|
+
var _useState = React.useState(initialValue),
|
|
20032
20041
|
_useState2 = _slicedToArray(_useState, 2),
|
|
20033
|
-
|
|
20034
|
-
|
|
20035
|
-
var
|
|
20036
|
-
|
|
20037
|
-
|
|
20038
|
-
|
|
20039
|
-
|
|
20040
|
-
|
|
20041
|
-
|
|
20042
|
-
|
|
20043
|
-
|
|
20044
|
-
|
|
20045
|
-
|
|
20046
|
-
|
|
20047
|
-
|
|
20048
|
-
|
|
20049
|
-
|
|
20050
|
-
|
|
20051
|
-
|
|
20052
|
-
|
|
20053
|
-
} else if (selectedIndex > 0) {
|
|
20054
|
-
newSelected = newSelected.concat(selected.slice(0, selectedIndex), selected.slice(selectedIndex + 1));
|
|
20055
|
-
}
|
|
20056
|
-
setSelected(newSelected);
|
|
20057
|
-
};
|
|
20058
|
-
|
|
20059
|
-
// const handleSelectAllClick = (event: { target: { checked: any } }) => {
|
|
20060
|
-
// if (event.target.checked) {
|
|
20061
|
-
// const newSelecteds = data.map((n: any) => n._id);
|
|
20062
|
-
// setSelected(newSelecteds as never[]);
|
|
20063
|
-
// return;
|
|
20064
|
-
// }
|
|
20065
|
-
// setSelected([]);
|
|
20066
|
-
// };
|
|
20067
|
-
|
|
20068
|
-
// Push Selected Rows
|
|
20069
|
-
React.useEffect(function () {
|
|
20070
|
-
if (selected.length > 0 && onSelected) {
|
|
20071
|
-
onSelected(selected);
|
|
20072
|
-
}
|
|
20073
|
-
}, [selected]);
|
|
20074
|
-
function renderRow(cols, row, index) {
|
|
20075
|
-
var _row$style;
|
|
20076
|
-
var urid = _.uniqueId();
|
|
20077
|
-
var className = rowClassName(row, index);
|
|
20078
|
-
var rw = _objectSpread2({}, row);
|
|
20079
|
-
var rowStyle = (_row$style = row === null || row === undefined ? undefined : row.style) !== null && _row$style !== undefined ? _row$style : {};
|
|
20080
|
-
var onDragStart = row === null || row === undefined ? undefined : row.onDragStart;
|
|
20081
|
-
delete rw.table;
|
|
20082
|
-
delete rw.style;
|
|
20083
|
-
delete rw.onDragStart;
|
|
20084
|
-
// console.log(row);
|
|
20085
|
-
// const frow = Object.fromEntries(
|
|
20086
|
-
// Object.entries(row).filter(([ky, _]) => ky !== '_id' && cols.map((col: any) => col.id).includes(ky))
|
|
20087
|
-
// ) as unknown as TableDataItem
|
|
20088
|
-
// console.log(frow);
|
|
20089
|
-
var isRowSelected = selected.indexOf(row) !== -1;
|
|
20090
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("tr", {
|
|
20091
|
-
draggable: rowDraggable,
|
|
20092
|
-
role: "checkbox",
|
|
20093
|
-
onDragStart: onDragStart,
|
|
20094
|
-
"aria-checked": selected.indexOf(row) !== -1,
|
|
20095
|
-
tabIndex: -1,
|
|
20096
|
-
key: urid,
|
|
20097
|
-
style: _objectSpread2({
|
|
20098
|
-
cursor: 'pointer',
|
|
20099
|
-
backgroundColor: isRowSelected ? '#efefef' : ''
|
|
20100
|
-
}, rowStyle),
|
|
20101
|
-
onClick: function onClick(e) {
|
|
20102
|
-
if (!rowDraggable) {
|
|
20103
|
-
if (onRow) {
|
|
20104
|
-
onRow(row, index);
|
|
20105
|
-
} else {
|
|
20106
|
-
handleClick(e, row);
|
|
20107
|
-
}
|
|
20108
|
-
}
|
|
20109
|
-
},
|
|
20110
|
-
className: _JSXStyle.dynamic([["2019708038", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]]) + " " + (useClasses("".concat(rowDraggable ? 'draggable' : 'hover', " ").concat(className)) || "")
|
|
20111
|
-
}, /*#__PURE__*/React.createElement(TableCell, {
|
|
20112
|
-
columns: cols,
|
|
20113
|
-
row: rw,
|
|
20114
|
-
rowIndex: index,
|
|
20115
|
-
emptyText: emptyText,
|
|
20116
|
-
onCellClick: onCell
|
|
20117
|
-
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
20118
|
-
id: "2019708038",
|
|
20119
|
-
dynamic: [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]
|
|
20120
|
-
}, "tr.__jsx-style-dynamic-selector{-webkit-transition:background-color 0.25s ease;transition:background-color 0.25s ease;font-size:inherit;}tr.hover.__jsx-style-dynamic-selector:hover{background-color:".concat(theme.palette.accents_1, ";}tr.draggable.__jsx-style-dynamic-selector:hover{border:2px dashed #dfdfdf;margin:3px;}tr.__jsx-style-dynamic-selector td{padding:0 0.5em;border-bottom:1px solid ").concat(theme.palette.border, ";color:").concat(theme.palette.accents_6, ";font-size:calc(0.875 * var(--table-font-size));text-align:left;}tr.__jsx-style-dynamic-selector .cell{min-height:calc(3.125 * var(--table-font-size));display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;}")));
|
|
20121
|
-
}
|
|
20122
|
-
return /*#__PURE__*/React.createElement("tbody", {
|
|
20123
|
-
className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
|
|
20124
|
-
}, data.map(function (row, index) {
|
|
20125
|
-
var qid = _.uniqueId();
|
|
20126
|
-
if (row === null || row === undefined) {
|
|
20127
|
-
var uid = _.uniqueId();
|
|
20128
|
-
return /*#__PURE__*/React.createElement("tr", {
|
|
20129
|
-
key: uid,
|
|
20130
|
-
className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
|
|
20131
|
-
}, /*#__PURE__*/React.createElement("td", {
|
|
20132
|
-
colSpan: columns.length,
|
|
20133
|
-
className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
|
|
20134
|
-
}, "\u2003"));
|
|
20135
|
-
}
|
|
20136
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, renderRow(columns, row, index), (row === null || row === undefined ? undefined : row.table) && /*#__PURE__*/React.createElement("tr", {
|
|
20137
|
-
key: qid,
|
|
20138
|
-
className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
|
|
20139
|
-
}, /*#__PURE__*/React.createElement("td", {
|
|
20140
|
-
style: {
|
|
20141
|
-
padding: '1rem'
|
|
20142
|
-
},
|
|
20143
|
-
colSpan: columns.length,
|
|
20144
|
-
className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
|
|
20145
|
-
})));
|
|
20146
|
-
|
|
20147
|
-
// return (
|
|
20148
|
-
// <tr
|
|
20149
|
-
// key={`tbody-row-${index}`}
|
|
20150
|
-
// className={useClasses({ hover }, className)}
|
|
20151
|
-
// onClick={() => rowClickHandler(row, index)}>
|
|
20152
|
-
// <TableCell<TableDataItem>
|
|
20153
|
-
// columns={columns}
|
|
20154
|
-
// row={row}
|
|
20155
|
-
// rowIndex={index}
|
|
20156
|
-
// emptyText={emptyText}
|
|
20157
|
-
// onCellClick={onCell}
|
|
20158
|
-
// />
|
|
20159
|
-
// </tr>
|
|
20160
|
-
// )
|
|
20161
|
-
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
20162
|
-
id: "1422656197",
|
|
20163
|
-
dynamic: [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]
|
|
20164
|
-
}, "tr.__jsx-style-dynamic-selector{-webkit-transition:background-color 0.25s ease;transition:background-color 0.25s ease;font-size:inherit;}tr.hover.__jsx-style-dynamic-selector:hover{background-color:".concat(theme.palette.accents_1, ";}tr.draggable.__jsx-style-dynamic-selector:hover{border:2px dashed #dfdfdf;margin:3px;}tr.__jsx-style-dynamic-selector td{padding:0 0.5em;border-bottom:1px solid ").concat(theme.palette.border, ";color:").concat(theme.palette.accents_6, ";font-size:calc(0.875 * var(--table-font-size));text-align:left;}tr.__jsx-style-dynamic-selector .cell{min-height:calc(3.125 * var(--table-font-size));display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;}")));
|
|
20165
|
-
};
|
|
20166
|
-
TableBody.displayName = 'TableBody';
|
|
20167
|
-
|
|
20168
|
-
var getRealShape = function getRealShape(el) {
|
|
20169
|
-
var defaultShape = {
|
|
20170
|
-
width: 0,
|
|
20171
|
-
height: 0
|
|
20042
|
+
selfValue = _useState2[0],
|
|
20043
|
+
setSelfValue = _useState2[1];
|
|
20044
|
+
var _useState3 = React.useState(false),
|
|
20045
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
20046
|
+
hover = _useState4[0],
|
|
20047
|
+
setHover = _useState4[1];
|
|
20048
|
+
var _useMemo = React.useMemo(function () {
|
|
20049
|
+
return getColors$1(theme.palette, type);
|
|
20050
|
+
}, [theme.palette, type]),
|
|
20051
|
+
color = _useMemo.color,
|
|
20052
|
+
borderColor = _useMemo.borderColor,
|
|
20053
|
+
hoverBorder = _useMemo.hoverBorder;
|
|
20054
|
+
var classes = useClasses('wrapper', {
|
|
20055
|
+
hover: hover,
|
|
20056
|
+
disabled: disabled
|
|
20057
|
+
}, className);
|
|
20058
|
+
var changeHandler = function changeHandler(event) {
|
|
20059
|
+
if (disabled || readOnly) return;
|
|
20060
|
+
setSelfValue(event.target.value);
|
|
20061
|
+
onChange && onChange(event);
|
|
20172
20062
|
};
|
|
20173
|
-
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
width = _window$getComputedSt.width,
|
|
20177
|
-
height = _window$getComputedSt.height;
|
|
20178
|
-
var getCSSStyleVal = function getCSSStyleVal(str, parentNum) {
|
|
20179
|
-
if (!str) return 0;
|
|
20180
|
-
var strVal = str.includes('px') ? +str.split('px')[0] : str.includes('%') ? +str.split('%')[0] * parentNum * 0.01 : str;
|
|
20181
|
-
return Number.isNaN(+strVal) ? 0 : +strVal;
|
|
20063
|
+
var focusHandler = function focusHandler(e) {
|
|
20064
|
+
setHover(true);
|
|
20065
|
+
onFocus && onFocus(e);
|
|
20182
20066
|
};
|
|
20183
|
-
|
|
20184
|
-
|
|
20185
|
-
|
|
20067
|
+
var blurHandler = function blurHandler(e) {
|
|
20068
|
+
setHover(false);
|
|
20069
|
+
onBlur && onBlur(e);
|
|
20070
|
+
};
|
|
20071
|
+
React.useEffect(function () {
|
|
20072
|
+
if (isControlledComponent) {
|
|
20073
|
+
setSelfValue(value);
|
|
20074
|
+
}
|
|
20075
|
+
});
|
|
20076
|
+
var controlledValue = isControlledComponent ? {
|
|
20077
|
+
value: selfValue
|
|
20078
|
+
} : {
|
|
20079
|
+
defaultValue: initialValue
|
|
20186
20080
|
};
|
|
20081
|
+
var textareaProps = _objectSpread2(_objectSpread2({}, props), controlledValue);
|
|
20082
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20083
|
+
className: _JSXStyle.dynamic([["12276481", [theme.layout.radius, borderColor, color, SCALES.font(0.875), SCALES.height(1, 'auto'), SCALES.width(1, 'initial'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hoverBorder, theme.palette.accents_1, theme.palette.accents_2, theme.font.sans, SCALES.pt(0.5), SCALES.pr(0.5), SCALES.pb(0.5), SCALES.pl(0.5), resize, theme.palette.background]]]) + " " + (classes || "")
|
|
20084
|
+
}, /*#__PURE__*/React.createElement("textarea", _extends({
|
|
20085
|
+
ref: textareaRef,
|
|
20086
|
+
disabled: disabled,
|
|
20087
|
+
placeholder: placeholder,
|
|
20088
|
+
readOnly: readOnly,
|
|
20089
|
+
onFocus: focusHandler,
|
|
20090
|
+
onBlur: blurHandler,
|
|
20091
|
+
onChange: changeHandler
|
|
20092
|
+
}, textareaProps, {
|
|
20093
|
+
className: _JSXStyle.dynamic([["12276481", [theme.layout.radius, borderColor, color, SCALES.font(0.875), SCALES.height(1, 'auto'), SCALES.width(1, 'initial'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hoverBorder, theme.palette.accents_1, theme.palette.accents_2, theme.font.sans, SCALES.pt(0.5), SCALES.pr(0.5), SCALES.pb(0.5), SCALES.pl(0.5), resize, theme.palette.background]]]) + " " + (textareaProps && textareaProps.className != null && textareaProps.className || "")
|
|
20094
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
20095
|
+
id: "12276481",
|
|
20096
|
+
dynamic: [theme.layout.radius, borderColor, color, SCALES.font(0.875), SCALES.height(1, 'auto'), SCALES.width(1, 'initial'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hoverBorder, theme.palette.accents_1, theme.palette.accents_2, theme.font.sans, SCALES.pt(0.5), SCALES.pr(0.5), SCALES.pb(0.5), SCALES.pl(0.5), resize, theme.palette.background]
|
|
20097
|
+
}, ".wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:".concat(theme.layout.radius, ";border:1px solid ").concat(borderColor, ";color:").concat(color, ";-webkit-transition:border 0.2s ease 0s,color 0.2s ease 0s;transition:border 0.2s ease 0s,color 0.2s ease 0s;min-width:12.5rem;max-width:95vw;--textarea-font-size:").concat(SCALES.font(0.875), ";--textarea-height:").concat(SCALES.height(1, 'auto'), ";width:").concat(SCALES.width(1, 'initial'), ";height:var(--textarea-height);margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.wrapper.hover.__jsx-style-dynamic-selector{border-color:").concat(hoverBorder, ";}.wrapper.disabled.__jsx-style-dynamic-selector{background-color:").concat(theme.palette.accents_1, ";border-color:").concat(theme.palette.accents_2, ";cursor:not-allowed;}textarea.__jsx-style-dynamic-selector{background-color:transparent;box-shadow:none;display:block;font-family:").concat(theme.font.sans, ";font-size:var(--textarea-font-size);width:100%;height:var(--textarea-height);border:none;outline:none;padding:").concat(SCALES.pt(0.5), " ").concat(SCALES.pr(0.5), " ").concat(SCALES.pb(0.5), " ").concat(SCALES.pl(0.5), ";resize:").concat(resize, ";}.disabled.__jsx-style-dynamic-selector>textarea.__jsx-style-dynamic-selector{cursor:not-allowed;}textarea.__jsx-style-dynamic-selector:-webkit-autofill,textarea.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:hover,textarea.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:active,textarea.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:focus{-webkit-box-shadow:0 0 0 30px ").concat(theme.palette.background, " inset !important;}")));
|
|
20098
|
+
});
|
|
20099
|
+
TextareaComponent.displayName = 'Textarea';
|
|
20100
|
+
var Textarea = withScale(TextareaComponent);
|
|
20101
|
+
|
|
20102
|
+
var PasswordIcon = function PasswordIcon(_ref) {
|
|
20103
|
+
var visible = _ref.visible;
|
|
20104
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
20105
|
+
viewBox: "0 0 24 24",
|
|
20106
|
+
stroke: "currentColor",
|
|
20107
|
+
strokeWidth: "1.5",
|
|
20108
|
+
strokeLinecap: "round",
|
|
20109
|
+
strokeLinejoin: "round",
|
|
20110
|
+
fill: "none",
|
|
20111
|
+
shapeRendering: "geometricPrecision",
|
|
20112
|
+
style: {
|
|
20113
|
+
color: 'currentColor'
|
|
20114
|
+
}
|
|
20115
|
+
}, !visible ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("path", {
|
|
20116
|
+
d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"
|
|
20117
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
20118
|
+
cx: "12",
|
|
20119
|
+
cy: "12",
|
|
20120
|
+
r: "3"
|
|
20121
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("path", {
|
|
20122
|
+
d: "M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"
|
|
20123
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
20124
|
+
d: "M1 1l22 22"
|
|
20125
|
+
})));
|
|
20187
20126
|
};
|
|
20188
|
-
var
|
|
20189
|
-
|
|
20190
|
-
|
|
20191
|
-
|
|
20192
|
-
|
|
20127
|
+
var MemoPasswordIcon = /*#__PURE__*/React.memo(PasswordIcon);
|
|
20128
|
+
|
|
20129
|
+
var _excluded$5 = ["hideToggle", "children"];
|
|
20130
|
+
var InputPasswordComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
20131
|
+
var hideToggle = _ref.hideToggle,
|
|
20132
|
+
children = _ref.children,
|
|
20133
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
20134
|
+
var _useScale = useScale(),
|
|
20135
|
+
getAllScaleProps = _useScale.getAllScaleProps;
|
|
20136
|
+
var inputRef = React.useRef(null);
|
|
20137
|
+
var _useState = React.useState(false),
|
|
20193
20138
|
_useState2 = _slicedToArray(_useState, 2),
|
|
20194
|
-
|
|
20195
|
-
|
|
20196
|
-
|
|
20197
|
-
|
|
20198
|
-
|
|
20199
|
-
|
|
20200
|
-
|
|
20201
|
-
|
|
20202
|
-
height: height
|
|
20139
|
+
visible = _useState2[0],
|
|
20140
|
+
setVisible = _useState2[1];
|
|
20141
|
+
React.useImperativeHandle(ref, function () {
|
|
20142
|
+
return inputRef.current;
|
|
20143
|
+
});
|
|
20144
|
+
var iconClickHandler = function iconClickHandler() {
|
|
20145
|
+
setVisible(function (v) {
|
|
20146
|
+
return !v;
|
|
20203
20147
|
});
|
|
20148
|
+
/* istanbul ignore next */
|
|
20149
|
+
if (inputRef && inputRef.current) {
|
|
20150
|
+
inputRef.current.focus();
|
|
20151
|
+
}
|
|
20204
20152
|
};
|
|
20205
|
-
React.
|
|
20206
|
-
return
|
|
20207
|
-
|
|
20208
|
-
|
|
20209
|
-
|
|
20153
|
+
var inputProps = React.useMemo(function () {
|
|
20154
|
+
return _objectSpread2(_objectSpread2({}, props), {}, {
|
|
20155
|
+
ref: inputRef,
|
|
20156
|
+
iconClickable: true,
|
|
20157
|
+
onIconClick: iconClickHandler,
|
|
20158
|
+
htmlType: visible ? 'text' : 'password'
|
|
20159
|
+
});
|
|
20160
|
+
}, [props, iconClickHandler, visible, inputRef]);
|
|
20161
|
+
var icon = React.useMemo(function () {
|
|
20162
|
+
if (hideToggle) return null;
|
|
20163
|
+
return /*#__PURE__*/React.createElement(MemoPasswordIcon, {
|
|
20164
|
+
visible: visible
|
|
20165
|
+
});
|
|
20166
|
+
}, [hideToggle, visible]);
|
|
20167
|
+
return /*#__PURE__*/React.createElement(Input, _extends({
|
|
20168
|
+
iconRight: icon
|
|
20169
|
+
}, getAllScaleProps(), inputProps), children);
|
|
20170
|
+
});
|
|
20171
|
+
InputPasswordComponent.displayName = 'InputPassword';
|
|
20172
|
+
var InputPassword = withScale(InputPasswordComponent);
|
|
20210
20173
|
|
|
20211
20174
|
/* "use client" */
|
|
20212
|
-
|
|
20213
|
-
|
|
20214
|
-
var _ref = columnProps,
|
|
20215
|
-
children = _ref.children,
|
|
20216
|
-
prop = _ref.prop,
|
|
20217
|
-
label = _ref.label,
|
|
20218
|
-
width = _ref.width,
|
|
20219
|
-
filter = _ref.filter,
|
|
20220
|
-
options = _ref.options,
|
|
20221
|
-
noWrap = _ref.noWrap,
|
|
20222
|
-
align = _ref.align,
|
|
20223
|
-
_ref$fontSize = _ref.fontSize,
|
|
20224
|
-
fontSize = _ref$fontSize === undefined ? 'smaller' : _ref$fontSize,
|
|
20225
|
-
_ref$className = _ref.className,
|
|
20226
|
-
className = _ref$className === undefined ? '' : _ref$className,
|
|
20227
|
-
renderHandler = _ref.render;
|
|
20228
|
-
var _useTableContext = useTableContext(),
|
|
20229
|
-
updateColumn = _useTableContext.updateColumn;
|
|
20230
|
-
var safeProp = "".concat(prop.toString()).trim();
|
|
20231
|
-
if (!safeProp) {
|
|
20232
|
-
useWarning('The props "prop" is required.', 'Table.Column');
|
|
20233
|
-
}
|
|
20234
|
-
React.useEffect(function () {
|
|
20235
|
-
updateColumn({
|
|
20236
|
-
label: children || label,
|
|
20237
|
-
filter: filter,
|
|
20238
|
-
noWrap: noWrap,
|
|
20239
|
-
options: options,
|
|
20240
|
-
prop: safeProp,
|
|
20241
|
-
width: width,
|
|
20242
|
-
align: align,
|
|
20243
|
-
fontSize: fontSize,
|
|
20244
|
-
className: className,
|
|
20245
|
-
renderHandler: function renderHandler() {}
|
|
20246
|
-
});
|
|
20247
|
-
}, [children, noWrap, fontSize, align, filter, options, label, prop, width, className, renderHandler]);
|
|
20248
|
-
return null;
|
|
20249
|
-
};
|
|
20250
|
-
TableColumn.displayName = 'TableColumn';
|
|
20175
|
+
Input.Textarea = Textarea;
|
|
20176
|
+
Input.Password = InputPassword;
|
|
20251
20177
|
|
|
20252
20178
|
var _excluded$4 = ["children", "data", "initialData", "hover", "emptyText", "rowDraggable", "readOnly", "onRow", "onCell", "onChange", "onFilters", "showFilters", "onSelected", "className", "rowClassName"];
|
|
20253
20179
|
function TableComponent(tableProps) {
|
|
@@ -20313,6 +20239,10 @@ function TableComponent(tableProps) {
|
|
|
20313
20239
|
updateColumn: updateColumn
|
|
20314
20240
|
};
|
|
20315
20241
|
}, [columns]);
|
|
20242
|
+
var _React$useState = React.useState({}),
|
|
20243
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
20244
|
+
filters = _React$useState2[0],
|
|
20245
|
+
setFilters = _React$useState2[1];
|
|
20316
20246
|
React.useEffect(function () {
|
|
20317
20247
|
if (typeof customData === 'undefined') return;
|
|
20318
20248
|
setData(customData);
|
|
@@ -20320,7 +20250,75 @@ function TableComponent(tableProps) {
|
|
|
20320
20250
|
useResize(function () {
|
|
20321
20251
|
return updateShape();
|
|
20322
20252
|
});
|
|
20323
|
-
|
|
20253
|
+
var handleFilterChange = function handleFilterChange(name, value) {
|
|
20254
|
+
setFilters(function (prevFilters) {
|
|
20255
|
+
var updatedFilters = _objectSpread2(_objectSpread2({}, prevFilters), {}, _defineProperty({}, name, value));
|
|
20256
|
+
// Call onFiltersChange to propagate filter changes to the parent
|
|
20257
|
+
if (onFilters) {
|
|
20258
|
+
onFilters(updatedFilters);
|
|
20259
|
+
}
|
|
20260
|
+
return updatedFilters;
|
|
20261
|
+
});
|
|
20262
|
+
};
|
|
20263
|
+
var generateFilterInputs = function generateFilterInputs() {
|
|
20264
|
+
return columns.map(function (col) {
|
|
20265
|
+
var _String, _filters$filterName;
|
|
20266
|
+
var Header = col.label,
|
|
20267
|
+
accessor = col.filter,
|
|
20268
|
+
options = col.options;
|
|
20269
|
+
var filterName = (_String = String(col === null || col === undefined ? undefined : col.label)) === null || _String === undefined ? undefined : _String.replace(' ', '_').toLowerCase();
|
|
20270
|
+
var unq_accessor = _.uniqueId(filterName);
|
|
20271
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20272
|
+
style: {
|
|
20273
|
+
margin: '3px'
|
|
20274
|
+
},
|
|
20275
|
+
"data-column": Header,
|
|
20276
|
+
key: unq_accessor
|
|
20277
|
+
}, accessor === 'fixed' && /*#__PURE__*/React.createElement(Select, {
|
|
20278
|
+
key: unq_accessor,
|
|
20279
|
+
name: filterName,
|
|
20280
|
+
value: (_filters$filterName = filters[filterName]) !== null && _filters$filterName !== undefined ? _filters$filterName : 'All',
|
|
20281
|
+
onChange: function onChange(newValue) {
|
|
20282
|
+
return handleFilterChange(filterName, newValue);
|
|
20283
|
+
}
|
|
20284
|
+
}, /*#__PURE__*/React.createElement(Select.Option, {
|
|
20285
|
+
value: "All"
|
|
20286
|
+
}, "All ", Header), options ? options.map(function (option) {
|
|
20287
|
+
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
20288
|
+
value: option.value
|
|
20289
|
+
}, option.name);
|
|
20290
|
+
}) : null), accessor === 'date' && /*#__PURE__*/React.createElement(Input, {
|
|
20291
|
+
id: "filter-date-".concat(filterName),
|
|
20292
|
+
htmlType: "date",
|
|
20293
|
+
name: filterName,
|
|
20294
|
+
value: filters[filterName],
|
|
20295
|
+
onChange: function onChange(e) {
|
|
20296
|
+
return handleFilterChange(filterName, e.target.value);
|
|
20297
|
+
}
|
|
20298
|
+
}), accessor === 'search' && /*#__PURE__*/React.createElement(Input, {
|
|
20299
|
+
id: "filter-search-".concat(filterName),
|
|
20300
|
+
htmlType: "text",
|
|
20301
|
+
autoComplete: "off",
|
|
20302
|
+
name: filterName,
|
|
20303
|
+
style: {
|
|
20304
|
+
height: 30,
|
|
20305
|
+
minWidth: 160
|
|
20306
|
+
},
|
|
20307
|
+
value: filters[filterName],
|
|
20308
|
+
onChange: function onChange(e) {
|
|
20309
|
+
return handleFilterChange(filterName, e.target.value);
|
|
20310
|
+
},
|
|
20311
|
+
placeholder: "Search...",
|
|
20312
|
+
fullWidth: true
|
|
20313
|
+
}));
|
|
20314
|
+
});
|
|
20315
|
+
};
|
|
20316
|
+
return /*#__PURE__*/React.createElement("div", null, showFilters && /*#__PURE__*/React.createElement("div", {
|
|
20317
|
+
style: {
|
|
20318
|
+
display: 'flex',
|
|
20319
|
+
gap: 6
|
|
20320
|
+
}
|
|
20321
|
+
}, generateFilterInputs()), /*#__PURE__*/React.createElement(TableContext.Provider, {
|
|
20324
20322
|
value: contextValue
|
|
20325
20323
|
}, /*#__PURE__*/React.createElement("table", _extends({
|
|
20326
20324
|
ref: ref
|
|
@@ -20328,8 +20326,6 @@ function TableComponent(tableProps) {
|
|
|
20328
20326
|
className: _JSXStyle.dynamic([["2132340556", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
|
|
20329
20327
|
}), /*#__PURE__*/React.createElement(TableHead, {
|
|
20330
20328
|
columns: columns,
|
|
20331
|
-
onFilters: onFilters,
|
|
20332
|
-
showFilters: showFilters,
|
|
20333
20329
|
width: width
|
|
20334
20330
|
}), /*#__PURE__*/React.createElement(TableBody, {
|
|
20335
20331
|
data: data,
|
|
@@ -20344,7 +20340,7 @@ function TableComponent(tableProps) {
|
|
|
20344
20340
|
}), children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
20345
20341
|
id: "2132340556",
|
|
20346
20342
|
dynamic: [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
|
|
20347
|
-
}, "table.__jsx-style-dynamic-selector{border-collapse:separate;border-spacing:0;--table-font-size:".concat(SCALES.font(1), ";font-size:var(--table-font-size);width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}"))));
|
|
20343
|
+
}, "table.__jsx-style-dynamic-selector{border-collapse:separate;border-spacing:0;--table-font-size:".concat(SCALES.font(1), ";font-size:var(--table-font-size);width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}")))));
|
|
20348
20344
|
}
|
|
20349
20345
|
TableComponent.displayName = 'Table';
|
|
20350
20346
|
TableComponent.Column = TableColumn;
|