@helpdice/ui 2.6.0-beta.8 → 2.6.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/container/index.js +143 -1
- package/dist/index.js +111 -112
- package/esm/container/box.js +1 -1
- package/package.json +1 -1
package/dist/container/index.js
CHANGED
|
@@ -5,13 +5,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var theme = require('@helpdice/theme');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
-
var
|
|
8
|
+
var Button = require('components/button');
|
|
9
9
|
|
|
10
10
|
function _arrayLikeToArray(r, a) {
|
|
11
11
|
(null == a || a > r.length) && (a = r.length);
|
|
12
12
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
13
13
|
return n;
|
|
14
14
|
}
|
|
15
|
+
function _arrayWithHoles(r) {
|
|
16
|
+
if (Array.isArray(r)) return r;
|
|
17
|
+
}
|
|
15
18
|
function _createForOfIteratorHelper(r, e) {
|
|
16
19
|
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
17
20
|
if (!t) {
|
|
@@ -68,6 +71,33 @@ function _defineProperty(e, r, t) {
|
|
|
68
71
|
writable: true
|
|
69
72
|
}) : e[r] = t, e;
|
|
70
73
|
}
|
|
74
|
+
function _iterableToArrayLimit(r, l) {
|
|
75
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
76
|
+
if (null != t) {
|
|
77
|
+
var e,
|
|
78
|
+
n,
|
|
79
|
+
i,
|
|
80
|
+
u,
|
|
81
|
+
a = [],
|
|
82
|
+
f = true,
|
|
83
|
+
o = false;
|
|
84
|
+
try {
|
|
85
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
86
|
+
} catch (r) {
|
|
87
|
+
o = true, n = r;
|
|
88
|
+
} finally {
|
|
89
|
+
try {
|
|
90
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
91
|
+
} finally {
|
|
92
|
+
if (o) throw n;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return a;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function _nonIterableRest() {
|
|
99
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
100
|
+
}
|
|
71
101
|
function ownKeys(e, r) {
|
|
72
102
|
var t = Object.keys(e);
|
|
73
103
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -109,6 +139,9 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
109
139
|
}
|
|
110
140
|
return t;
|
|
111
141
|
}
|
|
142
|
+
function _slicedToArray(r, e) {
|
|
143
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
144
|
+
}
|
|
112
145
|
function _toPrimitive(t, r) {
|
|
113
146
|
if ("object" != typeof t || !t) return t;
|
|
114
147
|
var e = t[Symbol.toPrimitive];
|
|
@@ -953,6 +986,115 @@ tuple('hover', 'click');
|
|
|
953
986
|
tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
|
|
954
987
|
tuple('start', 'center', 'end', 'left', 'right');
|
|
955
988
|
|
|
989
|
+
var Expandable = function Expandable(_ref) {
|
|
990
|
+
var children = _ref.children,
|
|
991
|
+
_ref$collapsedHeight = _ref.collapsedHeight,
|
|
992
|
+
collapsedHeight = _ref$collapsedHeight === void 0 ? 150 : _ref$collapsedHeight,
|
|
993
|
+
_ref$fadeHeight = _ref.fadeHeight,
|
|
994
|
+
fadeHeight = _ref$fadeHeight === void 0 ? 40 : _ref$fadeHeight,
|
|
995
|
+
className = _ref.className,
|
|
996
|
+
_ref$transitionDurati = _ref.transitionDuration,
|
|
997
|
+
transitionDuration = _ref$transitionDurati === void 0 ? 300 : _ref$transitionDurati;
|
|
998
|
+
var contentRef = React.useRef(null);
|
|
999
|
+
var containerRef = React.useRef(null);
|
|
1000
|
+
var _useState = React.useState(false),
|
|
1001
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1002
|
+
expanded = _useState2[0],
|
|
1003
|
+
setExpanded = _useState2[1];
|
|
1004
|
+
var _useState3 = React.useState(false),
|
|
1005
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1006
|
+
isOverflowing = _useState4[0],
|
|
1007
|
+
setIsOverflowing = _useState4[1];
|
|
1008
|
+
var _useState5 = React.useState(0),
|
|
1009
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
1010
|
+
contentHeight = _useState6[0],
|
|
1011
|
+
setContentHeight = _useState6[1];
|
|
1012
|
+
var _useState7 = React.useState("#fff"),
|
|
1013
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
1014
|
+
fadeColor = _useState8[0],
|
|
1015
|
+
setFadeColor = _useState8[1];
|
|
1016
|
+
|
|
1017
|
+
// Measure content height and detect overflow
|
|
1018
|
+
React.useEffect(function () {
|
|
1019
|
+
var el = contentRef.current;
|
|
1020
|
+
if (!el) return;
|
|
1021
|
+
var updateHeight = function updateHeight() {
|
|
1022
|
+
var _containerRef$current;
|
|
1023
|
+
var scrollHeight = el.scrollHeight;
|
|
1024
|
+
setContentHeight(scrollHeight);
|
|
1025
|
+
setIsOverflowing(scrollHeight > collapsedHeight);
|
|
1026
|
+
|
|
1027
|
+
// Detect background color dynamically
|
|
1028
|
+
var parentBg = window.getComputedStyle((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 ? _containerRef$current : el).backgroundColor;
|
|
1029
|
+
setFadeColor(parentBg || "#fff");
|
|
1030
|
+
};
|
|
1031
|
+
updateHeight();
|
|
1032
|
+
var observer = new ResizeObserver(updateHeight);
|
|
1033
|
+
observer.observe(el);
|
|
1034
|
+
return function () {
|
|
1035
|
+
return observer.disconnect();
|
|
1036
|
+
};
|
|
1037
|
+
}, [children, collapsedHeight]);
|
|
1038
|
+
var containerHeight = !isOverflowing ? contentHeight : expanded ? contentHeight : collapsedHeight;
|
|
1039
|
+
var fadeStyle = {
|
|
1040
|
+
position: "absolute",
|
|
1041
|
+
bottom: 0,
|
|
1042
|
+
left: 0,
|
|
1043
|
+
right: 0,
|
|
1044
|
+
height: fadeHeight,
|
|
1045
|
+
background: "linear-gradient(to bottom, rgba(255,255,255,0), ".concat(fadeColor, ")"),
|
|
1046
|
+
pointerEvents: "none",
|
|
1047
|
+
transition: "opacity ".concat(transitionDuration, "ms ease"),
|
|
1048
|
+
opacity: !expanded && isOverflowing ? 1 : 0
|
|
1049
|
+
};
|
|
1050
|
+
var toggleExpanded = function toggleExpanded() {
|
|
1051
|
+
return setExpanded(function (prev) {
|
|
1052
|
+
return !prev;
|
|
1053
|
+
});
|
|
1054
|
+
};
|
|
1055
|
+
var handleKey = function handleKey(e) {
|
|
1056
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1057
|
+
e.preventDefault();
|
|
1058
|
+
toggleExpanded();
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1062
|
+
ref: containerRef,
|
|
1063
|
+
className: className,
|
|
1064
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1065
|
+
style: {
|
|
1066
|
+
height: containerHeight,
|
|
1067
|
+
overflow: "hidden",
|
|
1068
|
+
transition: "height ".concat(transitionDuration, "ms ease"),
|
|
1069
|
+
position: "relative"
|
|
1070
|
+
},
|
|
1071
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1072
|
+
ref: contentRef,
|
|
1073
|
+
children: children
|
|
1074
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1075
|
+
style: fadeStyle
|
|
1076
|
+
})]
|
|
1077
|
+
}), isOverflowing && /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
1078
|
+
"aria-expanded": expanded,
|
|
1079
|
+
onKeyDown: handleKey,
|
|
1080
|
+
margin: 0,
|
|
1081
|
+
padding: 0,
|
|
1082
|
+
onClick: function onClick() {
|
|
1083
|
+
return setExpanded(function (prev) {
|
|
1084
|
+
return !prev;
|
|
1085
|
+
});
|
|
1086
|
+
},
|
|
1087
|
+
effect: false,
|
|
1088
|
+
color: "abort",
|
|
1089
|
+
scale: 2 / 3,
|
|
1090
|
+
auto: true,
|
|
1091
|
+
children: /*#__PURE__*/jsxRuntime.jsx("b", {
|
|
1092
|
+
children: expanded ? 'Show less' : 'Show more'
|
|
1093
|
+
})
|
|
1094
|
+
})]
|
|
1095
|
+
});
|
|
1096
|
+
};
|
|
1097
|
+
|
|
956
1098
|
var _excluded = ["gap", "children", "direction", "justify", "alignItems", "alignContent", "collapse", "className"];
|
|
957
1099
|
var wrap = tuple('nowrap', 'wrap', 'wrap-reverse');
|
|
958
1100
|
var Container = function Container(_ref) {
|
package/dist/index.js
CHANGED
|
@@ -6,13 +6,12 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var icons = require('@helpdice/icons');
|
|
7
7
|
var framerMotion = require('framer-motion');
|
|
8
8
|
var reactDom = require('react-dom');
|
|
9
|
-
var
|
|
9
|
+
var Button$1 = require('components/button');
|
|
10
10
|
var reactDom$1 = require('@floating-ui/react-dom');
|
|
11
11
|
var pro = require('@helpdice/pro');
|
|
12
12
|
var reactSyntaxHighlighter = require('react-syntax-highlighter');
|
|
13
13
|
var prism = require('react-syntax-highlighter/dist/cjs/styles/prism');
|
|
14
14
|
var require$$0 = require('react-is');
|
|
15
|
-
var Button$1 = require('components/button');
|
|
16
15
|
var isEqual = require('react-fast-compare');
|
|
17
16
|
|
|
18
17
|
function _interopNamespaceDefault(e) {
|
|
@@ -13390,6 +13389,115 @@ var GridContainer = withScale(GridContainerComponent);
|
|
|
13390
13389
|
|
|
13391
13390
|
Grid.Container = GridContainer;
|
|
13392
13391
|
|
|
13392
|
+
var Expandable = function Expandable(_ref) {
|
|
13393
|
+
var children = _ref.children,
|
|
13394
|
+
_ref$collapsedHeight = _ref.collapsedHeight,
|
|
13395
|
+
collapsedHeight = _ref$collapsedHeight === void 0 ? 150 : _ref$collapsedHeight,
|
|
13396
|
+
_ref$fadeHeight = _ref.fadeHeight,
|
|
13397
|
+
fadeHeight = _ref$fadeHeight === void 0 ? 40 : _ref$fadeHeight,
|
|
13398
|
+
className = _ref.className,
|
|
13399
|
+
_ref$transitionDurati = _ref.transitionDuration,
|
|
13400
|
+
transitionDuration = _ref$transitionDurati === void 0 ? 300 : _ref$transitionDurati;
|
|
13401
|
+
var contentRef = React.useRef(null);
|
|
13402
|
+
var containerRef = React.useRef(null);
|
|
13403
|
+
var _useState = React.useState(false),
|
|
13404
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13405
|
+
expanded = _useState2[0],
|
|
13406
|
+
setExpanded = _useState2[1];
|
|
13407
|
+
var _useState3 = React.useState(false),
|
|
13408
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
13409
|
+
isOverflowing = _useState4[0],
|
|
13410
|
+
setIsOverflowing = _useState4[1];
|
|
13411
|
+
var _useState5 = React.useState(0),
|
|
13412
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
13413
|
+
contentHeight = _useState6[0],
|
|
13414
|
+
setContentHeight = _useState6[1];
|
|
13415
|
+
var _useState7 = React.useState("#fff"),
|
|
13416
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
13417
|
+
fadeColor = _useState8[0],
|
|
13418
|
+
setFadeColor = _useState8[1];
|
|
13419
|
+
|
|
13420
|
+
// Measure content height and detect overflow
|
|
13421
|
+
React.useEffect(function () {
|
|
13422
|
+
var el = contentRef.current;
|
|
13423
|
+
if (!el) return;
|
|
13424
|
+
var updateHeight = function updateHeight() {
|
|
13425
|
+
var _containerRef$current;
|
|
13426
|
+
var scrollHeight = el.scrollHeight;
|
|
13427
|
+
setContentHeight(scrollHeight);
|
|
13428
|
+
setIsOverflowing(scrollHeight > collapsedHeight);
|
|
13429
|
+
|
|
13430
|
+
// Detect background color dynamically
|
|
13431
|
+
var parentBg = window.getComputedStyle((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 ? _containerRef$current : el).backgroundColor;
|
|
13432
|
+
setFadeColor(parentBg || "#fff");
|
|
13433
|
+
};
|
|
13434
|
+
updateHeight();
|
|
13435
|
+
var observer = new ResizeObserver(updateHeight);
|
|
13436
|
+
observer.observe(el);
|
|
13437
|
+
return function () {
|
|
13438
|
+
return observer.disconnect();
|
|
13439
|
+
};
|
|
13440
|
+
}, [children, collapsedHeight]);
|
|
13441
|
+
var containerHeight = !isOverflowing ? contentHeight : expanded ? contentHeight : collapsedHeight;
|
|
13442
|
+
var fadeStyle = {
|
|
13443
|
+
position: "absolute",
|
|
13444
|
+
bottom: 0,
|
|
13445
|
+
left: 0,
|
|
13446
|
+
right: 0,
|
|
13447
|
+
height: fadeHeight,
|
|
13448
|
+
background: "linear-gradient(to bottom, rgba(255,255,255,0), ".concat(fadeColor, ")"),
|
|
13449
|
+
pointerEvents: "none",
|
|
13450
|
+
transition: "opacity ".concat(transitionDuration, "ms ease"),
|
|
13451
|
+
opacity: !expanded && isOverflowing ? 1 : 0
|
|
13452
|
+
};
|
|
13453
|
+
var toggleExpanded = function toggleExpanded() {
|
|
13454
|
+
return setExpanded(function (prev) {
|
|
13455
|
+
return !prev;
|
|
13456
|
+
});
|
|
13457
|
+
};
|
|
13458
|
+
var handleKey = function handleKey(e) {
|
|
13459
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
13460
|
+
e.preventDefault();
|
|
13461
|
+
toggleExpanded();
|
|
13462
|
+
}
|
|
13463
|
+
};
|
|
13464
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13465
|
+
ref: containerRef,
|
|
13466
|
+
className: className,
|
|
13467
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13468
|
+
style: {
|
|
13469
|
+
height: containerHeight,
|
|
13470
|
+
overflow: "hidden",
|
|
13471
|
+
transition: "height ".concat(transitionDuration, "ms ease"),
|
|
13472
|
+
position: "relative"
|
|
13473
|
+
},
|
|
13474
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13475
|
+
ref: contentRef,
|
|
13476
|
+
children: children
|
|
13477
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13478
|
+
style: fadeStyle
|
|
13479
|
+
})]
|
|
13480
|
+
}), isOverflowing && /*#__PURE__*/jsxRuntime.jsx(Button$1, {
|
|
13481
|
+
"aria-expanded": expanded,
|
|
13482
|
+
onKeyDown: handleKey,
|
|
13483
|
+
margin: 0,
|
|
13484
|
+
padding: 0,
|
|
13485
|
+
onClick: function onClick() {
|
|
13486
|
+
return setExpanded(function (prev) {
|
|
13487
|
+
return !prev;
|
|
13488
|
+
});
|
|
13489
|
+
},
|
|
13490
|
+
effect: false,
|
|
13491
|
+
color: "abort",
|
|
13492
|
+
scale: 2 / 3,
|
|
13493
|
+
auto: true,
|
|
13494
|
+
children: /*#__PURE__*/jsxRuntime.jsx("b", {
|
|
13495
|
+
children: expanded ? 'Show less' : 'Show more'
|
|
13496
|
+
})
|
|
13497
|
+
})]
|
|
13498
|
+
});
|
|
13499
|
+
};
|
|
13500
|
+
|
|
13393
13501
|
var _excluded$B = ["gap", "children", "direction", "justify", "alignItems", "alignContent", "collapse", "className"];
|
|
13394
13502
|
var wrap = tuple('nowrap', 'wrap', 'wrap-reverse');
|
|
13395
13503
|
var Container = function Container(_ref) {
|
|
@@ -13425,7 +13533,7 @@ var Container = function Container(_ref) {
|
|
|
13425
13533
|
return /*#__PURE__*/jsxRuntime.jsxs(GridBasicItem, _objectSpread2(_objectSpread2({
|
|
13426
13534
|
className: classes
|
|
13427
13535
|
}, props), {}, {
|
|
13428
|
-
children: [collapse > 10 ? /*#__PURE__*/jsxRuntime.jsx(Expandable
|
|
13536
|
+
children: [collapse > 10 ? /*#__PURE__*/jsxRuntime.jsx(Expandable, {
|
|
13429
13537
|
collapsedHeight: collapse,
|
|
13430
13538
|
children: children
|
|
13431
13539
|
}) : children, styles]
|
|
@@ -42458,115 +42566,6 @@ function Clipboard(props) {
|
|
|
42458
42566
|
}), _objectSpread2({}, props));
|
|
42459
42567
|
}
|
|
42460
42568
|
|
|
42461
|
-
var Expandable = function Expandable(_ref) {
|
|
42462
|
-
var children = _ref.children,
|
|
42463
|
-
_ref$collapsedHeight = _ref.collapsedHeight,
|
|
42464
|
-
collapsedHeight = _ref$collapsedHeight === void 0 ? 150 : _ref$collapsedHeight,
|
|
42465
|
-
_ref$fadeHeight = _ref.fadeHeight,
|
|
42466
|
-
fadeHeight = _ref$fadeHeight === void 0 ? 40 : _ref$fadeHeight,
|
|
42467
|
-
className = _ref.className,
|
|
42468
|
-
_ref$transitionDurati = _ref.transitionDuration,
|
|
42469
|
-
transitionDuration = _ref$transitionDurati === void 0 ? 300 : _ref$transitionDurati;
|
|
42470
|
-
var contentRef = React.useRef(null);
|
|
42471
|
-
var containerRef = React.useRef(null);
|
|
42472
|
-
var _useState = React.useState(false),
|
|
42473
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
42474
|
-
expanded = _useState2[0],
|
|
42475
|
-
setExpanded = _useState2[1];
|
|
42476
|
-
var _useState3 = React.useState(false),
|
|
42477
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
42478
|
-
isOverflowing = _useState4[0],
|
|
42479
|
-
setIsOverflowing = _useState4[1];
|
|
42480
|
-
var _useState5 = React.useState(0),
|
|
42481
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
42482
|
-
contentHeight = _useState6[0],
|
|
42483
|
-
setContentHeight = _useState6[1];
|
|
42484
|
-
var _useState7 = React.useState("#fff"),
|
|
42485
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
42486
|
-
fadeColor = _useState8[0],
|
|
42487
|
-
setFadeColor = _useState8[1];
|
|
42488
|
-
|
|
42489
|
-
// Measure content height and detect overflow
|
|
42490
|
-
React.useEffect(function () {
|
|
42491
|
-
var el = contentRef.current;
|
|
42492
|
-
if (!el) return;
|
|
42493
|
-
var updateHeight = function updateHeight() {
|
|
42494
|
-
var _containerRef$current;
|
|
42495
|
-
var scrollHeight = el.scrollHeight;
|
|
42496
|
-
setContentHeight(scrollHeight);
|
|
42497
|
-
setIsOverflowing(scrollHeight > collapsedHeight);
|
|
42498
|
-
|
|
42499
|
-
// Detect background color dynamically
|
|
42500
|
-
var parentBg = window.getComputedStyle((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 ? _containerRef$current : el).backgroundColor;
|
|
42501
|
-
setFadeColor(parentBg || "#fff");
|
|
42502
|
-
};
|
|
42503
|
-
updateHeight();
|
|
42504
|
-
var observer = new ResizeObserver(updateHeight);
|
|
42505
|
-
observer.observe(el);
|
|
42506
|
-
return function () {
|
|
42507
|
-
return observer.disconnect();
|
|
42508
|
-
};
|
|
42509
|
-
}, [children, collapsedHeight]);
|
|
42510
|
-
var containerHeight = !isOverflowing ? contentHeight : expanded ? contentHeight : collapsedHeight;
|
|
42511
|
-
var fadeStyle = {
|
|
42512
|
-
position: "absolute",
|
|
42513
|
-
bottom: 0,
|
|
42514
|
-
left: 0,
|
|
42515
|
-
right: 0,
|
|
42516
|
-
height: fadeHeight,
|
|
42517
|
-
background: "linear-gradient(to bottom, rgba(255,255,255,0), ".concat(fadeColor, ")"),
|
|
42518
|
-
pointerEvents: "none",
|
|
42519
|
-
transition: "opacity ".concat(transitionDuration, "ms ease"),
|
|
42520
|
-
opacity: !expanded && isOverflowing ? 1 : 0
|
|
42521
|
-
};
|
|
42522
|
-
var toggleExpanded = function toggleExpanded() {
|
|
42523
|
-
return setExpanded(function (prev) {
|
|
42524
|
-
return !prev;
|
|
42525
|
-
});
|
|
42526
|
-
};
|
|
42527
|
-
var handleKey = function handleKey(e) {
|
|
42528
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
42529
|
-
e.preventDefault();
|
|
42530
|
-
toggleExpanded();
|
|
42531
|
-
}
|
|
42532
|
-
};
|
|
42533
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
42534
|
-
ref: containerRef,
|
|
42535
|
-
className: className,
|
|
42536
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
42537
|
-
style: {
|
|
42538
|
-
height: containerHeight,
|
|
42539
|
-
overflow: "hidden",
|
|
42540
|
-
transition: "height ".concat(transitionDuration, "ms ease"),
|
|
42541
|
-
position: "relative"
|
|
42542
|
-
},
|
|
42543
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
42544
|
-
ref: contentRef,
|
|
42545
|
-
children: children
|
|
42546
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
42547
|
-
style: fadeStyle
|
|
42548
|
-
})]
|
|
42549
|
-
}), isOverflowing && /*#__PURE__*/jsxRuntime.jsx(Button$1, {
|
|
42550
|
-
"aria-expanded": expanded,
|
|
42551
|
-
onKeyDown: handleKey,
|
|
42552
|
-
margin: 0,
|
|
42553
|
-
padding: 0,
|
|
42554
|
-
onClick: function onClick() {
|
|
42555
|
-
return setExpanded(function (prev) {
|
|
42556
|
-
return !prev;
|
|
42557
|
-
});
|
|
42558
|
-
},
|
|
42559
|
-
effect: false,
|
|
42560
|
-
color: "abort",
|
|
42561
|
-
scale: 2 / 3,
|
|
42562
|
-
auto: true,
|
|
42563
|
-
children: /*#__PURE__*/jsxRuntime.jsx("b", {
|
|
42564
|
-
children: expanded ? 'Show less' : 'Show more'
|
|
42565
|
-
})
|
|
42566
|
-
})]
|
|
42567
|
-
});
|
|
42568
|
-
};
|
|
42569
|
-
|
|
42570
42569
|
exports.AutoComplete = AutoComplete;
|
|
42571
42570
|
exports.Avatar = Avatar;
|
|
42572
42571
|
exports.Badge = Badge;
|
package/esm/container/box.js
CHANGED
|
@@ -7,7 +7,7 @@ import GridBasicItem from "../grid/basic-item";
|
|
|
7
7
|
import useScale, { withScale } from '../use-scale';
|
|
8
8
|
import { useClasses } from '@helpdice/theme';
|
|
9
9
|
import { tuple } from '../utils/prop-types';
|
|
10
|
-
import Expandable from "
|
|
10
|
+
import Expandable from "../expandable";
|
|
11
11
|
var wrap = tuple('nowrap', 'wrap', 'wrap-reverse');
|
|
12
12
|
var Container = function Container(_ref) {
|
|
13
13
|
var _ref$gap = _ref.gap,
|