@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.
@@ -11,9 +11,6 @@ function _arrayLikeToArray(r, a) {
11
11
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
12
12
  return n;
13
13
  }
14
- function _arrayWithHoles(r) {
15
- if (Array.isArray(r)) return r;
16
- }
17
14
  function _createForOfIteratorHelper(r, e) {
18
15
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
19
16
  if (!t) {
@@ -70,36 +67,6 @@ function _defineProperty(e, r, t) {
70
67
  writable: true
71
68
  }) : e[r] = t, e;
72
69
  }
73
- function _iterableToArrayLimit(r, l) {
74
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
75
- if (null != t) {
76
- var e,
77
- n,
78
- i,
79
- u,
80
- a = [],
81
- f = true,
82
- o = false;
83
- try {
84
- if (i = (t = t.call(r)).next, 0 === l) {
85
- if (Object(t) !== t) return;
86
- f = !1;
87
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
88
- } catch (r) {
89
- o = true, n = r;
90
- } finally {
91
- try {
92
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
93
- } finally {
94
- if (o) throw n;
95
- }
96
- }
97
- return a;
98
- }
99
- }
100
- function _nonIterableRest() {
101
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
102
- }
103
70
  function _objectDestructuringEmpty(t) {
104
71
  if (null == t) throw new TypeError("Cannot destructure " + t);
105
72
  }
@@ -144,9 +111,6 @@ function _objectWithoutPropertiesLoose(r, e) {
144
111
  }
145
112
  return t;
146
113
  }
147
- function _slicedToArray(r, e) {
148
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
149
- }
150
114
  function _toPrimitive(t, r) {
151
115
  if ("object" != typeof t || !t) return t;
152
116
  var e = t[Symbol.toPrimitive];
@@ -1026,7 +990,7 @@ var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingL
1026
990
  var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
1027
991
  return "".concat(scale1x);
1028
992
  };
1029
- var defaultContext$1 = {
993
+ var defaultContext = {
1030
994
  getScaleProps: function getScaleProps() {
1031
995
  return undefined;
1032
996
  },
@@ -1052,7 +1016,7 @@ var defaultContext$1 = {
1052
1016
  },
1053
1017
  unit: '16px'
1054
1018
  };
1055
- var ScaleContext = /*#__PURE__*/React.createContext(defaultContext$1);
1019
+ var ScaleContext = /*#__PURE__*/React.createContext(defaultContext);
1056
1020
  var useScale = function useScale() {
1057
1021
  return React.useContext(ScaleContext);
1058
1022
  };
@@ -1109,7 +1073,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
1109
1073
  return getAllScaleProps;
1110
1074
  };
1111
1075
 
1112
- var _excluded$5 = ["children"];
1076
+ var _excluded$2 = ["children"];
1113
1077
  var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
1114
1078
  if (scale === 1) return scale;
1115
1079
  var diff = Math.abs((scale - 1) / 2);
@@ -1119,7 +1083,7 @@ var withScale = function withScale(Render) {
1119
1083
  var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
1120
1084
  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;
1121
1085
  var children = _ref.children,
1122
- props = _objectWithoutProperties(_ref, _excluded$5);
1086
+ props = _objectWithoutProperties(_ref, _excluded$2);
1123
1087
  var _useTheme = theme.useTheme(),
1124
1088
  layout = _useTheme.layout;
1125
1089
  var paddingLeft = props.paddingLeft,
@@ -1204,7 +1168,7 @@ var withScale = function withScale(Render) {
1204
1168
  return ScaleFC;
1205
1169
  };
1206
1170
 
1207
- var _excluded$4 = ["children", "tag", "className", "color"];
1171
+ var _excluded$1 = ["children", "tag", "className", "color"];
1208
1172
  var getTypeColor = function getTypeColor(type, palette) {
1209
1173
  var colors = {
1210
1174
  "default": 'inherit',
@@ -1222,7 +1186,7 @@ var TextChild = function TextChild(_ref) {
1222
1186
  className = _ref$className === void 0 ? '' : _ref$className,
1223
1187
  _ref$color = _ref.color,
1224
1188
  color = _ref$color === void 0 ? 'default' : _ref$color,
1225
- props = _objectWithoutProperties(_ref, _excluded$4);
1189
+ props = _objectWithoutProperties(_ref, _excluded$1);
1226
1190
  var Component = tag;
1227
1191
  var theme$1 = theme.useTheme();
1228
1192
  var _useScale = useScale(),
@@ -1270,652 +1234,7 @@ var TextChild = function TextChild(_ref) {
1270
1234
  };
1271
1235
  TextChild.displayName = 'TextChild';
1272
1236
 
1273
- var ButtonDrip = function ButtonDrip(_ref) {
1274
- var _ref$x = _ref.x,
1275
- x = _ref$x === void 0 ? 0 : _ref$x,
1276
- _ref$y = _ref.y,
1277
- y = _ref$y === void 0 ? 0 : _ref$y,
1278
- color = _ref.color,
1279
- onCompleted = _ref.onCompleted;
1280
- var dripRef = React.useRef(null);
1281
- /* istanbul ignore next */
1282
- var top = Number.isNaN(+y) ? 0 : y - 10;
1283
- /* istanbul ignore next */
1284
- var left = Number.isNaN(+x) ? 0 : x - 10;
1285
- React.useEffect(function () {
1286
- /* istanbul ignore next */
1287
- if (!dripRef.current) return;
1288
- dripRef.current.addEventListener('animationend', onCompleted);
1289
- return function () {
1290
- /* istanbul ignore next */
1291
- if (!dripRef.current) return;
1292
- dripRef.current.removeEventListener('animationend', onCompleted);
1293
- };
1294
- });
1295
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
1296
- ref: dripRef,
1297
- className: "jsx-3424889537" + " " + "drip",
1298
- children: [/*#__PURE__*/jsxRuntime.jsx("svg", {
1299
- width: "20",
1300
- height: "20",
1301
- viewBox: "0 0 20 20",
1302
- style: {
1303
- top: top,
1304
- left: left
1305
- },
1306
- className: "jsx-3424889537",
1307
- children: /*#__PURE__*/jsxRuntime.jsx("g", {
1308
- stroke: "none",
1309
- strokeWidth: "1",
1310
- fill: "none",
1311
- fillRule: "evenodd",
1312
- className: "jsx-3424889537",
1313
- children: /*#__PURE__*/jsxRuntime.jsx("g", {
1314
- fill: color,
1315
- className: "jsx-3424889537",
1316
- children: /*#__PURE__*/jsxRuntime.jsx("rect", {
1317
- width: "100%",
1318
- height: "100%",
1319
- rx: "10",
1320
- className: "jsx-3424889537"
1321
- })
1322
- })
1323
- })
1324
- }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1325
- id: "3424889537",
1326
- 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;}}"
1327
- })]
1328
- });
1329
- };
1330
- ButtonDrip.displayName = 'ButtonDrip';
1331
-
1332
- var _excluded$3 = ["children", "type", "color", "className", "spaceRatio"];
1333
- var getIconBgColor = function getIconBgColor(type, palette, color) {
1334
- var colors = {
1335
- "default": palette.accents_6,
1336
- secondary: palette.secondary,
1337
- success: palette.success,
1338
- warning: palette.warning,
1339
- error: palette.error
1340
- };
1341
- return color ? color : colors[type];
1342
- };
1343
- var LoadingComponent = function LoadingComponent(_ref) {
1344
- var children = _ref.children,
1345
- _ref$type = _ref.type,
1346
- type = _ref$type === void 0 ? 'default' : _ref$type,
1347
- color = _ref.color,
1348
- _ref$className = _ref.className,
1349
- className = _ref$className === void 0 ? '' : _ref$className,
1350
- _ref$spaceRatio = _ref.spaceRatio,
1351
- spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
1352
- props = _objectWithoutProperties(_ref, _excluded$3);
1353
- var theme$1 = theme.useTheme();
1354
- var _useScale = useScale(),
1355
- SCALES = _useScale.SCALES;
1356
- var classes = theme.useClasses('loading-container', className);
1357
- var bgColor = React.useMemo(function () {
1358
- return getIconBgColor(type, theme$1.palette, color);
1359
- }, [type, theme$1.palette, color]);
1360
- return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread2(_objectSpread2({}, props), {}, {
1361
- 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 || ""),
1362
- children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
1363
- 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",
1364
- children: [children && /*#__PURE__*/jsxRuntime.jsx("label", {
1365
- 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]]]),
1366
- children: children
1367
- }), /*#__PURE__*/jsxRuntime.jsx("i", {
1368
- 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]]])
1369
- }), /*#__PURE__*/jsxRuntime.jsx("i", {
1370
- 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]]])
1371
- }), /*#__PURE__*/jsxRuntime.jsx("i", {
1372
- 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]]])
1373
- })]
1374
- }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1375
- id: "2201634259",
1376
- 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],
1377
- 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;}}")
1378
- })]
1379
- }));
1380
- };
1381
- LoadingComponent.displayName = 'Loading';
1382
- var Loading = withScale(LoadingComponent);
1383
-
1384
- var ButtonLoading = function ButtonLoading(_ref) {
1385
- var color = _ref.color;
1386
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
1387
- className: "jsx-212623367" + " " + "btn-loading",
1388
- children: [/*#__PURE__*/jsxRuntime.jsx(Loading, {
1389
- color: color
1390
- }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1391
- id: "212623367",
1392
- 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);}"
1393
- })]
1394
- });
1395
- };
1396
- ButtonLoading.displayName = 'ButtonLoading';
1397
-
1398
- var _excluded$2 = ["isRight", "isSingle", "children", "className"];
1399
- var ButtonIcon = function ButtonIcon(_ref) {
1400
- var _ref$isRight = _ref.isRight,
1401
- isRight = _ref$isRight === void 0 ? false : _ref$isRight,
1402
- isSingle = _ref.isSingle,
1403
- children = _ref.children,
1404
- _ref$className = _ref.className,
1405
- className = _ref$className === void 0 ? '' : _ref$className,
1406
- props = _objectWithoutProperties(_ref, _excluded$2);
1407
- var classes = theme.useClasses('icon', {
1408
- right: isRight,
1409
- single: isSingle
1410
- }, className);
1411
- return /*#__PURE__*/jsxRuntime.jsxs("span", _objectSpread2(_objectSpread2({}, props), {}, {
1412
- className: "jsx-2467502931" + " " + (props && props.className != null && props.className || classes || ""),
1413
- children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1414
- id: "2467502931",
1415
- 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;}"
1416
- })]
1417
- }));
1418
- };
1419
- ButtonIcon.displayName = 'ButtonIcon';
1420
-
1421
- var getButtonChildrenWithIcon = function getButtonChildrenWithIcon(auto, children, icons) {
1422
- var icon = icons.icon,
1423
- iconRight = icons.iconRight;
1424
- var hasIcon = icon || iconRight;
1425
- var isRight = Boolean(iconRight);
1426
- var paddingForAutoMode = auto ? "calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding) * .5)" : 0;
1427
- var classes = theme.useClasses('text', isRight ? 'right' : 'left');
1428
- if (!hasIcon) return /*#__PURE__*/jsxRuntime.jsx("div", {
1429
- className: "text",
1430
- children: children
1431
- });
1432
- if (React.Children.count(children) === 0) {
1433
- return /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
1434
- isRight: isRight,
1435
- isSingle: true,
1436
- children: hasIcon
1437
- });
1438
- }
1439
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1440
- children: [/*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
1441
- isRight: isRight,
1442
- children: hasIcon
1443
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1444
- className: _JSXStyle.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || ""),
1445
- children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1446
- id: "3568181479",
1447
- dynamic: [paddingForAutoMode, paddingForAutoMode],
1448
- children: ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}")
1449
- })]
1450
- })]
1451
- });
1452
- };
1453
- var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
1454
- if (!config.isButtonGroup) return props;
1455
- return _objectSpread2(_objectSpread2({}, props), {}, {
1456
- auto: true,
1457
- shadow: false,
1458
- ghost: config.ghost || props.ghost,
1459
- type: config.type || props.type,
1460
- disabled: config.disabled || props.disabled
1461
- });
1462
- };
1463
-
1464
- /* "use client" */
1465
-
1466
- var defaultContext = {
1467
- isButtonGroup: false,
1468
- disabled: false
1469
- };
1470
- var ButtonGroupContext = /*#__PURE__*/React.createContext(defaultContext);
1471
- var useButtonGroupContext = function useButtonGroupContext() {
1472
- return React.useContext(ButtonGroupContext);
1473
- };
1474
-
1475
- var hexToRgb = function hexToRgb(color) {
1476
- var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
1477
- var full = color.replace(fullReg, function (_, r, g, b) {
1478
- return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
1479
- });
1480
- var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
1481
- if (!values) {
1482
- throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
1483
- }
1484
- return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
1485
- };
1486
- var colorToRgbValues = function colorToRgbValues(color) {
1487
- if (color.charAt(0) === '#') return hexToRgb(color);
1488
- var safeColor = color.replace(/ /g, '');
1489
- var colorType = color.substr(0, 4);
1490
- var regArray = safeColor.match(/\((.+)\)/);
1491
- if (!colorType.startsWith('rgb') || !regArray) {
1492
- console.log(color);
1493
- throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
1494
- }
1495
- return regArray[1].split(',').map(function (str) {
1496
- return Number.parseFloat(str);
1497
- });
1498
- };
1499
- var addColorAlpha = function addColorAlpha(color, alpha) {
1500
- if (!/^#|rgb|RGB/.test(color)) return color;
1501
- var _colorToRgbValues = colorToRgbValues(color),
1502
- _colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
1503
- r = _colorToRgbValues2[0],
1504
- g = _colorToRgbValues2[1],
1505
- b = _colorToRgbValues2[2];
1506
- var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
1507
- return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
1508
- };
1509
-
1510
- var getButtonGhostColors = function getButtonGhostColors(palette, _color) {
1511
- var colors = {
1512
- secondary: {
1513
- bg: palette.background,
1514
- border: palette.foreground,
1515
- color: palette.foreground,
1516
- ripple: ''
1517
- },
1518
- success: {
1519
- bg: palette.background,
1520
- border: palette.success,
1521
- color: palette.success,
1522
- ripple: ''
1523
- },
1524
- warning: {
1525
- bg: palette.background,
1526
- border: palette.warning,
1527
- color: palette.warning,
1528
- ripple: ''
1529
- },
1530
- error: {
1531
- bg: palette.background,
1532
- border: palette.error,
1533
- color: palette.error,
1534
- ripple: ''
1535
- }
1536
- };
1537
- return colors[_color] || null;
1538
- };
1539
- var getButtonColors = function getButtonColors(palette, props) {
1540
- var color = props.color,
1541
- disabled = props.disabled,
1542
- ghost = props.ghost;
1543
- var colors = {
1544
- "default": {
1545
- bg: palette.background,
1546
- border: palette.border,
1547
- color: palette.accents_5,
1548
- ripple: palette.accents_1
1549
- },
1550
- secondary: {
1551
- bg: palette.foreground,
1552
- border: palette.foreground,
1553
- color: palette.background,
1554
- ripple: palette.accents_1
1555
- },
1556
- success: {
1557
- bg: palette.success,
1558
- border: palette.success,
1559
- color: '#fff',
1560
- ripple: '#1f93ffff'
1561
- },
1562
- warning: {
1563
- bg: palette.warning,
1564
- border: palette.warning,
1565
- color: '#fff',
1566
- ripple: '#ffca29ff'
1567
- },
1568
- error: {
1569
- bg: palette.error,
1570
- border: palette.error,
1571
- color: '#fff',
1572
- ripple: '#ff5a55ff'
1573
- },
1574
- abort: {
1575
- bg: 'transparent',
1576
- border: 'transparent',
1577
- color: palette.accents_5,
1578
- ripple: palette.accents_1
1579
- }
1580
- };
1581
- if (disabled) return {
1582
- bg: palette.accents_1,
1583
- border: palette.accents_2,
1584
- color: '#ccc',
1585
- ripple: ''
1586
- };
1587
-
1588
- /**
1589
- * The '-light' type is the same color as the common type,
1590
- * only hover's color is different.
1591
- * e.g.
1592
- * Color['success'] === Color['success-light']
1593
- * Color['warning'] === Color['warning-light']
1594
- */
1595
- var withoutLightType = color === null || color === void 0 ? void 0 : color.replace('-light', '');
1596
- var defaultColor = colors["default"];
1597
- if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
1598
- return colors[withoutLightType] || defaultColor;
1599
- };
1600
- var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, _color) {
1601
- var colors = {
1602
- secondary: {
1603
- bg: palette.foreground,
1604
- border: palette.background,
1605
- color: palette.background
1606
- },
1607
- success: {
1608
- bg: palette.success,
1609
- border: palette.background,
1610
- color: 'white'
1611
- },
1612
- warning: {
1613
- bg: palette.warning,
1614
- border: palette.background,
1615
- color: 'white'
1616
- },
1617
- error: {
1618
- bg: palette.error,
1619
- border: palette.background,
1620
- color: 'white'
1621
- }
1622
- };
1623
- var withoutLightType = _color === null || _color === void 0 ? void 0 : _color.replace('-light', '');
1624
- return colors[withoutLightType] || null;
1625
- };
1626
- var getButtonHoverColors = function getButtonHoverColors(palette, props) {
1627
- var color = props.color,
1628
- disabled = props.disabled,
1629
- loading = props.loading,
1630
- shadow = props.shadow,
1631
- ghost = props.ghost;
1632
- var defaultColor = getButtonColors(palette, props);
1633
- var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
1634
- var colors = {
1635
- "default": {
1636
- bg: palette.background,
1637
- border: palette.foreground
1638
- },
1639
- secondary: {
1640
- bg: palette.background,
1641
- border: palette.foreground
1642
- },
1643
- success: {
1644
- bg: palette.background,
1645
- border: palette.success
1646
- },
1647
- warning: {
1648
- bg: palette.background,
1649
- border: palette.warning
1650
- },
1651
- error: {
1652
- bg: palette.background,
1653
- border: palette.error
1654
- },
1655
- abort: {
1656
- bg: 'transparent',
1657
- border: 'transparent',
1658
- color: palette.accents_5
1659
- },
1660
- 'secondary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1661
- bg: alphaBackground
1662
- }),
1663
- 'success-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1664
- bg: alphaBackground
1665
- }),
1666
- 'warning-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1667
- bg: alphaBackground
1668
- }),
1669
- 'error-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1670
- bg: alphaBackground
1671
- })
1672
- };
1673
- if (disabled) return {
1674
- bg: palette.accents_1,
1675
- border: palette.accents_2,
1676
- color: '#ccc'
1677
- };
1678
- if (loading) return _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1679
- color: 'transparent'
1680
- });
1681
- if (shadow) return defaultColor;
1682
- var hoverColor = (ghost ? getButtonGhostHoverColors(palette, color) : colors[color]) || colors["default"];
1683
- return _objectSpread2(_objectSpread2({}, hoverColor), {}, {
1684
- color: hoverColor.color || hoverColor.border
1685
- });
1686
- };
1687
- var getButtonCursor = function getButtonCursor(disabled, loading) {
1688
- if (disabled) return {
1689
- cursor: 'not-allowed',
1690
- events: 'auto'
1691
- };
1692
- if (loading) return {
1693
- cursor: 'default',
1694
- events: 'none'
1695
- };
1696
- return {
1697
- cursor: 'pointer',
1698
- events: 'auto'
1699
- };
1700
- };
1701
- var getButtonDripColor = function getButtonDripColor(palette, props) {
1702
- var type = props.type;
1703
- var isLightHover = type ? type.endsWith('light') : false;
1704
- var hoverColors = getButtonHoverColors(palette, props);
1705
- return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
1706
- };
1707
-
1708
- var _excluded$1 = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "relative", "replace", "a", "to", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
1709
- var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
1710
- var theme$1 = theme.useTheme();
1711
- // const navigate = useNavigate();
1712
- var _useScale = useScale(),
1713
- SCALES = _useScale.SCALES;
1714
- var buttonRef = React.useRef(null);
1715
- React.useImperativeHandle(ref, function () {
1716
- return buttonRef.current;
1717
- }); // Changed with !
1718
-
1719
- var _useState = React.useState(false),
1720
- _useState2 = _slicedToArray(_useState, 2),
1721
- dripShow = _useState2[0],
1722
- setDripShow = _useState2[1];
1723
- var _useState3 = React.useState(0),
1724
- _useState4 = _slicedToArray(_useState3, 2),
1725
- dripX = _useState4[0],
1726
- setDripX = _useState4[1];
1727
- var _useState5 = React.useState(0),
1728
- _useState6 = _slicedToArray(_useState5, 2),
1729
- dripY = _useState6[0],
1730
- setDripY = _useState6[1];
1731
- var groupConfig = useButtonGroupContext();
1732
- var filteredProps = filterPropsWithGroup(btnProps, groupConfig);
1733
- /* eslint-disable @typescript-eslint/no-unused-vars */
1734
- var children = filteredProps.children,
1735
- _filteredProps$disabl = filteredProps.disabled,
1736
- disabled = _filteredProps$disabl === void 0 ? false : _filteredProps$disabl;
1737
- filteredProps.color;
1738
- var _filteredProps$loadin = filteredProps.loading,
1739
- loading = _filteredProps$loadin === void 0 ? false : _filteredProps$loadin,
1740
- _filteredProps$shadow = filteredProps.shadow,
1741
- shadow = _filteredProps$shadow === void 0 ? false : _filteredProps$shadow,
1742
- _filteredProps$ghost = filteredProps.ghost,
1743
- ghost = _filteredProps$ghost === void 0 ? false : _filteredProps$ghost,
1744
- _filteredProps$effect = filteredProps.effect,
1745
- effect = _filteredProps$effect === void 0 ? true : _filteredProps$effect,
1746
- _filteredProps$round = filteredProps.round,
1747
- round = _filteredProps$round === void 0 ? false : _filteredProps$round;
1748
- filteredProps.relative;
1749
- filteredProps.replace;
1750
- filteredProps.a;
1751
- var to = filteredProps.to,
1752
- onClick = filteredProps.onClick,
1753
- _filteredProps$auto = filteredProps.auto,
1754
- auto = _filteredProps$auto === void 0 ? false : _filteredProps$auto,
1755
- icon = filteredProps.icon,
1756
- _filteredProps$type = filteredProps.type,
1757
- type = _filteredProps$type === void 0 ? 'button' : _filteredProps$type,
1758
- iconRight = filteredProps.iconRight,
1759
- _filteredProps$classN = filteredProps.className,
1760
- className = _filteredProps$classN === void 0 ? '' : _filteredProps$classN;
1761
- filteredProps.crossOrigin;
1762
- var props = _objectWithoutProperties(filteredProps, _excluded$1);
1763
- /* eslint-enable @typescript-eslint/no-unused-vars */
1764
-
1765
- var _useMemo = React.useMemo(function () {
1766
- return getButtonColors(theme$1.palette, filteredProps);
1767
- }, [theme$1.palette, filteredProps]),
1768
- bg = _useMemo.bg,
1769
- border = _useMemo.border,
1770
- color = _useMemo.color,
1771
- rippleColor = _useMemo.ripple;
1772
- var hover = React.useMemo(function () {
1773
- return getButtonHoverColors(theme$1.palette, filteredProps);
1774
- }, [theme$1.palette, filteredProps]);
1775
- var _useMemo2 = React.useMemo(function () {
1776
- return getButtonCursor(disabled, loading);
1777
- }, [disabled, loading]),
1778
- cursor = _useMemo2.cursor,
1779
- events = _useMemo2.events;
1780
- var dripColor = React.useMemo(function () {
1781
- return getButtonDripColor(theme$1.palette, filteredProps);
1782
- }, [theme$1.palette, filteredProps]);
1783
-
1784
- /* istanbul ignore next */
1785
- var dripCompletedHandle = function dripCompletedHandle() {
1786
- setDripShow(false);
1787
- setDripX(0);
1788
- setDripY(0);
1789
- };
1790
- var createRipple = function createRipple(event) {
1791
- var button = buttonRef.current;
1792
- if (!button) return;
1793
- var rect = button.getBoundingClientRect();
1794
- var size = Math.max(rect.width, rect.height);
1795
- var x = event.clientX - rect.left - size / 2;
1796
- var y = event.clientY - rect.top - size / 2;
1797
- var rippleCount = 1; // number of rings
1798
- var rippleDelay = 500; // ms between each ripple
1799
- var _loop = function _loop() {
1800
- var ripple = document.createElement('span');
1801
- Object.assign(ripple.style, {
1802
- position: 'absolute',
1803
- borderRadius: '50%',
1804
- backgroundColor: rippleColor,
1805
- width: "".concat(size, "px"),
1806
- height: "".concat(size, "px"),
1807
- left: "".concat(x, "px"),
1808
- top: "".concat(y, "px"),
1809
- pointerEvents: 'none',
1810
- transform: 'scale(0)',
1811
- opacity: '1',
1812
- transition: "transform 600ms ease-out ".concat(i * rippleDelay, "ms, opacity 600ms ease-out ").concat(i * rippleDelay, "ms"),
1813
- zIndex: 1
1814
- });
1815
- button.appendChild(ripple);
1816
-
1817
- // Force reflow to start transition
1818
- window.getComputedStyle(ripple).opacity;
1819
- ripple.style.transform = 'scale(2.5)';
1820
- ripple.style.opacity = '0';
1821
- ripple.addEventListener('transitionend', function () {
1822
- ripple.remove();
1823
- });
1824
- };
1825
- for (var i = 0; i < rippleCount; i++) {
1826
- _loop();
1827
- }
1828
- };
1829
- var clickHandler = function clickHandler(event) {
1830
- if (disabled || loading) return;
1831
- var showDrip = !shadow && !ghost && effect;
1832
- /* istanbul ignore next */
1833
- if (showDrip && buttonRef.current) {
1834
- var rect = buttonRef.current.getBoundingClientRect();
1835
- setDripShow(true);
1836
- setDripX(event.clientX - rect.left);
1837
- setDripY(event.clientY - rect.top);
1838
- }
1839
- if (shadow) {
1840
- createRipple(event);
1841
- }
1842
- onClick && onClick(event);
1843
- };
1844
- var childrenWithIcon = React.useMemo(function () {
1845
- return getButtonChildrenWithIcon(auto, children, {
1846
- icon: icon,
1847
- iconRight: iconRight
1848
- });
1849
- }, [auto, children, icon, iconRight]);
1850
- var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
1851
- paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
1852
-
1853
- // If shadow provided is string then value other default
1854
- var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme$1.shadows.level.z2 : 'none';
1855
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1856
- children: [to ? /*#__PURE__*/jsxRuntime.jsxs("a", _objectSpread2(_objectSpread2({
1857
- href: to
1858
- }, props), {}, {
1859
- 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) || ""),
1860
- children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
1861
- color: color
1862
- }), childrenWithIcon]
1863
- })) : /*#__PURE__*/jsxRuntime.jsxs("button", _objectSpread2(_objectSpread2({
1864
- ref: buttonRef,
1865
- type: type,
1866
- disabled: disabled,
1867
- onClick: clickHandler
1868
- }, props), {}, {
1869
- 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) || ""),
1870
- children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
1871
- color: color
1872
- }), childrenWithIcon, dripShow && /*#__PURE__*/jsxRuntime.jsx(ButtonDrip, {
1873
- x: dripX,
1874
- y: dripY,
1875
- color: dripColor,
1876
- onCompleted: dripCompletedHandle
1877
- })]
1878
- })), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1879
- id: "612376042",
1880
- 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'],
1881
- 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;}}")
1882
- })]
1883
- });
1884
- });
1885
- ButtonComponent.displayName = 'Button';
1886
- var Button = withScale(ButtonComponent);
1887
-
1888
- var CompactButton = function CompactButton(props) {
1889
- // const theme = useTheme();
1890
- return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
1891
- scale: 2 / 3,
1892
- px: 0.6
1893
- }, _objectSpread2({
1894
- auto: true
1895
- }, props)), {}, {
1896
- children: props.children
1897
- }));
1898
- };
1899
- var IconButton = /*#__PURE__*/React.memo(CompactButton);
1900
-
1901
- var SmallButton = function SmallButton(props) {
1902
- // const theme = useTheme();
1903
- return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
1904
- auto: true,
1905
- scale: 2 / 3,
1906
- px: 0.6
1907
- }, props), {}, {
1908
- children: props.children
1909
- }));
1910
- };
1911
- var SmallButton$1 = /*#__PURE__*/React.memo(SmallButton);
1912
-
1913
- /* "use client" */
1914
-
1915
- Button.Icon = IconButton;
1916
- Button.Small = SmallButton$1;
1917
-
1918
- var _excluded = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "collapse", "children", "className", "display", "alignItems", "justify"];
1237
+ var _excluded = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "children", "className", "display", "alignItems", "justify"];
1919
1238
  var _getModifierChild = function getModifierChild(tags, children) {
1920
1239
  if (!tags.length) return children;
1921
1240
  var nextTag = tags.slice(1, tags.length);
@@ -1955,8 +1274,6 @@ var TextComponent = function TextComponent(_ref) {
1955
1274
  blockquote = _ref$blockquote === void 0 ? false : _ref$blockquote,
1956
1275
  _ref$noWrap = _ref.noWrap,
1957
1276
  noWrap = _ref$noWrap === void 0 ? false : _ref$noWrap,
1958
- _ref$collapse = _ref.collapse,
1959
- collapse = _ref$collapse === void 0 ? 0 : _ref$collapse,
1960
1277
  children = _ref.children,
1961
1278
  _ref$className = _ref.className,
1962
1279
  className = _ref$className === void 0 ? '' : _ref$className,
@@ -2000,10 +1317,6 @@ var TextComponent = function TextComponent(_ref) {
2000
1317
  *
2001
1318
  */
2002
1319
 
2003
- var _useState = React.useState(false),
2004
- _useState2 = _slicedToArray(_useState, 2),
2005
- expand = _useState2[0],
2006
- setExpand = _useState2[1];
2007
1320
  var tag = React.useMemo(function () {
2008
1321
  if (names[0]) return names[0];
2009
1322
  if (inlineNames[0]) return inlineNames[0];
@@ -2026,26 +1339,7 @@ var TextComponent = function TextComponent(_ref) {
2026
1339
  className: "".concat(className, " ").concat(noWrap ? 'no-wrap' : ''),
2027
1340
  tag: tag
2028
1341
  }, props), {}, {
2029
- children: typeof children === 'string' && collapse > 50 ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2030
- children: [expand ? modifers : (modifers === null || modifers === void 0 ? void 0 : modifers.toString().substring(0, collapse)) + '...', /*#__PURE__*/jsxRuntime.jsx(Button, {
2031
- margin: 0,
2032
- onClick: function onClick() {
2033
- return setExpand(!expand);
2034
- },
2035
- style: {
2036
- textTransform: 'lowercase'
2037
- },
2038
- effect: false,
2039
- color: "abort",
2040
- scale: 2 / 3,
2041
- px: 0.2,
2042
- py: 0,
2043
- auto: true,
2044
- children: /*#__PURE__*/jsxRuntime.jsx("b", {
2045
- children: expand ? 'less' : 'more'
2046
- })
2047
- })]
2048
- }) : modifers
1342
+ children: modifers
2049
1343
  }));
2050
1344
  };
2051
1345
  TextComponent.displayName = 'Text';