@homebound/beam 3.32.0 → 3.33.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 +212 -206
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +43 -37
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -8,7 +8,7 @@ import { VirtuosoHandle, ListRange } from 'react-virtuoso';
|
|
|
8
8
|
import { AriaButtonProps } from '@react-types/button';
|
|
9
9
|
import { MenuTriggerState } from 'react-stately';
|
|
10
10
|
import { FieldState, ListFieldState, ObjectState } from '@homebound/form-state';
|
|
11
|
-
import { NumberFieldAria } from '
|
|
11
|
+
import { NumberFieldAria } from 'react-aria';
|
|
12
12
|
|
|
13
13
|
/** Given a type X, and the user's proposed type T, only allow keys in X and nothing else. */
|
|
14
14
|
type Only<X, T> = X & Record<Exclude<keyof T, keyof X | "__kind">, never>;
|
|
@@ -7221,7 +7221,14 @@ type TreeSelectFieldProps<O, V extends Value> = {
|
|
|
7221
7221
|
/** Which selected options to display as chips in the input field when not focused.
|
|
7222
7222
|
* @default root */
|
|
7223
7223
|
chipDisplay?: "all" | "leaf" | "root";
|
|
7224
|
-
|
|
7224
|
+
/**
|
|
7225
|
+
* Options to disable. Can be a list of `V` values, or `{ value, reason }` tuples where the
|
|
7226
|
+
* `reason` is shown as a tooltip when the user hovers the disabled option.
|
|
7227
|
+
*/
|
|
7228
|
+
disabledOptions?: (V | {
|
|
7229
|
+
value: V;
|
|
7230
|
+
reason: string;
|
|
7231
|
+
})[];
|
|
7225
7232
|
groupOptions?: V[];
|
|
7226
7233
|
} & BeamFocusableProps & PresentationFieldProps;
|
|
7227
7234
|
declare function TreeSelectField<O, V extends Value>(props: TreeSelectFieldProps<O, V>): JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { VirtuosoHandle, ListRange } from 'react-virtuoso';
|
|
|
8
8
|
import { AriaButtonProps } from '@react-types/button';
|
|
9
9
|
import { MenuTriggerState } from 'react-stately';
|
|
10
10
|
import { FieldState, ListFieldState, ObjectState } from '@homebound/form-state';
|
|
11
|
-
import { NumberFieldAria } from '
|
|
11
|
+
import { NumberFieldAria } from 'react-aria';
|
|
12
12
|
|
|
13
13
|
/** Given a type X, and the user's proposed type T, only allow keys in X and nothing else. */
|
|
14
14
|
type Only<X, T> = X & Record<Exclude<keyof T, keyof X | "__kind">, never>;
|
|
@@ -7221,7 +7221,14 @@ type TreeSelectFieldProps<O, V extends Value> = {
|
|
|
7221
7221
|
/** Which selected options to display as chips in the input field when not focused.
|
|
7222
7222
|
* @default root */
|
|
7223
7223
|
chipDisplay?: "all" | "leaf" | "root";
|
|
7224
|
-
|
|
7224
|
+
/**
|
|
7225
|
+
* Options to disable. Can be a list of `V` values, or `{ value, reason }` tuples where the
|
|
7226
|
+
* `reason` is shown as a tooltip when the user hovers the disabled option.
|
|
7227
|
+
*/
|
|
7228
|
+
disabledOptions?: (V | {
|
|
7229
|
+
value: V;
|
|
7230
|
+
reason: string;
|
|
7231
|
+
})[];
|
|
7225
7232
|
groupOptions?: V[];
|
|
7226
7233
|
} & BeamFocusableProps & PresentationFieldProps;
|
|
7227
7234
|
declare function TreeSelectField<O, V extends Value>(props: TreeSelectFieldProps<O, V>): JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -7720,8 +7720,8 @@ function MenuSectionImpl(props) {
|
|
|
7720
7720
|
}
|
|
7721
7721
|
|
|
7722
7722
|
// src/inputs/internal/MenuSearchField.tsx
|
|
7723
|
-
import { useTextField } from "@react-aria/textfield";
|
|
7724
7723
|
import { useRef as useRef11 } from "react";
|
|
7724
|
+
import { useTextField } from "react-aria";
|
|
7725
7725
|
|
|
7726
7726
|
// src/inputs/TextFieldBase.tsx
|
|
7727
7727
|
import { useState as useState11 } from "react";
|
|
@@ -11642,7 +11642,8 @@ function TreeOption(props) {
|
|
|
11642
11642
|
const {
|
|
11643
11643
|
item,
|
|
11644
11644
|
state,
|
|
11645
|
-
allowCollapsing = true
|
|
11645
|
+
allowCollapsing = true,
|
|
11646
|
+
disabledReason
|
|
11646
11647
|
} = props;
|
|
11647
11648
|
const leveledOption = item.value;
|
|
11648
11649
|
if (!leveledOption) return null;
|
|
@@ -11699,43 +11700,47 @@ function TreeOption(props) {
|
|
|
11699
11700
|
}]
|
|
11700
11701
|
}
|
|
11701
11702
|
};
|
|
11702
|
-
return
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
e
|
|
11706
|
-
|
|
11707
|
-
}, ...trussProps34({
|
|
11708
|
-
...{
|
|
11709
|
-
display: "df",
|
|
11710
|
-
alignItems: "aic",
|
|
11711
|
-
justifyContent: "jcsb",
|
|
11712
|
-
gap: "gap1",
|
|
11713
|
-
paddingLeft: ["pl_var", {
|
|
11714
|
-
"--paddingLeft": `${16 + level * 8}px`
|
|
11715
|
-
}],
|
|
11716
|
-
minHeight: "mh_42px",
|
|
11717
|
-
outline: "outline0",
|
|
11718
|
-
cursor: "cursorPointer",
|
|
11719
|
-
fontWeight: "fw4",
|
|
11720
|
-
fontSize: "fz_14px",
|
|
11721
|
-
lineHeight: "lh_20px"
|
|
11722
|
-
},
|
|
11723
|
-
...listItemStyles.item,
|
|
11724
|
-
...isHovered && (!isDisabled || isGroup) ? listItemStyles.hover : {},
|
|
11725
|
-
...isFocused && !isGroup ? listItemStyles.focus : {},
|
|
11726
|
-
...isDisabled && !isGroup ? listItemStyles.disabled : {}
|
|
11727
|
-
}), children: [
|
|
11728
|
-
allowCollapsing && /* @__PURE__ */ jsx52("span", { className: "w_18px fs0 df aic", children: canCollapse && /* @__PURE__ */ jsx52("button", { onClick: (e) => {
|
|
11703
|
+
return maybeTooltip({
|
|
11704
|
+
title: !isGroup ? disabledReason : void 0,
|
|
11705
|
+
placement: "right",
|
|
11706
|
+
children: /* @__PURE__ */ jsxs33("li", { ...hoverProps, onClick: (e) => {
|
|
11707
|
+
if (!isGroup) return;
|
|
11729
11708
|
e.preventDefault();
|
|
11730
11709
|
e.stopPropagation();
|
|
11731
11710
|
toggleCollapsed();
|
|
11732
|
-
|
|
11733
|
-
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
|
|
11711
|
+
}, ...trussProps34({
|
|
11712
|
+
...{
|
|
11713
|
+
display: "df",
|
|
11714
|
+
alignItems: "aic",
|
|
11715
|
+
justifyContent: "jcsb",
|
|
11716
|
+
gap: "gap1",
|
|
11717
|
+
paddingLeft: ["pl_var", {
|
|
11718
|
+
"--paddingLeft": `${16 + level * 8}px`
|
|
11719
|
+
}],
|
|
11720
|
+
minHeight: "mh_42px",
|
|
11721
|
+
outline: "outline0",
|
|
11722
|
+
cursor: "cursorPointer",
|
|
11723
|
+
fontWeight: "fw4",
|
|
11724
|
+
fontSize: "fz_14px",
|
|
11725
|
+
lineHeight: "lh_20px"
|
|
11726
|
+
},
|
|
11727
|
+
...listItemStyles.item,
|
|
11728
|
+
...isHovered && (!isDisabled || isGroup) ? listItemStyles.hover : {},
|
|
11729
|
+
...isFocused && !isGroup ? listItemStyles.focus : {},
|
|
11730
|
+
...isDisabled && !isGroup ? listItemStyles.disabled : {}
|
|
11731
|
+
}), children: [
|
|
11732
|
+
allowCollapsing && /* @__PURE__ */ jsx52("span", { className: "w_18px fs0 df aic", children: canCollapse && /* @__PURE__ */ jsx52("button", { onClick: (e) => {
|
|
11733
|
+
e.preventDefault();
|
|
11734
|
+
e.stopPropagation();
|
|
11735
|
+
toggleCollapsed();
|
|
11736
|
+
return false;
|
|
11737
|
+
}, className: "br4 h_16px w_16px bgTransparent h_bgGray300", ...tid[`collapseToggle_${item.key}`], children: /* @__PURE__ */ jsx52(Icon, { icon: collapsedKeys.includes(item.key) ? "triangleRight" : "triangleDown", inc: 2 }) }) }),
|
|
11738
|
+
/* @__PURE__ */ jsxs33("span", { className: "df aic gap1 h100 fg1 pt1 pb1 pr2", ref, ...optionProps, "data-label": item.textValue, children: [
|
|
11739
|
+
!isGroup && /* @__PURE__ */ jsx52(StyledCheckbox, { isDisabled, isSelected, isIndeterminate, ...tid[item.key.toString()] }),
|
|
11740
|
+
/* @__PURE__ */ jsx52("div", { className: "pl1", children: item.rendered })
|
|
11741
|
+
] })
|
|
11737
11742
|
] })
|
|
11738
|
-
|
|
11743
|
+
});
|
|
11739
11744
|
}
|
|
11740
11745
|
function hasSelectedChildren(childOption, state, getOptionValue) {
|
|
11741
11746
|
if (childOption.children && childOption.children.length > 0) {
|
|
@@ -11833,7 +11838,8 @@ function VirtualizedOptions(props) {
|
|
|
11833
11838
|
{
|
|
11834
11839
|
item,
|
|
11835
11840
|
state,
|
|
11836
|
-
allowCollapsing
|
|
11841
|
+
allowCollapsing,
|
|
11842
|
+
disabledReason: disabledOptionsWithReasons[item.key]
|
|
11837
11843
|
},
|
|
11838
11844
|
item.key
|
|
11839
11845
|
);
|
|
@@ -12414,7 +12420,7 @@ function TreeSelectFieldBase(props) {
|
|
|
12414
12420
|
onClose: () => state.toggle(),
|
|
12415
12421
|
isOpen: state.isOpen,
|
|
12416
12422
|
minWidth: 320,
|
|
12417
|
-
children: /* @__PURE__ */ jsx57(ListBox, { ...listBoxProps, positionProps, state, listBoxRef, selectedOptions: fieldState.selectedChipOptions, getOptionLabel, getOptionValue: (o) => valueToKey(getOptionValue(o)), horizontalLayout: labelStyle === "left", loading: fieldState.optionsLoading, allowCollapsing: fieldState.allowCollapsing, isTree: true })
|
|
12423
|
+
children: /* @__PURE__ */ jsx57(ListBox, { ...listBoxProps, positionProps, state, listBoxRef, selectedOptions: fieldState.selectedChipOptions, getOptionLabel, getOptionValue: (o) => valueToKey(getOptionValue(o)), horizontalLayout: labelStyle === "left", loading: fieldState.optionsLoading, allowCollapsing: fieldState.allowCollapsing, disabledOptionsWithReasons, isTree: true })
|
|
12418
12424
|
}
|
|
12419
12425
|
)
|
|
12420
12426
|
] });
|