@helpdice/ui 2.1.8 → 2.2.2

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.
Files changed (101) hide show
  1. package/dist/auto-complete/index.js +2147 -8
  2. package/dist/button/index.js +2 -2
  3. package/dist/carousal/index.js +2 -2
  4. package/dist/container/box.d.ts +47 -0
  5. package/dist/container/index.d.ts +2 -0
  6. package/dist/container/index.js +952 -0
  7. package/dist/copy-to-clipboard/clipboard.d.ts +13 -1
  8. package/dist/copy-to-clipboard/index.d.ts +1 -1
  9. package/dist/copy-to-clipboard/index.js +142 -157
  10. package/dist/grid/index.d.ts +2 -3
  11. package/dist/grid/index.js +0 -1
  12. package/dist/index.d.ts +3 -4
  13. package/dist/index.js +14693 -14649
  14. package/dist/input/index.d.ts +4 -0
  15. package/dist/input/index.js +2151 -9
  16. package/dist/input/phone-input/phone.d.ts +13 -0
  17. package/dist/modal/index.js +2 -2
  18. package/dist/placeholder/index.js +643 -8
  19. package/dist/table/index.js +3516 -1368
  20. package/dist/text/child.d.ts +1 -0
  21. package/dist/text/index.js +686 -8
  22. package/dist/text/text.d.ts +1 -0
  23. package/esm/button/button.js +2 -2
  24. package/esm/container/box.d.ts +47 -0
  25. package/esm/container/box.js +43 -0
  26. package/esm/container/index.d.ts +2 -0
  27. package/esm/container/index.js +2 -0
  28. package/esm/copy-to-clipboard/clipboard.d.ts +13 -1
  29. package/esm/copy-to-clipboard/clipboard.js +91 -0
  30. package/esm/copy-to-clipboard/index.d.ts +1 -1
  31. package/esm/copy-to-clipboard/index.js +1 -1
  32. package/esm/grid/index.d.ts +2 -3
  33. package/esm/grid/index.js +5 -3
  34. package/esm/index.d.ts +3 -4
  35. package/esm/index.js +4 -3
  36. package/esm/input/index.d.ts +4 -0
  37. package/esm/input/index.js +4 -0
  38. package/esm/input/phone-input/phone.d.ts +13 -0
  39. package/esm/input/phone-input/phone.js +166 -0
  40. package/esm/table/table-cell.js +2 -1
  41. package/esm/text/child.d.ts +1 -0
  42. package/esm/text/text.d.ts +1 -0
  43. package/esm/text/text.js +25 -3
  44. package/package.json +8 -15
  45. package/dist/currency-input/index.js +0 -862
  46. package/dist/phone-input/index.js +0 -2033
  47. package/dist/phone-input/phone.d.ts +0 -11
  48. package/esm/phone-input/phone.d.ts +0 -11
  49. package/esm/phone-input/phone.js +0 -161
  50. /package/dist/{currency-input → input/currency-input}/components/CurrencyInput.d.ts +0 -0
  51. /package/dist/{currency-input → input/currency-input}/components/CurrencyInputProps.d.ts +0 -0
  52. /package/dist/{currency-input → input/currency-input}/components/utils/cleanValue.d.ts +0 -0
  53. /package/dist/{currency-input → input/currency-input}/components/utils/escapeRegExp.d.ts +0 -0
  54. /package/dist/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.d.ts +0 -0
  55. /package/dist/{currency-input → input/currency-input}/components/utils/formatValue.d.ts +0 -0
  56. /package/dist/{currency-input → input/currency-input}/components/utils/getLocaleConfig.d.ts +0 -0
  57. /package/dist/{currency-input → input/currency-input}/components/utils/getSuffix.d.ts +0 -0
  58. /package/dist/{currency-input → input/currency-input}/components/utils/index.d.ts +0 -0
  59. /package/dist/{currency-input → input/currency-input}/components/utils/isNumber.d.ts +0 -0
  60. /package/dist/{currency-input → input/currency-input}/components/utils/padTrimValue.d.ts +0 -0
  61. /package/dist/{currency-input → input/currency-input}/components/utils/parseAbbrValue.d.ts +0 -0
  62. /package/dist/{currency-input → input/currency-input}/components/utils/removeInvalidChars.d.ts +0 -0
  63. /package/dist/{currency-input → input/currency-input}/components/utils/removeSeparators.d.ts +0 -0
  64. /package/dist/{currency-input → input/currency-input}/components/utils/repositionCursor.d.ts +0 -0
  65. /package/dist/{currency-input → input/currency-input}/index.d.ts +0 -0
  66. /package/dist/{phone-input → input/phone-input}/index.d.ts +0 -0
  67. /package/esm/{currency-input → input/currency-input}/components/CurrencyInput.d.ts +0 -0
  68. /package/esm/{currency-input → input/currency-input}/components/CurrencyInput.js +0 -0
  69. /package/esm/{currency-input → input/currency-input}/components/CurrencyInputProps.d.ts +0 -0
  70. /package/esm/{currency-input → input/currency-input}/components/CurrencyInputProps.js +0 -0
  71. /package/esm/{currency-input → input/currency-input}/components/utils/addSeparators.js +0 -0
  72. /package/esm/{currency-input → input/currency-input}/components/utils/cleanValue.d.ts +0 -0
  73. /package/esm/{currency-input → input/currency-input}/components/utils/cleanValue.js +0 -0
  74. /package/esm/{currency-input → input/currency-input}/components/utils/escapeRegExp.d.ts +0 -0
  75. /package/esm/{currency-input → input/currency-input}/components/utils/escapeRegExp.js +0 -0
  76. /package/esm/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.d.ts +0 -0
  77. /package/esm/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.js +0 -0
  78. /package/esm/{currency-input → input/currency-input}/components/utils/formatValue.d.ts +0 -0
  79. /package/esm/{currency-input → input/currency-input}/components/utils/formatValue.js +0 -0
  80. /package/esm/{currency-input → input/currency-input}/components/utils/getLocaleConfig.d.ts +0 -0
  81. /package/esm/{currency-input → input/currency-input}/components/utils/getLocaleConfig.js +0 -0
  82. /package/esm/{currency-input → input/currency-input}/components/utils/getSuffix.d.ts +0 -0
  83. /package/esm/{currency-input → input/currency-input}/components/utils/getSuffix.js +0 -0
  84. /package/esm/{currency-input → input/currency-input}/components/utils/index.d.ts +0 -0
  85. /package/esm/{currency-input → input/currency-input}/components/utils/index.js +0 -0
  86. /package/esm/{currency-input → input/currency-input}/components/utils/isNumber.d.ts +0 -0
  87. /package/esm/{currency-input → input/currency-input}/components/utils/isNumber.js +0 -0
  88. /package/esm/{currency-input → input/currency-input}/components/utils/padTrimValue.d.ts +0 -0
  89. /package/esm/{currency-input → input/currency-input}/components/utils/padTrimValue.js +0 -0
  90. /package/esm/{currency-input → input/currency-input}/components/utils/parseAbbrValue.d.ts +0 -0
  91. /package/esm/{currency-input → input/currency-input}/components/utils/parseAbbrValue.js +0 -0
  92. /package/esm/{currency-input → input/currency-input}/components/utils/removeInvalidChars.d.ts +0 -0
  93. /package/esm/{currency-input → input/currency-input}/components/utils/removeInvalidChars.js +0 -0
  94. /package/esm/{currency-input → input/currency-input}/components/utils/removeSeparators.d.ts +0 -0
  95. /package/esm/{currency-input → input/currency-input}/components/utils/removeSeparators.js +0 -0
  96. /package/esm/{currency-input → input/currency-input}/components/utils/repositionCursor.d.ts +0 -0
  97. /package/esm/{currency-input → input/currency-input}/components/utils/repositionCursor.js +0 -0
  98. /package/esm/{currency-input → input/currency-input}/index.d.ts +0 -0
  99. /package/esm/{currency-input → input/currency-input}/index.js +0 -0
  100. /package/esm/{phone-input → input/phone-input}/index.d.ts +0 -0
  101. /package/esm/{phone-input → input/phone-input}/index.js +0 -0
@@ -10,6 +10,9 @@ function _arrayLikeToArray(r, a) {
10
10
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
11
11
  return n;
12
12
  }
13
+ function _arrayWithHoles(r) {
14
+ if (Array.isArray(r)) return r;
15
+ }
13
16
  function _createForOfIteratorHelper(r, e) {
14
17
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
15
18
  if (!t) {
@@ -75,6 +78,36 @@ function _extends() {
75
78
  return n;
76
79
  }, _extends.apply(null, arguments);
77
80
  }
81
+ function _iterableToArrayLimit(r, l) {
82
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
83
+ if (null != t) {
84
+ var e,
85
+ n,
86
+ i,
87
+ u,
88
+ a = [],
89
+ f = true,
90
+ o = false;
91
+ try {
92
+ if (i = (t = t.call(r)).next, 0 === l) {
93
+ if (Object(t) !== t) return;
94
+ f = !1;
95
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
96
+ } catch (r) {
97
+ o = true, n = r;
98
+ } finally {
99
+ try {
100
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
101
+ } finally {
102
+ if (o) throw n;
103
+ }
104
+ }
105
+ return a;
106
+ }
107
+ }
108
+ function _nonIterableRest() {
109
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
110
+ }
78
111
  function ownKeys(e, r) {
79
112
  var t = Object.keys(e);
80
113
  if (Object.getOwnPropertySymbols) {
@@ -116,6 +149,9 @@ function _objectWithoutPropertiesLoose(r, e) {
116
149
  }
117
150
  return t;
118
151
  }
152
+ function _slicedToArray(r, e) {
153
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
154
+ }
119
155
  function _toPrimitive(t, r) {
120
156
  if ("object" != typeof t || !t) return t;
121
157
  var e = t[Symbol.toPrimitive];
@@ -988,7 +1024,7 @@ var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingL
988
1024
  var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
989
1025
  return "".concat(scale1x);
990
1026
  };
991
- var defaultContext = {
1027
+ var defaultContext$1 = {
992
1028
  getScaleProps: function getScaleProps() {
993
1029
  return undefined;
994
1030
  },
@@ -1014,7 +1050,7 @@ var defaultContext = {
1014
1050
  },
1015
1051
  unit: '16px'
1016
1052
  };
1017
- var ScaleContext = /*#__PURE__*/React.createContext(defaultContext);
1053
+ var ScaleContext = /*#__PURE__*/React.createContext(defaultContext$1);
1018
1054
  var useScale = function useScale() {
1019
1055
  return React.useContext(ScaleContext);
1020
1056
  };
@@ -1071,7 +1107,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
1071
1107
  return getAllScaleProps;
1072
1108
  };
1073
1109
 
1074
- var _excluded$2 = ["children"];
1110
+ var _excluded$5 = ["children"];
1075
1111
  var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
1076
1112
  if (scale === 1) return scale;
1077
1113
  var diff = Math.abs((scale - 1) / 2);
@@ -1081,7 +1117,7 @@ var withScale = function withScale(Render) {
1081
1117
  var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
1082
1118
  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;
1083
1119
  var children = _ref.children,
1084
- props = _objectWithoutProperties(_ref, _excluded$2);
1120
+ props = _objectWithoutProperties(_ref, _excluded$5);
1085
1121
  var _useTheme = theme.useTheme(),
1086
1122
  layout = _useTheme.layout;
1087
1123
  var paddingLeft = props.paddingLeft,
@@ -1164,7 +1200,7 @@ var withScale = function withScale(Render) {
1164
1200
  return ScaleFC;
1165
1201
  };
1166
1202
 
1167
- var _excluded$1 = ["children", "tag", "className", "color"];
1203
+ var _excluded$4 = ["children", "tag", "className", "color"];
1168
1204
  var getTypeColor = function getTypeColor(type, palette) {
1169
1205
  var colors = {
1170
1206
  "default": 'inherit',
@@ -1182,7 +1218,7 @@ var TextChild = function TextChild(_ref) {
1182
1218
  className = _ref$className === void 0 ? '' : _ref$className,
1183
1219
  _ref$color = _ref.color,
1184
1220
  color = _ref$color === void 0 ? 'default' : _ref$color,
1185
- props = _objectWithoutProperties(_ref, _excluded$1);
1221
+ props = _objectWithoutProperties(_ref, _excluded$4);
1186
1222
  var Component = tag;
1187
1223
  var theme$1 = theme.useTheme();
1188
1224
  var _useScale = useScale(),
@@ -1228,7 +1264,586 @@ var TextChild = function TextChild(_ref) {
1228
1264
  };
1229
1265
  TextChild.displayName = 'TextChild';
1230
1266
 
1231
- var _excluded = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "children", "className"];
1267
+ var ButtonDrip = function ButtonDrip(_ref) {
1268
+ var _ref$x = _ref.x,
1269
+ x = _ref$x === void 0 ? 0 : _ref$x,
1270
+ _ref$y = _ref.y,
1271
+ y = _ref$y === void 0 ? 0 : _ref$y,
1272
+ color = _ref.color,
1273
+ onCompleted = _ref.onCompleted;
1274
+ var dripRef = React.useRef(null);
1275
+ /* istanbul ignore next */
1276
+ var top = Number.isNaN(+y) ? 0 : y - 10;
1277
+ /* istanbul ignore next */
1278
+ var left = Number.isNaN(+x) ? 0 : x - 10;
1279
+ React.useEffect(function () {
1280
+ /* istanbul ignore next */
1281
+ if (!dripRef.current) return;
1282
+ dripRef.current.addEventListener('animationend', onCompleted);
1283
+ return function () {
1284
+ /* istanbul ignore next */
1285
+ if (!dripRef.current) return;
1286
+ dripRef.current.removeEventListener('animationend', onCompleted);
1287
+ };
1288
+ });
1289
+ return /*#__PURE__*/React.createElement("div", {
1290
+ ref: dripRef,
1291
+ className: "jsx-3424889537" + " " + "drip"
1292
+ }, /*#__PURE__*/React.createElement("svg", {
1293
+ width: "20",
1294
+ height: "20",
1295
+ viewBox: "0 0 20 20",
1296
+ style: {
1297
+ top: top,
1298
+ left: left
1299
+ },
1300
+ className: "jsx-3424889537"
1301
+ }, /*#__PURE__*/React.createElement("g", {
1302
+ stroke: "none",
1303
+ strokeWidth: "1",
1304
+ fill: "none",
1305
+ fillRule: "evenodd",
1306
+ className: "jsx-3424889537"
1307
+ }, /*#__PURE__*/React.createElement("g", {
1308
+ fill: color,
1309
+ className: "jsx-3424889537"
1310
+ }, /*#__PURE__*/React.createElement("rect", {
1311
+ width: "100%",
1312
+ height: "100%",
1313
+ rx: "10",
1314
+ className: "jsx-3424889537"
1315
+ })))), /*#__PURE__*/React.createElement(_JSXStyle, {
1316
+ id: "3424889537"
1317
+ }, ".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;}}"));
1318
+ };
1319
+ ButtonDrip.displayName = 'ButtonDrip';
1320
+
1321
+ var _excluded$3 = ["children", "type", "color", "className", "spaceRatio"];
1322
+ var getIconBgColor = function getIconBgColor(type, palette, color) {
1323
+ var colors = {
1324
+ "default": palette.accents_6,
1325
+ secondary: palette.secondary,
1326
+ success: palette.success,
1327
+ warning: palette.warning,
1328
+ error: palette.error
1329
+ };
1330
+ return color ? color : colors[type];
1331
+ };
1332
+ var LoadingComponent = function LoadingComponent(_ref) {
1333
+ var children = _ref.children,
1334
+ _ref$type = _ref.type,
1335
+ type = _ref$type === void 0 ? 'default' : _ref$type,
1336
+ color = _ref.color,
1337
+ _ref$className = _ref.className,
1338
+ className = _ref$className === void 0 ? '' : _ref$className,
1339
+ _ref$spaceRatio = _ref.spaceRatio,
1340
+ spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
1341
+ props = _objectWithoutProperties(_ref, _excluded$3);
1342
+ var theme$1 = theme.useTheme();
1343
+ var _useScale = useScale(),
1344
+ SCALES = _useScale.SCALES;
1345
+ var classes = theme.useClasses('loading-container', className);
1346
+ var bgColor = React.useMemo(function () {
1347
+ return getIconBgColor(type, theme$1.palette, color);
1348
+ }, [type, theme$1.palette, color]);
1349
+ return /*#__PURE__*/React.createElement("div", _extends({}, props, {
1350
+ 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 || "")
1351
+ }), /*#__PURE__*/React.createElement("span", {
1352
+ 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"
1353
+ }, children && /*#__PURE__*/React.createElement("label", {
1354
+ 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]]])
1355
+ }, children), /*#__PURE__*/React.createElement("i", {
1356
+ 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]]])
1357
+ }), /*#__PURE__*/React.createElement("i", {
1358
+ 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]]])
1359
+ }), /*#__PURE__*/React.createElement("i", {
1360
+ 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]]])
1361
+ })), /*#__PURE__*/React.createElement(_JSXStyle, {
1362
+ id: "2201634259",
1363
+ 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]
1364
+ }, ".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;}}")));
1365
+ };
1366
+ LoadingComponent.displayName = 'Loading';
1367
+ var Loading = withScale(LoadingComponent);
1368
+
1369
+ var ButtonLoading = function ButtonLoading(_ref) {
1370
+ var color = _ref.color;
1371
+ return /*#__PURE__*/React.createElement("div", {
1372
+ className: "jsx-212623367" + " " + "btn-loading"
1373
+ }, /*#__PURE__*/React.createElement(Loading, {
1374
+ color: color
1375
+ }), /*#__PURE__*/React.createElement(_JSXStyle, {
1376
+ id: "212623367"
1377
+ }, ".btn-loading.jsx-212623367{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;background-color:var(--helpdice-ui-button-bg);}"));
1378
+ };
1379
+ ButtonLoading.displayName = 'ButtonLoading';
1380
+
1381
+ var _excluded$2 = ["isRight", "isSingle", "children", "className"];
1382
+ var ButtonIcon = function ButtonIcon(_ref) {
1383
+ var _ref$isRight = _ref.isRight,
1384
+ isRight = _ref$isRight === void 0 ? false : _ref$isRight,
1385
+ isSingle = _ref.isSingle,
1386
+ children = _ref.children,
1387
+ _ref$className = _ref.className,
1388
+ className = _ref$className === void 0 ? '' : _ref$className,
1389
+ props = _objectWithoutProperties(_ref, _excluded$2);
1390
+ var classes = theme.useClasses('icon', {
1391
+ right: isRight,
1392
+ single: isSingle
1393
+ }, className);
1394
+ return /*#__PURE__*/React.createElement("span", _extends({}, props, {
1395
+ className: "jsx-2467502931" + " " + (props && props.className != null && props.className || classes || "")
1396
+ }), children, /*#__PURE__*/React.createElement(_JSXStyle, {
1397
+ id: "2467502931"
1398
+ }, ".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;}"));
1399
+ };
1400
+ ButtonIcon.displayName = 'ButtonIcon';
1401
+
1402
+ var getButtonChildrenWithIcon = function getButtonChildrenWithIcon(auto, children, icons) {
1403
+ var icon = icons.icon,
1404
+ iconRight = icons.iconRight;
1405
+ var hasIcon = icon || iconRight;
1406
+ var isRight = Boolean(iconRight);
1407
+ var paddingForAutoMode = auto ? "calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding) * .5)" : 0;
1408
+ var classes = theme.useClasses('text', isRight ? 'right' : 'left');
1409
+ if (!hasIcon) return /*#__PURE__*/React.createElement("div", {
1410
+ className: "text"
1411
+ }, children);
1412
+ if (React.Children.count(children) === 0) {
1413
+ return /*#__PURE__*/React.createElement(ButtonIcon, {
1414
+ isRight: isRight,
1415
+ isSingle: true
1416
+ }, hasIcon);
1417
+ }
1418
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ButtonIcon, {
1419
+ isRight: isRight
1420
+ }, hasIcon), /*#__PURE__*/React.createElement("div", {
1421
+ className: _JSXStyle.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || "")
1422
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
1423
+ id: "3568181479",
1424
+ dynamic: [paddingForAutoMode, paddingForAutoMode]
1425
+ }, ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}"))));
1426
+ };
1427
+ var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
1428
+ if (!config.isButtonGroup) return props;
1429
+ return _objectSpread2(_objectSpread2({}, props), {}, {
1430
+ auto: true,
1431
+ shadow: false,
1432
+ ghost: config.ghost || props.ghost,
1433
+ type: config.type || props.type,
1434
+ disabled: config.disabled || props.disabled
1435
+ });
1436
+ };
1437
+
1438
+ /* "use client" */
1439
+
1440
+ var defaultContext = {
1441
+ isButtonGroup: false,
1442
+ disabled: false
1443
+ };
1444
+ var ButtonGroupContext = /*#__PURE__*/React.createContext(defaultContext);
1445
+ var useButtonGroupContext = function useButtonGroupContext() {
1446
+ return React.useContext(ButtonGroupContext);
1447
+ };
1448
+
1449
+ var hexToRgb = function hexToRgb(color) {
1450
+ var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
1451
+ var full = color.replace(fullReg, function (_, r, g, b) {
1452
+ return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
1453
+ });
1454
+ var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
1455
+ if (!values) {
1456
+ throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
1457
+ }
1458
+ return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
1459
+ };
1460
+ var colorToRgbValues = function colorToRgbValues(color) {
1461
+ if (color.charAt(0) === '#') return hexToRgb(color);
1462
+ var safeColor = color.replace(/ /g, '');
1463
+ var colorType = color.substr(0, 4);
1464
+ var regArray = safeColor.match(/\((.+)\)/);
1465
+ if (!colorType.startsWith('rgb') || !regArray) {
1466
+ console.log(color);
1467
+ throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
1468
+ }
1469
+ return regArray[1].split(',').map(function (str) {
1470
+ return Number.parseFloat(str);
1471
+ });
1472
+ };
1473
+ var addColorAlpha = function addColorAlpha(color, alpha) {
1474
+ if (!/^#|rgb|RGB/.test(color)) return color;
1475
+ var _colorToRgbValues = colorToRgbValues(color),
1476
+ _colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
1477
+ r = _colorToRgbValues2[0],
1478
+ g = _colorToRgbValues2[1],
1479
+ b = _colorToRgbValues2[2];
1480
+ var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
1481
+ return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
1482
+ };
1483
+
1484
+ var getButtonGhostColors = function getButtonGhostColors(palette, _color) {
1485
+ var colors = {
1486
+ secondary: {
1487
+ bg: palette.background,
1488
+ border: palette.foreground,
1489
+ color: palette.foreground,
1490
+ ripple: ''
1491
+ },
1492
+ success: {
1493
+ bg: palette.background,
1494
+ border: palette.success,
1495
+ color: palette.success,
1496
+ ripple: ''
1497
+ },
1498
+ warning: {
1499
+ bg: palette.background,
1500
+ border: palette.warning,
1501
+ color: palette.warning,
1502
+ ripple: ''
1503
+ },
1504
+ error: {
1505
+ bg: palette.background,
1506
+ border: palette.error,
1507
+ color: palette.error,
1508
+ ripple: ''
1509
+ }
1510
+ };
1511
+ return colors[_color] || null;
1512
+ };
1513
+ var getButtonColors = function getButtonColors(palette, props) {
1514
+ var color = props.color,
1515
+ disabled = props.disabled,
1516
+ ghost = props.ghost;
1517
+ var colors = {
1518
+ "default": {
1519
+ bg: palette.background,
1520
+ border: palette.border,
1521
+ color: palette.accents_5,
1522
+ ripple: palette.accents_1
1523
+ },
1524
+ secondary: {
1525
+ bg: palette.foreground,
1526
+ border: palette.foreground,
1527
+ color: palette.background,
1528
+ ripple: palette.accents_1
1529
+ },
1530
+ success: {
1531
+ bg: palette.success,
1532
+ border: palette.success,
1533
+ color: '#fff',
1534
+ ripple: '#1f93ffff'
1535
+ },
1536
+ warning: {
1537
+ bg: palette.warning,
1538
+ border: palette.warning,
1539
+ color: '#fff',
1540
+ ripple: '#ffca29ff'
1541
+ },
1542
+ error: {
1543
+ bg: palette.error,
1544
+ border: palette.error,
1545
+ color: '#fff',
1546
+ ripple: '#ff5a55ff'
1547
+ },
1548
+ abort: {
1549
+ bg: 'transparent',
1550
+ border: 'transparent',
1551
+ color: palette.accents_5,
1552
+ ripple: palette.accents_1
1553
+ }
1554
+ };
1555
+ if (disabled) return {
1556
+ bg: palette.accents_1,
1557
+ border: palette.accents_2,
1558
+ color: '#ccc',
1559
+ ripple: ''
1560
+ };
1561
+
1562
+ /**
1563
+ * The '-light' type is the same color as the common type,
1564
+ * only hover's color is different.
1565
+ * e.g.
1566
+ * Color['success'] === Color['success-light']
1567
+ * Color['warning'] === Color['warning-light']
1568
+ */
1569
+ var withoutLightType = color === null || color === void 0 ? void 0 : color.replace('-light', '');
1570
+ var defaultColor = colors["default"];
1571
+ if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
1572
+ return colors[withoutLightType] || defaultColor;
1573
+ };
1574
+ var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, _color) {
1575
+ var colors = {
1576
+ secondary: {
1577
+ bg: palette.foreground,
1578
+ border: palette.background,
1579
+ color: palette.background
1580
+ },
1581
+ success: {
1582
+ bg: palette.success,
1583
+ border: palette.background,
1584
+ color: 'white'
1585
+ },
1586
+ warning: {
1587
+ bg: palette.warning,
1588
+ border: palette.background,
1589
+ color: 'white'
1590
+ },
1591
+ error: {
1592
+ bg: palette.error,
1593
+ border: palette.background,
1594
+ color: 'white'
1595
+ }
1596
+ };
1597
+ var withoutLightType = _color === null || _color === void 0 ? void 0 : _color.replace('-light', '');
1598
+ return colors[withoutLightType] || null;
1599
+ };
1600
+ var getButtonHoverColors = function getButtonHoverColors(palette, props) {
1601
+ var color = props.color,
1602
+ disabled = props.disabled,
1603
+ loading = props.loading,
1604
+ shadow = props.shadow,
1605
+ ghost = props.ghost;
1606
+ var defaultColor = getButtonColors(palette, props);
1607
+ var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
1608
+ var colors = {
1609
+ "default": {
1610
+ bg: palette.background,
1611
+ border: palette.foreground
1612
+ },
1613
+ secondary: {
1614
+ bg: palette.background,
1615
+ border: palette.foreground
1616
+ },
1617
+ success: {
1618
+ bg: palette.background,
1619
+ border: palette.success
1620
+ },
1621
+ warning: {
1622
+ bg: palette.background,
1623
+ border: palette.warning
1624
+ },
1625
+ error: {
1626
+ bg: palette.background,
1627
+ border: palette.error
1628
+ },
1629
+ abort: {
1630
+ bg: 'transparent',
1631
+ border: 'transparent',
1632
+ color: palette.accents_5
1633
+ },
1634
+ 'secondary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1635
+ bg: alphaBackground
1636
+ }),
1637
+ 'success-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1638
+ bg: alphaBackground
1639
+ }),
1640
+ 'warning-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1641
+ bg: alphaBackground
1642
+ }),
1643
+ 'error-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1644
+ bg: alphaBackground
1645
+ })
1646
+ };
1647
+ if (disabled) return {
1648
+ bg: palette.accents_1,
1649
+ border: palette.accents_2,
1650
+ color: '#ccc'
1651
+ };
1652
+ if (loading) return _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1653
+ color: 'transparent'
1654
+ });
1655
+ if (shadow) return defaultColor;
1656
+ var hoverColor = (ghost ? getButtonGhostHoverColors(palette, color) : colors[color]) || colors["default"];
1657
+ return _objectSpread2(_objectSpread2({}, hoverColor), {}, {
1658
+ color: hoverColor.color || hoverColor.border
1659
+ });
1660
+ };
1661
+ var getButtonCursor = function getButtonCursor(disabled, loading) {
1662
+ if (disabled) return {
1663
+ cursor: 'not-allowed',
1664
+ events: 'auto'
1665
+ };
1666
+ if (loading) return {
1667
+ cursor: 'default',
1668
+ events: 'none'
1669
+ };
1670
+ return {
1671
+ cursor: 'pointer',
1672
+ events: 'auto'
1673
+ };
1674
+ };
1675
+ var getButtonDripColor = function getButtonDripColor(palette, props) {
1676
+ var type = props.type;
1677
+ var isLightHover = type ? type.endsWith('light') : false;
1678
+ var hoverColors = getButtonHoverColors(palette, props);
1679
+ return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
1680
+ };
1681
+
1682
+ var _excluded$1 = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
1683
+ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
1684
+ var theme$1 = theme.useTheme();
1685
+ var _useScale = useScale(),
1686
+ SCALES = _useScale.SCALES;
1687
+ var buttonRef = React.useRef(null);
1688
+ React.useImperativeHandle(ref, function () {
1689
+ return buttonRef.current;
1690
+ }); // Changed with !
1691
+
1692
+ var _useState = React.useState(false),
1693
+ _useState2 = _slicedToArray(_useState, 2),
1694
+ dripShow = _useState2[0],
1695
+ setDripShow = _useState2[1];
1696
+ var _useState3 = React.useState(0),
1697
+ _useState4 = _slicedToArray(_useState3, 2),
1698
+ dripX = _useState4[0],
1699
+ setDripX = _useState4[1];
1700
+ var _useState5 = React.useState(0),
1701
+ _useState6 = _slicedToArray(_useState5, 2),
1702
+ dripY = _useState6[0],
1703
+ setDripY = _useState6[1];
1704
+ var groupConfig = useButtonGroupContext();
1705
+ var filteredProps = filterPropsWithGroup(btnProps, groupConfig);
1706
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1707
+ var children = filteredProps.children,
1708
+ _filteredProps$disabl = filteredProps.disabled,
1709
+ disabled = _filteredProps$disabl === void 0 ? false : _filteredProps$disabl;
1710
+ filteredProps.color;
1711
+ var _filteredProps$loadin = filteredProps.loading,
1712
+ loading = _filteredProps$loadin === void 0 ? false : _filteredProps$loadin,
1713
+ _filteredProps$shadow = filteredProps.shadow,
1714
+ shadow = _filteredProps$shadow === void 0 ? false : _filteredProps$shadow,
1715
+ _filteredProps$ghost = filteredProps.ghost,
1716
+ ghost = _filteredProps$ghost === void 0 ? false : _filteredProps$ghost,
1717
+ _filteredProps$effect = filteredProps.effect,
1718
+ effect = _filteredProps$effect === void 0 ? true : _filteredProps$effect,
1719
+ _filteredProps$round = filteredProps.round,
1720
+ round = _filteredProps$round === void 0 ? false : _filteredProps$round,
1721
+ onClick = filteredProps.onClick,
1722
+ _filteredProps$auto = filteredProps.auto,
1723
+ auto = _filteredProps$auto === void 0 ? false : _filteredProps$auto,
1724
+ icon = filteredProps.icon,
1725
+ _filteredProps$type = filteredProps.type,
1726
+ type = _filteredProps$type === void 0 ? 'button' : _filteredProps$type,
1727
+ iconRight = filteredProps.iconRight,
1728
+ _filteredProps$classN = filteredProps.className,
1729
+ className = _filteredProps$classN === void 0 ? '' : _filteredProps$classN;
1730
+ filteredProps.crossOrigin;
1731
+ var props = _objectWithoutProperties(filteredProps, _excluded$1);
1732
+ /* eslint-enable @typescript-eslint/no-unused-vars */
1733
+
1734
+ var _useMemo = React.useMemo(function () {
1735
+ return getButtonColors(theme$1.palette, filteredProps);
1736
+ }, [theme$1.palette, filteredProps]),
1737
+ bg = _useMemo.bg,
1738
+ border = _useMemo.border,
1739
+ color = _useMemo.color,
1740
+ rippleColor = _useMemo.ripple;
1741
+ var hover = React.useMemo(function () {
1742
+ return getButtonHoverColors(theme$1.palette, filteredProps);
1743
+ }, [theme$1.palette, filteredProps]);
1744
+ var _useMemo2 = React.useMemo(function () {
1745
+ return getButtonCursor(disabled, loading);
1746
+ }, [disabled, loading]),
1747
+ cursor = _useMemo2.cursor,
1748
+ events = _useMemo2.events;
1749
+ var dripColor = React.useMemo(function () {
1750
+ return getButtonDripColor(theme$1.palette, filteredProps);
1751
+ }, [theme$1.palette, filteredProps]);
1752
+
1753
+ /* istanbul ignore next */
1754
+ var dripCompletedHandle = function dripCompletedHandle() {
1755
+ setDripShow(false);
1756
+ setDripX(0);
1757
+ setDripY(0);
1758
+ };
1759
+ var createRipple = function createRipple(event) {
1760
+ var button = buttonRef.current;
1761
+ if (!button) return;
1762
+ var rect = button.getBoundingClientRect();
1763
+ var size = Math.max(rect.width, rect.height);
1764
+ var x = event.clientX - rect.left - size / 2;
1765
+ var y = event.clientY - rect.top - size / 2;
1766
+ var rippleCount = 1; // number of rings
1767
+ var rippleDelay = 500; // ms between each ripple
1768
+ var _loop = function _loop() {
1769
+ var ripple = document.createElement('span');
1770
+ Object.assign(ripple.style, {
1771
+ position: 'absolute',
1772
+ borderRadius: '50%',
1773
+ backgroundColor: rippleColor,
1774
+ width: "".concat(size, "px"),
1775
+ height: "".concat(size, "px"),
1776
+ left: "".concat(x, "px"),
1777
+ top: "".concat(y, "px"),
1778
+ pointerEvents: 'none',
1779
+ transform: 'scale(0)',
1780
+ opacity: '1',
1781
+ transition: "transform 600ms ease-out ".concat(i * rippleDelay, "ms, opacity 600ms ease-out ").concat(i * rippleDelay, "ms"),
1782
+ zIndex: 1
1783
+ });
1784
+ button.appendChild(ripple);
1785
+
1786
+ // Force reflow to start transition
1787
+ window.getComputedStyle(ripple).opacity;
1788
+ ripple.style.transform = 'scale(2.5)';
1789
+ ripple.style.opacity = '0';
1790
+ ripple.addEventListener('transitionend', function () {
1791
+ ripple.remove();
1792
+ });
1793
+ };
1794
+ for (var i = 0; i < rippleCount; i++) {
1795
+ _loop();
1796
+ }
1797
+ };
1798
+ var clickHandler = function clickHandler(event) {
1799
+ if (disabled || loading) return;
1800
+ var showDrip = !shadow && !ghost && effect;
1801
+ /* istanbul ignore next */
1802
+ if (showDrip && buttonRef.current) {
1803
+ var rect = buttonRef.current.getBoundingClientRect();
1804
+ setDripShow(true);
1805
+ setDripX(event.clientX - rect.left);
1806
+ setDripY(event.clientY - rect.top);
1807
+ }
1808
+ if (shadow) {
1809
+ createRipple(event);
1810
+ }
1811
+ onClick && onClick(event);
1812
+ };
1813
+ var childrenWithIcon = React.useMemo(function () {
1814
+ return getButtonChildrenWithIcon(auto, children, {
1815
+ icon: icon,
1816
+ iconRight: iconRight
1817
+ });
1818
+ }, [auto, children, icon, iconRight]);
1819
+ var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
1820
+ paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
1821
+
1822
+ // If shadow provided is string then value other default
1823
+ var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme$1.shadows.level.z2 : 'none';
1824
+ return /*#__PURE__*/React.createElement("button", _extends({
1825
+ ref: buttonRef,
1826
+ type: type,
1827
+ disabled: disabled,
1828
+ onClick: clickHandler
1829
+ }, props, {
1830
+ className: _JSXStyle.dynamic([["905110486", [SCALES.height(2.5), round ? '50%' : theme$1.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor, 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) || "")
1831
+ }), loading && /*#__PURE__*/React.createElement(ButtonLoading, {
1832
+ color: color
1833
+ }), childrenWithIcon, dripShow && /*#__PURE__*/React.createElement(ButtonDrip, {
1834
+ x: dripX,
1835
+ y: dripY,
1836
+ color: dripColor,
1837
+ onCompleted: dripCompletedHandle
1838
+ }), /*#__PURE__*/React.createElement(_JSXStyle, {
1839
+ id: "905110486",
1840
+ dynamic: [SCALES.height(2.5), round ? '50%' : theme$1.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor, 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']
1841
+ }, ".btn.__jsx-style-dynamic-selector{box-sizing:border-box;display:inline-block;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, ";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.__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;}}")));
1842
+ });
1843
+ ButtonComponent.displayName = 'Button';
1844
+ var Button = withScale(ButtonComponent);
1845
+
1846
+ var _excluded = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "collapse", "children", "className"];
1232
1847
  var _getModifierChild = function getModifierChild(tags, children) {
1233
1848
  if (!tags.length) return children;
1234
1849
  var nextTag = tags.slice(1, tags.length);
@@ -1267,6 +1882,8 @@ var TextComponent = function TextComponent(_ref) {
1267
1882
  blockquote = _ref$blockquote === void 0 ? false : _ref$blockquote,
1268
1883
  _ref$noWrap = _ref.noWrap,
1269
1884
  noWrap = _ref$noWrap === void 0 ? false : _ref$noWrap,
1885
+ _ref$collapse = _ref.collapse,
1886
+ collapse = _ref$collapse === void 0 ? 0 : _ref$collapse,
1270
1887
  children = _ref.children,
1271
1888
  _ref$className = _ref.className,
1272
1889
  className = _ref$className === void 0 ? '' : _ref$className,
@@ -1306,6 +1923,10 @@ var TextComponent = function TextComponent(_ref) {
1306
1923
  *
1307
1924
  */
1308
1925
 
1926
+ var _useState = React.useState(false),
1927
+ _useState2 = _slicedToArray(_useState, 2),
1928
+ expand = _useState2[0],
1929
+ setExpand = _useState2[1];
1309
1930
  var tag = React.useMemo(function () {
1310
1931
  if (names[0]) return names[0];
1311
1932
  if (inlineNames[0]) return inlineNames[0];
@@ -1324,7 +1945,21 @@ var TextComponent = function TextComponent(_ref) {
1324
1945
  },
1325
1946
  className: "".concat(className, " ").concat(noWrap ? 'no-wrap' : ''),
1326
1947
  tag: tag
1327
- }, props), modifers);
1948
+ }, props), typeof children === 'string' && collapse > 50 ? /*#__PURE__*/React.createElement(React.Fragment, null, expand ? modifers : (modifers === null || modifers === void 0 ? void 0 : modifers.toString().substring(0, collapse)) + '...', /*#__PURE__*/React.createElement(Button, {
1949
+ margin: 0,
1950
+ onClick: function onClick() {
1951
+ return setExpand(!expand);
1952
+ },
1953
+ style: {
1954
+ textTransform: 'lowercase'
1955
+ },
1956
+ effect: false,
1957
+ color: "abort",
1958
+ scale: 2 / 3,
1959
+ px: 0.2,
1960
+ py: 0,
1961
+ auto: true
1962
+ }, /*#__PURE__*/React.createElement("b", null, expand ? 'less' : 'more'))) : modifers);
1328
1963
  };
1329
1964
  TextComponent.displayName = 'Text';
1330
1965
  var Text = withScale(TextComponent);