@lumx/react 4.30.0-next.2 → 4.30.0-next.3
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/index.d.ts +8 -2
- package/index.js +8 -3
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -6083,6 +6083,12 @@ interface TreeListItemProps extends GenericProps$1, ReactToJSX<TreeListItemProps
|
|
|
6083
6083
|
* In a combobox, the open state resets on each popup open: cache the loaded sub-items.
|
|
6084
6084
|
*/
|
|
6085
6085
|
hasSubItems?: boolean;
|
|
6086
|
+
/**
|
|
6087
|
+
* Open the item at mount. Uncontrolled: it applies at each mount (in a combobox, at each popup
|
|
6088
|
+
* open), it does not call `onOpenChange`, and a change after mount does nothing.
|
|
6089
|
+
* With `hasSubItems`, `onOpenChange` does not fire at mount: load the sub-items yourself.
|
|
6090
|
+
*/
|
|
6091
|
+
defaultOpen?: boolean;
|
|
6086
6092
|
/**
|
|
6087
6093
|
* Called on every open and close by the user (expand toggle, Right, Left, Enter or a click on a
|
|
6088
6094
|
* non-selectable parent item). Not called for the initial state or for the filter.
|
|
@@ -6106,8 +6112,8 @@ interface TreeListItemProps extends GenericProps$1, ReactToJSX<TreeListItemProps
|
|
|
6106
6112
|
* tree `value` holds it. Without, it is not selectable: Enter or a click on a non-selectable parent item
|
|
6107
6113
|
* opens or closes it, and on a non-selectable leaf item only calls `onClick` (e.g. an action such as
|
|
6108
6114
|
* "Create a new list…").
|
|
6109
|
-
* - The open state is internal: a parent item starts open when a sub-item at
|
|
6110
|
-
* In a combobox, it resets on each popup open.
|
|
6115
|
+
* - The open state is internal: a parent item starts open with `defaultOpen`, or when a sub-item at
|
|
6116
|
+
* any depth is selected. In a combobox, it resets on each popup open.
|
|
6111
6117
|
* - Touch screen readers: TalkBack (Chrome) can open and close the parent items. On iOS, a user can
|
|
6112
6118
|
* only reach the sub-items of a selectable parent item through the filter. To support it, use a
|
|
6113
6119
|
* non-selectable parent item with an "All <name>" leaf item that carries the parent value.
|
package/index.js
CHANGED
|
@@ -24360,6 +24360,7 @@ function setupTreeList(options = {}) {
|
|
|
24360
24360
|
function registerTreeItem(element, itemOptions) {
|
|
24361
24361
|
const {
|
|
24362
24362
|
isParent,
|
|
24363
|
+
defaultOpen,
|
|
24363
24364
|
onOpenChange,
|
|
24364
24365
|
onChange
|
|
24365
24366
|
} = itemOptions;
|
|
@@ -24369,7 +24370,7 @@ function setupTreeList(options = {}) {
|
|
|
24369
24370
|
const hasSelectedBelow = () => hasSelectedSubItem(element);
|
|
24370
24371
|
let filterState = NO_FILTER_STATE;
|
|
24371
24372
|
/** Open state set by the user (or the initial state) without a filter. */
|
|
24372
|
-
let userOpen = hasSelectedBelow();
|
|
24373
|
+
let userOpen = defaultOpen || hasSelectedBelow();
|
|
24373
24374
|
/** Open state set by the user during a filter (lasts until the next change of the filter text). */
|
|
24374
24375
|
let filterOverride = null;
|
|
24375
24376
|
/**
|
|
@@ -24828,8 +24829,8 @@ function isTreeListHandle(handle) {
|
|
|
24828
24829
|
* tree `value` holds it. Without, it is not selectable: Enter or a click on a non-selectable parent item
|
|
24829
24830
|
* opens or closes it, and on a non-selectable leaf item only calls `onClick` (e.g. an action such as
|
|
24830
24831
|
* "Create a new list…").
|
|
24831
|
-
* - The open state is internal: a parent item starts open when a sub-item at
|
|
24832
|
-
* In a combobox, it resets on each popup open.
|
|
24832
|
+
* - The open state is internal: a parent item starts open with `defaultOpen`, or when a sub-item at
|
|
24833
|
+
* any depth is selected. In a combobox, it resets on each popup open.
|
|
24833
24834
|
* - Touch screen readers: TalkBack (Chrome) can open and close the parent items. On iOS, a user can
|
|
24834
24835
|
* only reach the sub-items of a selectable parent item through the filter. To support it, use a
|
|
24835
24836
|
* non-selectable parent item with an "All <name>" leaf item that carries the parent value.
|
|
@@ -24844,6 +24845,7 @@ const TreeListItem = forwardRef((props, ref) => {
|
|
|
24844
24845
|
children,
|
|
24845
24846
|
value,
|
|
24846
24847
|
hasSubItems,
|
|
24848
|
+
defaultOpen,
|
|
24847
24849
|
onOpenChange,
|
|
24848
24850
|
onClick,
|
|
24849
24851
|
before,
|
|
@@ -24883,10 +24885,12 @@ const TreeListItem = forwardRef((props, ref) => {
|
|
|
24883
24885
|
// Latest props read by the controller.
|
|
24884
24886
|
const latestProps = useRef({
|
|
24885
24887
|
isParent,
|
|
24888
|
+
defaultOpen,
|
|
24886
24889
|
onOpenChange
|
|
24887
24890
|
});
|
|
24888
24891
|
latestProps.current = {
|
|
24889
24892
|
isParent,
|
|
24893
|
+
defaultOpen,
|
|
24890
24894
|
onOpenChange
|
|
24891
24895
|
};
|
|
24892
24896
|
const [state, setState] = useState({
|
|
@@ -24900,6 +24904,7 @@ const TreeListItem = forwardRef((props, ref) => {
|
|
|
24900
24904
|
if (!element || !tree) return undefined;
|
|
24901
24905
|
const controller = tree.registerTreeItem(element, {
|
|
24902
24906
|
isParent: () => latestProps.current.isParent,
|
|
24907
|
+
defaultOpen: latestProps.current.defaultOpen,
|
|
24903
24908
|
onOpenChange: isOpen => latestProps.current.onOpenChange?.(isOpen),
|
|
24904
24909
|
onChange: setState
|
|
24905
24910
|
});
|