@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/input/index.js
CHANGED
|
@@ -742,7 +742,7 @@ var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingL
|
|
|
742
742
|
var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
|
|
743
743
|
return "".concat(scale1x);
|
|
744
744
|
};
|
|
745
|
-
var defaultContext
|
|
745
|
+
var defaultContext = {
|
|
746
746
|
getScaleProps: function getScaleProps() {
|
|
747
747
|
return undefined;
|
|
748
748
|
},
|
|
@@ -768,7 +768,7 @@ var defaultContext$1 = {
|
|
|
768
768
|
},
|
|
769
769
|
unit: '16px'
|
|
770
770
|
};
|
|
771
|
-
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext
|
|
771
|
+
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
772
772
|
var useScale = function useScale() {
|
|
773
773
|
return React.useContext(ScaleContext);
|
|
774
774
|
};
|
|
@@ -825,7 +825,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
|
|
|
825
825
|
return getAllScaleProps;
|
|
826
826
|
};
|
|
827
827
|
|
|
828
|
-
var _excluded$
|
|
828
|
+
var _excluded$6 = ["children"];
|
|
829
829
|
var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
|
|
830
830
|
if (scale === 1) return scale;
|
|
831
831
|
var diff = Math.abs((scale - 1) / 2);
|
|
@@ -835,7 +835,7 @@ var withScale = function withScale(Render) {
|
|
|
835
835
|
var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
836
836
|
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;
|
|
837
837
|
var children = _ref.children,
|
|
838
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
838
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
839
839
|
var _useTheme = theme.useTheme(),
|
|
840
840
|
layout = _useTheme.layout;
|
|
841
841
|
var paddingLeft = props.paddingLeft,
|
|
@@ -920,7 +920,7 @@ var withScale = function withScale(Render) {
|
|
|
920
920
|
return ScaleFC;
|
|
921
921
|
};
|
|
922
922
|
|
|
923
|
-
var _excluded$
|
|
923
|
+
var _excluded$5 = ["children", "tag", "className", "color"];
|
|
924
924
|
var getTypeColor = function getTypeColor(type, palette) {
|
|
925
925
|
var colors = {
|
|
926
926
|
"default": 'inherit',
|
|
@@ -938,7 +938,7 @@ var TextChild = function TextChild(_ref) {
|
|
|
938
938
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
939
939
|
_ref$color = _ref.color,
|
|
940
940
|
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
941
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
941
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
942
942
|
var Component = tag;
|
|
943
943
|
var theme$1 = theme.useTheme();
|
|
944
944
|
var _useScale = useScale(),
|
|
@@ -986,652 +986,7 @@ var TextChild = function TextChild(_ref) {
|
|
|
986
986
|
};
|
|
987
987
|
TextChild.displayName = 'TextChild';
|
|
988
988
|
|
|
989
|
-
var
|
|
990
|
-
var _ref$x = _ref.x,
|
|
991
|
-
x = _ref$x === void 0 ? 0 : _ref$x,
|
|
992
|
-
_ref$y = _ref.y,
|
|
993
|
-
y = _ref$y === void 0 ? 0 : _ref$y,
|
|
994
|
-
color = _ref.color,
|
|
995
|
-
onCompleted = _ref.onCompleted;
|
|
996
|
-
var dripRef = React.useRef(null);
|
|
997
|
-
/* istanbul ignore next */
|
|
998
|
-
var top = Number.isNaN(+y) ? 0 : y - 10;
|
|
999
|
-
/* istanbul ignore next */
|
|
1000
|
-
var left = Number.isNaN(+x) ? 0 : x - 10;
|
|
1001
|
-
React.useEffect(function () {
|
|
1002
|
-
/* istanbul ignore next */
|
|
1003
|
-
if (!dripRef.current) return;
|
|
1004
|
-
dripRef.current.addEventListener('animationend', onCompleted);
|
|
1005
|
-
return function () {
|
|
1006
|
-
/* istanbul ignore next */
|
|
1007
|
-
if (!dripRef.current) return;
|
|
1008
|
-
dripRef.current.removeEventListener('animationend', onCompleted);
|
|
1009
|
-
};
|
|
1010
|
-
});
|
|
1011
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1012
|
-
ref: dripRef,
|
|
1013
|
-
className: "jsx-3424889537" + " " + "drip",
|
|
1014
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("svg", {
|
|
1015
|
-
width: "20",
|
|
1016
|
-
height: "20",
|
|
1017
|
-
viewBox: "0 0 20 20",
|
|
1018
|
-
style: {
|
|
1019
|
-
top: top,
|
|
1020
|
-
left: left
|
|
1021
|
-
},
|
|
1022
|
-
className: "jsx-3424889537",
|
|
1023
|
-
children: /*#__PURE__*/jsxRuntime.jsx("g", {
|
|
1024
|
-
stroke: "none",
|
|
1025
|
-
strokeWidth: "1",
|
|
1026
|
-
fill: "none",
|
|
1027
|
-
fillRule: "evenodd",
|
|
1028
|
-
className: "jsx-3424889537",
|
|
1029
|
-
children: /*#__PURE__*/jsxRuntime.jsx("g", {
|
|
1030
|
-
fill: color,
|
|
1031
|
-
className: "jsx-3424889537",
|
|
1032
|
-
children: /*#__PURE__*/jsxRuntime.jsx("rect", {
|
|
1033
|
-
width: "100%",
|
|
1034
|
-
height: "100%",
|
|
1035
|
-
rx: "10",
|
|
1036
|
-
className: "jsx-3424889537"
|
|
1037
|
-
})
|
|
1038
|
-
})
|
|
1039
|
-
})
|
|
1040
|
-
}), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1041
|
-
id: "3424889537",
|
|
1042
|
-
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;}}"
|
|
1043
|
-
})]
|
|
1044
|
-
});
|
|
1045
|
-
};
|
|
1046
|
-
ButtonDrip.displayName = 'ButtonDrip';
|
|
1047
|
-
|
|
1048
|
-
var _excluded$7 = ["children", "type", "color", "className", "spaceRatio"];
|
|
1049
|
-
var getIconBgColor = function getIconBgColor(type, palette, color) {
|
|
1050
|
-
var colors = {
|
|
1051
|
-
"default": palette.accents_6,
|
|
1052
|
-
secondary: palette.secondary,
|
|
1053
|
-
success: palette.success,
|
|
1054
|
-
warning: palette.warning,
|
|
1055
|
-
error: palette.error
|
|
1056
|
-
};
|
|
1057
|
-
return color ? color : colors[type];
|
|
1058
|
-
};
|
|
1059
|
-
var LoadingComponent = function LoadingComponent(_ref) {
|
|
1060
|
-
var children = _ref.children,
|
|
1061
|
-
_ref$type = _ref.type,
|
|
1062
|
-
type = _ref$type === void 0 ? 'default' : _ref$type,
|
|
1063
|
-
color = _ref.color,
|
|
1064
|
-
_ref$className = _ref.className,
|
|
1065
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1066
|
-
_ref$spaceRatio = _ref.spaceRatio,
|
|
1067
|
-
spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
|
|
1068
|
-
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
1069
|
-
var theme$1 = theme.useTheme();
|
|
1070
|
-
var _useScale = useScale(),
|
|
1071
|
-
SCALES = _useScale.SCALES;
|
|
1072
|
-
var classes = theme.useClasses('loading-container', className);
|
|
1073
|
-
var bgColor = React.useMemo(function () {
|
|
1074
|
-
return getIconBgColor(type, theme$1.palette, color);
|
|
1075
|
-
}, [type, theme$1.palette, color]);
|
|
1076
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1077
|
-
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 || ""),
|
|
1078
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
1079
|
-
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",
|
|
1080
|
-
children: [children && /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
1081
|
-
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]]]),
|
|
1082
|
-
children: children
|
|
1083
|
-
}), /*#__PURE__*/jsxRuntime.jsx("i", {
|
|
1084
|
-
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]]])
|
|
1085
|
-
}), /*#__PURE__*/jsxRuntime.jsx("i", {
|
|
1086
|
-
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]]])
|
|
1087
|
-
}), /*#__PURE__*/jsxRuntime.jsx("i", {
|
|
1088
|
-
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]]])
|
|
1089
|
-
})]
|
|
1090
|
-
}), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1091
|
-
id: "2201634259",
|
|
1092
|
-
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],
|
|
1093
|
-
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;}}")
|
|
1094
|
-
})]
|
|
1095
|
-
}));
|
|
1096
|
-
};
|
|
1097
|
-
LoadingComponent.displayName = 'Loading';
|
|
1098
|
-
var Loading = withScale(LoadingComponent);
|
|
1099
|
-
|
|
1100
|
-
var ButtonLoading = function ButtonLoading(_ref) {
|
|
1101
|
-
var color = _ref.color;
|
|
1102
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1103
|
-
className: "jsx-212623367" + " " + "btn-loading",
|
|
1104
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Loading, {
|
|
1105
|
-
color: color
|
|
1106
|
-
}), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1107
|
-
id: "212623367",
|
|
1108
|
-
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);}"
|
|
1109
|
-
})]
|
|
1110
|
-
});
|
|
1111
|
-
};
|
|
1112
|
-
ButtonLoading.displayName = 'ButtonLoading';
|
|
1113
|
-
|
|
1114
|
-
var _excluded$6 = ["isRight", "isSingle", "children", "className"];
|
|
1115
|
-
var ButtonIcon = function ButtonIcon(_ref) {
|
|
1116
|
-
var _ref$isRight = _ref.isRight,
|
|
1117
|
-
isRight = _ref$isRight === void 0 ? false : _ref$isRight,
|
|
1118
|
-
isSingle = _ref.isSingle,
|
|
1119
|
-
children = _ref.children,
|
|
1120
|
-
_ref$className = _ref.className,
|
|
1121
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1122
|
-
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
1123
|
-
var classes = theme.useClasses('icon', {
|
|
1124
|
-
right: isRight,
|
|
1125
|
-
single: isSingle
|
|
1126
|
-
}, className);
|
|
1127
|
-
return /*#__PURE__*/jsxRuntime.jsxs("span", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1128
|
-
className: "jsx-2467502931" + " " + (props && props.className != null && props.className || classes || ""),
|
|
1129
|
-
children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1130
|
-
id: "2467502931",
|
|
1131
|
-
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;}"
|
|
1132
|
-
})]
|
|
1133
|
-
}));
|
|
1134
|
-
};
|
|
1135
|
-
ButtonIcon.displayName = 'ButtonIcon';
|
|
1136
|
-
|
|
1137
|
-
var getButtonChildrenWithIcon = function getButtonChildrenWithIcon(auto, children, icons) {
|
|
1138
|
-
var icon = icons.icon,
|
|
1139
|
-
iconRight = icons.iconRight;
|
|
1140
|
-
var hasIcon = icon || iconRight;
|
|
1141
|
-
var isRight = Boolean(iconRight);
|
|
1142
|
-
var paddingForAutoMode = auto ? "calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding) * .5)" : 0;
|
|
1143
|
-
var classes = theme.useClasses('text', isRight ? 'right' : 'left');
|
|
1144
|
-
if (!hasIcon) return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1145
|
-
className: "text",
|
|
1146
|
-
children: children
|
|
1147
|
-
});
|
|
1148
|
-
if (React.Children.count(children) === 0) {
|
|
1149
|
-
return /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
|
|
1150
|
-
isRight: isRight,
|
|
1151
|
-
isSingle: true,
|
|
1152
|
-
children: hasIcon
|
|
1153
|
-
});
|
|
1154
|
-
}
|
|
1155
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1156
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
|
|
1157
|
-
isRight: isRight,
|
|
1158
|
-
children: hasIcon
|
|
1159
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1160
|
-
className: _JSXStyle.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || ""),
|
|
1161
|
-
children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1162
|
-
id: "3568181479",
|
|
1163
|
-
dynamic: [paddingForAutoMode, paddingForAutoMode],
|
|
1164
|
-
children: ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}")
|
|
1165
|
-
})]
|
|
1166
|
-
})]
|
|
1167
|
-
});
|
|
1168
|
-
};
|
|
1169
|
-
var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
|
|
1170
|
-
if (!config.isButtonGroup) return props;
|
|
1171
|
-
return _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1172
|
-
auto: true,
|
|
1173
|
-
shadow: false,
|
|
1174
|
-
ghost: config.ghost || props.ghost,
|
|
1175
|
-
type: config.type || props.type,
|
|
1176
|
-
disabled: config.disabled || props.disabled
|
|
1177
|
-
});
|
|
1178
|
-
};
|
|
1179
|
-
|
|
1180
|
-
/* "use client" */
|
|
1181
|
-
|
|
1182
|
-
var defaultContext = {
|
|
1183
|
-
isButtonGroup: false,
|
|
1184
|
-
disabled: false
|
|
1185
|
-
};
|
|
1186
|
-
var ButtonGroupContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
1187
|
-
var useButtonGroupContext = function useButtonGroupContext() {
|
|
1188
|
-
return React.useContext(ButtonGroupContext);
|
|
1189
|
-
};
|
|
1190
|
-
|
|
1191
|
-
var hexToRgb = function hexToRgb(color) {
|
|
1192
|
-
var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
1193
|
-
var full = color.replace(fullReg, function (_, r, g, b) {
|
|
1194
|
-
return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
|
|
1195
|
-
});
|
|
1196
|
-
var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
|
|
1197
|
-
if (!values) {
|
|
1198
|
-
throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
|
|
1199
|
-
}
|
|
1200
|
-
return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
|
|
1201
|
-
};
|
|
1202
|
-
var colorToRgbValues = function colorToRgbValues(color) {
|
|
1203
|
-
if (color.charAt(0) === '#') return hexToRgb(color);
|
|
1204
|
-
var safeColor = color.replace(/ /g, '');
|
|
1205
|
-
var colorType = color.substr(0, 4);
|
|
1206
|
-
var regArray = safeColor.match(/\((.+)\)/);
|
|
1207
|
-
if (!colorType.startsWith('rgb') || !regArray) {
|
|
1208
|
-
console.log(color);
|
|
1209
|
-
throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
|
|
1210
|
-
}
|
|
1211
|
-
return regArray[1].split(',').map(function (str) {
|
|
1212
|
-
return Number.parseFloat(str);
|
|
1213
|
-
});
|
|
1214
|
-
};
|
|
1215
|
-
var addColorAlpha = function addColorAlpha(color, alpha) {
|
|
1216
|
-
if (!/^#|rgb|RGB/.test(color)) return color;
|
|
1217
|
-
var _colorToRgbValues = colorToRgbValues(color),
|
|
1218
|
-
_colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
|
|
1219
|
-
r = _colorToRgbValues2[0],
|
|
1220
|
-
g = _colorToRgbValues2[1],
|
|
1221
|
-
b = _colorToRgbValues2[2];
|
|
1222
|
-
var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
|
|
1223
|
-
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
|
|
1224
|
-
};
|
|
1225
|
-
|
|
1226
|
-
var getButtonGhostColors = function getButtonGhostColors(palette, _color) {
|
|
1227
|
-
var colors = {
|
|
1228
|
-
secondary: {
|
|
1229
|
-
bg: palette.background,
|
|
1230
|
-
border: palette.foreground,
|
|
1231
|
-
color: palette.foreground,
|
|
1232
|
-
ripple: ''
|
|
1233
|
-
},
|
|
1234
|
-
success: {
|
|
1235
|
-
bg: palette.background,
|
|
1236
|
-
border: palette.success,
|
|
1237
|
-
color: palette.success,
|
|
1238
|
-
ripple: ''
|
|
1239
|
-
},
|
|
1240
|
-
warning: {
|
|
1241
|
-
bg: palette.background,
|
|
1242
|
-
border: palette.warning,
|
|
1243
|
-
color: palette.warning,
|
|
1244
|
-
ripple: ''
|
|
1245
|
-
},
|
|
1246
|
-
error: {
|
|
1247
|
-
bg: palette.background,
|
|
1248
|
-
border: palette.error,
|
|
1249
|
-
color: palette.error,
|
|
1250
|
-
ripple: ''
|
|
1251
|
-
}
|
|
1252
|
-
};
|
|
1253
|
-
return colors[_color] || null;
|
|
1254
|
-
};
|
|
1255
|
-
var getButtonColors = function getButtonColors(palette, props) {
|
|
1256
|
-
var color = props.color,
|
|
1257
|
-
disabled = props.disabled,
|
|
1258
|
-
ghost = props.ghost;
|
|
1259
|
-
var colors = {
|
|
1260
|
-
"default": {
|
|
1261
|
-
bg: palette.background,
|
|
1262
|
-
border: palette.border,
|
|
1263
|
-
color: palette.accents_5,
|
|
1264
|
-
ripple: palette.accents_1
|
|
1265
|
-
},
|
|
1266
|
-
secondary: {
|
|
1267
|
-
bg: palette.foreground,
|
|
1268
|
-
border: palette.foreground,
|
|
1269
|
-
color: palette.background,
|
|
1270
|
-
ripple: palette.accents_1
|
|
1271
|
-
},
|
|
1272
|
-
success: {
|
|
1273
|
-
bg: palette.success,
|
|
1274
|
-
border: palette.success,
|
|
1275
|
-
color: '#fff',
|
|
1276
|
-
ripple: '#1f93ffff'
|
|
1277
|
-
},
|
|
1278
|
-
warning: {
|
|
1279
|
-
bg: palette.warning,
|
|
1280
|
-
border: palette.warning,
|
|
1281
|
-
color: '#fff',
|
|
1282
|
-
ripple: '#ffca29ff'
|
|
1283
|
-
},
|
|
1284
|
-
error: {
|
|
1285
|
-
bg: palette.error,
|
|
1286
|
-
border: palette.error,
|
|
1287
|
-
color: '#fff',
|
|
1288
|
-
ripple: '#ff5a55ff'
|
|
1289
|
-
},
|
|
1290
|
-
abort: {
|
|
1291
|
-
bg: 'transparent',
|
|
1292
|
-
border: 'transparent',
|
|
1293
|
-
color: palette.accents_5,
|
|
1294
|
-
ripple: palette.accents_1
|
|
1295
|
-
}
|
|
1296
|
-
};
|
|
1297
|
-
if (disabled) return {
|
|
1298
|
-
bg: palette.accents_1,
|
|
1299
|
-
border: palette.accents_2,
|
|
1300
|
-
color: '#ccc',
|
|
1301
|
-
ripple: ''
|
|
1302
|
-
};
|
|
1303
|
-
|
|
1304
|
-
/**
|
|
1305
|
-
* The '-light' type is the same color as the common type,
|
|
1306
|
-
* only hover's color is different.
|
|
1307
|
-
* e.g.
|
|
1308
|
-
* Color['success'] === Color['success-light']
|
|
1309
|
-
* Color['warning'] === Color['warning-light']
|
|
1310
|
-
*/
|
|
1311
|
-
var withoutLightType = color === null || color === void 0 ? void 0 : color.replace('-light', '');
|
|
1312
|
-
var defaultColor = colors["default"];
|
|
1313
|
-
if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
|
|
1314
|
-
return colors[withoutLightType] || defaultColor;
|
|
1315
|
-
};
|
|
1316
|
-
var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, _color) {
|
|
1317
|
-
var colors = {
|
|
1318
|
-
secondary: {
|
|
1319
|
-
bg: palette.foreground,
|
|
1320
|
-
border: palette.background,
|
|
1321
|
-
color: palette.background
|
|
1322
|
-
},
|
|
1323
|
-
success: {
|
|
1324
|
-
bg: palette.success,
|
|
1325
|
-
border: palette.background,
|
|
1326
|
-
color: 'white'
|
|
1327
|
-
},
|
|
1328
|
-
warning: {
|
|
1329
|
-
bg: palette.warning,
|
|
1330
|
-
border: palette.background,
|
|
1331
|
-
color: 'white'
|
|
1332
|
-
},
|
|
1333
|
-
error: {
|
|
1334
|
-
bg: palette.error,
|
|
1335
|
-
border: palette.background,
|
|
1336
|
-
color: 'white'
|
|
1337
|
-
}
|
|
1338
|
-
};
|
|
1339
|
-
var withoutLightType = _color === null || _color === void 0 ? void 0 : _color.replace('-light', '');
|
|
1340
|
-
return colors[withoutLightType] || null;
|
|
1341
|
-
};
|
|
1342
|
-
var getButtonHoverColors = function getButtonHoverColors(palette, props) {
|
|
1343
|
-
var color = props.color,
|
|
1344
|
-
disabled = props.disabled,
|
|
1345
|
-
loading = props.loading,
|
|
1346
|
-
shadow = props.shadow,
|
|
1347
|
-
ghost = props.ghost;
|
|
1348
|
-
var defaultColor = getButtonColors(palette, props);
|
|
1349
|
-
var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
|
|
1350
|
-
var colors = {
|
|
1351
|
-
"default": {
|
|
1352
|
-
bg: palette.background,
|
|
1353
|
-
border: palette.foreground
|
|
1354
|
-
},
|
|
1355
|
-
secondary: {
|
|
1356
|
-
bg: palette.background,
|
|
1357
|
-
border: palette.foreground
|
|
1358
|
-
},
|
|
1359
|
-
success: {
|
|
1360
|
-
bg: palette.background,
|
|
1361
|
-
border: palette.success
|
|
1362
|
-
},
|
|
1363
|
-
warning: {
|
|
1364
|
-
bg: palette.background,
|
|
1365
|
-
border: palette.warning
|
|
1366
|
-
},
|
|
1367
|
-
error: {
|
|
1368
|
-
bg: palette.background,
|
|
1369
|
-
border: palette.error
|
|
1370
|
-
},
|
|
1371
|
-
abort: {
|
|
1372
|
-
bg: 'transparent',
|
|
1373
|
-
border: 'transparent',
|
|
1374
|
-
color: palette.accents_5
|
|
1375
|
-
},
|
|
1376
|
-
'secondary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1377
|
-
bg: alphaBackground
|
|
1378
|
-
}),
|
|
1379
|
-
'success-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1380
|
-
bg: alphaBackground
|
|
1381
|
-
}),
|
|
1382
|
-
'warning-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1383
|
-
bg: alphaBackground
|
|
1384
|
-
}),
|
|
1385
|
-
'error-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1386
|
-
bg: alphaBackground
|
|
1387
|
-
})
|
|
1388
|
-
};
|
|
1389
|
-
if (disabled) return {
|
|
1390
|
-
bg: palette.accents_1,
|
|
1391
|
-
border: palette.accents_2,
|
|
1392
|
-
color: '#ccc'
|
|
1393
|
-
};
|
|
1394
|
-
if (loading) return _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1395
|
-
color: 'transparent'
|
|
1396
|
-
});
|
|
1397
|
-
if (shadow) return defaultColor;
|
|
1398
|
-
var hoverColor = (ghost ? getButtonGhostHoverColors(palette, color) : colors[color]) || colors["default"];
|
|
1399
|
-
return _objectSpread2(_objectSpread2({}, hoverColor), {}, {
|
|
1400
|
-
color: hoverColor.color || hoverColor.border
|
|
1401
|
-
});
|
|
1402
|
-
};
|
|
1403
|
-
var getButtonCursor = function getButtonCursor(disabled, loading) {
|
|
1404
|
-
if (disabled) return {
|
|
1405
|
-
cursor: 'not-allowed',
|
|
1406
|
-
events: 'auto'
|
|
1407
|
-
};
|
|
1408
|
-
if (loading) return {
|
|
1409
|
-
cursor: 'default',
|
|
1410
|
-
events: 'none'
|
|
1411
|
-
};
|
|
1412
|
-
return {
|
|
1413
|
-
cursor: 'pointer',
|
|
1414
|
-
events: 'auto'
|
|
1415
|
-
};
|
|
1416
|
-
};
|
|
1417
|
-
var getButtonDripColor = function getButtonDripColor(palette, props) {
|
|
1418
|
-
var type = props.type;
|
|
1419
|
-
var isLightHover = type ? type.endsWith('light') : false;
|
|
1420
|
-
var hoverColors = getButtonHoverColors(palette, props);
|
|
1421
|
-
return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
|
|
1422
|
-
};
|
|
1423
|
-
|
|
1424
|
-
var _excluded$5 = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "relative", "replace", "a", "to", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
|
|
1425
|
-
var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
|
|
1426
|
-
var theme$1 = theme.useTheme();
|
|
1427
|
-
// const navigate = useNavigate();
|
|
1428
|
-
var _useScale = useScale(),
|
|
1429
|
-
SCALES = _useScale.SCALES;
|
|
1430
|
-
var buttonRef = React.useRef(null);
|
|
1431
|
-
React.useImperativeHandle(ref, function () {
|
|
1432
|
-
return buttonRef.current;
|
|
1433
|
-
}); // Changed with !
|
|
1434
|
-
|
|
1435
|
-
var _useState = React.useState(false),
|
|
1436
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1437
|
-
dripShow = _useState2[0],
|
|
1438
|
-
setDripShow = _useState2[1];
|
|
1439
|
-
var _useState3 = React.useState(0),
|
|
1440
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1441
|
-
dripX = _useState4[0],
|
|
1442
|
-
setDripX = _useState4[1];
|
|
1443
|
-
var _useState5 = React.useState(0),
|
|
1444
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
1445
|
-
dripY = _useState6[0],
|
|
1446
|
-
setDripY = _useState6[1];
|
|
1447
|
-
var groupConfig = useButtonGroupContext();
|
|
1448
|
-
var filteredProps = filterPropsWithGroup(btnProps, groupConfig);
|
|
1449
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1450
|
-
var children = filteredProps.children,
|
|
1451
|
-
_filteredProps$disabl = filteredProps.disabled,
|
|
1452
|
-
disabled = _filteredProps$disabl === void 0 ? false : _filteredProps$disabl;
|
|
1453
|
-
filteredProps.color;
|
|
1454
|
-
var _filteredProps$loadin = filteredProps.loading,
|
|
1455
|
-
loading = _filteredProps$loadin === void 0 ? false : _filteredProps$loadin,
|
|
1456
|
-
_filteredProps$shadow = filteredProps.shadow,
|
|
1457
|
-
shadow = _filteredProps$shadow === void 0 ? false : _filteredProps$shadow,
|
|
1458
|
-
_filteredProps$ghost = filteredProps.ghost,
|
|
1459
|
-
ghost = _filteredProps$ghost === void 0 ? false : _filteredProps$ghost,
|
|
1460
|
-
_filteredProps$effect = filteredProps.effect,
|
|
1461
|
-
effect = _filteredProps$effect === void 0 ? true : _filteredProps$effect,
|
|
1462
|
-
_filteredProps$round = filteredProps.round,
|
|
1463
|
-
round = _filteredProps$round === void 0 ? false : _filteredProps$round;
|
|
1464
|
-
filteredProps.relative;
|
|
1465
|
-
filteredProps.replace;
|
|
1466
|
-
filteredProps.a;
|
|
1467
|
-
var to = filteredProps.to,
|
|
1468
|
-
onClick = filteredProps.onClick,
|
|
1469
|
-
_filteredProps$auto = filteredProps.auto,
|
|
1470
|
-
auto = _filteredProps$auto === void 0 ? false : _filteredProps$auto,
|
|
1471
|
-
icon = filteredProps.icon,
|
|
1472
|
-
_filteredProps$type = filteredProps.type,
|
|
1473
|
-
type = _filteredProps$type === void 0 ? 'button' : _filteredProps$type,
|
|
1474
|
-
iconRight = filteredProps.iconRight,
|
|
1475
|
-
_filteredProps$classN = filteredProps.className,
|
|
1476
|
-
className = _filteredProps$classN === void 0 ? '' : _filteredProps$classN;
|
|
1477
|
-
filteredProps.crossOrigin;
|
|
1478
|
-
var props = _objectWithoutProperties(filteredProps, _excluded$5);
|
|
1479
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
1480
|
-
|
|
1481
|
-
var _useMemo = React.useMemo(function () {
|
|
1482
|
-
return getButtonColors(theme$1.palette, filteredProps);
|
|
1483
|
-
}, [theme$1.palette, filteredProps]),
|
|
1484
|
-
bg = _useMemo.bg,
|
|
1485
|
-
border = _useMemo.border,
|
|
1486
|
-
color = _useMemo.color,
|
|
1487
|
-
rippleColor = _useMemo.ripple;
|
|
1488
|
-
var hover = React.useMemo(function () {
|
|
1489
|
-
return getButtonHoverColors(theme$1.palette, filteredProps);
|
|
1490
|
-
}, [theme$1.palette, filteredProps]);
|
|
1491
|
-
var _useMemo2 = React.useMemo(function () {
|
|
1492
|
-
return getButtonCursor(disabled, loading);
|
|
1493
|
-
}, [disabled, loading]),
|
|
1494
|
-
cursor = _useMemo2.cursor,
|
|
1495
|
-
events = _useMemo2.events;
|
|
1496
|
-
var dripColor = React.useMemo(function () {
|
|
1497
|
-
return getButtonDripColor(theme$1.palette, filteredProps);
|
|
1498
|
-
}, [theme$1.palette, filteredProps]);
|
|
1499
|
-
|
|
1500
|
-
/* istanbul ignore next */
|
|
1501
|
-
var dripCompletedHandle = function dripCompletedHandle() {
|
|
1502
|
-
setDripShow(false);
|
|
1503
|
-
setDripX(0);
|
|
1504
|
-
setDripY(0);
|
|
1505
|
-
};
|
|
1506
|
-
var createRipple = function createRipple(event) {
|
|
1507
|
-
var button = buttonRef.current;
|
|
1508
|
-
if (!button) return;
|
|
1509
|
-
var rect = button.getBoundingClientRect();
|
|
1510
|
-
var size = Math.max(rect.width, rect.height);
|
|
1511
|
-
var x = event.clientX - rect.left - size / 2;
|
|
1512
|
-
var y = event.clientY - rect.top - size / 2;
|
|
1513
|
-
var rippleCount = 1; // number of rings
|
|
1514
|
-
var rippleDelay = 500; // ms between each ripple
|
|
1515
|
-
var _loop = function _loop() {
|
|
1516
|
-
var ripple = document.createElement('span');
|
|
1517
|
-
Object.assign(ripple.style, {
|
|
1518
|
-
position: 'absolute',
|
|
1519
|
-
borderRadius: '50%',
|
|
1520
|
-
backgroundColor: rippleColor,
|
|
1521
|
-
width: "".concat(size, "px"),
|
|
1522
|
-
height: "".concat(size, "px"),
|
|
1523
|
-
left: "".concat(x, "px"),
|
|
1524
|
-
top: "".concat(y, "px"),
|
|
1525
|
-
pointerEvents: 'none',
|
|
1526
|
-
transform: 'scale(0)',
|
|
1527
|
-
opacity: '1',
|
|
1528
|
-
transition: "transform 600ms ease-out ".concat(i * rippleDelay, "ms, opacity 600ms ease-out ").concat(i * rippleDelay, "ms"),
|
|
1529
|
-
zIndex: 1
|
|
1530
|
-
});
|
|
1531
|
-
button.appendChild(ripple);
|
|
1532
|
-
|
|
1533
|
-
// Force reflow to start transition
|
|
1534
|
-
window.getComputedStyle(ripple).opacity;
|
|
1535
|
-
ripple.style.transform = 'scale(2.5)';
|
|
1536
|
-
ripple.style.opacity = '0';
|
|
1537
|
-
ripple.addEventListener('transitionend', function () {
|
|
1538
|
-
ripple.remove();
|
|
1539
|
-
});
|
|
1540
|
-
};
|
|
1541
|
-
for (var i = 0; i < rippleCount; i++) {
|
|
1542
|
-
_loop();
|
|
1543
|
-
}
|
|
1544
|
-
};
|
|
1545
|
-
var clickHandler = function clickHandler(event) {
|
|
1546
|
-
if (disabled || loading) return;
|
|
1547
|
-
var showDrip = !shadow && !ghost && effect;
|
|
1548
|
-
/* istanbul ignore next */
|
|
1549
|
-
if (showDrip && buttonRef.current) {
|
|
1550
|
-
var rect = buttonRef.current.getBoundingClientRect();
|
|
1551
|
-
setDripShow(true);
|
|
1552
|
-
setDripX(event.clientX - rect.left);
|
|
1553
|
-
setDripY(event.clientY - rect.top);
|
|
1554
|
-
}
|
|
1555
|
-
if (shadow) {
|
|
1556
|
-
createRipple(event);
|
|
1557
|
-
}
|
|
1558
|
-
onClick && onClick(event);
|
|
1559
|
-
};
|
|
1560
|
-
var childrenWithIcon = React.useMemo(function () {
|
|
1561
|
-
return getButtonChildrenWithIcon(auto, children, {
|
|
1562
|
-
icon: icon,
|
|
1563
|
-
iconRight: iconRight
|
|
1564
|
-
});
|
|
1565
|
-
}, [auto, children, icon, iconRight]);
|
|
1566
|
-
var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
|
|
1567
|
-
paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
|
|
1568
|
-
|
|
1569
|
-
// If shadow provided is string then value other default
|
|
1570
|
-
var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme$1.shadows.level.z2 : 'none';
|
|
1571
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1572
|
-
children: [to ? /*#__PURE__*/jsxRuntime.jsxs("a", _objectSpread2(_objectSpread2({
|
|
1573
|
-
href: to
|
|
1574
|
-
}, props), {}, {
|
|
1575
|
-
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) || ""),
|
|
1576
|
-
children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
|
|
1577
|
-
color: color
|
|
1578
|
-
}), childrenWithIcon]
|
|
1579
|
-
})) : /*#__PURE__*/jsxRuntime.jsxs("button", _objectSpread2(_objectSpread2({
|
|
1580
|
-
ref: buttonRef,
|
|
1581
|
-
type: type,
|
|
1582
|
-
disabled: disabled,
|
|
1583
|
-
onClick: clickHandler
|
|
1584
|
-
}, props), {}, {
|
|
1585
|
-
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) || ""),
|
|
1586
|
-
children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
|
|
1587
|
-
color: color
|
|
1588
|
-
}), childrenWithIcon, dripShow && /*#__PURE__*/jsxRuntime.jsx(ButtonDrip, {
|
|
1589
|
-
x: dripX,
|
|
1590
|
-
y: dripY,
|
|
1591
|
-
color: dripColor,
|
|
1592
|
-
onCompleted: dripCompletedHandle
|
|
1593
|
-
})]
|
|
1594
|
-
})), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
1595
|
-
id: "612376042",
|
|
1596
|
-
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'],
|
|
1597
|
-
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;}}")
|
|
1598
|
-
})]
|
|
1599
|
-
});
|
|
1600
|
-
});
|
|
1601
|
-
ButtonComponent.displayName = 'Button';
|
|
1602
|
-
var Button = withScale(ButtonComponent);
|
|
1603
|
-
|
|
1604
|
-
var CompactButton = function CompactButton(props) {
|
|
1605
|
-
// const theme = useTheme();
|
|
1606
|
-
return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
|
|
1607
|
-
scale: 2 / 3,
|
|
1608
|
-
px: 0.6
|
|
1609
|
-
}, _objectSpread2({
|
|
1610
|
-
auto: true
|
|
1611
|
-
}, props)), {}, {
|
|
1612
|
-
children: props.children
|
|
1613
|
-
}));
|
|
1614
|
-
};
|
|
1615
|
-
var IconButton = /*#__PURE__*/React.memo(CompactButton);
|
|
1616
|
-
|
|
1617
|
-
var SmallButton = function SmallButton(props) {
|
|
1618
|
-
// const theme = useTheme();
|
|
1619
|
-
return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
|
|
1620
|
-
auto: true,
|
|
1621
|
-
scale: 2 / 3,
|
|
1622
|
-
px: 0.6
|
|
1623
|
-
}, props), {}, {
|
|
1624
|
-
children: props.children
|
|
1625
|
-
}));
|
|
1626
|
-
};
|
|
1627
|
-
var SmallButton$1 = /*#__PURE__*/React.memo(SmallButton);
|
|
1628
|
-
|
|
1629
|
-
/* "use client" */
|
|
1630
|
-
|
|
1631
|
-
Button.Icon = IconButton;
|
|
1632
|
-
Button.Small = SmallButton$1;
|
|
1633
|
-
|
|
1634
|
-
var _excluded$4 = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "collapse", "children", "className", "display", "alignItems", "justify"];
|
|
989
|
+
var _excluded$4 = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "children", "className", "display", "alignItems", "justify"];
|
|
1635
990
|
var _getModifierChild = function getModifierChild(tags, children) {
|
|
1636
991
|
if (!tags.length) return children;
|
|
1637
992
|
var nextTag = tags.slice(1, tags.length);
|
|
@@ -1671,8 +1026,6 @@ var TextComponent = function TextComponent(_ref) {
|
|
|
1671
1026
|
blockquote = _ref$blockquote === void 0 ? false : _ref$blockquote,
|
|
1672
1027
|
_ref$noWrap = _ref.noWrap,
|
|
1673
1028
|
noWrap = _ref$noWrap === void 0 ? false : _ref$noWrap,
|
|
1674
|
-
_ref$collapse = _ref.collapse,
|
|
1675
|
-
collapse = _ref$collapse === void 0 ? 0 : _ref$collapse,
|
|
1676
1029
|
children = _ref.children,
|
|
1677
1030
|
_ref$className = _ref.className,
|
|
1678
1031
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
@@ -1716,10 +1069,6 @@ var TextComponent = function TextComponent(_ref) {
|
|
|
1716
1069
|
*
|
|
1717
1070
|
*/
|
|
1718
1071
|
|
|
1719
|
-
var _useState = React.useState(false),
|
|
1720
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1721
|
-
expand = _useState2[0],
|
|
1722
|
-
setExpand = _useState2[1];
|
|
1723
1072
|
var tag = React.useMemo(function () {
|
|
1724
1073
|
if (names[0]) return names[0];
|
|
1725
1074
|
if (inlineNames[0]) return inlineNames[0];
|
|
@@ -1742,26 +1091,7 @@ var TextComponent = function TextComponent(_ref) {
|
|
|
1742
1091
|
className: "".concat(className, " ").concat(noWrap ? 'no-wrap' : ''),
|
|
1743
1092
|
tag: tag
|
|
1744
1093
|
}, props), {}, {
|
|
1745
|
-
children:
|
|
1746
|
-
children: [expand ? modifers : (modifers === null || modifers === void 0 ? void 0 : modifers.toString().substring(0, collapse)) + '...', /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
1747
|
-
margin: 0,
|
|
1748
|
-
onClick: function onClick() {
|
|
1749
|
-
return setExpand(!expand);
|
|
1750
|
-
},
|
|
1751
|
-
style: {
|
|
1752
|
-
textTransform: 'lowercase'
|
|
1753
|
-
},
|
|
1754
|
-
effect: false,
|
|
1755
|
-
color: "abort",
|
|
1756
|
-
scale: 2 / 3,
|
|
1757
|
-
px: 0.2,
|
|
1758
|
-
py: 0,
|
|
1759
|
-
auto: true,
|
|
1760
|
-
children: /*#__PURE__*/jsxRuntime.jsx("b", {
|
|
1761
|
-
children: expand ? 'less' : 'more'
|
|
1762
|
-
})
|
|
1763
|
-
})]
|
|
1764
|
-
}) : modifers
|
|
1094
|
+
children: modifers
|
|
1765
1095
|
}));
|
|
1766
1096
|
};
|
|
1767
1097
|
TextComponent.displayName = 'Text';
|