@helpdice/ui 2.6.0-beta.5 → 2.6.0-beta.7

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.
@@ -743,7 +743,7 @@ var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingL
743
743
  var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
744
744
  return "".concat(scale1x);
745
745
  };
746
- var defaultContext$2 = {
746
+ var defaultContext$1 = {
747
747
  getScaleProps: function getScaleProps() {
748
748
  return undefined;
749
749
  },
@@ -769,7 +769,7 @@ var defaultContext$2 = {
769
769
  },
770
770
  unit: '16px'
771
771
  };
772
- var ScaleContext = /*#__PURE__*/React.createContext(defaultContext$2);
772
+ var ScaleContext = /*#__PURE__*/React.createContext(defaultContext$1);
773
773
  var useScale = function useScale() {
774
774
  return React.useContext(ScaleContext);
775
775
  };
@@ -839,7 +839,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
839
839
  return getAllScaleProps;
840
840
  };
841
841
 
842
- var _excluded$a = ["children"];
842
+ var _excluded$8 = ["children"];
843
843
  var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
844
844
  if (scale === 1) return scale;
845
845
  var diff = Math.abs((scale - 1) / 2);
@@ -849,7 +849,7 @@ var withScale = function withScale(Render) {
849
849
  var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
850
850
  var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31;
851
851
  var children = _ref.children,
852
- props = _objectWithoutProperties(_ref, _excluded$a);
852
+ props = _objectWithoutProperties(_ref, _excluded$8);
853
853
  var _useTheme = theme.useTheme(),
854
854
  layout = _useTheme.layout;
855
855
  var paddingLeft = props.paddingLeft,
@@ -934,7 +934,7 @@ var withScale = function withScale(Render) {
934
934
  return ScaleFC;
935
935
  };
936
936
 
937
- var _excluded$9 = ["children", "tag", "className", "color"];
937
+ var _excluded$7 = ["children", "tag", "className", "color"];
938
938
  var getTypeColor = function getTypeColor(type, palette) {
939
939
  var colors = {
940
940
  "default": 'inherit',
@@ -952,7 +952,7 @@ var TextChild = function TextChild(_ref) {
952
952
  className = _ref$className === void 0 ? '' : _ref$className,
953
953
  _ref$color = _ref.color,
954
954
  color = _ref$color === void 0 ? 'default' : _ref$color,
955
- props = _objectWithoutProperties(_ref, _excluded$9);
955
+ props = _objectWithoutProperties(_ref, _excluded$7);
956
956
  var Component = tag;
957
957
  var theme$1 = theme.useTheme();
958
958
  var _useScale = useScale(),
@@ -1000,652 +1000,7 @@ var TextChild = function TextChild(_ref) {
1000
1000
  };
1001
1001
  TextChild.displayName = 'TextChild';
1002
1002
 
1003
- var ButtonDrip = function ButtonDrip(_ref) {
1004
- var _ref$x = _ref.x,
1005
- x = _ref$x === void 0 ? 0 : _ref$x,
1006
- _ref$y = _ref.y,
1007
- y = _ref$y === void 0 ? 0 : _ref$y,
1008
- color = _ref.color,
1009
- onCompleted = _ref.onCompleted;
1010
- var dripRef = React.useRef(null);
1011
- /* istanbul ignore next */
1012
- var top = Number.isNaN(+y) ? 0 : y - 10;
1013
- /* istanbul ignore next */
1014
- var left = Number.isNaN(+x) ? 0 : x - 10;
1015
- React.useEffect(function () {
1016
- /* istanbul ignore next */
1017
- if (!dripRef.current) return;
1018
- dripRef.current.addEventListener('animationend', onCompleted);
1019
- return function () {
1020
- /* istanbul ignore next */
1021
- if (!dripRef.current) return;
1022
- dripRef.current.removeEventListener('animationend', onCompleted);
1023
- };
1024
- });
1025
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
1026
- ref: dripRef,
1027
- className: "jsx-3424889537" + " " + "drip",
1028
- children: [/*#__PURE__*/jsxRuntime.jsx("svg", {
1029
- width: "20",
1030
- height: "20",
1031
- viewBox: "0 0 20 20",
1032
- style: {
1033
- top: top,
1034
- left: left
1035
- },
1036
- className: "jsx-3424889537",
1037
- children: /*#__PURE__*/jsxRuntime.jsx("g", {
1038
- stroke: "none",
1039
- strokeWidth: "1",
1040
- fill: "none",
1041
- fillRule: "evenodd",
1042
- className: "jsx-3424889537",
1043
- children: /*#__PURE__*/jsxRuntime.jsx("g", {
1044
- fill: color,
1045
- className: "jsx-3424889537",
1046
- children: /*#__PURE__*/jsxRuntime.jsx("rect", {
1047
- width: "100%",
1048
- height: "100%",
1049
- rx: "10",
1050
- className: "jsx-3424889537"
1051
- })
1052
- })
1053
- })
1054
- }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1055
- id: "3424889537",
1056
- children: ".drip.jsx-3424889537{position:absolute;left:0;right:0;top:0;bottom:0;}svg.jsx-3424889537{position:absolute;-webkit-animation:350ms ease-in expand-jsx-3424889537;animation:350ms ease-in expand-jsx-3424889537;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;width:1rem;height:1rem;}@-webkit-keyframes expand-jsx-3424889537{0%{opacity:0;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}30%{opacity:1;}80%{opacity:0.5;}100%{-webkit-transform:scale(28);-ms-transform:scale(28);transform:scale(28);opacity:0;}}@keyframes expand-jsx-3424889537{0%{opacity:0;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}30%{opacity:1;}80%{opacity:0.5;}100%{-webkit-transform:scale(28);-ms-transform:scale(28);transform:scale(28);opacity:0;}}"
1057
- })]
1058
- });
1059
- };
1060
- ButtonDrip.displayName = 'ButtonDrip';
1061
-
1062
- var _excluded$8 = ["children", "type", "color", "className", "spaceRatio"];
1063
- var getIconBgColor = function getIconBgColor(type, palette, color) {
1064
- var colors = {
1065
- "default": palette.accents_6,
1066
- secondary: palette.secondary,
1067
- success: palette.success,
1068
- warning: palette.warning,
1069
- error: palette.error
1070
- };
1071
- return color ? color : colors[type];
1072
- };
1073
- var LoadingComponent = function LoadingComponent(_ref) {
1074
- var children = _ref.children,
1075
- _ref$type = _ref.type,
1076
- type = _ref$type === void 0 ? 'default' : _ref$type,
1077
- color = _ref.color,
1078
- _ref$className = _ref.className,
1079
- className = _ref$className === void 0 ? '' : _ref$className,
1080
- _ref$spaceRatio = _ref.spaceRatio,
1081
- spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
1082
- props = _objectWithoutProperties(_ref, _excluded$8);
1083
- var theme$1 = theme.useTheme();
1084
- var _useScale = useScale(),
1085
- SCALES = _useScale.SCALES;
1086
- var classes = theme.useClasses('loading-container', className);
1087
- var bgColor = React.useMemo(function () {
1088
- return getIconBgColor(type, theme$1.palette, color);
1089
- }, [type, theme$1.palette, color]);
1090
- return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread2(_objectSpread2({}, props), {}, {
1091
- className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]]) + " " + (props && props.className != null && props.className || classes || ""),
1092
- children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
1093
- className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]]) + " " + "loading",
1094
- children: [children && /*#__PURE__*/jsxRuntime.jsx("label", {
1095
- className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]]),
1096
- children: children
1097
- }), /*#__PURE__*/jsxRuntime.jsx("i", {
1098
- className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]])
1099
- }), /*#__PURE__*/jsxRuntime.jsx("i", {
1100
- className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]])
1101
- }), /*#__PURE__*/jsxRuntime.jsx("i", {
1102
- className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]])
1103
- })]
1104
- }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1105
- id: "2201634259",
1106
- dynamic: [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio],
1107
- children: ".loading-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;position:relative;font-size:".concat(SCALES.font(1), ";width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, '100%'), ";min-height:1em;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), ";}label.__jsx-style-dynamic-selector{margin-right:0.5em;color:").concat(theme$1.palette.accents_5, ";line-height:1;}label.__jsx-style-dynamic-selector *{margin:0;}.loading.__jsx-style-dynamic-selector{position:absolute;top:50%;left:50%;width:100%;height:100%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:transparent;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}i.__jsx-style-dynamic-selector{width:0.25em;height:0.25em;border-radius:50%;background-color:").concat(bgColor, ";margin:0 calc(0.25em / 2 * ").concat(spaceRatio, ");display:inline-block;-webkit-animation:loading-blink-__jsx-style-dynamic-selector 1.4s infinite both;animation:loading-blink-__jsx-style-dynamic-selector 1.4s infinite both;}i.__jsx-style-dynamic-selector:nth-child(2){-webkit-animation-delay:0.2s;animation-delay:0.2s;}i.__jsx-style-dynamic-selector:nth-child(3){-webkit-animation-delay:0.4s;animation-delay:0.4s;}@-webkit-keyframes loading-blink-__jsx-style-dynamic-selector{0%{opacity:0.2;}20%{opacity:1;}100%{opacity:0.2;}}@keyframes loading-blink-__jsx-style-dynamic-selector{0%{opacity:0.2;}20%{opacity:1;}100%{opacity:0.2;}}")
1108
- })]
1109
- }));
1110
- };
1111
- LoadingComponent.displayName = 'Loading';
1112
- var Loading = withScale(LoadingComponent);
1113
-
1114
- var ButtonLoading = function ButtonLoading(_ref) {
1115
- var color = _ref.color;
1116
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
1117
- className: "jsx-212623367" + " " + "btn-loading",
1118
- children: [/*#__PURE__*/jsxRuntime.jsx(Loading, {
1119
- color: color
1120
- }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1121
- id: "212623367",
1122
- children: ".btn-loading.jsx-212623367{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;background-color:var(--helpdice-ui-button-bg);}"
1123
- })]
1124
- });
1125
- };
1126
- ButtonLoading.displayName = 'ButtonLoading';
1127
-
1128
- var _excluded$7 = ["isRight", "isSingle", "children", "className"];
1129
- var ButtonIcon = function ButtonIcon(_ref) {
1130
- var _ref$isRight = _ref.isRight,
1131
- isRight = _ref$isRight === void 0 ? false : _ref$isRight,
1132
- isSingle = _ref.isSingle,
1133
- children = _ref.children,
1134
- _ref$className = _ref.className,
1135
- className = _ref$className === void 0 ? '' : _ref$className,
1136
- props = _objectWithoutProperties(_ref, _excluded$7);
1137
- var classes = theme.useClasses('icon', {
1138
- right: isRight,
1139
- single: isSingle
1140
- }, className);
1141
- return /*#__PURE__*/jsxRuntime.jsxs("span", _objectSpread2(_objectSpread2({}, props), {}, {
1142
- className: "jsx-2467502931" + " " + (props && props.className != null && props.className || classes || ""),
1143
- children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1144
- id: "2467502931",
1145
- children: ".icon.jsx-2467502931{position:absolute;left:var(--helpdice-ui-button-icon-padding);right:auto;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--helpdice-ui-button-color);z-index:1;}.right.jsx-2467502931{right:var(--helpdice-ui-button-icon-padding);left:auto;}.icon.jsx-2467502931 svg{background:transparent;height:calc(var(--helpdice-ui-button-height) / 2.35);width:calc(var(--helpdice-ui-button-height) / 2.35);}.single.jsx-2467502931{position:static;-webkit-transform:none;-ms-transform:none;transform:none;}"
1146
- })]
1147
- }));
1148
- };
1149
- ButtonIcon.displayName = 'ButtonIcon';
1150
-
1151
- var getButtonChildrenWithIcon = function getButtonChildrenWithIcon(auto, children, icons) {
1152
- var icon = icons.icon,
1153
- iconRight = icons.iconRight;
1154
- var hasIcon = icon || iconRight;
1155
- var isRight = Boolean(iconRight);
1156
- var paddingForAutoMode = auto ? "calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding) * .5)" : 0;
1157
- var classes = theme.useClasses('text', isRight ? 'right' : 'left');
1158
- if (!hasIcon) return /*#__PURE__*/jsxRuntime.jsx("div", {
1159
- className: "text",
1160
- children: children
1161
- });
1162
- if (React.Children.count(children) === 0) {
1163
- return /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
1164
- isRight: isRight,
1165
- isSingle: true,
1166
- children: hasIcon
1167
- });
1168
- }
1169
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1170
- children: [/*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
1171
- isRight: isRight,
1172
- children: hasIcon
1173
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1174
- className: _JSXStyle.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || ""),
1175
- children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1176
- id: "3568181479",
1177
- dynamic: [paddingForAutoMode, paddingForAutoMode],
1178
- children: ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}")
1179
- })]
1180
- })]
1181
- });
1182
- };
1183
- var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
1184
- if (!config.isButtonGroup) return props;
1185
- return _objectSpread2(_objectSpread2({}, props), {}, {
1186
- auto: true,
1187
- shadow: false,
1188
- ghost: config.ghost || props.ghost,
1189
- type: config.type || props.type,
1190
- disabled: config.disabled || props.disabled
1191
- });
1192
- };
1193
-
1194
- /* "use client" */
1195
-
1196
- var defaultContext$1 = {
1197
- isButtonGroup: false,
1198
- disabled: false
1199
- };
1200
- var ButtonGroupContext = /*#__PURE__*/React.createContext(defaultContext$1);
1201
- var useButtonGroupContext = function useButtonGroupContext() {
1202
- return React.useContext(ButtonGroupContext);
1203
- };
1204
-
1205
- var hexToRgb = function hexToRgb(color) {
1206
- var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
1207
- var full = color.replace(fullReg, function (_, r, g, b) {
1208
- return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
1209
- });
1210
- var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
1211
- if (!values) {
1212
- throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
1213
- }
1214
- return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
1215
- };
1216
- var colorToRgbValues = function colorToRgbValues(color) {
1217
- if (color.charAt(0) === '#') return hexToRgb(color);
1218
- var safeColor = color.replace(/ /g, '');
1219
- var colorType = color.substr(0, 4);
1220
- var regArray = safeColor.match(/\((.+)\)/);
1221
- if (!colorType.startsWith('rgb') || !regArray) {
1222
- console.log(color);
1223
- throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
1224
- }
1225
- return regArray[1].split(',').map(function (str) {
1226
- return Number.parseFloat(str);
1227
- });
1228
- };
1229
- var addColorAlpha = function addColorAlpha(color, alpha) {
1230
- if (!/^#|rgb|RGB/.test(color)) return color;
1231
- var _colorToRgbValues = colorToRgbValues(color),
1232
- _colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
1233
- r = _colorToRgbValues2[0],
1234
- g = _colorToRgbValues2[1],
1235
- b = _colorToRgbValues2[2];
1236
- var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
1237
- return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
1238
- };
1239
-
1240
- var getButtonGhostColors = function getButtonGhostColors(palette, _color) {
1241
- var colors = {
1242
- secondary: {
1243
- bg: palette.background,
1244
- border: palette.foreground,
1245
- color: palette.foreground,
1246
- ripple: ''
1247
- },
1248
- success: {
1249
- bg: palette.background,
1250
- border: palette.success,
1251
- color: palette.success,
1252
- ripple: ''
1253
- },
1254
- warning: {
1255
- bg: palette.background,
1256
- border: palette.warning,
1257
- color: palette.warning,
1258
- ripple: ''
1259
- },
1260
- error: {
1261
- bg: palette.background,
1262
- border: palette.error,
1263
- color: palette.error,
1264
- ripple: ''
1265
- }
1266
- };
1267
- return colors[_color] || null;
1268
- };
1269
- var getButtonColors = function getButtonColors(palette, props) {
1270
- var color = props.color,
1271
- disabled = props.disabled,
1272
- ghost = props.ghost;
1273
- var colors = {
1274
- "default": {
1275
- bg: palette.background,
1276
- border: palette.border,
1277
- color: palette.accents_5,
1278
- ripple: palette.accents_1
1279
- },
1280
- secondary: {
1281
- bg: palette.foreground,
1282
- border: palette.foreground,
1283
- color: palette.background,
1284
- ripple: palette.accents_1
1285
- },
1286
- success: {
1287
- bg: palette.success,
1288
- border: palette.success,
1289
- color: '#fff',
1290
- ripple: '#1f93ffff'
1291
- },
1292
- warning: {
1293
- bg: palette.warning,
1294
- border: palette.warning,
1295
- color: '#fff',
1296
- ripple: '#ffca29ff'
1297
- },
1298
- error: {
1299
- bg: palette.error,
1300
- border: palette.error,
1301
- color: '#fff',
1302
- ripple: '#ff5a55ff'
1303
- },
1304
- abort: {
1305
- bg: 'transparent',
1306
- border: 'transparent',
1307
- color: palette.accents_5,
1308
- ripple: palette.accents_1
1309
- }
1310
- };
1311
- if (disabled) return {
1312
- bg: palette.accents_1,
1313
- border: palette.accents_2,
1314
- color: '#ccc',
1315
- ripple: ''
1316
- };
1317
-
1318
- /**
1319
- * The '-light' type is the same color as the common type,
1320
- * only hover's color is different.
1321
- * e.g.
1322
- * Color['success'] === Color['success-light']
1323
- * Color['warning'] === Color['warning-light']
1324
- */
1325
- var withoutLightType = color === null || color === void 0 ? void 0 : color.replace('-light', '');
1326
- var defaultColor = colors["default"];
1327
- if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
1328
- return colors[withoutLightType] || defaultColor;
1329
- };
1330
- var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, _color) {
1331
- var colors = {
1332
- secondary: {
1333
- bg: palette.foreground,
1334
- border: palette.background,
1335
- color: palette.background
1336
- },
1337
- success: {
1338
- bg: palette.success,
1339
- border: palette.background,
1340
- color: 'white'
1341
- },
1342
- warning: {
1343
- bg: palette.warning,
1344
- border: palette.background,
1345
- color: 'white'
1346
- },
1347
- error: {
1348
- bg: palette.error,
1349
- border: palette.background,
1350
- color: 'white'
1351
- }
1352
- };
1353
- var withoutLightType = _color === null || _color === void 0 ? void 0 : _color.replace('-light', '');
1354
- return colors[withoutLightType] || null;
1355
- };
1356
- var getButtonHoverColors = function getButtonHoverColors(palette, props) {
1357
- var color = props.color,
1358
- disabled = props.disabled,
1359
- loading = props.loading,
1360
- shadow = props.shadow,
1361
- ghost = props.ghost;
1362
- var defaultColor = getButtonColors(palette, props);
1363
- var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
1364
- var colors = {
1365
- "default": {
1366
- bg: palette.background,
1367
- border: palette.foreground
1368
- },
1369
- secondary: {
1370
- bg: palette.background,
1371
- border: palette.foreground
1372
- },
1373
- success: {
1374
- bg: palette.background,
1375
- border: palette.success
1376
- },
1377
- warning: {
1378
- bg: palette.background,
1379
- border: palette.warning
1380
- },
1381
- error: {
1382
- bg: palette.background,
1383
- border: palette.error
1384
- },
1385
- abort: {
1386
- bg: 'transparent',
1387
- border: 'transparent',
1388
- color: palette.accents_5
1389
- },
1390
- 'secondary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1391
- bg: alphaBackground
1392
- }),
1393
- 'success-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1394
- bg: alphaBackground
1395
- }),
1396
- 'warning-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1397
- bg: alphaBackground
1398
- }),
1399
- 'error-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1400
- bg: alphaBackground
1401
- })
1402
- };
1403
- if (disabled) return {
1404
- bg: palette.accents_1,
1405
- border: palette.accents_2,
1406
- color: '#ccc'
1407
- };
1408
- if (loading) return _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1409
- color: 'transparent'
1410
- });
1411
- if (shadow) return defaultColor;
1412
- var hoverColor = (ghost ? getButtonGhostHoverColors(palette, color) : colors[color]) || colors["default"];
1413
- return _objectSpread2(_objectSpread2({}, hoverColor), {}, {
1414
- color: hoverColor.color || hoverColor.border
1415
- });
1416
- };
1417
- var getButtonCursor = function getButtonCursor(disabled, loading) {
1418
- if (disabled) return {
1419
- cursor: 'not-allowed',
1420
- events: 'auto'
1421
- };
1422
- if (loading) return {
1423
- cursor: 'default',
1424
- events: 'none'
1425
- };
1426
- return {
1427
- cursor: 'pointer',
1428
- events: 'auto'
1429
- };
1430
- };
1431
- var getButtonDripColor = function getButtonDripColor(palette, props) {
1432
- var type = props.type;
1433
- var isLightHover = type ? type.endsWith('light') : false;
1434
- var hoverColors = getButtonHoverColors(palette, props);
1435
- return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
1436
- };
1437
-
1438
- var _excluded$6 = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "relative", "replace", "a", "to", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
1439
- var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
1440
- var theme$1 = theme.useTheme();
1441
- // const navigate = useNavigate();
1442
- var _useScale = useScale(),
1443
- SCALES = _useScale.SCALES;
1444
- var buttonRef = React.useRef(null);
1445
- React.useImperativeHandle(ref, function () {
1446
- return buttonRef.current;
1447
- }); // Changed with !
1448
-
1449
- var _useState = React.useState(false),
1450
- _useState2 = _slicedToArray(_useState, 2),
1451
- dripShow = _useState2[0],
1452
- setDripShow = _useState2[1];
1453
- var _useState3 = React.useState(0),
1454
- _useState4 = _slicedToArray(_useState3, 2),
1455
- dripX = _useState4[0],
1456
- setDripX = _useState4[1];
1457
- var _useState5 = React.useState(0),
1458
- _useState6 = _slicedToArray(_useState5, 2),
1459
- dripY = _useState6[0],
1460
- setDripY = _useState6[1];
1461
- var groupConfig = useButtonGroupContext();
1462
- var filteredProps = filterPropsWithGroup(btnProps, groupConfig);
1463
- /* eslint-disable @typescript-eslint/no-unused-vars */
1464
- var children = filteredProps.children,
1465
- _filteredProps$disabl = filteredProps.disabled,
1466
- disabled = _filteredProps$disabl === void 0 ? false : _filteredProps$disabl;
1467
- filteredProps.color;
1468
- var _filteredProps$loadin = filteredProps.loading,
1469
- loading = _filteredProps$loadin === void 0 ? false : _filteredProps$loadin,
1470
- _filteredProps$shadow = filteredProps.shadow,
1471
- shadow = _filteredProps$shadow === void 0 ? false : _filteredProps$shadow,
1472
- _filteredProps$ghost = filteredProps.ghost,
1473
- ghost = _filteredProps$ghost === void 0 ? false : _filteredProps$ghost,
1474
- _filteredProps$effect = filteredProps.effect,
1475
- effect = _filteredProps$effect === void 0 ? true : _filteredProps$effect,
1476
- _filteredProps$round = filteredProps.round,
1477
- round = _filteredProps$round === void 0 ? false : _filteredProps$round;
1478
- filteredProps.relative;
1479
- filteredProps.replace;
1480
- filteredProps.a;
1481
- var to = filteredProps.to,
1482
- onClick = filteredProps.onClick,
1483
- _filteredProps$auto = filteredProps.auto,
1484
- auto = _filteredProps$auto === void 0 ? false : _filteredProps$auto,
1485
- icon = filteredProps.icon,
1486
- _filteredProps$type = filteredProps.type,
1487
- type = _filteredProps$type === void 0 ? 'button' : _filteredProps$type,
1488
- iconRight = filteredProps.iconRight,
1489
- _filteredProps$classN = filteredProps.className,
1490
- className = _filteredProps$classN === void 0 ? '' : _filteredProps$classN;
1491
- filteredProps.crossOrigin;
1492
- var props = _objectWithoutProperties(filteredProps, _excluded$6);
1493
- /* eslint-enable @typescript-eslint/no-unused-vars */
1494
-
1495
- var _useMemo = React.useMemo(function () {
1496
- return getButtonColors(theme$1.palette, filteredProps);
1497
- }, [theme$1.palette, filteredProps]),
1498
- bg = _useMemo.bg,
1499
- border = _useMemo.border,
1500
- color = _useMemo.color,
1501
- rippleColor = _useMemo.ripple;
1502
- var hover = React.useMemo(function () {
1503
- return getButtonHoverColors(theme$1.palette, filteredProps);
1504
- }, [theme$1.palette, filteredProps]);
1505
- var _useMemo2 = React.useMemo(function () {
1506
- return getButtonCursor(disabled, loading);
1507
- }, [disabled, loading]),
1508
- cursor = _useMemo2.cursor,
1509
- events = _useMemo2.events;
1510
- var dripColor = React.useMemo(function () {
1511
- return getButtonDripColor(theme$1.palette, filteredProps);
1512
- }, [theme$1.palette, filteredProps]);
1513
-
1514
- /* istanbul ignore next */
1515
- var dripCompletedHandle = function dripCompletedHandle() {
1516
- setDripShow(false);
1517
- setDripX(0);
1518
- setDripY(0);
1519
- };
1520
- var createRipple = function createRipple(event) {
1521
- var button = buttonRef.current;
1522
- if (!button) return;
1523
- var rect = button.getBoundingClientRect();
1524
- var size = Math.max(rect.width, rect.height);
1525
- var x = event.clientX - rect.left - size / 2;
1526
- var y = event.clientY - rect.top - size / 2;
1527
- var rippleCount = 1; // number of rings
1528
- var rippleDelay = 500; // ms between each ripple
1529
- var _loop = function _loop() {
1530
- var ripple = document.createElement('span');
1531
- Object.assign(ripple.style, {
1532
- position: 'absolute',
1533
- borderRadius: '50%',
1534
- backgroundColor: rippleColor,
1535
- width: "".concat(size, "px"),
1536
- height: "".concat(size, "px"),
1537
- left: "".concat(x, "px"),
1538
- top: "".concat(y, "px"),
1539
- pointerEvents: 'none',
1540
- transform: 'scale(0)',
1541
- opacity: '1',
1542
- transition: "transform 600ms ease-out ".concat(i * rippleDelay, "ms, opacity 600ms ease-out ").concat(i * rippleDelay, "ms"),
1543
- zIndex: 1
1544
- });
1545
- button.appendChild(ripple);
1546
-
1547
- // Force reflow to start transition
1548
- window.getComputedStyle(ripple).opacity;
1549
- ripple.style.transform = 'scale(2.5)';
1550
- ripple.style.opacity = '0';
1551
- ripple.addEventListener('transitionend', function () {
1552
- ripple.remove();
1553
- });
1554
- };
1555
- for (var i = 0; i < rippleCount; i++) {
1556
- _loop();
1557
- }
1558
- };
1559
- var clickHandler = function clickHandler(event) {
1560
- if (disabled || loading) return;
1561
- var showDrip = !shadow && !ghost && effect;
1562
- /* istanbul ignore next */
1563
- if (showDrip && buttonRef.current) {
1564
- var rect = buttonRef.current.getBoundingClientRect();
1565
- setDripShow(true);
1566
- setDripX(event.clientX - rect.left);
1567
- setDripY(event.clientY - rect.top);
1568
- }
1569
- if (shadow) {
1570
- createRipple(event);
1571
- }
1572
- onClick && onClick(event);
1573
- };
1574
- var childrenWithIcon = React.useMemo(function () {
1575
- return getButtonChildrenWithIcon(auto, children, {
1576
- icon: icon,
1577
- iconRight: iconRight
1578
- });
1579
- }, [auto, children, icon, iconRight]);
1580
- var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
1581
- paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
1582
-
1583
- // If shadow provided is string then value other default
1584
- var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme$1.shadows.level.z2 : 'none';
1585
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1586
- children: [to ? /*#__PURE__*/jsxRuntime.jsxs("a", _objectSpread2(_objectSpread2({
1587
- href: to
1588
- }, props), {}, {
1589
- className: _JSXStyle.dynamic([["612376042", [SCALES.height(2.5), round ? '50%' : theme$1.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor !== null && cursor !== void 0 ? cursor : 'pointer', events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px']]]) + " " + (props && props.className != null && props.className || theme.useClasses('btn', 'btn-link', className) || ""),
1590
- children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
1591
- color: color
1592
- }), childrenWithIcon]
1593
- })) : /*#__PURE__*/jsxRuntime.jsxs("button", _objectSpread2(_objectSpread2({
1594
- ref: buttonRef,
1595
- type: type,
1596
- disabled: disabled,
1597
- onClick: clickHandler
1598
- }, props), {}, {
1599
- className: _JSXStyle.dynamic([["612376042", [SCALES.height(2.5), round ? '50%' : theme$1.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor !== null && cursor !== void 0 ? cursor : 'pointer', events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px']]]) + " " + (props && props.className != null && props.className || theme.useClasses('btn', className) || ""),
1600
- children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
1601
- color: color
1602
- }), childrenWithIcon, dripShow && /*#__PURE__*/jsxRuntime.jsx(ButtonDrip, {
1603
- x: dripX,
1604
- y: dripY,
1605
- color: dripColor,
1606
- onCompleted: dripCompletedHandle
1607
- })]
1608
- })), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1609
- id: "612376042",
1610
- dynamic: [SCALES.height(2.5), round ? '50%' : theme$1.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor !== null && cursor !== void 0 ? cursor : 'pointer', events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px'],
1611
- children: ".btn.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;line-height:".concat(SCALES.height(2.5), ";border-radius:").concat(round ? '50%' : theme$1.layout.radius, ";font-weight:400;font-size:").concat(SCALES.font(0.875), ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;text-transform:capitalize;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;white-space:nowrap;-webkit-transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;position:relative;overflow:hidden;color:").concat(color, ";background-color:").concat(bg, ";border:1px solid ").concat(shadow ? 'transparent' : border, ";cursor:").concat(cursor !== null && cursor !== void 0 ? cursor : 'pointer', ";pointer-events:").concat(events, ";box-shadow:").concat(shadow ? btnShadow : 'none', ";--helpdice-ui-button-icon-padding:").concat(SCALES.pl(0.727), ";--helpdice-ui-button-height:").concat(SCALES.height(2.5), ";--helpdice-ui-button-color:").concat(color, ";--helpdice-ui-button-bg:").concat(bg, ";min-width:").concat(auto ? 'min-content' : SCALES.width(10.5), ";width:").concat(auto ? 'auto' : 'initial', ";height:").concat(SCALES.height(2.5), ";padding:").concat(SCALES.pt(0), " ").concat(paddingRight, " ").concat(SCALES.pb(0), " ").concat(paddingLeft, ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.btn.__jsx-style-dynamic-selector:hover,.btn.__jsx-style-dynamic-selector:focus{color:").concat(hover.color, ";--helpdice-ui-button-color:").concat(hover.color, ";background-color:").concat(hover.bg, ";border-color:").concat(hover.border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(btnShadow, ";}.btn-link.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.btn.__jsx-style-dynamic-selector .text{position:relative;z-index:1;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;text-align:center;line-height:inherit;top:-1px;}.btn.__jsx-style-dynamic-selector .text p,.btn.__jsx-style-dynamic-selector .text pre,.btn.__jsx-style-dynamic-selector .text div{margin:0;}.ripple.__jsx-style-dynamic-selector{position:absolute;border-radius:50%;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;background-color:rgba(0,0,0,0.3);pointer-events:none;z-index:1;}@-webkit-keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}@keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}")
1612
- })]
1613
- });
1614
- });
1615
- ButtonComponent.displayName = 'Button';
1616
- var Button = withScale(ButtonComponent);
1617
-
1618
- var CompactButton = function CompactButton(props) {
1619
- // const theme = useTheme();
1620
- return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
1621
- scale: 2 / 3,
1622
- px: 0.6
1623
- }, _objectSpread2({
1624
- auto: true
1625
- }, props)), {}, {
1626
- children: props.children
1627
- }));
1628
- };
1629
- var IconButton = /*#__PURE__*/React.memo(CompactButton);
1630
-
1631
- var SmallButton = function SmallButton(props) {
1632
- // const theme = useTheme();
1633
- return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
1634
- auto: true,
1635
- scale: 2 / 3,
1636
- px: 0.6
1637
- }, props), {}, {
1638
- children: props.children
1639
- }));
1640
- };
1641
- var SmallButton$1 = /*#__PURE__*/React.memo(SmallButton);
1642
-
1643
- /* "use client" */
1644
-
1645
- Button.Icon = IconButton;
1646
- Button.Small = SmallButton$1;
1647
-
1648
- var _excluded$5 = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "collapse", "children", "className", "display", "alignItems", "justify"];
1003
+ var _excluded$6 = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "children", "className", "display", "alignItems", "justify"];
1649
1004
  var _getModifierChild = function getModifierChild(tags, children) {
1650
1005
  if (!tags.length) return children;
1651
1006
  var nextTag = tags.slice(1, tags.length);
@@ -1685,8 +1040,6 @@ var TextComponent = function TextComponent(_ref) {
1685
1040
  blockquote = _ref$blockquote === void 0 ? false : _ref$blockquote,
1686
1041
  _ref$noWrap = _ref.noWrap,
1687
1042
  noWrap = _ref$noWrap === void 0 ? false : _ref$noWrap,
1688
- _ref$collapse = _ref.collapse,
1689
- collapse = _ref$collapse === void 0 ? 0 : _ref$collapse,
1690
1043
  children = _ref.children,
1691
1044
  _ref$className = _ref.className,
1692
1045
  className = _ref$className === void 0 ? '' : _ref$className,
@@ -1694,7 +1047,7 @@ var TextComponent = function TextComponent(_ref) {
1694
1047
  display = _ref$display === void 0 ? 'block' : _ref$display,
1695
1048
  alignItems = _ref.alignItems,
1696
1049
  justify = _ref.justify,
1697
- props = _objectWithoutProperties(_ref, _excluded$5);
1050
+ props = _objectWithoutProperties(_ref, _excluded$6);
1698
1051
  var elements = {
1699
1052
  h1: h1,
1700
1053
  h2: h2,
@@ -1730,10 +1083,6 @@ var TextComponent = function TextComponent(_ref) {
1730
1083
  *
1731
1084
  */
1732
1085
 
1733
- var _useState = React.useState(false),
1734
- _useState2 = _slicedToArray(_useState, 2),
1735
- expand = _useState2[0],
1736
- setExpand = _useState2[1];
1737
1086
  var tag = React.useMemo(function () {
1738
1087
  if (names[0]) return names[0];
1739
1088
  if (inlineNames[0]) return inlineNames[0];
@@ -1756,26 +1105,7 @@ var TextComponent = function TextComponent(_ref) {
1756
1105
  className: "".concat(className, " ").concat(noWrap ? 'no-wrap' : ''),
1757
1106
  tag: tag
1758
1107
  }, props), {}, {
1759
- children: typeof children === 'string' && collapse > 50 ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1760
- children: [expand ? modifers : (modifers === null || modifers === void 0 ? void 0 : modifers.toString().substring(0, collapse)) + '...', /*#__PURE__*/jsxRuntime.jsx(Button, {
1761
- margin: 0,
1762
- onClick: function onClick() {
1763
- return setExpand(!expand);
1764
- },
1765
- style: {
1766
- textTransform: 'lowercase'
1767
- },
1768
- effect: false,
1769
- color: "abort",
1770
- scale: 2 / 3,
1771
- px: 0.2,
1772
- py: 0,
1773
- auto: true,
1774
- children: /*#__PURE__*/jsxRuntime.jsx("b", {
1775
- children: expand ? 'less' : 'more'
1776
- })
1777
- })]
1778
- }) : modifers
1108
+ children: modifers
1779
1109
  }));
1780
1110
  };
1781
1111
  TextComponent.displayName = 'Text';
@@ -1912,7 +1242,7 @@ var getColors = function getColors(palette, status) {
1912
1242
  return colors[status];
1913
1243
  };
1914
1244
 
1915
- var _excluded$4 = ["label", "labelRight", "error", "color", "helperText", "type", "icon", "variant", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "onEnter", "autoComplete", "placeholder", "children", "disabled", "fullWidth", "required"];
1245
+ var _excluded$5 = ["label", "labelRight", "error", "color", "helperText", "type", "icon", "variant", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "onEnter", "autoComplete", "placeholder", "children", "disabled", "fullWidth", "required"];
1916
1246
  var simulateChangeEvent = function simulateChangeEvent(el, event) {
1917
1247
  return _objectSpread2(_objectSpread2({}, event), {}, {
1918
1248
  target: el,
@@ -1959,7 +1289,7 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
1959
1289
  _ref$fullWidth = _ref.fullWidth,
1960
1290
  fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
1961
1291
  required = _ref.required,
1962
- props = _objectWithoutProperties(_ref, _excluded$4);
1292
+ props = _objectWithoutProperties(_ref, _excluded$5);
1963
1293
  var theme$1 = theme.useTheme();
1964
1294
  var _useScale = useScale(),
1965
1295
  SCALES = _useScale.SCALES;
@@ -2113,7 +1443,7 @@ tuple('hover', 'click');
2113
1443
  tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
2114
1444
  tuple('start', 'center', 'end', 'left', 'right');
2115
1445
 
2116
- var _excluded$3 = ["type", "disabled", "readOnly", "onFocus", "onBlur", "className", "initialValue", "onChange", "value", "placeholder", "helperText", "error", "label", "required", "resize"];
1446
+ var _excluded$4 = ["type", "disabled", "readOnly", "onFocus", "onBlur", "className", "initialValue", "onChange", "value", "placeholder", "helperText", "error", "label", "required", "resize"];
2117
1447
  tuple('none', 'both', 'horizontal', 'vertical', 'initial', 'inherit');
2118
1448
  var TextareaComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
2119
1449
  var _ref$type = _ref.type,
@@ -2137,7 +1467,7 @@ var TextareaComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
2137
1467
  required = _ref.required,
2138
1468
  _ref$resize = _ref.resize,
2139
1469
  resize = _ref$resize === void 0 ? 'none' : _ref$resize,
2140
- props = _objectWithoutProperties(_ref, _excluded$3);
1470
+ props = _objectWithoutProperties(_ref, _excluded$4);
2141
1471
  var theme$1 = theme.useTheme();
2142
1472
  var _useScale = useScale(),
2143
1473
  SCALES = _useScale.SCALES;
@@ -2261,11 +1591,11 @@ var PasswordIcon = function PasswordIcon(_ref) {
2261
1591
  };
2262
1592
  var MemoPasswordIcon = /*#__PURE__*/React.memo(PasswordIcon);
2263
1593
 
2264
- var _excluded$2 = ["hideToggle", "children"];
1594
+ var _excluded$3 = ["hideToggle", "children"];
2265
1595
  var InputPasswordComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
2266
1596
  var hideToggle = _ref.hideToggle,
2267
1597
  children = _ref.children,
2268
- props = _objectWithoutProperties(_ref, _excluded$2);
1598
+ props = _objectWithoutProperties(_ref, _excluded$3);
2269
1599
  var _useScale = useScale(),
2270
1600
  getAllScaleProps = _useScale.getAllScaleProps;
2271
1601
  var inputRef = React.useRef(null);
@@ -3873,7 +3203,7 @@ var repositionCursor = function repositionCursor(_ref) {
3873
3203
  };
3874
3204
  };
3875
3205
 
3876
- var _excluded$1 = ["allowDecimals", "allowNegativeValue", "id", "name", "className", "customInput", "decimalsLimit", "defaultValue", "disabled", "maxLength", "value", "onValueChange", "fixedDecimalLength", "placeholder", "decimalScale", "prefix", "suffix", "intlConfig", "fullWidth", "step", "min", "max", "disableGroupSeparators", "disableAbbreviations", "decimalSeparator", "groupSeparator", "onChange", "onFocus", "onBlur", "onKeyDown", "onKeyUp", "transformRawValue", "formatValueOnBlur", "children"];
3206
+ var _excluded$2 = ["allowDecimals", "allowNegativeValue", "id", "name", "className", "customInput", "decimalsLimit", "defaultValue", "disabled", "maxLength", "value", "onValueChange", "fixedDecimalLength", "placeholder", "decimalScale", "prefix", "suffix", "intlConfig", "fullWidth", "step", "min", "max", "disableGroupSeparators", "disableAbbreviations", "decimalSeparator", "groupSeparator", "onChange", "onFocus", "onBlur", "onKeyDown", "onKeyUp", "transformRawValue", "formatValueOnBlur", "children"];
3877
3207
  var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3878
3208
  var _ref$allowDecimals = _ref.allowDecimals,
3879
3209
  allowDecimals = _ref$allowDecimals === void 0 ? true : _ref$allowDecimals,
@@ -3915,7 +3245,7 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3915
3245
  _ref$formatValueOnBlu = _ref.formatValueOnBlur,
3916
3246
  formatValueOnBlur = _ref$formatValueOnBlu === void 0 ? true : _ref$formatValueOnBlu,
3917
3247
  children = _ref.children,
3918
- props = _objectWithoutProperties(_ref, _excluded$1);
3248
+ props = _objectWithoutProperties(_ref, _excluded$2);
3919
3249
  var _useScale = useScale(),
3920
3250
  SCALES = _useScale.SCALES;
3921
3251
  var theme$1 = theme.useTheme();
@@ -4341,6 +3671,58 @@ var AutoCompleteEmpty = function AutoCompleteEmpty(_ref) {
4341
3671
  };
4342
3672
  AutoCompleteEmpty.displayName = 'AutoCompleteEmpty';
4343
3673
 
3674
+ var _excluded$1 = ["children", "type", "color", "className", "spaceRatio"];
3675
+ var getIconBgColor = function getIconBgColor(type, palette, color) {
3676
+ var colors = {
3677
+ "default": palette.accents_6,
3678
+ secondary: palette.secondary,
3679
+ success: palette.success,
3680
+ warning: palette.warning,
3681
+ error: palette.error
3682
+ };
3683
+ return color ? color : colors[type];
3684
+ };
3685
+ var LoadingComponent = function LoadingComponent(_ref) {
3686
+ var children = _ref.children,
3687
+ _ref$type = _ref.type,
3688
+ type = _ref$type === void 0 ? 'default' : _ref$type,
3689
+ color = _ref.color,
3690
+ _ref$className = _ref.className,
3691
+ className = _ref$className === void 0 ? '' : _ref$className,
3692
+ _ref$spaceRatio = _ref.spaceRatio,
3693
+ spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
3694
+ props = _objectWithoutProperties(_ref, _excluded$1);
3695
+ var theme$1 = theme.useTheme();
3696
+ var _useScale = useScale(),
3697
+ SCALES = _useScale.SCALES;
3698
+ var classes = theme.useClasses('loading-container', className);
3699
+ var bgColor = React.useMemo(function () {
3700
+ return getIconBgColor(type, theme$1.palette, color);
3701
+ }, [type, theme$1.palette, color]);
3702
+ return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread2(_objectSpread2({}, props), {}, {
3703
+ className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]]) + " " + (props && props.className != null && props.className || classes || ""),
3704
+ children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
3705
+ className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]]) + " " + "loading",
3706
+ children: [children && /*#__PURE__*/jsxRuntime.jsx("label", {
3707
+ className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]]),
3708
+ children: children
3709
+ }), /*#__PURE__*/jsxRuntime.jsx("i", {
3710
+ className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]])
3711
+ }), /*#__PURE__*/jsxRuntime.jsx("i", {
3712
+ className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]])
3713
+ }), /*#__PURE__*/jsxRuntime.jsx("i", {
3714
+ className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]])
3715
+ })]
3716
+ }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
3717
+ id: "2201634259",
3718
+ dynamic: [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio],
3719
+ children: ".loading-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;position:relative;font-size:".concat(SCALES.font(1), ";width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, '100%'), ";min-height:1em;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), ";}label.__jsx-style-dynamic-selector{margin-right:0.5em;color:").concat(theme$1.palette.accents_5, ";line-height:1;}label.__jsx-style-dynamic-selector *{margin:0;}.loading.__jsx-style-dynamic-selector{position:absolute;top:50%;left:50%;width:100%;height:100%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:transparent;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}i.__jsx-style-dynamic-selector{width:0.25em;height:0.25em;border-radius:50%;background-color:").concat(bgColor, ";margin:0 calc(0.25em / 2 * ").concat(spaceRatio, ");display:inline-block;-webkit-animation:loading-blink-__jsx-style-dynamic-selector 1.4s infinite both;animation:loading-blink-__jsx-style-dynamic-selector 1.4s infinite both;}i.__jsx-style-dynamic-selector:nth-child(2){-webkit-animation-delay:0.2s;animation-delay:0.2s;}i.__jsx-style-dynamic-selector:nth-child(3){-webkit-animation-delay:0.4s;animation-delay:0.4s;}@-webkit-keyframes loading-blink-__jsx-style-dynamic-selector{0%{opacity:0.2;}20%{opacity:1;}100%{opacity:0.2;}}@keyframes loading-blink-__jsx-style-dynamic-selector{0%{opacity:0.2;}20%{opacity:1;}100%{opacity:0.2;}}")
3720
+ })]
3721
+ }));
3722
+ };
3723
+ LoadingComponent.displayName = 'Loading';
3724
+ var Loading = withScale(LoadingComponent);
3725
+
4344
3726
  var _excluded = ["options", "initialValue", "onSelect", "onSearch", "onChange", "searching", "children", "type", "color", "value", "clearable", "disabled", "dropdownClassName", "dropdownStyle", "disableMatchWidth", "disableFreeSolo", "getPopupContainer"];
4345
3727
  var childrenToOptionsNode = function childrenToOptionsNode(options) {
4346
3728
  return options.map(function (item, index) {