@helpdice/ui 2.2.4 → 2.2.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.
@@ -10,6 +10,9 @@ function _arrayLikeToArray(r, a) {
10
10
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
11
11
  return n;
12
12
  }
13
+ function _arrayWithHoles(r) {
14
+ if (Array.isArray(r)) return r;
15
+ }
13
16
  function _createForOfIteratorHelper(r, e) {
14
17
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
15
18
  if (!t) {
@@ -58,6 +61,14 @@ function _createForOfIteratorHelper(r, e) {
58
61
  }
59
62
  };
60
63
  }
64
+ function _defineProperty(e, r, t) {
65
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
66
+ value: t,
67
+ enumerable: true,
68
+ configurable: true,
69
+ writable: true
70
+ }) : e[r] = t, e;
71
+ }
61
72
  function _extends() {
62
73
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
63
74
  for (var e = 1; e < arguments.length; e++) {
@@ -67,6 +78,57 @@ function _extends() {
67
78
  return n;
68
79
  }, _extends.apply(null, arguments);
69
80
  }
81
+ function _iterableToArrayLimit(r, l) {
82
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
83
+ if (null != t) {
84
+ var e,
85
+ n,
86
+ i,
87
+ u,
88
+ a = [],
89
+ f = true,
90
+ o = false;
91
+ try {
92
+ if (i = (t = t.call(r)).next, 0 === l) {
93
+ if (Object(t) !== t) return;
94
+ f = !1;
95
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
96
+ } catch (r) {
97
+ o = true, n = r;
98
+ } finally {
99
+ try {
100
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
101
+ } finally {
102
+ if (o) throw n;
103
+ }
104
+ }
105
+ return a;
106
+ }
107
+ }
108
+ function _nonIterableRest() {
109
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
110
+ }
111
+ function ownKeys(e, r) {
112
+ var t = Object.keys(e);
113
+ if (Object.getOwnPropertySymbols) {
114
+ var o = Object.getOwnPropertySymbols(e);
115
+ r && (o = o.filter(function (r) {
116
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
117
+ })), t.push.apply(t, o);
118
+ }
119
+ return t;
120
+ }
121
+ function _objectSpread2(e) {
122
+ for (var r = 1; r < arguments.length; r++) {
123
+ var t = null != arguments[r] ? arguments[r] : {};
124
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
125
+ _defineProperty(e, r, t[r]);
126
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
127
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
128
+ });
129
+ }
130
+ return e;
131
+ }
70
132
  function _objectWithoutProperties(e, t) {
71
133
  if (null == e) return {};
72
134
  var o,
@@ -87,6 +149,23 @@ function _objectWithoutPropertiesLoose(r, e) {
87
149
  }
88
150
  return t;
89
151
  }
152
+ function _slicedToArray(r, e) {
153
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
154
+ }
155
+ function _toPrimitive(t, r) {
156
+ if ("object" != typeof t || !t) return t;
157
+ var e = t[Symbol.toPrimitive];
158
+ if (void 0 !== e) {
159
+ var i = e.call(t, r);
160
+ if ("object" != typeof i) return i;
161
+ throw new TypeError("@@toPrimitive must return a primitive value.");
162
+ }
163
+ return ("string" === r ? String : Number)(t);
164
+ }
165
+ function _toPropertyKey(t) {
166
+ var i = _toPrimitive(t, "string");
167
+ return "symbol" == typeof i ? i : i + "";
168
+ }
90
169
  function _unsupportedIterableToArray(r, a) {
91
170
  if (r) {
92
171
  if ("string" == typeof r) return _arrayLikeToArray(r, a);
@@ -644,7 +723,7 @@ var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingL
644
723
  var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
645
724
  return "".concat(scale1x);
646
725
  };
647
- var defaultContext = {
726
+ var defaultContext$1 = {
648
727
  getScaleProps: function getScaleProps() {
649
728
  return undefined;
650
729
  },
@@ -670,7 +749,7 @@ var defaultContext = {
670
749
  },
671
750
  unit: '16px'
672
751
  };
673
- var ScaleContext = /*#__PURE__*/React.createContext(defaultContext);
752
+ var ScaleContext = /*#__PURE__*/React.createContext(defaultContext$1);
674
753
  var useScale = function useScale() {
675
754
  return React.useContext(ScaleContext);
676
755
  };
@@ -727,7 +806,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
727
806
  return getAllScaleProps;
728
807
  };
729
808
 
730
- var _excluded$2 = ["children"];
809
+ var _excluded$5 = ["children"];
731
810
  var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
732
811
  if (scale === 1) return scale;
733
812
  var diff = Math.abs((scale - 1) / 2);
@@ -737,7 +816,7 @@ var withScale = function withScale(Render) {
737
816
  var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
738
817
  var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31;
739
818
  var children = _ref.children,
740
- props = _objectWithoutProperties(_ref, _excluded$2);
819
+ props = _objectWithoutProperties(_ref, _excluded$5);
741
820
  var _useTheme = theme.useTheme(),
742
821
  layout = _useTheme.layout;
743
822
  var paddingLeft = props.paddingLeft,
@@ -820,7 +899,7 @@ var withScale = function withScale(Render) {
820
899
  return ScaleFC;
821
900
  };
822
901
 
823
- var _excluded$1 = ["xs", "sm", "md", "lg", "xl", "justify", "direction", "alignItems", "alignContent", "children", "className"];
902
+ var _excluded$4 = ["xs", "sm", "md", "lg", "xl", "justify", "direction", "alignItems", "alignContent", "children", "className"];
824
903
  var getItemLayout = function getItemLayout(val) {
825
904
  var display = val === 0 ? 'display: none;' : 'display: inherit;';
826
905
  if (typeof val === 'number') {
@@ -858,7 +937,7 @@ var GridBasicItem = function GridBasicItem(_ref) {
858
937
  children = _ref.children,
859
938
  _ref$className = _ref.className,
860
939
  className = _ref$className === void 0 ? '' : _ref$className,
861
- props = _objectWithoutProperties(_ref, _excluded$1);
940
+ props = _objectWithoutProperties(_ref, _excluded$4);
862
941
  var theme$1 = theme.useTheme();
863
942
  var _useScale = useScale(),
864
943
  SCALES = _useScale.SCALES;
@@ -913,7 +992,586 @@ tuple('hover', 'click');
913
992
  tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
914
993
  tuple('start', 'center', 'end', 'left', 'right');
915
994
 
916
- var _excluded = ["gap", "children", "direction", "justify", "alignItems", "alignContent", "className"];
995
+ var ButtonDrip = function ButtonDrip(_ref) {
996
+ var _ref$x = _ref.x,
997
+ x = _ref$x === void 0 ? 0 : _ref$x,
998
+ _ref$y = _ref.y,
999
+ y = _ref$y === void 0 ? 0 : _ref$y,
1000
+ color = _ref.color,
1001
+ onCompleted = _ref.onCompleted;
1002
+ var dripRef = React.useRef(null);
1003
+ /* istanbul ignore next */
1004
+ var top = Number.isNaN(+y) ? 0 : y - 10;
1005
+ /* istanbul ignore next */
1006
+ var left = Number.isNaN(+x) ? 0 : x - 10;
1007
+ React.useEffect(function () {
1008
+ /* istanbul ignore next */
1009
+ if (!dripRef.current) return;
1010
+ dripRef.current.addEventListener('animationend', onCompleted);
1011
+ return function () {
1012
+ /* istanbul ignore next */
1013
+ if (!dripRef.current) return;
1014
+ dripRef.current.removeEventListener('animationend', onCompleted);
1015
+ };
1016
+ });
1017
+ return /*#__PURE__*/React.createElement("div", {
1018
+ ref: dripRef,
1019
+ className: "jsx-3424889537" + " " + "drip"
1020
+ }, /*#__PURE__*/React.createElement("svg", {
1021
+ width: "20",
1022
+ height: "20",
1023
+ viewBox: "0 0 20 20",
1024
+ style: {
1025
+ top: top,
1026
+ left: left
1027
+ },
1028
+ className: "jsx-3424889537"
1029
+ }, /*#__PURE__*/React.createElement("g", {
1030
+ stroke: "none",
1031
+ strokeWidth: "1",
1032
+ fill: "none",
1033
+ fillRule: "evenodd",
1034
+ className: "jsx-3424889537"
1035
+ }, /*#__PURE__*/React.createElement("g", {
1036
+ fill: color,
1037
+ className: "jsx-3424889537"
1038
+ }, /*#__PURE__*/React.createElement("rect", {
1039
+ width: "100%",
1040
+ height: "100%",
1041
+ rx: "10",
1042
+ className: "jsx-3424889537"
1043
+ })))), /*#__PURE__*/React.createElement(_JSXStyle, {
1044
+ id: "3424889537"
1045
+ }, ".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;}}"));
1046
+ };
1047
+ ButtonDrip.displayName = 'ButtonDrip';
1048
+
1049
+ var _excluded$3 = ["children", "type", "color", "className", "spaceRatio"];
1050
+ var getIconBgColor = function getIconBgColor(type, palette, color) {
1051
+ var colors = {
1052
+ "default": palette.accents_6,
1053
+ secondary: palette.secondary,
1054
+ success: palette.success,
1055
+ warning: palette.warning,
1056
+ error: palette.error
1057
+ };
1058
+ return color ? color : colors[type];
1059
+ };
1060
+ var LoadingComponent = function LoadingComponent(_ref) {
1061
+ var children = _ref.children,
1062
+ _ref$type = _ref.type,
1063
+ type = _ref$type === void 0 ? 'default' : _ref$type,
1064
+ color = _ref.color,
1065
+ _ref$className = _ref.className,
1066
+ className = _ref$className === void 0 ? '' : _ref$className,
1067
+ _ref$spaceRatio = _ref.spaceRatio,
1068
+ spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
1069
+ props = _objectWithoutProperties(_ref, _excluded$3);
1070
+ var theme$1 = theme.useTheme();
1071
+ var _useScale = useScale(),
1072
+ SCALES = _useScale.SCALES;
1073
+ var classes = theme.useClasses('loading-container', className);
1074
+ var bgColor = React.useMemo(function () {
1075
+ return getIconBgColor(type, theme$1.palette, color);
1076
+ }, [type, theme$1.palette, color]);
1077
+ return /*#__PURE__*/React.createElement("div", _extends({}, props, {
1078
+ 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 || "")
1079
+ }), /*#__PURE__*/React.createElement("span", {
1080
+ 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"
1081
+ }, children && /*#__PURE__*/React.createElement("label", {
1082
+ 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]]])
1083
+ }, children), /*#__PURE__*/React.createElement("i", {
1084
+ className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]])
1085
+ }), /*#__PURE__*/React.createElement("i", {
1086
+ className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]])
1087
+ }), /*#__PURE__*/React.createElement("i", {
1088
+ className: _JSXStyle.dynamic([["2201634259", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme$1.palette.accents_5, bgColor, spaceRatio]]])
1089
+ })), /*#__PURE__*/React.createElement(_JSXStyle, {
1090
+ id: "2201634259",
1091
+ 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]
1092
+ }, ".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;}}")));
1093
+ };
1094
+ LoadingComponent.displayName = 'Loading';
1095
+ var Loading = withScale(LoadingComponent);
1096
+
1097
+ var ButtonLoading = function ButtonLoading(_ref) {
1098
+ var color = _ref.color;
1099
+ return /*#__PURE__*/React.createElement("div", {
1100
+ className: "jsx-212623367" + " " + "btn-loading"
1101
+ }, /*#__PURE__*/React.createElement(Loading, {
1102
+ color: color
1103
+ }), /*#__PURE__*/React.createElement(_JSXStyle, {
1104
+ id: "212623367"
1105
+ }, ".btn-loading.jsx-212623367{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;background-color:var(--helpdice-ui-button-bg);}"));
1106
+ };
1107
+ ButtonLoading.displayName = 'ButtonLoading';
1108
+
1109
+ var _excluded$2 = ["isRight", "isSingle", "children", "className"];
1110
+ var ButtonIcon = function ButtonIcon(_ref) {
1111
+ var _ref$isRight = _ref.isRight,
1112
+ isRight = _ref$isRight === void 0 ? false : _ref$isRight,
1113
+ isSingle = _ref.isSingle,
1114
+ children = _ref.children,
1115
+ _ref$className = _ref.className,
1116
+ className = _ref$className === void 0 ? '' : _ref$className,
1117
+ props = _objectWithoutProperties(_ref, _excluded$2);
1118
+ var classes = theme.useClasses('icon', {
1119
+ right: isRight,
1120
+ single: isSingle
1121
+ }, className);
1122
+ return /*#__PURE__*/React.createElement("span", _extends({}, props, {
1123
+ className: "jsx-2467502931" + " " + (props && props.className != null && props.className || classes || "")
1124
+ }), children, /*#__PURE__*/React.createElement(_JSXStyle, {
1125
+ id: "2467502931"
1126
+ }, ".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;}"));
1127
+ };
1128
+ ButtonIcon.displayName = 'ButtonIcon';
1129
+
1130
+ var getButtonChildrenWithIcon = function getButtonChildrenWithIcon(auto, children, icons) {
1131
+ var icon = icons.icon,
1132
+ iconRight = icons.iconRight;
1133
+ var hasIcon = icon || iconRight;
1134
+ var isRight = Boolean(iconRight);
1135
+ var paddingForAutoMode = auto ? "calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding) * .5)" : 0;
1136
+ var classes = theme.useClasses('text', isRight ? 'right' : 'left');
1137
+ if (!hasIcon) return /*#__PURE__*/React.createElement("div", {
1138
+ className: "text"
1139
+ }, children);
1140
+ if (React.Children.count(children) === 0) {
1141
+ return /*#__PURE__*/React.createElement(ButtonIcon, {
1142
+ isRight: isRight,
1143
+ isSingle: true
1144
+ }, hasIcon);
1145
+ }
1146
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ButtonIcon, {
1147
+ isRight: isRight
1148
+ }, hasIcon), /*#__PURE__*/React.createElement("div", {
1149
+ className: _JSXStyle.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || "")
1150
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
1151
+ id: "3568181479",
1152
+ dynamic: [paddingForAutoMode, paddingForAutoMode]
1153
+ }, ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}"))));
1154
+ };
1155
+ var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
1156
+ if (!config.isButtonGroup) return props;
1157
+ return _objectSpread2(_objectSpread2({}, props), {}, {
1158
+ auto: true,
1159
+ shadow: false,
1160
+ ghost: config.ghost || props.ghost,
1161
+ type: config.type || props.type,
1162
+ disabled: config.disabled || props.disabled
1163
+ });
1164
+ };
1165
+
1166
+ /* "use client" */
1167
+
1168
+ var defaultContext = {
1169
+ isButtonGroup: false,
1170
+ disabled: false
1171
+ };
1172
+ var ButtonGroupContext = /*#__PURE__*/React.createContext(defaultContext);
1173
+ var useButtonGroupContext = function useButtonGroupContext() {
1174
+ return React.useContext(ButtonGroupContext);
1175
+ };
1176
+
1177
+ var hexToRgb = function hexToRgb(color) {
1178
+ var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
1179
+ var full = color.replace(fullReg, function (_, r, g, b) {
1180
+ return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
1181
+ });
1182
+ var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
1183
+ if (!values) {
1184
+ throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
1185
+ }
1186
+ return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
1187
+ };
1188
+ var colorToRgbValues = function colorToRgbValues(color) {
1189
+ if (color.charAt(0) === '#') return hexToRgb(color);
1190
+ var safeColor = color.replace(/ /g, '');
1191
+ var colorType = color.substr(0, 4);
1192
+ var regArray = safeColor.match(/\((.+)\)/);
1193
+ if (!colorType.startsWith('rgb') || !regArray) {
1194
+ console.log(color);
1195
+ throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
1196
+ }
1197
+ return regArray[1].split(',').map(function (str) {
1198
+ return Number.parseFloat(str);
1199
+ });
1200
+ };
1201
+ var addColorAlpha = function addColorAlpha(color, alpha) {
1202
+ if (!/^#|rgb|RGB/.test(color)) return color;
1203
+ var _colorToRgbValues = colorToRgbValues(color),
1204
+ _colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
1205
+ r = _colorToRgbValues2[0],
1206
+ g = _colorToRgbValues2[1],
1207
+ b = _colorToRgbValues2[2];
1208
+ var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
1209
+ return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
1210
+ };
1211
+
1212
+ var getButtonGhostColors = function getButtonGhostColors(palette, _color) {
1213
+ var colors = {
1214
+ secondary: {
1215
+ bg: palette.background,
1216
+ border: palette.foreground,
1217
+ color: palette.foreground,
1218
+ ripple: ''
1219
+ },
1220
+ success: {
1221
+ bg: palette.background,
1222
+ border: palette.success,
1223
+ color: palette.success,
1224
+ ripple: ''
1225
+ },
1226
+ warning: {
1227
+ bg: palette.background,
1228
+ border: palette.warning,
1229
+ color: palette.warning,
1230
+ ripple: ''
1231
+ },
1232
+ error: {
1233
+ bg: palette.background,
1234
+ border: palette.error,
1235
+ color: palette.error,
1236
+ ripple: ''
1237
+ }
1238
+ };
1239
+ return colors[_color] || null;
1240
+ };
1241
+ var getButtonColors = function getButtonColors(palette, props) {
1242
+ var color = props.color,
1243
+ disabled = props.disabled,
1244
+ ghost = props.ghost;
1245
+ var colors = {
1246
+ "default": {
1247
+ bg: palette.background,
1248
+ border: palette.border,
1249
+ color: palette.accents_5,
1250
+ ripple: palette.accents_1
1251
+ },
1252
+ secondary: {
1253
+ bg: palette.foreground,
1254
+ border: palette.foreground,
1255
+ color: palette.background,
1256
+ ripple: palette.accents_1
1257
+ },
1258
+ success: {
1259
+ bg: palette.success,
1260
+ border: palette.success,
1261
+ color: '#fff',
1262
+ ripple: '#1f93ffff'
1263
+ },
1264
+ warning: {
1265
+ bg: palette.warning,
1266
+ border: palette.warning,
1267
+ color: '#fff',
1268
+ ripple: '#ffca29ff'
1269
+ },
1270
+ error: {
1271
+ bg: palette.error,
1272
+ border: palette.error,
1273
+ color: '#fff',
1274
+ ripple: '#ff5a55ff'
1275
+ },
1276
+ abort: {
1277
+ bg: 'transparent',
1278
+ border: 'transparent',
1279
+ color: palette.accents_5,
1280
+ ripple: palette.accents_1
1281
+ }
1282
+ };
1283
+ if (disabled) return {
1284
+ bg: palette.accents_1,
1285
+ border: palette.accents_2,
1286
+ color: '#ccc',
1287
+ ripple: ''
1288
+ };
1289
+
1290
+ /**
1291
+ * The '-light' type is the same color as the common type,
1292
+ * only hover's color is different.
1293
+ * e.g.
1294
+ * Color['success'] === Color['success-light']
1295
+ * Color['warning'] === Color['warning-light']
1296
+ */
1297
+ var withoutLightType = color === null || color === void 0 ? void 0 : color.replace('-light', '');
1298
+ var defaultColor = colors["default"];
1299
+ if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
1300
+ return colors[withoutLightType] || defaultColor;
1301
+ };
1302
+ var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, _color) {
1303
+ var colors = {
1304
+ secondary: {
1305
+ bg: palette.foreground,
1306
+ border: palette.background,
1307
+ color: palette.background
1308
+ },
1309
+ success: {
1310
+ bg: palette.success,
1311
+ border: palette.background,
1312
+ color: 'white'
1313
+ },
1314
+ warning: {
1315
+ bg: palette.warning,
1316
+ border: palette.background,
1317
+ color: 'white'
1318
+ },
1319
+ error: {
1320
+ bg: palette.error,
1321
+ border: palette.background,
1322
+ color: 'white'
1323
+ }
1324
+ };
1325
+ var withoutLightType = _color === null || _color === void 0 ? void 0 : _color.replace('-light', '');
1326
+ return colors[withoutLightType] || null;
1327
+ };
1328
+ var getButtonHoverColors = function getButtonHoverColors(palette, props) {
1329
+ var color = props.color,
1330
+ disabled = props.disabled,
1331
+ loading = props.loading,
1332
+ shadow = props.shadow,
1333
+ ghost = props.ghost;
1334
+ var defaultColor = getButtonColors(palette, props);
1335
+ var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
1336
+ var colors = {
1337
+ "default": {
1338
+ bg: palette.background,
1339
+ border: palette.foreground
1340
+ },
1341
+ secondary: {
1342
+ bg: palette.background,
1343
+ border: palette.foreground
1344
+ },
1345
+ success: {
1346
+ bg: palette.background,
1347
+ border: palette.success
1348
+ },
1349
+ warning: {
1350
+ bg: palette.background,
1351
+ border: palette.warning
1352
+ },
1353
+ error: {
1354
+ bg: palette.background,
1355
+ border: palette.error
1356
+ },
1357
+ abort: {
1358
+ bg: 'transparent',
1359
+ border: 'transparent',
1360
+ color: palette.accents_5
1361
+ },
1362
+ 'secondary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1363
+ bg: alphaBackground
1364
+ }),
1365
+ 'success-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1366
+ bg: alphaBackground
1367
+ }),
1368
+ 'warning-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1369
+ bg: alphaBackground
1370
+ }),
1371
+ 'error-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1372
+ bg: alphaBackground
1373
+ })
1374
+ };
1375
+ if (disabled) return {
1376
+ bg: palette.accents_1,
1377
+ border: palette.accents_2,
1378
+ color: '#ccc'
1379
+ };
1380
+ if (loading) return _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1381
+ color: 'transparent'
1382
+ });
1383
+ if (shadow) return defaultColor;
1384
+ var hoverColor = (ghost ? getButtonGhostHoverColors(palette, color) : colors[color]) || colors["default"];
1385
+ return _objectSpread2(_objectSpread2({}, hoverColor), {}, {
1386
+ color: hoverColor.color || hoverColor.border
1387
+ });
1388
+ };
1389
+ var getButtonCursor = function getButtonCursor(disabled, loading) {
1390
+ if (disabled) return {
1391
+ cursor: 'not-allowed',
1392
+ events: 'auto'
1393
+ };
1394
+ if (loading) return {
1395
+ cursor: 'default',
1396
+ events: 'none'
1397
+ };
1398
+ return {
1399
+ cursor: 'pointer',
1400
+ events: 'auto'
1401
+ };
1402
+ };
1403
+ var getButtonDripColor = function getButtonDripColor(palette, props) {
1404
+ var type = props.type;
1405
+ var isLightHover = type ? type.endsWith('light') : false;
1406
+ var hoverColors = getButtonHoverColors(palette, props);
1407
+ return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
1408
+ };
1409
+
1410
+ var _excluded$1 = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
1411
+ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
1412
+ var theme$1 = theme.useTheme();
1413
+ var _useScale = useScale(),
1414
+ SCALES = _useScale.SCALES;
1415
+ var buttonRef = React.useRef(null);
1416
+ React.useImperativeHandle(ref, function () {
1417
+ return buttonRef.current;
1418
+ }); // Changed with !
1419
+
1420
+ var _useState = React.useState(false),
1421
+ _useState2 = _slicedToArray(_useState, 2),
1422
+ dripShow = _useState2[0],
1423
+ setDripShow = _useState2[1];
1424
+ var _useState3 = React.useState(0),
1425
+ _useState4 = _slicedToArray(_useState3, 2),
1426
+ dripX = _useState4[0],
1427
+ setDripX = _useState4[1];
1428
+ var _useState5 = React.useState(0),
1429
+ _useState6 = _slicedToArray(_useState5, 2),
1430
+ dripY = _useState6[0],
1431
+ setDripY = _useState6[1];
1432
+ var groupConfig = useButtonGroupContext();
1433
+ var filteredProps = filterPropsWithGroup(btnProps, groupConfig);
1434
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1435
+ var children = filteredProps.children,
1436
+ _filteredProps$disabl = filteredProps.disabled,
1437
+ disabled = _filteredProps$disabl === void 0 ? false : _filteredProps$disabl;
1438
+ filteredProps.color;
1439
+ var _filteredProps$loadin = filteredProps.loading,
1440
+ loading = _filteredProps$loadin === void 0 ? false : _filteredProps$loadin,
1441
+ _filteredProps$shadow = filteredProps.shadow,
1442
+ shadow = _filteredProps$shadow === void 0 ? false : _filteredProps$shadow,
1443
+ _filteredProps$ghost = filteredProps.ghost,
1444
+ ghost = _filteredProps$ghost === void 0 ? false : _filteredProps$ghost,
1445
+ _filteredProps$effect = filteredProps.effect,
1446
+ effect = _filteredProps$effect === void 0 ? true : _filteredProps$effect,
1447
+ _filteredProps$round = filteredProps.round,
1448
+ round = _filteredProps$round === void 0 ? false : _filteredProps$round,
1449
+ onClick = filteredProps.onClick,
1450
+ _filteredProps$auto = filteredProps.auto,
1451
+ auto = _filteredProps$auto === void 0 ? false : _filteredProps$auto,
1452
+ icon = filteredProps.icon,
1453
+ _filteredProps$type = filteredProps.type,
1454
+ type = _filteredProps$type === void 0 ? 'button' : _filteredProps$type,
1455
+ iconRight = filteredProps.iconRight,
1456
+ _filteredProps$classN = filteredProps.className,
1457
+ className = _filteredProps$classN === void 0 ? '' : _filteredProps$classN;
1458
+ filteredProps.crossOrigin;
1459
+ var props = _objectWithoutProperties(filteredProps, _excluded$1);
1460
+ /* eslint-enable @typescript-eslint/no-unused-vars */
1461
+
1462
+ var _useMemo = React.useMemo(function () {
1463
+ return getButtonColors(theme$1.palette, filteredProps);
1464
+ }, [theme$1.palette, filteredProps]),
1465
+ bg = _useMemo.bg,
1466
+ border = _useMemo.border,
1467
+ color = _useMemo.color,
1468
+ rippleColor = _useMemo.ripple;
1469
+ var hover = React.useMemo(function () {
1470
+ return getButtonHoverColors(theme$1.palette, filteredProps);
1471
+ }, [theme$1.palette, filteredProps]);
1472
+ var _useMemo2 = React.useMemo(function () {
1473
+ return getButtonCursor(disabled, loading);
1474
+ }, [disabled, loading]),
1475
+ cursor = _useMemo2.cursor,
1476
+ events = _useMemo2.events;
1477
+ var dripColor = React.useMemo(function () {
1478
+ return getButtonDripColor(theme$1.palette, filteredProps);
1479
+ }, [theme$1.palette, filteredProps]);
1480
+
1481
+ /* istanbul ignore next */
1482
+ var dripCompletedHandle = function dripCompletedHandle() {
1483
+ setDripShow(false);
1484
+ setDripX(0);
1485
+ setDripY(0);
1486
+ };
1487
+ var createRipple = function createRipple(event) {
1488
+ var button = buttonRef.current;
1489
+ if (!button) return;
1490
+ var rect = button.getBoundingClientRect();
1491
+ var size = Math.max(rect.width, rect.height);
1492
+ var x = event.clientX - rect.left - size / 2;
1493
+ var y = event.clientY - rect.top - size / 2;
1494
+ var rippleCount = 1; // number of rings
1495
+ var rippleDelay = 500; // ms between each ripple
1496
+ var _loop = function _loop() {
1497
+ var ripple = document.createElement('span');
1498
+ Object.assign(ripple.style, {
1499
+ position: 'absolute',
1500
+ borderRadius: '50%',
1501
+ backgroundColor: rippleColor,
1502
+ width: "".concat(size, "px"),
1503
+ height: "".concat(size, "px"),
1504
+ left: "".concat(x, "px"),
1505
+ top: "".concat(y, "px"),
1506
+ pointerEvents: 'none',
1507
+ transform: 'scale(0)',
1508
+ opacity: '1',
1509
+ transition: "transform 600ms ease-out ".concat(i * rippleDelay, "ms, opacity 600ms ease-out ").concat(i * rippleDelay, "ms"),
1510
+ zIndex: 1
1511
+ });
1512
+ button.appendChild(ripple);
1513
+
1514
+ // Force reflow to start transition
1515
+ window.getComputedStyle(ripple).opacity;
1516
+ ripple.style.transform = 'scale(2.5)';
1517
+ ripple.style.opacity = '0';
1518
+ ripple.addEventListener('transitionend', function () {
1519
+ ripple.remove();
1520
+ });
1521
+ };
1522
+ for (var i = 0; i < rippleCount; i++) {
1523
+ _loop();
1524
+ }
1525
+ };
1526
+ var clickHandler = function clickHandler(event) {
1527
+ if (disabled || loading) return;
1528
+ var showDrip = !shadow && !ghost && effect;
1529
+ /* istanbul ignore next */
1530
+ if (showDrip && buttonRef.current) {
1531
+ var rect = buttonRef.current.getBoundingClientRect();
1532
+ setDripShow(true);
1533
+ setDripX(event.clientX - rect.left);
1534
+ setDripY(event.clientY - rect.top);
1535
+ }
1536
+ if (shadow) {
1537
+ createRipple(event);
1538
+ }
1539
+ onClick && onClick(event);
1540
+ };
1541
+ var childrenWithIcon = React.useMemo(function () {
1542
+ return getButtonChildrenWithIcon(auto, children, {
1543
+ icon: icon,
1544
+ iconRight: iconRight
1545
+ });
1546
+ }, [auto, children, icon, iconRight]);
1547
+ var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
1548
+ paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
1549
+
1550
+ // If shadow provided is string then value other default
1551
+ var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme$1.shadows.level.z2 : 'none';
1552
+ return /*#__PURE__*/React.createElement("button", _extends({
1553
+ ref: buttonRef,
1554
+ type: type,
1555
+ disabled: disabled,
1556
+ onClick: clickHandler
1557
+ }, props, {
1558
+ className: _JSXStyle.dynamic([["905110486", [SCALES.height(2.5), round ? '50%' : theme$1.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor, events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px']]]) + " " + (props && props.className != null && props.className || theme.useClasses('btn', className) || "")
1559
+ }), loading && /*#__PURE__*/React.createElement(ButtonLoading, {
1560
+ color: color
1561
+ }), childrenWithIcon, dripShow && /*#__PURE__*/React.createElement(ButtonDrip, {
1562
+ x: dripX,
1563
+ y: dripY,
1564
+ color: dripColor,
1565
+ onCompleted: dripCompletedHandle
1566
+ }), /*#__PURE__*/React.createElement(_JSXStyle, {
1567
+ id: "905110486",
1568
+ dynamic: [SCALES.height(2.5), round ? '50%' : theme$1.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor, events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px']
1569
+ }, ".btn.__jsx-style-dynamic-selector{box-sizing:border-box;display:inline-block;line-height:".concat(SCALES.height(2.5), ";border-radius:").concat(round ? '50%' : theme$1.layout.radius, ";font-weight:400;font-size:").concat(SCALES.font(0.875), ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;text-transform:capitalize;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;white-space:nowrap;-webkit-transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;position:relative;overflow:hidden;color:").concat(color, ";background-color:").concat(bg, ";border:1px solid ").concat(shadow ? 'transparent' : border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(shadow ? btnShadow : 'none', ";--helpdice-ui-button-icon-padding:").concat(SCALES.pl(0.727), ";--helpdice-ui-button-height:").concat(SCALES.height(2.5), ";--helpdice-ui-button-color:").concat(color, ";--helpdice-ui-button-bg:").concat(bg, ";min-width:").concat(auto ? 'min-content' : SCALES.width(10.5), ";width:").concat(auto ? 'auto' : 'initial', ";height:").concat(SCALES.height(2.5), ";padding:").concat(SCALES.pt(0), " ").concat(paddingRight, " ").concat(SCALES.pb(0), " ").concat(paddingLeft, ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.btn.__jsx-style-dynamic-selector:hover,.btn.__jsx-style-dynamic-selector:focus{color:").concat(hover.color, ";--helpdice-ui-button-color:").concat(hover.color, ";background-color:").concat(hover.bg, ";border-color:").concat(hover.border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(btnShadow, ";}.btn.__jsx-style-dynamic-selector .text{position:relative;z-index:1;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;text-align:center;line-height:inherit;top:-1px;}.btn.__jsx-style-dynamic-selector .text p,.btn.__jsx-style-dynamic-selector .text pre,.btn.__jsx-style-dynamic-selector .text div{margin:0;}.ripple.__jsx-style-dynamic-selector{position:absolute;border-radius:50%;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;background-color:rgba(0,0,0,0.3);pointer-events:none;z-index:1;}@-webkit-keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}@keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}")));
1570
+ });
1571
+ ButtonComponent.displayName = 'Button';
1572
+ var Button = withScale(ButtonComponent);
1573
+
1574
+ var _excluded = ["gap", "children", "direction", "justify", "alignItems", "alignContent", "collapse", "className"];
917
1575
  var wrap = tuple('nowrap', 'wrap', 'wrap-reverse');
918
1576
  var Container = function Container(_ref) {
919
1577
  var _ref$gap = _ref.gap,
@@ -923,9 +1581,15 @@ var Container = function Container(_ref) {
923
1581
  justify = _ref.justify,
924
1582
  alignItems = _ref.alignItems,
925
1583
  alignContent = _ref.alignContent,
1584
+ _ref$collapse = _ref.collapse,
1585
+ collapse = _ref$collapse === void 0 ? 0 : _ref$collapse,
926
1586
  _ref$className = _ref.className,
927
1587
  className = _ref$className === void 0 ? '' : _ref$className,
928
1588
  props = _objectWithoutProperties(_ref, _excluded);
1589
+ var _useState = React.useState(false),
1590
+ _useState2 = _slicedToArray(_useState, 2),
1591
+ expand = _useState2[0],
1592
+ setExpand = _useState2[1];
929
1593
  var _useScale = useScale(),
930
1594
  unit = _useScale.unit,
931
1595
  SCALES = _useScale.SCALES;
@@ -934,17 +1598,39 @@ var Container = function Container(_ref) {
934
1598
  }, [gap, unit]);
935
1599
  var _styles$className = {
936
1600
  styles: /*#__PURE__*/React.createElement(_JSXStyle, {
937
- id: "4110955330",
938
- dynamic: [gapUnit, direction, wrap, justify, alignContent, alignItems, SCALES.width(1, 'var(--container-width)'), 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)]
939
- }, "div.__jsx-style-dynamic-selector{--gap-unit:".concat(gapUnit, ";--container-width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:").concat(direction, ";-ms-flex-direction:").concat(direction, ";flex-direction:").concat(direction, ";-webkit-flex-wrap:").concat(wrap, ";-ms-flex-wrap:").concat(wrap, ";flex-wrap:").concat(wrap, ";-webkit-box-pack:").concat(justify, ";-webkit-justify-content:").concat(justify, ";-ms-flex-pack:").concat(justify, ";justify-content:").concat(justify, ";-webkit-align-content:").concat(alignContent, ";-ms-flex-line-pack:").concat(alignContent, ";align-content:").concat(alignContent, ";-webkit-align-items:").concat(alignItems, ";-webkit-box-align:").concat(alignItems, ";-ms-flex-align:").concat(alignItems, ";align-items:").concat(alignItems, ";box-sizing:border-box;gap:var(--gap-unit);width:").concat(SCALES.width(1, 'var(--container-width)'), ";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), ";}")),
940
- className: _JSXStyle.dynamic([["4110955330", [gapUnit, direction, wrap, justify, alignContent, alignItems, SCALES.width(1, 'var(--container-width)'), 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)]]])
1601
+ id: "2357140837",
1602
+ dynamic: [gapUnit, direction, collapse ? 'wrap' : wrap, justify, alignContent, alignItems, SCALES.width(1, 'var(--container-width)'), 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)]
1603
+ }, "div.__jsx-style-dynamic-selector{--gap-unit:".concat(gapUnit, ";--container-width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:").concat(direction, ";-ms-flex-direction:").concat(direction, ";flex-direction:").concat(direction, ";-webkit-flex-wrap:").concat(collapse ? 'wrap' : wrap, ";-ms-flex-wrap:").concat(collapse ? 'wrap' : wrap, ";flex-wrap:").concat(collapse ? 'wrap' : wrap, ";-webkit-box-pack:").concat(justify, ";-webkit-justify-content:").concat(justify, ";-ms-flex-pack:").concat(justify, ";justify-content:").concat(justify, ";-webkit-align-content:").concat(alignContent, ";-ms-flex-line-pack:").concat(alignContent, ";align-content:").concat(alignContent, ";-webkit-align-items:").concat(alignItems, ";-webkit-box-align:").concat(alignItems, ";-ms-flex-align:").concat(alignItems, ";align-items:").concat(alignItems, ";box-sizing:border-box;gap:var(--gap-unit);width:").concat(SCALES.width(1, 'var(--container-width)'), ";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), ";}")),
1604
+ className: _JSXStyle.dynamic([["2357140837", [gapUnit, direction, collapse ? 'wrap' : wrap, justify, alignContent, alignItems, SCALES.width(1, 'var(--container-width)'), 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)]]])
941
1605
  },
942
1606
  resolveClassName = _styles$className.className,
943
1607
  styles = _styles$className.styles;
944
1608
  var classes = theme.useClasses(resolveClassName, className);
945
1609
  return /*#__PURE__*/React.createElement(GridBasicItem, _extends({
946
1610
  className: classes
947
- }, props), children, styles);
1611
+ }, props), collapse > 50 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
1612
+ style: {
1613
+ maxHeight: expand ? '100%' : "".concat(collapse, "px"),
1614
+ overflow: 'hidden',
1615
+ display: 'inline',
1616
+ transition: "max-height 0.3s ease"
1617
+ }
1618
+ }, children), /*#__PURE__*/React.createElement(Button, {
1619
+ margin: 0,
1620
+ onClick: function onClick() {
1621
+ return setExpand(!expand);
1622
+ },
1623
+ style: {
1624
+ textTransform: 'lowercase',
1625
+ height: '25px'
1626
+ },
1627
+ effect: false,
1628
+ color: "abort",
1629
+ scale: 2 / 3,
1630
+ px: 0.2,
1631
+ py: 0,
1632
+ auto: true
1633
+ }, /*#__PURE__*/React.createElement("b", null, expand ? 'less' : 'more'))) : children, styles);
948
1634
  };
949
1635
  Container.displayName = 'Container';
950
1636
  var Container$1 = withScale(Container);