@homebound/beam 3.21.0 → 3.21.1
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/index.cjs +87 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -11
- package/dist/index.d.ts +17 -11
- package/dist/index.js +74 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -19330,7 +19330,7 @@ function invertSpacing(value) {
|
|
|
19330
19330
|
}
|
|
19331
19331
|
|
|
19332
19332
|
// src/components/Layout/GridTableLayout/GridTableLayout.tsx
|
|
19333
|
-
var
|
|
19333
|
+
var import_utils120 = require("@react-aria/utils");
|
|
19334
19334
|
var import_react103 = __toESM(require("react"), 1);
|
|
19335
19335
|
|
|
19336
19336
|
// src/components/ButtonMenu.tsx
|
|
@@ -19449,6 +19449,12 @@ var DateFilter = class extends BaseFilter {
|
|
|
19449
19449
|
dehydrate(value) {
|
|
19450
19450
|
return value ? { op: value.op, value: dehydratePlainDate(value.value) } : void 0;
|
|
19451
19451
|
}
|
|
19452
|
+
formatSelectedFilterLabel(value) {
|
|
19453
|
+
const { operations, getOperationValue, getOperationLabel } = this.props;
|
|
19454
|
+
const operation = operations.find((o) => getOperationValue(o) === value.op);
|
|
19455
|
+
const opLabel = operation ? getOperationLabel(operation) : String(value.op);
|
|
19456
|
+
return `${opLabel} ${formatDate(value.value, "date")}`;
|
|
19457
|
+
}
|
|
19452
19458
|
render(value, setValue, tid, inModal, vertical) {
|
|
19453
19459
|
const { label, operations, getOperationValue, getOperationLabel, defaultValue } = this.props;
|
|
19454
19460
|
return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_jsx_runtime129.Fragment, { children: [
|
|
@@ -19516,6 +19522,10 @@ var DateRangeFilter = class extends BaseFilter {
|
|
|
19516
19522
|
value: value.value ? { from: dehydratePlainDate(value.value.from), to: dehydratePlainDate(value.value.to) } : void 0
|
|
19517
19523
|
} : void 0;
|
|
19518
19524
|
}
|
|
19525
|
+
formatSelectedFilterLabel(value) {
|
|
19526
|
+
const formatted = formatDateRange(value.value, "date");
|
|
19527
|
+
return formatted ? formatted : void 0;
|
|
19528
|
+
}
|
|
19519
19529
|
render(value, setValue, tid, inModal, vertical) {
|
|
19520
19530
|
const { label, placeholderText, disabledDays, testFieldLabel, defaultValue } = this.props;
|
|
19521
19531
|
return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(import_jsx_runtime130.Fragment, { children: [
|
|
@@ -19557,12 +19567,34 @@ function hydrateDateRange(value) {
|
|
|
19557
19567
|
return { from: hydratedFrom, to: hydratedTo };
|
|
19558
19568
|
}
|
|
19559
19569
|
|
|
19570
|
+
// src/components/Filters/selectedFilterLabelUtils.ts
|
|
19571
|
+
function resolveOptionSelectedFilterLabel(optionsOrLoad, getOptionValue, getOptionLabel, value) {
|
|
19572
|
+
const options = initializeOptions(optionsOrLoad, getOptionValue, getOptionLabel, void 0, false, false);
|
|
19573
|
+
const match = options.find((o) => getOptionValue(o) === value);
|
|
19574
|
+
return match ? getOptionLabel(match) : String(value);
|
|
19575
|
+
}
|
|
19576
|
+
function resolveTreeSelectedFilterLabel(optionsOrLoad, getOptionValue, getOptionLabel, value) {
|
|
19577
|
+
const options = resolveNestedOptions(optionsOrLoad);
|
|
19578
|
+
const match = options.flatMap(flattenOptions).find((o) => getOptionValue(o) === value);
|
|
19579
|
+
return match ? getOptionLabel(match) : String(value);
|
|
19580
|
+
}
|
|
19581
|
+
function resolveNestedOptions(optionsOrLoad) {
|
|
19582
|
+
if (Array.isArray(optionsOrLoad)) {
|
|
19583
|
+
return optionsOrLoad;
|
|
19584
|
+
}
|
|
19585
|
+
return optionsOrLoad.current ?? [];
|
|
19586
|
+
}
|
|
19587
|
+
|
|
19560
19588
|
// src/components/Filters/MultiFilter.tsx
|
|
19561
19589
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
19562
19590
|
function multiFilter(props) {
|
|
19563
19591
|
return (key) => new MultiFilter(key, props);
|
|
19564
19592
|
}
|
|
19565
19593
|
var MultiFilter = class extends BaseFilter {
|
|
19594
|
+
formatSelectedFilterLabel(value) {
|
|
19595
|
+
const { options, getOptionValue, getOptionLabel } = this.props;
|
|
19596
|
+
return resolveOptionSelectedFilterLabel(options, getOptionValue, getOptionLabel, value);
|
|
19597
|
+
}
|
|
19566
19598
|
render(value, setValue, tid, inModal, vertical) {
|
|
19567
19599
|
if (inModal && Array.isArray(this.props.options) && this.props.options.length > 0 && this.props.options.length <= 8) {
|
|
19568
19600
|
const { disabledOptions } = this.props;
|
|
@@ -19616,6 +19648,10 @@ function numberRangeFilter(props) {
|
|
|
19616
19648
|
return (key) => new NumberRangeFilter(key, props);
|
|
19617
19649
|
}
|
|
19618
19650
|
var NumberRangeFilter = class extends BaseFilter {
|
|
19651
|
+
formatSelectedFilterLabel(value) {
|
|
19652
|
+
const parts = [value.min, value.max].filter((n) => n !== void 0);
|
|
19653
|
+
return parts.length > 0 ? parts.join(" \u2013 ") : void 0;
|
|
19654
|
+
}
|
|
19619
19655
|
render(value, setValue, tid, inModal, vertical) {
|
|
19620
19656
|
const {
|
|
19621
19657
|
label,
|
|
@@ -19690,6 +19726,10 @@ function singleFilter(props) {
|
|
|
19690
19726
|
}
|
|
19691
19727
|
var allOption = {};
|
|
19692
19728
|
var SingleFilter = class extends BaseFilter {
|
|
19729
|
+
formatSelectedFilterLabel(value) {
|
|
19730
|
+
const { options, getOptionValue, getOptionLabel } = this.props;
|
|
19731
|
+
return resolveOptionSelectedFilterLabel(options, getOptionValue, getOptionLabel, value);
|
|
19732
|
+
}
|
|
19693
19733
|
render(value, setValue, tid, inModal, vertical) {
|
|
19694
19734
|
const {
|
|
19695
19735
|
label,
|
|
@@ -19726,6 +19766,10 @@ function treeFilter(props) {
|
|
|
19726
19766
|
return (key) => new TreeFilter(key, props);
|
|
19727
19767
|
}
|
|
19728
19768
|
var TreeFilter = class extends BaseFilter {
|
|
19769
|
+
formatSelectedFilterLabel(value) {
|
|
19770
|
+
const { options, getOptionValue, getOptionLabel } = this.props;
|
|
19771
|
+
return resolveTreeSelectedFilterLabel(options, getOptionValue, getOptionLabel, value);
|
|
19772
|
+
}
|
|
19729
19773
|
render(value, setValue, tid, inModal, vertical) {
|
|
19730
19774
|
const { defaultValue, nothingSelectedText, filterBy = "root", ...props } = this.props;
|
|
19731
19775
|
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
@@ -19753,6 +19797,11 @@ function booleanFilter(props) {
|
|
|
19753
19797
|
return (key) => new BooleanFilter(key, props);
|
|
19754
19798
|
}
|
|
19755
19799
|
var BooleanFilter = class extends BaseFilter {
|
|
19800
|
+
formatSelectedFilterLabel(value) {
|
|
19801
|
+
const { options = defaultBooleanOptions } = this.props;
|
|
19802
|
+
const match = options.find(([optionValue]) => optionValue === value);
|
|
19803
|
+
return match ? match[1] : String(value);
|
|
19804
|
+
}
|
|
19756
19805
|
render(value, setValue, tid, inModal, vertical) {
|
|
19757
19806
|
const { options = defaultBooleanOptions, label, defaultValue, ...props } = this.props;
|
|
19758
19807
|
return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
@@ -19791,6 +19840,10 @@ function checkboxFilter(props) {
|
|
|
19791
19840
|
});
|
|
19792
19841
|
}
|
|
19793
19842
|
var CheckboxFilter = class extends BaseFilter {
|
|
19843
|
+
formatSelectedFilterLabel(value) {
|
|
19844
|
+
const { onValue = true } = this.props;
|
|
19845
|
+
return value === onValue ? this.label : void 0;
|
|
19846
|
+
}
|
|
19794
19847
|
render(value, setValue, tid, inModal, vertical) {
|
|
19795
19848
|
const { defaultValue, onValue = true, offValue = void 0, ...props } = this.props;
|
|
19796
19849
|
return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
@@ -19945,6 +19998,10 @@ function toggleFilter(props) {
|
|
|
19945
19998
|
});
|
|
19946
19999
|
}
|
|
19947
20000
|
var ToggleFilter = class extends BaseFilter {
|
|
20001
|
+
formatSelectedFilterLabel(value) {
|
|
20002
|
+
const { onValue = true } = this.props;
|
|
20003
|
+
return value === onValue ? this.label : void 0;
|
|
20004
|
+
}
|
|
19948
20005
|
render(value, setValue, tid, inModal, vertical) {
|
|
19949
20006
|
const { defaultValue, onValue = true, offValue = void 0, ...props } = this.props;
|
|
19950
20007
|
return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
@@ -20076,30 +20133,32 @@ function FilterChips({
|
|
|
20076
20133
|
onClear,
|
|
20077
20134
|
testId
|
|
20078
20135
|
}) {
|
|
20079
|
-
const chips = safeEntries(filterImpls).flatMap(([key]) =>
|
|
20080
|
-
const value = filter[key];
|
|
20081
|
-
if (!isDefined(value)) return [];
|
|
20082
|
-
if (Array.isArray(value)) {
|
|
20083
|
-
return value.map((item) => {
|
|
20084
|
-
const chipKey = `${String(key)}_${item}`;
|
|
20085
|
-
const newArray = value.filter((v) => v !== item);
|
|
20086
|
-
return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(ToggleChip, { text: titleCase(String(item)), onClick: () => onChange(updateFilter(filter, key, newArray.length > 0 ? newArray : void 0)), ...testId[`chip_${chipKey}`] }, chipKey);
|
|
20087
|
-
});
|
|
20088
|
-
}
|
|
20089
|
-
return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(ToggleChip, { text: titleCase(String(value)), onClick: () => onChange(updateFilter(filter, key, void 0)), ...testId[`chip_${String(key)}`] }, String(key));
|
|
20090
|
-
});
|
|
20136
|
+
const chips = safeEntries(filterImpls).flatMap(([key, f]) => chipsForFilterKey(key, f, filter, onChange, testId));
|
|
20091
20137
|
if (chips.length === 0) return null;
|
|
20092
20138
|
return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: "df gap1 fww aic order_1", children: [
|
|
20093
20139
|
chips,
|
|
20094
20140
|
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(Button, { label: "Clear", variant: "tertiary", onClick: onClear, ...testId.clearBtn })
|
|
20095
20141
|
] });
|
|
20096
20142
|
}
|
|
20143
|
+
function chipsForFilterKey(key, f, filter, onChange, testId) {
|
|
20144
|
+
const value = filter[key];
|
|
20145
|
+
if (!isDefined(value)) return [];
|
|
20146
|
+
if (Array.isArray(value)) {
|
|
20147
|
+
return value.flatMap((item) => {
|
|
20148
|
+
const label2 = f.formatSelectedFilterLabel(item);
|
|
20149
|
+
if (!isDefined(label2)) return [];
|
|
20150
|
+
const chipKey = `${String(key)}_${item}`;
|
|
20151
|
+
const newArray = value.filter((v) => v !== item);
|
|
20152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(ToggleChip, { text: label2, onClick: () => onChange(updateFilter(filter, key, newArray.length > 0 ? newArray : void 0)), ...testId[`chip_${chipKey}`] }, chipKey);
|
|
20153
|
+
});
|
|
20154
|
+
}
|
|
20155
|
+
const label = f.formatSelectedFilterLabel(value);
|
|
20156
|
+
if (!isDefined(label)) return [];
|
|
20157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(ToggleChip, { text: label, onClick: () => onChange(updateFilter(filter, key, void 0)), ...testId[`chip_${String(key)}`] }, String(key));
|
|
20158
|
+
}
|
|
20097
20159
|
function buildFilterImpls(filterDefs) {
|
|
20098
20160
|
return Object.fromEntries(safeEntries(filterDefs).map(([key, fn]) => [key, fn(key)]));
|
|
20099
20161
|
}
|
|
20100
|
-
function titleCase(str) {
|
|
20101
|
-
return str.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
20102
|
-
}
|
|
20103
20162
|
function getActiveFilterCount(filter) {
|
|
20104
20163
|
return safeKeys(filter).filter((key) => filter[key] !== void 0).length;
|
|
20105
20164
|
}
|
|
@@ -20579,7 +20638,7 @@ function useSetTableActionsHeight(tableWrapperRef, tableActionsRef, enabled) {
|
|
|
20579
20638
|
tableWrapper.style.removeProperty(beamTableActionsHeightVar);
|
|
20580
20639
|
}
|
|
20581
20640
|
}, [enabled, tableActionsRef, tableWrapperRef]);
|
|
20582
|
-
(0,
|
|
20641
|
+
(0, import_utils120.useResizeObserver)({
|
|
20583
20642
|
ref: tableActionsRef,
|
|
20584
20643
|
onResize: enabled ? syncHeightVar : noop
|
|
20585
20644
|
});
|
|
@@ -21215,7 +21274,7 @@ var import_react111 = require("react");
|
|
|
21215
21274
|
var import_react_aria49 = require("react-aria");
|
|
21216
21275
|
|
|
21217
21276
|
// src/components/Tag.tsx
|
|
21218
|
-
var
|
|
21277
|
+
var import_utils127 = require("@react-aria/utils");
|
|
21219
21278
|
var import_react110 = require("react");
|
|
21220
21279
|
var import_runtime83 = require("@homebound/truss/runtime");
|
|
21221
21280
|
var import_jsx_runtime158 = require("react/jsx-runtime");
|
|
@@ -21231,7 +21290,7 @@ function Tag(props) {
|
|
|
21231
21290
|
const tid = useTestIds(otherProps);
|
|
21232
21291
|
const [showTooltip, setShowTooltip] = (0, import_react110.useState)(false);
|
|
21233
21292
|
const ref = (0, import_react110.useRef)(null);
|
|
21234
|
-
(0,
|
|
21293
|
+
(0, import_utils127.useResizeObserver)({
|
|
21235
21294
|
ref,
|
|
21236
21295
|
onResize: () => {
|
|
21237
21296
|
if (ref.current) {
|
|
@@ -21956,7 +22015,7 @@ function HomeboundLogo(props) {
|
|
|
21956
22015
|
}
|
|
21957
22016
|
|
|
21958
22017
|
// src/components/MaxLines.tsx
|
|
21959
|
-
var
|
|
22018
|
+
var import_utils135 = require("@react-aria/utils");
|
|
21960
22019
|
var import_react120 = require("react");
|
|
21961
22020
|
var import_runtime92 = require("@homebound/truss/runtime");
|
|
21962
22021
|
var import_jsx_runtime167 = require("react/jsx-runtime");
|
|
@@ -21967,7 +22026,7 @@ function MaxLines({
|
|
|
21967
22026
|
const elRef = (0, import_react120.useRef)(null);
|
|
21968
22027
|
const [hasMore, setHasMore] = (0, import_react120.useState)(false);
|
|
21969
22028
|
const [expanded, setExpanded] = (0, import_react120.useState)(false);
|
|
21970
|
-
(0,
|
|
22029
|
+
(0, import_utils135.useLayoutEffect)(() => {
|
|
21971
22030
|
if (!elRef.current) return;
|
|
21972
22031
|
setHasMore(elRef.current.scrollHeight > elRef.current.clientHeight);
|
|
21973
22032
|
}, []);
|
|
@@ -21978,7 +22037,7 @@ function MaxLines({
|
|
|
21978
22037
|
if (!elRef.current) return;
|
|
21979
22038
|
!expanded && setHasMore(elRef.current.scrollHeight > elRef.current.clientHeight);
|
|
21980
22039
|
}, [expanded]);
|
|
21981
|
-
(0,
|
|
22040
|
+
(0, import_utils135.useResizeObserver)({
|
|
21982
22041
|
ref: elRef,
|
|
21983
22042
|
onResize
|
|
21984
22043
|
});
|
|
@@ -22002,7 +22061,7 @@ function MaxLines({
|
|
|
22002
22061
|
var import_change_case8 = require("change-case");
|
|
22003
22062
|
|
|
22004
22063
|
// src/components/AppNav/AppNavGroup.tsx
|
|
22005
|
-
var
|
|
22064
|
+
var import_utils137 = require("@react-aria/utils");
|
|
22006
22065
|
var import_change_case7 = require("change-case");
|
|
22007
22066
|
var import_react123 = require("react");
|
|
22008
22067
|
|
|
@@ -22245,7 +22304,7 @@ function AppNavGroupDisclosure(props) {
|
|
|
22245
22304
|
setContentHeight(`${contentEl.scrollHeight}px`);
|
|
22246
22305
|
}
|
|
22247
22306
|
}, [expanded, contentEl]);
|
|
22248
|
-
(0,
|
|
22307
|
+
(0, import_utils137.useResizeObserver)({
|
|
22249
22308
|
ref: contentRef,
|
|
22250
22309
|
onResize
|
|
22251
22310
|
});
|
|
@@ -22858,7 +22917,7 @@ function PageHeader2(props) {
|
|
|
22858
22917
|
}
|
|
22859
22918
|
|
|
22860
22919
|
// src/components/ScrollShadows.tsx
|
|
22861
|
-
var
|
|
22920
|
+
var import_utils145 = require("@react-aria/utils");
|
|
22862
22921
|
var import_react126 = require("react");
|
|
22863
22922
|
var import_runtime100 = require("@homebound/truss/runtime");
|
|
22864
22923
|
var import_jsx_runtime177 = require("react/jsx-runtime");
|
|
@@ -22947,7 +23006,7 @@ function ScrollShadows(props) {
|
|
|
22947
23006
|
setShowEndShadow(start + boxSize < end);
|
|
22948
23007
|
}, [horizontal]);
|
|
22949
23008
|
const onResize = (0, import_react126.useCallback)(() => scrollRef.current && updateScrollProps(scrollRef.current), [updateScrollProps]);
|
|
22950
|
-
(0,
|
|
23009
|
+
(0, import_utils145.useResizeObserver)({
|
|
22951
23010
|
ref: scrollRef,
|
|
22952
23011
|
onResize
|
|
22953
23012
|
});
|
|
@@ -23856,7 +23915,7 @@ function useAutoHideOnScroll(spacerRef, enabled, getTopOffset) {
|
|
|
23856
23915
|
}
|
|
23857
23916
|
|
|
23858
23917
|
// src/layouts/useMeasuredHeight.ts
|
|
23859
|
-
var
|
|
23918
|
+
var import_utils152 = require("@react-aria/utils");
|
|
23860
23919
|
var import_react134 = require("react");
|
|
23861
23920
|
function useMeasuredHeight(ref, enabled) {
|
|
23862
23921
|
const [height, setHeight] = (0, import_react134.useState)(0);
|
|
@@ -23865,7 +23924,7 @@ function useMeasuredHeight(ref, enabled) {
|
|
|
23865
23924
|
const next = el ? Math.round(el.getBoundingClientRect().height) : 0;
|
|
23866
23925
|
setHeight((prev) => prev === next ? prev : next);
|
|
23867
23926
|
}, [ref]);
|
|
23868
|
-
(0,
|
|
23927
|
+
(0, import_utils152.useResizeObserver)({ ref, onResize: syncElementHeight });
|
|
23869
23928
|
(0, import_react134.useLayoutEffect)(() => {
|
|
23870
23929
|
syncElementHeight();
|
|
23871
23930
|
}, [enabled, syncElementHeight]);
|