@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/text/index.js
CHANGED
|
@@ -11,9 +11,6 @@ function _arrayLikeToArray(r, a) {
|
|
|
11
11
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
12
12
|
return n;
|
|
13
13
|
}
|
|
14
|
-
function _arrayWithHoles(r) {
|
|
15
|
-
if (Array.isArray(r)) return r;
|
|
16
|
-
}
|
|
17
14
|
function _createForOfIteratorHelper(r, e) {
|
|
18
15
|
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
19
16
|
if (!t) {
|
|
@@ -70,36 +67,6 @@ function _defineProperty(e, r, t) {
|
|
|
70
67
|
writable: true
|
|
71
68
|
}) : e[r] = t, e;
|
|
72
69
|
}
|
|
73
|
-
function _iterableToArrayLimit(r, l) {
|
|
74
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
75
|
-
if (null != t) {
|
|
76
|
-
var e,
|
|
77
|
-
n,
|
|
78
|
-
i,
|
|
79
|
-
u,
|
|
80
|
-
a = [],
|
|
81
|
-
f = true,
|
|
82
|
-
o = false;
|
|
83
|
-
try {
|
|
84
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
85
|
-
if (Object(t) !== t) return;
|
|
86
|
-
f = !1;
|
|
87
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
88
|
-
} catch (r) {
|
|
89
|
-
o = true, n = r;
|
|
90
|
-
} finally {
|
|
91
|
-
try {
|
|
92
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
93
|
-
} finally {
|
|
94
|
-
if (o) throw n;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return a;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function _nonIterableRest() {
|
|
101
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
102
|
-
}
|
|
103
70
|
function ownKeys(e, r) {
|
|
104
71
|
var t = Object.keys(e);
|
|
105
72
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -141,9 +108,6 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
141
108
|
}
|
|
142
109
|
return t;
|
|
143
110
|
}
|
|
144
|
-
function _slicedToArray(r, e) {
|
|
145
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
146
|
-
}
|
|
147
111
|
function _toPrimitive(t, r) {
|
|
148
112
|
if ("object" != typeof t || !t) return t;
|
|
149
113
|
var e = t[Symbol.toPrimitive];
|
|
@@ -715,7 +679,7 @@ var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingL
|
|
|
715
679
|
var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
|
|
716
680
|
return "".concat(scale1x);
|
|
717
681
|
};
|
|
718
|
-
var defaultContext
|
|
682
|
+
var defaultContext = {
|
|
719
683
|
getScaleProps: function getScaleProps() {
|
|
720
684
|
return undefined;
|
|
721
685
|
},
|
|
@@ -741,7 +705,7 @@ var defaultContext$1 = {
|
|
|
741
705
|
},
|
|
742
706
|
unit: '16px'
|
|
743
707
|
};
|
|
744
|
-
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext
|
|
708
|
+
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
745
709
|
var useScale = function useScale() {
|
|
746
710
|
return React.useContext(ScaleContext);
|
|
747
711
|
};
|
|
@@ -798,7 +762,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
|
|
|
798
762
|
return getAllScaleProps;
|
|
799
763
|
};
|
|
800
764
|
|
|
801
|
-
var _excluded$
|
|
765
|
+
var _excluded$2 = ["children"];
|
|
802
766
|
var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
|
|
803
767
|
if (scale === 1) return scale;
|
|
804
768
|
var diff = Math.abs((scale - 1) / 2);
|
|
@@ -808,7 +772,7 @@ var withScale = function withScale(Render) {
|
|
|
808
772
|
var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
809
773
|
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;
|
|
810
774
|
var children = _ref.children,
|
|
811
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
775
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
812
776
|
var _useTheme = theme.useTheme(),
|
|
813
777
|
layout = _useTheme.layout;
|
|
814
778
|
var paddingLeft = props.paddingLeft,
|
|
@@ -893,7 +857,7 @@ var withScale = function withScale(Render) {
|
|
|
893
857
|
return ScaleFC;
|
|
894
858
|
};
|
|
895
859
|
|
|
896
|
-
var _excluded$
|
|
860
|
+
var _excluded$1 = ["children", "tag", "className", "color"];
|
|
897
861
|
var getTypeColor = function getTypeColor(type, palette) {
|
|
898
862
|
var colors = {
|
|
899
863
|
"default": 'inherit',
|
|
@@ -911,7 +875,7 @@ var TextChild = function TextChild(_ref) {
|
|
|
911
875
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
912
876
|
_ref$color = _ref.color,
|
|
913
877
|
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
914
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
878
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
915
879
|
var Component = tag;
|
|
916
880
|
var theme$1 = theme.useTheme();
|
|
917
881
|
var _useScale = useScale(),
|
|
@@ -959,652 +923,7 @@ var TextChild = function TextChild(_ref) {
|
|
|
959
923
|
};
|
|
960
924
|
TextChild.displayName = 'TextChild';
|
|
961
925
|
|
|
962
|
-
var
|
|
963
|
-
var _ref$x = _ref.x,
|
|
964
|
-
x = _ref$x === void 0 ? 0 : _ref$x,
|
|
965
|
-
_ref$y = _ref.y,
|
|
966
|
-
y = _ref$y === void 0 ? 0 : _ref$y,
|
|
967
|
-
color = _ref.color,
|
|
968
|
-
onCompleted = _ref.onCompleted;
|
|
969
|
-
var dripRef = React.useRef(null);
|
|
970
|
-
/* istanbul ignore next */
|
|
971
|
-
var top = Number.isNaN(+y) ? 0 : y - 10;
|
|
972
|
-
/* istanbul ignore next */
|
|
973
|
-
var left = Number.isNaN(+x) ? 0 : x - 10;
|
|
974
|
-
React.useEffect(function () {
|
|
975
|
-
/* istanbul ignore next */
|
|
976
|
-
if (!dripRef.current) return;
|
|
977
|
-
dripRef.current.addEventListener('animationend', onCompleted);
|
|
978
|
-
return function () {
|
|
979
|
-
/* istanbul ignore next */
|
|
980
|
-
if (!dripRef.current) return;
|
|
981
|
-
dripRef.current.removeEventListener('animationend', onCompleted);
|
|
982
|
-
};
|
|
983
|
-
});
|
|
984
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
985
|
-
ref: dripRef,
|
|
986
|
-
className: "jsx-3424889537" + " " + "drip",
|
|
987
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("svg", {
|
|
988
|
-
width: "20",
|
|
989
|
-
height: "20",
|
|
990
|
-
viewBox: "0 0 20 20",
|
|
991
|
-
style: {
|
|
992
|
-
top: top,
|
|
993
|
-
left: left
|
|
994
|
-
},
|
|
995
|
-
className: "jsx-3424889537",
|
|
996
|
-
children: /*#__PURE__*/jsxRuntime.jsx("g", {
|
|
997
|
-
stroke: "none",
|
|
998
|
-
strokeWidth: "1",
|
|
999
|
-
fill: "none",
|
|
1000
|
-
fillRule: "evenodd",
|
|
1001
|
-
className: "jsx-3424889537",
|
|
1002
|
-
children: /*#__PURE__*/jsxRuntime.jsx("g", {
|
|
1003
|
-
fill: color,
|
|
1004
|
-
className: "jsx-3424889537",
|
|
1005
|
-
children: /*#__PURE__*/jsxRuntime.jsx("rect", {
|
|
1006
|
-
width: "100%",
|
|
1007
|
-
height: "100%",
|
|
1008
|
-
rx: "10",
|
|
1009
|
-
className: "jsx-3424889537"
|
|
1010
|
-
})
|
|
1011
|
-
})
|
|
1012
|
-
})
|
|
1013
|
-
}), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1014
|
-
id: "3424889537",
|
|
1015
|
-
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;}}"
|
|
1016
|
-
})]
|
|
1017
|
-
});
|
|
1018
|
-
};
|
|
1019
|
-
ButtonDrip.displayName = 'ButtonDrip';
|
|
1020
|
-
|
|
1021
|
-
var _excluded$3 = ["children", "type", "color", "className", "spaceRatio"];
|
|
1022
|
-
var getIconBgColor = function getIconBgColor(type, palette, color) {
|
|
1023
|
-
var colors = {
|
|
1024
|
-
"default": palette.accents_6,
|
|
1025
|
-
secondary: palette.secondary,
|
|
1026
|
-
success: palette.success,
|
|
1027
|
-
warning: palette.warning,
|
|
1028
|
-
error: palette.error
|
|
1029
|
-
};
|
|
1030
|
-
return color ? color : colors[type];
|
|
1031
|
-
};
|
|
1032
|
-
var LoadingComponent = function LoadingComponent(_ref) {
|
|
1033
|
-
var children = _ref.children,
|
|
1034
|
-
_ref$type = _ref.type,
|
|
1035
|
-
type = _ref$type === void 0 ? 'default' : _ref$type,
|
|
1036
|
-
color = _ref.color,
|
|
1037
|
-
_ref$className = _ref.className,
|
|
1038
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1039
|
-
_ref$spaceRatio = _ref.spaceRatio,
|
|
1040
|
-
spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
|
|
1041
|
-
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
1042
|
-
var theme$1 = theme.useTheme();
|
|
1043
|
-
var _useScale = useScale(),
|
|
1044
|
-
SCALES = _useScale.SCALES;
|
|
1045
|
-
var classes = theme.useClasses('loading-container', className);
|
|
1046
|
-
var bgColor = React.useMemo(function () {
|
|
1047
|
-
return getIconBgColor(type, theme$1.palette, color);
|
|
1048
|
-
}, [type, theme$1.palette, color]);
|
|
1049
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1050
|
-
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 || ""),
|
|
1051
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
1052
|
-
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",
|
|
1053
|
-
children: [children && /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
1054
|
-
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]]]),
|
|
1055
|
-
children: children
|
|
1056
|
-
}), /*#__PURE__*/jsxRuntime.jsx("i", {
|
|
1057
|
-
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]]])
|
|
1058
|
-
}), /*#__PURE__*/jsxRuntime.jsx("i", {
|
|
1059
|
-
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]]])
|
|
1060
|
-
}), /*#__PURE__*/jsxRuntime.jsx("i", {
|
|
1061
|
-
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]]])
|
|
1062
|
-
})]
|
|
1063
|
-
}), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1064
|
-
id: "2201634259",
|
|
1065
|
-
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],
|
|
1066
|
-
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;}}")
|
|
1067
|
-
})]
|
|
1068
|
-
}));
|
|
1069
|
-
};
|
|
1070
|
-
LoadingComponent.displayName = 'Loading';
|
|
1071
|
-
var Loading = withScale(LoadingComponent);
|
|
1072
|
-
|
|
1073
|
-
var ButtonLoading = function ButtonLoading(_ref) {
|
|
1074
|
-
var color = _ref.color;
|
|
1075
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1076
|
-
className: "jsx-212623367" + " " + "btn-loading",
|
|
1077
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Loading, {
|
|
1078
|
-
color: color
|
|
1079
|
-
}), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1080
|
-
id: "212623367",
|
|
1081
|
-
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);}"
|
|
1082
|
-
})]
|
|
1083
|
-
});
|
|
1084
|
-
};
|
|
1085
|
-
ButtonLoading.displayName = 'ButtonLoading';
|
|
1086
|
-
|
|
1087
|
-
var _excluded$2 = ["isRight", "isSingle", "children", "className"];
|
|
1088
|
-
var ButtonIcon = function ButtonIcon(_ref) {
|
|
1089
|
-
var _ref$isRight = _ref.isRight,
|
|
1090
|
-
isRight = _ref$isRight === void 0 ? false : _ref$isRight,
|
|
1091
|
-
isSingle = _ref.isSingle,
|
|
1092
|
-
children = _ref.children,
|
|
1093
|
-
_ref$className = _ref.className,
|
|
1094
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1095
|
-
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
1096
|
-
var classes = theme.useClasses('icon', {
|
|
1097
|
-
right: isRight,
|
|
1098
|
-
single: isSingle
|
|
1099
|
-
}, className);
|
|
1100
|
-
return /*#__PURE__*/jsxRuntime.jsxs("span", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1101
|
-
className: "jsx-2467502931" + " " + (props && props.className != null && props.className || classes || ""),
|
|
1102
|
-
children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1103
|
-
id: "2467502931",
|
|
1104
|
-
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;}"
|
|
1105
|
-
})]
|
|
1106
|
-
}));
|
|
1107
|
-
};
|
|
1108
|
-
ButtonIcon.displayName = 'ButtonIcon';
|
|
1109
|
-
|
|
1110
|
-
var getButtonChildrenWithIcon = function getButtonChildrenWithIcon(auto, children, icons) {
|
|
1111
|
-
var icon = icons.icon,
|
|
1112
|
-
iconRight = icons.iconRight;
|
|
1113
|
-
var hasIcon = icon || iconRight;
|
|
1114
|
-
var isRight = Boolean(iconRight);
|
|
1115
|
-
var paddingForAutoMode = auto ? "calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding) * .5)" : 0;
|
|
1116
|
-
var classes = theme.useClasses('text', isRight ? 'right' : 'left');
|
|
1117
|
-
if (!hasIcon) return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1118
|
-
className: "text",
|
|
1119
|
-
children: children
|
|
1120
|
-
});
|
|
1121
|
-
if (React.Children.count(children) === 0) {
|
|
1122
|
-
return /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
|
|
1123
|
-
isRight: isRight,
|
|
1124
|
-
isSingle: true,
|
|
1125
|
-
children: hasIcon
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1129
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
|
|
1130
|
-
isRight: isRight,
|
|
1131
|
-
children: hasIcon
|
|
1132
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1133
|
-
className: _JSXStyle.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || ""),
|
|
1134
|
-
children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1135
|
-
id: "3568181479",
|
|
1136
|
-
dynamic: [paddingForAutoMode, paddingForAutoMode],
|
|
1137
|
-
children: ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}")
|
|
1138
|
-
})]
|
|
1139
|
-
})]
|
|
1140
|
-
});
|
|
1141
|
-
};
|
|
1142
|
-
var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
|
|
1143
|
-
if (!config.isButtonGroup) return props;
|
|
1144
|
-
return _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1145
|
-
auto: true,
|
|
1146
|
-
shadow: false,
|
|
1147
|
-
ghost: config.ghost || props.ghost,
|
|
1148
|
-
type: config.type || props.type,
|
|
1149
|
-
disabled: config.disabled || props.disabled
|
|
1150
|
-
});
|
|
1151
|
-
};
|
|
1152
|
-
|
|
1153
|
-
/* "use client" */
|
|
1154
|
-
|
|
1155
|
-
var defaultContext = {
|
|
1156
|
-
isButtonGroup: false,
|
|
1157
|
-
disabled: false
|
|
1158
|
-
};
|
|
1159
|
-
var ButtonGroupContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
1160
|
-
var useButtonGroupContext = function useButtonGroupContext() {
|
|
1161
|
-
return React.useContext(ButtonGroupContext);
|
|
1162
|
-
};
|
|
1163
|
-
|
|
1164
|
-
var hexToRgb = function hexToRgb(color) {
|
|
1165
|
-
var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
1166
|
-
var full = color.replace(fullReg, function (_, r, g, b) {
|
|
1167
|
-
return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
|
|
1168
|
-
});
|
|
1169
|
-
var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
|
|
1170
|
-
if (!values) {
|
|
1171
|
-
throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
|
|
1172
|
-
}
|
|
1173
|
-
return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
|
|
1174
|
-
};
|
|
1175
|
-
var colorToRgbValues = function colorToRgbValues(color) {
|
|
1176
|
-
if (color.charAt(0) === '#') return hexToRgb(color);
|
|
1177
|
-
var safeColor = color.replace(/ /g, '');
|
|
1178
|
-
var colorType = color.substr(0, 4);
|
|
1179
|
-
var regArray = safeColor.match(/\((.+)\)/);
|
|
1180
|
-
if (!colorType.startsWith('rgb') || !regArray) {
|
|
1181
|
-
console.log(color);
|
|
1182
|
-
throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
|
|
1183
|
-
}
|
|
1184
|
-
return regArray[1].split(',').map(function (str) {
|
|
1185
|
-
return Number.parseFloat(str);
|
|
1186
|
-
});
|
|
1187
|
-
};
|
|
1188
|
-
var addColorAlpha = function addColorAlpha(color, alpha) {
|
|
1189
|
-
if (!/^#|rgb|RGB/.test(color)) return color;
|
|
1190
|
-
var _colorToRgbValues = colorToRgbValues(color),
|
|
1191
|
-
_colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
|
|
1192
|
-
r = _colorToRgbValues2[0],
|
|
1193
|
-
g = _colorToRgbValues2[1],
|
|
1194
|
-
b = _colorToRgbValues2[2];
|
|
1195
|
-
var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
|
|
1196
|
-
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
|
|
1197
|
-
};
|
|
1198
|
-
|
|
1199
|
-
var getButtonGhostColors = function getButtonGhostColors(palette, _color) {
|
|
1200
|
-
var colors = {
|
|
1201
|
-
secondary: {
|
|
1202
|
-
bg: palette.background,
|
|
1203
|
-
border: palette.foreground,
|
|
1204
|
-
color: palette.foreground,
|
|
1205
|
-
ripple: ''
|
|
1206
|
-
},
|
|
1207
|
-
success: {
|
|
1208
|
-
bg: palette.background,
|
|
1209
|
-
border: palette.success,
|
|
1210
|
-
color: palette.success,
|
|
1211
|
-
ripple: ''
|
|
1212
|
-
},
|
|
1213
|
-
warning: {
|
|
1214
|
-
bg: palette.background,
|
|
1215
|
-
border: palette.warning,
|
|
1216
|
-
color: palette.warning,
|
|
1217
|
-
ripple: ''
|
|
1218
|
-
},
|
|
1219
|
-
error: {
|
|
1220
|
-
bg: palette.background,
|
|
1221
|
-
border: palette.error,
|
|
1222
|
-
color: palette.error,
|
|
1223
|
-
ripple: ''
|
|
1224
|
-
}
|
|
1225
|
-
};
|
|
1226
|
-
return colors[_color] || null;
|
|
1227
|
-
};
|
|
1228
|
-
var getButtonColors = function getButtonColors(palette, props) {
|
|
1229
|
-
var color = props.color,
|
|
1230
|
-
disabled = props.disabled,
|
|
1231
|
-
ghost = props.ghost;
|
|
1232
|
-
var colors = {
|
|
1233
|
-
"default": {
|
|
1234
|
-
bg: palette.background,
|
|
1235
|
-
border: palette.border,
|
|
1236
|
-
color: palette.accents_5,
|
|
1237
|
-
ripple: palette.accents_1
|
|
1238
|
-
},
|
|
1239
|
-
secondary: {
|
|
1240
|
-
bg: palette.foreground,
|
|
1241
|
-
border: palette.foreground,
|
|
1242
|
-
color: palette.background,
|
|
1243
|
-
ripple: palette.accents_1
|
|
1244
|
-
},
|
|
1245
|
-
success: {
|
|
1246
|
-
bg: palette.success,
|
|
1247
|
-
border: palette.success,
|
|
1248
|
-
color: '#fff',
|
|
1249
|
-
ripple: '#1f93ffff'
|
|
1250
|
-
},
|
|
1251
|
-
warning: {
|
|
1252
|
-
bg: palette.warning,
|
|
1253
|
-
border: palette.warning,
|
|
1254
|
-
color: '#fff',
|
|
1255
|
-
ripple: '#ffca29ff'
|
|
1256
|
-
},
|
|
1257
|
-
error: {
|
|
1258
|
-
bg: palette.error,
|
|
1259
|
-
border: palette.error,
|
|
1260
|
-
color: '#fff',
|
|
1261
|
-
ripple: '#ff5a55ff'
|
|
1262
|
-
},
|
|
1263
|
-
abort: {
|
|
1264
|
-
bg: 'transparent',
|
|
1265
|
-
border: 'transparent',
|
|
1266
|
-
color: palette.accents_5,
|
|
1267
|
-
ripple: palette.accents_1
|
|
1268
|
-
}
|
|
1269
|
-
};
|
|
1270
|
-
if (disabled) return {
|
|
1271
|
-
bg: palette.accents_1,
|
|
1272
|
-
border: palette.accents_2,
|
|
1273
|
-
color: '#ccc',
|
|
1274
|
-
ripple: ''
|
|
1275
|
-
};
|
|
1276
|
-
|
|
1277
|
-
/**
|
|
1278
|
-
* The '-light' type is the same color as the common type,
|
|
1279
|
-
* only hover's color is different.
|
|
1280
|
-
* e.g.
|
|
1281
|
-
* Color['success'] === Color['success-light']
|
|
1282
|
-
* Color['warning'] === Color['warning-light']
|
|
1283
|
-
*/
|
|
1284
|
-
var withoutLightType = color === null || color === void 0 ? void 0 : color.replace('-light', '');
|
|
1285
|
-
var defaultColor = colors["default"];
|
|
1286
|
-
if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
|
|
1287
|
-
return colors[withoutLightType] || defaultColor;
|
|
1288
|
-
};
|
|
1289
|
-
var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, _color) {
|
|
1290
|
-
var colors = {
|
|
1291
|
-
secondary: {
|
|
1292
|
-
bg: palette.foreground,
|
|
1293
|
-
border: palette.background,
|
|
1294
|
-
color: palette.background
|
|
1295
|
-
},
|
|
1296
|
-
success: {
|
|
1297
|
-
bg: palette.success,
|
|
1298
|
-
border: palette.background,
|
|
1299
|
-
color: 'white'
|
|
1300
|
-
},
|
|
1301
|
-
warning: {
|
|
1302
|
-
bg: palette.warning,
|
|
1303
|
-
border: palette.background,
|
|
1304
|
-
color: 'white'
|
|
1305
|
-
},
|
|
1306
|
-
error: {
|
|
1307
|
-
bg: palette.error,
|
|
1308
|
-
border: palette.background,
|
|
1309
|
-
color: 'white'
|
|
1310
|
-
}
|
|
1311
|
-
};
|
|
1312
|
-
var withoutLightType = _color === null || _color === void 0 ? void 0 : _color.replace('-light', '');
|
|
1313
|
-
return colors[withoutLightType] || null;
|
|
1314
|
-
};
|
|
1315
|
-
var getButtonHoverColors = function getButtonHoverColors(palette, props) {
|
|
1316
|
-
var color = props.color,
|
|
1317
|
-
disabled = props.disabled,
|
|
1318
|
-
loading = props.loading,
|
|
1319
|
-
shadow = props.shadow,
|
|
1320
|
-
ghost = props.ghost;
|
|
1321
|
-
var defaultColor = getButtonColors(palette, props);
|
|
1322
|
-
var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
|
|
1323
|
-
var colors = {
|
|
1324
|
-
"default": {
|
|
1325
|
-
bg: palette.background,
|
|
1326
|
-
border: palette.foreground
|
|
1327
|
-
},
|
|
1328
|
-
secondary: {
|
|
1329
|
-
bg: palette.background,
|
|
1330
|
-
border: palette.foreground
|
|
1331
|
-
},
|
|
1332
|
-
success: {
|
|
1333
|
-
bg: palette.background,
|
|
1334
|
-
border: palette.success
|
|
1335
|
-
},
|
|
1336
|
-
warning: {
|
|
1337
|
-
bg: palette.background,
|
|
1338
|
-
border: palette.warning
|
|
1339
|
-
},
|
|
1340
|
-
error: {
|
|
1341
|
-
bg: palette.background,
|
|
1342
|
-
border: palette.error
|
|
1343
|
-
},
|
|
1344
|
-
abort: {
|
|
1345
|
-
bg: 'transparent',
|
|
1346
|
-
border: 'transparent',
|
|
1347
|
-
color: palette.accents_5
|
|
1348
|
-
},
|
|
1349
|
-
'secondary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1350
|
-
bg: alphaBackground
|
|
1351
|
-
}),
|
|
1352
|
-
'success-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1353
|
-
bg: alphaBackground
|
|
1354
|
-
}),
|
|
1355
|
-
'warning-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1356
|
-
bg: alphaBackground
|
|
1357
|
-
}),
|
|
1358
|
-
'error-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1359
|
-
bg: alphaBackground
|
|
1360
|
-
})
|
|
1361
|
-
};
|
|
1362
|
-
if (disabled) return {
|
|
1363
|
-
bg: palette.accents_1,
|
|
1364
|
-
border: palette.accents_2,
|
|
1365
|
-
color: '#ccc'
|
|
1366
|
-
};
|
|
1367
|
-
if (loading) return _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1368
|
-
color: 'transparent'
|
|
1369
|
-
});
|
|
1370
|
-
if (shadow) return defaultColor;
|
|
1371
|
-
var hoverColor = (ghost ? getButtonGhostHoverColors(palette, color) : colors[color]) || colors["default"];
|
|
1372
|
-
return _objectSpread2(_objectSpread2({}, hoverColor), {}, {
|
|
1373
|
-
color: hoverColor.color || hoverColor.border
|
|
1374
|
-
});
|
|
1375
|
-
};
|
|
1376
|
-
var getButtonCursor = function getButtonCursor(disabled, loading) {
|
|
1377
|
-
if (disabled) return {
|
|
1378
|
-
cursor: 'not-allowed',
|
|
1379
|
-
events: 'auto'
|
|
1380
|
-
};
|
|
1381
|
-
if (loading) return {
|
|
1382
|
-
cursor: 'default',
|
|
1383
|
-
events: 'none'
|
|
1384
|
-
};
|
|
1385
|
-
return {
|
|
1386
|
-
cursor: 'pointer',
|
|
1387
|
-
events: 'auto'
|
|
1388
|
-
};
|
|
1389
|
-
};
|
|
1390
|
-
var getButtonDripColor = function getButtonDripColor(palette, props) {
|
|
1391
|
-
var type = props.type;
|
|
1392
|
-
var isLightHover = type ? type.endsWith('light') : false;
|
|
1393
|
-
var hoverColors = getButtonHoverColors(palette, props);
|
|
1394
|
-
return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
|
|
1395
|
-
};
|
|
1396
|
-
|
|
1397
|
-
var _excluded$1 = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "relative", "replace", "a", "to", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
|
|
1398
|
-
var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
|
|
1399
|
-
var theme$1 = theme.useTheme();
|
|
1400
|
-
// const navigate = useNavigate();
|
|
1401
|
-
var _useScale = useScale(),
|
|
1402
|
-
SCALES = _useScale.SCALES;
|
|
1403
|
-
var buttonRef = React.useRef(null);
|
|
1404
|
-
React.useImperativeHandle(ref, function () {
|
|
1405
|
-
return buttonRef.current;
|
|
1406
|
-
}); // Changed with !
|
|
1407
|
-
|
|
1408
|
-
var _useState = React.useState(false),
|
|
1409
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1410
|
-
dripShow = _useState2[0],
|
|
1411
|
-
setDripShow = _useState2[1];
|
|
1412
|
-
var _useState3 = React.useState(0),
|
|
1413
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1414
|
-
dripX = _useState4[0],
|
|
1415
|
-
setDripX = _useState4[1];
|
|
1416
|
-
var _useState5 = React.useState(0),
|
|
1417
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
1418
|
-
dripY = _useState6[0],
|
|
1419
|
-
setDripY = _useState6[1];
|
|
1420
|
-
var groupConfig = useButtonGroupContext();
|
|
1421
|
-
var filteredProps = filterPropsWithGroup(btnProps, groupConfig);
|
|
1422
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1423
|
-
var children = filteredProps.children,
|
|
1424
|
-
_filteredProps$disabl = filteredProps.disabled,
|
|
1425
|
-
disabled = _filteredProps$disabl === void 0 ? false : _filteredProps$disabl;
|
|
1426
|
-
filteredProps.color;
|
|
1427
|
-
var _filteredProps$loadin = filteredProps.loading,
|
|
1428
|
-
loading = _filteredProps$loadin === void 0 ? false : _filteredProps$loadin,
|
|
1429
|
-
_filteredProps$shadow = filteredProps.shadow,
|
|
1430
|
-
shadow = _filteredProps$shadow === void 0 ? false : _filteredProps$shadow,
|
|
1431
|
-
_filteredProps$ghost = filteredProps.ghost,
|
|
1432
|
-
ghost = _filteredProps$ghost === void 0 ? false : _filteredProps$ghost,
|
|
1433
|
-
_filteredProps$effect = filteredProps.effect,
|
|
1434
|
-
effect = _filteredProps$effect === void 0 ? true : _filteredProps$effect,
|
|
1435
|
-
_filteredProps$round = filteredProps.round,
|
|
1436
|
-
round = _filteredProps$round === void 0 ? false : _filteredProps$round;
|
|
1437
|
-
filteredProps.relative;
|
|
1438
|
-
filteredProps.replace;
|
|
1439
|
-
filteredProps.a;
|
|
1440
|
-
var to = filteredProps.to,
|
|
1441
|
-
onClick = filteredProps.onClick,
|
|
1442
|
-
_filteredProps$auto = filteredProps.auto,
|
|
1443
|
-
auto = _filteredProps$auto === void 0 ? false : _filteredProps$auto,
|
|
1444
|
-
icon = filteredProps.icon,
|
|
1445
|
-
_filteredProps$type = filteredProps.type,
|
|
1446
|
-
type = _filteredProps$type === void 0 ? 'button' : _filteredProps$type,
|
|
1447
|
-
iconRight = filteredProps.iconRight,
|
|
1448
|
-
_filteredProps$classN = filteredProps.className,
|
|
1449
|
-
className = _filteredProps$classN === void 0 ? '' : _filteredProps$classN;
|
|
1450
|
-
filteredProps.crossOrigin;
|
|
1451
|
-
var props = _objectWithoutProperties(filteredProps, _excluded$1);
|
|
1452
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
1453
|
-
|
|
1454
|
-
var _useMemo = React.useMemo(function () {
|
|
1455
|
-
return getButtonColors(theme$1.palette, filteredProps);
|
|
1456
|
-
}, [theme$1.palette, filteredProps]),
|
|
1457
|
-
bg = _useMemo.bg,
|
|
1458
|
-
border = _useMemo.border,
|
|
1459
|
-
color = _useMemo.color,
|
|
1460
|
-
rippleColor = _useMemo.ripple;
|
|
1461
|
-
var hover = React.useMemo(function () {
|
|
1462
|
-
return getButtonHoverColors(theme$1.palette, filteredProps);
|
|
1463
|
-
}, [theme$1.palette, filteredProps]);
|
|
1464
|
-
var _useMemo2 = React.useMemo(function () {
|
|
1465
|
-
return getButtonCursor(disabled, loading);
|
|
1466
|
-
}, [disabled, loading]),
|
|
1467
|
-
cursor = _useMemo2.cursor,
|
|
1468
|
-
events = _useMemo2.events;
|
|
1469
|
-
var dripColor = React.useMemo(function () {
|
|
1470
|
-
return getButtonDripColor(theme$1.palette, filteredProps);
|
|
1471
|
-
}, [theme$1.palette, filteredProps]);
|
|
1472
|
-
|
|
1473
|
-
/* istanbul ignore next */
|
|
1474
|
-
var dripCompletedHandle = function dripCompletedHandle() {
|
|
1475
|
-
setDripShow(false);
|
|
1476
|
-
setDripX(0);
|
|
1477
|
-
setDripY(0);
|
|
1478
|
-
};
|
|
1479
|
-
var createRipple = function createRipple(event) {
|
|
1480
|
-
var button = buttonRef.current;
|
|
1481
|
-
if (!button) return;
|
|
1482
|
-
var rect = button.getBoundingClientRect();
|
|
1483
|
-
var size = Math.max(rect.width, rect.height);
|
|
1484
|
-
var x = event.clientX - rect.left - size / 2;
|
|
1485
|
-
var y = event.clientY - rect.top - size / 2;
|
|
1486
|
-
var rippleCount = 1; // number of rings
|
|
1487
|
-
var rippleDelay = 500; // ms between each ripple
|
|
1488
|
-
var _loop = function _loop() {
|
|
1489
|
-
var ripple = document.createElement('span');
|
|
1490
|
-
Object.assign(ripple.style, {
|
|
1491
|
-
position: 'absolute',
|
|
1492
|
-
borderRadius: '50%',
|
|
1493
|
-
backgroundColor: rippleColor,
|
|
1494
|
-
width: "".concat(size, "px"),
|
|
1495
|
-
height: "".concat(size, "px"),
|
|
1496
|
-
left: "".concat(x, "px"),
|
|
1497
|
-
top: "".concat(y, "px"),
|
|
1498
|
-
pointerEvents: 'none',
|
|
1499
|
-
transform: 'scale(0)',
|
|
1500
|
-
opacity: '1',
|
|
1501
|
-
transition: "transform 600ms ease-out ".concat(i * rippleDelay, "ms, opacity 600ms ease-out ").concat(i * rippleDelay, "ms"),
|
|
1502
|
-
zIndex: 1
|
|
1503
|
-
});
|
|
1504
|
-
button.appendChild(ripple);
|
|
1505
|
-
|
|
1506
|
-
// Force reflow to start transition
|
|
1507
|
-
window.getComputedStyle(ripple).opacity;
|
|
1508
|
-
ripple.style.transform = 'scale(2.5)';
|
|
1509
|
-
ripple.style.opacity = '0';
|
|
1510
|
-
ripple.addEventListener('transitionend', function () {
|
|
1511
|
-
ripple.remove();
|
|
1512
|
-
});
|
|
1513
|
-
};
|
|
1514
|
-
for (var i = 0; i < rippleCount; i++) {
|
|
1515
|
-
_loop();
|
|
1516
|
-
}
|
|
1517
|
-
};
|
|
1518
|
-
var clickHandler = function clickHandler(event) {
|
|
1519
|
-
if (disabled || loading) return;
|
|
1520
|
-
var showDrip = !shadow && !ghost && effect;
|
|
1521
|
-
/* istanbul ignore next */
|
|
1522
|
-
if (showDrip && buttonRef.current) {
|
|
1523
|
-
var rect = buttonRef.current.getBoundingClientRect();
|
|
1524
|
-
setDripShow(true);
|
|
1525
|
-
setDripX(event.clientX - rect.left);
|
|
1526
|
-
setDripY(event.clientY - rect.top);
|
|
1527
|
-
}
|
|
1528
|
-
if (shadow) {
|
|
1529
|
-
createRipple(event);
|
|
1530
|
-
}
|
|
1531
|
-
onClick && onClick(event);
|
|
1532
|
-
};
|
|
1533
|
-
var childrenWithIcon = React.useMemo(function () {
|
|
1534
|
-
return getButtonChildrenWithIcon(auto, children, {
|
|
1535
|
-
icon: icon,
|
|
1536
|
-
iconRight: iconRight
|
|
1537
|
-
});
|
|
1538
|
-
}, [auto, children, icon, iconRight]);
|
|
1539
|
-
var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
|
|
1540
|
-
paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
|
|
1541
|
-
|
|
1542
|
-
// If shadow provided is string then value other default
|
|
1543
|
-
var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme$1.shadows.level.z2 : 'none';
|
|
1544
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1545
|
-
children: [to ? /*#__PURE__*/jsxRuntime.jsxs("a", _objectSpread2(_objectSpread2({
|
|
1546
|
-
href: to
|
|
1547
|
-
}, props), {}, {
|
|
1548
|
-
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) || ""),
|
|
1549
|
-
children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
|
|
1550
|
-
color: color
|
|
1551
|
-
}), childrenWithIcon]
|
|
1552
|
-
})) : /*#__PURE__*/jsxRuntime.jsxs("button", _objectSpread2(_objectSpread2({
|
|
1553
|
-
ref: buttonRef,
|
|
1554
|
-
type: type,
|
|
1555
|
-
disabled: disabled,
|
|
1556
|
-
onClick: clickHandler
|
|
1557
|
-
}, props), {}, {
|
|
1558
|
-
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) || ""),
|
|
1559
|
-
children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
|
|
1560
|
-
color: color
|
|
1561
|
-
}), childrenWithIcon, dripShow && /*#__PURE__*/jsxRuntime.jsx(ButtonDrip, {
|
|
1562
|
-
x: dripX,
|
|
1563
|
-
y: dripY,
|
|
1564
|
-
color: dripColor,
|
|
1565
|
-
onCompleted: dripCompletedHandle
|
|
1566
|
-
})]
|
|
1567
|
-
})), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1568
|
-
id: "612376042",
|
|
1569
|
-
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'],
|
|
1570
|
-
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;}}")
|
|
1571
|
-
})]
|
|
1572
|
-
});
|
|
1573
|
-
});
|
|
1574
|
-
ButtonComponent.displayName = 'Button';
|
|
1575
|
-
var Button = withScale(ButtonComponent);
|
|
1576
|
-
|
|
1577
|
-
var CompactButton = function CompactButton(props) {
|
|
1578
|
-
// const theme = useTheme();
|
|
1579
|
-
return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
|
|
1580
|
-
scale: 2 / 3,
|
|
1581
|
-
px: 0.6
|
|
1582
|
-
}, _objectSpread2({
|
|
1583
|
-
auto: true
|
|
1584
|
-
}, props)), {}, {
|
|
1585
|
-
children: props.children
|
|
1586
|
-
}));
|
|
1587
|
-
};
|
|
1588
|
-
var IconButton = /*#__PURE__*/React.memo(CompactButton);
|
|
1589
|
-
|
|
1590
|
-
var SmallButton = function SmallButton(props) {
|
|
1591
|
-
// const theme = useTheme();
|
|
1592
|
-
return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
|
|
1593
|
-
auto: true,
|
|
1594
|
-
scale: 2 / 3,
|
|
1595
|
-
px: 0.6
|
|
1596
|
-
}, props), {}, {
|
|
1597
|
-
children: props.children
|
|
1598
|
-
}));
|
|
1599
|
-
};
|
|
1600
|
-
var SmallButton$1 = /*#__PURE__*/React.memo(SmallButton);
|
|
1601
|
-
|
|
1602
|
-
/* "use client" */
|
|
1603
|
-
|
|
1604
|
-
Button.Icon = IconButton;
|
|
1605
|
-
Button.Small = SmallButton$1;
|
|
1606
|
-
|
|
1607
|
-
var _excluded = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "collapse", "children", "className", "display", "alignItems", "justify"];
|
|
926
|
+
var _excluded = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "children", "className", "display", "alignItems", "justify"];
|
|
1608
927
|
var _getModifierChild = function getModifierChild(tags, children) {
|
|
1609
928
|
if (!tags.length) return children;
|
|
1610
929
|
var nextTag = tags.slice(1, tags.length);
|
|
@@ -1644,8 +963,6 @@ var TextComponent = function TextComponent(_ref) {
|
|
|
1644
963
|
blockquote = _ref$blockquote === void 0 ? false : _ref$blockquote,
|
|
1645
964
|
_ref$noWrap = _ref.noWrap,
|
|
1646
965
|
noWrap = _ref$noWrap === void 0 ? false : _ref$noWrap,
|
|
1647
|
-
_ref$collapse = _ref.collapse,
|
|
1648
|
-
collapse = _ref$collapse === void 0 ? 0 : _ref$collapse,
|
|
1649
966
|
children = _ref.children,
|
|
1650
967
|
_ref$className = _ref.className,
|
|
1651
968
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
@@ -1689,10 +1006,6 @@ var TextComponent = function TextComponent(_ref) {
|
|
|
1689
1006
|
*
|
|
1690
1007
|
*/
|
|
1691
1008
|
|
|
1692
|
-
var _useState = React.useState(false),
|
|
1693
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1694
|
-
expand = _useState2[0],
|
|
1695
|
-
setExpand = _useState2[1];
|
|
1696
1009
|
var tag = React.useMemo(function () {
|
|
1697
1010
|
if (names[0]) return names[0];
|
|
1698
1011
|
if (inlineNames[0]) return inlineNames[0];
|
|
@@ -1715,26 +1028,7 @@ var TextComponent = function TextComponent(_ref) {
|
|
|
1715
1028
|
className: "".concat(className, " ").concat(noWrap ? 'no-wrap' : ''),
|
|
1716
1029
|
tag: tag
|
|
1717
1030
|
}, props), {}, {
|
|
1718
|
-
children:
|
|
1719
|
-
children: [expand ? modifers : (modifers === null || modifers === void 0 ? void 0 : modifers.toString().substring(0, collapse)) + '...', /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
1720
|
-
margin: 0,
|
|
1721
|
-
onClick: function onClick() {
|
|
1722
|
-
return setExpand(!expand);
|
|
1723
|
-
},
|
|
1724
|
-
style: {
|
|
1725
|
-
textTransform: 'lowercase'
|
|
1726
|
-
},
|
|
1727
|
-
effect: false,
|
|
1728
|
-
color: "abort",
|
|
1729
|
-
scale: 2 / 3,
|
|
1730
|
-
px: 0.2,
|
|
1731
|
-
py: 0,
|
|
1732
|
-
auto: true,
|
|
1733
|
-
children: /*#__PURE__*/jsxRuntime.jsx("b", {
|
|
1734
|
-
children: expand ? 'less' : 'more'
|
|
1735
|
-
})
|
|
1736
|
-
})]
|
|
1737
|
-
}) : modifers
|
|
1031
|
+
children: modifers
|
|
1738
1032
|
}));
|
|
1739
1033
|
};
|
|
1740
1034
|
TextComponent.displayName = 'Text';
|