@helpdice/ui 2.5.3 → 2.5.8-beta.0
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 +913 -102
- package/dist/avatar/index.js +11 -9
- package/dist/button/button.icon.d.ts +0 -1
- package/dist/button/button.small.d.ts +0 -1
- package/dist/button/index.js +7 -9
- package/dist/carousal/index.js +7 -9
- package/dist/container/index.js +7 -9
- package/dist/copy-to-clipboard/index.js +7 -9
- package/dist/index.js +3047 -2977
- package/dist/input/index.js +906 -47
- package/dist/modal/index.js +5 -5
- package/dist/pagination/index.js +6 -6
- package/dist/placeholder/index.js +16 -11
- package/dist/select/index.js +912 -14
- package/dist/select/select.d.ts +2 -0
- package/dist/table/index.js +21629 -21561
- package/dist/table/table-body.d.ts +1 -2
- package/dist/table/table.d.ts +1 -0
- package/dist/text/index.js +16 -11
- package/dist/text/text.d.ts +3 -0
- package/dist/textarea/index.js +881 -7
- package/dist/textarea/textarea.d.ts +3 -0
- package/dist/tooltip/index.d.ts +6 -1
- package/dist/tooltip/index.js +12 -0
- package/dist/tooltip/tooltip-small.d.ts +4 -0
- package/dist/user/index.js +11 -9
- package/esm/avatar/avatar.js +8 -6
- package/esm/button/button.icon.d.ts +0 -1
- package/esm/button/button.js +5 -5
- package/esm/button/button.small.d.ts +0 -1
- package/esm/button/button.small.js +2 -4
- package/esm/input/input-field.js +11 -9
- package/esm/pagination/pagination-item.js +6 -6
- package/esm/select/select.d.ts +2 -0
- package/esm/select/select.js +15 -2
- package/esm/table/table-body.d.ts +1 -2
- package/esm/table/table-body.js +16 -11
- package/esm/table/table.d.ts +1 -0
- package/esm/table/table.js +45 -25
- package/esm/text/text.d.ts +3 -0
- package/esm/text/text.js +9 -2
- package/esm/textarea/textarea.d.ts +3 -0
- package/esm/textarea/textarea.js +19 -2
- package/esm/tooltip/index.d.ts +6 -1
- package/esm/tooltip/index.js +2 -0
- package/esm/tooltip/tooltip-small.d.ts +4 -0
- package/esm/tooltip/tooltip-small.js +12 -0
- package/package.json +2 -2
package/dist/select/index.js
CHANGED
|
@@ -64,6 +64,14 @@ function _createForOfIteratorHelper(r, e) {
|
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
+
function _defineProperty(e, r, t) {
|
|
68
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
69
|
+
value: t,
|
|
70
|
+
enumerable: true,
|
|
71
|
+
configurable: true,
|
|
72
|
+
writable: true
|
|
73
|
+
}) : e[r] = t, e;
|
|
74
|
+
}
|
|
67
75
|
function _extends() {
|
|
68
76
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
69
77
|
for (var e = 1; e < arguments.length; e++) {
|
|
@@ -109,6 +117,27 @@ function _nonIterableRest() {
|
|
|
109
117
|
function _nonIterableSpread() {
|
|
110
118
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
111
119
|
}
|
|
120
|
+
function ownKeys(e, r) {
|
|
121
|
+
var t = Object.keys(e);
|
|
122
|
+
if (Object.getOwnPropertySymbols) {
|
|
123
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
124
|
+
r && (o = o.filter(function (r) {
|
|
125
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
126
|
+
})), t.push.apply(t, o);
|
|
127
|
+
}
|
|
128
|
+
return t;
|
|
129
|
+
}
|
|
130
|
+
function _objectSpread2(e) {
|
|
131
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
132
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
133
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
134
|
+
_defineProperty(e, r, t[r]);
|
|
135
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
136
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return e;
|
|
140
|
+
}
|
|
112
141
|
function _objectWithoutProperties(e, t) {
|
|
113
142
|
if (null == e) return {};
|
|
114
143
|
var o,
|
|
@@ -135,6 +164,20 @@ function _slicedToArray(r, e) {
|
|
|
135
164
|
function _toConsumableArray(r) {
|
|
136
165
|
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
137
166
|
}
|
|
167
|
+
function _toPrimitive(t, r) {
|
|
168
|
+
if ("object" != typeof t || !t) return t;
|
|
169
|
+
var e = t[Symbol.toPrimitive];
|
|
170
|
+
if (void 0 !== e) {
|
|
171
|
+
var i = e.call(t, r);
|
|
172
|
+
if ("object" != typeof i) return i;
|
|
173
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
174
|
+
}
|
|
175
|
+
return ("string" === r ? String : Number)(t);
|
|
176
|
+
}
|
|
177
|
+
function _toPropertyKey(t) {
|
|
178
|
+
var i = _toPrimitive(t, "string");
|
|
179
|
+
return "symbol" == typeof i ? i : i + "";
|
|
180
|
+
}
|
|
138
181
|
function _unsupportedIterableToArray(r, a) {
|
|
139
182
|
if (r) {
|
|
140
183
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
@@ -736,11 +779,11 @@ var SelectIcon = /*#__PURE__*/React.memo(SelectIconComponent);
|
|
|
736
779
|
|
|
737
780
|
/* "use client" */
|
|
738
781
|
|
|
739
|
-
var defaultContext$
|
|
782
|
+
var defaultContext$2 = {
|
|
740
783
|
visible: false,
|
|
741
784
|
disableAll: false
|
|
742
785
|
};
|
|
743
|
-
var SelectContext = /*#__PURE__*/React.createContext(defaultContext$
|
|
786
|
+
var SelectContext = /*#__PURE__*/React.createContext(defaultContext$2);
|
|
744
787
|
var useSelectContext = function useSelectContext() {
|
|
745
788
|
return React.useContext(SelectContext);
|
|
746
789
|
};
|
|
@@ -784,7 +827,7 @@ var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingL
|
|
|
784
827
|
var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
|
|
785
828
|
return "".concat(scale1x);
|
|
786
829
|
};
|
|
787
|
-
var defaultContext = {
|
|
830
|
+
var defaultContext$1 = {
|
|
788
831
|
getScaleProps: function getScaleProps() {
|
|
789
832
|
return undefined;
|
|
790
833
|
},
|
|
@@ -810,7 +853,7 @@ var defaultContext = {
|
|
|
810
853
|
},
|
|
811
854
|
unit: '16px'
|
|
812
855
|
};
|
|
813
|
-
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
856
|
+
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext$1);
|
|
814
857
|
var useScale = function useScale() {
|
|
815
858
|
return React.useContext(ScaleContext);
|
|
816
859
|
};
|
|
@@ -861,7 +904,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
|
|
|
861
904
|
return getAllScaleProps;
|
|
862
905
|
};
|
|
863
906
|
|
|
864
|
-
var _excluded$
|
|
907
|
+
var _excluded$a = ["children"];
|
|
865
908
|
var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
|
|
866
909
|
if (scale === 1) return scale;
|
|
867
910
|
var diff = Math.abs((scale - 1) / 2);
|
|
@@ -871,7 +914,7 @@ var withScale = function withScale(Render) {
|
|
|
871
914
|
var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
872
915
|
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;
|
|
873
916
|
var children = _ref.children,
|
|
874
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
917
|
+
props = _objectWithoutProperties(_ref, _excluded$a);
|
|
875
918
|
var _useTheme = theme.useTheme(),
|
|
876
919
|
layout = _useTheme.layout;
|
|
877
920
|
var paddingLeft = props.paddingLeft,
|
|
@@ -954,7 +997,7 @@ var withScale = function withScale(Render) {
|
|
|
954
997
|
return ScaleFC;
|
|
955
998
|
};
|
|
956
999
|
|
|
957
|
-
var _excluded$
|
|
1000
|
+
var _excluded$9 = ["xs", "sm", "md", "lg", "xl", "justify", "direction", "alignItems", "alignContent", "children", "className"];
|
|
958
1001
|
var getItemLayout = function getItemLayout(val) {
|
|
959
1002
|
var display = val === 0 ? 'display: none;' : 'display: inherit;';
|
|
960
1003
|
if (typeof val === 'number') {
|
|
@@ -992,7 +1035,7 @@ var GridBasicItem = function GridBasicItem(_ref) {
|
|
|
992
1035
|
children = _ref.children,
|
|
993
1036
|
_ref$className = _ref.className,
|
|
994
1037
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
995
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1038
|
+
props = _objectWithoutProperties(_ref, _excluded$9);
|
|
996
1039
|
var theme$1 = theme.useTheme();
|
|
997
1040
|
var _useScale = useScale(),
|
|
998
1041
|
SCALES = _useScale.SCALES;
|
|
@@ -1032,12 +1075,12 @@ var GridBasicItem = function GridBasicItem(_ref) {
|
|
|
1032
1075
|
};
|
|
1033
1076
|
GridBasicItem.displayName = 'GridBasicItem';
|
|
1034
1077
|
|
|
1035
|
-
var _excluded$
|
|
1078
|
+
var _excluded$8 = ["children", "className"];
|
|
1036
1079
|
var GridComponent = function GridComponent(_ref) {
|
|
1037
1080
|
var children = _ref.children,
|
|
1038
1081
|
_ref$className = _ref.className,
|
|
1039
1082
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1040
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1083
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
1041
1084
|
var _useScale = useScale(),
|
|
1042
1085
|
SCALES = _useScale.SCALES;
|
|
1043
1086
|
var _styles$className = {
|
|
@@ -1057,7 +1100,7 @@ var GridComponent = function GridComponent(_ref) {
|
|
|
1057
1100
|
GridComponent.displayName = 'Grid';
|
|
1058
1101
|
var Grid = withScale(GridComponent);
|
|
1059
1102
|
|
|
1060
|
-
var _excluded$
|
|
1103
|
+
var _excluded$7 = ["gap", "wrap", "children", "className"];
|
|
1061
1104
|
var GridContainerComponent = function GridContainerComponent(_ref) {
|
|
1062
1105
|
var _ref$gap = _ref.gap,
|
|
1063
1106
|
gap = _ref$gap === void 0 ? 0 : _ref$gap,
|
|
@@ -1066,7 +1109,7 @@ var GridContainerComponent = function GridContainerComponent(_ref) {
|
|
|
1066
1109
|
children = _ref.children,
|
|
1067
1110
|
_ref$className = _ref.className,
|
|
1068
1111
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1069
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1112
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
1070
1113
|
var _useScale = useScale(),
|
|
1071
1114
|
unit = _useScale.unit,
|
|
1072
1115
|
SCALES = _useScale.SCALES;
|
|
@@ -1142,6 +1185,849 @@ var SelectMultipleValue = function SelectMultipleValue(_ref) {
|
|
|
1142
1185
|
};
|
|
1143
1186
|
SelectMultipleValue.displayName = 'SelectMultipleValue';
|
|
1144
1187
|
|
|
1188
|
+
var _excluded$6 = ["children", "tag", "className", "color"];
|
|
1189
|
+
var getTypeColor = function getTypeColor(type, palette) {
|
|
1190
|
+
var colors = {
|
|
1191
|
+
"default": 'inherit',
|
|
1192
|
+
secondary: palette.secondary,
|
|
1193
|
+
success: palette.success,
|
|
1194
|
+
warning: palette.warning,
|
|
1195
|
+
error: palette.error
|
|
1196
|
+
};
|
|
1197
|
+
return colors[type] || colors["default"];
|
|
1198
|
+
};
|
|
1199
|
+
var TextChild = function TextChild(_ref) {
|
|
1200
|
+
var children = _ref.children,
|
|
1201
|
+
tag = _ref.tag,
|
|
1202
|
+
_ref$className = _ref.className,
|
|
1203
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1204
|
+
_ref$color = _ref.color,
|
|
1205
|
+
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
1206
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
1207
|
+
var Component = tag;
|
|
1208
|
+
var theme$1 = theme.useTheme();
|
|
1209
|
+
var _useScale = useScale(),
|
|
1210
|
+
SCALES = _useScale.SCALES,
|
|
1211
|
+
getScaleProps = _useScale.getScaleProps;
|
|
1212
|
+
var font = getScaleProps('font');
|
|
1213
|
+
var mx = getScaleProps(['margin', 'marginLeft', 'marginRight', 'mx', 'ml', 'mr']);
|
|
1214
|
+
var my = getScaleProps(['margin', 'marginTop', 'marginBottom', 'my', 'mt', 'mb']);
|
|
1215
|
+
var px = getScaleProps(['padding', 'paddingLeft', 'paddingRight', 'pl', 'pr', 'px']);
|
|
1216
|
+
var py = getScaleProps(['padding', 'paddingTop', 'paddingBottom', 'pt', 'pb', 'py']);
|
|
1217
|
+
var _color = React.useMemo(function () {
|
|
1218
|
+
return getTypeColor(color, theme$1.palette);
|
|
1219
|
+
}, [color, theme$1.palette]);
|
|
1220
|
+
var classNames = React.useMemo(function () {
|
|
1221
|
+
var keys = [{
|
|
1222
|
+
value: mx,
|
|
1223
|
+
className: 'mx'
|
|
1224
|
+
}, {
|
|
1225
|
+
value: my,
|
|
1226
|
+
className: 'my'
|
|
1227
|
+
}, {
|
|
1228
|
+
value: px,
|
|
1229
|
+
className: 'px'
|
|
1230
|
+
}, {
|
|
1231
|
+
value: py,
|
|
1232
|
+
className: 'py'
|
|
1233
|
+
}, {
|
|
1234
|
+
value: font,
|
|
1235
|
+
className: 'font'
|
|
1236
|
+
}];
|
|
1237
|
+
var scaleClassNames = keys.reduce(function (pre, next) {
|
|
1238
|
+
if (typeof next.value === 'undefined') return pre;
|
|
1239
|
+
return "".concat(pre, " ").concat(next.className);
|
|
1240
|
+
}, '');
|
|
1241
|
+
return "".concat(scaleClassNames, " ").concat(className).trim();
|
|
1242
|
+
}, [mx, my, px, py, font, className]);
|
|
1243
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
1244
|
+
className: _JSXStyle.dynamic([["2277774325", [tag, _color, SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.font(1, 'inherit'), SCALES.ml(0, 'revert'), SCALES.mr(0, 'revert'), SCALES.mt(0, 'revert'), SCALES.mb(0, 'revert'), SCALES.pl(0, 'revert'), SCALES.pr(0, 'revert'), SCALES.pt(0, 'revert'), SCALES.pb(0, 'revert')]]]) + " " + (props && props.className != null && props.className || classNames || "")
|
|
1245
|
+
}), children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1246
|
+
id: "2277774325",
|
|
1247
|
+
dynamic: [tag, _color, SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.font(1, 'inherit'), SCALES.ml(0, 'revert'), SCALES.mr(0, 'revert'), SCALES.mt(0, 'revert'), SCALES.mb(0, 'revert'), SCALES.pl(0, 'revert'), SCALES.pr(0, 'revert'), SCALES.pt(0, 'revert'), SCALES.pb(0, 'revert')]
|
|
1248
|
+
}, "".concat(tag, ".__jsx-style-dynamic-selector{color:").concat(_color, ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";}.font.__jsx-style-dynamic-selector{font-size:").concat(SCALES.font(1, 'inherit'), ";}.mx.__jsx-style-dynamic-selector{margin-left:").concat(SCALES.ml(0, 'revert'), ";margin-right:").concat(SCALES.mr(0, 'revert'), ";}.my.__jsx-style-dynamic-selector{margin-top:").concat(SCALES.mt(0, 'revert'), ";margin-bottom:").concat(SCALES.mb(0, 'revert'), ";}.px.__jsx-style-dynamic-selector{padding-left:").concat(SCALES.pl(0, 'revert'), ";padding-right:").concat(SCALES.pr(0, 'revert'), ";}.py.__jsx-style-dynamic-selector{padding-top:").concat(SCALES.pt(0, 'revert'), ";padding-bottom:").concat(SCALES.pb(0, 'revert'), ";}.no-wrap.__jsx-style-dynamic-selector{white-space:nowrap;}")));
|
|
1249
|
+
};
|
|
1250
|
+
TextChild.displayName = 'TextChild';
|
|
1251
|
+
|
|
1252
|
+
var ButtonDrip = function ButtonDrip(_ref) {
|
|
1253
|
+
var _ref$x = _ref.x,
|
|
1254
|
+
x = _ref$x === void 0 ? 0 : _ref$x,
|
|
1255
|
+
_ref$y = _ref.y,
|
|
1256
|
+
y = _ref$y === void 0 ? 0 : _ref$y,
|
|
1257
|
+
color = _ref.color,
|
|
1258
|
+
onCompleted = _ref.onCompleted;
|
|
1259
|
+
var dripRef = React.useRef(null);
|
|
1260
|
+
/* istanbul ignore next */
|
|
1261
|
+
var top = Number.isNaN(+y) ? 0 : y - 10;
|
|
1262
|
+
/* istanbul ignore next */
|
|
1263
|
+
var left = Number.isNaN(+x) ? 0 : x - 10;
|
|
1264
|
+
React.useEffect(function () {
|
|
1265
|
+
/* istanbul ignore next */
|
|
1266
|
+
if (!dripRef.current) return;
|
|
1267
|
+
dripRef.current.addEventListener('animationend', onCompleted);
|
|
1268
|
+
return function () {
|
|
1269
|
+
/* istanbul ignore next */
|
|
1270
|
+
if (!dripRef.current) return;
|
|
1271
|
+
dripRef.current.removeEventListener('animationend', onCompleted);
|
|
1272
|
+
};
|
|
1273
|
+
});
|
|
1274
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1275
|
+
ref: dripRef,
|
|
1276
|
+
className: "jsx-3424889537" + " " + "drip"
|
|
1277
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
1278
|
+
width: "20",
|
|
1279
|
+
height: "20",
|
|
1280
|
+
viewBox: "0 0 20 20",
|
|
1281
|
+
style: {
|
|
1282
|
+
top: top,
|
|
1283
|
+
left: left
|
|
1284
|
+
},
|
|
1285
|
+
className: "jsx-3424889537"
|
|
1286
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
1287
|
+
stroke: "none",
|
|
1288
|
+
strokeWidth: "1",
|
|
1289
|
+
fill: "none",
|
|
1290
|
+
fillRule: "evenodd",
|
|
1291
|
+
className: "jsx-3424889537"
|
|
1292
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
1293
|
+
fill: color,
|
|
1294
|
+
className: "jsx-3424889537"
|
|
1295
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
1296
|
+
width: "100%",
|
|
1297
|
+
height: "100%",
|
|
1298
|
+
rx: "10",
|
|
1299
|
+
className: "jsx-3424889537"
|
|
1300
|
+
})))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1301
|
+
id: "3424889537"
|
|
1302
|
+
}, ".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;}}"));
|
|
1303
|
+
};
|
|
1304
|
+
ButtonDrip.displayName = 'ButtonDrip';
|
|
1305
|
+
|
|
1306
|
+
var _excluded$5 = ["children", "type", "color", "className", "spaceRatio"];
|
|
1307
|
+
var getIconBgColor = function getIconBgColor(type, palette, color) {
|
|
1308
|
+
var colors = {
|
|
1309
|
+
"default": palette.accents_6,
|
|
1310
|
+
secondary: palette.secondary,
|
|
1311
|
+
success: palette.success,
|
|
1312
|
+
warning: palette.warning,
|
|
1313
|
+
error: palette.error
|
|
1314
|
+
};
|
|
1315
|
+
return color ? color : colors[type];
|
|
1316
|
+
};
|
|
1317
|
+
var LoadingComponent = function LoadingComponent(_ref) {
|
|
1318
|
+
var children = _ref.children,
|
|
1319
|
+
_ref$type = _ref.type,
|
|
1320
|
+
type = _ref$type === void 0 ? 'default' : _ref$type,
|
|
1321
|
+
color = _ref.color,
|
|
1322
|
+
_ref$className = _ref.className,
|
|
1323
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1324
|
+
_ref$spaceRatio = _ref.spaceRatio,
|
|
1325
|
+
spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
|
|
1326
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
1327
|
+
var theme$1 = theme.useTheme();
|
|
1328
|
+
var _useScale = useScale(),
|
|
1329
|
+
SCALES = _useScale.SCALES;
|
|
1330
|
+
var classes = theme.useClasses('loading-container', className);
|
|
1331
|
+
var bgColor = React.useMemo(function () {
|
|
1332
|
+
return getIconBgColor(type, theme$1.palette, color);
|
|
1333
|
+
}, [type, theme$1.palette, color]);
|
|
1334
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
1335
|
+
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 || "")
|
|
1336
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
1337
|
+
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"
|
|
1338
|
+
}, children && /*#__PURE__*/React.createElement("label", {
|
|
1339
|
+
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]]])
|
|
1340
|
+
}, children), /*#__PURE__*/React.createElement("i", {
|
|
1341
|
+
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]]])
|
|
1342
|
+
}), /*#__PURE__*/React.createElement("i", {
|
|
1343
|
+
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]]])
|
|
1344
|
+
}), /*#__PURE__*/React.createElement("i", {
|
|
1345
|
+
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]]])
|
|
1346
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1347
|
+
id: "2201634259",
|
|
1348
|
+
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]
|
|
1349
|
+
}, ".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;}}")));
|
|
1350
|
+
};
|
|
1351
|
+
LoadingComponent.displayName = 'Loading';
|
|
1352
|
+
var Loading = withScale(LoadingComponent);
|
|
1353
|
+
|
|
1354
|
+
var ButtonLoading = function ButtonLoading(_ref) {
|
|
1355
|
+
var color = _ref.color;
|
|
1356
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1357
|
+
className: "jsx-212623367" + " " + "btn-loading"
|
|
1358
|
+
}, /*#__PURE__*/React.createElement(Loading, {
|
|
1359
|
+
color: color
|
|
1360
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1361
|
+
id: "212623367"
|
|
1362
|
+
}, ".btn-loading.jsx-212623367{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;background-color:var(--helpdice-ui-button-bg);}"));
|
|
1363
|
+
};
|
|
1364
|
+
ButtonLoading.displayName = 'ButtonLoading';
|
|
1365
|
+
|
|
1366
|
+
var _excluded$4 = ["isRight", "isSingle", "children", "className"];
|
|
1367
|
+
var ButtonIcon = function ButtonIcon(_ref) {
|
|
1368
|
+
var _ref$isRight = _ref.isRight,
|
|
1369
|
+
isRight = _ref$isRight === void 0 ? false : _ref$isRight,
|
|
1370
|
+
isSingle = _ref.isSingle,
|
|
1371
|
+
children = _ref.children,
|
|
1372
|
+
_ref$className = _ref.className,
|
|
1373
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1374
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
1375
|
+
var classes = theme.useClasses('icon', {
|
|
1376
|
+
right: isRight,
|
|
1377
|
+
single: isSingle
|
|
1378
|
+
}, className);
|
|
1379
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, props, {
|
|
1380
|
+
className: "jsx-2467502931" + " " + (props && props.className != null && props.className || classes || "")
|
|
1381
|
+
}), children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1382
|
+
id: "2467502931"
|
|
1383
|
+
}, ".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;}"));
|
|
1384
|
+
};
|
|
1385
|
+
ButtonIcon.displayName = 'ButtonIcon';
|
|
1386
|
+
|
|
1387
|
+
var getButtonChildrenWithIcon = function getButtonChildrenWithIcon(auto, children, icons) {
|
|
1388
|
+
var icon = icons.icon,
|
|
1389
|
+
iconRight = icons.iconRight;
|
|
1390
|
+
var hasIcon = icon || iconRight;
|
|
1391
|
+
var isRight = Boolean(iconRight);
|
|
1392
|
+
var paddingForAutoMode = auto ? "calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding) * .5)" : 0;
|
|
1393
|
+
var classes = theme.useClasses('text', isRight ? 'right' : 'left');
|
|
1394
|
+
if (!hasIcon) return /*#__PURE__*/React.createElement("div", {
|
|
1395
|
+
className: "text"
|
|
1396
|
+
}, children);
|
|
1397
|
+
if (React.Children.count(children) === 0) {
|
|
1398
|
+
return /*#__PURE__*/React.createElement(ButtonIcon, {
|
|
1399
|
+
isRight: isRight,
|
|
1400
|
+
isSingle: true
|
|
1401
|
+
}, hasIcon);
|
|
1402
|
+
}
|
|
1403
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ButtonIcon, {
|
|
1404
|
+
isRight: isRight
|
|
1405
|
+
}, hasIcon), /*#__PURE__*/React.createElement("div", {
|
|
1406
|
+
className: _JSXStyle.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || "")
|
|
1407
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1408
|
+
id: "3568181479",
|
|
1409
|
+
dynamic: [paddingForAutoMode, paddingForAutoMode]
|
|
1410
|
+
}, ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}"))));
|
|
1411
|
+
};
|
|
1412
|
+
var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
|
|
1413
|
+
if (!config.isButtonGroup) return props;
|
|
1414
|
+
return _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1415
|
+
auto: true,
|
|
1416
|
+
shadow: false,
|
|
1417
|
+
ghost: config.ghost || props.ghost,
|
|
1418
|
+
type: config.type || props.type,
|
|
1419
|
+
disabled: config.disabled || props.disabled
|
|
1420
|
+
});
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1423
|
+
/* "use client" */
|
|
1424
|
+
|
|
1425
|
+
var defaultContext = {
|
|
1426
|
+
isButtonGroup: false,
|
|
1427
|
+
disabled: false
|
|
1428
|
+
};
|
|
1429
|
+
var ButtonGroupContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
1430
|
+
var useButtonGroupContext = function useButtonGroupContext() {
|
|
1431
|
+
return React.useContext(ButtonGroupContext);
|
|
1432
|
+
};
|
|
1433
|
+
|
|
1434
|
+
var hexToRgb = function hexToRgb(color) {
|
|
1435
|
+
var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
1436
|
+
var full = color.replace(fullReg, function (_, r, g, b) {
|
|
1437
|
+
return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
|
|
1438
|
+
});
|
|
1439
|
+
var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
|
|
1440
|
+
if (!values) {
|
|
1441
|
+
throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
|
|
1442
|
+
}
|
|
1443
|
+
return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
|
|
1444
|
+
};
|
|
1445
|
+
var colorToRgbValues = function colorToRgbValues(color) {
|
|
1446
|
+
if (color.charAt(0) === '#') return hexToRgb(color);
|
|
1447
|
+
var safeColor = color.replace(/ /g, '');
|
|
1448
|
+
var colorType = color.substr(0, 4);
|
|
1449
|
+
var regArray = safeColor.match(/\((.+)\)/);
|
|
1450
|
+
if (!colorType.startsWith('rgb') || !regArray) {
|
|
1451
|
+
console.log(color);
|
|
1452
|
+
throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
|
|
1453
|
+
}
|
|
1454
|
+
return regArray[1].split(',').map(function (str) {
|
|
1455
|
+
return Number.parseFloat(str);
|
|
1456
|
+
});
|
|
1457
|
+
};
|
|
1458
|
+
var addColorAlpha = function addColorAlpha(color, alpha) {
|
|
1459
|
+
if (!/^#|rgb|RGB/.test(color)) return color;
|
|
1460
|
+
var _colorToRgbValues = colorToRgbValues(color),
|
|
1461
|
+
_colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
|
|
1462
|
+
r = _colorToRgbValues2[0],
|
|
1463
|
+
g = _colorToRgbValues2[1],
|
|
1464
|
+
b = _colorToRgbValues2[2];
|
|
1465
|
+
var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
|
|
1466
|
+
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
|
|
1467
|
+
};
|
|
1468
|
+
|
|
1469
|
+
var getButtonGhostColors = function getButtonGhostColors(palette, _color) {
|
|
1470
|
+
var colors = {
|
|
1471
|
+
secondary: {
|
|
1472
|
+
bg: palette.background,
|
|
1473
|
+
border: palette.foreground,
|
|
1474
|
+
color: palette.foreground,
|
|
1475
|
+
ripple: ''
|
|
1476
|
+
},
|
|
1477
|
+
success: {
|
|
1478
|
+
bg: palette.background,
|
|
1479
|
+
border: palette.success,
|
|
1480
|
+
color: palette.success,
|
|
1481
|
+
ripple: ''
|
|
1482
|
+
},
|
|
1483
|
+
warning: {
|
|
1484
|
+
bg: palette.background,
|
|
1485
|
+
border: palette.warning,
|
|
1486
|
+
color: palette.warning,
|
|
1487
|
+
ripple: ''
|
|
1488
|
+
},
|
|
1489
|
+
error: {
|
|
1490
|
+
bg: palette.background,
|
|
1491
|
+
border: palette.error,
|
|
1492
|
+
color: palette.error,
|
|
1493
|
+
ripple: ''
|
|
1494
|
+
}
|
|
1495
|
+
};
|
|
1496
|
+
return colors[_color] || null;
|
|
1497
|
+
};
|
|
1498
|
+
var getButtonColors = function getButtonColors(palette, props) {
|
|
1499
|
+
var color = props.color,
|
|
1500
|
+
disabled = props.disabled,
|
|
1501
|
+
ghost = props.ghost;
|
|
1502
|
+
var colors = {
|
|
1503
|
+
"default": {
|
|
1504
|
+
bg: palette.background,
|
|
1505
|
+
border: palette.border,
|
|
1506
|
+
color: palette.accents_5,
|
|
1507
|
+
ripple: palette.accents_1
|
|
1508
|
+
},
|
|
1509
|
+
secondary: {
|
|
1510
|
+
bg: palette.foreground,
|
|
1511
|
+
border: palette.foreground,
|
|
1512
|
+
color: palette.background,
|
|
1513
|
+
ripple: palette.accents_1
|
|
1514
|
+
},
|
|
1515
|
+
success: {
|
|
1516
|
+
bg: palette.success,
|
|
1517
|
+
border: palette.success,
|
|
1518
|
+
color: '#fff',
|
|
1519
|
+
ripple: '#1f93ffff'
|
|
1520
|
+
},
|
|
1521
|
+
warning: {
|
|
1522
|
+
bg: palette.warning,
|
|
1523
|
+
border: palette.warning,
|
|
1524
|
+
color: '#fff',
|
|
1525
|
+
ripple: '#ffca29ff'
|
|
1526
|
+
},
|
|
1527
|
+
error: {
|
|
1528
|
+
bg: palette.error,
|
|
1529
|
+
border: palette.error,
|
|
1530
|
+
color: '#fff',
|
|
1531
|
+
ripple: '#ff5a55ff'
|
|
1532
|
+
},
|
|
1533
|
+
abort: {
|
|
1534
|
+
bg: 'transparent',
|
|
1535
|
+
border: 'transparent',
|
|
1536
|
+
color: palette.accents_5,
|
|
1537
|
+
ripple: palette.accents_1
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
if (disabled) return {
|
|
1541
|
+
bg: palette.accents_1,
|
|
1542
|
+
border: palette.accents_2,
|
|
1543
|
+
color: '#ccc',
|
|
1544
|
+
ripple: ''
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1547
|
+
/**
|
|
1548
|
+
* The '-light' type is the same color as the common type,
|
|
1549
|
+
* only hover's color is different.
|
|
1550
|
+
* e.g.
|
|
1551
|
+
* Color['success'] === Color['success-light']
|
|
1552
|
+
* Color['warning'] === Color['warning-light']
|
|
1553
|
+
*/
|
|
1554
|
+
var withoutLightType = color === null || color === void 0 ? void 0 : color.replace('-light', '');
|
|
1555
|
+
var defaultColor = colors["default"];
|
|
1556
|
+
if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
|
|
1557
|
+
return colors[withoutLightType] || defaultColor;
|
|
1558
|
+
};
|
|
1559
|
+
var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, _color) {
|
|
1560
|
+
var colors = {
|
|
1561
|
+
secondary: {
|
|
1562
|
+
bg: palette.foreground,
|
|
1563
|
+
border: palette.background,
|
|
1564
|
+
color: palette.background
|
|
1565
|
+
},
|
|
1566
|
+
success: {
|
|
1567
|
+
bg: palette.success,
|
|
1568
|
+
border: palette.background,
|
|
1569
|
+
color: 'white'
|
|
1570
|
+
},
|
|
1571
|
+
warning: {
|
|
1572
|
+
bg: palette.warning,
|
|
1573
|
+
border: palette.background,
|
|
1574
|
+
color: 'white'
|
|
1575
|
+
},
|
|
1576
|
+
error: {
|
|
1577
|
+
bg: palette.error,
|
|
1578
|
+
border: palette.background,
|
|
1579
|
+
color: 'white'
|
|
1580
|
+
}
|
|
1581
|
+
};
|
|
1582
|
+
var withoutLightType = _color === null || _color === void 0 ? void 0 : _color.replace('-light', '');
|
|
1583
|
+
return colors[withoutLightType] || null;
|
|
1584
|
+
};
|
|
1585
|
+
var getButtonHoverColors = function getButtonHoverColors(palette, props) {
|
|
1586
|
+
var color = props.color,
|
|
1587
|
+
disabled = props.disabled,
|
|
1588
|
+
loading = props.loading,
|
|
1589
|
+
shadow = props.shadow,
|
|
1590
|
+
ghost = props.ghost;
|
|
1591
|
+
var defaultColor = getButtonColors(palette, props);
|
|
1592
|
+
var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
|
|
1593
|
+
var colors = {
|
|
1594
|
+
"default": {
|
|
1595
|
+
bg: palette.background,
|
|
1596
|
+
border: palette.foreground
|
|
1597
|
+
},
|
|
1598
|
+
secondary: {
|
|
1599
|
+
bg: palette.background,
|
|
1600
|
+
border: palette.foreground
|
|
1601
|
+
},
|
|
1602
|
+
success: {
|
|
1603
|
+
bg: palette.background,
|
|
1604
|
+
border: palette.success
|
|
1605
|
+
},
|
|
1606
|
+
warning: {
|
|
1607
|
+
bg: palette.background,
|
|
1608
|
+
border: palette.warning
|
|
1609
|
+
},
|
|
1610
|
+
error: {
|
|
1611
|
+
bg: palette.background,
|
|
1612
|
+
border: palette.error
|
|
1613
|
+
},
|
|
1614
|
+
abort: {
|
|
1615
|
+
bg: 'transparent',
|
|
1616
|
+
border: 'transparent',
|
|
1617
|
+
color: palette.accents_5
|
|
1618
|
+
},
|
|
1619
|
+
'secondary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1620
|
+
bg: alphaBackground
|
|
1621
|
+
}),
|
|
1622
|
+
'success-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1623
|
+
bg: alphaBackground
|
|
1624
|
+
}),
|
|
1625
|
+
'warning-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1626
|
+
bg: alphaBackground
|
|
1627
|
+
}),
|
|
1628
|
+
'error-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1629
|
+
bg: alphaBackground
|
|
1630
|
+
})
|
|
1631
|
+
};
|
|
1632
|
+
if (disabled) return {
|
|
1633
|
+
bg: palette.accents_1,
|
|
1634
|
+
border: palette.accents_2,
|
|
1635
|
+
color: '#ccc'
|
|
1636
|
+
};
|
|
1637
|
+
if (loading) return _objectSpread2(_objectSpread2({}, defaultColor), {}, {
|
|
1638
|
+
color: 'transparent'
|
|
1639
|
+
});
|
|
1640
|
+
if (shadow) return defaultColor;
|
|
1641
|
+
var hoverColor = (ghost ? getButtonGhostHoverColors(palette, color) : colors[color]) || colors["default"];
|
|
1642
|
+
return _objectSpread2(_objectSpread2({}, hoverColor), {}, {
|
|
1643
|
+
color: hoverColor.color || hoverColor.border
|
|
1644
|
+
});
|
|
1645
|
+
};
|
|
1646
|
+
var getButtonCursor = function getButtonCursor(disabled, loading) {
|
|
1647
|
+
if (disabled) return {
|
|
1648
|
+
cursor: 'not-allowed',
|
|
1649
|
+
events: 'auto'
|
|
1650
|
+
};
|
|
1651
|
+
if (loading) return {
|
|
1652
|
+
cursor: 'default',
|
|
1653
|
+
events: 'none'
|
|
1654
|
+
};
|
|
1655
|
+
return {
|
|
1656
|
+
cursor: 'pointer',
|
|
1657
|
+
events: 'auto'
|
|
1658
|
+
};
|
|
1659
|
+
};
|
|
1660
|
+
var getButtonDripColor = function getButtonDripColor(palette, props) {
|
|
1661
|
+
var type = props.type;
|
|
1662
|
+
var isLightHover = type ? type.endsWith('light') : false;
|
|
1663
|
+
var hoverColors = getButtonHoverColors(palette, props);
|
|
1664
|
+
return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
|
|
1665
|
+
};
|
|
1666
|
+
|
|
1667
|
+
var _excluded$3 = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "relative", "replace", "a", "to", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
|
|
1668
|
+
var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
|
|
1669
|
+
var theme$1 = theme.useTheme();
|
|
1670
|
+
// const navigate = useNavigate();
|
|
1671
|
+
var _useScale = useScale(),
|
|
1672
|
+
SCALES = _useScale.SCALES;
|
|
1673
|
+
var buttonRef = React.useRef(null);
|
|
1674
|
+
React.useImperativeHandle(ref, function () {
|
|
1675
|
+
return buttonRef.current;
|
|
1676
|
+
}); // Changed with !
|
|
1677
|
+
|
|
1678
|
+
var _useState = React.useState(false),
|
|
1679
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1680
|
+
dripShow = _useState2[0],
|
|
1681
|
+
setDripShow = _useState2[1];
|
|
1682
|
+
var _useState3 = React.useState(0),
|
|
1683
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1684
|
+
dripX = _useState4[0],
|
|
1685
|
+
setDripX = _useState4[1];
|
|
1686
|
+
var _useState5 = React.useState(0),
|
|
1687
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
1688
|
+
dripY = _useState6[0],
|
|
1689
|
+
setDripY = _useState6[1];
|
|
1690
|
+
var groupConfig = useButtonGroupContext();
|
|
1691
|
+
var filteredProps = filterPropsWithGroup(btnProps, groupConfig);
|
|
1692
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1693
|
+
var children = filteredProps.children,
|
|
1694
|
+
_filteredProps$disabl = filteredProps.disabled,
|
|
1695
|
+
disabled = _filteredProps$disabl === void 0 ? false : _filteredProps$disabl;
|
|
1696
|
+
filteredProps.color;
|
|
1697
|
+
var _filteredProps$loadin = filteredProps.loading,
|
|
1698
|
+
loading = _filteredProps$loadin === void 0 ? false : _filteredProps$loadin,
|
|
1699
|
+
_filteredProps$shadow = filteredProps.shadow,
|
|
1700
|
+
shadow = _filteredProps$shadow === void 0 ? false : _filteredProps$shadow,
|
|
1701
|
+
_filteredProps$ghost = filteredProps.ghost,
|
|
1702
|
+
ghost = _filteredProps$ghost === void 0 ? false : _filteredProps$ghost,
|
|
1703
|
+
_filteredProps$effect = filteredProps.effect,
|
|
1704
|
+
effect = _filteredProps$effect === void 0 ? true : _filteredProps$effect,
|
|
1705
|
+
_filteredProps$round = filteredProps.round,
|
|
1706
|
+
round = _filteredProps$round === void 0 ? false : _filteredProps$round;
|
|
1707
|
+
filteredProps.relative;
|
|
1708
|
+
filteredProps.replace;
|
|
1709
|
+
filteredProps.a;
|
|
1710
|
+
var to = filteredProps.to,
|
|
1711
|
+
onClick = filteredProps.onClick,
|
|
1712
|
+
_filteredProps$auto = filteredProps.auto,
|
|
1713
|
+
auto = _filteredProps$auto === void 0 ? false : _filteredProps$auto,
|
|
1714
|
+
icon = filteredProps.icon,
|
|
1715
|
+
_filteredProps$type = filteredProps.type,
|
|
1716
|
+
type = _filteredProps$type === void 0 ? 'button' : _filteredProps$type,
|
|
1717
|
+
iconRight = filteredProps.iconRight,
|
|
1718
|
+
_filteredProps$classN = filteredProps.className,
|
|
1719
|
+
className = _filteredProps$classN === void 0 ? '' : _filteredProps$classN;
|
|
1720
|
+
filteredProps.crossOrigin;
|
|
1721
|
+
var props = _objectWithoutProperties(filteredProps, _excluded$3);
|
|
1722
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
1723
|
+
|
|
1724
|
+
var _useMemo = React.useMemo(function () {
|
|
1725
|
+
return getButtonColors(theme$1.palette, filteredProps);
|
|
1726
|
+
}, [theme$1.palette, filteredProps]),
|
|
1727
|
+
bg = _useMemo.bg,
|
|
1728
|
+
border = _useMemo.border,
|
|
1729
|
+
color = _useMemo.color,
|
|
1730
|
+
rippleColor = _useMemo.ripple;
|
|
1731
|
+
var hover = React.useMemo(function () {
|
|
1732
|
+
return getButtonHoverColors(theme$1.palette, filteredProps);
|
|
1733
|
+
}, [theme$1.palette, filteredProps]);
|
|
1734
|
+
var _useMemo2 = React.useMemo(function () {
|
|
1735
|
+
return getButtonCursor(disabled, loading);
|
|
1736
|
+
}, [disabled, loading]),
|
|
1737
|
+
cursor = _useMemo2.cursor,
|
|
1738
|
+
events = _useMemo2.events;
|
|
1739
|
+
var dripColor = React.useMemo(function () {
|
|
1740
|
+
return getButtonDripColor(theme$1.palette, filteredProps);
|
|
1741
|
+
}, [theme$1.palette, filteredProps]);
|
|
1742
|
+
|
|
1743
|
+
/* istanbul ignore next */
|
|
1744
|
+
var dripCompletedHandle = function dripCompletedHandle() {
|
|
1745
|
+
setDripShow(false);
|
|
1746
|
+
setDripX(0);
|
|
1747
|
+
setDripY(0);
|
|
1748
|
+
};
|
|
1749
|
+
var createRipple = function createRipple(event) {
|
|
1750
|
+
var button = buttonRef.current;
|
|
1751
|
+
if (!button) return;
|
|
1752
|
+
var rect = button.getBoundingClientRect();
|
|
1753
|
+
var size = Math.max(rect.width, rect.height);
|
|
1754
|
+
var x = event.clientX - rect.left - size / 2;
|
|
1755
|
+
var y = event.clientY - rect.top - size / 2;
|
|
1756
|
+
var rippleCount = 1; // number of rings
|
|
1757
|
+
var rippleDelay = 500; // ms between each ripple
|
|
1758
|
+
var _loop = function _loop() {
|
|
1759
|
+
var ripple = document.createElement('span');
|
|
1760
|
+
Object.assign(ripple.style, {
|
|
1761
|
+
position: 'absolute',
|
|
1762
|
+
borderRadius: '50%',
|
|
1763
|
+
backgroundColor: rippleColor,
|
|
1764
|
+
width: "".concat(size, "px"),
|
|
1765
|
+
height: "".concat(size, "px"),
|
|
1766
|
+
left: "".concat(x, "px"),
|
|
1767
|
+
top: "".concat(y, "px"),
|
|
1768
|
+
pointerEvents: 'none',
|
|
1769
|
+
transform: 'scale(0)',
|
|
1770
|
+
opacity: '1',
|
|
1771
|
+
transition: "transform 600ms ease-out ".concat(i * rippleDelay, "ms, opacity 600ms ease-out ").concat(i * rippleDelay, "ms"),
|
|
1772
|
+
zIndex: 1
|
|
1773
|
+
});
|
|
1774
|
+
button.appendChild(ripple);
|
|
1775
|
+
|
|
1776
|
+
// Force reflow to start transition
|
|
1777
|
+
window.getComputedStyle(ripple).opacity;
|
|
1778
|
+
ripple.style.transform = 'scale(2.5)';
|
|
1779
|
+
ripple.style.opacity = '0';
|
|
1780
|
+
ripple.addEventListener('transitionend', function () {
|
|
1781
|
+
ripple.remove();
|
|
1782
|
+
});
|
|
1783
|
+
};
|
|
1784
|
+
for (var i = 0; i < rippleCount; i++) {
|
|
1785
|
+
_loop();
|
|
1786
|
+
}
|
|
1787
|
+
};
|
|
1788
|
+
var clickHandler = function clickHandler(event) {
|
|
1789
|
+
if (disabled || loading) return;
|
|
1790
|
+
var showDrip = !shadow && !ghost && effect;
|
|
1791
|
+
/* istanbul ignore next */
|
|
1792
|
+
if (showDrip && buttonRef.current) {
|
|
1793
|
+
var rect = buttonRef.current.getBoundingClientRect();
|
|
1794
|
+
setDripShow(true);
|
|
1795
|
+
setDripX(event.clientX - rect.left);
|
|
1796
|
+
setDripY(event.clientY - rect.top);
|
|
1797
|
+
}
|
|
1798
|
+
if (shadow) {
|
|
1799
|
+
createRipple(event);
|
|
1800
|
+
}
|
|
1801
|
+
onClick && onClick(event);
|
|
1802
|
+
};
|
|
1803
|
+
var childrenWithIcon = React.useMemo(function () {
|
|
1804
|
+
return getButtonChildrenWithIcon(auto, children, {
|
|
1805
|
+
icon: icon,
|
|
1806
|
+
iconRight: iconRight
|
|
1807
|
+
});
|
|
1808
|
+
}, [auto, children, icon, iconRight]);
|
|
1809
|
+
var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
|
|
1810
|
+
paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
|
|
1811
|
+
|
|
1812
|
+
// If shadow provided is string then value other default
|
|
1813
|
+
var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme$1.shadows.level.z2 : 'none';
|
|
1814
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, to ? /*#__PURE__*/React.createElement("a", _extends({
|
|
1815
|
+
href: to
|
|
1816
|
+
}, props, {
|
|
1817
|
+
className: _JSXStyle.dynamic([["331518307", [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) || "")
|
|
1818
|
+
}), loading && /*#__PURE__*/React.createElement(ButtonLoading, {
|
|
1819
|
+
color: color
|
|
1820
|
+
}), childrenWithIcon) : /*#__PURE__*/React.createElement("button", _extends({
|
|
1821
|
+
ref: buttonRef,
|
|
1822
|
+
type: type,
|
|
1823
|
+
disabled: disabled,
|
|
1824
|
+
onClick: clickHandler
|
|
1825
|
+
}, props, {
|
|
1826
|
+
className: _JSXStyle.dynamic([["331518307", [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) || "")
|
|
1827
|
+
}), loading && /*#__PURE__*/React.createElement(ButtonLoading, {
|
|
1828
|
+
color: color
|
|
1829
|
+
}), childrenWithIcon, dripShow && /*#__PURE__*/React.createElement(ButtonDrip, {
|
|
1830
|
+
x: dripX,
|
|
1831
|
+
y: dripY,
|
|
1832
|
+
color: dripColor,
|
|
1833
|
+
onCompleted: dripCompletedHandle
|
|
1834
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1835
|
+
id: "331518307",
|
|
1836
|
+
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']
|
|
1837
|
+
}, ".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 !== 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{display:-webkit-box !important;display:-webkit-flex !important;display:-ms-flexbox !important;display:flex !important;-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;}}")));
|
|
1838
|
+
});
|
|
1839
|
+
ButtonComponent.displayName = 'Button';
|
|
1840
|
+
var Button = withScale(ButtonComponent);
|
|
1841
|
+
|
|
1842
|
+
// import { useTheme } from '@helpdice/theme';
|
|
1843
|
+
|
|
1844
|
+
var CompactButton = function CompactButton(_ref) {
|
|
1845
|
+
_ref.color;
|
|
1846
|
+
var children = _ref.children,
|
|
1847
|
+
iconRight = _ref.iconRight,
|
|
1848
|
+
icon = _ref.icon,
|
|
1849
|
+
_ref$scale = _ref.scale,
|
|
1850
|
+
scale = _ref$scale === void 0 ? 2 / 3 : _ref$scale,
|
|
1851
|
+
type = _ref.type,
|
|
1852
|
+
style = _ref.style,
|
|
1853
|
+
onClick = _ref.onClick,
|
|
1854
|
+
to = _ref.to;
|
|
1855
|
+
// const theme = useTheme();
|
|
1856
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
1857
|
+
to: to,
|
|
1858
|
+
icon: icon,
|
|
1859
|
+
style: style,
|
|
1860
|
+
type: type,
|
|
1861
|
+
onClick: onClick,
|
|
1862
|
+
auto: true,
|
|
1863
|
+
scale: scale,
|
|
1864
|
+
px: 0.6,
|
|
1865
|
+
iconRight: iconRight
|
|
1866
|
+
}, children);
|
|
1867
|
+
};
|
|
1868
|
+
var IconButton = /*#__PURE__*/React.memo(CompactButton);
|
|
1869
|
+
|
|
1870
|
+
// import { useTheme } from '@helpdice/theme';
|
|
1871
|
+
|
|
1872
|
+
var SmallButton = function SmallButton(_ref) {
|
|
1873
|
+
_ref.color;
|
|
1874
|
+
var children = _ref.children,
|
|
1875
|
+
iconRight = _ref.iconRight,
|
|
1876
|
+
icon = _ref.icon,
|
|
1877
|
+
_ref$scale = _ref.scale,
|
|
1878
|
+
scale = _ref$scale === void 0 ? 2 / 3 : _ref$scale,
|
|
1879
|
+
type = _ref.type,
|
|
1880
|
+
style = _ref.style,
|
|
1881
|
+
onClick = _ref.onClick,
|
|
1882
|
+
to = _ref.to;
|
|
1883
|
+
// const theme = useTheme();
|
|
1884
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
1885
|
+
to: to,
|
|
1886
|
+
icon: icon,
|
|
1887
|
+
style: style,
|
|
1888
|
+
type: type,
|
|
1889
|
+
onClick: onClick,
|
|
1890
|
+
auto: true,
|
|
1891
|
+
scale: scale,
|
|
1892
|
+
px: 0.6,
|
|
1893
|
+
iconRight: iconRight
|
|
1894
|
+
}, children);
|
|
1895
|
+
};
|
|
1896
|
+
var SmallButton$1 = /*#__PURE__*/React.memo(SmallButton);
|
|
1897
|
+
|
|
1898
|
+
/* "use client" */
|
|
1899
|
+
|
|
1900
|
+
Button.Icon = IconButton;
|
|
1901
|
+
Button.Small = SmallButton$1;
|
|
1902
|
+
|
|
1903
|
+
var _excluded$2 = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "collapse", "children", "className", "display", "alignItems", "justify"];
|
|
1904
|
+
var _getModifierChild = function getModifierChild(tags, children) {
|
|
1905
|
+
if (!tags.length) return children;
|
|
1906
|
+
var nextTag = tags.slice(1, tags.length);
|
|
1907
|
+
return /*#__PURE__*/React.createElement(TextChild, {
|
|
1908
|
+
tag: tags[0]
|
|
1909
|
+
}, _getModifierChild(nextTag, children));
|
|
1910
|
+
};
|
|
1911
|
+
var TextComponent = function TextComponent(_ref) {
|
|
1912
|
+
var _ref$h = _ref.h1,
|
|
1913
|
+
h1 = _ref$h === void 0 ? false : _ref$h,
|
|
1914
|
+
_ref$h2 = _ref.h2,
|
|
1915
|
+
h2 = _ref$h2 === void 0 ? false : _ref$h2,
|
|
1916
|
+
_ref$h3 = _ref.h3,
|
|
1917
|
+
h3 = _ref$h3 === void 0 ? false : _ref$h3,
|
|
1918
|
+
_ref$h4 = _ref.h4,
|
|
1919
|
+
h4 = _ref$h4 === void 0 ? false : _ref$h4,
|
|
1920
|
+
_ref$h5 = _ref.h5,
|
|
1921
|
+
h5 = _ref$h5 === void 0 ? false : _ref$h5,
|
|
1922
|
+
_ref$h6 = _ref.h6,
|
|
1923
|
+
h6 = _ref$h6 === void 0 ? false : _ref$h6,
|
|
1924
|
+
_ref$p = _ref.p,
|
|
1925
|
+
p = _ref$p === void 0 ? false : _ref$p,
|
|
1926
|
+
_ref$b = _ref.b,
|
|
1927
|
+
b = _ref$b === void 0 ? false : _ref$b,
|
|
1928
|
+
_ref$small = _ref.small,
|
|
1929
|
+
small = _ref$small === void 0 ? false : _ref$small,
|
|
1930
|
+
_ref$i = _ref.i,
|
|
1931
|
+
i = _ref$i === void 0 ? false : _ref$i,
|
|
1932
|
+
_ref$span = _ref.span,
|
|
1933
|
+
span = _ref$span === void 0 ? false : _ref$span,
|
|
1934
|
+
_ref$del = _ref.del,
|
|
1935
|
+
del = _ref$del === void 0 ? false : _ref$del,
|
|
1936
|
+
_ref$em = _ref.em,
|
|
1937
|
+
em = _ref$em === void 0 ? false : _ref$em,
|
|
1938
|
+
_ref$blockquote = _ref.blockquote,
|
|
1939
|
+
blockquote = _ref$blockquote === void 0 ? false : _ref$blockquote,
|
|
1940
|
+
_ref$noWrap = _ref.noWrap,
|
|
1941
|
+
noWrap = _ref$noWrap === void 0 ? false : _ref$noWrap,
|
|
1942
|
+
_ref$collapse = _ref.collapse,
|
|
1943
|
+
collapse = _ref$collapse === void 0 ? 0 : _ref$collapse,
|
|
1944
|
+
children = _ref.children,
|
|
1945
|
+
_ref$className = _ref.className,
|
|
1946
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1947
|
+
_ref$display = _ref.display,
|
|
1948
|
+
display = _ref$display === void 0 ? 'block' : _ref$display,
|
|
1949
|
+
alignItems = _ref.alignItems,
|
|
1950
|
+
justify = _ref.justify,
|
|
1951
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
1952
|
+
var elements = {
|
|
1953
|
+
h1: h1,
|
|
1954
|
+
h2: h2,
|
|
1955
|
+
h3: h3,
|
|
1956
|
+
h4: h4,
|
|
1957
|
+
h5: h5,
|
|
1958
|
+
h6: h6,
|
|
1959
|
+
p: p,
|
|
1960
|
+
blockquote: blockquote
|
|
1961
|
+
};
|
|
1962
|
+
var inlineElements = {
|
|
1963
|
+
span: span,
|
|
1964
|
+
small: small,
|
|
1965
|
+
b: b,
|
|
1966
|
+
em: em,
|
|
1967
|
+
i: i,
|
|
1968
|
+
del: del
|
|
1969
|
+
};
|
|
1970
|
+
var names = Object.keys(elements).filter(function (name) {
|
|
1971
|
+
return elements[name];
|
|
1972
|
+
});
|
|
1973
|
+
var inlineNames = Object.keys(inlineElements).filter(function (name) {
|
|
1974
|
+
return inlineElements[name];
|
|
1975
|
+
});
|
|
1976
|
+
|
|
1977
|
+
/**
|
|
1978
|
+
* Render element "p" only if no element is found.
|
|
1979
|
+
* If there is only one modifier, just rendered one modifier element
|
|
1980
|
+
* e.g.
|
|
1981
|
+
* <Text /> => <p />
|
|
1982
|
+
* <Text em /> => <em />
|
|
1983
|
+
* <Text p em /> => <p><em>children</em></p>
|
|
1984
|
+
*
|
|
1985
|
+
*/
|
|
1986
|
+
|
|
1987
|
+
var _useState = React.useState(false),
|
|
1988
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1989
|
+
expand = _useState2[0],
|
|
1990
|
+
setExpand = _useState2[1];
|
|
1991
|
+
var tag = React.useMemo(function () {
|
|
1992
|
+
if (names[0]) return names[0];
|
|
1993
|
+
if (inlineNames[0]) return inlineNames[0];
|
|
1994
|
+
return 'p';
|
|
1995
|
+
}, [names, inlineNames]);
|
|
1996
|
+
var renderableChildElements = inlineNames.filter(function (name) {
|
|
1997
|
+
return name !== tag;
|
|
1998
|
+
});
|
|
1999
|
+
var modifers = React.useMemo(function () {
|
|
2000
|
+
if (!renderableChildElements.length) return children;
|
|
2001
|
+
return _getModifierChild(renderableChildElements, children);
|
|
2002
|
+
}, [renderableChildElements, children]);
|
|
2003
|
+
return /*#__PURE__*/React.createElement(TextChild, _extends({
|
|
2004
|
+
style: {
|
|
2005
|
+
textAlign: props.align,
|
|
2006
|
+
display: display,
|
|
2007
|
+
alignItems: alignItems,
|
|
2008
|
+
justifyContent: justify
|
|
2009
|
+
},
|
|
2010
|
+
className: "".concat(className, " ").concat(noWrap ? 'no-wrap' : ''),
|
|
2011
|
+
tag: tag
|
|
2012
|
+
}, 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, {
|
|
2013
|
+
margin: 0,
|
|
2014
|
+
onClick: function onClick() {
|
|
2015
|
+
return setExpand(!expand);
|
|
2016
|
+
},
|
|
2017
|
+
style: {
|
|
2018
|
+
textTransform: 'lowercase'
|
|
2019
|
+
},
|
|
2020
|
+
effect: false,
|
|
2021
|
+
color: "abort",
|
|
2022
|
+
scale: 2 / 3,
|
|
2023
|
+
px: 0.2,
|
|
2024
|
+
py: 0,
|
|
2025
|
+
auto: true
|
|
2026
|
+
}, /*#__PURE__*/React.createElement("b", null, expand ? 'less' : 'more'))) : modifers);
|
|
2027
|
+
};
|
|
2028
|
+
TextComponent.displayName = 'Text';
|
|
2029
|
+
var Text = withScale(TextComponent);
|
|
2030
|
+
|
|
1145
2031
|
var getColors = function getColors(palette, status) {
|
|
1146
2032
|
var colors = {
|
|
1147
2033
|
"default": {
|
|
@@ -1210,7 +2096,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (_ref, inputRef) {
|
|
|
1210
2096
|
});
|
|
1211
2097
|
SelectInput.displayName = 'SelectInput';
|
|
1212
2098
|
|
|
1213
|
-
var _excluded$1 = ["children", "label", "type", "disabled", "initialValue", "value", "icon", "onChange", "pure", "multiple", "fullWidth", "clearable", "placeholder", "className", "dropdownClassName", "dropdownStyle", "disableMatchWidth", "getPopupContainer", "onDropdownVisibleChange"];
|
|
2099
|
+
var _excluded$1 = ["children", "label", "type", "disabled", "initialValue", "value", "icon", "onChange", "pure", "multiple", "fullWidth", "clearable", "placeholder", "className", "dropdownClassName", "dropdownStyle", "disableMatchWidth", "helperText", "error", "getPopupContainer", "onDropdownVisibleChange"];
|
|
1214
2100
|
var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
|
|
1215
2101
|
var children = _ref.children,
|
|
1216
2102
|
label = _ref.label,
|
|
@@ -1238,6 +2124,8 @@ var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
|
|
|
1238
2124
|
dropdownStyle = _ref.dropdownStyle,
|
|
1239
2125
|
_ref$disableMatchWidt = _ref.disableMatchWidth,
|
|
1240
2126
|
disableMatchWidth = _ref$disableMatchWidt === void 0 ? false : _ref$disableMatchWidt,
|
|
2127
|
+
helperText = _ref.helperText,
|
|
2128
|
+
error = _ref.error,
|
|
1241
2129
|
getPopupContainer = _ref.getPopupContainer,
|
|
1242
2130
|
_ref$onDropdownVisibl = _ref.onDropdownVisibleChange,
|
|
1243
2131
|
onDropdownVisibleChange = _ref$onDropdownVisibl === void 0 ? function () {} : _ref$onDropdownVisibl,
|
|
@@ -1406,7 +2294,17 @@ var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
|
|
|
1406
2294
|
className: _JSXStyle.dynamic([["1795507141", [disabled ? 'not-allowed' : 'pointer', border, theme$1.layout.radius, disabled ? theme$1.palette.accents_1 : theme$1.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, fullWidth ? '100%' : 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme$1.palette.border : borderActive, disabled ? theme$1.palette.accents_5 : borderActive, disabled ? theme$1.palette.accents_4 : theme$1.palette.foreground, placeholderColor, theme$1.layout.gapQuarter, visible ? '180' : '0', iconBorder]]]) + " " + "icon"
|
|
1407
2295
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
1408
2296
|
className: _JSXStyle.dynamic([["1795507141", [disabled ? 'not-allowed' : 'pointer', border, theme$1.layout.radius, disabled ? theme$1.palette.accents_1 : theme$1.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, fullWidth ? '100%' : 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme$1.palette.border : borderActive, disabled ? theme$1.palette.accents_5 : borderActive, disabled ? theme$1.palette.accents_4 : theme$1.palette.foreground, placeholderColor, theme$1.layout.gapQuarter, visible ? '180' : '0', iconBorder]]])
|
|
1409
|
-
})))), /*#__PURE__*/React.createElement(
|
|
2297
|
+
})))), helperText && /*#__PURE__*/React.createElement(Text, {
|
|
2298
|
+
font: 0.8,
|
|
2299
|
+
style: {
|
|
2300
|
+
marginTop: 0.4,
|
|
2301
|
+
marginRight: 0,
|
|
2302
|
+
marginLeft: 0,
|
|
2303
|
+
marginBottom: '0.4rem',
|
|
2304
|
+
textAlign: 'left'
|
|
2305
|
+
},
|
|
2306
|
+
color: error ? "error" : 'default'
|
|
2307
|
+
}, "\xA0", helperText), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1410
2308
|
id: "1795507141",
|
|
1411
2309
|
dynamic: [disabled ? 'not-allowed' : 'pointer', border, theme$1.layout.radius, disabled ? theme$1.palette.accents_1 : theme$1.palette.background, SCALES.font(0.875), SCALES.height(2.25), SCALES.width(1, fullWidth ? '100%' : 'initial'), SCALES.pt(0), SCALES.pr(0.334), SCALES.pb(0), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.334), SCALES.pr(0.334), SCALES.pb(0.334), SCALES.pl(0.667), disabled ? theme$1.palette.border : borderActive, disabled ? theme$1.palette.accents_5 : borderActive, disabled ? theme$1.palette.accents_4 : theme$1.palette.foreground, placeholderColor, theme$1.layout.gapQuarter, visible ? '180' : '0', iconBorder]
|
|
1412
2310
|
}, ".select.__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;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;position:relative;cursor:".concat(disabled ? 'not-allowed' : 'pointer', ";max-width:90vw;overflow:hidden;-webkit-transition:border 150ms ease-in 0s,color 200ms ease-out 0s, box-shadow 200ms ease 0s;transition:border 150ms ease-in 0s,color 200ms ease-out 0s, box-shadow 200ms ease 0s;border:1px solid ").concat(border, ";border-radius:").concat(theme$1.layout.radius, ";background-color:").concat(disabled ? theme$1.palette.accents_1 : theme$1.palette.background, ";--select-font-size:").concat(SCALES.font(0.875), ";--select-height:").concat(SCALES.height(2.25), ";min-width:11.5em;width:").concat(SCALES.width(1, fullWidth ? '100%' : 'initial'), ";height:var(--select-height);padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0.334), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0.667), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.multiple.__jsx-style-dynamic-selector{height:auto;min-height:var(--select-height);padding:").concat(SCALES.pt(0.334), " ").concat(SCALES.pr(0.334), " ").concat(SCALES.pb(0.334), " ").concat(SCALES.pl(0.667), ";}.select.active.__jsx-style-dynamic-selector,.select.__jsx-style-dynamic-selector:hover{border-color:").concat(disabled ? theme$1.palette.border : borderActive, ";}.select.active.icon.__jsx-style-dynamic-selector,.select.__jsx-style-dynamic-selector:hover .icon.__jsx-style-dynamic-selector{color:").concat(disabled ? theme$1.palette.accents_5 : borderActive, ";}.value.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex:1;-ms-flex:1;flex:1;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;line-height:1;padding:0;margin-right:1.25em;font-size:var(--select-font-size);color:").concat(disabled ? theme$1.palette.accents_4 : theme$1.palette.foreground, ";width:calc(100% - 1.25em);}.value.__jsx-style-dynamic-selector>div,.value.__jsx-style-dynamic-selector>div:hover{border-radius:0;background-color:transparent;padding:0;margin:0;color:inherit;}.placeholder.__jsx-style-dynamic-selector{color:").concat(placeholderColor, ";}.icon.__jsx-style-dynamic-selector{position:absolute;right:").concat(theme$1.layout.gapQuarter, ";font-size:var(--select-font-size);top:50%;bottom:0;-webkit-transform:translateY(-50%) rotate(").concat(visible ? '180' : '0', "deg);-ms-transform:translateY(-50%) rotate(").concat(visible ? '180' : '0', "deg);transform:translateY(-50%) rotate(").concat(visible ? '180' : '0', "deg);pointer-events:none;-webkit-transition:-webkit-transform 200ms ease;-webkit-transition:transform 200ms ease;transition:transform 200ms ease;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:").concat(iconBorder, ";}")));
|