@helpdice/ui 2.1.8 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-complete/index.js +2147 -8
- package/dist/button/index.js +2 -2
- package/dist/carousal/index.js +2 -2
- package/dist/container/box.d.ts +47 -0
- package/dist/container/index.d.ts +2 -0
- package/dist/container/index.js +952 -0
- package/dist/copy-to-clipboard/clipboard.d.ts +13 -1
- package/dist/copy-to-clipboard/index.d.ts +1 -1
- package/dist/copy-to-clipboard/index.js +142 -157
- package/dist/grid/index.d.ts +2 -3
- package/dist/grid/index.js +0 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +14693 -14649
- package/dist/input/index.d.ts +4 -0
- package/dist/input/index.js +2151 -9
- package/dist/input/phone-input/phone.d.ts +13 -0
- package/dist/modal/index.js +2 -2
- package/dist/placeholder/index.js +643 -8
- package/dist/table/index.js +3516 -1368
- package/dist/text/child.d.ts +1 -0
- package/dist/text/index.js +686 -8
- package/dist/text/text.d.ts +1 -0
- package/esm/button/button.js +2 -2
- package/esm/container/box.d.ts +47 -0
- package/esm/container/box.js +43 -0
- package/esm/container/index.d.ts +2 -0
- package/esm/container/index.js +2 -0
- package/esm/copy-to-clipboard/clipboard.d.ts +13 -1
- package/esm/copy-to-clipboard/clipboard.js +91 -0
- package/esm/copy-to-clipboard/index.d.ts +1 -1
- package/esm/copy-to-clipboard/index.js +1 -1
- package/esm/grid/index.d.ts +2 -3
- package/esm/grid/index.js +5 -3
- package/esm/index.d.ts +3 -4
- package/esm/index.js +4 -3
- package/esm/input/index.d.ts +4 -0
- package/esm/input/index.js +4 -0
- package/esm/input/phone-input/phone.d.ts +13 -0
- package/esm/input/phone-input/phone.js +166 -0
- package/esm/table/table-cell.js +2 -1
- package/esm/text/child.d.ts +1 -0
- package/esm/text/text.d.ts +1 -0
- package/esm/text/text.js +25 -3
- package/package.json +8 -15
- package/dist/currency-input/index.js +0 -862
- package/dist/phone-input/index.js +0 -2033
- package/dist/phone-input/phone.d.ts +0 -11
- package/esm/phone-input/phone.d.ts +0 -11
- package/esm/phone-input/phone.js +0 -161
- /package/dist/{currency-input → input/currency-input}/components/CurrencyInput.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/CurrencyInputProps.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/cleanValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/escapeRegExp.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/formatValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/getLocaleConfig.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/getSuffix.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/index.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/isNumber.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/padTrimValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/parseAbbrValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/removeInvalidChars.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/removeSeparators.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/repositionCursor.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/index.d.ts +0 -0
- /package/dist/{phone-input → input/phone-input}/index.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/CurrencyInput.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/CurrencyInput.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/CurrencyInputProps.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/CurrencyInputProps.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/addSeparators.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/cleanValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/cleanValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/escapeRegExp.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/escapeRegExp.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/formatValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/formatValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/getLocaleConfig.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/getLocaleConfig.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/getSuffix.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/getSuffix.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/index.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/index.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/isNumber.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/isNumber.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/padTrimValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/padTrimValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/parseAbbrValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/parseAbbrValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/removeInvalidChars.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/removeInvalidChars.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/removeSeparators.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/removeSeparators.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/repositionCursor.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/repositionCursor.js +0 -0
- /package/esm/{currency-input → input/currency-input}/index.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/index.js +0 -0
- /package/esm/{phone-input → input/phone-input}/index.d.ts +0 -0
- /package/esm/{phone-input → input/phone-input}/index.js +0 -0
package/dist/text/index.js
CHANGED
|
@@ -10,6 +10,9 @@ function _arrayLikeToArray(r, a) {
|
|
|
10
10
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
11
11
|
return n;
|
|
12
12
|
}
|
|
13
|
+
function _arrayWithHoles(r) {
|
|
14
|
+
if (Array.isArray(r)) return r;
|
|
15
|
+
}
|
|
13
16
|
function _createForOfIteratorHelper(r, e) {
|
|
14
17
|
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
15
18
|
if (!t) {
|
|
@@ -58,6 +61,14 @@ function _createForOfIteratorHelper(r, e) {
|
|
|
58
61
|
}
|
|
59
62
|
};
|
|
60
63
|
}
|
|
64
|
+
function _defineProperty(e, r, t) {
|
|
65
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
66
|
+
value: t,
|
|
67
|
+
enumerable: true,
|
|
68
|
+
configurable: true,
|
|
69
|
+
writable: true
|
|
70
|
+
}) : e[r] = t, e;
|
|
71
|
+
}
|
|
61
72
|
function _extends() {
|
|
62
73
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
63
74
|
for (var e = 1; e < arguments.length; e++) {
|
|
@@ -67,6 +78,57 @@ function _extends() {
|
|
|
67
78
|
return n;
|
|
68
79
|
}, _extends.apply(null, arguments);
|
|
69
80
|
}
|
|
81
|
+
function _iterableToArrayLimit(r, l) {
|
|
82
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
83
|
+
if (null != t) {
|
|
84
|
+
var e,
|
|
85
|
+
n,
|
|
86
|
+
i,
|
|
87
|
+
u,
|
|
88
|
+
a = [],
|
|
89
|
+
f = true,
|
|
90
|
+
o = false;
|
|
91
|
+
try {
|
|
92
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
93
|
+
if (Object(t) !== t) return;
|
|
94
|
+
f = !1;
|
|
95
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
96
|
+
} catch (r) {
|
|
97
|
+
o = true, n = r;
|
|
98
|
+
} finally {
|
|
99
|
+
try {
|
|
100
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
101
|
+
} finally {
|
|
102
|
+
if (o) throw n;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return a;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function _nonIterableRest() {
|
|
109
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
110
|
+
}
|
|
111
|
+
function ownKeys(e, r) {
|
|
112
|
+
var t = Object.keys(e);
|
|
113
|
+
if (Object.getOwnPropertySymbols) {
|
|
114
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
115
|
+
r && (o = o.filter(function (r) {
|
|
116
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
117
|
+
})), t.push.apply(t, o);
|
|
118
|
+
}
|
|
119
|
+
return t;
|
|
120
|
+
}
|
|
121
|
+
function _objectSpread2(e) {
|
|
122
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
123
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
124
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
125
|
+
_defineProperty(e, r, t[r]);
|
|
126
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
127
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return e;
|
|
131
|
+
}
|
|
70
132
|
function _objectWithoutProperties(e, t) {
|
|
71
133
|
if (null == e) return {};
|
|
72
134
|
var o,
|
|
@@ -87,6 +149,23 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
87
149
|
}
|
|
88
150
|
return t;
|
|
89
151
|
}
|
|
152
|
+
function _slicedToArray(r, e) {
|
|
153
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
154
|
+
}
|
|
155
|
+
function _toPrimitive(t, r) {
|
|
156
|
+
if ("object" != typeof t || !t) return t;
|
|
157
|
+
var e = t[Symbol.toPrimitive];
|
|
158
|
+
if (void 0 !== e) {
|
|
159
|
+
var i = e.call(t, r);
|
|
160
|
+
if ("object" != typeof i) return i;
|
|
161
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
162
|
+
}
|
|
163
|
+
return ("string" === r ? String : Number)(t);
|
|
164
|
+
}
|
|
165
|
+
function _toPropertyKey(t) {
|
|
166
|
+
var i = _toPrimitive(t, "string");
|
|
167
|
+
return "symbol" == typeof i ? i : i + "";
|
|
168
|
+
}
|
|
90
169
|
function _unsupportedIterableToArray(r, a) {
|
|
91
170
|
if (r) {
|
|
92
171
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
@@ -644,7 +723,7 @@ var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingL
|
|
|
644
723
|
var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
|
|
645
724
|
return "".concat(scale1x);
|
|
646
725
|
};
|
|
647
|
-
var defaultContext = {
|
|
726
|
+
var defaultContext$1 = {
|
|
648
727
|
getScaleProps: function getScaleProps() {
|
|
649
728
|
return undefined;
|
|
650
729
|
},
|
|
@@ -670,7 +749,7 @@ var defaultContext = {
|
|
|
670
749
|
},
|
|
671
750
|
unit: '16px'
|
|
672
751
|
};
|
|
673
|
-
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
752
|
+
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext$1);
|
|
674
753
|
var useScale = function useScale() {
|
|
675
754
|
return React.useContext(ScaleContext);
|
|
676
755
|
};
|
|
@@ -727,7 +806,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
|
|
|
727
806
|
return getAllScaleProps;
|
|
728
807
|
};
|
|
729
808
|
|
|
730
|
-
var _excluded$
|
|
809
|
+
var _excluded$5 = ["children"];
|
|
731
810
|
var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
|
|
732
811
|
if (scale === 1) return scale;
|
|
733
812
|
var diff = Math.abs((scale - 1) / 2);
|
|
@@ -737,7 +816,7 @@ var withScale = function withScale(Render) {
|
|
|
737
816
|
var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
738
817
|
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;
|
|
739
818
|
var children = _ref.children,
|
|
740
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
819
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
741
820
|
var _useTheme = theme.useTheme(),
|
|
742
821
|
layout = _useTheme.layout;
|
|
743
822
|
var paddingLeft = props.paddingLeft,
|
|
@@ -820,7 +899,7 @@ var withScale = function withScale(Render) {
|
|
|
820
899
|
return ScaleFC;
|
|
821
900
|
};
|
|
822
901
|
|
|
823
|
-
var _excluded$
|
|
902
|
+
var _excluded$4 = ["children", "tag", "className", "color"];
|
|
824
903
|
var getTypeColor = function getTypeColor(type, palette) {
|
|
825
904
|
var colors = {
|
|
826
905
|
"default": 'inherit',
|
|
@@ -838,7 +917,7 @@ var TextChild = function TextChild(_ref) {
|
|
|
838
917
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
839
918
|
_ref$color = _ref.color,
|
|
840
919
|
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
841
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
920
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
842
921
|
var Component = tag;
|
|
843
922
|
var theme$1 = theme.useTheme();
|
|
844
923
|
var _useScale = useScale(),
|
|
@@ -884,7 +963,586 @@ var TextChild = function TextChild(_ref) {
|
|
|
884
963
|
};
|
|
885
964
|
TextChild.displayName = 'TextChild';
|
|
886
965
|
|
|
887
|
-
var
|
|
966
|
+
var ButtonDrip = function ButtonDrip(_ref) {
|
|
967
|
+
var _ref$x = _ref.x,
|
|
968
|
+
x = _ref$x === void 0 ? 0 : _ref$x,
|
|
969
|
+
_ref$y = _ref.y,
|
|
970
|
+
y = _ref$y === void 0 ? 0 : _ref$y,
|
|
971
|
+
color = _ref.color,
|
|
972
|
+
onCompleted = _ref.onCompleted;
|
|
973
|
+
var dripRef = React.useRef(null);
|
|
974
|
+
/* istanbul ignore next */
|
|
975
|
+
var top = Number.isNaN(+y) ? 0 : y - 10;
|
|
976
|
+
/* istanbul ignore next */
|
|
977
|
+
var left = Number.isNaN(+x) ? 0 : x - 10;
|
|
978
|
+
React.useEffect(function () {
|
|
979
|
+
/* istanbul ignore next */
|
|
980
|
+
if (!dripRef.current) return;
|
|
981
|
+
dripRef.current.addEventListener('animationend', onCompleted);
|
|
982
|
+
return function () {
|
|
983
|
+
/* istanbul ignore next */
|
|
984
|
+
if (!dripRef.current) return;
|
|
985
|
+
dripRef.current.removeEventListener('animationend', onCompleted);
|
|
986
|
+
};
|
|
987
|
+
});
|
|
988
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
989
|
+
ref: dripRef,
|
|
990
|
+
className: "jsx-3424889537" + " " + "drip"
|
|
991
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
992
|
+
width: "20",
|
|
993
|
+
height: "20",
|
|
994
|
+
viewBox: "0 0 20 20",
|
|
995
|
+
style: {
|
|
996
|
+
top: top,
|
|
997
|
+
left: left
|
|
998
|
+
},
|
|
999
|
+
className: "jsx-3424889537"
|
|
1000
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
1001
|
+
stroke: "none",
|
|
1002
|
+
strokeWidth: "1",
|
|
1003
|
+
fill: "none",
|
|
1004
|
+
fillRule: "evenodd",
|
|
1005
|
+
className: "jsx-3424889537"
|
|
1006
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
1007
|
+
fill: color,
|
|
1008
|
+
className: "jsx-3424889537"
|
|
1009
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
1010
|
+
width: "100%",
|
|
1011
|
+
height: "100%",
|
|
1012
|
+
rx: "10",
|
|
1013
|
+
className: "jsx-3424889537"
|
|
1014
|
+
})))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1015
|
+
id: "3424889537"
|
|
1016
|
+
}, ".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;}}"));
|
|
1017
|
+
};
|
|
1018
|
+
ButtonDrip.displayName = 'ButtonDrip';
|
|
1019
|
+
|
|
1020
|
+
var _excluded$3 = ["children", "type", "color", "className", "spaceRatio"];
|
|
1021
|
+
var getIconBgColor = function getIconBgColor(type, palette, color) {
|
|
1022
|
+
var colors = {
|
|
1023
|
+
"default": palette.accents_6,
|
|
1024
|
+
secondary: palette.secondary,
|
|
1025
|
+
success: palette.success,
|
|
1026
|
+
warning: palette.warning,
|
|
1027
|
+
error: palette.error
|
|
1028
|
+
};
|
|
1029
|
+
return color ? color : colors[type];
|
|
1030
|
+
};
|
|
1031
|
+
var LoadingComponent = function LoadingComponent(_ref) {
|
|
1032
|
+
var children = _ref.children,
|
|
1033
|
+
_ref$type = _ref.type,
|
|
1034
|
+
type = _ref$type === void 0 ? 'default' : _ref$type,
|
|
1035
|
+
color = _ref.color,
|
|
1036
|
+
_ref$className = _ref.className,
|
|
1037
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1038
|
+
_ref$spaceRatio = _ref.spaceRatio,
|
|
1039
|
+
spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
|
|
1040
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
1041
|
+
var theme$1 = theme.useTheme();
|
|
1042
|
+
var _useScale = useScale(),
|
|
1043
|
+
SCALES = _useScale.SCALES;
|
|
1044
|
+
var classes = theme.useClasses('loading-container', className);
|
|
1045
|
+
var bgColor = React.useMemo(function () {
|
|
1046
|
+
return getIconBgColor(type, theme$1.palette, color);
|
|
1047
|
+
}, [type, theme$1.palette, color]);
|
|
1048
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
1049
|
+
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 || "")
|
|
1050
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
1051
|
+
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"
|
|
1052
|
+
}, children && /*#__PURE__*/React.createElement("label", {
|
|
1053
|
+
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]]])
|
|
1054
|
+
}, children), /*#__PURE__*/React.createElement("i", {
|
|
1055
|
+
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]]])
|
|
1056
|
+
}), /*#__PURE__*/React.createElement("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__*/React.createElement("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__*/React.createElement(_JSXStyle, {
|
|
1061
|
+
id: "2201634259",
|
|
1062
|
+
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]
|
|
1063
|
+
}, ".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;}}")));
|
|
1064
|
+
};
|
|
1065
|
+
LoadingComponent.displayName = 'Loading';
|
|
1066
|
+
var Loading = withScale(LoadingComponent);
|
|
1067
|
+
|
|
1068
|
+
var ButtonLoading = function ButtonLoading(_ref) {
|
|
1069
|
+
var color = _ref.color;
|
|
1070
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1071
|
+
className: "jsx-212623367" + " " + "btn-loading"
|
|
1072
|
+
}, /*#__PURE__*/React.createElement(Loading, {
|
|
1073
|
+
color: color
|
|
1074
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1075
|
+
id: "212623367"
|
|
1076
|
+
}, ".btn-loading.jsx-212623367{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;background-color:var(--helpdice-ui-button-bg);}"));
|
|
1077
|
+
};
|
|
1078
|
+
ButtonLoading.displayName = 'ButtonLoading';
|
|
1079
|
+
|
|
1080
|
+
var _excluded$2 = ["isRight", "isSingle", "children", "className"];
|
|
1081
|
+
var ButtonIcon = function ButtonIcon(_ref) {
|
|
1082
|
+
var _ref$isRight = _ref.isRight,
|
|
1083
|
+
isRight = _ref$isRight === void 0 ? false : _ref$isRight,
|
|
1084
|
+
isSingle = _ref.isSingle,
|
|
1085
|
+
children = _ref.children,
|
|
1086
|
+
_ref$className = _ref.className,
|
|
1087
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1088
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
1089
|
+
var classes = theme.useClasses('icon', {
|
|
1090
|
+
right: isRight,
|
|
1091
|
+
single: isSingle
|
|
1092
|
+
}, className);
|
|
1093
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, props, {
|
|
1094
|
+
className: "jsx-2467502931" + " " + (props && props.className != null && props.className || classes || "")
|
|
1095
|
+
}), children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1096
|
+
id: "2467502931"
|
|
1097
|
+
}, ".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;}"));
|
|
1098
|
+
};
|
|
1099
|
+
ButtonIcon.displayName = 'ButtonIcon';
|
|
1100
|
+
|
|
1101
|
+
var getButtonChildrenWithIcon = function getButtonChildrenWithIcon(auto, children, icons) {
|
|
1102
|
+
var icon = icons.icon,
|
|
1103
|
+
iconRight = icons.iconRight;
|
|
1104
|
+
var hasIcon = icon || iconRight;
|
|
1105
|
+
var isRight = Boolean(iconRight);
|
|
1106
|
+
var paddingForAutoMode = auto ? "calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding) * .5)" : 0;
|
|
1107
|
+
var classes = theme.useClasses('text', isRight ? 'right' : 'left');
|
|
1108
|
+
if (!hasIcon) return /*#__PURE__*/React.createElement("div", {
|
|
1109
|
+
className: "text"
|
|
1110
|
+
}, children);
|
|
1111
|
+
if (React.Children.count(children) === 0) {
|
|
1112
|
+
return /*#__PURE__*/React.createElement(ButtonIcon, {
|
|
1113
|
+
isRight: isRight,
|
|
1114
|
+
isSingle: true
|
|
1115
|
+
}, hasIcon);
|
|
1116
|
+
}
|
|
1117
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ButtonIcon, {
|
|
1118
|
+
isRight: isRight
|
|
1119
|
+
}, hasIcon), /*#__PURE__*/React.createElement("div", {
|
|
1120
|
+
className: _JSXStyle.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || "")
|
|
1121
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1122
|
+
id: "3568181479",
|
|
1123
|
+
dynamic: [paddingForAutoMode, paddingForAutoMode]
|
|
1124
|
+
}, ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}"))));
|
|
1125
|
+
};
|
|
1126
|
+
var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
|
|
1127
|
+
if (!config.isButtonGroup) return props;
|
|
1128
|
+
return _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1129
|
+
auto: true,
|
|
1130
|
+
shadow: false,
|
|
1131
|
+
ghost: config.ghost || props.ghost,
|
|
1132
|
+
type: config.type || props.type,
|
|
1133
|
+
disabled: config.disabled || props.disabled
|
|
1134
|
+
});
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
/* "use client" */
|
|
1138
|
+
|
|
1139
|
+
var defaultContext = {
|
|
1140
|
+
isButtonGroup: false,
|
|
1141
|
+
disabled: false
|
|
1142
|
+
};
|
|
1143
|
+
var ButtonGroupContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
1144
|
+
var useButtonGroupContext = function useButtonGroupContext() {
|
|
1145
|
+
return React.useContext(ButtonGroupContext);
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1148
|
+
var hexToRgb = function hexToRgb(color) {
|
|
1149
|
+
var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
1150
|
+
var full = color.replace(fullReg, function (_, r, g, b) {
|
|
1151
|
+
return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
|
|
1152
|
+
});
|
|
1153
|
+
var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
|
|
1154
|
+
if (!values) {
|
|
1155
|
+
throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
|
|
1156
|
+
}
|
|
1157
|
+
return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
|
|
1158
|
+
};
|
|
1159
|
+
var colorToRgbValues = function colorToRgbValues(color) {
|
|
1160
|
+
if (color.charAt(0) === '#') return hexToRgb(color);
|
|
1161
|
+
var safeColor = color.replace(/ /g, '');
|
|
1162
|
+
var colorType = color.substr(0, 4);
|
|
1163
|
+
var regArray = safeColor.match(/\((.+)\)/);
|
|
1164
|
+
if (!colorType.startsWith('rgb') || !regArray) {
|
|
1165
|
+
console.log(color);
|
|
1166
|
+
throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
|
|
1167
|
+
}
|
|
1168
|
+
return regArray[1].split(',').map(function (str) {
|
|
1169
|
+
return Number.parseFloat(str);
|
|
1170
|
+
});
|
|
1171
|
+
};
|
|
1172
|
+
var addColorAlpha = function addColorAlpha(color, alpha) {
|
|
1173
|
+
if (!/^#|rgb|RGB/.test(color)) return color;
|
|
1174
|
+
var _colorToRgbValues = colorToRgbValues(color),
|
|
1175
|
+
_colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
|
|
1176
|
+
r = _colorToRgbValues2[0],
|
|
1177
|
+
g = _colorToRgbValues2[1],
|
|
1178
|
+
b = _colorToRgbValues2[2];
|
|
1179
|
+
var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
|
|
1180
|
+
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
|
|
1181
|
+
};
|
|
1182
|
+
|
|
1183
|
+
var getButtonGhostColors = function getButtonGhostColors(palette, _color) {
|
|
1184
|
+
var colors = {
|
|
1185
|
+
secondary: {
|
|
1186
|
+
bg: palette.background,
|
|
1187
|
+
border: palette.foreground,
|
|
1188
|
+
color: palette.foreground,
|
|
1189
|
+
ripple: ''
|
|
1190
|
+
},
|
|
1191
|
+
success: {
|
|
1192
|
+
bg: palette.background,
|
|
1193
|
+
border: palette.success,
|
|
1194
|
+
color: palette.success,
|
|
1195
|
+
ripple: ''
|
|
1196
|
+
},
|
|
1197
|
+
warning: {
|
|
1198
|
+
bg: palette.background,
|
|
1199
|
+
border: palette.warning,
|
|
1200
|
+
color: palette.warning,
|
|
1201
|
+
ripple: ''
|
|
1202
|
+
},
|
|
1203
|
+
error: {
|
|
1204
|
+
bg: palette.background,
|
|
1205
|
+
border: palette.error,
|
|
1206
|
+
color: palette.error,
|
|
1207
|
+
ripple: ''
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
return colors[_color] || null;
|
|
1211
|
+
};
|
|
1212
|
+
var getButtonColors = function getButtonColors(palette, props) {
|
|
1213
|
+
var color = props.color,
|
|
1214
|
+
disabled = props.disabled,
|
|
1215
|
+
ghost = props.ghost;
|
|
1216
|
+
var colors = {
|
|
1217
|
+
"default": {
|
|
1218
|
+
bg: palette.background,
|
|
1219
|
+
border: palette.border,
|
|
1220
|
+
color: palette.accents_5,
|
|
1221
|
+
ripple: palette.accents_1
|
|
1222
|
+
},
|
|
1223
|
+
secondary: {
|
|
1224
|
+
bg: palette.foreground,
|
|
1225
|
+
border: palette.foreground,
|
|
1226
|
+
color: palette.background,
|
|
1227
|
+
ripple: palette.accents_1
|
|
1228
|
+
},
|
|
1229
|
+
success: {
|
|
1230
|
+
bg: palette.success,
|
|
1231
|
+
border: palette.success,
|
|
1232
|
+
color: '#fff',
|
|
1233
|
+
ripple: '#1f93ffff'
|
|
1234
|
+
},
|
|
1235
|
+
warning: {
|
|
1236
|
+
bg: palette.warning,
|
|
1237
|
+
border: palette.warning,
|
|
1238
|
+
color: '#fff',
|
|
1239
|
+
ripple: '#ffca29ff'
|
|
1240
|
+
},
|
|
1241
|
+
error: {
|
|
1242
|
+
bg: palette.error,
|
|
1243
|
+
border: palette.error,
|
|
1244
|
+
color: '#fff',
|
|
1245
|
+
ripple: '#ff5a55ff'
|
|
1246
|
+
},
|
|
1247
|
+
abort: {
|
|
1248
|
+
bg: 'transparent',
|
|
1249
|
+
border: 'transparent',
|
|
1250
|
+
color: palette.accents_5,
|
|
1251
|
+
ripple: palette.accents_1
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1254
|
+
if (disabled) return {
|
|
1255
|
+
bg: palette.accents_1,
|
|
1256
|
+
border: palette.accents_2,
|
|
1257
|
+
color: '#ccc',
|
|
1258
|
+
ripple: ''
|
|
1259
|
+
};
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* The '-light' type is the same color as the common type,
|
|
1263
|
+
* only hover's color is different.
|
|
1264
|
+
* e.g.
|
|
1265
|
+
* Color['success'] === Color['success-light']
|
|
1266
|
+
* Color['warning'] === Color['warning-light']
|
|
1267
|
+
*/
|
|
1268
|
+
var withoutLightType = color === null || color === void 0 ? void 0 : color.replace('-light', '');
|
|
1269
|
+
var defaultColor = colors["default"];
|
|
1270
|
+
if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
|
|
1271
|
+
return colors[withoutLightType] || defaultColor;
|
|
1272
|
+
};
|
|
1273
|
+
var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, _color) {
|
|
1274
|
+
var colors = {
|
|
1275
|
+
secondary: {
|
|
1276
|
+
bg: palette.foreground,
|
|
1277
|
+
border: palette.background,
|
|
1278
|
+
color: palette.background
|
|
1279
|
+
},
|
|
1280
|
+
success: {
|
|
1281
|
+
bg: palette.success,
|
|
1282
|
+
border: palette.background,
|
|
1283
|
+
color: 'white'
|
|
1284
|
+
},
|
|
1285
|
+
warning: {
|
|
1286
|
+
bg: palette.warning,
|
|
1287
|
+
border: palette.background,
|
|
1288
|
+
color: 'white'
|
|
1289
|
+
},
|
|
1290
|
+
error: {
|
|
1291
|
+
bg: palette.error,
|
|
1292
|
+
border: palette.background,
|
|
1293
|
+
color: 'white'
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
var withoutLightType = _color === null || _color === void 0 ? void 0 : _color.replace('-light', '');
|
|
1297
|
+
return colors[withoutLightType] || null;
|
|
1298
|
+
};
|
|
1299
|
+
var getButtonHoverColors = function getButtonHoverColors(palette, props) {
|
|
1300
|
+
var color = props.color,
|
|
1301
|
+
disabled = props.disabled,
|
|
1302
|
+
loading = props.loading,
|
|
1303
|
+
shadow = props.shadow,
|
|
1304
|
+
ghost = props.ghost;
|
|
1305
|
+
var defaultColor = getButtonColors(palette, props);
|
|
1306
|
+
var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
|
|
1307
|
+
var colors = {
|
|
1308
|
+
"default": {
|
|
1309
|
+
bg: palette.background,
|
|
1310
|
+
border: palette.foreground
|
|
1311
|
+
},
|
|
1312
|
+
secondary: {
|
|
1313
|
+
bg: palette.background,
|
|
1314
|
+
border: palette.foreground
|
|
1315
|
+
},
|
|
1316
|
+
success: {
|
|
1317
|
+
bg: palette.background,
|
|
1318
|
+
border: palette.success
|
|
1319
|
+
},
|
|
1320
|
+
warning: {
|
|
1321
|
+
bg: palette.background,
|
|
1322
|
+
border: palette.warning
|
|
1323
|
+
},
|
|
1324
|
+
error: {
|
|
1325
|
+
bg: palette.background,
|
|
1326
|
+
border: palette.error
|
|
1327
|
+
},
|
|
1328
|
+
abort: {
|
|
1329
|
+
bg: 'transparent',
|
|
1330
|
+
border: 'transparent',
|
|
1331
|
+
color: palette.accents_5
|
|
1332
|
+
},
|
|
1333
|
+
'secondary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1334
|
+
bg: alphaBackground
|
|
1335
|
+
}),
|
|
1336
|
+
'success-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1337
|
+
bg: alphaBackground
|
|
1338
|
+
}),
|
|
1339
|
+
'warning-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1340
|
+
bg: alphaBackground
|
|
1341
|
+
}),
|
|
1342
|
+
'error-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1343
|
+
bg: alphaBackground
|
|
1344
|
+
})
|
|
1345
|
+
};
|
|
1346
|
+
if (disabled) return {
|
|
1347
|
+
bg: palette.accents_1,
|
|
1348
|
+
border: palette.accents_2,
|
|
1349
|
+
color: '#ccc'
|
|
1350
|
+
};
|
|
1351
|
+
if (loading) return _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1352
|
+
color: 'transparent'
|
|
1353
|
+
});
|
|
1354
|
+
if (shadow) return defaultColor;
|
|
1355
|
+
var hoverColor = (ghost ? getButtonGhostHoverColors(palette, color) : colors[color]) || colors["default"];
|
|
1356
|
+
return _objectSpread2(_objectSpread2({}, hoverColor), {}, {
|
|
1357
|
+
color: hoverColor.color || hoverColor.border
|
|
1358
|
+
});
|
|
1359
|
+
};
|
|
1360
|
+
var getButtonCursor = function getButtonCursor(disabled, loading) {
|
|
1361
|
+
if (disabled) return {
|
|
1362
|
+
cursor: 'not-allowed',
|
|
1363
|
+
events: 'auto'
|
|
1364
|
+
};
|
|
1365
|
+
if (loading) return {
|
|
1366
|
+
cursor: 'default',
|
|
1367
|
+
events: 'none'
|
|
1368
|
+
};
|
|
1369
|
+
return {
|
|
1370
|
+
cursor: 'pointer',
|
|
1371
|
+
events: 'auto'
|
|
1372
|
+
};
|
|
1373
|
+
};
|
|
1374
|
+
var getButtonDripColor = function getButtonDripColor(palette, props) {
|
|
1375
|
+
var type = props.type;
|
|
1376
|
+
var isLightHover = type ? type.endsWith('light') : false;
|
|
1377
|
+
var hoverColors = getButtonHoverColors(palette, props);
|
|
1378
|
+
return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
|
|
1379
|
+
};
|
|
1380
|
+
|
|
1381
|
+
var _excluded$1 = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
|
|
1382
|
+
var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
|
|
1383
|
+
var theme$1 = theme.useTheme();
|
|
1384
|
+
var _useScale = useScale(),
|
|
1385
|
+
SCALES = _useScale.SCALES;
|
|
1386
|
+
var buttonRef = React.useRef(null);
|
|
1387
|
+
React.useImperativeHandle(ref, function () {
|
|
1388
|
+
return buttonRef.current;
|
|
1389
|
+
}); // Changed with !
|
|
1390
|
+
|
|
1391
|
+
var _useState = React.useState(false),
|
|
1392
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1393
|
+
dripShow = _useState2[0],
|
|
1394
|
+
setDripShow = _useState2[1];
|
|
1395
|
+
var _useState3 = React.useState(0),
|
|
1396
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1397
|
+
dripX = _useState4[0],
|
|
1398
|
+
setDripX = _useState4[1];
|
|
1399
|
+
var _useState5 = React.useState(0),
|
|
1400
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
1401
|
+
dripY = _useState6[0],
|
|
1402
|
+
setDripY = _useState6[1];
|
|
1403
|
+
var groupConfig = useButtonGroupContext();
|
|
1404
|
+
var filteredProps = filterPropsWithGroup(btnProps, groupConfig);
|
|
1405
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1406
|
+
var children = filteredProps.children,
|
|
1407
|
+
_filteredProps$disabl = filteredProps.disabled,
|
|
1408
|
+
disabled = _filteredProps$disabl === void 0 ? false : _filteredProps$disabl;
|
|
1409
|
+
filteredProps.color;
|
|
1410
|
+
var _filteredProps$loadin = filteredProps.loading,
|
|
1411
|
+
loading = _filteredProps$loadin === void 0 ? false : _filteredProps$loadin,
|
|
1412
|
+
_filteredProps$shadow = filteredProps.shadow,
|
|
1413
|
+
shadow = _filteredProps$shadow === void 0 ? false : _filteredProps$shadow,
|
|
1414
|
+
_filteredProps$ghost = filteredProps.ghost,
|
|
1415
|
+
ghost = _filteredProps$ghost === void 0 ? false : _filteredProps$ghost,
|
|
1416
|
+
_filteredProps$effect = filteredProps.effect,
|
|
1417
|
+
effect = _filteredProps$effect === void 0 ? true : _filteredProps$effect,
|
|
1418
|
+
_filteredProps$round = filteredProps.round,
|
|
1419
|
+
round = _filteredProps$round === void 0 ? false : _filteredProps$round,
|
|
1420
|
+
onClick = filteredProps.onClick,
|
|
1421
|
+
_filteredProps$auto = filteredProps.auto,
|
|
1422
|
+
auto = _filteredProps$auto === void 0 ? false : _filteredProps$auto,
|
|
1423
|
+
icon = filteredProps.icon,
|
|
1424
|
+
_filteredProps$type = filteredProps.type,
|
|
1425
|
+
type = _filteredProps$type === void 0 ? 'button' : _filteredProps$type,
|
|
1426
|
+
iconRight = filteredProps.iconRight,
|
|
1427
|
+
_filteredProps$classN = filteredProps.className,
|
|
1428
|
+
className = _filteredProps$classN === void 0 ? '' : _filteredProps$classN;
|
|
1429
|
+
filteredProps.crossOrigin;
|
|
1430
|
+
var props = _objectWithoutProperties(filteredProps, _excluded$1);
|
|
1431
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
1432
|
+
|
|
1433
|
+
var _useMemo = React.useMemo(function () {
|
|
1434
|
+
return getButtonColors(theme$1.palette, filteredProps);
|
|
1435
|
+
}, [theme$1.palette, filteredProps]),
|
|
1436
|
+
bg = _useMemo.bg,
|
|
1437
|
+
border = _useMemo.border,
|
|
1438
|
+
color = _useMemo.color,
|
|
1439
|
+
rippleColor = _useMemo.ripple;
|
|
1440
|
+
var hover = React.useMemo(function () {
|
|
1441
|
+
return getButtonHoverColors(theme$1.palette, filteredProps);
|
|
1442
|
+
}, [theme$1.palette, filteredProps]);
|
|
1443
|
+
var _useMemo2 = React.useMemo(function () {
|
|
1444
|
+
return getButtonCursor(disabled, loading);
|
|
1445
|
+
}, [disabled, loading]),
|
|
1446
|
+
cursor = _useMemo2.cursor,
|
|
1447
|
+
events = _useMemo2.events;
|
|
1448
|
+
var dripColor = React.useMemo(function () {
|
|
1449
|
+
return getButtonDripColor(theme$1.palette, filteredProps);
|
|
1450
|
+
}, [theme$1.palette, filteredProps]);
|
|
1451
|
+
|
|
1452
|
+
/* istanbul ignore next */
|
|
1453
|
+
var dripCompletedHandle = function dripCompletedHandle() {
|
|
1454
|
+
setDripShow(false);
|
|
1455
|
+
setDripX(0);
|
|
1456
|
+
setDripY(0);
|
|
1457
|
+
};
|
|
1458
|
+
var createRipple = function createRipple(event) {
|
|
1459
|
+
var button = buttonRef.current;
|
|
1460
|
+
if (!button) return;
|
|
1461
|
+
var rect = button.getBoundingClientRect();
|
|
1462
|
+
var size = Math.max(rect.width, rect.height);
|
|
1463
|
+
var x = event.clientX - rect.left - size / 2;
|
|
1464
|
+
var y = event.clientY - rect.top - size / 2;
|
|
1465
|
+
var rippleCount = 1; // number of rings
|
|
1466
|
+
var rippleDelay = 500; // ms between each ripple
|
|
1467
|
+
var _loop = function _loop() {
|
|
1468
|
+
var ripple = document.createElement('span');
|
|
1469
|
+
Object.assign(ripple.style, {
|
|
1470
|
+
position: 'absolute',
|
|
1471
|
+
borderRadius: '50%',
|
|
1472
|
+
backgroundColor: rippleColor,
|
|
1473
|
+
width: "".concat(size, "px"),
|
|
1474
|
+
height: "".concat(size, "px"),
|
|
1475
|
+
left: "".concat(x, "px"),
|
|
1476
|
+
top: "".concat(y, "px"),
|
|
1477
|
+
pointerEvents: 'none',
|
|
1478
|
+
transform: 'scale(0)',
|
|
1479
|
+
opacity: '1',
|
|
1480
|
+
transition: "transform 600ms ease-out ".concat(i * rippleDelay, "ms, opacity 600ms ease-out ").concat(i * rippleDelay, "ms"),
|
|
1481
|
+
zIndex: 1
|
|
1482
|
+
});
|
|
1483
|
+
button.appendChild(ripple);
|
|
1484
|
+
|
|
1485
|
+
// Force reflow to start transition
|
|
1486
|
+
window.getComputedStyle(ripple).opacity;
|
|
1487
|
+
ripple.style.transform = 'scale(2.5)';
|
|
1488
|
+
ripple.style.opacity = '0';
|
|
1489
|
+
ripple.addEventListener('transitionend', function () {
|
|
1490
|
+
ripple.remove();
|
|
1491
|
+
});
|
|
1492
|
+
};
|
|
1493
|
+
for (var i = 0; i < rippleCount; i++) {
|
|
1494
|
+
_loop();
|
|
1495
|
+
}
|
|
1496
|
+
};
|
|
1497
|
+
var clickHandler = function clickHandler(event) {
|
|
1498
|
+
if (disabled || loading) return;
|
|
1499
|
+
var showDrip = !shadow && !ghost && effect;
|
|
1500
|
+
/* istanbul ignore next */
|
|
1501
|
+
if (showDrip && buttonRef.current) {
|
|
1502
|
+
var rect = buttonRef.current.getBoundingClientRect();
|
|
1503
|
+
setDripShow(true);
|
|
1504
|
+
setDripX(event.clientX - rect.left);
|
|
1505
|
+
setDripY(event.clientY - rect.top);
|
|
1506
|
+
}
|
|
1507
|
+
if (shadow) {
|
|
1508
|
+
createRipple(event);
|
|
1509
|
+
}
|
|
1510
|
+
onClick && onClick(event);
|
|
1511
|
+
};
|
|
1512
|
+
var childrenWithIcon = React.useMemo(function () {
|
|
1513
|
+
return getButtonChildrenWithIcon(auto, children, {
|
|
1514
|
+
icon: icon,
|
|
1515
|
+
iconRight: iconRight
|
|
1516
|
+
});
|
|
1517
|
+
}, [auto, children, icon, iconRight]);
|
|
1518
|
+
var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
|
|
1519
|
+
paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
|
|
1520
|
+
|
|
1521
|
+
// If shadow provided is string then value other default
|
|
1522
|
+
var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme$1.shadows.level.z2 : 'none';
|
|
1523
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
1524
|
+
ref: buttonRef,
|
|
1525
|
+
type: type,
|
|
1526
|
+
disabled: disabled,
|
|
1527
|
+
onClick: clickHandler
|
|
1528
|
+
}, props, {
|
|
1529
|
+
className: _JSXStyle.dynamic([["905110486", [SCALES.height(2.5), round ? '50%' : theme$1.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor, events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px']]]) + " " + (props && props.className != null && props.className || theme.useClasses('btn', className) || "")
|
|
1530
|
+
}), loading && /*#__PURE__*/React.createElement(ButtonLoading, {
|
|
1531
|
+
color: color
|
|
1532
|
+
}), childrenWithIcon, dripShow && /*#__PURE__*/React.createElement(ButtonDrip, {
|
|
1533
|
+
x: dripX,
|
|
1534
|
+
y: dripY,
|
|
1535
|
+
color: dripColor,
|
|
1536
|
+
onCompleted: dripCompletedHandle
|
|
1537
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1538
|
+
id: "905110486",
|
|
1539
|
+
dynamic: [SCALES.height(2.5), round ? '50%' : theme$1.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor, events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px']
|
|
1540
|
+
}, ".btn.__jsx-style-dynamic-selector{box-sizing:border-box;display:inline-block;line-height:".concat(SCALES.height(2.5), ";border-radius:").concat(round ? '50%' : theme$1.layout.radius, ";font-weight:400;font-size:").concat(SCALES.font(0.875), ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;text-transform:capitalize;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;white-space:nowrap;-webkit-transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;position:relative;overflow:hidden;color:").concat(color, ";background-color:").concat(bg, ";border:1px solid ").concat(shadow ? 'transparent' : border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(shadow ? btnShadow : 'none', ";--helpdice-ui-button-icon-padding:").concat(SCALES.pl(0.727), ";--helpdice-ui-button-height:").concat(SCALES.height(2.5), ";--helpdice-ui-button-color:").concat(color, ";--helpdice-ui-button-bg:").concat(bg, ";min-width:").concat(auto ? 'min-content' : SCALES.width(10.5), ";width:").concat(auto ? 'auto' : 'initial', ";height:").concat(SCALES.height(2.5), ";padding:").concat(SCALES.pt(0), " ").concat(paddingRight, " ").concat(SCALES.pb(0), " ").concat(paddingLeft, ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.btn.__jsx-style-dynamic-selector:hover,.btn.__jsx-style-dynamic-selector:focus{color:").concat(hover.color, ";--helpdice-ui-button-color:").concat(hover.color, ";background-color:").concat(hover.bg, ";border-color:").concat(hover.border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(btnShadow, ";}.btn.__jsx-style-dynamic-selector .text{position:relative;z-index:1;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;text-align:center;line-height:inherit;top:-1px;}.btn.__jsx-style-dynamic-selector .text p,.btn.__jsx-style-dynamic-selector .text pre,.btn.__jsx-style-dynamic-selector .text div{margin:0;}.ripple.__jsx-style-dynamic-selector{position:absolute;border-radius:50%;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;background-color:rgba(0,0,0,0.3);pointer-events:none;z-index:1;}@-webkit-keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}@keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}")));
|
|
1541
|
+
});
|
|
1542
|
+
ButtonComponent.displayName = 'Button';
|
|
1543
|
+
var Button = withScale(ButtonComponent);
|
|
1544
|
+
|
|
1545
|
+
var _excluded = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "collapse", "children", "className"];
|
|
888
1546
|
var _getModifierChild = function getModifierChild(tags, children) {
|
|
889
1547
|
if (!tags.length) return children;
|
|
890
1548
|
var nextTag = tags.slice(1, tags.length);
|
|
@@ -923,6 +1581,8 @@ var TextComponent = function TextComponent(_ref) {
|
|
|
923
1581
|
blockquote = _ref$blockquote === void 0 ? false : _ref$blockquote,
|
|
924
1582
|
_ref$noWrap = _ref.noWrap,
|
|
925
1583
|
noWrap = _ref$noWrap === void 0 ? false : _ref$noWrap,
|
|
1584
|
+
_ref$collapse = _ref.collapse,
|
|
1585
|
+
collapse = _ref$collapse === void 0 ? 0 : _ref$collapse,
|
|
926
1586
|
children = _ref.children,
|
|
927
1587
|
_ref$className = _ref.className,
|
|
928
1588
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
@@ -962,6 +1622,10 @@ var TextComponent = function TextComponent(_ref) {
|
|
|
962
1622
|
*
|
|
963
1623
|
*/
|
|
964
1624
|
|
|
1625
|
+
var _useState = React.useState(false),
|
|
1626
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1627
|
+
expand = _useState2[0],
|
|
1628
|
+
setExpand = _useState2[1];
|
|
965
1629
|
var tag = React.useMemo(function () {
|
|
966
1630
|
if (names[0]) return names[0];
|
|
967
1631
|
if (inlineNames[0]) return inlineNames[0];
|
|
@@ -980,7 +1644,21 @@ var TextComponent = function TextComponent(_ref) {
|
|
|
980
1644
|
},
|
|
981
1645
|
className: "".concat(className, " ").concat(noWrap ? 'no-wrap' : ''),
|
|
982
1646
|
tag: tag
|
|
983
|
-
}, props), modifers)
|
|
1647
|
+
}, props), typeof children === 'string' && collapse > 50 ? /*#__PURE__*/React.createElement(React.Fragment, null, expand ? modifers : (modifers === null || modifers === void 0 ? void 0 : modifers.toString().substring(0, collapse)) + '...', /*#__PURE__*/React.createElement(Button, {
|
|
1648
|
+
margin: 0,
|
|
1649
|
+
onClick: function onClick() {
|
|
1650
|
+
return setExpand(!expand);
|
|
1651
|
+
},
|
|
1652
|
+
style: {
|
|
1653
|
+
textTransform: 'lowercase'
|
|
1654
|
+
},
|
|
1655
|
+
effect: false,
|
|
1656
|
+
color: "abort",
|
|
1657
|
+
scale: 2 / 3,
|
|
1658
|
+
px: 0.2,
|
|
1659
|
+
py: 0,
|
|
1660
|
+
auto: true
|
|
1661
|
+
}, /*#__PURE__*/React.createElement("b", null, expand ? 'less' : 'more'))) : modifers);
|
|
984
1662
|
};
|
|
985
1663
|
TextComponent.displayName = 'Text';
|
|
986
1664
|
var Text = withScale(TextComponent);
|