@helpdice/ui 2.6.0-beta.5 → 2.6.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1036,1154 +1036,484 @@ var TextChild = function TextChild(_ref) {
1036
1036
  };
1037
1037
  TextChild.displayName = 'TextChild';
1038
1038
 
1039
- var ButtonDrip = function ButtonDrip(_ref) {
1040
- var _ref$x = _ref.x,
1041
- x = _ref$x === void 0 ? 0 : _ref$x,
1042
- _ref$y = _ref.y,
1043
- y = _ref$y === void 0 ? 0 : _ref$y,
1044
- color = _ref.color,
1045
- onCompleted = _ref.onCompleted;
1046
- var dripRef = React.useRef(null);
1047
- /* istanbul ignore next */
1048
- var top = Number.isNaN(+y) ? 0 : y - 10;
1049
- /* istanbul ignore next */
1050
- var left = Number.isNaN(+x) ? 0 : x - 10;
1051
- React.useEffect(function () {
1052
- /* istanbul ignore next */
1053
- if (!dripRef.current) return;
1054
- dripRef.current.addEventListener('animationend', onCompleted);
1055
- return function () {
1056
- /* istanbul ignore next */
1057
- if (!dripRef.current) return;
1058
- dripRef.current.removeEventListener('animationend', onCompleted);
1059
- };
1060
- });
1061
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
1062
- ref: dripRef,
1063
- className: "jsx-3424889537" + " " + "drip",
1064
- children: [/*#__PURE__*/jsxRuntime.jsx("svg", {
1065
- width: "20",
1066
- height: "20",
1067
- viewBox: "0 0 20 20",
1068
- style: {
1069
- top: top,
1070
- left: left
1071
- },
1072
- className: "jsx-3424889537",
1073
- children: /*#__PURE__*/jsxRuntime.jsx("g", {
1074
- stroke: "none",
1075
- strokeWidth: "1",
1076
- fill: "none",
1077
- fillRule: "evenodd",
1078
- className: "jsx-3424889537",
1079
- children: /*#__PURE__*/jsxRuntime.jsx("g", {
1080
- fill: color,
1081
- className: "jsx-3424889537",
1082
- children: /*#__PURE__*/jsxRuntime.jsx("rect", {
1083
- width: "100%",
1084
- height: "100%",
1085
- rx: "10",
1086
- className: "jsx-3424889537"
1087
- })
1088
- })
1089
- })
1090
- }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1091
- id: "3424889537",
1092
- children: ".drip.jsx-3424889537{position:absolute;left:0;right:0;top:0;bottom:0;}svg.jsx-3424889537{position:absolute;-webkit-animation:350ms ease-in expand-jsx-3424889537;animation:350ms ease-in expand-jsx-3424889537;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;width:1rem;height:1rem;}@-webkit-keyframes expand-jsx-3424889537{0%{opacity:0;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}30%{opacity:1;}80%{opacity:0.5;}100%{-webkit-transform:scale(28);-ms-transform:scale(28);transform:scale(28);opacity:0;}}@keyframes expand-jsx-3424889537{0%{opacity:0;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}30%{opacity:1;}80%{opacity:0.5;}100%{-webkit-transform:scale(28);-ms-transform:scale(28);transform:scale(28);opacity:0;}}"
1093
- })]
1039
+ var _excluded$h = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "children", "className", "display", "alignItems", "justify"];
1040
+ var _getModifierChild = function getModifierChild(tags, children) {
1041
+ if (!tags.length) return children;
1042
+ var nextTag = tags.slice(1, tags.length);
1043
+ return /*#__PURE__*/jsxRuntime.jsx(TextChild, {
1044
+ tag: tags[0],
1045
+ children: _getModifierChild(nextTag, children)
1094
1046
  });
1095
1047
  };
1096
- ButtonDrip.displayName = 'ButtonDrip';
1097
-
1098
- var _excluded$h = ["children", "type", "color", "className", "spaceRatio"];
1099
- var getIconBgColor = function getIconBgColor(type, palette, color) {
1100
- var colors = {
1101
- "default": palette.accents_6,
1102
- secondary: palette.secondary,
1103
- success: palette.success,
1104
- warning: palette.warning,
1105
- error: palette.error
1106
- };
1107
- return color ? color : colors[type];
1108
- };
1109
- var LoadingComponent = function LoadingComponent(_ref) {
1110
- var children = _ref.children,
1111
- _ref$type = _ref.type,
1112
- type = _ref$type === void 0 ? 'default' : _ref$type,
1113
- color = _ref.color,
1048
+ var TextComponent = function TextComponent(_ref) {
1049
+ var _ref$h = _ref.h1,
1050
+ h1 = _ref$h === void 0 ? false : _ref$h,
1051
+ _ref$h2 = _ref.h2,
1052
+ h2 = _ref$h2 === void 0 ? false : _ref$h2,
1053
+ _ref$h3 = _ref.h3,
1054
+ h3 = _ref$h3 === void 0 ? false : _ref$h3,
1055
+ _ref$h4 = _ref.h4,
1056
+ h4 = _ref$h4 === void 0 ? false : _ref$h4,
1057
+ _ref$h5 = _ref.h5,
1058
+ h5 = _ref$h5 === void 0 ? false : _ref$h5,
1059
+ _ref$h6 = _ref.h6,
1060
+ h6 = _ref$h6 === void 0 ? false : _ref$h6,
1061
+ _ref$p = _ref.p,
1062
+ p = _ref$p === void 0 ? false : _ref$p,
1063
+ _ref$b = _ref.b,
1064
+ b = _ref$b === void 0 ? false : _ref$b,
1065
+ _ref$small = _ref.small,
1066
+ small = _ref$small === void 0 ? false : _ref$small,
1067
+ _ref$i = _ref.i,
1068
+ i = _ref$i === void 0 ? false : _ref$i,
1069
+ _ref$span = _ref.span,
1070
+ span = _ref$span === void 0 ? false : _ref$span,
1071
+ _ref$del = _ref.del,
1072
+ del = _ref$del === void 0 ? false : _ref$del,
1073
+ _ref$em = _ref.em,
1074
+ em = _ref$em === void 0 ? false : _ref$em,
1075
+ _ref$blockquote = _ref.blockquote,
1076
+ blockquote = _ref$blockquote === void 0 ? false : _ref$blockquote,
1077
+ _ref$noWrap = _ref.noWrap,
1078
+ noWrap = _ref$noWrap === void 0 ? false : _ref$noWrap,
1079
+ children = _ref.children,
1114
1080
  _ref$className = _ref.className,
1115
1081
  className = _ref$className === void 0 ? '' : _ref$className,
1116
- _ref$spaceRatio = _ref.spaceRatio,
1117
- spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
1082
+ _ref$display = _ref.display,
1083
+ display = _ref$display === void 0 ? 'block' : _ref$display,
1084
+ alignItems = _ref.alignItems,
1085
+ justify = _ref.justify,
1118
1086
  props = _objectWithoutProperties(_ref, _excluded$h);
1087
+ var elements = {
1088
+ h1: h1,
1089
+ h2: h2,
1090
+ h3: h3,
1091
+ h4: h4,
1092
+ h5: h5,
1093
+ h6: h6,
1094
+ p: p,
1095
+ blockquote: blockquote
1096
+ };
1097
+ var inlineElements = {
1098
+ span: span,
1099
+ small: small,
1100
+ b: b,
1101
+ em: em,
1102
+ i: i,
1103
+ del: del
1104
+ };
1105
+ var names = Object.keys(elements).filter(function (name) {
1106
+ return elements[name];
1107
+ });
1108
+ var inlineNames = Object.keys(inlineElements).filter(function (name) {
1109
+ return inlineElements[name];
1110
+ });
1111
+
1112
+ /**
1113
+ * Render element "p" only if no element is found.
1114
+ * If there is only one modifier, just rendered one modifier element
1115
+ * e.g.
1116
+ * <Text /> => <p />
1117
+ * <Text em /> => <em />
1118
+ * <Text p em /> => <p><em>children</em></p>
1119
+ *
1120
+ */
1121
+
1122
+ var tag = React.useMemo(function () {
1123
+ if (names[0]) return names[0];
1124
+ if (inlineNames[0]) return inlineNames[0];
1125
+ return 'p';
1126
+ }, [names, inlineNames]);
1127
+ var renderableChildElements = inlineNames.filter(function (name) {
1128
+ return name !== tag;
1129
+ });
1130
+ var modifers = React.useMemo(function () {
1131
+ if (!renderableChildElements.length) return children;
1132
+ return _getModifierChild(renderableChildElements, children);
1133
+ }, [renderableChildElements, children]);
1134
+ return /*#__PURE__*/jsxRuntime.jsx(TextChild, _objectSpread2(_objectSpread2({
1135
+ style: {
1136
+ textAlign: props.align,
1137
+ display: display,
1138
+ alignItems: alignItems,
1139
+ justifyContent: justify
1140
+ },
1141
+ className: "".concat(className, " ").concat(noWrap ? 'no-wrap' : ''),
1142
+ tag: tag
1143
+ }, props), {}, {
1144
+ children: modifers
1145
+ }));
1146
+ };
1147
+ TextComponent.displayName = 'Text';
1148
+ var Text = withScale(TextComponent);
1149
+
1150
+ var InputError = function InputError(_ref) {
1151
+ var text = _ref.text,
1152
+ error = _ref.error;
1153
+ return /*#__PURE__*/jsxRuntime.jsxs(Text, {
1154
+ font: 0.8,
1155
+ style: {
1156
+ marginTop: 0.4,
1157
+ marginRight: 0,
1158
+ marginLeft: 0,
1159
+ marginBottom: '0.4rem',
1160
+ textAlign: 'left',
1161
+ zIndex: 0
1162
+ },
1163
+ color: error ? "error" : 'default',
1164
+ children: ["\xA0", text]
1165
+ });
1166
+ };
1167
+ var InputBlockLabelComponent = function InputBlockLabelComponent(_ref2) {
1168
+ var children = _ref2.children,
1169
+ _ref2$required = _ref2.required,
1170
+ required = _ref2$required === void 0 ? false : _ref2$required;
1119
1171
  var theme$1 = theme.useTheme();
1120
1172
  var _useScale = useScale(),
1121
1173
  SCALES = _useScale.SCALES;
1122
- var classes = theme.useClasses('loading-container', className);
1123
- var bgColor = React.useMemo(function () {
1124
- return getIconBgColor(type, theme$1.palette, color);
1125
- }, [type, theme$1.palette, color]);
1126
- return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread2(_objectSpread2({}, props), {}, {
1127
- 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 || ""),
1128
- children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
1129
- 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",
1130
- children: [children && /*#__PURE__*/jsxRuntime.jsx("label", {
1131
- 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]]]),
1132
- children: children
1133
- }), /*#__PURE__*/jsxRuntime.jsx("i", {
1134
- 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]]])
1135
- }), /*#__PURE__*/jsxRuntime.jsx("i", {
1136
- 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]]])
1137
- }), /*#__PURE__*/jsxRuntime.jsx("i", {
1138
- 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]]])
1139
- })]
1174
+ return /*#__PURE__*/jsxRuntime.jsxs("label", {
1175
+ className: _JSXStyle.dynamic([["588038827", [typeof children === "string" ? 'block' : 'flex', theme$1.palette.accents_6, theme$1.palette.errorDark, SCALES.font(1.2)]]]),
1176
+ children: [children, required && /*#__PURE__*/jsxRuntime.jsx("span", {
1177
+ className: _JSXStyle.dynamic([["588038827", [typeof children === "string" ? 'block' : 'flex', theme$1.palette.accents_6, theme$1.palette.errorDark, SCALES.font(1.2)]]]) + " " + "mark-error",
1178
+ children: "*"
1140
1179
  }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1141
- id: "2201634259",
1142
- 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],
1143
- children: ".loading-container.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;position:relative;font-size:".concat(SCALES.font(1), ";width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, '100%'), ";min-height:1em;padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}label.__jsx-style-dynamic-selector{margin-right:0.5em;color:").concat(theme$1.palette.accents_5, ";line-height:1;}label.__jsx-style-dynamic-selector *{margin:0;}.loading.__jsx-style-dynamic-selector{position:absolute;top:50%;left:50%;width:100%;height:100%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:transparent;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}i.__jsx-style-dynamic-selector{width:0.25em;height:0.25em;border-radius:50%;background-color:").concat(bgColor, ";margin:0 calc(0.25em / 2 * ").concat(spaceRatio, ");display:inline-block;-webkit-animation:loading-blink-__jsx-style-dynamic-selector 1.4s infinite both;animation:loading-blink-__jsx-style-dynamic-selector 1.4s infinite both;}i.__jsx-style-dynamic-selector:nth-child(2){-webkit-animation-delay:0.2s;animation-delay:0.2s;}i.__jsx-style-dynamic-selector:nth-child(3){-webkit-animation-delay:0.4s;animation-delay:0.4s;}@-webkit-keyframes loading-blink-__jsx-style-dynamic-selector{0%{opacity:0.2;}20%{opacity:1;}100%{opacity:0.2;}}@keyframes loading-blink-__jsx-style-dynamic-selector{0%{opacity:0.2;}20%{opacity:1;}100%{opacity:0.2;}}")
1180
+ id: "588038827",
1181
+ dynamic: [typeof children === "string" ? 'block' : 'flex', theme$1.palette.accents_6, theme$1.palette.errorDark, SCALES.font(1.2)],
1182
+ children: "label.__jsx-style-dynamic-selector{display:".concat(typeof children === "string" ? 'block' : 'flex', ";font-weight:normal;color:").concat(theme$1.palette.accents_6, ";padding:0 0 0 1px;margin-bottom:0.5em;font-size:1em;line-height:1.5;}label.__jsx-style-dynamic-selector .mark-error.__jsx-style-dynamic-selector{color:").concat(theme$1.palette.errorDark, ";margin:0px 3px;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;font-size:").concat(SCALES.font(1.2), ";}label.__jsx-style-dynamic-selector>*:first-child{margin-top:0;}label.__jsx-style-dynamic-selector>*:last-child{margin-bottom:0;}")
1144
1183
  })]
1145
- }));
1184
+ });
1146
1185
  };
1147
- LoadingComponent.displayName = 'Loading';
1148
- var Loading = withScale(LoadingComponent);
1186
+ InputBlockLabelComponent.displayName = 'InputBlockLabel';
1187
+ var InputBlockLabel = /*#__PURE__*/React.memo(InputBlockLabelComponent);
1149
1188
 
1150
- var ButtonLoading = function ButtonLoading(_ref) {
1151
- var color = _ref.color;
1152
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
1153
- className: "jsx-212623367" + " " + "btn-loading",
1154
- children: [/*#__PURE__*/jsxRuntime.jsx(Loading, {
1155
- color: color
1156
- }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1157
- id: "212623367",
1158
- children: ".btn-loading.jsx-212623367{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;background-color:var(--helpdice-ui-button-bg);}"
1189
+ var InputIconComponent = function InputIconComponent(_ref) {
1190
+ var icon = _ref.icon,
1191
+ _ref$clickable = _ref.clickable,
1192
+ clickable = _ref$clickable === void 0 ? false : _ref$clickable,
1193
+ onClick = _ref.onClick;
1194
+ return /*#__PURE__*/jsxRuntime.jsxs("span", {
1195
+ onClick: onClick,
1196
+ className: _JSXStyle.dynamic([["4247656379", [clickable ? 'pointer' : 'default', clickable ? 'auto' : 'none']]]) + " " + "input-icon",
1197
+ children: [icon, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1198
+ id: "4247656379",
1199
+ dynamic: [clickable ? 'pointer' : 'default', clickable ? 'auto' : 'none'],
1200
+ children: ".input-icon.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:calc(var(--input-height) - 2px);-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;margin:0;padding:0;line-height:1;position:relative;cursor:".concat(clickable ? 'pointer' : 'default', ";pointer-events:").concat(clickable ? 'auto' : 'none', ";}.input-icon.__jsx-style-dynamic-selector svg{width:calc(var(--input-height) - 2px);height:calc(var(--input-height) - 2px);-webkit-transform:scale(0.44);-ms-transform:scale(0.44);transform:scale(0.44);}")
1159
1201
  })]
1160
1202
  });
1161
1203
  };
1162
- ButtonLoading.displayName = 'ButtonLoading';
1163
-
1164
- var _excluded$g = ["isRight", "isSingle", "children", "className"];
1165
- var ButtonIcon = function ButtonIcon(_ref) {
1166
- var _ref$isRight = _ref.isRight,
1167
- isRight = _ref$isRight === void 0 ? false : _ref$isRight,
1168
- isSingle = _ref.isSingle,
1169
- children = _ref.children,
1170
- _ref$className = _ref.className,
1171
- className = _ref$className === void 0 ? '' : _ref$className,
1172
- props = _objectWithoutProperties(_ref, _excluded$g);
1173
- var classes = theme.useClasses('icon', {
1174
- right: isRight,
1175
- single: isSingle
1176
- }, className);
1177
- return /*#__PURE__*/jsxRuntime.jsxs("span", _objectSpread2(_objectSpread2({}, props), {}, {
1178
- className: "jsx-2467502931" + " " + (props && props.className != null && props.className || classes || ""),
1179
- children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1180
- id: "2467502931",
1181
- children: ".icon.jsx-2467502931{position:absolute;left:var(--helpdice-ui-button-icon-padding);right:auto;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--helpdice-ui-button-color);z-index:1;}.right.jsx-2467502931{right:var(--helpdice-ui-button-icon-padding);left:auto;}.icon.jsx-2467502931 svg{background:transparent;height:calc(var(--helpdice-ui-button-height) / 2.35);width:calc(var(--helpdice-ui-button-height) / 2.35);}.single.jsx-2467502931{position:static;-webkit-transform:none;-ms-transform:none;transform:none;}"
1182
- })]
1183
- }));
1184
- };
1185
- ButtonIcon.displayName = 'ButtonIcon';
1204
+ InputIconComponent.displayName = 'InputIcon';
1205
+ var InputIcon = /*#__PURE__*/React.memo(InputIconComponent);
1186
1206
 
1187
- var getButtonChildrenWithIcon = function getButtonChildrenWithIcon(auto, children, icons) {
1188
- var icon = icons.icon,
1189
- iconRight = icons.iconRight;
1190
- var hasIcon = icon || iconRight;
1191
- var isRight = Boolean(iconRight);
1192
- var paddingForAutoMode = auto ? "calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding) * .5)" : 0;
1193
- var classes = theme.useClasses('text', isRight ? 'right' : 'left');
1194
- if (!hasIcon) return /*#__PURE__*/jsxRuntime.jsx("div", {
1195
- className: "text",
1196
- children: children
1207
+ var InputIconClear = function InputIconClear(_ref) {
1208
+ var onClick = _ref.onClick,
1209
+ disabled = _ref.disabled,
1210
+ visible = _ref.visible;
1211
+ var theme$1 = theme.useTheme();
1212
+ var classes = theme.useClasses('clear-icon', {
1213
+ visible: visible
1197
1214
  });
1198
- if (React.Children.count(children) === 0) {
1199
- return /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
1200
- isRight: isRight,
1201
- isSingle: true,
1202
- children: hasIcon
1203
- });
1204
- }
1205
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1206
- children: [/*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
1207
- isRight: isRight,
1208
- children: hasIcon
1209
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1210
- className: _JSXStyle.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || ""),
1211
- children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1212
- id: "3568181479",
1213
- dynamic: [paddingForAutoMode, paddingForAutoMode],
1214
- children: ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}")
1215
+ var clickHandler = function clickHandler(event) {
1216
+ event.preventDefault();
1217
+ event.stopPropagation();
1218
+ event.nativeEvent.stopImmediatePropagation();
1219
+ onClick && onClick(event);
1220
+ };
1221
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
1222
+ onClick: clickHandler,
1223
+ className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme$1.palette.accents_3, disabled ? theme$1.palette.accents_3 : theme$1.palette.foreground]]]) + " " + (classes || ""),
1224
+ children: [/*#__PURE__*/jsxRuntime.jsxs("svg", {
1225
+ viewBox: "0 0 24 24",
1226
+ stroke: "currentColor",
1227
+ strokeWidth: "1.5",
1228
+ strokeLinecap: "round",
1229
+ strokeLinejoin: "round",
1230
+ fill: "none",
1231
+ shapeRendering: "geometricPrecision",
1232
+ className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme$1.palette.accents_3, disabled ? theme$1.palette.accents_3 : theme$1.palette.foreground]]]),
1233
+ children: [/*#__PURE__*/jsxRuntime.jsx("path", {
1234
+ d: "M18 6L6 18",
1235
+ className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme$1.palette.accents_3, disabled ? theme$1.palette.accents_3 : theme$1.palette.foreground]]])
1236
+ }), /*#__PURE__*/jsxRuntime.jsx("path", {
1237
+ d: "M6 6l12 12",
1238
+ className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme$1.palette.accents_3, disabled ? theme$1.palette.accents_3 : theme$1.palette.foreground]]])
1215
1239
  })]
1240
+ }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1241
+ id: "1567030211",
1242
+ dynamic: [disabled ? 'not-allowed' : 'pointer', theme$1.palette.accents_3, disabled ? theme$1.palette.accents_3 : theme$1.palette.foreground],
1243
+ children: ".clear-icon.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:calc(var(--input-height) - 2px);-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;cursor:".concat(disabled ? 'not-allowed' : 'pointer', ";-webkit-transition:color 150ms ease 0s;transition:color 150ms ease 0s;margin:0;padding:0;color:").concat(theme$1.palette.accents_3, ";visibility:hidden;opacity:0;}.visible.__jsx-style-dynamic-selector{visibility:visible;opacity:1;}.clear-icon.__jsx-style-dynamic-selector:hover{color:").concat(disabled ? theme$1.palette.accents_3 : theme$1.palette.foreground, ";}svg.__jsx-style-dynamic-selector{color:currentColor;width:calc(var(--input-height) - 2px);height:calc(var(--input-height) - 2px);-webkit-transform:scale(0.44);-ms-transform:scale(0.44);transform:scale(0.44);}")
1216
1244
  })]
1217
1245
  });
1218
1246
  };
1219
- var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
1220
- if (!config.isButtonGroup) return props;
1221
- return _objectSpread2(_objectSpread2({}, props), {}, {
1222
- auto: true,
1223
- shadow: false,
1224
- ghost: config.ghost || props.ghost,
1225
- type: config.type || props.type,
1226
- disabled: config.disabled || props.disabled
1227
- });
1228
- };
1229
-
1230
- /* "use client" */
1231
-
1232
- var defaultContext$3 = {
1233
- isButtonGroup: false,
1234
- disabled: false
1235
- };
1236
- var ButtonGroupContext = /*#__PURE__*/React.createContext(defaultContext$3);
1237
- var useButtonGroupContext = function useButtonGroupContext() {
1238
- return React.useContext(ButtonGroupContext);
1239
- };
1240
-
1241
- var hexToRgb = function hexToRgb(color) {
1242
- var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
1243
- var full = color.replace(fullReg, function (_, r, g, b) {
1244
- return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
1245
- });
1246
- var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
1247
- if (!values) {
1248
- throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
1249
- }
1250
- return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
1251
- };
1252
- var colorToRgbValues = function colorToRgbValues(color) {
1253
- if (color.charAt(0) === '#') return hexToRgb(color);
1254
- var safeColor = color.replace(/ /g, '');
1255
- var colorType = color.substr(0, 4);
1256
- var regArray = safeColor.match(/\((.+)\)/);
1257
- if (!colorType.startsWith('rgb') || !regArray) {
1258
- console.log(color);
1259
- throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
1260
- }
1261
- return regArray[1].split(',').map(function (str) {
1262
- return Number.parseFloat(str);
1263
- });
1264
- };
1265
- var addColorAlpha = function addColorAlpha(color, alpha) {
1266
- if (!/^#|rgb|RGB/.test(color)) return color;
1267
- var _colorToRgbValues = colorToRgbValues(color),
1268
- _colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
1269
- r = _colorToRgbValues2[0],
1270
- g = _colorToRgbValues2[1],
1271
- b = _colorToRgbValues2[2];
1272
- var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
1273
- return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
1274
- };
1247
+ var MemoInputIconClear = /*#__PURE__*/React.memo(InputIconClear);
1275
1248
 
1276
- var getButtonGhostColors = function getButtonGhostColors(palette, _color) {
1249
+ var getColors$2 = function getColors(palette, status) {
1277
1250
  var colors = {
1251
+ "default": {
1252
+ color: palette.foreground,
1253
+ borderColor: palette.border,
1254
+ hoverBorder: palette.accents_5
1255
+ },
1278
1256
  secondary: {
1279
- bg: palette.background,
1280
- border: palette.foreground,
1281
1257
  color: palette.foreground,
1282
- ripple: ''
1258
+ borderColor: palette.secondary,
1259
+ hoverBorder: palette.secondary
1283
1260
  },
1284
1261
  success: {
1285
- bg: palette.background,
1286
- border: palette.success,
1287
- color: palette.success,
1288
- ripple: ''
1262
+ color: palette.foreground,
1263
+ borderColor: palette.successLight,
1264
+ hoverBorder: palette.success
1289
1265
  },
1290
1266
  warning: {
1291
- bg: palette.background,
1292
- border: palette.warning,
1293
- color: palette.warning,
1294
- ripple: ''
1267
+ color: palette.foreground,
1268
+ borderColor: palette.warningLight,
1269
+ hoverBorder: palette.warning
1295
1270
  },
1296
1271
  error: {
1297
- bg: palette.background,
1298
- border: palette.error,
1299
1272
  color: palette.error,
1300
- ripple: ''
1273
+ borderColor: palette.error,
1274
+ hoverBorder: palette.errorDark
1301
1275
  }
1302
1276
  };
1303
- return colors[_color] || null;
1277
+ if (!status) return colors["default"];
1278
+ return colors[status];
1304
1279
  };
1305
- var getButtonColors = function getButtonColors(palette, props) {
1306
- var color = props.color,
1307
- disabled = props.disabled,
1308
- ghost = props.ghost;
1309
- var colors = {
1310
- "default": {
1311
- bg: palette.background,
1312
- border: palette.border,
1313
- color: palette.accents_5,
1314
- ripple: palette.accents_1
1315
- },
1316
- secondary: {
1317
- bg: palette.foreground,
1318
- border: palette.foreground,
1319
- color: palette.background,
1320
- ripple: palette.accents_1
1321
- },
1322
- success: {
1323
- bg: palette.success,
1324
- border: palette.success,
1325
- color: '#fff',
1326
- ripple: '#1f93ffff'
1327
- },
1328
- warning: {
1329
- bg: palette.warning,
1330
- border: palette.warning,
1331
- color: '#fff',
1332
- ripple: '#ffca29ff'
1333
- },
1334
- error: {
1335
- bg: palette.error,
1336
- border: palette.error,
1337
- color: '#fff',
1338
- ripple: '#ff5a55ff'
1339
- },
1340
- abort: {
1341
- bg: 'transparent',
1342
- border: 'transparent',
1343
- color: palette.accents_5,
1344
- ripple: palette.accents_1
1345
- }
1346
- };
1347
- if (disabled) return {
1348
- bg: palette.accents_1,
1349
- border: palette.accents_2,
1350
- color: '#ccc',
1351
- ripple: ''
1352
- };
1353
1280
 
1354
- /**
1355
- * The '-light' type is the same color as the common type,
1356
- * only hover's color is different.
1357
- * e.g.
1358
- * Color['success'] === Color['success-light']
1359
- * Color['warning'] === Color['warning-light']
1360
- */
1361
- var withoutLightType = color === null || color === void 0 ? void 0 : color.replace('-light', '');
1362
- var defaultColor = colors["default"];
1363
- if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
1364
- return colors[withoutLightType] || defaultColor;
1281
+ var _excluded$g = ["label", "labelRight", "error", "color", "helperText", "type", "icon", "variant", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "onEnter", "autoComplete", "placeholder", "children", "disabled", "fullWidth", "required"];
1282
+ var simulateChangeEvent = function simulateChangeEvent(el, event) {
1283
+ return _objectSpread2(_objectSpread2({}, event), {}, {
1284
+ target: el,
1285
+ currentTarget: el
1286
+ });
1365
1287
  };
1366
- var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, _color) {
1367
- var colors = {
1368
- secondary: {
1369
- bg: palette.foreground,
1370
- border: palette.background,
1371
- color: palette.background
1372
- },
1373
- success: {
1374
- bg: palette.success,
1375
- border: palette.background,
1376
- color: 'white'
1377
- },
1378
- warning: {
1379
- bg: palette.warning,
1380
- border: palette.background,
1381
- color: 'white'
1382
- },
1383
- error: {
1384
- bg: palette.error,
1385
- border: palette.background,
1386
- color: 'white'
1387
- }
1388
- };
1389
- var withoutLightType = _color === null || _color === void 0 ? void 0 : _color.replace('-light', '');
1390
- return colors[withoutLightType] || null;
1391
- };
1392
- var getButtonHoverColors = function getButtonHoverColors(palette, props) {
1393
- var color = props.color,
1394
- disabled = props.disabled,
1395
- loading = props.loading,
1396
- shadow = props.shadow,
1397
- ghost = props.ghost;
1398
- var defaultColor = getButtonColors(palette, props);
1399
- var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
1400
- var colors = {
1401
- "default": {
1402
- bg: palette.background,
1403
- border: palette.foreground
1404
- },
1405
- secondary: {
1406
- bg: palette.background,
1407
- border: palette.foreground
1408
- },
1409
- success: {
1410
- bg: palette.background,
1411
- border: palette.success
1412
- },
1413
- warning: {
1414
- bg: palette.background,
1415
- border: palette.warning
1416
- },
1417
- error: {
1418
- bg: palette.background,
1419
- border: palette.error
1420
- },
1421
- abort: {
1422
- bg: 'transparent',
1423
- border: 'transparent',
1424
- color: palette.accents_5
1425
- },
1426
- 'secondary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1427
- bg: alphaBackground
1428
- }),
1429
- 'success-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1430
- bg: alphaBackground
1431
- }),
1432
- 'warning-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1433
- bg: alphaBackground
1434
- }),
1435
- 'error-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1436
- bg: alphaBackground
1437
- })
1438
- };
1439
- if (disabled) return {
1440
- bg: palette.accents_1,
1441
- border: palette.accents_2,
1442
- color: '#ccc'
1443
- };
1444
- if (loading) return _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1445
- color: 'transparent'
1446
- });
1447
- if (shadow) return defaultColor;
1448
- var hoverColor = (ghost ? getButtonGhostHoverColors(palette, color) : colors[color]) || colors["default"];
1449
- return _objectSpread2(_objectSpread2({}, hoverColor), {}, {
1450
- color: hoverColor.color || hoverColor.border
1451
- });
1452
- };
1453
- var getButtonCursor = function getButtonCursor(disabled, loading) {
1454
- if (disabled) return {
1455
- cursor: 'not-allowed',
1456
- events: 'auto'
1457
- };
1458
- if (loading) return {
1459
- cursor: 'default',
1460
- events: 'none'
1461
- };
1462
- return {
1463
- cursor: 'pointer',
1464
- events: 'auto'
1465
- };
1466
- };
1467
- var getButtonDripColor = function getButtonDripColor(palette, props) {
1468
- var type = props.type;
1469
- var isLightHover = type ? type.endsWith('light') : false;
1470
- var hoverColors = getButtonHoverColors(palette, props);
1471
- return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
1472
- };
1473
-
1474
- var _excluded$f = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "relative", "replace", "a", "to", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
1475
- var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
1288
+ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
1289
+ var label = _ref.label,
1290
+ labelRight = _ref.labelRight,
1291
+ error = _ref.error,
1292
+ _ref$color = _ref.color,
1293
+ _color = _ref$color === void 0 ? error ? 'error' : 'default' : _ref$color,
1294
+ helperText = _ref.helperText,
1295
+ _ref$type = _ref.type,
1296
+ type = _ref$type === void 0 ? 'text' : _ref$type,
1297
+ icon = _ref.icon,
1298
+ _ref$variant = _ref.variant,
1299
+ variant = _ref$variant === void 0 ? 'normal' : _ref$variant,
1300
+ iconRight = _ref.iconRight,
1301
+ _ref$iconClickable = _ref.iconClickable,
1302
+ iconClickable = _ref$iconClickable === void 0 ? false : _ref$iconClickable,
1303
+ onIconClick = _ref.onIconClick,
1304
+ _ref$initialValue = _ref.initialValue,
1305
+ initialValue = _ref$initialValue === void 0 ? '' : _ref$initialValue,
1306
+ onChange = _ref.onChange,
1307
+ _ref$readOnly = _ref.readOnly,
1308
+ readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
1309
+ value = _ref.value,
1310
+ onClearClick = _ref.onClearClick,
1311
+ _ref$clearable = _ref.clearable,
1312
+ clearable = _ref$clearable === void 0 ? false : _ref$clearable,
1313
+ _ref$className = _ref.className,
1314
+ className = _ref$className === void 0 ? '' : _ref$className,
1315
+ onBlur = _ref.onBlur,
1316
+ onFocus = _ref.onFocus,
1317
+ onEnter = _ref.onEnter,
1318
+ _ref$autoComplete = _ref.autoComplete,
1319
+ autoComplete = _ref$autoComplete === void 0 ? 'off' : _ref$autoComplete,
1320
+ _ref$placeholder = _ref.placeholder,
1321
+ placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
1322
+ children = _ref.children,
1323
+ _ref$disabled = _ref.disabled,
1324
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1325
+ _ref$fullWidth = _ref.fullWidth,
1326
+ fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
1327
+ required = _ref.required,
1328
+ props = _objectWithoutProperties(_ref, _excluded$g);
1476
1329
  var theme$1 = theme.useTheme();
1477
- // const navigate = useNavigate();
1478
1330
  var _useScale = useScale(),
1479
1331
  SCALES = _useScale.SCALES;
1480
- var buttonRef = React.useRef(null);
1332
+ var inputRef = React.useRef(null);
1481
1333
  React.useImperativeHandle(ref, function () {
1482
- return buttonRef.current;
1334
+ return inputRef.current;
1483
1335
  }); // Changed with !
1484
1336
 
1485
- var _useState = React.useState(false),
1337
+ var _useState = React.useState(initialValue),
1486
1338
  _useState2 = _slicedToArray(_useState, 2),
1487
- dripShow = _useState2[0],
1488
- setDripShow = _useState2[1];
1489
- var _useState3 = React.useState(0),
1339
+ selfValue = _useState2[0],
1340
+ setSelfValue = _useState2[1];
1341
+ var _useState3 = React.useState(false),
1490
1342
  _useState4 = _slicedToArray(_useState3, 2),
1491
- dripX = _useState4[0],
1492
- setDripX = _useState4[1];
1493
- var _useState5 = React.useState(0),
1494
- _useState6 = _slicedToArray(_useState5, 2),
1495
- dripY = _useState6[0],
1496
- setDripY = _useState6[1];
1497
- var groupConfig = useButtonGroupContext();
1498
- var filteredProps = filterPropsWithGroup(btnProps, groupConfig);
1499
- /* eslint-disable @typescript-eslint/no-unused-vars */
1500
- var children = filteredProps.children,
1501
- _filteredProps$disabl = filteredProps.disabled,
1502
- disabled = _filteredProps$disabl === void 0 ? false : _filteredProps$disabl;
1503
- filteredProps.color;
1504
- var _filteredProps$loadin = filteredProps.loading,
1505
- loading = _filteredProps$loadin === void 0 ? false : _filteredProps$loadin,
1506
- _filteredProps$shadow = filteredProps.shadow,
1507
- shadow = _filteredProps$shadow === void 0 ? false : _filteredProps$shadow,
1508
- _filteredProps$ghost = filteredProps.ghost,
1509
- ghost = _filteredProps$ghost === void 0 ? false : _filteredProps$ghost,
1510
- _filteredProps$effect = filteredProps.effect,
1511
- effect = _filteredProps$effect === void 0 ? true : _filteredProps$effect,
1512
- _filteredProps$round = filteredProps.round,
1513
- round = _filteredProps$round === void 0 ? false : _filteredProps$round;
1514
- filteredProps.relative;
1515
- filteredProps.replace;
1516
- filteredProps.a;
1517
- var to = filteredProps.to,
1518
- onClick = filteredProps.onClick,
1519
- _filteredProps$auto = filteredProps.auto,
1520
- auto = _filteredProps$auto === void 0 ? false : _filteredProps$auto,
1521
- icon = filteredProps.icon,
1522
- _filteredProps$type = filteredProps.type,
1523
- type = _filteredProps$type === void 0 ? 'button' : _filteredProps$type,
1524
- iconRight = filteredProps.iconRight,
1525
- _filteredProps$classN = filteredProps.className,
1526
- className = _filteredProps$classN === void 0 ? '' : _filteredProps$classN;
1527
- filteredProps.crossOrigin;
1528
- var props = _objectWithoutProperties(filteredProps, _excluded$f);
1529
- /* eslint-enable @typescript-eslint/no-unused-vars */
1530
-
1343
+ hover = _useState4[0],
1344
+ setHover = _useState4[1];
1345
+ var isControlledComponent = React.useMemo(function () {
1346
+ return value !== undefined;
1347
+ }, [value]);
1348
+ var labelClasses = React.useMemo(function () {
1349
+ return labelRight ? 'right-label' : label ? 'left-label' : '';
1350
+ }, [label, labelRight]);
1351
+ var iconClasses = React.useMemo(function () {
1352
+ return iconRight ? 'right-icon' : icon ? 'left-icon' : '';
1353
+ }, [icon, iconRight]);
1531
1354
  var _useMemo = React.useMemo(function () {
1532
- return getButtonColors(theme$1.palette, filteredProps);
1533
- }, [theme$1.palette, filteredProps]),
1534
- bg = _useMemo.bg,
1535
- border = _useMemo.border,
1355
+ return getColors$2(theme$1.palette, _color);
1356
+ }, [theme$1.palette, _color]),
1536
1357
  color = _useMemo.color,
1537
- rippleColor = _useMemo.ripple;
1538
- var hover = React.useMemo(function () {
1539
- return getButtonHoverColors(theme$1.palette, filteredProps);
1540
- }, [theme$1.palette, filteredProps]);
1541
- var _useMemo2 = React.useMemo(function () {
1542
- return getButtonCursor(disabled, loading);
1543
- }, [disabled, loading]),
1544
- cursor = _useMemo2.cursor,
1545
- events = _useMemo2.events;
1546
- var dripColor = React.useMemo(function () {
1547
- return getButtonDripColor(theme$1.palette, filteredProps);
1548
- }, [theme$1.palette, filteredProps]);
1549
-
1550
- /* istanbul ignore next */
1551
- var dripCompletedHandle = function dripCompletedHandle() {
1552
- setDripShow(false);
1553
- setDripX(0);
1554
- setDripY(0);
1358
+ borderColor = _useMemo.borderColor,
1359
+ hoverBorder = _useMemo.hoverBorder;
1360
+ var changeHandler = function changeHandler(event) {
1361
+ if (disabled || readOnly) return;
1362
+ setSelfValue(event.target.value);
1363
+ onChange && onChange(event);
1555
1364
  };
1556
- var createRipple = function createRipple(event) {
1557
- var button = buttonRef.current;
1558
- if (!button) return;
1559
- var rect = button.getBoundingClientRect();
1560
- var size = Math.max(rect.width, rect.height);
1561
- var x = event.clientX - rect.left - size / 2;
1562
- var y = event.clientY - rect.top - size / 2;
1563
- var rippleCount = 1; // number of rings
1564
- var rippleDelay = 500; // ms between each ripple
1565
- var _loop = function _loop() {
1566
- var ripple = document.createElement('span');
1567
- Object.assign(ripple.style, {
1568
- position: 'absolute',
1569
- borderRadius: '50%',
1570
- backgroundColor: rippleColor,
1571
- width: "".concat(size, "px"),
1572
- height: "".concat(size, "px"),
1573
- left: "".concat(x, "px"),
1574
- top: "".concat(y, "px"),
1575
- pointerEvents: 'none',
1576
- transform: 'scale(0)',
1577
- opacity: '1',
1578
- transition: "transform 600ms ease-out ".concat(i * rippleDelay, "ms, opacity 600ms ease-out ").concat(i * rippleDelay, "ms"),
1579
- zIndex: 1
1580
- });
1581
- button.appendChild(ripple);
1582
-
1583
- // Force reflow to start transition
1584
- window.getComputedStyle(ripple).opacity;
1585
- ripple.style.transform = 'scale(2.5)';
1586
- ripple.style.opacity = '0';
1587
- ripple.addEventListener('transitionend', function () {
1588
- ripple.remove();
1589
- });
1590
- };
1591
- for (var i = 0; i < rippleCount; i++) {
1592
- _loop();
1593
- }
1594
- };
1595
- var clickHandler = function clickHandler(event) {
1596
- if (disabled || loading) return;
1597
- var showDrip = !shadow && !ghost && effect;
1365
+ var clearHandler = function clearHandler(event) {
1366
+ setSelfValue('');
1367
+ onClearClick && onClearClick(event);
1598
1368
  /* istanbul ignore next */
1599
- if (showDrip && buttonRef.current) {
1600
- var rect = buttonRef.current.getBoundingClientRect();
1601
- setDripShow(true);
1602
- setDripX(event.clientX - rect.left);
1603
- setDripY(event.clientY - rect.top);
1369
+ if (!inputRef.current) return;
1370
+ var changeEvent = simulateChangeEvent(inputRef.current, event);
1371
+ changeEvent.target.value = '';
1372
+ onChange && onChange(changeEvent);
1373
+ inputRef.current.focus();
1374
+ };
1375
+ var focusHandler = function focusHandler(e) {
1376
+ setHover(true);
1377
+ onFocus && onFocus(e);
1378
+ };
1379
+ var blurHandler = function blurHandler(e) {
1380
+ setHover(false);
1381
+ onBlur && onBlur(e);
1382
+ };
1383
+ var iconClickHandler = function iconClickHandler(e) {
1384
+ if (disabled) return;
1385
+ onIconClick && onIconClick(e);
1386
+ };
1387
+ var iconProps = React.useMemo(function () {
1388
+ return {
1389
+ clickable: iconClickable,
1390
+ onClick: iconClickHandler
1391
+ };
1392
+ }, [iconClickable, iconClickHandler]);
1393
+ React.useEffect(function () {
1394
+ if (isControlledComponent) {
1395
+ setSelfValue(value);
1604
1396
  }
1605
- if (shadow) {
1606
- createRipple(event);
1397
+ });
1398
+ var handleKeyDown = function handleKeyDown(e) {
1399
+ if (e.key === "Enter") {
1400
+ onEnter && onEnter(e);
1607
1401
  }
1608
- onClick && onClick(event);
1609
1402
  };
1610
- var childrenWithIcon = React.useMemo(function () {
1611
- return getButtonChildrenWithIcon(auto, children, {
1612
- icon: icon,
1613
- iconRight: iconRight
1614
- });
1615
- }, [auto, children, icon, iconRight]);
1616
- var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
1617
- paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
1618
-
1619
- // If shadow provided is string then value other default
1620
- var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme$1.shadows.level.z2 : 'none';
1621
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1622
- children: [to ? /*#__PURE__*/jsxRuntime.jsxs("a", _objectSpread2(_objectSpread2({
1623
- href: to
1624
- }, props), {}, {
1625
- className: _JSXStyle.dynamic([["612376042", [SCALES.height(2.5), round ? '50%' : theme$1.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor !== null && cursor !== void 0 ? cursor : 'pointer', events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px']]]) + " " + (props && props.className != null && props.className || theme.useClasses('btn', 'btn-link', className) || ""),
1626
- children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
1627
- color: color
1628
- }), childrenWithIcon]
1629
- })) : /*#__PURE__*/jsxRuntime.jsxs("button", _objectSpread2(_objectSpread2({
1630
- ref: buttonRef,
1631
- type: type,
1632
- disabled: disabled,
1633
- onClick: clickHandler
1634
- }, props), {}, {
1635
- className: _JSXStyle.dynamic([["612376042", [SCALES.height(2.5), round ? '50%' : theme$1.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor !== null && cursor !== void 0 ? cursor : 'pointer', events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px']]]) + " " + (props && props.className != null && props.className || theme.useClasses('btn', className) || ""),
1636
- children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
1637
- color: color
1638
- }), childrenWithIcon, dripShow && /*#__PURE__*/jsxRuntime.jsx(ButtonDrip, {
1639
- x: dripX,
1640
- y: dripY,
1641
- color: dripColor,
1642
- onCompleted: dripCompletedHandle
1403
+ var controlledValue = isControlledComponent ? {
1404
+ value: selfValue
1405
+ } : {
1406
+ defaultValue: initialValue
1407
+ };
1408
+ var inputProps = _objectSpread2(_objectSpread2({}, props), controlledValue);
1409
+ var defaultWidth = fullWidth ? '100%' : 'initial';
1410
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
1411
+ className: _JSXStyle.dynamic([["2371903369", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), theme$1.palette.foreground, theme$1.palette.accents_3, theme$1.palette.background, color]]]) + " " + "with-label",
1412
+ children: [children && /*#__PURE__*/jsxRuntime.jsx(InputBlockLabel, {
1413
+ required: required,
1414
+ children: children
1415
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1416
+ className: _JSXStyle.dynamic([["2371903369", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), theme$1.palette.foreground, theme$1.palette.accents_3, theme$1.palette.background, color]]]) + " " + (theme.useClasses('input-container', className) || ""),
1417
+ children: [label && /*#__PURE__*/jsxRuntime.jsx(MemoInputLabel, {
1418
+ children: label
1419
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1420
+ className: _JSXStyle.dynamic([["2371903369", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), theme$1.palette.foreground, theme$1.palette.accents_3, theme$1.palette.background, color]]]) + " " + (theme.useClasses('input-wrapper', {
1421
+ hover: hover,
1422
+ disabled: disabled
1423
+ }, labelClasses) || ""),
1424
+ children: [icon && /*#__PURE__*/jsxRuntime.jsx(InputIcon, _objectSpread2({
1425
+ icon: icon
1426
+ }, iconProps)), /*#__PURE__*/jsxRuntime.jsx("input", _objectSpread2(_objectSpread2({
1427
+ type: type,
1428
+ ref: inputRef,
1429
+ placeholder: placeholder,
1430
+ disabled: disabled,
1431
+ readOnly: readOnly,
1432
+ onFocus: focusHandler,
1433
+ onBlur: blurHandler,
1434
+ onChange: changeHandler,
1435
+ autoComplete: autoComplete,
1436
+ onKeyDown: handleKeyDown
1437
+ }, inputProps), {}, {
1438
+ className: _JSXStyle.dynamic([["2371903369", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), theme$1.palette.foreground, theme$1.palette.accents_3, theme$1.palette.background, color]]]) + " " + (inputProps && inputProps.className != null && inputProps.className || theme.useClasses({
1439
+ disabled: disabled
1440
+ }, iconClasses) || "")
1441
+ })), clearable && /*#__PURE__*/jsxRuntime.jsx(MemoInputIconClear, {
1442
+ visible: Boolean(inputRef.current && inputRef.current.value !== ''),
1443
+ disabled: disabled || readOnly,
1444
+ onClick: clearHandler
1445
+ }), iconRight && /*#__PURE__*/jsxRuntime.jsx(InputIcon, _objectSpread2({
1446
+ icon: iconRight
1447
+ }, iconProps))]
1448
+ }), labelRight && /*#__PURE__*/jsxRuntime.jsx(MemoInputLabel, {
1449
+ isRight: true,
1450
+ children: labelRight
1451
+ }), /*#__PURE__*/jsxRuntime.jsx("br", {
1452
+ className: _JSXStyle.dynamic([["2371903369", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), theme$1.palette.foreground, theme$1.palette.accents_3, theme$1.palette.background, color]]])
1643
1453
  })]
1644
- })), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1645
- id: "612376042",
1646
- 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'],
1647
- children: ".btn.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;line-height:".concat(SCALES.height(2.5), ";border-radius:").concat(round ? '50%' : theme$1.layout.radius, ";font-weight:400;font-size:").concat(SCALES.font(0.875), ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;text-transform:capitalize;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;white-space:nowrap;-webkit-transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;position:relative;overflow:hidden;color:").concat(color, ";background-color:").concat(bg, ";border:1px solid ").concat(shadow ? 'transparent' : border, ";cursor:").concat(cursor !== null && cursor !== void 0 ? cursor : 'pointer', ";pointer-events:").concat(events, ";box-shadow:").concat(shadow ? btnShadow : 'none', ";--helpdice-ui-button-icon-padding:").concat(SCALES.pl(0.727), ";--helpdice-ui-button-height:").concat(SCALES.height(2.5), ";--helpdice-ui-button-color:").concat(color, ";--helpdice-ui-button-bg:").concat(bg, ";min-width:").concat(auto ? 'min-content' : SCALES.width(10.5), ";width:").concat(auto ? 'auto' : 'initial', ";height:").concat(SCALES.height(2.5), ";padding:").concat(SCALES.pt(0), " ").concat(paddingRight, " ").concat(SCALES.pb(0), " ").concat(paddingLeft, ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.btn.__jsx-style-dynamic-selector:hover,.btn.__jsx-style-dynamic-selector:focus{color:").concat(hover.color, ";--helpdice-ui-button-color:").concat(hover.color, ";background-color:").concat(hover.bg, ";border-color:").concat(hover.border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(btnShadow, ";}.btn-link.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.btn.__jsx-style-dynamic-selector .text{position:relative;z-index:1;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;text-align:center;line-height:inherit;top:-1px;}.btn.__jsx-style-dynamic-selector .text p,.btn.__jsx-style-dynamic-selector .text pre,.btn.__jsx-style-dynamic-selector .text div{margin:0;}.ripple.__jsx-style-dynamic-selector{position:absolute;border-radius:50%;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;background-color:rgba(0,0,0,0.3);pointer-events:none;z-index:1;}@-webkit-keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}@keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}")
1454
+ }), helperText && /*#__PURE__*/jsxRuntime.jsx(InputError, {
1455
+ text: helperText,
1456
+ error: error
1457
+ }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1458
+ id: "2371903369",
1459
+ dynamic: [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), theme$1.palette.foreground, theme$1.palette.accents_3, theme$1.palette.background, color],
1460
+ children: ".with-label.__jsx-style-dynamic-selector{display:inline-block;box-sizing:border-box;-webkit-box-align:center;--input-height:".concat(SCALES.height(2.25), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, defaultWidth), ";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), ";}.input-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;width:").concat(SCALES.width(1, defaultWidth), ";height:var(--input-height);}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:").concat(variant === 'normal' ? theme$1.layout.radius : '', ";").concat(variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), ";-webkit-transition:border 0.2s ease 0s,color 0.2s ease 0s;transition:border 0.2s ease 0s,color 0.2s ease 0s;}.input-wrapper.left-label.__jsx-style-dynamic-selector{border-top-left-radius:0;border-bottom-left-radius:0;}.input-wrapper.right-label.__jsx-style-dynamic-selector{border-top-right-radius:0;border-bottom-right-radius:0;}.input-wrapper.disabled.__jsx-style-dynamic-selector{background-color:").concat(theme$1.palette.accents_1, ";border-color:").concat(theme$1.palette.accents_2, ";cursor:not-allowed;}input.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}.input-wrapper.hover.__jsx-style-dynamic-selector{border-color:").concat(hoverBorder, ";}input.__jsx-style-dynamic-selector{margin:0.25em 0.625em;padding:0;box-shadow:none;font-size:").concat(SCALES.font(0.875), ";background-color:transparent;border:none;color:").concat(theme$1.palette.foreground, ";outline:none;border-radius:0;width:100%;min-width:0;-webkit-appearance:none;}input.left-icon.__jsx-style-dynamic-selector{margin-left:0;}input.right-icon.__jsx-style-dynamic-selector{margin-right:0;}.__jsx-style-dynamic-selector::-webkit-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector::placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector::-ms-reveal{display:none !important;}input.__jsx-style-dynamic-selector:-webkit-autofill,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:hover,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:active,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:focus{-webkit-box-shadow:0 0 0 30px ").concat(theme$1.palette.background, " inset !important;-webkit-text-fill-color:").concat(color, " !important;}")
1648
1461
  })]
1649
1462
  });
1650
1463
  });
1651
- ButtonComponent.displayName = 'Button';
1652
- var Button = withScale(ButtonComponent);
1653
-
1654
- var CompactButton = function CompactButton(props) {
1655
- // const theme = useTheme();
1656
- return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
1657
- scale: 2 / 3,
1658
- px: 0.6
1659
- }, _objectSpread2({
1660
- auto: true
1661
- }, props)), {}, {
1662
- children: props.children
1663
- }));
1664
- };
1665
- var IconButton = /*#__PURE__*/React.memo(CompactButton);
1464
+ InputComponent.displayName = 'Input';
1465
+ var Input = withScale(InputComponent);
1666
1466
 
1667
- var SmallButton = function SmallButton(props) {
1668
- // const theme = useTheme();
1669
- return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
1670
- auto: true,
1671
- scale: 2 / 3,
1672
- px: 0.6
1673
- }, props), {}, {
1674
- children: props.children
1675
- }));
1467
+ var tuple = function tuple() {
1468
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1469
+ args[_key] = arguments[_key];
1470
+ }
1471
+ return args;
1676
1472
  };
1677
- var SmallButton$1 = /*#__PURE__*/React.memo(SmallButton);
1678
-
1679
- /* "use client" */
1680
-
1681
- Button.Icon = IconButton;
1682
- Button.Small = SmallButton$1;
1473
+ tuple('default', 'secondary', 'success', 'warning', 'error', 'abort', 'secondary-light', 'success-light', 'warning-light', 'error-light');
1474
+ tuple('default', 'secondary', 'success', 'warning', 'error');
1475
+ tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite');
1476
+ tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite', 'alert', 'purple', 'violet', 'cyan');
1477
+ tuple('default', 'silent', 'prevent');
1478
+ tuple('hover', 'click');
1479
+ tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
1480
+ tuple('start', 'center', 'end', 'left', 'right');
1683
1481
 
1684
- var _excluded$e = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "collapse", "children", "className", "display", "alignItems", "justify"];
1685
- var _getModifierChild = function getModifierChild(tags, children) {
1686
- if (!tags.length) return children;
1687
- var nextTag = tags.slice(1, tags.length);
1688
- return /*#__PURE__*/jsxRuntime.jsx(TextChild, {
1689
- tag: tags[0],
1690
- children: _getModifierChild(nextTag, children)
1691
- });
1692
- };
1693
- var TextComponent = function TextComponent(_ref) {
1694
- var _ref$h = _ref.h1,
1695
- h1 = _ref$h === void 0 ? false : _ref$h,
1696
- _ref$h2 = _ref.h2,
1697
- h2 = _ref$h2 === void 0 ? false : _ref$h2,
1698
- _ref$h3 = _ref.h3,
1699
- h3 = _ref$h3 === void 0 ? false : _ref$h3,
1700
- _ref$h4 = _ref.h4,
1701
- h4 = _ref$h4 === void 0 ? false : _ref$h4,
1702
- _ref$h5 = _ref.h5,
1703
- h5 = _ref$h5 === void 0 ? false : _ref$h5,
1704
- _ref$h6 = _ref.h6,
1705
- h6 = _ref$h6 === void 0 ? false : _ref$h6,
1706
- _ref$p = _ref.p,
1707
- p = _ref$p === void 0 ? false : _ref$p,
1708
- _ref$b = _ref.b,
1709
- b = _ref$b === void 0 ? false : _ref$b,
1710
- _ref$small = _ref.small,
1711
- small = _ref$small === void 0 ? false : _ref$small,
1712
- _ref$i = _ref.i,
1713
- i = _ref$i === void 0 ? false : _ref$i,
1714
- _ref$span = _ref.span,
1715
- span = _ref$span === void 0 ? false : _ref$span,
1716
- _ref$del = _ref.del,
1717
- del = _ref$del === void 0 ? false : _ref$del,
1718
- _ref$em = _ref.em,
1719
- em = _ref$em === void 0 ? false : _ref$em,
1720
- _ref$blockquote = _ref.blockquote,
1721
- blockquote = _ref$blockquote === void 0 ? false : _ref$blockquote,
1722
- _ref$noWrap = _ref.noWrap,
1723
- noWrap = _ref$noWrap === void 0 ? false : _ref$noWrap,
1724
- _ref$collapse = _ref.collapse,
1725
- collapse = _ref$collapse === void 0 ? 0 : _ref$collapse,
1726
- children = _ref.children,
1482
+ var _excluded$f = ["type", "disabled", "readOnly", "onFocus", "onBlur", "className", "initialValue", "onChange", "value", "placeholder", "helperText", "error", "label", "required", "resize"];
1483
+ tuple('none', 'both', 'horizontal', 'vertical', 'initial', 'inherit');
1484
+ var TextareaComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
1485
+ var _ref$type = _ref.type,
1486
+ type = _ref$type === void 0 ? 'default' : _ref$type,
1487
+ _ref$disabled = _ref.disabled,
1488
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1489
+ _ref$readOnly = _ref.readOnly,
1490
+ readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
1491
+ onFocus = _ref.onFocus,
1492
+ onBlur = _ref.onBlur,
1727
1493
  _ref$className = _ref.className,
1728
1494
  className = _ref$className === void 0 ? '' : _ref$className,
1729
- _ref$display = _ref.display,
1730
- display = _ref$display === void 0 ? 'block' : _ref$display,
1731
- alignItems = _ref.alignItems,
1732
- justify = _ref.justify,
1733
- props = _objectWithoutProperties(_ref, _excluded$e);
1734
- var elements = {
1735
- h1: h1,
1736
- h2: h2,
1737
- h3: h3,
1738
- h4: h4,
1739
- h5: h5,
1740
- h6: h6,
1741
- p: p,
1742
- blockquote: blockquote
1743
- };
1744
- var inlineElements = {
1745
- span: span,
1746
- small: small,
1747
- b: b,
1748
- em: em,
1749
- i: i,
1750
- del: del
1751
- };
1752
- var names = Object.keys(elements).filter(function (name) {
1753
- return elements[name];
1754
- });
1755
- var inlineNames = Object.keys(inlineElements).filter(function (name) {
1756
- return inlineElements[name];
1757
- });
1758
-
1759
- /**
1760
- * Render element "p" only if no element is found.
1761
- * If there is only one modifier, just rendered one modifier element
1762
- * e.g.
1763
- * <Text /> => <p />
1764
- * <Text em /> => <em />
1765
- * <Text p em /> => <p><em>children</em></p>
1766
- *
1767
- */
1768
-
1769
- var _useState = React.useState(false),
1770
- _useState2 = _slicedToArray(_useState, 2),
1771
- expand = _useState2[0],
1772
- setExpand = _useState2[1];
1773
- var tag = React.useMemo(function () {
1774
- if (names[0]) return names[0];
1775
- if (inlineNames[0]) return inlineNames[0];
1776
- return 'p';
1777
- }, [names, inlineNames]);
1778
- var renderableChildElements = inlineNames.filter(function (name) {
1779
- return name !== tag;
1780
- });
1781
- var modifers = React.useMemo(function () {
1782
- if (!renderableChildElements.length) return children;
1783
- return _getModifierChild(renderableChildElements, children);
1784
- }, [renderableChildElements, children]);
1785
- return /*#__PURE__*/jsxRuntime.jsx(TextChild, _objectSpread2(_objectSpread2({
1786
- style: {
1787
- textAlign: props.align,
1788
- display: display,
1789
- alignItems: alignItems,
1790
- justifyContent: justify
1791
- },
1792
- className: "".concat(className, " ").concat(noWrap ? 'no-wrap' : ''),
1793
- tag: tag
1794
- }, props), {}, {
1795
- children: typeof children === 'string' && collapse > 50 ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1796
- children: [expand ? modifers : (modifers === null || modifers === void 0 ? void 0 : modifers.toString().substring(0, collapse)) + '...', /*#__PURE__*/jsxRuntime.jsx(Button, {
1797
- margin: 0,
1798
- onClick: function onClick() {
1799
- return setExpand(!expand);
1800
- },
1801
- style: {
1802
- textTransform: 'lowercase'
1803
- },
1804
- effect: false,
1805
- color: "abort",
1806
- scale: 2 / 3,
1807
- px: 0.2,
1808
- py: 0,
1809
- auto: true,
1810
- children: /*#__PURE__*/jsxRuntime.jsx("b", {
1811
- children: expand ? 'less' : 'more'
1812
- })
1813
- })]
1814
- }) : modifers
1815
- }));
1816
- };
1817
- TextComponent.displayName = 'Text';
1818
- var Text = withScale(TextComponent);
1819
-
1820
- var InputError = function InputError(_ref) {
1821
- var text = _ref.text,
1822
- error = _ref.error;
1823
- return /*#__PURE__*/jsxRuntime.jsxs(Text, {
1824
- font: 0.8,
1825
- style: {
1826
- marginTop: 0.4,
1827
- marginRight: 0,
1828
- marginLeft: 0,
1829
- marginBottom: '0.4rem',
1830
- textAlign: 'left',
1831
- zIndex: 0
1832
- },
1833
- color: error ? "error" : 'default',
1834
- children: ["\xA0", text]
1835
- });
1836
- };
1837
- var InputBlockLabelComponent = function InputBlockLabelComponent(_ref2) {
1838
- var children = _ref2.children,
1839
- _ref2$required = _ref2.required,
1840
- required = _ref2$required === void 0 ? false : _ref2$required;
1841
- var theme$1 = theme.useTheme();
1842
- var _useScale = useScale(),
1843
- SCALES = _useScale.SCALES;
1844
- return /*#__PURE__*/jsxRuntime.jsxs("label", {
1845
- className: _JSXStyle.dynamic([["588038827", [typeof children === "string" ? 'block' : 'flex', theme$1.palette.accents_6, theme$1.palette.errorDark, SCALES.font(1.2)]]]),
1846
- children: [children, required && /*#__PURE__*/jsxRuntime.jsx("span", {
1847
- className: _JSXStyle.dynamic([["588038827", [typeof children === "string" ? 'block' : 'flex', theme$1.palette.accents_6, theme$1.palette.errorDark, SCALES.font(1.2)]]]) + " " + "mark-error",
1848
- children: "*"
1849
- }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1850
- id: "588038827",
1851
- dynamic: [typeof children === "string" ? 'block' : 'flex', theme$1.palette.accents_6, theme$1.palette.errorDark, SCALES.font(1.2)],
1852
- children: "label.__jsx-style-dynamic-selector{display:".concat(typeof children === "string" ? 'block' : 'flex', ";font-weight:normal;color:").concat(theme$1.palette.accents_6, ";padding:0 0 0 1px;margin-bottom:0.5em;font-size:1em;line-height:1.5;}label.__jsx-style-dynamic-selector .mark-error.__jsx-style-dynamic-selector{color:").concat(theme$1.palette.errorDark, ";margin:0px 3px;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;font-size:").concat(SCALES.font(1.2), ";}label.__jsx-style-dynamic-selector>*:first-child{margin-top:0;}label.__jsx-style-dynamic-selector>*:last-child{margin-bottom:0;}")
1853
- })]
1854
- });
1855
- };
1856
- InputBlockLabelComponent.displayName = 'InputBlockLabel';
1857
- var InputBlockLabel = /*#__PURE__*/React.memo(InputBlockLabelComponent);
1858
-
1859
- var InputIconComponent = function InputIconComponent(_ref) {
1860
- var icon = _ref.icon,
1861
- _ref$clickable = _ref.clickable,
1862
- clickable = _ref$clickable === void 0 ? false : _ref$clickable,
1863
- onClick = _ref.onClick;
1864
- return /*#__PURE__*/jsxRuntime.jsxs("span", {
1865
- onClick: onClick,
1866
- className: _JSXStyle.dynamic([["4247656379", [clickable ? 'pointer' : 'default', clickable ? 'auto' : 'none']]]) + " " + "input-icon",
1867
- children: [icon, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1868
- id: "4247656379",
1869
- dynamic: [clickable ? 'pointer' : 'default', clickable ? 'auto' : 'none'],
1870
- children: ".input-icon.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:calc(var(--input-height) - 2px);-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;margin:0;padding:0;line-height:1;position:relative;cursor:".concat(clickable ? 'pointer' : 'default', ";pointer-events:").concat(clickable ? 'auto' : 'none', ";}.input-icon.__jsx-style-dynamic-selector svg{width:calc(var(--input-height) - 2px);height:calc(var(--input-height) - 2px);-webkit-transform:scale(0.44);-ms-transform:scale(0.44);transform:scale(0.44);}")
1871
- })]
1872
- });
1873
- };
1874
- InputIconComponent.displayName = 'InputIcon';
1875
- var InputIcon = /*#__PURE__*/React.memo(InputIconComponent);
1876
-
1877
- var InputIconClear = function InputIconClear(_ref) {
1878
- var onClick = _ref.onClick,
1879
- disabled = _ref.disabled,
1880
- visible = _ref.visible;
1881
- var theme$1 = theme.useTheme();
1882
- var classes = theme.useClasses('clear-icon', {
1883
- visible: visible
1884
- });
1885
- var clickHandler = function clickHandler(event) {
1886
- event.preventDefault();
1887
- event.stopPropagation();
1888
- event.nativeEvent.stopImmediatePropagation();
1889
- onClick && onClick(event);
1890
- };
1891
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
1892
- onClick: clickHandler,
1893
- className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme$1.palette.accents_3, disabled ? theme$1.palette.accents_3 : theme$1.palette.foreground]]]) + " " + (classes || ""),
1894
- children: [/*#__PURE__*/jsxRuntime.jsxs("svg", {
1895
- viewBox: "0 0 24 24",
1896
- stroke: "currentColor",
1897
- strokeWidth: "1.5",
1898
- strokeLinecap: "round",
1899
- strokeLinejoin: "round",
1900
- fill: "none",
1901
- shapeRendering: "geometricPrecision",
1902
- className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme$1.palette.accents_3, disabled ? theme$1.palette.accents_3 : theme$1.palette.foreground]]]),
1903
- children: [/*#__PURE__*/jsxRuntime.jsx("path", {
1904
- d: "M18 6L6 18",
1905
- className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme$1.palette.accents_3, disabled ? theme$1.palette.accents_3 : theme$1.palette.foreground]]])
1906
- }), /*#__PURE__*/jsxRuntime.jsx("path", {
1907
- d: "M6 6l12 12",
1908
- className: _JSXStyle.dynamic([["1567030211", [disabled ? 'not-allowed' : 'pointer', theme$1.palette.accents_3, disabled ? theme$1.palette.accents_3 : theme$1.palette.foreground]]])
1909
- })]
1910
- }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
1911
- id: "1567030211",
1912
- dynamic: [disabled ? 'not-allowed' : 'pointer', theme$1.palette.accents_3, disabled ? theme$1.palette.accents_3 : theme$1.palette.foreground],
1913
- children: ".clear-icon.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:calc(var(--input-height) - 2px);-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;cursor:".concat(disabled ? 'not-allowed' : 'pointer', ";-webkit-transition:color 150ms ease 0s;transition:color 150ms ease 0s;margin:0;padding:0;color:").concat(theme$1.palette.accents_3, ";visibility:hidden;opacity:0;}.visible.__jsx-style-dynamic-selector{visibility:visible;opacity:1;}.clear-icon.__jsx-style-dynamic-selector:hover{color:").concat(disabled ? theme$1.palette.accents_3 : theme$1.palette.foreground, ";}svg.__jsx-style-dynamic-selector{color:currentColor;width:calc(var(--input-height) - 2px);height:calc(var(--input-height) - 2px);-webkit-transform:scale(0.44);-ms-transform:scale(0.44);transform:scale(0.44);}")
1914
- })]
1915
- });
1916
- };
1917
- var MemoInputIconClear = /*#__PURE__*/React.memo(InputIconClear);
1918
-
1919
- var getColors$2 = function getColors(palette, status) {
1920
- var colors = {
1921
- "default": {
1922
- color: palette.foreground,
1923
- borderColor: palette.border,
1924
- hoverBorder: palette.accents_5
1925
- },
1926
- secondary: {
1927
- color: palette.foreground,
1928
- borderColor: palette.secondary,
1929
- hoverBorder: palette.secondary
1930
- },
1931
- success: {
1932
- color: palette.foreground,
1933
- borderColor: palette.successLight,
1934
- hoverBorder: palette.success
1935
- },
1936
- warning: {
1937
- color: palette.foreground,
1938
- borderColor: palette.warningLight,
1939
- hoverBorder: palette.warning
1940
- },
1941
- error: {
1942
- color: palette.error,
1943
- borderColor: palette.error,
1944
- hoverBorder: palette.errorDark
1945
- }
1946
- };
1947
- if (!status) return colors["default"];
1948
- return colors[status];
1949
- };
1950
-
1951
- var _excluded$d = ["label", "labelRight", "error", "color", "helperText", "type", "icon", "variant", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "onEnter", "autoComplete", "placeholder", "children", "disabled", "fullWidth", "required"];
1952
- var simulateChangeEvent = function simulateChangeEvent(el, event) {
1953
- return _objectSpread2(_objectSpread2({}, event), {}, {
1954
- target: el,
1955
- currentTarget: el
1956
- });
1957
- };
1958
- var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
1959
- var label = _ref.label,
1960
- labelRight = _ref.labelRight,
1961
- error = _ref.error,
1962
- _ref$color = _ref.color,
1963
- _color = _ref$color === void 0 ? error ? 'error' : 'default' : _ref$color,
1964
- helperText = _ref.helperText,
1965
- _ref$type = _ref.type,
1966
- type = _ref$type === void 0 ? 'text' : _ref$type,
1967
- icon = _ref.icon,
1968
- _ref$variant = _ref.variant,
1969
- variant = _ref$variant === void 0 ? 'normal' : _ref$variant,
1970
- iconRight = _ref.iconRight,
1971
- _ref$iconClickable = _ref.iconClickable,
1972
- iconClickable = _ref$iconClickable === void 0 ? false : _ref$iconClickable,
1973
- onIconClick = _ref.onIconClick,
1974
1495
  _ref$initialValue = _ref.initialValue,
1975
1496
  initialValue = _ref$initialValue === void 0 ? '' : _ref$initialValue,
1976
1497
  onChange = _ref.onChange,
1977
- _ref$readOnly = _ref.readOnly,
1978
- readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
1979
1498
  value = _ref.value,
1980
- onClearClick = _ref.onClearClick,
1981
- _ref$clearable = _ref.clearable,
1982
- clearable = _ref$clearable === void 0 ? false : _ref$clearable,
1983
- _ref$className = _ref.className,
1984
- className = _ref$className === void 0 ? '' : _ref$className,
1985
- onBlur = _ref.onBlur,
1986
- onFocus = _ref.onFocus,
1987
- onEnter = _ref.onEnter,
1988
- _ref$autoComplete = _ref.autoComplete,
1989
- autoComplete = _ref$autoComplete === void 0 ? 'off' : _ref$autoComplete,
1990
- _ref$placeholder = _ref.placeholder,
1991
- placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
1992
- children = _ref.children,
1993
- _ref$disabled = _ref.disabled,
1994
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1995
- _ref$fullWidth = _ref.fullWidth,
1996
- fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
1499
+ placeholder = _ref.placeholder,
1500
+ helperText = _ref.helperText,
1501
+ error = _ref.error,
1502
+ label = _ref.label,
1997
1503
  required = _ref.required,
1998
- props = _objectWithoutProperties(_ref, _excluded$d);
1504
+ _ref$resize = _ref.resize,
1505
+ resize = _ref$resize === void 0 ? 'none' : _ref$resize,
1506
+ props = _objectWithoutProperties(_ref, _excluded$f);
1999
1507
  var theme$1 = theme.useTheme();
2000
1508
  var _useScale = useScale(),
2001
1509
  SCALES = _useScale.SCALES;
2002
- var inputRef = React.useRef(null);
1510
+ var textareaRef = React.useRef(null);
2003
1511
  React.useImperativeHandle(ref, function () {
2004
- return inputRef.current;
2005
- }); // Changed with !
2006
-
2007
- var _useState = React.useState(initialValue),
2008
- _useState2 = _slicedToArray(_useState, 2),
2009
- selfValue = _useState2[0],
2010
- setSelfValue = _useState2[1];
2011
- var _useState3 = React.useState(false),
2012
- _useState4 = _slicedToArray(_useState3, 2),
2013
- hover = _useState4[0],
2014
- setHover = _useState4[1];
2015
- var isControlledComponent = React.useMemo(function () {
2016
- return value !== undefined;
2017
- }, [value]);
2018
- var labelClasses = React.useMemo(function () {
2019
- return labelRight ? 'right-label' : label ? 'left-label' : '';
2020
- }, [label, labelRight]);
2021
- var iconClasses = React.useMemo(function () {
2022
- return iconRight ? 'right-icon' : icon ? 'left-icon' : '';
2023
- }, [icon, iconRight]);
2024
- var _useMemo = React.useMemo(function () {
2025
- return getColors$2(theme$1.palette, _color);
2026
- }, [theme$1.palette, _color]),
2027
- color = _useMemo.color,
2028
- borderColor = _useMemo.borderColor,
2029
- hoverBorder = _useMemo.hoverBorder;
2030
- var changeHandler = function changeHandler(event) {
2031
- if (disabled || readOnly) return;
2032
- setSelfValue(event.target.value);
2033
- onChange && onChange(event);
2034
- };
2035
- var clearHandler = function clearHandler(event) {
2036
- setSelfValue('');
2037
- onClearClick && onClearClick(event);
2038
- /* istanbul ignore next */
2039
- if (!inputRef.current) return;
2040
- var changeEvent = simulateChangeEvent(inputRef.current, event);
2041
- changeEvent.target.value = '';
2042
- onChange && onChange(changeEvent);
2043
- inputRef.current.focus();
2044
- };
2045
- var focusHandler = function focusHandler(e) {
2046
- setHover(true);
2047
- onFocus && onFocus(e);
2048
- };
2049
- var blurHandler = function blurHandler(e) {
2050
- setHover(false);
2051
- onBlur && onBlur(e);
2052
- };
2053
- var iconClickHandler = function iconClickHandler(e) {
2054
- if (disabled) return;
2055
- onIconClick && onIconClick(e);
2056
- };
2057
- var iconProps = React.useMemo(function () {
2058
- return {
2059
- clickable: iconClickable,
2060
- onClick: iconClickHandler
2061
- };
2062
- }, [iconClickable, iconClickHandler]);
2063
- React.useEffect(function () {
2064
- if (isControlledComponent) {
2065
- setSelfValue(value);
2066
- }
2067
- });
2068
- var handleKeyDown = function handleKeyDown(e) {
2069
- if (e.key === "Enter") {
2070
- onEnter && onEnter(e);
2071
- }
2072
- };
2073
- var controlledValue = isControlledComponent ? {
2074
- value: selfValue
2075
- } : {
2076
- defaultValue: initialValue
2077
- };
2078
- var inputProps = _objectSpread2(_objectSpread2({}, props), controlledValue);
2079
- var defaultWidth = fullWidth ? '100%' : 'initial';
2080
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
2081
- className: _JSXStyle.dynamic([["2371903369", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), theme$1.palette.foreground, theme$1.palette.accents_3, theme$1.palette.background, color]]]) + " " + "with-label",
2082
- children: [children && /*#__PURE__*/jsxRuntime.jsx(InputBlockLabel, {
2083
- required: required,
2084
- children: children
2085
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
2086
- className: _JSXStyle.dynamic([["2371903369", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), theme$1.palette.foreground, theme$1.palette.accents_3, theme$1.palette.background, color]]]) + " " + (theme.useClasses('input-container', className) || ""),
2087
- children: [label && /*#__PURE__*/jsxRuntime.jsx(MemoInputLabel, {
2088
- children: label
2089
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
2090
- className: _JSXStyle.dynamic([["2371903369", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), theme$1.palette.foreground, theme$1.palette.accents_3, theme$1.palette.background, color]]]) + " " + (theme.useClasses('input-wrapper', {
2091
- hover: hover,
2092
- disabled: disabled
2093
- }, labelClasses) || ""),
2094
- children: [icon && /*#__PURE__*/jsxRuntime.jsx(InputIcon, _objectSpread2({
2095
- icon: icon
2096
- }, iconProps)), /*#__PURE__*/jsxRuntime.jsx("input", _objectSpread2(_objectSpread2({
2097
- type: type,
2098
- ref: inputRef,
2099
- placeholder: placeholder,
2100
- disabled: disabled,
2101
- readOnly: readOnly,
2102
- onFocus: focusHandler,
2103
- onBlur: blurHandler,
2104
- onChange: changeHandler,
2105
- autoComplete: autoComplete,
2106
- onKeyDown: handleKeyDown
2107
- }, inputProps), {}, {
2108
- className: _JSXStyle.dynamic([["2371903369", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), theme$1.palette.foreground, theme$1.palette.accents_3, theme$1.palette.background, color]]]) + " " + (inputProps && inputProps.className != null && inputProps.className || theme.useClasses({
2109
- disabled: disabled
2110
- }, iconClasses) || "")
2111
- })), clearable && /*#__PURE__*/jsxRuntime.jsx(MemoInputIconClear, {
2112
- visible: Boolean(inputRef.current && inputRef.current.value !== ''),
2113
- disabled: disabled || readOnly,
2114
- onClick: clearHandler
2115
- }), iconRight && /*#__PURE__*/jsxRuntime.jsx(InputIcon, _objectSpread2({
2116
- icon: iconRight
2117
- }, iconProps))]
2118
- }), labelRight && /*#__PURE__*/jsxRuntime.jsx(MemoInputLabel, {
2119
- isRight: true,
2120
- children: labelRight
2121
- }), /*#__PURE__*/jsxRuntime.jsx("br", {
2122
- className: _JSXStyle.dynamic([["2371903369", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), theme$1.palette.foreground, theme$1.palette.accents_3, theme$1.palette.background, color]]])
2123
- })]
2124
- }), helperText && /*#__PURE__*/jsxRuntime.jsx(InputError, {
2125
- text: helperText,
2126
- error: error
2127
- }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
2128
- id: "2371903369",
2129
- dynamic: [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), theme$1.palette.foreground, theme$1.palette.accents_3, theme$1.palette.background, color],
2130
- children: ".with-label.__jsx-style-dynamic-selector{display:inline-block;box-sizing:border-box;-webkit-box-align:center;--input-height:".concat(SCALES.height(2.25), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, defaultWidth), ";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), ";}.input-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;width:").concat(SCALES.width(1, defaultWidth), ";height:var(--input-height);}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:").concat(variant === 'normal' ? theme$1.layout.radius : '', ";").concat(variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), ";-webkit-transition:border 0.2s ease 0s,color 0.2s ease 0s;transition:border 0.2s ease 0s,color 0.2s ease 0s;}.input-wrapper.left-label.__jsx-style-dynamic-selector{border-top-left-radius:0;border-bottom-left-radius:0;}.input-wrapper.right-label.__jsx-style-dynamic-selector{border-top-right-radius:0;border-bottom-right-radius:0;}.input-wrapper.disabled.__jsx-style-dynamic-selector{background-color:").concat(theme$1.palette.accents_1, ";border-color:").concat(theme$1.palette.accents_2, ";cursor:not-allowed;}input.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}.input-wrapper.hover.__jsx-style-dynamic-selector{border-color:").concat(hoverBorder, ";}input.__jsx-style-dynamic-selector{margin:0.25em 0.625em;padding:0;box-shadow:none;font-size:").concat(SCALES.font(0.875), ";background-color:transparent;border:none;color:").concat(theme$1.palette.foreground, ";outline:none;border-radius:0;width:100%;min-width:0;-webkit-appearance:none;}input.left-icon.__jsx-style-dynamic-selector{margin-left:0;}input.right-icon.__jsx-style-dynamic-selector{margin-right:0;}.__jsx-style-dynamic-selector::-webkit-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector::placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector::-ms-reveal{display:none !important;}input.__jsx-style-dynamic-selector:-webkit-autofill,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:hover,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:active,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:focus{-webkit-box-shadow:0 0 0 30px ").concat(theme$1.palette.background, " inset !important;-webkit-text-fill-color:").concat(color, " !important;}")
2131
- })]
2132
- });
2133
- });
2134
- InputComponent.displayName = 'Input';
2135
- var Input = withScale(InputComponent);
2136
-
2137
- var tuple = function tuple() {
2138
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2139
- args[_key] = arguments[_key];
2140
- }
2141
- return args;
2142
- };
2143
- tuple('default', 'secondary', 'success', 'warning', 'error', 'abort', 'secondary-light', 'success-light', 'warning-light', 'error-light');
2144
- tuple('default', 'secondary', 'success', 'warning', 'error');
2145
- tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite');
2146
- tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite', 'alert', 'purple', 'violet', 'cyan');
2147
- tuple('default', 'silent', 'prevent');
2148
- tuple('hover', 'click');
2149
- tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
2150
- tuple('start', 'center', 'end', 'left', 'right');
2151
-
2152
- var _excluded$c = ["type", "disabled", "readOnly", "onFocus", "onBlur", "className", "initialValue", "onChange", "value", "placeholder", "helperText", "error", "label", "required", "resize"];
2153
- tuple('none', 'both', 'horizontal', 'vertical', 'initial', 'inherit');
2154
- var TextareaComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
2155
- var _ref$type = _ref.type,
2156
- type = _ref$type === void 0 ? 'default' : _ref$type,
2157
- _ref$disabled = _ref.disabled,
2158
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
2159
- _ref$readOnly = _ref.readOnly,
2160
- readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
2161
- onFocus = _ref.onFocus,
2162
- onBlur = _ref.onBlur,
2163
- _ref$className = _ref.className,
2164
- className = _ref$className === void 0 ? '' : _ref$className,
2165
- _ref$initialValue = _ref.initialValue,
2166
- initialValue = _ref$initialValue === void 0 ? '' : _ref$initialValue,
2167
- onChange = _ref.onChange,
2168
- value = _ref.value,
2169
- placeholder = _ref.placeholder,
2170
- helperText = _ref.helperText,
2171
- error = _ref.error,
2172
- label = _ref.label,
2173
- required = _ref.required,
2174
- _ref$resize = _ref.resize,
2175
- resize = _ref$resize === void 0 ? 'none' : _ref$resize,
2176
- props = _objectWithoutProperties(_ref, _excluded$c);
2177
- var theme$1 = theme.useTheme();
2178
- var _useScale = useScale(),
2179
- SCALES = _useScale.SCALES;
2180
- var textareaRef = React.useRef(null);
2181
- React.useImperativeHandle(ref, function () {
2182
- return textareaRef.current;
2183
- }); // added not null
2184
- var isControlledComponent = React.useMemo(function () {
2185
- return value !== undefined;
2186
- }, [value]);
1512
+ return textareaRef.current;
1513
+ }); // added not null
1514
+ var isControlledComponent = React.useMemo(function () {
1515
+ return value !== undefined;
1516
+ }, [value]);
2187
1517
  var _useState = React.useState(initialValue),
2188
1518
  _useState2 = _slicedToArray(_useState, 2),
2189
1519
  selfValue = _useState2[0],
@@ -2297,11 +1627,11 @@ var PasswordIcon = function PasswordIcon(_ref) {
2297
1627
  };
2298
1628
  var MemoPasswordIcon = /*#__PURE__*/React.memo(PasswordIcon);
2299
1629
 
2300
- var _excluded$b = ["hideToggle", "children"];
1630
+ var _excluded$e = ["hideToggle", "children"];
2301
1631
  var InputPasswordComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
2302
1632
  var hideToggle = _ref.hideToggle,
2303
1633
  children = _ref.children,
2304
- props = _objectWithoutProperties(_ref, _excluded$b);
1634
+ props = _objectWithoutProperties(_ref, _excluded$e);
2305
1635
  var _useScale = useScale(),
2306
1636
  getAllScaleProps = _useScale.getAllScaleProps;
2307
1637
  var inputRef = React.useRef(null);
@@ -3909,7 +3239,7 @@ var repositionCursor = function repositionCursor(_ref) {
3909
3239
  };
3910
3240
  };
3911
3241
 
3912
- var _excluded$a = ["allowDecimals", "allowNegativeValue", "id", "name", "className", "customInput", "decimalsLimit", "defaultValue", "disabled", "maxLength", "value", "onValueChange", "fixedDecimalLength", "placeholder", "decimalScale", "prefix", "suffix", "intlConfig", "fullWidth", "step", "min", "max", "disableGroupSeparators", "disableAbbreviations", "decimalSeparator", "groupSeparator", "onChange", "onFocus", "onBlur", "onKeyDown", "onKeyUp", "transformRawValue", "formatValueOnBlur", "children"];
3242
+ var _excluded$d = ["allowDecimals", "allowNegativeValue", "id", "name", "className", "customInput", "decimalsLimit", "defaultValue", "disabled", "maxLength", "value", "onValueChange", "fixedDecimalLength", "placeholder", "decimalScale", "prefix", "suffix", "intlConfig", "fullWidth", "step", "min", "max", "disableGroupSeparators", "disableAbbreviations", "decimalSeparator", "groupSeparator", "onChange", "onFocus", "onBlur", "onKeyDown", "onKeyUp", "transformRawValue", "formatValueOnBlur", "children"];
3913
3243
  var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3914
3244
  var _ref$allowDecimals = _ref.allowDecimals,
3915
3245
  allowDecimals = _ref$allowDecimals === void 0 ? true : _ref$allowDecimals,
@@ -3951,7 +3281,7 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3951
3281
  _ref$formatValueOnBlu = _ref.formatValueOnBlur,
3952
3282
  formatValueOnBlur = _ref$formatValueOnBlu === void 0 ? true : _ref$formatValueOnBlu,
3953
3283
  children = _ref.children,
3954
- props = _objectWithoutProperties(_ref, _excluded$a);
3284
+ props = _objectWithoutProperties(_ref, _excluded$d);
3955
3285
  var _useScale = useScale(),
3956
3286
  SCALES = _useScale.SCALES;
3957
3287
  var theme$1 = theme.useTheme();
@@ -21494,11 +20824,11 @@ var SelectIcon = /*#__PURE__*/React.memo(SelectIconComponent);
21494
20824
 
21495
20825
  /* "use client" */
21496
20826
 
21497
- var defaultContext$2 = {
20827
+ var defaultContext$3 = {
21498
20828
  visible: false,
21499
20829
  disableAll: false
21500
20830
  };
21501
- var SelectContext = /*#__PURE__*/React.createContext(defaultContext$2);
20831
+ var SelectContext = /*#__PURE__*/React.createContext(defaultContext$3);
21502
20832
  var useSelectContext = function useSelectContext() {
21503
20833
  return React.useContext(SelectContext);
21504
20834
  };
@@ -21539,7 +20869,7 @@ var SelectDropdown = /*#__PURE__*/React.forwardRef(function (_ref, dropdownRef)
21539
20869
  });
21540
20870
  SelectDropdown.displayName = 'SelectDropdown';
21541
20871
 
21542
- var _excluded$9 = ["xs", "sm", "md", "lg", "xl", "justify", "direction", "alignItems", "alignContent", "children", "className"];
20872
+ var _excluded$c = ["xs", "sm", "md", "lg", "xl", "justify", "direction", "alignItems", "alignContent", "children", "className"];
21543
20873
  var getItemLayout = function getItemLayout(val) {
21544
20874
  var display = val === 0 ? 'display: none;' : 'display: inherit;';
21545
20875
  if (typeof val === 'number') {
@@ -21577,7 +20907,7 @@ var GridBasicItem = function GridBasicItem(_ref) {
21577
20907
  children = _ref.children,
21578
20908
  _ref$className = _ref.className,
21579
20909
  className = _ref$className === void 0 ? '' : _ref$className,
21580
- props = _objectWithoutProperties(_ref, _excluded$9);
20910
+ props = _objectWithoutProperties(_ref, _excluded$c);
21581
20911
  var theme$1 = theme.useTheme();
21582
20912
  var _useScale = useScale(),
21583
20913
  SCALES = _useScale.SCALES;
@@ -21619,12 +20949,12 @@ var GridBasicItem = function GridBasicItem(_ref) {
21619
20949
  };
21620
20950
  GridBasicItem.displayName = 'GridBasicItem';
21621
20951
 
21622
- var _excluded$8 = ["children", "className"];
20952
+ var _excluded$b = ["children", "className"];
21623
20953
  var GridComponent = function GridComponent(_ref) {
21624
20954
  var children = _ref.children,
21625
20955
  _ref$className = _ref.className,
21626
20956
  className = _ref$className === void 0 ? '' : _ref$className,
21627
- props = _objectWithoutProperties(_ref, _excluded$8);
20957
+ props = _objectWithoutProperties(_ref, _excluded$b);
21628
20958
  var _useScale = useScale(),
21629
20959
  SCALES = _useScale.SCALES;
21630
20960
  var _styles$className = {
@@ -21647,7 +20977,7 @@ var GridComponent = function GridComponent(_ref) {
21647
20977
  GridComponent.displayName = 'Grid';
21648
20978
  var Grid = withScale(GridComponent);
21649
20979
 
21650
- var _excluded$7 = ["gap", "wrap", "children", "className"];
20980
+ var _excluded$a = ["gap", "wrap", "children", "className"];
21651
20981
  var GridContainerComponent = function GridContainerComponent(_ref) {
21652
20982
  var _ref$gap = _ref.gap,
21653
20983
  gap = _ref$gap === void 0 ? 0 : _ref$gap,
@@ -21656,7 +20986,7 @@ var GridContainerComponent = function GridContainerComponent(_ref) {
21656
20986
  children = _ref.children,
21657
20987
  _ref$className = _ref.className,
21658
20988
  className = _ref$className === void 0 ? '' : _ref$className,
21659
- props = _objectWithoutProperties(_ref, _excluded$7);
20989
+ props = _objectWithoutProperties(_ref, _excluded$a);
21660
20990
  var _useScale = useScale(),
21661
20991
  unit = _useScale.unit,
21662
20992
  SCALES = _useScale.SCALES;
@@ -21813,7 +21143,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (_ref, inputRef) {
21813
21143
  });
21814
21144
  SelectInput.displayName = 'SelectInput';
21815
21145
 
21816
- var _excluded$6 = ["children", "label", "type", "disabled", "initialValue", "value", "icon", "onChange", "pure", "multiple", "fullWidth", "clearable", "placeholder", "className", "dropdownClassName", "dropdownStyle", "disableMatchWidth", "helperText", "error", "required", "getPopupContainer", "onDropdownVisibleChange"];
21146
+ var _excluded$9 = ["children", "label", "type", "disabled", "initialValue", "value", "icon", "onChange", "pure", "multiple", "fullWidth", "clearable", "placeholder", "className", "dropdownClassName", "dropdownStyle", "disableMatchWidth", "helperText", "error", "required", "getPopupContainer", "onDropdownVisibleChange"];
21817
21147
  var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
21818
21148
  var children = _ref.children,
21819
21149
  label = _ref.label,
@@ -21847,7 +21177,7 @@ var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
21847
21177
  getPopupContainer = _ref.getPopupContainer,
21848
21178
  _ref$onDropdownVisibl = _ref.onDropdownVisibleChange,
21849
21179
  onDropdownVisibleChange = _ref$onDropdownVisibl === void 0 ? function () {} : _ref$onDropdownVisibl,
21850
- props = _objectWithoutProperties(_ref, _excluded$6);
21180
+ props = _objectWithoutProperties(_ref, _excluded$9);
21851
21181
  var theme$1 = theme.useTheme();
21852
21182
  var _useScale = useScale(),
21853
21183
  SCALES = _useScale.SCALES;
@@ -22050,7 +21380,7 @@ var useWarning = function useWarning(message, component) {
22050
21380
  console.warn(log);
22051
21381
  };
22052
21382
 
22053
- var _excluded$5 = ["value", "className", "children", "disabled", "divider", "label", "preventAllEvents"];
21383
+ var _excluded$8 = ["value", "className", "children", "disabled", "divider", "label", "preventAllEvents"];
22054
21384
  var SelectOptionComponent = function SelectOptionComponent(_ref) {
22055
21385
  var identValue = _ref.value,
22056
21386
  _ref$className = _ref.className,
@@ -22064,7 +21394,7 @@ var SelectOptionComponent = function SelectOptionComponent(_ref) {
22064
21394
  label = _ref$label === void 0 ? false : _ref$label,
22065
21395
  _ref$preventAllEvents = _ref.preventAllEvents,
22066
21396
  preventAllEvents = _ref$preventAllEvents === void 0 ? false : _ref$preventAllEvents,
22067
- props = _objectWithoutProperties(_ref, _excluded$5);
21397
+ props = _objectWithoutProperties(_ref, _excluded$8);
22068
21398
  var theme$1 = theme.useTheme();
22069
21399
  var _useScale = useScale(),
22070
21400
  SCALES = _useScale.SCALES;
@@ -23051,11 +22381,11 @@ var TableCell = function TableCell(_ref) {
23051
22381
 
23052
22382
  /* "use client" */
23053
22383
 
23054
- var defaultContext$1 = {
22384
+ var defaultContext$2 = {
23055
22385
  columns: [],
23056
22386
  updateColumn: function updateColumn() {}
23057
22387
  };
23058
- var TableContext = /*#__PURE__*/React.createContext(defaultContext$1);
22388
+ var TableContext = /*#__PURE__*/React.createContext(defaultContext$2);
23059
22389
  var useTableContext = function useTableContext() {
23060
22390
  return React.useContext(TableContext);
23061
22391
  };
@@ -23341,13 +22671,48 @@ var TableColumn = function TableColumn(columnProps) {
23341
22671
  };
23342
22672
  TableColumn.displayName = 'TableColumn';
23343
22673
 
23344
- var _excluded$4 = ["active", "children", "disabled", "onClick"];
22674
+ var hexToRgb = function hexToRgb(color) {
22675
+ var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
22676
+ var full = color.replace(fullReg, function (_, r, g, b) {
22677
+ return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
22678
+ });
22679
+ var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
22680
+ if (!values) {
22681
+ throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
22682
+ }
22683
+ return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
22684
+ };
22685
+ var colorToRgbValues = function colorToRgbValues(color) {
22686
+ if (color.charAt(0) === '#') return hexToRgb(color);
22687
+ var safeColor = color.replace(/ /g, '');
22688
+ var colorType = color.substr(0, 4);
22689
+ var regArray = safeColor.match(/\((.+)\)/);
22690
+ if (!colorType.startsWith('rgb') || !regArray) {
22691
+ console.log(color);
22692
+ throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
22693
+ }
22694
+ return regArray[1].split(',').map(function (str) {
22695
+ return Number.parseFloat(str);
22696
+ });
22697
+ };
22698
+ var addColorAlpha = function addColorAlpha(color, alpha) {
22699
+ if (!/^#|rgb|RGB/.test(color)) return color;
22700
+ var _colorToRgbValues = colorToRgbValues(color),
22701
+ _colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
22702
+ r = _colorToRgbValues2[0],
22703
+ g = _colorToRgbValues2[1],
22704
+ b = _colorToRgbValues2[2];
22705
+ var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
22706
+ return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
22707
+ };
22708
+
22709
+ var _excluded$7 = ["active", "children", "disabled", "onClick"];
23345
22710
  var PaginationItem = function PaginationItem(_ref) {
23346
22711
  var active = _ref.active,
23347
22712
  children = _ref.children,
23348
22713
  disabled = _ref.disabled,
23349
22714
  onClick = _ref.onClick,
23350
- props = _objectWithoutProperties(_ref, _excluded$4);
22715
+ props = _objectWithoutProperties(_ref, _excluded$7);
23351
22716
  var theme$1 = theme.useTheme();
23352
22717
  var _useMemo = React.useMemo(function () {
23353
22718
  return [addColorAlpha(theme$1.palette.accents_7, 0.1), addColorAlpha(theme$1.palette.accents_7, 0.8)];
@@ -23382,16 +22747,16 @@ PaginationItem.displayName = 'PaginationItem';
23382
22747
  /* "use client" */
23383
22748
 
23384
22749
  tuple('prev', 'next', 'click');
23385
- var defaultContext = {};
23386
- var PaginationContext = /*#__PURE__*/React.createContext(defaultContext);
22750
+ var defaultContext$1 = {};
22751
+ var PaginationContext = /*#__PURE__*/React.createContext(defaultContext$1);
23387
22752
  var usePaginationContext = function usePaginationContext() {
23388
22753
  return React.useContext(PaginationContext);
23389
22754
  };
23390
22755
 
23391
- var _excluded$3 = ["children"];
22756
+ var _excluded$6 = ["children"];
23392
22757
  var PaginationPrevious = function PaginationPrevious(_ref) {
23393
22758
  var children = _ref.children,
23394
- props = _objectWithoutProperties(_ref, _excluded$3);
22759
+ props = _objectWithoutProperties(_ref, _excluded$6);
23395
22760
  var _usePaginationContext = usePaginationContext(),
23396
22761
  update = _usePaginationContext.update,
23397
22762
  isFirst = _usePaginationContext.isFirst;
@@ -23406,10 +22771,10 @@ var PaginationPrevious = function PaginationPrevious(_ref) {
23406
22771
  };
23407
22772
  PaginationPrevious.displayName = 'PaginationPrevious';
23408
22773
 
23409
- var _excluded$2 = ["children"];
22774
+ var _excluded$5 = ["children"];
23410
22775
  var PaginationNext = function PaginationNext(_ref) {
23411
22776
  var children = _ref.children,
23412
- props = _objectWithoutProperties(_ref, _excluded$2);
22777
+ props = _objectWithoutProperties(_ref, _excluded$5);
23413
22778
  var _usePaginationContext = usePaginationContext(),
23414
22779
  update = _usePaginationContext.update,
23415
22780
  isLast = _usePaginationContext.isLast;
@@ -23576,7 +22941,7 @@ var PaginationPages = function PaginationPages(_ref) {
23576
22941
  };
23577
22942
  PaginationPages.displayName = 'PaginationPages';
23578
22943
 
23579
- var _excluded$1 = ["page", "initialPage", "count", "limit", "children", "onChange", "className"];
22944
+ var _excluded$4 = ["page", "initialPage", "count", "limit", "children", "onChange", "className"];
23580
22945
  var PaginationComponent = function PaginationComponent(_ref) {
23581
22946
  var customPage = _ref.page,
23582
22947
  _ref$initialPage = _ref.initialPage,
@@ -23589,84 +22954,694 @@ var PaginationComponent = function PaginationComponent(_ref) {
23589
22954
  onChange = _ref.onChange,
23590
22955
  _ref$className = _ref.className,
23591
22956
  className = _ref$className === void 0 ? '' : _ref$className,
23592
- props = _objectWithoutProperties(_ref, _excluded$1);
22957
+ props = _objectWithoutProperties(_ref, _excluded$4);
22958
+ var _useScale = useScale(),
22959
+ SCALES = _useScale.SCALES;
22960
+ var _useCurrentState = theme.useCurrentState(initialPage),
22961
+ _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
22962
+ page = _useCurrentState2[0],
22963
+ setPage = _useCurrentState2[1],
22964
+ pageRef = _useCurrentState2[2];
22965
+ var _pickChild = pickChild(children, PaginationPrevious),
22966
+ _pickChild2 = _slicedToArray(_pickChild, 2),
22967
+ prevChildren = _pickChild2[1];
22968
+ var _pickChild3 = pickChild(children, PaginationNext),
22969
+ _pickChild4 = _slicedToArray(_pickChild3, 2),
22970
+ nextChildren = _pickChild4[1];
22971
+ var _useMemo = React.useMemo(function () {
22972
+ var hasChildren = function hasChildren(c) {
22973
+ return React.Children.count(c) > 0;
22974
+ };
22975
+ var prevDefault = /*#__PURE__*/jsxRuntime.jsx(PaginationPrevious, {
22976
+ children: "prev"
22977
+ });
22978
+ var nextDefault = /*#__PURE__*/jsxRuntime.jsx(PaginationNext, {
22979
+ children: "next"
22980
+ });
22981
+ return [hasChildren(prevChildren) ? prevChildren : prevDefault, hasChildren(nextChildren) ? nextChildren : nextDefault];
22982
+ }, [prevChildren, nextChildren]),
22983
+ _useMemo2 = _slicedToArray(_useMemo, 2),
22984
+ prevItem = _useMemo2[0],
22985
+ nextItem = _useMemo2[1];
22986
+ var update = function update(type) {
22987
+ if (type === 'prev' && pageRef.current > 1) {
22988
+ setPage(function (last) {
22989
+ return last - 1;
22990
+ });
22991
+ }
22992
+ if (type === 'next' && pageRef.current < count) {
22993
+ setPage(function (last) {
22994
+ return last + 1;
22995
+ });
22996
+ }
22997
+ };
22998
+ var values = React.useMemo(function () {
22999
+ return {
23000
+ isFirst: page <= 1,
23001
+ isLast: page >= count,
23002
+ update: update
23003
+ };
23004
+ }, [page, count]);
23005
+ React.useEffect(function () {
23006
+ onChange && onChange(page);
23007
+ }, [page]);
23008
+ React.useEffect(function () {
23009
+ if (customPage !== undefined) {
23010
+ setPage(customPage);
23011
+ }
23012
+ }, [customPage]);
23013
+ return /*#__PURE__*/jsxRuntime.jsxs(PaginationContext.Provider, {
23014
+ value: values,
23015
+ children: [/*#__PURE__*/jsxRuntime.jsxs("nav", _objectSpread2(_objectSpread2({}, props), {}, {
23016
+ className: _JSXStyle.dynamic([["3826701357", [SCALES.font(2), SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || ""),
23017
+ children: [prevItem, /*#__PURE__*/jsxRuntime.jsx(PaginationPages, {
23018
+ count: count,
23019
+ current: page,
23020
+ limit: limit,
23021
+ setPage: setPage
23022
+ }), nextItem]
23023
+ })), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
23024
+ id: "3826701357",
23025
+ dynamic: [SCALES.font(2), SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)],
23026
+ children: "nav.__jsx-style-dynamic-selector{font-variant:tabular-nums;font-feature-settings:'tnum';--pagination-size:".concat(SCALES.font(2), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";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), ";}nav.__jsx-style-dynamic-selector button:last-of-type{margin-right:0;}")
23027
+ })]
23028
+ });
23029
+ };
23030
+ PaginationComponent.displayName = 'Pagination';
23031
+ var Pagination = withScale(PaginationComponent);
23032
+
23033
+ Pagination.Previous = PaginationPrevious;
23034
+ Pagination.Next = PaginationNext;
23035
+
23036
+ var ButtonDrip = function ButtonDrip(_ref) {
23037
+ var _ref$x = _ref.x,
23038
+ x = _ref$x === void 0 ? 0 : _ref$x,
23039
+ _ref$y = _ref.y,
23040
+ y = _ref$y === void 0 ? 0 : _ref$y,
23041
+ color = _ref.color,
23042
+ onCompleted = _ref.onCompleted;
23043
+ var dripRef = React.useRef(null);
23044
+ /* istanbul ignore next */
23045
+ var top = Number.isNaN(+y) ? 0 : y - 10;
23046
+ /* istanbul ignore next */
23047
+ var left = Number.isNaN(+x) ? 0 : x - 10;
23048
+ React.useEffect(function () {
23049
+ /* istanbul ignore next */
23050
+ if (!dripRef.current) return;
23051
+ dripRef.current.addEventListener('animationend', onCompleted);
23052
+ return function () {
23053
+ /* istanbul ignore next */
23054
+ if (!dripRef.current) return;
23055
+ dripRef.current.removeEventListener('animationend', onCompleted);
23056
+ };
23057
+ });
23058
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
23059
+ ref: dripRef,
23060
+ className: "jsx-3424889537" + " " + "drip",
23061
+ children: [/*#__PURE__*/jsxRuntime.jsx("svg", {
23062
+ width: "20",
23063
+ height: "20",
23064
+ viewBox: "0 0 20 20",
23065
+ style: {
23066
+ top: top,
23067
+ left: left
23068
+ },
23069
+ className: "jsx-3424889537",
23070
+ children: /*#__PURE__*/jsxRuntime.jsx("g", {
23071
+ stroke: "none",
23072
+ strokeWidth: "1",
23073
+ fill: "none",
23074
+ fillRule: "evenodd",
23075
+ className: "jsx-3424889537",
23076
+ children: /*#__PURE__*/jsxRuntime.jsx("g", {
23077
+ fill: color,
23078
+ className: "jsx-3424889537",
23079
+ children: /*#__PURE__*/jsxRuntime.jsx("rect", {
23080
+ width: "100%",
23081
+ height: "100%",
23082
+ rx: "10",
23083
+ className: "jsx-3424889537"
23084
+ })
23085
+ })
23086
+ })
23087
+ }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
23088
+ id: "3424889537",
23089
+ children: ".drip.jsx-3424889537{position:absolute;left:0;right:0;top:0;bottom:0;}svg.jsx-3424889537{position:absolute;-webkit-animation:350ms ease-in expand-jsx-3424889537;animation:350ms ease-in expand-jsx-3424889537;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;width:1rem;height:1rem;}@-webkit-keyframes expand-jsx-3424889537{0%{opacity:0;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}30%{opacity:1;}80%{opacity:0.5;}100%{-webkit-transform:scale(28);-ms-transform:scale(28);transform:scale(28);opacity:0;}}@keyframes expand-jsx-3424889537{0%{opacity:0;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}30%{opacity:1;}80%{opacity:0.5;}100%{-webkit-transform:scale(28);-ms-transform:scale(28);transform:scale(28);opacity:0;}}"
23090
+ })]
23091
+ });
23092
+ };
23093
+ ButtonDrip.displayName = 'ButtonDrip';
23094
+
23095
+ var _excluded$3 = ["children", "type", "color", "className", "spaceRatio"];
23096
+ var getIconBgColor = function getIconBgColor(type, palette, color) {
23097
+ var colors = {
23098
+ "default": palette.accents_6,
23099
+ secondary: palette.secondary,
23100
+ success: palette.success,
23101
+ warning: palette.warning,
23102
+ error: palette.error
23103
+ };
23104
+ return color ? color : colors[type];
23105
+ };
23106
+ var LoadingComponent = function LoadingComponent(_ref) {
23107
+ var children = _ref.children,
23108
+ _ref$type = _ref.type,
23109
+ type = _ref$type === void 0 ? 'default' : _ref$type,
23110
+ color = _ref.color,
23111
+ _ref$className = _ref.className,
23112
+ className = _ref$className === void 0 ? '' : _ref$className,
23113
+ _ref$spaceRatio = _ref.spaceRatio,
23114
+ spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
23115
+ props = _objectWithoutProperties(_ref, _excluded$3);
23116
+ var theme$1 = theme.useTheme();
23117
+ var _useScale = useScale(),
23118
+ SCALES = _useScale.SCALES;
23119
+ var classes = theme.useClasses('loading-container', className);
23120
+ var bgColor = React.useMemo(function () {
23121
+ return getIconBgColor(type, theme$1.palette, color);
23122
+ }, [type, theme$1.palette, color]);
23123
+ return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread2(_objectSpread2({}, props), {}, {
23124
+ 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 || ""),
23125
+ children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
23126
+ 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",
23127
+ children: [children && /*#__PURE__*/jsxRuntime.jsx("label", {
23128
+ 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]]]),
23129
+ children: children
23130
+ }), /*#__PURE__*/jsxRuntime.jsx("i", {
23131
+ 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]]])
23132
+ }), /*#__PURE__*/jsxRuntime.jsx("i", {
23133
+ 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]]])
23134
+ }), /*#__PURE__*/jsxRuntime.jsx("i", {
23135
+ 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]]])
23136
+ })]
23137
+ }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
23138
+ id: "2201634259",
23139
+ 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],
23140
+ children: ".loading-container.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;position:relative;font-size:".concat(SCALES.font(1), ";width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, '100%'), ";min-height:1em;padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}label.__jsx-style-dynamic-selector{margin-right:0.5em;color:").concat(theme$1.palette.accents_5, ";line-height:1;}label.__jsx-style-dynamic-selector *{margin:0;}.loading.__jsx-style-dynamic-selector{position:absolute;top:50%;left:50%;width:100%;height:100%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:transparent;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}i.__jsx-style-dynamic-selector{width:0.25em;height:0.25em;border-radius:50%;background-color:").concat(bgColor, ";margin:0 calc(0.25em / 2 * ").concat(spaceRatio, ");display:inline-block;-webkit-animation:loading-blink-__jsx-style-dynamic-selector 1.4s infinite both;animation:loading-blink-__jsx-style-dynamic-selector 1.4s infinite both;}i.__jsx-style-dynamic-selector:nth-child(2){-webkit-animation-delay:0.2s;animation-delay:0.2s;}i.__jsx-style-dynamic-selector:nth-child(3){-webkit-animation-delay:0.4s;animation-delay:0.4s;}@-webkit-keyframes loading-blink-__jsx-style-dynamic-selector{0%{opacity:0.2;}20%{opacity:1;}100%{opacity:0.2;}}@keyframes loading-blink-__jsx-style-dynamic-selector{0%{opacity:0.2;}20%{opacity:1;}100%{opacity:0.2;}}")
23141
+ })]
23142
+ }));
23143
+ };
23144
+ LoadingComponent.displayName = 'Loading';
23145
+ var Loading = withScale(LoadingComponent);
23146
+
23147
+ var ButtonLoading = function ButtonLoading(_ref) {
23148
+ var color = _ref.color;
23149
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
23150
+ className: "jsx-212623367" + " " + "btn-loading",
23151
+ children: [/*#__PURE__*/jsxRuntime.jsx(Loading, {
23152
+ color: color
23153
+ }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
23154
+ id: "212623367",
23155
+ children: ".btn-loading.jsx-212623367{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;background-color:var(--helpdice-ui-button-bg);}"
23156
+ })]
23157
+ });
23158
+ };
23159
+ ButtonLoading.displayName = 'ButtonLoading';
23160
+
23161
+ var _excluded$2 = ["isRight", "isSingle", "children", "className"];
23162
+ var ButtonIcon = function ButtonIcon(_ref) {
23163
+ var _ref$isRight = _ref.isRight,
23164
+ isRight = _ref$isRight === void 0 ? false : _ref$isRight,
23165
+ isSingle = _ref.isSingle,
23166
+ children = _ref.children,
23167
+ _ref$className = _ref.className,
23168
+ className = _ref$className === void 0 ? '' : _ref$className,
23169
+ props = _objectWithoutProperties(_ref, _excluded$2);
23170
+ var classes = theme.useClasses('icon', {
23171
+ right: isRight,
23172
+ single: isSingle
23173
+ }, className);
23174
+ return /*#__PURE__*/jsxRuntime.jsxs("span", _objectSpread2(_objectSpread2({}, props), {}, {
23175
+ className: "jsx-2467502931" + " " + (props && props.className != null && props.className || classes || ""),
23176
+ children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
23177
+ id: "2467502931",
23178
+ children: ".icon.jsx-2467502931{position:absolute;left:var(--helpdice-ui-button-icon-padding);right:auto;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--helpdice-ui-button-color);z-index:1;}.right.jsx-2467502931{right:var(--helpdice-ui-button-icon-padding);left:auto;}.icon.jsx-2467502931 svg{background:transparent;height:calc(var(--helpdice-ui-button-height) / 2.35);width:calc(var(--helpdice-ui-button-height) / 2.35);}.single.jsx-2467502931{position:static;-webkit-transform:none;-ms-transform:none;transform:none;}"
23179
+ })]
23180
+ }));
23181
+ };
23182
+ ButtonIcon.displayName = 'ButtonIcon';
23183
+
23184
+ var getButtonChildrenWithIcon = function getButtonChildrenWithIcon(auto, children, icons) {
23185
+ var icon = icons.icon,
23186
+ iconRight = icons.iconRight;
23187
+ var hasIcon = icon || iconRight;
23188
+ var isRight = Boolean(iconRight);
23189
+ var paddingForAutoMode = auto ? "calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding) * .5)" : 0;
23190
+ var classes = theme.useClasses('text', isRight ? 'right' : 'left');
23191
+ if (!hasIcon) return /*#__PURE__*/jsxRuntime.jsx("div", {
23192
+ className: "text",
23193
+ children: children
23194
+ });
23195
+ if (React.Children.count(children) === 0) {
23196
+ return /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
23197
+ isRight: isRight,
23198
+ isSingle: true,
23199
+ children: hasIcon
23200
+ });
23201
+ }
23202
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
23203
+ children: [/*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
23204
+ isRight: isRight,
23205
+ children: hasIcon
23206
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
23207
+ className: _JSXStyle.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || ""),
23208
+ children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
23209
+ id: "3568181479",
23210
+ dynamic: [paddingForAutoMode, paddingForAutoMode],
23211
+ children: ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}")
23212
+ })]
23213
+ })]
23214
+ });
23215
+ };
23216
+ var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
23217
+ if (!config.isButtonGroup) return props;
23218
+ return _objectSpread2(_objectSpread2({}, props), {}, {
23219
+ auto: true,
23220
+ shadow: false,
23221
+ ghost: config.ghost || props.ghost,
23222
+ type: config.type || props.type,
23223
+ disabled: config.disabled || props.disabled
23224
+ });
23225
+ };
23226
+
23227
+ /* "use client" */
23228
+
23229
+ var defaultContext = {
23230
+ isButtonGroup: false,
23231
+ disabled: false
23232
+ };
23233
+ var ButtonGroupContext = /*#__PURE__*/React.createContext(defaultContext);
23234
+ var useButtonGroupContext = function useButtonGroupContext() {
23235
+ return React.useContext(ButtonGroupContext);
23236
+ };
23237
+
23238
+ var getButtonGhostColors = function getButtonGhostColors(palette, _color) {
23239
+ var colors = {
23240
+ secondary: {
23241
+ bg: palette.background,
23242
+ border: palette.foreground,
23243
+ color: palette.foreground,
23244
+ ripple: ''
23245
+ },
23246
+ success: {
23247
+ bg: palette.background,
23248
+ border: palette.success,
23249
+ color: palette.success,
23250
+ ripple: ''
23251
+ },
23252
+ warning: {
23253
+ bg: palette.background,
23254
+ border: palette.warning,
23255
+ color: palette.warning,
23256
+ ripple: ''
23257
+ },
23258
+ error: {
23259
+ bg: palette.background,
23260
+ border: palette.error,
23261
+ color: palette.error,
23262
+ ripple: ''
23263
+ }
23264
+ };
23265
+ return colors[_color] || null;
23266
+ };
23267
+ var getButtonColors = function getButtonColors(palette, props) {
23268
+ var color = props.color,
23269
+ disabled = props.disabled,
23270
+ ghost = props.ghost;
23271
+ var colors = {
23272
+ "default": {
23273
+ bg: palette.background,
23274
+ border: palette.border,
23275
+ color: palette.accents_5,
23276
+ ripple: palette.accents_1
23277
+ },
23278
+ secondary: {
23279
+ bg: palette.foreground,
23280
+ border: palette.foreground,
23281
+ color: palette.background,
23282
+ ripple: palette.accents_1
23283
+ },
23284
+ success: {
23285
+ bg: palette.success,
23286
+ border: palette.success,
23287
+ color: '#fff',
23288
+ ripple: '#1f93ffff'
23289
+ },
23290
+ warning: {
23291
+ bg: palette.warning,
23292
+ border: palette.warning,
23293
+ color: '#fff',
23294
+ ripple: '#ffca29ff'
23295
+ },
23296
+ error: {
23297
+ bg: palette.error,
23298
+ border: palette.error,
23299
+ color: '#fff',
23300
+ ripple: '#ff5a55ff'
23301
+ },
23302
+ abort: {
23303
+ bg: 'transparent',
23304
+ border: 'transparent',
23305
+ color: palette.accents_5,
23306
+ ripple: palette.accents_1
23307
+ }
23308
+ };
23309
+ if (disabled) return {
23310
+ bg: palette.accents_1,
23311
+ border: palette.accents_2,
23312
+ color: '#ccc',
23313
+ ripple: ''
23314
+ };
23315
+
23316
+ /**
23317
+ * The '-light' type is the same color as the common type,
23318
+ * only hover's color is different.
23319
+ * e.g.
23320
+ * Color['success'] === Color['success-light']
23321
+ * Color['warning'] === Color['warning-light']
23322
+ */
23323
+ var withoutLightType = color === null || color === void 0 ? void 0 : color.replace('-light', '');
23324
+ var defaultColor = colors["default"];
23325
+ if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
23326
+ return colors[withoutLightType] || defaultColor;
23327
+ };
23328
+ var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, _color) {
23329
+ var colors = {
23330
+ secondary: {
23331
+ bg: palette.foreground,
23332
+ border: palette.background,
23333
+ color: palette.background
23334
+ },
23335
+ success: {
23336
+ bg: palette.success,
23337
+ border: palette.background,
23338
+ color: 'white'
23339
+ },
23340
+ warning: {
23341
+ bg: palette.warning,
23342
+ border: palette.background,
23343
+ color: 'white'
23344
+ },
23345
+ error: {
23346
+ bg: palette.error,
23347
+ border: palette.background,
23348
+ color: 'white'
23349
+ }
23350
+ };
23351
+ var withoutLightType = _color === null || _color === void 0 ? void 0 : _color.replace('-light', '');
23352
+ return colors[withoutLightType] || null;
23353
+ };
23354
+ var getButtonHoverColors = function getButtonHoverColors(palette, props) {
23355
+ var color = props.color,
23356
+ disabled = props.disabled,
23357
+ loading = props.loading,
23358
+ shadow = props.shadow,
23359
+ ghost = props.ghost;
23360
+ var defaultColor = getButtonColors(palette, props);
23361
+ var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
23362
+ var colors = {
23363
+ "default": {
23364
+ bg: palette.background,
23365
+ border: palette.foreground
23366
+ },
23367
+ secondary: {
23368
+ bg: palette.background,
23369
+ border: palette.foreground
23370
+ },
23371
+ success: {
23372
+ bg: palette.background,
23373
+ border: palette.success
23374
+ },
23375
+ warning: {
23376
+ bg: palette.background,
23377
+ border: palette.warning
23378
+ },
23379
+ error: {
23380
+ bg: palette.background,
23381
+ border: palette.error
23382
+ },
23383
+ abort: {
23384
+ bg: 'transparent',
23385
+ border: 'transparent',
23386
+ color: palette.accents_5
23387
+ },
23388
+ 'secondary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
23389
+ bg: alphaBackground
23390
+ }),
23391
+ 'success-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
23392
+ bg: alphaBackground
23393
+ }),
23394
+ 'warning-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
23395
+ bg: alphaBackground
23396
+ }),
23397
+ 'error-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
23398
+ bg: alphaBackground
23399
+ })
23400
+ };
23401
+ if (disabled) return {
23402
+ bg: palette.accents_1,
23403
+ border: palette.accents_2,
23404
+ color: '#ccc'
23405
+ };
23406
+ if (loading) return _objectSpread2(_objectSpread2({}, defaultColor), {}, {
23407
+ color: 'transparent'
23408
+ });
23409
+ if (shadow) return defaultColor;
23410
+ var hoverColor = (ghost ? getButtonGhostHoverColors(palette, color) : colors[color]) || colors["default"];
23411
+ return _objectSpread2(_objectSpread2({}, hoverColor), {}, {
23412
+ color: hoverColor.color || hoverColor.border
23413
+ });
23414
+ };
23415
+ var getButtonCursor = function getButtonCursor(disabled, loading) {
23416
+ if (disabled) return {
23417
+ cursor: 'not-allowed',
23418
+ events: 'auto'
23419
+ };
23420
+ if (loading) return {
23421
+ cursor: 'default',
23422
+ events: 'none'
23423
+ };
23424
+ return {
23425
+ cursor: 'pointer',
23426
+ events: 'auto'
23427
+ };
23428
+ };
23429
+ var getButtonDripColor = function getButtonDripColor(palette, props) {
23430
+ var type = props.type;
23431
+ var isLightHover = type ? type.endsWith('light') : false;
23432
+ var hoverColors = getButtonHoverColors(palette, props);
23433
+ return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
23434
+ };
23435
+
23436
+ var _excluded$1 = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "relative", "replace", "a", "to", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
23437
+ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
23438
+ var theme$1 = theme.useTheme();
23439
+ // const navigate = useNavigate();
23593
23440
  var _useScale = useScale(),
23594
23441
  SCALES = _useScale.SCALES;
23595
- var _useCurrentState = theme.useCurrentState(initialPage),
23596
- _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
23597
- page = _useCurrentState2[0],
23598
- setPage = _useCurrentState2[1],
23599
- pageRef = _useCurrentState2[2];
23600
- var _pickChild = pickChild(children, PaginationPrevious),
23601
- _pickChild2 = _slicedToArray(_pickChild, 2),
23602
- prevChildren = _pickChild2[1];
23603
- var _pickChild3 = pickChild(children, PaginationNext),
23604
- _pickChild4 = _slicedToArray(_pickChild3, 2),
23605
- nextChildren = _pickChild4[1];
23442
+ var buttonRef = React.useRef(null);
23443
+ React.useImperativeHandle(ref, function () {
23444
+ return buttonRef.current;
23445
+ }); // Changed with !
23446
+
23447
+ var _useState = React.useState(false),
23448
+ _useState2 = _slicedToArray(_useState, 2),
23449
+ dripShow = _useState2[0],
23450
+ setDripShow = _useState2[1];
23451
+ var _useState3 = React.useState(0),
23452
+ _useState4 = _slicedToArray(_useState3, 2),
23453
+ dripX = _useState4[0],
23454
+ setDripX = _useState4[1];
23455
+ var _useState5 = React.useState(0),
23456
+ _useState6 = _slicedToArray(_useState5, 2),
23457
+ dripY = _useState6[0],
23458
+ setDripY = _useState6[1];
23459
+ var groupConfig = useButtonGroupContext();
23460
+ var filteredProps = filterPropsWithGroup(btnProps, groupConfig);
23461
+ /* eslint-disable @typescript-eslint/no-unused-vars */
23462
+ var children = filteredProps.children,
23463
+ _filteredProps$disabl = filteredProps.disabled,
23464
+ disabled = _filteredProps$disabl === void 0 ? false : _filteredProps$disabl;
23465
+ filteredProps.color;
23466
+ var _filteredProps$loadin = filteredProps.loading,
23467
+ loading = _filteredProps$loadin === void 0 ? false : _filteredProps$loadin,
23468
+ _filteredProps$shadow = filteredProps.shadow,
23469
+ shadow = _filteredProps$shadow === void 0 ? false : _filteredProps$shadow,
23470
+ _filteredProps$ghost = filteredProps.ghost,
23471
+ ghost = _filteredProps$ghost === void 0 ? false : _filteredProps$ghost,
23472
+ _filteredProps$effect = filteredProps.effect,
23473
+ effect = _filteredProps$effect === void 0 ? true : _filteredProps$effect,
23474
+ _filteredProps$round = filteredProps.round,
23475
+ round = _filteredProps$round === void 0 ? false : _filteredProps$round;
23476
+ filteredProps.relative;
23477
+ filteredProps.replace;
23478
+ filteredProps.a;
23479
+ var to = filteredProps.to,
23480
+ onClick = filteredProps.onClick,
23481
+ _filteredProps$auto = filteredProps.auto,
23482
+ auto = _filteredProps$auto === void 0 ? false : _filteredProps$auto,
23483
+ icon = filteredProps.icon,
23484
+ _filteredProps$type = filteredProps.type,
23485
+ type = _filteredProps$type === void 0 ? 'button' : _filteredProps$type,
23486
+ iconRight = filteredProps.iconRight,
23487
+ _filteredProps$classN = filteredProps.className,
23488
+ className = _filteredProps$classN === void 0 ? '' : _filteredProps$classN;
23489
+ filteredProps.crossOrigin;
23490
+ var props = _objectWithoutProperties(filteredProps, _excluded$1);
23491
+ /* eslint-enable @typescript-eslint/no-unused-vars */
23492
+
23606
23493
  var _useMemo = React.useMemo(function () {
23607
- var hasChildren = function hasChildren(c) {
23608
- return React.Children.count(c) > 0;
23609
- };
23610
- var prevDefault = /*#__PURE__*/jsxRuntime.jsx(PaginationPrevious, {
23611
- children: "prev"
23612
- });
23613
- var nextDefault = /*#__PURE__*/jsxRuntime.jsx(PaginationNext, {
23614
- children: "next"
23615
- });
23616
- return [hasChildren(prevChildren) ? prevChildren : prevDefault, hasChildren(nextChildren) ? nextChildren : nextDefault];
23617
- }, [prevChildren, nextChildren]),
23618
- _useMemo2 = _slicedToArray(_useMemo, 2),
23619
- prevItem = _useMemo2[0],
23620
- nextItem = _useMemo2[1];
23621
- var update = function update(type) {
23622
- if (type === 'prev' && pageRef.current > 1) {
23623
- setPage(function (last) {
23624
- return last - 1;
23494
+ return getButtonColors(theme$1.palette, filteredProps);
23495
+ }, [theme$1.palette, filteredProps]),
23496
+ bg = _useMemo.bg,
23497
+ border = _useMemo.border,
23498
+ color = _useMemo.color,
23499
+ rippleColor = _useMemo.ripple;
23500
+ var hover = React.useMemo(function () {
23501
+ return getButtonHoverColors(theme$1.palette, filteredProps);
23502
+ }, [theme$1.palette, filteredProps]);
23503
+ var _useMemo2 = React.useMemo(function () {
23504
+ return getButtonCursor(disabled, loading);
23505
+ }, [disabled, loading]),
23506
+ cursor = _useMemo2.cursor,
23507
+ events = _useMemo2.events;
23508
+ var dripColor = React.useMemo(function () {
23509
+ return getButtonDripColor(theme$1.palette, filteredProps);
23510
+ }, [theme$1.palette, filteredProps]);
23511
+
23512
+ /* istanbul ignore next */
23513
+ var dripCompletedHandle = function dripCompletedHandle() {
23514
+ setDripShow(false);
23515
+ setDripX(0);
23516
+ setDripY(0);
23517
+ };
23518
+ var createRipple = function createRipple(event) {
23519
+ var button = buttonRef.current;
23520
+ if (!button) return;
23521
+ var rect = button.getBoundingClientRect();
23522
+ var size = Math.max(rect.width, rect.height);
23523
+ var x = event.clientX - rect.left - size / 2;
23524
+ var y = event.clientY - rect.top - size / 2;
23525
+ var rippleCount = 1; // number of rings
23526
+ var rippleDelay = 500; // ms between each ripple
23527
+ var _loop = function _loop() {
23528
+ var ripple = document.createElement('span');
23529
+ Object.assign(ripple.style, {
23530
+ position: 'absolute',
23531
+ borderRadius: '50%',
23532
+ backgroundColor: rippleColor,
23533
+ width: "".concat(size, "px"),
23534
+ height: "".concat(size, "px"),
23535
+ left: "".concat(x, "px"),
23536
+ top: "".concat(y, "px"),
23537
+ pointerEvents: 'none',
23538
+ transform: 'scale(0)',
23539
+ opacity: '1',
23540
+ transition: "transform 600ms ease-out ".concat(i * rippleDelay, "ms, opacity 600ms ease-out ").concat(i * rippleDelay, "ms"),
23541
+ zIndex: 1
23625
23542
  });
23626
- }
23627
- if (type === 'next' && pageRef.current < count) {
23628
- setPage(function (last) {
23629
- return last + 1;
23543
+ button.appendChild(ripple);
23544
+
23545
+ // Force reflow to start transition
23546
+ window.getComputedStyle(ripple).opacity;
23547
+ ripple.style.transform = 'scale(2.5)';
23548
+ ripple.style.opacity = '0';
23549
+ ripple.addEventListener('transitionend', function () {
23550
+ ripple.remove();
23630
23551
  });
23552
+ };
23553
+ for (var i = 0; i < rippleCount; i++) {
23554
+ _loop();
23631
23555
  }
23632
23556
  };
23633
- var values = React.useMemo(function () {
23634
- return {
23635
- isFirst: page <= 1,
23636
- isLast: page >= count,
23637
- update: update
23638
- };
23639
- }, [page, count]);
23640
- React.useEffect(function () {
23641
- onChange && onChange(page);
23642
- }, [page]);
23643
- React.useEffect(function () {
23644
- if (customPage !== undefined) {
23645
- setPage(customPage);
23557
+ var clickHandler = function clickHandler(event) {
23558
+ if (disabled || loading) return;
23559
+ var showDrip = !shadow && !ghost && effect;
23560
+ /* istanbul ignore next */
23561
+ if (showDrip && buttonRef.current) {
23562
+ var rect = buttonRef.current.getBoundingClientRect();
23563
+ setDripShow(true);
23564
+ setDripX(event.clientX - rect.left);
23565
+ setDripY(event.clientY - rect.top);
23646
23566
  }
23647
- }, [customPage]);
23648
- return /*#__PURE__*/jsxRuntime.jsxs(PaginationContext.Provider, {
23649
- value: values,
23650
- children: [/*#__PURE__*/jsxRuntime.jsxs("nav", _objectSpread2(_objectSpread2({}, props), {}, {
23651
- className: _JSXStyle.dynamic([["3826701357", [SCALES.font(2), SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || ""),
23652
- children: [prevItem, /*#__PURE__*/jsxRuntime.jsx(PaginationPages, {
23653
- count: count,
23654
- current: page,
23655
- limit: limit,
23656
- setPage: setPage
23657
- }), nextItem]
23567
+ if (shadow) {
23568
+ createRipple(event);
23569
+ }
23570
+ onClick && onClick(event);
23571
+ };
23572
+ var childrenWithIcon = React.useMemo(function () {
23573
+ return getButtonChildrenWithIcon(auto, children, {
23574
+ icon: icon,
23575
+ iconRight: iconRight
23576
+ });
23577
+ }, [auto, children, icon, iconRight]);
23578
+ var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
23579
+ paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
23580
+
23581
+ // If shadow provided is string then value other default
23582
+ var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme$1.shadows.level.z2 : 'none';
23583
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
23584
+ children: [to ? /*#__PURE__*/jsxRuntime.jsxs("a", _objectSpread2(_objectSpread2({
23585
+ href: to
23586
+ }, props), {}, {
23587
+ className: _JSXStyle.dynamic([["612376042", [SCALES.height(2.5), round ? '50%' : theme$1.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor !== null && cursor !== void 0 ? cursor : 'pointer', events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px']]]) + " " + (props && props.className != null && props.className || theme.useClasses('btn', 'btn-link', className) || ""),
23588
+ children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
23589
+ color: color
23590
+ }), childrenWithIcon]
23591
+ })) : /*#__PURE__*/jsxRuntime.jsxs("button", _objectSpread2(_objectSpread2({
23592
+ ref: buttonRef,
23593
+ type: type,
23594
+ disabled: disabled,
23595
+ onClick: clickHandler
23596
+ }, props), {}, {
23597
+ className: _JSXStyle.dynamic([["612376042", [SCALES.height(2.5), round ? '50%' : theme$1.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor !== null && cursor !== void 0 ? cursor : 'pointer', events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px']]]) + " " + (props && props.className != null && props.className || theme.useClasses('btn', className) || ""),
23598
+ children: [loading && /*#__PURE__*/jsxRuntime.jsx(ButtonLoading, {
23599
+ color: color
23600
+ }), childrenWithIcon, dripShow && /*#__PURE__*/jsxRuntime.jsx(ButtonDrip, {
23601
+ x: dripX,
23602
+ y: dripY,
23603
+ color: dripColor,
23604
+ onCompleted: dripCompletedHandle
23605
+ })]
23658
23606
  })), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
23659
- id: "3826701357",
23660
- dynamic: [SCALES.font(2), SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)],
23661
- children: "nav.__jsx-style-dynamic-selector{font-variant:tabular-nums;font-feature-settings:'tnum';--pagination-size:".concat(SCALES.font(2), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";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), ";}nav.__jsx-style-dynamic-selector button:last-of-type{margin-right:0;}")
23607
+ id: "612376042",
23608
+ 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'],
23609
+ children: ".btn.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;line-height:".concat(SCALES.height(2.5), ";border-radius:").concat(round ? '50%' : theme$1.layout.radius, ";font-weight:400;font-size:").concat(SCALES.font(0.875), ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;text-transform:capitalize;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;white-space:nowrap;-webkit-transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;position:relative;overflow:hidden;color:").concat(color, ";background-color:").concat(bg, ";border:1px solid ").concat(shadow ? 'transparent' : border, ";cursor:").concat(cursor !== null && cursor !== void 0 ? cursor : 'pointer', ";pointer-events:").concat(events, ";box-shadow:").concat(shadow ? btnShadow : 'none', ";--helpdice-ui-button-icon-padding:").concat(SCALES.pl(0.727), ";--helpdice-ui-button-height:").concat(SCALES.height(2.5), ";--helpdice-ui-button-color:").concat(color, ";--helpdice-ui-button-bg:").concat(bg, ";min-width:").concat(auto ? 'min-content' : SCALES.width(10.5), ";width:").concat(auto ? 'auto' : 'initial', ";height:").concat(SCALES.height(2.5), ";padding:").concat(SCALES.pt(0), " ").concat(paddingRight, " ").concat(SCALES.pb(0), " ").concat(paddingLeft, ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.btn.__jsx-style-dynamic-selector:hover,.btn.__jsx-style-dynamic-selector:focus{color:").concat(hover.color, ";--helpdice-ui-button-color:").concat(hover.color, ";background-color:").concat(hover.bg, ";border-color:").concat(hover.border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(btnShadow, ";}.btn-link.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.btn.__jsx-style-dynamic-selector .text{position:relative;z-index:1;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;text-align:center;line-height:inherit;top:-1px;}.btn.__jsx-style-dynamic-selector .text p,.btn.__jsx-style-dynamic-selector .text pre,.btn.__jsx-style-dynamic-selector .text div{margin:0;}.ripple.__jsx-style-dynamic-selector{position:absolute;border-radius:50%;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;background-color:rgba(0,0,0,0.3);pointer-events:none;z-index:1;}@-webkit-keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}@keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}")
23662
23610
  })]
23663
23611
  });
23612
+ });
23613
+ ButtonComponent.displayName = 'Button';
23614
+ var Button = withScale(ButtonComponent);
23615
+
23616
+ var CompactButton = function CompactButton(props) {
23617
+ // const theme = useTheme();
23618
+ return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
23619
+ scale: 2 / 3,
23620
+ px: 0.6
23621
+ }, _objectSpread2({
23622
+ auto: true
23623
+ }, props)), {}, {
23624
+ children: props.children
23625
+ }));
23664
23626
  };
23665
- PaginationComponent.displayName = 'Pagination';
23666
- var Pagination = withScale(PaginationComponent);
23627
+ var IconButton = /*#__PURE__*/React.memo(CompactButton);
23667
23628
 
23668
- Pagination.Previous = PaginationPrevious;
23669
- Pagination.Next = PaginationNext;
23629
+ var SmallButton = function SmallButton(props) {
23630
+ // const theme = useTheme();
23631
+ return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread2(_objectSpread2({
23632
+ auto: true,
23633
+ scale: 2 / 3,
23634
+ px: 0.6
23635
+ }, props), {}, {
23636
+ children: props.children
23637
+ }));
23638
+ };
23639
+ var SmallButton$1 = /*#__PURE__*/React.memo(SmallButton);
23640
+
23641
+ /* "use client" */
23642
+
23643
+ Button.Icon = IconButton;
23644
+ Button.Small = SmallButton$1;
23670
23645
 
23671
23646
  var Empty = function Empty(_ref) {
23672
23647
  _objectDestructuringEmpty(_ref);