@helpdice/ui 1.6.6 → 1.6.8
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/button/button.compact.d.ts +2 -2
- package/dist/button/index.js +59 -59
- package/dist/index.js +1325 -1331
- package/dist/table/index.js +9 -15
- package/esm/button/button.compact.d.ts +2 -2
- package/esm/button/button.compact.js +1 -1
- package/esm/table/data-table.js +8 -12
- package/esm/table/table-cell.js +1 -3
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
2
|
type CompactButtonProps = {
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
iconRight?: React.ReactNode;
|
|
@@ -11,5 +11,5 @@ type CompactButtonProps = {
|
|
|
11
11
|
target?: string;
|
|
12
12
|
onClick?: () => void;
|
|
13
13
|
};
|
|
14
|
-
declare const _default:
|
|
14
|
+
declare const _default: React.NamedExoticComponent<CompactButtonProps>;
|
|
15
15
|
export default _default;
|
package/dist/button/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var React
|
|
5
|
+
var React = require('react');
|
|
6
6
|
|
|
7
7
|
function _arrayLikeToArray(r, a) {
|
|
8
8
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -193,11 +193,11 @@ var hasRequiredIndex;
|
|
|
193
193
|
function requireIndex () {
|
|
194
194
|
if (hasRequiredIndex) return index;
|
|
195
195
|
hasRequiredIndex = 1;
|
|
196
|
-
var React = React
|
|
196
|
+
var React$1 = React;
|
|
197
197
|
|
|
198
198
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
199
199
|
|
|
200
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
200
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React$1);
|
|
201
201
|
|
|
202
202
|
/*
|
|
203
203
|
Based on Glamor's sheet
|
|
@@ -633,15 +633,15 @@ function requireIndex () {
|
|
|
633
633
|
throw new Error("StyleSheetRegistry: " + message + ".");
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
|
-
var StyleSheetContext = /*#__PURE__*/ React.createContext(null);
|
|
636
|
+
var StyleSheetContext = /*#__PURE__*/ React$1.createContext(null);
|
|
637
637
|
StyleSheetContext.displayName = "StyleSheetContext";
|
|
638
638
|
function createStyleRegistry() {
|
|
639
639
|
return new StyleSheetRegistry();
|
|
640
640
|
}
|
|
641
641
|
function StyleRegistry(param) {
|
|
642
642
|
var configuredRegistry = param.registry, children = param.children;
|
|
643
|
-
var rootRegistry = React.useContext(StyleSheetContext);
|
|
644
|
-
var ref = React.useState(function() {
|
|
643
|
+
var rootRegistry = React$1.useContext(StyleSheetContext);
|
|
644
|
+
var ref = React$1.useState(function() {
|
|
645
645
|
return rootRegistry || configuredRegistry || createStyleRegistry();
|
|
646
646
|
}), registry = ref[0];
|
|
647
647
|
return /*#__PURE__*/ React__default["default"].createElement(StyleSheetContext.Provider, {
|
|
@@ -649,7 +649,7 @@ function requireIndex () {
|
|
|
649
649
|
}, children);
|
|
650
650
|
}
|
|
651
651
|
function useStyleRegistry() {
|
|
652
|
-
return React.useContext(StyleSheetContext);
|
|
652
|
+
return React$1.useContext(StyleSheetContext);
|
|
653
653
|
}
|
|
654
654
|
|
|
655
655
|
// Opt-into the new `useInsertionEffect` API in React 18, fallback to `useLayoutEffect`.
|
|
@@ -738,9 +738,9 @@ var defaultContext$1 = {
|
|
|
738
738
|
},
|
|
739
739
|
unit: '16px'
|
|
740
740
|
};
|
|
741
|
-
var ScaleContext = /*#__PURE__*/React
|
|
741
|
+
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext$1);
|
|
742
742
|
var useScale = function useScale() {
|
|
743
|
-
return React
|
|
743
|
+
return React.useContext(ScaleContext);
|
|
744
744
|
};
|
|
745
745
|
|
|
746
746
|
var defaultFont = {
|
|
@@ -987,9 +987,9 @@ var Themes = {
|
|
|
987
987
|
/* "use client" */
|
|
988
988
|
|
|
989
989
|
var defaultTheme = Themes.getPresetStaticTheme();
|
|
990
|
-
var ThemeContext = /*#__PURE__*/React
|
|
990
|
+
var ThemeContext = /*#__PURE__*/React.createContext(defaultTheme);
|
|
991
991
|
var useTheme = function useTheme() {
|
|
992
|
-
return React
|
|
992
|
+
return React.useContext(ThemeContext);
|
|
993
993
|
};
|
|
994
994
|
|
|
995
995
|
/* "use client" */
|
|
@@ -1051,7 +1051,7 @@ var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
|
|
|
1051
1051
|
return scale > 1 ? 1 + diff : 1 - diff;
|
|
1052
1052
|
};
|
|
1053
1053
|
var withScale = function withScale(Render) {
|
|
1054
|
-
var ScaleFC = /*#__PURE__*/React
|
|
1054
|
+
var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1055
1055
|
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31, _ref32, _ref33;
|
|
1056
1056
|
var children = _ref.children,
|
|
1057
1057
|
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
@@ -1127,9 +1127,9 @@ var withScale = function withScale(Render) {
|
|
|
1127
1127
|
getScaleProps: generateGetScaleProps(props),
|
|
1128
1128
|
getAllScaleProps: generateGetAllScaleProps(props)
|
|
1129
1129
|
};
|
|
1130
|
-
return /*#__PURE__*/React
|
|
1130
|
+
return /*#__PURE__*/React.createElement(ScaleContext.Provider, {
|
|
1131
1131
|
value: value
|
|
1132
|
-
}, /*#__PURE__*/React
|
|
1132
|
+
}, /*#__PURE__*/React.createElement(Render, _extends({}, props, {
|
|
1133
1133
|
ref: ref
|
|
1134
1134
|
}), children));
|
|
1135
1135
|
});
|
|
@@ -1144,12 +1144,12 @@ var ButtonDrip = function ButtonDrip(_ref) {
|
|
|
1144
1144
|
y = _ref$y === void 0 ? 0 : _ref$y,
|
|
1145
1145
|
color = _ref.color,
|
|
1146
1146
|
onCompleted = _ref.onCompleted;
|
|
1147
|
-
var dripRef = React
|
|
1147
|
+
var dripRef = React.useRef(null);
|
|
1148
1148
|
/* istanbul ignore next */
|
|
1149
1149
|
var top = Number.isNaN(+y) ? 0 : y - 10;
|
|
1150
1150
|
/* istanbul ignore next */
|
|
1151
1151
|
var left = Number.isNaN(+x) ? 0 : x - 10;
|
|
1152
|
-
React
|
|
1152
|
+
React.useEffect(function () {
|
|
1153
1153
|
/* istanbul ignore next */
|
|
1154
1154
|
if (!dripRef.current) return;
|
|
1155
1155
|
dripRef.current.addEventListener('animationend', onCompleted);
|
|
@@ -1159,10 +1159,10 @@ var ButtonDrip = function ButtonDrip(_ref) {
|
|
|
1159
1159
|
dripRef.current.removeEventListener('animationend', onCompleted);
|
|
1160
1160
|
};
|
|
1161
1161
|
});
|
|
1162
|
-
return /*#__PURE__*/React
|
|
1162
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1163
1163
|
ref: dripRef,
|
|
1164
1164
|
className: "jsx-3424889537" + " " + "drip"
|
|
1165
|
-
}, /*#__PURE__*/React
|
|
1165
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
1166
1166
|
width: "20",
|
|
1167
1167
|
height: "20",
|
|
1168
1168
|
viewBox: "0 0 20 20",
|
|
@@ -1171,21 +1171,21 @@ var ButtonDrip = function ButtonDrip(_ref) {
|
|
|
1171
1171
|
left: left
|
|
1172
1172
|
},
|
|
1173
1173
|
className: "jsx-3424889537"
|
|
1174
|
-
}, /*#__PURE__*/React
|
|
1174
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
1175
1175
|
stroke: "none",
|
|
1176
1176
|
strokeWidth: "1",
|
|
1177
1177
|
fill: "none",
|
|
1178
1178
|
fillRule: "evenodd",
|
|
1179
1179
|
className: "jsx-3424889537"
|
|
1180
|
-
}, /*#__PURE__*/React
|
|
1180
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
1181
1181
|
fill: color,
|
|
1182
1182
|
className: "jsx-3424889537"
|
|
1183
|
-
}, /*#__PURE__*/React
|
|
1183
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
1184
1184
|
width: "100%",
|
|
1185
1185
|
height: "100%",
|
|
1186
1186
|
rx: "10",
|
|
1187
1187
|
className: "jsx-3424889537"
|
|
1188
|
-
})))), /*#__PURE__*/React
|
|
1188
|
+
})))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1189
1189
|
id: "3424889537"
|
|
1190
1190
|
}, ".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;}}"));
|
|
1191
1191
|
};
|
|
@@ -1249,22 +1249,22 @@ var LoadingComponent = function LoadingComponent(_ref) {
|
|
|
1249
1249
|
var _useScale = useScale(),
|
|
1250
1250
|
SCALES = _useScale.SCALES;
|
|
1251
1251
|
var classes = useClasses('loading-container', className);
|
|
1252
|
-
var bgColor = React
|
|
1252
|
+
var bgColor = React.useMemo(function () {
|
|
1253
1253
|
return getIconBgColor(type, theme.palette, color);
|
|
1254
1254
|
}, [type, theme.palette, color]);
|
|
1255
|
-
return /*#__PURE__*/React
|
|
1255
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
1256
1256
|
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.palette.accents_5, bgColor, spaceRatio]]]) + " " + (props && props.className != null && props.className || classes || "")
|
|
1257
|
-
}), /*#__PURE__*/React
|
|
1257
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
1258
1258
|
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.palette.accents_5, bgColor, spaceRatio]]]) + " " + "loading"
|
|
1259
|
-
}, children && /*#__PURE__*/React
|
|
1259
|
+
}, children && /*#__PURE__*/React.createElement("label", {
|
|
1260
1260
|
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.palette.accents_5, bgColor, spaceRatio]]])
|
|
1261
|
-
}, children), /*#__PURE__*/React
|
|
1261
|
+
}, children), /*#__PURE__*/React.createElement("i", {
|
|
1262
1262
|
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.palette.accents_5, bgColor, spaceRatio]]])
|
|
1263
|
-
}), /*#__PURE__*/React
|
|
1263
|
+
}), /*#__PURE__*/React.createElement("i", {
|
|
1264
1264
|
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.palette.accents_5, bgColor, spaceRatio]]])
|
|
1265
|
-
}), /*#__PURE__*/React
|
|
1265
|
+
}), /*#__PURE__*/React.createElement("i", {
|
|
1266
1266
|
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.palette.accents_5, bgColor, spaceRatio]]])
|
|
1267
|
-
})), /*#__PURE__*/React
|
|
1267
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1268
1268
|
id: "2201634259",
|
|
1269
1269
|
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.palette.accents_5, bgColor, spaceRatio]
|
|
1270
1270
|
}, ".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.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;}}")));
|
|
@@ -1274,11 +1274,11 @@ var Loading = withScale(LoadingComponent);
|
|
|
1274
1274
|
|
|
1275
1275
|
var ButtonLoading = function ButtonLoading(_ref) {
|
|
1276
1276
|
var color = _ref.color;
|
|
1277
|
-
return /*#__PURE__*/React
|
|
1277
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1278
1278
|
className: "jsx-212623367" + " " + "btn-loading"
|
|
1279
|
-
}, /*#__PURE__*/React
|
|
1279
|
+
}, /*#__PURE__*/React.createElement(Loading, {
|
|
1280
1280
|
color: color
|
|
1281
|
-
}), /*#__PURE__*/React
|
|
1281
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1282
1282
|
id: "212623367"
|
|
1283
1283
|
}, ".btn-loading.jsx-212623367{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;background-color:var(--helpdice-ui-button-bg);}"));
|
|
1284
1284
|
};
|
|
@@ -1297,9 +1297,9 @@ var ButtonIcon = function ButtonIcon(_ref) {
|
|
|
1297
1297
|
right: isRight,
|
|
1298
1298
|
single: isSingle
|
|
1299
1299
|
}, className);
|
|
1300
|
-
return /*#__PURE__*/React
|
|
1300
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, props, {
|
|
1301
1301
|
className: "jsx-2467502931" + " " + (props && props.className != null && props.className || classes || "")
|
|
1302
|
-
}), children, /*#__PURE__*/React
|
|
1302
|
+
}), children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1303
1303
|
id: "2467502931"
|
|
1304
1304
|
}, ".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;}"));
|
|
1305
1305
|
};
|
|
@@ -1312,20 +1312,20 @@ var getButtonChildrenWithIcon = function getButtonChildrenWithIcon(auto, childre
|
|
|
1312
1312
|
var isRight = Boolean(iconRight);
|
|
1313
1313
|
var paddingForAutoMode = auto ? "calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding) * .5)" : 0;
|
|
1314
1314
|
var classes = useClasses('text', isRight ? 'right' : 'left');
|
|
1315
|
-
if (!hasIcon) return /*#__PURE__*/React
|
|
1315
|
+
if (!hasIcon) return /*#__PURE__*/React.createElement("div", {
|
|
1316
1316
|
className: "text"
|
|
1317
1317
|
}, children);
|
|
1318
|
-
if (React
|
|
1319
|
-
return /*#__PURE__*/React
|
|
1318
|
+
if (React.Children.count(children) === 0) {
|
|
1319
|
+
return /*#__PURE__*/React.createElement(ButtonIcon, {
|
|
1320
1320
|
isRight: isRight,
|
|
1321
1321
|
isSingle: true
|
|
1322
1322
|
}, hasIcon);
|
|
1323
1323
|
}
|
|
1324
|
-
return /*#__PURE__*/React
|
|
1324
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ButtonIcon, {
|
|
1325
1325
|
isRight: isRight
|
|
1326
|
-
}, hasIcon), /*#__PURE__*/React
|
|
1326
|
+
}, hasIcon), /*#__PURE__*/React.createElement("div", {
|
|
1327
1327
|
className: _JSXStyle.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || "")
|
|
1328
|
-
}, children, /*#__PURE__*/React
|
|
1328
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1329
1329
|
id: "3568181479",
|
|
1330
1330
|
dynamic: [paddingForAutoMode, paddingForAutoMode]
|
|
1331
1331
|
}, ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}"))));
|
|
@@ -1347,9 +1347,9 @@ var defaultContext = {
|
|
|
1347
1347
|
isButtonGroup: false,
|
|
1348
1348
|
disabled: false
|
|
1349
1349
|
};
|
|
1350
|
-
var ButtonGroupContext = /*#__PURE__*/React
|
|
1350
|
+
var ButtonGroupContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
1351
1351
|
var useButtonGroupContext = function useButtonGroupContext() {
|
|
1352
|
-
return React
|
|
1352
|
+
return React.useContext(ButtonGroupContext);
|
|
1353
1353
|
};
|
|
1354
1354
|
|
|
1355
1355
|
var hexToRgb = function hexToRgb(color) {
|
|
@@ -1575,23 +1575,23 @@ var getButtonDripColor = function getButtonDripColor(palette, props) {
|
|
|
1575
1575
|
};
|
|
1576
1576
|
|
|
1577
1577
|
var _excluded = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
|
|
1578
|
-
var ButtonComponent = /*#__PURE__*/React
|
|
1578
|
+
var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
|
|
1579
1579
|
var theme = useTheme();
|
|
1580
1580
|
var _useScale = useScale(),
|
|
1581
1581
|
SCALES = _useScale.SCALES;
|
|
1582
|
-
var buttonRef = React
|
|
1583
|
-
React
|
|
1582
|
+
var buttonRef = React.useRef(null);
|
|
1583
|
+
React.useImperativeHandle(ref, function () {
|
|
1584
1584
|
return buttonRef.current;
|
|
1585
1585
|
});
|
|
1586
|
-
var _useState = React
|
|
1586
|
+
var _useState = React.useState(false),
|
|
1587
1587
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1588
1588
|
dripShow = _useState2[0],
|
|
1589
1589
|
setDripShow = _useState2[1];
|
|
1590
|
-
var _useState3 = React
|
|
1590
|
+
var _useState3 = React.useState(0),
|
|
1591
1591
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
1592
1592
|
dripX = _useState4[0],
|
|
1593
1593
|
setDripX = _useState4[1];
|
|
1594
|
-
var _useState5 = React
|
|
1594
|
+
var _useState5 = React.useState(0),
|
|
1595
1595
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
1596
1596
|
dripY = _useState6[0],
|
|
1597
1597
|
setDripY = _useState6[1];
|
|
@@ -1625,21 +1625,21 @@ var ButtonComponent = /*#__PURE__*/React$1.forwardRef(function (btnProps, ref) {
|
|
|
1625
1625
|
var props = _objectWithoutProperties(filteredProps, _excluded);
|
|
1626
1626
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
1627
1627
|
|
|
1628
|
-
var _useMemo = React
|
|
1628
|
+
var _useMemo = React.useMemo(function () {
|
|
1629
1629
|
return getButtonColors(theme.palette, filteredProps);
|
|
1630
1630
|
}, [theme.palette, filteredProps]),
|
|
1631
1631
|
bg = _useMemo.bg,
|
|
1632
1632
|
border = _useMemo.border,
|
|
1633
1633
|
color = _useMemo.color;
|
|
1634
|
-
var hover = React
|
|
1634
|
+
var hover = React.useMemo(function () {
|
|
1635
1635
|
return getButtonHoverColors(theme.palette, filteredProps);
|
|
1636
1636
|
}, [theme.palette, filteredProps]);
|
|
1637
|
-
var _useMemo2 = React
|
|
1637
|
+
var _useMemo2 = React.useMemo(function () {
|
|
1638
1638
|
return getButtonCursor(disabled, loading);
|
|
1639
1639
|
}, [disabled, loading]),
|
|
1640
1640
|
cursor = _useMemo2.cursor,
|
|
1641
1641
|
events = _useMemo2.events;
|
|
1642
|
-
var dripColor = React
|
|
1642
|
+
var dripColor = React.useMemo(function () {
|
|
1643
1643
|
return getButtonDripColor(theme.palette, filteredProps);
|
|
1644
1644
|
}, [theme.palette, filteredProps]);
|
|
1645
1645
|
|
|
@@ -1661,7 +1661,7 @@ var ButtonComponent = /*#__PURE__*/React$1.forwardRef(function (btnProps, ref) {
|
|
|
1661
1661
|
}
|
|
1662
1662
|
onClick && onClick(event);
|
|
1663
1663
|
};
|
|
1664
|
-
var childrenWithIcon = React
|
|
1664
|
+
var childrenWithIcon = React.useMemo(function () {
|
|
1665
1665
|
return getButtonChildrenWithIcon(auto, children, {
|
|
1666
1666
|
icon: icon,
|
|
1667
1667
|
iconRight: iconRight
|
|
@@ -1669,21 +1669,21 @@ var ButtonComponent = /*#__PURE__*/React$1.forwardRef(function (btnProps, ref) {
|
|
|
1669
1669
|
}, [auto, children, icon, iconRight]);
|
|
1670
1670
|
var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
|
|
1671
1671
|
paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
|
|
1672
|
-
return /*#__PURE__*/React
|
|
1672
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
1673
1673
|
ref: buttonRef,
|
|
1674
1674
|
type: type,
|
|
1675
1675
|
disabled: disabled,
|
|
1676
1676
|
onClick: clickHandler
|
|
1677
1677
|
}, props, {
|
|
1678
1678
|
className: _JSXStyle.dynamic([["1558010596", [SCALES.height(2.5), round ? '50%' : theme.layout.radius, SCALES.font(0.875), color, bg, border, cursor, events, shadow ? theme.expressiveness.shadowSmall : '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, shadow ? theme.expressiveness.shadowMedium : 'none', shadow ? '-1px' : '0px']]]) + " " + (props && props.className != null && props.className || useClasses('btn', className) || "")
|
|
1679
|
-
}), loading && /*#__PURE__*/React
|
|
1679
|
+
}), loading && /*#__PURE__*/React.createElement(ButtonLoading, {
|
|
1680
1680
|
color: color
|
|
1681
|
-
}), childrenWithIcon, dripShow && /*#__PURE__*/React
|
|
1681
|
+
}), childrenWithIcon, dripShow && /*#__PURE__*/React.createElement(ButtonDrip, {
|
|
1682
1682
|
x: dripX,
|
|
1683
1683
|
y: dripY,
|
|
1684
1684
|
color: dripColor,
|
|
1685
1685
|
onCompleted: dripCompletedHandle
|
|
1686
|
-
}), /*#__PURE__*/React
|
|
1686
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1687
1687
|
id: "1558010596",
|
|
1688
1688
|
dynamic: [SCALES.height(2.5), round ? '50%' : theme.layout.radius, SCALES.font(0.875), color, bg, border, cursor, events, shadow ? theme.expressiveness.shadowSmall : '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, shadow ? theme.expressiveness.shadowMedium : 'none', shadow ? '-1px' : '0px']
|
|
1689
1689
|
}, ".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.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(border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(shadow ? theme.expressiveness.shadowSmall : '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(shadow ? theme.expressiveness.shadowMedium : 'none', ";-webkit-transform:translate3d(0px,").concat(shadow ? '-1px' : '0px', ",0px);-ms-transform:translate3d(0px,").concat(shadow ? '-1px' : '0px', ",0px);transform:translate3d(0px,").concat(shadow ? '-1px' : '0px', ",0px);}.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;}")));
|
|
@@ -1767,7 +1767,7 @@ var CompactButton = function CompactButton(_ref) {
|
|
|
1767
1767
|
iconRight: iconRight
|
|
1768
1768
|
}, children);
|
|
1769
1769
|
};
|
|
1770
|
-
var button_compact = /*#__PURE__*/React
|
|
1770
|
+
var button_compact = /*#__PURE__*/React.memo(CompactButton);
|
|
1771
1771
|
|
|
1772
1772
|
/* "use client" */
|
|
1773
1773
|
|