@helpdice/ui 1.2.9 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -989,112 +989,47 @@ var useTheme = function useTheme() {
989
989
  return React.useContext(ThemeContext);
990
990
  };
991
991
 
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) {
992
+ var InputLabel = function InputLabel(_ref) {
993
+ var children = _ref.children,
994
+ isRight = _ref.isRight;
1009
995
  var theme = useTheme();
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;}")));
996
+ return /*#__PURE__*/React.createElement("span", {
997
+ 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' : '') || "")
998
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
999
+ id: "3089782703",
1000
+ 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]
1001
+ }, "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, ";}")));
1052
1002
  };
1053
- TableHead.displayName = 'TableHead';
1003
+ var MemoInputLabel = /*#__PURE__*/React.memo(InputLabel);
1054
1004
 
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 */
1005
+ var InputBlockLabelComponent = function InputBlockLabelComponent(_ref) {
1006
+ var children = _ref.children;
1007
+ var theme = useTheme();
1008
+ return /*#__PURE__*/React.createElement("label", {
1009
+ className: _JSXStyle.dynamic([["1278828862", [theme.palette.accents_6]]])
1010
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
1011
+ id: "1278828862",
1012
+ dynamic: [theme.palette.accents_6]
1013
+ }, "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;}")));
1086
1014
  };
1015
+ InputBlockLabelComponent.displayName = 'GeistInputBlockLabel';
1016
+ var InputBlockLabel = /*#__PURE__*/React.memo(InputBlockLabelComponent);
1087
1017
 
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);
1018
+ var InputIconComponent = function InputIconComponent(_ref) {
1019
+ var icon = _ref.icon,
1020
+ _ref$clickable = _ref.clickable,
1021
+ clickable = _ref$clickable === undefined ? false : _ref$clickable,
1022
+ onClick = _ref.onClick;
1023
+ return /*#__PURE__*/React.createElement("span", {
1024
+ onClick: onClick,
1025
+ className: _JSXStyle.dynamic([["4247656379", [clickable ? 'pointer' : 'default', clickable ? 'auto' : 'none']]]) + " " + "input-icon"
1026
+ }, icon, /*#__PURE__*/React.createElement(_JSXStyle, {
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);}")));
1097
1030
  };
1031
+ InputIconComponent.displayName = 'GeistInputIcon';
1032
+ var InputIcon = /*#__PURE__*/React.memo(InputIconComponent);
1098
1033
 
1099
1034
  /* "use client" */
1100
1035
 
@@ -1129,31 +1064,663 @@ var useClasses = function useClasses() {
1129
1064
  return classes.trim();
1130
1065
  };
1131
1066
 
1132
- var lodash$1 = {exports: {}};
1067
+ var InputIconClear = function InputIconClear(_ref) {
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);
1133
1105
 
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;
1106
+ var getColors$2 = function getColors(palette, status) {
1107
+ var colors = {
1108
+ "default": {
1109
+ color: palette.foreground,
1110
+ borderColor: palette.border,
1111
+ hoverBorder: palette.accents_5
1112
+ },
1113
+ secondary: {
1114
+ color: palette.foreground,
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
+ };
1143
1137
 
1144
- var hasRequiredLodash;
1138
+ /* "use client" */
1145
1139
 
1146
- function requireLodash () {
1147
- if (hasRequiredLodash) return lodash$1.exports;
1148
- hasRequiredLodash = 1;
1149
- (function (module, exports) {
1150
- (function() {
1140
+ 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'];
1141
+ var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
1142
+ return "".concat(scale1x);
1143
+ };
1144
+ var defaultContext$3 = {
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
+ };
1151
1174
 
1152
- /** Used as a safe reference for `undefined` in pre-ES5 environments. */
1153
- var undefined$1;
1175
+ /* "use client" */
1154
1176
 
1155
- /** Used as the semantic version number. */
1156
- var VERSION = '4.17.21';
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;
1721
+
1722
+ /** Used as the semantic version number. */
1723
+ var VERSION = '4.17.21';
1157
1724
 
1158
1725
  /** Used as the size to enable large array optimizations. */
1159
1726
  var LARGE_ARRAY_SIZE = 200;
@@ -18136,1631 +18703,732 @@ function requireLodash () {
18136
18703
  LazyWrapper.prototype[methodName] = function(iteratee) {
18137
18704
  var result = this.clone();
18138
18705
  result.__iteratees__.push({
18139
- 'iteratee': getIteratee(iteratee, 3),
18140
- 'type': type
18141
- });
18142
- result.__filtered__ = result.__filtered__ || isFilter;
18143
- return result;
18144
- };
18145
- });
18146
-
18147
- // Add `LazyWrapper` methods for `_.head` and `_.last`.
18148
- arrayEach(['head', 'last'], function(methodName, index) {
18149
- var takeName = 'take' + (index ? 'Right' : '');
18150
-
18151
- LazyWrapper.prototype[methodName] = function() {
18152
- return this[takeName](1).value()[0];
18153
- };
18154
- });
18155
-
18156
- // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
18157
- arrayEach(['initial', 'tail'], function(methodName, index) {
18158
- var dropName = 'drop' + (index ? '' : 'Right');
18159
-
18160
- LazyWrapper.prototype[methodName] = function() {
18161
- return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
18162
- };
18163
- });
18164
-
18165
- LazyWrapper.prototype.compact = function() {
18166
- return this.filter(identity);
18167
- };
18168
-
18169
- LazyWrapper.prototype.find = function(predicate) {
18170
- return this.filter(predicate).head();
18171
- };
18172
-
18173
- LazyWrapper.prototype.findLast = function(predicate) {
18174
- return this.reverse().find(predicate);
18175
- };
18176
-
18177
- LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
18178
- if (typeof path == 'function') {
18179
- return new LazyWrapper(this);
18180
- }
18181
- return this.map(function(value) {
18182
- return baseInvoke(value, path, args);
18183
- });
18184
- });
18185
-
18186
- LazyWrapper.prototype.reject = function(predicate) {
18187
- return this.filter(negate(getIteratee(predicate)));
18188
- };
18189
-
18190
- LazyWrapper.prototype.slice = function(start, end) {
18191
- start = toInteger(start);
18192
-
18193
- var result = this;
18194
- if (result.__filtered__ && (start > 0 || end < 0)) {
18195
- return new LazyWrapper(result);
18196
- }
18197
- if (start < 0) {
18198
- result = result.takeRight(-start);
18199
- } else if (start) {
18200
- result = result.drop(start);
18201
- }
18202
- if (end !== undefined$1) {
18203
- end = toInteger(end);
18204
- result = end < 0 ? result.dropRight(-end) : result.take(end - start);
18205
- }
18206
- return result;
18207
- };
18208
-
18209
- LazyWrapper.prototype.takeRightWhile = function(predicate) {
18210
- return this.reverse().takeWhile(predicate).reverse();
18211
- };
18212
-
18213
- LazyWrapper.prototype.toArray = function() {
18214
- return this.take(MAX_ARRAY_LENGTH);
18215
- };
18216
-
18217
- // Add `LazyWrapper` methods to `lodash.prototype`.
18218
- baseForOwn(LazyWrapper.prototype, function(func, methodName) {
18219
- var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
18220
- isTaker = /^(?:head|last)$/.test(methodName),
18221
- lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
18222
- retUnwrapped = isTaker || /^find/.test(methodName);
18223
-
18224
- if (!lodashFunc) {
18225
- return;
18226
- }
18227
- lodash.prototype[methodName] = function() {
18228
- var value = this.__wrapped__,
18229
- args = isTaker ? [1] : arguments,
18230
- isLazy = value instanceof LazyWrapper,
18231
- iteratee = args[0],
18232
- useLazy = isLazy || isArray(value);
18233
-
18234
- var interceptor = function(value) {
18235
- var result = lodashFunc.apply(lodash, arrayPush([value], args));
18236
- return (isTaker && chainAll) ? result[0] : result;
18237
- };
18238
-
18239
- if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
18240
- // Avoid lazy use if the iteratee has a "length" value other than `1`.
18241
- isLazy = useLazy = false;
18242
- }
18243
- var chainAll = this.__chain__,
18244
- isHybrid = !!this.__actions__.length,
18245
- isUnwrapped = retUnwrapped && !chainAll,
18246
- onlyLazy = isLazy && !isHybrid;
18247
-
18248
- if (!retUnwrapped && useLazy) {
18249
- value = onlyLazy ? value : new LazyWrapper(this);
18250
- var result = func.apply(value, args);
18251
- result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined$1 });
18252
- return new LodashWrapper(result, chainAll);
18253
- }
18254
- if (isUnwrapped && onlyLazy) {
18255
- return func.apply(this, args);
18256
- }
18257
- result = this.thru(interceptor);
18258
- return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
18259
- };
18260
- });
18261
-
18262
- // Add `Array` methods to `lodash.prototype`.
18263
- arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
18264
- var func = arrayProto[methodName],
18265
- chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
18266
- retUnwrapped = /^(?:pop|shift)$/.test(methodName);
18267
-
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
- }
18706
+ 'iteratee': getIteratee(iteratee, 3),
18707
+ 'type': type
18708
+ });
18709
+ result.__filtered__ = result.__filtered__ || isFilter;
18710
+ return result;
18711
+ };
18712
+ });
18340
18713
 
18341
- var lodashExports = requireLodash();
18342
- var _ = /*@__PURE__*/getDefaultExportFromCjs(lodashExports);
18714
+ // Add `LazyWrapper` methods for `_.head` and `_.last`.
18715
+ arrayEach(['head', 'last'], function(methodName, index) {
18716
+ var takeName = 'take' + (index ? 'Right' : '');
18343
18717
 
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
- // }
18718
+ LazyWrapper.prototype[methodName] = function() {
18719
+ return this[takeName](1).value()[0];
18720
+ };
18721
+ });
18365
18722
 
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
- };
18723
+ // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
18724
+ arrayEach(['initial', 'tail'], function(methodName, index) {
18725
+ var dropName = 'drop' + (index ? '' : 'Right');
18383
18726
 
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
- // };
18727
+ LazyWrapper.prototype[methodName] = function() {
18728
+ return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
18729
+ };
18730
+ });
18392
18731
 
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
- })));
18732
+ LazyWrapper.prototype.compact = function() {
18733
+ return this.filter(identity);
18734
+ };
18471
18735
 
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';
18736
+ LazyWrapper.prototype.find = function(predicate) {
18737
+ return this.filter(predicate).head();
18738
+ };
18492
18739
 
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
- };
18740
+ LazyWrapper.prototype.findLast = function(predicate) {
18741
+ return this.reverse().find(predicate);
18742
+ };
18535
18743
 
18536
- /* "use client" */
18744
+ LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
18745
+ if (typeof path == 'function') {
18746
+ return new LazyWrapper(this);
18747
+ }
18748
+ return this.map(function(value) {
18749
+ return baseInvoke(value, path, args);
18750
+ });
18751
+ });
18537
18752
 
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
- };
18753
+ LazyWrapper.prototype.reject = function(predicate) {
18754
+ return this.filter(negate(getIteratee(predicate)));
18755
+ };
18756
+
18757
+ LazyWrapper.prototype.slice = function(start, end) {
18758
+ start = toInteger(start);
18759
+
18760
+ var result = this;
18761
+ if (result.__filtered__ && (start > 0 || end < 0)) {
18762
+ return new LazyWrapper(result);
18763
+ }
18764
+ if (start < 0) {
18765
+ result = result.takeRight(-start);
18766
+ } else if (start) {
18767
+ result = result.drop(start);
18768
+ }
18769
+ if (end !== undefined$1) {
18770
+ end = toInteger(end);
18771
+ result = end < 0 ? result.dropRight(-end) : result.take(end - start);
18772
+ }
18773
+ return result;
18774
+ };
18553
18775
 
18554
- /* "use client" */
18776
+ LazyWrapper.prototype.takeRightWhile = function(predicate) {
18777
+ return this.reverse().takeWhile(predicate).reverse();
18778
+ };
18555
18779
 
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
- };
18780
+ LazyWrapper.prototype.toArray = function() {
18781
+ return this.take(MAX_ARRAY_LENGTH);
18782
+ };
18590
18783
 
18591
- /* "use client" */
18784
+ // Add `LazyWrapper` methods to `lodash.prototype`.
18785
+ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
18786
+ var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
18787
+ isTaker = /^(?:head|last)$/.test(methodName),
18788
+ lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
18789
+ retUnwrapped = isTaker || /^find/.test(methodName);
18592
18790
 
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
- };
18791
+ if (!lodashFunc) {
18792
+ return;
18793
+ }
18794
+ lodash.prototype[methodName] = function() {
18795
+ var value = this.__wrapped__,
18796
+ args = isTaker ? [1] : arguments,
18797
+ isLazy = value instanceof LazyWrapper,
18798
+ iteratee = args[0],
18799
+ useLazy = isLazy || isArray(value);
18624
18800
 
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
- };
18801
+ var interceptor = function(value) {
18802
+ var result = lodashFunc.apply(lodash, arrayPush([value], args));
18803
+ return (isTaker && chainAll) ? result[0] : result;
18804
+ };
18670
18805
 
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
- };
18806
+ if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
18807
+ // Avoid lazy use if the iteratee has a "length" value other than `1`.
18808
+ isLazy = useLazy = false;
18809
+ }
18810
+ var chainAll = this.__chain__,
18811
+ isHybrid = !!this.__actions__.length,
18812
+ isUnwrapped = retUnwrapped && !chainAll,
18813
+ onlyLazy = isLazy && !isHybrid;
18763
18814
 
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
- };
18815
+ if (!retUnwrapped && useLazy) {
18816
+ value = onlyLazy ? value : new LazyWrapper(this);
18817
+ var result = func.apply(value, args);
18818
+ result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined$1 });
18819
+ return new LodashWrapper(result, chainAll);
18820
+ }
18821
+ if (isUnwrapped && onlyLazy) {
18822
+ return func.apply(this, args);
18823
+ }
18824
+ result = this.thru(interceptor);
18825
+ return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
18826
+ };
18827
+ });
18776
18828
 
18777
- /* "use client" */
18829
+ // Add `Array` methods to `lodash.prototype`.
18830
+ arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
18831
+ var func = arrayProto[methodName],
18832
+ chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
18833
+ retUnwrapped = /^(?:pop|shift)$/.test(methodName);
18778
18834
 
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';
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
+ });
18817
18846
 
18818
- var useCurrentState = function useCurrentState(initialState) {
18819
- var _useState = React.useState(function () {
18820
- return typeof initialState === 'function' ? initialState() : initialState;
18821
- }),
18822
- _useState2 = _slicedToArray(_useState, 2),
18823
- state = _useState2[0],
18824
- setState = _useState2[1];
18825
- var ref = React.useRef(initialState);
18826
- React.useEffect(function () {
18827
- ref.current = state;
18828
- }, [state]);
18829
- var setValue = function setValue(val) {
18830
- var result = typeof val === 'function' ? val(ref.current) : val;
18831
- ref.current = result;
18832
- setState(result);
18833
- };
18834
- return [state, setValue, ref];
18835
- };
18847
+ // Map minified method names to their real names.
18848
+ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
18849
+ var lodashFunc = lodash[methodName];
18850
+ if (lodashFunc) {
18851
+ var key = lodashFunc.name + '';
18852
+ if (!hasOwnProperty.call(realNames, key)) {
18853
+ realNames[key] = [];
18854
+ }
18855
+ realNames[key].push({ 'name': methodName, 'func': lodashFunc });
18856
+ }
18857
+ });
18836
18858
 
18837
- var SelectIconComponent = function SelectIconComponent() {
18838
- return /*#__PURE__*/React.createElement("svg", {
18839
- viewBox: "0 0 24 24",
18840
- strokeWidth: "1",
18841
- strokeLinecap: "round",
18842
- strokeLinejoin: "round",
18843
- fill: "none",
18844
- shapeRendering: "geometricPrecision",
18845
- className: "jsx-2742933678"
18846
- }, /*#__PURE__*/React.createElement("path", {
18847
- d: "M6 9l6 6 6-6",
18848
- className: "jsx-2742933678"
18849
- }), /*#__PURE__*/React.createElement(_JSXStyle, {
18850
- id: "2742933678"
18851
- }, "svg.jsx-2742933678{color:inherit;stroke:currentColor;-webkit-transition:all 200ms ease;transition:all 200ms ease;width:1.214em;height:1.214em;}"));
18852
- };
18853
- SelectIconComponent.displayName = 'GeistSelectIcon';
18854
- var SelectIcon = /*#__PURE__*/React.memo(SelectIconComponent);
18859
+ realNames[createHybrid(undefined$1, WRAP_BIND_KEY_FLAG).name] = [{
18860
+ 'name': 'wrapper',
18861
+ 'func': undefined$1
18862
+ }];
18855
18863
 
18856
- /* "use client" */
18864
+ // Add methods to `LazyWrapper`.
18865
+ LazyWrapper.prototype.clone = lazyClone;
18866
+ LazyWrapper.prototype.reverse = lazyReverse;
18867
+ LazyWrapper.prototype.value = lazyValue;
18857
18868
 
18858
- var defaultContext$1 = {
18859
- visible: false,
18860
- disableAll: false
18861
- };
18862
- var SelectContext = /*#__PURE__*/React.createContext(defaultContext$1);
18863
- var useSelectContext = function useSelectContext() {
18864
- return React.useContext(SelectContext);
18865
- };
18869
+ // Add chain sequence methods to the `lodash` wrapper.
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;
18866
18877
 
18867
- var useSSR = function useSSR() {
18868
- var _useState = React.useState(false),
18869
- _useState2 = _slicedToArray(_useState, 2),
18870
- browser = _useState2[0],
18871
- setBrowser = _useState2[1];
18872
- React.useEffect(function () {
18873
- setBrowser(isBrowser());
18874
- }, []);
18875
- return {
18876
- isBrowser: browser,
18877
- isServer: !browser
18878
- };
18879
- };
18878
+ // Add lazy aliases.
18879
+ lodash.prototype.first = lodash.prototype.head;
18880
18880
 
18881
- var createElement = function createElement(id) {
18882
- var el = document.createElement('div');
18883
- el.setAttribute('id', id);
18884
- return el;
18885
- };
18886
- var usePortal = function usePortal() {
18887
- var selectId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getId();
18888
- var getContainer = arguments.length > 1 ? arguments[1] : undefined;
18889
- var id = "helpdice-ui-".concat(selectId);
18890
- var _useSSR = useSSR(),
18891
- isBrowser = _useSSR.isBrowser;
18892
- var _useState = React.useState(isBrowser ? createElement(id) : null),
18893
- _useState2 = _slicedToArray(_useState, 2),
18894
- elSnapshot = _useState2[0],
18895
- setElSnapshot = _useState2[1];
18896
- React.useEffect(function () {
18897
- var customContainer = getContainer ? getContainer() : null;
18898
- var parentElement = customContainer || document.body;
18899
- var hasElement = parentElement.querySelector("#".concat(id));
18900
- var el = hasElement || createElement(id);
18901
- if (!hasElement) {
18902
- parentElement.appendChild(el);
18903
- }
18904
- setElSnapshot(el);
18905
- }, []);
18906
- return elSnapshot;
18907
- };
18881
+ if (symIterator) {
18882
+ lodash.prototype[symIterator] = wrapperToIterator;
18883
+ }
18884
+ return lodash;
18885
+ });
18908
18886
 
18909
- var _excluded$d = ["children", "className", "visible", "enterTime", "leaveTime", "clearTime", "name"];
18910
- var CssTransition = function CssTransition(_ref) {
18911
- var children = _ref.children,
18912
- _ref$className = _ref.className,
18913
- className = _ref$className === undefined ? '' : _ref$className,
18914
- _ref$visible = _ref.visible,
18915
- visible = _ref$visible === undefined ? false : _ref$visible,
18916
- _ref$enterTime = _ref.enterTime,
18917
- enterTime = _ref$enterTime === undefined ? 60 : _ref$enterTime,
18918
- _ref$leaveTime = _ref.leaveTime,
18919
- leaveTime = _ref$leaveTime === undefined ? 60 : _ref$leaveTime,
18920
- _ref$clearTime = _ref.clearTime,
18921
- clearTime = _ref$clearTime === undefined ? 60 : _ref$clearTime,
18922
- _ref$name = _ref.name,
18923
- name = _ref$name === undefined ? 'transition' : _ref$name,
18924
- props = _objectWithoutProperties(_ref, _excluded$d);
18925
- var _useState = React.useState(''),
18926
- _useState2 = _slicedToArray(_useState, 2),
18927
- classes = _useState2[0],
18928
- setClasses = _useState2[1];
18929
- var _useState3 = React.useState(visible),
18930
- _useState4 = _slicedToArray(_useState3, 2),
18931
- renderable = _useState4[0],
18932
- setRenderable = _useState4[1];
18933
- React.useEffect(function () {
18934
- var statusClassName = visible ? 'enter' : 'leave';
18935
- var time = visible ? enterTime : leaveTime;
18936
- if (visible && !renderable) {
18937
- setRenderable(true);
18938
- }
18939
- setClasses("".concat(name, "-").concat(statusClassName));
18887
+ /*--------------------------------------------------------------------------*/
18940
18888
 
18941
- // set class to active
18942
- var timer = setTimeout(function () {
18943
- setClasses("".concat(name, "-").concat(statusClassName, " ").concat(name, "-").concat(statusClassName, "-active"));
18944
- clearTimeout(timer);
18945
- }, time);
18889
+ // Export lodash.
18890
+ var _ = runInContext();
18946
18891
 
18947
- // remove classess when animation over
18948
- var clearClassesTimer = setTimeout(function () {
18949
- if (!visible) {
18950
- setClasses('');
18951
- setRenderable(false);
18952
- }
18953
- clearTimeout(clearClassesTimer);
18954
- }, time + clearTime);
18955
- return function () {
18956
- clearTimeout(timer);
18957
- clearTimeout(clearClassesTimer);
18958
- };
18959
- }, [visible, renderable]);
18960
- if (! /*#__PURE__*/React.isValidElement(children) || !renderable) return null;
18961
- var propsTransition = _objectSpread2(_objectSpread2({}, props), {}, {
18962
- className: "".concat(children.props.className, " ").concat(className, " ").concat(classes)
18963
- });
18964
- return /*#__PURE__*/React.cloneElement(children, propsTransition);
18965
- };
18966
- CssTransition.displayName = 'CssTransition';
18892
+ // Some AMD build optimizers, like r.js, check for condition patterns like:
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
+ }
18967
18907
 
18968
- /* "use client" */
18908
+ var lodashExports = requireLodash();
18909
+ var _ = /*@__PURE__*/getDefaultExportFromCjs(lodashExports);
18969
18910
 
18970
- var useClickAnyWhere = function useClickAnyWhere(handler) {
18911
+ var useCurrentState = function useCurrentState(initialState) {
18912
+ var _useState = React.useState(function () {
18913
+ return typeof initialState === 'function' ? initialState() : initialState;
18914
+ }),
18915
+ _useState2 = _slicedToArray(_useState, 2),
18916
+ state = _useState2[0],
18917
+ setState = _useState2[1];
18918
+ var ref = React.useRef(initialState);
18971
18919
  React.useEffect(function () {
18972
- var callback = function callback(event) {
18973
- return handler(event);
18974
- };
18975
- document.addEventListener('click', callback);
18976
- return function () {
18977
- return document.removeEventListener('click', callback);
18978
- };
18979
- }, [handler]);
18980
- };
18981
-
18982
- /* "use client" */
18983
-
18984
- var useDOMObserver = function useDOMObserver(ref) {
18985
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
18986
- var config = {
18987
- attributes: false,
18988
- childList: true,
18989
- subtree: true
18920
+ ref.current = state;
18921
+ }, [state]);
18922
+ var setValue = function setValue(val) {
18923
+ var result = typeof val === 'function' ? val(ref.current) : val;
18924
+ ref.current = result;
18925
+ setState(result);
18990
18926
  };
18991
- React.useEffect(function () {
18992
- if (!ref || !ref.current) return;
18993
- var unmount = false;
18994
- var done = function done() {
18995
- if (unmount) return;
18996
- callback.apply(undefined, arguments);
18997
- };
18998
- var observer = new MutationObserver(done);
18999
- observer.observe(ref.current, config);
19000
- return function () {
19001
- unmount = true;
19002
- observer.disconnect();
19003
- };
19004
- }, [ref]);
18927
+ return [state, setValue, ref];
19005
18928
  };
19006
18929
 
19007
- var getElementOffset = function getElementOffset(el) {
19008
- if (!el) return {
19009
- top: 0,
19010
- left: 0
19011
- };
19012
- var _el$getBoundingClient = el.getBoundingClientRect(),
19013
- top = _el$getBoundingClient.top,
19014
- left = _el$getBoundingClient.left;
19015
- return {
19016
- top: top,
19017
- left: left
19018
- };
19019
- };
19020
- var defaultRect$2 = {
19021
- top: -1e3,
19022
- left: -1e3,
19023
- right: -1e3,
19024
- width: 0,
19025
- height: 0,
19026
- elementTop: -1e3
18930
+ var SelectIconComponent = function SelectIconComponent() {
18931
+ return /*#__PURE__*/React.createElement("svg", {
18932
+ viewBox: "0 0 24 24",
18933
+ strokeWidth: "1",
18934
+ strokeLinecap: "round",
18935
+ strokeLinejoin: "round",
18936
+ fill: "none",
18937
+ shapeRendering: "geometricPrecision",
18938
+ className: "jsx-2742933678"
18939
+ }, /*#__PURE__*/React.createElement("path", {
18940
+ d: "M6 9l6 6 6-6",
18941
+ className: "jsx-2742933678"
18942
+ }), /*#__PURE__*/React.createElement(_JSXStyle, {
18943
+ id: "2742933678"
18944
+ }, "svg.jsx-2742933678{color:inherit;stroke:currentColor;-webkit-transition:all 200ms ease;transition:all 200ms ease;width:1.214em;height:1.214em;}"));
19027
18945
  };
19028
- var getRectFromDOMWithContainer = function getRectFromDOMWithContainer(domRect, getContainer) {
19029
- if (!domRect) return defaultRect$2;
19030
- var container = getContainer ? getContainer() : null;
19031
- var scrollElement = container || document.documentElement;
19032
- var _getElementOffset = getElementOffset(container),
19033
- offsetTop = _getElementOffset.top,
19034
- offsetLeft = _getElementOffset.left;
19035
- return _objectSpread2(_objectSpread2({}, domRect), {}, {
19036
- width: domRect.width || domRect.right - domRect.left,
19037
- height: domRect.height || domRect.top - domRect.bottom,
19038
- top: domRect.bottom + scrollElement.scrollTop - offsetTop,
19039
- left: domRect.left + scrollElement.scrollLeft - offsetLeft,
19040
- elementTop: domRect.top + scrollElement.scrollTop - offsetTop
19041
- });
18946
+ SelectIconComponent.displayName = 'GeistSelectIcon';
18947
+ var SelectIcon = /*#__PURE__*/React.memo(SelectIconComponent);
18948
+
18949
+ /* "use client" */
18950
+
18951
+ var defaultContext$2 = {
18952
+ visible: false,
18953
+ disableAll: false
19042
18954
  };
19043
- var getRefRect = function getRefRect(ref, getContainer) {
19044
- if (!ref || !ref.current) return defaultRect$2;
19045
- var rect = ref.current.getBoundingClientRect();
19046
- return getRectFromDOMWithContainer(rect, getContainer);
18955
+ var SelectContext = /*#__PURE__*/React.createContext(defaultContext$2);
18956
+ var useSelectContext = function useSelectContext() {
18957
+ return React.useContext(SelectContext);
19047
18958
  };
19048
18959
 
19049
- var defaultRect$1 = {
19050
- top: -1e3,
19051
- left: -1e3,
19052
- right: -1e3,
19053
- width: 0
19054
- };
19055
- var Dropdown = /*#__PURE__*/React.memo(function (_ref) {
19056
- var children = _ref.children,
19057
- parent = _ref.parent,
19058
- visible = _ref.visible,
19059
- disableMatchWidth = _ref.disableMatchWidth,
19060
- getPopupContainer = _ref.getPopupContainer;
19061
- var el = usePortal('dropdown', getPopupContainer);
19062
- var _useState = React.useState(defaultRect$1),
18960
+ var useSSR = function useSSR() {
18961
+ var _useState = React.useState(false),
19063
18962
  _useState2 = _slicedToArray(_useState, 2),
19064
- rect = _useState2[0],
19065
- setRect = _useState2[1];
19066
- var classes = useClasses('dropdown', disableMatchWidth ? 'disable-match' : 'width-match');
19067
- if (!parent) return null;
19068
-
19069
- /* istanbul ignore next */
19070
- if (process.env.NODE_ENV !== 'production') {
19071
- if (getPopupContainer && getPopupContainer()) {
19072
- var _el = getPopupContainer();
19073
- var style = window.getComputedStyle(_el);
19074
- if (style.position === 'static') {
19075
- useWarning('The element specified by "getPopupContainer" must have "position" set.');
19076
- }
19077
- }
19078
- }
19079
- var updateRect = function updateRect() {
19080
- var _getRefRect = getRefRect(parent, getPopupContainer),
19081
- top = _getRefRect.top,
19082
- left = _getRefRect.left,
19083
- right = _getRefRect.right,
19084
- nativeWidth = _getRefRect.width;
19085
- setRect({
19086
- top: top,
19087
- left: left,
19088
- right: right,
19089
- width: nativeWidth
19090
- });
19091
- };
19092
- useResize(updateRect);
19093
- useClickAnyWhere(function () {
19094
- var _getRefRect2 = getRefRect(parent, getPopupContainer),
19095
- top = _getRefRect2.top,
19096
- left = _getRefRect2.left;
19097
- var shouldUpdatePosition = top !== rect.top || left !== rect.left;
19098
- if (!shouldUpdatePosition) return;
19099
- updateRect();
19100
- });
19101
- useDOMObserver(parent, function () {
19102
- updateRect();
19103
- });
18963
+ browser = _useState2[0],
18964
+ setBrowser = _useState2[1];
19104
18965
  React.useEffect(function () {
19105
- if (!parent || !parent.current) return;
19106
- parent.current.addEventListener('mouseenter', updateRect);
19107
- /* istanbul ignore next */
19108
- return function () {
19109
- if (!parent || !parent.current) return;
19110
- parent.current.removeEventListener('mouseenter', updateRect);
19111
- };
19112
- }, [parent]);
19113
- var clickHandler = function clickHandler(event) {
19114
- event.stopPropagation();
19115
- event.nativeEvent.stopImmediatePropagation();
19116
- event.preventDefault();
19117
- };
19118
- var mouseDownHandler = function mouseDownHandler(event) {
19119
- event.preventDefault();
19120
- };
19121
- if (!el) return null;
19122
- return /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/React.createElement(CssTransition, {
19123
- visible: visible
19124
- }, /*#__PURE__*/React.createElement("div", {
19125
- onClick: clickHandler,
19126
- onMouseDown: mouseDownHandler,
19127
- className: _JSXStyle.dynamic([["1644673105", [rect.top + 2, rect.left, rect.width, rect.width]]]) + " " + (classes || "")
19128
- }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
19129
- id: "1644673105",
19130
- dynamic: [rect.top + 2, rect.left, rect.width, rect.width]
19131
- }, ".dropdown.__jsx-style-dynamic-selector{position:absolute;top:".concat(rect.top + 2, "px;left:").concat(rect.left, "px;z-index:1100;}.width-match.__jsx-style-dynamic-selector{width:").concat(rect.width, "px;}.disable-match.__jsx-style-dynamic-selector{min-width:").concat(rect.width, "px;}")))), el);
19132
- });
19133
-
19134
- var SelectDropdown = /*#__PURE__*/React.forwardRef(function (_ref, dropdownRef) {
19135
- var visible = _ref.visible,
19136
- children = _ref.children,
19137
- _ref$className = _ref.className,
19138
- className = _ref$className === undefined ? '' : _ref$className,
19139
- _ref$dropdownStyle = _ref.dropdownStyle,
19140
- dropdownStyle = _ref$dropdownStyle === undefined ? {} : _ref$dropdownStyle,
19141
- disableMatchWidth = _ref.disableMatchWidth,
19142
- getPopupContainer = _ref.getPopupContainer;
19143
- var theme = useTheme();
19144
- var internalDropdownRef = React.useRef(null);
19145
- var _useSelectContext = useSelectContext(),
19146
- ref = _useSelectContext.ref;
19147
- var classes = useClasses('select-dropdown', className);
19148
- React.useImperativeHandle(dropdownRef, function () {
19149
- return internalDropdownRef.current;
19150
- });
19151
- return /*#__PURE__*/React.createElement(Dropdown, {
19152
- parent: ref,
19153
- visible: visible,
19154
- disableMatchWidth: disableMatchWidth,
19155
- getPopupContainer: getPopupContainer
19156
- }, /*#__PURE__*/React.createElement("div", {
19157
- ref: internalDropdownRef,
19158
- style: dropdownStyle,
19159
- className: _JSXStyle.dynamic([["2782510679", [theme.layout.radius, theme.expressiveness.shadowLarge, theme.palette.background]]]) + " " + (classes || "")
19160
- }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
19161
- id: "2782510679",
19162
- dynamic: [theme.layout.radius, theme.expressiveness.shadowLarge, theme.palette.background]
19163
- }, ".select-dropdown.__jsx-style-dynamic-selector{border-radius:".concat(theme.layout.radius, ";box-shadow:").concat(theme.expressiveness.shadowLarge, ";background-color:").concat(theme.palette.background, ";max-height:17em;overflow-y:auto;overflow-anchor:none;padding:0.38em 0;-webkit-scroll-behavior:smooth;-moz-scroll-behavior:smooth;-ms-scroll-behavior:smooth;scroll-behavior:smooth;}"))));
19164
- });
19165
- SelectDropdown.displayName = 'SelectDropdown';
19166
-
19167
- var _excluded$c = ["xs", "sm", "md", "lg", "xl", "justify", "direction", "alignItems", "alignContent", "children", "className"];
19168
- var getItemLayout = function getItemLayout(val) {
19169
- var display = val === 0 ? 'display: none;' : 'display: inherit;';
19170
- if (typeof val === 'number') {
19171
- var width = 100 / 24 * val;
19172
- var ratio = width > 100 ? '100%' : width < 0 ? '0' : "".concat(width, "%");
19173
- return {
19174
- grow: 0,
19175
- display: display,
19176
- width: ratio,
19177
- basis: ratio
19178
- };
19179
- }
18966
+ setBrowser(isBrowser());
18967
+ }, []);
19180
18968
  return {
19181
- grow: 1,
19182
- display: display,
19183
- width: '100%',
19184
- basis: '0'
18969
+ isBrowser: browser,
18970
+ isServer: !browser
19185
18971
  };
19186
18972
  };
19187
- var GridBasicItem = function GridBasicItem(_ref) {
19188
- var _ref$xs = _ref.xs,
19189
- xs = _ref$xs === undefined ? false : _ref$xs,
19190
- _ref$sm = _ref.sm,
19191
- sm = _ref$sm === undefined ? false : _ref$sm,
19192
- _ref$md = _ref.md,
19193
- md = _ref$md === undefined ? false : _ref$md,
19194
- _ref$lg = _ref.lg,
19195
- lg = _ref$lg === undefined ? false : _ref$lg,
19196
- _ref$xl = _ref.xl,
19197
- xl = _ref$xl === undefined ? false : _ref$xl,
19198
- justify = _ref.justify,
19199
- direction = _ref.direction,
19200
- alignItems = _ref.alignItems,
19201
- alignContent = _ref.alignContent,
19202
- children = _ref.children,
19203
- _ref$className = _ref.className,
19204
- className = _ref$className === undefined ? '' : _ref$className,
19205
- props = _objectWithoutProperties(_ref, _excluded$c);
19206
- var theme = useTheme();
19207
- var _useScale = useScale(),
19208
- SCALES = _useScale.SCALES;
19209
- var classes = React.useMemo(function () {
19210
- var aligns = {
19211
- justify: justify,
19212
- direction: direction,
19213
- alignItems: alignItems,
19214
- alignContent: alignContent,
19215
- xs: xs,
19216
- sm: sm,
19217
- md: md,
19218
- lg: lg,
19219
- xl: xl
18973
+
18974
+ var createElement = function createElement(id) {
18975
+ var el = document.createElement('div');
18976
+ el.setAttribute('id', id);
18977
+ return el;
18978
+ };
18979
+ var usePortal = function usePortal() {
18980
+ var selectId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getId();
18981
+ var getContainer = arguments.length > 1 ? arguments[1] : undefined;
18982
+ var id = "helpdice-ui-".concat(selectId);
18983
+ var _useSSR = useSSR(),
18984
+ isBrowser = _useSSR.isBrowser;
18985
+ var _useState = React.useState(isBrowser ? createElement(id) : null),
18986
+ _useState2 = _slicedToArray(_useState, 2),
18987
+ elSnapshot = _useState2[0],
18988
+ setElSnapshot = _useState2[1];
18989
+ React.useEffect(function () {
18990
+ var customContainer = getContainer ? getContainer() : null;
18991
+ var parentElement = customContainer || document.body;
18992
+ var hasElement = parentElement.querySelector("#".concat(id));
18993
+ var el = hasElement || createElement(id);
18994
+ if (!hasElement) {
18995
+ parentElement.appendChild(el);
18996
+ }
18997
+ setElSnapshot(el);
18998
+ }, []);
18999
+ return elSnapshot;
19000
+ };
19001
+
19002
+ /* "use client" */
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();
19220
19009
  };
19221
- var classString = Object.keys(aligns).reduce(function (pre, name) {
19222
- if (aligns[name] !== undefined && aligns[name] !== false) return "".concat(pre, " ").concat(name);
19223
- return pre;
19224
- }, '');
19225
- return classString.trim();
19226
- }, [justify, direction, alignItems, alignContent, xs, sm, md, lg, xl]);
19227
- var layout = React.useMemo(function () {
19228
- return {
19229
- xs: getItemLayout(xs),
19230
- sm: getItemLayout(sm),
19231
- md: getItemLayout(md),
19232
- lg: getItemLayout(lg),
19233
- xl: getItemLayout(xl)
19010
+ if (immediatelyInvoke) {
19011
+ fn();
19012
+ }
19013
+ window.addEventListener('resize', fn);
19014
+ return function () {
19015
+ return window.removeEventListener('resize', fn);
19234
19016
  };
19235
- }, [xs, sm, md, lg, xl]);
19236
- return /*#__PURE__*/React.createElement("div", _extends({}, props, {
19237
- className: _JSXStyle.dynamic([["568430467", [SCALES.font(1, 'inherit'), SCALES.height(1, 'auto'), justify, direction, alignContent, alignItems, layout.xs.grow, layout.xs.width, layout.xs.basis, layout.xs.display, theme.breakpoints.sm.min, layout.sm.grow, layout.sm.width, layout.sm.basis, layout.sm.display, theme.breakpoints.md.min, layout.md.grow, layout.md.width, layout.md.basis, layout.md.display, theme.breakpoints.lg.min, layout.lg.grow, layout.lg.width, layout.lg.basis, layout.lg.display, theme.breakpoints.xl.min, layout.xl.grow, layout.xl.width, layout.xl.basis, layout.xl.display]]]) + " " + (props && props.className != null && props.className || useClasses('item', classes, className) || "")
19238
- }), children, /*#__PURE__*/React.createElement(_JSXStyle, {
19239
- id: "568430467",
19240
- dynamic: [SCALES.font(1, 'inherit'), SCALES.height(1, 'auto'), justify, direction, alignContent, alignItems, layout.xs.grow, layout.xs.width, layout.xs.basis, layout.xs.display, theme.breakpoints.sm.min, layout.sm.grow, layout.sm.width, layout.sm.basis, layout.sm.display, theme.breakpoints.md.min, layout.md.grow, layout.md.width, layout.md.basis, layout.md.display, theme.breakpoints.lg.min, layout.lg.grow, layout.lg.width, layout.lg.basis, layout.lg.display, theme.breakpoints.xl.min, layout.xl.grow, layout.xl.width, layout.xl.basis, layout.xl.display]
19241
- }, ".item.__jsx-style-dynamic-selector{font-size:".concat(SCALES.font(1, 'inherit'), ";height:").concat(SCALES.height(1, 'auto'), ";}.justify.__jsx-style-dynamic-selector{-webkit-box-pack:").concat(justify, ";-webkit-justify-content:").concat(justify, ";-ms-flex-pack:").concat(justify, ";justify-content:").concat(justify, ";}.direction.__jsx-style-dynamic-selector{-webkit-flex-direction:").concat(direction, ";-ms-flex-direction:").concat(direction, ";flex-direction:").concat(direction, ";}.alignContent.__jsx-style-dynamic-selector{-webkit-align-content:").concat(alignContent, ";-ms-flex-line-pack:").concat(alignContent, ";align-content:").concat(alignContent, ";}.alignItems.__jsx-style-dynamic-selector{-webkit-align-items:").concat(alignItems, ";-webkit-box-align:").concat(alignItems, ";-ms-flex-align:").concat(alignItems, ";align-items:").concat(alignItems, ";}.xs.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.xs.grow, ";-webkit-flex-grow:").concat(layout.xs.grow, ";-ms-flex-positive:").concat(layout.xs.grow, ";flex-grow:").concat(layout.xs.grow, ";max-width:").concat(layout.xs.width, ";-webkit-flex-basis:").concat(layout.xs.basis, ";-ms-flex-preferred-size:").concat(layout.xs.basis, ";flex-basis:").concat(layout.xs.basis, ";").concat(layout.xs.display, ";}@media only screen and (min-width:").concat(theme.breakpoints.sm.min, "){.sm.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.sm.grow, ";-webkit-flex-grow:").concat(layout.sm.grow, ";-ms-flex-positive:").concat(layout.sm.grow, ";flex-grow:").concat(layout.sm.grow, ";max-width:").concat(layout.sm.width, ";-webkit-flex-basis:").concat(layout.sm.basis, ";-ms-flex-preferred-size:").concat(layout.sm.basis, ";flex-basis:").concat(layout.sm.basis, ";").concat(layout.sm.display, ";}}@media only screen and (min-width:").concat(theme.breakpoints.md.min, "){.md.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.md.grow, ";-webkit-flex-grow:").concat(layout.md.grow, ";-ms-flex-positive:").concat(layout.md.grow, ";flex-grow:").concat(layout.md.grow, ";max-width:").concat(layout.md.width, ";-webkit-flex-basis:").concat(layout.md.basis, ";-ms-flex-preferred-size:").concat(layout.md.basis, ";flex-basis:").concat(layout.md.basis, ";").concat(layout.md.display, ";}}@media only screen and (min-width:").concat(theme.breakpoints.lg.min, "){.lg.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.lg.grow, ";-webkit-flex-grow:").concat(layout.lg.grow, ";-ms-flex-positive:").concat(layout.lg.grow, ";flex-grow:").concat(layout.lg.grow, ";max-width:").concat(layout.lg.width, ";-webkit-flex-basis:").concat(layout.lg.basis, ";-ms-flex-preferred-size:").concat(layout.lg.basis, ";flex-basis:").concat(layout.lg.basis, ";").concat(layout.lg.display, ";}}@media only screen and (min-width:").concat(theme.breakpoints.xl.min, "){.xl.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.xl.grow, ";-webkit-flex-grow:").concat(layout.xl.grow, ";-ms-flex-positive:").concat(layout.xl.grow, ";flex-grow:").concat(layout.xl.grow, ";max-width:").concat(layout.xl.width, ";-webkit-flex-basis:").concat(layout.xl.basis, ";-ms-flex-preferred-size:").concat(layout.xl.basis, ";flex-basis:").concat(layout.xl.basis, ";").concat(layout.xl.display, ";}}")));
19017
+ }, []);
19242
19018
  };
19243
- GridBasicItem.displayName = 'GridBasicItem';
19244
19019
 
19245
- var _excluded$b = ["children", "className"];
19246
- var GridComponent = function GridComponent(_ref) {
19020
+ var _excluded$a = ["children", "className", "visible", "enterTime", "leaveTime", "clearTime", "name"];
19021
+ var CssTransition = function CssTransition(_ref) {
19247
19022
  var children = _ref.children,
19248
19023
  _ref$className = _ref.className,
19249
19024
  className = _ref$className === undefined ? '' : _ref$className,
19250
- props = _objectWithoutProperties(_ref, _excluded$b);
19251
- var _useScale = useScale(),
19252
- SCALES = _useScale.SCALES;
19253
- var _styles$className = {
19254
- styles: /*#__PURE__*/React.createElement(_JSXStyle, {
19255
- id: "1271839607",
19256
- dynamic: [SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0, 'var(--grid-gap-unit)'), SCALES.pr(0, 'var(--grid-gap-unit)'), SCALES.pb(0, 'var(--grid-gap-unit)'), SCALES.pl(0, 'var(--grid-gap-unit)')]
19257
- }, "div.__jsx-style-dynamic-selector{margin:".concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";box-sizing:border-box;padding:").concat(SCALES.pt(0, 'var(--grid-gap-unit)'), " ").concat(SCALES.pr(0, 'var(--grid-gap-unit)'), " ").concat(SCALES.pb(0, 'var(--grid-gap-unit)'), " ").concat(SCALES.pl(0, 'var(--grid-gap-unit)'), ";}")),
19258
- className: _JSXStyle.dynamic([["1271839607", [SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0, 'var(--grid-gap-unit)'), SCALES.pr(0, 'var(--grid-gap-unit)'), SCALES.pb(0, 'var(--grid-gap-unit)'), SCALES.pl(0, 'var(--grid-gap-unit)')]]])
19259
- },
19260
- resolveClassName = _styles$className.className,
19261
- styles = _styles$className.styles;
19262
- var classes = useClasses(resolveClassName, className);
19263
- return /*#__PURE__*/React.createElement(GridBasicItem, _extends({
19264
- className: classes
19265
- }, props), children, styles);
19266
- };
19267
- GridComponent.displayName = 'Grid';
19268
- var Grid = withScale(GridComponent);
19269
-
19270
- var _excluded$a = ["gap", "wrap", "children", "className"];
19271
- var GridContainerComponent = function GridContainerComponent(_ref) {
19272
- var _ref$gap = _ref.gap,
19273
- gap = _ref$gap === undefined ? 0 : _ref$gap,
19274
- _ref$wrap = _ref.wrap,
19275
- wrap = _ref$wrap === undefined ? 'wrap' : _ref$wrap,
19276
- children = _ref.children,
19277
- _ref$className = _ref.className,
19278
- className = _ref$className === undefined ? '' : _ref$className,
19025
+ _ref$visible = _ref.visible,
19026
+ visible = _ref$visible === undefined ? false : _ref$visible,
19027
+ _ref$enterTime = _ref.enterTime,
19028
+ enterTime = _ref$enterTime === undefined ? 60 : _ref$enterTime,
19029
+ _ref$leaveTime = _ref.leaveTime,
19030
+ leaveTime = _ref$leaveTime === undefined ? 60 : _ref$leaveTime,
19031
+ _ref$clearTime = _ref.clearTime,
19032
+ clearTime = _ref$clearTime === undefined ? 60 : _ref$clearTime,
19033
+ _ref$name = _ref.name,
19034
+ name = _ref$name === undefined ? 'transition' : _ref$name,
19279
19035
  props = _objectWithoutProperties(_ref, _excluded$a);
19280
- var _useScale = useScale(),
19281
- unit = _useScale.unit,
19282
- SCALES = _useScale.SCALES;
19283
- var gapUnit = React.useMemo(function () {
19284
- return "calc(".concat(gap, " * ").concat(unit, " * 1/3)");
19285
- }, [gap, unit]);
19286
- var _styles$className = {
19287
- styles: /*#__PURE__*/React.createElement(_JSXStyle, {
19288
- id: "3631618093",
19289
- dynamic: [gapUnit, wrap, SCALES.width(1, 'var(--grid-container-width)'), SCALES.mt(0, 'var(--grid-container-margin)'), SCALES.mr(0, 'var(--grid-container-margin)'), SCALES.mb(0, 'var(--grid-container-margin)'), SCALES.ml(0, 'var(--grid-container-margin)')]
19290
- }, "div.__jsx-style-dynamic-selector{--grid-gap-unit:".concat(gapUnit, ";--grid-container-margin:calc(-1 * var(--grid-gap-unit));--grid-container-width:calc(100% + var(--grid-gap-unit) * 2);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:").concat(wrap, ";-ms-flex-wrap:").concat(wrap, ";flex-wrap:").concat(wrap, ";box-sizing:border-box;width:").concat(SCALES.width(1, 'var(--grid-container-width)'), ";margin:").concat(SCALES.mt(0, 'var(--grid-container-margin)'), " ").concat(SCALES.mr(0, 'var(--grid-container-margin)'), " ").concat(SCALES.mb(0, 'var(--grid-container-margin)'), " ").concat(SCALES.ml(0, 'var(--grid-container-margin)'), ";}")),
19291
- className: _JSXStyle.dynamic([["3631618093", [gapUnit, wrap, SCALES.width(1, 'var(--grid-container-width)'), SCALES.mt(0, 'var(--grid-container-margin)'), SCALES.mr(0, 'var(--grid-container-margin)'), SCALES.mb(0, 'var(--grid-container-margin)'), SCALES.ml(0, 'var(--grid-container-margin)')]]])
19292
- },
19293
- resolveClassName = _styles$className.className,
19294
- styles = _styles$className.styles;
19295
- var classes = useClasses(resolveClassName, className);
19296
- return /*#__PURE__*/React.createElement(GridBasicItem, _extends({
19297
- className: classes
19298
- }, props), children, styles);
19299
- };
19300
- GridContainerComponent.displayName = 'GridContainer';
19301
- var GridContainer = withScale(GridContainerComponent);
19036
+ var _useState = React.useState(''),
19037
+ _useState2 = _slicedToArray(_useState, 2),
19038
+ classes = _useState2[0],
19039
+ setClasses = _useState2[1];
19040
+ var _useState3 = React.useState(visible),
19041
+ _useState4 = _slicedToArray(_useState3, 2),
19042
+ renderable = _useState4[0],
19043
+ setRenderable = _useState4[1];
19044
+ React.useEffect(function () {
19045
+ var statusClassName = visible ? 'enter' : 'leave';
19046
+ var time = visible ? enterTime : leaveTime;
19047
+ if (visible && !renderable) {
19048
+ setRenderable(true);
19049
+ }
19050
+ setClasses("".concat(name, "-").concat(statusClassName));
19302
19051
 
19303
- Grid.Container = GridContainer;
19052
+ // set class to active
19053
+ var timer = setTimeout(function () {
19054
+ setClasses("".concat(name, "-").concat(statusClassName, " ").concat(name, "-").concat(statusClassName, "-active"));
19055
+ clearTimeout(timer);
19056
+ }, time);
19304
19057
 
19305
- var SelectIconClear = function SelectIconClear(_ref) {
19306
- var onClick = _ref.onClick;
19307
- var theme = useTheme();
19308
- var clickHandler = function clickHandler(event) {
19309
- event.preventDefault();
19310
- event.stopPropagation();
19311
- event.nativeEvent.stopImmediatePropagation();
19312
- onClick && onClick(event);
19313
- };
19314
- return /*#__PURE__*/React.createElement("div", {
19315
- onClick: clickHandler,
19316
- className: _JSXStyle.dynamic([["1984024521", [theme.palette.accents_3, theme.palette.foreground]]]) + " " + "clear-icon"
19317
- }, /*#__PURE__*/React.createElement("svg", {
19318
- viewBox: "0 0 24 24",
19319
- stroke: "currentColor",
19320
- strokeWidth: "1.5",
19321
- strokeLinecap: "round",
19322
- strokeLinejoin: "round",
19323
- fill: "none",
19324
- shapeRendering: "geometricPrecision",
19325
- className: _JSXStyle.dynamic([["1984024521", [theme.palette.accents_3, theme.palette.foreground]]])
19326
- }, /*#__PURE__*/React.createElement("path", {
19327
- d: "M18 6L6 18",
19328
- className: _JSXStyle.dynamic([["1984024521", [theme.palette.accents_3, theme.palette.foreground]]])
19329
- }), /*#__PURE__*/React.createElement("path", {
19330
- d: "M6 6l12 12",
19331
- className: _JSXStyle.dynamic([["1984024521", [theme.palette.accents_3, theme.palette.foreground]]])
19332
- })), /*#__PURE__*/React.createElement(_JSXStyle, {
19333
- id: "1984024521",
19334
- dynamic: [theme.palette.accents_3, theme.palette.foreground]
19335
- }, ".clear-icon.__jsx-style-dynamic-selector{padding:0 0 0 0.5em;margin:0;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;height:100%;cursor:pointer;box-sizing:border-box;-webkit-transition:color 150ms ease 0s;transition:color 150ms ease 0s;color:".concat(theme.palette.accents_3, ";visibility:visible;opacity:1;}.clear-icon.__jsx-style-dynamic-selector:hover{color:").concat(theme.palette.foreground, ";}svg.__jsx-style-dynamic-selector{color:currentColor;width:1em;height:1em;}")));
19058
+ // remove classess when animation over
19059
+ var clearClassesTimer = setTimeout(function () {
19060
+ if (!visible) {
19061
+ setClasses('');
19062
+ setRenderable(false);
19063
+ }
19064
+ clearTimeout(clearClassesTimer);
19065
+ }, time + clearTime);
19066
+ return function () {
19067
+ clearTimeout(timer);
19068
+ clearTimeout(clearClassesTimer);
19069
+ };
19070
+ }, [visible, renderable]);
19071
+ if (! /*#__PURE__*/React.isValidElement(children) || !renderable) return null;
19072
+ var propsTransition = _objectSpread2(_objectSpread2({}, props), {}, {
19073
+ className: "".concat(children.props.className, " ").concat(className, " ").concat(classes)
19074
+ });
19075
+ return /*#__PURE__*/React.cloneElement(children, propsTransition);
19336
19076
  };
19337
- var MemoSelectIconClear = /*#__PURE__*/React.memo(SelectIconClear);
19077
+ CssTransition.displayName = 'CssTransition';
19338
19078
 
19339
- var SelectMultipleValue = function SelectMultipleValue(_ref) {
19340
- var disabled = _ref.disabled,
19341
- onClear = _ref.onClear,
19342
- children = _ref.children;
19343
- var theme = useTheme();
19344
- return /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement("div", {
19345
- className: _JSXStyle.dynamic([["3357578496", [theme.layout.radius, theme.palette.accents_2, disabled ? theme.palette.accents_4 : theme.palette.accents_6]]]) + " " + "item"
19346
- }, children, !!onClear && /*#__PURE__*/React.createElement(MemoSelectIconClear, {
19347
- onClick: onClear
19348
- })), /*#__PURE__*/React.createElement(_JSXStyle, {
19349
- id: "3357578496",
19350
- dynamic: [theme.layout.radius, theme.palette.accents_2, disabled ? theme.palette.accents_4 : theme.palette.accents_6]
19351
- }, ".item.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;justify-items:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;line-height:1;padding:0 0.5em;font-size:var(--select-font-size);height:calc(var(--select-font-size) * 2);border-radius:".concat(theme.layout.radius, ";background-color:").concat(theme.palette.accents_2, ";color:").concat(disabled ? theme.palette.accents_4 : theme.palette.accents_6, ";}.item.__jsx-style-dynamic-selector>div:not(.clear-icon),.item.__jsx-style-dynamic-selector>div:not(.clear-icon):hover{border-radius:0;background-color:transparent;padding:0;margin:0;color:inherit;}")));
19079
+ /* "use client" */
19080
+
19081
+ var useClickAnyWhere = function useClickAnyWhere(handler) {
19082
+ React.useEffect(function () {
19083
+ var callback = function callback(event) {
19084
+ return handler(event);
19085
+ };
19086
+ document.addEventListener('click', callback);
19087
+ return function () {
19088
+ return document.removeEventListener('click', callback);
19089
+ };
19090
+ }, [handler]);
19352
19091
  };
19353
- SelectMultipleValue.displayName = 'GeistSelectMultipleValue';
19354
19092
 
19355
- var getColors$2 = function getColors(palette, status) {
19356
- var colors = {
19357
- "default": {
19358
- border: palette.border,
19359
- borderActive: palette.foreground,
19360
- iconBorder: palette.accents_5,
19361
- placeholderColor: palette.accents_3
19362
- },
19363
- secondary: {
19364
- border: palette.border,
19365
- borderActive: palette.foreground,
19366
- iconBorder: palette.accents_5,
19367
- placeholderColor: palette.accents_3
19368
- },
19369
- success: {
19370
- border: palette.successLight,
19371
- borderActive: palette.successDark,
19372
- iconBorder: palette.success,
19373
- placeholderColor: palette.accents_3
19374
- },
19375
- warning: {
19376
- border: palette.warningLight,
19377
- borderActive: palette.warningDark,
19378
- iconBorder: palette.warning,
19379
- placeholderColor: palette.accents_3
19380
- },
19381
- error: {
19382
- border: palette.errorLight,
19383
- borderActive: palette.errorDark,
19384
- iconBorder: palette.error,
19385
- placeholderColor: palette.error
19386
- }
19093
+ /* "use client" */
19094
+
19095
+ var useDOMObserver = function useDOMObserver(ref) {
19096
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
19097
+ var config = {
19098
+ attributes: false,
19099
+ childList: true,
19100
+ subtree: true
19387
19101
  };
19388
- if (!status) return colors["default"];
19389
- return colors[status];
19102
+ React.useEffect(function () {
19103
+ if (!ref || !ref.current) return;
19104
+ var unmount = false;
19105
+ var done = function done() {
19106
+ if (unmount) return;
19107
+ callback.apply(undefined, arguments);
19108
+ };
19109
+ var observer = new MutationObserver(done);
19110
+ observer.observe(ref.current, config);
19111
+ return function () {
19112
+ unmount = true;
19113
+ observer.disconnect();
19114
+ };
19115
+ }, [ref]);
19390
19116
  };
19391
19117
 
19392
- var Ellipsis = function Ellipsis(_ref) {
19393
- var children = _ref.children,
19394
- height = _ref.height;
19395
- return /*#__PURE__*/React.createElement("span", {
19396
- className: _JSXStyle.dynamic([["822089635", [height]]])
19397
- }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
19398
- id: "822089635",
19399
- dynamic: [height]
19400
- }, "span.__jsx-style-dynamic-selector{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:".concat(height, ";min-width:0;}")));
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);
19401
19129
  };
19402
- var Ellipsis$1 = /*#__PURE__*/React.memo(Ellipsis);
19403
19130
 
19404
- var SelectInput = /*#__PURE__*/React.forwardRef(function (_ref, inputRef) {
19405
- var visible = _ref.visible,
19406
- onBlur = _ref.onBlur,
19407
- onFocus = _ref.onFocus;
19408
- var ref = React.useRef(null);
19409
- React.useImperativeHandle(inputRef, function () {
19410
- return ref.current;
19131
+ var getElementOffset = function getElementOffset(el) {
19132
+ if (!el) return {
19133
+ top: 0,
19134
+ left: 0
19135
+ };
19136
+ var _el$getBoundingClient = el.getBoundingClientRect(),
19137
+ top = _el$getBoundingClient.top,
19138
+ left = _el$getBoundingClient.left;
19139
+ return {
19140
+ top: top,
19141
+ left: left
19142
+ };
19143
+ };
19144
+ var defaultRect$2 = {
19145
+ top: -1e3,
19146
+ left: -1e3,
19147
+ right: -1e3,
19148
+ width: 0,
19149
+ height: 0,
19150
+ elementTop: -1e3
19151
+ };
19152
+ var getRectFromDOMWithContainer = function getRectFromDOMWithContainer(domRect, getContainer) {
19153
+ if (!domRect) return defaultRect$2;
19154
+ var container = getContainer ? getContainer() : null;
19155
+ var scrollElement = container || document.documentElement;
19156
+ var _getElementOffset = getElementOffset(container),
19157
+ offsetTop = _getElementOffset.top,
19158
+ offsetLeft = _getElementOffset.left;
19159
+ return _objectSpread2(_objectSpread2({}, domRect), {}, {
19160
+ width: domRect.width || domRect.right - domRect.left,
19161
+ height: domRect.height || domRect.top - domRect.bottom,
19162
+ top: domRect.bottom + scrollElement.scrollTop - offsetTop,
19163
+ left: domRect.left + scrollElement.scrollLeft - offsetLeft,
19164
+ elementTop: domRect.top + scrollElement.scrollTop - offsetTop
19411
19165
  });
19412
- React.useEffect(function () {
19413
- if (visible) {
19414
- var _ref$current;
19415
- (_ref$current = ref.current) === null || _ref$current === undefined || _ref$current.focus();
19416
- }
19417
- }, [visible]);
19418
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", {
19419
- ref: ref,
19420
- type: "search",
19421
- role: "combobox",
19422
- "aria-haspopup": "listbox",
19423
- readOnly: true,
19424
- unselectable: "on",
19425
- "aria-expanded": visible,
19426
- onBlur: onBlur,
19427
- onFocus: onFocus,
19428
- className: "jsx-2813108835"
19429
- }), /*#__PURE__*/React.createElement(_JSXStyle, {
19430
- id: "2813108835"
19431
- }, "input.jsx-2813108835{position:fixed;top:-10000px;left:-10000px;opacity:0;z-index:-1;width:0;height:0;padding:0;font-size:0;border:none;}"));
19432
- });
19433
- SelectInput.displayName = 'GeistSelectInput';
19166
+ };
19167
+ var getRefRect = function getRefRect(ref, getContainer) {
19168
+ if (!ref || !ref.current) return defaultRect$2;
19169
+ var rect = ref.current.getBoundingClientRect();
19170
+ return getRectFromDOMWithContainer(rect, getContainer);
19171
+ };
19434
19172
 
19435
- var _excluded$9 = ["children", "label", "type", "disabled", "initialValue", "value", "icon", "onChange", "pure", "multiple", "clearable", "placeholder", "className", "dropdownClassName", "dropdownStyle", "disableMatchWidth", "getPopupContainer", "onDropdownVisibleChange"];
19436
- var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
19173
+ var defaultRect$1 = {
19174
+ top: -1e3,
19175
+ left: -1e3,
19176
+ right: -1e3,
19177
+ width: 0
19178
+ };
19179
+ var Dropdown = /*#__PURE__*/React.memo(function (_ref) {
19437
19180
  var children = _ref.children,
19438
- label = _ref.label,
19439
- _ref$type = _ref.type,
19440
- type = _ref$type === undefined ? 'default' : _ref$type,
19441
- _ref$disabled = _ref.disabled,
19442
- disabled = _ref$disabled === undefined ? false : _ref$disabled,
19443
- init = _ref.initialValue,
19444
- customValue = _ref.value,
19445
- _ref$icon = _ref.icon,
19446
- Icon = _ref$icon === undefined ? SelectIcon : _ref$icon,
19447
- onChange = _ref.onChange,
19448
- _ref$pure = _ref.pure,
19449
- pure = _ref$pure === undefined ? false : _ref$pure,
19450
- _ref$multiple = _ref.multiple,
19451
- multiple = _ref$multiple === undefined ? false : _ref$multiple,
19452
- _ref$clearable = _ref.clearable,
19453
- clearable = _ref$clearable === undefined ? true : _ref$clearable,
19454
- placeholder = _ref.placeholder,
19455
- _ref$className = _ref.className,
19456
- className = _ref$className === undefined ? '' : _ref$className,
19457
- dropdownClassName = _ref.dropdownClassName,
19458
- dropdownStyle = _ref.dropdownStyle,
19459
- _ref$disableMatchWidt = _ref.disableMatchWidth,
19460
- disableMatchWidth = _ref$disableMatchWidt === undefined ? false : _ref$disableMatchWidt,
19461
- getPopupContainer = _ref.getPopupContainer,
19462
- _ref$onDropdownVisibl = _ref.onDropdownVisibleChange,
19463
- onDropdownVisibleChange = _ref$onDropdownVisibl === undefined ? function () {} : _ref$onDropdownVisibl,
19464
- props = _objectWithoutProperties(_ref, _excluded$9);
19465
- var theme = useTheme();
19466
- var _useScale = useScale(),
19467
- SCALES = _useScale.SCALES;
19468
- var ref = React.useRef(null);
19469
- var inputRef = React.useRef(null);
19470
- var dropdownRef = React.useRef(null);
19471
- var _useState = React.useState(false),
19181
+ parent = _ref.parent,
19182
+ visible = _ref.visible,
19183
+ disableMatchWidth = _ref.disableMatchWidth,
19184
+ getPopupContainer = _ref.getPopupContainer;
19185
+ var el = usePortal('dropdown', getPopupContainer);
19186
+ var _useState = React.useState(defaultRect$1),
19472
19187
  _useState2 = _slicedToArray(_useState, 2),
19473
- visible = _useState2[0],
19474
- setVisible = _useState2[1];
19475
- var _useState3 = React.useState(false),
19476
- _useState4 = _slicedToArray(_useState3, 2),
19477
- selectFocus = _useState4[0],
19478
- setSelectFocus = _useState4[1];
19479
- var _useCurrentState = useCurrentState(function () {
19480
- if (!multiple) return init;
19481
- if (Array.isArray(init)) return init;
19482
- return typeof init === 'undefined' ? [] : [init];
19483
- }),
19484
- _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
19485
- value = _useCurrentState2[0],
19486
- setValue = _useCurrentState2[1],
19487
- valueRef = _useCurrentState2[2];
19488
- var isEmpty = React.useMemo(function () {
19489
- if (!Array.isArray(value)) return !value;
19490
- return value.length === 0;
19491
- }, [value]);
19492
- var _useMemo = React.useMemo(function () {
19493
- return getColors$2(theme.palette, type);
19494
- }, [theme.palette, type]),
19495
- border = _useMemo.border,
19496
- borderActive = _useMemo.borderActive,
19497
- iconBorder = _useMemo.iconBorder,
19498
- placeholderColor = _useMemo.placeholderColor;
19499
- var updateVisible = function updateVisible(next) {
19500
- onDropdownVisibleChange(next);
19501
- setVisible(next);
19502
- };
19503
- var updateValue = function updateValue(next) {
19504
- setValue(function (last) {
19505
- if (!Array.isArray(last)) return next;
19506
- if (!last.includes(next)) return [].concat(_toConsumableArray(last), [next]);
19507
- return last.filter(function (item) {
19508
- return item !== next;
19509
- });
19188
+ rect = _useState2[0],
19189
+ setRect = _useState2[1];
19190
+ var classes = useClasses('dropdown', disableMatchWidth ? 'disable-match' : 'width-match');
19191
+ if (!parent) return null;
19192
+
19193
+ /* istanbul ignore next */
19194
+ if (process.env.NODE_ENV !== 'production') {
19195
+ if (getPopupContainer && getPopupContainer()) {
19196
+ var _el = getPopupContainer();
19197
+ var style = window.getComputedStyle(_el);
19198
+ if (style.position === 'static') {
19199
+ useWarning('The element specified by "getPopupContainer" must have "position" set.');
19200
+ }
19201
+ }
19202
+ }
19203
+ var updateRect = function updateRect() {
19204
+ var _getRefRect = getRefRect(parent, getPopupContainer),
19205
+ top = _getRefRect.top,
19206
+ left = _getRefRect.left,
19207
+ right = _getRefRect.right,
19208
+ nativeWidth = _getRefRect.width;
19209
+ setRect({
19210
+ top: top,
19211
+ left: left,
19212
+ right: right,
19213
+ width: nativeWidth
19510
19214
  });
19511
- onChange && onChange(valueRef.current);
19512
- if (!multiple) {
19513
- updateVisible(false);
19514
- }
19515
19215
  };
19516
- var initialValue = React.useMemo(function () {
19517
- return {
19518
- value: value,
19519
- visible: visible,
19520
- updateValue: updateValue,
19521
- updateVisible: updateVisible,
19522
- ref: ref,
19523
- disableAll: disabled
19216
+ useResize(updateRect);
19217
+ useClickAnyWhere(function () {
19218
+ var _getRefRect2 = getRefRect(parent, getPopupContainer),
19219
+ top = _getRefRect2.top,
19220
+ left = _getRefRect2.left;
19221
+ var shouldUpdatePosition = top !== rect.top || left !== rect.left;
19222
+ if (!shouldUpdatePosition) return;
19223
+ updateRect();
19224
+ });
19225
+ useDOMObserver(parent, function () {
19226
+ updateRect();
19227
+ });
19228
+ React.useEffect(function () {
19229
+ if (!parent || !parent.current) return;
19230
+ parent.current.addEventListener('mouseenter', updateRect);
19231
+ /* istanbul ignore next */
19232
+ return function () {
19233
+ if (!parent || !parent.current) return;
19234
+ parent.current.removeEventListener('mouseenter', updateRect);
19524
19235
  };
19525
- }, [visible, disabled, ref, value, multiple]);
19236
+ }, [parent]);
19526
19237
  var clickHandler = function clickHandler(event) {
19527
19238
  event.stopPropagation();
19528
19239
  event.nativeEvent.stopImmediatePropagation();
19529
19240
  event.preventDefault();
19530
- if (disabled) return;
19531
- updateVisible(!visible);
19532
- event.preventDefault();
19533
19241
  };
19534
19242
  var mouseDownHandler = function mouseDownHandler(event) {
19535
- /* istanbul ignore next */
19536
- if (visible) {
19537
- event.preventDefault();
19538
- }
19539
- };
19540
- React.useEffect(function () {
19541
- if (customValue === undefined) return;
19542
- setValue(customValue);
19543
- }, [customValue]);
19544
- React.useImperativeHandle(selectRef, function () {
19545
- return {
19546
- focus: function focus() {
19547
- var _inputRef$current;
19548
- return (_inputRef$current = inputRef.current) === null || _inputRef$current === undefined ? undefined : _inputRef$current.focus();
19549
- },
19550
- blur: function blur() {
19551
- var _inputRef$current2;
19552
- return (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === undefined ? undefined : _inputRef$current2.blur();
19553
- },
19554
- scrollTo: function scrollTo(options) {
19555
- var _dropdownRef$current;
19556
- return (_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === undefined ? undefined : _dropdownRef$current.scrollTo(options);
19557
- }
19558
- };
19559
- }, [inputRef, dropdownRef]);
19560
- var selectedChild = React.useMemo(function () {
19561
- var _pickChildByProps = pickChildByProps(children, 'value', value),
19562
- _pickChildByProps2 = _slicedToArray(_pickChildByProps, 2),
19563
- optionChildren = _pickChildByProps2[1];
19564
- return React.Children.map(optionChildren, function (child) {
19565
- if (! /*#__PURE__*/React.isValidElement(child)) return null;
19566
- var el = /*#__PURE__*/React.cloneElement(child); // { preventAllEvents: true }
19567
- if (!multiple) return el;
19568
- return /*#__PURE__*/React.createElement(SelectMultipleValue, {
19569
- disabled: disabled,
19570
- onClear: clearable ? function () {
19571
- return updateValue(child.props.value);
19572
- } : null
19573
- }, el);
19574
- });
19575
- }, [value, children, multiple]);
19576
- var onInputBlur = function onInputBlur() {
19577
- updateVisible(false);
19578
- setSelectFocus(false);
19243
+ event.preventDefault();
19579
19244
  };
19580
- var classes = useClasses('select', {
19581
- active: selectFocus || visible,
19582
- multiple: multiple
19583
- }, className);
19584
- return /*#__PURE__*/React.createElement("div", {
19585
- className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]])
19586
- }, label && /*#__PURE__*/React.createElement("label", {
19587
- style: {
19588
- display: 'block',
19589
- marginBottom: '0.4rem',
19590
- fontSize: '14px',
19591
- fontWeight: 'light'
19592
- },
19593
- className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]])
19594
- }, label), /*#__PURE__*/React.createElement(SelectContext.Provider, {
19595
- value: initialValue
19596
- }, /*#__PURE__*/React.createElement("div", _extends({
19597
- ref: ref,
19245
+ if (!el) return null;
19246
+ return /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/React.createElement(CssTransition, {
19247
+ visible: visible
19248
+ }, /*#__PURE__*/React.createElement("div", {
19598
19249
  onClick: clickHandler,
19599
- onMouseDown: mouseDownHandler
19600
- }, props, {
19601
- className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]]) + " " + (props && props.className != null && props.className || classes || "")
19602
- }), /*#__PURE__*/React.createElement(SelectInput, {
19603
- ref: inputRef,
19604
- visible: visible,
19605
- onBlur: onInputBlur,
19606
- onFocus: function onFocus() {
19607
- return setSelectFocus(true);
19608
- }
19609
- }), isEmpty && /*#__PURE__*/React.createElement("span", {
19610
- className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]]) + " " + "value placeholder"
19611
- }, /*#__PURE__*/React.createElement(Ellipsis$1, {
19612
- height: "var(--select-height)"
19613
- }, placeholder)), value && !multiple && /*#__PURE__*/React.createElement("span", {
19614
- className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]]) + " " + "value"
19615
- }, selectedChild), value && multiple && /*#__PURE__*/React.createElement(Grid.Container, {
19616
- gap: 0.5
19617
- }, selectedChild), /*#__PURE__*/React.createElement(SelectDropdown, {
19618
- ref: dropdownRef,
19619
- visible: visible,
19620
- className: dropdownClassName,
19621
- dropdownStyle: dropdownStyle,
19622
- disableMatchWidth: disableMatchWidth,
19623
- getPopupContainer: getPopupContainer
19624
- }, children), !pure && /*#__PURE__*/React.createElement("div", {
19625
- className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]]) + " " + "icon"
19626
- }, /*#__PURE__*/React.createElement(Icon, {
19627
- className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]])
19628
- })))), /*#__PURE__*/React.createElement(_JSXStyle, {
19629
- id: "3282295248",
19630
- dynamic: [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]
19631
- }, ".select.__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;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;position:relative;cursor:".concat(disabled ? 'not-allowed' : 'pointer', ";max-width:90vw;overflow:hidden;-webkit-transition:border 150ms ease-in 0s,color 200ms ease-out 0s, box-shadow 200ms ease 0s;transition:border 150ms ease-in 0s,color 200ms ease-out 0s, box-shadow 200ms ease 0s;border:1px solid ").concat(border, ";border-radius:").concat(theme.layout.radius, ";background-color:").concat(disabled ? theme.palette.accents_1 : theme.palette.background, ";--select-font-size:").concat(SCALES.font(0.875), ";--select-height:").concat(SCALES.height(2.25), ";min-width:11.5em;width:").concat(SCALES.width(1, 'initial'), ";height:var(--select-height);padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0.334), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0.667), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.multiple.__jsx-style-dynamic-selector{height:auto;min-height:var(--select-height);padding:").concat(SCALES.pt(0.334), " ").concat(SCALES.pr(0.334), " ").concat(SCALES.pb(0.334), " ").concat(SCALES.pl(0.667), ";}.select.active.__jsx-style-dynamic-selector,.select.__jsx-style-dynamic-selector:hover{border-color:").concat(disabled ? theme.palette.border : borderActive, ";}.select.active.icon.__jsx-style-dynamic-selector,.select.__jsx-style-dynamic-selector:hover .icon.__jsx-style-dynamic-selector{color:").concat(disabled ? theme.palette.accents_5 : borderActive, ";}.value.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex:1;-ms-flex:1;flex:1;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;line-height:1;padding:0;margin-right:1.25em;font-size:var(--select-font-size);color:").concat(disabled ? theme.palette.accents_4 : theme.palette.foreground, ";width:calc(100% - 1.25em);}.value.__jsx-style-dynamic-selector>div,.value.__jsx-style-dynamic-selector>div:hover{border-radius:0;background-color:transparent;padding:0;margin:0;color:inherit;}.placeholder.__jsx-style-dynamic-selector{color:").concat(placeholderColor, ";}.icon.__jsx-style-dynamic-selector{position:absolute;right:").concat(theme.layout.gapQuarter, ";font-size:var(--select-font-size);top:50%;bottom:0;-webkit-transform:translateY(-50%) rotate(").concat(visible ? '180' : '0', "deg);-ms-transform:translateY(-50%) rotate(").concat(visible ? '180' : '0', "deg);transform:translateY(-50%) rotate(").concat(visible ? '180' : '0', "deg);pointer-events:none;-webkit-transition:-webkit-transform 200ms ease;-webkit-transition:transform 200ms ease;transition:transform 200ms ease;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;color:").concat(iconBorder, ";}")));
19250
+ onMouseDown: mouseDownHandler,
19251
+ className: _JSXStyle.dynamic([["1644673105", [rect.top + 2, rect.left, rect.width, rect.width]]]) + " " + (classes || "")
19252
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
19253
+ id: "1644673105",
19254
+ dynamic: [rect.top + 2, rect.left, rect.width, rect.width]
19255
+ }, ".dropdown.__jsx-style-dynamic-selector{position:absolute;top:".concat(rect.top + 2, "px;left:").concat(rect.left, "px;z-index:1100;}.width-match.__jsx-style-dynamic-selector{width:").concat(rect.width, "px;}.disable-match.__jsx-style-dynamic-selector{min-width:").concat(rect.width, "px;}")))), el);
19632
19256
  });
19633
- SelectComponent.displayName = 'Select';
19634
- var Select = withScale(SelectComponent);
19635
19257
 
19636
- var _excluded$8 = ["value", "className", "children", "disabled", "divider", "label", "preventAllEvents"];
19637
- var SelectOptionComponent = function SelectOptionComponent(_ref) {
19638
- var identValue = _ref.value,
19258
+ var SelectDropdown = /*#__PURE__*/React.forwardRef(function (_ref, dropdownRef) {
19259
+ var visible = _ref.visible,
19260
+ children = _ref.children,
19639
19261
  _ref$className = _ref.className,
19640
19262
  className = _ref$className === undefined ? '' : _ref$className,
19641
- children = _ref.children,
19642
- _ref$disabled = _ref.disabled,
19643
- disabled = _ref$disabled === undefined ? false : _ref$disabled,
19644
- _ref$divider = _ref.divider,
19645
- divider = _ref$divider === undefined ? false : _ref$divider,
19646
- _ref$label = _ref.label,
19647
- label = _ref$label === undefined ? false : _ref$label,
19648
- _ref$preventAllEvents = _ref.preventAllEvents,
19649
- preventAllEvents = _ref$preventAllEvents === undefined ? false : _ref$preventAllEvents,
19650
- props = _objectWithoutProperties(_ref, _excluded$8);
19263
+ _ref$dropdownStyle = _ref.dropdownStyle,
19264
+ dropdownStyle = _ref$dropdownStyle === undefined ? {} : _ref$dropdownStyle,
19265
+ disableMatchWidth = _ref.disableMatchWidth,
19266
+ getPopupContainer = _ref.getPopupContainer;
19651
19267
  var theme = useTheme();
19652
- var _useScale = useScale(),
19653
- SCALES = _useScale.SCALES;
19268
+ var internalDropdownRef = React.useRef(null);
19654
19269
  var _useSelectContext = useSelectContext(),
19655
- updateValue = _useSelectContext.updateValue,
19656
- value = _useSelectContext.value,
19657
- disableAll = _useSelectContext.disableAll;
19658
- var isDisabled = React.useMemo(function () {
19659
- return disabled || disableAll;
19660
- }, [disabled, disableAll]);
19661
- var isLabel = React.useMemo(function () {
19662
- return label || divider;
19663
- }, [label, divider]);
19664
- var classes = useClasses('option', {
19665
- divider: divider,
19666
- label: label
19667
- }, className);
19668
- if (!isLabel && identValue === undefined) {
19669
- useWarning('The props "value" is required.', 'Select Option');
19270
+ ref = _useSelectContext.ref;
19271
+ var classes = useClasses('select-dropdown', className);
19272
+ React.useImperativeHandle(dropdownRef, function () {
19273
+ return internalDropdownRef.current;
19274
+ });
19275
+ return /*#__PURE__*/React.createElement(Dropdown, {
19276
+ parent: ref,
19277
+ visible: visible,
19278
+ disableMatchWidth: disableMatchWidth,
19279
+ getPopupContainer: getPopupContainer
19280
+ }, /*#__PURE__*/React.createElement("div", {
19281
+ ref: internalDropdownRef,
19282
+ style: dropdownStyle,
19283
+ className: _JSXStyle.dynamic([["2782510679", [theme.layout.radius, theme.expressiveness.shadowLarge, theme.palette.background]]]) + " " + (classes || "")
19284
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
19285
+ id: "2782510679",
19286
+ dynamic: [theme.layout.radius, theme.expressiveness.shadowLarge, theme.palette.background]
19287
+ }, ".select-dropdown.__jsx-style-dynamic-selector{border-radius:".concat(theme.layout.radius, ";box-shadow:").concat(theme.expressiveness.shadowLarge, ";background-color:").concat(theme.palette.background, ";max-height:17em;overflow-y:auto;overflow-anchor:none;padding:0.38em 0;-webkit-scroll-behavior:smooth;-moz-scroll-behavior:smooth;-ms-scroll-behavior:smooth;scroll-behavior:smooth;}"))));
19288
+ });
19289
+ SelectDropdown.displayName = 'SelectDropdown';
19290
+
19291
+ var _excluded$9 = ["xs", "sm", "md", "lg", "xl", "justify", "direction", "alignItems", "alignContent", "children", "className"];
19292
+ var getItemLayout = function getItemLayout(val) {
19293
+ var display = val === 0 ? 'display: none;' : 'display: inherit;';
19294
+ if (typeof val === 'number') {
19295
+ var width = 100 / 24 * val;
19296
+ var ratio = width > 100 ? '100%' : width < 0 ? '0' : "".concat(width, "%");
19297
+ return {
19298
+ grow: 0,
19299
+ display: display,
19300
+ width: ratio,
19301
+ basis: ratio
19302
+ };
19670
19303
  }
19671
- var selected = React.useMemo(function () {
19672
- if (!value) return false;
19673
- if (typeof value === 'string') {
19674
- return identValue === value;
19675
- }
19676
- return value.includes("".concat(identValue));
19677
- }, [identValue, value]);
19678
- var bgColor = React.useMemo(function () {
19679
- if (isDisabled) return theme.palette.accents_1;
19680
- return selected ? theme.palette.accents_2 : theme.palette.background;
19681
- }, [selected, isDisabled, theme.palette]);
19682
- var hoverBgColor = React.useMemo(function () {
19683
- if (isDisabled || isLabel || selected) return bgColor;
19684
- return theme.palette.accents_1;
19685
- }, [selected, isDisabled, theme.palette, isLabel, bgColor]);
19686
- var color = React.useMemo(function () {
19687
- if (isDisabled) return theme.palette.accents_4;
19688
- return selected ? theme.palette.foreground : theme.palette.accents_5;
19689
- }, [selected, isDisabled, theme.palette]);
19690
- var clickHandler = function clickHandler(event) {
19691
- if (preventAllEvents) return;
19692
- event.stopPropagation();
19693
- event.nativeEvent.stopImmediatePropagation();
19694
- event.preventDefault();
19695
- if (isDisabled || isLabel) return;
19696
- updateValue && updateValue(identValue);
19697
- };
19698
- return /*#__PURE__*/React.createElement("div", _extends({
19699
- onClick: clickHandler
19700
- }, props, {
19701
- className: _JSXStyle.dynamic([["199367556", [bgColor, color, isDisabled ? 'not-allowed' : 'pointer', SCALES.font(0.75), SCALES.width(1, '100%'), SCALES.height(2.25), SCALES.pt(0), SCALES.pr(0.667), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hoverBgColor, theme.palette.accents_7, theme.palette.border, SCALES.width(1, '100%'), SCALES.height(1, 0), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0.5), SCALES.mr(0), SCALES.mb(0.5), SCALES.ml(0), theme.palette.accents_7, theme.palette.border, SCALES.font(0.875), SCALES.width(1, '100%')]]]) + " " + (props && props.className != null && props.className || classes || "")
19702
- }), /*#__PURE__*/React.createElement(Ellipsis$1, {
19703
- height: SCALES.height(2.25)
19704
- }, children), /*#__PURE__*/React.createElement(_JSXStyle, {
19705
- id: "199367556",
19706
- dynamic: [bgColor, color, isDisabled ? 'not-allowed' : 'pointer', SCALES.font(0.75), SCALES.width(1, '100%'), SCALES.height(2.25), SCALES.pt(0), SCALES.pr(0.667), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hoverBgColor, theme.palette.accents_7, theme.palette.border, SCALES.width(1, '100%'), SCALES.height(1, 0), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0.5), SCALES.mr(0), SCALES.mb(0.5), SCALES.ml(0), theme.palette.accents_7, theme.palette.border, SCALES.font(0.875), SCALES.width(1, '100%')]
19707
- }, ".option.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;max-width:100%;box-sizing:border-box;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-weight:normal;background-color:".concat(bgColor, ";color:").concat(color, ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:0;cursor:").concat(isDisabled ? 'not-allowed' : 'pointer', ";-webkit-transition:background 0.2s ease 0s,border-color 0.2s ease 0s;transition:background 0.2s ease 0s,border-color 0.2s ease 0s;--select-font-size:").concat(SCALES.font(0.75), ";font-size:var(--select-font-size);width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(2.25), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0.667), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0.667), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.option.__jsx-style-dynamic-selector:hover{background-color:").concat(hoverBgColor, ";color:").concat(theme.palette.accents_7, ";}.divider.__jsx-style-dynamic-selector{line-height:0;overflow:hidden;border-top:1px solid ").concat(theme.palette.border, ";width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, 0), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0.5), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0.5), " ").concat(SCALES.ml(0), ";}.label.__jsx-style-dynamic-selector{color:").concat(theme.palette.accents_7, ";border-bottom:1px solid ").concat(theme.palette.border, ";text-transform:capitalize;cursor:default;font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, '100%'), ";font-weight:500;}")));
19304
+ return {
19305
+ grow: 1,
19306
+ display: display,
19307
+ width: '100%',
19308
+ basis: '0'
19309
+ };
19708
19310
  };
19709
- SelectOptionComponent.displayName = 'SelectOption';
19710
- var SelectOption = withScale(SelectOptionComponent);
19711
-
19712
- Select.Option = SelectOption;
19713
-
19714
- var InputLabel = function InputLabel(_ref) {
19715
- var children = _ref.children,
19716
- isRight = _ref.isRight;
19311
+ var GridBasicItem = function GridBasicItem(_ref) {
19312
+ var _ref$xs = _ref.xs,
19313
+ xs = _ref$xs === undefined ? false : _ref$xs,
19314
+ _ref$sm = _ref.sm,
19315
+ sm = _ref$sm === undefined ? false : _ref$sm,
19316
+ _ref$md = _ref.md,
19317
+ md = _ref$md === undefined ? false : _ref$md,
19318
+ _ref$lg = _ref.lg,
19319
+ lg = _ref$lg === undefined ? false : _ref$lg,
19320
+ _ref$xl = _ref.xl,
19321
+ xl = _ref$xl === undefined ? false : _ref$xl,
19322
+ justify = _ref.justify,
19323
+ direction = _ref.direction,
19324
+ alignItems = _ref.alignItems,
19325
+ alignContent = _ref.alignContent,
19326
+ children = _ref.children,
19327
+ _ref$className = _ref.className,
19328
+ className = _ref$className === undefined ? '' : _ref$className,
19329
+ props = _objectWithoutProperties(_ref, _excluded$9);
19717
19330
  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, ";}")));
19331
+ var _useScale = useScale(),
19332
+ SCALES = _useScale.SCALES;
19333
+ var classes = React.useMemo(function () {
19334
+ var aligns = {
19335
+ justify: justify,
19336
+ direction: direction,
19337
+ alignItems: alignItems,
19338
+ alignContent: alignContent,
19339
+ xs: xs,
19340
+ sm: sm,
19341
+ md: md,
19342
+ lg: lg,
19343
+ xl: xl
19344
+ };
19345
+ var classString = Object.keys(aligns).reduce(function (pre, name) {
19346
+ if (aligns[name] !== undefined && aligns[name] !== false) return "".concat(pre, " ").concat(name);
19347
+ return pre;
19348
+ }, '');
19349
+ return classString.trim();
19350
+ }, [justify, direction, alignItems, alignContent, xs, sm, md, lg, xl]);
19351
+ var layout = React.useMemo(function () {
19352
+ return {
19353
+ xs: getItemLayout(xs),
19354
+ sm: getItemLayout(sm),
19355
+ md: getItemLayout(md),
19356
+ lg: getItemLayout(lg),
19357
+ xl: getItemLayout(xl)
19358
+ };
19359
+ }, [xs, sm, md, lg, xl]);
19360
+ return /*#__PURE__*/React.createElement("div", _extends({}, props, {
19361
+ className: _JSXStyle.dynamic([["568430467", [SCALES.font(1, 'inherit'), SCALES.height(1, 'auto'), justify, direction, alignContent, alignItems, layout.xs.grow, layout.xs.width, layout.xs.basis, layout.xs.display, theme.breakpoints.sm.min, layout.sm.grow, layout.sm.width, layout.sm.basis, layout.sm.display, theme.breakpoints.md.min, layout.md.grow, layout.md.width, layout.md.basis, layout.md.display, theme.breakpoints.lg.min, layout.lg.grow, layout.lg.width, layout.lg.basis, layout.lg.display, theme.breakpoints.xl.min, layout.xl.grow, layout.xl.width, layout.xl.basis, layout.xl.display]]]) + " " + (props && props.className != null && props.className || useClasses('item', classes, className) || "")
19362
+ }), children, /*#__PURE__*/React.createElement(_JSXStyle, {
19363
+ id: "568430467",
19364
+ dynamic: [SCALES.font(1, 'inherit'), SCALES.height(1, 'auto'), justify, direction, alignContent, alignItems, layout.xs.grow, layout.xs.width, layout.xs.basis, layout.xs.display, theme.breakpoints.sm.min, layout.sm.grow, layout.sm.width, layout.sm.basis, layout.sm.display, theme.breakpoints.md.min, layout.md.grow, layout.md.width, layout.md.basis, layout.md.display, theme.breakpoints.lg.min, layout.lg.grow, layout.lg.width, layout.lg.basis, layout.lg.display, theme.breakpoints.xl.min, layout.xl.grow, layout.xl.width, layout.xl.basis, layout.xl.display]
19365
+ }, ".item.__jsx-style-dynamic-selector{font-size:".concat(SCALES.font(1, 'inherit'), ";height:").concat(SCALES.height(1, 'auto'), ";}.justify.__jsx-style-dynamic-selector{-webkit-box-pack:").concat(justify, ";-webkit-justify-content:").concat(justify, ";-ms-flex-pack:").concat(justify, ";justify-content:").concat(justify, ";}.direction.__jsx-style-dynamic-selector{-webkit-flex-direction:").concat(direction, ";-ms-flex-direction:").concat(direction, ";flex-direction:").concat(direction, ";}.alignContent.__jsx-style-dynamic-selector{-webkit-align-content:").concat(alignContent, ";-ms-flex-line-pack:").concat(alignContent, ";align-content:").concat(alignContent, ";}.alignItems.__jsx-style-dynamic-selector{-webkit-align-items:").concat(alignItems, ";-webkit-box-align:").concat(alignItems, ";-ms-flex-align:").concat(alignItems, ";align-items:").concat(alignItems, ";}.xs.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.xs.grow, ";-webkit-flex-grow:").concat(layout.xs.grow, ";-ms-flex-positive:").concat(layout.xs.grow, ";flex-grow:").concat(layout.xs.grow, ";max-width:").concat(layout.xs.width, ";-webkit-flex-basis:").concat(layout.xs.basis, ";-ms-flex-preferred-size:").concat(layout.xs.basis, ";flex-basis:").concat(layout.xs.basis, ";").concat(layout.xs.display, ";}@media only screen and (min-width:").concat(theme.breakpoints.sm.min, "){.sm.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.sm.grow, ";-webkit-flex-grow:").concat(layout.sm.grow, ";-ms-flex-positive:").concat(layout.sm.grow, ";flex-grow:").concat(layout.sm.grow, ";max-width:").concat(layout.sm.width, ";-webkit-flex-basis:").concat(layout.sm.basis, ";-ms-flex-preferred-size:").concat(layout.sm.basis, ";flex-basis:").concat(layout.sm.basis, ";").concat(layout.sm.display, ";}}@media only screen and (min-width:").concat(theme.breakpoints.md.min, "){.md.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.md.grow, ";-webkit-flex-grow:").concat(layout.md.grow, ";-ms-flex-positive:").concat(layout.md.grow, ";flex-grow:").concat(layout.md.grow, ";max-width:").concat(layout.md.width, ";-webkit-flex-basis:").concat(layout.md.basis, ";-ms-flex-preferred-size:").concat(layout.md.basis, ";flex-basis:").concat(layout.md.basis, ";").concat(layout.md.display, ";}}@media only screen and (min-width:").concat(theme.breakpoints.lg.min, "){.lg.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.lg.grow, ";-webkit-flex-grow:").concat(layout.lg.grow, ";-ms-flex-positive:").concat(layout.lg.grow, ";flex-grow:").concat(layout.lg.grow, ";max-width:").concat(layout.lg.width, ";-webkit-flex-basis:").concat(layout.lg.basis, ";-ms-flex-preferred-size:").concat(layout.lg.basis, ";flex-basis:").concat(layout.lg.basis, ";").concat(layout.lg.display, ";}}@media only screen and (min-width:").concat(theme.breakpoints.xl.min, "){.xl.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.xl.grow, ";-webkit-flex-grow:").concat(layout.xl.grow, ";-ms-flex-positive:").concat(layout.xl.grow, ";flex-grow:").concat(layout.xl.grow, ";max-width:").concat(layout.xl.width, ";-webkit-flex-basis:").concat(layout.xl.basis, ";-ms-flex-preferred-size:").concat(layout.xl.basis, ";flex-basis:").concat(layout.xl.basis, ";").concat(layout.xl.display, ";}}")));
19724
19366
  };
19725
- var MemoInputLabel = /*#__PURE__*/React.memo(InputLabel);
19367
+ GridBasicItem.displayName = 'GridBasicItem';
19726
19368
 
19727
- var InputBlockLabelComponent = function InputBlockLabelComponent(_ref) {
19728
- var children = _ref.children;
19729
- var theme = useTheme();
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;}")));
19369
+ var _excluded$8 = ["children", "className"];
19370
+ var GridComponent = function GridComponent(_ref) {
19371
+ var children = _ref.children,
19372
+ _ref$className = _ref.className,
19373
+ className = _ref$className === undefined ? '' : _ref$className,
19374
+ props = _objectWithoutProperties(_ref, _excluded$8);
19375
+ var _useScale = useScale(),
19376
+ SCALES = _useScale.SCALES;
19377
+ var _styles$className = {
19378
+ styles: /*#__PURE__*/React.createElement(_JSXStyle, {
19379
+ id: "1271839607",
19380
+ dynamic: [SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0, 'var(--grid-gap-unit)'), SCALES.pr(0, 'var(--grid-gap-unit)'), SCALES.pb(0, 'var(--grid-gap-unit)'), SCALES.pl(0, 'var(--grid-gap-unit)')]
19381
+ }, "div.__jsx-style-dynamic-selector{margin:".concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";box-sizing:border-box;padding:").concat(SCALES.pt(0, 'var(--grid-gap-unit)'), " ").concat(SCALES.pr(0, 'var(--grid-gap-unit)'), " ").concat(SCALES.pb(0, 'var(--grid-gap-unit)'), " ").concat(SCALES.pl(0, 'var(--grid-gap-unit)'), ";}")),
19382
+ className: _JSXStyle.dynamic([["1271839607", [SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0, 'var(--grid-gap-unit)'), SCALES.pr(0, 'var(--grid-gap-unit)'), SCALES.pb(0, 'var(--grid-gap-unit)'), SCALES.pl(0, 'var(--grid-gap-unit)')]]])
19383
+ },
19384
+ resolveClassName = _styles$className.className,
19385
+ styles = _styles$className.styles;
19386
+ var classes = useClasses(resolveClassName, className);
19387
+ return /*#__PURE__*/React.createElement(GridBasicItem, _extends({
19388
+ className: classes
19389
+ }, props), children, styles);
19736
19390
  };
19737
- InputBlockLabelComponent.displayName = 'GeistInputBlockLabel';
19738
- var InputBlockLabel = /*#__PURE__*/React.memo(InputBlockLabelComponent);
19391
+ GridComponent.displayName = 'Grid';
19392
+ var Grid = withScale(GridComponent);
19739
19393
 
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);}")));
19394
+ var _excluded$7 = ["gap", "wrap", "children", "className"];
19395
+ var GridContainerComponent = function GridContainerComponent(_ref) {
19396
+ var _ref$gap = _ref.gap,
19397
+ gap = _ref$gap === undefined ? 0 : _ref$gap,
19398
+ _ref$wrap = _ref.wrap,
19399
+ wrap = _ref$wrap === undefined ? 'wrap' : _ref$wrap,
19400
+ children = _ref.children,
19401
+ _ref$className = _ref.className,
19402
+ className = _ref$className === undefined ? '' : _ref$className,
19403
+ props = _objectWithoutProperties(_ref, _excluded$7);
19404
+ var _useScale = useScale(),
19405
+ unit = _useScale.unit,
19406
+ SCALES = _useScale.SCALES;
19407
+ var gapUnit = React.useMemo(function () {
19408
+ return "calc(".concat(gap, " * ").concat(unit, " * 1/3)");
19409
+ }, [gap, unit]);
19410
+ var _styles$className = {
19411
+ styles: /*#__PURE__*/React.createElement(_JSXStyle, {
19412
+ id: "3631618093",
19413
+ dynamic: [gapUnit, wrap, SCALES.width(1, 'var(--grid-container-width)'), SCALES.mt(0, 'var(--grid-container-margin)'), SCALES.mr(0, 'var(--grid-container-margin)'), SCALES.mb(0, 'var(--grid-container-margin)'), SCALES.ml(0, 'var(--grid-container-margin)')]
19414
+ }, "div.__jsx-style-dynamic-selector{--grid-gap-unit:".concat(gapUnit, ";--grid-container-margin:calc(-1 * var(--grid-gap-unit));--grid-container-width:calc(100% + var(--grid-gap-unit) * 2);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:").concat(wrap, ";-ms-flex-wrap:").concat(wrap, ";flex-wrap:").concat(wrap, ";box-sizing:border-box;width:").concat(SCALES.width(1, 'var(--grid-container-width)'), ";margin:").concat(SCALES.mt(0, 'var(--grid-container-margin)'), " ").concat(SCALES.mr(0, 'var(--grid-container-margin)'), " ").concat(SCALES.mb(0, 'var(--grid-container-margin)'), " ").concat(SCALES.ml(0, 'var(--grid-container-margin)'), ";}")),
19415
+ className: _JSXStyle.dynamic([["3631618093", [gapUnit, wrap, SCALES.width(1, 'var(--grid-container-width)'), SCALES.mt(0, 'var(--grid-container-margin)'), SCALES.mr(0, 'var(--grid-container-margin)'), SCALES.mb(0, 'var(--grid-container-margin)'), SCALES.ml(0, 'var(--grid-container-margin)')]]])
19416
+ },
19417
+ resolveClassName = _styles$className.className,
19418
+ styles = _styles$className.styles;
19419
+ var classes = useClasses(resolveClassName, className);
19420
+ return /*#__PURE__*/React.createElement(GridBasicItem, _extends({
19421
+ className: classes
19422
+ }, props), children, styles);
19752
19423
  };
19753
- InputIconComponent.displayName = 'GeistInputIcon';
19754
- var InputIcon = /*#__PURE__*/React.memo(InputIconComponent);
19424
+ GridContainerComponent.displayName = 'GridContainer';
19425
+ var GridContainer = withScale(GridContainerComponent);
19755
19426
 
19756
- var InputIconClear = function InputIconClear(_ref) {
19757
- var onClick = _ref.onClick,
19758
- disabled = _ref.disabled,
19759
- visible = _ref.visible;
19427
+ Grid.Container = GridContainer;
19428
+
19429
+ var SelectIconClear = function SelectIconClear(_ref) {
19430
+ var onClick = _ref.onClick;
19760
19431
  var theme = useTheme();
19761
- var classes = useClasses('clear-icon', {
19762
- visible: visible
19763
- });
19764
19432
  var clickHandler = function clickHandler(event) {
19765
19433
  event.preventDefault();
19766
19434
  event.stopPropagation();
@@ -19769,7 +19437,7 @@ var InputIconClear = function InputIconClear(_ref) {
19769
19437
  };
19770
19438
  return /*#__PURE__*/React.createElement("div", {
19771
19439
  onClick: clickHandler,
19772
- className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]]) + " " + (classes || "")
19440
+ className: _JSXStyle.dynamic([["1984024521", [theme.palette.accents_3, theme.palette.foreground]]]) + " " + "clear-icon"
19773
19441
  }, /*#__PURE__*/React.createElement("svg", {
19774
19442
  viewBox: "0 0 24 24",
19775
19443
  stroke: "currentColor",
@@ -19778,402 +19446,820 @@ var InputIconClear = function InputIconClear(_ref) {
19778
19446
  strokeLinejoin: "round",
19779
19447
  fill: "none",
19780
19448
  shapeRendering: "geometricPrecision",
19781
- className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]])
19449
+ className: _JSXStyle.dynamic([["1984024521", [theme.palette.accents_3, theme.palette.foreground]]])
19782
19450
  }, /*#__PURE__*/React.createElement("path", {
19783
19451
  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]]])
19452
+ className: _JSXStyle.dynamic([["1984024521", [theme.palette.accents_3, theme.palette.foreground]]])
19785
19453
  }), /*#__PURE__*/React.createElement("path", {
19786
19454
  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]]])
19455
+ className: _JSXStyle.dynamic([["1984024521", [theme.palette.accents_3, theme.palette.foreground]]])
19788
19456
  })), /*#__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);}")));
19457
+ id: "1984024521",
19458
+ dynamic: [theme.palette.accents_3, theme.palette.foreground]
19459
+ }, ".clear-icon.__jsx-style-dynamic-selector{padding:0 0 0 0.5em;margin:0;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;height:100%;cursor:pointer;box-sizing:border-box;-webkit-transition:color 150ms ease 0s;transition:color 150ms ease 0s;color:".concat(theme.palette.accents_3, ";visibility:visible;opacity:1;}.clear-icon.__jsx-style-dynamic-selector:hover{color:").concat(theme.palette.foreground, ";}svg.__jsx-style-dynamic-selector{color:currentColor;width:1em;height:1em;}")));
19792
19460
  };
19793
- var MemoInputIconClear = /*#__PURE__*/React.memo(InputIconClear);
19461
+ var MemoSelectIconClear = /*#__PURE__*/React.memo(SelectIconClear);
19462
+
19463
+ var SelectMultipleValue = function SelectMultipleValue(_ref) {
19464
+ var disabled = _ref.disabled,
19465
+ onClear = _ref.onClear,
19466
+ children = _ref.children;
19467
+ var theme = useTheme();
19468
+ return /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement("div", {
19469
+ className: _JSXStyle.dynamic([["3357578496", [theme.layout.radius, theme.palette.accents_2, disabled ? theme.palette.accents_4 : theme.palette.accents_6]]]) + " " + "item"
19470
+ }, children, !!onClear && /*#__PURE__*/React.createElement(MemoSelectIconClear, {
19471
+ onClick: onClear
19472
+ })), /*#__PURE__*/React.createElement(_JSXStyle, {
19473
+ id: "3357578496",
19474
+ dynamic: [theme.layout.radius, theme.palette.accents_2, disabled ? theme.palette.accents_4 : theme.palette.accents_6]
19475
+ }, ".item.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;justify-items:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;line-height:1;padding:0 0.5em;font-size:var(--select-font-size);height:calc(var(--select-font-size) * 2);border-radius:".concat(theme.layout.radius, ";background-color:").concat(theme.palette.accents_2, ";color:").concat(disabled ? theme.palette.accents_4 : theme.palette.accents_6, ";}.item.__jsx-style-dynamic-selector>div:not(.clear-icon),.item.__jsx-style-dynamic-selector>div:not(.clear-icon):hover{border-radius:0;background-color:transparent;padding:0;margin:0;color:inherit;}")));
19476
+ };
19477
+ SelectMultipleValue.displayName = 'GeistSelectMultipleValue';
19794
19478
 
19795
19479
  var getColors$1 = function getColors(palette, status) {
19796
19480
  var colors = {
19797
19481
  "default": {
19798
- color: palette.foreground,
19799
- borderColor: palette.border,
19800
- hoverBorder: palette.accents_5
19482
+ border: palette.border,
19483
+ borderActive: palette.foreground,
19484
+ iconBorder: palette.accents_5,
19485
+ placeholderColor: palette.accents_3
19801
19486
  },
19802
19487
  secondary: {
19803
- color: palette.foreground,
19804
- borderColor: palette.secondary,
19805
- hoverBorder: palette.secondary
19488
+ border: palette.border,
19489
+ borderActive: palette.foreground,
19490
+ iconBorder: palette.accents_5,
19491
+ placeholderColor: palette.accents_3
19806
19492
  },
19807
19493
  success: {
19808
- color: palette.foreground,
19809
- borderColor: palette.successLight,
19810
- hoverBorder: palette.success
19494
+ border: palette.successLight,
19495
+ borderActive: palette.successDark,
19496
+ iconBorder: palette.success,
19497
+ placeholderColor: palette.accents_3
19811
19498
  },
19812
19499
  warning: {
19813
- color: palette.foreground,
19814
- borderColor: palette.warningLight,
19815
- hoverBorder: palette.warning
19500
+ border: palette.warningLight,
19501
+ borderActive: palette.warningDark,
19502
+ iconBorder: palette.warning,
19503
+ placeholderColor: palette.accents_3
19816
19504
  },
19817
19505
  error: {
19818
- color: palette.error,
19819
- borderColor: palette.error,
19820
- hoverBorder: palette.errorDark
19506
+ border: palette.errorLight,
19507
+ borderActive: palette.errorDark,
19508
+ iconBorder: palette.error,
19509
+ placeholderColor: palette.error
19821
19510
  }
19822
19511
  };
19823
19512
  if (!status) return colors["default"];
19824
19513
  return colors[status];
19825
19514
  };
19826
19515
 
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,
19516
+ var Ellipsis = function Ellipsis(_ref) {
19517
+ var children = _ref.children,
19518
+ height = _ref.height;
19519
+ return /*#__PURE__*/React.createElement("span", {
19520
+ className: _JSXStyle.dynamic([["822089635", [height]]])
19521
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
19522
+ id: "822089635",
19523
+ dynamic: [height]
19524
+ }, "span.__jsx-style-dynamic-selector{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:".concat(height, ";min-width:0;}")));
19525
+ };
19526
+ var Ellipsis$1 = /*#__PURE__*/React.memo(Ellipsis);
19527
+
19528
+ var SelectInput = /*#__PURE__*/React.forwardRef(function (_ref, inputRef) {
19529
+ var visible = _ref.visible,
19530
+ onBlur = _ref.onBlur,
19531
+ onFocus = _ref.onFocus;
19532
+ var ref = React.useRef(null);
19533
+ React.useImperativeHandle(inputRef, function () {
19534
+ return ref.current;
19535
+ });
19536
+ React.useEffect(function () {
19537
+ if (visible) {
19538
+ var _ref$current;
19539
+ (_ref$current = ref.current) === null || _ref$current === undefined || _ref$current.focus();
19540
+ }
19541
+ }, [visible]);
19542
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", {
19543
+ ref: ref,
19544
+ type: "search",
19545
+ role: "combobox",
19546
+ "aria-haspopup": "listbox",
19547
+ readOnly: true,
19548
+ unselectable: "on",
19549
+ "aria-expanded": visible,
19550
+ onBlur: onBlur,
19551
+ onFocus: onFocus,
19552
+ className: "jsx-2813108835"
19553
+ }), /*#__PURE__*/React.createElement(_JSXStyle, {
19554
+ id: "2813108835"
19555
+ }, "input.jsx-2813108835{position:fixed;top:-10000px;left:-10000px;opacity:0;z-index:-1;width:0;height:0;padding:0;font-size:0;border:none;}"));
19556
+ });
19557
+ SelectInput.displayName = 'GeistSelectInput';
19558
+
19559
+ var _excluded$6 = ["children", "label", "type", "disabled", "initialValue", "value", "icon", "onChange", "pure", "multiple", "clearable", "placeholder", "className", "dropdownClassName", "dropdownStyle", "disableMatchWidth", "getPopupContainer", "onDropdownVisibleChange"];
19560
+ var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
19561
+ var children = _ref.children,
19562
+ label = _ref.label,
19837
19563
  _ref$type = _ref.type,
19838
19564
  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,
19565
+ _ref$disabled = _ref.disabled,
19566
+ disabled = _ref$disabled === undefined ? false : _ref$disabled,
19567
+ init = _ref.initialValue,
19568
+ customValue = _ref.value,
19569
+ _ref$icon = _ref.icon,
19570
+ Icon = _ref$icon === undefined ? SelectIcon : _ref$icon,
19849
19571
  onChange = _ref.onChange,
19850
- _ref$readOnly = _ref.readOnly,
19851
- readOnly = _ref$readOnly === undefined ? false : _ref$readOnly,
19852
- value = _ref.value,
19853
- onClearClick = _ref.onClearClick,
19572
+ _ref$pure = _ref.pure,
19573
+ pure = _ref$pure === undefined ? false : _ref$pure,
19574
+ _ref$multiple = _ref.multiple,
19575
+ multiple = _ref$multiple === undefined ? false : _ref$multiple,
19854
19576
  _ref$clearable = _ref.clearable,
19855
- clearable = _ref$clearable === undefined ? false : _ref$clearable,
19577
+ clearable = _ref$clearable === undefined ? true : _ref$clearable,
19578
+ placeholder = _ref.placeholder,
19856
19579
  _ref$className = _ref.className,
19857
19580
  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);
19581
+ dropdownClassName = _ref.dropdownClassName,
19582
+ dropdownStyle = _ref.dropdownStyle,
19583
+ _ref$disableMatchWidt = _ref.disableMatchWidth,
19584
+ disableMatchWidth = _ref$disableMatchWidt === undefined ? false : _ref$disableMatchWidt,
19585
+ getPopupContainer = _ref.getPopupContainer,
19586
+ _ref$onDropdownVisibl = _ref.onDropdownVisibleChange,
19587
+ onDropdownVisibleChange = _ref$onDropdownVisibl === undefined ? function () {} : _ref$onDropdownVisibl,
19588
+ props = _objectWithoutProperties(_ref, _excluded$6);
19868
19589
  var theme = useTheme();
19869
19590
  var _useScale = useScale(),
19870
19591
  SCALES = _useScale.SCALES;
19592
+ var ref = React.useRef(null);
19871
19593
  var inputRef = React.useRef(null);
19872
- React.useImperativeHandle(ref, function () {
19873
- return inputRef.current;
19874
- });
19875
- var _useState = React.useState(initialValue),
19594
+ var dropdownRef = React.useRef(null);
19595
+ var _useState = React.useState(false),
19876
19596
  _useState2 = _slicedToArray(_useState, 2),
19877
- selfValue = _useState2[0],
19878
- setSelfValue = _useState2[1];
19597
+ visible = _useState2[0],
19598
+ setVisible = _useState2[1];
19879
19599
  var _useState3 = React.useState(false),
19880
19600
  _useState4 = _slicedToArray(_useState3, 2),
19881
- hover = _useState4[0],
19882
- setHover = _useState4[1];
19883
- var isControlledComponent = React.useMemo(function () {
19884
- return value !== undefined;
19601
+ selectFocus = _useState4[0],
19602
+ setSelectFocus = _useState4[1];
19603
+ var _useCurrentState = useCurrentState(function () {
19604
+ if (!multiple) return init;
19605
+ if (Array.isArray(init)) return init;
19606
+ return typeof init === 'undefined' ? [] : [init];
19607
+ }),
19608
+ _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
19609
+ value = _useCurrentState2[0],
19610
+ setValue = _useCurrentState2[1],
19611
+ valueRef = _useCurrentState2[2];
19612
+ var isEmpty = React.useMemo(function () {
19613
+ if (!Array.isArray(value)) return !value;
19614
+ return value.length === 0;
19885
19615
  }, [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
19616
  var _useMemo = React.useMemo(function () {
19893
19617
  return getColors$1(theme.palette, type);
19894
19618
  }, [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);
19619
+ border = _useMemo.border,
19620
+ borderActive = _useMemo.borderActive,
19621
+ iconBorder = _useMemo.iconBorder,
19622
+ placeholderColor = _useMemo.placeholderColor;
19623
+ var updateVisible = function updateVisible(next) {
19624
+ onDropdownVisibleChange(next);
19625
+ setVisible(next);
19920
19626
  };
19921
- var iconClickHandler = function iconClickHandler(e) {
19922
- if (disabled) return;
19923
- onIconClick && onIconClick(e);
19627
+ var updateValue = function updateValue(next) {
19628
+ setValue(function (last) {
19629
+ if (!Array.isArray(last)) return next;
19630
+ if (!last.includes(next)) return [].concat(_toConsumableArray(last), [next]);
19631
+ return last.filter(function (item) {
19632
+ return item !== next;
19633
+ });
19634
+ });
19635
+ onChange && onChange(valueRef.current);
19636
+ if (!multiple) {
19637
+ updateVisible(false);
19638
+ }
19924
19639
  };
19925
- var iconProps = React.useMemo(function () {
19640
+ var initialValue = React.useMemo(function () {
19926
19641
  return {
19927
- clickable: iconClickable,
19928
- onClick: iconClickHandler
19642
+ value: value,
19643
+ visible: visible,
19644
+ updateValue: updateValue,
19645
+ updateVisible: updateVisible,
19646
+ ref: ref,
19647
+ disableAll: disabled
19929
19648
  };
19930
- }, [iconClickable, iconClickHandler]);
19931
- React.useEffect(function () {
19932
- if (isControlledComponent) {
19933
- setSelfValue(value);
19649
+ }, [visible, disabled, ref, value, multiple]);
19650
+ var clickHandler = function clickHandler(event) {
19651
+ event.stopPropagation();
19652
+ event.nativeEvent.stopImmediatePropagation();
19653
+ event.preventDefault();
19654
+ if (disabled) return;
19655
+ updateVisible(!visible);
19656
+ event.preventDefault();
19657
+ };
19658
+ var mouseDownHandler = function mouseDownHandler(event) {
19659
+ /* istanbul ignore next */
19660
+ if (visible) {
19661
+ event.preventDefault();
19934
19662
  }
19935
- });
19936
- var controlledValue = isControlledComponent ? {
19937
- value: selfValue
19938
- } : {
19939
- defaultValue: initialValue
19940
19663
  };
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", {
19664
+ React.useEffect(function () {
19665
+ if (customValue === undefined) return;
19666
+ setValue(customValue);
19667
+ }, [customValue]);
19668
+ React.useImperativeHandle(selectRef, function () {
19669
+ return {
19670
+ focus: function focus() {
19671
+ var _inputRef$current;
19672
+ return (_inputRef$current = inputRef.current) === null || _inputRef$current === undefined ? undefined : _inputRef$current.focus();
19673
+ },
19674
+ blur: function blur() {
19675
+ var _inputRef$current2;
19676
+ return (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === undefined ? undefined : _inputRef$current2.blur();
19677
+ },
19678
+ scrollTo: function scrollTo(options) {
19679
+ var _dropdownRef$current;
19680
+ return (_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === undefined ? undefined : _dropdownRef$current.scrollTo(options);
19681
+ }
19682
+ };
19683
+ }, [inputRef, dropdownRef]);
19684
+ var selectedChild = React.useMemo(function () {
19685
+ var _pickChildByProps = pickChildByProps(children, 'value', value),
19686
+ _pickChildByProps2 = _slicedToArray(_pickChildByProps, 2),
19687
+ optionChildren = _pickChildByProps2[1];
19688
+ return React.Children.map(optionChildren, function (child) {
19689
+ if (! /*#__PURE__*/React.isValidElement(child)) return null;
19690
+ var el = /*#__PURE__*/React.cloneElement(child); // { preventAllEvents: true }
19691
+ if (!multiple) return el;
19692
+ return /*#__PURE__*/React.createElement(SelectMultipleValue, {
19693
+ disabled: disabled,
19694
+ onClear: clearable ? function () {
19695
+ return updateValue(child.props.value);
19696
+ } : null
19697
+ }, el);
19698
+ });
19699
+ }, [value, children, multiple]);
19700
+ var onInputBlur = function onInputBlur() {
19701
+ updateVisible(false);
19702
+ setSelectFocus(false);
19703
+ };
19704
+ var classes = useClasses('select', {
19705
+ active: selectFocus || visible,
19706
+ multiple: multiple
19707
+ }, className);
19708
+ return /*#__PURE__*/React.createElement("div", {
19709
+ className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]])
19710
+ }, label && /*#__PURE__*/React.createElement("label", {
19978
19711
  style: {
19979
- marginTop: 0.4,
19980
- marginRight: 0,
19981
- marginLeft: 0,
19712
+ display: 'block',
19982
19713
  marginBottom: '0.4rem',
19983
- textAlign: 'left'
19714
+ fontSize: '14px',
19715
+ fontWeight: 'light'
19984
19716
  },
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;}")));
19717
+ className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]])
19718
+ }, label), /*#__PURE__*/React.createElement(SelectContext.Provider, {
19719
+ value: initialValue
19720
+ }, /*#__PURE__*/React.createElement("div", _extends({
19721
+ ref: ref,
19722
+ onClick: clickHandler,
19723
+ onMouseDown: mouseDownHandler
19724
+ }, props, {
19725
+ className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]]) + " " + (props && props.className != null && props.className || classes || "")
19726
+ }), /*#__PURE__*/React.createElement(SelectInput, {
19727
+ ref: inputRef,
19728
+ visible: visible,
19729
+ onBlur: onInputBlur,
19730
+ onFocus: function onFocus() {
19731
+ return setSelectFocus(true);
19732
+ }
19733
+ }), isEmpty && /*#__PURE__*/React.createElement("span", {
19734
+ className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]]) + " " + "value placeholder"
19735
+ }, /*#__PURE__*/React.createElement(Ellipsis$1, {
19736
+ height: "var(--select-height)"
19737
+ }, placeholder)), value && !multiple && /*#__PURE__*/React.createElement("span", {
19738
+ className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]]) + " " + "value"
19739
+ }, selectedChild), value && multiple && /*#__PURE__*/React.createElement(Grid.Container, {
19740
+ gap: 0.5
19741
+ }, selectedChild), /*#__PURE__*/React.createElement(SelectDropdown, {
19742
+ ref: dropdownRef,
19743
+ visible: visible,
19744
+ className: dropdownClassName,
19745
+ dropdownStyle: dropdownStyle,
19746
+ disableMatchWidth: disableMatchWidth,
19747
+ getPopupContainer: getPopupContainer
19748
+ }, children), !pure && /*#__PURE__*/React.createElement("div", {
19749
+ className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]]) + " " + "icon"
19750
+ }, /*#__PURE__*/React.createElement(Icon, {
19751
+ className: _JSXStyle.dynamic([["3282295248", [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]]])
19752
+ })))), /*#__PURE__*/React.createElement(_JSXStyle, {
19753
+ id: "3282295248",
19754
+ dynamic: [disabled ? 'not-allowed' : 'pointer', border, theme.layout.radius, disabled ? theme.palette.accents_1 : theme.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme.palette.border : borderActive, disabled ? theme.palette.accents_5 : borderActive, disabled ? theme.palette.accents_4 : theme.palette.foreground, placeholderColor, theme.layout.gapQuarter, visible ? '180' : '0', iconBorder]
19755
+ }, ".select.__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;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;position:relative;cursor:".concat(disabled ? 'not-allowed' : 'pointer', ";max-width:90vw;overflow:hidden;-webkit-transition:border 150ms ease-in 0s,color 200ms ease-out 0s, box-shadow 200ms ease 0s;transition:border 150ms ease-in 0s,color 200ms ease-out 0s, box-shadow 200ms ease 0s;border:1px solid ").concat(border, ";border-radius:").concat(theme.layout.radius, ";background-color:").concat(disabled ? theme.palette.accents_1 : theme.palette.background, ";--select-font-size:").concat(SCALES.font(0.875), ";--select-height:").concat(SCALES.height(2.25), ";min-width:11.5em;width:").concat(SCALES.width(1, 'initial'), ";height:var(--select-height);padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0.334), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0.667), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.multiple.__jsx-style-dynamic-selector{height:auto;min-height:var(--select-height);padding:").concat(SCALES.pt(0.334), " ").concat(SCALES.pr(0.334), " ").concat(SCALES.pb(0.334), " ").concat(SCALES.pl(0.667), ";}.select.active.__jsx-style-dynamic-selector,.select.__jsx-style-dynamic-selector:hover{border-color:").concat(disabled ? theme.palette.border : borderActive, ";}.select.active.icon.__jsx-style-dynamic-selector,.select.__jsx-style-dynamic-selector:hover .icon.__jsx-style-dynamic-selector{color:").concat(disabled ? theme.palette.accents_5 : borderActive, ";}.value.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex:1;-ms-flex:1;flex:1;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;line-height:1;padding:0;margin-right:1.25em;font-size:var(--select-font-size);color:").concat(disabled ? theme.palette.accents_4 : theme.palette.foreground, ";width:calc(100% - 1.25em);}.value.__jsx-style-dynamic-selector>div,.value.__jsx-style-dynamic-selector>div:hover{border-radius:0;background-color:transparent;padding:0;margin:0;color:inherit;}.placeholder.__jsx-style-dynamic-selector{color:").concat(placeholderColor, ";}.icon.__jsx-style-dynamic-selector{position:absolute;right:").concat(theme.layout.gapQuarter, ";font-size:var(--select-font-size);top:50%;bottom:0;-webkit-transform:translateY(-50%) rotate(").concat(visible ? '180' : '0', "deg);-ms-transform:translateY(-50%) rotate(").concat(visible ? '180' : '0', "deg);transform:translateY(-50%) rotate(").concat(visible ? '180' : '0', "deg);pointer-events:none;-webkit-transition:-webkit-transform 200ms ease;-webkit-transition:transform 200ms ease;transition:transform 200ms ease;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;color:").concat(iconBorder, ";}")));
19990
19756
  });
19991
- InputComponent.displayName = 'Input';
19992
- var Input = withScale(InputComponent);
19757
+ SelectComponent.displayName = 'Select';
19758
+ var Select = withScale(SelectComponent);
19759
+
19760
+ var _excluded$5 = ["value", "className", "children", "disabled", "divider", "label", "preventAllEvents"];
19761
+ var SelectOptionComponent = function SelectOptionComponent(_ref) {
19762
+ var identValue = _ref.value,
19763
+ _ref$className = _ref.className,
19764
+ className = _ref$className === undefined ? '' : _ref$className,
19765
+ children = _ref.children,
19766
+ _ref$disabled = _ref.disabled,
19767
+ disabled = _ref$disabled === undefined ? false : _ref$disabled,
19768
+ _ref$divider = _ref.divider,
19769
+ divider = _ref$divider === undefined ? false : _ref$divider,
19770
+ _ref$label = _ref.label,
19771
+ label = _ref$label === undefined ? false : _ref$label,
19772
+ _ref$preventAllEvents = _ref.preventAllEvents,
19773
+ preventAllEvents = _ref$preventAllEvents === undefined ? false : _ref$preventAllEvents,
19774
+ props = _objectWithoutProperties(_ref, _excluded$5);
19775
+ var theme = useTheme();
19776
+ var _useScale = useScale(),
19777
+ SCALES = _useScale.SCALES;
19778
+ var _useSelectContext = useSelectContext(),
19779
+ updateValue = _useSelectContext.updateValue,
19780
+ value = _useSelectContext.value,
19781
+ disableAll = _useSelectContext.disableAll;
19782
+ var isDisabled = React.useMemo(function () {
19783
+ return disabled || disableAll;
19784
+ }, [disabled, disableAll]);
19785
+ var isLabel = React.useMemo(function () {
19786
+ return label || divider;
19787
+ }, [label, divider]);
19788
+ var classes = useClasses('option', {
19789
+ divider: divider,
19790
+ label: label
19791
+ }, className);
19792
+ if (!isLabel && identValue === undefined) {
19793
+ useWarning('The props "value" is required.', 'Select Option');
19794
+ }
19795
+ var selected = React.useMemo(function () {
19796
+ if (!value) return false;
19797
+ if (typeof value === 'string') {
19798
+ return identValue === value;
19799
+ }
19800
+ return value.includes("".concat(identValue));
19801
+ }, [identValue, value]);
19802
+ var bgColor = React.useMemo(function () {
19803
+ if (isDisabled) return theme.palette.accents_1;
19804
+ return selected ? theme.palette.accents_2 : theme.palette.background;
19805
+ }, [selected, isDisabled, theme.palette]);
19806
+ var hoverBgColor = React.useMemo(function () {
19807
+ if (isDisabled || isLabel || selected) return bgColor;
19808
+ return theme.palette.accents_1;
19809
+ }, [selected, isDisabled, theme.palette, isLabel, bgColor]);
19810
+ var color = React.useMemo(function () {
19811
+ if (isDisabled) return theme.palette.accents_4;
19812
+ return selected ? theme.palette.foreground : theme.palette.accents_5;
19813
+ }, [selected, isDisabled, theme.palette]);
19814
+ var clickHandler = function clickHandler(event) {
19815
+ if (preventAllEvents) return;
19816
+ event.stopPropagation();
19817
+ event.nativeEvent.stopImmediatePropagation();
19818
+ event.preventDefault();
19819
+ if (isDisabled || isLabel) return;
19820
+ updateValue && updateValue(identValue);
19821
+ };
19822
+ return /*#__PURE__*/React.createElement("div", _extends({
19823
+ onClick: clickHandler
19824
+ }, props, {
19825
+ className: _JSXStyle.dynamic([["199367556", [bgColor, color, isDisabled ? 'not-allowed' : 'pointer', SCALES.font(0.75), SCALES.width(1, '100%'), SCALES.height(2.25), SCALES.pt(0), SCALES.pr(0.667), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hoverBgColor, theme.palette.accents_7, theme.palette.border, SCALES.width(1, '100%'), SCALES.height(1, 0), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0.5), SCALES.mr(0), SCALES.mb(0.5), SCALES.ml(0), theme.palette.accents_7, theme.palette.border, SCALES.font(0.875), SCALES.width(1, '100%')]]]) + " " + (props && props.className != null && props.className || classes || "")
19826
+ }), /*#__PURE__*/React.createElement(Ellipsis$1, {
19827
+ height: SCALES.height(2.25)
19828
+ }, children), /*#__PURE__*/React.createElement(_JSXStyle, {
19829
+ id: "199367556",
19830
+ dynamic: [bgColor, color, isDisabled ? 'not-allowed' : 'pointer', SCALES.font(0.75), SCALES.width(1, '100%'), SCALES.height(2.25), SCALES.pt(0), SCALES.pr(0.667), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hoverBgColor, theme.palette.accents_7, theme.palette.border, SCALES.width(1, '100%'), SCALES.height(1, 0), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0.5), SCALES.mr(0), SCALES.mb(0.5), SCALES.ml(0), theme.palette.accents_7, theme.palette.border, SCALES.font(0.875), SCALES.width(1, '100%')]
19831
+ }, ".option.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;max-width:100%;box-sizing:border-box;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-weight:normal;background-color:".concat(bgColor, ";color:").concat(color, ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:0;cursor:").concat(isDisabled ? 'not-allowed' : 'pointer', ";-webkit-transition:background 0.2s ease 0s,border-color 0.2s ease 0s;transition:background 0.2s ease 0s,border-color 0.2s ease 0s;--select-font-size:").concat(SCALES.font(0.75), ";font-size:var(--select-font-size);width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(2.25), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0.667), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0.667), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.option.__jsx-style-dynamic-selector:hover{background-color:").concat(hoverBgColor, ";color:").concat(theme.palette.accents_7, ";}.divider.__jsx-style-dynamic-selector{line-height:0;overflow:hidden;border-top:1px solid ").concat(theme.palette.border, ";width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, 0), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0.5), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0.5), " ").concat(SCALES.ml(0), ";}.label.__jsx-style-dynamic-selector{color:").concat(theme.palette.accents_7, ";border-bottom:1px solid ").concat(theme.palette.border, ";text-transform:capitalize;cursor:default;font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, '100%'), ";font-weight:500;}")));
19832
+ };
19833
+ SelectOptionComponent.displayName = 'SelectOption';
19834
+ var SelectOption = withScale(SelectOptionComponent);
19835
+
19836
+ Select.Option = SelectOption;
19837
+
19838
+ var makeColgroup = function makeColgroup(width, columns) {
19839
+ var unsetWidthCount = columns.filter(function (c) {
19840
+ return !c.width;
19841
+ }).length;
19842
+ var customWidthTotal = columns.reduce(function (pre, current) {
19843
+ return current.width ? pre + current.width : pre;
19844
+ }, 0);
19845
+ var averageWidth = (width - customWidthTotal) / unsetWidthCount;
19846
+ if (averageWidth <= 0) return /*#__PURE__*/React.createElement("colgroup", null);
19847
+ return /*#__PURE__*/React.createElement("colgroup", null, columns.map(function (column, index) {
19848
+ return /*#__PURE__*/React.createElement("col", {
19849
+ key: "colgroup-".concat(index),
19850
+ width: column.width || averageWidth
19851
+ });
19852
+ }));
19853
+ };
19854
+ var TableHead = function TableHead(props) {
19855
+ var theme = useTheme();
19856
+ var _React$useState = React.useState({}),
19857
+ _React$useState2 = _slicedToArray(_React$useState, 2),
19858
+ filters = _React$useState2[0],
19859
+ setFilters = _React$useState2[1];
19860
+ var _ref = props,
19861
+ columns = _ref.columns,
19862
+ width = _ref.width,
19863
+ onFilters = _ref.onFilters,
19864
+ showFilters = _ref.showFilters;
19865
+ var isScalableWidth = React.useMemo(function () {
19866
+ return columns.find(function (item) {
19867
+ return !!item.width;
19868
+ });
19869
+ }, [columns]);
19870
+ var colgroup = React.useMemo(function () {
19871
+ if (!isScalableWidth) return /*#__PURE__*/React.createElement("colgroup", null);
19872
+ return makeColgroup(width, columns);
19873
+ }, [isScalableWidth, width]);
19874
+ var handleFilterChange = function handleFilterChange(name, value) {
19875
+ setFilters(function (prevFilters) {
19876
+ var updatedFilters = _objectSpread2(_objectSpread2({}, prevFilters), {}, _defineProperty({}, name, value));
19877
+ if (onFilters) {
19878
+ onFilters(updatedFilters);
19879
+ }
19880
+ return updatedFilters;
19881
+ });
19882
+ };
19883
+
19884
+ // const applyFilters = () => {
19885
+ // if (onFilters) {
19886
+ // onFilters(filters);
19887
+ // }
19888
+ // }
19889
+
19890
+ var generateFilterInputs = function generateFilterInputs() {
19891
+ return columns.map(function (col) {
19892
+ var _String, _filters$filterName;
19893
+ var Header = col.label,
19894
+ accessor = col.filter,
19895
+ options = col.options;
19896
+ var filterName = (_String = String(col === null || col === undefined ? undefined : col.label)) === null || _String === undefined ? undefined : _String.replace(' ', '_').toLowerCase();
19897
+ var unq_accessor = _.uniqueId(filterName);
19898
+ // if (Header === 'actions') {
19899
+ // return (
19900
+ // <th style={{ margin: '3px' }} data-column={Header} key={unq_accessor}>
19901
+ // <Button onClick={applyFilters} auto px={0.6} scale={2 / 3}>Apply</Button>
19902
+ // </th>
19903
+ // )
19904
+ // }
19905
+ return /*#__PURE__*/React.createElement("th", {
19906
+ style: {
19907
+ padding: '3px'
19908
+ },
19909
+ "data-column": Header,
19910
+ key: unq_accessor
19911
+ }, accessor === 'fixed' && /*#__PURE__*/React.createElement(Select, {
19912
+ key: unq_accessor,
19913
+ name: filterName,
19914
+ value: (_filters$filterName = filters[filterName]) !== null && _filters$filterName !== undefined ? _filters$filterName : 'All',
19915
+ onChange: function onChange(newValue) {
19916
+ return handleFilterChange(filterName, newValue);
19917
+ }
19918
+ }, /*#__PURE__*/React.createElement(Select.Option, {
19919
+ value: "All"
19920
+ }, "All ", Header), options ? options.map(function (option) {
19921
+ return /*#__PURE__*/React.createElement(Select.Option, {
19922
+ value: option.value
19923
+ }, option.name);
19924
+ }) : null), accessor === 'date' && /*#__PURE__*/React.createElement(Input, {
19925
+ id: "filter-date-".concat(filterName),
19926
+ htmlType: "date",
19927
+ name: filterName,
19928
+ value: filters[filterName],
19929
+ onChange: function onChange(e) {
19930
+ return handleFilterChange(filterName, e.target.value);
19931
+ }
19932
+ }), accessor === 'search' && /*#__PURE__*/React.createElement(Input, {
19933
+ id: "filter-search-".concat(filterName),
19934
+ htmlType: "text",
19935
+ autoComplete: "off"
19936
+ // ref={filterRefs.current[filterName]} // Dynamically set ref}
19937
+ ,
19938
+ name: filterName,
19939
+ style: {
19940
+ height: 30,
19941
+ minWidth: 160
19942
+ },
19943
+ value: filters[filterName],
19944
+ onChange: function onChange(e) {
19945
+ return handleFilterChange(filterName, e.target.value);
19946
+ },
19947
+ placeholder: "Search...",
19948
+ fullWidth: true
19949
+ }));
19950
+ });
19951
+ };
19952
+ return /*#__PURE__*/React.createElement(React.Fragment, null, colgroup, /*#__PURE__*/React.createElement("thead", {
19953
+ 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]]])
19954
+ }, /*#__PURE__*/React.createElement("tr", {
19955
+ 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]]])
19956
+ }, columns.map(function (column, index) {
19957
+ return /*#__PURE__*/React.createElement("th", {
19958
+ style: {
19959
+ // textAlign: `${column?.align} !important`,
19960
+ // paddingLeft: '0.3rem',
19961
+ // paddingRight: '0.3rem',
19962
+ // color: `${column?.color}`,
19963
+ whiteSpace: column !== null && column !== undefined && column.noWrap ? 'nowrap' : 'normal'
19964
+ },
19965
+ key: "table-th-".concat(column.prop.toString(), "-").concat(index),
19966
+ "data-column": column.label,
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]]]) + " " + (column.className || "")
19968
+ }, /*#__PURE__*/React.createElement("div", {
19969
+ 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"
19970
+ }, column.label, /*#__PURE__*/React.createElement("br", {
19971
+ 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]]])
19972
+ }), /*#__PURE__*/React.createElement("span", {
19973
+ style: {
19974
+ textAlign: 'center'
19975
+ },
19976
+ 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]]])
19977
+ }, column.text)));
19978
+ })), showFilters && /*#__PURE__*/React.createElement("tr", {
19979
+ 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]]])
19980
+ }, generateFilterInputs())), /*#__PURE__*/React.createElement(_JSXStyle, {
19981
+ id: "134865897",
19982
+ 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]
19983
+ }, "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;}")));
19984
+ };
19985
+ TableHead.displayName = 'TableHead';
19993
19986
 
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;
19987
+ var TableCell = function TableCell(_ref) {
19988
+ var columns = _ref.columns,
19989
+ row = _ref.row,
19990
+ rowIndex = _ref.rowIndex,
19991
+ emptyText = _ref.emptyText,
19992
+ onCellClick = _ref.onCellClick;
19993
+ /* eslint-disable react/jsx-no-useless-fragment */
19994
+ return /*#__PURE__*/React.createElement(React.Fragment, null, columns.map(function (column, index) {
19995
+ var currentRowValue = row[column.prop];
19996
+ var cellValue = currentRowValue || emptyText;
19997
+ var shouldBeRenderElement = column.renderHandler(currentRowValue, row, rowIndex);
19998
+ return /*#__PURE__*/React.createElement("td", {
19999
+ style: _objectSpread2({
20000
+ fontSize: "".concat(column === null || column === undefined ? undefined : column.fontSize),
20001
+ textAlign: "".concat(column === null || column === undefined ? undefined : column.align, " !important"),
20002
+ paddingLeft: '0.3rem',
20003
+ paddingRight: '0.3rem',
20004
+ color: "".concat(column === null || column === undefined ? undefined : column.color),
20005
+ whiteSpace: column !== null && column !== undefined && column.noWrap ? 'nowrap' : 'normal'
20006
+ }, currentRowValue === null || currentRowValue === undefined ? undefined : currentRowValue.style),
20007
+ "data-column": column.label,
20008
+ key: "row-td-".concat(index, "-").concat(column.prop.toString()),
20009
+ onClick: function onClick() {
20010
+ return onCellClick && onCellClick(currentRowValue, rowIndex, index);
20011
+ },
20012
+ className: column.className
20013
+ }, /*#__PURE__*/React.createElement("div", {
20014
+ className: "cell"
20015
+ }, shouldBeRenderElement ? shouldBeRenderElement : cellValue));
20016
+ }));
20017
+ /* eslint-enable */
19999
20018
  };
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');
20008
20019
 
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,
20020
+ /* "use client" */
20021
+
20022
+ var defaultContext$1 = {
20023
+ columns: [],
20024
+ updateColumn: function updateColumn() {}
20025
+ };
20026
+ var TableContext = /*#__PURE__*/React.createContext(defaultContext$1);
20027
+ var useTableContext = function useTableContext() {
20028
+ return React.useContext(TableContext);
20029
+ };
20030
+
20031
+ var TableBody = function TableBody(_ref) {
20032
+ var data = _ref.data,
20033
+ emptyText = _ref.emptyText,
20034
+ onRow = _ref.onRow,
20035
+ onCell = _ref.onCell,
20036
+ rowClassName = _ref.rowClassName,
20037
+ _ref$rowDraggable = _ref.rowDraggable,
20038
+ rowDraggable = _ref$rowDraggable === undefined ? false : _ref$rowDraggable,
20016
20039
  _ref$readOnly = _ref.readOnly,
20017
20040
  readOnly = _ref$readOnly === undefined ? false : _ref$readOnly,
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);
20041
+ onSelected = _ref.onSelected;
20030
20042
  var theme = useTheme();
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),
20043
+ var _useState = React.useState([]),
20041
20044
  _useState2 = _slicedToArray(_useState, 2),
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);
20045
+ selected = _useState2[0],
20046
+ setSelected = _useState2[1];
20047
+ var _useTableContext = useTableContext(),
20048
+ columns = _useTableContext.columns;
20049
+ // const rowClickHandler = (row: TableDataItem, index: number) => {
20050
+ // onRow && onRow(row, index)
20051
+ // }
20052
+
20053
+ var handleClick = function handleClick(_event, id) {
20054
+ if (readOnly) {
20055
+ return true;
20056
+ }
20057
+ var selectedIndex = selected.indexOf(id);
20058
+ var newSelected = [];
20059
+ if (selectedIndex === -1) {
20060
+ newSelected = newSelected.concat(selected, id);
20061
+ } else if (selectedIndex === 0) {
20062
+ newSelected = newSelected.concat(selected.slice(1));
20063
+ } else if (selectedIndex === selected.length - 1) {
20064
+ newSelected = newSelected.concat(selected.slice(0, -1));
20065
+ } else if (selectedIndex > 0) {
20066
+ newSelected = newSelected.concat(selected.slice(0, selectedIndex), selected.slice(selectedIndex + 1));
20067
+ }
20068
+ setSelected(newSelected);
20062
20069
  };
20063
- var focusHandler = function focusHandler(e) {
20064
- setHover(true);
20065
- onFocus && onFocus(e);
20070
+
20071
+ // const handleSelectAllClick = (event: { target: { checked: any } }) => {
20072
+ // if (event.target.checked) {
20073
+ // const newSelecteds = data.map((n: any) => n._id);
20074
+ // setSelected(newSelecteds as never[]);
20075
+ // return;
20076
+ // }
20077
+ // setSelected([]);
20078
+ // };
20079
+
20080
+ // Push Selected Rows
20081
+ React.useEffect(function () {
20082
+ if (selected.length > 0 && onSelected) {
20083
+ onSelected(selected);
20084
+ }
20085
+ }, [selected]);
20086
+ function renderRow(cols, row, index) {
20087
+ var _row$style;
20088
+ var urid = _.uniqueId();
20089
+ var className = rowClassName(row, index);
20090
+ var rw = _objectSpread2({}, row);
20091
+ var rowStyle = (_row$style = row === null || row === undefined ? undefined : row.style) !== null && _row$style !== undefined ? _row$style : {};
20092
+ var onDragStart = row === null || row === undefined ? undefined : row.onDragStart;
20093
+ delete rw.table;
20094
+ delete rw.style;
20095
+ delete rw.onDragStart;
20096
+ // console.log(row);
20097
+ // const frow = Object.fromEntries(
20098
+ // Object.entries(row).filter(([ky, _]) => ky !== '_id' && cols.map((col: any) => col.id).includes(ky))
20099
+ // ) as unknown as TableDataItem
20100
+ // console.log(frow);
20101
+ var isRowSelected = selected.indexOf(row) !== -1;
20102
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("tr", {
20103
+ draggable: rowDraggable,
20104
+ role: "checkbox",
20105
+ onDragStart: onDragStart,
20106
+ "aria-checked": selected.indexOf(row) !== -1,
20107
+ tabIndex: -1,
20108
+ key: urid,
20109
+ style: _objectSpread2({
20110
+ cursor: 'pointer',
20111
+ backgroundColor: isRowSelected ? '#efefef' : ''
20112
+ }, rowStyle),
20113
+ onClick: function onClick(e) {
20114
+ if (!rowDraggable) {
20115
+ if (onRow) {
20116
+ onRow(row, index);
20117
+ } else {
20118
+ handleClick(e, row);
20119
+ }
20120
+ }
20121
+ },
20122
+ className: _JSXStyle.dynamic([["2019708038", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]]) + " " + (useClasses("".concat(rowDraggable ? 'draggable' : 'hover', " ").concat(className)) || "")
20123
+ }, /*#__PURE__*/React.createElement(TableCell, {
20124
+ columns: cols,
20125
+ row: rw,
20126
+ rowIndex: index,
20127
+ emptyText: emptyText,
20128
+ onCellClick: onCell
20129
+ })), /*#__PURE__*/React.createElement(_JSXStyle, {
20130
+ id: "2019708038",
20131
+ dynamic: [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]
20132
+ }, "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;}")));
20133
+ }
20134
+ return /*#__PURE__*/React.createElement("tbody", {
20135
+ className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
20136
+ }, data.map(function (row, index) {
20137
+ var qid = _.uniqueId();
20138
+ if (row === null || row === undefined) {
20139
+ var uid = _.uniqueId();
20140
+ return /*#__PURE__*/React.createElement("tr", {
20141
+ key: uid,
20142
+ className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
20143
+ }, /*#__PURE__*/React.createElement("td", {
20144
+ colSpan: columns.length,
20145
+ className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
20146
+ }, "\u2003"));
20147
+ }
20148
+ return /*#__PURE__*/React.createElement(React.Fragment, null, renderRow(columns, row, index), (row === null || row === undefined ? undefined : row.table) && /*#__PURE__*/React.createElement("tr", {
20149
+ key: qid,
20150
+ className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
20151
+ }, /*#__PURE__*/React.createElement("td", {
20152
+ style: {
20153
+ padding: '1rem'
20154
+ },
20155
+ colSpan: columns.length,
20156
+ className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
20157
+ })));
20158
+
20159
+ // return (
20160
+ // <tr
20161
+ // key={`tbody-row-${index}`}
20162
+ // className={useClasses({ hover }, className)}
20163
+ // onClick={() => rowClickHandler(row, index)}>
20164
+ // <TableCell<TableDataItem>
20165
+ // columns={columns}
20166
+ // row={row}
20167
+ // rowIndex={index}
20168
+ // emptyText={emptyText}
20169
+ // onCellClick={onCell}
20170
+ // />
20171
+ // </tr>
20172
+ // )
20173
+ }), /*#__PURE__*/React.createElement(_JSXStyle, {
20174
+ id: "1422656197",
20175
+ dynamic: [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]
20176
+ }, "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;}")));
20177
+ };
20178
+ TableBody.displayName = 'TableBody';
20179
+
20180
+ var getRealShape = function getRealShape(el) {
20181
+ var defaultShape = {
20182
+ width: 0,
20183
+ height: 0
20066
20184
  };
20067
- var blurHandler = function blurHandler(e) {
20068
- setHover(false);
20069
- onBlur && onBlur(e);
20185
+ if (!el || typeof window === 'undefined') return defaultShape;
20186
+ var rect = el.getBoundingClientRect();
20187
+ var _window$getComputedSt = window.getComputedStyle(el),
20188
+ width = _window$getComputedSt.width,
20189
+ height = _window$getComputedSt.height;
20190
+ var getCSSStyleVal = function getCSSStyleVal(str, parentNum) {
20191
+ if (!str) return 0;
20192
+ var strVal = str.includes('px') ? +str.split('px')[0] : str.includes('%') ? +str.split('%')[0] * parentNum * 0.01 : str;
20193
+ return Number.isNaN(+strVal) ? 0 : +strVal;
20070
20194
  };
20071
- React.useEffect(function () {
20072
- if (isControlledComponent) {
20073
- setSelfValue(value);
20074
- }
20075
- });
20076
- var controlledValue = isControlledComponent ? {
20077
- value: selfValue
20078
- } : {
20079
- defaultValue: initialValue
20195
+ return {
20196
+ width: getCSSStyleVal("".concat(width), rect.width),
20197
+ height: getCSSStyleVal("".concat(height), rect.height)
20080
20198
  };
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
- })));
20126
20199
  };
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),
20200
+ var useRealShape = function useRealShape(ref) {
20201
+ var _useState = React.useState({
20202
+ width: 0,
20203
+ height: 0
20204
+ }),
20138
20205
  _useState2 = _slicedToArray(_useState, 2),
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;
20206
+ state = _useState2[0],
20207
+ setState = _useState2[1];
20208
+ var update = function update() {
20209
+ var _getRealShape = getRealShape(ref.current),
20210
+ width = _getRealShape.width,
20211
+ height = _getRealShape.height;
20212
+ setState({
20213
+ width: width,
20214
+ height: height
20147
20215
  });
20148
- /* istanbul ignore next */
20149
- if (inputRef && inputRef.current) {
20150
- inputRef.current.focus();
20151
- }
20152
20216
  };
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);
20217
+ React.useEffect(function () {
20218
+ return update();
20219
+ }, [ref.current]);
20220
+ return [state, update];
20221
+ };
20173
20222
 
20174
20223
  /* "use client" */
20175
- Input.Textarea = Textarea;
20176
- Input.Password = InputPassword;
20224
+
20225
+ var TableColumn = function TableColumn(columnProps) {
20226
+ var _ref = columnProps,
20227
+ children = _ref.children,
20228
+ prop = _ref.prop,
20229
+ label = _ref.label,
20230
+ width = _ref.width,
20231
+ filter = _ref.filter,
20232
+ options = _ref.options,
20233
+ noWrap = _ref.noWrap,
20234
+ align = _ref.align,
20235
+ _ref$fontSize = _ref.fontSize,
20236
+ fontSize = _ref$fontSize === undefined ? 'smaller' : _ref$fontSize,
20237
+ _ref$className = _ref.className,
20238
+ className = _ref$className === undefined ? '' : _ref$className,
20239
+ renderHandler = _ref.render;
20240
+ var _useTableContext = useTableContext(),
20241
+ updateColumn = _useTableContext.updateColumn;
20242
+ var safeProp = "".concat(prop.toString()).trim();
20243
+ if (!safeProp) {
20244
+ useWarning('The props "prop" is required.', 'Table.Column');
20245
+ }
20246
+ React.useEffect(function () {
20247
+ updateColumn({
20248
+ label: children || label,
20249
+ filter: filter,
20250
+ noWrap: noWrap,
20251
+ options: options,
20252
+ prop: safeProp,
20253
+ width: width,
20254
+ align: align,
20255
+ fontSize: fontSize,
20256
+ className: className,
20257
+ renderHandler: function renderHandler() {}
20258
+ });
20259
+ }, [children, noWrap, fontSize, align, filter, options, label, prop, width, className, renderHandler]);
20260
+ return null;
20261
+ };
20262
+ TableColumn.displayName = 'TableColumn';
20177
20263
 
20178
20264
  var _excluded$4 = ["children", "data", "initialData", "hover", "emptyText", "rowDraggable", "readOnly", "onRow", "onCell", "onChange", "onFilters", "showFilters", "onSelected", "className", "rowClassName"];
20179
20265
  function TableComponent(tableProps) {
@@ -20239,10 +20325,6 @@ function TableComponent(tableProps) {
20239
20325
  updateColumn: updateColumn
20240
20326
  };
20241
20327
  }, [columns]);
20242
- var _React$useState = React.useState({}),
20243
- _React$useState2 = _slicedToArray(_React$useState, 2),
20244
- filters = _React$useState2[0],
20245
- setFilters = _React$useState2[1];
20246
20328
  React.useEffect(function () {
20247
20329
  if (typeof customData === 'undefined') return;
20248
20330
  setData(customData);
@@ -20250,75 +20332,7 @@ function TableComponent(tableProps) {
20250
20332
  useResize(function () {
20251
20333
  return updateShape();
20252
20334
  });
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, {
20335
+ return /*#__PURE__*/React.createElement(TableContext.Provider, {
20322
20336
  value: contextValue
20323
20337
  }, /*#__PURE__*/React.createElement("table", _extends({
20324
20338
  ref: ref
@@ -20326,6 +20340,8 @@ function TableComponent(tableProps) {
20326
20340
  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 || "")
20327
20341
  }), /*#__PURE__*/React.createElement(TableHead, {
20328
20342
  columns: columns,
20343
+ onFilters: onFilters,
20344
+ showFilters: showFilters,
20329
20345
  width: width
20330
20346
  }), /*#__PURE__*/React.createElement(TableBody, {
20331
20347
  data: data,
@@ -20340,7 +20356,7 @@ function TableComponent(tableProps) {
20340
20356
  }), children, /*#__PURE__*/React.createElement(_JSXStyle, {
20341
20357
  id: "2132340556",
20342
20358
  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)]
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), ";}")))));
20359
+ }, "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), ";}"))));
20344
20360
  }
20345
20361
  TableComponent.displayName = 'Table';
20346
20362
  TableComponent.Column = TableColumn;