@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.
- package/dist/auto-complete/index.js +69 -687
- package/dist/container/index.js +10 -719
- package/dist/expandable/expand.d.ts +7 -0
- package/dist/expandable/index.d.ts +2 -0
- package/dist/expandable/index.js +1612 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1253 -1234
- package/dist/input/index.js +8 -678
- package/dist/placeholder/index.js +8 -714
- package/dist/select/index.js +16 -686
- package/dist/table/index.js +1145 -1170
- package/dist/text/index.js +8 -714
- package/dist/text/text.d.ts +0 -1
- package/dist/textarea/index.js +9 -682
- package/esm/container/box.js +5 -30
- package/esm/expandable/expand.d.ts +7 -0
- package/esm/expandable/expand.js +67 -0
- package/esm/expandable/index.d.ts +2 -0
- package/esm/expandable/index.js +2 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/esm/text/text.d.ts +0 -1
- package/esm/text/text.js +3 -25
- package/package.json +9 -1
package/dist/select/index.js
CHANGED
|
@@ -773,11 +773,11 @@ var SelectIcon = /*#__PURE__*/React.memo(SelectIconComponent);
|
|
|
773
773
|
|
|
774
774
|
/* "use client" */
|
|
775
775
|
|
|
776
|
-
var defaultContext$
|
|
776
|
+
var defaultContext$1 = {
|
|
777
777
|
visible: false,
|
|
778
778
|
disableAll: false
|
|
779
779
|
};
|
|
780
|
-
var SelectContext = /*#__PURE__*/React.createContext(defaultContext$
|
|
780
|
+
var SelectContext = /*#__PURE__*/React.createContext(defaultContext$1);
|
|
781
781
|
var useSelectContext = function useSelectContext() {
|
|
782
782
|
return React.useContext(SelectContext);
|
|
783
783
|
};
|
|
@@ -824,7 +824,7 @@ var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingL
|
|
|
824
824
|
var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
|
|
825
825
|
return "".concat(scale1x);
|
|
826
826
|
};
|
|
827
|
-
var defaultContext
|
|
827
|
+
var defaultContext = {
|
|
828
828
|
getScaleProps: function getScaleProps() {
|
|
829
829
|
return undefined;
|
|
830
830
|
},
|
|
@@ -850,7 +850,7 @@ var defaultContext$1 = {
|
|
|
850
850
|
},
|
|
851
851
|
unit: '16px'
|
|
852
852
|
};
|
|
853
|
-
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext
|
|
853
|
+
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
854
854
|
var useScale = function useScale() {
|
|
855
855
|
return React.useContext(ScaleContext);
|
|
856
856
|
};
|
|
@@ -901,7 +901,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
|
|
|
901
901
|
return getAllScaleProps;
|
|
902
902
|
};
|
|
903
903
|
|
|
904
|
-
var _excluded$
|
|
904
|
+
var _excluded$7 = ["children"];
|
|
905
905
|
var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
|
|
906
906
|
if (scale === 1) return scale;
|
|
907
907
|
var diff = Math.abs((scale - 1) / 2);
|
|
@@ -911,7 +911,7 @@ var withScale = function withScale(Render) {
|
|
|
911
911
|
var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
912
912
|
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;
|
|
913
913
|
var children = _ref.children,
|
|
914
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
914
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
915
915
|
var _useTheme = theme.useTheme(),
|
|
916
916
|
layout = _useTheme.layout;
|
|
917
917
|
var paddingLeft = props.paddingLeft,
|
|
@@ -996,7 +996,7 @@ var withScale = function withScale(Render) {
|
|
|
996
996
|
return ScaleFC;
|
|
997
997
|
};
|
|
998
998
|
|
|
999
|
-
var _excluded$
|
|
999
|
+
var _excluded$6 = ["xs", "sm", "md", "lg", "xl", "justify", "direction", "alignItems", "alignContent", "children", "className"];
|
|
1000
1000
|
var getItemLayout = function getItemLayout(val) {
|
|
1001
1001
|
var display = val === 0 ? 'display: none;' : 'display: inherit;';
|
|
1002
1002
|
if (typeof val === 'number') {
|
|
@@ -1034,7 +1034,7 @@ var GridBasicItem = function GridBasicItem(_ref) {
|
|
|
1034
1034
|
children = _ref.children,
|
|
1035
1035
|
_ref$className = _ref.className,
|
|
1036
1036
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1037
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1037
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
1038
1038
|
var theme$1 = theme.useTheme();
|
|
1039
1039
|
var _useScale = useScale(),
|
|
1040
1040
|
SCALES = _useScale.SCALES;
|
|
@@ -1076,12 +1076,12 @@ var GridBasicItem = function GridBasicItem(_ref) {
|
|
|
1076
1076
|
};
|
|
1077
1077
|
GridBasicItem.displayName = 'GridBasicItem';
|
|
1078
1078
|
|
|
1079
|
-
var _excluded$
|
|
1079
|
+
var _excluded$5 = ["children", "className"];
|
|
1080
1080
|
var GridComponent = function GridComponent(_ref) {
|
|
1081
1081
|
var children = _ref.children,
|
|
1082
1082
|
_ref$className = _ref.className,
|
|
1083
1083
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1084
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1084
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
1085
1085
|
var _useScale = useScale(),
|
|
1086
1086
|
SCALES = _useScale.SCALES;
|
|
1087
1087
|
var _styles$className = {
|
|
@@ -1104,7 +1104,7 @@ var GridComponent = function GridComponent(_ref) {
|
|
|
1104
1104
|
GridComponent.displayName = 'Grid';
|
|
1105
1105
|
var Grid = withScale(GridComponent);
|
|
1106
1106
|
|
|
1107
|
-
var _excluded$
|
|
1107
|
+
var _excluded$4 = ["gap", "wrap", "children", "className"];
|
|
1108
1108
|
var GridContainerComponent = function GridContainerComponent(_ref) {
|
|
1109
1109
|
var _ref$gap = _ref.gap,
|
|
1110
1110
|
gap = _ref$gap === void 0 ? 0 : _ref$gap,
|
|
@@ -1113,7 +1113,7 @@ var GridContainerComponent = function GridContainerComponent(_ref) {
|
|
|
1113
1113
|
children = _ref.children,
|
|
1114
1114
|
_ref$className = _ref.className,
|
|
1115
1115
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1116
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1116
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
1117
1117
|
var _useScale = useScale(),
|
|
1118
1118
|
unit = _useScale.unit,
|
|
1119
1119
|
SCALES = _useScale.SCALES;
|
|
@@ -1199,7 +1199,7 @@ var SelectMultipleValue = function SelectMultipleValue(_ref) {
|
|
|
1199
1199
|
};
|
|
1200
1200
|
SelectMultipleValue.displayName = 'SelectMultipleValue';
|
|
1201
1201
|
|
|
1202
|
-
var _excluded$
|
|
1202
|
+
var _excluded$3 = ["children", "tag", "className", "color"];
|
|
1203
1203
|
var getTypeColor = function getTypeColor(type, palette) {
|
|
1204
1204
|
var colors = {
|
|
1205
1205
|
"default": 'inherit',
|
|
@@ -1217,7 +1217,7 @@ var TextChild = function TextChild(_ref) {
|
|
|
1217
1217
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1218
1218
|
_ref$color = _ref.color,
|
|
1219
1219
|
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
1220
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1220
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
1221
1221
|
var Component = tag;
|
|
1222
1222
|
var theme$1 = theme.useTheme();
|
|
1223
1223
|
var _useScale = useScale(),
|
|
@@ -1265,652 +1265,7 @@ var TextChild = function TextChild(_ref) {
|
|
|
1265
1265
|
};
|
|
1266
1266
|
TextChild.displayName = 'TextChild';
|
|
1267
1267
|
|
|
1268
|
-
var
|
|
1269
|
-
var _ref$x = _ref.x,
|
|
1270
|
-
x = _ref$x === void 0 ? 0 : _ref$x,
|
|
1271
|
-
_ref$y = _ref.y,
|
|
1272
|
-
y = _ref$y === void 0 ? 0 : _ref$y,
|
|
1273
|
-
color = _ref.color,
|
|
1274
|
-
onCompleted = _ref.onCompleted;
|
|
1275
|
-
var dripRef = React.useRef(null);
|
|
1276
|
-
/* istanbul ignore next */
|
|
1277
|
-
var top = Number.isNaN(+y) ? 0 : y - 10;
|
|
1278
|
-
/* istanbul ignore next */
|
|
1279
|
-
var left = Number.isNaN(+x) ? 0 : x - 10;
|
|
1280
|
-
React.useEffect(function () {
|
|
1281
|
-
/* istanbul ignore next */
|
|
1282
|
-
if (!dripRef.current) return;
|
|
1283
|
-
dripRef.current.addEventListener('animationend', onCompleted);
|
|
1284
|
-
return function () {
|
|
1285
|
-
/* istanbul ignore next */
|
|
1286
|
-
if (!dripRef.current) return;
|
|
1287
|
-
dripRef.current.removeEventListener('animationend', onCompleted);
|
|
1288
|
-
};
|
|
1289
|
-
});
|
|
1290
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1291
|
-
ref: dripRef,
|
|
1292
|
-
className: "jsx-3424889537" + " " + "drip",
|
|
1293
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("svg", {
|
|
1294
|
-
width: "20",
|
|
1295
|
-
height: "20",
|
|
1296
|
-
viewBox: "0 0 20 20",
|
|
1297
|
-
style: {
|
|
1298
|
-
top: top,
|
|
1299
|
-
left: left
|
|
1300
|
-
},
|
|
1301
|
-
className: "jsx-3424889537",
|
|
1302
|
-
children: /*#__PURE__*/jsxRuntime.jsx("g", {
|
|
1303
|
-
stroke: "none",
|
|
1304
|
-
strokeWidth: "1",
|
|
1305
|
-
fill: "none",
|
|
1306
|
-
fillRule: "evenodd",
|
|
1307
|
-
className: "jsx-3424889537",
|
|
1308
|
-
children: /*#__PURE__*/jsxRuntime.jsx("g", {
|
|
1309
|
-
fill: color,
|
|
1310
|
-
className: "jsx-3424889537",
|
|
1311
|
-
children: /*#__PURE__*/jsxRuntime.jsx("rect", {
|
|
1312
|
-
width: "100%",
|
|
1313
|
-
height: "100%",
|
|
1314
|
-
rx: "10",
|
|
1315
|
-
className: "jsx-3424889537"
|
|
1316
|
-
})
|
|
1317
|
-
})
|
|
1318
|
-
})
|
|
1319
|
-
}), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1320
|
-
id: "3424889537",
|
|
1321
|
-
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;}}"
|
|
1322
|
-
})]
|
|
1323
|
-
});
|
|
1324
|
-
};
|
|
1325
|
-
ButtonDrip.displayName = 'ButtonDrip';
|
|
1326
|
-
|
|
1327
|
-
var _excluded$5 = ["children", "type", "color", "className", "spaceRatio"];
|
|
1328
|
-
var getIconBgColor = function getIconBgColor(type, palette, color) {
|
|
1329
|
-
var colors = {
|
|
1330
|
-
"default": palette.accents_6,
|
|
1331
|
-
secondary: palette.secondary,
|
|
1332
|
-
success: palette.success,
|
|
1333
|
-
warning: palette.warning,
|
|
1334
|
-
error: palette.error
|
|
1335
|
-
};
|
|
1336
|
-
return color ? color : colors[type];
|
|
1337
|
-
};
|
|
1338
|
-
var LoadingComponent = function LoadingComponent(_ref) {
|
|
1339
|
-
var children = _ref.children,
|
|
1340
|
-
_ref$type = _ref.type,
|
|
1341
|
-
type = _ref$type === void 0 ? 'default' : _ref$type,
|
|
1342
|
-
color = _ref.color,
|
|
1343
|
-
_ref$className = _ref.className,
|
|
1344
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1345
|
-
_ref$spaceRatio = _ref.spaceRatio,
|
|
1346
|
-
spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
|
|
1347
|
-
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
1348
|
-
var theme$1 = theme.useTheme();
|
|
1349
|
-
var _useScale = useScale(),
|
|
1350
|
-
SCALES = _useScale.SCALES;
|
|
1351
|
-
var classes = theme.useClasses('loading-container', className);
|
|
1352
|
-
var bgColor = React.useMemo(function () {
|
|
1353
|
-
return getIconBgColor(type, theme$1.palette, color);
|
|
1354
|
-
}, [type, theme$1.palette, color]);
|
|
1355
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
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]]]) + " " + (props && props.className != null && props.className || classes || ""),
|
|
1357
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
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]]]) + " " + "loading",
|
|
1359
|
-
children: [children && /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
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
|
-
children: children
|
|
1362
|
-
}), /*#__PURE__*/jsxRuntime.jsx("i", {
|
|
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]]])
|
|
1364
|
-
}), /*#__PURE__*/jsxRuntime.jsx("i", {
|
|
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
|
-
}), /*#__PURE__*/jsxRuntime.jsx("i", {
|
|
1367
|
-
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]]])
|
|
1368
|
-
})]
|
|
1369
|
-
}), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1370
|
-
id: "2201634259",
|
|
1371
|
-
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],
|
|
1372
|
-
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;}}")
|
|
1373
|
-
})]
|
|
1374
|
-
}));
|
|
1375
|
-
};
|
|
1376
|
-
LoadingComponent.displayName = 'Loading';
|
|
1377
|
-
var Loading = withScale(LoadingComponent);
|
|
1378
|
-
|
|
1379
|
-
var ButtonLoading = function ButtonLoading(_ref) {
|
|
1380
|
-
var color = _ref.color;
|
|
1381
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1382
|
-
className: "jsx-212623367" + " " + "btn-loading",
|
|
1383
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Loading, {
|
|
1384
|
-
color: color
|
|
1385
|
-
}), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1386
|
-
id: "212623367",
|
|
1387
|
-
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);}"
|
|
1388
|
-
})]
|
|
1389
|
-
});
|
|
1390
|
-
};
|
|
1391
|
-
ButtonLoading.displayName = 'ButtonLoading';
|
|
1392
|
-
|
|
1393
|
-
var _excluded$4 = ["isRight", "isSingle", "children", "className"];
|
|
1394
|
-
var ButtonIcon = function ButtonIcon(_ref) {
|
|
1395
|
-
var _ref$isRight = _ref.isRight,
|
|
1396
|
-
isRight = _ref$isRight === void 0 ? false : _ref$isRight,
|
|
1397
|
-
isSingle = _ref.isSingle,
|
|
1398
|
-
children = _ref.children,
|
|
1399
|
-
_ref$className = _ref.className,
|
|
1400
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1401
|
-
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
1402
|
-
var classes = theme.useClasses('icon', {
|
|
1403
|
-
right: isRight,
|
|
1404
|
-
single: isSingle
|
|
1405
|
-
}, className);
|
|
1406
|
-
return /*#__PURE__*/jsxRuntime.jsxs("span", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1407
|
-
className: "jsx-2467502931" + " " + (props && props.className != null && props.className || classes || ""),
|
|
1408
|
-
children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1409
|
-
id: "2467502931",
|
|
1410
|
-
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;}"
|
|
1411
|
-
})]
|
|
1412
|
-
}));
|
|
1413
|
-
};
|
|
1414
|
-
ButtonIcon.displayName = 'ButtonIcon';
|
|
1415
|
-
|
|
1416
|
-
var getButtonChildrenWithIcon = function getButtonChildrenWithIcon(auto, children, icons) {
|
|
1417
|
-
var icon = icons.icon,
|
|
1418
|
-
iconRight = icons.iconRight;
|
|
1419
|
-
var hasIcon = icon || iconRight;
|
|
1420
|
-
var isRight = Boolean(iconRight);
|
|
1421
|
-
var paddingForAutoMode = auto ? "calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding) * .5)" : 0;
|
|
1422
|
-
var classes = theme.useClasses('text', isRight ? 'right' : 'left');
|
|
1423
|
-
if (!hasIcon) return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1424
|
-
className: "text",
|
|
1425
|
-
children: children
|
|
1426
|
-
});
|
|
1427
|
-
if (React.Children.count(children) === 0) {
|
|
1428
|
-
return /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
|
|
1429
|
-
isRight: isRight,
|
|
1430
|
-
isSingle: true,
|
|
1431
|
-
children: hasIcon
|
|
1432
|
-
});
|
|
1433
|
-
}
|
|
1434
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1435
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
|
|
1436
|
-
isRight: isRight,
|
|
1437
|
-
children: hasIcon
|
|
1438
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1439
|
-
className: _JSXStyle.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || ""),
|
|
1440
|
-
children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1441
|
-
id: "3568181479",
|
|
1442
|
-
dynamic: [paddingForAutoMode, paddingForAutoMode],
|
|
1443
|
-
children: ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}")
|
|
1444
|
-
})]
|
|
1445
|
-
})]
|
|
1446
|
-
});
|
|
1447
|
-
};
|
|
1448
|
-
var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
|
|
1449
|
-
if (!config.isButtonGroup) return props;
|
|
1450
|
-
return _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1451
|
-
auto: true,
|
|
1452
|
-
shadow: false,
|
|
1453
|
-
ghost: config.ghost || props.ghost,
|
|
1454
|
-
type: config.type || props.type,
|
|
1455
|
-
disabled: config.disabled || props.disabled
|
|
1456
|
-
});
|
|
1457
|
-
};
|
|
1458
|
-
|
|
1459
|
-
/* "use client" */
|
|
1460
|
-
|
|
1461
|
-
var defaultContext = {
|
|
1462
|
-
isButtonGroup: false,
|
|
1463
|
-
disabled: false
|
|
1464
|
-
};
|
|
1465
|
-
var ButtonGroupContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
1466
|
-
var useButtonGroupContext = function useButtonGroupContext() {
|
|
1467
|
-
return React.useContext(ButtonGroupContext);
|
|
1468
|
-
};
|
|
1469
|
-
|
|
1470
|
-
var hexToRgb = function hexToRgb(color) {
|
|
1471
|
-
var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
1472
|
-
var full = color.replace(fullReg, function (_, r, g, b) {
|
|
1473
|
-
return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
|
|
1474
|
-
});
|
|
1475
|
-
var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
|
|
1476
|
-
if (!values) {
|
|
1477
|
-
throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
|
|
1478
|
-
}
|
|
1479
|
-
return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
|
|
1480
|
-
};
|
|
1481
|
-
var colorToRgbValues = function colorToRgbValues(color) {
|
|
1482
|
-
if (color.charAt(0) === '#') return hexToRgb(color);
|
|
1483
|
-
var safeColor = color.replace(/ /g, '');
|
|
1484
|
-
var colorType = color.substr(0, 4);
|
|
1485
|
-
var regArray = safeColor.match(/\((.+)\)/);
|
|
1486
|
-
if (!colorType.startsWith('rgb') || !regArray) {
|
|
1487
|
-
console.log(color);
|
|
1488
|
-
throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
|
|
1489
|
-
}
|
|
1490
|
-
return regArray[1].split(',').map(function (str) {
|
|
1491
|
-
return Number.parseFloat(str);
|
|
1492
|
-
});
|
|
1493
|
-
};
|
|
1494
|
-
var addColorAlpha = function addColorAlpha(color, alpha) {
|
|
1495
|
-
if (!/^#|rgb|RGB/.test(color)) return color;
|
|
1496
|
-
var _colorToRgbValues = colorToRgbValues(color),
|
|
1497
|
-
_colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
|
|
1498
|
-
r = _colorToRgbValues2[0],
|
|
1499
|
-
g = _colorToRgbValues2[1],
|
|
1500
|
-
b = _colorToRgbValues2[2];
|
|
1501
|
-
var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
|
|
1502
|
-
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
|
|
1503
|
-
};
|
|
1504
|
-
|
|
1505
|
-
var getButtonGhostColors = function getButtonGhostColors(palette, _color) {
|
|
1506
|
-
var colors = {
|
|
1507
|
-
secondary: {
|
|
1508
|
-
bg: palette.background,
|
|
1509
|
-
border: palette.foreground,
|
|
1510
|
-
color: palette.foreground,
|
|
1511
|
-
ripple: ''
|
|
1512
|
-
},
|
|
1513
|
-
success: {
|
|
1514
|
-
bg: palette.background,
|
|
1515
|
-
border: palette.success,
|
|
1516
|
-
color: palette.success,
|
|
1517
|
-
ripple: ''
|
|
1518
|
-
},
|
|
1519
|
-
warning: {
|
|
1520
|
-
bg: palette.background,
|
|
1521
|
-
border: palette.warning,
|
|
1522
|
-
color: palette.warning,
|
|
1523
|
-
ripple: ''
|
|
1524
|
-
},
|
|
1525
|
-
error: {
|
|
1526
|
-
bg: palette.background,
|
|
1527
|
-
border: palette.error,
|
|
1528
|
-
color: palette.error,
|
|
1529
|
-
ripple: ''
|
|
1530
|
-
}
|
|
1531
|
-
};
|
|
1532
|
-
return colors[_color] || null;
|
|
1533
|
-
};
|
|
1534
|
-
var getButtonColors = function getButtonColors(palette, props) {
|
|
1535
|
-
var color = props.color,
|
|
1536
|
-
disabled = props.disabled,
|
|
1537
|
-
ghost = props.ghost;
|
|
1538
|
-
var colors = {
|
|
1539
|
-
"default": {
|
|
1540
|
-
bg: palette.background,
|
|
1541
|
-
border: palette.border,
|
|
1542
|
-
color: palette.accents_5,
|
|
1543
|
-
ripple: palette.accents_1
|
|
1544
|
-
},
|
|
1545
|
-
secondary: {
|
|
1546
|
-
bg: palette.foreground,
|
|
1547
|
-
border: palette.foreground,
|
|
1548
|
-
color: palette.background,
|
|
1549
|
-
ripple: palette.accents_1
|
|
1550
|
-
},
|
|
1551
|
-
success: {
|
|
1552
|
-
bg: palette.success,
|
|
1553
|
-
border: palette.success,
|
|
1554
|
-
color: '#fff',
|
|
1555
|
-
ripple: '#1f93ffff'
|
|
1556
|
-
},
|
|
1557
|
-
warning: {
|
|
1558
|
-
bg: palette.warning,
|
|
1559
|
-
border: palette.warning,
|
|
1560
|
-
color: '#fff',
|
|
1561
|
-
ripple: '#ffca29ff'
|
|
1562
|
-
},
|
|
1563
|
-
error: {
|
|
1564
|
-
bg: palette.error,
|
|
1565
|
-
border: palette.error,
|
|
1566
|
-
color: '#fff',
|
|
1567
|
-
ripple: '#ff5a55ff'
|
|
1568
|
-
},
|
|
1569
|
-
abort: {
|
|
1570
|
-
bg: 'transparent',
|
|
1571
|
-
border: 'transparent',
|
|
1572
|
-
color: palette.accents_5,
|
|
1573
|
-
ripple: palette.accents_1
|
|
1574
|
-
}
|
|
1575
|
-
};
|
|
1576
|
-
if (disabled) return {
|
|
1577
|
-
bg: palette.accents_1,
|
|
1578
|
-
border: palette.accents_2,
|
|
1579
|
-
color: '#ccc',
|
|
1580
|
-
ripple: ''
|
|
1581
|
-
};
|
|
1582
|
-
|
|
1583
|
-
/**
|
|
1584
|
-
* The '-light' type is the same color as the common type,
|
|
1585
|
-
* only hover's color is different.
|
|
1586
|
-
* e.g.
|
|
1587
|
-
* Color['success'] === Color['success-light']
|
|
1588
|
-
* Color['warning'] === Color['warning-light']
|
|
1589
|
-
*/
|
|
1590
|
-
var withoutLightType = color === null || color === void 0 ? void 0 : color.replace('-light', '');
|
|
1591
|
-
var defaultColor = colors["default"];
|
|
1592
|
-
if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
|
|
1593
|
-
return colors[withoutLightType] || defaultColor;
|
|
1594
|
-
};
|
|
1595
|
-
var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, _color) {
|
|
1596
|
-
var colors = {
|
|
1597
|
-
secondary: {
|
|
1598
|
-
bg: palette.foreground,
|
|
1599
|
-
border: palette.background,
|
|
1600
|
-
color: palette.background
|
|
1601
|
-
},
|
|
1602
|
-
success: {
|
|
1603
|
-
bg: palette.success,
|
|
1604
|
-
border: palette.background,
|
|
1605
|
-
color: 'white'
|
|
1606
|
-
},
|
|
1607
|
-
warning: {
|
|
1608
|
-
bg: palette.warning,
|
|
1609
|
-
border: palette.background,
|
|
1610
|
-
color: 'white'
|
|
1611
|
-
},
|
|
1612
|
-
error: {
|
|
1613
|
-
bg: palette.error,
|
|
1614
|
-
border: palette.background,
|
|
1615
|
-
color: 'white'
|
|
1616
|
-
}
|
|
1617
|
-
};
|
|
1618
|
-
var withoutLightType = _color === null || _color === void 0 ? void 0 : _color.replace('-light', '');
|
|
1619
|
-
return colors[withoutLightType] || null;
|
|
1620
|
-
};
|
|
1621
|
-
var getButtonHoverColors = function getButtonHoverColors(palette, props) {
|
|
1622
|
-
var color = props.color,
|
|
1623
|
-
disabled = props.disabled,
|
|
1624
|
-
loading = props.loading,
|
|
1625
|
-
shadow = props.shadow,
|
|
1626
|
-
ghost = props.ghost;
|
|
1627
|
-
var defaultColor = getButtonColors(palette, props);
|
|
1628
|
-
var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
|
|
1629
|
-
var colors = {
|
|
1630
|
-
"default": {
|
|
1631
|
-
bg: palette.background,
|
|
1632
|
-
border: palette.foreground
|
|
1633
|
-
},
|
|
1634
|
-
secondary: {
|
|
1635
|
-
bg: palette.background,
|
|
1636
|
-
border: palette.foreground
|
|
1637
|
-
},
|
|
1638
|
-
success: {
|
|
1639
|
-
bg: palette.background,
|
|
1640
|
-
border: palette.success
|
|
1641
|
-
},
|
|
1642
|
-
warning: {
|
|
1643
|
-
bg: palette.background,
|
|
1644
|
-
border: palette.warning
|
|
1645
|
-
},
|
|
1646
|
-
error: {
|
|
1647
|
-
bg: palette.background,
|
|
1648
|
-
border: palette.error
|
|
1649
|
-
},
|
|
1650
|
-
abort: {
|
|
1651
|
-
bg: 'transparent',
|
|
1652
|
-
border: 'transparent',
|
|
1653
|
-
color: palette.accents_5
|
|
1654
|
-
},
|
|
1655
|
-
'secondary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1656
|
-
bg: alphaBackground
|
|
1657
|
-
}),
|
|
1658
|
-
'success-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1659
|
-
bg: alphaBackground
|
|
1660
|
-
}),
|
|
1661
|
-
'warning-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1662
|
-
bg: alphaBackground
|
|
1663
|
-
}),
|
|
1664
|
-
'error-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1665
|
-
bg: alphaBackground
|
|
1666
|
-
})
|
|
1667
|
-
};
|
|
1668
|
-
if (disabled) return {
|
|
1669
|
-
bg: palette.accents_1,
|
|
1670
|
-
border: palette.accents_2,
|
|
1671
|
-
color: '#ccc'
|
|
1672
|
-
};
|
|
1673
|
-
if (loading) return _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1674
|
-
color: 'transparent'
|
|
1675
|
-
});
|
|
1676
|
-
if (shadow) return defaultColor;
|
|
1677
|
-
var hoverColor = (ghost ? getButtonGhostHoverColors(palette, color) : colors[color]) || colors["default"];
|
|
1678
|
-
return _objectSpread2(_objectSpread2({}, hoverColor), {}, {
|
|
1679
|
-
color: hoverColor.color || hoverColor.border
|
|
1680
|
-
});
|
|
1681
|
-
};
|
|
1682
|
-
var getButtonCursor = function getButtonCursor(disabled, loading) {
|
|
1683
|
-
if (disabled) return {
|
|
1684
|
-
cursor: 'not-allowed',
|
|
1685
|
-
events: 'auto'
|
|
1686
|
-
};
|
|
1687
|
-
if (loading) return {
|
|
1688
|
-
cursor: 'default',
|
|
1689
|
-
events: 'none'
|
|
1690
|
-
};
|
|
1691
|
-
return {
|
|
1692
|
-
cursor: 'pointer',
|
|
1693
|
-
events: 'auto'
|
|
1694
|
-
};
|
|
1695
|
-
};
|
|
1696
|
-
var getButtonDripColor = function getButtonDripColor(palette, props) {
|
|
1697
|
-
var type = props.type;
|
|
1698
|
-
var isLightHover = type ? type.endsWith('light') : false;
|
|
1699
|
-
var hoverColors = getButtonHoverColors(palette, props);
|
|
1700
|
-
return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
|
|
1701
|
-
};
|
|
1702
|
-
|
|
1703
|
-
var _excluded$3 = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "relative", "replace", "a", "to", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
|
|
1704
|
-
var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
|
|
1705
|
-
var theme$1 = theme.useTheme();
|
|
1706
|
-
// const navigate = useNavigate();
|
|
1707
|
-
var _useScale = useScale(),
|
|
1708
|
-
SCALES = _useScale.SCALES;
|
|
1709
|
-
var buttonRef = React.useRef(null);
|
|
1710
|
-
React.useImperativeHandle(ref, function () {
|
|
1711
|
-
return buttonRef.current;
|
|
1712
|
-
}); // Changed with !
|
|
1713
|
-
|
|
1714
|
-
var _useState = React.useState(false),
|
|
1715
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1716
|
-
dripShow = _useState2[0],
|
|
1717
|
-
setDripShow = _useState2[1];
|
|
1718
|
-
var _useState3 = React.useState(0),
|
|
1719
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1720
|
-
dripX = _useState4[0],
|
|
1721
|
-
setDripX = _useState4[1];
|
|
1722
|
-
var _useState5 = React.useState(0),
|
|
1723
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
1724
|
-
dripY = _useState6[0],
|
|
1725
|
-
setDripY = _useState6[1];
|
|
1726
|
-
var groupConfig = useButtonGroupContext();
|
|
1727
|
-
var filteredProps = filterPropsWithGroup(btnProps, groupConfig);
|
|
1728
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1729
|
-
var children = filteredProps.children,
|
|
1730
|
-
_filteredProps$disabl = filteredProps.disabled,
|
|
1731
|
-
disabled = _filteredProps$disabl === void 0 ? false : _filteredProps$disabl;
|
|
1732
|
-
filteredProps.color;
|
|
1733
|
-
var _filteredProps$loadin = filteredProps.loading,
|
|
1734
|
-
loading = _filteredProps$loadin === void 0 ? false : _filteredProps$loadin,
|
|
1735
|
-
_filteredProps$shadow = filteredProps.shadow,
|
|
1736
|
-
shadow = _filteredProps$shadow === void 0 ? false : _filteredProps$shadow,
|
|
1737
|
-
_filteredProps$ghost = filteredProps.ghost,
|
|
1738
|
-
ghost = _filteredProps$ghost === void 0 ? false : _filteredProps$ghost,
|
|
1739
|
-
_filteredProps$effect = filteredProps.effect,
|
|
1740
|
-
effect = _filteredProps$effect === void 0 ? true : _filteredProps$effect,
|
|
1741
|
-
_filteredProps$round = filteredProps.round,
|
|
1742
|
-
round = _filteredProps$round === void 0 ? false : _filteredProps$round;
|
|
1743
|
-
filteredProps.relative;
|
|
1744
|
-
filteredProps.replace;
|
|
1745
|
-
filteredProps.a;
|
|
1746
|
-
var to = filteredProps.to,
|
|
1747
|
-
onClick = filteredProps.onClick,
|
|
1748
|
-
_filteredProps$auto = filteredProps.auto,
|
|
1749
|
-
auto = _filteredProps$auto === void 0 ? false : _filteredProps$auto,
|
|
1750
|
-
icon = filteredProps.icon,
|
|
1751
|
-
_filteredProps$type = filteredProps.type,
|
|
1752
|
-
type = _filteredProps$type === void 0 ? 'button' : _filteredProps$type,
|
|
1753
|
-
iconRight = filteredProps.iconRight,
|
|
1754
|
-
_filteredProps$classN = filteredProps.className,
|
|
1755
|
-
className = _filteredProps$classN === void 0 ? '' : _filteredProps$classN;
|
|
1756
|
-
filteredProps.crossOrigin;
|
|
1757
|
-
var props = _objectWithoutProperties(filteredProps, _excluded$3);
|
|
1758
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
1759
|
-
|
|
1760
|
-
var _useMemo = React.useMemo(function () {
|
|
1761
|
-
return getButtonColors(theme$1.palette, filteredProps);
|
|
1762
|
-
}, [theme$1.palette, filteredProps]),
|
|
1763
|
-
bg = _useMemo.bg,
|
|
1764
|
-
border = _useMemo.border,
|
|
1765
|
-
color = _useMemo.color,
|
|
1766
|
-
rippleColor = _useMemo.ripple;
|
|
1767
|
-
var hover = React.useMemo(function () {
|
|
1768
|
-
return getButtonHoverColors(theme$1.palette, filteredProps);
|
|
1769
|
-
}, [theme$1.palette, filteredProps]);
|
|
1770
|
-
var _useMemo2 = React.useMemo(function () {
|
|
1771
|
-
return getButtonCursor(disabled, loading);
|
|
1772
|
-
}, [disabled, loading]),
|
|
1773
|
-
cursor = _useMemo2.cursor,
|
|
1774
|
-
events = _useMemo2.events;
|
|
1775
|
-
var dripColor = React.useMemo(function () {
|
|
1776
|
-
return getButtonDripColor(theme$1.palette, filteredProps);
|
|
1777
|
-
}, [theme$1.palette, filteredProps]);
|
|
1778
|
-
|
|
1779
|
-
/* istanbul ignore next */
|
|
1780
|
-
var dripCompletedHandle = function dripCompletedHandle() {
|
|
1781
|
-
setDripShow(false);
|
|
1782
|
-
setDripX(0);
|
|
1783
|
-
setDripY(0);
|
|
1784
|
-
};
|
|
1785
|
-
var createRipple = function createRipple(event) {
|
|
1786
|
-
var button = buttonRef.current;
|
|
1787
|
-
if (!button) return;
|
|
1788
|
-
var rect = button.getBoundingClientRect();
|
|
1789
|
-
var size = Math.max(rect.width, rect.height);
|
|
1790
|
-
var x = event.clientX - rect.left - size / 2;
|
|
1791
|
-
var y = event.clientY - rect.top - size / 2;
|
|
1792
|
-
var rippleCount = 1; // number of rings
|
|
1793
|
-
var rippleDelay = 500; // ms between each ripple
|
|
1794
|
-
var _loop = function _loop() {
|
|
1795
|
-
var ripple = document.createElement('span');
|
|
1796
|
-
Object.assign(ripple.style, {
|
|
1797
|
-
position: 'absolute',
|
|
1798
|
-
borderRadius: '50%',
|
|
1799
|
-
backgroundColor: rippleColor,
|
|
1800
|
-
width: "".concat(size, "px"),
|
|
1801
|
-
height: "".concat(size, "px"),
|
|
1802
|
-
left: "".concat(x, "px"),
|
|
1803
|
-
top: "".concat(y, "px"),
|
|
1804
|
-
pointerEvents: 'none',
|
|
1805
|
-
transform: 'scale(0)',
|
|
1806
|
-
opacity: '1',
|
|
1807
|
-
transition: "transform 600ms ease-out ".concat(i * rippleDelay, "ms, opacity 600ms ease-out ").concat(i * rippleDelay, "ms"),
|
|
1808
|
-
zIndex: 1
|
|
1809
|
-
});
|
|
1810
|
-
button.appendChild(ripple);
|
|
1811
|
-
|
|
1812
|
-
// Force reflow to start transition
|
|
1813
|
-
window.getComputedStyle(ripple).opacity;
|
|
1814
|
-
ripple.style.transform = 'scale(2.5)';
|
|
1815
|
-
ripple.style.opacity = '0';
|
|
1816
|
-
ripple.addEventListener('transitionend', function () {
|
|
1817
|
-
ripple.remove();
|
|
1818
|
-
});
|
|
1819
|
-
};
|
|
1820
|
-
for (var i = 0; i < rippleCount; i++) {
|
|
1821
|
-
_loop();
|
|
1822
|
-
}
|
|
1823
|
-
};
|
|
1824
|
-
var clickHandler = function clickHandler(event) {
|
|
1825
|
-
if (disabled || loading) return;
|
|
1826
|
-
var showDrip = !shadow && !ghost && effect;
|
|
1827
|
-
/* istanbul ignore next */
|
|
1828
|
-
if (showDrip && buttonRef.current) {
|
|
1829
|
-
var rect = buttonRef.current.getBoundingClientRect();
|
|
1830
|
-
setDripShow(true);
|
|
1831
|
-
setDripX(event.clientX - rect.left);
|
|
1832
|
-
setDripY(event.clientY - rect.top);
|
|
1833
|
-
}
|
|
1834
|
-
if (shadow) {
|
|
1835
|
-
createRipple(event);
|
|
1836
|
-
}
|
|
1837
|
-
onClick && onClick(event);
|
|
1838
|
-
};
|
|
1839
|
-
var childrenWithIcon = React.useMemo(function () {
|
|
1840
|
-
return getButtonChildrenWithIcon(auto, children, {
|
|
1841
|
-
icon: icon,
|
|
1842
|
-
iconRight: iconRight
|
|
1843
|
-
});
|
|
1844
|
-
}, [auto, children, icon, iconRight]);
|
|
1845
|
-
var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
|
|
1846
|
-
paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
|
|
1847
|
-
|
|
1848
|
-
// If shadow provided is string then value other default
|
|
1849
|
-
var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme$1.shadows.level.z2 : 'none';
|
|
1850
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1851
|
-
children: [to ? /*#__PURE__*/jsxRuntime.jsxs("a", _objectSpread2(_objectSpread2({
|
|
1852
|
-
href: to
|
|
1853
|
-
}, props), {}, {
|
|
1854
|
-
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) || ""),
|
|
1855
|
-
children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
|
|
1856
|
-
color: color
|
|
1857
|
-
}), childrenWithIcon]
|
|
1858
|
-
})) : /*#__PURE__*/jsxRuntime.jsxs("button", _objectSpread2(_objectSpread2({
|
|
1859
|
-
ref: buttonRef,
|
|
1860
|
-
type: type,
|
|
1861
|
-
disabled: disabled,
|
|
1862
|
-
onClick: clickHandler
|
|
1863
|
-
}, props), {}, {
|
|
1864
|
-
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) || ""),
|
|
1865
|
-
children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
|
|
1866
|
-
color: color
|
|
1867
|
-
}), childrenWithIcon, dripShow && /*#__PURE__*/jsxRuntime.jsx(ButtonDrip, {
|
|
1868
|
-
x: dripX,
|
|
1869
|
-
y: dripY,
|
|
1870
|
-
color: dripColor,
|
|
1871
|
-
onCompleted: dripCompletedHandle
|
|
1872
|
-
})]
|
|
1873
|
-
})), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1874
|
-
id: "612376042",
|
|
1875
|
-
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'],
|
|
1876
|
-
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;}}")
|
|
1877
|
-
})]
|
|
1878
|
-
});
|
|
1879
|
-
});
|
|
1880
|
-
ButtonComponent.displayName = 'Button';
|
|
1881
|
-
var Button = withScale(ButtonComponent);
|
|
1882
|
-
|
|
1883
|
-
var CompactButton = function CompactButton(props) {
|
|
1884
|
-
// const theme = useTheme();
|
|
1885
|
-
return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
|
|
1886
|
-
scale: 2 / 3,
|
|
1887
|
-
px: 0.6
|
|
1888
|
-
}, _objectSpread2({
|
|
1889
|
-
auto: true
|
|
1890
|
-
}, props)), {}, {
|
|
1891
|
-
children: props.children
|
|
1892
|
-
}));
|
|
1893
|
-
};
|
|
1894
|
-
var IconButton = /*#__PURE__*/React.memo(CompactButton);
|
|
1895
|
-
|
|
1896
|
-
var SmallButton = function SmallButton(props) {
|
|
1897
|
-
// const theme = useTheme();
|
|
1898
|
-
return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
|
|
1899
|
-
auto: true,
|
|
1900
|
-
scale: 2 / 3,
|
|
1901
|
-
px: 0.6
|
|
1902
|
-
}, props), {}, {
|
|
1903
|
-
children: props.children
|
|
1904
|
-
}));
|
|
1905
|
-
};
|
|
1906
|
-
var SmallButton$1 = /*#__PURE__*/React.memo(SmallButton);
|
|
1907
|
-
|
|
1908
|
-
/* "use client" */
|
|
1909
|
-
|
|
1910
|
-
Button.Icon = IconButton;
|
|
1911
|
-
Button.Small = SmallButton$1;
|
|
1912
|
-
|
|
1913
|
-
var _excluded$2 = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "collapse", "children", "className", "display", "alignItems", "justify"];
|
|
1268
|
+
var _excluded$2 = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "children", "className", "display", "alignItems", "justify"];
|
|
1914
1269
|
var _getModifierChild = function getModifierChild(tags, children) {
|
|
1915
1270
|
if (!tags.length) return children;
|
|
1916
1271
|
var nextTag = tags.slice(1, tags.length);
|
|
@@ -1950,8 +1305,6 @@ var TextComponent = function TextComponent(_ref) {
|
|
|
1950
1305
|
blockquote = _ref$blockquote === void 0 ? false : _ref$blockquote,
|
|
1951
1306
|
_ref$noWrap = _ref.noWrap,
|
|
1952
1307
|
noWrap = _ref$noWrap === void 0 ? false : _ref$noWrap,
|
|
1953
|
-
_ref$collapse = _ref.collapse,
|
|
1954
|
-
collapse = _ref$collapse === void 0 ? 0 : _ref$collapse,
|
|
1955
1308
|
children = _ref.children,
|
|
1956
1309
|
_ref$className = _ref.className,
|
|
1957
1310
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
@@ -1995,10 +1348,6 @@ var TextComponent = function TextComponent(_ref) {
|
|
|
1995
1348
|
*
|
|
1996
1349
|
*/
|
|
1997
1350
|
|
|
1998
|
-
var _useState = React.useState(false),
|
|
1999
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2000
|
-
expand = _useState2[0],
|
|
2001
|
-
setExpand = _useState2[1];
|
|
2002
1351
|
var tag = React.useMemo(function () {
|
|
2003
1352
|
if (names[0]) return names[0];
|
|
2004
1353
|
if (inlineNames[0]) return inlineNames[0];
|
|
@@ -2021,26 +1370,7 @@ var TextComponent = function TextComponent(_ref) {
|
|
|
2021
1370
|
className: "".concat(className, " ").concat(noWrap ? 'no-wrap' : ''),
|
|
2022
1371
|
tag: tag
|
|
2023
1372
|
}, props), {}, {
|
|
2024
|
-
children:
|
|
2025
|
-
children: [expand ? modifers : (modifers === null || modifers === void 0 ? void 0 : modifers.toString().substring(0, collapse)) + '...', /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
2026
|
-
margin: 0,
|
|
2027
|
-
onClick: function onClick() {
|
|
2028
|
-
return setExpand(!expand);
|
|
2029
|
-
},
|
|
2030
|
-
style: {
|
|
2031
|
-
textTransform: 'lowercase'
|
|
2032
|
-
},
|
|
2033
|
-
effect: false,
|
|
2034
|
-
color: "abort",
|
|
2035
|
-
scale: 2 / 3,
|
|
2036
|
-
px: 0.2,
|
|
2037
|
-
py: 0,
|
|
2038
|
-
auto: true,
|
|
2039
|
-
children: /*#__PURE__*/jsxRuntime.jsx("b", {
|
|
2040
|
-
children: expand ? 'less' : 'more'
|
|
2041
|
-
})
|
|
2042
|
-
})]
|
|
2043
|
-
}) : modifers
|
|
1373
|
+
children: modifers
|
|
2044
1374
|
}));
|
|
2045
1375
|
};
|
|
2046
1376
|
TextComponent.displayName = 'Text';
|