@homebound/beam 2.91.0 → 2.91.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.
|
@@ -7,6 +7,15 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
function useModal() {
|
|
8
8
|
const { modalState, modalCanCloseChecks } = (0, BeamContext_1.useBeamContext)();
|
|
9
9
|
const lastCanClose = (0, react_1.useRef)();
|
|
10
|
+
(0, react_1.useEffect)(() => {
|
|
11
|
+
// Capture the lastCanClose from when the `useEffect` runs, so that when our cleanup
|
|
12
|
+
// lambda is called later, we clean up the as-when-scheduled value, and not the super-latest
|
|
13
|
+
// value, because then we need up nuking the actually valid current value.
|
|
14
|
+
const { current } = lastCanClose;
|
|
15
|
+
return () => {
|
|
16
|
+
modalCanCloseChecks.current = modalCanCloseChecks.current.filter((c) => c !== current);
|
|
17
|
+
};
|
|
18
|
+
}, [modalCanCloseChecks]);
|
|
10
19
|
return (0, react_1.useMemo)(() => ({
|
|
11
20
|
openModal(props) {
|
|
12
21
|
// TODO Check already open?
|
|
@@ -340,7 +340,7 @@ function calcVirtualGridColumns(columns, firstLastColumnWidth) {
|
|
|
340
340
|
else {
|
|
341
341
|
throw new Error("as=virtual only supports px, percentage, or fr units");
|
|
342
342
|
}
|
|
343
|
-
}, { claimedPercentages: 0, claimedPixels: 0, totalFr: 0 });
|
|
343
|
+
}, { claimedPercentages: 0, claimedPixels: firstLastColumnWidth ? firstLastColumnWidth * 2 : 0, totalFr: 0 });
|
|
344
344
|
// This is our "fake but for some reason it lines up better" fr calc
|
|
345
345
|
function fr(myFr) {
|
|
346
346
|
return `calc((100% - ${claimedPercentages}% - ${claimedPixels}px) * (${myFr} / ${totalFr}))`;
|
|
@@ -12,7 +12,7 @@ export interface ChipSelectFieldProps<O, V extends Value> {
|
|
|
12
12
|
onBlur?: () => void;
|
|
13
13
|
onFocus?: () => void;
|
|
14
14
|
clearable?: boolean;
|
|
15
|
-
onCreateNew?: (value: string) => Promise<
|
|
15
|
+
onCreateNew?: (value: string) => Promise<void>;
|
|
16
16
|
disabled?: boolean | ReactNode;
|
|
17
17
|
}
|
|
18
18
|
export declare function ChipSelectField<O, V extends Value>(props: ChipSelectFieldProps<O, V>): JSX.Element;
|
|
@@ -138,8 +138,7 @@ function ChipSelectField(props) {
|
|
|
138
138
|
(_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
139
139
|
}, [setShowInput, setInputValue]);
|
|
140
140
|
const field = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showInput && onCreateNew && ((0, jsx_runtime_1.jsx)(ChipTextField_1.ChipTextField, Object.assign({ autoFocus: true, label: "Add new", value: inputValue, onChange: setInputValue, onEnter: async () => {
|
|
141
|
-
|
|
142
|
-
listData.insertBefore(createNewOpt.id, newOption);
|
|
141
|
+
await onCreateNew(inputValue);
|
|
143
142
|
removeCreateNewField();
|
|
144
143
|
}, onBlur: removeCreateNewField }, tid.createNewField), void 0)), (0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: wrapperRef, css: {
|
|
145
144
|
...chipStyles,
|
|
@@ -71,10 +71,12 @@ function SelectFieldBase(props) {
|
|
|
71
71
|
selectedKeys: [firstKey],
|
|
72
72
|
selectedOptions: firstSelectedOption ? [firstSelectedOption] : [],
|
|
73
73
|
});
|
|
74
|
-
// When a single select menu item changes, then blur the field
|
|
75
|
-
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
76
74
|
}
|
|
77
75
|
selectionChanged && onSelect([...keys.values()].map(Value_1.keyToValue));
|
|
76
|
+
if (!multiselect) {
|
|
77
|
+
// When a single select menu item changes, then blur the field AFTER `onSelect` has been called
|
|
78
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
79
|
+
}
|
|
78
80
|
}
|
|
79
81
|
function onInputChange(value) {
|
|
80
82
|
setFieldState((prevState) => ({
|