@homebound/beam 2.132.1 → 2.132.4
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.
|
@@ -31,7 +31,7 @@ function ScrollableParent(props) {
|
|
|
31
31
|
(0, react_1.useEffect)(() => {
|
|
32
32
|
scrollableRef.current.appendChild(scrollableEl);
|
|
33
33
|
}, [scrollableEl]);
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)(ScrollableParentContext.Provider, Object.assign({ value: context }, { children: (0, jsx_runtime_1.jsxs)(Tag, Object.assign({ css: { ...Css_1.Css.mh0.mw0.fg1.df.fdc.$, ...otherXss } }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(ScrollableParentContext.Provider, Object.assign({ value: context }, { children: (0, jsx_runtime_1.jsxs)(Tag, Object.assign({ css: { ...Css_1.Css.mh0.mw0.fg1.df.fdc.$, ...otherXss } }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.pl(context.pl).pr(context.pr).if(!hasScrollableContent).h100.overflowAuto.$ }, { children: children }), void 0), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.fg1.overflowAuto.pl(context.pl).pr(context.pr).$, ref: scrollableRef }, void 0)] }), void 0) }), void 0));
|
|
35
35
|
}
|
|
36
36
|
exports.ScrollableParent = ScrollableParent;
|
|
37
37
|
function useScrollableParent() {
|
|
@@ -126,19 +126,19 @@ class RowState {
|
|
|
126
126
|
}
|
|
127
127
|
// Should be called in an Observer/useComputed to trigger re-renders
|
|
128
128
|
isCollapsed(id) {
|
|
129
|
-
return this.collapsedRows.has(id)
|
|
129
|
+
return this.collapsedRows.has(id);
|
|
130
130
|
}
|
|
131
131
|
toggleCollapsed(id) {
|
|
132
132
|
const collapsedIds = [...this.collapsedRows.values()];
|
|
133
133
|
// We have different behavior when going from expand/collapse all.
|
|
134
134
|
if (id === "header") {
|
|
135
|
-
const isAllCollapsed = collapsedIds
|
|
135
|
+
const isAllCollapsed = collapsedIds.includes("header");
|
|
136
136
|
if (isAllCollapsed) {
|
|
137
137
|
// Expand all means keep `collapsedIds` empty
|
|
138
138
|
collapsedIds.splice(0, collapsedIds.length);
|
|
139
139
|
}
|
|
140
140
|
else {
|
|
141
|
-
// Otherwise push `header`
|
|
141
|
+
// Otherwise push `header` to the list as a hint that we're in the collapsed-all state
|
|
142
142
|
collapsedIds.push("header");
|
|
143
143
|
// Find all non-leaf rows so that toggling "all collapsed" -> "all not collapsed" opens
|
|
144
144
|
// the parent rows of any level.
|
|
@@ -164,6 +164,16 @@ class RowState {
|
|
|
164
164
|
else {
|
|
165
165
|
collapsedIds.splice(i, 1);
|
|
166
166
|
}
|
|
167
|
+
// If all rows have been expanded individually, but the 'header' was collapsed, then remove the header from the collapsedIds so it reverts to the expanded state
|
|
168
|
+
if (collapsedIds.length === 1 && collapsedIds[0] === "header") {
|
|
169
|
+
collapsedIds.splice(0, 1);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
// If every top level child has been collapsed, then push "header" into the array to be considered collapsed as well.
|
|
173
|
+
if (this.rows.every((maybeParent) => (maybeParent.children ? collapsedIds.includes(maybeParent.id) : true))) {
|
|
174
|
+
collapsedIds.push("header");
|
|
175
|
+
}
|
|
176
|
+
}
|
|
167
177
|
}
|
|
168
178
|
this.collapsedRows.replace(collapsedIds);
|
|
169
179
|
if (this.persistCollapse) {
|
|
@@ -8,7 +8,7 @@ const useTestIds_1 = require("../utils/useTestIds");
|
|
|
8
8
|
/** Renders a list of `Chip`s, with wrapping & appropriate margin between each `Chip`. */
|
|
9
9
|
function ToggleChips(props) {
|
|
10
10
|
const { values, getLabel, onRemove, xss } = props;
|
|
11
|
-
const tid = (0, useTestIds_1.useTestIds)(props, "
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: { ...Css_1.Css.df.add(
|
|
11
|
+
const tid = (0, useTestIds_1.useTestIds)(props, "toggleChips");
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: { ...Css_1.Css.df.add("flexWrap", "wrap").gap1.$, ...xss } }, tid, { children: values.map((value) => ((0, jsx_runtime_1.jsx)(ToggleChip_1.ToggleChip, Object.assign({ text: getLabel(value), onClick: () => onRemove(value) }, tid.chip), getLabel(value)))) }), void 0));
|
|
13
13
|
}
|
|
14
14
|
exports.ToggleChips = ToggleChips;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homebound/beam",
|
|
3
|
-
"version": "2.132.
|
|
3
|
+
"version": "2.132.4",
|
|
4
4
|
"author": "Homebound",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
"identity-obj-proxy": "^3.0.0",
|
|
117
117
|
"jest": "^26.6.3",
|
|
118
118
|
"jest-chain": "^1.1.5",
|
|
119
|
+
"jest-watch-typeahead": "^0.6.5",
|
|
119
120
|
"mobx": "^6.3.2",
|
|
120
121
|
"mobx-react": "^7.2.0",
|
|
121
122
|
"prettier": "^2.2.1",
|